"Fossies" - the Fresh Open Source Software Archive

Member "xorg-server-1.20.5/aclocal.m4" (30 May 2019, 147481 Bytes) of package /linux/misc/xorg-server-1.20.5.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "aclocal.m4": 1.20.3_vs_1.20.4.

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