aclocal.m4 revision 33734831
1# generated automatically by aclocal 1.13.4 -*- Autoconf -*-
2
3# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15m4_ifndef([AC_AUTOCONF_VERSION],
16  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18[m4_warning([this file was generated for autoconf 2.69.
19You have another version of autoconf.  It may work, but is not guaranteed to.
20If you have problems, you may need to regenerate the build system entirely.
21To do so, use the procedure documented by the package, typically 'autoreconf'.])])
22
23# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24#
25# This file is free software; the Free Software Foundation
26# gives unlimited permission to copy and/or distribute it,
27# with or without modifications, as long as this notice is preserved.
28
29# AM_AUTOMAKE_VERSION(VERSION)
30# ----------------------------
31# Automake X.Y traces this macro to ensure aclocal.m4 has been
32# generated from the m4 files accompanying Automake X.Y.
33# (This private macro should not be called outside this file.)
34AC_DEFUN([AM_AUTOMAKE_VERSION],
35[am__api_version='1.13'
36dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37dnl require some minimum version.  Point them to the right macro.
38m4_if([$1], [1.13.4], [],
39      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40])
41
42# _AM_AUTOCONF_VERSION(VERSION)
43# -----------------------------
44# aclocal traces this macro to find the Autoconf version.
45# This is a private macro too.  Using m4_define simplifies
46# the logic in aclocal, which can simply ignore this definition.
47m4_define([_AM_AUTOCONF_VERSION], [])
48
49# AM_SET_CURRENT_AUTOMAKE_VERSION
50# -------------------------------
51# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54[AM_AUTOMAKE_VERSION([1.13.4])dnl
55m4_ifndef([AC_AUTOCONF_VERSION],
56  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58
59# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60
61# Copyright (C) 2001-2013 Free Software Foundation, Inc.
62#
63# This file is free software; the Free Software Foundation
64# gives unlimited permission to copy and/or distribute it,
65# with or without modifications, as long as this notice is preserved.
66
67# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70#
71# Of course, Automake must honor this variable whenever it calls a
72# tool from the auxiliary directory.  The problem is that $srcdir (and
73# therefore $ac_aux_dir as well) can be either absolute or relative,
74# depending on how configure is run.  This is pretty annoying, since
75# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76# source directory, any form will work fine, but in subdirectories a
77# relative path needs to be adjusted first.
78#
79# $ac_aux_dir/missing
80#    fails when called from a subdirectory if $ac_aux_dir is relative
81# $top_srcdir/$ac_aux_dir/missing
82#    fails if $ac_aux_dir is absolute,
83#    fails when called from a subdirectory in a VPATH build with
84#          a relative $ac_aux_dir
85#
86# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87# are both prefixed by $srcdir.  In an in-source build this is usually
88# harmless because $srcdir is '.', but things will broke when you
89# start a VPATH build or use an absolute $srcdir.
90#
91# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94# and then we would define $MISSING as
95#   MISSING="\${SHELL} $am_aux_dir/missing"
96# This will work as long as MISSING is not called from configure, because
97# unfortunately $(top_srcdir) has no meaning in configure.
98# However there are other variables, like CC, which are often used in
99# configure, and could therefore not use this "fixed" $ac_aux_dir.
100#
101# Another solution, used here, is to always expand $ac_aux_dir to an
102# absolute PATH.  The drawback is that using absolute paths prevent a
103# configured tree to be moved without reconfiguration.
104
105AC_DEFUN([AM_AUX_DIR_EXPAND],
106[dnl Rely on autoconf to set up CDPATH properly.
107AC_PREREQ([2.50])dnl
108# expand $ac_aux_dir to an absolute path
109am_aux_dir=`cd $ac_aux_dir && pwd`
110])
111
112# AM_CONDITIONAL                                            -*- Autoconf -*-
113
114# Copyright (C) 1997-2013 Free Software Foundation, Inc.
115#
116# This file is free software; the Free Software Foundation
117# gives unlimited permission to copy and/or distribute it,
118# with or without modifications, as long as this notice is preserved.
119
120# AM_CONDITIONAL(NAME, SHELL-CONDITION)
121# -------------------------------------
122# Define a conditional.
123AC_DEFUN([AM_CONDITIONAL],
124[AC_PREREQ([2.52])dnl
125 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
126       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
127AC_SUBST([$1_TRUE])dnl
128AC_SUBST([$1_FALSE])dnl
129_AM_SUBST_NOTMAKE([$1_TRUE])dnl
130_AM_SUBST_NOTMAKE([$1_FALSE])dnl
131m4_define([_AM_COND_VALUE_$1], [$2])dnl
132if $2; then
133  $1_TRUE=
134  $1_FALSE='#'
135else
136  $1_TRUE='#'
137  $1_FALSE=
138fi
139AC_CONFIG_COMMANDS_PRE(
140[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
141  AC_MSG_ERROR([[conditional "$1" was never defined.
142Usually this means the macro was only invoked conditionally.]])
143fi])])
144
145# Copyright (C) 1999-2013 Free Software Foundation, Inc.
146#
147# This file is free software; the Free Software Foundation
148# gives unlimited permission to copy and/or distribute it,
149# with or without modifications, as long as this notice is preserved.
150
151
152# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
153# written in clear, in which case automake, when reading aclocal.m4,
154# will think it sees a *use*, and therefore will trigger all it's
155# C support machinery.  Also note that it means that autoscan, seeing
156# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157
158
159# _AM_DEPENDENCIES(NAME)
160# ----------------------
161# See how the compiler implements dependency checking.
162# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
163# We try a few techniques and use that to set a single cache variable.
164#
165# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
166# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
167# dependency, and given that the user is not expected to run this macro,
168# just rely on AC_PROG_CC.
169AC_DEFUN([_AM_DEPENDENCIES],
170[AC_REQUIRE([AM_SET_DEPDIR])dnl
171AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
172AC_REQUIRE([AM_MAKE_INCLUDE])dnl
173AC_REQUIRE([AM_DEP_TRACK])dnl
174
175m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
176      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
177      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
178      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
179      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
180      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
181                    [depcc="$$1"   am_compiler_list=])
182
183AC_CACHE_CHECK([dependency style of $depcc],
184               [am_cv_$1_dependencies_compiler_type],
185[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
186  # We make a subdir and do the tests there.  Otherwise we can end up
187  # making bogus files that we don't know about and never remove.  For
188  # instance it was reported that on HP-UX the gcc test will end up
189  # making a dummy file named 'D' -- because '-MD' means "put the output
190  # in D".
191  rm -rf conftest.dir
192  mkdir conftest.dir
193  # Copy depcomp to subdir because otherwise we won't find it if we're
194  # using a relative directory.
195  cp "$am_depcomp" conftest.dir
196  cd conftest.dir
197  # We will build objects and dependencies in a subdirectory because
198  # it helps to detect inapplicable dependency modes.  For instance
199  # both Tru64's cc and ICC support -MD to output dependencies as a
200  # side effect of compilation, but ICC will put the dependencies in
201  # the current directory while Tru64 will put them in the object
202  # directory.
203  mkdir sub
204
205  am_cv_$1_dependencies_compiler_type=none
206  if test "$am_compiler_list" = ""; then
207     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
208  fi
209  am__universal=false
210  m4_case([$1], [CC],
211    [case " $depcc " in #(
212     *\ -arch\ *\ -arch\ *) am__universal=true ;;
213     esac],
214    [CXX],
215    [case " $depcc " in #(
216     *\ -arch\ *\ -arch\ *) am__universal=true ;;
217     esac])
218
219  for depmode in $am_compiler_list; do
220    # Setup a source with many dependencies, because some compilers
221    # like to wrap large dependency lists on column 80 (with \), and
222    # we should not choose a depcomp mode which is confused by this.
223    #
224    # We need to recreate these files for each test, as the compiler may
225    # overwrite some of them when testing with obscure command lines.
226    # This happens at least with the AIX C compiler.
227    : > sub/conftest.c
228    for i in 1 2 3 4 5 6; do
229      echo '#include "conftst'$i'.h"' >> sub/conftest.c
230      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
231      # Solaris 10 /bin/sh.
232      echo '/* dummy */' > sub/conftst$i.h
233    done
234    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235
236    # We check with '-c' and '-o' for the sake of the "dashmstdout"
237    # mode.  It turns out that the SunPro C++ compiler does not properly
238    # handle '-M -o', and we need to detect this.  Also, some Intel
239    # versions had trouble with output in subdirs.
240    am__obj=sub/conftest.${OBJEXT-o}
241    am__minus_obj="-o $am__obj"
242    case $depmode in
243    gcc)
244      # This depmode causes a compiler race in universal mode.
245      test "$am__universal" = false || continue
246      ;;
247    nosideeffect)
248      # After this tag, mechanisms are not by side-effect, so they'll
249      # only be used when explicitly requested.
250      if test "x$enable_dependency_tracking" = xyes; then
251	continue
252      else
253	break
254      fi
255      ;;
256    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
257      # This compiler won't grok '-c -o', but also, the minuso test has
258      # not run yet.  These depmodes are late enough in the game, and
259      # so weak that their functioning should not be impacted.
260      am__obj=conftest.${OBJEXT-o}
261      am__minus_obj=
262      ;;
263    none) break ;;
264    esac
265    if depmode=$depmode \
266       source=sub/conftest.c object=$am__obj \
267       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
268       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
269         >/dev/null 2>conftest.err &&
270       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
271       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
272       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
273       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
274      # icc doesn't choke on unknown options, it will just issue warnings
275      # or remarks (even with -Werror).  So we grep stderr for any message
276      # that says an option was ignored or not supported.
277      # When given -MP, icc 7.0 and 7.1 complain thusly:
278      #   icc: Command line warning: ignoring option '-M'; no argument required
279      # The diagnosis changed in icc 8.0:
280      #   icc: Command line remark: option '-MP' not supported
281      if (grep 'ignoring option' conftest.err ||
282          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
283        am_cv_$1_dependencies_compiler_type=$depmode
284        break
285      fi
286    fi
287  done
288
289  cd ..
290  rm -rf conftest.dir
291else
292  am_cv_$1_dependencies_compiler_type=none
293fi
294])
295AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
296AM_CONDITIONAL([am__fastdep$1], [
297  test "x$enable_dependency_tracking" != xno \
298  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
299])
300
301
302# AM_SET_DEPDIR
303# -------------
304# Choose a directory name for dependency files.
305# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
306AC_DEFUN([AM_SET_DEPDIR],
307[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
308AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
309])
310
311
312# AM_DEP_TRACK
313# ------------
314AC_DEFUN([AM_DEP_TRACK],
315[AC_ARG_ENABLE([dependency-tracking], [dnl
316AS_HELP_STRING(
317  [--enable-dependency-tracking],
318  [do not reject slow dependency extractors])
319AS_HELP_STRING(
320  [--disable-dependency-tracking],
321  [speeds up one-time build])])
322if test "x$enable_dependency_tracking" != xno; then
323  am_depcomp="$ac_aux_dir/depcomp"
324  AMDEPBACKSLASH='\'
325  am__nodep='_no'
326fi
327AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
328AC_SUBST([AMDEPBACKSLASH])dnl
329_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
330AC_SUBST([am__nodep])dnl
331_AM_SUBST_NOTMAKE([am__nodep])dnl
332])
333
334# Generate code to set up dependency tracking.              -*- Autoconf -*-
335
336# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337#
338# This file is free software; the Free Software Foundation
339# gives unlimited permission to copy and/or distribute it,
340# with or without modifications, as long as this notice is preserved.
341
342
343# _AM_OUTPUT_DEPENDENCY_COMMANDS
344# ------------------------------
345AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
346[{
347  # Older Autoconf quotes --file arguments for eval, but not when files
348  # are listed without --file.  Let's play safe and only enable the eval
349  # if we detect the quoting.
350  case $CONFIG_FILES in
351  *\'*) eval set x "$CONFIG_FILES" ;;
352  *)   set x $CONFIG_FILES ;;
353  esac
354  shift
355  for mf
356  do
357    # Strip MF so we end up with the name of the file.
358    mf=`echo "$mf" | sed -e 's/:.*$//'`
359    # Check whether this is an Automake generated Makefile or not.
360    # We used to match only the files named 'Makefile.in', but
361    # some people rename them; so instead we look at the file content.
362    # Grep'ing the first line is not enough: some people post-process
363    # each Makefile.in and add a new line on top of each file to say so.
364    # Grep'ing the whole file is not good either: AIX grep has a line
365    # limit of 2048, but all sed's we know have understand at least 4000.
366    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
367      dirpart=`AS_DIRNAME("$mf")`
368    else
369      continue
370    fi
371    # Extract the definition of DEPDIR, am__include, and am__quote
372    # from the Makefile without running 'make'.
373    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
374    test -z "$DEPDIR" && continue
375    am__include=`sed -n 's/^am__include = //p' < "$mf"`
376    test -z "$am__include" && continue
377    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
378    # Find all dependency output files, they are included files with
379    # $(DEPDIR) in their names.  We invoke sed twice because it is the
380    # simplest approach to changing $(DEPDIR) to its actual value in the
381    # expansion.
382    for file in `sed -n "
383      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
384	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
385      # Make sure the directory exists.
386      test -f "$dirpart/$file" && continue
387      fdir=`AS_DIRNAME(["$file"])`
388      AS_MKDIR_P([$dirpart/$fdir])
389      # echo "creating $dirpart/$file"
390      echo '# dummy' > "$dirpart/$file"
391    done
392  done
393}
394])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395
396
397# AM_OUTPUT_DEPENDENCY_COMMANDS
398# -----------------------------
399# This macro should only be invoked once -- use via AC_REQUIRE.
400#
401# This code is only required when automatic dependency tracking
402# is enabled.  FIXME.  This creates each '.P' file that we will
403# need in order to bootstrap the dependency handling code.
404AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
405[AC_CONFIG_COMMANDS([depfiles],
406     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
407     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
408])
409
410# Do all the work for Automake.                             -*- Autoconf -*-
411
412# Copyright (C) 1996-2013 Free Software Foundation, Inc.
413#
414# This file is free software; the Free Software Foundation
415# gives unlimited permission to copy and/or distribute it,
416# with or without modifications, as long as this notice is preserved.
417
418# This macro actually does too much.  Some checks are only needed if
419# your package does certain things.  But this isn't really a big deal.
420
421# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
422# AM_INIT_AUTOMAKE([OPTIONS])
423# -----------------------------------------------
424# The call with PACKAGE and VERSION arguments is the old style
425# call (pre autoconf-2.50), which is being phased out.  PACKAGE
426# and VERSION should now be passed to AC_INIT and removed from
427# the call to AM_INIT_AUTOMAKE.
428# We support both call styles for the transition.  After
429# the next Automake release, Autoconf can make the AC_INIT
430# arguments mandatory, and then we can depend on a new Autoconf
431# release and drop the old call support.
432AC_DEFUN([AM_INIT_AUTOMAKE],
433[AC_PREREQ([2.65])dnl
434dnl Autoconf wants to disallow AM_ names.  We explicitly allow
435dnl the ones we care about.
436m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
437AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
438AC_REQUIRE([AC_PROG_INSTALL])dnl
439if test "`cd $srcdir && pwd`" != "`pwd`"; then
440  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
441  # is not polluted with repeated "-I."
442  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
443  # test to see if srcdir already configured
444  if test -f $srcdir/config.status; then
445    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
446  fi
447fi
448
449# test whether we have cygpath
450if test -z "$CYGPATH_W"; then
451  if (cygpath --version) >/dev/null 2>/dev/null; then
452    CYGPATH_W='cygpath -w'
453  else
454    CYGPATH_W=echo
455  fi
456fi
457AC_SUBST([CYGPATH_W])
458
459# Define the identity of the package.
460dnl Distinguish between old-style and new-style calls.
461m4_ifval([$2],
462[AC_DIAGNOSE([obsolete],
463             [$0: two- and three-arguments forms are deprecated.])
464m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465 AC_SUBST([PACKAGE], [$1])dnl
466 AC_SUBST([VERSION], [$2])],
467[_AM_SET_OPTIONS([$1])dnl
468dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469m4_if(
470  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
471  [ok:ok],,
472  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
473 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
474 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
475
476_AM_IF_OPTION([no-define],,
477[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
478 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
479
480# Some tools Automake needs.
481AC_REQUIRE([AM_SANITY_CHECK])dnl
482AC_REQUIRE([AC_ARG_PROGRAM])dnl
483AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
484AM_MISSING_PROG([AUTOCONF], [autoconf])
485AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
486AM_MISSING_PROG([AUTOHEADER], [autoheader])
487AM_MISSING_PROG([MAKEINFO], [makeinfo])
488AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
489AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
490AC_REQUIRE([AC_PROG_MKDIR_P])dnl
491# For better backward compatibility.  To be removed once Automake 1.9.x
492# dies out for good.  For more background, see:
493# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
494# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
495AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
496# We need awk for the "check" target.  The system "awk" is bad on
497# some platforms.
498AC_REQUIRE([AC_PROG_AWK])dnl
499AC_REQUIRE([AC_PROG_MAKE_SET])dnl
500AC_REQUIRE([AM_SET_LEADING_DOT])dnl
501_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
502	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
503			     [_AM_PROG_TAR([v7])])])
504_AM_IF_OPTION([no-dependencies],,
505[AC_PROVIDE_IFELSE([AC_PROG_CC],
506		  [_AM_DEPENDENCIES([CC])],
507		  [m4_define([AC_PROG_CC],
508			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
509AC_PROVIDE_IFELSE([AC_PROG_CXX],
510		  [_AM_DEPENDENCIES([CXX])],
511		  [m4_define([AC_PROG_CXX],
512			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
513AC_PROVIDE_IFELSE([AC_PROG_OBJC],
514		  [_AM_DEPENDENCIES([OBJC])],
515		  [m4_define([AC_PROG_OBJC],
516			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
517AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
518		  [_AM_DEPENDENCIES([OBJCXX])],
519		  [m4_define([AC_PROG_OBJCXX],
520			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
521])
522AC_REQUIRE([AM_SILENT_RULES])dnl
523dnl The testsuite driver may need to know about EXEEXT, so add the
524dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
525dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
526AC_CONFIG_COMMANDS_PRE(dnl
527[m4_provide_if([_AM_COMPILER_EXEEXT],
528  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
529])
530
531dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
532dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
533dnl mangled by Autoconf and run in a shell conditional statement.
534m4_define([_AC_COMPILER_EXEEXT],
535m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
536
537
538# When config.status generates a header, we must update the stamp-h file.
539# This file resides in the same directory as the config header
540# that is generated.  The stamp files are numbered to have different names.
541
542# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
543# loop where config.status creates the headers, so we can generate
544# our stamp files there.
545AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
546[# Compute $1's index in $config_headers.
547_am_arg=$1
548_am_stamp_count=1
549for _am_header in $config_headers :; do
550  case $_am_header in
551    $_am_arg | $_am_arg:* )
552      break ;;
553    * )
554      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
555  esac
556done
557echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
558
559# Copyright (C) 2001-2013 Free Software Foundation, Inc.
560#
561# This file is free software; the Free Software Foundation
562# gives unlimited permission to copy and/or distribute it,
563# with or without modifications, as long as this notice is preserved.
564
565# AM_PROG_INSTALL_SH
566# ------------------
567# Define $install_sh.
568AC_DEFUN([AM_PROG_INSTALL_SH],
569[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
570if test x"${install_sh}" != xset; then
571  case $am_aux_dir in
572  *\ * | *\	*)
573    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
574  *)
575    install_sh="\${SHELL} $am_aux_dir/install-sh"
576  esac
577fi
578AC_SUBST([install_sh])])
579
580# Copyright (C) 2003-2013 Free Software Foundation, Inc.
581#
582# This file is free software; the Free Software Foundation
583# gives unlimited permission to copy and/or distribute it,
584# with or without modifications, as long as this notice is preserved.
585
586# Check whether the underlying file-system supports filenames
587# with a leading dot.  For instance MS-DOS doesn't.
588AC_DEFUN([AM_SET_LEADING_DOT],
589[rm -rf .tst 2>/dev/null
590mkdir .tst 2>/dev/null
591if test -d .tst; then
592  am__leading_dot=.
593else
594  am__leading_dot=_
595fi
596rmdir .tst 2>/dev/null
597AC_SUBST([am__leading_dot])])
598
599# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
600# From Jim Meyering
601
602# Copyright (C) 1996-2013 Free Software Foundation, Inc.
603#
604# This file is free software; the Free Software Foundation
605# gives unlimited permission to copy and/or distribute it,
606# with or without modifications, as long as this notice is preserved.
607
608# AM_MAINTAINER_MODE([DEFAULT-MODE])
609# ----------------------------------
610# Control maintainer-specific portions of Makefiles.
611# Default is to disable them, unless 'enable' is passed literally.
612# For symmetry, 'disable' may be passed as well.  Anyway, the user
613# can override the default with the --enable/--disable switch.
614AC_DEFUN([AM_MAINTAINER_MODE],
615[m4_case(m4_default([$1], [disable]),
616       [enable], [m4_define([am_maintainer_other], [disable])],
617       [disable], [m4_define([am_maintainer_other], [enable])],
618       [m4_define([am_maintainer_other], [enable])
619        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
620AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
621  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
622  AC_ARG_ENABLE([maintainer-mode],
623    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
624      am_maintainer_other[ make rules and dependencies not useful
625      (and sometimes confusing) to the casual installer])],
626    [USE_MAINTAINER_MODE=$enableval],
627    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
628  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
629  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
630  MAINT=$MAINTAINER_MODE_TRUE
631  AC_SUBST([MAINT])dnl
632]
633)
634
635# Check to see how 'make' treats includes.	            -*- Autoconf -*-
636
637# Copyright (C) 2001-2013 Free Software Foundation, Inc.
638#
639# This file is free software; the Free Software Foundation
640# gives unlimited permission to copy and/or distribute it,
641# with or without modifications, as long as this notice is preserved.
642
643# AM_MAKE_INCLUDE()
644# -----------------
645# Check to see how make treats includes.
646AC_DEFUN([AM_MAKE_INCLUDE],
647[am_make=${MAKE-make}
648cat > confinc << 'END'
649am__doit:
650	@echo this is the am__doit target
651.PHONY: am__doit
652END
653# If we don't find an include directive, just comment out the code.
654AC_MSG_CHECKING([for style of include used by $am_make])
655am__include="#"
656am__quote=
657_am_result=none
658# First try GNU make style include.
659echo "include confinc" > confmf
660# Ignore all kinds of additional output from 'make'.
661case `$am_make -s -f confmf 2> /dev/null` in #(
662*the\ am__doit\ target*)
663  am__include=include
664  am__quote=
665  _am_result=GNU
666  ;;
667esac
668# Now try BSD make style include.
669if test "$am__include" = "#"; then
670   echo '.include "confinc"' > confmf
671   case `$am_make -s -f confmf 2> /dev/null` in #(
672   *the\ am__doit\ target*)
673     am__include=.include
674     am__quote="\""
675     _am_result=BSD
676     ;;
677   esac
678fi
679AC_SUBST([am__include])
680AC_SUBST([am__quote])
681AC_MSG_RESULT([$_am_result])
682rm -f confinc confmf
683])
684
685# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
686
687# Copyright (C) 1997-2013 Free Software Foundation, Inc.
688#
689# This file is free software; the Free Software Foundation
690# gives unlimited permission to copy and/or distribute it,
691# with or without modifications, as long as this notice is preserved.
692
693# AM_MISSING_PROG(NAME, PROGRAM)
694# ------------------------------
695AC_DEFUN([AM_MISSING_PROG],
696[AC_REQUIRE([AM_MISSING_HAS_RUN])
697$1=${$1-"${am_missing_run}$2"}
698AC_SUBST($1)])
699
700# AM_MISSING_HAS_RUN
701# ------------------
702# Define MISSING if not defined so far and test if it is modern enough.
703# If it is, set am_missing_run to use it, otherwise, to nothing.
704AC_DEFUN([AM_MISSING_HAS_RUN],
705[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
706AC_REQUIRE_AUX_FILE([missing])dnl
707if test x"${MISSING+set}" != xset; then
708  case $am_aux_dir in
709  *\ * | *\	*)
710    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
711  *)
712    MISSING="\${SHELL} $am_aux_dir/missing" ;;
713  esac
714fi
715# Use eval to expand $SHELL
716if eval "$MISSING --is-lightweight"; then
717  am_missing_run="$MISSING "
718else
719  am_missing_run=
720  AC_MSG_WARN(['missing' script is too old or missing])
721fi
722])
723
724# Helper functions for option handling.                     -*- Autoconf -*-
725
726# Copyright (C) 2001-2013 Free Software Foundation, Inc.
727#
728# This file is free software; the Free Software Foundation
729# gives unlimited permission to copy and/or distribute it,
730# with or without modifications, as long as this notice is preserved.
731
732# _AM_MANGLE_OPTION(NAME)
733# -----------------------
734AC_DEFUN([_AM_MANGLE_OPTION],
735[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
736
737# _AM_SET_OPTION(NAME)
738# --------------------
739# Set option NAME.  Presently that only means defining a flag for this option.
740AC_DEFUN([_AM_SET_OPTION],
741[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
742
743# _AM_SET_OPTIONS(OPTIONS)
744# ------------------------
745# OPTIONS is a space-separated list of Automake options.
746AC_DEFUN([_AM_SET_OPTIONS],
747[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
748
749# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
750# -------------------------------------------
751# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
752AC_DEFUN([_AM_IF_OPTION],
753[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
754
755# Check to make sure that the build environment is sane.    -*- Autoconf -*-
756
757# Copyright (C) 1996-2013 Free Software Foundation, Inc.
758#
759# This file is free software; the Free Software Foundation
760# gives unlimited permission to copy and/or distribute it,
761# with or without modifications, as long as this notice is preserved.
762
763# AM_SANITY_CHECK
764# ---------------
765AC_DEFUN([AM_SANITY_CHECK],
766[AC_MSG_CHECKING([whether build environment is sane])
767# Reject unsafe characters in $srcdir or the absolute working directory
768# name.  Accept space and tab only in the latter.
769am_lf='
770'
771case `pwd` in
772  *[[\\\"\#\$\&\'\`$am_lf]]*)
773    AC_MSG_ERROR([unsafe absolute working directory name]);;
774esac
775case $srcdir in
776  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
777    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
778esac
779
780# Do 'set' in a subshell so we don't clobber the current shell's
781# arguments.  Must try -L first in case configure is actually a
782# symlink; some systems play weird games with the mod time of symlinks
783# (eg FreeBSD returns the mod time of the symlink's containing
784# directory).
785if (
786   am_has_slept=no
787   for am_try in 1 2; do
788     echo "timestamp, slept: $am_has_slept" > conftest.file
789     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
790     if test "$[*]" = "X"; then
791	# -L didn't work.
792	set X `ls -t "$srcdir/configure" conftest.file`
793     fi
794     if test "$[*]" != "X $srcdir/configure conftest.file" \
795	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
796
797	# If neither matched, then we have a broken ls.  This can happen
798	# if, for instance, CONFIG_SHELL is bash and it inherits a
799	# broken ls alias from the environment.  This has actually
800	# happened.  Such a system could not be considered "sane".
801	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
802  alias in your environment])
803     fi
804     if test "$[2]" = conftest.file || test $am_try -eq 2; then
805       break
806     fi
807     # Just in case.
808     sleep 1
809     am_has_slept=yes
810   done
811   test "$[2]" = conftest.file
812   )
813then
814   # Ok.
815   :
816else
817   AC_MSG_ERROR([newly created file is older than distributed files!
818Check your system clock])
819fi
820AC_MSG_RESULT([yes])
821# If we didn't sleep, we still need to ensure time stamps of config.status and
822# generated files are strictly newer.
823am_sleep_pid=
824if grep 'slept: no' conftest.file >/dev/null 2>&1; then
825  ( sleep 1 ) &
826  am_sleep_pid=$!
827fi
828AC_CONFIG_COMMANDS_PRE(
829  [AC_MSG_CHECKING([that generated files are newer than configure])
830   if test -n "$am_sleep_pid"; then
831     # Hide warnings about reused PIDs.
832     wait $am_sleep_pid 2>/dev/null
833   fi
834   AC_MSG_RESULT([done])])
835rm -f conftest.file
836])
837
838# Copyright (C) 2009-2013 Free Software Foundation, Inc.
839#
840# This file is free software; the Free Software Foundation
841# gives unlimited permission to copy and/or distribute it,
842# with or without modifications, as long as this notice is preserved.
843
844# AM_SILENT_RULES([DEFAULT])
845# --------------------------
846# Enable less verbose build rules; with the default set to DEFAULT
847# ("yes" being less verbose, "no" or empty being verbose).
848AC_DEFUN([AM_SILENT_RULES],
849[AC_ARG_ENABLE([silent-rules], [dnl
850AS_HELP_STRING(
851  [--enable-silent-rules],
852  [less verbose build output (undo: "make V=1")])
853AS_HELP_STRING(
854  [--disable-silent-rules],
855  [verbose build output (undo: "make V=0")])dnl
856])
857case $enable_silent_rules in @%:@ (((
858  yes) AM_DEFAULT_VERBOSITY=0;;
859   no) AM_DEFAULT_VERBOSITY=1;;
860    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
861esac
862dnl
863dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
864dnl do not support nested variable expansions.
865dnl See automake bug#9928 and bug#10237.
866am_make=${MAKE-make}
867AC_CACHE_CHECK([whether $am_make supports nested variables],
868   [am_cv_make_support_nested_variables],
869   [if AS_ECHO([['TRUE=$(BAR$(V))
870BAR0=false
871BAR1=true
872V=1
873am__doit:
874	@$(TRUE)
875.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
876  am_cv_make_support_nested_variables=yes
877else
878  am_cv_make_support_nested_variables=no
879fi])
880if test $am_cv_make_support_nested_variables = yes; then
881  dnl Using '$V' instead of '$(V)' breaks IRIX make.
882  AM_V='$(V)'
883  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
884else
885  AM_V=$AM_DEFAULT_VERBOSITY
886  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
887fi
888AC_SUBST([AM_V])dnl
889AM_SUBST_NOTMAKE([AM_V])dnl
890AC_SUBST([AM_DEFAULT_V])dnl
891AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
892AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
893AM_BACKSLASH='\'
894AC_SUBST([AM_BACKSLASH])dnl
895_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
896])
897
898# Copyright (C) 2001-2013 Free Software Foundation, Inc.
899#
900# This file is free software; the Free Software Foundation
901# gives unlimited permission to copy and/or distribute it,
902# with or without modifications, as long as this notice is preserved.
903
904# AM_PROG_INSTALL_STRIP
905# ---------------------
906# One issue with vendor 'install' (even GNU) is that you can't
907# specify the program used to strip binaries.  This is especially
908# annoying in cross-compiling environments, where the build's strip
909# is unlikely to handle the host's binaries.
910# Fortunately install-sh will honor a STRIPPROG variable, so we
911# always use install-sh in "make install-strip", and initialize
912# STRIPPROG with the value of the STRIP variable (set by the user).
913AC_DEFUN([AM_PROG_INSTALL_STRIP],
914[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
915# Installed binaries are usually stripped using 'strip' when the user
916# run "make install-strip".  However 'strip' might not be the right
917# tool to use in cross-compilation environments, therefore Automake
918# will honor the 'STRIP' environment variable to overrule this program.
919dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
920if test "$cross_compiling" != no; then
921  AC_CHECK_TOOL([STRIP], [strip], :)
922fi
923INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
924AC_SUBST([INSTALL_STRIP_PROGRAM])])
925
926# Copyright (C) 2006-2013 Free Software Foundation, Inc.
927#
928# This file is free software; the Free Software Foundation
929# gives unlimited permission to copy and/or distribute it,
930# with or without modifications, as long as this notice is preserved.
931
932# _AM_SUBST_NOTMAKE(VARIABLE)
933# ---------------------------
934# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
935# This macro is traced by Automake.
936AC_DEFUN([_AM_SUBST_NOTMAKE])
937
938# AM_SUBST_NOTMAKE(VARIABLE)
939# --------------------------
940# Public sister of _AM_SUBST_NOTMAKE.
941AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
942
943# Check how to create a tarball.                            -*- Autoconf -*-
944
945# Copyright (C) 2004-2013 Free Software Foundation, Inc.
946#
947# This file is free software; the Free Software Foundation
948# gives unlimited permission to copy and/or distribute it,
949# with or without modifications, as long as this notice is preserved.
950
951# _AM_PROG_TAR(FORMAT)
952# --------------------
953# Check how to create a tarball in format FORMAT.
954# FORMAT should be one of 'v7', 'ustar', or 'pax'.
955#
956# Substitute a variable $(am__tar) that is a command
957# writing to stdout a FORMAT-tarball containing the directory
958# $tardir.
959#     tardir=directory && $(am__tar) > result.tar
960#
961# Substitute a variable $(am__untar) that extract such
962# a tarball read from stdin.
963#     $(am__untar) < result.tar
964#
965AC_DEFUN([_AM_PROG_TAR],
966[# Always define AMTAR for backward compatibility.  Yes, it's still used
967# in the wild :-(  We should find a proper way to deprecate it ...
968AC_SUBST([AMTAR], ['$${TAR-tar}'])
969
970# We'll loop over all known methods to create a tar archive until one works.
971_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
972
973m4_if([$1], [v7],
974  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
975
976  [m4_case([$1],
977    [ustar],
978     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
979      # There is notably a 21 bits limit for the UID and the GID.  In fact,
980      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
981      # and bug#13588).
982      am_max_uid=2097151 # 2^21 - 1
983      am_max_gid=$am_max_uid
984      # The $UID and $GID variables are not portable, so we need to resort
985      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
986      # below are definitely unexpected, so allow the users to see them
987      # (that is, avoid stderr redirection).
988      am_uid=`id -u || echo unknown`
989      am_gid=`id -g || echo unknown`
990      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
991      if test $am_uid -le $am_max_uid; then
992         AC_MSG_RESULT([yes])
993      else
994         AC_MSG_RESULT([no])
995         _am_tools=none
996      fi
997      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
998      if test $am_gid -le $am_max_gid; then
999         AC_MSG_RESULT([yes])
1000      else
1001        AC_MSG_RESULT([no])
1002        _am_tools=none
1003      fi],
1004
1005  [pax],
1006    [],
1007
1008  [m4_fatal([Unknown tar format])])
1009
1010  AC_MSG_CHECKING([how to create a $1 tar archive])
1011
1012  # Go ahead even if we have the value already cached.  We do so because we
1013  # need to set the values for the 'am__tar' and 'am__untar' variables.
1014  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1015
1016  for _am_tool in $_am_tools; do
1017    case $_am_tool in
1018    gnutar)
1019      for _am_tar in tar gnutar gtar; do
1020        AM_RUN_LOG([$_am_tar --version]) && break
1021      done
1022      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1023      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1024      am__untar="$_am_tar -xf -"
1025      ;;
1026    plaintar)
1027      # Must skip GNU tar: if it does not support --format= it doesn't create
1028      # ustar tarball either.
1029      (tar --version) >/dev/null 2>&1 && continue
1030      am__tar='tar chf - "$$tardir"'
1031      am__tar_='tar chf - "$tardir"'
1032      am__untar='tar xf -'
1033      ;;
1034    pax)
1035      am__tar='pax -L -x $1 -w "$$tardir"'
1036      am__tar_='pax -L -x $1 -w "$tardir"'
1037      am__untar='pax -r'
1038      ;;
1039    cpio)
1040      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1041      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1042      am__untar='cpio -i -H $1 -d'
1043      ;;
1044    none)
1045      am__tar=false
1046      am__tar_=false
1047      am__untar=false
1048      ;;
1049    esac
1050
1051    # If the value was cached, stop now.  We just wanted to have am__tar
1052    # and am__untar set.
1053    test -n "${am_cv_prog_tar_$1}" && break
1054
1055    # tar/untar a dummy directory, and stop if the command works.
1056    rm -rf conftest.dir
1057    mkdir conftest.dir
1058    echo GrepMe > conftest.dir/file
1059    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1060    rm -rf conftest.dir
1061    if test -s conftest.tar; then
1062      AM_RUN_LOG([$am__untar <conftest.tar])
1063      AM_RUN_LOG([cat conftest.dir/file])
1064      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1065    fi
1066  done
1067  rm -rf conftest.dir
1068
1069  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1070  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1071
1072AC_SUBST([am__tar])
1073AC_SUBST([am__untar])
1074]) # _AM_PROG_TAR
1075
1076# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1077# serial 1 (pkg-config-0.24)
1078# 
1079# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1080#
1081# This program is free software; you can redistribute it and/or modify
1082# it under the terms of the GNU General Public License as published by
1083# the Free Software Foundation; either version 2 of the License, or
1084# (at your option) any later version.
1085#
1086# This program is distributed in the hope that it will be useful, but
1087# WITHOUT ANY WARRANTY; without even the implied warranty of
1088# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1089# General Public License for more details.
1090#
1091# You should have received a copy of the GNU General Public License
1092# along with this program; if not, write to the Free Software
1093# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1094#
1095# As a special exception to the GNU General Public License, if you
1096# distribute this file as part of a program that contains a
1097# configuration script generated by Autoconf, you may include it under
1098# the same distribution terms that you use for the rest of that program.
1099
1100# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1101# ----------------------------------
1102AC_DEFUN([PKG_PROG_PKG_CONFIG],
1103[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1104m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1105AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1106AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1107AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1108
1109if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1110	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1111fi
1112if test -n "$PKG_CONFIG"; then
1113	_pkg_min_version=m4_default([$1], [0.9.0])
1114	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1115	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1116		AC_MSG_RESULT([yes])
1117	else
1118		AC_MSG_RESULT([no])
1119		PKG_CONFIG=""
1120	fi
1121fi[]dnl
1122])# PKG_PROG_PKG_CONFIG
1123
1124# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1125#
1126# Check to see whether a particular set of modules exists.  Similar
1127# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1128#
1129# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1130# only at the first occurence in configure.ac, so if the first place
1131# it's called might be skipped (such as if it is within an "if", you
1132# have to call PKG_CHECK_EXISTS manually
1133# --------------------------------------------------------------
1134AC_DEFUN([PKG_CHECK_EXISTS],
1135[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1136if test -n "$PKG_CONFIG" && \
1137    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1138  m4_default([$2], [:])
1139m4_ifvaln([$3], [else
1140  $3])dnl
1141fi])
1142
1143# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1144# ---------------------------------------------
1145m4_define([_PKG_CONFIG],
1146[if test -n "$$1"; then
1147    pkg_cv_[]$1="$$1"
1148 elif test -n "$PKG_CONFIG"; then
1149    PKG_CHECK_EXISTS([$3],
1150                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1151		     [pkg_failed=yes])
1152 else
1153    pkg_failed=untried
1154fi[]dnl
1155])# _PKG_CONFIG
1156
1157# _PKG_SHORT_ERRORS_SUPPORTED
1158# -----------------------------
1159AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1160[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1161if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1162        _pkg_short_errors_supported=yes
1163else
1164        _pkg_short_errors_supported=no
1165fi[]dnl
1166])# _PKG_SHORT_ERRORS_SUPPORTED
1167
1168
1169# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1170# [ACTION-IF-NOT-FOUND])
1171#
1172#
1173# Note that if there is a possibility the first call to
1174# PKG_CHECK_MODULES might not happen, you should be sure to include an
1175# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1176#
1177#
1178# --------------------------------------------------------------
1179AC_DEFUN([PKG_CHECK_MODULES],
1180[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1181AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1182AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1183
1184pkg_failed=no
1185AC_MSG_CHECKING([for $1])
1186
1187_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1188_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1189
1190m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1191and $1[]_LIBS to avoid the need to call pkg-config.
1192See the pkg-config man page for more details.])
1193
1194if test $pkg_failed = yes; then
1195   	AC_MSG_RESULT([no])
1196        _PKG_SHORT_ERRORS_SUPPORTED
1197        if test $_pkg_short_errors_supported = yes; then
1198	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1199        else 
1200	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1201        fi
1202	# Put the nasty error message in config.log where it belongs
1203	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1204
1205	m4_default([$4], [AC_MSG_ERROR(
1206[Package requirements ($2) were not met:
1207
1208$$1_PKG_ERRORS
1209
1210Consider adjusting the PKG_CONFIG_PATH environment variable if you
1211installed software in a non-standard prefix.
1212
1213_PKG_TEXT])
1214        ])
1215elif test $pkg_failed = untried; then
1216     	AC_MSG_RESULT([no])
1217	m4_default([$4], [AC_MSG_FAILURE(
1218[The pkg-config script could not be found or is too old.  Make sure it
1219is in your PATH or set the PKG_CONFIG environment variable to the full
1220path to pkg-config.
1221
1222_PKG_TEXT
1223
1224To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
1225        ])
1226else
1227	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1228	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1229        AC_MSG_RESULT([yes])
1230	$3
1231fi[]dnl
1232])# PKG_CHECK_MODULES
1233
1234dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1235dnl
1236dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1237dnl 
1238dnl Permission is hereby granted, free of charge, to any person obtaining a
1239dnl copy of this software and associated documentation files (the "Software"),
1240dnl to deal in the Software without restriction, including without limitation
1241dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1242dnl and/or sell copies of the Software, and to permit persons to whom the
1243dnl Software is furnished to do so, subject to the following conditions:
1244dnl
1245dnl The above copyright notice and this permission notice (including the next
1246dnl paragraph) shall be included in all copies or substantial portions of the
1247dnl Software.
1248dnl
1249dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1250dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1251dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1252dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1253dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1254dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1255dnl DEALINGS IN THE SOFTWARE.
1256
1257# XORG_MACROS_VERSION(required-version)
1258# -------------------------------------
1259# Minimum version: 1.1.0
1260#
1261# If you're using a macro added in Version 1.1 or newer, include this in
1262# your configure.ac with the minimum required version, such as:
1263# XORG_MACROS_VERSION(1.1)
1264#
1265# To ensure that this macro is defined, also add:
1266# m4_ifndef([XORG_MACROS_VERSION],
1267#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1268#
1269#
1270# See the "minimum version" comment for each macro you use to see what 
1271# version you require.
1272m4_defun([XORG_MACROS_VERSION],[
1273m4_define([vers_have], [1.17])
1274m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1275m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1276m4_if(m4_cmp(maj_have, maj_needed), 0,,
1277    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1278m4_if(m4_version_compare(vers_have, [$1]), -1,
1279    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1280m4_undefine([vers_have])
1281m4_undefine([maj_have])
1282m4_undefine([maj_needed])
1283]) # XORG_MACROS_VERSION
1284
1285# XORG_PROG_RAWCPP()
1286# ------------------
1287# Minimum version: 1.0.0
1288#
1289# Find cpp program and necessary flags for use in pre-processing text files
1290# such as man pages and config files
1291AC_DEFUN([XORG_PROG_RAWCPP],[
1292AC_REQUIRE([AC_PROG_CPP])
1293AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1294   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1295
1296# Check for flag to avoid builtin definitions - assumes unix is predefined,
1297# which is not the best choice for supporting other OS'es, but covers most
1298# of the ones we need for now.
1299AC_MSG_CHECKING([if $RAWCPP requires -undef])
1300AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1301if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1302	AC_MSG_RESULT([no])
1303else
1304	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1305		RAWCPPFLAGS=-undef
1306		AC_MSG_RESULT([yes])
1307	# under Cygwin unix is still defined even with -undef
1308	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1309		RAWCPPFLAGS="-undef -ansi"
1310		AC_MSG_RESULT([yes, with -ansi])
1311	else
1312		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1313	fi
1314fi
1315rm -f conftest.$ac_ext
1316
1317AC_MSG_CHECKING([if $RAWCPP requires -traditional])
1318AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1319if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1320	AC_MSG_RESULT([no])
1321else
1322	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1323		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1324		AC_MSG_RESULT([yes])
1325	else
1326		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1327	fi
1328fi
1329rm -f conftest.$ac_ext
1330AC_SUBST(RAWCPPFLAGS)
1331]) # XORG_PROG_RAWCPP
1332
1333# XORG_MANPAGE_SECTIONS()
1334# -----------------------
1335# Minimum version: 1.0.0
1336#
1337# Determine which sections man pages go in for the different man page types
1338# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1339# Not sure if there's any better way than just hardcoding by OS name.
1340# Override default settings by setting environment variables
1341# Added MAN_SUBSTS in version 1.8
1342# Added AC_PROG_SED in version 1.8
1343
1344AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1345AC_REQUIRE([AC_CANONICAL_HOST])
1346AC_REQUIRE([AC_PROG_SED])
1347
1348if test x$APP_MAN_SUFFIX = x    ; then
1349    APP_MAN_SUFFIX=1
1350fi
1351if test x$APP_MAN_DIR = x    ; then
1352    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1353fi
1354
1355if test x$LIB_MAN_SUFFIX = x    ; then
1356    LIB_MAN_SUFFIX=3
1357fi
1358if test x$LIB_MAN_DIR = x    ; then
1359    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1360fi
1361
1362if test x$FILE_MAN_SUFFIX = x    ; then
1363    case $host_os in
1364	solaris*)	FILE_MAN_SUFFIX=4  ;;
1365	*)		FILE_MAN_SUFFIX=5  ;;
1366    esac
1367fi
1368if test x$FILE_MAN_DIR = x    ; then
1369    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1370fi
1371
1372if test x$MISC_MAN_SUFFIX = x    ; then
1373    case $host_os in
1374	solaris*)	MISC_MAN_SUFFIX=5  ;;
1375	*)		MISC_MAN_SUFFIX=7  ;;
1376    esac
1377fi
1378if test x$MISC_MAN_DIR = x    ; then
1379    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1380fi
1381
1382if test x$DRIVER_MAN_SUFFIX = x    ; then
1383    case $host_os in
1384	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1385	*)		DRIVER_MAN_SUFFIX=4  ;;
1386    esac
1387fi
1388if test x$DRIVER_MAN_DIR = x    ; then
1389    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1390fi
1391
1392if test x$ADMIN_MAN_SUFFIX = x    ; then
1393    case $host_os in
1394	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1395	*)		ADMIN_MAN_SUFFIX=8  ;;
1396    esac
1397fi
1398if test x$ADMIN_MAN_DIR = x    ; then
1399    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1400fi
1401
1402
1403AC_SUBST([APP_MAN_SUFFIX])
1404AC_SUBST([LIB_MAN_SUFFIX])
1405AC_SUBST([FILE_MAN_SUFFIX])
1406AC_SUBST([MISC_MAN_SUFFIX])
1407AC_SUBST([DRIVER_MAN_SUFFIX])
1408AC_SUBST([ADMIN_MAN_SUFFIX])
1409AC_SUBST([APP_MAN_DIR])
1410AC_SUBST([LIB_MAN_DIR])
1411AC_SUBST([FILE_MAN_DIR])
1412AC_SUBST([MISC_MAN_DIR])
1413AC_SUBST([DRIVER_MAN_DIR])
1414AC_SUBST([ADMIN_MAN_DIR])
1415
1416XORG_MAN_PAGE="X Version 11"
1417AC_SUBST([XORG_MAN_PAGE])
1418MAN_SUBSTS="\
1419	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1420	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1421	-e 's|__xservername__|Xorg|g' \
1422	-e 's|__xconfigfile__|xorg.conf|g' \
1423	-e 's|__xorgconfdir__|xorg.conf.d|g' \
1424	-e 's|__projectroot__|\$(prefix)|g' \
1425	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1426	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1427	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1428	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1429	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1430	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1431	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1432AC_SUBST([MAN_SUBSTS])
1433
1434]) # XORG_MANPAGE_SECTIONS
1435
1436# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1437# ------------------------
1438# Minimum version: 1.7.0
1439#
1440# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1441# provided by xorg-sgml-doctools, if installed.
1442AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1443AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1444XORG_SGML_PATH=
1445PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1446    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1447    [m4_ifval([$1],[:],
1448        [if test x"$cross_compiling" != x"yes" ; then
1449            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1450                          [XORG_SGML_PATH=$prefix/share/sgml])
1451         fi])
1452    ])
1453
1454# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1455# the path and the name of the doc stylesheet
1456if test "x$XORG_SGML_PATH" != "x" ; then
1457   AC_MSG_RESULT([$XORG_SGML_PATH])
1458   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1459   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1460else
1461   AC_MSG_RESULT([no])
1462fi
1463
1464AC_SUBST(XORG_SGML_PATH)
1465AC_SUBST(STYLESHEET_SRCDIR)
1466AC_SUBST(XSL_STYLESHEET)
1467AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1468]) # XORG_CHECK_SGML_DOCTOOLS
1469
1470# XORG_CHECK_LINUXDOC
1471# -------------------
1472# Minimum version: 1.0.0
1473#
1474# Defines the variable MAKE_TEXT if the necessary tools and
1475# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1476# Whether or not the necessary tools and files are found can be checked
1477# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1478AC_DEFUN([XORG_CHECK_LINUXDOC],[
1479AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1480AC_REQUIRE([XORG_WITH_PS2PDF])
1481
1482AC_PATH_PROG(LINUXDOC, linuxdoc)
1483
1484AC_MSG_CHECKING([whether to build documentation])
1485
1486if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1487   BUILDDOC=yes
1488else
1489   BUILDDOC=no
1490fi
1491
1492AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1493
1494AC_MSG_RESULT([$BUILDDOC])
1495
1496AC_MSG_CHECKING([whether to build pdf documentation])
1497
1498if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1499   BUILDPDFDOC=yes
1500else
1501   BUILDPDFDOC=no
1502fi
1503
1504AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1505
1506AC_MSG_RESULT([$BUILDPDFDOC])
1507
1508MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1509MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1510MAKE_PDF="$PS2PDF"
1511MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1512
1513AC_SUBST(MAKE_TEXT)
1514AC_SUBST(MAKE_PS)
1515AC_SUBST(MAKE_PDF)
1516AC_SUBST(MAKE_HTML)
1517]) # XORG_CHECK_LINUXDOC
1518
1519# XORG_CHECK_DOCBOOK
1520# -------------------
1521# Minimum version: 1.0.0
1522#
1523# Checks for the ability to build output formats from SGML DocBook source.
1524# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1525# indicates whether the necessary tools and files are found and, if set,
1526# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1527AC_DEFUN([XORG_CHECK_DOCBOOK],[
1528AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1529
1530BUILDTXTDOC=no
1531BUILDPDFDOC=no
1532BUILDPSDOC=no
1533BUILDHTMLDOC=no
1534
1535AC_PATH_PROG(DOCBOOKPS, docbook2ps)
1536AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1537AC_PATH_PROG(DOCBOOKHTML, docbook2html)
1538AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1539
1540AC_MSG_CHECKING([whether to build text documentation])
1541if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1542   test x$BUILD_TXTDOC != xno; then
1543	BUILDTXTDOC=yes
1544fi
1545AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1546AC_MSG_RESULT([$BUILDTXTDOC])
1547
1548AC_MSG_CHECKING([whether to build PDF documentation])
1549if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1550   test x$BUILD_PDFDOC != xno; then
1551	BUILDPDFDOC=yes
1552fi
1553AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1554AC_MSG_RESULT([$BUILDPDFDOC])
1555
1556AC_MSG_CHECKING([whether to build PostScript documentation])
1557if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1558   test x$BUILD_PSDOC != xno; then
1559	BUILDPSDOC=yes
1560fi
1561AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1562AC_MSG_RESULT([$BUILDPSDOC])
1563
1564AC_MSG_CHECKING([whether to build HTML documentation])
1565if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1566   test x$BUILD_HTMLDOC != xno; then
1567	BUILDHTMLDOC=yes
1568fi
1569AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1570AC_MSG_RESULT([$BUILDHTMLDOC])
1571
1572MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1573MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1574MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1575MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1576
1577AC_SUBST(MAKE_TEXT)
1578AC_SUBST(MAKE_PS)
1579AC_SUBST(MAKE_PDF)
1580AC_SUBST(MAKE_HTML)
1581]) # XORG_CHECK_DOCBOOK
1582
1583# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1584# ----------------
1585# Minimum version: 1.5.0
1586# Minimum version for optional DEFAULT argument: 1.11.0
1587#
1588# Documentation tools are not always available on all platforms and sometimes
1589# not at the appropriate level. This macro enables a module to test for the
1590# presence of the tool and obtain it's path in separate variables. Coupled with
1591# the --with-xmlto option, it allows maximum flexibilty in making decisions
1592# as whether or not to use the xmlto package. When DEFAULT is not specified,
1593# --with-xmlto assumes 'auto'.
1594#
1595# Interface to module:
1596# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1597# XMLTO:	returns the path of the xmlto program found
1598#		returns the path set by the user in the environment
1599# --with-xmlto:	'yes' user instructs the module to use xmlto
1600#		'no' user instructs the module not to use xmlto
1601#
1602# Added in version 1.10.0
1603# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1604#                  xmlto for text output requires either lynx, links, or w3m browsers
1605#
1606# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1607#
1608AC_DEFUN([XORG_WITH_XMLTO],[
1609AC_ARG_VAR([XMLTO], [Path to xmlto command])
1610m4_define([_defopt], m4_default([$2], [auto]))
1611AC_ARG_WITH(xmlto,
1612	AS_HELP_STRING([--with-xmlto],
1613	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1614	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1615m4_undefine([_defopt])
1616
1617if test "x$use_xmlto" = x"auto"; then
1618   AC_PATH_PROG([XMLTO], [xmlto])
1619   if test "x$XMLTO" = "x"; then
1620        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1621	have_xmlto=no
1622   else
1623        have_xmlto=yes
1624   fi
1625elif test "x$use_xmlto" = x"yes" ; then
1626   AC_PATH_PROG([XMLTO], [xmlto])
1627   if test "x$XMLTO" = "x"; then
1628        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1629   fi
1630   have_xmlto=yes
1631elif test "x$use_xmlto" = x"no" ; then
1632   if test "x$XMLTO" != "x"; then
1633      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1634   fi
1635   have_xmlto=no
1636else
1637   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1638fi
1639
1640# Test for a minimum version of xmlto, if provided.
1641m4_ifval([$1],
1642[if test "$have_xmlto" = yes; then
1643    # scrape the xmlto version
1644    AC_MSG_CHECKING([the xmlto version])
1645    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1646    AC_MSG_RESULT([$xmlto_version])
1647    AS_VERSION_COMPARE([$xmlto_version], [$1],
1648        [if test "x$use_xmlto" = xauto; then
1649            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1650            have_xmlto=no
1651        else
1652            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1653        fi])
1654fi])
1655
1656# Test for the ability of xmlto to generate a text target
1657have_xmlto_text=no
1658cat > conftest.xml << "EOF"
1659EOF
1660AS_IF([test "$have_xmlto" = yes],
1661      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1662             [have_xmlto_text=yes],
1663             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1664rm -f conftest.xml
1665AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1666AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1667]) # XORG_WITH_XMLTO
1668
1669# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1670# --------------------------------------------
1671# Minimum version: 1.12.0
1672# Minimum version for optional DEFAULT argument: 1.12.0
1673#
1674# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1675# XML-based language used for the transformation of XML documents.
1676# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1677# It is used under the cover by xmlto to generate html files from DocBook/XML.
1678# The XSLT processor is often used as a standalone tool for transformations.
1679# It should not be assumed that this tool is used only to work with documnetation.
1680# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1681#
1682# Interface to module:
1683# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1684# XSLTPROC:	 returns the path of the xsltproc program found
1685#		 returns the path set by the user in the environment
1686# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1687#		  'no' user instructs the module not to use xsltproc
1688# have_xsltproc: returns yes if xsltproc found in PATH or no
1689#
1690# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1691#
1692AC_DEFUN([XORG_WITH_XSLTPROC],[
1693AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1694# Preserves the interface, should it be implemented later
1695m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1696m4_define([_defopt], m4_default([$2], [auto]))
1697AC_ARG_WITH(xsltproc,
1698	AS_HELP_STRING([--with-xsltproc],
1699	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1700	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1701m4_undefine([_defopt])
1702
1703if test "x$use_xsltproc" = x"auto"; then
1704   AC_PATH_PROG([XSLTPROC], [xsltproc])
1705   if test "x$XSLTPROC" = "x"; then
1706        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1707	have_xsltproc=no
1708   else
1709        have_xsltproc=yes
1710   fi
1711elif test "x$use_xsltproc" = x"yes" ; then
1712   AC_PATH_PROG([XSLTPROC], [xsltproc])
1713   if test "x$XSLTPROC" = "x"; then
1714        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1715   fi
1716   have_xsltproc=yes
1717elif test "x$use_xsltproc" = x"no" ; then
1718   if test "x$XSLTPROC" != "x"; then
1719      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1720   fi
1721   have_xsltproc=no
1722else
1723   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1724fi
1725
1726AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1727]) # XORG_WITH_XSLTPROC
1728
1729# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1730# ----------------------------------------
1731# Minimum version: 1.15.0
1732#
1733# PERL (Practical Extraction and Report Language) is a language optimized for
1734# scanning arbitrary text files, extracting information from those text files,
1735# and printing reports based on that information.
1736#
1737# When DEFAULT is not specified, --with-perl assumes 'auto'.
1738#
1739# Interface to module:
1740# HAVE_PERL: used in makefiles to conditionally scan text files
1741# PERL:	     returns the path of the perl program found
1742#	     returns the path set by the user in the environment
1743# --with-perl: 'yes' user instructs the module to use perl
1744#	       'no' user instructs the module not to use perl
1745# have_perl: returns yes if perl found in PATH or no
1746#
1747# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1748#
1749AC_DEFUN([XORG_WITH_PERL],[
1750AC_ARG_VAR([PERL], [Path to perl command])
1751# Preserves the interface, should it be implemented later
1752m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1753m4_define([_defopt], m4_default([$2], [auto]))
1754AC_ARG_WITH(perl,
1755	AS_HELP_STRING([--with-perl],
1756	   [Use perl for extracting information from files (default: ]_defopt[)]),
1757	   [use_perl=$withval], [use_perl=]_defopt)
1758m4_undefine([_defopt])
1759
1760if test "x$use_perl" = x"auto"; then
1761   AC_PATH_PROG([PERL], [perl])
1762   if test "x$PERL" = "x"; then
1763        AC_MSG_WARN([perl not found - cannot extract information and report])
1764	have_perl=no
1765   else
1766        have_perl=yes
1767   fi
1768elif test "x$use_perl" = x"yes" ; then
1769   AC_PATH_PROG([PERL], [perl])
1770   if test "x$PERL" = "x"; then
1771        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1772   fi
1773   have_perl=yes
1774elif test "x$use_perl" = x"no" ; then
1775   if test "x$PERL" != "x"; then
1776      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1777   fi
1778   have_perl=no
1779else
1780   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1781fi
1782
1783AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1784]) # XORG_WITH_PERL
1785
1786# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1787# ----------------
1788# Minimum version: 1.5.0
1789# Minimum version for optional DEFAULT argument: 1.11.0
1790#
1791# Documentation tools are not always available on all platforms and sometimes
1792# not at the appropriate level. This macro enables a module to test for the
1793# presence of the tool and obtain it's path in separate variables. Coupled with
1794# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1795# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1796# --with-asciidoc assumes 'auto'.
1797#
1798# Interface to module:
1799# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1800# ASCIIDOC:	 returns the path of the asciidoc program found
1801#		 returns the path set by the user in the environment
1802# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1803#		  'no' user instructs the module not to use asciidoc
1804#
1805# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1806#
1807AC_DEFUN([XORG_WITH_ASCIIDOC],[
1808AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1809m4_define([_defopt], m4_default([$2], [auto]))
1810AC_ARG_WITH(asciidoc,
1811	AS_HELP_STRING([--with-asciidoc],
1812	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1813	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1814m4_undefine([_defopt])
1815
1816if test "x$use_asciidoc" = x"auto"; then
1817   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1818   if test "x$ASCIIDOC" = "x"; then
1819        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1820	have_asciidoc=no
1821   else
1822        have_asciidoc=yes
1823   fi
1824elif test "x$use_asciidoc" = x"yes" ; then
1825   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1826   if test "x$ASCIIDOC" = "x"; then
1827        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1828   fi
1829   have_asciidoc=yes
1830elif test "x$use_asciidoc" = x"no" ; then
1831   if test "x$ASCIIDOC" != "x"; then
1832      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1833   fi
1834   have_asciidoc=no
1835else
1836   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1837fi
1838m4_ifval([$1],
1839[if test "$have_asciidoc" = yes; then
1840    # scrape the asciidoc version
1841    AC_MSG_CHECKING([the asciidoc version])
1842    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1843    AC_MSG_RESULT([$asciidoc_version])
1844    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1845        [if test "x$use_asciidoc" = xauto; then
1846            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1847            have_asciidoc=no
1848        else
1849            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1850        fi])
1851fi])
1852AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1853]) # XORG_WITH_ASCIIDOC
1854
1855# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1856# --------------------------------
1857# Minimum version: 1.5.0
1858# Minimum version for optional DEFAULT argument: 1.11.0
1859#
1860# Documentation tools are not always available on all platforms and sometimes
1861# not at the appropriate level. This macro enables a module to test for the
1862# presence of the tool and obtain it's path in separate variables. Coupled with
1863# the --with-doxygen option, it allows maximum flexibilty in making decisions
1864# as whether or not to use the doxygen package. When DEFAULT is not specified,
1865# --with-doxygen assumes 'auto'.
1866#
1867# Interface to module:
1868# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1869# DOXYGEN:	 returns the path of the doxygen program found
1870#		 returns the path set by the user in the environment
1871# --with-doxygen: 'yes' user instructs the module to use doxygen
1872#		  'no' user instructs the module not to use doxygen
1873#
1874# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1875#
1876AC_DEFUN([XORG_WITH_DOXYGEN],[
1877AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1878m4_define([_defopt], m4_default([$2], [auto]))
1879AC_ARG_WITH(doxygen,
1880	AS_HELP_STRING([--with-doxygen],
1881	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1882	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1883m4_undefine([_defopt])
1884
1885if test "x$use_doxygen" = x"auto"; then
1886   AC_PATH_PROG([DOXYGEN], [doxygen])
1887   if test "x$DOXYGEN" = "x"; then
1888        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1889	have_doxygen=no
1890   else
1891        have_doxygen=yes
1892   fi
1893elif test "x$use_doxygen" = x"yes" ; then
1894   AC_PATH_PROG([DOXYGEN], [doxygen])
1895   if test "x$DOXYGEN" = "x"; then
1896        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1897   fi
1898   have_doxygen=yes
1899elif test "x$use_doxygen" = x"no" ; then
1900   if test "x$DOXYGEN" != "x"; then
1901      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1902   fi
1903   have_doxygen=no
1904else
1905   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1906fi
1907m4_ifval([$1],
1908[if test "$have_doxygen" = yes; then
1909    # scrape the doxygen version
1910    AC_MSG_CHECKING([the doxygen version])
1911    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1912    AC_MSG_RESULT([$doxygen_version])
1913    AS_VERSION_COMPARE([$doxygen_version], [$1],
1914        [if test "x$use_doxygen" = xauto; then
1915            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1916            have_doxygen=no
1917        else
1918            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1919        fi])
1920fi])
1921AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1922]) # XORG_WITH_DOXYGEN
1923
1924# XORG_WITH_GROFF([DEFAULT])
1925# ----------------
1926# Minimum version: 1.6.0
1927# Minimum version for optional DEFAULT argument: 1.11.0
1928#
1929# Documentation tools are not always available on all platforms and sometimes
1930# not at the appropriate level. This macro enables a module to test for the
1931# presence of the tool and obtain it's path in separate variables. Coupled with
1932# the --with-groff option, it allows maximum flexibilty in making decisions
1933# as whether or not to use the groff package. When DEFAULT is not specified,
1934# --with-groff assumes 'auto'.
1935#
1936# Interface to module:
1937# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1938# HAVE_GROFF_MM: the memorandum macros (-mm) package
1939# HAVE_GROFF_MS: the -ms macros package
1940# GROFF:	 returns the path of the groff program found
1941#		 returns the path set by the user in the environment
1942# --with-groff:	 'yes' user instructs the module to use groff
1943#		 'no' user instructs the module not to use groff
1944#
1945# Added in version 1.9.0:
1946# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1947#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1948#		   psselect from the psutils package.
1949#		   the ghostcript package. Refer to the grohtml man pages
1950#
1951# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1952#
1953# OS and distros often splits groff in a basic and full package, the former
1954# having the groff program and the later having devices, fonts and macros
1955# Checking for the groff executable is not enough.
1956#
1957# If macros are missing, we cannot assume that groff is useless, so we don't
1958# unset HAVE_GROFF or GROFF env variables.
1959# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1960#
1961AC_DEFUN([XORG_WITH_GROFF],[
1962AC_ARG_VAR([GROFF], [Path to groff command])
1963m4_define([_defopt], m4_default([$1], [auto]))
1964AC_ARG_WITH(groff,
1965	AS_HELP_STRING([--with-groff],
1966	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1967	   [use_groff=$withval], [use_groff=]_defopt)
1968m4_undefine([_defopt])
1969
1970if test "x$use_groff" = x"auto"; then
1971   AC_PATH_PROG([GROFF], [groff])
1972   if test "x$GROFF" = "x"; then
1973        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1974	have_groff=no
1975   else
1976        have_groff=yes
1977   fi
1978elif test "x$use_groff" = x"yes" ; then
1979   AC_PATH_PROG([GROFF], [groff])
1980   if test "x$GROFF" = "x"; then
1981        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1982   fi
1983   have_groff=yes
1984elif test "x$use_groff" = x"no" ; then
1985   if test "x$GROFF" != "x"; then
1986      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1987   fi
1988   have_groff=no
1989else
1990   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1991fi
1992
1993# We have groff, test for the presence of the macro packages
1994if test "x$have_groff" = x"yes"; then
1995    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1996    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1997        groff_ms_works=yes
1998    else
1999        groff_ms_works=no
2000    fi
2001    AC_MSG_RESULT([$groff_ms_works])
2002    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2003    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2004        groff_mm_works=yes
2005    else
2006        groff_mm_works=no
2007    fi
2008    AC_MSG_RESULT([$groff_mm_works])
2009fi
2010
2011# We have groff, test for HTML dependencies, one command per package
2012if test "x$have_groff" = x"yes"; then
2013   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2014   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2015   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2016   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2017      have_groff_html=yes
2018   else
2019      have_groff_html=no
2020      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2021   fi
2022fi
2023
2024# Set Automake conditionals for Makefiles
2025AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2026AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2027AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2028AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2029]) # XORG_WITH_GROFF
2030
2031# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2032# ---------------------------------------
2033# Minimum version: 1.6.0
2034# Minimum version for optional DEFAULT argument: 1.11.0
2035# Minimum version for optional MIN-VERSION argument: 1.15.0
2036#
2037# Documentation tools are not always available on all platforms and sometimes
2038# not at the appropriate level. This macro enables a module to test for the
2039# presence of the tool and obtain it's path in separate variables. Coupled with
2040# the --with-fop option, it allows maximum flexibilty in making decisions
2041# as whether or not to use the fop package. When DEFAULT is not specified,
2042# --with-fop assumes 'auto'.
2043#
2044# Interface to module:
2045# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2046# FOP:	 	returns the path of the fop program found
2047#		returns the path set by the user in the environment
2048# --with-fop: 	'yes' user instructs the module to use fop
2049#		'no' user instructs the module not to use fop
2050#
2051# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2052#
2053AC_DEFUN([XORG_WITH_FOP],[
2054AC_ARG_VAR([FOP], [Path to fop command])
2055m4_define([_defopt], m4_default([$2], [auto]))
2056AC_ARG_WITH(fop,
2057	AS_HELP_STRING([--with-fop],
2058	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2059	   [use_fop=$withval], [use_fop=]_defopt)
2060m4_undefine([_defopt])
2061
2062if test "x$use_fop" = x"auto"; then
2063   AC_PATH_PROG([FOP], [fop])
2064   if test "x$FOP" = "x"; then
2065        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2066	have_fop=no
2067   else
2068        have_fop=yes
2069   fi
2070elif test "x$use_fop" = x"yes" ; then
2071   AC_PATH_PROG([FOP], [fop])
2072   if test "x$FOP" = "x"; then
2073        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2074   fi
2075   have_fop=yes
2076elif test "x$use_fop" = x"no" ; then
2077   if test "x$FOP" != "x"; then
2078      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2079   fi
2080   have_fop=no
2081else
2082   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2083fi
2084
2085# Test for a minimum version of fop, if provided.
2086m4_ifval([$1],
2087[if test "$have_fop" = yes; then
2088    # scrape the fop version
2089    AC_MSG_CHECKING([for fop minimum version])
2090    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2091    AC_MSG_RESULT([$fop_version])
2092    AS_VERSION_COMPARE([$fop_version], [$1],
2093        [if test "x$use_fop" = xauto; then
2094            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2095            have_fop=no
2096        else
2097            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2098        fi])
2099fi])
2100AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2101]) # XORG_WITH_FOP
2102
2103# XORG_WITH_PS2PDF([DEFAULT])
2104# ----------------
2105# Minimum version: 1.6.0
2106# Minimum version for optional DEFAULT argument: 1.11.0
2107#
2108# Documentation tools are not always available on all platforms and sometimes
2109# not at the appropriate level. This macro enables a module to test for the
2110# presence of the tool and obtain it's path in separate variables. Coupled with
2111# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2112# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2113# --with-ps2pdf assumes 'auto'.
2114#
2115# Interface to module:
2116# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2117# PS2PDF:	returns the path of the ps2pdf program found
2118#		returns the path set by the user in the environment
2119# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2120#		 'no' user instructs the module not to use ps2pdf
2121#
2122# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2123#
2124AC_DEFUN([XORG_WITH_PS2PDF],[
2125AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2126m4_define([_defopt], m4_default([$1], [auto]))
2127AC_ARG_WITH(ps2pdf,
2128	AS_HELP_STRING([--with-ps2pdf],
2129	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2130	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2131m4_undefine([_defopt])
2132
2133if test "x$use_ps2pdf" = x"auto"; then
2134   AC_PATH_PROG([PS2PDF], [ps2pdf])
2135   if test "x$PS2PDF" = "x"; then
2136        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2137	have_ps2pdf=no
2138   else
2139        have_ps2pdf=yes
2140   fi
2141elif test "x$use_ps2pdf" = x"yes" ; then
2142   AC_PATH_PROG([PS2PDF], [ps2pdf])
2143   if test "x$PS2PDF" = "x"; then
2144        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2145   fi
2146   have_ps2pdf=yes
2147elif test "x$use_ps2pdf" = x"no" ; then
2148   if test "x$PS2PDF" != "x"; then
2149      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2150   fi
2151   have_ps2pdf=no
2152else
2153   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2154fi
2155AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2156]) # XORG_WITH_PS2PDF
2157
2158# XORG_ENABLE_DOCS (enable_docs=yes)
2159# ----------------
2160# Minimum version: 1.6.0
2161#
2162# Documentation tools are not always available on all platforms and sometimes
2163# not at the appropriate level. This macro enables a builder to skip all
2164# documentation targets except traditional man pages.
2165# Combined with the specific tool checking macros XORG_WITH_*, it provides
2166# maximum flexibilty in controlling documentation building.
2167# Refer to:
2168# XORG_WITH_XMLTO         --with-xmlto
2169# XORG_WITH_ASCIIDOC      --with-asciidoc
2170# XORG_WITH_DOXYGEN       --with-doxygen
2171# XORG_WITH_FOP           --with-fop
2172# XORG_WITH_GROFF         --with-groff
2173# XORG_WITH_PS2PDF        --with-ps2pdf
2174#
2175# Interface to module:
2176# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2177# --enable-docs: 'yes' user instructs the module to generate docs
2178#		 'no' user instructs the module not to generate docs
2179# parm1:	specify the default value, yes or no.
2180#
2181AC_DEFUN([XORG_ENABLE_DOCS],[
2182m4_define([docs_default], m4_default([$1], [yes]))
2183AC_ARG_ENABLE(docs,
2184	AS_HELP_STRING([--enable-docs],
2185	   [Enable building the documentation (default: ]docs_default[)]),
2186	   [build_docs=$enableval], [build_docs=]docs_default)
2187m4_undefine([docs_default])
2188AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2189AC_MSG_CHECKING([whether to build documentation])
2190AC_MSG_RESULT([$build_docs])
2191]) # XORG_ENABLE_DOCS
2192
2193# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2194# ----------------
2195# Minimum version: 1.6.0
2196#
2197# This macro enables a builder to skip all developer documentation.
2198# Combined with the specific tool checking macros XORG_WITH_*, it provides
2199# maximum flexibilty in controlling documentation building.
2200# Refer to:
2201# XORG_WITH_XMLTO         --with-xmlto
2202# XORG_WITH_ASCIIDOC      --with-asciidoc
2203# XORG_WITH_DOXYGEN       --with-doxygen
2204# XORG_WITH_FOP           --with-fop
2205# XORG_WITH_GROFF         --with-groff
2206# XORG_WITH_PS2PDF        --with-ps2pdf
2207#
2208# Interface to module:
2209# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2210# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2211#			'no' user instructs the module not to generate developer docs
2212# parm1:		specify the default value, yes or no.
2213#
2214AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2215m4_define([devel_default], m4_default([$1], [yes]))
2216AC_ARG_ENABLE(devel-docs,
2217	AS_HELP_STRING([--enable-devel-docs],
2218	   [Enable building the developer documentation (default: ]devel_default[)]),
2219	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2220m4_undefine([devel_default])
2221AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2222AC_MSG_CHECKING([whether to build developer documentation])
2223AC_MSG_RESULT([$build_devel_docs])
2224]) # XORG_ENABLE_DEVEL_DOCS
2225
2226# XORG_ENABLE_SPECS (enable_specs=yes)
2227# ----------------
2228# Minimum version: 1.6.0
2229#
2230# This macro enables a builder to skip all functional specification targets.
2231# Combined with the specific tool checking macros XORG_WITH_*, it provides
2232# maximum flexibilty in controlling documentation building.
2233# Refer to:
2234# XORG_WITH_XMLTO         --with-xmlto
2235# XORG_WITH_ASCIIDOC      --with-asciidoc
2236# XORG_WITH_DOXYGEN       --with-doxygen
2237# XORG_WITH_FOP           --with-fop
2238# XORG_WITH_GROFF         --with-groff
2239# XORG_WITH_PS2PDF        --with-ps2pdf
2240#
2241# Interface to module:
2242# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2243# --enable-specs:	'yes' user instructs the module to generate specs
2244#			'no' user instructs the module not to generate specs
2245# parm1:		specify the default value, yes or no.
2246#
2247AC_DEFUN([XORG_ENABLE_SPECS],[
2248m4_define([spec_default], m4_default([$1], [yes]))
2249AC_ARG_ENABLE(specs,
2250	AS_HELP_STRING([--enable-specs],
2251	   [Enable building the specs (default: ]spec_default[)]),
2252	   [build_specs=$enableval], [build_specs=]spec_default)
2253m4_undefine([spec_default])
2254AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2255AC_MSG_CHECKING([whether to build functional specifications])
2256AC_MSG_RESULT([$build_specs])
2257]) # XORG_ENABLE_SPECS
2258
2259# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2260# ----------------------------------------------
2261# Minimum version: 1.13.0
2262#
2263# This macro enables a builder to enable/disable unit testing
2264# It makes no assumption about the test cases implementation
2265# Test cases may or may not use Automake "Support for test suites"
2266# They may or may not use the software utility library GLib
2267#
2268# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2269# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2270# The variable enable_unit_tests is used by other macros in this file.
2271#
2272# Interface to module:
2273# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2274# enable_unit_tests:    used in configure.ac for additional configuration
2275# --enable-unit-tests:	'yes' user instructs the module to build tests
2276#			'no' user instructs the module not to build tests
2277# parm1:		specify the default value, yes or no.
2278#
2279AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2280AC_BEFORE([$0], [XORG_WITH_GLIB])
2281AC_BEFORE([$0], [XORG_LD_WRAP])
2282AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2283m4_define([_defopt], m4_default([$1], [auto]))
2284AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2285	[Enable building unit test cases (default: ]_defopt[)]),
2286	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2287m4_undefine([_defopt])
2288AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2289AC_MSG_CHECKING([whether to build unit test cases])
2290AC_MSG_RESULT([$enable_unit_tests])
2291]) # XORG_ENABLE_UNIT_TESTS
2292
2293# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2294# ------------------------------------------------------
2295# Minimum version: 1.17.0
2296#
2297# This macro enables a builder to enable/disable integration testing
2298# It makes no assumption about the test cases' implementation
2299# Test cases may or may not use Automake "Support for test suites"
2300#
2301# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2302# usually requires less dependencies and may be built and run under less
2303# stringent environments than integration tests.
2304#
2305# Interface to module:
2306# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2307# enable_integration_tests:   used in configure.ac for additional configuration
2308# --enable-integration-tests: 'yes' user instructs the module to build tests
2309#                             'no' user instructs the module not to build tests
2310# parm1:                      specify the default value, yes or no.
2311#
2312AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2313AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2314m4_define([_defopt], m4_default([$1], [auto]))
2315AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2316	[Enable building integration test cases (default: ]_defopt[)]),
2317	[enable_integration_tests=$enableval],
2318	[enable_integration_tests=]_defopt)
2319m4_undefine([_defopt])
2320AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2321	[test "x$enable_integration_tests" != xno])
2322AC_MSG_CHECKING([whether to build unit test cases])
2323AC_MSG_RESULT([$enable_integration_tests])
2324]) # XORG_ENABLE_INTEGRATION_TESTS
2325
2326# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2327# ----------------------------------------
2328# Minimum version: 1.13.0
2329#
2330# GLib is a library which provides advanced data structures and functions.
2331# This macro enables a module to test for the presence of Glib.
2332#
2333# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2334# Otherwise the value of $enable_unit_tests is blank.
2335#
2336# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2337# test support usually requires less dependencies and may be built and run under
2338# less stringent environments than integration tests.
2339#
2340# Interface to module:
2341# HAVE_GLIB: used in makefiles to conditionally build targets
2342# with_glib: used in configure.ac to know if GLib has been found
2343# --with-glib:	'yes' user instructs the module to use glib
2344#		'no' user instructs the module not to use glib
2345#
2346AC_DEFUN([XORG_WITH_GLIB],[
2347AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2348m4_define([_defopt], m4_default([$2], [auto]))
2349AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2350	[Use GLib library for unit testing (default: ]_defopt[)]),
2351	[with_glib=$withval], [with_glib=]_defopt)
2352m4_undefine([_defopt])
2353
2354have_glib=no
2355# Do not probe GLib if user explicitly disabled unit testing
2356if test "x$enable_unit_tests" != x"no"; then
2357  # Do not probe GLib if user explicitly disabled it
2358  if test "x$with_glib" != x"no"; then
2359    m4_ifval(
2360      [$1],
2361      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2362      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2363    )
2364  fi
2365fi
2366
2367# Not having GLib when unit testing has been explicitly requested is an error
2368if test "x$enable_unit_tests" = x"yes"; then
2369  if test "x$have_glib" = x"no"; then
2370    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2371  fi
2372fi
2373
2374# Having unit testing disabled when GLib has been explicitly requested is an error
2375if test "x$enable_unit_tests" = x"no"; then
2376  if test "x$with_glib" = x"yes"; then
2377    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2378  fi
2379fi
2380
2381# Not having GLib when it has been explicitly requested is an error
2382if test "x$with_glib" = x"yes"; then
2383  if test "x$have_glib" = x"no"; then
2384    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2385  fi
2386fi
2387
2388AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2389]) # XORG_WITH_GLIB
2390
2391# XORG_LD_WRAP([required|optional])
2392# ---------------------------------
2393# Minimum version: 1.13.0
2394#
2395# Check if linker supports -wrap, passed via compiler flags
2396#
2397# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2398# Otherwise the value of $enable_unit_tests is blank.
2399#
2400# Argument added in 1.16.0 - default is "required", to match existing behavior
2401# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2402# available, an argument of "optional" allows use when some unit tests require
2403# ld -wrap and others do not.
2404#
2405AC_DEFUN([XORG_LD_WRAP],[
2406XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2407    [AC_LANG_PROGRAM([#include <stdlib.h>
2408                      void __wrap_exit(int status) { return; }],
2409                     [exit(0);])])
2410# Not having ld wrap when unit testing has been explicitly requested is an error
2411if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2412  if test "x$have_ld_wrap" = x"no"; then
2413    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2414  fi
2415fi
2416AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2417#
2418]) # XORG_LD_WRAP
2419
2420# XORG_CHECK_LINKER_FLAGS
2421# -----------------------
2422# SYNOPSIS
2423#
2424#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2425#
2426# DESCRIPTION
2427#
2428#   Check whether the given linker FLAGS work with the current language's
2429#   linker, or whether they give an error.
2430#
2431#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2432#   success/failure.
2433#
2434#   PROGRAM-SOURCE is the program source to link with, if needed
2435#
2436#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2437#
2438# LICENSE
2439#
2440#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2441#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2442#   Copyright (c) 2009 Matteo Frigo
2443#
2444#   This program is free software: you can redistribute it and/or modify it
2445#   under the terms of the GNU General Public License as published by the
2446#   Free Software Foundation, either version 3 of the License, or (at your
2447#   option) any later version.
2448#
2449#   This program is distributed in the hope that it will be useful, but
2450#   WITHOUT ANY WARRANTY; without even the implied warranty of
2451#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2452#   Public License for more details.
2453#
2454#   You should have received a copy of the GNU General Public License along
2455#   with this program. If not, see <http://www.gnu.org/licenses/>.
2456#
2457#   As a special exception, the respective Autoconf Macro's copyright owner
2458#   gives unlimited permission to copy, distribute and modify the configure
2459#   scripts that are the output of Autoconf when processing the Macro. You
2460#   need not follow the terms of the GNU General Public License when using
2461#   or distributing such scripts, even though portions of the text of the
2462#   Macro appear in them. The GNU General Public License (GPL) does govern
2463#   all other use of the material that constitutes the Autoconf Macro.
2464#
2465#   This special exception to the GPL applies to versions of the Autoconf
2466#   Macro released by the Autoconf Archive. When you make and distribute a
2467#   modified version of the Autoconf Macro, you may extend this special
2468#   exception to the GPL to apply to your modified version as well.#
2469AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2470[AC_MSG_CHECKING([whether the linker accepts $1])
2471dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2472AS_LITERAL_IF([$1],
2473  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2474      ax_save_FLAGS=$LDFLAGS
2475      LDFLAGS="$1"
2476      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2477        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2478        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2479      LDFLAGS=$ax_save_FLAGS])],
2480  [ax_save_FLAGS=$LDFLAGS
2481   LDFLAGS="$1"
2482   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2483     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2484     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2485   LDFLAGS=$ax_save_FLAGS])
2486eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2487AC_MSG_RESULT($xorg_check_linker_flags)
2488if test "x$xorg_check_linker_flags" = xyes; then
2489	m4_default([$2], :)
2490else
2491	m4_default([$3], :)
2492fi
2493]) # XORG_CHECK_LINKER_FLAGS
2494
2495# XORG_MEMORY_CHECK_FLAGS
2496# -----------------------
2497# Minimum version: 1.16.0
2498#
2499# This macro attempts to find appropriate memory checking functionality
2500# for various platforms which unit testing code may use to catch various
2501# forms of memory allocation and access errors in testing.
2502#
2503# Interface to module:
2504# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2505#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2506#
2507# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2508#
2509AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2510
2511AC_REQUIRE([AC_CANONICAL_HOST])
2512AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2513           [Environment variables to enable memory checking in tests])
2514
2515# Check for different types of support on different platforms
2516case $host_os in
2517    solaris*)
2518        AC_CHECK_LIB([umem], [umem_alloc],
2519            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2520        ;;
2521    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2522        # both directly and inverted, so should not be 0 or 255.
2523        malloc_debug_env='MALLOC_PERTURB_=15'
2524        ;;
2525    darwin*)
2526        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2527        ;;
2528    *bsd*)
2529        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2530        ;;
2531esac
2532
2533# User supplied flags override default flags
2534if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2535    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2536fi
2537
2538AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2539]) # XORG_WITH_LINT
2540
2541# XORG_CHECK_MALLOC_ZERO
2542# ----------------------
2543# Minimum version: 1.0.0
2544#
2545# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2546# malloc(0) returns NULL.  Packages should add one of these cflags to
2547# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2548AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2549AC_ARG_ENABLE(malloc0returnsnull,
2550	AS_HELP_STRING([--enable-malloc0returnsnull],
2551		       [malloc(0) returns NULL (default: auto)]),
2552	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2553	[MALLOC_ZERO_RETURNS_NULL=auto])
2554
2555AC_MSG_CHECKING([whether malloc(0) returns NULL])
2556if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2557	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2558#include <stdlib.h>
2559],[
2560    char *m0, *r0, *c0, *p;
2561    m0 = malloc(0);
2562    p = malloc(10);
2563    r0 = realloc(p,0);
2564    c0 = calloc(0,10);
2565    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2566])],
2567		[MALLOC_ZERO_RETURNS_NULL=yes],
2568		[MALLOC_ZERO_RETURNS_NULL=no],
2569		[MALLOC_ZERO_RETURNS_NULL=yes])
2570fi
2571AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2572
2573if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2574	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2575	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2576	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2577else
2578	MALLOC_ZERO_CFLAGS=""
2579	XMALLOC_ZERO_CFLAGS=""
2580	XTMALLOC_ZERO_CFLAGS=""
2581fi
2582
2583AC_SUBST([MALLOC_ZERO_CFLAGS])
2584AC_SUBST([XMALLOC_ZERO_CFLAGS])
2585AC_SUBST([XTMALLOC_ZERO_CFLAGS])
2586]) # XORG_CHECK_MALLOC_ZERO
2587
2588# XORG_WITH_LINT()
2589# ----------------
2590# Minimum version: 1.1.0
2591#
2592# This macro enables the use of a tool that flags some suspicious and
2593# non-portable constructs (likely to be bugs) in C language source code.
2594# It will attempt to locate the tool and use appropriate options.
2595# There are various lint type tools on different platforms.
2596#
2597# Interface to module:
2598# LINT:		returns the path to the tool found on the platform
2599#		or the value set to LINT on the configure cmd line
2600#		also an Automake conditional
2601# LINT_FLAGS:	an Automake variable with appropriate flags
2602#
2603# --with-lint:	'yes' user instructs the module to use lint
2604#		'no' user instructs the module not to use lint (default)
2605#
2606# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2607# If the user sets the value of LINT_FLAGS, they are used verbatim.
2608#
2609AC_DEFUN([XORG_WITH_LINT],[
2610
2611AC_ARG_VAR([LINT], [Path to a lint-style command])
2612AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2613AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2614		[Use a lint-style source code checker (default: disabled)])],
2615		[use_lint=$withval], [use_lint=no])
2616
2617# Obtain platform specific info like program name and options
2618# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2619case $host_os in
2620  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2621	lint_name=splint
2622	lint_options="-badflag"
2623	;;
2624  *freebsd* | *netbsd*)
2625	lint_name=lint
2626	lint_options="-u -b"
2627	;;
2628  *solaris*)
2629	lint_name=lint
2630	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2631	;;
2632esac
2633
2634# Test for the presence of the program (either guessed by the code or spelled out by the user)
2635if test "x$use_lint" = x"yes" ; then
2636   AC_PATH_PROG([LINT], [$lint_name])
2637   if test "x$LINT" = "x"; then
2638        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2639   fi
2640elif test "x$use_lint" = x"no" ; then
2641   if test "x$LINT" != "x"; then
2642      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2643   fi
2644else
2645   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2646fi
2647
2648# User supplied flags override default flags
2649if test "x$LINT_FLAGS" != "x"; then
2650   lint_options=$LINT_FLAGS
2651fi
2652
2653AC_SUBST([LINT_FLAGS],[$lint_options])
2654AM_CONDITIONAL(LINT, [test "x$LINT" != x])
2655
2656]) # XORG_WITH_LINT
2657
2658# XORG_LINT_LIBRARY(LIBNAME)
2659# --------------------------
2660# Minimum version: 1.1.0
2661#
2662# Sets up flags for building lint libraries for checking programs that call
2663# functions in the library.
2664#
2665# Interface to module:
2666# LINTLIB		- Automake variable with the name of lint library file to make
2667# MAKE_LINT_LIB		- Automake conditional
2668#
2669# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2670#			  - 'no' user instructs the module not to create a lint library (default)
2671
2672AC_DEFUN([XORG_LINT_LIBRARY],[
2673AC_REQUIRE([XORG_WITH_LINT])
2674AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2675	[Create lint library (default: disabled)])],
2676	[make_lint_lib=$enableval], [make_lint_lib=no])
2677
2678if test "x$make_lint_lib" = x"yes" ; then
2679   LINTLIB=llib-l$1.ln
2680   if test "x$LINT" = "x"; then
2681        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2682   fi
2683elif test "x$make_lint_lib" != x"no" ; then
2684   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2685fi
2686
2687AC_SUBST(LINTLIB)
2688AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2689
2690]) # XORG_LINT_LIBRARY
2691
2692# XORG_COMPILER_BRAND
2693# -------------------
2694# Minimum version: 1.14.0
2695#
2696# Checks for various brands of compilers and sets flags as appropriate:
2697#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2698#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2699#   clang compiler - sets CLANGCC to "yes"
2700#   Intel compiler - sets INTELCC to "yes"
2701#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2702#
2703AC_DEFUN([XORG_COMPILER_BRAND], [
2704AC_LANG_CASE(
2705	[C], [
2706		AC_REQUIRE([AC_PROG_CC_C99])
2707	],
2708	[C++], [
2709		AC_REQUIRE([AC_PROG_CXX])
2710	]
2711)
2712AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2713AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2714AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2715]) # XORG_COMPILER_BRAND
2716
2717# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2718# ---------------
2719# Minimum version: 1.16.0
2720#
2721# Test if the compiler works when passed the given flag as a command line argument.
2722# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2723# next flag in the list until there are no more options.
2724#
2725# Note that this does not guarantee that the compiler supports the flag as some
2726# compilers will simply ignore arguments that they do not understand, but we do
2727# attempt to weed out false positives by using -Werror=unknown-warning-option and
2728# -Werror=unused-command-line-argument
2729#
2730AC_DEFUN([XORG_TESTSET_CFLAG], [
2731m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2732m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2733
2734AC_LANG_COMPILER_REQUIRE
2735
2736AC_LANG_CASE(
2737	[C], [
2738		AC_REQUIRE([AC_PROG_CC_C99])
2739		define([PREFIX], [C])
2740		define([CACHE_PREFIX], [cc])
2741		define([COMPILER], [$CC])
2742	],
2743	[C++], [
2744		define([PREFIX], [CXX])
2745		define([CACHE_PREFIX], [cxx])
2746		define([COMPILER], [$CXX])
2747	]
2748)
2749
2750[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2751
2752if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2753	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2754	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2755			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2756			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2757					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2758					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2759	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2760	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2761fi
2762
2763if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2764	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2765		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2766	fi
2767	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2768	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2769			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2770			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2771					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2772					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2773	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2774	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2775fi
2776
2777found="no"
2778m4_foreach([flag], m4_cdr($@), [
2779	if test $found = "no" ; then
2780		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2781			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2782		fi
2783
2784		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2785			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2786		fi
2787
2788		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2789
2790dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2791		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2792		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2793		AC_CACHE_VAL($cacheid,
2794			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2795					     [eval $cacheid=yes],
2796					     [eval $cacheid=no])])
2797
2798		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2799
2800		eval supported=\$$cacheid
2801		AC_MSG_RESULT([$supported])
2802		if test "$supported" = "yes" ; then
2803			$1="$$1 ]flag["
2804			found="yes"
2805		fi
2806	fi
2807])
2808]) # XORG_TESTSET_CFLAG
2809
2810# XORG_COMPILER_FLAGS
2811# ---------------
2812# Minimum version: 1.16.0
2813#
2814# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2815# arguments supported by the selected compiler which do NOT alter the generated
2816# code.  These arguments will cause the compiler to print various warnings
2817# during compilation AND turn a conservative set of warnings into errors.
2818#
2819# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2820# future versions of util-macros as options are added to new compilers.
2821#
2822AC_DEFUN([XORG_COMPILER_FLAGS], [
2823AC_REQUIRE([XORG_COMPILER_BRAND])
2824
2825AC_ARG_ENABLE(selective-werror,
2826              AS_HELP_STRING([--disable-selective-werror],
2827                             [Turn off selective compiler errors. (default: enabled)]),
2828              [SELECTIVE_WERROR=$enableval],
2829              [SELECTIVE_WERROR=yes])
2830
2831AC_LANG_CASE(
2832        [C], [
2833                define([PREFIX], [C])
2834        ],
2835        [C++], [
2836                define([PREFIX], [CXX])
2837        ]
2838)
2839# -v is too short to test reliably with XORG_TESTSET_CFLAG
2840if test "x$SUNCC" = "xyes"; then
2841    [BASE_]PREFIX[FLAGS]="-v"
2842else
2843    [BASE_]PREFIX[FLAGS]=""
2844fi
2845
2846# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2847XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2848XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2849XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2850XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2851
2852AC_LANG_CASE(
2853	[C], [
2854		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2855		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2856		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2857		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2858		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2859		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2860	]
2861)
2862
2863# This chunk adds additional warnings that could catch undesired effects.
2864XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2865XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2866XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2867XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2868XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2869XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2870XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2871
2872# These are currently disabled because they are noisy.  They will be enabled
2873# in the future once the codebase is sufficiently modernized to silence
2874# them.  For now, I don't want them to drown out the other warnings.
2875# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2876# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2877# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2878
2879# Turn some warnings into errors, so we don't accidently get successful builds
2880# when there are problems that should be fixed.
2881
2882if test "x$SELECTIVE_WERROR" = "xyes" ; then
2883XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2884XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2885XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2886XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2887XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2888XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2889XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2890XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2891XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2892XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2893XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2894XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2895XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2896else
2897AC_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])
2898XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2899XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2900XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2901XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2902XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2903XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2904XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2905XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2906XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2907XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2908XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2909XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2910XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2911fi
2912
2913AC_SUBST([BASE_]PREFIX[FLAGS])
2914]) # XORG_COMPILER_FLAGS
2915
2916# XORG_CWARNFLAGS
2917# ---------------
2918# Minimum version: 1.2.0
2919# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2920#
2921# Defines CWARNFLAGS to enable C compiler warnings.
2922#
2923# This function is deprecated because it defines -fno-strict-aliasing
2924# which alters the code generated by the compiler.  If -fno-strict-aliasing
2925# is needed, then it should be added explicitly in the module when
2926# it is updated to use BASE_CFLAGS.
2927#
2928AC_DEFUN([XORG_CWARNFLAGS], [
2929AC_REQUIRE([XORG_COMPILER_FLAGS])
2930AC_REQUIRE([XORG_COMPILER_BRAND])
2931AC_LANG_CASE(
2932	[C], [
2933		CWARNFLAGS="$BASE_CFLAGS"
2934		if  test "x$GCC" = xyes ; then
2935		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2936		fi
2937		AC_SUBST(CWARNFLAGS)
2938	]
2939)
2940]) # XORG_CWARNFLAGS
2941
2942# XORG_STRICT_OPTION
2943# -----------------------
2944# Minimum version: 1.3.0
2945#
2946# Add configure option to enable strict compilation flags, such as treating
2947# warnings as fatal errors.
2948# If --enable-strict-compilation is passed to configure, adds strict flags to
2949# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2950#
2951# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2952# when strict compilation is unconditionally desired.
2953AC_DEFUN([XORG_STRICT_OPTION], [
2954AC_REQUIRE([XORG_CWARNFLAGS])
2955AC_REQUIRE([XORG_COMPILER_FLAGS])
2956
2957AC_ARG_ENABLE(strict-compilation,
2958			  AS_HELP_STRING([--enable-strict-compilation],
2959			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2960			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2961
2962AC_LANG_CASE(
2963        [C], [
2964                define([PREFIX], [C])
2965        ],
2966        [C++], [
2967                define([PREFIX], [CXX])
2968        ]
2969)
2970
2971[STRICT_]PREFIX[FLAGS]=""
2972XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2973XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2974
2975# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2976# activate it with -Werror, so we add it here explicitly.
2977XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2978
2979if test "x$STRICT_COMPILE" = "xyes"; then
2980    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2981    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2982fi
2983AC_SUBST([STRICT_]PREFIX[FLAGS])
2984AC_SUBST([BASE_]PREFIX[FLAGS])
2985AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2986]) # XORG_STRICT_OPTION
2987
2988# XORG_DEFAULT_OPTIONS
2989# --------------------
2990# Minimum version: 1.3.0
2991#
2992# Defines default options for X.Org modules.
2993#
2994AC_DEFUN([XORG_DEFAULT_OPTIONS], [
2995AC_REQUIRE([AC_PROG_INSTALL])
2996XORG_COMPILER_FLAGS
2997XORG_CWARNFLAGS
2998XORG_STRICT_OPTION
2999XORG_RELEASE_VERSION
3000XORG_CHANGELOG
3001XORG_INSTALL
3002XORG_MANPAGE_SECTIONS
3003m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3004    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3005]) # XORG_DEFAULT_OPTIONS
3006
3007# XORG_INSTALL()
3008# ----------------
3009# Minimum version: 1.4.0
3010#
3011# Defines the variable INSTALL_CMD as the command to copy
3012# INSTALL from $prefix/share/util-macros.
3013#
3014AC_DEFUN([XORG_INSTALL], [
3015AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3016macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3017INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3018mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3019|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3020echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3021AC_SUBST([INSTALL_CMD])
3022]) # XORG_INSTALL
3023dnl Copyright 2005 Red Hat, Inc
3024dnl
3025dnl Permission to use, copy, modify, distribute, and sell this software and its
3026dnl documentation for any purpose is hereby granted without fee, provided that
3027dnl the above copyright notice appear in all copies and that both that
3028dnl copyright notice and this permission notice appear in supporting
3029dnl documentation.
3030dnl
3031dnl The above copyright notice and this permission notice shall be included
3032dnl in all copies or substantial portions of the Software.
3033dnl
3034dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3035dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3036dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3037dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3038dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3039dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3040dnl OTHER DEALINGS IN THE SOFTWARE.
3041dnl
3042dnl Except as contained in this notice, the name of the copyright holders shall
3043dnl not be used in advertising or otherwise to promote the sale, use or
3044dnl other dealings in this Software without prior written authorization
3045dnl from the copyright holders.
3046dnl
3047
3048# XORG_RELEASE_VERSION
3049# --------------------
3050# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3051 
3052AC_DEFUN([XORG_RELEASE_VERSION],[
3053	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3054		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3055		[Major version of this package])
3056	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3057	if test "x$PVM" = "x"; then
3058		PVM="0"
3059	fi
3060	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3061		[$PVM],
3062		[Minor version of this package])
3063	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3064	if test "x$PVP" = "x"; then
3065		PVP="0"
3066	fi
3067	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3068		[$PVP],
3069		[Patch version of this package])
3070])
3071
3072# XORG_CHANGELOG()
3073# ----------------
3074# Minimum version: 1.2.0
3075#
3076# Defines the variable CHANGELOG_CMD as the command to generate
3077# ChangeLog from git.
3078#
3079#
3080AC_DEFUN([XORG_CHANGELOG], [
3081CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3082mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3083|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3084echo 'git directory not found: installing possibly empty changelog.' >&2)"
3085AC_SUBST([CHANGELOG_CMD])
3086]) # XORG_CHANGELOG
3087
3088