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