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