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