4 +dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
6 +dnl Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
8 +dnl Permission is hereby granted, free of charge, to any person obtaining a
9 +dnl copy of this software and associated documentation files (the
10 +dnl "Software"), to deal in the Software without restriction, including
11 +dnl without limitation the rights to use, copy, modify, merge, publish,
12 +dnl distribute, and/or sell copies of the Software, and to permit persons
13 +dnl to whom the Software is furnished to do so, provided that the above
14 +dnl copyright notice(s) and this permission notice appear in all copies of
15 +dnl the Software and that both the above copyright notice(s) and this
16 +dnl permission notice appear in supporting documentation.
18 +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
21 +dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22 +dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
23 +dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
24 +dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
25 +dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
26 +dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28 +dnl Except as contained in this notice, the name of a copyright holder
29 +dnl shall not be used in advertising or otherwise to promote the sale, use
30 +dnl or other dealings in this Software without prior written authorization
31 +dnl of the copyright holder.
33 +# XORG_MACROS_VERSION(required-version)
34 +# -------------------------------------
35 +# Minimum version: 1.1.0
37 +# If you're using a macro added in Version 1.1 or newer, include this in
38 +# your configure.ac with the minimum required version, such as:
39 +# XORG_MACROS_VERSION(1.1)
41 +# To ensure that this macro is defined, also add:
42 +# m4_ifndef([XORG_MACROS_VERSION],
43 +# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
46 +# See the "minimum version" comment for each macro you use to see what
47 +# version you require.
48 +m4_defun([XORG_MACROS_VERSION],[
49 +m4_define([vers_have], [1.2.2])
50 +m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
51 +m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
52 +m4_if(m4_cmp(maj_have, maj_needed), 0,,
53 + [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
54 +m4_if(m4_version_compare(vers_have, [$1]), -1,
55 + [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
56 +m4_undefine([vers_have])
57 +m4_undefine([maj_have])
58 +m4_undefine([maj_needed])
59 +]) # XORG_MACROS_VERSION
63 +# Minimum version: 1.0.0
65 +# Find cpp program and necessary flags for use in pre-processing text files
66 +# such as man pages and config files
67 +AC_DEFUN([XORG_PROG_RAWCPP],[
68 +AC_REQUIRE([AC_PROG_CPP])
69 +AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
70 + [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
72 +# Check for flag to avoid builtin definitions - assumes unix is predefined,
73 +# which is not the best choice for supporting other OS'es, but covers most
74 +# of the ones we need for now.
75 +AC_MSG_CHECKING([if $RAWCPP requires -undef])
76 +AC_LANG_CONFTEST([Does cpp redefine unix ?])
77 +if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
80 + if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
82 + AC_MSG_RESULT([yes])
83 + # under Cygwin unix is still defined even with -undef
84 + elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
85 + RAWCPPFLAGS="-undef -ansi"
86 + AC_MSG_RESULT([yes, with -ansi])
88 + AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.])
91 +rm -f conftest.$ac_ext
93 +AC_MSG_CHECKING([if $RAWCPP requires -traditional])
94 +AC_LANG_CONFTEST([Does cpp preserve "whitespace"?])
95 +if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
98 + if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
99 + RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
100 + AC_MSG_RESULT([yes])
102 + AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.])
105 +rm -f conftest.$ac_ext
106 +AC_SUBST(RAWCPPFLAGS)
107 +]) # XORG_PROG_RAWCPP
109 +# XORG_MANPAGE_SECTIONS()
110 +# -----------------------
111 +# Minimum version: 1.0.0
113 +# Determine which sections man pages go in for the different man page types
114 +# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
115 +# Not sure if there's any better way than just hardcoding by OS name.
116 +# Override default settings by setting environment variables
118 +AC_DEFUN([XORG_MANPAGE_SECTIONS],[
119 +AC_REQUIRE([AC_CANONICAL_HOST])
121 +if test x$APP_MAN_SUFFIX = x ; then
124 +if test x$APP_MAN_DIR = x ; then
125 + APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
128 +if test x$LIB_MAN_SUFFIX = x ; then
131 +if test x$LIB_MAN_DIR = x ; then
132 + LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
135 +if test x$FILE_MAN_SUFFIX = x ; then
137 + solaris*) FILE_MAN_SUFFIX=4 ;;
138 + *) FILE_MAN_SUFFIX=5 ;;
141 +if test x$FILE_MAN_DIR = x ; then
142 + FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
145 +if test x$MISC_MAN_SUFFIX = x ; then
147 + solaris*) MISC_MAN_SUFFIX=5 ;;
148 + *) MISC_MAN_SUFFIX=7 ;;
151 +if test x$MISC_MAN_DIR = x ; then
152 + MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
155 +if test x$DRIVER_MAN_SUFFIX = x ; then
157 + solaris*) DRIVER_MAN_SUFFIX=7 ;;
158 + *) DRIVER_MAN_SUFFIX=4 ;;
161 +if test x$DRIVER_MAN_DIR = x ; then
162 + DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
165 +if test x$ADMIN_MAN_SUFFIX = x ; then
167 + solaris*) ADMIN_MAN_SUFFIX=1m ;;
168 + *) ADMIN_MAN_SUFFIX=8 ;;
171 +if test x$ADMIN_MAN_DIR = x ; then
172 + ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
176 +AC_SUBST([APP_MAN_SUFFIX])
177 +AC_SUBST([LIB_MAN_SUFFIX])
178 +AC_SUBST([FILE_MAN_SUFFIX])
179 +AC_SUBST([MISC_MAN_SUFFIX])
180 +AC_SUBST([DRIVER_MAN_SUFFIX])
181 +AC_SUBST([ADMIN_MAN_SUFFIX])
182 +AC_SUBST([APP_MAN_DIR])
183 +AC_SUBST([LIB_MAN_DIR])
184 +AC_SUBST([FILE_MAN_DIR])
185 +AC_SUBST([MISC_MAN_DIR])
186 +AC_SUBST([DRIVER_MAN_DIR])
187 +AC_SUBST([ADMIN_MAN_DIR])
188 +]) # XORG_MANPAGE_SECTIONS
190 +# XORG_CHECK_LINUXDOC
191 +# -------------------
192 +# Minimum version: 1.0.0
194 +# Defines the variable MAKE_TEXT if the necessary tools and
195 +# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
196 +# Whether or not the necessary tools and files are found can be checked
197 +# with the AM_CONDITIONAL "BUILD_LINUXDOC"
198 +AC_DEFUN([XORG_CHECK_LINUXDOC],[
199 +if test x$XORG_SGML_PATH = x ; then
200 + XORG_SGML_PATH=$prefix/share/sgml
204 +if test x"$cross_compiling" = x"yes" ; then
207 + AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
210 +AC_PATH_PROG(LINUXDOC, linuxdoc)
211 +AC_PATH_PROG(PS2PDF, ps2pdf)
213 +AC_MSG_CHECKING([Whether to build documentation])
215 +if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
221 +AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
223 +AC_MSG_RESULT([$BUILDDOC])
225 +AC_MSG_CHECKING([Whether to build pdf documentation])
227 +if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
233 +AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
235 +AC_MSG_RESULT([$BUILDPDFDOC])
237 +MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
238 +MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
240 +MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0"
246 +]) # XORG_CHECK_LINUXDOC
248 +# XORG_CHECK_DOCBOOK
249 +# -------------------
250 +# Minimum version: 1.0.0
252 +# Checks for the ability to build output formats from SGML DocBook source.
253 +# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
254 +# indicates whether the necessary tools and files are found and, if set,
255 +# $(MAKE_XXX) blah.sgml will produce blah.xxx.
256 +AC_DEFUN([XORG_CHECK_DOCBOOK],[
257 +if test x$XORG_SGML_PATH = x ; then
258 + XORG_SGML_PATH=$prefix/share/sgml
266 +AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
268 +AC_PATH_PROG(DOCBOOKPS, docbook2ps)
269 +AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
270 +AC_PATH_PROG(DOCBOOKHTML, docbook2html)
271 +AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
273 +AC_MSG_CHECKING([Whether to build text documentation])
274 +if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
275 + test x$BUILD_TXTDOC != xno; then
278 +AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
279 +AC_MSG_RESULT([$BUILDTXTDOC])
281 +AC_MSG_CHECKING([Whether to build PDF documentation])
282 +if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
283 + test x$BUILD_PDFDOC != xno; then
286 +AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
287 +AC_MSG_RESULT([$BUILDPDFDOC])
289 +AC_MSG_CHECKING([Whether to build PostScript documentation])
290 +if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
291 + test x$BUILD_PSDOC != xno; then
294 +AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
295 +AC_MSG_RESULT([$BUILDPSDOC])
297 +AC_MSG_CHECKING([Whether to build HTML documentation])
298 +if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
299 + test x$BUILD_HTMLDOC != xno; then
302 +AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
303 +AC_MSG_RESULT([$BUILDHTMLDOC])
305 +MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
306 +MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
307 +MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
308 +MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
314 +]) # XORG_CHECK_DOCBOOK
316 +# XORG_CHECK_MALLOC_ZERO
317 +# ----------------------
318 +# Minimum version: 1.0.0
320 +# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
321 +# malloc(0) returns NULL. Packages should add one of these cflags to
322 +# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
323 +AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
324 +AC_ARG_ENABLE(malloc0returnsnull,
325 + AC_HELP_STRING([--enable-malloc0returnsnull],
326 + [malloc(0) returns NULL (default: auto)]),
327 + [MALLOC_ZERO_RETURNS_NULL=$enableval],
328 + [MALLOC_ZERO_RETURNS_NULL=auto])
330 +AC_MSG_CHECKING([whether malloc(0) returns NULL])
331 +if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
337 + char *m0, *r0, *c0, *p;
342 + exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
344 + [MALLOC_ZERO_RETURNS_NULL=yes],
345 + [MALLOC_ZERO_RETURNS_NULL=no])
347 +AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
349 +if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
350 + MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
351 + XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
352 + XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
354 + MALLOC_ZERO_CFLAGS=""
355 + XMALLOC_ZERO_CFLAGS=""
356 + XTMALLOC_ZERO_CFLAGS=""
359 +AC_SUBST([MALLOC_ZERO_CFLAGS])
360 +AC_SUBST([XMALLOC_ZERO_CFLAGS])
361 +AC_SUBST([XTMALLOC_ZERO_CFLAGS])
362 +]) # XORG_CHECK_MALLOC_ZERO
366 +# Minimum version: 1.1.0
368 +# Sets up flags for source checkers such as lint and sparse if --with-lint
369 +# is specified. (Use --with-lint=sparse for sparse.)
370 +# Sets $LINT to name of source checker passed with --with-lint (default: lint)
371 +# Sets $LINT_FLAGS to flags to pass to source checker
372 +# Sets LINT automake conditional if enabled (default: disabled)
374 +AC_DEFUN([XORG_WITH_LINT],[
376 +# Allow checking code with lint, sparse, etc.
377 +AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
378 + [Use a lint-style source code checker (default: disabled)])],
379 + [use_lint=$withval], [use_lint=no])
380 +if test "x$use_lint" = "xyes" ; then
385 +if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
390 + LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
398 +AC_SUBST(LINT_FLAGS)
399 +AM_CONDITIONAL(LINT, [test x$LINT != xno])
403 +# XORG_LINT_LIBRARY(LIBNAME)
404 +# --------------------------
405 +# Minimum version: 1.1.0
407 +# Sets up flags for building lint libraries for checking programs that call
408 +# functions in the library.
409 +# Disabled by default, enable with --enable-lint-library
411 +# @LINTLIB@ - name of lint library file to make
412 +# MAKE_LINT_LIB - automake conditional
415 +AC_DEFUN([XORG_LINT_LIBRARY],[
416 +AC_REQUIRE([XORG_WITH_LINT])
417 +# Build lint "library" for more indepth checks of programs calling this library
418 +AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
419 + [Create lint library (default: disabled)])],
420 + [make_lint_lib=$enableval], [make_lint_lib=no])
421 +if test "x$make_lint_lib" != "xno" ; then
422 + if test "x$LINT" = "xno" ; then
423 + AC_MSG_ERROR([Cannot make lint library without --with-lint])
425 + if test "x$make_lint_lib" = "xyes" ; then
426 + LINTLIB=llib-l$1.ln
428 + LINTLIB=$make_lint_lib
432 +AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
434 +]) # XORG_LINT_LIBRARY
438 +# Minimum version: 1.2.0
440 +# Defines CWARNFLAGS to enable C compiler warnings.
442 +AC_DEFUN([XORG_CWARNFLAGS], [
443 +AC_REQUIRE([AC_PROG_CC])
444 +if test "x$GCC" = xyes ; then
445 + CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
446 +-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
447 +-Wbad-function-cast"
448 + case `$CC -dumpversion` in
450 + CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
454 + AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
455 + if test "x$SUNCC" = "xyes"; then
459 +AC_SUBST(CWARNFLAGS)
460 +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
461 +]) # XORG_CWARNFLAGS
462 +dnl Copyright 2005 Red Hat, Inc
464 +dnl Permission to use, copy, modify, distribute, and sell this software and its
465 +dnl documentation for any purpose is hereby granted without fee, provided that
466 +dnl the above copyright notice appear in all copies and that both that
467 +dnl copyright notice and this permission notice appear in supporting
470 +dnl The above copyright notice and this permission notice shall be included
471 +dnl in all copies or substantial portions of the Software.
473 +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
474 +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
475 +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
476 +dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
477 +dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
478 +dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
479 +dnl OTHER DEALINGS IN THE SOFTWARE.
481 +dnl Except as contained in this notice, the name of the copyright holders shall
482 +dnl not be used in advertising or otherwise to promote the sale, use or
483 +dnl other dealings in this Software without prior written authorization
484 +dnl from the copyright holders.
487 +# XORG_RELEASE_VERSION
488 +# --------------------
489 +# Adds --with/without-release-string and changes the PACKAGE and
490 +# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION". If
491 +# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged. Also
492 +# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
494 +AC_DEFUN([XORG_RELEASE_VERSION],[
495 + AC_ARG_WITH(release-version,
496 + AC_HELP_STRING([--with-release-version=STRING],
497 + [Use release version string in package name]),
498 + [RELEASE_VERSION="$withval"],
499 + [RELEASE_VERSION=""])
500 + if test "x$RELEASE_VERSION" != "x"; then
501 + PACKAGE="$PACKAGE-$RELEASE_VERSION"
502 + PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
503 + AC_MSG_NOTICE([Building with package name set to $PACKAGE])
505 + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
506 + [`echo $PACKAGE_VERSION | cut -d . -f 1`],
507 + [Major version of this package])
508 + PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
509 + if test "x$PVM" = "x"; then
512 + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
514 + [Minor version of this package])
515 + PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
516 + if test "x$PVP" = "x"; then
519 + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
521 + [Patch version of this package])
526 +# Minimum version: 1.2.0
528 +# Defines the variable CHANGELOG_CMD as the command to generate
529 +# ChangeLog from git.
531 +# Arrange that distcleancheck ignores ChangeLog left over by distclean.
533 +AC_DEFUN([XORG_CHANGELOG], [
534 +CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \
535 +mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \
536 +echo 'git directory not found: installing possibly empty changelog.' >&2)"
537 +AC_SUBST([CHANGELOG_CMD])
538 +AC_SUBST([distcleancheck_listfiles], ['find . -type f ! -name ChangeLog -print'])