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