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