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