aclocal.m4 revision 83d7c197
1# generated automatically by aclocal 1.10 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005, 2006  Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14m4_if(m4_PACKAGE_VERSION, [2.61],,
15[m4_fatal([this file was generated for autoconf 2.61.
16You have another version of autoconf.  If you want to use that,
17you should regenerate the build system entirely.], [63])])
18
19dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
20dnl
21dnl Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
22dnl 
23dnl Permission is hereby granted, free of charge, to any person obtaining a
24dnl copy of this software and associated documentation files (the
25dnl "Software"), to deal in the Software without restriction, including
26dnl without limitation the rights to use, copy, modify, merge, publish,
27dnl distribute, and/or sell copies of the Software, and to permit persons
28dnl to whom the Software is furnished to do so, provided that the above
29dnl copyright notice(s) and this permission notice appear in all copies of
30dnl the Software and that both the above copyright notice(s) and this
31dnl permission notice appear in supporting documentation.
32dnl
33dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
34dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
35dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
36dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
37dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
38dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
39dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
40dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
41dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
42dnl
43dnl Except as contained in this notice, the name of a copyright holder
44dnl shall not be used in advertising or otherwise to promote the sale, use
45dnl or other dealings in this Software without prior written authorization
46dnl of the copyright holder.
47
48# XORG_MACROS_VERSION(required-version)
49# -------------------------------------
50# Minimum version: 1.1.0
51#
52# If you're using a macro added in Version 1.1 or newer, include this in
53# your configure.ac with the minimum required version, such as:
54# XORG_MACROS_VERSION(1.1)
55#
56# To force at least a version with this macro defined, also add:
57# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
58#
59#
60# See the "minimum version" comment for each macro you use to see what 
61# version you require.
62AC_DEFUN([XORG_MACROS_VERSION],[
63	[XORG_MACROS_needed_version=$1
64	XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
65	XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
66	AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}])
67	[XORG_MACROS_version=1.2.1
68	XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
69	XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
70	if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
71		AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x])
72	fi
73	if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then
74		AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer])
75	fi
76	AC_MSG_RESULT([yes, $XORG_MACROS_version])
77]) # XORG_MACROS_VERSION
78
79# XORG_PROG_RAWCPP()
80# ------------------
81# Minimum version: 1.0.0
82#
83# Find cpp program and necessary flags for use in pre-processing text files
84# such as man pages and config files
85AC_DEFUN([XORG_PROG_RAWCPP],[
86AC_REQUIRE([AC_PROG_CPP])
87AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
88   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
89
90# Check for flag to avoid builtin definitions - assumes unix is predefined,
91# which is not the best choice for supporting other OS'es, but covers most
92# of the ones we need for now.
93AC_MSG_CHECKING([if $RAWCPP requires -undef])
94AC_LANG_CONFTEST([Does cpp redefine unix ?])
95if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
96	AC_MSG_RESULT([no])
97else
98	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
99		RAWCPPFLAGS=-undef
100		AC_MSG_RESULT([yes])
101	# under Cygwin unix is still defined even with -undef
102	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
103		RAWCPPFLAGS="-undef -ansi"
104		AC_MSG_RESULT([yes, with -ansi])
105	else
106		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
107	fi
108fi
109rm -f conftest.$ac_ext
110
111AC_MSG_CHECKING([if $RAWCPP requires -traditional])
112AC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
113if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
114	AC_MSG_RESULT([no])
115else
116	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
117		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
118		AC_MSG_RESULT([yes])
119	else
120		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
121	fi
122fi
123rm -f conftest.$ac_ext
124AC_SUBST(RAWCPPFLAGS)
125]) # XORG_PROG_RAWCPP
126
127# XORG_MANPAGE_SECTIONS()
128# -----------------------
129# Minimum version: 1.0.0
130#
131# Determine which sections man pages go in for the different man page types
132# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
133# Not sure if there's any better way than just hardcoding by OS name.
134# Override default settings by setting environment variables
135
136AC_DEFUN([XORG_MANPAGE_SECTIONS],[
137AC_REQUIRE([AC_CANONICAL_HOST])
138
139if test x$APP_MAN_SUFFIX = x    ; then
140    APP_MAN_SUFFIX=1
141fi
142if test x$APP_MAN_DIR = x    ; then
143    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
144fi
145
146if test x$LIB_MAN_SUFFIX = x    ; then
147    LIB_MAN_SUFFIX=3
148fi
149if test x$LIB_MAN_DIR = x    ; then
150    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
151fi
152
153if test x$FILE_MAN_SUFFIX = x    ; then
154    case $host_os in
155	solaris*)	FILE_MAN_SUFFIX=4  ;;
156	*)		FILE_MAN_SUFFIX=5  ;;
157    esac
158fi
159if test x$FILE_MAN_DIR = x    ; then
160    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
161fi
162
163if test x$MISC_MAN_SUFFIX = x    ; then
164    case $host_os in
165	solaris*)	MISC_MAN_SUFFIX=5  ;;
166	*)		MISC_MAN_SUFFIX=7  ;;
167    esac
168fi
169if test x$MISC_MAN_DIR = x    ; then
170    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
171fi
172
173if test x$DRIVER_MAN_SUFFIX = x    ; then
174    case $host_os in
175	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
176	*)		DRIVER_MAN_SUFFIX=4  ;;
177    esac
178fi
179if test x$DRIVER_MAN_DIR = x    ; then
180    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
181fi
182
183if test x$ADMIN_MAN_SUFFIX = x    ; then
184    case $host_os in
185	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
186	*)		ADMIN_MAN_SUFFIX=8  ;;
187    esac
188fi
189if test x$ADMIN_MAN_DIR = x    ; then
190    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
191fi
192
193
194AC_SUBST([APP_MAN_SUFFIX])
195AC_SUBST([LIB_MAN_SUFFIX])
196AC_SUBST([FILE_MAN_SUFFIX])
197AC_SUBST([MISC_MAN_SUFFIX])
198AC_SUBST([DRIVER_MAN_SUFFIX])
199AC_SUBST([ADMIN_MAN_SUFFIX])
200AC_SUBST([APP_MAN_DIR])
201AC_SUBST([LIB_MAN_DIR])
202AC_SUBST([FILE_MAN_DIR])
203AC_SUBST([MISC_MAN_DIR])
204AC_SUBST([DRIVER_MAN_DIR])
205AC_SUBST([ADMIN_MAN_DIR])
206]) # XORG_MANPAGE_SECTIONS
207
208# XORG_CHECK_LINUXDOC
209# -------------------
210# Minimum version: 1.0.0
211#
212# Defines the variable MAKE_TEXT if the necessary tools and
213# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
214# Whether or not the necessary tools and files are found can be checked
215# with the AM_CONDITIONAL "BUILD_LINUXDOC"
216AC_DEFUN([XORG_CHECK_LINUXDOC],[
217if test x$XORG_SGML_PATH = x ; then
218    XORG_SGML_PATH=$prefix/share/sgml
219fi
220HAVE_DEFS_ENT=
221
222if test x"$cross_compiling" = x"yes" ; then
223  HAVE_DEFS_ENT=no
224else
225  AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
226fi
227
228AC_PATH_PROG(LINUXDOC, linuxdoc)
229AC_PATH_PROG(PS2PDF, ps2pdf)
230
231AC_MSG_CHECKING([Whether to build documentation])
232
233if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
234   BUILDDOC=yes
235else
236   BUILDDOC=no
237fi
238
239AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
240
241AC_MSG_RESULT([$BUILDDOC])
242
243AC_MSG_CHECKING([Whether to build pdf documentation])
244
245if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
246   BUILDPDFDOC=yes
247else
248   BUILDPDFDOC=no
249fi
250
251AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
252
253AC_MSG_RESULT([$BUILDPDFDOC])
254
255MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
256MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
257MAKE_PDF="$PS2PDF"
258MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
259
260AC_SUBST(MAKE_TEXT)
261AC_SUBST(MAKE_PS)
262AC_SUBST(MAKE_PDF)
263AC_SUBST(MAKE_HTML)
264]) # XORG_CHECK_LINUXDOC
265
266# XORG_CHECK_DOCBOOK
267# -------------------
268# Minimum version: 1.0.0
269#
270# Checks for the ability to build output formats from SGML DocBook source.
271# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
272# indicates whether the necessary tools and files are found and, if set,
273# $(MAKE_XXX) blah.sgml will produce blah.xxx.
274AC_DEFUN([XORG_CHECK_DOCBOOK],[
275if test x$XORG_SGML_PATH = x ; then
276    XORG_SGML_PATH=$prefix/share/sgml
277fi
278HAVE_DEFS_ENT=
279BUILDTXTDOC=no
280BUILDPDFDOC=no
281BUILDPSDOC=no
282BUILDHTMLDOC=no
283
284AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
285
286AC_PATH_PROG(DOCBOOKPS, docbook2ps)
287AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
288AC_PATH_PROG(DOCBOOKHTML, docbook2html)
289AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
290
291AC_MSG_CHECKING([Whether to build text documentation])
292if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
293   test x$BUILD_TXTDOC != xno; then
294	BUILDTXTDOC=yes
295fi
296AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
297AC_MSG_RESULT([$BUILDTXTDOC])
298
299AC_MSG_CHECKING([Whether to build PDF documentation])
300if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
301   test x$BUILD_PDFDOC != xno; then
302	BUILDPDFDOC=yes
303fi
304AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
305AC_MSG_RESULT([$BUILDPDFDOC])
306
307AC_MSG_CHECKING([Whether to build PostScript documentation])
308if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
309   test x$BUILD_PSDOC != xno; then
310	BUILDPSDOC=yes
311fi
312AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
313AC_MSG_RESULT([$BUILDPSDOC])
314
315AC_MSG_CHECKING([Whether to build HTML documentation])
316if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
317   test x$BUILD_HTMLDOC != xno; then
318	BUILDHTMLDOC=yes
319fi
320AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
321AC_MSG_RESULT([$BUILDHTMLDOC])
322
323MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
324MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
325MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
326MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
327
328AC_SUBST(MAKE_TEXT)
329AC_SUBST(MAKE_PS)
330AC_SUBST(MAKE_PDF)
331AC_SUBST(MAKE_HTML)
332]) # XORG_CHECK_DOCBOOK
333
334# XORG_CHECK_MALLOC_ZERO
335# ----------------------
336# Minimum version: 1.0.0
337#
338# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
339# malloc(0) returns NULL.  Packages should add one of these cflags to
340# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
341AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
342AC_ARG_ENABLE(malloc0returnsnull,
343	AC_HELP_STRING([--enable-malloc0returnsnull],
344		       [malloc(0) returns NULL (default: auto)]),
345	[MALLOC_ZERO_RETURNS_NULL=$enableval],
346	[MALLOC_ZERO_RETURNS_NULL=auto])
347
348AC_MSG_CHECKING([whether malloc(0) returns NULL])
349if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
350	AC_RUN_IFELSE([
351char *malloc();
352char *realloc();
353char *calloc();
354main() {
355    char *m0, *r0, *c0, *p;
356    m0 = malloc(0);
357    p = malloc(10);
358    r0 = realloc(p,0);
359    c0 = calloc(0);
360    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
361}],
362		[MALLOC_ZERO_RETURNS_NULL=yes],
363		[MALLOC_ZERO_RETURNS_NULL=no])
364fi
365AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
366
367if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
368	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
369	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
370	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
371else
372	MALLOC_ZERO_CFLAGS=""
373	XMALLOC_ZERO_CFLAGS=""
374	XTMALLOC_ZERO_CFLAGS=""
375fi
376
377AC_SUBST([MALLOC_ZERO_CFLAGS])
378AC_SUBST([XMALLOC_ZERO_CFLAGS])
379AC_SUBST([XTMALLOC_ZERO_CFLAGS])
380]) # XORG_CHECK_MALLOC_ZERO
381
382# XORG_WITH_LINT()
383# ----------------
384# Minimum version: 1.1.0
385#
386# Sets up flags for source checkers such as lint and sparse if --with-lint
387# is specified.   (Use --with-lint=sparse for sparse.)
388# Sets $LINT to name of source checker passed with --with-lint (default: lint)
389# Sets $LINT_FLAGS to flags to pass to source checker
390# Sets LINT automake conditional if enabled (default: disabled)
391#
392AC_DEFUN([XORG_WITH_LINT],[
393
394# Allow checking code with lint, sparse, etc.
395AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
396		[Use a lint-style source code checker (default: disabled)])],
397		[use_lint=$withval], [use_lint=no])
398if test "x$use_lint" = "xyes" ; then
399	LINT="lint"
400else
401	LINT="$use_lint"
402fi
403if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
404    case $LINT in
405	lint|*/lint)
406	    case $host_os in
407		solaris*)
408			LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
409			;;
410	    esac
411	    ;;
412    esac
413fi
414
415AC_SUBST(LINT)
416AC_SUBST(LINT_FLAGS)
417AM_CONDITIONAL(LINT, [test x$LINT != xno])
418
419]) # XORG_WITH_LINT
420
421# XORG_LINT_LIBRARY(LIBNAME)
422# --------------------------
423# Minimum version: 1.1.0
424#
425# Sets up flags for building lint libraries for checking programs that call
426# functions in the library.
427# Disabled by default, enable with --enable-lint-library
428# Sets: 
429#	@LINTLIB@		- name of lint library file to make
430#	MAKE_LINT_LIB		- automake conditional
431#
432
433AC_DEFUN([XORG_LINT_LIBRARY],[
434AC_REQUIRE([XORG_WITH_LINT])
435# Build lint "library" for more indepth checks of programs calling this library
436AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
437	[Create lint library (default: disabled)])],
438	[make_lint_lib=$enableval], [make_lint_lib=no])
439if test "x$make_lint_lib" != "xno" ; then
440	if test "x$LINT" = "xno" ; then
441		AC_MSG_ERROR([Cannot make lint library without --with-lint])
442	fi
443	if test "x$make_lint_lib" = "xyes" ; then
444		LINTLIB=llib-l$1.ln
445	else
446		LINTLIB=$make_lint_lib
447	fi
448fi
449AC_SUBST(LINTLIB)
450AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
451
452]) # XORG_LINT_LIBRARY
453
454# XORG_CWARNFLAGS
455# ---------------
456# Minimum version: 1.2.0
457#
458# Defines CWARNFLAGS to enable C compiler warnings.
459#
460AC_DEFUN([XORG_CWARNFLAGS], [
461AC_REQUIRE([AC_PROG_CC])
462if  test "x$GCC" = xyes ; then
463    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
464-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
465-Wbad-function-cast"
466    case `gcc -dumpversion` in
467    3.4.* | 4.*)
468	CWARNFLAGS+=" -Wold-style-definition -Wdeclaration-after-statement"
469	;;
470    esac
471else
472    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
473    if test "x$SUNCC" = "xyes"; then
474	CWARNFLAGS="-v"
475    fi
476fi
477AC_SUBST(CWARNFLAGS)
478]) # XORG_CWARNFLAGS
479dnl Copyright 2005 Red Hat, Inc
480dnl
481dnl Permission to use, copy, modify, distribute, and sell this software and its
482dnl documentation for any purpose is hereby granted without fee, provided that
483dnl the above copyright notice appear in all copies and that both that
484dnl copyright notice and this permission notice appear in supporting
485dnl documentation.
486dnl
487dnl The above copyright notice and this permission notice shall be included
488dnl in all copies or substantial portions of the Software.
489dnl
490dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
491dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
492dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
493dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
494dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
495dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
496dnl OTHER DEALINGS IN THE SOFTWARE.
497dnl
498dnl Except as contained in this notice, the name of the copyright holders shall
499dnl not be used in advertising or otherwise to promote the sale, use or
500dnl other dealings in this Software without prior written authorization
501dnl from the copyright holders.
502dnl
503
504# XORG_RELEASE_VERSION
505# --------------------
506# Adds --with/without-release-string and changes the PACKAGE and
507# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION".  If
508# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged.  Also
509# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
510 
511AC_DEFUN([XORG_RELEASE_VERSION],[
512	AC_ARG_WITH(release-version,
513			AC_HELP_STRING([--with-release-version=STRING],
514				[Use release version string in package name]),
515			[RELEASE_VERSION="$withval"],
516			[RELEASE_VERSION=""])
517	if test "x$RELEASE_VERSION" != "x"; then
518		PACKAGE="$PACKAGE-$RELEASE_VERSION"
519		PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
520		AC_MSG_NOTICE([Building with package name set to $PACKAGE])
521	fi
522	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
523		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
524		[Major version of this package])
525	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
526	if test "x$PVM" = "x"; then
527		PVM="0"
528	fi
529	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
530		[$PVM],
531		[Minor version of this package])
532	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
533	if test "x$PVP" = "x"; then
534		PVP="0"
535	fi
536	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
537		[$PVP],
538		[Patch version of this package])
539])
540
541# XORG_CHANGELOG()
542# ----------------
543# Minimum version: 1.2.0
544#
545# Defines the variable CHANGELOG_CMD as the command to generate
546# ChangeLog from git.
547#
548# Arrange that distcleancheck ignores ChangeLog left over by distclean.
549#
550AC_DEFUN([XORG_CHANGELOG], [
551CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \
552mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \
553echo 'git directory not found: installing possibly empty changelog.' >&2)"
554AC_SUBST([CHANGELOG_CMD])
555AC_SUBST([distcleancheck_listfiles], ['find . -type f ! -name ChangeLog -print'])
556]) # XORG_CHANGELOG
557
558# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
559#
560# This file is free software; the Free Software Foundation
561# gives unlimited permission to copy and/or distribute it,
562# with or without modifications, as long as this notice is preserved.
563
564# AM_AUTOMAKE_VERSION(VERSION)
565# ----------------------------
566# Automake X.Y traces this macro to ensure aclocal.m4 has been
567# generated from the m4 files accompanying Automake X.Y.
568# (This private macro should not be called outside this file.)
569AC_DEFUN([AM_AUTOMAKE_VERSION],
570[am__api_version='1.10'
571dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
572dnl require some minimum version.  Point them to the right macro.
573m4_if([$1], [1.10], [],
574      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
575])
576
577# _AM_AUTOCONF_VERSION(VERSION)
578# -----------------------------
579# aclocal traces this macro to find the Autoconf version.
580# This is a private macro too.  Using m4_define simplifies
581# the logic in aclocal, which can simply ignore this definition.
582m4_define([_AM_AUTOCONF_VERSION], [])
583
584# AM_SET_CURRENT_AUTOMAKE_VERSION
585# -------------------------------
586# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
587# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
588AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
589[AM_AUTOMAKE_VERSION([1.10])dnl
590_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
591
592# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
593
594# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
595#
596# This file is free software; the Free Software Foundation
597# gives unlimited permission to copy and/or distribute it,
598# with or without modifications, as long as this notice is preserved.
599
600# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
601# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
602# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
603#
604# Of course, Automake must honor this variable whenever it calls a
605# tool from the auxiliary directory.  The problem is that $srcdir (and
606# therefore $ac_aux_dir as well) can be either absolute or relative,
607# depending on how configure is run.  This is pretty annoying, since
608# it makes $ac_aux_dir quite unusable in subdirectories: in the top
609# source directory, any form will work fine, but in subdirectories a
610# relative path needs to be adjusted first.
611#
612# $ac_aux_dir/missing
613#    fails when called from a subdirectory if $ac_aux_dir is relative
614# $top_srcdir/$ac_aux_dir/missing
615#    fails if $ac_aux_dir is absolute,
616#    fails when called from a subdirectory in a VPATH build with
617#          a relative $ac_aux_dir
618#
619# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
620# are both prefixed by $srcdir.  In an in-source build this is usually
621# harmless because $srcdir is `.', but things will broke when you
622# start a VPATH build or use an absolute $srcdir.
623#
624# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
625# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
626#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
627# and then we would define $MISSING as
628#   MISSING="\${SHELL} $am_aux_dir/missing"
629# This will work as long as MISSING is not called from configure, because
630# unfortunately $(top_srcdir) has no meaning in configure.
631# However there are other variables, like CC, which are often used in
632# configure, and could therefore not use this "fixed" $ac_aux_dir.
633#
634# Another solution, used here, is to always expand $ac_aux_dir to an
635# absolute PATH.  The drawback is that using absolute paths prevent a
636# configured tree to be moved without reconfiguration.
637
638AC_DEFUN([AM_AUX_DIR_EXPAND],
639[dnl Rely on autoconf to set up CDPATH properly.
640AC_PREREQ([2.50])dnl
641# expand $ac_aux_dir to an absolute path
642am_aux_dir=`cd $ac_aux_dir && pwd`
643])
644
645# AM_CONDITIONAL                                            -*- Autoconf -*-
646
647# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
648# Free Software Foundation, Inc.
649#
650# This file is free software; the Free Software Foundation
651# gives unlimited permission to copy and/or distribute it,
652# with or without modifications, as long as this notice is preserved.
653
654# serial 8
655
656# AM_CONDITIONAL(NAME, SHELL-CONDITION)
657# -------------------------------------
658# Define a conditional.
659AC_DEFUN([AM_CONDITIONAL],
660[AC_PREREQ(2.52)dnl
661 ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
662	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
663AC_SUBST([$1_TRUE])dnl
664AC_SUBST([$1_FALSE])dnl
665_AM_SUBST_NOTMAKE([$1_TRUE])dnl
666_AM_SUBST_NOTMAKE([$1_FALSE])dnl
667if $2; then
668  $1_TRUE=
669  $1_FALSE='#'
670else
671  $1_TRUE='#'
672  $1_FALSE=
673fi
674AC_CONFIG_COMMANDS_PRE(
675[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
676  AC_MSG_ERROR([[conditional "$1" was never defined.
677Usually this means the macro was only invoked conditionally.]])
678fi])])
679
680# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
681# Free Software Foundation, Inc.
682#
683# This file is free software; the Free Software Foundation
684# gives unlimited permission to copy and/or distribute it,
685# with or without modifications, as long as this notice is preserved.
686
687# serial 9
688
689# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
690# written in clear, in which case automake, when reading aclocal.m4,
691# will think it sees a *use*, and therefore will trigger all it's
692# C support machinery.  Also note that it means that autoscan, seeing
693# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
694
695
696# _AM_DEPENDENCIES(NAME)
697# ----------------------
698# See how the compiler implements dependency checking.
699# NAME is "CC", "CXX", "GCJ", or "OBJC".
700# We try a few techniques and use that to set a single cache variable.
701#
702# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
703# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
704# dependency, and given that the user is not expected to run this macro,
705# just rely on AC_PROG_CC.
706AC_DEFUN([_AM_DEPENDENCIES],
707[AC_REQUIRE([AM_SET_DEPDIR])dnl
708AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
709AC_REQUIRE([AM_MAKE_INCLUDE])dnl
710AC_REQUIRE([AM_DEP_TRACK])dnl
711
712ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
713       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
714       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
715       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
716       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
717                   [depcc="$$1"   am_compiler_list=])
718
719AC_CACHE_CHECK([dependency style of $depcc],
720               [am_cv_$1_dependencies_compiler_type],
721[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
722  # We make a subdir and do the tests there.  Otherwise we can end up
723  # making bogus files that we don't know about and never remove.  For
724  # instance it was reported that on HP-UX the gcc test will end up
725  # making a dummy file named `D' -- because `-MD' means `put the output
726  # in D'.
727  mkdir conftest.dir
728  # Copy depcomp to subdir because otherwise we won't find it if we're
729  # using a relative directory.
730  cp "$am_depcomp" conftest.dir
731  cd conftest.dir
732  # We will build objects and dependencies in a subdirectory because
733  # it helps to detect inapplicable dependency modes.  For instance
734  # both Tru64's cc and ICC support -MD to output dependencies as a
735  # side effect of compilation, but ICC will put the dependencies in
736  # the current directory while Tru64 will put them in the object
737  # directory.
738  mkdir sub
739
740  am_cv_$1_dependencies_compiler_type=none
741  if test "$am_compiler_list" = ""; then
742     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
743  fi
744  for depmode in $am_compiler_list; do
745    # Setup a source with many dependencies, because some compilers
746    # like to wrap large dependency lists on column 80 (with \), and
747    # we should not choose a depcomp mode which is confused by this.
748    #
749    # We need to recreate these files for each test, as the compiler may
750    # overwrite some of them when testing with obscure command lines.
751    # This happens at least with the AIX C compiler.
752    : > sub/conftest.c
753    for i in 1 2 3 4 5 6; do
754      echo '#include "conftst'$i'.h"' >> sub/conftest.c
755      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
756      # Solaris 8's {/usr,}/bin/sh.
757      touch sub/conftst$i.h
758    done
759    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
760
761    case $depmode in
762    nosideeffect)
763      # after this tag, mechanisms are not by side-effect, so they'll
764      # only be used when explicitly requested
765      if test "x$enable_dependency_tracking" = xyes; then
766	continue
767      else
768	break
769      fi
770      ;;
771    none) break ;;
772    esac
773    # We check with `-c' and `-o' for the sake of the "dashmstdout"
774    # mode.  It turns out that the SunPro C++ compiler does not properly
775    # handle `-M -o', and we need to detect this.
776    if depmode=$depmode \
777       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
778       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
779       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
780         >/dev/null 2>conftest.err &&
781       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
782       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
783       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
784       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
785      # icc doesn't choke on unknown options, it will just issue warnings
786      # or remarks (even with -Werror).  So we grep stderr for any message
787      # that says an option was ignored or not supported.
788      # When given -MP, icc 7.0 and 7.1 complain thusly:
789      #   icc: Command line warning: ignoring option '-M'; no argument required
790      # The diagnosis changed in icc 8.0:
791      #   icc: Command line remark: option '-MP' not supported
792      if (grep 'ignoring option' conftest.err ||
793          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
794        am_cv_$1_dependencies_compiler_type=$depmode
795        break
796      fi
797    fi
798  done
799
800  cd ..
801  rm -rf conftest.dir
802else
803  am_cv_$1_dependencies_compiler_type=none
804fi
805])
806AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
807AM_CONDITIONAL([am__fastdep$1], [
808  test "x$enable_dependency_tracking" != xno \
809  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
810])
811
812
813# AM_SET_DEPDIR
814# -------------
815# Choose a directory name for dependency files.
816# This macro is AC_REQUIREd in _AM_DEPENDENCIES
817AC_DEFUN([AM_SET_DEPDIR],
818[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
819AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
820])
821
822
823# AM_DEP_TRACK
824# ------------
825AC_DEFUN([AM_DEP_TRACK],
826[AC_ARG_ENABLE(dependency-tracking,
827[  --disable-dependency-tracking  speeds up one-time build
828  --enable-dependency-tracking   do not reject slow dependency extractors])
829if test "x$enable_dependency_tracking" != xno; then
830  am_depcomp="$ac_aux_dir/depcomp"
831  AMDEPBACKSLASH='\'
832fi
833AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
834AC_SUBST([AMDEPBACKSLASH])dnl
835_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
836])
837
838# Generate code to set up dependency tracking.              -*- Autoconf -*-
839
840# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
841# Free Software Foundation, Inc.
842#
843# This file is free software; the Free Software Foundation
844# gives unlimited permission to copy and/or distribute it,
845# with or without modifications, as long as this notice is preserved.
846
847#serial 3
848
849# _AM_OUTPUT_DEPENDENCY_COMMANDS
850# ------------------------------
851AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
852[for mf in $CONFIG_FILES; do
853  # Strip MF so we end up with the name of the file.
854  mf=`echo "$mf" | sed -e 's/:.*$//'`
855  # Check whether this is an Automake generated Makefile or not.
856  # We used to match only the files named `Makefile.in', but
857  # some people rename them; so instead we look at the file content.
858  # Grep'ing the first line is not enough: some people post-process
859  # each Makefile.in and add a new line on top of each file to say so.
860  # Grep'ing the whole file is not good either: AIX grep has a line
861  # limit of 2048, but all sed's we know have understand at least 4000.
862  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
863    dirpart=`AS_DIRNAME("$mf")`
864  else
865    continue
866  fi
867  # Extract the definition of DEPDIR, am__include, and am__quote
868  # from the Makefile without running `make'.
869  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
870  test -z "$DEPDIR" && continue
871  am__include=`sed -n 's/^am__include = //p' < "$mf"`
872  test -z "am__include" && continue
873  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
874  # When using ansi2knr, U may be empty or an underscore; expand it
875  U=`sed -n 's/^U = //p' < "$mf"`
876  # Find all dependency output files, they are included files with
877  # $(DEPDIR) in their names.  We invoke sed twice because it is the
878  # simplest approach to changing $(DEPDIR) to its actual value in the
879  # expansion.
880  for file in `sed -n "
881    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
882       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
883    # Make sure the directory exists.
884    test -f "$dirpart/$file" && continue
885    fdir=`AS_DIRNAME(["$file"])`
886    AS_MKDIR_P([$dirpart/$fdir])
887    # echo "creating $dirpart/$file"
888    echo '# dummy' > "$dirpart/$file"
889  done
890done
891])# _AM_OUTPUT_DEPENDENCY_COMMANDS
892
893
894# AM_OUTPUT_DEPENDENCY_COMMANDS
895# -----------------------------
896# This macro should only be invoked once -- use via AC_REQUIRE.
897#
898# This code is only required when automatic dependency tracking
899# is enabled.  FIXME.  This creates each `.P' file that we will
900# need in order to bootstrap the dependency handling code.
901AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
902[AC_CONFIG_COMMANDS([depfiles],
903     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
904     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
905])
906
907# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
908# Free Software Foundation, Inc.
909#
910# This file is free software; the Free Software Foundation
911# gives unlimited permission to copy and/or distribute it,
912# with or without modifications, as long as this notice is preserved.
913
914# serial 8
915
916# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
917AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
918
919# Do all the work for Automake.                             -*- Autoconf -*-
920
921# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
922# 2005, 2006 Free Software Foundation, Inc.
923#
924# This file is free software; the Free Software Foundation
925# gives unlimited permission to copy and/or distribute it,
926# with or without modifications, as long as this notice is preserved.
927
928# serial 12
929
930# This macro actually does too much.  Some checks are only needed if
931# your package does certain things.  But this isn't really a big deal.
932
933# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
934# AM_INIT_AUTOMAKE([OPTIONS])
935# -----------------------------------------------
936# The call with PACKAGE and VERSION arguments is the old style
937# call (pre autoconf-2.50), which is being phased out.  PACKAGE
938# and VERSION should now be passed to AC_INIT and removed from
939# the call to AM_INIT_AUTOMAKE.
940# We support both call styles for the transition.  After
941# the next Automake release, Autoconf can make the AC_INIT
942# arguments mandatory, and then we can depend on a new Autoconf
943# release and drop the old call support.
944AC_DEFUN([AM_INIT_AUTOMAKE],
945[AC_PREREQ([2.60])dnl
946dnl Autoconf wants to disallow AM_ names.  We explicitly allow
947dnl the ones we care about.
948m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
949AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
950AC_REQUIRE([AC_PROG_INSTALL])dnl
951if test "`cd $srcdir && pwd`" != "`pwd`"; then
952  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
953  # is not polluted with repeated "-I."
954  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
955  # test to see if srcdir already configured
956  if test -f $srcdir/config.status; then
957    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
958  fi
959fi
960
961# test whether we have cygpath
962if test -z "$CYGPATH_W"; then
963  if (cygpath --version) >/dev/null 2>/dev/null; then
964    CYGPATH_W='cygpath -w'
965  else
966    CYGPATH_W=echo
967  fi
968fi
969AC_SUBST([CYGPATH_W])
970
971# Define the identity of the package.
972dnl Distinguish between old-style and new-style calls.
973m4_ifval([$2],
974[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
975 AC_SUBST([PACKAGE], [$1])dnl
976 AC_SUBST([VERSION], [$2])],
977[_AM_SET_OPTIONS([$1])dnl
978dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
979m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
980  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
981 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
982 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
983
984_AM_IF_OPTION([no-define],,
985[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
986 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
987
988# Some tools Automake needs.
989AC_REQUIRE([AM_SANITY_CHECK])dnl
990AC_REQUIRE([AC_ARG_PROGRAM])dnl
991AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
992AM_MISSING_PROG(AUTOCONF, autoconf)
993AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
994AM_MISSING_PROG(AUTOHEADER, autoheader)
995AM_MISSING_PROG(MAKEINFO, makeinfo)
996AM_PROG_INSTALL_SH
997AM_PROG_INSTALL_STRIP
998AC_REQUIRE([AM_PROG_MKDIR_P])dnl
999# We need awk for the "check" target.  The system "awk" is bad on
1000# some platforms.
1001AC_REQUIRE([AC_PROG_AWK])dnl
1002AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1003AC_REQUIRE([AM_SET_LEADING_DOT])dnl
1004_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
1005              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
1006	      		     [_AM_PROG_TAR([v7])])])
1007_AM_IF_OPTION([no-dependencies],,
1008[AC_PROVIDE_IFELSE([AC_PROG_CC],
1009                  [_AM_DEPENDENCIES(CC)],
1010                  [define([AC_PROG_CC],
1011                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
1012AC_PROVIDE_IFELSE([AC_PROG_CXX],
1013                  [_AM_DEPENDENCIES(CXX)],
1014                  [define([AC_PROG_CXX],
1015                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
1016AC_PROVIDE_IFELSE([AC_PROG_OBJC],
1017                  [_AM_DEPENDENCIES(OBJC)],
1018                  [define([AC_PROG_OBJC],
1019                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
1020])
1021])
1022
1023
1024# When config.status generates a header, we must update the stamp-h file.
1025# This file resides in the same directory as the config header
1026# that is generated.  The stamp files are numbered to have different names.
1027
1028# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
1029# loop where config.status creates the headers, so we can generate
1030# our stamp files there.
1031AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
1032[# Compute $1's index in $config_headers.
1033_am_stamp_count=1
1034for _am_header in $config_headers :; do
1035  case $_am_header in
1036    $1 | $1:* )
1037      break ;;
1038    * )
1039      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
1040  esac
1041done
1042echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
1043
1044# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
1045#
1046# This file is free software; the Free Software Foundation
1047# gives unlimited permission to copy and/or distribute it,
1048# with or without modifications, as long as this notice is preserved.
1049
1050# AM_PROG_INSTALL_SH
1051# ------------------
1052# Define $install_sh.
1053AC_DEFUN([AM_PROG_INSTALL_SH],
1054[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1055install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
1056AC_SUBST(install_sh)])
1057
1058# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
1059#
1060# This file is free software; the Free Software Foundation
1061# gives unlimited permission to copy and/or distribute it,
1062# with or without modifications, as long as this notice is preserved.
1063
1064# serial 2
1065
1066# Check whether the underlying file-system supports filenames
1067# with a leading dot.  For instance MS-DOS doesn't.
1068AC_DEFUN([AM_SET_LEADING_DOT],
1069[rm -rf .tst 2>/dev/null
1070mkdir .tst 2>/dev/null
1071if test -d .tst; then
1072  am__leading_dot=.
1073else
1074  am__leading_dot=_
1075fi
1076rmdir .tst 2>/dev/null
1077AC_SUBST([am__leading_dot])])
1078
1079# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
1080# From Jim Meyering
1081
1082# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
1083# Free Software Foundation, Inc.
1084#
1085# This file is free software; the Free Software Foundation
1086# gives unlimited permission to copy and/or distribute it,
1087# with or without modifications, as long as this notice is preserved.
1088
1089# serial 4
1090
1091AC_DEFUN([AM_MAINTAINER_MODE],
1092[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1093  dnl maintainer-mode is disabled by default
1094  AC_ARG_ENABLE(maintainer-mode,
1095[  --enable-maintainer-mode  enable make rules and dependencies not useful
1096			  (and sometimes confusing) to the casual installer],
1097      USE_MAINTAINER_MODE=$enableval,
1098      USE_MAINTAINER_MODE=no)
1099  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
1100  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
1101  MAINT=$MAINTAINER_MODE_TRUE
1102  AC_SUBST(MAINT)dnl
1103]
1104)
1105
1106AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
1107
1108# Check to see how 'make' treats includes.	            -*- Autoconf -*-
1109
1110# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
1111#
1112# This file is free software; the Free Software Foundation
1113# gives unlimited permission to copy and/or distribute it,
1114# with or without modifications, as long as this notice is preserved.
1115
1116# serial 3
1117
1118# AM_MAKE_INCLUDE()
1119# -----------------
1120# Check to see how make treats includes.
1121AC_DEFUN([AM_MAKE_INCLUDE],
1122[am_make=${MAKE-make}
1123cat > confinc << 'END'
1124am__doit:
1125	@echo done
1126.PHONY: am__doit
1127END
1128# If we don't find an include directive, just comment out the code.
1129AC_MSG_CHECKING([for style of include used by $am_make])
1130am__include="#"
1131am__quote=
1132_am_result=none
1133# First try GNU make style include.
1134echo "include confinc" > confmf
1135# We grep out `Entering directory' and `Leaving directory'
1136# messages which can occur if `w' ends up in MAKEFLAGS.
1137# In particular we don't look at `^make:' because GNU make might
1138# be invoked under some other name (usually "gmake"), in which
1139# case it prints its new name instead of `make'.
1140if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
1141   am__include=include
1142   am__quote=
1143   _am_result=GNU
1144fi
1145# Now try BSD make style include.
1146if test "$am__include" = "#"; then
1147   echo '.include "confinc"' > confmf
1148   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
1149      am__include=.include
1150      am__quote="\""
1151      _am_result=BSD
1152   fi
1153fi
1154AC_SUBST([am__include])
1155AC_SUBST([am__quote])
1156AC_MSG_RESULT([$_am_result])
1157rm -f confinc confmf
1158])
1159
1160# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
1161
1162# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
1163# Free Software Foundation, Inc.
1164#
1165# This file is free software; the Free Software Foundation
1166# gives unlimited permission to copy and/or distribute it,
1167# with or without modifications, as long as this notice is preserved.
1168
1169# serial 5
1170
1171# AM_MISSING_PROG(NAME, PROGRAM)
1172# ------------------------------
1173AC_DEFUN([AM_MISSING_PROG],
1174[AC_REQUIRE([AM_MISSING_HAS_RUN])
1175$1=${$1-"${am_missing_run}$2"}
1176AC_SUBST($1)])
1177
1178
1179# AM_MISSING_HAS_RUN
1180# ------------------
1181# Define MISSING if not defined so far and test if it supports --run.
1182# If it does, set am_missing_run to use it, otherwise, to nothing.
1183AC_DEFUN([AM_MISSING_HAS_RUN],
1184[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1185AC_REQUIRE_AUX_FILE([missing])dnl
1186test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
1187# Use eval to expand $SHELL
1188if eval "$MISSING --run true"; then
1189  am_missing_run="$MISSING --run "
1190else
1191  am_missing_run=
1192  AC_MSG_WARN([`missing' script is too old or missing])
1193fi
1194])
1195
1196# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
1197#
1198# This file is free software; the Free Software Foundation
1199# gives unlimited permission to copy and/or distribute it,
1200# with or without modifications, as long as this notice is preserved.
1201
1202# AM_PROG_MKDIR_P
1203# ---------------
1204# Check for `mkdir -p'.
1205AC_DEFUN([AM_PROG_MKDIR_P],
1206[AC_PREREQ([2.60])dnl
1207AC_REQUIRE([AC_PROG_MKDIR_P])dnl
1208dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
1209dnl while keeping a definition of mkdir_p for backward compatibility.
1210dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
1211dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
1212dnl Makefile.ins that do not define MKDIR_P, so we do our own
1213dnl adjustment using top_builddir (which is defined more often than
1214dnl MKDIR_P).
1215AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
1216case $mkdir_p in
1217  [[\\/$]]* | ?:[[\\/]]*) ;;
1218  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
1219esac
1220])
1221
1222# Helper functions for option handling.                     -*- Autoconf -*-
1223
1224# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
1225#
1226# This file is free software; the Free Software Foundation
1227# gives unlimited permission to copy and/or distribute it,
1228# with or without modifications, as long as this notice is preserved.
1229
1230# serial 3
1231
1232# _AM_MANGLE_OPTION(NAME)
1233# -----------------------
1234AC_DEFUN([_AM_MANGLE_OPTION],
1235[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
1236
1237# _AM_SET_OPTION(NAME)
1238# ------------------------------
1239# Set option NAME.  Presently that only means defining a flag for this option.
1240AC_DEFUN([_AM_SET_OPTION],
1241[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
1242
1243# _AM_SET_OPTIONS(OPTIONS)
1244# ----------------------------------
1245# OPTIONS is a space-separated list of Automake options.
1246AC_DEFUN([_AM_SET_OPTIONS],
1247[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
1248
1249# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
1250# -------------------------------------------
1251# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
1252AC_DEFUN([_AM_IF_OPTION],
1253[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
1254
1255# Check to make sure that the build environment is sane.    -*- Autoconf -*-
1256
1257# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
1258# Free Software Foundation, Inc.
1259#
1260# This file is free software; the Free Software Foundation
1261# gives unlimited permission to copy and/or distribute it,
1262# with or without modifications, as long as this notice is preserved.
1263
1264# serial 4
1265
1266# AM_SANITY_CHECK
1267# ---------------
1268AC_DEFUN([AM_SANITY_CHECK],
1269[AC_MSG_CHECKING([whether build environment is sane])
1270# Just in case
1271sleep 1
1272echo timestamp > conftest.file
1273# Do `set' in a subshell so we don't clobber the current shell's
1274# arguments.  Must try -L first in case configure is actually a
1275# symlink; some systems play weird games with the mod time of symlinks
1276# (eg FreeBSD returns the mod time of the symlink's containing
1277# directory).
1278if (
1279   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
1280   if test "$[*]" = "X"; then
1281      # -L didn't work.
1282      set X `ls -t $srcdir/configure conftest.file`
1283   fi
1284   rm -f conftest.file
1285   if test "$[*]" != "X $srcdir/configure conftest.file" \
1286      && test "$[*]" != "X conftest.file $srcdir/configure"; then
1287
1288      # If neither matched, then we have a broken ls.  This can happen
1289      # if, for instance, CONFIG_SHELL is bash and it inherits a
1290      # broken ls alias from the environment.  This has actually
1291      # happened.  Such a system could not be considered "sane".
1292      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1293alias in your environment])
1294   fi
1295
1296   test "$[2]" = conftest.file
1297   )
1298then
1299   # Ok.
1300   :
1301else
1302   AC_MSG_ERROR([newly created file is older than distributed files!
1303Check your system clock])
1304fi
1305AC_MSG_RESULT(yes)])
1306
1307# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
1308#
1309# This file is free software; the Free Software Foundation
1310# gives unlimited permission to copy and/or distribute it,
1311# with or without modifications, as long as this notice is preserved.
1312
1313# AM_PROG_INSTALL_STRIP
1314# ---------------------
1315# One issue with vendor `install' (even GNU) is that you can't
1316# specify the program used to strip binaries.  This is especially
1317# annoying in cross-compiling environments, where the build's strip
1318# is unlikely to handle the host's binaries.
1319# Fortunately install-sh will honor a STRIPPROG variable, so we
1320# always use install-sh in `make install-strip', and initialize
1321# STRIPPROG with the value of the STRIP variable (set by the user).
1322AC_DEFUN([AM_PROG_INSTALL_STRIP],
1323[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1324# Installed binaries are usually stripped using `strip' when the user
1325# run `make install-strip'.  However `strip' might not be the right
1326# tool to use in cross-compilation environments, therefore Automake
1327# will honor the `STRIP' environment variable to overrule this program.
1328dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
1329if test "$cross_compiling" != no; then
1330  AC_CHECK_TOOL([STRIP], [strip], :)
1331fi
1332INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1333AC_SUBST([INSTALL_STRIP_PROGRAM])])
1334
1335# Copyright (C) 2006  Free Software Foundation, Inc.
1336#
1337# This file is free software; the Free Software Foundation
1338# gives unlimited permission to copy and/or distribute it,
1339# with or without modifications, as long as this notice is preserved.
1340
1341# _AM_SUBST_NOTMAKE(VARIABLE)
1342# ---------------------------
1343# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
1344# This macro is traced by Automake.
1345AC_DEFUN([_AM_SUBST_NOTMAKE])
1346
1347# Check how to create a tarball.                            -*- Autoconf -*-
1348
1349# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
1350#
1351# This file is free software; the Free Software Foundation
1352# gives unlimited permission to copy and/or distribute it,
1353# with or without modifications, as long as this notice is preserved.
1354
1355# serial 2
1356
1357# _AM_PROG_TAR(FORMAT)
1358# --------------------
1359# Check how to create a tarball in format FORMAT.
1360# FORMAT should be one of `v7', `ustar', or `pax'.
1361#
1362# Substitute a variable $(am__tar) that is a command
1363# writing to stdout a FORMAT-tarball containing the directory
1364# $tardir.
1365#     tardir=directory && $(am__tar) > result.tar
1366#
1367# Substitute a variable $(am__untar) that extract such
1368# a tarball read from stdin.
1369#     $(am__untar) < result.tar
1370AC_DEFUN([_AM_PROG_TAR],
1371[# Always define AMTAR for backward compatibility.
1372AM_MISSING_PROG([AMTAR], [tar])
1373m4_if([$1], [v7],
1374     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
1375     [m4_case([$1], [ustar],, [pax],,
1376              [m4_fatal([Unknown tar format])])
1377AC_MSG_CHECKING([how to create a $1 tar archive])
1378# Loop over all known methods to create a tar archive until one works.
1379_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1380_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1381# Do not fold the above two line into one, because Tru64 sh and
1382# Solaris sh will not grok spaces in the rhs of `-'.
1383for _am_tool in $_am_tools
1384do
1385  case $_am_tool in
1386  gnutar)
1387    for _am_tar in tar gnutar gtar;
1388    do
1389      AM_RUN_LOG([$_am_tar --version]) && break
1390    done
1391    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1392    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1393    am__untar="$_am_tar -xf -"
1394    ;;
1395  plaintar)
1396    # Must skip GNU tar: if it does not support --format= it doesn't create
1397    # ustar tarball either.
1398    (tar --version) >/dev/null 2>&1 && continue
1399    am__tar='tar chf - "$$tardir"'
1400    am__tar_='tar chf - "$tardir"'
1401    am__untar='tar xf -'
1402    ;;
1403  pax)
1404    am__tar='pax -L -x $1 -w "$$tardir"'
1405    am__tar_='pax -L -x $1 -w "$tardir"'
1406    am__untar='pax -r'
1407    ;;
1408  cpio)
1409    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1410    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1411    am__untar='cpio -i -H $1 -d'
1412    ;;
1413  none)
1414    am__tar=false
1415    am__tar_=false
1416    am__untar=false
1417    ;;
1418  esac
1419
1420  # If the value was cached, stop now.  We just wanted to have am__tar
1421  # and am__untar set.
1422  test -n "${am_cv_prog_tar_$1}" && break
1423
1424  # tar/untar a dummy directory, and stop if the command works
1425  rm -rf conftest.dir
1426  mkdir conftest.dir
1427  echo GrepMe > conftest.dir/file
1428  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1429  rm -rf conftest.dir
1430  if test -s conftest.tar; then
1431    AM_RUN_LOG([$am__untar <conftest.tar])
1432    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1433  fi
1434done
1435rm -rf conftest.dir
1436
1437AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1438AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1439AC_SUBST([am__tar])
1440AC_SUBST([am__untar])
1441]) # _AM_PROG_TAR
1442
1443dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1444dnl
1445dnl Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
1446dnl 
1447dnl Permission is hereby granted, free of charge, to any person obtaining a
1448dnl copy of this software and associated documentation files (the
1449dnl "Software"), to deal in the Software without restriction, including
1450dnl without limitation the rights to use, copy, modify, merge, publish,
1451dnl distribute, and/or sell copies of the Software, and to permit persons
1452dnl to whom the Software is furnished to do so, provided that the above
1453dnl copyright notice(s) and this permission notice appear in all copies of
1454dnl the Software and that both the above copyright notice(s) and this
1455dnl permission notice appear in supporting documentation.
1456dnl
1457dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1458dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1459dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
1460dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
1461dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
1462dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
1463dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1464dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1465dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1466dnl
1467dnl Except as contained in this notice, the name of a copyright holder
1468dnl shall not be used in advertising or otherwise to promote the sale, use
1469dnl or other dealings in this Software without prior written authorization
1470dnl of the copyright holder.
1471
1472# XORG_MACROS_VERSION(required-version)
1473# -------------------------------------
1474# Minimum version: 1.1.0
1475#
1476# If you're using a macro added in Version 1.1 or newer, include this in
1477# your configure.ac with the minimum required version, such as:
1478# XORG_MACROS_VERSION(1.1)
1479#
1480# To ensure that this macro is defined, also add:
1481# m4_ifndef([XORG_MACROS_VERSION],
1482#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1483#
1484#
1485# See the "minimum version" comment for each macro you use to see what 
1486# version you require.
1487m4_defun([XORG_MACROS_VERSION],[
1488m4_define([vers_have], [1.2.2])
1489m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1490m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1491m4_if(m4_cmp(maj_have, maj_needed), 0,,
1492    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1493m4_if(m4_version_compare(vers_have, [$1]), -1,
1494    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1495m4_undefine([vers_have])
1496m4_undefine([maj_have])
1497m4_undefine([maj_needed])
1498]) # XORG_MACROS_VERSION
1499
1500# XORG_PROG_RAWCPP()
1501# ------------------
1502# Minimum version: 1.0.0
1503#
1504# Find cpp program and necessary flags for use in pre-processing text files
1505# such as man pages and config files
1506AC_DEFUN([XORG_PROG_RAWCPP],[
1507AC_REQUIRE([AC_PROG_CPP])
1508AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1509   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1510
1511# Check for flag to avoid builtin definitions - assumes unix is predefined,
1512# which is not the best choice for supporting other OS'es, but covers most
1513# of the ones we need for now.
1514AC_MSG_CHECKING([if $RAWCPP requires -undef])
1515AC_LANG_CONFTEST([Does cpp redefine unix ?])
1516if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1517	AC_MSG_RESULT([no])
1518else
1519	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1520		RAWCPPFLAGS=-undef
1521		AC_MSG_RESULT([yes])
1522	# under Cygwin unix is still defined even with -undef
1523	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1524		RAWCPPFLAGS="-undef -ansi"
1525		AC_MSG_RESULT([yes, with -ansi])
1526	else
1527		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1528	fi
1529fi
1530rm -f conftest.$ac_ext
1531
1532AC_MSG_CHECKING([if $RAWCPP requires -traditional])
1533AC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
1534if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1535	AC_MSG_RESULT([no])
1536else
1537	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1538		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1539		AC_MSG_RESULT([yes])
1540	else
1541		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1542	fi
1543fi
1544rm -f conftest.$ac_ext
1545AC_SUBST(RAWCPPFLAGS)
1546]) # XORG_PROG_RAWCPP
1547
1548# XORG_MANPAGE_SECTIONS()
1549# -----------------------
1550# Minimum version: 1.0.0
1551#
1552# Determine which sections man pages go in for the different man page types
1553# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1554# Not sure if there's any better way than just hardcoding by OS name.
1555# Override default settings by setting environment variables
1556
1557AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1558AC_REQUIRE([AC_CANONICAL_HOST])
1559
1560if test x$APP_MAN_SUFFIX = x    ; then
1561    APP_MAN_SUFFIX=1
1562fi
1563if test x$APP_MAN_DIR = x    ; then
1564    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1565fi
1566
1567if test x$LIB_MAN_SUFFIX = x    ; then
1568    LIB_MAN_SUFFIX=3
1569fi
1570if test x$LIB_MAN_DIR = x    ; then
1571    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1572fi
1573
1574if test x$FILE_MAN_SUFFIX = x    ; then
1575    case $host_os in
1576	solaris*)	FILE_MAN_SUFFIX=4  ;;
1577	*)		FILE_MAN_SUFFIX=5  ;;
1578    esac
1579fi
1580if test x$FILE_MAN_DIR = x    ; then
1581    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1582fi
1583
1584if test x$MISC_MAN_SUFFIX = x    ; then
1585    case $host_os in
1586	solaris*)	MISC_MAN_SUFFIX=5  ;;
1587	*)		MISC_MAN_SUFFIX=7  ;;
1588    esac
1589fi
1590if test x$MISC_MAN_DIR = x    ; then
1591    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1592fi
1593
1594if test x$DRIVER_MAN_SUFFIX = x    ; then
1595    case $host_os in
1596	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1597	*)		DRIVER_MAN_SUFFIX=4  ;;
1598    esac
1599fi
1600if test x$DRIVER_MAN_DIR = x    ; then
1601    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1602fi
1603
1604if test x$ADMIN_MAN_SUFFIX = x    ; then
1605    case $host_os in
1606	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1607	*)		ADMIN_MAN_SUFFIX=8  ;;
1608    esac
1609fi
1610if test x$ADMIN_MAN_DIR = x    ; then
1611    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1612fi
1613
1614
1615AC_SUBST([APP_MAN_SUFFIX])
1616AC_SUBST([LIB_MAN_SUFFIX])
1617AC_SUBST([FILE_MAN_SUFFIX])
1618AC_SUBST([MISC_MAN_SUFFIX])
1619AC_SUBST([DRIVER_MAN_SUFFIX])
1620AC_SUBST([ADMIN_MAN_SUFFIX])
1621AC_SUBST([APP_MAN_DIR])
1622AC_SUBST([LIB_MAN_DIR])
1623AC_SUBST([FILE_MAN_DIR])
1624AC_SUBST([MISC_MAN_DIR])
1625AC_SUBST([DRIVER_MAN_DIR])
1626AC_SUBST([ADMIN_MAN_DIR])
1627]) # XORG_MANPAGE_SECTIONS
1628
1629# XORG_CHECK_LINUXDOC
1630# -------------------
1631# Minimum version: 1.0.0
1632#
1633# Defines the variable MAKE_TEXT if the necessary tools and
1634# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1635# Whether or not the necessary tools and files are found can be checked
1636# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1637AC_DEFUN([XORG_CHECK_LINUXDOC],[
1638if test x$XORG_SGML_PATH = x ; then
1639    XORG_SGML_PATH=$prefix/share/sgml
1640fi
1641HAVE_DEFS_ENT=
1642
1643if test x"$cross_compiling" = x"yes" ; then
1644  HAVE_DEFS_ENT=no
1645else
1646  AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
1647fi
1648
1649AC_PATH_PROG(LINUXDOC, linuxdoc)
1650AC_PATH_PROG(PS2PDF, ps2pdf)
1651
1652AC_MSG_CHECKING([Whether to build documentation])
1653
1654if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
1655   BUILDDOC=yes
1656else
1657   BUILDDOC=no
1658fi
1659
1660AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1661
1662AC_MSG_RESULT([$BUILDDOC])
1663
1664AC_MSG_CHECKING([Whether to build pdf documentation])
1665
1666if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
1667   BUILDPDFDOC=yes
1668else
1669   BUILDPDFDOC=no
1670fi
1671
1672AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1673
1674AC_MSG_RESULT([$BUILDPDFDOC])
1675
1676MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
1677MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1678MAKE_PDF="$PS2PDF"
1679MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1680
1681AC_SUBST(MAKE_TEXT)
1682AC_SUBST(MAKE_PS)
1683AC_SUBST(MAKE_PDF)
1684AC_SUBST(MAKE_HTML)
1685]) # XORG_CHECK_LINUXDOC
1686
1687# XORG_CHECK_DOCBOOK
1688# -------------------
1689# Minimum version: 1.0.0
1690#
1691# Checks for the ability to build output formats from SGML DocBook source.
1692# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1693# indicates whether the necessary tools and files are found and, if set,
1694# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1695AC_DEFUN([XORG_CHECK_DOCBOOK],[
1696if test x$XORG_SGML_PATH = x ; then
1697    XORG_SGML_PATH=$prefix/share/sgml
1698fi
1699HAVE_DEFS_ENT=
1700BUILDTXTDOC=no
1701BUILDPDFDOC=no
1702BUILDPSDOC=no
1703BUILDHTMLDOC=no
1704
1705AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
1706
1707AC_PATH_PROG(DOCBOOKPS, docbook2ps)
1708AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1709AC_PATH_PROG(DOCBOOKHTML, docbook2html)
1710AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1711
1712AC_MSG_CHECKING([Whether to build text documentation])
1713if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
1714   test x$BUILD_TXTDOC != xno; then
1715	BUILDTXTDOC=yes
1716fi
1717AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1718AC_MSG_RESULT([$BUILDTXTDOC])
1719
1720AC_MSG_CHECKING([Whether to build PDF documentation])
1721if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
1722   test x$BUILD_PDFDOC != xno; then
1723	BUILDPDFDOC=yes
1724fi
1725AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1726AC_MSG_RESULT([$BUILDPDFDOC])
1727
1728AC_MSG_CHECKING([Whether to build PostScript documentation])
1729if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
1730   test x$BUILD_PSDOC != xno; then
1731	BUILDPSDOC=yes
1732fi
1733AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1734AC_MSG_RESULT([$BUILDPSDOC])
1735
1736AC_MSG_CHECKING([Whether to build HTML documentation])
1737if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
1738   test x$BUILD_HTMLDOC != xno; then
1739	BUILDHTMLDOC=yes
1740fi
1741AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1742AC_MSG_RESULT([$BUILDHTMLDOC])
1743
1744MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1745MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1746MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1747MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1748
1749AC_SUBST(MAKE_TEXT)
1750AC_SUBST(MAKE_PS)
1751AC_SUBST(MAKE_PDF)
1752AC_SUBST(MAKE_HTML)
1753]) # XORG_CHECK_DOCBOOK
1754
1755# XORG_CHECK_MALLOC_ZERO
1756# ----------------------
1757# Minimum version: 1.0.0
1758#
1759# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1760# malloc(0) returns NULL.  Packages should add one of these cflags to
1761# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1762AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1763AC_ARG_ENABLE(malloc0returnsnull,
1764	AC_HELP_STRING([--enable-malloc0returnsnull],
1765		       [malloc(0) returns NULL (default: auto)]),
1766	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1767	[MALLOC_ZERO_RETURNS_NULL=auto])
1768
1769AC_MSG_CHECKING([whether malloc(0) returns NULL])
1770if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1771	AC_RUN_IFELSE([
1772char *malloc();
1773char *realloc();
1774char *calloc();
1775main() {
1776    char *m0, *r0, *c0, *p;
1777    m0 = malloc(0);
1778    p = malloc(10);
1779    r0 = realloc(p,0);
1780    c0 = calloc(0);
1781    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
1782}],
1783		[MALLOC_ZERO_RETURNS_NULL=yes],
1784		[MALLOC_ZERO_RETURNS_NULL=no])
1785fi
1786AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1787
1788if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1789	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1790	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1791	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1792else
1793	MALLOC_ZERO_CFLAGS=""
1794	XMALLOC_ZERO_CFLAGS=""
1795	XTMALLOC_ZERO_CFLAGS=""
1796fi
1797
1798AC_SUBST([MALLOC_ZERO_CFLAGS])
1799AC_SUBST([XMALLOC_ZERO_CFLAGS])
1800AC_SUBST([XTMALLOC_ZERO_CFLAGS])
1801]) # XORG_CHECK_MALLOC_ZERO
1802
1803# XORG_WITH_LINT()
1804# ----------------
1805# Minimum version: 1.1.0
1806#
1807# Sets up flags for source checkers such as lint and sparse if --with-lint
1808# is specified.   (Use --with-lint=sparse for sparse.)
1809# Sets $LINT to name of source checker passed with --with-lint (default: lint)
1810# Sets $LINT_FLAGS to flags to pass to source checker
1811# Sets LINT automake conditional if enabled (default: disabled)
1812#
1813AC_DEFUN([XORG_WITH_LINT],[
1814
1815# Allow checking code with lint, sparse, etc.
1816AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
1817		[Use a lint-style source code checker (default: disabled)])],
1818		[use_lint=$withval], [use_lint=no])
1819if test "x$use_lint" = "xyes" ; then
1820	LINT="lint"
1821else
1822	LINT="$use_lint"
1823fi
1824if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
1825    case $LINT in
1826	lint|*/lint)
1827	    case $host_os in
1828		solaris*)
1829			LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1830			;;
1831	    esac
1832	    ;;
1833    esac
1834fi
1835
1836AC_SUBST(LINT)
1837AC_SUBST(LINT_FLAGS)
1838AM_CONDITIONAL(LINT, [test x$LINT != xno])
1839
1840]) # XORG_WITH_LINT
1841
1842# XORG_LINT_LIBRARY(LIBNAME)
1843# --------------------------
1844# Minimum version: 1.1.0
1845#
1846# Sets up flags for building lint libraries for checking programs that call
1847# functions in the library.
1848# Disabled by default, enable with --enable-lint-library
1849# Sets: 
1850#	@LINTLIB@		- name of lint library file to make
1851#	MAKE_LINT_LIB		- automake conditional
1852#
1853
1854AC_DEFUN([XORG_LINT_LIBRARY],[
1855AC_REQUIRE([XORG_WITH_LINT])
1856# Build lint "library" for more indepth checks of programs calling this library
1857AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
1858	[Create lint library (default: disabled)])],
1859	[make_lint_lib=$enableval], [make_lint_lib=no])
1860if test "x$make_lint_lib" != "xno" ; then
1861	if test "x$LINT" = "xno" ; then
1862		AC_MSG_ERROR([Cannot make lint library without --with-lint])
1863	fi
1864	if test "x$make_lint_lib" = "xyes" ; then
1865		LINTLIB=llib-l$1.ln
1866	else
1867		LINTLIB=$make_lint_lib
1868	fi
1869fi
1870AC_SUBST(LINTLIB)
1871AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1872
1873]) # XORG_LINT_LIBRARY
1874
1875# XORG_CWARNFLAGS
1876# ---------------
1877# Minimum version: 1.2.0
1878#
1879# Defines CWARNFLAGS to enable C compiler warnings.
1880#
1881AC_DEFUN([XORG_CWARNFLAGS], [
1882AC_REQUIRE([AC_PROG_CC])
1883if  test "x$GCC" = xyes ; then
1884    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
1885-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
1886-Wbad-function-cast"
1887    case `$CC -dumpversion` in
1888    3.4.* | 4.*)
1889	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
1890	;;
1891    esac
1892else
1893    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1894    if test "x$SUNCC" = "xyes"; then
1895	CWARNFLAGS="-v"
1896    fi
1897fi
1898AC_SUBST(CWARNFLAGS)
1899]) # XORG_CWARNFLAGS
1900dnl Copyright 2005 Red Hat, Inc
1901dnl
1902dnl Permission to use, copy, modify, distribute, and sell this software and its
1903dnl documentation for any purpose is hereby granted without fee, provided that
1904dnl the above copyright notice appear in all copies and that both that
1905dnl copyright notice and this permission notice appear in supporting
1906dnl documentation.
1907dnl
1908dnl The above copyright notice and this permission notice shall be included
1909dnl in all copies or substantial portions of the Software.
1910dnl
1911dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1912dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1913dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1914dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1915dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1916dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1917dnl OTHER DEALINGS IN THE SOFTWARE.
1918dnl
1919dnl Except as contained in this notice, the name of the copyright holders shall
1920dnl not be used in advertising or otherwise to promote the sale, use or
1921dnl other dealings in this Software without prior written authorization
1922dnl from the copyright holders.
1923dnl
1924
1925# XORG_RELEASE_VERSION
1926# --------------------
1927# Adds --with/without-release-string and changes the PACKAGE and
1928# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION".  If
1929# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged.  Also
1930# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
1931 
1932AC_DEFUN([XORG_RELEASE_VERSION],[
1933	AC_ARG_WITH(release-version,
1934			AC_HELP_STRING([--with-release-version=STRING],
1935				[Use release version string in package name]),
1936			[RELEASE_VERSION="$withval"],
1937			[RELEASE_VERSION=""])
1938	if test "x$RELEASE_VERSION" != "x"; then
1939		PACKAGE="$PACKAGE-$RELEASE_VERSION"
1940		PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
1941		AC_MSG_NOTICE([Building with package name set to $PACKAGE])
1942	fi
1943	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
1944		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
1945		[Major version of this package])
1946	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
1947	if test "x$PVM" = "x"; then
1948		PVM="0"
1949	fi
1950	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
1951		[$PVM],
1952		[Minor version of this package])
1953	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
1954	if test "x$PVP" = "x"; then
1955		PVP="0"
1956	fi
1957	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
1958		[$PVP],
1959		[Patch version of this package])
1960])
1961
1962# XORG_CHANGELOG()
1963# ----------------
1964# Minimum version: 1.2.0
1965#
1966# Defines the variable CHANGELOG_CMD as the command to generate
1967# ChangeLog from git.
1968#
1969# Arrange that distcleancheck ignores ChangeLog left over by distclean.
1970#
1971AC_DEFUN([XORG_CHANGELOG], [
1972CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \
1973mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \
1974echo 'git directory not found: installing possibly empty changelog.' >&2)"
1975AC_SUBST([CHANGELOG_CMD])
1976AC_SUBST([distcleancheck_listfiles], ['find . -type f ! -name ChangeLog -print'])
1977]) # XORG_CHANGELOG
1978
1979# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1980# 
1981# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1982#
1983# This program is free software; you can redistribute it and/or modify
1984# it under the terms of the GNU General Public License as published by
1985# the Free Software Foundation; either version 2 of the License, or
1986# (at your option) any later version.
1987#
1988# This program is distributed in the hope that it will be useful, but
1989# WITHOUT ANY WARRANTY; without even the implied warranty of
1990# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1991# General Public License for more details.
1992#
1993# You should have received a copy of the GNU General Public License
1994# along with this program; if not, write to the Free Software
1995# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1996#
1997# As a special exception to the GNU General Public License, if you
1998# distribute this file as part of a program that contains a
1999# configuration script generated by Autoconf, you may include it under
2000# the same distribution terms that you use for the rest of that program.
2001
2002# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2003# ----------------------------------
2004AC_DEFUN([PKG_PROG_PKG_CONFIG],
2005[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2006m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2007AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2008if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2009	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2010fi
2011if test -n "$PKG_CONFIG"; then
2012	_pkg_min_version=m4_ifval([$1], [$1], [0.9.0])
2013	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2014	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2015		AC_MSG_RESULT([yes])
2016	else
2017		AC_MSG_RESULT([no])
2018		PKG_CONFIG=""
2019	fi
2020		
2021fi[]dnl
2022])# PKG_PROG_PKG_CONFIG
2023
2024# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2025#
2026# Check to see whether a particular set of modules exists.  Similar
2027# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2028#
2029#
2030# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2031# this or PKG_CHECK_MODULES is called, or make sure to call
2032# PKG_CHECK_EXISTS manually
2033# --------------------------------------------------------------
2034AC_DEFUN([PKG_CHECK_EXISTS],
2035[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2036if test -n "$PKG_CONFIG" && \
2037    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2038  m4_ifval([$2], [$2], [:])
2039m4_ifvaln([$3], [else
2040  $3])dnl
2041fi])
2042
2043
2044# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2045# ---------------------------------------------
2046m4_define([_PKG_CONFIG],
2047[if test -n "$PKG_CONFIG"; then
2048        PKG_CHECK_EXISTS([$3],
2049                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2050			 [pkg_failed=yes])
2051else
2052	pkg_failed=untried
2053fi[]dnl
2054])# _PKG_CONFIG
2055
2056# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2057# [ACTION-IF-NOT-FOUND])
2058#
2059#
2060# Note that if there is a possibility the first call to
2061# PKG_CHECK_MODULES might not happen, you should be sure to include an
2062# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2063#
2064#
2065# --------------------------------------------------------------
2066AC_DEFUN([PKG_CHECK_MODULES],
2067[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2068AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2069AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2070
2071pkg_failed=no
2072AC_MSG_CHECKING([for $1])
2073
2074_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2075_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2076
2077if test $pkg_failed = yes; then
2078	$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
2079	# Put the nasty error message in config.log where it belongs
2080	echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
2081
2082	ifelse([$4], , [AC_MSG_ERROR(dnl
2083[Package requirements ($2) were not met.
2084Consider adjusting the PKG_CONFIG_PATH environment variable if you
2085installed software in a non-standard prefix.
2086
2087Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
2088to avoid the need to call pkg-config.  See the pkg-config man page for
2089more details.])],
2090		[$4])
2091elif test $pkg_failed = untried; then
2092	ifelse([$4], , [AC_MSG_FAILURE(dnl
2093[The pkg-config script could not be found or is too old.  Make sure it
2094is in your PATH or set the PKG_CONFIG environment variable to the full
2095path to pkg-config.
2096
2097Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
2098to avoid the need to call pkg-config.  See the pkg-config man page for
2099more details.
2100
2101To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
2102		[$4])
2103else
2104	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2105	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2106        AC_MSG_RESULT([yes])
2107	ifelse([$3], , :, [$3])
2108fi[]dnl
2109])# PKG_CHECK_MODULES
2110
2111