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