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