aclocal.m4 revision c3d5982a
1# generated automatically by aclocal 1.13.2 -*- 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.68],,
18[m4_warning([this file was generated for autoconf 2.68.
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.2], [],
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.2])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# 
1078# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1079#
1080# This program is free software; you can redistribute it and/or modify
1081# it under the terms of the GNU General Public License as published by
1082# the Free Software Foundation; either version 2 of the License, or
1083# (at your option) any later version.
1084#
1085# This program is distributed in the hope that it will be useful, but
1086# WITHOUT ANY WARRANTY; without even the implied warranty of
1087# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1088# General Public License for more details.
1089#
1090# You should have received a copy of the GNU General Public License
1091# along with this program; if not, write to the Free Software
1092# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1093#
1094# As a special exception to the GNU General Public License, if you
1095# distribute this file as part of a program that contains a
1096# configuration script generated by Autoconf, you may include it under
1097# the same distribution terms that you use for the rest of that program.
1098
1099# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1100# ----------------------------------
1101AC_DEFUN([PKG_PROG_PKG_CONFIG],
1102[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1103m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1104AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1105if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1106	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1107fi
1108if test -n "$PKG_CONFIG"; then
1109	_pkg_min_version=m4_default([$1], [0.9.0])
1110	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1111	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1112		AC_MSG_RESULT([yes])
1113	else
1114		AC_MSG_RESULT([no])
1115		PKG_CONFIG=""
1116	fi
1117		
1118fi[]dnl
1119])# PKG_PROG_PKG_CONFIG
1120
1121# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1122#
1123# Check to see whether a particular set of modules exists.  Similar
1124# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1125#
1126#
1127# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1128# this or PKG_CHECK_MODULES is called, or make sure to call
1129# PKG_CHECK_EXISTS manually
1130# --------------------------------------------------------------
1131AC_DEFUN([PKG_CHECK_EXISTS],
1132[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1133if test -n "$PKG_CONFIG" && \
1134    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1135  m4_ifval([$2], [$2], [:])
1136m4_ifvaln([$3], [else
1137  $3])dnl
1138fi])
1139
1140
1141# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1142# ---------------------------------------------
1143m4_define([_PKG_CONFIG],
1144[if test -n "$$1"; then
1145    pkg_cv_[]$1="$$1"
1146 elif test -n "$PKG_CONFIG"; then
1147    PKG_CHECK_EXISTS([$3],
1148                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1149		     [pkg_failed=yes])
1150 else
1151    pkg_failed=untried
1152fi[]dnl
1153])# _PKG_CONFIG
1154
1155# _PKG_SHORT_ERRORS_SUPPORTED
1156# -----------------------------
1157AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1158[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1159if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1160        _pkg_short_errors_supported=yes
1161else
1162        _pkg_short_errors_supported=no
1163fi[]dnl
1164])# _PKG_SHORT_ERRORS_SUPPORTED
1165
1166
1167# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1168# [ACTION-IF-NOT-FOUND])
1169#
1170#
1171# Note that if there is a possibility the first call to
1172# PKG_CHECK_MODULES might not happen, you should be sure to include an
1173# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1174#
1175#
1176# --------------------------------------------------------------
1177AC_DEFUN([PKG_CHECK_MODULES],
1178[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1179AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1180AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1181
1182pkg_failed=no
1183AC_MSG_CHECKING([for $1])
1184
1185_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1186_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1187
1188m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1189and $1[]_LIBS to avoid the need to call pkg-config.
1190See the pkg-config man page for more details.])
1191
1192if test $pkg_failed = yes; then
1193        _PKG_SHORT_ERRORS_SUPPORTED
1194        if test $_pkg_short_errors_supported = yes; then
1195	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1196        else 
1197	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1198        fi
1199	# Put the nasty error message in config.log where it belongs
1200	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1201
1202	ifelse([$4], , [AC_MSG_ERROR(dnl
1203[Package requirements ($2) were not met:
1204
1205$$1_PKG_ERRORS
1206
1207Consider adjusting the PKG_CONFIG_PATH environment variable if you
1208installed software in a non-standard prefix.
1209
1210_PKG_TEXT
1211])],
1212		[AC_MSG_RESULT([no])
1213                $4])
1214elif test $pkg_failed = untried; then
1215	ifelse([$4], , [AC_MSG_FAILURE(dnl
1216[The pkg-config script could not be found or is too old.  Make sure it
1217is in your PATH or set the PKG_CONFIG environment variable to the full
1218path to pkg-config.
1219
1220_PKG_TEXT
1221
1222To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1223		[$4])
1224else
1225	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1226	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1227        AC_MSG_RESULT([yes])
1228	ifelse([$3], , :, [$3])
1229fi[]dnl
1230])# PKG_CHECK_MODULES
1231
1232dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1233dnl
1234dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1235dnl 
1236dnl Permission is hereby granted, free of charge, to any person obtaining a
1237dnl copy of this software and associated documentation files (the "Software"),
1238dnl to deal in the Software without restriction, including without limitation
1239dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1240dnl and/or sell copies of the Software, and to permit persons to whom the
1241dnl Software is furnished to do so, subject to the following conditions:
1242dnl
1243dnl The above copyright notice and this permission notice (including the next
1244dnl paragraph) shall be included in all copies or substantial portions of the
1245dnl Software.
1246dnl
1247dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1248dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1249dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1250dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1251dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1252dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1253dnl DEALINGS IN THE SOFTWARE.
1254
1255# XORG_MACROS_VERSION(required-version)
1256# -------------------------------------
1257# Minimum version: 1.1.0
1258#
1259# If you're using a macro added in Version 1.1 or newer, include this in
1260# your configure.ac with the minimum required version, such as:
1261# XORG_MACROS_VERSION(1.1)
1262#
1263# To ensure that this macro is defined, also add:
1264# m4_ifndef([XORG_MACROS_VERSION],
1265#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1266#
1267#
1268# See the "minimum version" comment for each macro you use to see what 
1269# version you require.
1270m4_defun([XORG_MACROS_VERSION],[
1271m4_define([vers_have], [1.17])
1272m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1273m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1274m4_if(m4_cmp(maj_have, maj_needed), 0,,
1275    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1276m4_if(m4_version_compare(vers_have, [$1]), -1,
1277    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1278m4_undefine([vers_have])
1279m4_undefine([maj_have])
1280m4_undefine([maj_needed])
1281]) # XORG_MACROS_VERSION
1282
1283# XORG_PROG_RAWCPP()
1284# ------------------
1285# Minimum version: 1.0.0
1286#
1287# Find cpp program and necessary flags for use in pre-processing text files
1288# such as man pages and config files
1289AC_DEFUN([XORG_PROG_RAWCPP],[
1290AC_REQUIRE([AC_PROG_CPP])
1291AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1292   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1293
1294# Check for flag to avoid builtin definitions - assumes unix is predefined,
1295# which is not the best choice for supporting other OS'es, but covers most
1296# of the ones we need for now.
1297AC_MSG_CHECKING([if $RAWCPP requires -undef])
1298AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1299if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1300	AC_MSG_RESULT([no])
1301else
1302	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1303		RAWCPPFLAGS=-undef
1304		AC_MSG_RESULT([yes])
1305	# under Cygwin unix is still defined even with -undef
1306	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1307		RAWCPPFLAGS="-undef -ansi"
1308		AC_MSG_RESULT([yes, with -ansi])
1309	else
1310		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1311	fi
1312fi
1313rm -f conftest.$ac_ext
1314
1315AC_MSG_CHECKING([if $RAWCPP requires -traditional])
1316AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1317if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1318	AC_MSG_RESULT([no])
1319else
1320	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1321		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1322		AC_MSG_RESULT([yes])
1323	else
1324		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1325	fi
1326fi
1327rm -f conftest.$ac_ext
1328AC_SUBST(RAWCPPFLAGS)
1329]) # XORG_PROG_RAWCPP
1330
1331# XORG_MANPAGE_SECTIONS()
1332# -----------------------
1333# Minimum version: 1.0.0
1334#
1335# Determine which sections man pages go in for the different man page types
1336# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1337# Not sure if there's any better way than just hardcoding by OS name.
1338# Override default settings by setting environment variables
1339# Added MAN_SUBSTS in version 1.8
1340# Added AC_PROG_SED in version 1.8
1341
1342AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1343AC_REQUIRE([AC_CANONICAL_HOST])
1344AC_REQUIRE([AC_PROG_SED])
1345
1346if test x$APP_MAN_SUFFIX = x    ; then
1347    APP_MAN_SUFFIX=1
1348fi
1349if test x$APP_MAN_DIR = x    ; then
1350    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1351fi
1352
1353if test x$LIB_MAN_SUFFIX = x    ; then
1354    LIB_MAN_SUFFIX=3
1355fi
1356if test x$LIB_MAN_DIR = x    ; then
1357    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1358fi
1359
1360if test x$FILE_MAN_SUFFIX = x    ; then
1361    case $host_os in
1362	solaris*)	FILE_MAN_SUFFIX=4  ;;
1363	*)		FILE_MAN_SUFFIX=5  ;;
1364    esac
1365fi
1366if test x$FILE_MAN_DIR = x    ; then
1367    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1368fi
1369
1370if test x$MISC_MAN_SUFFIX = x    ; then
1371    case $host_os in
1372	solaris*)	MISC_MAN_SUFFIX=5  ;;
1373	*)		MISC_MAN_SUFFIX=7  ;;
1374    esac
1375fi
1376if test x$MISC_MAN_DIR = x    ; then
1377    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1378fi
1379
1380if test x$DRIVER_MAN_SUFFIX = x    ; then
1381    case $host_os in
1382	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1383	*)		DRIVER_MAN_SUFFIX=4  ;;
1384    esac
1385fi
1386if test x$DRIVER_MAN_DIR = x    ; then
1387    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1388fi
1389
1390if test x$ADMIN_MAN_SUFFIX = x    ; then
1391    case $host_os in
1392	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1393	*)		ADMIN_MAN_SUFFIX=8  ;;
1394    esac
1395fi
1396if test x$ADMIN_MAN_DIR = x    ; then
1397    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1398fi
1399
1400
1401AC_SUBST([APP_MAN_SUFFIX])
1402AC_SUBST([LIB_MAN_SUFFIX])
1403AC_SUBST([FILE_MAN_SUFFIX])
1404AC_SUBST([MISC_MAN_SUFFIX])
1405AC_SUBST([DRIVER_MAN_SUFFIX])
1406AC_SUBST([ADMIN_MAN_SUFFIX])
1407AC_SUBST([APP_MAN_DIR])
1408AC_SUBST([LIB_MAN_DIR])
1409AC_SUBST([FILE_MAN_DIR])
1410AC_SUBST([MISC_MAN_DIR])
1411AC_SUBST([DRIVER_MAN_DIR])
1412AC_SUBST([ADMIN_MAN_DIR])
1413
1414XORG_MAN_PAGE="X Version 11"
1415AC_SUBST([XORG_MAN_PAGE])
1416MAN_SUBSTS="\
1417	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1418	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1419	-e 's|__xservername__|Xorg|g' \
1420	-e 's|__xconfigfile__|xorg.conf|g' \
1421	-e 's|__projectroot__|\$(prefix)|g' \
1422	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1423	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1424	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1425	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1426	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1427	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1428	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1429AC_SUBST([MAN_SUBSTS])
1430
1431]) # XORG_MANPAGE_SECTIONS
1432
1433# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1434# ------------------------
1435# Minimum version: 1.7.0
1436#
1437# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1438# provided by xorg-sgml-doctools, if installed.
1439AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1440AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1441XORG_SGML_PATH=
1442PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1443    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1444    [m4_ifval([$1],[:],
1445        [if test x"$cross_compiling" != x"yes" ; then
1446            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1447                          [XORG_SGML_PATH=$prefix/share/sgml])
1448         fi])
1449    ])
1450
1451# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1452# the path and the name of the doc stylesheet
1453if test "x$XORG_SGML_PATH" != "x" ; then
1454   AC_MSG_RESULT([$XORG_SGML_PATH])
1455   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1456   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1457else
1458   AC_MSG_RESULT([no])
1459fi
1460
1461AC_SUBST(XORG_SGML_PATH)
1462AC_SUBST(STYLESHEET_SRCDIR)
1463AC_SUBST(XSL_STYLESHEET)
1464AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1465]) # XORG_CHECK_SGML_DOCTOOLS
1466
1467# XORG_CHECK_LINUXDOC
1468# -------------------
1469# Minimum version: 1.0.0
1470#
1471# Defines the variable MAKE_TEXT if the necessary tools and
1472# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1473# Whether or not the necessary tools and files are found can be checked
1474# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1475AC_DEFUN([XORG_CHECK_LINUXDOC],[
1476AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1477AC_REQUIRE([XORG_WITH_PS2PDF])
1478
1479AC_PATH_PROG(LINUXDOC, linuxdoc)
1480
1481AC_MSG_CHECKING([whether to build documentation])
1482
1483if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1484   BUILDDOC=yes
1485else
1486   BUILDDOC=no
1487fi
1488
1489AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1490
1491AC_MSG_RESULT([$BUILDDOC])
1492
1493AC_MSG_CHECKING([whether to build pdf documentation])
1494
1495if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1496   BUILDPDFDOC=yes
1497else
1498   BUILDPDFDOC=no
1499fi
1500
1501AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1502
1503AC_MSG_RESULT([$BUILDPDFDOC])
1504
1505MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1506MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1507MAKE_PDF="$PS2PDF"
1508MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1509
1510AC_SUBST(MAKE_TEXT)
1511AC_SUBST(MAKE_PS)
1512AC_SUBST(MAKE_PDF)
1513AC_SUBST(MAKE_HTML)
1514]) # XORG_CHECK_LINUXDOC
1515
1516# XORG_CHECK_DOCBOOK
1517# -------------------
1518# Minimum version: 1.0.0
1519#
1520# Checks for the ability to build output formats from SGML DocBook source.
1521# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1522# indicates whether the necessary tools and files are found and, if set,
1523# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1524AC_DEFUN([XORG_CHECK_DOCBOOK],[
1525AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1526
1527BUILDTXTDOC=no
1528BUILDPDFDOC=no
1529BUILDPSDOC=no
1530BUILDHTMLDOC=no
1531
1532AC_PATH_PROG(DOCBOOKPS, docbook2ps)
1533AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1534AC_PATH_PROG(DOCBOOKHTML, docbook2html)
1535AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1536
1537AC_MSG_CHECKING([whether to build text documentation])
1538if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1539   test x$BUILD_TXTDOC != xno; then
1540	BUILDTXTDOC=yes
1541fi
1542AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1543AC_MSG_RESULT([$BUILDTXTDOC])
1544
1545AC_MSG_CHECKING([whether to build PDF documentation])
1546if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1547   test x$BUILD_PDFDOC != xno; then
1548	BUILDPDFDOC=yes
1549fi
1550AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1551AC_MSG_RESULT([$BUILDPDFDOC])
1552
1553AC_MSG_CHECKING([whether to build PostScript documentation])
1554if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1555   test x$BUILD_PSDOC != xno; then
1556	BUILDPSDOC=yes
1557fi
1558AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1559AC_MSG_RESULT([$BUILDPSDOC])
1560
1561AC_MSG_CHECKING([whether to build HTML documentation])
1562if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1563   test x$BUILD_HTMLDOC != xno; then
1564	BUILDHTMLDOC=yes
1565fi
1566AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1567AC_MSG_RESULT([$BUILDHTMLDOC])
1568
1569MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1570MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1571MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1572MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1573
1574AC_SUBST(MAKE_TEXT)
1575AC_SUBST(MAKE_PS)
1576AC_SUBST(MAKE_PDF)
1577AC_SUBST(MAKE_HTML)
1578]) # XORG_CHECK_DOCBOOK
1579
1580# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1581# ----------------
1582# Minimum version: 1.5.0
1583# Minimum version for optional DEFAULT argument: 1.11.0
1584#
1585# Documentation tools are not always available on all platforms and sometimes
1586# not at the appropriate level. This macro enables a module to test for the
1587# presence of the tool and obtain it's path in separate variables. Coupled with
1588# the --with-xmlto option, it allows maximum flexibilty in making decisions
1589# as whether or not to use the xmlto package. When DEFAULT is not specified,
1590# --with-xmlto assumes 'auto'.
1591#
1592# Interface to module:
1593# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1594# XMLTO:	returns the path of the xmlto program found
1595#		returns the path set by the user in the environment
1596# --with-xmlto:	'yes' user instructs the module to use xmlto
1597#		'no' user instructs the module not to use xmlto
1598#
1599# Added in version 1.10.0
1600# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1601#                  xmlto for text output requires either lynx, links, or w3m browsers
1602#
1603# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1604#
1605AC_DEFUN([XORG_WITH_XMLTO],[
1606AC_ARG_VAR([XMLTO], [Path to xmlto command])
1607m4_define([_defopt], m4_default([$2], [auto]))
1608AC_ARG_WITH(xmlto,
1609	AS_HELP_STRING([--with-xmlto],
1610	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1611	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1612m4_undefine([_defopt])
1613
1614if test "x$use_xmlto" = x"auto"; then
1615   AC_PATH_PROG([XMLTO], [xmlto])
1616   if test "x$XMLTO" = "x"; then
1617        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1618	have_xmlto=no
1619   else
1620        have_xmlto=yes
1621   fi
1622elif test "x$use_xmlto" = x"yes" ; then
1623   AC_PATH_PROG([XMLTO], [xmlto])
1624   if test "x$XMLTO" = "x"; then
1625        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1626   fi
1627   have_xmlto=yes
1628elif test "x$use_xmlto" = x"no" ; then
1629   if test "x$XMLTO" != "x"; then
1630      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1631   fi
1632   have_xmlto=no
1633else
1634   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1635fi
1636
1637# Test for a minimum version of xmlto, if provided.
1638m4_ifval([$1],
1639[if test "$have_xmlto" = yes; then
1640    # scrape the xmlto version
1641    AC_MSG_CHECKING([the xmlto version])
1642    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1643    AC_MSG_RESULT([$xmlto_version])
1644    AS_VERSION_COMPARE([$xmlto_version], [$1],
1645        [if test "x$use_xmlto" = xauto; then
1646            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1647            have_xmlto=no
1648        else
1649            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1650        fi])
1651fi])
1652
1653# Test for the ability of xmlto to generate a text target
1654have_xmlto_text=no
1655cat > conftest.xml << "EOF"
1656EOF
1657AS_IF([test "$have_xmlto" = yes],
1658      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1659             [have_xmlto_text=yes],
1660             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1661rm -f conftest.xml
1662AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1663AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1664]) # XORG_WITH_XMLTO
1665
1666# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1667# --------------------------------------------
1668# Minimum version: 1.12.0
1669# Minimum version for optional DEFAULT argument: 1.12.0
1670#
1671# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1672# XML-based language used for the transformation of XML documents.
1673# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1674# It is used under the cover by xmlto to generate html files from DocBook/XML.
1675# The XSLT processor is often used as a standalone tool for transformations.
1676# It should not be assumed that this tool is used only to work with documnetation.
1677# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1678#
1679# Interface to module:
1680# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1681# XSLTPROC:	 returns the path of the xsltproc program found
1682#		 returns the path set by the user in the environment
1683# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1684#		  'no' user instructs the module not to use xsltproc
1685# have_xsltproc: returns yes if xsltproc found in PATH or no
1686#
1687# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1688#
1689AC_DEFUN([XORG_WITH_XSLTPROC],[
1690AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1691# Preserves the interface, should it be implemented later
1692m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1693m4_define([_defopt], m4_default([$2], [auto]))
1694AC_ARG_WITH(xsltproc,
1695	AS_HELP_STRING([--with-xsltproc],
1696	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1697	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1698m4_undefine([_defopt])
1699
1700if test "x$use_xsltproc" = x"auto"; then
1701   AC_PATH_PROG([XSLTPROC], [xsltproc])
1702   if test "x$XSLTPROC" = "x"; then
1703        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1704	have_xsltproc=no
1705   else
1706        have_xsltproc=yes
1707   fi
1708elif test "x$use_xsltproc" = x"yes" ; then
1709   AC_PATH_PROG([XSLTPROC], [xsltproc])
1710   if test "x$XSLTPROC" = "x"; then
1711        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1712   fi
1713   have_xsltproc=yes
1714elif test "x$use_xsltproc" = x"no" ; then
1715   if test "x$XSLTPROC" != "x"; then
1716      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1717   fi
1718   have_xsltproc=no
1719else
1720   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1721fi
1722
1723AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1724]) # XORG_WITH_XSLTPROC
1725
1726# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1727# ----------------------------------------
1728# Minimum version: 1.15.0
1729#
1730# PERL (Practical Extraction and Report Language) is a language optimized for
1731# scanning arbitrary text files, extracting information from those text files,
1732# and printing reports based on that information.
1733#
1734# When DEFAULT is not specified, --with-perl assumes 'auto'.
1735#
1736# Interface to module:
1737# HAVE_PERL: used in makefiles to conditionally scan text files
1738# PERL:	     returns the path of the perl program found
1739#	     returns the path set by the user in the environment
1740# --with-perl: 'yes' user instructs the module to use perl
1741#	       'no' user instructs the module not to use perl
1742# have_perl: returns yes if perl found in PATH or no
1743#
1744# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1745#
1746AC_DEFUN([XORG_WITH_PERL],[
1747AC_ARG_VAR([PERL], [Path to perl command])
1748# Preserves the interface, should it be implemented later
1749m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1750m4_define([_defopt], m4_default([$2], [auto]))
1751AC_ARG_WITH(perl,
1752	AS_HELP_STRING([--with-perl],
1753	   [Use perl for extracting information from files (default: ]_defopt[)]),
1754	   [use_perl=$withval], [use_perl=]_defopt)
1755m4_undefine([_defopt])
1756
1757if test "x$use_perl" = x"auto"; then
1758   AC_PATH_PROG([PERL], [perl])
1759   if test "x$PERL" = "x"; then
1760        AC_MSG_WARN([perl not found - cannot extract information and report])
1761	have_perl=no
1762   else
1763        have_perl=yes
1764   fi
1765elif test "x$use_perl" = x"yes" ; then
1766   AC_PATH_PROG([PERL], [perl])
1767   if test "x$PERL" = "x"; then
1768        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1769   fi
1770   have_perl=yes
1771elif test "x$use_perl" = x"no" ; then
1772   if test "x$PERL" != "x"; then
1773      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1774   fi
1775   have_perl=no
1776else
1777   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1778fi
1779
1780AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1781]) # XORG_WITH_PERL
1782
1783# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1784# ----------------
1785# Minimum version: 1.5.0
1786# Minimum version for optional DEFAULT argument: 1.11.0
1787#
1788# Documentation tools are not always available on all platforms and sometimes
1789# not at the appropriate level. This macro enables a module to test for the
1790# presence of the tool and obtain it's path in separate variables. Coupled with
1791# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1792# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1793# --with-asciidoc assumes 'auto'.
1794#
1795# Interface to module:
1796# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1797# ASCIIDOC:	 returns the path of the asciidoc program found
1798#		 returns the path set by the user in the environment
1799# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1800#		  'no' user instructs the module not to use asciidoc
1801#
1802# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1803#
1804AC_DEFUN([XORG_WITH_ASCIIDOC],[
1805AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1806m4_define([_defopt], m4_default([$2], [auto]))
1807AC_ARG_WITH(asciidoc,
1808	AS_HELP_STRING([--with-asciidoc],
1809	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1810	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1811m4_undefine([_defopt])
1812
1813if test "x$use_asciidoc" = x"auto"; then
1814   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1815   if test "x$ASCIIDOC" = "x"; then
1816        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1817	have_asciidoc=no
1818   else
1819        have_asciidoc=yes
1820   fi
1821elif test "x$use_asciidoc" = x"yes" ; then
1822   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1823   if test "x$ASCIIDOC" = "x"; then
1824        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1825   fi
1826   have_asciidoc=yes
1827elif test "x$use_asciidoc" = x"no" ; then
1828   if test "x$ASCIIDOC" != "x"; then
1829      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1830   fi
1831   have_asciidoc=no
1832else
1833   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1834fi
1835m4_ifval([$1],
1836[if test "$have_asciidoc" = yes; then
1837    # scrape the asciidoc version
1838    AC_MSG_CHECKING([the asciidoc version])
1839    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1840    AC_MSG_RESULT([$asciidoc_version])
1841    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1842        [if test "x$use_asciidoc" = xauto; then
1843            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1844            have_asciidoc=no
1845        else
1846            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1847        fi])
1848fi])
1849AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1850]) # XORG_WITH_ASCIIDOC
1851
1852# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1853# --------------------------------
1854# Minimum version: 1.5.0
1855# Minimum version for optional DEFAULT argument: 1.11.0
1856#
1857# Documentation tools are not always available on all platforms and sometimes
1858# not at the appropriate level. This macro enables a module to test for the
1859# presence of the tool and obtain it's path in separate variables. Coupled with
1860# the --with-doxygen option, it allows maximum flexibilty in making decisions
1861# as whether or not to use the doxygen package. When DEFAULT is not specified,
1862# --with-doxygen assumes 'auto'.
1863#
1864# Interface to module:
1865# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1866# DOXYGEN:	 returns the path of the doxygen program found
1867#		 returns the path set by the user in the environment
1868# --with-doxygen: 'yes' user instructs the module to use doxygen
1869#		  'no' user instructs the module not to use doxygen
1870#
1871# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1872#
1873AC_DEFUN([XORG_WITH_DOXYGEN],[
1874AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1875m4_define([_defopt], m4_default([$2], [auto]))
1876AC_ARG_WITH(doxygen,
1877	AS_HELP_STRING([--with-doxygen],
1878	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1879	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1880m4_undefine([_defopt])
1881
1882if test "x$use_doxygen" = x"auto"; then
1883   AC_PATH_PROG([DOXYGEN], [doxygen])
1884   if test "x$DOXYGEN" = "x"; then
1885        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1886	have_doxygen=no
1887   else
1888        have_doxygen=yes
1889   fi
1890elif test "x$use_doxygen" = x"yes" ; then
1891   AC_PATH_PROG([DOXYGEN], [doxygen])
1892   if test "x$DOXYGEN" = "x"; then
1893        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1894   fi
1895   have_doxygen=yes
1896elif test "x$use_doxygen" = x"no" ; then
1897   if test "x$DOXYGEN" != "x"; then
1898      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1899   fi
1900   have_doxygen=no
1901else
1902   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1903fi
1904m4_ifval([$1],
1905[if test "$have_doxygen" = yes; then
1906    # scrape the doxygen version
1907    AC_MSG_CHECKING([the doxygen version])
1908    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1909    AC_MSG_RESULT([$doxygen_version])
1910    AS_VERSION_COMPARE([$doxygen_version], [$1],
1911        [if test "x$use_doxygen" = xauto; then
1912            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1913            have_doxygen=no
1914        else
1915            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1916        fi])
1917fi])
1918AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1919]) # XORG_WITH_DOXYGEN
1920
1921# XORG_WITH_GROFF([DEFAULT])
1922# ----------------
1923# Minimum version: 1.6.0
1924# Minimum version for optional DEFAULT argument: 1.11.0
1925#
1926# Documentation tools are not always available on all platforms and sometimes
1927# not at the appropriate level. This macro enables a module to test for the
1928# presence of the tool and obtain it's path in separate variables. Coupled with
1929# the --with-groff option, it allows maximum flexibilty in making decisions
1930# as whether or not to use the groff package. When DEFAULT is not specified,
1931# --with-groff assumes 'auto'.
1932#
1933# Interface to module:
1934# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1935# HAVE_GROFF_MM: the memorandum macros (-mm) package
1936# HAVE_GROFF_MS: the -ms macros package
1937# GROFF:	 returns the path of the groff program found
1938#		 returns the path set by the user in the environment
1939# --with-groff:	 'yes' user instructs the module to use groff
1940#		 'no' user instructs the module not to use groff
1941#
1942# Added in version 1.9.0:
1943# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1944#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1945#		   psselect from the psutils package.
1946#		   the ghostcript package. Refer to the grohtml man pages
1947#
1948# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1949#
1950# OS and distros often splits groff in a basic and full package, the former
1951# having the groff program and the later having devices, fonts and macros
1952# Checking for the groff executable is not enough.
1953#
1954# If macros are missing, we cannot assume that groff is useless, so we don't
1955# unset HAVE_GROFF or GROFF env variables.
1956# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1957#
1958AC_DEFUN([XORG_WITH_GROFF],[
1959AC_ARG_VAR([GROFF], [Path to groff command])
1960m4_define([_defopt], m4_default([$1], [auto]))
1961AC_ARG_WITH(groff,
1962	AS_HELP_STRING([--with-groff],
1963	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1964	   [use_groff=$withval], [use_groff=]_defopt)
1965m4_undefine([_defopt])
1966
1967if test "x$use_groff" = x"auto"; then
1968   AC_PATH_PROG([GROFF], [groff])
1969   if test "x$GROFF" = "x"; then
1970        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1971	have_groff=no
1972   else
1973        have_groff=yes
1974   fi
1975elif test "x$use_groff" = x"yes" ; then
1976   AC_PATH_PROG([GROFF], [groff])
1977   if test "x$GROFF" = "x"; then
1978        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1979   fi
1980   have_groff=yes
1981elif test "x$use_groff" = x"no" ; then
1982   if test "x$GROFF" != "x"; then
1983      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1984   fi
1985   have_groff=no
1986else
1987   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1988fi
1989
1990# We have groff, test for the presence of the macro packages
1991if test "x$have_groff" = x"yes"; then
1992    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1993    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1994        groff_ms_works=yes
1995    else
1996        groff_ms_works=no
1997    fi
1998    AC_MSG_RESULT([$groff_ms_works])
1999    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2000    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2001        groff_mm_works=yes
2002    else
2003        groff_mm_works=no
2004    fi
2005    AC_MSG_RESULT([$groff_mm_works])
2006fi
2007
2008# We have groff, test for HTML dependencies, one command per package
2009if test "x$have_groff" = x"yes"; then
2010   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2011   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2012   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2013   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2014      have_groff_html=yes
2015   else
2016      have_groff_html=no
2017      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2018   fi
2019fi
2020
2021# Set Automake conditionals for Makefiles
2022AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2023AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2024AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2025AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2026]) # XORG_WITH_GROFF
2027
2028# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2029# ---------------------------------------
2030# Minimum version: 1.6.0
2031# Minimum version for optional DEFAULT argument: 1.11.0
2032# Minimum version for optional MIN-VERSION argument: 1.15.0
2033#
2034# Documentation tools are not always available on all platforms and sometimes
2035# not at the appropriate level. This macro enables a module to test for the
2036# presence of the tool and obtain it's path in separate variables. Coupled with
2037# the --with-fop option, it allows maximum flexibilty in making decisions
2038# as whether or not to use the fop package. When DEFAULT is not specified,
2039# --with-fop assumes 'auto'.
2040#
2041# Interface to module:
2042# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2043# FOP:	 	returns the path of the fop program found
2044#		returns the path set by the user in the environment
2045# --with-fop: 	'yes' user instructs the module to use fop
2046#		'no' user instructs the module not to use fop
2047#
2048# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2049#
2050AC_DEFUN([XORG_WITH_FOP],[
2051AC_ARG_VAR([FOP], [Path to fop command])
2052m4_define([_defopt], m4_default([$2], [auto]))
2053AC_ARG_WITH(fop,
2054	AS_HELP_STRING([--with-fop],
2055	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2056	   [use_fop=$withval], [use_fop=]_defopt)
2057m4_undefine([_defopt])
2058
2059if test "x$use_fop" = x"auto"; then
2060   AC_PATH_PROG([FOP], [fop])
2061   if test "x$FOP" = "x"; then
2062        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2063	have_fop=no
2064   else
2065        have_fop=yes
2066   fi
2067elif test "x$use_fop" = x"yes" ; then
2068   AC_PATH_PROG([FOP], [fop])
2069   if test "x$FOP" = "x"; then
2070        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2071   fi
2072   have_fop=yes
2073elif test "x$use_fop" = x"no" ; then
2074   if test "x$FOP" != "x"; then
2075      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2076   fi
2077   have_fop=no
2078else
2079   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2080fi
2081
2082# Test for a minimum version of fop, if provided.
2083m4_ifval([$1],
2084[if test "$have_fop" = yes; then
2085    # scrape the fop version
2086    AC_MSG_CHECKING([for fop minimum version])
2087    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2088    AC_MSG_RESULT([$fop_version])
2089    AS_VERSION_COMPARE([$fop_version], [$1],
2090        [if test "x$use_fop" = xauto; then
2091            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2092            have_fop=no
2093        else
2094            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2095        fi])
2096fi])
2097AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2098]) # XORG_WITH_FOP
2099
2100# XORG_WITH_PS2PDF([DEFAULT])
2101# ----------------
2102# Minimum version: 1.6.0
2103# Minimum version for optional DEFAULT argument: 1.11.0
2104#
2105# Documentation tools are not always available on all platforms and sometimes
2106# not at the appropriate level. This macro enables a module to test for the
2107# presence of the tool and obtain it's path in separate variables. Coupled with
2108# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2109# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2110# --with-ps2pdf assumes 'auto'.
2111#
2112# Interface to module:
2113# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2114# PS2PDF:	returns the path of the ps2pdf program found
2115#		returns the path set by the user in the environment
2116# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2117#		 'no' user instructs the module not to use ps2pdf
2118#
2119# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2120#
2121AC_DEFUN([XORG_WITH_PS2PDF],[
2122AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2123m4_define([_defopt], m4_default([$1], [auto]))
2124AC_ARG_WITH(ps2pdf,
2125	AS_HELP_STRING([--with-ps2pdf],
2126	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2127	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2128m4_undefine([_defopt])
2129
2130if test "x$use_ps2pdf" = x"auto"; then
2131   AC_PATH_PROG([PS2PDF], [ps2pdf])
2132   if test "x$PS2PDF" = "x"; then
2133        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2134	have_ps2pdf=no
2135   else
2136        have_ps2pdf=yes
2137   fi
2138elif test "x$use_ps2pdf" = x"yes" ; then
2139   AC_PATH_PROG([PS2PDF], [ps2pdf])
2140   if test "x$PS2PDF" = "x"; then
2141        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2142   fi
2143   have_ps2pdf=yes
2144elif test "x$use_ps2pdf" = x"no" ; then
2145   if test "x$PS2PDF" != "x"; then
2146      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2147   fi
2148   have_ps2pdf=no
2149else
2150   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2151fi
2152AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2153]) # XORG_WITH_PS2PDF
2154
2155# XORG_ENABLE_DOCS (enable_docs=yes)
2156# ----------------
2157# Minimum version: 1.6.0
2158#
2159# Documentation tools are not always available on all platforms and sometimes
2160# not at the appropriate level. This macro enables a builder to skip all
2161# documentation targets except traditional man pages.
2162# Combined with the specific tool checking macros XORG_WITH_*, it provides
2163# maximum flexibilty in controlling documentation building.
2164# Refer to:
2165# XORG_WITH_XMLTO         --with-xmlto
2166# XORG_WITH_ASCIIDOC      --with-asciidoc
2167# XORG_WITH_DOXYGEN       --with-doxygen
2168# XORG_WITH_FOP           --with-fop
2169# XORG_WITH_GROFF         --with-groff
2170# XORG_WITH_PS2PDF        --with-ps2pdf
2171#
2172# Interface to module:
2173# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2174# --enable-docs: 'yes' user instructs the module to generate docs
2175#		 'no' user instructs the module not to generate docs
2176# parm1:	specify the default value, yes or no.
2177#
2178AC_DEFUN([XORG_ENABLE_DOCS],[
2179m4_define([docs_default], m4_default([$1], [yes]))
2180AC_ARG_ENABLE(docs,
2181	AS_HELP_STRING([--enable-docs],
2182	   [Enable building the documentation (default: ]docs_default[)]),
2183	   [build_docs=$enableval], [build_docs=]docs_default)
2184m4_undefine([docs_default])
2185AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2186AC_MSG_CHECKING([whether to build documentation])
2187AC_MSG_RESULT([$build_docs])
2188]) # XORG_ENABLE_DOCS
2189
2190# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2191# ----------------
2192# Minimum version: 1.6.0
2193#
2194# This macro enables a builder to skip all developer documentation.
2195# Combined with the specific tool checking macros XORG_WITH_*, it provides
2196# maximum flexibilty in controlling documentation building.
2197# Refer to:
2198# XORG_WITH_XMLTO         --with-xmlto
2199# XORG_WITH_ASCIIDOC      --with-asciidoc
2200# XORG_WITH_DOXYGEN       --with-doxygen
2201# XORG_WITH_FOP           --with-fop
2202# XORG_WITH_GROFF         --with-groff
2203# XORG_WITH_PS2PDF        --with-ps2pdf
2204#
2205# Interface to module:
2206# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2207# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2208#			'no' user instructs the module not to generate developer docs
2209# parm1:		specify the default value, yes or no.
2210#
2211AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2212m4_define([devel_default], m4_default([$1], [yes]))
2213AC_ARG_ENABLE(devel-docs,
2214	AS_HELP_STRING([--enable-devel-docs],
2215	   [Enable building the developer documentation (default: ]devel_default[)]),
2216	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2217m4_undefine([devel_default])
2218AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2219AC_MSG_CHECKING([whether to build developer documentation])
2220AC_MSG_RESULT([$build_devel_docs])
2221]) # XORG_ENABLE_DEVEL_DOCS
2222
2223# XORG_ENABLE_SPECS (enable_specs=yes)
2224# ----------------
2225# Minimum version: 1.6.0
2226#
2227# This macro enables a builder to skip all functional specification targets.
2228# Combined with the specific tool checking macros XORG_WITH_*, it provides
2229# maximum flexibilty in controlling documentation building.
2230# Refer to:
2231# XORG_WITH_XMLTO         --with-xmlto
2232# XORG_WITH_ASCIIDOC      --with-asciidoc
2233# XORG_WITH_DOXYGEN       --with-doxygen
2234# XORG_WITH_FOP           --with-fop
2235# XORG_WITH_GROFF         --with-groff
2236# XORG_WITH_PS2PDF        --with-ps2pdf
2237#
2238# Interface to module:
2239# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2240# --enable-specs:	'yes' user instructs the module to generate specs
2241#			'no' user instructs the module not to generate specs
2242# parm1:		specify the default value, yes or no.
2243#
2244AC_DEFUN([XORG_ENABLE_SPECS],[
2245m4_define([spec_default], m4_default([$1], [yes]))
2246AC_ARG_ENABLE(specs,
2247	AS_HELP_STRING([--enable-specs],
2248	   [Enable building the specs (default: ]spec_default[)]),
2249	   [build_specs=$enableval], [build_specs=]spec_default)
2250m4_undefine([spec_default])
2251AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2252AC_MSG_CHECKING([whether to build functional specifications])
2253AC_MSG_RESULT([$build_specs])
2254]) # XORG_ENABLE_SPECS
2255
2256# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2257# ----------------------------------------------
2258# Minimum version: 1.13.0
2259#
2260# This macro enables a builder to enable/disable unit testing
2261# It makes no assumption about the test cases implementation
2262# Test cases may or may not use Automake "Support for test suites"
2263# They may or may not use the software utility library GLib
2264#
2265# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2266# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2267# The variable enable_unit_tests is used by other macros in this file.
2268#
2269# Interface to module:
2270# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2271# enable_unit_tests:    used in configure.ac for additional configuration
2272# --enable-unit-tests:	'yes' user instructs the module to build tests
2273#			'no' user instructs the module not to build tests
2274# parm1:		specify the default value, yes or no.
2275#
2276AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2277AC_BEFORE([$0], [XORG_WITH_GLIB])
2278AC_BEFORE([$0], [XORG_LD_WRAP])
2279AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2280m4_define([_defopt], m4_default([$1], [auto]))
2281AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2282	[Enable building unit test cases (default: ]_defopt[)]),
2283	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2284m4_undefine([_defopt])
2285AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2286AC_MSG_CHECKING([whether to build unit test cases])
2287AC_MSG_RESULT([$enable_unit_tests])
2288]) # XORG_ENABLE_UNIT_TESTS
2289
2290# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2291# ------------------------------------------------------
2292# Minimum version: 1.17.0
2293#
2294# This macro enables a builder to enable/disable integration testing
2295# It makes no assumption about the test cases' implementation
2296# Test cases may or may not use Automake "Support for test suites"
2297#
2298# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2299# usually requires less dependencies and may be built and run under less
2300# stringent environments than integration tests.
2301#
2302# Interface to module:
2303# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2304# enable_integration_tests:   used in configure.ac for additional configuration
2305# --enable-integration-tests: 'yes' user instructs the module to build tests
2306#                             'no' user instructs the module not to build tests
2307# parm1:                      specify the default value, yes or no.
2308#
2309AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2310AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2311m4_define([_defopt], m4_default([$1], [auto]))
2312AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2313	[Enable building integration test cases (default: ]_defopt[)]),
2314	[enable_integration_tests=$enableval],
2315	[enable_integration_tests=]_defopt)
2316m4_undefine([_defopt])
2317AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2318	[test "x$enable_integration_tests" != xno])
2319AC_MSG_CHECKING([whether to build unit test cases])
2320AC_MSG_RESULT([$enable_integration_tests])
2321]) # XORG_ENABLE_INTEGRATION_TESTS
2322
2323# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2324# ----------------------------------------
2325# Minimum version: 1.13.0
2326#
2327# GLib is a library which provides advanced data structures and functions.
2328# This macro enables a module to test for the presence of Glib.
2329#
2330# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2331# Otherwise the value of $enable_unit_tests is blank.
2332#
2333# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2334# test support usually requires less dependencies and may be built and run under
2335# less stringent environments than integration tests.
2336#
2337# Interface to module:
2338# HAVE_GLIB: used in makefiles to conditionally build targets
2339# with_glib: used in configure.ac to know if GLib has been found
2340# --with-glib:	'yes' user instructs the module to use glib
2341#		'no' user instructs the module not to use glib
2342#
2343AC_DEFUN([XORG_WITH_GLIB],[
2344AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2345m4_define([_defopt], m4_default([$2], [auto]))
2346AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2347	[Use GLib library for unit testing (default: ]_defopt[)]),
2348	[with_glib=$withval], [with_glib=]_defopt)
2349m4_undefine([_defopt])
2350
2351have_glib=no
2352# Do not probe GLib if user explicitly disabled unit testing
2353if test "x$enable_unit_tests" != x"no"; then
2354  # Do not probe GLib if user explicitly disabled it
2355  if test "x$with_glib" != x"no"; then
2356    m4_ifval(
2357      [$1],
2358      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2359      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2360    )
2361  fi
2362fi
2363
2364# Not having GLib when unit testing has been explicitly requested is an error
2365if test "x$enable_unit_tests" = x"yes"; then
2366  if test "x$have_glib" = x"no"; then
2367    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2368  fi
2369fi
2370
2371# Having unit testing disabled when GLib has been explicitly requested is an error
2372if test "x$enable_unit_tests" = x"no"; then
2373  if test "x$with_glib" = x"yes"; then
2374    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2375  fi
2376fi
2377
2378# Not having GLib when it has been explicitly requested is an error
2379if test "x$with_glib" = x"yes"; then
2380  if test "x$have_glib" = x"no"; then
2381    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2382  fi
2383fi
2384
2385AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2386]) # XORG_WITH_GLIB
2387
2388# XORG_LD_WRAP([required|optional])
2389# ---------------------------------
2390# Minimum version: 1.13.0
2391#
2392# Check if linker supports -wrap, passed via compiler flags
2393#
2394# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2395# Otherwise the value of $enable_unit_tests is blank.
2396#
2397# Argument added in 1.16.0 - default is "required", to match existing behavior
2398# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2399# available, an argument of "optional" allows use when some unit tests require
2400# ld -wrap and others do not.
2401#
2402AC_DEFUN([XORG_LD_WRAP],[
2403XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2404    [AC_LANG_PROGRAM([#include <stdlib.h>
2405                      void __wrap_exit(int status) { return; }],
2406                     [exit(0);])])
2407# Not having ld wrap when unit testing has been explicitly requested is an error
2408if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2409  if test "x$have_ld_wrap" = x"no"; then
2410    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2411  fi
2412fi
2413AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2414#
2415]) # XORG_LD_WRAP
2416
2417# XORG_CHECK_LINKER_FLAGS
2418# -----------------------
2419# SYNOPSIS
2420#
2421#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2422#
2423# DESCRIPTION
2424#
2425#   Check whether the given linker FLAGS work with the current language's
2426#   linker, or whether they give an error.
2427#
2428#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2429#   success/failure.
2430#
2431#   PROGRAM-SOURCE is the program source to link with, if needed
2432#
2433#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2434#
2435# LICENSE
2436#
2437#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2438#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2439#   Copyright (c) 2009 Matteo Frigo
2440#
2441#   This program is free software: you can redistribute it and/or modify it
2442#   under the terms of the GNU General Public License as published by the
2443#   Free Software Foundation, either version 3 of the License, or (at your
2444#   option) any later version.
2445#
2446#   This program is distributed in the hope that it will be useful, but
2447#   WITHOUT ANY WARRANTY; without even the implied warranty of
2448#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2449#   Public License for more details.
2450#
2451#   You should have received a copy of the GNU General Public License along
2452#   with this program. If not, see <http://www.gnu.org/licenses/>.
2453#
2454#   As a special exception, the respective Autoconf Macro's copyright owner
2455#   gives unlimited permission to copy, distribute and modify the configure
2456#   scripts that are the output of Autoconf when processing the Macro. You
2457#   need not follow the terms of the GNU General Public License when using
2458#   or distributing such scripts, even though portions of the text of the
2459#   Macro appear in them. The GNU General Public License (GPL) does govern
2460#   all other use of the material that constitutes the Autoconf Macro.
2461#
2462#   This special exception to the GPL applies to versions of the Autoconf
2463#   Macro released by the Autoconf Archive. When you make and distribute a
2464#   modified version of the Autoconf Macro, you may extend this special
2465#   exception to the GPL to apply to your modified version as well.#
2466AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2467[AC_MSG_CHECKING([whether the linker accepts $1])
2468dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2469AS_LITERAL_IF([$1],
2470  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2471      ax_save_FLAGS=$LDFLAGS
2472      LDFLAGS="$1"
2473      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2474        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2475        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2476      LDFLAGS=$ax_save_FLAGS])],
2477  [ax_save_FLAGS=$LDFLAGS
2478   LDFLAGS="$1"
2479   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2480     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2481     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2482   LDFLAGS=$ax_save_FLAGS])
2483eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2484AC_MSG_RESULT($xorg_check_linker_flags)
2485if test "x$xorg_check_linker_flags" = xyes; then
2486	m4_default([$2], :)
2487else
2488	m4_default([$3], :)
2489fi
2490]) # XORG_CHECK_LINKER_FLAGS
2491
2492# XORG_MEMORY_CHECK_FLAGS
2493# -----------------------
2494# Minimum version: 1.16.0
2495#
2496# This macro attempts to find appropriate memory checking functionality
2497# for various platforms which unit testing code may use to catch various
2498# forms of memory allocation and access errors in testing.
2499#
2500# Interface to module:
2501# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2502#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2503#
2504# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2505#
2506AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2507
2508AC_REQUIRE([AC_CANONICAL_HOST])
2509AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2510           [Environment variables to enable memory checking in tests])
2511
2512# Check for different types of support on different platforms
2513case $host_os in
2514    solaris*)
2515        AC_CHECK_LIB([umem], [umem_alloc],
2516            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2517        ;;
2518    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2519        # both directly and inverted, so should not be 0 or 255.
2520        malloc_debug_env='MALLOC_PERTURB_=15'
2521        ;;
2522    darwin*)
2523        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2524        ;;
2525    *bsd*)
2526        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2527        ;;
2528esac
2529
2530# User supplied flags override default flags
2531if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2532    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2533fi
2534
2535AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2536]) # XORG_WITH_LINT
2537
2538# XORG_CHECK_MALLOC_ZERO
2539# ----------------------
2540# Minimum version: 1.0.0
2541#
2542# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2543# malloc(0) returns NULL.  Packages should add one of these cflags to
2544# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2545AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2546AC_ARG_ENABLE(malloc0returnsnull,
2547	AS_HELP_STRING([--enable-malloc0returnsnull],
2548		       [malloc(0) returns NULL (default: auto)]),
2549	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2550	[MALLOC_ZERO_RETURNS_NULL=auto])
2551
2552AC_MSG_CHECKING([whether malloc(0) returns NULL])
2553if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2554	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2555#include <stdlib.h>
2556],[
2557    char *m0, *r0, *c0, *p;
2558    m0 = malloc(0);
2559    p = malloc(10);
2560    r0 = realloc(p,0);
2561    c0 = calloc(0,10);
2562    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2563])],
2564		[MALLOC_ZERO_RETURNS_NULL=yes],
2565		[MALLOC_ZERO_RETURNS_NULL=no],
2566		[MALLOC_ZERO_RETURNS_NULL=yes])
2567fi
2568AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2569
2570if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2571	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2572	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2573	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2574else
2575	MALLOC_ZERO_CFLAGS=""
2576	XMALLOC_ZERO_CFLAGS=""
2577	XTMALLOC_ZERO_CFLAGS=""
2578fi
2579
2580AC_SUBST([MALLOC_ZERO_CFLAGS])
2581AC_SUBST([XMALLOC_ZERO_CFLAGS])
2582AC_SUBST([XTMALLOC_ZERO_CFLAGS])
2583]) # XORG_CHECK_MALLOC_ZERO
2584
2585# XORG_WITH_LINT()
2586# ----------------
2587# Minimum version: 1.1.0
2588#
2589# This macro enables the use of a tool that flags some suspicious and
2590# non-portable constructs (likely to be bugs) in C language source code.
2591# It will attempt to locate the tool and use appropriate options.
2592# There are various lint type tools on different platforms.
2593#
2594# Interface to module:
2595# LINT:		returns the path to the tool found on the platform
2596#		or the value set to LINT on the configure cmd line
2597#		also an Automake conditional
2598# LINT_FLAGS:	an Automake variable with appropriate flags
2599#
2600# --with-lint:	'yes' user instructs the module to use lint
2601#		'no' user instructs the module not to use lint (default)
2602#
2603# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2604# If the user sets the value of LINT_FLAGS, they are used verbatim.
2605#
2606AC_DEFUN([XORG_WITH_LINT],[
2607
2608AC_ARG_VAR([LINT], [Path to a lint-style command])
2609AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2610AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2611		[Use a lint-style source code checker (default: disabled)])],
2612		[use_lint=$withval], [use_lint=no])
2613
2614# Obtain platform specific info like program name and options
2615# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2616case $host_os in
2617  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2618	lint_name=splint
2619	lint_options="-badflag"
2620	;;
2621  *freebsd* | *netbsd*)
2622	lint_name=lint
2623	lint_options="-u -b"
2624	;;
2625  *solaris*)
2626	lint_name=lint
2627	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2628	;;
2629esac
2630
2631# Test for the presence of the program (either guessed by the code or spelled out by the user)
2632if test "x$use_lint" = x"yes" ; then
2633   AC_PATH_PROG([LINT], [$lint_name])
2634   if test "x$LINT" = "x"; then
2635        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2636   fi
2637elif test "x$use_lint" = x"no" ; then
2638   if test "x$LINT" != "x"; then
2639      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2640   fi
2641else
2642   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2643fi
2644
2645# User supplied flags override default flags
2646if test "x$LINT_FLAGS" != "x"; then
2647   lint_options=$LINT_FLAGS
2648fi
2649
2650AC_SUBST([LINT_FLAGS],[$lint_options])
2651AM_CONDITIONAL(LINT, [test "x$LINT" != x])
2652
2653]) # XORG_WITH_LINT
2654
2655# XORG_LINT_LIBRARY(LIBNAME)
2656# --------------------------
2657# Minimum version: 1.1.0
2658#
2659# Sets up flags for building lint libraries for checking programs that call
2660# functions in the library.
2661#
2662# Interface to module:
2663# LINTLIB		- Automake variable with the name of lint library file to make
2664# MAKE_LINT_LIB		- Automake conditional
2665#
2666# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2667#			  - 'no' user instructs the module not to create a lint library (default)
2668
2669AC_DEFUN([XORG_LINT_LIBRARY],[
2670AC_REQUIRE([XORG_WITH_LINT])
2671AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2672	[Create lint library (default: disabled)])],
2673	[make_lint_lib=$enableval], [make_lint_lib=no])
2674
2675if test "x$make_lint_lib" = x"yes" ; then
2676   LINTLIB=llib-l$1.ln
2677   if test "x$LINT" = "x"; then
2678        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2679   fi
2680elif test "x$make_lint_lib" != x"no" ; then
2681   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2682fi
2683
2684AC_SUBST(LINTLIB)
2685AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2686
2687]) # XORG_LINT_LIBRARY
2688
2689# XORG_COMPILER_BRAND
2690# -------------------
2691# Minimum version: 1.14.0
2692#
2693# Checks for various brands of compilers and sets flags as appropriate:
2694#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2695#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2696#   clang compiler - sets CLANGCC to "yes"
2697#   Intel compiler - sets INTELCC to "yes"
2698#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2699#
2700AC_DEFUN([XORG_COMPILER_BRAND], [
2701AC_LANG_CASE(
2702	[C], [
2703		AC_REQUIRE([AC_PROG_CC_C99])
2704	],
2705	[C++], [
2706		AC_REQUIRE([AC_PROG_CXX])
2707	]
2708)
2709AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2710AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2711AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2712]) # XORG_COMPILER_BRAND
2713
2714# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2715# ---------------
2716# Minimum version: 1.16.0
2717#
2718# Test if the compiler works when passed the given flag as a command line argument.
2719# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2720# next flag in the list until there are no more options.
2721#
2722# Note that this does not guarantee that the compiler supports the flag as some
2723# compilers will simply ignore arguments that they do not understand, but we do
2724# attempt to weed out false positives by using -Werror=unknown-warning-option and
2725# -Werror=unused-command-line-argument
2726#
2727AC_DEFUN([XORG_TESTSET_CFLAG], [
2728m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2729m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2730
2731AC_LANG_COMPILER_REQUIRE
2732
2733AC_LANG_CASE(
2734	[C], [
2735		AC_REQUIRE([AC_PROG_CC_C99])
2736		define([PREFIX], [C])
2737		define([CACHE_PREFIX], [cc])
2738		define([COMPILER], [$CC])
2739	],
2740	[C++], [
2741		define([PREFIX], [CXX])
2742		define([CACHE_PREFIX], [cxx])
2743		define([COMPILER], [$CXX])
2744	]
2745)
2746
2747[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2748
2749if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2750	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2751	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2752			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2753			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2754					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2755					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2756	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2757	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2758fi
2759
2760if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2761	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2762		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2763	fi
2764	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2765	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2766			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2767			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2768					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2769					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2770	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2771	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2772fi
2773
2774found="no"
2775m4_foreach([flag], m4_cdr($@), [
2776	if test $found = "no" ; then
2777		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2778			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2779		fi
2780
2781		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2782			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2783		fi
2784
2785		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2786
2787dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2788		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2789		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2790		AC_CACHE_VAL($cacheid,
2791			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2792					     [eval $cacheid=yes],
2793					     [eval $cacheid=no])])
2794
2795		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2796
2797		eval supported=\$$cacheid
2798		AC_MSG_RESULT([$supported])
2799		if test "$supported" = "yes" ; then
2800			$1="$$1 ]flag["
2801			found="yes"
2802		fi
2803	fi
2804])
2805]) # XORG_TESTSET_CFLAG
2806
2807# XORG_COMPILER_FLAGS
2808# ---------------
2809# Minimum version: 1.16.0
2810#
2811# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2812# arguments supported by the selected compiler which do NOT alter the generated
2813# code.  These arguments will cause the compiler to print various warnings
2814# during compilation AND turn a conservative set of warnings into errors.
2815#
2816# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2817# future versions of util-macros as options are added to new compilers.
2818#
2819AC_DEFUN([XORG_COMPILER_FLAGS], [
2820AC_REQUIRE([XORG_COMPILER_BRAND])
2821
2822AC_ARG_ENABLE(selective-werror,
2823              AS_HELP_STRING([--disable-selective-werror],
2824                             [Turn off selective compiler errors. (default: enabled)]),
2825              [SELECTIVE_WERROR=$enableval],
2826              [SELECTIVE_WERROR=yes])
2827
2828AC_LANG_CASE(
2829        [C], [
2830                define([PREFIX], [C])
2831        ],
2832        [C++], [
2833                define([PREFIX], [CXX])
2834        ]
2835)
2836# -v is too short to test reliably with XORG_TESTSET_CFLAG
2837if test "x$SUNCC" = "xyes"; then
2838    [BASE_]PREFIX[FLAGS]="-v"
2839else
2840    [BASE_]PREFIX[FLAGS]=""
2841fi
2842
2843# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2844XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2845XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2846XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2847XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2848
2849AC_LANG_CASE(
2850	[C], [
2851		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2852		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2853		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2854		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2855		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2856		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2857	]
2858)
2859
2860# This chunk adds additional warnings that could catch undesired effects.
2861XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2862XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2863XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2864XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2865XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2866XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2867XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2868
2869# These are currently disabled because they are noisy.  They will be enabled
2870# in the future once the codebase is sufficiently modernized to silence
2871# them.  For now, I don't want them to drown out the other warnings.
2872# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2873# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2874# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2875
2876# Turn some warnings into errors, so we don't accidently get successful builds
2877# when there are problems that should be fixed.
2878
2879if test "x$SELECTIVE_WERROR" = "xyes" ; then
2880XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2881XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2882XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2883XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2884XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2885XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2886XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2887XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2888XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2889XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2890XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2891XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2892XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2893else
2894AC_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])
2895XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2896XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2897XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2898XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2899XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2900XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2901XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2902XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2903XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2904XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2905XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2906XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2907XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2908fi
2909
2910AC_SUBST([BASE_]PREFIX[FLAGS])
2911]) # XORG_COMPILER_FLAGS
2912
2913# XORG_CWARNFLAGS
2914# ---------------
2915# Minimum version: 1.2.0
2916# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2917#
2918# Defines CWARNFLAGS to enable C compiler warnings.
2919#
2920# This function is deprecated because it defines -fno-strict-aliasing
2921# which alters the code generated by the compiler.  If -fno-strict-aliasing
2922# is needed, then it should be added explicitly in the module when
2923# it is updated to use BASE_CFLAGS.
2924#
2925AC_DEFUN([XORG_CWARNFLAGS], [
2926AC_REQUIRE([XORG_COMPILER_FLAGS])
2927AC_REQUIRE([XORG_COMPILER_BRAND])
2928AC_LANG_CASE(
2929	[C], [
2930		CWARNFLAGS="$BASE_CFLAGS"
2931		if  test "x$GCC" = xyes ; then
2932		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2933		fi
2934		AC_SUBST(CWARNFLAGS)
2935	]
2936)
2937]) # XORG_CWARNFLAGS
2938
2939# XORG_STRICT_OPTION
2940# -----------------------
2941# Minimum version: 1.3.0
2942#
2943# Add configure option to enable strict compilation flags, such as treating
2944# warnings as fatal errors.
2945# If --enable-strict-compilation is passed to configure, adds strict flags to
2946# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2947#
2948# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2949# when strict compilation is unconditionally desired.
2950AC_DEFUN([XORG_STRICT_OPTION], [
2951AC_REQUIRE([XORG_CWARNFLAGS])
2952AC_REQUIRE([XORG_COMPILER_FLAGS])
2953
2954AC_ARG_ENABLE(strict-compilation,
2955			  AS_HELP_STRING([--enable-strict-compilation],
2956			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2957			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2958
2959AC_LANG_CASE(
2960        [C], [
2961                define([PREFIX], [C])
2962        ],
2963        [C++], [
2964                define([PREFIX], [CXX])
2965        ]
2966)
2967
2968[STRICT_]PREFIX[FLAGS]=""
2969XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2970XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2971
2972# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2973# activate it with -Werror, so we add it here explicitly.
2974XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2975
2976if test "x$STRICT_COMPILE" = "xyes"; then
2977    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2978    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2979fi
2980AC_SUBST([STRICT_]PREFIX[FLAGS])
2981AC_SUBST([BASE_]PREFIX[FLAGS])
2982AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2983]) # XORG_STRICT_OPTION
2984
2985# XORG_DEFAULT_OPTIONS
2986# --------------------
2987# Minimum version: 1.3.0
2988#
2989# Defines default options for X.Org modules.
2990#
2991AC_DEFUN([XORG_DEFAULT_OPTIONS], [
2992AC_REQUIRE([AC_PROG_INSTALL])
2993XORG_COMPILER_FLAGS
2994XORG_CWARNFLAGS
2995XORG_STRICT_OPTION
2996XORG_RELEASE_VERSION
2997XORG_CHANGELOG
2998XORG_INSTALL
2999XORG_MANPAGE_SECTIONS
3000m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3001    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3002]) # XORG_DEFAULT_OPTIONS
3003
3004# XORG_INSTALL()
3005# ----------------
3006# Minimum version: 1.4.0
3007#
3008# Defines the variable INSTALL_CMD as the command to copy
3009# INSTALL from $prefix/share/util-macros.
3010#
3011AC_DEFUN([XORG_INSTALL], [
3012AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3013macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3014INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3015mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3016|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3017echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3018AC_SUBST([INSTALL_CMD])
3019]) # XORG_INSTALL
3020dnl Copyright 2005 Red Hat, Inc
3021dnl
3022dnl Permission to use, copy, modify, distribute, and sell this software and its
3023dnl documentation for any purpose is hereby granted without fee, provided that
3024dnl the above copyright notice appear in all copies and that both that
3025dnl copyright notice and this permission notice appear in supporting
3026dnl documentation.
3027dnl
3028dnl The above copyright notice and this permission notice shall be included
3029dnl in all copies or substantial portions of the Software.
3030dnl
3031dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3032dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3033dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3034dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3035dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3036dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3037dnl OTHER DEALINGS IN THE SOFTWARE.
3038dnl
3039dnl Except as contained in this notice, the name of the copyright holders shall
3040dnl not be used in advertising or otherwise to promote the sale, use or
3041dnl other dealings in this Software without prior written authorization
3042dnl from the copyright holders.
3043dnl
3044
3045# XORG_RELEASE_VERSION
3046# --------------------
3047# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3048 
3049AC_DEFUN([XORG_RELEASE_VERSION],[
3050	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3051		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3052		[Major version of this package])
3053	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3054	if test "x$PVM" = "x"; then
3055		PVM="0"
3056	fi
3057	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3058		[$PVM],
3059		[Minor version of this package])
3060	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3061	if test "x$PVP" = "x"; then
3062		PVP="0"
3063	fi
3064	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3065		[$PVP],
3066		[Patch version of this package])
3067])
3068
3069# XORG_CHANGELOG()
3070# ----------------
3071# Minimum version: 1.2.0
3072#
3073# Defines the variable CHANGELOG_CMD as the command to generate
3074# ChangeLog from git.
3075#
3076#
3077AC_DEFUN([XORG_CHANGELOG], [
3078CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3079mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3080|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3081echo 'git directory not found: installing possibly empty changelog.' >&2)"
3082AC_SUBST([CHANGELOG_CMD])
3083]) # XORG_CHANGELOG
3084
3085