aclocal.m4 revision 972599cf
1972599cfSmrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2972599cfSmrg
3972599cfSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4972599cfSmrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
5972599cfSmrg# Inc.
6972599cfSmrg# This file is free software; the Free Software Foundation
7972599cfSmrg# gives unlimited permission to copy and/or distribute it,
8972599cfSmrg# with or without modifications, as long as this notice is preserved.
9972599cfSmrg
10972599cfSmrg# This program is distributed in the hope that it will be useful,
11972599cfSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12972599cfSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13972599cfSmrg# PARTICULAR PURPOSE.
14972599cfSmrg
15972599cfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16972599cfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17972599cfSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18972599cfSmrg[m4_warning([this file was generated for autoconf 2.68.
19972599cfSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20972599cfSmrgIf you have problems, you may need to regenerate the build system entirely.
21972599cfSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22972599cfSmrg
23972599cfSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
24972599cfSmrg# Foundation, Inc.
25972599cfSmrg#
26972599cfSmrg# This file is free software; the Free Software Foundation
27972599cfSmrg# gives unlimited permission to copy and/or distribute it,
28972599cfSmrg# with or without modifications, as long as this notice is preserved.
29972599cfSmrg
30972599cfSmrg# serial 1
31972599cfSmrg
32972599cfSmrg# AM_AUTOMAKE_VERSION(VERSION)
33972599cfSmrg# ----------------------------
34972599cfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
35972599cfSmrg# generated from the m4 files accompanying Automake X.Y.
36972599cfSmrg# (This private macro should not be called outside this file.)
37972599cfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
38972599cfSmrg[am__api_version='1.11'
39972599cfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40972599cfSmrgdnl require some minimum version.  Point them to the right macro.
41972599cfSmrgm4_if([$1], [1.11.2], [],
42972599cfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43972599cfSmrg])
44972599cfSmrg
45972599cfSmrg# _AM_AUTOCONF_VERSION(VERSION)
46972599cfSmrg# -----------------------------
47972599cfSmrg# aclocal traces this macro to find the Autoconf version.
48972599cfSmrg# This is a private macro too.  Using m4_define simplifies
49972599cfSmrg# the logic in aclocal, which can simply ignore this definition.
50972599cfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
51972599cfSmrg
52972599cfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
53972599cfSmrg# -------------------------------
54972599cfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
55972599cfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56972599cfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
57972599cfSmrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
58972599cfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
59972599cfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
60972599cfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61972599cfSmrg
62972599cfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
63972599cfSmrg
64972599cfSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65972599cfSmrg#
66972599cfSmrg# This file is free software; the Free Software Foundation
67972599cfSmrg# gives unlimited permission to copy and/or distribute it,
68972599cfSmrg# with or without modifications, as long as this notice is preserved.
69972599cfSmrg
70972599cfSmrg# serial 1
71972599cfSmrg
72972599cfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73972599cfSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74972599cfSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75972599cfSmrg#
76972599cfSmrg# Of course, Automake must honor this variable whenever it calls a
77972599cfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
78972599cfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
79972599cfSmrg# depending on how configure is run.  This is pretty annoying, since
80972599cfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81972599cfSmrg# source directory, any form will work fine, but in subdirectories a
82972599cfSmrg# relative path needs to be adjusted first.
83972599cfSmrg#
84972599cfSmrg# $ac_aux_dir/missing
85972599cfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
86972599cfSmrg# $top_srcdir/$ac_aux_dir/missing
87972599cfSmrg#    fails if $ac_aux_dir is absolute,
88972599cfSmrg#    fails when called from a subdirectory in a VPATH build with
89972599cfSmrg#          a relative $ac_aux_dir
90972599cfSmrg#
91972599cfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92972599cfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
93972599cfSmrg# harmless because $srcdir is `.', but things will broke when you
94972599cfSmrg# start a VPATH build or use an absolute $srcdir.
95972599cfSmrg#
96972599cfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97972599cfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98972599cfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99972599cfSmrg# and then we would define $MISSING as
100972599cfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
101972599cfSmrg# This will work as long as MISSING is not called from configure, because
102972599cfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
103972599cfSmrg# However there are other variables, like CC, which are often used in
104972599cfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
105972599cfSmrg#
106972599cfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
107972599cfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
108972599cfSmrg# configured tree to be moved without reconfiguration.
109972599cfSmrg
110972599cfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
111972599cfSmrg[dnl Rely on autoconf to set up CDPATH properly.
112972599cfSmrgAC_PREREQ([2.50])dnl
113972599cfSmrg# expand $ac_aux_dir to an absolute path
114972599cfSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
115972599cfSmrg])
116972599cfSmrg
117972599cfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
118972599cfSmrg
119972599cfSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120972599cfSmrg# Free Software Foundation, Inc.
121972599cfSmrg#
122972599cfSmrg# This file is free software; the Free Software Foundation
123972599cfSmrg# gives unlimited permission to copy and/or distribute it,
124972599cfSmrg# with or without modifications, as long as this notice is preserved.
125972599cfSmrg
126972599cfSmrg# serial 9
127972599cfSmrg
128972599cfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129972599cfSmrg# -------------------------------------
130972599cfSmrg# Define a conditional.
131972599cfSmrgAC_DEFUN([AM_CONDITIONAL],
132972599cfSmrg[AC_PREREQ(2.52)dnl
133972599cfSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
134972599cfSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135972599cfSmrgAC_SUBST([$1_TRUE])dnl
136972599cfSmrgAC_SUBST([$1_FALSE])dnl
137972599cfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138972599cfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
139972599cfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
140972599cfSmrgif $2; then
141972599cfSmrg  $1_TRUE=
142972599cfSmrg  $1_FALSE='#'
143972599cfSmrgelse
144972599cfSmrg  $1_TRUE='#'
145972599cfSmrg  $1_FALSE=
146972599cfSmrgfi
147972599cfSmrgAC_CONFIG_COMMANDS_PRE(
148972599cfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149972599cfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
150972599cfSmrgUsually this means the macro was only invoked conditionally.]])
151972599cfSmrgfi])])
152972599cfSmrg
153972599cfSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
154972599cfSmrg# 2010, 2011 Free Software Foundation, Inc.
155972599cfSmrg#
156972599cfSmrg# This file is free software; the Free Software Foundation
157972599cfSmrg# gives unlimited permission to copy and/or distribute it,
158972599cfSmrg# with or without modifications, as long as this notice is preserved.
159972599cfSmrg
160972599cfSmrg# serial 12
161972599cfSmrg
162972599cfSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163972599cfSmrg# written in clear, in which case automake, when reading aclocal.m4,
164972599cfSmrg# will think it sees a *use*, and therefore will trigger all it's
165972599cfSmrg# C support machinery.  Also note that it means that autoscan, seeing
166972599cfSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167972599cfSmrg
168972599cfSmrg
169972599cfSmrg# _AM_DEPENDENCIES(NAME)
170972599cfSmrg# ----------------------
171972599cfSmrg# See how the compiler implements dependency checking.
172972599cfSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
173972599cfSmrg# We try a few techniques and use that to set a single cache variable.
174972599cfSmrg#
175972599cfSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176972599cfSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177972599cfSmrg# dependency, and given that the user is not expected to run this macro,
178972599cfSmrg# just rely on AC_PROG_CC.
179972599cfSmrgAC_DEFUN([_AM_DEPENDENCIES],
180972599cfSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
181972599cfSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182972599cfSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
183972599cfSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
184972599cfSmrg
185972599cfSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186972599cfSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187972599cfSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
188972599cfSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189972599cfSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190972599cfSmrg                   [depcc="$$1"   am_compiler_list=])
191972599cfSmrg
192972599cfSmrgAC_CACHE_CHECK([dependency style of $depcc],
193972599cfSmrg               [am_cv_$1_dependencies_compiler_type],
194972599cfSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195972599cfSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
196972599cfSmrg  # making bogus files that we don't know about and never remove.  For
197972599cfSmrg  # instance it was reported that on HP-UX the gcc test will end up
198972599cfSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
199972599cfSmrg  # in D'.
200972599cfSmrg  rm -rf conftest.dir
201972599cfSmrg  mkdir conftest.dir
202972599cfSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
203972599cfSmrg  # using a relative directory.
204972599cfSmrg  cp "$am_depcomp" conftest.dir
205972599cfSmrg  cd conftest.dir
206972599cfSmrg  # We will build objects and dependencies in a subdirectory because
207972599cfSmrg  # it helps to detect inapplicable dependency modes.  For instance
208972599cfSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
209972599cfSmrg  # side effect of compilation, but ICC will put the dependencies in
210972599cfSmrg  # the current directory while Tru64 will put them in the object
211972599cfSmrg  # directory.
212972599cfSmrg  mkdir sub
213972599cfSmrg
214972599cfSmrg  am_cv_$1_dependencies_compiler_type=none
215972599cfSmrg  if test "$am_compiler_list" = ""; then
216972599cfSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217972599cfSmrg  fi
218972599cfSmrg  am__universal=false
219972599cfSmrg  m4_case([$1], [CC],
220972599cfSmrg    [case " $depcc " in #(
221972599cfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
222972599cfSmrg     esac],
223972599cfSmrg    [CXX],
224972599cfSmrg    [case " $depcc " in #(
225972599cfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
226972599cfSmrg     esac])
227972599cfSmrg
228972599cfSmrg  for depmode in $am_compiler_list; do
229972599cfSmrg    # Setup a source with many dependencies, because some compilers
230972599cfSmrg    # like to wrap large dependency lists on column 80 (with \), and
231972599cfSmrg    # we should not choose a depcomp mode which is confused by this.
232972599cfSmrg    #
233972599cfSmrg    # We need to recreate these files for each test, as the compiler may
234972599cfSmrg    # overwrite some of them when testing with obscure command lines.
235972599cfSmrg    # This happens at least with the AIX C compiler.
236972599cfSmrg    : > sub/conftest.c
237972599cfSmrg    for i in 1 2 3 4 5 6; do
238972599cfSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
239972599cfSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
240972599cfSmrg      # Solaris 8's {/usr,}/bin/sh.
241972599cfSmrg      touch sub/conftst$i.h
242972599cfSmrg    done
243972599cfSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244972599cfSmrg
245972599cfSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
246972599cfSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
247972599cfSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
248972599cfSmrg    # versions had trouble with output in subdirs
249972599cfSmrg    am__obj=sub/conftest.${OBJEXT-o}
250972599cfSmrg    am__minus_obj="-o $am__obj"
251972599cfSmrg    case $depmode in
252972599cfSmrg    gcc)
253972599cfSmrg      # This depmode causes a compiler race in universal mode.
254972599cfSmrg      test "$am__universal" = false || continue
255972599cfSmrg      ;;
256972599cfSmrg    nosideeffect)
257972599cfSmrg      # after this tag, mechanisms are not by side-effect, so they'll
258972599cfSmrg      # only be used when explicitly requested
259972599cfSmrg      if test "x$enable_dependency_tracking" = xyes; then
260972599cfSmrg	continue
261972599cfSmrg      else
262972599cfSmrg	break
263972599cfSmrg      fi
264972599cfSmrg      ;;
265972599cfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
266972599cfSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
267972599cfSmrg      # not run yet.  These depmodes are late enough in the game, and
268972599cfSmrg      # so weak that their functioning should not be impacted.
269972599cfSmrg      am__obj=conftest.${OBJEXT-o}
270972599cfSmrg      am__minus_obj=
271972599cfSmrg      ;;
272972599cfSmrg    none) break ;;
273972599cfSmrg    esac
274972599cfSmrg    if depmode=$depmode \
275972599cfSmrg       source=sub/conftest.c object=$am__obj \
276972599cfSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
277972599cfSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278972599cfSmrg         >/dev/null 2>conftest.err &&
279972599cfSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280972599cfSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
281972599cfSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282972599cfSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283972599cfSmrg      # icc doesn't choke on unknown options, it will just issue warnings
284972599cfSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
285972599cfSmrg      # that says an option was ignored or not supported.
286972599cfSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
287972599cfSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
288972599cfSmrg      # The diagnosis changed in icc 8.0:
289972599cfSmrg      #   icc: Command line remark: option '-MP' not supported
290972599cfSmrg      if (grep 'ignoring option' conftest.err ||
291972599cfSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292972599cfSmrg        am_cv_$1_dependencies_compiler_type=$depmode
293972599cfSmrg        break
294972599cfSmrg      fi
295972599cfSmrg    fi
296972599cfSmrg  done
297972599cfSmrg
298972599cfSmrg  cd ..
299972599cfSmrg  rm -rf conftest.dir
300972599cfSmrgelse
301972599cfSmrg  am_cv_$1_dependencies_compiler_type=none
302972599cfSmrgfi
303972599cfSmrg])
304972599cfSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305972599cfSmrgAM_CONDITIONAL([am__fastdep$1], [
306972599cfSmrg  test "x$enable_dependency_tracking" != xno \
307972599cfSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308972599cfSmrg])
309972599cfSmrg
310972599cfSmrg
311972599cfSmrg# AM_SET_DEPDIR
312972599cfSmrg# -------------
313972599cfSmrg# Choose a directory name for dependency files.
314972599cfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315972599cfSmrgAC_DEFUN([AM_SET_DEPDIR],
316972599cfSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317972599cfSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318972599cfSmrg])
319972599cfSmrg
320972599cfSmrg
321972599cfSmrg# AM_DEP_TRACK
322972599cfSmrg# ------------
323972599cfSmrgAC_DEFUN([AM_DEP_TRACK],
324972599cfSmrg[AC_ARG_ENABLE(dependency-tracking,
325972599cfSmrg[  --disable-dependency-tracking  speeds up one-time build
326972599cfSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
327972599cfSmrgif test "x$enable_dependency_tracking" != xno; then
328972599cfSmrg  am_depcomp="$ac_aux_dir/depcomp"
329972599cfSmrg  AMDEPBACKSLASH='\'
330972599cfSmrg  am__nodep='_no'
331972599cfSmrgfi
332972599cfSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
333972599cfSmrgAC_SUBST([AMDEPBACKSLASH])dnl
334972599cfSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
335972599cfSmrgAC_SUBST([am__nodep])dnl
336972599cfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
337972599cfSmrg])
338972599cfSmrg
339972599cfSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
340972599cfSmrg
341972599cfSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
342972599cfSmrg# Free Software Foundation, Inc.
343972599cfSmrg#
344972599cfSmrg# This file is free software; the Free Software Foundation
345972599cfSmrg# gives unlimited permission to copy and/or distribute it,
346972599cfSmrg# with or without modifications, as long as this notice is preserved.
347972599cfSmrg
348972599cfSmrg#serial 5
349972599cfSmrg
350972599cfSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
351972599cfSmrg# ------------------------------
352972599cfSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
353972599cfSmrg[{
354972599cfSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
355972599cfSmrg  # are listed without --file.  Let's play safe and only enable the eval
356972599cfSmrg  # if we detect the quoting.
357972599cfSmrg  case $CONFIG_FILES in
358972599cfSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
359972599cfSmrg  *)   set x $CONFIG_FILES ;;
360972599cfSmrg  esac
361972599cfSmrg  shift
362972599cfSmrg  for mf
363972599cfSmrg  do
364972599cfSmrg    # Strip MF so we end up with the name of the file.
365972599cfSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
366972599cfSmrg    # Check whether this is an Automake generated Makefile or not.
367972599cfSmrg    # We used to match only the files named `Makefile.in', but
368972599cfSmrg    # some people rename them; so instead we look at the file content.
369972599cfSmrg    # Grep'ing the first line is not enough: some people post-process
370972599cfSmrg    # each Makefile.in and add a new line on top of each file to say so.
371972599cfSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
372972599cfSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
373972599cfSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
374972599cfSmrg      dirpart=`AS_DIRNAME("$mf")`
375972599cfSmrg    else
376972599cfSmrg      continue
377972599cfSmrg    fi
378972599cfSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
379972599cfSmrg    # from the Makefile without running `make'.
380972599cfSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
381972599cfSmrg    test -z "$DEPDIR" && continue
382972599cfSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
383972599cfSmrg    test -z "am__include" && continue
384972599cfSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
385972599cfSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
386972599cfSmrg    U=`sed -n 's/^U = //p' < "$mf"`
387972599cfSmrg    # Find all dependency output files, they are included files with
388972599cfSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
389972599cfSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
390972599cfSmrg    # expansion.
391972599cfSmrg    for file in `sed -n "
392972599cfSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
393972599cfSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
394972599cfSmrg      # Make sure the directory exists.
395972599cfSmrg      test -f "$dirpart/$file" && continue
396972599cfSmrg      fdir=`AS_DIRNAME(["$file"])`
397972599cfSmrg      AS_MKDIR_P([$dirpart/$fdir])
398972599cfSmrg      # echo "creating $dirpart/$file"
399972599cfSmrg      echo '# dummy' > "$dirpart/$file"
400972599cfSmrg    done
401972599cfSmrg  done
402972599cfSmrg}
403972599cfSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404972599cfSmrg
405972599cfSmrg
406972599cfSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
407972599cfSmrg# -----------------------------
408972599cfSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
409972599cfSmrg#
410972599cfSmrg# This code is only required when automatic dependency tracking
411972599cfSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
412972599cfSmrg# need in order to bootstrap the dependency handling code.
413972599cfSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414972599cfSmrg[AC_CONFIG_COMMANDS([depfiles],
415972599cfSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416972599cfSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417972599cfSmrg])
418972599cfSmrg
419972599cfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
420972599cfSmrg
421972599cfSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
422972599cfSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423972599cfSmrg#
424972599cfSmrg# This file is free software; the Free Software Foundation
425972599cfSmrg# gives unlimited permission to copy and/or distribute it,
426972599cfSmrg# with or without modifications, as long as this notice is preserved.
427972599cfSmrg
428972599cfSmrg# serial 16
429972599cfSmrg
430972599cfSmrg# This macro actually does too much.  Some checks are only needed if
431972599cfSmrg# your package does certain things.  But this isn't really a big deal.
432972599cfSmrg
433972599cfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
434972599cfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
435972599cfSmrg# -----------------------------------------------
436972599cfSmrg# The call with PACKAGE and VERSION arguments is the old style
437972599cfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
438972599cfSmrg# and VERSION should now be passed to AC_INIT and removed from
439972599cfSmrg# the call to AM_INIT_AUTOMAKE.
440972599cfSmrg# We support both call styles for the transition.  After
441972599cfSmrg# the next Automake release, Autoconf can make the AC_INIT
442972599cfSmrg# arguments mandatory, and then we can depend on a new Autoconf
443972599cfSmrg# release and drop the old call support.
444972599cfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
445972599cfSmrg[AC_PREREQ([2.62])dnl
446972599cfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
447972599cfSmrgdnl the ones we care about.
448972599cfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
449972599cfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
450972599cfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
451972599cfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
452972599cfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
453972599cfSmrg  # is not polluted with repeated "-I."
454972599cfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
455972599cfSmrg  # test to see if srcdir already configured
456972599cfSmrg  if test -f $srcdir/config.status; then
457972599cfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
458972599cfSmrg  fi
459972599cfSmrgfi
460972599cfSmrg
461972599cfSmrg# test whether we have cygpath
462972599cfSmrgif test -z "$CYGPATH_W"; then
463972599cfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
464972599cfSmrg    CYGPATH_W='cygpath -w'
465972599cfSmrg  else
466972599cfSmrg    CYGPATH_W=echo
467972599cfSmrg  fi
468972599cfSmrgfi
469972599cfSmrgAC_SUBST([CYGPATH_W])
470972599cfSmrg
471972599cfSmrg# Define the identity of the package.
472972599cfSmrgdnl Distinguish between old-style and new-style calls.
473972599cfSmrgm4_ifval([$2],
474972599cfSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
475972599cfSmrg AC_SUBST([PACKAGE], [$1])dnl
476972599cfSmrg AC_SUBST([VERSION], [$2])],
477972599cfSmrg[_AM_SET_OPTIONS([$1])dnl
478972599cfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
479972599cfSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
480972599cfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
481972599cfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
482972599cfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483972599cfSmrg
484972599cfSmrg_AM_IF_OPTION([no-define],,
485972599cfSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
486972599cfSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487972599cfSmrg
488972599cfSmrg# Some tools Automake needs.
489972599cfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
490972599cfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
491972599cfSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
492972599cfSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
493972599cfSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
494972599cfSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
495972599cfSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
496972599cfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
497972599cfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
498972599cfSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
499972599cfSmrg# We need awk for the "check" target.  The system "awk" is bad on
500972599cfSmrg# some platforms.
501972599cfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
502972599cfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
503972599cfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
504972599cfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
505972599cfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
506972599cfSmrg			     [_AM_PROG_TAR([v7])])])
507972599cfSmrg_AM_IF_OPTION([no-dependencies],,
508972599cfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
509972599cfSmrg		  [_AM_DEPENDENCIES(CC)],
510972599cfSmrg		  [define([AC_PROG_CC],
511972599cfSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
512972599cfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
513972599cfSmrg		  [_AM_DEPENDENCIES(CXX)],
514972599cfSmrg		  [define([AC_PROG_CXX],
515972599cfSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
516972599cfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
517972599cfSmrg		  [_AM_DEPENDENCIES(OBJC)],
518972599cfSmrg		  [define([AC_PROG_OBJC],
519972599cfSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
520972599cfSmrg])
521972599cfSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
522972599cfSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
523972599cfSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
524972599cfSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
525972599cfSmrgAC_CONFIG_COMMANDS_PRE(dnl
526972599cfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
527972599cfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
528972599cfSmrg])
529972599cfSmrg
530972599cfSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
531972599cfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
532972599cfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
533972599cfSmrgm4_define([_AC_COMPILER_EXEEXT],
534972599cfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
535972599cfSmrg
536972599cfSmrg
537972599cfSmrg# When config.status generates a header, we must update the stamp-h file.
538972599cfSmrg# This file resides in the same directory as the config header
539972599cfSmrg# that is generated.  The stamp files are numbered to have different names.
540972599cfSmrg
541972599cfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
542972599cfSmrg# loop where config.status creates the headers, so we can generate
543972599cfSmrg# our stamp files there.
544972599cfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
545972599cfSmrg[# Compute $1's index in $config_headers.
546972599cfSmrg_am_arg=$1
547972599cfSmrg_am_stamp_count=1
548972599cfSmrgfor _am_header in $config_headers :; do
549972599cfSmrg  case $_am_header in
550972599cfSmrg    $_am_arg | $_am_arg:* )
551972599cfSmrg      break ;;
552972599cfSmrg    * )
553972599cfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
554972599cfSmrg  esac
555972599cfSmrgdone
556972599cfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557972599cfSmrg
558972599cfSmrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
559972599cfSmrg# Inc.
560972599cfSmrg#
561972599cfSmrg# This file is free software; the Free Software Foundation
562972599cfSmrg# gives unlimited permission to copy and/or distribute it,
563972599cfSmrg# with or without modifications, as long as this notice is preserved.
564972599cfSmrg
565972599cfSmrg# serial 1
566972599cfSmrg
567972599cfSmrg# AM_PROG_INSTALL_SH
568972599cfSmrg# ------------------
569972599cfSmrg# Define $install_sh.
570972599cfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
571972599cfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
572972599cfSmrgif test x"${install_sh}" != xset; then
573972599cfSmrg  case $am_aux_dir in
574972599cfSmrg  *\ * | *\	*)
575972599cfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
576972599cfSmrg  *)
577972599cfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
578972599cfSmrg  esac
579972599cfSmrgfi
580972599cfSmrgAC_SUBST(install_sh)])
581972599cfSmrg
582972599cfSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
583972599cfSmrg#
584972599cfSmrg# This file is free software; the Free Software Foundation
585972599cfSmrg# gives unlimited permission to copy and/or distribute it,
586972599cfSmrg# with or without modifications, as long as this notice is preserved.
587972599cfSmrg
588972599cfSmrg# serial 2
589972599cfSmrg
590972599cfSmrg# Check whether the underlying file-system supports filenames
591972599cfSmrg# with a leading dot.  For instance MS-DOS doesn't.
592972599cfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
593972599cfSmrg[rm -rf .tst 2>/dev/null
594972599cfSmrgmkdir .tst 2>/dev/null
595972599cfSmrgif test -d .tst; then
596972599cfSmrg  am__leading_dot=.
597972599cfSmrgelse
598972599cfSmrg  am__leading_dot=_
599972599cfSmrgfi
600972599cfSmrgrmdir .tst 2>/dev/null
601972599cfSmrgAC_SUBST([am__leading_dot])])
602972599cfSmrg
603972599cfSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
604972599cfSmrg# From Jim Meyering
605972599cfSmrg
606972599cfSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
607972599cfSmrg# 2011 Free Software Foundation, Inc.
608972599cfSmrg#
609972599cfSmrg# This file is free software; the Free Software Foundation
610972599cfSmrg# gives unlimited permission to copy and/or distribute it,
611972599cfSmrg# with or without modifications, as long as this notice is preserved.
612972599cfSmrg
613972599cfSmrg# serial 5
614972599cfSmrg
615972599cfSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
616972599cfSmrg# ----------------------------------
617972599cfSmrg# Control maintainer-specific portions of Makefiles.
618972599cfSmrg# Default is to disable them, unless `enable' is passed literally.
619972599cfSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
620972599cfSmrg# can override the default with the --enable/--disable switch.
621972599cfSmrgAC_DEFUN([AM_MAINTAINER_MODE],
622972599cfSmrg[m4_case(m4_default([$1], [disable]),
623972599cfSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
624972599cfSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
625972599cfSmrg       [m4_define([am_maintainer_other], [enable])
626972599cfSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
627972599cfSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
628972599cfSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
629972599cfSmrg  AC_ARG_ENABLE([maintainer-mode],
630972599cfSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
631972599cfSmrg			  (and sometimes confusing) to the casual installer],
632972599cfSmrg      [USE_MAINTAINER_MODE=$enableval],
633972599cfSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634972599cfSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
635972599cfSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636972599cfSmrg  MAINT=$MAINTAINER_MODE_TRUE
637972599cfSmrg  AC_SUBST([MAINT])dnl
638972599cfSmrg]
639972599cfSmrg)
640972599cfSmrg
641972599cfSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
642972599cfSmrg
643972599cfSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644972599cfSmrg
645972599cfSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
646972599cfSmrg#
647972599cfSmrg# This file is free software; the Free Software Foundation
648972599cfSmrg# gives unlimited permission to copy and/or distribute it,
649972599cfSmrg# with or without modifications, as long as this notice is preserved.
650972599cfSmrg
651972599cfSmrg# serial 4
652972599cfSmrg
653972599cfSmrg# AM_MAKE_INCLUDE()
654972599cfSmrg# -----------------
655972599cfSmrg# Check to see how make treats includes.
656972599cfSmrgAC_DEFUN([AM_MAKE_INCLUDE],
657972599cfSmrg[am_make=${MAKE-make}
658972599cfSmrgcat > confinc << 'END'
659972599cfSmrgam__doit:
660972599cfSmrg	@echo this is the am__doit target
661972599cfSmrg.PHONY: am__doit
662972599cfSmrgEND
663972599cfSmrg# If we don't find an include directive, just comment out the code.
664972599cfSmrgAC_MSG_CHECKING([for style of include used by $am_make])
665972599cfSmrgam__include="#"
666972599cfSmrgam__quote=
667972599cfSmrg_am_result=none
668972599cfSmrg# First try GNU make style include.
669972599cfSmrgecho "include confinc" > confmf
670972599cfSmrg# Ignore all kinds of additional output from `make'.
671972599cfSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
672972599cfSmrg*the\ am__doit\ target*)
673972599cfSmrg  am__include=include
674972599cfSmrg  am__quote=
675972599cfSmrg  _am_result=GNU
676972599cfSmrg  ;;
677972599cfSmrgesac
678972599cfSmrg# Now try BSD make style include.
679972599cfSmrgif test "$am__include" = "#"; then
680972599cfSmrg   echo '.include "confinc"' > confmf
681972599cfSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
682972599cfSmrg   *the\ am__doit\ target*)
683972599cfSmrg     am__include=.include
684972599cfSmrg     am__quote="\""
685972599cfSmrg     _am_result=BSD
686972599cfSmrg     ;;
687972599cfSmrg   esac
688972599cfSmrgfi
689972599cfSmrgAC_SUBST([am__include])
690972599cfSmrgAC_SUBST([am__quote])
691972599cfSmrgAC_MSG_RESULT([$_am_result])
692972599cfSmrgrm -f confinc confmf
693972599cfSmrg])
694972599cfSmrg
695972599cfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
696972599cfSmrg
697972599cfSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
698972599cfSmrg# Free Software Foundation, Inc.
699972599cfSmrg#
700972599cfSmrg# This file is free software; the Free Software Foundation
701972599cfSmrg# gives unlimited permission to copy and/or distribute it,
702972599cfSmrg# with or without modifications, as long as this notice is preserved.
703972599cfSmrg
704972599cfSmrg# serial 6
705972599cfSmrg
706972599cfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
707972599cfSmrg# ------------------------------
708972599cfSmrgAC_DEFUN([AM_MISSING_PROG],
709972599cfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710972599cfSmrg$1=${$1-"${am_missing_run}$2"}
711972599cfSmrgAC_SUBST($1)])
712972599cfSmrg
713972599cfSmrg
714972599cfSmrg# AM_MISSING_HAS_RUN
715972599cfSmrg# ------------------
716972599cfSmrg# Define MISSING if not defined so far and test if it supports --run.
717972599cfSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
718972599cfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
719972599cfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
720972599cfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
721972599cfSmrgif test x"${MISSING+set}" != xset; then
722972599cfSmrg  case $am_aux_dir in
723972599cfSmrg  *\ * | *\	*)
724972599cfSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
725972599cfSmrg  *)
726972599cfSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
727972599cfSmrg  esac
728972599cfSmrgfi
729972599cfSmrg# Use eval to expand $SHELL
730972599cfSmrgif eval "$MISSING --run true"; then
731972599cfSmrg  am_missing_run="$MISSING --run "
732972599cfSmrgelse
733972599cfSmrg  am_missing_run=
734972599cfSmrg  AC_MSG_WARN([`missing' script is too old or missing])
735972599cfSmrgfi
736972599cfSmrg])
737972599cfSmrg
738972599cfSmrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
739972599cfSmrg# Inc.
740972599cfSmrg#
741972599cfSmrg# This file is free software; the Free Software Foundation
742972599cfSmrg# gives unlimited permission to copy and/or distribute it,
743972599cfSmrg# with or without modifications, as long as this notice is preserved.
744972599cfSmrg
745972599cfSmrg# serial 1
746972599cfSmrg
747972599cfSmrg# AM_PROG_MKDIR_P
748972599cfSmrg# ---------------
749972599cfSmrg# Check for `mkdir -p'.
750972599cfSmrgAC_DEFUN([AM_PROG_MKDIR_P],
751972599cfSmrg[AC_PREREQ([2.60])dnl
752972599cfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
753972599cfSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
754972599cfSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
755972599cfSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
756972599cfSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
757972599cfSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
758972599cfSmrgdnl adjustment using top_builddir (which is defined more often than
759972599cfSmrgdnl MKDIR_P).
760972599cfSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
761972599cfSmrgcase $mkdir_p in
762972599cfSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
763972599cfSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
764972599cfSmrgesac
765972599cfSmrg])
766972599cfSmrg
767972599cfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
768972599cfSmrg
769972599cfSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
770972599cfSmrg# Foundation, Inc.
771972599cfSmrg#
772972599cfSmrg# This file is free software; the Free Software Foundation
773972599cfSmrg# gives unlimited permission to copy and/or distribute it,
774972599cfSmrg# with or without modifications, as long as this notice is preserved.
775972599cfSmrg
776972599cfSmrg# serial 5
777972599cfSmrg
778972599cfSmrg# _AM_MANGLE_OPTION(NAME)
779972599cfSmrg# -----------------------
780972599cfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
781972599cfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782972599cfSmrg
783972599cfSmrg# _AM_SET_OPTION(NAME)
784972599cfSmrg# --------------------
785972599cfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
786972599cfSmrgAC_DEFUN([_AM_SET_OPTION],
787972599cfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
788972599cfSmrg
789972599cfSmrg# _AM_SET_OPTIONS(OPTIONS)
790972599cfSmrg# ------------------------
791972599cfSmrg# OPTIONS is a space-separated list of Automake options.
792972599cfSmrgAC_DEFUN([_AM_SET_OPTIONS],
793972599cfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794972599cfSmrg
795972599cfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
796972599cfSmrg# -------------------------------------------
797972599cfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
798972599cfSmrgAC_DEFUN([_AM_IF_OPTION],
799972599cfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800972599cfSmrg
801972599cfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
802972599cfSmrg
803972599cfSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
804972599cfSmrg# Free Software Foundation, Inc.
805972599cfSmrg#
806972599cfSmrg# This file is free software; the Free Software Foundation
807972599cfSmrg# gives unlimited permission to copy and/or distribute it,
808972599cfSmrg# with or without modifications, as long as this notice is preserved.
809972599cfSmrg
810972599cfSmrg# serial 5
811972599cfSmrg
812972599cfSmrg# AM_SANITY_CHECK
813972599cfSmrg# ---------------
814972599cfSmrgAC_DEFUN([AM_SANITY_CHECK],
815972599cfSmrg[AC_MSG_CHECKING([whether build environment is sane])
816972599cfSmrg# Just in case
817972599cfSmrgsleep 1
818972599cfSmrgecho timestamp > conftest.file
819972599cfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
820972599cfSmrg# name.  Accept space and tab only in the latter.
821972599cfSmrgam_lf='
822972599cfSmrg'
823972599cfSmrgcase `pwd` in
824972599cfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
825972599cfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
826972599cfSmrgesac
827972599cfSmrgcase $srcdir in
828972599cfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
829972599cfSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
830972599cfSmrgesac
831972599cfSmrg
832972599cfSmrg# Do `set' in a subshell so we don't clobber the current shell's
833972599cfSmrg# arguments.  Must try -L first in case configure is actually a
834972599cfSmrg# symlink; some systems play weird games with the mod time of symlinks
835972599cfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
836972599cfSmrg# directory).
837972599cfSmrgif (
838972599cfSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
839972599cfSmrg   if test "$[*]" = "X"; then
840972599cfSmrg      # -L didn't work.
841972599cfSmrg      set X `ls -t "$srcdir/configure" conftest.file`
842972599cfSmrg   fi
843972599cfSmrg   rm -f conftest.file
844972599cfSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
845972599cfSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
846972599cfSmrg
847972599cfSmrg      # If neither matched, then we have a broken ls.  This can happen
848972599cfSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
849972599cfSmrg      # broken ls alias from the environment.  This has actually
850972599cfSmrg      # happened.  Such a system could not be considered "sane".
851972599cfSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
852972599cfSmrgalias in your environment])
853972599cfSmrg   fi
854972599cfSmrg
855972599cfSmrg   test "$[2]" = conftest.file
856972599cfSmrg   )
857972599cfSmrgthen
858972599cfSmrg   # Ok.
859972599cfSmrg   :
860972599cfSmrgelse
861972599cfSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
862972599cfSmrgCheck your system clock])
863972599cfSmrgfi
864972599cfSmrgAC_MSG_RESULT(yes)])
865972599cfSmrg
866972599cfSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
867972599cfSmrg#
868972599cfSmrg# This file is free software; the Free Software Foundation
869972599cfSmrg# gives unlimited permission to copy and/or distribute it,
870972599cfSmrg# with or without modifications, as long as this notice is preserved.
871972599cfSmrg
872972599cfSmrg# serial 1
873972599cfSmrg
874972599cfSmrg# AM_SILENT_RULES([DEFAULT])
875972599cfSmrg# --------------------------
876972599cfSmrg# Enable less verbose build rules; with the default set to DEFAULT
877972599cfSmrg# (`yes' being less verbose, `no' or empty being verbose).
878972599cfSmrgAC_DEFUN([AM_SILENT_RULES],
879972599cfSmrg[AC_ARG_ENABLE([silent-rules],
880972599cfSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
881972599cfSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
882972599cfSmrgcase $enable_silent_rules in
883972599cfSmrgyes) AM_DEFAULT_VERBOSITY=0;;
884972599cfSmrgno)  AM_DEFAULT_VERBOSITY=1;;
885972599cfSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
886972599cfSmrgesac
887972599cfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
888972599cfSmrgAM_BACKSLASH='\'
889972599cfSmrgAC_SUBST([AM_BACKSLASH])dnl
890972599cfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
891972599cfSmrg])
892972599cfSmrg
893972599cfSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
894972599cfSmrg#
895972599cfSmrg# This file is free software; the Free Software Foundation
896972599cfSmrg# gives unlimited permission to copy and/or distribute it,
897972599cfSmrg# with or without modifications, as long as this notice is preserved.
898972599cfSmrg
899972599cfSmrg# serial 1
900972599cfSmrg
901972599cfSmrg# AM_PROG_INSTALL_STRIP
902972599cfSmrg# ---------------------
903972599cfSmrg# One issue with vendor `install' (even GNU) is that you can't
904972599cfSmrg# specify the program used to strip binaries.  This is especially
905972599cfSmrg# annoying in cross-compiling environments, where the build's strip
906972599cfSmrg# is unlikely to handle the host's binaries.
907972599cfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
908972599cfSmrg# always use install-sh in `make install-strip', and initialize
909972599cfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
910972599cfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
911972599cfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
912972599cfSmrg# Installed binaries are usually stripped using `strip' when the user
913972599cfSmrg# run `make install-strip'.  However `strip' might not be the right
914972599cfSmrg# tool to use in cross-compilation environments, therefore Automake
915972599cfSmrg# will honor the `STRIP' environment variable to overrule this program.
916972599cfSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
917972599cfSmrgif test "$cross_compiling" != no; then
918972599cfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
919972599cfSmrgfi
920972599cfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
921972599cfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
922972599cfSmrg
923972599cfSmrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
924972599cfSmrg#
925972599cfSmrg# This file is free software; the Free Software Foundation
926972599cfSmrg# gives unlimited permission to copy and/or distribute it,
927972599cfSmrg# with or without modifications, as long as this notice is preserved.
928972599cfSmrg
929972599cfSmrg# serial 3
930972599cfSmrg
931972599cfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
932972599cfSmrg# ---------------------------
933972599cfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
934972599cfSmrg# This macro is traced by Automake.
935972599cfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
936972599cfSmrg
937972599cfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
938972599cfSmrg# --------------------------
939972599cfSmrg# Public sister of _AM_SUBST_NOTMAKE.
940972599cfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
941972599cfSmrg
942972599cfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
943972599cfSmrg
944972599cfSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
945972599cfSmrg#
946972599cfSmrg# This file is free software; the Free Software Foundation
947972599cfSmrg# gives unlimited permission to copy and/or distribute it,
948972599cfSmrg# with or without modifications, as long as this notice is preserved.
949972599cfSmrg
950972599cfSmrg# serial 2
951972599cfSmrg
952972599cfSmrg# _AM_PROG_TAR(FORMAT)
953972599cfSmrg# --------------------
954972599cfSmrg# Check how to create a tarball in format FORMAT.
955972599cfSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
956972599cfSmrg#
957972599cfSmrg# Substitute a variable $(am__tar) that is a command
958972599cfSmrg# writing to stdout a FORMAT-tarball containing the directory
959972599cfSmrg# $tardir.
960972599cfSmrg#     tardir=directory && $(am__tar) > result.tar
961972599cfSmrg#
962972599cfSmrg# Substitute a variable $(am__untar) that extract such
963972599cfSmrg# a tarball read from stdin.
964972599cfSmrg#     $(am__untar) < result.tar
965972599cfSmrgAC_DEFUN([_AM_PROG_TAR],
966972599cfSmrg[# Always define AMTAR for backward compatibility.
967972599cfSmrgAM_MISSING_PROG([AMTAR], [tar])
968972599cfSmrgm4_if([$1], [v7],
969972599cfSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
970972599cfSmrg     [m4_case([$1], [ustar],, [pax],,
971972599cfSmrg              [m4_fatal([Unknown tar format])])
972972599cfSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
973972599cfSmrg# Loop over all known methods to create a tar archive until one works.
974972599cfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
975972599cfSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
976972599cfSmrg# Do not fold the above two line into one, because Tru64 sh and
977972599cfSmrg# Solaris sh will not grok spaces in the rhs of `-'.
978972599cfSmrgfor _am_tool in $_am_tools
979972599cfSmrgdo
980972599cfSmrg  case $_am_tool in
981972599cfSmrg  gnutar)
982972599cfSmrg    for _am_tar in tar gnutar gtar;
983972599cfSmrg    do
984972599cfSmrg      AM_RUN_LOG([$_am_tar --version]) && break
985972599cfSmrg    done
986972599cfSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
987972599cfSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
988972599cfSmrg    am__untar="$_am_tar -xf -"
989972599cfSmrg    ;;
990972599cfSmrg  plaintar)
991972599cfSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
992972599cfSmrg    # ustar tarball either.
993972599cfSmrg    (tar --version) >/dev/null 2>&1 && continue
994972599cfSmrg    am__tar='tar chf - "$$tardir"'
995972599cfSmrg    am__tar_='tar chf - "$tardir"'
996972599cfSmrg    am__untar='tar xf -'
997972599cfSmrg    ;;
998972599cfSmrg  pax)
999972599cfSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
1000972599cfSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
1001972599cfSmrg    am__untar='pax -r'
1002972599cfSmrg    ;;
1003972599cfSmrg  cpio)
1004972599cfSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1005972599cfSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1006972599cfSmrg    am__untar='cpio -i -H $1 -d'
1007972599cfSmrg    ;;
1008972599cfSmrg  none)
1009972599cfSmrg    am__tar=false
1010972599cfSmrg    am__tar_=false
1011972599cfSmrg    am__untar=false
1012972599cfSmrg    ;;
1013972599cfSmrg  esac
1014972599cfSmrg
1015972599cfSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
1016972599cfSmrg  # and am__untar set.
1017972599cfSmrg  test -n "${am_cv_prog_tar_$1}" && break
1018972599cfSmrg
1019972599cfSmrg  # tar/untar a dummy directory, and stop if the command works
1020972599cfSmrg  rm -rf conftest.dir
1021972599cfSmrg  mkdir conftest.dir
1022972599cfSmrg  echo GrepMe > conftest.dir/file
1023972599cfSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1024972599cfSmrg  rm -rf conftest.dir
1025972599cfSmrg  if test -s conftest.tar; then
1026972599cfSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
1027972599cfSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1028972599cfSmrg  fi
1029972599cfSmrgdone
1030972599cfSmrgrm -rf conftest.dir
1031972599cfSmrg
1032972599cfSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1033972599cfSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1034972599cfSmrgAC_SUBST([am__tar])
1035972599cfSmrgAC_SUBST([am__untar])
1036972599cfSmrg]) # _AM_PROG_TAR
1037972599cfSmrg
1038972599cfSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1039972599cfSmrg# 
1040972599cfSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1041972599cfSmrg#
1042972599cfSmrg# This program is free software; you can redistribute it and/or modify
1043972599cfSmrg# it under the terms of the GNU General Public License as published by
1044972599cfSmrg# the Free Software Foundation; either version 2 of the License, or
1045972599cfSmrg# (at your option) any later version.
1046972599cfSmrg#
1047972599cfSmrg# This program is distributed in the hope that it will be useful, but
1048972599cfSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1049972599cfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1050972599cfSmrg# General Public License for more details.
1051972599cfSmrg#
1052972599cfSmrg# You should have received a copy of the GNU General Public License
1053972599cfSmrg# along with this program; if not, write to the Free Software
1054972599cfSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1055972599cfSmrg#
1056972599cfSmrg# As a special exception to the GNU General Public License, if you
1057972599cfSmrg# distribute this file as part of a program that contains a
1058972599cfSmrg# configuration script generated by Autoconf, you may include it under
1059972599cfSmrg# the same distribution terms that you use for the rest of that program.
1060972599cfSmrg
1061972599cfSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1062972599cfSmrg# ----------------------------------
1063972599cfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1064972599cfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1065972599cfSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1066972599cfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1067972599cfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1068972599cfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1069972599cfSmrgfi
1070972599cfSmrgif test -n "$PKG_CONFIG"; then
1071972599cfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1072972599cfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1073972599cfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1074972599cfSmrg		AC_MSG_RESULT([yes])
1075972599cfSmrg	else
1076972599cfSmrg		AC_MSG_RESULT([no])
1077972599cfSmrg		PKG_CONFIG=""
1078972599cfSmrg	fi
1079972599cfSmrg		
1080972599cfSmrgfi[]dnl
1081972599cfSmrg])# PKG_PROG_PKG_CONFIG
1082972599cfSmrg
1083972599cfSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1084972599cfSmrg#
1085972599cfSmrg# Check to see whether a particular set of modules exists.  Similar
1086972599cfSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1087972599cfSmrg#
1088972599cfSmrg#
1089972599cfSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1090972599cfSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1091972599cfSmrg# PKG_CHECK_EXISTS manually
1092972599cfSmrg# --------------------------------------------------------------
1093972599cfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1094972599cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1095972599cfSmrgif test -n "$PKG_CONFIG" && \
1096972599cfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1097972599cfSmrg  m4_ifval([$2], [$2], [:])
1098972599cfSmrgm4_ifvaln([$3], [else
1099972599cfSmrg  $3])dnl
1100972599cfSmrgfi])
1101972599cfSmrg
1102972599cfSmrg
1103972599cfSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1104972599cfSmrg# ---------------------------------------------
1105972599cfSmrgm4_define([_PKG_CONFIG],
1106972599cfSmrg[if test -n "$$1"; then
1107972599cfSmrg    pkg_cv_[]$1="$$1"
1108972599cfSmrg elif test -n "$PKG_CONFIG"; then
1109972599cfSmrg    PKG_CHECK_EXISTS([$3],
1110972599cfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1111972599cfSmrg		     [pkg_failed=yes])
1112972599cfSmrg else
1113972599cfSmrg    pkg_failed=untried
1114972599cfSmrgfi[]dnl
1115972599cfSmrg])# _PKG_CONFIG
1116972599cfSmrg
1117972599cfSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1118972599cfSmrg# -----------------------------
1119972599cfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1120972599cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1121972599cfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1122972599cfSmrg        _pkg_short_errors_supported=yes
1123972599cfSmrgelse
1124972599cfSmrg        _pkg_short_errors_supported=no
1125972599cfSmrgfi[]dnl
1126972599cfSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1127972599cfSmrg
1128972599cfSmrg
1129972599cfSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1130972599cfSmrg# [ACTION-IF-NOT-FOUND])
1131972599cfSmrg#
1132972599cfSmrg#
1133972599cfSmrg# Note that if there is a possibility the first call to
1134972599cfSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1135972599cfSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1136972599cfSmrg#
1137972599cfSmrg#
1138972599cfSmrg# --------------------------------------------------------------
1139972599cfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1140972599cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1141972599cfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1142972599cfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1143972599cfSmrg
1144972599cfSmrgpkg_failed=no
1145972599cfSmrgAC_MSG_CHECKING([for $1])
1146972599cfSmrg
1147972599cfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1148972599cfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1149972599cfSmrg
1150972599cfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1151972599cfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1152972599cfSmrgSee the pkg-config man page for more details.])
1153972599cfSmrg
1154972599cfSmrgif test $pkg_failed = yes; then
1155972599cfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1156972599cfSmrg        if test $_pkg_short_errors_supported = yes; then
1157972599cfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1158972599cfSmrg        else 
1159972599cfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1160972599cfSmrg        fi
1161972599cfSmrg	# Put the nasty error message in config.log where it belongs
1162972599cfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1163972599cfSmrg
1164972599cfSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1165972599cfSmrg[Package requirements ($2) were not met:
1166972599cfSmrg
1167972599cfSmrg$$1_PKG_ERRORS
1168972599cfSmrg
1169972599cfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1170972599cfSmrginstalled software in a non-standard prefix.
1171972599cfSmrg
1172972599cfSmrg_PKG_TEXT
1173972599cfSmrg])],
1174972599cfSmrg		[AC_MSG_RESULT([no])
1175972599cfSmrg                $4])
1176972599cfSmrgelif test $pkg_failed = untried; then
1177972599cfSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1178972599cfSmrg[The pkg-config script could not be found or is too old.  Make sure it
1179972599cfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1180972599cfSmrgpath to pkg-config.
1181972599cfSmrg
1182972599cfSmrg_PKG_TEXT
1183972599cfSmrg
1184972599cfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1185972599cfSmrg		[$4])
1186972599cfSmrgelse
1187972599cfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1188972599cfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1189972599cfSmrg        AC_MSG_RESULT([yes])
1190972599cfSmrg	ifelse([$3], , :, [$3])
1191972599cfSmrgfi[]dnl
1192972599cfSmrg])# PKG_CHECK_MODULES
1193972599cfSmrg
1194972599cfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1195972599cfSmrgdnl
1196972599cfSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1197972599cfSmrgdnl 
1198972599cfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1199972599cfSmrgdnl copy of this software and associated documentation files (the "Software"),
1200972599cfSmrgdnl to deal in the Software without restriction, including without limitation
1201972599cfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1202972599cfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1203972599cfSmrgdnl Software is furnished to do so, subject to the following conditions:
1204972599cfSmrgdnl
1205972599cfSmrgdnl The above copyright notice and this permission notice (including the next
1206972599cfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1207972599cfSmrgdnl Software.
1208972599cfSmrgdnl
1209972599cfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1210972599cfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1211972599cfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1212972599cfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1213972599cfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1214972599cfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1215972599cfSmrgdnl DEALINGS IN THE SOFTWARE.
1216972599cfSmrg
1217972599cfSmrg# XORG_MACROS_VERSION(required-version)
1218972599cfSmrg# -------------------------------------
1219972599cfSmrg# Minimum version: 1.1.0
1220972599cfSmrg#
1221972599cfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1222972599cfSmrg# your configure.ac with the minimum required version, such as:
1223972599cfSmrg# XORG_MACROS_VERSION(1.1)
1224972599cfSmrg#
1225972599cfSmrg# To ensure that this macro is defined, also add:
1226972599cfSmrg# m4_ifndef([XORG_MACROS_VERSION],
1227972599cfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1228972599cfSmrg#
1229972599cfSmrg#
1230972599cfSmrg# See the "minimum version" comment for each macro you use to see what 
1231972599cfSmrg# version you require.
1232972599cfSmrgm4_defun([XORG_MACROS_VERSION],[
1233972599cfSmrgm4_define([vers_have], [1.17])
1234972599cfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1235972599cfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1236972599cfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1237972599cfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1238972599cfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1239972599cfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1240972599cfSmrgm4_undefine([vers_have])
1241972599cfSmrgm4_undefine([maj_have])
1242972599cfSmrgm4_undefine([maj_needed])
1243972599cfSmrg]) # XORG_MACROS_VERSION
1244972599cfSmrg
1245972599cfSmrg# XORG_PROG_RAWCPP()
1246972599cfSmrg# ------------------
1247972599cfSmrg# Minimum version: 1.0.0
1248972599cfSmrg#
1249972599cfSmrg# Find cpp program and necessary flags for use in pre-processing text files
1250972599cfSmrg# such as man pages and config files
1251972599cfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1252972599cfSmrgAC_REQUIRE([AC_PROG_CPP])
1253972599cfSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1254972599cfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1255972599cfSmrg
1256972599cfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1257972599cfSmrg# which is not the best choice for supporting other OS'es, but covers most
1258972599cfSmrg# of the ones we need for now.
1259972599cfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1260972599cfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1261972599cfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1262972599cfSmrg	AC_MSG_RESULT([no])
1263972599cfSmrgelse
1264972599cfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1265972599cfSmrg		RAWCPPFLAGS=-undef
1266972599cfSmrg		AC_MSG_RESULT([yes])
1267972599cfSmrg	# under Cygwin unix is still defined even with -undef
1268972599cfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1269972599cfSmrg		RAWCPPFLAGS="-undef -ansi"
1270972599cfSmrg		AC_MSG_RESULT([yes, with -ansi])
1271972599cfSmrg	else
1272972599cfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1273972599cfSmrg	fi
1274972599cfSmrgfi
1275972599cfSmrgrm -f conftest.$ac_ext
1276972599cfSmrg
1277972599cfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1278972599cfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1279972599cfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1280972599cfSmrg	AC_MSG_RESULT([no])
1281972599cfSmrgelse
1282972599cfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1283972599cfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1284972599cfSmrg		AC_MSG_RESULT([yes])
1285972599cfSmrg	else
1286972599cfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1287972599cfSmrg	fi
1288972599cfSmrgfi
1289972599cfSmrgrm -f conftest.$ac_ext
1290972599cfSmrgAC_SUBST(RAWCPPFLAGS)
1291972599cfSmrg]) # XORG_PROG_RAWCPP
1292972599cfSmrg
1293972599cfSmrg# XORG_MANPAGE_SECTIONS()
1294972599cfSmrg# -----------------------
1295972599cfSmrg# Minimum version: 1.0.0
1296972599cfSmrg#
1297972599cfSmrg# Determine which sections man pages go in for the different man page types
1298972599cfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1299972599cfSmrg# Not sure if there's any better way than just hardcoding by OS name.
1300972599cfSmrg# Override default settings by setting environment variables
1301972599cfSmrg# Added MAN_SUBSTS in version 1.8
1302972599cfSmrg# Added AC_PROG_SED in version 1.8
1303972599cfSmrg
1304972599cfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1305972599cfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1306972599cfSmrgAC_REQUIRE([AC_PROG_SED])
1307972599cfSmrg
1308972599cfSmrgif test x$APP_MAN_SUFFIX = x    ; then
1309972599cfSmrg    APP_MAN_SUFFIX=1
1310972599cfSmrgfi
1311972599cfSmrgif test x$APP_MAN_DIR = x    ; then
1312972599cfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1313972599cfSmrgfi
1314972599cfSmrg
1315972599cfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1316972599cfSmrg    LIB_MAN_SUFFIX=3
1317972599cfSmrgfi
1318972599cfSmrgif test x$LIB_MAN_DIR = x    ; then
1319972599cfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1320972599cfSmrgfi
1321972599cfSmrg
1322972599cfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1323972599cfSmrg    case $host_os in
1324972599cfSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1325972599cfSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1326972599cfSmrg    esac
1327972599cfSmrgfi
1328972599cfSmrgif test x$FILE_MAN_DIR = x    ; then
1329972599cfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1330972599cfSmrgfi
1331972599cfSmrg
1332972599cfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1333972599cfSmrg    case $host_os in
1334972599cfSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1335972599cfSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1336972599cfSmrg    esac
1337972599cfSmrgfi
1338972599cfSmrgif test x$MISC_MAN_DIR = x    ; then
1339972599cfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1340972599cfSmrgfi
1341972599cfSmrg
1342972599cfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1343972599cfSmrg    case $host_os in
1344972599cfSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1345972599cfSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1346972599cfSmrg    esac
1347972599cfSmrgfi
1348972599cfSmrgif test x$DRIVER_MAN_DIR = x    ; then
1349972599cfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1350972599cfSmrgfi
1351972599cfSmrg
1352972599cfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1353972599cfSmrg    case $host_os in
1354972599cfSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1355972599cfSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1356972599cfSmrg    esac
1357972599cfSmrgfi
1358972599cfSmrgif test x$ADMIN_MAN_DIR = x    ; then
1359972599cfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1360972599cfSmrgfi
1361972599cfSmrg
1362972599cfSmrg
1363972599cfSmrgAC_SUBST([APP_MAN_SUFFIX])
1364972599cfSmrgAC_SUBST([LIB_MAN_SUFFIX])
1365972599cfSmrgAC_SUBST([FILE_MAN_SUFFIX])
1366972599cfSmrgAC_SUBST([MISC_MAN_SUFFIX])
1367972599cfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1368972599cfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1369972599cfSmrgAC_SUBST([APP_MAN_DIR])
1370972599cfSmrgAC_SUBST([LIB_MAN_DIR])
1371972599cfSmrgAC_SUBST([FILE_MAN_DIR])
1372972599cfSmrgAC_SUBST([MISC_MAN_DIR])
1373972599cfSmrgAC_SUBST([DRIVER_MAN_DIR])
1374972599cfSmrgAC_SUBST([ADMIN_MAN_DIR])
1375972599cfSmrg
1376972599cfSmrgXORG_MAN_PAGE="X Version 11"
1377972599cfSmrgAC_SUBST([XORG_MAN_PAGE])
1378972599cfSmrgMAN_SUBSTS="\
1379972599cfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1380972599cfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1381972599cfSmrg	-e 's|__xservername__|Xorg|g' \
1382972599cfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1383972599cfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1384972599cfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1385972599cfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1386972599cfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1387972599cfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1388972599cfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1389972599cfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1390972599cfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1391972599cfSmrgAC_SUBST([MAN_SUBSTS])
1392972599cfSmrg
1393972599cfSmrg]) # XORG_MANPAGE_SECTIONS
1394972599cfSmrg
1395972599cfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1396972599cfSmrg# ------------------------
1397972599cfSmrg# Minimum version: 1.7.0
1398972599cfSmrg#
1399972599cfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1400972599cfSmrg# provided by xorg-sgml-doctools, if installed.
1401972599cfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1402972599cfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1403972599cfSmrgXORG_SGML_PATH=
1404972599cfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1405972599cfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1406972599cfSmrg    [m4_ifval([$1],[:],
1407972599cfSmrg        [if test x"$cross_compiling" != x"yes" ; then
1408972599cfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1409972599cfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1410972599cfSmrg         fi])
1411972599cfSmrg    ])
1412972599cfSmrg
1413972599cfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1414972599cfSmrg# the path and the name of the doc stylesheet
1415972599cfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1416972599cfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1417972599cfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1418972599cfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1419972599cfSmrgelse
1420972599cfSmrg   AC_MSG_RESULT([no])
1421972599cfSmrgfi
1422972599cfSmrg
1423972599cfSmrgAC_SUBST(XORG_SGML_PATH)
1424972599cfSmrgAC_SUBST(STYLESHEET_SRCDIR)
1425972599cfSmrgAC_SUBST(XSL_STYLESHEET)
1426972599cfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1427972599cfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1428972599cfSmrg
1429972599cfSmrg# XORG_CHECK_LINUXDOC
1430972599cfSmrg# -------------------
1431972599cfSmrg# Minimum version: 1.0.0
1432972599cfSmrg#
1433972599cfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1434972599cfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1435972599cfSmrg# Whether or not the necessary tools and files are found can be checked
1436972599cfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1437972599cfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1438972599cfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1439972599cfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1440972599cfSmrg
1441972599cfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1442972599cfSmrg
1443972599cfSmrgAC_MSG_CHECKING([whether to build documentation])
1444972599cfSmrg
1445972599cfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1446972599cfSmrg   BUILDDOC=yes
1447972599cfSmrgelse
1448972599cfSmrg   BUILDDOC=no
1449972599cfSmrgfi
1450972599cfSmrg
1451972599cfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1452972599cfSmrg
1453972599cfSmrgAC_MSG_RESULT([$BUILDDOC])
1454972599cfSmrg
1455972599cfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1456972599cfSmrg
1457972599cfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1458972599cfSmrg   BUILDPDFDOC=yes
1459972599cfSmrgelse
1460972599cfSmrg   BUILDPDFDOC=no
1461972599cfSmrgfi
1462972599cfSmrg
1463972599cfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1464972599cfSmrg
1465972599cfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1466972599cfSmrg
1467972599cfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1468972599cfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1469972599cfSmrgMAKE_PDF="$PS2PDF"
1470972599cfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1471972599cfSmrg
1472972599cfSmrgAC_SUBST(MAKE_TEXT)
1473972599cfSmrgAC_SUBST(MAKE_PS)
1474972599cfSmrgAC_SUBST(MAKE_PDF)
1475972599cfSmrgAC_SUBST(MAKE_HTML)
1476972599cfSmrg]) # XORG_CHECK_LINUXDOC
1477972599cfSmrg
1478972599cfSmrg# XORG_CHECK_DOCBOOK
1479972599cfSmrg# -------------------
1480972599cfSmrg# Minimum version: 1.0.0
1481972599cfSmrg#
1482972599cfSmrg# Checks for the ability to build output formats from SGML DocBook source.
1483972599cfSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1484972599cfSmrg# indicates whether the necessary tools and files are found and, if set,
1485972599cfSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1486972599cfSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1487972599cfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1488972599cfSmrg
1489972599cfSmrgBUILDTXTDOC=no
1490972599cfSmrgBUILDPDFDOC=no
1491972599cfSmrgBUILDPSDOC=no
1492972599cfSmrgBUILDHTMLDOC=no
1493972599cfSmrg
1494972599cfSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1495972599cfSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1496972599cfSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1497972599cfSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1498972599cfSmrg
1499972599cfSmrgAC_MSG_CHECKING([whether to build text documentation])
1500972599cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1501972599cfSmrg   test x$BUILD_TXTDOC != xno; then
1502972599cfSmrg	BUILDTXTDOC=yes
1503972599cfSmrgfi
1504972599cfSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1505972599cfSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1506972599cfSmrg
1507972599cfSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1508972599cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1509972599cfSmrg   test x$BUILD_PDFDOC != xno; then
1510972599cfSmrg	BUILDPDFDOC=yes
1511972599cfSmrgfi
1512972599cfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1513972599cfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1514972599cfSmrg
1515972599cfSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1516972599cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1517972599cfSmrg   test x$BUILD_PSDOC != xno; then
1518972599cfSmrg	BUILDPSDOC=yes
1519972599cfSmrgfi
1520972599cfSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1521972599cfSmrgAC_MSG_RESULT([$BUILDPSDOC])
1522972599cfSmrg
1523972599cfSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1524972599cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1525972599cfSmrg   test x$BUILD_HTMLDOC != xno; then
1526972599cfSmrg	BUILDHTMLDOC=yes
1527972599cfSmrgfi
1528972599cfSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1529972599cfSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1530972599cfSmrg
1531972599cfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1532972599cfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1533972599cfSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1534972599cfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1535972599cfSmrg
1536972599cfSmrgAC_SUBST(MAKE_TEXT)
1537972599cfSmrgAC_SUBST(MAKE_PS)
1538972599cfSmrgAC_SUBST(MAKE_PDF)
1539972599cfSmrgAC_SUBST(MAKE_HTML)
1540972599cfSmrg]) # XORG_CHECK_DOCBOOK
1541972599cfSmrg
1542972599cfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1543972599cfSmrg# ----------------
1544972599cfSmrg# Minimum version: 1.5.0
1545972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1546972599cfSmrg#
1547972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1548972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1549972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1550972599cfSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1551972599cfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1552972599cfSmrg# --with-xmlto assumes 'auto'.
1553972599cfSmrg#
1554972599cfSmrg# Interface to module:
1555972599cfSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1556972599cfSmrg# XMLTO:	returns the path of the xmlto program found
1557972599cfSmrg#		returns the path set by the user in the environment
1558972599cfSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1559972599cfSmrg#		'no' user instructs the module not to use xmlto
1560972599cfSmrg#
1561972599cfSmrg# Added in version 1.10.0
1562972599cfSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1563972599cfSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1564972599cfSmrg#
1565972599cfSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1566972599cfSmrg#
1567972599cfSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1568972599cfSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1569972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1570972599cfSmrgAC_ARG_WITH(xmlto,
1571972599cfSmrg	AS_HELP_STRING([--with-xmlto],
1572972599cfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1573972599cfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1574972599cfSmrgm4_undefine([_defopt])
1575972599cfSmrg
1576972599cfSmrgif test "x$use_xmlto" = x"auto"; then
1577972599cfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1578972599cfSmrg   if test "x$XMLTO" = "x"; then
1579972599cfSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1580972599cfSmrg	have_xmlto=no
1581972599cfSmrg   else
1582972599cfSmrg        have_xmlto=yes
1583972599cfSmrg   fi
1584972599cfSmrgelif test "x$use_xmlto" = x"yes" ; then
1585972599cfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1586972599cfSmrg   if test "x$XMLTO" = "x"; then
1587972599cfSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1588972599cfSmrg   fi
1589972599cfSmrg   have_xmlto=yes
1590972599cfSmrgelif test "x$use_xmlto" = x"no" ; then
1591972599cfSmrg   if test "x$XMLTO" != "x"; then
1592972599cfSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1593972599cfSmrg   fi
1594972599cfSmrg   have_xmlto=no
1595972599cfSmrgelse
1596972599cfSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1597972599cfSmrgfi
1598972599cfSmrg
1599972599cfSmrg# Test for a minimum version of xmlto, if provided.
1600972599cfSmrgm4_ifval([$1],
1601972599cfSmrg[if test "$have_xmlto" = yes; then
1602972599cfSmrg    # scrape the xmlto version
1603972599cfSmrg    AC_MSG_CHECKING([the xmlto version])
1604972599cfSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1605972599cfSmrg    AC_MSG_RESULT([$xmlto_version])
1606972599cfSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1607972599cfSmrg        [if test "x$use_xmlto" = xauto; then
1608972599cfSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1609972599cfSmrg            have_xmlto=no
1610972599cfSmrg        else
1611972599cfSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1612972599cfSmrg        fi])
1613972599cfSmrgfi])
1614972599cfSmrg
1615972599cfSmrg# Test for the ability of xmlto to generate a text target
1616972599cfSmrghave_xmlto_text=no
1617972599cfSmrgcat > conftest.xml << "EOF"
1618972599cfSmrgEOF
1619972599cfSmrgAS_IF([test "$have_xmlto" = yes],
1620972599cfSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1621972599cfSmrg             [have_xmlto_text=yes],
1622972599cfSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1623972599cfSmrgrm -f conftest.xml
1624972599cfSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1625972599cfSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1626972599cfSmrg]) # XORG_WITH_XMLTO
1627972599cfSmrg
1628972599cfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1629972599cfSmrg# --------------------------------------------
1630972599cfSmrg# Minimum version: 1.12.0
1631972599cfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1632972599cfSmrg#
1633972599cfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1634972599cfSmrg# XML-based language used for the transformation of XML documents.
1635972599cfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1636972599cfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1637972599cfSmrg# The XSLT processor is often used as a standalone tool for transformations.
1638972599cfSmrg# It should not be assumed that this tool is used only to work with documnetation.
1639972599cfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1640972599cfSmrg#
1641972599cfSmrg# Interface to module:
1642972599cfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1643972599cfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1644972599cfSmrg#		 returns the path set by the user in the environment
1645972599cfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1646972599cfSmrg#		  'no' user instructs the module not to use xsltproc
1647972599cfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1648972599cfSmrg#
1649972599cfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1650972599cfSmrg#
1651972599cfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1652972599cfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1653972599cfSmrg# Preserves the interface, should it be implemented later
1654972599cfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1655972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1656972599cfSmrgAC_ARG_WITH(xsltproc,
1657972599cfSmrg	AS_HELP_STRING([--with-xsltproc],
1658972599cfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1659972599cfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1660972599cfSmrgm4_undefine([_defopt])
1661972599cfSmrg
1662972599cfSmrgif test "x$use_xsltproc" = x"auto"; then
1663972599cfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1664972599cfSmrg   if test "x$XSLTPROC" = "x"; then
1665972599cfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1666972599cfSmrg	have_xsltproc=no
1667972599cfSmrg   else
1668972599cfSmrg        have_xsltproc=yes
1669972599cfSmrg   fi
1670972599cfSmrgelif test "x$use_xsltproc" = x"yes" ; then
1671972599cfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1672972599cfSmrg   if test "x$XSLTPROC" = "x"; then
1673972599cfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1674972599cfSmrg   fi
1675972599cfSmrg   have_xsltproc=yes
1676972599cfSmrgelif test "x$use_xsltproc" = x"no" ; then
1677972599cfSmrg   if test "x$XSLTPROC" != "x"; then
1678972599cfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1679972599cfSmrg   fi
1680972599cfSmrg   have_xsltproc=no
1681972599cfSmrgelse
1682972599cfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1683972599cfSmrgfi
1684972599cfSmrg
1685972599cfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1686972599cfSmrg]) # XORG_WITH_XSLTPROC
1687972599cfSmrg
1688972599cfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1689972599cfSmrg# ----------------------------------------
1690972599cfSmrg# Minimum version: 1.15.0
1691972599cfSmrg#
1692972599cfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1693972599cfSmrg# scanning arbitrary text files, extracting information from those text files,
1694972599cfSmrg# and printing reports based on that information.
1695972599cfSmrg#
1696972599cfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1697972599cfSmrg#
1698972599cfSmrg# Interface to module:
1699972599cfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1700972599cfSmrg# PERL:	     returns the path of the perl program found
1701972599cfSmrg#	     returns the path set by the user in the environment
1702972599cfSmrg# --with-perl: 'yes' user instructs the module to use perl
1703972599cfSmrg#	       'no' user instructs the module not to use perl
1704972599cfSmrg# have_perl: returns yes if perl found in PATH or no
1705972599cfSmrg#
1706972599cfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1707972599cfSmrg#
1708972599cfSmrgAC_DEFUN([XORG_WITH_PERL],[
1709972599cfSmrgAC_ARG_VAR([PERL], [Path to perl command])
1710972599cfSmrg# Preserves the interface, should it be implemented later
1711972599cfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1712972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1713972599cfSmrgAC_ARG_WITH(perl,
1714972599cfSmrg	AS_HELP_STRING([--with-perl],
1715972599cfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1716972599cfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1717972599cfSmrgm4_undefine([_defopt])
1718972599cfSmrg
1719972599cfSmrgif test "x$use_perl" = x"auto"; then
1720972599cfSmrg   AC_PATH_PROG([PERL], [perl])
1721972599cfSmrg   if test "x$PERL" = "x"; then
1722972599cfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1723972599cfSmrg	have_perl=no
1724972599cfSmrg   else
1725972599cfSmrg        have_perl=yes
1726972599cfSmrg   fi
1727972599cfSmrgelif test "x$use_perl" = x"yes" ; then
1728972599cfSmrg   AC_PATH_PROG([PERL], [perl])
1729972599cfSmrg   if test "x$PERL" = "x"; then
1730972599cfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1731972599cfSmrg   fi
1732972599cfSmrg   have_perl=yes
1733972599cfSmrgelif test "x$use_perl" = x"no" ; then
1734972599cfSmrg   if test "x$PERL" != "x"; then
1735972599cfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1736972599cfSmrg   fi
1737972599cfSmrg   have_perl=no
1738972599cfSmrgelse
1739972599cfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1740972599cfSmrgfi
1741972599cfSmrg
1742972599cfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1743972599cfSmrg]) # XORG_WITH_PERL
1744972599cfSmrg
1745972599cfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1746972599cfSmrg# ----------------
1747972599cfSmrg# Minimum version: 1.5.0
1748972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1749972599cfSmrg#
1750972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1751972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1752972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1753972599cfSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1754972599cfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1755972599cfSmrg# --with-asciidoc assumes 'auto'.
1756972599cfSmrg#
1757972599cfSmrg# Interface to module:
1758972599cfSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1759972599cfSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1760972599cfSmrg#		 returns the path set by the user in the environment
1761972599cfSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1762972599cfSmrg#		  'no' user instructs the module not to use asciidoc
1763972599cfSmrg#
1764972599cfSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1765972599cfSmrg#
1766972599cfSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1767972599cfSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1768972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1769972599cfSmrgAC_ARG_WITH(asciidoc,
1770972599cfSmrg	AS_HELP_STRING([--with-asciidoc],
1771972599cfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1772972599cfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1773972599cfSmrgm4_undefine([_defopt])
1774972599cfSmrg
1775972599cfSmrgif test "x$use_asciidoc" = x"auto"; then
1776972599cfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1777972599cfSmrg   if test "x$ASCIIDOC" = "x"; then
1778972599cfSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1779972599cfSmrg	have_asciidoc=no
1780972599cfSmrg   else
1781972599cfSmrg        have_asciidoc=yes
1782972599cfSmrg   fi
1783972599cfSmrgelif test "x$use_asciidoc" = x"yes" ; then
1784972599cfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1785972599cfSmrg   if test "x$ASCIIDOC" = "x"; then
1786972599cfSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1787972599cfSmrg   fi
1788972599cfSmrg   have_asciidoc=yes
1789972599cfSmrgelif test "x$use_asciidoc" = x"no" ; then
1790972599cfSmrg   if test "x$ASCIIDOC" != "x"; then
1791972599cfSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1792972599cfSmrg   fi
1793972599cfSmrg   have_asciidoc=no
1794972599cfSmrgelse
1795972599cfSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1796972599cfSmrgfi
1797972599cfSmrgm4_ifval([$1],
1798972599cfSmrg[if test "$have_asciidoc" = yes; then
1799972599cfSmrg    # scrape the asciidoc version
1800972599cfSmrg    AC_MSG_CHECKING([the asciidoc version])
1801972599cfSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1802972599cfSmrg    AC_MSG_RESULT([$asciidoc_version])
1803972599cfSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1804972599cfSmrg        [if test "x$use_asciidoc" = xauto; then
1805972599cfSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1806972599cfSmrg            have_asciidoc=no
1807972599cfSmrg        else
1808972599cfSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1809972599cfSmrg        fi])
1810972599cfSmrgfi])
1811972599cfSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1812972599cfSmrg]) # XORG_WITH_ASCIIDOC
1813972599cfSmrg
1814972599cfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1815972599cfSmrg# --------------------------------
1816972599cfSmrg# Minimum version: 1.5.0
1817972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1818972599cfSmrg#
1819972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1820972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1821972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1822972599cfSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1823972599cfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1824972599cfSmrg# --with-doxygen assumes 'auto'.
1825972599cfSmrg#
1826972599cfSmrg# Interface to module:
1827972599cfSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1828972599cfSmrg# DOXYGEN:	 returns the path of the doxygen program found
1829972599cfSmrg#		 returns the path set by the user in the environment
1830972599cfSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1831972599cfSmrg#		  'no' user instructs the module not to use doxygen
1832972599cfSmrg#
1833972599cfSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1834972599cfSmrg#
1835972599cfSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1836972599cfSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1837972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1838972599cfSmrgAC_ARG_WITH(doxygen,
1839972599cfSmrg	AS_HELP_STRING([--with-doxygen],
1840972599cfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1841972599cfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1842972599cfSmrgm4_undefine([_defopt])
1843972599cfSmrg
1844972599cfSmrgif test "x$use_doxygen" = x"auto"; then
1845972599cfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1846972599cfSmrg   if test "x$DOXYGEN" = "x"; then
1847972599cfSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1848972599cfSmrg	have_doxygen=no
1849972599cfSmrg   else
1850972599cfSmrg        have_doxygen=yes
1851972599cfSmrg   fi
1852972599cfSmrgelif test "x$use_doxygen" = x"yes" ; then
1853972599cfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1854972599cfSmrg   if test "x$DOXYGEN" = "x"; then
1855972599cfSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1856972599cfSmrg   fi
1857972599cfSmrg   have_doxygen=yes
1858972599cfSmrgelif test "x$use_doxygen" = x"no" ; then
1859972599cfSmrg   if test "x$DOXYGEN" != "x"; then
1860972599cfSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1861972599cfSmrg   fi
1862972599cfSmrg   have_doxygen=no
1863972599cfSmrgelse
1864972599cfSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1865972599cfSmrgfi
1866972599cfSmrgm4_ifval([$1],
1867972599cfSmrg[if test "$have_doxygen" = yes; then
1868972599cfSmrg    # scrape the doxygen version
1869972599cfSmrg    AC_MSG_CHECKING([the doxygen version])
1870972599cfSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1871972599cfSmrg    AC_MSG_RESULT([$doxygen_version])
1872972599cfSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1873972599cfSmrg        [if test "x$use_doxygen" = xauto; then
1874972599cfSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1875972599cfSmrg            have_doxygen=no
1876972599cfSmrg        else
1877972599cfSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1878972599cfSmrg        fi])
1879972599cfSmrgfi])
1880972599cfSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1881972599cfSmrg]) # XORG_WITH_DOXYGEN
1882972599cfSmrg
1883972599cfSmrg# XORG_WITH_GROFF([DEFAULT])
1884972599cfSmrg# ----------------
1885972599cfSmrg# Minimum version: 1.6.0
1886972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1887972599cfSmrg#
1888972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1889972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1890972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1891972599cfSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1892972599cfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1893972599cfSmrg# --with-groff assumes 'auto'.
1894972599cfSmrg#
1895972599cfSmrg# Interface to module:
1896972599cfSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1897972599cfSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1898972599cfSmrg# HAVE_GROFF_MS: the -ms macros package
1899972599cfSmrg# GROFF:	 returns the path of the groff program found
1900972599cfSmrg#		 returns the path set by the user in the environment
1901972599cfSmrg# --with-groff:	 'yes' user instructs the module to use groff
1902972599cfSmrg#		 'no' user instructs the module not to use groff
1903972599cfSmrg#
1904972599cfSmrg# Added in version 1.9.0:
1905972599cfSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1906972599cfSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1907972599cfSmrg#		   psselect from the psutils package.
1908972599cfSmrg#		   the ghostcript package. Refer to the grohtml man pages
1909972599cfSmrg#
1910972599cfSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1911972599cfSmrg#
1912972599cfSmrg# OS and distros often splits groff in a basic and full package, the former
1913972599cfSmrg# having the groff program and the later having devices, fonts and macros
1914972599cfSmrg# Checking for the groff executable is not enough.
1915972599cfSmrg#
1916972599cfSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1917972599cfSmrg# unset HAVE_GROFF or GROFF env variables.
1918972599cfSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1919972599cfSmrg#
1920972599cfSmrgAC_DEFUN([XORG_WITH_GROFF],[
1921972599cfSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1922972599cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
1923972599cfSmrgAC_ARG_WITH(groff,
1924972599cfSmrg	AS_HELP_STRING([--with-groff],
1925972599cfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1926972599cfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1927972599cfSmrgm4_undefine([_defopt])
1928972599cfSmrg
1929972599cfSmrgif test "x$use_groff" = x"auto"; then
1930972599cfSmrg   AC_PATH_PROG([GROFF], [groff])
1931972599cfSmrg   if test "x$GROFF" = "x"; then
1932972599cfSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1933972599cfSmrg	have_groff=no
1934972599cfSmrg   else
1935972599cfSmrg        have_groff=yes
1936972599cfSmrg   fi
1937972599cfSmrgelif test "x$use_groff" = x"yes" ; then
1938972599cfSmrg   AC_PATH_PROG([GROFF], [groff])
1939972599cfSmrg   if test "x$GROFF" = "x"; then
1940972599cfSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1941972599cfSmrg   fi
1942972599cfSmrg   have_groff=yes
1943972599cfSmrgelif test "x$use_groff" = x"no" ; then
1944972599cfSmrg   if test "x$GROFF" != "x"; then
1945972599cfSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1946972599cfSmrg   fi
1947972599cfSmrg   have_groff=no
1948972599cfSmrgelse
1949972599cfSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1950972599cfSmrgfi
1951972599cfSmrg
1952972599cfSmrg# We have groff, test for the presence of the macro packages
1953972599cfSmrgif test "x$have_groff" = x"yes"; then
1954972599cfSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1955972599cfSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1956972599cfSmrg        groff_ms_works=yes
1957972599cfSmrg    else
1958972599cfSmrg        groff_ms_works=no
1959972599cfSmrg    fi
1960972599cfSmrg    AC_MSG_RESULT([$groff_ms_works])
1961972599cfSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1962972599cfSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1963972599cfSmrg        groff_mm_works=yes
1964972599cfSmrg    else
1965972599cfSmrg        groff_mm_works=no
1966972599cfSmrg    fi
1967972599cfSmrg    AC_MSG_RESULT([$groff_mm_works])
1968972599cfSmrgfi
1969972599cfSmrg
1970972599cfSmrg# We have groff, test for HTML dependencies, one command per package
1971972599cfSmrgif test "x$have_groff" = x"yes"; then
1972972599cfSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1973972599cfSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1974972599cfSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1975972599cfSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1976972599cfSmrg      have_groff_html=yes
1977972599cfSmrg   else
1978972599cfSmrg      have_groff_html=no
1979972599cfSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1980972599cfSmrg   fi
1981972599cfSmrgfi
1982972599cfSmrg
1983972599cfSmrg# Set Automake conditionals for Makefiles
1984972599cfSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1985972599cfSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1986972599cfSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1987972599cfSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1988972599cfSmrg]) # XORG_WITH_GROFF
1989972599cfSmrg
1990972599cfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1991972599cfSmrg# ---------------------------------------
1992972599cfSmrg# Minimum version: 1.6.0
1993972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1994972599cfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1995972599cfSmrg#
1996972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
1997972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
1998972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1999972599cfSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2000972599cfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2001972599cfSmrg# --with-fop assumes 'auto'.
2002972599cfSmrg#
2003972599cfSmrg# Interface to module:
2004972599cfSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2005972599cfSmrg# FOP:	 	returns the path of the fop program found
2006972599cfSmrg#		returns the path set by the user in the environment
2007972599cfSmrg# --with-fop: 	'yes' user instructs the module to use fop
2008972599cfSmrg#		'no' user instructs the module not to use fop
2009972599cfSmrg#
2010972599cfSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2011972599cfSmrg#
2012972599cfSmrgAC_DEFUN([XORG_WITH_FOP],[
2013972599cfSmrgAC_ARG_VAR([FOP], [Path to fop command])
2014972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2015972599cfSmrgAC_ARG_WITH(fop,
2016972599cfSmrg	AS_HELP_STRING([--with-fop],
2017972599cfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2018972599cfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2019972599cfSmrgm4_undefine([_defopt])
2020972599cfSmrg
2021972599cfSmrgif test "x$use_fop" = x"auto"; then
2022972599cfSmrg   AC_PATH_PROG([FOP], [fop])
2023972599cfSmrg   if test "x$FOP" = "x"; then
2024972599cfSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2025972599cfSmrg	have_fop=no
2026972599cfSmrg   else
2027972599cfSmrg        have_fop=yes
2028972599cfSmrg   fi
2029972599cfSmrgelif test "x$use_fop" = x"yes" ; then
2030972599cfSmrg   AC_PATH_PROG([FOP], [fop])
2031972599cfSmrg   if test "x$FOP" = "x"; then
2032972599cfSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2033972599cfSmrg   fi
2034972599cfSmrg   have_fop=yes
2035972599cfSmrgelif test "x$use_fop" = x"no" ; then
2036972599cfSmrg   if test "x$FOP" != "x"; then
2037972599cfSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2038972599cfSmrg   fi
2039972599cfSmrg   have_fop=no
2040972599cfSmrgelse
2041972599cfSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2042972599cfSmrgfi
2043972599cfSmrg
2044972599cfSmrg# Test for a minimum version of fop, if provided.
2045972599cfSmrgm4_ifval([$1],
2046972599cfSmrg[if test "$have_fop" = yes; then
2047972599cfSmrg    # scrape the fop version
2048972599cfSmrg    AC_MSG_CHECKING([for fop minimum version])
2049972599cfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2050972599cfSmrg    AC_MSG_RESULT([$fop_version])
2051972599cfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2052972599cfSmrg        [if test "x$use_fop" = xauto; then
2053972599cfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2054972599cfSmrg            have_fop=no
2055972599cfSmrg        else
2056972599cfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2057972599cfSmrg        fi])
2058972599cfSmrgfi])
2059972599cfSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2060972599cfSmrg]) # XORG_WITH_FOP
2061972599cfSmrg
2062972599cfSmrg# XORG_WITH_PS2PDF([DEFAULT])
2063972599cfSmrg# ----------------
2064972599cfSmrg# Minimum version: 1.6.0
2065972599cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2066972599cfSmrg#
2067972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
2068972599cfSmrg# not at the appropriate level. This macro enables a module to test for the
2069972599cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2070972599cfSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2071972599cfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2072972599cfSmrg# --with-ps2pdf assumes 'auto'.
2073972599cfSmrg#
2074972599cfSmrg# Interface to module:
2075972599cfSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2076972599cfSmrg# PS2PDF:	returns the path of the ps2pdf program found
2077972599cfSmrg#		returns the path set by the user in the environment
2078972599cfSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2079972599cfSmrg#		 'no' user instructs the module not to use ps2pdf
2080972599cfSmrg#
2081972599cfSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2082972599cfSmrg#
2083972599cfSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2084972599cfSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2085972599cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2086972599cfSmrgAC_ARG_WITH(ps2pdf,
2087972599cfSmrg	AS_HELP_STRING([--with-ps2pdf],
2088972599cfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2089972599cfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2090972599cfSmrgm4_undefine([_defopt])
2091972599cfSmrg
2092972599cfSmrgif test "x$use_ps2pdf" = x"auto"; then
2093972599cfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2094972599cfSmrg   if test "x$PS2PDF" = "x"; then
2095972599cfSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2096972599cfSmrg	have_ps2pdf=no
2097972599cfSmrg   else
2098972599cfSmrg        have_ps2pdf=yes
2099972599cfSmrg   fi
2100972599cfSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2101972599cfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2102972599cfSmrg   if test "x$PS2PDF" = "x"; then
2103972599cfSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2104972599cfSmrg   fi
2105972599cfSmrg   have_ps2pdf=yes
2106972599cfSmrgelif test "x$use_ps2pdf" = x"no" ; then
2107972599cfSmrg   if test "x$PS2PDF" != "x"; then
2108972599cfSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2109972599cfSmrg   fi
2110972599cfSmrg   have_ps2pdf=no
2111972599cfSmrgelse
2112972599cfSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2113972599cfSmrgfi
2114972599cfSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2115972599cfSmrg]) # XORG_WITH_PS2PDF
2116972599cfSmrg
2117972599cfSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2118972599cfSmrg# ----------------
2119972599cfSmrg# Minimum version: 1.6.0
2120972599cfSmrg#
2121972599cfSmrg# Documentation tools are not always available on all platforms and sometimes
2122972599cfSmrg# not at the appropriate level. This macro enables a builder to skip all
2123972599cfSmrg# documentation targets except traditional man pages.
2124972599cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2125972599cfSmrg# maximum flexibilty in controlling documentation building.
2126972599cfSmrg# Refer to:
2127972599cfSmrg# XORG_WITH_XMLTO         --with-xmlto
2128972599cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2129972599cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2130972599cfSmrg# XORG_WITH_FOP           --with-fop
2131972599cfSmrg# XORG_WITH_GROFF         --with-groff
2132972599cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2133972599cfSmrg#
2134972599cfSmrg# Interface to module:
2135972599cfSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2136972599cfSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2137972599cfSmrg#		 'no' user instructs the module not to generate docs
2138972599cfSmrg# parm1:	specify the default value, yes or no.
2139972599cfSmrg#
2140972599cfSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2141972599cfSmrgm4_define([docs_default], m4_default([$1], [yes]))
2142972599cfSmrgAC_ARG_ENABLE(docs,
2143972599cfSmrg	AS_HELP_STRING([--enable-docs],
2144972599cfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2145972599cfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2146972599cfSmrgm4_undefine([docs_default])
2147972599cfSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2148972599cfSmrgAC_MSG_CHECKING([whether to build documentation])
2149972599cfSmrgAC_MSG_RESULT([$build_docs])
2150972599cfSmrg]) # XORG_ENABLE_DOCS
2151972599cfSmrg
2152972599cfSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2153972599cfSmrg# ----------------
2154972599cfSmrg# Minimum version: 1.6.0
2155972599cfSmrg#
2156972599cfSmrg# This macro enables a builder to skip all developer documentation.
2157972599cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2158972599cfSmrg# maximum flexibilty in controlling documentation building.
2159972599cfSmrg# Refer to:
2160972599cfSmrg# XORG_WITH_XMLTO         --with-xmlto
2161972599cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2162972599cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2163972599cfSmrg# XORG_WITH_FOP           --with-fop
2164972599cfSmrg# XORG_WITH_GROFF         --with-groff
2165972599cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2166972599cfSmrg#
2167972599cfSmrg# Interface to module:
2168972599cfSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2169972599cfSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2170972599cfSmrg#			'no' user instructs the module not to generate developer docs
2171972599cfSmrg# parm1:		specify the default value, yes or no.
2172972599cfSmrg#
2173972599cfSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2174972599cfSmrgm4_define([devel_default], m4_default([$1], [yes]))
2175972599cfSmrgAC_ARG_ENABLE(devel-docs,
2176972599cfSmrg	AS_HELP_STRING([--enable-devel-docs],
2177972599cfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2178972599cfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2179972599cfSmrgm4_undefine([devel_default])
2180972599cfSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2181972599cfSmrgAC_MSG_CHECKING([whether to build developer documentation])
2182972599cfSmrgAC_MSG_RESULT([$build_devel_docs])
2183972599cfSmrg]) # XORG_ENABLE_DEVEL_DOCS
2184972599cfSmrg
2185972599cfSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2186972599cfSmrg# ----------------
2187972599cfSmrg# Minimum version: 1.6.0
2188972599cfSmrg#
2189972599cfSmrg# This macro enables a builder to skip all functional specification targets.
2190972599cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2191972599cfSmrg# maximum flexibilty in controlling documentation building.
2192972599cfSmrg# Refer to:
2193972599cfSmrg# XORG_WITH_XMLTO         --with-xmlto
2194972599cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2195972599cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2196972599cfSmrg# XORG_WITH_FOP           --with-fop
2197972599cfSmrg# XORG_WITH_GROFF         --with-groff
2198972599cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2199972599cfSmrg#
2200972599cfSmrg# Interface to module:
2201972599cfSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2202972599cfSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2203972599cfSmrg#			'no' user instructs the module not to generate specs
2204972599cfSmrg# parm1:		specify the default value, yes or no.
2205972599cfSmrg#
2206972599cfSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2207972599cfSmrgm4_define([spec_default], m4_default([$1], [yes]))
2208972599cfSmrgAC_ARG_ENABLE(specs,
2209972599cfSmrg	AS_HELP_STRING([--enable-specs],
2210972599cfSmrg	   [Enable building the specs (default: ]spec_default[)]),
2211972599cfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2212972599cfSmrgm4_undefine([spec_default])
2213972599cfSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2214972599cfSmrgAC_MSG_CHECKING([whether to build functional specifications])
2215972599cfSmrgAC_MSG_RESULT([$build_specs])
2216972599cfSmrg]) # XORG_ENABLE_SPECS
2217972599cfSmrg
2218972599cfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2219972599cfSmrg# ----------------------------------------------
2220972599cfSmrg# Minimum version: 1.13.0
2221972599cfSmrg#
2222972599cfSmrg# This macro enables a builder to enable/disable unit testing
2223972599cfSmrg# It makes no assumption about the test cases implementation
2224972599cfSmrg# Test cases may or may not use Automake "Support for test suites"
2225972599cfSmrg# They may or may not use the software utility library GLib
2226972599cfSmrg#
2227972599cfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2228972599cfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2229972599cfSmrg# The variable enable_unit_tests is used by other macros in this file.
2230972599cfSmrg#
2231972599cfSmrg# Interface to module:
2232972599cfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2233972599cfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2234972599cfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2235972599cfSmrg#			'no' user instructs the module not to build tests
2236972599cfSmrg# parm1:		specify the default value, yes or no.
2237972599cfSmrg#
2238972599cfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2239972599cfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2240972599cfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2241972599cfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2242972599cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2243972599cfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2244972599cfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2245972599cfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2246972599cfSmrgm4_undefine([_defopt])
2247972599cfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2248972599cfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2249972599cfSmrgAC_MSG_RESULT([$enable_unit_tests])
2250972599cfSmrg]) # XORG_ENABLE_UNIT_TESTS
2251972599cfSmrg
2252972599cfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2253972599cfSmrg# ------------------------------------------------------
2254972599cfSmrg# Minimum version: 1.17.0
2255972599cfSmrg#
2256972599cfSmrg# This macro enables a builder to enable/disable integration testing
2257972599cfSmrg# It makes no assumption about the test cases' implementation
2258972599cfSmrg# Test cases may or may not use Automake "Support for test suites"
2259972599cfSmrg#
2260972599cfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2261972599cfSmrg# usually requires less dependencies and may be built and run under less
2262972599cfSmrg# stringent environments than integration tests.
2263972599cfSmrg#
2264972599cfSmrg# Interface to module:
2265972599cfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2266972599cfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2267972599cfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2268972599cfSmrg#                             'no' user instructs the module not to build tests
2269972599cfSmrg# parm1:                      specify the default value, yes or no.
2270972599cfSmrg#
2271972599cfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2272972599cfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2273972599cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2274972599cfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2275972599cfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2276972599cfSmrg	[enable_integration_tests=$enableval],
2277972599cfSmrg	[enable_integration_tests=]_defopt)
2278972599cfSmrgm4_undefine([_defopt])
2279972599cfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2280972599cfSmrg	[test "x$enable_integration_tests" != xno])
2281972599cfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2282972599cfSmrgAC_MSG_RESULT([$enable_integration_tests])
2283972599cfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2284972599cfSmrg
2285972599cfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2286972599cfSmrg# ----------------------------------------
2287972599cfSmrg# Minimum version: 1.13.0
2288972599cfSmrg#
2289972599cfSmrg# GLib is a library which provides advanced data structures and functions.
2290972599cfSmrg# This macro enables a module to test for the presence of Glib.
2291972599cfSmrg#
2292972599cfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2293972599cfSmrg# Otherwise the value of $enable_unit_tests is blank.
2294972599cfSmrg#
2295972599cfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2296972599cfSmrg# test support usually requires less dependencies and may be built and run under
2297972599cfSmrg# less stringent environments than integration tests.
2298972599cfSmrg#
2299972599cfSmrg# Interface to module:
2300972599cfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2301972599cfSmrg# with_glib: used in configure.ac to know if GLib has been found
2302972599cfSmrg# --with-glib:	'yes' user instructs the module to use glib
2303972599cfSmrg#		'no' user instructs the module not to use glib
2304972599cfSmrg#
2305972599cfSmrgAC_DEFUN([XORG_WITH_GLIB],[
2306972599cfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2307972599cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2308972599cfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2309972599cfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2310972599cfSmrg	[with_glib=$withval], [with_glib=]_defopt)
2311972599cfSmrgm4_undefine([_defopt])
2312972599cfSmrg
2313972599cfSmrghave_glib=no
2314972599cfSmrg# Do not probe GLib if user explicitly disabled unit testing
2315972599cfSmrgif test "x$enable_unit_tests" != x"no"; then
2316972599cfSmrg  # Do not probe GLib if user explicitly disabled it
2317972599cfSmrg  if test "x$with_glib" != x"no"; then
2318972599cfSmrg    m4_ifval(
2319972599cfSmrg      [$1],
2320972599cfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2321972599cfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2322972599cfSmrg    )
2323972599cfSmrg  fi
2324972599cfSmrgfi
2325972599cfSmrg
2326972599cfSmrg# Not having GLib when unit testing has been explicitly requested is an error
2327972599cfSmrgif test "x$enable_unit_tests" = x"yes"; then
2328972599cfSmrg  if test "x$have_glib" = x"no"; then
2329972599cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2330972599cfSmrg  fi
2331972599cfSmrgfi
2332972599cfSmrg
2333972599cfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2334972599cfSmrgif test "x$enable_unit_tests" = x"no"; then
2335972599cfSmrg  if test "x$with_glib" = x"yes"; then
2336972599cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2337972599cfSmrg  fi
2338972599cfSmrgfi
2339972599cfSmrg
2340972599cfSmrg# Not having GLib when it has been explicitly requested is an error
2341972599cfSmrgif test "x$with_glib" = x"yes"; then
2342972599cfSmrg  if test "x$have_glib" = x"no"; then
2343972599cfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2344972599cfSmrg  fi
2345972599cfSmrgfi
2346972599cfSmrg
2347972599cfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2348972599cfSmrg]) # XORG_WITH_GLIB
2349972599cfSmrg
2350972599cfSmrg# XORG_LD_WRAP([required|optional])
2351972599cfSmrg# ---------------------------------
2352972599cfSmrg# Minimum version: 1.13.0
2353972599cfSmrg#
2354972599cfSmrg# Check if linker supports -wrap, passed via compiler flags
2355972599cfSmrg#
2356972599cfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2357972599cfSmrg# Otherwise the value of $enable_unit_tests is blank.
2358972599cfSmrg#
2359972599cfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2360972599cfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2361972599cfSmrg# available, an argument of "optional" allows use when some unit tests require
2362972599cfSmrg# ld -wrap and others do not.
2363972599cfSmrg#
2364972599cfSmrgAC_DEFUN([XORG_LD_WRAP],[
2365972599cfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2366972599cfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2367972599cfSmrg                      void __wrap_exit(int status) { return; }],
2368972599cfSmrg                     [exit(0);])])
2369972599cfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2370972599cfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2371972599cfSmrg  if test "x$have_ld_wrap" = x"no"; then
2372972599cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2373972599cfSmrg  fi
2374972599cfSmrgfi
2375972599cfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2376972599cfSmrg#
2377972599cfSmrg]) # XORG_LD_WRAP
2378972599cfSmrg
2379972599cfSmrg# XORG_CHECK_LINKER_FLAGS
2380972599cfSmrg# -----------------------
2381972599cfSmrg# SYNOPSIS
2382972599cfSmrg#
2383972599cfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2384972599cfSmrg#
2385972599cfSmrg# DESCRIPTION
2386972599cfSmrg#
2387972599cfSmrg#   Check whether the given linker FLAGS work with the current language's
2388972599cfSmrg#   linker, or whether they give an error.
2389972599cfSmrg#
2390972599cfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2391972599cfSmrg#   success/failure.
2392972599cfSmrg#
2393972599cfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2394972599cfSmrg#
2395972599cfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2396972599cfSmrg#
2397972599cfSmrg# LICENSE
2398972599cfSmrg#
2399972599cfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2400972599cfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2401972599cfSmrg#   Copyright (c) 2009 Matteo Frigo
2402972599cfSmrg#
2403972599cfSmrg#   This program is free software: you can redistribute it and/or modify it
2404972599cfSmrg#   under the terms of the GNU General Public License as published by the
2405972599cfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2406972599cfSmrg#   option) any later version.
2407972599cfSmrg#
2408972599cfSmrg#   This program is distributed in the hope that it will be useful, but
2409972599cfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2410972599cfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2411972599cfSmrg#   Public License for more details.
2412972599cfSmrg#
2413972599cfSmrg#   You should have received a copy of the GNU General Public License along
2414972599cfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2415972599cfSmrg#
2416972599cfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2417972599cfSmrg#   gives unlimited permission to copy, distribute and modify the configure
2418972599cfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2419972599cfSmrg#   need not follow the terms of the GNU General Public License when using
2420972599cfSmrg#   or distributing such scripts, even though portions of the text of the
2421972599cfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2422972599cfSmrg#   all other use of the material that constitutes the Autoconf Macro.
2423972599cfSmrg#
2424972599cfSmrg#   This special exception to the GPL applies to versions of the Autoconf
2425972599cfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2426972599cfSmrg#   modified version of the Autoconf Macro, you may extend this special
2427972599cfSmrg#   exception to the GPL to apply to your modified version as well.#
2428972599cfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2429972599cfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2430972599cfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2431972599cfSmrgAS_LITERAL_IF([$1],
2432972599cfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2433972599cfSmrg      ax_save_FLAGS=$LDFLAGS
2434972599cfSmrg      LDFLAGS="$1"
2435972599cfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2436972599cfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2437972599cfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2438972599cfSmrg      LDFLAGS=$ax_save_FLAGS])],
2439972599cfSmrg  [ax_save_FLAGS=$LDFLAGS
2440972599cfSmrg   LDFLAGS="$1"
2441972599cfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2442972599cfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2443972599cfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2444972599cfSmrg   LDFLAGS=$ax_save_FLAGS])
2445972599cfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2446972599cfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2447972599cfSmrgif test "x$xorg_check_linker_flags" = xyes; then
2448972599cfSmrg	m4_default([$2], :)
2449972599cfSmrgelse
2450972599cfSmrg	m4_default([$3], :)
2451972599cfSmrgfi
2452972599cfSmrg]) # XORG_CHECK_LINKER_FLAGS
2453972599cfSmrg
2454972599cfSmrg# XORG_MEMORY_CHECK_FLAGS
2455972599cfSmrg# -----------------------
2456972599cfSmrg# Minimum version: 1.16.0
2457972599cfSmrg#
2458972599cfSmrg# This macro attempts to find appropriate memory checking functionality
2459972599cfSmrg# for various platforms which unit testing code may use to catch various
2460972599cfSmrg# forms of memory allocation and access errors in testing.
2461972599cfSmrg#
2462972599cfSmrg# Interface to module:
2463972599cfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2464972599cfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2465972599cfSmrg#
2466972599cfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2467972599cfSmrg#
2468972599cfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2469972599cfSmrg
2470972599cfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2471972599cfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2472972599cfSmrg           [Environment variables to enable memory checking in tests])
2473972599cfSmrg
2474972599cfSmrg# Check for different types of support on different platforms
2475972599cfSmrgcase $host_os in
2476972599cfSmrg    solaris*)
2477972599cfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2478972599cfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2479972599cfSmrg        ;;
2480972599cfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2481972599cfSmrg        # both directly and inverted, so should not be 0 or 255.
2482972599cfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2483972599cfSmrg        ;;
2484972599cfSmrg    darwin*)
2485972599cfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2486972599cfSmrg        ;;
2487972599cfSmrg    *bsd*)
2488972599cfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2489972599cfSmrg        ;;
2490972599cfSmrgesac
2491972599cfSmrg
2492972599cfSmrg# User supplied flags override default flags
2493972599cfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2494972599cfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2495972599cfSmrgfi
2496972599cfSmrg
2497972599cfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2498972599cfSmrg]) # XORG_WITH_LINT
2499972599cfSmrg
2500972599cfSmrg# XORG_CHECK_MALLOC_ZERO
2501972599cfSmrg# ----------------------
2502972599cfSmrg# Minimum version: 1.0.0
2503972599cfSmrg#
2504972599cfSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2505972599cfSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2506972599cfSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2507972599cfSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2508972599cfSmrgAC_ARG_ENABLE(malloc0returnsnull,
2509972599cfSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2510972599cfSmrg		       [malloc(0) returns NULL (default: auto)]),
2511972599cfSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2512972599cfSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2513972599cfSmrg
2514972599cfSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2515972599cfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2516972599cfSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2517972599cfSmrg#include <stdlib.h>
2518972599cfSmrg],[
2519972599cfSmrg    char *m0, *r0, *c0, *p;
2520972599cfSmrg    m0 = malloc(0);
2521972599cfSmrg    p = malloc(10);
2522972599cfSmrg    r0 = realloc(p,0);
2523972599cfSmrg    c0 = calloc(0,10);
2524972599cfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2525972599cfSmrg])],
2526972599cfSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2527972599cfSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
2528972599cfSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2529972599cfSmrgfi
2530972599cfSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2531972599cfSmrg
2532972599cfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2533972599cfSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2534972599cfSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2535972599cfSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2536972599cfSmrgelse
2537972599cfSmrg	MALLOC_ZERO_CFLAGS=""
2538972599cfSmrg	XMALLOC_ZERO_CFLAGS=""
2539972599cfSmrg	XTMALLOC_ZERO_CFLAGS=""
2540972599cfSmrgfi
2541972599cfSmrg
2542972599cfSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2543972599cfSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2544972599cfSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2545972599cfSmrg]) # XORG_CHECK_MALLOC_ZERO
2546972599cfSmrg
2547972599cfSmrg# XORG_WITH_LINT()
2548972599cfSmrg# ----------------
2549972599cfSmrg# Minimum version: 1.1.0
2550972599cfSmrg#
2551972599cfSmrg# This macro enables the use of a tool that flags some suspicious and
2552972599cfSmrg# non-portable constructs (likely to be bugs) in C language source code.
2553972599cfSmrg# It will attempt to locate the tool and use appropriate options.
2554972599cfSmrg# There are various lint type tools on different platforms.
2555972599cfSmrg#
2556972599cfSmrg# Interface to module:
2557972599cfSmrg# LINT:		returns the path to the tool found on the platform
2558972599cfSmrg#		or the value set to LINT on the configure cmd line
2559972599cfSmrg#		also an Automake conditional
2560972599cfSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2561972599cfSmrg#
2562972599cfSmrg# --with-lint:	'yes' user instructs the module to use lint
2563972599cfSmrg#		'no' user instructs the module not to use lint (default)
2564972599cfSmrg#
2565972599cfSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2566972599cfSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2567972599cfSmrg#
2568972599cfSmrgAC_DEFUN([XORG_WITH_LINT],[
2569972599cfSmrg
2570972599cfSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2571972599cfSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2572972599cfSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2573972599cfSmrg		[Use a lint-style source code checker (default: disabled)])],
2574972599cfSmrg		[use_lint=$withval], [use_lint=no])
2575972599cfSmrg
2576972599cfSmrg# Obtain platform specific info like program name and options
2577972599cfSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2578972599cfSmrgcase $host_os in
2579972599cfSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2580972599cfSmrg	lint_name=splint
2581972599cfSmrg	lint_options="-badflag"
2582972599cfSmrg	;;
2583972599cfSmrg  *freebsd* | *netbsd*)
2584972599cfSmrg	lint_name=lint
2585972599cfSmrg	lint_options="-u -b"
2586972599cfSmrg	;;
2587972599cfSmrg  *solaris*)
2588972599cfSmrg	lint_name=lint
2589972599cfSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2590972599cfSmrg	;;
2591972599cfSmrgesac
2592972599cfSmrg
2593972599cfSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2594972599cfSmrgif test "x$use_lint" = x"yes" ; then
2595972599cfSmrg   AC_PATH_PROG([LINT], [$lint_name])
2596972599cfSmrg   if test "x$LINT" = "x"; then
2597972599cfSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2598972599cfSmrg   fi
2599972599cfSmrgelif test "x$use_lint" = x"no" ; then
2600972599cfSmrg   if test "x$LINT" != "x"; then
2601972599cfSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2602972599cfSmrg   fi
2603972599cfSmrgelse
2604972599cfSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2605972599cfSmrgfi
2606972599cfSmrg
2607972599cfSmrg# User supplied flags override default flags
2608972599cfSmrgif test "x$LINT_FLAGS" != "x"; then
2609972599cfSmrg   lint_options=$LINT_FLAGS
2610972599cfSmrgfi
2611972599cfSmrg
2612972599cfSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2613972599cfSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2614972599cfSmrg
2615972599cfSmrg]) # XORG_WITH_LINT
2616972599cfSmrg
2617972599cfSmrg# XORG_LINT_LIBRARY(LIBNAME)
2618972599cfSmrg# --------------------------
2619972599cfSmrg# Minimum version: 1.1.0
2620972599cfSmrg#
2621972599cfSmrg# Sets up flags for building lint libraries for checking programs that call
2622972599cfSmrg# functions in the library.
2623972599cfSmrg#
2624972599cfSmrg# Interface to module:
2625972599cfSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2626972599cfSmrg# MAKE_LINT_LIB		- Automake conditional
2627972599cfSmrg#
2628972599cfSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2629972599cfSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2630972599cfSmrg
2631972599cfSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2632972599cfSmrgAC_REQUIRE([XORG_WITH_LINT])
2633972599cfSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2634972599cfSmrg	[Create lint library (default: disabled)])],
2635972599cfSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2636972599cfSmrg
2637972599cfSmrgif test "x$make_lint_lib" = x"yes" ; then
2638972599cfSmrg   LINTLIB=llib-l$1.ln
2639972599cfSmrg   if test "x$LINT" = "x"; then
2640972599cfSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2641972599cfSmrg   fi
2642972599cfSmrgelif test "x$make_lint_lib" != x"no" ; then
2643972599cfSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2644972599cfSmrgfi
2645972599cfSmrg
2646972599cfSmrgAC_SUBST(LINTLIB)
2647972599cfSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2648972599cfSmrg
2649972599cfSmrg]) # XORG_LINT_LIBRARY
2650972599cfSmrg
2651972599cfSmrg# XORG_COMPILER_BRAND
2652972599cfSmrg# -------------------
2653972599cfSmrg# Minimum version: 1.14.0
2654972599cfSmrg#
2655972599cfSmrg# Checks for various brands of compilers and sets flags as appropriate:
2656972599cfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2657972599cfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2658972599cfSmrg#   clang compiler - sets CLANGCC to "yes"
2659972599cfSmrg#   Intel compiler - sets INTELCC to "yes"
2660972599cfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2661972599cfSmrg#
2662972599cfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2663972599cfSmrgAC_LANG_CASE(
2664972599cfSmrg	[C], [
2665972599cfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2666972599cfSmrg	],
2667972599cfSmrg	[C++], [
2668972599cfSmrg		AC_REQUIRE([AC_PROG_CXX])
2669972599cfSmrg	]
2670972599cfSmrg)
2671972599cfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2672972599cfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2673972599cfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2674972599cfSmrg]) # XORG_COMPILER_BRAND
2675972599cfSmrg
2676972599cfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2677972599cfSmrg# ---------------
2678972599cfSmrg# Minimum version: 1.16.0
2679972599cfSmrg#
2680972599cfSmrg# Test if the compiler works when passed the given flag as a command line argument.
2681972599cfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2682972599cfSmrg# next flag in the list until there are no more options.
2683972599cfSmrg#
2684972599cfSmrg# Note that this does not guarantee that the compiler supports the flag as some
2685972599cfSmrg# compilers will simply ignore arguments that they do not understand, but we do
2686972599cfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2687972599cfSmrg# -Werror=unused-command-line-argument
2688972599cfSmrg#
2689972599cfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2690972599cfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2691972599cfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2692972599cfSmrg
2693972599cfSmrgAC_LANG_COMPILER_REQUIRE
2694972599cfSmrg
2695972599cfSmrgAC_LANG_CASE(
2696972599cfSmrg	[C], [
2697972599cfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2698972599cfSmrg		define([PREFIX], [C])
2699972599cfSmrg		define([CACHE_PREFIX], [cc])
2700972599cfSmrg		define([COMPILER], [$CC])
2701972599cfSmrg	],
2702972599cfSmrg	[C++], [
2703972599cfSmrg		define([PREFIX], [CXX])
2704972599cfSmrg		define([CACHE_PREFIX], [cxx])
2705972599cfSmrg		define([COMPILER], [$CXX])
2706972599cfSmrg	]
2707972599cfSmrg)
2708972599cfSmrg
2709972599cfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2710972599cfSmrg
2711972599cfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2712972599cfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2713972599cfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2714972599cfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2715972599cfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2716972599cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2717972599cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2718972599cfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2719972599cfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2720972599cfSmrgfi
2721972599cfSmrg
2722972599cfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2723972599cfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2724972599cfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2725972599cfSmrg	fi
2726972599cfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2727972599cfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2728972599cfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2729972599cfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2730972599cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2731972599cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2732972599cfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2733972599cfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2734972599cfSmrgfi
2735972599cfSmrg
2736972599cfSmrgfound="no"
2737972599cfSmrgm4_foreach([flag], m4_cdr($@), [
2738972599cfSmrg	if test $found = "no" ; then
2739972599cfSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2740972599cfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2741972599cfSmrg		fi
2742972599cfSmrg
2743972599cfSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2744972599cfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2745972599cfSmrg		fi
2746972599cfSmrg
2747972599cfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2748972599cfSmrg
2749972599cfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2750972599cfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2751972599cfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2752972599cfSmrg		AC_CACHE_VAL($cacheid,
2753972599cfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2754972599cfSmrg					     [eval $cacheid=yes],
2755972599cfSmrg					     [eval $cacheid=no])])
2756972599cfSmrg
2757972599cfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2758972599cfSmrg
2759972599cfSmrg		eval supported=\$$cacheid
2760972599cfSmrg		AC_MSG_RESULT([$supported])
2761972599cfSmrg		if test "$supported" = "yes" ; then
2762972599cfSmrg			$1="$$1 ]flag["
2763972599cfSmrg			found="yes"
2764972599cfSmrg		fi
2765972599cfSmrg	fi
2766972599cfSmrg])
2767972599cfSmrg]) # XORG_TESTSET_CFLAG
2768972599cfSmrg
2769972599cfSmrg# XORG_COMPILER_FLAGS
2770972599cfSmrg# ---------------
2771972599cfSmrg# Minimum version: 1.16.0
2772972599cfSmrg#
2773972599cfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2774972599cfSmrg# arguments supported by the selected compiler which do NOT alter the generated
2775972599cfSmrg# code.  These arguments will cause the compiler to print various warnings
2776972599cfSmrg# during compilation AND turn a conservative set of warnings into errors.
2777972599cfSmrg#
2778972599cfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2779972599cfSmrg# future versions of util-macros as options are added to new compilers.
2780972599cfSmrg#
2781972599cfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2782972599cfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2783972599cfSmrg
2784972599cfSmrgAC_ARG_ENABLE(selective-werror,
2785972599cfSmrg              AS_HELP_STRING([--disable-selective-werror],
2786972599cfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2787972599cfSmrg              [SELECTIVE_WERROR=$enableval],
2788972599cfSmrg              [SELECTIVE_WERROR=yes])
2789972599cfSmrg
2790972599cfSmrgAC_LANG_CASE(
2791972599cfSmrg        [C], [
2792972599cfSmrg                define([PREFIX], [C])
2793972599cfSmrg        ],
2794972599cfSmrg        [C++], [
2795972599cfSmrg                define([PREFIX], [CXX])
2796972599cfSmrg        ]
2797972599cfSmrg)
2798972599cfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2799972599cfSmrgif test "x$SUNCC" = "xyes"; then
2800972599cfSmrg    [BASE_]PREFIX[FLAGS]="-v"
2801972599cfSmrgelse
2802972599cfSmrg    [BASE_]PREFIX[FLAGS]=""
2803972599cfSmrgfi
2804972599cfSmrg
2805972599cfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2806972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2807972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2808972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2809972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2810972599cfSmrg
2811972599cfSmrgAC_LANG_CASE(
2812972599cfSmrg	[C], [
2813972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2814972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2815972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2816972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2817972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2818972599cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2819972599cfSmrg	]
2820972599cfSmrg)
2821972599cfSmrg
2822972599cfSmrg# This chunk adds additional warnings that could catch undesired effects.
2823972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2824972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2825972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2826972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2827972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2828972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2829972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2830972599cfSmrg
2831972599cfSmrg# These are currently disabled because they are noisy.  They will be enabled
2832972599cfSmrg# in the future once the codebase is sufficiently modernized to silence
2833972599cfSmrg# them.  For now, I don't want them to drown out the other warnings.
2834972599cfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2835972599cfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2836972599cfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2837972599cfSmrg
2838972599cfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2839972599cfSmrg# when there are problems that should be fixed.
2840972599cfSmrg
2841972599cfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2842972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2843972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2844972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2845972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2846972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2847972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2848972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2849972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2850972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2851972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2852972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2853972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2854972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2855972599cfSmrgelse
2856972599cfSmrgAC_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])
2857972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2858972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2859972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2860972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2861972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2862972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2863972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2864972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2865972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2866972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2867972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2868972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2869972599cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2870972599cfSmrgfi
2871972599cfSmrg
2872972599cfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2873972599cfSmrg]) # XORG_COMPILER_FLAGS
2874972599cfSmrg
2875972599cfSmrg# XORG_CWARNFLAGS
2876972599cfSmrg# ---------------
2877972599cfSmrg# Minimum version: 1.2.0
2878972599cfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2879972599cfSmrg#
2880972599cfSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2881972599cfSmrg#
2882972599cfSmrg# This function is deprecated because it defines -fno-strict-aliasing
2883972599cfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2884972599cfSmrg# is needed, then it should be added explicitly in the module when
2885972599cfSmrg# it is updated to use BASE_CFLAGS.
2886972599cfSmrg#
2887972599cfSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2888972599cfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2889972599cfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2890972599cfSmrgAC_LANG_CASE(
2891972599cfSmrg	[C], [
2892972599cfSmrg		CWARNFLAGS="$BASE_CFLAGS"
2893972599cfSmrg		if  test "x$GCC" = xyes ; then
2894972599cfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2895972599cfSmrg		fi
2896972599cfSmrg		AC_SUBST(CWARNFLAGS)
2897972599cfSmrg	]
2898972599cfSmrg)
2899972599cfSmrg]) # XORG_CWARNFLAGS
2900972599cfSmrg
2901972599cfSmrg# XORG_STRICT_OPTION
2902972599cfSmrg# -----------------------
2903972599cfSmrg# Minimum version: 1.3.0
2904972599cfSmrg#
2905972599cfSmrg# Add configure option to enable strict compilation flags, such as treating
2906972599cfSmrg# warnings as fatal errors.
2907972599cfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2908972599cfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2909972599cfSmrg#
2910972599cfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2911972599cfSmrg# when strict compilation is unconditionally desired.
2912972599cfSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2913972599cfSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2914972599cfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2915972599cfSmrg
2916972599cfSmrgAC_ARG_ENABLE(strict-compilation,
2917972599cfSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2918972599cfSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2919972599cfSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2920972599cfSmrg
2921972599cfSmrgAC_LANG_CASE(
2922972599cfSmrg        [C], [
2923972599cfSmrg                define([PREFIX], [C])
2924972599cfSmrg        ],
2925972599cfSmrg        [C++], [
2926972599cfSmrg                define([PREFIX], [CXX])
2927972599cfSmrg        ]
2928972599cfSmrg)
2929972599cfSmrg
2930972599cfSmrg[STRICT_]PREFIX[FLAGS]=""
2931972599cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2932972599cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2933972599cfSmrg
2934972599cfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2935972599cfSmrg# activate it with -Werror, so we add it here explicitly.
2936972599cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2937972599cfSmrg
2938972599cfSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2939972599cfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2940972599cfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2941972599cfSmrgfi
2942972599cfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2943972599cfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2944972599cfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2945972599cfSmrg]) # XORG_STRICT_OPTION
2946972599cfSmrg
2947972599cfSmrg# XORG_DEFAULT_OPTIONS
2948972599cfSmrg# --------------------
2949972599cfSmrg# Minimum version: 1.3.0
2950972599cfSmrg#
2951972599cfSmrg# Defines default options for X.Org modules.
2952972599cfSmrg#
2953972599cfSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2954972599cfSmrgAC_REQUIRE([AC_PROG_INSTALL])
2955972599cfSmrgXORG_COMPILER_FLAGS
2956972599cfSmrgXORG_CWARNFLAGS
2957972599cfSmrgXORG_STRICT_OPTION
2958972599cfSmrgXORG_RELEASE_VERSION
2959972599cfSmrgXORG_CHANGELOG
2960972599cfSmrgXORG_INSTALL
2961972599cfSmrgXORG_MANPAGE_SECTIONS
2962972599cfSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2963972599cfSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2964972599cfSmrg]) # XORG_DEFAULT_OPTIONS
2965972599cfSmrg
2966972599cfSmrg# XORG_INSTALL()
2967972599cfSmrg# ----------------
2968972599cfSmrg# Minimum version: 1.4.0
2969972599cfSmrg#
2970972599cfSmrg# Defines the variable INSTALL_CMD as the command to copy
2971972599cfSmrg# INSTALL from $prefix/share/util-macros.
2972972599cfSmrg#
2973972599cfSmrgAC_DEFUN([XORG_INSTALL], [
2974972599cfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2975972599cfSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2976972599cfSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2977972599cfSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2978972599cfSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2979972599cfSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2980972599cfSmrgAC_SUBST([INSTALL_CMD])
2981972599cfSmrg]) # XORG_INSTALL
2982972599cfSmrgdnl Copyright 2005 Red Hat, Inc
2983972599cfSmrgdnl
2984972599cfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2985972599cfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2986972599cfSmrgdnl the above copyright notice appear in all copies and that both that
2987972599cfSmrgdnl copyright notice and this permission notice appear in supporting
2988972599cfSmrgdnl documentation.
2989972599cfSmrgdnl
2990972599cfSmrgdnl The above copyright notice and this permission notice shall be included
2991972599cfSmrgdnl in all copies or substantial portions of the Software.
2992972599cfSmrgdnl
2993972599cfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2994972599cfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2995972599cfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2996972599cfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2997972599cfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2998972599cfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2999972599cfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3000972599cfSmrgdnl
3001972599cfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3002972599cfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3003972599cfSmrgdnl other dealings in this Software without prior written authorization
3004972599cfSmrgdnl from the copyright holders.
3005972599cfSmrgdnl
3006972599cfSmrg
3007972599cfSmrg# XORG_RELEASE_VERSION
3008972599cfSmrg# --------------------
3009972599cfSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3010972599cfSmrg 
3011972599cfSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3012972599cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3013972599cfSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3014972599cfSmrg		[Major version of this package])
3015972599cfSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3016972599cfSmrg	if test "x$PVM" = "x"; then
3017972599cfSmrg		PVM="0"
3018972599cfSmrg	fi
3019972599cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3020972599cfSmrg		[$PVM],
3021972599cfSmrg		[Minor version of this package])
3022972599cfSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3023972599cfSmrg	if test "x$PVP" = "x"; then
3024972599cfSmrg		PVP="0"
3025972599cfSmrg	fi
3026972599cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3027972599cfSmrg		[$PVP],
3028972599cfSmrg		[Patch version of this package])
3029972599cfSmrg])
3030972599cfSmrg
3031972599cfSmrg# XORG_CHANGELOG()
3032972599cfSmrg# ----------------
3033972599cfSmrg# Minimum version: 1.2.0
3034972599cfSmrg#
3035972599cfSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3036972599cfSmrg# ChangeLog from git.
3037972599cfSmrg#
3038972599cfSmrg#
3039972599cfSmrgAC_DEFUN([XORG_CHANGELOG], [
3040972599cfSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3041972599cfSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3042972599cfSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3043972599cfSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3044972599cfSmrgAC_SUBST([CHANGELOG_CMD])
3045972599cfSmrg]) # XORG_CHANGELOG
3046972599cfSmrg
3047