xorg-macros.m4.in revision ffab5952
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([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([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_ASCIIDOC([MIN-VERSION], [DEFAULT]) 436# ---------------- 437# Minimum version: 1.5.0 438# Minimum version for optional DEFAULT argument: 1.11.0 439# 440# Documentation tools are not always available on all platforms and sometimes 441# not at the appropriate level. This macro enables a module to test for the 442# presence of the tool and obtain it's path in separate variables. Coupled with 443# the --with-asciidoc option, it allows maximum flexibilty in making decisions 444# as whether or not to use the asciidoc package. When DEFAULT is not specified, 445# --with-asciidoc assumes 'auto'. 446# 447# Interface to module: 448# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation 449# ASCIIDOC: returns the path of the asciidoc program found 450# returns the path set by the user in the environment 451# --with-asciidoc: 'yes' user instructs the module to use asciidoc 452# 'no' user instructs the module not to use asciidoc 453# 454# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path. 455# 456AC_DEFUN([XORG_WITH_ASCIIDOC],[ 457AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command]) 458m4_define([_defopt], m4_default([$2], [auto])) 459AC_ARG_WITH(asciidoc, 460 AS_HELP_STRING([--with-asciidoc], 461 [Use asciidoc to regenerate documentation (default: ]_defopt[)]), 462 [use_asciidoc=$withval], [use_asciidoc=]_defopt) 463m4_undefine([_defopt]) 464 465if test "x$use_asciidoc" = x"auto"; then 466 AC_PATH_PROG([ASCIIDOC], [asciidoc]) 467 if test "x$ASCIIDOC" = "x"; then 468 AC_MSG_WARN([asciidoc not found - documentation targets will be skipped]) 469 have_asciidoc=no 470 else 471 have_asciidoc=yes 472 fi 473elif test "x$use_asciidoc" = x"yes" ; then 474 AC_PATH_PROG([ASCIIDOC], [asciidoc]) 475 if test "x$ASCIIDOC" = "x"; then 476 AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH]) 477 fi 478 have_asciidoc=yes 479elif test "x$use_asciidoc" = x"no" ; then 480 if test "x$ASCIIDOC" != "x"; then 481 AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified]) 482 fi 483 have_asciidoc=no 484else 485 AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no']) 486fi 487m4_ifval([$1], 488[if test "$have_asciidoc" = yes; then 489 # scrape the asciidoc version 490 AC_MSG_CHECKING([the asciidoc version]) 491 asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2` 492 AC_MSG_RESULT([$asciidoc_version]) 493 AS_VERSION_COMPARE([$asciidoc_version], [$1], 494 [if test "x$use_asciidoc" = xauto; then 495 AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed]) 496 have_asciidoc=no 497 else 498 AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed]) 499 fi]) 500fi]) 501AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) 502]) # XORG_WITH_ASCIIDOC 503 504# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) 505# -------------------------------- 506# Minimum version: 1.5.0 507# Minimum version for optional DEFAULT argument: 1.11.0 508# 509# Documentation tools are not always available on all platforms and sometimes 510# not at the appropriate level. This macro enables a module to test for the 511# presence of the tool and obtain it's path in separate variables. Coupled with 512# the --with-doxygen option, it allows maximum flexibilty in making decisions 513# as whether or not to use the doxygen package. When DEFAULT is not specified, 514# --with-doxygen assumes 'auto'. 515# 516# Interface to module: 517# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation 518# DOXYGEN: returns the path of the doxygen program found 519# returns the path set by the user in the environment 520# --with-doxygen: 'yes' user instructs the module to use doxygen 521# 'no' user instructs the module not to use doxygen 522# 523# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path. 524# 525AC_DEFUN([XORG_WITH_DOXYGEN],[ 526AC_ARG_VAR([DOXYGEN], [Path to doxygen command]) 527m4_define([_defopt], m4_default([$2], [auto])) 528AC_ARG_WITH(doxygen, 529 AS_HELP_STRING([--with-doxygen], 530 [Use doxygen to regenerate documentation (default: ]_defopt[)]), 531 [use_doxygen=$withval], [use_doxygen=]_defopt) 532m4_undefine([_defopt]) 533 534if test "x$use_doxygen" = x"auto"; then 535 AC_PATH_PROG([DOXYGEN], [doxygen]) 536 if test "x$DOXYGEN" = "x"; then 537 AC_MSG_WARN([doxygen not found - documentation targets will be skipped]) 538 have_doxygen=no 539 else 540 have_doxygen=yes 541 fi 542elif test "x$use_doxygen" = x"yes" ; then 543 AC_PATH_PROG([DOXYGEN], [doxygen]) 544 if test "x$DOXYGEN" = "x"; then 545 AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH]) 546 fi 547 have_doxygen=yes 548elif test "x$use_doxygen" = x"no" ; then 549 if test "x$DOXYGEN" != "x"; then 550 AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified]) 551 fi 552 have_doxygen=no 553else 554 AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no']) 555fi 556m4_ifval([$1], 557[if test "$have_doxygen" = yes; then 558 # scrape the doxygen version 559 AC_MSG_CHECKING([the doxygen version]) 560 doxygen_version=`$DOXYGEN --version 2>/dev/null` 561 AC_MSG_RESULT([$doxygen_version]) 562 AS_VERSION_COMPARE([$doxygen_version], [$1], 563 [if test "x$use_doxygen" = xauto; then 564 AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed]) 565 have_doxygen=no 566 else 567 AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) 568 fi]) 569fi]) 570AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) 571]) # XORG_WITH_DOXYGEN 572 573# XORG_WITH_GROFF([DEFAULT]) 574# ---------------- 575# Minimum version: 1.6.0 576# Minimum version for optional DEFAULT argument: 1.11.0 577# 578# Documentation tools are not always available on all platforms and sometimes 579# not at the appropriate level. This macro enables a module to test for the 580# presence of the tool and obtain it's path in separate variables. Coupled with 581# the --with-groff option, it allows maximum flexibilty in making decisions 582# as whether or not to use the groff package. When DEFAULT is not specified, 583# --with-groff assumes 'auto'. 584# 585# Interface to module: 586# HAVE_GROFF: used in makefiles to conditionally generate documentation 587# HAVE_GROFF_MM: the memorandum macros (-mm) package 588# HAVE_GROFF_MS: the -ms macros package 589# GROFF: returns the path of the groff program found 590# returns the path set by the user in the environment 591# --with-groff: 'yes' user instructs the module to use groff 592# 'no' user instructs the module not to use groff 593# 594# Added in version 1.9.0: 595# HAVE_GROFF_HTML: groff has dependencies to output HTML format: 596# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package. 597# psselect from the psutils package. 598# the ghostcript package. Refer to the grohtml man pages 599# 600# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path. 601# 602# OS and distros often splits groff in a basic and full package, the former 603# having the groff program and the later having devices, fonts and macros 604# Checking for the groff executable is not enough. 605# 606# If macros are missing, we cannot assume that groff is useless, so we don't 607# unset HAVE_GROFF or GROFF env variables. 608# HAVE_GROFF_?? can never be true while HAVE_GROFF is false. 609# 610AC_DEFUN([XORG_WITH_GROFF],[ 611AC_ARG_VAR([GROFF], [Path to groff command]) 612m4_define([_defopt], m4_default([$1], [auto])) 613AC_ARG_WITH(groff, 614 AS_HELP_STRING([--with-groff], 615 [Use groff to regenerate documentation (default: ]_defopt[)]), 616 [use_groff=$withval], [use_groff=]_defopt) 617m4_undefine([_defopt]) 618 619if test "x$use_groff" = x"auto"; then 620 AC_PATH_PROG([GROFF], [groff]) 621 if test "x$GROFF" = "x"; then 622 AC_MSG_WARN([groff not found - documentation targets will be skipped]) 623 have_groff=no 624 else 625 have_groff=yes 626 fi 627elif test "x$use_groff" = x"yes" ; then 628 AC_PATH_PROG([GROFF], [groff]) 629 if test "x$GROFF" = "x"; then 630 AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH]) 631 fi 632 have_groff=yes 633elif test "x$use_groff" = x"no" ; then 634 if test "x$GROFF" != "x"; then 635 AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified]) 636 fi 637 have_groff=no 638else 639 AC_MSG_ERROR([--with-groff expects 'yes' or 'no']) 640fi 641 642# We have groff, test for the presence of the macro packages 643if test "x$have_groff" = x"yes"; then 644 AC_MSG_CHECKING([for ${GROFF} -ms macros]) 645 if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then 646 groff_ms_works=yes 647 else 648 groff_ms_works=no 649 fi 650 AC_MSG_RESULT([$groff_ms_works]) 651 AC_MSG_CHECKING([for ${GROFF} -mm macros]) 652 if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then 653 groff_mm_works=yes 654 else 655 groff_mm_works=no 656 fi 657 AC_MSG_RESULT([$groff_mm_works]) 658fi 659 660# We have groff, test for HTML dependencies, one command per package 661if test "x$have_groff" = x"yes"; then 662 AC_PATH_PROGS(GS_PATH, [gs gswin32c]) 663 AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng]) 664 AC_PATH_PROG(PSSELECT_PATH, [psselect]) 665 if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then 666 have_groff_html=yes 667 else 668 have_groff_html=no 669 AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages]) 670 fi 671fi 672 673# Set Automake conditionals for Makefiles 674AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes]) 675AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes]) 676AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes]) 677AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) 678]) # XORG_WITH_GROFF 679 680# XORG_WITH_FOP([DEFAULT]) 681# ---------------- 682# Minimum version: 1.6.0 683# Minimum version for optional DEFAULT argument: 1.11.0 684# 685# Documentation tools are not always available on all platforms and sometimes 686# not at the appropriate level. This macro enables a module to test for the 687# presence of the tool and obtain it's path in separate variables. Coupled with 688# the --with-fop option, it allows maximum flexibilty in making decisions 689# as whether or not to use the fop package. When DEFAULT is not specified, 690# --with-fop assumes 'auto'. 691# 692# Interface to module: 693# HAVE_FOP: used in makefiles to conditionally generate documentation 694# FOP: returns the path of the fop program found 695# returns the path set by the user in the environment 696# --with-fop: 'yes' user instructs the module to use fop 697# 'no' user instructs the module not to use fop 698# 699# If the user sets the value of FOP, AC_PATH_PROG skips testing the path. 700# 701AC_DEFUN([XORG_WITH_FOP],[ 702AC_ARG_VAR([FOP], [Path to fop command]) 703m4_define([_defopt], m4_default([$1], [auto])) 704AC_ARG_WITH(fop, 705 AS_HELP_STRING([--with-fop], 706 [Use fop to regenerate documentation (default: ]_defopt[)]), 707 [use_fop=$withval], [use_fop=]_defopt) 708m4_undefine([_defopt]) 709 710if test "x$use_fop" = x"auto"; then 711 AC_PATH_PROG([FOP], [fop]) 712 if test "x$FOP" = "x"; then 713 AC_MSG_WARN([fop not found - documentation targets will be skipped]) 714 have_fop=no 715 else 716 have_fop=yes 717 fi 718elif test "x$use_fop" = x"yes" ; then 719 AC_PATH_PROG([FOP], [fop]) 720 if test "x$FOP" = "x"; then 721 AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH]) 722 fi 723 have_fop=yes 724elif test "x$use_fop" = x"no" ; then 725 if test "x$FOP" != "x"; then 726 AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified]) 727 fi 728 have_fop=no 729else 730 AC_MSG_ERROR([--with-fop expects 'yes' or 'no']) 731fi 732AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) 733]) # XORG_WITH_FOP 734 735# XORG_WITH_PS2PDF([DEFAULT]) 736# ---------------- 737# Minimum version: 1.6.0 738# Minimum version for optional DEFAULT argument: 1.11.0 739# 740# Documentation tools are not always available on all platforms and sometimes 741# not at the appropriate level. This macro enables a module to test for the 742# presence of the tool and obtain it's path in separate variables. Coupled with 743# the --with-ps2pdf option, it allows maximum flexibilty in making decisions 744# as whether or not to use the ps2pdf package. When DEFAULT is not specified, 745# --with-ps2pdf assumes 'auto'. 746# 747# Interface to module: 748# HAVE_PS2PDF: used in makefiles to conditionally generate documentation 749# PS2PDF: returns the path of the ps2pdf program found 750# returns the path set by the user in the environment 751# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf 752# 'no' user instructs the module not to use ps2pdf 753# 754# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path. 755# 756AC_DEFUN([XORG_WITH_PS2PDF],[ 757AC_ARG_VAR([PS2PDF], [Path to ps2pdf command]) 758m4_define([_defopt], m4_default([$1], [auto])) 759AC_ARG_WITH(ps2pdf, 760 AS_HELP_STRING([--with-ps2pdf], 761 [Use ps2pdf to regenerate documentation (default: ]_defopt[)]), 762 [use_ps2pdf=$withval], [use_ps2pdf=]_defopt) 763m4_undefine([_defopt]) 764 765if test "x$use_ps2pdf" = x"auto"; then 766 AC_PATH_PROG([PS2PDF], [ps2pdf]) 767 if test "x$PS2PDF" = "x"; then 768 AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped]) 769 have_ps2pdf=no 770 else 771 have_ps2pdf=yes 772 fi 773elif test "x$use_ps2pdf" = x"yes" ; then 774 AC_PATH_PROG([PS2PDF], [ps2pdf]) 775 if test "x$PS2PDF" = "x"; then 776 AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH]) 777 fi 778 have_ps2pdf=yes 779elif test "x$use_ps2pdf" = x"no" ; then 780 if test "x$PS2PDF" != "x"; then 781 AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified]) 782 fi 783 have_ps2pdf=no 784else 785 AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no']) 786fi 787AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes]) 788]) # XORG_WITH_PS2PDF 789 790# XORG_ENABLE_DOCS (enable_docs=yes) 791# ---------------- 792# Minimum version: 1.6.0 793# 794# Documentation tools are not always available on all platforms and sometimes 795# not at the appropriate level. This macro enables a builder to skip all 796# documentation targets except traditional man pages. 797# Combined with the specific tool checking macros XORG_WITH_*, it provides 798# maximum flexibilty in controlling documentation building. 799# Refer to: 800# XORG_WITH_XMLTO --with-xmlto 801# XORG_WITH_ASCIIDOC --with-asciidoc 802# XORG_WITH_DOXYGEN --with-doxygen 803# XORG_WITH_FOP --with-fop 804# XORG_WITH_GROFF --with-groff 805# XORG_WITH_PS2PDF --with-ps2pdf 806# 807# Interface to module: 808# ENABLE_DOCS: used in makefiles to conditionally generate documentation 809# --enable-docs: 'yes' user instructs the module to generate docs 810# 'no' user instructs the module not to generate docs 811# parm1: specify the default value, yes or no. 812# 813AC_DEFUN([XORG_ENABLE_DOCS],[ 814m4_define([default], m4_default([$1], [yes])) 815AC_ARG_ENABLE(docs, 816 AS_HELP_STRING([--enable-docs], 817 [Enable building the documentation (default: ]default[)]), 818 [build_docs=$enableval], [build_docs=]default) 819m4_undefine([default]) 820AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes]) 821AC_MSG_CHECKING([whether to build documentation]) 822AC_MSG_RESULT([$build_docs]) 823]) # XORG_ENABLE_DOCS 824 825# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes) 826# ---------------- 827# Minimum version: 1.6.0 828# 829# This macro enables a builder to skip all developer documentation. 830# Combined with the specific tool checking macros XORG_WITH_*, it provides 831# maximum flexibilty in controlling documentation building. 832# Refer to: 833# XORG_WITH_XMLTO --with-xmlto 834# XORG_WITH_ASCIIDOC --with-asciidoc 835# XORG_WITH_DOXYGEN --with-doxygen 836# XORG_WITH_FOP --with-fop 837# XORG_WITH_GROFF --with-groff 838# XORG_WITH_PS2PDF --with-ps2pdf 839# 840# Interface to module: 841# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs 842# --enable-devel-docs: 'yes' user instructs the module to generate developer docs 843# 'no' user instructs the module not to generate developer docs 844# parm1: specify the default value, yes or no. 845# 846AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[ 847m4_define([devel_default], m4_default([$1], [yes])) 848AC_ARG_ENABLE(devel-docs, 849 AS_HELP_STRING([--enable-devel-docs], 850 [Enable building the developer documentation (default: ]devel_default[)]), 851 [build_devel_docs=$enableval], [build_devel_docs=]devel_default) 852m4_undefine([devel_default]) 853AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes]) 854AC_MSG_CHECKING([whether to build developer documentation]) 855AC_MSG_RESULT([$build_devel_docs]) 856]) # XORG_ENABLE_DEVEL_DOCS 857 858# XORG_ENABLE_SPECS (enable_specs=yes) 859# ---------------- 860# Minimum version: 1.6.0 861# 862# This macro enables a builder to skip all functional specification targets. 863# Combined with the specific tool checking macros XORG_WITH_*, it provides 864# maximum flexibilty in controlling documentation building. 865# Refer to: 866# XORG_WITH_XMLTO --with-xmlto 867# XORG_WITH_ASCIIDOC --with-asciidoc 868# XORG_WITH_DOXYGEN --with-doxygen 869# XORG_WITH_FOP --with-fop 870# XORG_WITH_GROFF --with-groff 871# XORG_WITH_PS2PDF --with-ps2pdf 872# 873# Interface to module: 874# ENABLE_SPECS: used in makefiles to conditionally generate specs 875# --enable-specs: 'yes' user instructs the module to generate specs 876# 'no' user instructs the module not to generate specs 877# parm1: specify the default value, yes or no. 878# 879AC_DEFUN([XORG_ENABLE_SPECS],[ 880m4_define([spec_default], m4_default([$1], [yes])) 881AC_ARG_ENABLE(specs, 882 AS_HELP_STRING([--enable-specs], 883 [Enable building the specs (default: ]spec_default[)]), 884 [build_specs=$enableval], [build_specs=]spec_default) 885m4_undefine([spec_default]) 886AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes]) 887AC_MSG_CHECKING([whether to build functional specifications]) 888AC_MSG_RESULT([$build_specs]) 889]) # XORG_ENABLE_SPECS 890 891# XORG_CHECK_MALLOC_ZERO 892# ---------------------- 893# Minimum version: 1.0.0 894# 895# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if 896# malloc(0) returns NULL. Packages should add one of these cflags to 897# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. 898AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ 899AC_ARG_ENABLE(malloc0returnsnull, 900 AS_HELP_STRING([--enable-malloc0returnsnull], 901 [malloc(0) returns NULL (default: auto)]), 902 [MALLOC_ZERO_RETURNS_NULL=$enableval], 903 [MALLOC_ZERO_RETURNS_NULL=auto]) 904 905AC_MSG_CHECKING([whether malloc(0) returns NULL]) 906if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then 907 AC_RUN_IFELSE([ 908char *malloc(); 909char *realloc(); 910char *calloc(); 911main() { 912 char *m0, *r0, *c0, *p; 913 m0 = malloc(0); 914 p = malloc(10); 915 r0 = realloc(p,0); 916 c0 = calloc(0); 917 exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1); 918}], 919 [MALLOC_ZERO_RETURNS_NULL=yes], 920 [MALLOC_ZERO_RETURNS_NULL=no], 921 [MALLOC_ZERO_RETURNS_NULL=yes]) 922fi 923AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) 924 925if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then 926 MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" 927 XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS 928 XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" 929else 930 MALLOC_ZERO_CFLAGS="" 931 XMALLOC_ZERO_CFLAGS="" 932 XTMALLOC_ZERO_CFLAGS="" 933fi 934 935AC_SUBST([MALLOC_ZERO_CFLAGS]) 936AC_SUBST([XMALLOC_ZERO_CFLAGS]) 937AC_SUBST([XTMALLOC_ZERO_CFLAGS]) 938]) # XORG_CHECK_MALLOC_ZERO 939 940# XORG_WITH_LINT() 941# ---------------- 942# Minimum version: 1.1.0 943# 944# This macro enables the use of a tool that flags some suspicious and 945# non-portable constructs (likely to be bugs) in C language source code. 946# It will attempt to locate the tool and use appropriate options. 947# There are various lint type tools on different platforms. 948# 949# Interface to module: 950# LINT: returns the path to the tool found on the platform 951# or the value set to LINT on the configure cmd line 952# also an Automake conditional 953# LINT_FLAGS: an Automake variable with appropriate flags 954# 955# --with-lint: 'yes' user instructs the module to use lint 956# 'no' user instructs the module not to use lint (default) 957# 958# If the user sets the value of LINT, AC_PATH_PROG skips testing the path. 959# If the user sets the value of LINT_FLAGS, they are used verbatim. 960# 961AC_DEFUN([XORG_WITH_LINT],[ 962 963AC_ARG_VAR([LINT], [Path to a lint-style command]) 964AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command]) 965AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint], 966 [Use a lint-style source code checker (default: disabled)])], 967 [use_lint=$withval], [use_lint=no]) 968 969# Obtain platform specific info like program name and options 970# The lint program on FreeBSD and NetBSD is different from the one on Solaris 971case $host_os in 972 *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*) 973 lint_name=splint 974 lint_options="-badflag" 975 ;; 976 *freebsd* | *netbsd*) 977 lint_name=lint 978 lint_options="-u -b" 979 ;; 980 *solaris*) 981 lint_name=lint 982 lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2" 983 ;; 984esac 985 986# Test for the presence of the program (either guessed by the code or spelled out by the user) 987if test "x$use_lint" = x"yes" ; then 988 AC_PATH_PROG([LINT], [$lint_name]) 989 if test "x$LINT" = "x"; then 990 AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH]) 991 fi 992elif test "x$use_lint" = x"no" ; then 993 if test "x$LINT" != "x"; then 994 AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified]) 995 fi 996else 997 AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.]) 998fi 999 1000# User supplied flags override default flags 1001if test "x$LINT_FLAGS" != "x"; then 1002 lint_options=$LINT_FLAGS 1003fi 1004 1005AC_SUBST([LINT_FLAGS],[$lint_options]) 1006AM_CONDITIONAL(LINT, [test "x$LINT" != x]) 1007 1008]) # XORG_WITH_LINT 1009 1010# XORG_LINT_LIBRARY(LIBNAME) 1011# -------------------------- 1012# Minimum version: 1.1.0 1013# 1014# Sets up flags for building lint libraries for checking programs that call 1015# functions in the library. 1016# 1017# Interface to module: 1018# LINTLIB - Automake variable with the name of lint library file to make 1019# MAKE_LINT_LIB - Automake conditional 1020# 1021# --enable-lint-library: - 'yes' user instructs the module to created a lint library 1022# - 'no' user instructs the module not to create a lint library (default) 1023 1024AC_DEFUN([XORG_LINT_LIBRARY],[ 1025AC_REQUIRE([XORG_WITH_LINT]) 1026AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library], 1027 [Create lint library (default: disabled)])], 1028 [make_lint_lib=$enableval], [make_lint_lib=no]) 1029 1030if test "x$make_lint_lib" = x"yes" ; then 1031 LINTLIB=llib-l$1.ln 1032 if test "x$LINT" = "x"; then 1033 AC_MSG_ERROR([Cannot make lint library without --with-lint]) 1034 fi 1035elif test "x$make_lint_lib" != x"no" ; then 1036 AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.]) 1037fi 1038 1039AC_SUBST(LINTLIB) 1040AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) 1041 1042]) # XORG_LINT_LIBRARY 1043 1044# XORG_CWARNFLAGS 1045# --------------- 1046# Minimum version: 1.2.0 1047# 1048# Defines CWARNFLAGS to enable C compiler warnings. 1049# 1050AC_DEFUN([XORG_CWARNFLAGS], [ 1051AC_REQUIRE([AC_PROG_CC_C99]) 1052if test "x$GCC" = xyes ; then 1053 CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ 1054-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ 1055-Wbad-function-cast -Wformat=2" 1056 case `$CC -dumpversion` in 1057 3.4.* | 4.*) 1058 CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement" 1059 ;; 1060 esac 1061else 1062 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) 1063 if test "x$SUNCC" = "xyes"; then 1064 CWARNFLAGS="-v" 1065 fi 1066fi 1067AC_SUBST(CWARNFLAGS) 1068]) # XORG_CWARNFLAGS 1069 1070# XORG_STRICT_OPTION 1071# ----------------------- 1072# Minimum version: 1.3.0 1073# 1074# Add configure option to enable strict compilation 1075AC_DEFUN([XORG_STRICT_OPTION], [ 1076# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89 1077AC_REQUIRE([AC_PROG_CC_C99]) 1078AC_REQUIRE([XORG_CWARNFLAGS]) 1079 1080AC_ARG_ENABLE(strict-compilation, 1081 AS_HELP_STRING([--enable-strict-compilation], 1082 [Enable all warnings from compiler and make them errors (default: disabled)]), 1083 [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) 1084if test "x$STRICT_COMPILE" = "xyes"; then 1085 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) 1086 AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) 1087 if test "x$GCC" = xyes ; then 1088 STRICT_CFLAGS="-pedantic -Werror" 1089 elif test "x$SUNCC" = "xyes"; then 1090 STRICT_CFLAGS="-errwarn" 1091 elif test "x$INTELCC" = "xyes"; then 1092 STRICT_CFLAGS="-Werror" 1093 fi 1094fi 1095CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" 1096AC_SUBST([CWARNFLAGS]) 1097]) # XORG_STRICT_OPTION 1098 1099# XORG_DEFAULT_OPTIONS 1100# -------------------- 1101# Minimum version: 1.3.0 1102# 1103# Defines default options for X.Org modules. 1104# 1105AC_DEFUN([XORG_DEFAULT_OPTIONS], [ 1106AC_REQUIRE([AC_PROG_INSTALL]) 1107XORG_CWARNFLAGS 1108XORG_STRICT_OPTION 1109XORG_RELEASE_VERSION 1110XORG_CHANGELOG 1111XORG_INSTALL 1112XORG_MANPAGE_SECTIONS 1113m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], 1114 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) 1115]) # XORG_DEFAULT_OPTIONS 1116 1117# XORG_INSTALL() 1118# ---------------- 1119# Minimum version: 1.4.0 1120# 1121# Defines the variable INSTALL_CMD as the command to copy 1122# INSTALL from $prefix/share/util-macros. 1123# 1124AC_DEFUN([XORG_INSTALL], [ 1125AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 1126macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` 1127INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ 1128mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ 1129|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \ 1130echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)" 1131AC_SUBST([INSTALL_CMD]) 1132]) # XORG_INSTALL 1133