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