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