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