aclocal.m4 revision dd52494d
1# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
2
3# Copyright (C) 1996-2018 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
2218dnl Copyright 2005 Red Hat, Inc
2219dnl 
2220dnl Permission to use, copy, modify, distribute, and sell this software and its
2221dnl documentation for any purpose is hereby granted without fee, provided that
2222dnl the above copyright notice appear in all copies and that both that
2223dnl copyright notice and this permission notice appear in supporting
2224dnl documentation.
2225dnl 
2226dnl The above copyright notice and this permission notice shall be included
2227dnl in all copies or substantial portions of the Software.
2228dnl 
2229dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2230dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2231dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2232dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2233dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2234dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2235dnl OTHER DEALINGS IN THE SOFTWARE.
2236dnl 
2237dnl Except as contained in this notice, the name of the copyright holders shall
2238dnl not be used in advertising or otherwise to promote the sale, use or
2239dnl other dealings in this Software without prior written authorization
2240dnl from the copyright holders.
2241dnl 
2242
2243# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
2244# --------------------------
2245# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
2246# is defined, then add the given PROTO to $REQUIRED_MODULES.
2247
2248AC_DEFUN([XORG_DRIVER_CHECK_EXT],[
2249	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2250	SAVE_CFLAGS="$CFLAGS"
2251	CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`"
2252	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2253#include "xorg-server.h"
2254#if !defined $1
2255#error $1 not defined
2256#endif
2257		]])],
2258		[_EXT_CHECK=yes],
2259		[_EXT_CHECK=no])
2260	CFLAGS="$SAVE_CFLAGS"
2261	AC_MSG_CHECKING([if $1 is defined])
2262	AC_MSG_RESULT([$_EXT_CHECK])
2263	if test "$_EXT_CHECK" != no; then
2264		REQUIRED_MODULES="$REQUIRED_MODULES $2"
2265	fi
2266])
2267
2268# Copyright (C) 2002-2018 Free Software Foundation, Inc.
2269#
2270# This file is free software; the Free Software Foundation
2271# gives unlimited permission to copy and/or distribute it,
2272# with or without modifications, as long as this notice is preserved.
2273
2274# AM_AUTOMAKE_VERSION(VERSION)
2275# ----------------------------
2276# Automake X.Y traces this macro to ensure aclocal.m4 has been
2277# generated from the m4 files accompanying Automake X.Y.
2278# (This private macro should not be called outside this file.)
2279AC_DEFUN([AM_AUTOMAKE_VERSION],
2280[am__api_version='1.16'
2281dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2282dnl require some minimum version.  Point them to the right macro.
2283m4_if([$1], [1.16.1], [],
2284      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2285])
2286
2287# _AM_AUTOCONF_VERSION(VERSION)
2288# -----------------------------
2289# aclocal traces this macro to find the Autoconf version.
2290# This is a private macro too.  Using m4_define simplifies
2291# the logic in aclocal, which can simply ignore this definition.
2292m4_define([_AM_AUTOCONF_VERSION], [])
2293
2294# AM_SET_CURRENT_AUTOMAKE_VERSION
2295# -------------------------------
2296# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2297# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2298AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2299[AM_AUTOMAKE_VERSION([1.16.1])dnl
2300m4_ifndef([AC_AUTOCONF_VERSION],
2301  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2302_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2303
2304# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2305
2306# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2307#
2308# This file is free software; the Free Software Foundation
2309# gives unlimited permission to copy and/or distribute it,
2310# with or without modifications, as long as this notice is preserved.
2311
2312# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2313# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2314# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2315#
2316# Of course, Automake must honor this variable whenever it calls a
2317# tool from the auxiliary directory.  The problem is that $srcdir (and
2318# therefore $ac_aux_dir as well) can be either absolute or relative,
2319# depending on how configure is run.  This is pretty annoying, since
2320# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2321# source directory, any form will work fine, but in subdirectories a
2322# relative path needs to be adjusted first.
2323#
2324# $ac_aux_dir/missing
2325#    fails when called from a subdirectory if $ac_aux_dir is relative
2326# $top_srcdir/$ac_aux_dir/missing
2327#    fails if $ac_aux_dir is absolute,
2328#    fails when called from a subdirectory in a VPATH build with
2329#          a relative $ac_aux_dir
2330#
2331# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2332# are both prefixed by $srcdir.  In an in-source build this is usually
2333# harmless because $srcdir is '.', but things will broke when you
2334# start a VPATH build or use an absolute $srcdir.
2335#
2336# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2337# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2338#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2339# and then we would define $MISSING as
2340#   MISSING="\${SHELL} $am_aux_dir/missing"
2341# This will work as long as MISSING is not called from configure, because
2342# unfortunately $(top_srcdir) has no meaning in configure.
2343# However there are other variables, like CC, which are often used in
2344# configure, and could therefore not use this "fixed" $ac_aux_dir.
2345#
2346# Another solution, used here, is to always expand $ac_aux_dir to an
2347# absolute PATH.  The drawback is that using absolute paths prevent a
2348# configured tree to be moved without reconfiguration.
2349
2350AC_DEFUN([AM_AUX_DIR_EXPAND],
2351[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
2352# Expand $ac_aux_dir to an absolute path.
2353am_aux_dir=`cd "$ac_aux_dir" && pwd`
2354])
2355
2356# AM_CONDITIONAL                                            -*- Autoconf -*-
2357
2358# Copyright (C) 1997-2018 Free Software Foundation, Inc.
2359#
2360# This file is free software; the Free Software Foundation
2361# gives unlimited permission to copy and/or distribute it,
2362# with or without modifications, as long as this notice is preserved.
2363
2364# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2365# -------------------------------------
2366# Define a conditional.
2367AC_DEFUN([AM_CONDITIONAL],
2368[AC_PREREQ([2.52])dnl
2369 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2370       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2371AC_SUBST([$1_TRUE])dnl
2372AC_SUBST([$1_FALSE])dnl
2373_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2374_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2375m4_define([_AM_COND_VALUE_$1], [$2])dnl
2376if $2; then
2377  $1_TRUE=
2378  $1_FALSE='#'
2379else
2380  $1_TRUE='#'
2381  $1_FALSE=
2382fi
2383AC_CONFIG_COMMANDS_PRE(
2384[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2385  AC_MSG_ERROR([[conditional "$1" was never defined.
2386Usually this means the macro was only invoked conditionally.]])
2387fi])])
2388
2389# Copyright (C) 1999-2018 Free Software Foundation, Inc.
2390#
2391# This file is free software; the Free Software Foundation
2392# gives unlimited permission to copy and/or distribute it,
2393# with or without modifications, as long as this notice is preserved.
2394
2395
2396# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2397# written in clear, in which case automake, when reading aclocal.m4,
2398# will think it sees a *use*, and therefore will trigger all it's
2399# C support machinery.  Also note that it means that autoscan, seeing
2400# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2401
2402
2403# _AM_DEPENDENCIES(NAME)
2404# ----------------------
2405# See how the compiler implements dependency checking.
2406# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2407# We try a few techniques and use that to set a single cache variable.
2408#
2409# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2410# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2411# dependency, and given that the user is not expected to run this macro,
2412# just rely on AC_PROG_CC.
2413AC_DEFUN([_AM_DEPENDENCIES],
2414[AC_REQUIRE([AM_SET_DEPDIR])dnl
2415AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2416AC_REQUIRE([AM_MAKE_INCLUDE])dnl
2417AC_REQUIRE([AM_DEP_TRACK])dnl
2418
2419m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2420      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2421      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2422      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2423      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2424      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2425                    [depcc="$$1"   am_compiler_list=])
2426
2427AC_CACHE_CHECK([dependency style of $depcc],
2428               [am_cv_$1_dependencies_compiler_type],
2429[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2430  # We make a subdir and do the tests there.  Otherwise we can end up
2431  # making bogus files that we don't know about and never remove.  For
2432  # instance it was reported that on HP-UX the gcc test will end up
2433  # making a dummy file named 'D' -- because '-MD' means "put the output
2434  # in D".
2435  rm -rf conftest.dir
2436  mkdir conftest.dir
2437  # Copy depcomp to subdir because otherwise we won't find it if we're
2438  # using a relative directory.
2439  cp "$am_depcomp" conftest.dir
2440  cd conftest.dir
2441  # We will build objects and dependencies in a subdirectory because
2442  # it helps to detect inapplicable dependency modes.  For instance
2443  # both Tru64's cc and ICC support -MD to output dependencies as a
2444  # side effect of compilation, but ICC will put the dependencies in
2445  # the current directory while Tru64 will put them in the object
2446  # directory.
2447  mkdir sub
2448
2449  am_cv_$1_dependencies_compiler_type=none
2450  if test "$am_compiler_list" = ""; then
2451     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2452  fi
2453  am__universal=false
2454  m4_case([$1], [CC],
2455    [case " $depcc " in #(
2456     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2457     esac],
2458    [CXX],
2459    [case " $depcc " in #(
2460     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2461     esac])
2462
2463  for depmode in $am_compiler_list; do
2464    # Setup a source with many dependencies, because some compilers
2465    # like to wrap large dependency lists on column 80 (with \), and
2466    # we should not choose a depcomp mode which is confused by this.
2467    #
2468    # We need to recreate these files for each test, as the compiler may
2469    # overwrite some of them when testing with obscure command lines.
2470    # This happens at least with the AIX C compiler.
2471    : > sub/conftest.c
2472    for i in 1 2 3 4 5 6; do
2473      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2474      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2475      # Solaris 10 /bin/sh.
2476      echo '/* dummy */' > sub/conftst$i.h
2477    done
2478    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2479
2480    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2481    # mode.  It turns out that the SunPro C++ compiler does not properly
2482    # handle '-M -o', and we need to detect this.  Also, some Intel
2483    # versions had trouble with output in subdirs.
2484    am__obj=sub/conftest.${OBJEXT-o}
2485    am__minus_obj="-o $am__obj"
2486    case $depmode in
2487    gcc)
2488      # This depmode causes a compiler race in universal mode.
2489      test "$am__universal" = false || continue
2490      ;;
2491    nosideeffect)
2492      # After this tag, mechanisms are not by side-effect, so they'll
2493      # only be used when explicitly requested.
2494      if test "x$enable_dependency_tracking" = xyes; then
2495	continue
2496      else
2497	break
2498      fi
2499      ;;
2500    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2501      # This compiler won't grok '-c -o', but also, the minuso test has
2502      # not run yet.  These depmodes are late enough in the game, and
2503      # so weak that their functioning should not be impacted.
2504      am__obj=conftest.${OBJEXT-o}
2505      am__minus_obj=
2506      ;;
2507    none) break ;;
2508    esac
2509    if depmode=$depmode \
2510       source=sub/conftest.c object=$am__obj \
2511       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2512       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2513         >/dev/null 2>conftest.err &&
2514       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2515       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2516       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2517       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2518      # icc doesn't choke on unknown options, it will just issue warnings
2519      # or remarks (even with -Werror).  So we grep stderr for any message
2520      # that says an option was ignored or not supported.
2521      # When given -MP, icc 7.0 and 7.1 complain thusly:
2522      #   icc: Command line warning: ignoring option '-M'; no argument required
2523      # The diagnosis changed in icc 8.0:
2524      #   icc: Command line remark: option '-MP' not supported
2525      if (grep 'ignoring option' conftest.err ||
2526          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2527        am_cv_$1_dependencies_compiler_type=$depmode
2528        break
2529      fi
2530    fi
2531  done
2532
2533  cd ..
2534  rm -rf conftest.dir
2535else
2536  am_cv_$1_dependencies_compiler_type=none
2537fi
2538])
2539AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2540AM_CONDITIONAL([am__fastdep$1], [
2541  test "x$enable_dependency_tracking" != xno \
2542  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2543])
2544
2545
2546# AM_SET_DEPDIR
2547# -------------
2548# Choose a directory name for dependency files.
2549# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2550AC_DEFUN([AM_SET_DEPDIR],
2551[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2552AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2553])
2554
2555
2556# AM_DEP_TRACK
2557# ------------
2558AC_DEFUN([AM_DEP_TRACK],
2559[AC_ARG_ENABLE([dependency-tracking], [dnl
2560AS_HELP_STRING(
2561  [--enable-dependency-tracking],
2562  [do not reject slow dependency extractors])
2563AS_HELP_STRING(
2564  [--disable-dependency-tracking],
2565  [speeds up one-time build])])
2566if test "x$enable_dependency_tracking" != xno; then
2567  am_depcomp="$ac_aux_dir/depcomp"
2568  AMDEPBACKSLASH='\'
2569  am__nodep='_no'
2570fi
2571AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2572AC_SUBST([AMDEPBACKSLASH])dnl
2573_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2574AC_SUBST([am__nodep])dnl
2575_AM_SUBST_NOTMAKE([am__nodep])dnl
2576])
2577
2578# Generate code to set up dependency tracking.              -*- Autoconf -*-
2579
2580# Copyright (C) 1999-2018 Free Software Foundation, Inc.
2581#
2582# This file is free software; the Free Software Foundation
2583# gives unlimited permission to copy and/or distribute it,
2584# with or without modifications, as long as this notice is preserved.
2585
2586# _AM_OUTPUT_DEPENDENCY_COMMANDS
2587# ------------------------------
2588AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2589[{
2590  # Older Autoconf quotes --file arguments for eval, but not when files
2591  # are listed without --file.  Let's play safe and only enable the eval
2592  # if we detect the quoting.
2593  # TODO: see whether this extra hack can be removed once we start
2594  # requiring Autoconf 2.70 or later.
2595  AS_CASE([$CONFIG_FILES],
2596          [*\'*], [eval set x "$CONFIG_FILES"],
2597          [*], [set x $CONFIG_FILES])
2598  shift
2599  # Used to flag and report bootstrapping failures.
2600  am_rc=0
2601  for am_mf
2602  do
2603    # Strip MF so we end up with the name of the file.
2604    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
2605    # Check whether this is an Automake generated Makefile which includes
2606    # dependency-tracking related rules and includes.
2607    # Grep'ing the whole file directly is not great: AIX grep has a line
2608    # limit of 2048, but all sed's we know have understand at least 4000.
2609    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
2610      || continue
2611    am_dirpart=`AS_DIRNAME(["$am_mf"])`
2612    am_filepart=`AS_BASENAME(["$am_mf"])`
2613    AM_RUN_LOG([cd "$am_dirpart" \
2614      && sed -e '/# am--include-marker/d' "$am_filepart" \
2615        | $MAKE -f - am--depfiles]) || am_rc=$?
2616  done
2617  if test $am_rc -ne 0; then
2618    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
2619    for automatic dependency tracking.  Try re-running configure with the
2620    '--disable-dependency-tracking' option to at least be able to build
2621    the package (albeit without support for automatic dependency tracking).])
2622  fi
2623  AS_UNSET([am_dirpart])
2624  AS_UNSET([am_filepart])
2625  AS_UNSET([am_mf])
2626  AS_UNSET([am_rc])
2627  rm -f conftest-deps.mk
2628}
2629])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2630
2631
2632# AM_OUTPUT_DEPENDENCY_COMMANDS
2633# -----------------------------
2634# This macro should only be invoked once -- use via AC_REQUIRE.
2635#
2636# This code is only required when automatic dependency tracking is enabled.
2637# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
2638# order to bootstrap the dependency handling code.
2639AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2640[AC_CONFIG_COMMANDS([depfiles],
2641     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2642     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
2643
2644# Do all the work for Automake.                             -*- Autoconf -*-
2645
2646# Copyright (C) 1996-2018 Free Software Foundation, Inc.
2647#
2648# This file is free software; the Free Software Foundation
2649# gives unlimited permission to copy and/or distribute it,
2650# with or without modifications, as long as this notice is preserved.
2651
2652# This macro actually does too much.  Some checks are only needed if
2653# your package does certain things.  But this isn't really a big deal.
2654
2655dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2656m4_define([AC_PROG_CC],
2657m4_defn([AC_PROG_CC])
2658[_AM_PROG_CC_C_O
2659])
2660
2661# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2662# AM_INIT_AUTOMAKE([OPTIONS])
2663# -----------------------------------------------
2664# The call with PACKAGE and VERSION arguments is the old style
2665# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2666# and VERSION should now be passed to AC_INIT and removed from
2667# the call to AM_INIT_AUTOMAKE.
2668# We support both call styles for the transition.  After
2669# the next Automake release, Autoconf can make the AC_INIT
2670# arguments mandatory, and then we can depend on a new Autoconf
2671# release and drop the old call support.
2672AC_DEFUN([AM_INIT_AUTOMAKE],
2673[AC_PREREQ([2.65])dnl
2674dnl Autoconf wants to disallow AM_ names.  We explicitly allow
2675dnl the ones we care about.
2676m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2677AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2678AC_REQUIRE([AC_PROG_INSTALL])dnl
2679if test "`cd $srcdir && pwd`" != "`pwd`"; then
2680  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2681  # is not polluted with repeated "-I."
2682  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2683  # test to see if srcdir already configured
2684  if test -f $srcdir/config.status; then
2685    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2686  fi
2687fi
2688
2689# test whether we have cygpath
2690if test -z "$CYGPATH_W"; then
2691  if (cygpath --version) >/dev/null 2>/dev/null; then
2692    CYGPATH_W='cygpath -w'
2693  else
2694    CYGPATH_W=echo
2695  fi
2696fi
2697AC_SUBST([CYGPATH_W])
2698
2699# Define the identity of the package.
2700dnl Distinguish between old-style and new-style calls.
2701m4_ifval([$2],
2702[AC_DIAGNOSE([obsolete],
2703             [$0: two- and three-arguments forms are deprecated.])
2704m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2705 AC_SUBST([PACKAGE], [$1])dnl
2706 AC_SUBST([VERSION], [$2])],
2707[_AM_SET_OPTIONS([$1])dnl
2708dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2709m4_if(
2710  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
2711  [ok:ok],,
2712  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2713 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2714 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2715
2716_AM_IF_OPTION([no-define],,
2717[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2718 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2719
2720# Some tools Automake needs.
2721AC_REQUIRE([AM_SANITY_CHECK])dnl
2722AC_REQUIRE([AC_ARG_PROGRAM])dnl
2723AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2724AM_MISSING_PROG([AUTOCONF], [autoconf])
2725AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2726AM_MISSING_PROG([AUTOHEADER], [autoheader])
2727AM_MISSING_PROG([MAKEINFO], [makeinfo])
2728AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2729AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2730AC_REQUIRE([AC_PROG_MKDIR_P])dnl
2731# For better backward compatibility.  To be removed once Automake 1.9.x
2732# dies out for good.  For more background, see:
2733# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2734# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2735AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2736# We need awk for the "check" target (and possibly the TAP driver).  The
2737# system "awk" is bad on some platforms.
2738AC_REQUIRE([AC_PROG_AWK])dnl
2739AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2740AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2741_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2742	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2743			     [_AM_PROG_TAR([v7])])])
2744_AM_IF_OPTION([no-dependencies],,
2745[AC_PROVIDE_IFELSE([AC_PROG_CC],
2746		  [_AM_DEPENDENCIES([CC])],
2747		  [m4_define([AC_PROG_CC],
2748			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2749AC_PROVIDE_IFELSE([AC_PROG_CXX],
2750		  [_AM_DEPENDENCIES([CXX])],
2751		  [m4_define([AC_PROG_CXX],
2752			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2753AC_PROVIDE_IFELSE([AC_PROG_OBJC],
2754		  [_AM_DEPENDENCIES([OBJC])],
2755		  [m4_define([AC_PROG_OBJC],
2756			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2757AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2758		  [_AM_DEPENDENCIES([OBJCXX])],
2759		  [m4_define([AC_PROG_OBJCXX],
2760			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2761])
2762AC_REQUIRE([AM_SILENT_RULES])dnl
2763dnl The testsuite driver may need to know about EXEEXT, so add the
2764dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2765dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2766AC_CONFIG_COMMANDS_PRE(dnl
2767[m4_provide_if([_AM_COMPILER_EXEEXT],
2768  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2769
2770# POSIX will say in a future version that running "rm -f" with no argument
2771# is OK; and we want to be able to make that assumption in our Makefile
2772# recipes.  So use an aggressive probe to check that the usage we want is
2773# actually supported "in the wild" to an acceptable degree.
2774# See automake bug#10828.
2775# To make any issue more visible, cause the running configure to be aborted
2776# by default if the 'rm' program in use doesn't match our expectations; the
2777# user can still override this though.
2778if rm -f && rm -fr && rm -rf; then : OK; else
2779  cat >&2 <<'END'
2780Oops!
2781
2782Your 'rm' program seems unable to run without file operands specified
2783on the command line, even when the '-f' option is present.  This is contrary
2784to the behaviour of most rm programs out there, and not conforming with
2785the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2786
2787Please tell bug-automake@gnu.org about your system, including the value
2788of your $PATH and any error possibly output before this message.  This
2789can help us improve future automake versions.
2790
2791END
2792  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2793    echo 'Configuration will proceed anyway, since you have set the' >&2
2794    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2795    echo >&2
2796  else
2797    cat >&2 <<'END'
2798Aborting the configuration process, to ensure you take notice of the issue.
2799
2800You can download and install GNU coreutils to get an 'rm' implementation
2801that behaves properly: <https://www.gnu.org/software/coreutils/>.
2802
2803If you want to complete the configuration process using your problematic
2804'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2805to "yes", and re-run configure.
2806
2807END
2808    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2809  fi
2810fi
2811dnl The trailing newline in this macro's definition is deliberate, for
2812dnl backward compatibility and to allow trailing 'dnl'-style comments
2813dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
2814])
2815
2816dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2817dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2818dnl mangled by Autoconf and run in a shell conditional statement.
2819m4_define([_AC_COMPILER_EXEEXT],
2820m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2821
2822# When config.status generates a header, we must update the stamp-h file.
2823# This file resides in the same directory as the config header
2824# that is generated.  The stamp files are numbered to have different names.
2825
2826# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2827# loop where config.status creates the headers, so we can generate
2828# our stamp files there.
2829AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2830[# Compute $1's index in $config_headers.
2831_am_arg=$1
2832_am_stamp_count=1
2833for _am_header in $config_headers :; do
2834  case $_am_header in
2835    $_am_arg | $_am_arg:* )
2836      break ;;
2837    * )
2838      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2839  esac
2840done
2841echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2842
2843# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2844#
2845# This file is free software; the Free Software Foundation
2846# gives unlimited permission to copy and/or distribute it,
2847# with or without modifications, as long as this notice is preserved.
2848
2849# AM_PROG_INSTALL_SH
2850# ------------------
2851# Define $install_sh.
2852AC_DEFUN([AM_PROG_INSTALL_SH],
2853[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2854if test x"${install_sh+set}" != xset; then
2855  case $am_aux_dir in
2856  *\ * | *\	*)
2857    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2858  *)
2859    install_sh="\${SHELL} $am_aux_dir/install-sh"
2860  esac
2861fi
2862AC_SUBST([install_sh])])
2863
2864# Copyright (C) 2003-2018 Free Software Foundation, Inc.
2865#
2866# This file is free software; the Free Software Foundation
2867# gives unlimited permission to copy and/or distribute it,
2868# with or without modifications, as long as this notice is preserved.
2869
2870# Check whether the underlying file-system supports filenames
2871# with a leading dot.  For instance MS-DOS doesn't.
2872AC_DEFUN([AM_SET_LEADING_DOT],
2873[rm -rf .tst 2>/dev/null
2874mkdir .tst 2>/dev/null
2875if test -d .tst; then
2876  am__leading_dot=.
2877else
2878  am__leading_dot=_
2879fi
2880rmdir .tst 2>/dev/null
2881AC_SUBST([am__leading_dot])])
2882
2883# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2884
2885# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2886#
2887# This file is free software; the Free Software Foundation
2888# gives unlimited permission to copy and/or distribute it,
2889# with or without modifications, as long as this notice is preserved.
2890
2891# AM_MAKE_INCLUDE()
2892# -----------------
2893# Check whether make has an 'include' directive that can support all
2894# the idioms we need for our automatic dependency tracking code.
2895AC_DEFUN([AM_MAKE_INCLUDE],
2896[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
2897cat > confinc.mk << 'END'
2898am__doit:
2899	@echo this is the am__doit target >confinc.out
2900.PHONY: am__doit
2901END
2902am__include="#"
2903am__quote=
2904# BSD make does it like this.
2905echo '.include "confinc.mk" # ignored' > confmf.BSD
2906# Other make implementations (GNU, Solaris 10, AIX) do it like this.
2907echo 'include confinc.mk # ignored' > confmf.GNU
2908_am_result=no
2909for s in GNU BSD; do
2910  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
2911  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
2912      ['0:this is the am__doit target'],
2913      [AS_CASE([$s],
2914          [BSD], [am__include='.include' am__quote='"'],
2915          [am__include='include' am__quote=''])])
2916  if test "$am__include" != "#"; then
2917    _am_result="yes ($s style)"
2918    break
2919  fi
2920done
2921rm -f confinc.* confmf.*
2922AC_MSG_RESULT([${_am_result}])
2923AC_SUBST([am__include])])
2924AC_SUBST([am__quote])])
2925
2926# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2927
2928# Copyright (C) 1997-2018 Free Software Foundation, Inc.
2929#
2930# This file is free software; the Free Software Foundation
2931# gives unlimited permission to copy and/or distribute it,
2932# with or without modifications, as long as this notice is preserved.
2933
2934# AM_MISSING_PROG(NAME, PROGRAM)
2935# ------------------------------
2936AC_DEFUN([AM_MISSING_PROG],
2937[AC_REQUIRE([AM_MISSING_HAS_RUN])
2938$1=${$1-"${am_missing_run}$2"}
2939AC_SUBST($1)])
2940
2941# AM_MISSING_HAS_RUN
2942# ------------------
2943# Define MISSING if not defined so far and test if it is modern enough.
2944# If it is, set am_missing_run to use it, otherwise, to nothing.
2945AC_DEFUN([AM_MISSING_HAS_RUN],
2946[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2947AC_REQUIRE_AUX_FILE([missing])dnl
2948if test x"${MISSING+set}" != xset; then
2949  case $am_aux_dir in
2950  *\ * | *\	*)
2951    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2952  *)
2953    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2954  esac
2955fi
2956# Use eval to expand $SHELL
2957if eval "$MISSING --is-lightweight"; then
2958  am_missing_run="$MISSING "
2959else
2960  am_missing_run=
2961  AC_MSG_WARN(['missing' script is too old or missing])
2962fi
2963])
2964
2965# Helper functions for option handling.                     -*- Autoconf -*-
2966
2967# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2968#
2969# This file is free software; the Free Software Foundation
2970# gives unlimited permission to copy and/or distribute it,
2971# with or without modifications, as long as this notice is preserved.
2972
2973# _AM_MANGLE_OPTION(NAME)
2974# -----------------------
2975AC_DEFUN([_AM_MANGLE_OPTION],
2976[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2977
2978# _AM_SET_OPTION(NAME)
2979# --------------------
2980# Set option NAME.  Presently that only means defining a flag for this option.
2981AC_DEFUN([_AM_SET_OPTION],
2982[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2983
2984# _AM_SET_OPTIONS(OPTIONS)
2985# ------------------------
2986# OPTIONS is a space-separated list of Automake options.
2987AC_DEFUN([_AM_SET_OPTIONS],
2988[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2989
2990# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2991# -------------------------------------------
2992# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2993AC_DEFUN([_AM_IF_OPTION],
2994[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2995
2996# Copyright (C) 1999-2018 Free Software Foundation, Inc.
2997#
2998# This file is free software; the Free Software Foundation
2999# gives unlimited permission to copy and/or distribute it,
3000# with or without modifications, as long as this notice is preserved.
3001
3002# _AM_PROG_CC_C_O
3003# ---------------
3004# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
3005# to automatically call this.
3006AC_DEFUN([_AM_PROG_CC_C_O],
3007[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3008AC_REQUIRE_AUX_FILE([compile])dnl
3009AC_LANG_PUSH([C])dnl
3010AC_CACHE_CHECK(
3011  [whether $CC understands -c and -o together],
3012  [am_cv_prog_cc_c_o],
3013  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
3014  # Make sure it works both with $CC and with simple cc.
3015  # Following AC_PROG_CC_C_O, we do the test twice because some
3016  # compilers refuse to overwrite an existing .o file with -o,
3017  # though they will create one.
3018  am_cv_prog_cc_c_o=yes
3019  for am_i in 1 2; do
3020    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
3021         && test -f conftest2.$ac_objext; then
3022      : OK
3023    else
3024      am_cv_prog_cc_c_o=no
3025      break
3026    fi
3027  done
3028  rm -f core conftest*
3029  unset am_i])
3030if test "$am_cv_prog_cc_c_o" != yes; then
3031   # Losing compiler, so override with the script.
3032   # FIXME: It is wrong to rewrite CC.
3033   # But if we don't then we get into trouble of one sort or another.
3034   # A longer-term fix would be to have automake use am__CC in this case,
3035   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
3036   CC="$am_aux_dir/compile $CC"
3037fi
3038AC_LANG_POP([C])])
3039
3040# For backward compatibility.
3041AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3042
3043# Copyright (C) 2001-2018 Free Software Foundation, Inc.
3044#
3045# This file is free software; the Free Software Foundation
3046# gives unlimited permission to copy and/or distribute it,
3047# with or without modifications, as long as this notice is preserved.
3048
3049# AM_RUN_LOG(COMMAND)
3050# -------------------
3051# Run COMMAND, save the exit status in ac_status, and log it.
3052# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
3053AC_DEFUN([AM_RUN_LOG],
3054[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
3055   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
3056   ac_status=$?
3057   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
3058   (exit $ac_status); }])
3059
3060# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3061
3062# Copyright (C) 1996-2018 Free Software Foundation, Inc.
3063#
3064# This file is free software; the Free Software Foundation
3065# gives unlimited permission to copy and/or distribute it,
3066# with or without modifications, as long as this notice is preserved.
3067
3068# AM_SANITY_CHECK
3069# ---------------
3070AC_DEFUN([AM_SANITY_CHECK],
3071[AC_MSG_CHECKING([whether build environment is sane])
3072# Reject unsafe characters in $srcdir or the absolute working directory
3073# name.  Accept space and tab only in the latter.
3074am_lf='
3075'
3076case `pwd` in
3077  *[[\\\"\#\$\&\'\`$am_lf]]*)
3078    AC_MSG_ERROR([unsafe absolute working directory name]);;
3079esac
3080case $srcdir in
3081  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
3082    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3083esac
3084
3085# Do 'set' in a subshell so we don't clobber the current shell's
3086# arguments.  Must try -L first in case configure is actually a
3087# symlink; some systems play weird games with the mod time of symlinks
3088# (eg FreeBSD returns the mod time of the symlink's containing
3089# directory).
3090if (
3091   am_has_slept=no
3092   for am_try in 1 2; do
3093     echo "timestamp, slept: $am_has_slept" > conftest.file
3094     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
3095     if test "$[*]" = "X"; then
3096	# -L didn't work.
3097	set X `ls -t "$srcdir/configure" conftest.file`
3098     fi
3099     if test "$[*]" != "X $srcdir/configure conftest.file" \
3100	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3101
3102	# If neither matched, then we have a broken ls.  This can happen
3103	# if, for instance, CONFIG_SHELL is bash and it inherits a
3104	# broken ls alias from the environment.  This has actually
3105	# happened.  Such a system could not be considered "sane".
3106	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
3107  alias in your environment])
3108     fi
3109     if test "$[2]" = conftest.file || test $am_try -eq 2; then
3110       break
3111     fi
3112     # Just in case.
3113     sleep 1
3114     am_has_slept=yes
3115   done
3116   test "$[2]" = conftest.file
3117   )
3118then
3119   # Ok.
3120   :
3121else
3122   AC_MSG_ERROR([newly created file is older than distributed files!
3123Check your system clock])
3124fi
3125AC_MSG_RESULT([yes])
3126# If we didn't sleep, we still need to ensure time stamps of config.status and
3127# generated files are strictly newer.
3128am_sleep_pid=
3129if grep 'slept: no' conftest.file >/dev/null 2>&1; then
3130  ( sleep 1 ) &
3131  am_sleep_pid=$!
3132fi
3133AC_CONFIG_COMMANDS_PRE(
3134  [AC_MSG_CHECKING([that generated files are newer than configure])
3135   if test -n "$am_sleep_pid"; then
3136     # Hide warnings about reused PIDs.
3137     wait $am_sleep_pid 2>/dev/null
3138   fi
3139   AC_MSG_RESULT([done])])
3140rm -f conftest.file
3141])
3142
3143# Copyright (C) 2009-2018 Free Software Foundation, Inc.
3144#
3145# This file is free software; the Free Software Foundation
3146# gives unlimited permission to copy and/or distribute it,
3147# with or without modifications, as long as this notice is preserved.
3148
3149# AM_SILENT_RULES([DEFAULT])
3150# --------------------------
3151# Enable less verbose build rules; with the default set to DEFAULT
3152# ("yes" being less verbose, "no" or empty being verbose).
3153AC_DEFUN([AM_SILENT_RULES],
3154[AC_ARG_ENABLE([silent-rules], [dnl
3155AS_HELP_STRING(
3156  [--enable-silent-rules],
3157  [less verbose build output (undo: "make V=1")])
3158AS_HELP_STRING(
3159  [--disable-silent-rules],
3160  [verbose build output (undo: "make V=0")])dnl
3161])
3162case $enable_silent_rules in @%:@ (((
3163  yes) AM_DEFAULT_VERBOSITY=0;;
3164   no) AM_DEFAULT_VERBOSITY=1;;
3165    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3166esac
3167dnl
3168dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
3169dnl do not support nested variable expansions.
3170dnl See automake bug#9928 and bug#10237.
3171am_make=${MAKE-make}
3172AC_CACHE_CHECK([whether $am_make supports nested variables],
3173   [am_cv_make_support_nested_variables],
3174   [if AS_ECHO([['TRUE=$(BAR$(V))
3175BAR0=false
3176BAR1=true
3177V=1
3178am__doit:
3179	@$(TRUE)
3180.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3181  am_cv_make_support_nested_variables=yes
3182else
3183  am_cv_make_support_nested_variables=no
3184fi])
3185if test $am_cv_make_support_nested_variables = yes; then
3186  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3187  AM_V='$(V)'
3188  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3189else
3190  AM_V=$AM_DEFAULT_VERBOSITY
3191  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3192fi
3193AC_SUBST([AM_V])dnl
3194AM_SUBST_NOTMAKE([AM_V])dnl
3195AC_SUBST([AM_DEFAULT_V])dnl
3196AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3197AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3198AM_BACKSLASH='\'
3199AC_SUBST([AM_BACKSLASH])dnl
3200_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3201])
3202
3203# Copyright (C) 2001-2018 Free Software Foundation, Inc.
3204#
3205# This file is free software; the Free Software Foundation
3206# gives unlimited permission to copy and/or distribute it,
3207# with or without modifications, as long as this notice is preserved.
3208
3209# AM_PROG_INSTALL_STRIP
3210# ---------------------
3211# One issue with vendor 'install' (even GNU) is that you can't
3212# specify the program used to strip binaries.  This is especially
3213# annoying in cross-compiling environments, where the build's strip
3214# is unlikely to handle the host's binaries.
3215# Fortunately install-sh will honor a STRIPPROG variable, so we
3216# always use install-sh in "make install-strip", and initialize
3217# STRIPPROG with the value of the STRIP variable (set by the user).
3218AC_DEFUN([AM_PROG_INSTALL_STRIP],
3219[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3220# Installed binaries are usually stripped using 'strip' when the user
3221# run "make install-strip".  However 'strip' might not be the right
3222# tool to use in cross-compilation environments, therefore Automake
3223# will honor the 'STRIP' environment variable to overrule this program.
3224dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3225if test "$cross_compiling" != no; then
3226  AC_CHECK_TOOL([STRIP], [strip], :)
3227fi
3228INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3229AC_SUBST([INSTALL_STRIP_PROGRAM])])
3230
3231# Copyright (C) 2006-2018 Free Software Foundation, Inc.
3232#
3233# This file is free software; the Free Software Foundation
3234# gives unlimited permission to copy and/or distribute it,
3235# with or without modifications, as long as this notice is preserved.
3236
3237# _AM_SUBST_NOTMAKE(VARIABLE)
3238# ---------------------------
3239# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3240# This macro is traced by Automake.
3241AC_DEFUN([_AM_SUBST_NOTMAKE])
3242
3243# AM_SUBST_NOTMAKE(VARIABLE)
3244# --------------------------
3245# Public sister of _AM_SUBST_NOTMAKE.
3246AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3247
3248# Check how to create a tarball.                            -*- Autoconf -*-
3249
3250# Copyright (C) 2004-2018 Free Software Foundation, Inc.
3251#
3252# This file is free software; the Free Software Foundation
3253# gives unlimited permission to copy and/or distribute it,
3254# with or without modifications, as long as this notice is preserved.
3255
3256# _AM_PROG_TAR(FORMAT)
3257# --------------------
3258# Check how to create a tarball in format FORMAT.
3259# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3260#
3261# Substitute a variable $(am__tar) that is a command
3262# writing to stdout a FORMAT-tarball containing the directory
3263# $tardir.
3264#     tardir=directory && $(am__tar) > result.tar
3265#
3266# Substitute a variable $(am__untar) that extract such
3267# a tarball read from stdin.
3268#     $(am__untar) < result.tar
3269#
3270AC_DEFUN([_AM_PROG_TAR],
3271[# Always define AMTAR for backward compatibility.  Yes, it's still used
3272# in the wild :-(  We should find a proper way to deprecate it ...
3273AC_SUBST([AMTAR], ['$${TAR-tar}'])
3274
3275# We'll loop over all known methods to create a tar archive until one works.
3276_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3277
3278m4_if([$1], [v7],
3279  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3280
3281  [m4_case([$1],
3282    [ustar],
3283     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3284      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3285      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3286      # and bug#13588).
3287      am_max_uid=2097151 # 2^21 - 1
3288      am_max_gid=$am_max_uid
3289      # The $UID and $GID variables are not portable, so we need to resort
3290      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3291      # below are definitely unexpected, so allow the users to see them
3292      # (that is, avoid stderr redirection).
3293      am_uid=`id -u || echo unknown`
3294      am_gid=`id -g || echo unknown`
3295      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3296      if test $am_uid -le $am_max_uid; then
3297         AC_MSG_RESULT([yes])
3298      else
3299         AC_MSG_RESULT([no])
3300         _am_tools=none
3301      fi
3302      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3303      if test $am_gid -le $am_max_gid; then
3304         AC_MSG_RESULT([yes])
3305      else
3306        AC_MSG_RESULT([no])
3307        _am_tools=none
3308      fi],
3309
3310  [pax],
3311    [],
3312
3313  [m4_fatal([Unknown tar format])])
3314
3315  AC_MSG_CHECKING([how to create a $1 tar archive])
3316
3317  # Go ahead even if we have the value already cached.  We do so because we
3318  # need to set the values for the 'am__tar' and 'am__untar' variables.
3319  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3320
3321  for _am_tool in $_am_tools; do
3322    case $_am_tool in
3323    gnutar)
3324      for _am_tar in tar gnutar gtar; do
3325        AM_RUN_LOG([$_am_tar --version]) && break
3326      done
3327      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3328      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3329      am__untar="$_am_tar -xf -"
3330      ;;
3331    plaintar)
3332      # Must skip GNU tar: if it does not support --format= it doesn't create
3333      # ustar tarball either.
3334      (tar --version) >/dev/null 2>&1 && continue
3335      am__tar='tar chf - "$$tardir"'
3336      am__tar_='tar chf - "$tardir"'
3337      am__untar='tar xf -'
3338      ;;
3339    pax)
3340      am__tar='pax -L -x $1 -w "$$tardir"'
3341      am__tar_='pax -L -x $1 -w "$tardir"'
3342      am__untar='pax -r'
3343      ;;
3344    cpio)
3345      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3346      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3347      am__untar='cpio -i -H $1 -d'
3348      ;;
3349    none)
3350      am__tar=false
3351      am__tar_=false
3352      am__untar=false
3353      ;;
3354    esac
3355
3356    # If the value was cached, stop now.  We just wanted to have am__tar
3357    # and am__untar set.
3358    test -n "${am_cv_prog_tar_$1}" && break
3359
3360    # tar/untar a dummy directory, and stop if the command works.
3361    rm -rf conftest.dir
3362    mkdir conftest.dir
3363    echo GrepMe > conftest.dir/file
3364    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3365    rm -rf conftest.dir
3366    if test -s conftest.tar; then
3367      AM_RUN_LOG([$am__untar <conftest.tar])
3368      AM_RUN_LOG([cat conftest.dir/file])
3369      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3370    fi
3371  done
3372  rm -rf conftest.dir
3373
3374  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3375  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3376
3377AC_SUBST([am__tar])
3378AC_SUBST([am__untar])
3379]) # _AM_PROG_TAR
3380
3381m4_include([m4/libtool.m4])
3382m4_include([m4/ltoptions.m4])
3383m4_include([m4/ltsugar.m4])
3384m4_include([m4/ltversion.m4])
3385m4_include([m4/lt~obsolete.m4])
3386