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