xorg-macros.m4.in revision 62044635
1dnl @configure_input@ 2dnl 3dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 4dnl 5dnl Permission is hereby granted, free of charge, to any person obtaining a 6dnl copy of this software and associated documentation files (the "Software"), 7dnl to deal in the Software without restriction, including without limitation 8dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, 9dnl and/or sell copies of the Software, and to permit persons to whom the 10dnl Software is furnished to do so, subject to the following conditions: 11dnl 12dnl The above copyright notice and this permission notice (including the next 13dnl paragraph) shall be included in all copies or substantial portions of the 14dnl Software. 15dnl 16dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22dnl DEALINGS IN THE SOFTWARE. 23 24# XORG_MACROS_VERSION(required-version) 25# ------------------------------------- 26# Minimum version: 1.1.0 27# 28# If you're using a macro added in Version 1.1 or newer, include this in 29# your configure.ac with the minimum required version, such as: 30# XORG_MACROS_VERSION(1.1) 31# 32# To ensure that this macro is defined, also add: 33# m4_ifndef([XORG_MACROS_VERSION], 34# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])]) 35# 36# 37# See the "minimum version" comment for each macro you use to see what 38# version you require. 39m4_defun([XORG_MACROS_VERSION],[ 40m4_define([vers_have], [@VERSION@]) 41m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) 42m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) 43m4_if(m4_cmp(maj_have, maj_needed), 0,, 44 [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])]) 45m4_if(m4_version_compare(vers_have, [$1]), -1, 46 [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])]) 47m4_undefine([vers_have]) 48m4_undefine([maj_have]) 49m4_undefine([maj_needed]) 50]) # XORG_MACROS_VERSION 51 52# XORG_PROG_RAWCPP() 53# ------------------ 54# Minimum version: 1.0.0 55# 56# Find cpp program and necessary flags for use in pre-processing text files 57# such as man pages and config files 58AC_DEFUN([XORG_PROG_RAWCPP],[ 59AC_REQUIRE([AC_PROG_CPP]) 60AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 61 [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib]) 62 63# Check for flag to avoid builtin definitions - assumes unix is predefined, 64# which is not the best choice for supporting other OS'es, but covers most 65# of the ones we need for now. 66AC_MSG_CHECKING([if $RAWCPP requires -undef]) 67AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])]) 68if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 69 AC_MSG_RESULT([no]) 70else 71 if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 72 RAWCPPFLAGS=-undef 73 AC_MSG_RESULT([yes]) 74 # under Cygwin unix is still defined even with -undef 75 elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then 76 RAWCPPFLAGS="-undef -ansi" 77 AC_MSG_RESULT([yes, with -ansi]) 78 else 79 AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.]) 80 fi 81fi 82rm -f conftest.$ac_ext 83 84AC_MSG_CHECKING([if $RAWCPP requires -traditional]) 85AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])]) 86if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then 87 AC_MSG_RESULT([no]) 88else 89 if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then 90 RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" 91 AC_MSG_RESULT([yes]) 92 else 93 AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.]) 94 fi 95fi 96rm -f conftest.$ac_ext 97AC_SUBST(RAWCPPFLAGS) 98]) # XORG_PROG_RAWCPP 99 100# XORG_MANPAGE_SECTIONS() 101# ----------------------- 102# Minimum version: 1.0.0 103# 104# Determine which sections man pages go in for the different man page types 105# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files. 106# Not sure if there's any better way than just hardcoding by OS name. 107# Override default settings by setting environment variables 108# Added MAN_SUBSTS in version 1.8 109# Added AC_PROG_SED in version 1.8 110 111AC_DEFUN([XORG_MANPAGE_SECTIONS],[ 112AC_REQUIRE([AC_CANONICAL_HOST]) 113AC_REQUIRE([AC_PROG_SED]) 114 115if test x$APP_MAN_SUFFIX = x ; then 116 APP_MAN_SUFFIX=1 117fi 118if test x$APP_MAN_DIR = x ; then 119 APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)' 120fi 121 122if test x$LIB_MAN_SUFFIX = x ; then 123 LIB_MAN_SUFFIX=3 124fi 125if test x$LIB_MAN_DIR = x ; then 126 LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)' 127fi 128 129if test x$FILE_MAN_SUFFIX = x ; then 130 case $host_os in 131 solaris*) FILE_MAN_SUFFIX=4 ;; 132 *) FILE_MAN_SUFFIX=5 ;; 133 esac 134fi 135if test x$FILE_MAN_DIR = x ; then 136 FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)' 137fi 138 139if test x$MISC_MAN_SUFFIX = x ; then 140 case $host_os in 141 solaris*) MISC_MAN_SUFFIX=5 ;; 142 *) MISC_MAN_SUFFIX=7 ;; 143 esac 144fi 145if test x$MISC_MAN_DIR = x ; then 146 MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)' 147fi 148 149if test x$DRIVER_MAN_SUFFIX = x ; then 150 case $host_os in 151 solaris*) DRIVER_MAN_SUFFIX=7 ;; 152 *) DRIVER_MAN_SUFFIX=4 ;; 153 esac 154fi 155if test x$DRIVER_MAN_DIR = x ; then 156 DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)' 157fi 158 159if test x$ADMIN_MAN_SUFFIX = x ; then 160 case $host_os in 161 solaris*) ADMIN_MAN_SUFFIX=1m ;; 162 *) ADMIN_MAN_SUFFIX=8 ;; 163 esac 164fi 165if test x$ADMIN_MAN_DIR = x ; then 166 ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)' 167fi 168 169 170AC_SUBST([APP_MAN_SUFFIX]) 171AC_SUBST([LIB_MAN_SUFFIX]) 172AC_SUBST([FILE_MAN_SUFFIX]) 173AC_SUBST([MISC_MAN_SUFFIX]) 174AC_SUBST([DRIVER_MAN_SUFFIX]) 175AC_SUBST([ADMIN_MAN_SUFFIX]) 176AC_SUBST([APP_MAN_DIR]) 177AC_SUBST([LIB_MAN_DIR]) 178AC_SUBST([FILE_MAN_DIR]) 179AC_SUBST([MISC_MAN_DIR]) 180AC_SUBST([DRIVER_MAN_DIR]) 181AC_SUBST([ADMIN_MAN_DIR]) 182 183XORG_MAN_PAGE="X Version 11" 184AC_SUBST([XORG_MAN_PAGE]) 185MAN_SUBSTS="\ 186 -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ 187 -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ 188 -e 's|__xservername__|Xorg|g' \ 189 -e 's|__xconfigfile__|xorg.conf|g' \ 190 -e 's|__projectroot__|\$(prefix)|g' \ 191 -e 's|__apploaddir__|\$(appdefaultdir)|g' \ 192 -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \ 193 -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \ 194 -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \ 195 -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \ 196 -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \ 197 -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'" 198AC_SUBST([MAN_SUBSTS]) 199 200]) # XORG_MANPAGE_SECTIONS 201 202# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION]) 203# ------------------------ 204# Minimum version: 1.7.0 205# 206# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent 207# provided by xorg-sgml-doctools, if installed. 208AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[ 209AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])]) 210XORG_SGML_PATH= 211PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])], 212 [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`], 213 [m4_ifval([$1],[:], 214 [if test x"$cross_compiling" != x"yes" ; then 215 AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent], 216 [XORG_SGML_PATH=$prefix/share/sgml]) 217 fi]) 218 ]) 219 220# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing 221# the path and the name of the doc stylesheet 222if test "x$XORG_SGML_PATH" != "x" ; then 223 AC_MSG_RESULT([$XORG_SGML_PATH]) 224 STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11 225 XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl 226else 227 AC_MSG_RESULT([no]) 228fi 229 230AC_SUBST(XORG_SGML_PATH) 231AC_SUBST(STYLESHEET_SRCDIR) 232AC_SUBST(XSL_STYLESHEET) 233AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"]) 234]) # XORG_CHECK_SGML_DOCTOOLS 235 236# XORG_CHECK_LINUXDOC 237# ------------------- 238# Minimum version: 1.0.0 239# 240# Defines the variable MAKE_TEXT if the necessary tools and 241# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt. 242# Whether or not the necessary tools and files are found can be checked 243# with the AM_CONDITIONAL "BUILD_LINUXDOC" 244AC_DEFUN([XORG_CHECK_LINUXDOC],[ 245AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) 246AC_REQUIRE([XORG_WITH_PS2PDF]) 247 248AC_PATH_PROG(LINUXDOC, linuxdoc) 249 250AC_MSG_CHECKING([whether to build documentation]) 251 252if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then 253 BUILDDOC=yes 254else 255 BUILDDOC=no 256fi 257 258AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes]) 259 260AC_MSG_RESULT([$BUILDDOC]) 261 262AC_MSG_CHECKING([whether to build pdf documentation]) 263 264if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then 265 BUILDPDFDOC=yes 266else 267 BUILDPDFDOC=no 268fi 269 270AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) 271 272AC_MSG_RESULT([$BUILDPDFDOC]) 273 274MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f" 275MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps" 276MAKE_PDF="$PS2PDF" 277MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0" 278 279AC_SUBST(MAKE_TEXT) 280AC_SUBST(MAKE_PS) 281AC_SUBST(MAKE_PDF) 282AC_SUBST(MAKE_HTML) 283]) # XORG_CHECK_LINUXDOC 284 285# XORG_CHECK_DOCBOOK 286# ------------------- 287# Minimum version: 1.0.0 288# 289# Checks for the ability to build output formats from SGML DocBook source. 290# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC" 291# indicates whether the necessary tools and files are found and, if set, 292# $(MAKE_XXX) blah.sgml will produce blah.xxx. 293AC_DEFUN([XORG_CHECK_DOCBOOK],[ 294AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) 295 296BUILDTXTDOC=no 297BUILDPDFDOC=no 298BUILDPSDOC=no 299BUILDHTMLDOC=no 300 301AC_PATH_PROG(DOCBOOKPS, docbook2ps) 302AC_PATH_PROG(DOCBOOKPDF, docbook2pdf) 303AC_PATH_PROG(DOCBOOKHTML, docbook2html) 304AC_PATH_PROG(DOCBOOKTXT, docbook2txt) 305 306AC_MSG_CHECKING([whether to build text documentation]) 307if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x && 308 test x$BUILD_TXTDOC != xno; then 309 BUILDTXTDOC=yes 310fi 311AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes]) 312AC_MSG_RESULT([$BUILDTXTDOC]) 313 314AC_MSG_CHECKING([whether to build PDF documentation]) 315if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x && 316 test x$BUILD_PDFDOC != xno; then 317 BUILDPDFDOC=yes 318fi 319AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) 320AC_MSG_RESULT([$BUILDPDFDOC]) 321 322AC_MSG_CHECKING([whether to build PostScript documentation]) 323if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x && 324 test x$BUILD_PSDOC != xno; then 325 BUILDPSDOC=yes 326fi 327AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes]) 328AC_MSG_RESULT([$BUILDPSDOC]) 329 330AC_MSG_CHECKING([whether to build HTML documentation]) 331if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x && 332 test x$BUILD_HTMLDOC != xno; then 333 BUILDHTMLDOC=yes 334fi 335AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes]) 336AC_MSG_RESULT([$BUILDHTMLDOC]) 337 338MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT" 339MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS" 340MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF" 341MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML" 342 343AC_SUBST(MAKE_TEXT) 344AC_SUBST(MAKE_PS) 345AC_SUBST(MAKE_PDF) 346AC_SUBST(MAKE_HTML) 347]) # XORG_CHECK_DOCBOOK 348 349# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT]) 350# ---------------- 351# Minimum version: 1.5.0 352# Minimum version for optional DEFAULT argument: 1.11.0 353# 354# Documentation tools are not always available on all platforms and sometimes 355# not at the appropriate level. This macro enables a module to test for the 356# presence of the tool and obtain it's path in separate variables. Coupled with 357# the --with-xmlto option, it allows maximum flexibilty in making decisions 358# as whether or not to use the xmlto package. When DEFAULT is not specified, 359# --with-xmlto assumes 'auto'. 360# 361# Interface to module: 362# HAVE_XMLTO: used in makefiles to conditionally generate documentation 363# XMLTO: returns the path of the xmlto program found 364# returns the path set by the user in the environment 365# --with-xmlto: 'yes' user instructs the module to use xmlto 366# 'no' user instructs the module not to use xmlto 367# 368# Added in version 1.10.0 369# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation 370# xmlto for text output requires either lynx, links, or w3m browsers 371# 372# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path. 373# 374AC_DEFUN([XORG_WITH_XMLTO],[ 375AC_ARG_VAR([XMLTO], [Path to xmlto command]) 376m4_define([_defopt], m4_default([$2], [auto])) 377AC_ARG_WITH(xmlto, 378 AS_HELP_STRING([--with-xmlto], 379 [Use xmlto to regenerate documentation (default: ]_defopt[)]), 380 [use_xmlto=$withval], [use_xmlto=]_defopt) 381m4_undefine([_defopt]) 382 383if test "x$use_xmlto" = x"auto"; then 384 AC_PATH_PROG([XMLTO], [xmlto]) 385 if test "x$XMLTO" = "x"; then 386 AC_MSG_WARN([xmlto not found - documentation targets will be skipped]) 387 have_xmlto=no 388 else 389 have_xmlto=yes 390 fi 391elif test "x$use_xmlto" = x"yes" ; then 392 AC_PATH_PROG([XMLTO], [xmlto]) 393 if test "x$XMLTO" = "x"; then 394 AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH]) 395 fi 396 have_xmlto=yes 397elif test "x$use_xmlto" = x"no" ; then 398 if test "x$XMLTO" != "x"; then 399 AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified]) 400 fi 401 have_xmlto=no 402else 403 AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no']) 404fi 405 406# Test for a minimum version of xmlto, if provided. 407m4_ifval([$1], 408[if test "$have_xmlto" = yes; then 409 # scrape the xmlto version 410 AC_MSG_CHECKING([the xmlto version]) 411 xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3` 412 AC_MSG_RESULT([$xmlto_version]) 413 AS_VERSION_COMPARE([$xmlto_version], [$1], 414 [if test "x$use_xmlto" = xauto; then 415 AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed]) 416 have_xmlto=no 417 else 418 AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed]) 419 fi]) 420fi]) 421 422# Test for the ability of xmlto to generate a text target 423have_xmlto_text=no 424cat > conftest.xml << "EOF" 425EOF 426AS_IF([test "$have_xmlto" = yes], 427 [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], 428 [have_xmlto_text=yes], 429 [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])]) 430rm -f conftest.xml 431AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes]) 432AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) 433]) # XORG_WITH_XMLTO 434 435# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT]) 436# -------------------------------------------- 437# Minimum version: 1.12.0 438# Minimum version for optional DEFAULT argument: 1.12.0 439# 440# XSLT (Extensible Stylesheet Language Transformations) is a declarative, 441# XML-based language used for the transformation of XML documents. 442# The xsltproc command line tool is for applying XSLT stylesheets to XML documents. 443# It is used under the cover by xmlto to generate html files from DocBook/XML. 444# The XSLT processor is often used as a standalone tool for transformations. 445# It should not be assumed that this tool is used only to work with documnetation. 446# When DEFAULT is not specified, --with-xsltproc assumes 'auto'. 447# 448# Interface to module: 449# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation 450# XSLTPROC: returns the path of the xsltproc program found 451# returns the path set by the user in the environment 452# --with-xsltproc: 'yes' user instructs the module to use xsltproc 453# 'no' user instructs the module not to use xsltproc 454# have_xsltproc: returns yes if xsltproc found in PATH or no 455# 456# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path. 457# 458AC_DEFUN([XORG_WITH_XSLTPROC],[ 459AC_ARG_VAR([XSLTPROC], [Path to xsltproc command]) 460# Preserves the interface, should it be implemented later 461m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])]) 462m4_define([_defopt], m4_default([$2], [auto])) 463AC_ARG_WITH(xsltproc, 464 AS_HELP_STRING([--with-xsltproc], 465 [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]), 466 [use_xsltproc=$withval], [use_xsltproc=]_defopt) 467m4_undefine([_defopt]) 468 469if test "x$use_xsltproc" = x"auto"; then 470 AC_PATH_PROG([XSLTPROC], [xsltproc]) 471 if test "x$XSLTPROC" = "x"; then 472 AC_MSG_WARN([xsltproc not found - cannot transform XML documents]) 473 have_xsltproc=no 474 else 475 have_xsltproc=yes 476 fi 477elif test "x$use_xsltproc" = x"yes" ; then 478 AC_PATH_PROG([XSLTPROC], [xsltproc]) 479 if test "x$XSLTPROC" = "x"; then 480 AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH]) 481 fi 482 have_xsltproc=yes 483elif test "x$use_xsltproc" = x"no" ; then 484 if test "x$XSLTPROC" != "x"; then 485 AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified]) 486 fi 487 have_xsltproc=no 488else 489 AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no']) 490fi 491 492AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes]) 493]) # XORG_WITH_XSLTPROC 494 495# XORG_WITH_PERL([MIN-VERSION], [DEFAULT]) 496# ---------------------------------------- 497# Minimum version: 1.15.0 498# 499# PERL (Practical Extraction and Report Language) is a language optimized for 500# scanning arbitrary text files, extracting information from those text files, 501# and printing reports based on that information. 502# 503# When DEFAULT is not specified, --with-perl assumes 'auto'. 504# 505# Interface to module: 506# HAVE_PERL: used in makefiles to conditionally scan text files 507# PERL: returns the path of the perl program found 508# returns the path set by the user in the environment 509# --with-perl: 'yes' user instructs the module to use perl 510# 'no' user instructs the module not to use perl 511# have_perl: returns yes if perl found in PATH or no 512# 513# If the user sets the value of PERL, AC_PATH_PROG skips testing the path. 514# 515AC_DEFUN([XORG_WITH_PERL],[ 516AC_ARG_VAR([PERL], [Path to perl command]) 517# Preserves the interface, should it be implemented later 518m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])]) 519m4_define([_defopt], m4_default([$2], [auto])) 520AC_ARG_WITH(perl, 521 AS_HELP_STRING([--with-perl], 522 [Use perl for extracting information from files (default: ]_defopt[)]), 523 [use_perl=$withval], [use_perl=]_defopt) 524m4_undefine([_defopt]) 525 526if test "x$use_perl" = x"auto"; then 527 AC_PATH_PROG([PERL], [perl]) 528 if test "x$PERL" = "x"; then 529 AC_MSG_WARN([perl not found - cannot extract information and report]) 530 have_perl=no 531 else 532 have_perl=yes 533 fi 534elif test "x$use_perl" = x"yes" ; then 535 AC_PATH_PROG([PERL], [perl]) 536 if test "x$PERL" = "x"; then 537 AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH]) 538 fi 539 have_perl=yes 540elif test "x$use_perl" = x"no" ; then 541 if test "x$PERL" != "x"; then 542 AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified]) 543 fi 544 have_perl=no 545else 546 AC_MSG_ERROR([--with-perl expects 'yes' or 'no']) 547fi 548 549AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes]) 550]) # XORG_WITH_PERL 551 552# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT]) 553# ---------------- 554# Minimum version: 1.5.0 555# Minimum version for optional DEFAULT argument: 1.11.0 556# 557# Documentation tools are not always available on all platforms and sometimes 558# not at the appropriate level. This macro enables a module to test for the 559# presence of the tool and obtain it's path in separate variables. Coupled with 560# the --with-asciidoc option, it allows maximum flexibilty in making decisions 561# as whether or not to use the asciidoc package. When DEFAULT is not specified, 562# --with-asciidoc assumes 'auto'. 563# 564# Interface to module: 565# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation 566# ASCIIDOC: returns the path of the asciidoc program found 567# returns the path set by the user in the environment 568# --with-asciidoc: 'yes' user instructs the module to use asciidoc 569# 'no' user instructs the module not to use asciidoc 570# 571# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path. 572# 573AC_DEFUN([XORG_WITH_ASCIIDOC],[ 574AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command]) 575m4_define([_defopt], m4_default([$2], [auto])) 576AC_ARG_WITH(asciidoc, 577 AS_HELP_STRING([--with-asciidoc], 578 [Use asciidoc to regenerate documentation (default: ]_defopt[)]), 579 [use_asciidoc=$withval], [use_asciidoc=]_defopt) 580m4_undefine([_defopt]) 581 582if test "x$use_asciidoc" = x"auto"; then 583 AC_PATH_PROG([ASCIIDOC], [asciidoc]) 584 if test "x$ASCIIDOC" = "x"; then 585 AC_MSG_WARN([asciidoc not found - documentation targets will be skipped]) 586 have_asciidoc=no 587 else 588 have_asciidoc=yes 589 fi 590elif test "x$use_asciidoc" = x"yes" ; then 591 AC_PATH_PROG([ASCIIDOC], [asciidoc]) 592 if test "x$ASCIIDOC" = "x"; then 593 AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH]) 594 fi 595 have_asciidoc=yes 596elif test "x$use_asciidoc" = x"no" ; then 597 if test "x$ASCIIDOC" != "x"; then 598 AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified]) 599 fi 600 have_asciidoc=no 601else 602 AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no']) 603fi 604m4_ifval([$1], 605[if test "$have_asciidoc" = yes; then 606 # scrape the asciidoc version 607 AC_MSG_CHECKING([the asciidoc version]) 608 asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2` 609 AC_MSG_RESULT([$asciidoc_version]) 610 AS_VERSION_COMPARE([$asciidoc_version], [$1], 611 [if test "x$use_asciidoc" = xauto; then 612 AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed]) 613 have_asciidoc=no 614 else 615 AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed]) 616 fi]) 617fi]) 618AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) 619]) # XORG_WITH_ASCIIDOC 620 621# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) 622# -------------------------------- 623# Minimum version: 1.5.0 624# Minimum version for optional DEFAULT argument: 1.11.0 625# 626# Documentation tools are not always available on all platforms and sometimes 627# not at the appropriate level. This macro enables a module to test for the 628# presence of the tool and obtain it's path in separate variables. Coupled with 629# the --with-doxygen option, it allows maximum flexibilty in making decisions 630# as whether or not to use the doxygen package. When DEFAULT is not specified, 631# --with-doxygen assumes 'auto'. 632# 633# Interface to module: 634# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation 635# DOXYGEN: returns the path of the doxygen program found 636# returns the path set by the user in the environment 637# --with-doxygen: 'yes' user instructs the module to use doxygen 638# 'no' user instructs the module not to use doxygen 639# 640# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path. 641# 642AC_DEFUN([XORG_WITH_DOXYGEN],[ 643AC_ARG_VAR([DOXYGEN], [Path to doxygen command]) 644m4_define([_defopt], m4_default([$2], [auto])) 645AC_ARG_WITH(doxygen, 646 AS_HELP_STRING([--with-doxygen], 647 [Use doxygen to regenerate documentation (default: ]_defopt[)]), 648 [use_doxygen=$withval], [use_doxygen=]_defopt) 649m4_undefine([_defopt]) 650 651if test "x$use_doxygen" = x"auto"; then 652 AC_PATH_PROG([DOXYGEN], [doxygen]) 653 if test "x$DOXYGEN" = "x"; then 654 AC_MSG_WARN([doxygen not found - documentation targets will be skipped]) 655 have_doxygen=no 656 else 657 have_doxygen=yes 658 fi 659elif test "x$use_doxygen" = x"yes" ; then 660 AC_PATH_PROG([DOXYGEN], [doxygen]) 661 if test "x$DOXYGEN" = "x"; then 662 AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH]) 663 fi 664 have_doxygen=yes 665elif test "x$use_doxygen" = x"no" ; then 666 if test "x$DOXYGEN" != "x"; then 667 AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified]) 668 fi 669 have_doxygen=no 670else 671 AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no']) 672fi 673m4_ifval([$1], 674[if test "$have_doxygen" = yes; then 675 # scrape the doxygen version 676 AC_MSG_CHECKING([the doxygen version]) 677 doxygen_version=`$DOXYGEN --version 2>/dev/null` 678 AC_MSG_RESULT([$doxygen_version]) 679 AS_VERSION_COMPARE([$doxygen_version], [$1], 680 [if test "x$use_doxygen" = xauto; then 681 AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed]) 682 have_doxygen=no 683 else 684 AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) 685 fi]) 686fi]) 687AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) 688]) # XORG_WITH_DOXYGEN 689 690# XORG_WITH_GROFF([DEFAULT]) 691# ---------------- 692# Minimum version: 1.6.0 693# Minimum version for optional DEFAULT argument: 1.11.0 694# 695# Documentation tools are not always available on all platforms and sometimes 696# not at the appropriate level. This macro enables a module to test for the 697# presence of the tool and obtain it's path in separate variables. Coupled with 698# the --with-groff option, it allows maximum flexibilty in making decisions 699# as whether or not to use the groff package. When DEFAULT is not specified, 700# --with-groff assumes 'auto'. 701# 702# Interface to module: 703# HAVE_GROFF: used in makefiles to conditionally generate documentation 704# HAVE_GROFF_MM: the memorandum macros (-mm) package 705# HAVE_GROFF_MS: the -ms macros package 706# GROFF: returns the path of the groff program found 707# returns the path set by the user in the environment 708# --with-groff: 'yes' user instructs the module to use groff 709# 'no' user instructs the module not to use groff 710# 711# Added in version 1.9.0: 712# HAVE_GROFF_HTML: groff has dependencies to output HTML format: 713# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package. 714# psselect from the psutils package. 715# the ghostcript package. Refer to the grohtml man pages 716# 717# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path. 718# 719# OS and distros often splits groff in a basic and full package, the former 720# having the groff program and the later having devices, fonts and macros 721# Checking for the groff executable is not enough. 722# 723# If macros are missing, we cannot assume that groff is useless, so we don't 724# unset HAVE_GROFF or GROFF env variables. 725# HAVE_GROFF_?? can never be true while HAVE_GROFF is false. 726# 727AC_DEFUN([XORG_WITH_GROFF],[ 728AC_ARG_VAR([GROFF], [Path to groff command]) 729m4_define([_defopt], m4_default([$1], [auto])) 730AC_ARG_WITH(groff, 731 AS_HELP_STRING([--with-groff], 732 [Use groff to regenerate documentation (default: ]_defopt[)]), 733 [use_groff=$withval], [use_groff=]_defopt) 734m4_undefine([_defopt]) 735 736if test "x$use_groff" = x"auto"; then 737 AC_PATH_PROG([GROFF], [groff]) 738 if test "x$GROFF" = "x"; then 739 AC_MSG_WARN([groff not found - documentation targets will be skipped]) 740 have_groff=no 741 else 742 have_groff=yes 743 fi 744elif test "x$use_groff" = x"yes" ; then 745 AC_PATH_PROG([GROFF], [groff]) 746 if test "x$GROFF" = "x"; then 747 AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH]) 748 fi 749 have_groff=yes 750elif test "x$use_groff" = x"no" ; then 751 if test "x$GROFF" != "x"; then 752 AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified]) 753 fi 754 have_groff=no 755else 756 AC_MSG_ERROR([--with-groff expects 'yes' or 'no']) 757fi 758 759# We have groff, test for the presence of the macro packages 760if test "x$have_groff" = x"yes"; then 761 AC_MSG_CHECKING([for ${GROFF} -ms macros]) 762 if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then 763 groff_ms_works=yes 764 else 765 groff_ms_works=no 766 fi 767 AC_MSG_RESULT([$groff_ms_works]) 768 AC_MSG_CHECKING([for ${GROFF} -mm macros]) 769 if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then 770 groff_mm_works=yes 771 else 772 groff_mm_works=no 773 fi 774 AC_MSG_RESULT([$groff_mm_works]) 775fi 776 777# We have groff, test for HTML dependencies, one command per package 778if test "x$have_groff" = x"yes"; then 779 AC_PATH_PROGS(GS_PATH, [gs gswin32c]) 780 AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng]) 781 AC_PATH_PROG(PSSELECT_PATH, [psselect]) 782 if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then 783 have_groff_html=yes 784 else 785 have_groff_html=no 786 AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages]) 787 fi 788fi 789 790# Set Automake conditionals for Makefiles 791AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes]) 792AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes]) 793AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes]) 794AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) 795]) # XORG_WITH_GROFF 796 797# XORG_WITH_FOP([MIN-VERSION], [DEFAULT]) 798# --------------------------------------- 799# Minimum version: 1.6.0 800# Minimum version for optional DEFAULT argument: 1.11.0 801# Minimum version for optional MIN-VERSION argument: 1.15.0 802# 803# Documentation tools are not always available on all platforms and sometimes 804# not at the appropriate level. This macro enables a module to test for the 805# presence of the tool and obtain it's path in separate variables. Coupled with 806# the --with-fop option, it allows maximum flexibilty in making decisions 807# as whether or not to use the fop package. When DEFAULT is not specified, 808# --with-fop assumes 'auto'. 809# 810# Interface to module: 811# HAVE_FOP: used in makefiles to conditionally generate documentation 812# FOP: returns the path of the fop program found 813# returns the path set by the user in the environment 814# --with-fop: 'yes' user instructs the module to use fop 815# 'no' user instructs the module not to use fop 816# 817# If the user sets the value of FOP, AC_PATH_PROG skips testing the path. 818# 819AC_DEFUN([XORG_WITH_FOP],[ 820AC_ARG_VAR([FOP], [Path to fop command]) 821m4_define([_defopt], m4_default([$2], [auto])) 822AC_ARG_WITH(fop, 823 AS_HELP_STRING([--with-fop], 824 [Use fop to regenerate documentation (default: ]_defopt[)]), 825 [use_fop=$withval], [use_fop=]_defopt) 826m4_undefine([_defopt]) 827 828if test "x$use_fop" = x"auto"; then 829 AC_PATH_PROG([FOP], [fop]) 830 if test "x$FOP" = "x"; then 831 AC_MSG_WARN([fop not found - documentation targets will be skipped]) 832 have_fop=no 833 else 834 have_fop=yes 835 fi 836elif test "x$use_fop" = x"yes" ; then 837 AC_PATH_PROG([FOP], [fop]) 838 if test "x$FOP" = "x"; then 839 AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH]) 840 fi 841 have_fop=yes 842elif test "x$use_fop" = x"no" ; then 843 if test "x$FOP" != "x"; then 844 AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified]) 845 fi 846 have_fop=no 847else 848 AC_MSG_ERROR([--with-fop expects 'yes' or 'no']) 849fi 850 851# Test for a minimum version of fop, if provided. 852m4_ifval([$1], 853[if test "$have_fop" = yes; then 854 # scrape the fop version 855 AC_MSG_CHECKING([for fop minimum version]) 856 fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3` 857 AC_MSG_RESULT([$fop_version]) 858 AS_VERSION_COMPARE([$fop_version], [$1], 859 [if test "x$use_fop" = xauto; then 860 AC_MSG_WARN([fop version $fop_version found, but $1 needed]) 861 have_fop=no 862 else 863 AC_MSG_ERROR([fop version $fop_version found, but $1 needed]) 864 fi]) 865fi]) 866AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) 867]) # XORG_WITH_FOP 868 869# XORG_WITH_PS2PDF([DEFAULT]) 870# ---------------- 871# Minimum version: 1.6.0 872# Minimum version for optional DEFAULT argument: 1.11.0 873# 874# Documentation tools are not always available on all platforms and sometimes 875# not at the appropriate level. This macro enables a module to test for the 876# presence of the tool and obtain it's path in separate variables. Coupled with 877# the --with-ps2pdf option, it allows maximum flexibilty in making decisions 878# as whether or not to use the ps2pdf package. When DEFAULT is not specified, 879# --with-ps2pdf assumes 'auto'. 880# 881# Interface to module: 882# HAVE_PS2PDF: used in makefiles to conditionally generate documentation 883# PS2PDF: returns the path of the ps2pdf program found 884# returns the path set by the user in the environment 885# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf 886# 'no' user instructs the module not to use ps2pdf 887# 888# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path. 889# 890AC_DEFUN([XORG_WITH_PS2PDF],[ 891AC_ARG_VAR([PS2PDF], [Path to ps2pdf command]) 892m4_define([_defopt], m4_default([$1], [auto])) 893AC_ARG_WITH(ps2pdf, 894 AS_HELP_STRING([--with-ps2pdf], 895 [Use ps2pdf to regenerate documentation (default: ]_defopt[)]), 896 [use_ps2pdf=$withval], [use_ps2pdf=]_defopt) 897m4_undefine([_defopt]) 898 899if test "x$use_ps2pdf" = x"auto"; then 900 AC_PATH_PROG([PS2PDF], [ps2pdf]) 901 if test "x$PS2PDF" = "x"; then 902 AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped]) 903 have_ps2pdf=no 904 else 905 have_ps2pdf=yes 906 fi 907elif test "x$use_ps2pdf" = x"yes" ; then 908 AC_PATH_PROG([PS2PDF], [ps2pdf]) 909 if test "x$PS2PDF" = "x"; then 910 AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH]) 911 fi 912 have_ps2pdf=yes 913elif test "x$use_ps2pdf" = x"no" ; then 914 if test "x$PS2PDF" != "x"; then 915 AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified]) 916 fi 917 have_ps2pdf=no 918else 919 AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no']) 920fi 921AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes]) 922]) # XORG_WITH_PS2PDF 923 924# XORG_ENABLE_DOCS (enable_docs=yes) 925# ---------------- 926# Minimum version: 1.6.0 927# 928# Documentation tools are not always available on all platforms and sometimes 929# not at the appropriate level. This macro enables a builder to skip all 930# documentation targets except traditional man pages. 931# Combined with the specific tool checking macros XORG_WITH_*, it provides 932# maximum flexibilty in controlling documentation building. 933# Refer to: 934# XORG_WITH_XMLTO --with-xmlto 935# XORG_WITH_ASCIIDOC --with-asciidoc 936# XORG_WITH_DOXYGEN --with-doxygen 937# XORG_WITH_FOP --with-fop 938# XORG_WITH_GROFF --with-groff 939# XORG_WITH_PS2PDF --with-ps2pdf 940# 941# Interface to module: 942# ENABLE_DOCS: used in makefiles to conditionally generate documentation 943# --enable-docs: 'yes' user instructs the module to generate docs 944# 'no' user instructs the module not to generate docs 945# parm1: specify the default value, yes or no. 946# 947AC_DEFUN([XORG_ENABLE_DOCS],[ 948m4_define([docs_default], m4_default([$1], [yes])) 949AC_ARG_ENABLE(docs, 950 AS_HELP_STRING([--enable-docs], 951 [Enable building the documentation (default: ]docs_default[)]), 952 [build_docs=$enableval], [build_docs=]docs_default) 953m4_undefine([docs_default]) 954AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes]) 955AC_MSG_CHECKING([whether to build documentation]) 956AC_MSG_RESULT([$build_docs]) 957]) # XORG_ENABLE_DOCS 958 959# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes) 960# ---------------- 961# Minimum version: 1.6.0 962# 963# This macro enables a builder to skip all developer documentation. 964# Combined with the specific tool checking macros XORG_WITH_*, it provides 965# maximum flexibilty in controlling documentation building. 966# Refer to: 967# XORG_WITH_XMLTO --with-xmlto 968# XORG_WITH_ASCIIDOC --with-asciidoc 969# XORG_WITH_DOXYGEN --with-doxygen 970# XORG_WITH_FOP --with-fop 971# XORG_WITH_GROFF --with-groff 972# XORG_WITH_PS2PDF --with-ps2pdf 973# 974# Interface to module: 975# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs 976# --enable-devel-docs: 'yes' user instructs the module to generate developer docs 977# 'no' user instructs the module not to generate developer docs 978# parm1: specify the default value, yes or no. 979# 980AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[ 981m4_define([devel_default], m4_default([$1], [yes])) 982AC_ARG_ENABLE(devel-docs, 983 AS_HELP_STRING([--enable-devel-docs], 984 [Enable building the developer documentation (default: ]devel_default[)]), 985 [build_devel_docs=$enableval], [build_devel_docs=]devel_default) 986m4_undefine([devel_default]) 987AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes]) 988AC_MSG_CHECKING([whether to build developer documentation]) 989AC_MSG_RESULT([$build_devel_docs]) 990]) # XORG_ENABLE_DEVEL_DOCS 991 992# XORG_ENABLE_SPECS (enable_specs=yes) 993# ---------------- 994# Minimum version: 1.6.0 995# 996# This macro enables a builder to skip all functional specification targets. 997# Combined with the specific tool checking macros XORG_WITH_*, it provides 998# maximum flexibilty in controlling documentation building. 999# Refer to: 1000# XORG_WITH_XMLTO --with-xmlto 1001# XORG_WITH_ASCIIDOC --with-asciidoc 1002# XORG_WITH_DOXYGEN --with-doxygen 1003# XORG_WITH_FOP --with-fop 1004# XORG_WITH_GROFF --with-groff 1005# XORG_WITH_PS2PDF --with-ps2pdf 1006# 1007# Interface to module: 1008# ENABLE_SPECS: used in makefiles to conditionally generate specs 1009# --enable-specs: 'yes' user instructs the module to generate specs 1010# 'no' user instructs the module not to generate specs 1011# parm1: specify the default value, yes or no. 1012# 1013AC_DEFUN([XORG_ENABLE_SPECS],[ 1014m4_define([spec_default], m4_default([$1], [yes])) 1015AC_ARG_ENABLE(specs, 1016 AS_HELP_STRING([--enable-specs], 1017 [Enable building the specs (default: ]spec_default[)]), 1018 [build_specs=$enableval], [build_specs=]spec_default) 1019m4_undefine([spec_default]) 1020AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes]) 1021AC_MSG_CHECKING([whether to build functional specifications]) 1022AC_MSG_RESULT([$build_specs]) 1023]) # XORG_ENABLE_SPECS 1024 1025# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto) 1026# ---------------------------------------------- 1027# Minimum version: 1.13.0 1028# 1029# This macro enables a builder to enable/disable unit testing 1030# It makes no assumption about the test cases implementation 1031# Test cases may or may not use Automake "Support for test suites" 1032# They may or may not use the software utility library GLib 1033# 1034# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL 1035# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib. 1036# The variable enable_unit_tests is used by other macros in this file. 1037# 1038# Interface to module: 1039# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests 1040# enable_unit_tests: used in configure.ac for additional configuration 1041# --enable-unit-tests: 'yes' user instructs the module to build tests 1042# 'no' user instructs the module not to build tests 1043# parm1: specify the default value, yes or no. 1044# 1045AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[ 1046AC_BEFORE([$0], [XORG_WITH_GLIB]) 1047AC_BEFORE([$0], [XORG_LD_WRAP]) 1048m4_define([_defopt], m4_default([$1], [auto])) 1049AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests], 1050 [Enable building unit test cases (default: ]_defopt[)]), 1051 [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt) 1052m4_undefine([_defopt]) 1053AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno]) 1054AC_MSG_CHECKING([whether to build unit test cases]) 1055AC_MSG_RESULT([$enable_unit_tests]) 1056]) # XORG_ENABLE_UNIT_TESTS 1057 1058# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT]) 1059# ---------------------------------------- 1060# Minimum version: 1.13.0 1061# 1062# GLib is a library which provides advanced data structures and functions. 1063# This macro enables a module to test for the presence of Glib. 1064# 1065# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing. 1066# Otherwise the value of $enable_unit_tests is blank. 1067# 1068# Interface to module: 1069# HAVE_GLIB: used in makefiles to conditionally build targets 1070# with_glib: used in configure.ac to know if GLib has been found 1071# --with-glib: 'yes' user instructs the module to use glib 1072# 'no' user instructs the module not to use glib 1073# 1074AC_DEFUN([XORG_WITH_GLIB],[ 1075AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 1076m4_define([_defopt], m4_default([$2], [auto])) 1077AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib], 1078 [Use GLib library for unit testing (default: ]_defopt[)]), 1079 [with_glib=$withval], [with_glib=]_defopt) 1080m4_undefine([_defopt]) 1081 1082have_glib=no 1083# Do not probe GLib if user explicitly disabled unit testing 1084if test "x$enable_unit_tests" != x"no"; then 1085 # Do not probe GLib if user explicitly disabled it 1086 if test "x$with_glib" != x"no"; then 1087 m4_ifval( 1088 [$1], 1089 [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])], 1090 [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])] 1091 ) 1092 fi 1093fi 1094 1095# Not having GLib when unit testing has been explicitly requested is an error 1096if test "x$enable_unit_tests" = x"yes"; then 1097 if test "x$have_glib" = x"no"; then 1098 AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) 1099 fi 1100fi 1101 1102# Having unit testing disabled when GLib has been explicitly requested is an error 1103if test "x$enable_unit_tests" = x"no"; then 1104 if test "x$with_glib" = x"yes"; then 1105 AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) 1106 fi 1107fi 1108 1109# Not having GLib when it has been explicitly requested is an error 1110if test "x$with_glib" = x"yes"; then 1111 if test "x$have_glib" = x"no"; then 1112 AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found]) 1113 fi 1114fi 1115 1116AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes]) 1117]) # XORG_WITH_GLIB 1118 1119# XORG_LD_WRAP 1120# ------------ 1121# Minimum version: 1.13.0 1122# 1123# Check if linker supports -wrap, passed via compiler flags 1124# 1125# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing. 1126# Otherwise the value of $enable_unit_tests is blank. 1127# 1128AC_DEFUN([XORG_LD_WRAP],[ 1129XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no]) 1130# Not having ld wrap when unit testing has been explicitly requested is an error 1131if test "x$enable_unit_tests" = x"yes"; then 1132 if test "x$have_ld_wrap" = x"no"; then 1133 AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available]) 1134 fi 1135fi 1136AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes]) 1137# 1138]) # XORG_LD_WRAP 1139 1140# XORG_CHECK_LINKER_FLAGS 1141# ----------------------- 1142# SYNOPSIS 1143# 1144# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) 1145# 1146# DESCRIPTION 1147# 1148# Check whether the given linker FLAGS work with the current language's 1149# linker, or whether they give an error. 1150# 1151# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 1152# success/failure. 1153# 1154# NOTE: Based on AX_CHECK_COMPILER_FLAGS. 1155# 1156# LICENSE 1157# 1158# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org> 1159# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu> 1160# Copyright (c) 2009 Matteo Frigo 1161# 1162# This program is free software: you can redistribute it and/or modify it 1163# under the terms of the GNU General Public License as published by the 1164# Free Software Foundation, either version 3 of the License, or (at your 1165# option) any later version. 1166# 1167# This program is distributed in the hope that it will be useful, but 1168# WITHOUT ANY WARRANTY; without even the implied warranty of 1169# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 1170# Public License for more details. 1171# 1172# You should have received a copy of the GNU General Public License along 1173# with this program. If not, see <http://www.gnu.org/licenses/>. 1174# 1175# As a special exception, the respective Autoconf Macro's copyright owner 1176# gives unlimited permission to copy, distribute and modify the configure 1177# scripts that are the output of Autoconf when processing the Macro. You 1178# need not follow the terms of the GNU General Public License when using 1179# or distributing such scripts, even though portions of the text of the 1180# Macro appear in them. The GNU General Public License (GPL) does govern 1181# all other use of the material that constitutes the Autoconf Macro. 1182# 1183# This special exception to the GPL applies to versions of the Autoconf 1184# Macro released by the Autoconf Archive. When you make and distribute a 1185# modified version of the Autoconf Macro, you may extend this special 1186# exception to the GPL to apply to your modified version as well.# 1187AC_DEFUN([XORG_CHECK_LINKER_FLAGS], 1188[AC_MSG_CHECKING([whether the linker accepts $1]) 1189dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: 1190AS_LITERAL_IF([$1], 1191 [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [ 1192 ax_save_FLAGS=$LDFLAGS 1193 LDFLAGS="$1" 1194 AC_LINK_IFELSE([AC_LANG_PROGRAM()], 1195 AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, 1196 AS_TR_SH(xorg_cv_linker_flags_[$1])=no) 1197 LDFLAGS=$ax_save_FLAGS])], 1198 [ax_save_FLAGS=$LDFLAGS 1199 LDFLAGS="$1" 1200 AC_LINK_IFELSE([AC_LANG_PROGRAM()], 1201 eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, 1202 eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no) 1203 LDFLAGS=$ax_save_FLAGS]) 1204eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1]) 1205AC_MSG_RESULT($xorg_check_linker_flags) 1206if test "x$xorg_check_linker_flags" = xyes; then 1207 m4_default([$2], :) 1208else 1209 m4_default([$3], :) 1210fi 1211]) # XORG_CHECK_LINKER_FLAGS 1212 1213# XORG_CHECK_MALLOC_ZERO 1214# ---------------------- 1215# Minimum version: 1.0.0 1216# 1217# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if 1218# malloc(0) returns NULL. Packages should add one of these cflags to 1219# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. 1220AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ 1221AC_ARG_ENABLE(malloc0returnsnull, 1222 AS_HELP_STRING([--enable-malloc0returnsnull], 1223 [malloc(0) returns NULL (default: auto)]), 1224 [MALLOC_ZERO_RETURNS_NULL=$enableval], 1225 [MALLOC_ZERO_RETURNS_NULL=auto]) 1226 1227AC_MSG_CHECKING([whether malloc(0) returns NULL]) 1228if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then 1229 AC_RUN_IFELSE([AC_LANG_PROGRAM([ 1230#include <stdlib.h> 1231],[ 1232 char *m0, *r0, *c0, *p; 1233 m0 = malloc(0); 1234 p = malloc(10); 1235 r0 = realloc(p,0); 1236 c0 = calloc(0,10); 1237 exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); 1238])], 1239 [MALLOC_ZERO_RETURNS_NULL=yes], 1240 [MALLOC_ZERO_RETURNS_NULL=no], 1241 [MALLOC_ZERO_RETURNS_NULL=yes]) 1242fi 1243AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) 1244 1245if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then 1246 MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" 1247 XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS 1248 XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" 1249else 1250 MALLOC_ZERO_CFLAGS="" 1251 XMALLOC_ZERO_CFLAGS="" 1252 XTMALLOC_ZERO_CFLAGS="" 1253fi 1254 1255AC_SUBST([MALLOC_ZERO_CFLAGS]) 1256AC_SUBST([XMALLOC_ZERO_CFLAGS]) 1257AC_SUBST([XTMALLOC_ZERO_CFLAGS]) 1258]) # XORG_CHECK_MALLOC_ZERO 1259 1260# XORG_WITH_LINT() 1261# ---------------- 1262# Minimum version: 1.1.0 1263# 1264# This macro enables the use of a tool that flags some suspicious and 1265# non-portable constructs (likely to be bugs) in C language source code. 1266# It will attempt to locate the tool and use appropriate options. 1267# There are various lint type tools on different platforms. 1268# 1269# Interface to module: 1270# LINT: returns the path to the tool found on the platform 1271# or the value set to LINT on the configure cmd line 1272# also an Automake conditional 1273# LINT_FLAGS: an Automake variable with appropriate flags 1274# 1275# --with-lint: 'yes' user instructs the module to use lint 1276# 'no' user instructs the module not to use lint (default) 1277# 1278# If the user sets the value of LINT, AC_PATH_PROG skips testing the path. 1279# If the user sets the value of LINT_FLAGS, they are used verbatim. 1280# 1281AC_DEFUN([XORG_WITH_LINT],[ 1282 1283AC_ARG_VAR([LINT], [Path to a lint-style command]) 1284AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command]) 1285AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint], 1286 [Use a lint-style source code checker (default: disabled)])], 1287 [use_lint=$withval], [use_lint=no]) 1288 1289# Obtain platform specific info like program name and options 1290# The lint program on FreeBSD and NetBSD is different from the one on Solaris 1291case $host_os in 1292 *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*) 1293 lint_name=splint 1294 lint_options="-badflag" 1295 ;; 1296 *freebsd* | *netbsd*) 1297 lint_name=lint 1298 lint_options="-u -b" 1299 ;; 1300 *solaris*) 1301 lint_name=lint 1302 lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2" 1303 ;; 1304esac 1305 1306# Test for the presence of the program (either guessed by the code or spelled out by the user) 1307if test "x$use_lint" = x"yes" ; then 1308 AC_PATH_PROG([LINT], [$lint_name]) 1309 if test "x$LINT" = "x"; then 1310 AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH]) 1311 fi 1312elif test "x$use_lint" = x"no" ; then 1313 if test "x$LINT" != "x"; then 1314 AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified]) 1315 fi 1316else 1317 AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.]) 1318fi 1319 1320# User supplied flags override default flags 1321if test "x$LINT_FLAGS" != "x"; then 1322 lint_options=$LINT_FLAGS 1323fi 1324 1325AC_SUBST([LINT_FLAGS],[$lint_options]) 1326AM_CONDITIONAL(LINT, [test "x$LINT" != x]) 1327 1328]) # XORG_WITH_LINT 1329 1330# XORG_LINT_LIBRARY(LIBNAME) 1331# -------------------------- 1332# Minimum version: 1.1.0 1333# 1334# Sets up flags for building lint libraries for checking programs that call 1335# functions in the library. 1336# 1337# Interface to module: 1338# LINTLIB - Automake variable with the name of lint library file to make 1339# MAKE_LINT_LIB - Automake conditional 1340# 1341# --enable-lint-library: - 'yes' user instructs the module to created a lint library 1342# - 'no' user instructs the module not to create a lint library (default) 1343 1344AC_DEFUN([XORG_LINT_LIBRARY],[ 1345AC_REQUIRE([XORG_WITH_LINT]) 1346AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library], 1347 [Create lint library (default: disabled)])], 1348 [make_lint_lib=$enableval], [make_lint_lib=no]) 1349 1350if test "x$make_lint_lib" = x"yes" ; then 1351 LINTLIB=llib-l$1.ln 1352 if test "x$LINT" = "x"; then 1353 AC_MSG_ERROR([Cannot make lint library without --with-lint]) 1354 fi 1355elif test "x$make_lint_lib" != x"no" ; then 1356 AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.]) 1357fi 1358 1359AC_SUBST(LINTLIB) 1360AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) 1361 1362]) # XORG_LINT_LIBRARY 1363 1364# XORG_COMPILER_BRAND 1365# ------------------- 1366# Minimum version: 1.14.0 1367# 1368# Checks for various brands of compilers and sets flags as appropriate: 1369# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" 1370# clang compiler - sets CLANGCC to "yes" 1371# Intel compiler - sets INTELCC to "yes" 1372# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" 1373# 1374AC_DEFUN([XORG_COMPILER_BRAND], [ 1375AC_REQUIRE([AC_PROG_CC_C99]) 1376AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) 1377AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) 1378AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) 1379]) # XORG_COMPILER_BRAND 1380 1381# XORG_CWARNFLAGS 1382# --------------- 1383# Minimum version: 1.2.0 1384# 1385# Defines CWARNFLAGS to enable C compiler warnings. 1386# 1387AC_DEFUN([XORG_CWARNFLAGS], [ 1388AC_REQUIRE([AC_PROG_CC_C99]) 1389AC_REQUIRE([XORG_COMPILER_BRAND]) 1390if test "x$GCC" = xyes ; then 1391 CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ 1392-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ 1393-Wbad-function-cast -Wformat=2" 1394 case `$CC -dumpversion` in 1395 3.4.* | 4.*) 1396 CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement" 1397 ;; 1398 esac 1399else 1400 if test "x$SUNCC" = "xyes"; then 1401 CWARNFLAGS="-v" 1402 fi 1403fi 1404AC_SUBST(CWARNFLAGS) 1405]) # XORG_CWARNFLAGS 1406 1407# XORG_STRICT_OPTION 1408# ----------------------- 1409# Minimum version: 1.3.0 1410# 1411# Add configure option to enable strict compilation flags, such as treating 1412# warnings as fatal errors. 1413# If --enable-strict-compilation is passed to configure, adds strict flags to 1414# $CWARNFLAGS. 1415# 1416# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or 1417# when strict compilation is unconditionally desired. 1418AC_DEFUN([XORG_STRICT_OPTION], [ 1419# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89 1420AC_REQUIRE([AC_PROG_CC_C99]) 1421AC_REQUIRE([XORG_COMPILER_BRAND]) 1422AC_REQUIRE([XORG_CWARNFLAGS]) 1423 1424AC_ARG_ENABLE(strict-compilation, 1425 AS_HELP_STRING([--enable-strict-compilation], 1426 [Enable all warnings from compiler and make them errors (default: disabled)]), 1427 [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) 1428if test "x$GCC" = xyes ; then 1429 STRICT_CFLAGS="-pedantic -Werror" 1430 # Add -Werror=attributes if supported (gcc 4.2 & later) 1431 AC_MSG_CHECKING([if $CC supports -Werror=attributes]) 1432 save_CFLAGS="$CFLAGS" 1433 CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes" 1434 AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])], 1435 [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes" 1436 AC_MSG_RESULT([yes])], 1437 [AC_MSG_RESULT([no])]) 1438 CFLAGS="$save_CFLAGS" 1439elif test "x$SUNCC" = "xyes"; then 1440 STRICT_CFLAGS="-errwarn" 1441elif test "x$INTELCC" = "xyes"; then 1442 STRICT_CFLAGS="-Werror" 1443fi 1444if test "x$STRICT_COMPILE" = "xyes"; then 1445 CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" 1446fi 1447AC_SUBST([STRICT_CFLAGS]) 1448AC_SUBST([CWARNFLAGS]) 1449]) # XORG_STRICT_OPTION 1450 1451# XORG_DEFAULT_OPTIONS 1452# -------------------- 1453# Minimum version: 1.3.0 1454# 1455# Defines default options for X.Org modules. 1456# 1457AC_DEFUN([XORG_DEFAULT_OPTIONS], [ 1458AC_REQUIRE([AC_PROG_INSTALL]) 1459XORG_CWARNFLAGS 1460XORG_STRICT_OPTION 1461XORG_RELEASE_VERSION 1462XORG_CHANGELOG 1463XORG_INSTALL 1464XORG_MANPAGE_SECTIONS 1465m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], 1466 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) 1467]) # XORG_DEFAULT_OPTIONS 1468 1469# XORG_INSTALL() 1470# ---------------- 1471# Minimum version: 1.4.0 1472# 1473# Defines the variable INSTALL_CMD as the command to copy 1474# INSTALL from $prefix/share/util-macros. 1475# 1476AC_DEFUN([XORG_INSTALL], [ 1477AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 1478macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` 1479INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ 1480mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ 1481|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \ 1482echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)" 1483AC_SUBST([INSTALL_CMD]) 1484]) # XORG_INSTALL 1485