aclocal.m4 revision 31de2854
131de2854Smrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
25dfecf96Smrg
35dfecf96Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
431de2854Smrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
531de2854Smrg# Inc.
65dfecf96Smrg# This file is free software; the Free Software Foundation
75dfecf96Smrg# gives unlimited permission to copy and/or distribute it,
85dfecf96Smrg# with or without modifications, as long as this notice is preserved.
95dfecf96Smrg
105dfecf96Smrg# This program is distributed in the hope that it will be useful,
115dfecf96Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
125dfecf96Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
135dfecf96Smrg# PARTICULAR PURPOSE.
145dfecf96Smrg
15f14f4646Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16f14f4646Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17c05e22d7Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18c05e22d7Smrg[m4_warning([this file was generated for autoconf 2.68.
19f14f4646SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20f14f4646SmrgIf you have problems, you may need to regenerate the build system entirely.
21f14f4646SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22f14f4646Smrg
2331de2854Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
2431de2854Smrg# Foundation, Inc.
255dfecf96Smrg#
26c05e22d7Smrg# This file is free software; the Free Software Foundation
27c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
28c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
295dfecf96Smrg
3031de2854Smrg# serial 1
3131de2854Smrg
32c05e22d7Smrg# AM_AUTOMAKE_VERSION(VERSION)
33c05e22d7Smrg# ----------------------------
34c05e22d7Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
35c05e22d7Smrg# generated from the m4 files accompanying Automake X.Y.
36c05e22d7Smrg# (This private macro should not be called outside this file.)
37c05e22d7SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
38c05e22d7Smrg[am__api_version='1.11'
39c05e22d7Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40c05e22d7Smrgdnl require some minimum version.  Point them to the right macro.
4131de2854Smrgm4_if([$1], [1.11.2], [],
42c05e22d7Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43c05e22d7Smrg])
445dfecf96Smrg
45c05e22d7Smrg# _AM_AUTOCONF_VERSION(VERSION)
46c05e22d7Smrg# -----------------------------
47c05e22d7Smrg# aclocal traces this macro to find the Autoconf version.
48c05e22d7Smrg# This is a private macro too.  Using m4_define simplifies
49c05e22d7Smrg# the logic in aclocal, which can simply ignore this definition.
50c05e22d7Smrgm4_define([_AM_AUTOCONF_VERSION], [])
515dfecf96Smrg
52c05e22d7Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
53c05e22d7Smrg# -------------------------------
54c05e22d7Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
55c05e22d7Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56c05e22d7SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5731de2854Smrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
58c05e22d7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
59c05e22d7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
60c05e22d7Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
615dfecf96Smrg
62c05e22d7Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
635dfecf96Smrg
6431de2854Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65c05e22d7Smrg#
66c05e22d7Smrg# This file is free software; the Free Software Foundation
67c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
68c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
695dfecf96Smrg
7031de2854Smrg# serial 1
7131de2854Smrg
72c05e22d7Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73c05e22d7Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74c05e22d7Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
755dfecf96Smrg#
76c05e22d7Smrg# Of course, Automake must honor this variable whenever it calls a
77c05e22d7Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
78c05e22d7Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
79c05e22d7Smrg# depending on how configure is run.  This is pretty annoying, since
80c05e22d7Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81c05e22d7Smrg# source directory, any form will work fine, but in subdirectories a
82c05e22d7Smrg# relative path needs to be adjusted first.
835dfecf96Smrg#
84c05e22d7Smrg# $ac_aux_dir/missing
85c05e22d7Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
86c05e22d7Smrg# $top_srcdir/$ac_aux_dir/missing
87c05e22d7Smrg#    fails if $ac_aux_dir is absolute,
88c05e22d7Smrg#    fails when called from a subdirectory in a VPATH build with
89c05e22d7Smrg#          a relative $ac_aux_dir
905dfecf96Smrg#
91c05e22d7Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92c05e22d7Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
93c05e22d7Smrg# harmless because $srcdir is `.', but things will broke when you
94c05e22d7Smrg# start a VPATH build or use an absolute $srcdir.
955dfecf96Smrg#
96c05e22d7Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97c05e22d7Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98c05e22d7Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99c05e22d7Smrg# and then we would define $MISSING as
100c05e22d7Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
101c05e22d7Smrg# This will work as long as MISSING is not called from configure, because
102c05e22d7Smrg# unfortunately $(top_srcdir) has no meaning in configure.
103c05e22d7Smrg# However there are other variables, like CC, which are often used in
104c05e22d7Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
105c05e22d7Smrg#
106c05e22d7Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
107c05e22d7Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
108c05e22d7Smrg# configured tree to be moved without reconfiguration.
1095dfecf96Smrg
110c05e22d7SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
111c05e22d7Smrg[dnl Rely on autoconf to set up CDPATH properly.
112c05e22d7SmrgAC_PREREQ([2.50])dnl
113c05e22d7Smrg# expand $ac_aux_dir to an absolute path
114c05e22d7Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
115c05e22d7Smrg])
1165dfecf96Smrg
117c05e22d7Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1185dfecf96Smrg
119c05e22d7Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120c05e22d7Smrg# Free Software Foundation, Inc.
121c05e22d7Smrg#
122c05e22d7Smrg# This file is free software; the Free Software Foundation
123c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
124c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
1255dfecf96Smrg
126c05e22d7Smrg# serial 9
1275dfecf96Smrg
128c05e22d7Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129c05e22d7Smrg# -------------------------------------
130c05e22d7Smrg# Define a conditional.
131c05e22d7SmrgAC_DEFUN([AM_CONDITIONAL],
132c05e22d7Smrg[AC_PREREQ(2.52)dnl
133c05e22d7Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
134c05e22d7Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135c05e22d7SmrgAC_SUBST([$1_TRUE])dnl
136c05e22d7SmrgAC_SUBST([$1_FALSE])dnl
137c05e22d7Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138c05e22d7Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
139c05e22d7Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
140c05e22d7Smrgif $2; then
141c05e22d7Smrg  $1_TRUE=
142c05e22d7Smrg  $1_FALSE='#'
143c05e22d7Smrgelse
144c05e22d7Smrg  $1_TRUE='#'
145c05e22d7Smrg  $1_FALSE=
146c05e22d7Smrgfi
147c05e22d7SmrgAC_CONFIG_COMMANDS_PRE(
148c05e22d7Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149c05e22d7Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
150c05e22d7SmrgUsually this means the macro was only invoked conditionally.]])
151c05e22d7Smrgfi])])
1525dfecf96Smrg
15331de2854Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
15431de2854Smrg# 2010, 2011 Free Software Foundation, Inc.
155c05e22d7Smrg#
156c05e22d7Smrg# This file is free software; the Free Software Foundation
157c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
158c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
1595dfecf96Smrg
16031de2854Smrg# serial 12
1615dfecf96Smrg
162c05e22d7Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163c05e22d7Smrg# written in clear, in which case automake, when reading aclocal.m4,
164c05e22d7Smrg# will think it sees a *use*, and therefore will trigger all it's
165c05e22d7Smrg# C support machinery.  Also note that it means that autoscan, seeing
166c05e22d7Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1675dfecf96Smrg
1685dfecf96Smrg
169c05e22d7Smrg# _AM_DEPENDENCIES(NAME)
170c05e22d7Smrg# ----------------------
171c05e22d7Smrg# See how the compiler implements dependency checking.
172c05e22d7Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
173c05e22d7Smrg# We try a few techniques and use that to set a single cache variable.
174f14f4646Smrg#
175c05e22d7Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176c05e22d7Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177c05e22d7Smrg# dependency, and given that the user is not expected to run this macro,
178c05e22d7Smrg# just rely on AC_PROG_CC.
179c05e22d7SmrgAC_DEFUN([_AM_DEPENDENCIES],
180c05e22d7Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
181c05e22d7SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182c05e22d7SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
183c05e22d7SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1845dfecf96Smrg
185c05e22d7Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186c05e22d7Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187c05e22d7Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
188c05e22d7Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189c05e22d7Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190c05e22d7Smrg                   [depcc="$$1"   am_compiler_list=])
1915dfecf96Smrg
192c05e22d7SmrgAC_CACHE_CHECK([dependency style of $depcc],
193c05e22d7Smrg               [am_cv_$1_dependencies_compiler_type],
194c05e22d7Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195c05e22d7Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
196c05e22d7Smrg  # making bogus files that we don't know about and never remove.  For
197c05e22d7Smrg  # instance it was reported that on HP-UX the gcc test will end up
198c05e22d7Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
199c05e22d7Smrg  # in D'.
20031de2854Smrg  rm -rf conftest.dir
201c05e22d7Smrg  mkdir conftest.dir
202c05e22d7Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
203c05e22d7Smrg  # using a relative directory.
204c05e22d7Smrg  cp "$am_depcomp" conftest.dir
205c05e22d7Smrg  cd conftest.dir
206c05e22d7Smrg  # We will build objects and dependencies in a subdirectory because
207c05e22d7Smrg  # it helps to detect inapplicable dependency modes.  For instance
208c05e22d7Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
209c05e22d7Smrg  # side effect of compilation, but ICC will put the dependencies in
210c05e22d7Smrg  # the current directory while Tru64 will put them in the object
211c05e22d7Smrg  # directory.
212c05e22d7Smrg  mkdir sub
2135dfecf96Smrg
214c05e22d7Smrg  am_cv_$1_dependencies_compiler_type=none
215c05e22d7Smrg  if test "$am_compiler_list" = ""; then
216c05e22d7Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217c05e22d7Smrg  fi
218c05e22d7Smrg  am__universal=false
219c05e22d7Smrg  m4_case([$1], [CC],
220c05e22d7Smrg    [case " $depcc " in #(
221c05e22d7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
222c05e22d7Smrg     esac],
223c05e22d7Smrg    [CXX],
224c05e22d7Smrg    [case " $depcc " in #(
225c05e22d7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
226c05e22d7Smrg     esac])
2275dfecf96Smrg
228c05e22d7Smrg  for depmode in $am_compiler_list; do
229c05e22d7Smrg    # Setup a source with many dependencies, because some compilers
230c05e22d7Smrg    # like to wrap large dependency lists on column 80 (with \), and
231c05e22d7Smrg    # we should not choose a depcomp mode which is confused by this.
232c05e22d7Smrg    #
233c05e22d7Smrg    # We need to recreate these files for each test, as the compiler may
234c05e22d7Smrg    # overwrite some of them when testing with obscure command lines.
235c05e22d7Smrg    # This happens at least with the AIX C compiler.
236c05e22d7Smrg    : > sub/conftest.c
237c05e22d7Smrg    for i in 1 2 3 4 5 6; do
238c05e22d7Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
239c05e22d7Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
240c05e22d7Smrg      # Solaris 8's {/usr,}/bin/sh.
241c05e22d7Smrg      touch sub/conftst$i.h
242c05e22d7Smrg    done
243c05e22d7Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2445dfecf96Smrg
245c05e22d7Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
246c05e22d7Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
247c05e22d7Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
248c05e22d7Smrg    # versions had trouble with output in subdirs
249c05e22d7Smrg    am__obj=sub/conftest.${OBJEXT-o}
250c05e22d7Smrg    am__minus_obj="-o $am__obj"
251c05e22d7Smrg    case $depmode in
252c05e22d7Smrg    gcc)
253c05e22d7Smrg      # This depmode causes a compiler race in universal mode.
254c05e22d7Smrg      test "$am__universal" = false || continue
255c05e22d7Smrg      ;;
256c05e22d7Smrg    nosideeffect)
257c05e22d7Smrg      # after this tag, mechanisms are not by side-effect, so they'll
258c05e22d7Smrg      # only be used when explicitly requested
259c05e22d7Smrg      if test "x$enable_dependency_tracking" = xyes; then
260c05e22d7Smrg	continue
261c05e22d7Smrg      else
262c05e22d7Smrg	break
263c05e22d7Smrg      fi
264c05e22d7Smrg      ;;
26531de2854Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
266c05e22d7Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
267c05e22d7Smrg      # not run yet.  These depmodes are late enough in the game, and
268c05e22d7Smrg      # so weak that their functioning should not be impacted.
269c05e22d7Smrg      am__obj=conftest.${OBJEXT-o}
270c05e22d7Smrg      am__minus_obj=
271c05e22d7Smrg      ;;
272c05e22d7Smrg    none) break ;;
273c05e22d7Smrg    esac
274c05e22d7Smrg    if depmode=$depmode \
275c05e22d7Smrg       source=sub/conftest.c object=$am__obj \
276c05e22d7Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
277c05e22d7Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278c05e22d7Smrg         >/dev/null 2>conftest.err &&
279c05e22d7Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280c05e22d7Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
281c05e22d7Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282c05e22d7Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283c05e22d7Smrg      # icc doesn't choke on unknown options, it will just issue warnings
284c05e22d7Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
285c05e22d7Smrg      # that says an option was ignored or not supported.
286c05e22d7Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
287c05e22d7Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
288c05e22d7Smrg      # The diagnosis changed in icc 8.0:
289c05e22d7Smrg      #   icc: Command line remark: option '-MP' not supported
290c05e22d7Smrg      if (grep 'ignoring option' conftest.err ||
291c05e22d7Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292c05e22d7Smrg        am_cv_$1_dependencies_compiler_type=$depmode
293c05e22d7Smrg        break
294c05e22d7Smrg      fi
295c05e22d7Smrg    fi
296c05e22d7Smrg  done
2975dfecf96Smrg
298c05e22d7Smrg  cd ..
299c05e22d7Smrg  rm -rf conftest.dir
300c05e22d7Smrgelse
301c05e22d7Smrg  am_cv_$1_dependencies_compiler_type=none
3025dfecf96Smrgfi
303c05e22d7Smrg])
304c05e22d7SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305c05e22d7SmrgAM_CONDITIONAL([am__fastdep$1], [
306c05e22d7Smrg  test "x$enable_dependency_tracking" != xno \
307c05e22d7Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308c05e22d7Smrg])
3095dfecf96Smrg
3105dfecf96Smrg
311c05e22d7Smrg# AM_SET_DEPDIR
312c05e22d7Smrg# -------------
313c05e22d7Smrg# Choose a directory name for dependency files.
314c05e22d7Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315c05e22d7SmrgAC_DEFUN([AM_SET_DEPDIR],
316c05e22d7Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317c05e22d7SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318c05e22d7Smrg])
3195dfecf96Smrg
3205dfecf96Smrg
321c05e22d7Smrg# AM_DEP_TRACK
322c05e22d7Smrg# ------------
323c05e22d7SmrgAC_DEFUN([AM_DEP_TRACK],
324c05e22d7Smrg[AC_ARG_ENABLE(dependency-tracking,
325c05e22d7Smrg[  --disable-dependency-tracking  speeds up one-time build
326c05e22d7Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
327c05e22d7Smrgif test "x$enable_dependency_tracking" != xno; then
328c05e22d7Smrg  am_depcomp="$ac_aux_dir/depcomp"
329c05e22d7Smrg  AMDEPBACKSLASH='\'
33031de2854Smrg  am__nodep='_no'
3315dfecf96Smrgfi
332c05e22d7SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
333c05e22d7SmrgAC_SUBST([AMDEPBACKSLASH])dnl
334c05e22d7Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33531de2854SmrgAC_SUBST([am__nodep])dnl
33631de2854Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
337c05e22d7Smrg])
3385dfecf96Smrg
339c05e22d7Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3405dfecf96Smrg
341c05e22d7Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
342c05e22d7Smrg# Free Software Foundation, Inc.
343c05e22d7Smrg#
344c05e22d7Smrg# This file is free software; the Free Software Foundation
345c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
346c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
3475dfecf96Smrg
348c05e22d7Smrg#serial 5
3495dfecf96Smrg
350c05e22d7Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
351c05e22d7Smrg# ------------------------------
352c05e22d7SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
353c05e22d7Smrg[{
354c05e22d7Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
355c05e22d7Smrg  # are listed without --file.  Let's play safe and only enable the eval
356c05e22d7Smrg  # if we detect the quoting.
357c05e22d7Smrg  case $CONFIG_FILES in
358c05e22d7Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
359c05e22d7Smrg  *)   set x $CONFIG_FILES ;;
360c05e22d7Smrg  esac
361c05e22d7Smrg  shift
362c05e22d7Smrg  for mf
363c05e22d7Smrg  do
364c05e22d7Smrg    # Strip MF so we end up with the name of the file.
365c05e22d7Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
366c05e22d7Smrg    # Check whether this is an Automake generated Makefile or not.
367c05e22d7Smrg    # We used to match only the files named `Makefile.in', but
368c05e22d7Smrg    # some people rename them; so instead we look at the file content.
369c05e22d7Smrg    # Grep'ing the first line is not enough: some people post-process
370c05e22d7Smrg    # each Makefile.in and add a new line on top of each file to say so.
371c05e22d7Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
372c05e22d7Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
373c05e22d7Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
374c05e22d7Smrg      dirpart=`AS_DIRNAME("$mf")`
375c05e22d7Smrg    else
376c05e22d7Smrg      continue
377c05e22d7Smrg    fi
378c05e22d7Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
379c05e22d7Smrg    # from the Makefile without running `make'.
380c05e22d7Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
381c05e22d7Smrg    test -z "$DEPDIR" && continue
382c05e22d7Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
383c05e22d7Smrg    test -z "am__include" && continue
384c05e22d7Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
385c05e22d7Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
386c05e22d7Smrg    U=`sed -n 's/^U = //p' < "$mf"`
387c05e22d7Smrg    # Find all dependency output files, they are included files with
388c05e22d7Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
389c05e22d7Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
390c05e22d7Smrg    # expansion.
391c05e22d7Smrg    for file in `sed -n "
392c05e22d7Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
393c05e22d7Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
394c05e22d7Smrg      # Make sure the directory exists.
395c05e22d7Smrg      test -f "$dirpart/$file" && continue
396c05e22d7Smrg      fdir=`AS_DIRNAME(["$file"])`
397c05e22d7Smrg      AS_MKDIR_P([$dirpart/$fdir])
398c05e22d7Smrg      # echo "creating $dirpart/$file"
399c05e22d7Smrg      echo '# dummy' > "$dirpart/$file"
400c05e22d7Smrg    done
401c05e22d7Smrg  done
402c05e22d7Smrg}
403c05e22d7Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404c05e22d7Smrg
405c05e22d7Smrg
406c05e22d7Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
407c05e22d7Smrg# -----------------------------
408c05e22d7Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
409f14f4646Smrg#
410c05e22d7Smrg# This code is only required when automatic dependency tracking
411c05e22d7Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
412c05e22d7Smrg# need in order to bootstrap the dependency handling code.
413c05e22d7SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414c05e22d7Smrg[AC_CONFIG_COMMANDS([depfiles],
415c05e22d7Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416c05e22d7Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417c05e22d7Smrg])
418f14f4646Smrg
419c05e22d7Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4205dfecf96Smrg
421c05e22d7Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
422c05e22d7Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423c05e22d7Smrg#
424c05e22d7Smrg# This file is free software; the Free Software Foundation
425c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
426c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
4275dfecf96Smrg
428c05e22d7Smrg# serial 16
4295dfecf96Smrg
430c05e22d7Smrg# This macro actually does too much.  Some checks are only needed if
431c05e22d7Smrg# your package does certain things.  But this isn't really a big deal.
4325dfecf96Smrg
433c05e22d7Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
434c05e22d7Smrg# AM_INIT_AUTOMAKE([OPTIONS])
435c05e22d7Smrg# -----------------------------------------------
436c05e22d7Smrg# The call with PACKAGE and VERSION arguments is the old style
437c05e22d7Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
438c05e22d7Smrg# and VERSION should now be passed to AC_INIT and removed from
439c05e22d7Smrg# the call to AM_INIT_AUTOMAKE.
440c05e22d7Smrg# We support both call styles for the transition.  After
441c05e22d7Smrg# the next Automake release, Autoconf can make the AC_INIT
442c05e22d7Smrg# arguments mandatory, and then we can depend on a new Autoconf
443c05e22d7Smrg# release and drop the old call support.
444c05e22d7SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
445c05e22d7Smrg[AC_PREREQ([2.62])dnl
446c05e22d7Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
447c05e22d7Smrgdnl the ones we care about.
448c05e22d7Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
449c05e22d7SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
450c05e22d7SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
451c05e22d7Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
452c05e22d7Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
453c05e22d7Smrg  # is not polluted with repeated "-I."
454c05e22d7Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
455c05e22d7Smrg  # test to see if srcdir already configured
456c05e22d7Smrg  if test -f $srcdir/config.status; then
457c05e22d7Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
458c05e22d7Smrg  fi
4595dfecf96Smrgfi
4605dfecf96Smrg
461c05e22d7Smrg# test whether we have cygpath
462c05e22d7Smrgif test -z "$CYGPATH_W"; then
463c05e22d7Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
464c05e22d7Smrg    CYGPATH_W='cygpath -w'
465c05e22d7Smrg  else
466c05e22d7Smrg    CYGPATH_W=echo
467c05e22d7Smrg  fi
468c05e22d7Smrgfi
469c05e22d7SmrgAC_SUBST([CYGPATH_W])
4705dfecf96Smrg
471c05e22d7Smrg# Define the identity of the package.
472c05e22d7Smrgdnl Distinguish between old-style and new-style calls.
473c05e22d7Smrgm4_ifval([$2],
474c05e22d7Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
475c05e22d7Smrg AC_SUBST([PACKAGE], [$1])dnl
476c05e22d7Smrg AC_SUBST([VERSION], [$2])],
477c05e22d7Smrg[_AM_SET_OPTIONS([$1])dnl
478c05e22d7Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
479c05e22d7Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
480c05e22d7Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
481c05e22d7Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
482c05e22d7Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4835dfecf96Smrg
484c05e22d7Smrg_AM_IF_OPTION([no-define],,
485c05e22d7Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
486c05e22d7Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4875dfecf96Smrg
488c05e22d7Smrg# Some tools Automake needs.
489c05e22d7SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
490c05e22d7SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
491c05e22d7SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
492c05e22d7SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
493c05e22d7SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
494c05e22d7SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
495c05e22d7SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
496c05e22d7SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
497c05e22d7SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
498c05e22d7SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
499c05e22d7Smrg# We need awk for the "check" target.  The system "awk" is bad on
500c05e22d7Smrg# some platforms.
501c05e22d7SmrgAC_REQUIRE([AC_PROG_AWK])dnl
502c05e22d7SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
503c05e22d7SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
504c05e22d7Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
505c05e22d7Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
506c05e22d7Smrg			     [_AM_PROG_TAR([v7])])])
507c05e22d7Smrg_AM_IF_OPTION([no-dependencies],,
508c05e22d7Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
509c05e22d7Smrg		  [_AM_DEPENDENCIES(CC)],
510c05e22d7Smrg		  [define([AC_PROG_CC],
511c05e22d7Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
512c05e22d7SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
513c05e22d7Smrg		  [_AM_DEPENDENCIES(CXX)],
514c05e22d7Smrg		  [define([AC_PROG_CXX],
515c05e22d7Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
516c05e22d7SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
517c05e22d7Smrg		  [_AM_DEPENDENCIES(OBJC)],
518c05e22d7Smrg		  [define([AC_PROG_OBJC],
519c05e22d7Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
520c05e22d7Smrg])
521c05e22d7Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
522c05e22d7Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
523c05e22d7Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
524c05e22d7Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
525c05e22d7SmrgAC_CONFIG_COMMANDS_PRE(dnl
526c05e22d7Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
527c05e22d7Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
528c05e22d7Smrg])
5295dfecf96Smrg
530c05e22d7Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
531c05e22d7Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
532c05e22d7Smrgdnl mangled by Autoconf and run in a shell conditional statement.
533c05e22d7Smrgm4_define([_AC_COMPILER_EXEEXT],
534c05e22d7Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
535f14f4646Smrg
536f14f4646Smrg
537c05e22d7Smrg# When config.status generates a header, we must update the stamp-h file.
538c05e22d7Smrg# This file resides in the same directory as the config header
539c05e22d7Smrg# that is generated.  The stamp files are numbered to have different names.
540f14f4646Smrg
541c05e22d7Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
542c05e22d7Smrg# loop where config.status creates the headers, so we can generate
543c05e22d7Smrg# our stamp files there.
544c05e22d7SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
545c05e22d7Smrg[# Compute $1's index in $config_headers.
546c05e22d7Smrg_am_arg=$1
547c05e22d7Smrg_am_stamp_count=1
548c05e22d7Smrgfor _am_header in $config_headers :; do
549c05e22d7Smrg  case $_am_header in
550c05e22d7Smrg    $_am_arg | $_am_arg:* )
551c05e22d7Smrg      break ;;
552c05e22d7Smrg    * )
553c05e22d7Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
554c05e22d7Smrg  esac
555c05e22d7Smrgdone
556c05e22d7Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557f14f4646Smrg
55831de2854Smrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
55931de2854Smrg# Inc.
560c05e22d7Smrg#
561c05e22d7Smrg# This file is free software; the Free Software Foundation
562c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
563c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
564f14f4646Smrg
56531de2854Smrg# serial 1
56631de2854Smrg
567c05e22d7Smrg# AM_PROG_INSTALL_SH
568c05e22d7Smrg# ------------------
569c05e22d7Smrg# Define $install_sh.
570c05e22d7SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
571c05e22d7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
572c05e22d7Smrgif test x"${install_sh}" != xset; then
573c05e22d7Smrg  case $am_aux_dir in
574c05e22d7Smrg  *\ * | *\	*)
575c05e22d7Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
576c05e22d7Smrg  *)
577c05e22d7Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
578c05e22d7Smrg  esac
579f14f4646Smrgfi
580c05e22d7SmrgAC_SUBST(install_sh)])
581f14f4646Smrg
582c05e22d7Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
583c05e22d7Smrg#
584c05e22d7Smrg# This file is free software; the Free Software Foundation
585c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
586c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
587f14f4646Smrg
588c05e22d7Smrg# serial 2
589f14f4646Smrg
590c05e22d7Smrg# Check whether the underlying file-system supports filenames
591c05e22d7Smrg# with a leading dot.  For instance MS-DOS doesn't.
592c05e22d7SmrgAC_DEFUN([AM_SET_LEADING_DOT],
593c05e22d7Smrg[rm -rf .tst 2>/dev/null
594c05e22d7Smrgmkdir .tst 2>/dev/null
595c05e22d7Smrgif test -d .tst; then
596c05e22d7Smrg  am__leading_dot=.
597c05e22d7Smrgelse
598c05e22d7Smrg  am__leading_dot=_
599c05e22d7Smrgfi
600c05e22d7Smrgrmdir .tst 2>/dev/null
601c05e22d7SmrgAC_SUBST([am__leading_dot])])
602f14f4646Smrg
603c05e22d7Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
604c05e22d7Smrg# From Jim Meyering
605c05e22d7Smrg
60631de2854Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
60731de2854Smrg# 2011 Free Software Foundation, Inc.
608f14f4646Smrg#
609c05e22d7Smrg# This file is free software; the Free Software Foundation
610c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
611c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
6125dfecf96Smrg
613c05e22d7Smrg# serial 5
6145dfecf96Smrg
615c05e22d7Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
616c05e22d7Smrg# ----------------------------------
617c05e22d7Smrg# Control maintainer-specific portions of Makefiles.
618c05e22d7Smrg# Default is to disable them, unless `enable' is passed literally.
619c05e22d7Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
620c05e22d7Smrg# can override the default with the --enable/--disable switch.
621c05e22d7SmrgAC_DEFUN([AM_MAINTAINER_MODE],
622c05e22d7Smrg[m4_case(m4_default([$1], [disable]),
623c05e22d7Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
624c05e22d7Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
625c05e22d7Smrg       [m4_define([am_maintainer_other], [enable])
626c05e22d7Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
62731de2854SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
628c05e22d7Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
629c05e22d7Smrg  AC_ARG_ENABLE([maintainer-mode],
630c05e22d7Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
631c05e22d7Smrg			  (and sometimes confusing) to the casual installer],
632c05e22d7Smrg      [USE_MAINTAINER_MODE=$enableval],
633c05e22d7Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634c05e22d7Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
635c05e22d7Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636c05e22d7Smrg  MAINT=$MAINTAINER_MODE_TRUE
637c05e22d7Smrg  AC_SUBST([MAINT])dnl
638c05e22d7Smrg]
639c05e22d7Smrg)
6405dfecf96Smrg
641c05e22d7SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
6425dfecf96Smrg
643c05e22d7Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644c05e22d7Smrg
645c05e22d7Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
646f14f4646Smrg#
647c05e22d7Smrg# This file is free software; the Free Software Foundation
648c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
649c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
650f14f4646Smrg
651c05e22d7Smrg# serial 4
652c05e22d7Smrg
653c05e22d7Smrg# AM_MAKE_INCLUDE()
654c05e22d7Smrg# -----------------
655c05e22d7Smrg# Check to see how make treats includes.
656c05e22d7SmrgAC_DEFUN([AM_MAKE_INCLUDE],
657c05e22d7Smrg[am_make=${MAKE-make}
658c05e22d7Smrgcat > confinc << 'END'
659c05e22d7Smrgam__doit:
660c05e22d7Smrg	@echo this is the am__doit target
661c05e22d7Smrg.PHONY: am__doit
662c05e22d7SmrgEND
663c05e22d7Smrg# If we don't find an include directive, just comment out the code.
664c05e22d7SmrgAC_MSG_CHECKING([for style of include used by $am_make])
665c05e22d7Smrgam__include="#"
666c05e22d7Smrgam__quote=
667c05e22d7Smrg_am_result=none
668c05e22d7Smrg# First try GNU make style include.
669c05e22d7Smrgecho "include confinc" > confmf
670c05e22d7Smrg# Ignore all kinds of additional output from `make'.
671c05e22d7Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
672c05e22d7Smrg*the\ am__doit\ target*)
673c05e22d7Smrg  am__include=include
674c05e22d7Smrg  am__quote=
675c05e22d7Smrg  _am_result=GNU
676c05e22d7Smrg  ;;
677c05e22d7Smrgesac
678c05e22d7Smrg# Now try BSD make style include.
679c05e22d7Smrgif test "$am__include" = "#"; then
680c05e22d7Smrg   echo '.include "confinc"' > confmf
681c05e22d7Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
682c05e22d7Smrg   *the\ am__doit\ target*)
683c05e22d7Smrg     am__include=.include
684c05e22d7Smrg     am__quote="\""
685c05e22d7Smrg     _am_result=BSD
686c05e22d7Smrg     ;;
687c05e22d7Smrg   esac
688f14f4646Smrgfi
689c05e22d7SmrgAC_SUBST([am__include])
690c05e22d7SmrgAC_SUBST([am__quote])
691c05e22d7SmrgAC_MSG_RESULT([$_am_result])
692c05e22d7Smrgrm -f confinc confmf
693c05e22d7Smrg])
694f14f4646Smrg
695c05e22d7Smrg# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
696c05e22d7Smrg# Free Software Foundation, Inc.
697c05e22d7Smrg#
698c05e22d7Smrg# This file is free software; the Free Software Foundation
699c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
700c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
701f14f4646Smrg
702c05e22d7Smrg# serial 6
703f14f4646Smrg
704c05e22d7Smrg# AM_PROG_CC_C_O
705c05e22d7Smrg# --------------
706c05e22d7Smrg# Like AC_PROG_CC_C_O, but changed for automake.
707c05e22d7SmrgAC_DEFUN([AM_PROG_CC_C_O],
708c05e22d7Smrg[AC_REQUIRE([AC_PROG_CC_C_O])dnl
709c05e22d7SmrgAC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
710c05e22d7SmrgAC_REQUIRE_AUX_FILE([compile])dnl
711c05e22d7Smrg# FIXME: we rely on the cache variable name because
712c05e22d7Smrg# there is no other way.
713c05e22d7Smrgset dummy $CC
714c05e22d7Smrgam_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
715c05e22d7Smrgeval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
716c05e22d7Smrgif test "$am_t" != yes; then
717c05e22d7Smrg   # Losing compiler, so override with the script.
718c05e22d7Smrg   # FIXME: It is wrong to rewrite CC.
719c05e22d7Smrg   # But if we don't then we get into trouble of one sort or another.
720c05e22d7Smrg   # A longer-term fix would be to have automake use am__CC in this case,
721c05e22d7Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
722c05e22d7Smrg   CC="$am_aux_dir/compile $CC"
723c05e22d7Smrgfi
724c05e22d7Smrgdnl Make sure AC_PROG_CC is never called again, or it will override our
725c05e22d7Smrgdnl setting of CC.
726c05e22d7Smrgm4_define([AC_PROG_CC],
727c05e22d7Smrg          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
728c05e22d7Smrg])
729c05e22d7Smrg
730c05e22d7Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
731c05e22d7Smrg
732c05e22d7Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
733c05e22d7Smrg# Free Software Foundation, Inc.
734f14f4646Smrg#
735c05e22d7Smrg# This file is free software; the Free Software Foundation
736c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
737c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
738f14f4646Smrg
739c05e22d7Smrg# serial 6
740f14f4646Smrg
741c05e22d7Smrg# AM_MISSING_PROG(NAME, PROGRAM)
742c05e22d7Smrg# ------------------------------
743c05e22d7SmrgAC_DEFUN([AM_MISSING_PROG],
744c05e22d7Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
745c05e22d7Smrg$1=${$1-"${am_missing_run}$2"}
746c05e22d7SmrgAC_SUBST($1)])
747f14f4646Smrg
7485dfecf96Smrg
749c05e22d7Smrg# AM_MISSING_HAS_RUN
750c05e22d7Smrg# ------------------
751c05e22d7Smrg# Define MISSING if not defined so far and test if it supports --run.
752c05e22d7Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
753c05e22d7SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
754c05e22d7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
755c05e22d7SmrgAC_REQUIRE_AUX_FILE([missing])dnl
756c05e22d7Smrgif test x"${MISSING+set}" != xset; then
757c05e22d7Smrg  case $am_aux_dir in
758c05e22d7Smrg  *\ * | *\	*)
759c05e22d7Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
760c05e22d7Smrg  *)
761c05e22d7Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
762c05e22d7Smrg  esac
763c05e22d7Smrgfi
764c05e22d7Smrg# Use eval to expand $SHELL
765c05e22d7Smrgif eval "$MISSING --run true"; then
766c05e22d7Smrg  am_missing_run="$MISSING --run "
767c05e22d7Smrgelse
768c05e22d7Smrg  am_missing_run=
769c05e22d7Smrg  AC_MSG_WARN([`missing' script is too old or missing])
770c05e22d7Smrgfi
7715dfecf96Smrg])
7725dfecf96Smrg
77331de2854Smrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
77431de2854Smrg# Inc.
7755dfecf96Smrg#
7765dfecf96Smrg# This file is free software; the Free Software Foundation
7775dfecf96Smrg# gives unlimited permission to copy and/or distribute it,
7785dfecf96Smrg# with or without modifications, as long as this notice is preserved.
7795dfecf96Smrg
78031de2854Smrg# serial 1
78131de2854Smrg
782c05e22d7Smrg# AM_PROG_MKDIR_P
783c05e22d7Smrg# ---------------
784c05e22d7Smrg# Check for `mkdir -p'.
785c05e22d7SmrgAC_DEFUN([AM_PROG_MKDIR_P],
786c05e22d7Smrg[AC_PREREQ([2.60])dnl
787c05e22d7SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
788c05e22d7Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
789c05e22d7Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
790c05e22d7Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
791c05e22d7Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
792c05e22d7Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
793c05e22d7Smrgdnl adjustment using top_builddir (which is defined more often than
794c05e22d7Smrgdnl MKDIR_P).
795c05e22d7SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
796c05e22d7Smrgcase $mkdir_p in
797c05e22d7Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
798c05e22d7Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
799c05e22d7Smrgesac
800f14f4646Smrg])
801f14f4646Smrg
802c05e22d7Smrg# Helper functions for option handling.                     -*- Autoconf -*-
8035dfecf96Smrg
80431de2854Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
80531de2854Smrg# Foundation, Inc.
8065dfecf96Smrg#
8075dfecf96Smrg# This file is free software; the Free Software Foundation
8085dfecf96Smrg# gives unlimited permission to copy and/or distribute it,
8095dfecf96Smrg# with or without modifications, as long as this notice is preserved.
8105dfecf96Smrg
81131de2854Smrg# serial 5
8125dfecf96Smrg
813c05e22d7Smrg# _AM_MANGLE_OPTION(NAME)
814c05e22d7Smrg# -----------------------
815c05e22d7SmrgAC_DEFUN([_AM_MANGLE_OPTION],
816c05e22d7Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
8175dfecf96Smrg
818c05e22d7Smrg# _AM_SET_OPTION(NAME)
81931de2854Smrg# --------------------
820c05e22d7Smrg# Set option NAME.  Presently that only means defining a flag for this option.
821c05e22d7SmrgAC_DEFUN([_AM_SET_OPTION],
822c05e22d7Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
823c05e22d7Smrg
824c05e22d7Smrg# _AM_SET_OPTIONS(OPTIONS)
82531de2854Smrg# ------------------------
826c05e22d7Smrg# OPTIONS is a space-separated list of Automake options.
827c05e22d7SmrgAC_DEFUN([_AM_SET_OPTIONS],
828c05e22d7Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
829c05e22d7Smrg
830c05e22d7Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
831c05e22d7Smrg# -------------------------------------------
832c05e22d7Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
833c05e22d7SmrgAC_DEFUN([_AM_IF_OPTION],
834c05e22d7Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
8355dfecf96Smrg
836c05e22d7Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
837c05e22d7Smrg
838c05e22d7Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
8395dfecf96Smrg# Free Software Foundation, Inc.
8405dfecf96Smrg#
8415dfecf96Smrg# This file is free software; the Free Software Foundation
8425dfecf96Smrg# gives unlimited permission to copy and/or distribute it,
8435dfecf96Smrg# with or without modifications, as long as this notice is preserved.
8445dfecf96Smrg
845c05e22d7Smrg# serial 5
8465dfecf96Smrg
847c05e22d7Smrg# AM_SANITY_CHECK
848c05e22d7Smrg# ---------------
849c05e22d7SmrgAC_DEFUN([AM_SANITY_CHECK],
850c05e22d7Smrg[AC_MSG_CHECKING([whether build environment is sane])
851c05e22d7Smrg# Just in case
852c05e22d7Smrgsleep 1
853c05e22d7Smrgecho timestamp > conftest.file
854c05e22d7Smrg# Reject unsafe characters in $srcdir or the absolute working directory
855c05e22d7Smrg# name.  Accept space and tab only in the latter.
856c05e22d7Smrgam_lf='
857c05e22d7Smrg'
858c05e22d7Smrgcase `pwd` in
859c05e22d7Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
860c05e22d7Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
861c05e22d7Smrgesac
862c05e22d7Smrgcase $srcdir in
863c05e22d7Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
864c05e22d7Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
865c05e22d7Smrgesac
866c05e22d7Smrg
867c05e22d7Smrg# Do `set' in a subshell so we don't clobber the current shell's
868c05e22d7Smrg# arguments.  Must try -L first in case configure is actually a
869c05e22d7Smrg# symlink; some systems play weird games with the mod time of symlinks
870c05e22d7Smrg# (eg FreeBSD returns the mod time of the symlink's containing
871c05e22d7Smrg# directory).
872c05e22d7Smrgif (
873c05e22d7Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
874c05e22d7Smrg   if test "$[*]" = "X"; then
875c05e22d7Smrg      # -L didn't work.
876c05e22d7Smrg      set X `ls -t "$srcdir/configure" conftest.file`
877c05e22d7Smrg   fi
878c05e22d7Smrg   rm -f conftest.file
879c05e22d7Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
880c05e22d7Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
881c05e22d7Smrg
882c05e22d7Smrg      # If neither matched, then we have a broken ls.  This can happen
883c05e22d7Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
884c05e22d7Smrg      # broken ls alias from the environment.  This has actually
885c05e22d7Smrg      # happened.  Such a system could not be considered "sane".
886c05e22d7Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
887c05e22d7Smrgalias in your environment])
888c05e22d7Smrg   fi
889c05e22d7Smrg
890c05e22d7Smrg   test "$[2]" = conftest.file
891c05e22d7Smrg   )
892c05e22d7Smrgthen
893c05e22d7Smrg   # Ok.
894c05e22d7Smrg   :
8955dfecf96Smrgelse
896c05e22d7Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
897c05e22d7SmrgCheck your system clock])
8985dfecf96Smrgfi
899c05e22d7SmrgAC_MSG_RESULT(yes)])
9005dfecf96Smrg
901c05e22d7Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
9025dfecf96Smrg#
9035dfecf96Smrg# This file is free software; the Free Software Foundation
9045dfecf96Smrg# gives unlimited permission to copy and/or distribute it,
9055dfecf96Smrg# with or without modifications, as long as this notice is preserved.
9065dfecf96Smrg
907c05e22d7Smrg# serial 1
9085dfecf96Smrg
909c05e22d7Smrg# AM_SILENT_RULES([DEFAULT])
910c05e22d7Smrg# --------------------------
911c05e22d7Smrg# Enable less verbose build rules; with the default set to DEFAULT
912c05e22d7Smrg# (`yes' being less verbose, `no' or empty being verbose).
913c05e22d7SmrgAC_DEFUN([AM_SILENT_RULES],
914c05e22d7Smrg[AC_ARG_ENABLE([silent-rules],
915c05e22d7Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
916c05e22d7Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
917c05e22d7Smrgcase $enable_silent_rules in
918c05e22d7Smrgyes) AM_DEFAULT_VERBOSITY=0;;
919c05e22d7Smrgno)  AM_DEFAULT_VERBOSITY=1;;
920c05e22d7Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
921c05e22d7Smrgesac
922c05e22d7SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
923c05e22d7SmrgAM_BACKSLASH='\'
924c05e22d7SmrgAC_SUBST([AM_BACKSLASH])dnl
925c05e22d7Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
926c05e22d7Smrg])
9275dfecf96Smrg
92831de2854Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
929c05e22d7Smrg#
930c05e22d7Smrg# This file is free software; the Free Software Foundation
931c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
932c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
9335dfecf96Smrg
93431de2854Smrg# serial 1
93531de2854Smrg
936c05e22d7Smrg# AM_PROG_INSTALL_STRIP
937c05e22d7Smrg# ---------------------
938c05e22d7Smrg# One issue with vendor `install' (even GNU) is that you can't
939c05e22d7Smrg# specify the program used to strip binaries.  This is especially
940c05e22d7Smrg# annoying in cross-compiling environments, where the build's strip
941c05e22d7Smrg# is unlikely to handle the host's binaries.
942c05e22d7Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
943c05e22d7Smrg# always use install-sh in `make install-strip', and initialize
944c05e22d7Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
945c05e22d7SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
946c05e22d7Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
947c05e22d7Smrg# Installed binaries are usually stripped using `strip' when the user
948c05e22d7Smrg# run `make install-strip'.  However `strip' might not be the right
949c05e22d7Smrg# tool to use in cross-compilation environments, therefore Automake
950c05e22d7Smrg# will honor the `STRIP' environment variable to overrule this program.
951c05e22d7Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
952c05e22d7Smrgif test "$cross_compiling" != no; then
953c05e22d7Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
954c05e22d7Smrgfi
955c05e22d7SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
956c05e22d7SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
957c05e22d7Smrg
95831de2854Smrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
9595dfecf96Smrg#
960c05e22d7Smrg# This file is free software; the Free Software Foundation
961c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
962c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
9635dfecf96Smrg
96431de2854Smrg# serial 3
9655dfecf96Smrg
966c05e22d7Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
967c05e22d7Smrg# ---------------------------
968c05e22d7Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
969c05e22d7Smrg# This macro is traced by Automake.
970c05e22d7SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9715dfecf96Smrg
972c05e22d7Smrg# AM_SUBST_NOTMAKE(VARIABLE)
97331de2854Smrg# --------------------------
974c05e22d7Smrg# Public sister of _AM_SUBST_NOTMAKE.
975c05e22d7SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
976c05e22d7Smrg
977c05e22d7Smrg# Check how to create a tarball.                            -*- Autoconf -*-
978c05e22d7Smrg
979c05e22d7Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
980c05e22d7Smrg#
981c05e22d7Smrg# This file is free software; the Free Software Foundation
982c05e22d7Smrg# gives unlimited permission to copy and/or distribute it,
983c05e22d7Smrg# with or without modifications, as long as this notice is preserved.
984c05e22d7Smrg
985c05e22d7Smrg# serial 2
986c05e22d7Smrg
987c05e22d7Smrg# _AM_PROG_TAR(FORMAT)
988c05e22d7Smrg# --------------------
989c05e22d7Smrg# Check how to create a tarball in format FORMAT.
990c05e22d7Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
991c05e22d7Smrg#
992c05e22d7Smrg# Substitute a variable $(am__tar) that is a command
993c05e22d7Smrg# writing to stdout a FORMAT-tarball containing the directory
994c05e22d7Smrg# $tardir.
995c05e22d7Smrg#     tardir=directory && $(am__tar) > result.tar
996c05e22d7Smrg#
997c05e22d7Smrg# Substitute a variable $(am__untar) that extract such
998c05e22d7Smrg# a tarball read from stdin.
999c05e22d7Smrg#     $(am__untar) < result.tar
1000c05e22d7SmrgAC_DEFUN([_AM_PROG_TAR],
1001c05e22d7Smrg[# Always define AMTAR for backward compatibility.
1002c05e22d7SmrgAM_MISSING_PROG([AMTAR], [tar])
1003c05e22d7Smrgm4_if([$1], [v7],
1004c05e22d7Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
1005c05e22d7Smrg     [m4_case([$1], [ustar],, [pax],,
1006c05e22d7Smrg              [m4_fatal([Unknown tar format])])
1007c05e22d7SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
1008c05e22d7Smrg# Loop over all known methods to create a tar archive until one works.
1009c05e22d7Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1010c05e22d7Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1011c05e22d7Smrg# Do not fold the above two line into one, because Tru64 sh and
1012c05e22d7Smrg# Solaris sh will not grok spaces in the rhs of `-'.
1013c05e22d7Smrgfor _am_tool in $_am_tools
1014c05e22d7Smrgdo
1015c05e22d7Smrg  case $_am_tool in
1016c05e22d7Smrg  gnutar)
1017c05e22d7Smrg    for _am_tar in tar gnutar gtar;
1018c05e22d7Smrg    do
1019c05e22d7Smrg      AM_RUN_LOG([$_am_tar --version]) && break
10205dfecf96Smrg    done
1021c05e22d7Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1022c05e22d7Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1023c05e22d7Smrg    am__untar="$_am_tar -xf -"
1024c05e22d7Smrg    ;;
1025c05e22d7Smrg  plaintar)
1026c05e22d7Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
1027c05e22d7Smrg    # ustar tarball either.
1028c05e22d7Smrg    (tar --version) >/dev/null 2>&1 && continue
1029c05e22d7Smrg    am__tar='tar chf - "$$tardir"'
1030c05e22d7Smrg    am__tar_='tar chf - "$tardir"'
1031c05e22d7Smrg    am__untar='tar xf -'
1032c05e22d7Smrg    ;;
1033c05e22d7Smrg  pax)
1034c05e22d7Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
1035c05e22d7Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
1036c05e22d7Smrg    am__untar='pax -r'
1037c05e22d7Smrg    ;;
1038c05e22d7Smrg  cpio)
1039c05e22d7Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1040c05e22d7Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1041c05e22d7Smrg    am__untar='cpio -i -H $1 -d'
1042c05e22d7Smrg    ;;
1043c05e22d7Smrg  none)
1044c05e22d7Smrg    am__tar=false
1045c05e22d7Smrg    am__tar_=false
1046c05e22d7Smrg    am__untar=false
1047c05e22d7Smrg    ;;
1048c05e22d7Smrg  esac
10495dfecf96Smrg
1050c05e22d7Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
1051c05e22d7Smrg  # and am__untar set.
1052c05e22d7Smrg  test -n "${am_cv_prog_tar_$1}" && break
1053c05e22d7Smrg
1054c05e22d7Smrg  # tar/untar a dummy directory, and stop if the command works
1055c05e22d7Smrg  rm -rf conftest.dir
1056c05e22d7Smrg  mkdir conftest.dir
1057c05e22d7Smrg  echo GrepMe > conftest.dir/file
1058c05e22d7Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1059c05e22d7Smrg  rm -rf conftest.dir
1060c05e22d7Smrg  if test -s conftest.tar; then
1061c05e22d7Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1062c05e22d7Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1063c05e22d7Smrg  fi
1064c05e22d7Smrgdone
1065c05e22d7Smrgrm -rf conftest.dir
1066c05e22d7Smrg
1067c05e22d7SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1068c05e22d7SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1069c05e22d7SmrgAC_SUBST([am__tar])
1070c05e22d7SmrgAC_SUBST([am__untar])
1071c05e22d7Smrg]) # _AM_PROG_TAR
1072c05e22d7Smrg
107331de2854Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
107431de2854Smrg# 
107531de2854Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
107631de2854Smrg#
107731de2854Smrg# This program is free software; you can redistribute it and/or modify
107831de2854Smrg# it under the terms of the GNU General Public License as published by
107931de2854Smrg# the Free Software Foundation; either version 2 of the License, or
108031de2854Smrg# (at your option) any later version.
108131de2854Smrg#
108231de2854Smrg# This program is distributed in the hope that it will be useful, but
108331de2854Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
108431de2854Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
108531de2854Smrg# General Public License for more details.
108631de2854Smrg#
108731de2854Smrg# You should have received a copy of the GNU General Public License
108831de2854Smrg# along with this program; if not, write to the Free Software
108931de2854Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
109031de2854Smrg#
109131de2854Smrg# As a special exception to the GNU General Public License, if you
109231de2854Smrg# distribute this file as part of a program that contains a
109331de2854Smrg# configuration script generated by Autoconf, you may include it under
109431de2854Smrg# the same distribution terms that you use for the rest of that program.
109531de2854Smrg
109631de2854Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
109731de2854Smrg# ----------------------------------
109831de2854SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
109931de2854Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
110031de2854Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
110131de2854SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
110231de2854Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
110331de2854Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
110431de2854Smrgfi
110531de2854Smrgif test -n "$PKG_CONFIG"; then
110631de2854Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
110731de2854Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
110831de2854Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
110931de2854Smrg		AC_MSG_RESULT([yes])
111031de2854Smrg	else
111131de2854Smrg		AC_MSG_RESULT([no])
111231de2854Smrg		PKG_CONFIG=""
111331de2854Smrg	fi
111431de2854Smrg		
111531de2854Smrgfi[]dnl
111631de2854Smrg])# PKG_PROG_PKG_CONFIG
111731de2854Smrg
111831de2854Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
111931de2854Smrg#
112031de2854Smrg# Check to see whether a particular set of modules exists.  Similar
112131de2854Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
112231de2854Smrg#
112331de2854Smrg#
112431de2854Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
112531de2854Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
112631de2854Smrg# PKG_CHECK_EXISTS manually
112731de2854Smrg# --------------------------------------------------------------
112831de2854SmrgAC_DEFUN([PKG_CHECK_EXISTS],
112931de2854Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
113031de2854Smrgif test -n "$PKG_CONFIG" && \
113131de2854Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
113231de2854Smrg  m4_ifval([$2], [$2], [:])
113331de2854Smrgm4_ifvaln([$3], [else
113431de2854Smrg  $3])dnl
113531de2854Smrgfi])
113631de2854Smrg
113731de2854Smrg
113831de2854Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
113931de2854Smrg# ---------------------------------------------
114031de2854Smrgm4_define([_PKG_CONFIG],
114131de2854Smrg[if test -n "$$1"; then
114231de2854Smrg    pkg_cv_[]$1="$$1"
114331de2854Smrg elif test -n "$PKG_CONFIG"; then
114431de2854Smrg    PKG_CHECK_EXISTS([$3],
114531de2854Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
114631de2854Smrg		     [pkg_failed=yes])
114731de2854Smrg else
114831de2854Smrg    pkg_failed=untried
114931de2854Smrgfi[]dnl
115031de2854Smrg])# _PKG_CONFIG
115131de2854Smrg
115231de2854Smrg# _PKG_SHORT_ERRORS_SUPPORTED
115331de2854Smrg# -----------------------------
115431de2854SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
115531de2854Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
115631de2854Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
115731de2854Smrg        _pkg_short_errors_supported=yes
115831de2854Smrgelse
115931de2854Smrg        _pkg_short_errors_supported=no
116031de2854Smrgfi[]dnl
116131de2854Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
116231de2854Smrg
116331de2854Smrg
116431de2854Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
116531de2854Smrg# [ACTION-IF-NOT-FOUND])
116631de2854Smrg#
116731de2854Smrg#
116831de2854Smrg# Note that if there is a possibility the first call to
116931de2854Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
117031de2854Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
117131de2854Smrg#
117231de2854Smrg#
117331de2854Smrg# --------------------------------------------------------------
117431de2854SmrgAC_DEFUN([PKG_CHECK_MODULES],
117531de2854Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
117631de2854SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
117731de2854SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
117831de2854Smrg
117931de2854Smrgpkg_failed=no
118031de2854SmrgAC_MSG_CHECKING([for $1])
118131de2854Smrg
118231de2854Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
118331de2854Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
118431de2854Smrg
118531de2854Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
118631de2854Smrgand $1[]_LIBS to avoid the need to call pkg-config.
118731de2854SmrgSee the pkg-config man page for more details.])
118831de2854Smrg
118931de2854Smrgif test $pkg_failed = yes; then
119031de2854Smrg        _PKG_SHORT_ERRORS_SUPPORTED
119131de2854Smrg        if test $_pkg_short_errors_supported = yes; then
119231de2854Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
119331de2854Smrg        else 
119431de2854Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
119531de2854Smrg        fi
119631de2854Smrg	# Put the nasty error message in config.log where it belongs
119731de2854Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
119831de2854Smrg
119931de2854Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
120031de2854Smrg[Package requirements ($2) were not met:
120131de2854Smrg
120231de2854Smrg$$1_PKG_ERRORS
120331de2854Smrg
120431de2854SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
120531de2854Smrginstalled software in a non-standard prefix.
120631de2854Smrg
120731de2854Smrg_PKG_TEXT
120831de2854Smrg])],
120931de2854Smrg		[AC_MSG_RESULT([no])
121031de2854Smrg                $4])
121131de2854Smrgelif test $pkg_failed = untried; then
121231de2854Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
121331de2854Smrg[The pkg-config script could not be found or is too old.  Make sure it
121431de2854Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
121531de2854Smrgpath to pkg-config.
121631de2854Smrg
121731de2854Smrg_PKG_TEXT
121831de2854Smrg
121931de2854SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
122031de2854Smrg		[$4])
122131de2854Smrgelse
122231de2854Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
122331de2854Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
122431de2854Smrg        AC_MSG_RESULT([yes])
122531de2854Smrg	ifelse([$3], , :, [$3])
122631de2854Smrgfi[]dnl
122731de2854Smrg])# PKG_CHECK_MODULES
122831de2854Smrg
1229c05e22d7Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1230c05e22d7Smrgdnl
1231c05e22d7Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1232c05e22d7Smrgdnl 
1233c05e22d7Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1234c05e22d7Smrgdnl copy of this software and associated documentation files (the "Software"),
1235c05e22d7Smrgdnl to deal in the Software without restriction, including without limitation
1236c05e22d7Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1237c05e22d7Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1238c05e22d7Smrgdnl Software is furnished to do so, subject to the following conditions:
1239c05e22d7Smrgdnl
1240c05e22d7Smrgdnl The above copyright notice and this permission notice (including the next
1241c05e22d7Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1242c05e22d7Smrgdnl Software.
1243c05e22d7Smrgdnl
1244c05e22d7Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1245c05e22d7Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1246c05e22d7Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1247c05e22d7Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1248c05e22d7Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1249c05e22d7Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1250c05e22d7Smrgdnl DEALINGS IN THE SOFTWARE.
1251c05e22d7Smrg
1252c05e22d7Smrg# XORG_MACROS_VERSION(required-version)
1253c05e22d7Smrg# -------------------------------------
1254c05e22d7Smrg# Minimum version: 1.1.0
1255c05e22d7Smrg#
1256c05e22d7Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1257c05e22d7Smrg# your configure.ac with the minimum required version, such as:
1258c05e22d7Smrg# XORG_MACROS_VERSION(1.1)
1259c05e22d7Smrg#
1260c05e22d7Smrg# To ensure that this macro is defined, also add:
1261c05e22d7Smrg# m4_ifndef([XORG_MACROS_VERSION],
1262c05e22d7Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1263c05e22d7Smrg#
1264c05e22d7Smrg#
1265c05e22d7Smrg# See the "minimum version" comment for each macro you use to see what 
1266c05e22d7Smrg# version you require.
1267c05e22d7Smrgm4_defun([XORG_MACROS_VERSION],[
126831de2854Smrgm4_define([vers_have], [1.17])
1269c05e22d7Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1270c05e22d7Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1271c05e22d7Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1272c05e22d7Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1273c05e22d7Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1274c05e22d7Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1275c05e22d7Smrgm4_undefine([vers_have])
1276c05e22d7Smrgm4_undefine([maj_have])
1277c05e22d7Smrgm4_undefine([maj_needed])
1278c05e22d7Smrg]) # XORG_MACROS_VERSION
1279c05e22d7Smrg
1280c05e22d7Smrg# XORG_PROG_RAWCPP()
1281c05e22d7Smrg# ------------------
1282c05e22d7Smrg# Minimum version: 1.0.0
1283c05e22d7Smrg#
1284c05e22d7Smrg# Find cpp program and necessary flags for use in pre-processing text files
1285c05e22d7Smrg# such as man pages and config files
1286c05e22d7SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1287c05e22d7SmrgAC_REQUIRE([AC_PROG_CPP])
1288c05e22d7SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1289c05e22d7Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1290c05e22d7Smrg
1291c05e22d7Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1292c05e22d7Smrg# which is not the best choice for supporting other OS'es, but covers most
1293c05e22d7Smrg# of the ones we need for now.
1294c05e22d7SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
129531de2854SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1296c05e22d7Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1297c05e22d7Smrg	AC_MSG_RESULT([no])
1298c05e22d7Smrgelse
1299c05e22d7Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1300c05e22d7Smrg		RAWCPPFLAGS=-undef
1301c05e22d7Smrg		AC_MSG_RESULT([yes])
1302c05e22d7Smrg	# under Cygwin unix is still defined even with -undef
1303c05e22d7Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1304c05e22d7Smrg		RAWCPPFLAGS="-undef -ansi"
1305c05e22d7Smrg		AC_MSG_RESULT([yes, with -ansi])
1306c05e22d7Smrg	else
1307c05e22d7Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1308c05e22d7Smrg	fi
1309c05e22d7Smrgfi
1310c05e22d7Smrgrm -f conftest.$ac_ext
13115dfecf96Smrg
1312c05e22d7SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
131331de2854SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1314c05e22d7Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1315c05e22d7Smrg	AC_MSG_RESULT([no])
13165dfecf96Smrgelse
1317c05e22d7Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1318c05e22d7Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1319c05e22d7Smrg		AC_MSG_RESULT([yes])
1320c05e22d7Smrg	else
1321c05e22d7Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1322c05e22d7Smrg	fi
13235dfecf96Smrgfi
1324c05e22d7Smrgrm -f conftest.$ac_ext
1325c05e22d7SmrgAC_SUBST(RAWCPPFLAGS)
1326c05e22d7Smrg]) # XORG_PROG_RAWCPP
13275dfecf96Smrg
1328c05e22d7Smrg# XORG_MANPAGE_SECTIONS()
1329c05e22d7Smrg# -----------------------
1330c05e22d7Smrg# Minimum version: 1.0.0
1331c05e22d7Smrg#
1332c05e22d7Smrg# Determine which sections man pages go in for the different man page types
1333c05e22d7Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1334c05e22d7Smrg# Not sure if there's any better way than just hardcoding by OS name.
1335c05e22d7Smrg# Override default settings by setting environment variables
1336c05e22d7Smrg# Added MAN_SUBSTS in version 1.8
1337c05e22d7Smrg# Added AC_PROG_SED in version 1.8
13385dfecf96Smrg
1339c05e22d7SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1340c05e22d7SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1341c05e22d7SmrgAC_REQUIRE([AC_PROG_SED])
13425dfecf96Smrg
1343c05e22d7Smrgif test x$APP_MAN_SUFFIX = x    ; then
1344c05e22d7Smrg    APP_MAN_SUFFIX=1
1345c05e22d7Smrgfi
1346c05e22d7Smrgif test x$APP_MAN_DIR = x    ; then
1347c05e22d7Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1348c05e22d7Smrgfi
13495dfecf96Smrg
1350c05e22d7Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1351c05e22d7Smrg    LIB_MAN_SUFFIX=3
1352c05e22d7Smrgfi
1353c05e22d7Smrgif test x$LIB_MAN_DIR = x    ; then
1354c05e22d7Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13555dfecf96Smrgfi
13565dfecf96Smrg
1357c05e22d7Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1358c05e22d7Smrg    case $host_os in
1359c05e22d7Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1360c05e22d7Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1361c05e22d7Smrg    esac
1362c05e22d7Smrgfi
1363c05e22d7Smrgif test x$FILE_MAN_DIR = x    ; then
1364c05e22d7Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1365c05e22d7Smrgfi
13665dfecf96Smrg
1367c05e22d7Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1368c05e22d7Smrg    case $host_os in
1369c05e22d7Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1370c05e22d7Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1371c05e22d7Smrg    esac
1372c05e22d7Smrgfi
1373c05e22d7Smrgif test x$MISC_MAN_DIR = x    ; then
1374c05e22d7Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1375c05e22d7Smrgfi
13765dfecf96Smrg
1377c05e22d7Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1378c05e22d7Smrg    case $host_os in
1379c05e22d7Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1380c05e22d7Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1381c05e22d7Smrg    esac
1382c05e22d7Smrgfi
1383c05e22d7Smrgif test x$DRIVER_MAN_DIR = x    ; then
1384c05e22d7Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1385c05e22d7Smrgfi
13865dfecf96Smrg
1387c05e22d7Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1388c05e22d7Smrg    case $host_os in
1389c05e22d7Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1390c05e22d7Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1391c05e22d7Smrg    esac
1392c05e22d7Smrgfi
1393c05e22d7Smrgif test x$ADMIN_MAN_DIR = x    ; then
1394c05e22d7Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1395c05e22d7Smrgfi
13965dfecf96Smrg
13975dfecf96Smrg
1398c05e22d7SmrgAC_SUBST([APP_MAN_SUFFIX])
1399c05e22d7SmrgAC_SUBST([LIB_MAN_SUFFIX])
1400c05e22d7SmrgAC_SUBST([FILE_MAN_SUFFIX])
1401c05e22d7SmrgAC_SUBST([MISC_MAN_SUFFIX])
1402c05e22d7SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1403c05e22d7SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1404c05e22d7SmrgAC_SUBST([APP_MAN_DIR])
1405c05e22d7SmrgAC_SUBST([LIB_MAN_DIR])
1406c05e22d7SmrgAC_SUBST([FILE_MAN_DIR])
1407c05e22d7SmrgAC_SUBST([MISC_MAN_DIR])
1408c05e22d7SmrgAC_SUBST([DRIVER_MAN_DIR])
1409c05e22d7SmrgAC_SUBST([ADMIN_MAN_DIR])
14105dfecf96Smrg
1411c05e22d7SmrgXORG_MAN_PAGE="X Version 11"
1412c05e22d7SmrgAC_SUBST([XORG_MAN_PAGE])
1413c05e22d7SmrgMAN_SUBSTS="\
1414c05e22d7Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1415c05e22d7Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1416c05e22d7Smrg	-e 's|__xservername__|Xorg|g' \
1417c05e22d7Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1418c05e22d7Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1419c05e22d7Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1420c05e22d7Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1421c05e22d7Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1422c05e22d7Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1423c05e22d7Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1424c05e22d7Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1425c05e22d7Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1426c05e22d7SmrgAC_SUBST([MAN_SUBSTS])
14275dfecf96Smrg
1428c05e22d7Smrg]) # XORG_MANPAGE_SECTIONS
14295dfecf96Smrg
1430c05e22d7Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1431c05e22d7Smrg# ------------------------
1432c05e22d7Smrg# Minimum version: 1.7.0
1433c05e22d7Smrg#
1434c05e22d7Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1435c05e22d7Smrg# provided by xorg-sgml-doctools, if installed.
1436c05e22d7SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1437c05e22d7SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1438c05e22d7SmrgXORG_SGML_PATH=
1439c05e22d7SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1440c05e22d7Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1441c05e22d7Smrg    [m4_ifval([$1],[:],
1442c05e22d7Smrg        [if test x"$cross_compiling" != x"yes" ; then
1443c05e22d7Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1444c05e22d7Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1445c05e22d7Smrg         fi])
1446c05e22d7Smrg    ])
1447c05e22d7Smrg
1448c05e22d7Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1449c05e22d7Smrg# the path and the name of the doc stylesheet
1450c05e22d7Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1451c05e22d7Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1452c05e22d7Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1453c05e22d7Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1454c05e22d7Smrgelse
1455c05e22d7Smrg   AC_MSG_RESULT([no])
1456c05e22d7Smrgfi
14575dfecf96Smrg
1458c05e22d7SmrgAC_SUBST(XORG_SGML_PATH)
1459c05e22d7SmrgAC_SUBST(STYLESHEET_SRCDIR)
1460c05e22d7SmrgAC_SUBST(XSL_STYLESHEET)
1461c05e22d7SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1462c05e22d7Smrg]) # XORG_CHECK_SGML_DOCTOOLS
14635dfecf96Smrg
1464c05e22d7Smrg# XORG_CHECK_LINUXDOC
1465c05e22d7Smrg# -------------------
1466c05e22d7Smrg# Minimum version: 1.0.0
14675dfecf96Smrg#
1468c05e22d7Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1469c05e22d7Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1470c05e22d7Smrg# Whether or not the necessary tools and files are found can be checked
1471c05e22d7Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1472c05e22d7SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1473c05e22d7SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1474c05e22d7SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
14755dfecf96Smrg
1476c05e22d7SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
14775dfecf96Smrg
1478c05e22d7SmrgAC_MSG_CHECKING([whether to build documentation])
14795dfecf96Smrg
1480c05e22d7Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1481c05e22d7Smrg   BUILDDOC=yes
1482c05e22d7Smrgelse
1483c05e22d7Smrg   BUILDDOC=no
14845dfecf96Smrgfi
14855dfecf96Smrg
1486c05e22d7SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1487c05e22d7Smrg
1488c05e22d7SmrgAC_MSG_RESULT([$BUILDDOC])
1489c05e22d7Smrg
1490c05e22d7SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1491c05e22d7Smrg
1492c05e22d7Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1493c05e22d7Smrg   BUILDPDFDOC=yes
1494c05e22d7Smrgelse
1495c05e22d7Smrg   BUILDPDFDOC=no
14965dfecf96Smrgfi
14975dfecf96Smrg
1498c05e22d7SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1499c05e22d7Smrg
1500c05e22d7SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1501c05e22d7Smrg
1502c05e22d7SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1503c05e22d7SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1504c05e22d7SmrgMAKE_PDF="$PS2PDF"
1505c05e22d7SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1506c05e22d7Smrg
1507c05e22d7SmrgAC_SUBST(MAKE_TEXT)
1508c05e22d7SmrgAC_SUBST(MAKE_PS)
1509c05e22d7SmrgAC_SUBST(MAKE_PDF)
1510c05e22d7SmrgAC_SUBST(MAKE_HTML)
1511c05e22d7Smrg]) # XORG_CHECK_LINUXDOC
1512c05e22d7Smrg
1513c05e22d7Smrg# XORG_CHECK_DOCBOOK
1514c05e22d7Smrg# -------------------
1515c05e22d7Smrg# Minimum version: 1.0.0
1516c05e22d7Smrg#
1517c05e22d7Smrg# Checks for the ability to build output formats from SGML DocBook source.
1518c05e22d7Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1519c05e22d7Smrg# indicates whether the necessary tools and files are found and, if set,
1520c05e22d7Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1521c05e22d7SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1522c05e22d7SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1523c05e22d7Smrg
1524c05e22d7SmrgBUILDTXTDOC=no
1525c05e22d7SmrgBUILDPDFDOC=no
1526c05e22d7SmrgBUILDPSDOC=no
1527c05e22d7SmrgBUILDHTMLDOC=no
15285dfecf96Smrg
1529c05e22d7SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1530c05e22d7SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1531c05e22d7SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1532c05e22d7SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
15335dfecf96Smrg
1534c05e22d7SmrgAC_MSG_CHECKING([whether to build text documentation])
1535c05e22d7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1536c05e22d7Smrg   test x$BUILD_TXTDOC != xno; then
1537c05e22d7Smrg	BUILDTXTDOC=yes
1538c05e22d7Smrgfi
1539c05e22d7SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1540c05e22d7SmrgAC_MSG_RESULT([$BUILDTXTDOC])
15415dfecf96Smrg
1542c05e22d7SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1543c05e22d7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1544c05e22d7Smrg   test x$BUILD_PDFDOC != xno; then
1545c05e22d7Smrg	BUILDPDFDOC=yes
1546c05e22d7Smrgfi
1547c05e22d7SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1548c05e22d7SmrgAC_MSG_RESULT([$BUILDPDFDOC])
15495dfecf96Smrg
1550c05e22d7SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1551c05e22d7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1552c05e22d7Smrg   test x$BUILD_PSDOC != xno; then
1553c05e22d7Smrg	BUILDPSDOC=yes
1554c05e22d7Smrgfi
1555c05e22d7SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1556c05e22d7SmrgAC_MSG_RESULT([$BUILDPSDOC])
15575dfecf96Smrg
1558c05e22d7SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1559c05e22d7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1560c05e22d7Smrg   test x$BUILD_HTMLDOC != xno; then
1561c05e22d7Smrg	BUILDHTMLDOC=yes
1562c05e22d7Smrgfi
1563c05e22d7SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1564c05e22d7SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
15655dfecf96Smrg
1566c05e22d7SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1567c05e22d7SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1568c05e22d7SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1569c05e22d7SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
15705dfecf96Smrg
1571c05e22d7SmrgAC_SUBST(MAKE_TEXT)
1572c05e22d7SmrgAC_SUBST(MAKE_PS)
1573c05e22d7SmrgAC_SUBST(MAKE_PDF)
1574c05e22d7SmrgAC_SUBST(MAKE_HTML)
1575c05e22d7Smrg]) # XORG_CHECK_DOCBOOK
15765dfecf96Smrg
1577c05e22d7Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1578c05e22d7Smrg# ----------------
1579c05e22d7Smrg# Minimum version: 1.5.0
1580c05e22d7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
15815dfecf96Smrg#
1582c05e22d7Smrg# Documentation tools are not always available on all platforms and sometimes
1583c05e22d7Smrg# not at the appropriate level. This macro enables a module to test for the
1584c05e22d7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1585c05e22d7Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1586c05e22d7Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1587c05e22d7Smrg# --with-xmlto assumes 'auto'.
1588c05e22d7Smrg#
1589c05e22d7Smrg# Interface to module:
1590c05e22d7Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1591c05e22d7Smrg# XMLTO:	returns the path of the xmlto program found
1592c05e22d7Smrg#		returns the path set by the user in the environment
1593c05e22d7Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1594c05e22d7Smrg#		'no' user instructs the module not to use xmlto
1595c05e22d7Smrg#
1596c05e22d7Smrg# Added in version 1.10.0
1597c05e22d7Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1598c05e22d7Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1599c05e22d7Smrg#
1600c05e22d7Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1601c05e22d7Smrg#
1602c05e22d7SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1603c05e22d7SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1604c05e22d7Smrgm4_define([_defopt], m4_default([$2], [auto]))
1605c05e22d7SmrgAC_ARG_WITH(xmlto,
1606c05e22d7Smrg	AS_HELP_STRING([--with-xmlto],
1607c05e22d7Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1608c05e22d7Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1609c05e22d7Smrgm4_undefine([_defopt])
1610c05e22d7Smrg
1611c05e22d7Smrgif test "x$use_xmlto" = x"auto"; then
1612c05e22d7Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1613c05e22d7Smrg   if test "x$XMLTO" = "x"; then
1614c05e22d7Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1615c05e22d7Smrg	have_xmlto=no
1616c05e22d7Smrg   else
1617c05e22d7Smrg        have_xmlto=yes
1618c05e22d7Smrg   fi
1619c05e22d7Smrgelif test "x$use_xmlto" = x"yes" ; then
1620c05e22d7Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1621c05e22d7Smrg   if test "x$XMLTO" = "x"; then
1622c05e22d7Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1623c05e22d7Smrg   fi
1624c05e22d7Smrg   have_xmlto=yes
1625c05e22d7Smrgelif test "x$use_xmlto" = x"no" ; then
1626c05e22d7Smrg   if test "x$XMLTO" != "x"; then
1627c05e22d7Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1628c05e22d7Smrg   fi
1629c05e22d7Smrg   have_xmlto=no
1630c05e22d7Smrgelse
1631c05e22d7Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1632c05e22d7Smrgfi
16335dfecf96Smrg
1634c05e22d7Smrg# Test for a minimum version of xmlto, if provided.
1635c05e22d7Smrgm4_ifval([$1],
1636c05e22d7Smrg[if test "$have_xmlto" = yes; then
1637c05e22d7Smrg    # scrape the xmlto version
1638c05e22d7Smrg    AC_MSG_CHECKING([the xmlto version])
1639c05e22d7Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1640c05e22d7Smrg    AC_MSG_RESULT([$xmlto_version])
1641c05e22d7Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1642c05e22d7Smrg        [if test "x$use_xmlto" = xauto; then
1643c05e22d7Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1644c05e22d7Smrg            have_xmlto=no
1645c05e22d7Smrg        else
1646c05e22d7Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1647c05e22d7Smrg        fi])
1648c05e22d7Smrgfi])
16495dfecf96Smrg
1650c05e22d7Smrg# Test for the ability of xmlto to generate a text target
1651c05e22d7Smrghave_xmlto_text=no
1652c05e22d7Smrgcat > conftest.xml << "EOF"
1653c05e22d7SmrgEOF
1654c05e22d7SmrgAS_IF([test "$have_xmlto" = yes],
1655c05e22d7Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1656c05e22d7Smrg             [have_xmlto_text=yes],
1657c05e22d7Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1658c05e22d7Smrgrm -f conftest.xml
1659c05e22d7SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1660c05e22d7SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1661c05e22d7Smrg]) # XORG_WITH_XMLTO
1662c05e22d7Smrg
166331de2854Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
166431de2854Smrg# --------------------------------------------
166531de2854Smrg# Minimum version: 1.12.0
166631de2854Smrg# Minimum version for optional DEFAULT argument: 1.12.0
166731de2854Smrg#
166831de2854Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
166931de2854Smrg# XML-based language used for the transformation of XML documents.
167031de2854Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
167131de2854Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
167231de2854Smrg# The XSLT processor is often used as a standalone tool for transformations.
167331de2854Smrg# It should not be assumed that this tool is used only to work with documnetation.
167431de2854Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
167531de2854Smrg#
167631de2854Smrg# Interface to module:
167731de2854Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
167831de2854Smrg# XSLTPROC:	 returns the path of the xsltproc program found
167931de2854Smrg#		 returns the path set by the user in the environment
168031de2854Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
168131de2854Smrg#		  'no' user instructs the module not to use xsltproc
168231de2854Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
168331de2854Smrg#
168431de2854Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
168531de2854Smrg#
168631de2854SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
168731de2854SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
168831de2854Smrg# Preserves the interface, should it be implemented later
168931de2854Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
169031de2854Smrgm4_define([_defopt], m4_default([$2], [auto]))
169131de2854SmrgAC_ARG_WITH(xsltproc,
169231de2854Smrg	AS_HELP_STRING([--with-xsltproc],
169331de2854Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
169431de2854Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
169531de2854Smrgm4_undefine([_defopt])
169631de2854Smrg
169731de2854Smrgif test "x$use_xsltproc" = x"auto"; then
169831de2854Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
169931de2854Smrg   if test "x$XSLTPROC" = "x"; then
170031de2854Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
170131de2854Smrg	have_xsltproc=no
170231de2854Smrg   else
170331de2854Smrg        have_xsltproc=yes
170431de2854Smrg   fi
170531de2854Smrgelif test "x$use_xsltproc" = x"yes" ; then
170631de2854Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
170731de2854Smrg   if test "x$XSLTPROC" = "x"; then
170831de2854Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
170931de2854Smrg   fi
171031de2854Smrg   have_xsltproc=yes
171131de2854Smrgelif test "x$use_xsltproc" = x"no" ; then
171231de2854Smrg   if test "x$XSLTPROC" != "x"; then
171331de2854Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
171431de2854Smrg   fi
171531de2854Smrg   have_xsltproc=no
171631de2854Smrgelse
171731de2854Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
171831de2854Smrgfi
171931de2854Smrg
172031de2854SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
172131de2854Smrg]) # XORG_WITH_XSLTPROC
172231de2854Smrg
172331de2854Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
172431de2854Smrg# ----------------------------------------
172531de2854Smrg# Minimum version: 1.15.0
172631de2854Smrg#
172731de2854Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
172831de2854Smrg# scanning arbitrary text files, extracting information from those text files,
172931de2854Smrg# and printing reports based on that information.
173031de2854Smrg#
173131de2854Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
173231de2854Smrg#
173331de2854Smrg# Interface to module:
173431de2854Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
173531de2854Smrg# PERL:	     returns the path of the perl program found
173631de2854Smrg#	     returns the path set by the user in the environment
173731de2854Smrg# --with-perl: 'yes' user instructs the module to use perl
173831de2854Smrg#	       'no' user instructs the module not to use perl
173931de2854Smrg# have_perl: returns yes if perl found in PATH or no
174031de2854Smrg#
174131de2854Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
174231de2854Smrg#
174331de2854SmrgAC_DEFUN([XORG_WITH_PERL],[
174431de2854SmrgAC_ARG_VAR([PERL], [Path to perl command])
174531de2854Smrg# Preserves the interface, should it be implemented later
174631de2854Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
174731de2854Smrgm4_define([_defopt], m4_default([$2], [auto]))
174831de2854SmrgAC_ARG_WITH(perl,
174931de2854Smrg	AS_HELP_STRING([--with-perl],
175031de2854Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
175131de2854Smrg	   [use_perl=$withval], [use_perl=]_defopt)
175231de2854Smrgm4_undefine([_defopt])
175331de2854Smrg
175431de2854Smrgif test "x$use_perl" = x"auto"; then
175531de2854Smrg   AC_PATH_PROG([PERL], [perl])
175631de2854Smrg   if test "x$PERL" = "x"; then
175731de2854Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
175831de2854Smrg	have_perl=no
175931de2854Smrg   else
176031de2854Smrg        have_perl=yes
176131de2854Smrg   fi
176231de2854Smrgelif test "x$use_perl" = x"yes" ; then
176331de2854Smrg   AC_PATH_PROG([PERL], [perl])
176431de2854Smrg   if test "x$PERL" = "x"; then
176531de2854Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
176631de2854Smrg   fi
176731de2854Smrg   have_perl=yes
176831de2854Smrgelif test "x$use_perl" = x"no" ; then
176931de2854Smrg   if test "x$PERL" != "x"; then
177031de2854Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
177131de2854Smrg   fi
177231de2854Smrg   have_perl=no
177331de2854Smrgelse
177431de2854Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
177531de2854Smrgfi
177631de2854Smrg
177731de2854SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
177831de2854Smrg]) # XORG_WITH_PERL
177931de2854Smrg
1780c05e22d7Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1781c05e22d7Smrg# ----------------
1782c05e22d7Smrg# Minimum version: 1.5.0
1783c05e22d7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1784c05e22d7Smrg#
1785c05e22d7Smrg# Documentation tools are not always available on all platforms and sometimes
1786c05e22d7Smrg# not at the appropriate level. This macro enables a module to test for the
1787c05e22d7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1788c05e22d7Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1789c05e22d7Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1790c05e22d7Smrg# --with-asciidoc assumes 'auto'.
1791c05e22d7Smrg#
1792c05e22d7Smrg# Interface to module:
1793c05e22d7Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1794c05e22d7Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1795c05e22d7Smrg#		 returns the path set by the user in the environment
1796c05e22d7Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1797c05e22d7Smrg#		  'no' user instructs the module not to use asciidoc
1798c05e22d7Smrg#
1799c05e22d7Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1800c05e22d7Smrg#
1801c05e22d7SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1802c05e22d7SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1803c05e22d7Smrgm4_define([_defopt], m4_default([$2], [auto]))
1804c05e22d7SmrgAC_ARG_WITH(asciidoc,
1805c05e22d7Smrg	AS_HELP_STRING([--with-asciidoc],
1806c05e22d7Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1807c05e22d7Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1808c05e22d7Smrgm4_undefine([_defopt])
1809c05e22d7Smrg
1810c05e22d7Smrgif test "x$use_asciidoc" = x"auto"; then
1811c05e22d7Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1812c05e22d7Smrg   if test "x$ASCIIDOC" = "x"; then
1813c05e22d7Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1814c05e22d7Smrg	have_asciidoc=no
1815c05e22d7Smrg   else
1816c05e22d7Smrg        have_asciidoc=yes
1817c05e22d7Smrg   fi
1818c05e22d7Smrgelif test "x$use_asciidoc" = x"yes" ; then
1819c05e22d7Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1820c05e22d7Smrg   if test "x$ASCIIDOC" = "x"; then
1821c05e22d7Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1822c05e22d7Smrg   fi
1823c05e22d7Smrg   have_asciidoc=yes
1824c05e22d7Smrgelif test "x$use_asciidoc" = x"no" ; then
1825c05e22d7Smrg   if test "x$ASCIIDOC" != "x"; then
1826c05e22d7Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1827c05e22d7Smrg   fi
1828c05e22d7Smrg   have_asciidoc=no
18295dfecf96Smrgelse
1830c05e22d7Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
18315dfecf96Smrgfi
1832c05e22d7Smrgm4_ifval([$1],
1833c05e22d7Smrg[if test "$have_asciidoc" = yes; then
1834c05e22d7Smrg    # scrape the asciidoc version
1835c05e22d7Smrg    AC_MSG_CHECKING([the asciidoc version])
1836c05e22d7Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1837c05e22d7Smrg    AC_MSG_RESULT([$asciidoc_version])
1838c05e22d7Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1839c05e22d7Smrg        [if test "x$use_asciidoc" = xauto; then
1840c05e22d7Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1841c05e22d7Smrg            have_asciidoc=no
1842c05e22d7Smrg        else
1843c05e22d7Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1844c05e22d7Smrg        fi])
1845c05e22d7Smrgfi])
1846c05e22d7SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1847c05e22d7Smrg]) # XORG_WITH_ASCIIDOC
18485dfecf96Smrg
1849c05e22d7Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1850c05e22d7Smrg# --------------------------------
1851c05e22d7Smrg# Minimum version: 1.5.0
1852c05e22d7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1853c05e22d7Smrg#
1854c05e22d7Smrg# Documentation tools are not always available on all platforms and sometimes
1855c05e22d7Smrg# not at the appropriate level. This macro enables a module to test for the
1856c05e22d7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1857c05e22d7Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1858c05e22d7Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1859c05e22d7Smrg# --with-doxygen assumes 'auto'.
1860c05e22d7Smrg#
1861c05e22d7Smrg# Interface to module:
1862c05e22d7Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1863c05e22d7Smrg# DOXYGEN:	 returns the path of the doxygen program found
1864c05e22d7Smrg#		 returns the path set by the user in the environment
1865c05e22d7Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1866c05e22d7Smrg#		  'no' user instructs the module not to use doxygen
1867c05e22d7Smrg#
1868c05e22d7Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1869c05e22d7Smrg#
1870c05e22d7SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1871c05e22d7SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1872c05e22d7Smrgm4_define([_defopt], m4_default([$2], [auto]))
1873c05e22d7SmrgAC_ARG_WITH(doxygen,
1874c05e22d7Smrg	AS_HELP_STRING([--with-doxygen],
1875c05e22d7Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1876c05e22d7Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1877c05e22d7Smrgm4_undefine([_defopt])
1878c05e22d7Smrg
1879c05e22d7Smrgif test "x$use_doxygen" = x"auto"; then
1880c05e22d7Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1881c05e22d7Smrg   if test "x$DOXYGEN" = "x"; then
1882c05e22d7Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1883c05e22d7Smrg	have_doxygen=no
1884c05e22d7Smrg   else
1885c05e22d7Smrg        have_doxygen=yes
1886c05e22d7Smrg   fi
1887c05e22d7Smrgelif test "x$use_doxygen" = x"yes" ; then
1888c05e22d7Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1889c05e22d7Smrg   if test "x$DOXYGEN" = "x"; then
1890c05e22d7Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1891c05e22d7Smrg   fi
1892c05e22d7Smrg   have_doxygen=yes
1893c05e22d7Smrgelif test "x$use_doxygen" = x"no" ; then
1894c05e22d7Smrg   if test "x$DOXYGEN" != "x"; then
1895c05e22d7Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1896c05e22d7Smrg   fi
1897c05e22d7Smrg   have_doxygen=no
1898c05e22d7Smrgelse
1899c05e22d7Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1900c05e22d7Smrgfi
1901c05e22d7Smrgm4_ifval([$1],
1902c05e22d7Smrg[if test "$have_doxygen" = yes; then
1903c05e22d7Smrg    # scrape the doxygen version
1904c05e22d7Smrg    AC_MSG_CHECKING([the doxygen version])
1905c05e22d7Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1906c05e22d7Smrg    AC_MSG_RESULT([$doxygen_version])
1907c05e22d7Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1908c05e22d7Smrg        [if test "x$use_doxygen" = xauto; then
1909c05e22d7Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1910c05e22d7Smrg            have_doxygen=no
1911c05e22d7Smrg        else
1912c05e22d7Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1913c05e22d7Smrg        fi])
1914c05e22d7Smrgfi])
1915c05e22d7SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1916c05e22d7Smrg]) # XORG_WITH_DOXYGEN
19175dfecf96Smrg
1918c05e22d7Smrg# XORG_WITH_GROFF([DEFAULT])
1919c05e22d7Smrg# ----------------
1920c05e22d7Smrg# Minimum version: 1.6.0
1921c05e22d7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19225dfecf96Smrg#
1923c05e22d7Smrg# Documentation tools are not always available on all platforms and sometimes
1924c05e22d7Smrg# not at the appropriate level. This macro enables a module to test for the
1925c05e22d7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1926c05e22d7Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1927c05e22d7Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1928c05e22d7Smrg# --with-groff assumes 'auto'.
1929c05e22d7Smrg#
1930c05e22d7Smrg# Interface to module:
1931c05e22d7Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1932c05e22d7Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1933c05e22d7Smrg# HAVE_GROFF_MS: the -ms macros package
1934c05e22d7Smrg# GROFF:	 returns the path of the groff program found
1935c05e22d7Smrg#		 returns the path set by the user in the environment
1936c05e22d7Smrg# --with-groff:	 'yes' user instructs the module to use groff
1937c05e22d7Smrg#		 'no' user instructs the module not to use groff
1938c05e22d7Smrg#
1939c05e22d7Smrg# Added in version 1.9.0:
1940c05e22d7Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1941c05e22d7Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1942c05e22d7Smrg#		   psselect from the psutils package.
1943c05e22d7Smrg#		   the ghostcript package. Refer to the grohtml man pages
1944c05e22d7Smrg#
1945c05e22d7Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1946c05e22d7Smrg#
1947c05e22d7Smrg# OS and distros often splits groff in a basic and full package, the former
1948c05e22d7Smrg# having the groff program and the later having devices, fonts and macros
1949c05e22d7Smrg# Checking for the groff executable is not enough.
1950c05e22d7Smrg#
1951c05e22d7Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1952c05e22d7Smrg# unset HAVE_GROFF or GROFF env variables.
1953c05e22d7Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1954c05e22d7Smrg#
1955c05e22d7SmrgAC_DEFUN([XORG_WITH_GROFF],[
1956c05e22d7SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1957c05e22d7Smrgm4_define([_defopt], m4_default([$1], [auto]))
1958c05e22d7SmrgAC_ARG_WITH(groff,
1959c05e22d7Smrg	AS_HELP_STRING([--with-groff],
1960c05e22d7Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1961c05e22d7Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1962c05e22d7Smrgm4_undefine([_defopt])
1963c05e22d7Smrg
1964c05e22d7Smrgif test "x$use_groff" = x"auto"; then
1965c05e22d7Smrg   AC_PATH_PROG([GROFF], [groff])
1966c05e22d7Smrg   if test "x$GROFF" = "x"; then
1967c05e22d7Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1968c05e22d7Smrg	have_groff=no
1969c05e22d7Smrg   else
1970c05e22d7Smrg        have_groff=yes
1971c05e22d7Smrg   fi
1972c05e22d7Smrgelif test "x$use_groff" = x"yes" ; then
1973c05e22d7Smrg   AC_PATH_PROG([GROFF], [groff])
1974c05e22d7Smrg   if test "x$GROFF" = "x"; then
1975c05e22d7Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1976c05e22d7Smrg   fi
1977c05e22d7Smrg   have_groff=yes
1978c05e22d7Smrgelif test "x$use_groff" = x"no" ; then
1979c05e22d7Smrg   if test "x$GROFF" != "x"; then
1980c05e22d7Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1981c05e22d7Smrg   fi
1982c05e22d7Smrg   have_groff=no
1983c05e22d7Smrgelse
1984c05e22d7Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1985c05e22d7Smrgfi
19865dfecf96Smrg
1987c05e22d7Smrg# We have groff, test for the presence of the macro packages
1988c05e22d7Smrgif test "x$have_groff" = x"yes"; then
1989c05e22d7Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1990c05e22d7Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1991c05e22d7Smrg        groff_ms_works=yes
1992c05e22d7Smrg    else
1993c05e22d7Smrg        groff_ms_works=no
1994c05e22d7Smrg    fi
1995c05e22d7Smrg    AC_MSG_RESULT([$groff_ms_works])
1996c05e22d7Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1997c05e22d7Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1998c05e22d7Smrg        groff_mm_works=yes
1999c05e22d7Smrg    else
2000c05e22d7Smrg        groff_mm_works=no
2001c05e22d7Smrg    fi
2002c05e22d7Smrg    AC_MSG_RESULT([$groff_mm_works])
2003c05e22d7Smrgfi
20045dfecf96Smrg
2005c05e22d7Smrg# We have groff, test for HTML dependencies, one command per package
2006c05e22d7Smrgif test "x$have_groff" = x"yes"; then
2007c05e22d7Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2008c05e22d7Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2009c05e22d7Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2010c05e22d7Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2011c05e22d7Smrg      have_groff_html=yes
2012c05e22d7Smrg   else
2013c05e22d7Smrg      have_groff_html=no
2014c05e22d7Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2015c05e22d7Smrg   fi
2016c05e22d7Smrgfi
20175dfecf96Smrg
2018c05e22d7Smrg# Set Automake conditionals for Makefiles
2019c05e22d7SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2020c05e22d7SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2021c05e22d7SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2022c05e22d7SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2023c05e22d7Smrg]) # XORG_WITH_GROFF
20245dfecf96Smrg
202531de2854Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
202631de2854Smrg# ---------------------------------------
2027c05e22d7Smrg# Minimum version: 1.6.0
2028c05e22d7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
202931de2854Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2030c05e22d7Smrg#
2031c05e22d7Smrg# Documentation tools are not always available on all platforms and sometimes
2032c05e22d7Smrg# not at the appropriate level. This macro enables a module to test for the
2033c05e22d7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2034c05e22d7Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2035c05e22d7Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2036c05e22d7Smrg# --with-fop assumes 'auto'.
2037c05e22d7Smrg#
2038c05e22d7Smrg# Interface to module:
2039c05e22d7Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2040c05e22d7Smrg# FOP:	 	returns the path of the fop program found
2041c05e22d7Smrg#		returns the path set by the user in the environment
2042c05e22d7Smrg# --with-fop: 	'yes' user instructs the module to use fop
2043c05e22d7Smrg#		'no' user instructs the module not to use fop
2044c05e22d7Smrg#
2045c05e22d7Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2046c05e22d7Smrg#
2047c05e22d7SmrgAC_DEFUN([XORG_WITH_FOP],[
2048c05e22d7SmrgAC_ARG_VAR([FOP], [Path to fop command])
204931de2854Smrgm4_define([_defopt], m4_default([$2], [auto]))
2050c05e22d7SmrgAC_ARG_WITH(fop,
2051c05e22d7Smrg	AS_HELP_STRING([--with-fop],
2052c05e22d7Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2053c05e22d7Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2054c05e22d7Smrgm4_undefine([_defopt])
2055c05e22d7Smrg
2056c05e22d7Smrgif test "x$use_fop" = x"auto"; then
2057c05e22d7Smrg   AC_PATH_PROG([FOP], [fop])
2058c05e22d7Smrg   if test "x$FOP" = "x"; then
2059c05e22d7Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2060c05e22d7Smrg	have_fop=no
2061c05e22d7Smrg   else
2062c05e22d7Smrg        have_fop=yes
2063c05e22d7Smrg   fi
2064c05e22d7Smrgelif test "x$use_fop" = x"yes" ; then
2065c05e22d7Smrg   AC_PATH_PROG([FOP], [fop])
2066c05e22d7Smrg   if test "x$FOP" = "x"; then
2067c05e22d7Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2068c05e22d7Smrg   fi
2069c05e22d7Smrg   have_fop=yes
2070c05e22d7Smrgelif test "x$use_fop" = x"no" ; then
2071c05e22d7Smrg   if test "x$FOP" != "x"; then
2072c05e22d7Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2073c05e22d7Smrg   fi
2074c05e22d7Smrg   have_fop=no
2075c05e22d7Smrgelse
2076c05e22d7Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2077c05e22d7Smrgfi
207831de2854Smrg
207931de2854Smrg# Test for a minimum version of fop, if provided.
208031de2854Smrgm4_ifval([$1],
208131de2854Smrg[if test "$have_fop" = yes; then
208231de2854Smrg    # scrape the fop version
208331de2854Smrg    AC_MSG_CHECKING([for fop minimum version])
208431de2854Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
208531de2854Smrg    AC_MSG_RESULT([$fop_version])
208631de2854Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
208731de2854Smrg        [if test "x$use_fop" = xauto; then
208831de2854Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
208931de2854Smrg            have_fop=no
209031de2854Smrg        else
209131de2854Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
209231de2854Smrg        fi])
209331de2854Smrgfi])
2094c05e22d7SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2095c05e22d7Smrg]) # XORG_WITH_FOP
2096c05e22d7Smrg
2097c05e22d7Smrg# XORG_WITH_PS2PDF([DEFAULT])
2098c05e22d7Smrg# ----------------
2099c05e22d7Smrg# Minimum version: 1.6.0
2100c05e22d7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2101c05e22d7Smrg#
2102c05e22d7Smrg# Documentation tools are not always available on all platforms and sometimes
2103c05e22d7Smrg# not at the appropriate level. This macro enables a module to test for the
2104c05e22d7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2105c05e22d7Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2106c05e22d7Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2107c05e22d7Smrg# --with-ps2pdf assumes 'auto'.
2108c05e22d7Smrg#
2109c05e22d7Smrg# Interface to module:
2110c05e22d7Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2111c05e22d7Smrg# PS2PDF:	returns the path of the ps2pdf program found
2112c05e22d7Smrg#		returns the path set by the user in the environment
2113c05e22d7Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2114c05e22d7Smrg#		 'no' user instructs the module not to use ps2pdf
2115c05e22d7Smrg#
2116c05e22d7Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2117c05e22d7Smrg#
2118c05e22d7SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2119c05e22d7SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2120c05e22d7Smrgm4_define([_defopt], m4_default([$1], [auto]))
2121c05e22d7SmrgAC_ARG_WITH(ps2pdf,
2122c05e22d7Smrg	AS_HELP_STRING([--with-ps2pdf],
2123c05e22d7Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2124c05e22d7Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2125c05e22d7Smrgm4_undefine([_defopt])
2126c05e22d7Smrg
2127c05e22d7Smrgif test "x$use_ps2pdf" = x"auto"; then
2128c05e22d7Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2129c05e22d7Smrg   if test "x$PS2PDF" = "x"; then
2130c05e22d7Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2131c05e22d7Smrg	have_ps2pdf=no
2132c05e22d7Smrg   else
2133c05e22d7Smrg        have_ps2pdf=yes
2134c05e22d7Smrg   fi
2135c05e22d7Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2136c05e22d7Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2137c05e22d7Smrg   if test "x$PS2PDF" = "x"; then
2138c05e22d7Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2139c05e22d7Smrg   fi
2140c05e22d7Smrg   have_ps2pdf=yes
2141c05e22d7Smrgelif test "x$use_ps2pdf" = x"no" ; then
2142c05e22d7Smrg   if test "x$PS2PDF" != "x"; then
2143c05e22d7Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2144c05e22d7Smrg   fi
2145c05e22d7Smrg   have_ps2pdf=no
2146c05e22d7Smrgelse
2147c05e22d7Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2148c05e22d7Smrgfi
2149c05e22d7SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2150c05e22d7Smrg]) # XORG_WITH_PS2PDF
21515dfecf96Smrg
2152c05e22d7Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2153c05e22d7Smrg# ----------------
2154c05e22d7Smrg# Minimum version: 1.6.0
21555dfecf96Smrg#
2156c05e22d7Smrg# Documentation tools are not always available on all platforms and sometimes
2157c05e22d7Smrg# not at the appropriate level. This macro enables a builder to skip all
2158c05e22d7Smrg# documentation targets except traditional man pages.
2159c05e22d7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2160c05e22d7Smrg# maximum flexibilty in controlling documentation building.
2161c05e22d7Smrg# Refer to:
2162c05e22d7Smrg# XORG_WITH_XMLTO         --with-xmlto
2163c05e22d7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2164c05e22d7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2165c05e22d7Smrg# XORG_WITH_FOP           --with-fop
2166c05e22d7Smrg# XORG_WITH_GROFF         --with-groff
2167c05e22d7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2168c05e22d7Smrg#
2169c05e22d7Smrg# Interface to module:
2170c05e22d7Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2171c05e22d7Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2172c05e22d7Smrg#		 'no' user instructs the module not to generate docs
2173c05e22d7Smrg# parm1:	specify the default value, yes or no.
2174c05e22d7Smrg#
2175c05e22d7SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
217631de2854Smrgm4_define([docs_default], m4_default([$1], [yes]))
2177c05e22d7SmrgAC_ARG_ENABLE(docs,
2178c05e22d7Smrg	AS_HELP_STRING([--enable-docs],
217931de2854Smrg	   [Enable building the documentation (default: ]docs_default[)]),
218031de2854Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
218131de2854Smrgm4_undefine([docs_default])
2182c05e22d7SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2183c05e22d7SmrgAC_MSG_CHECKING([whether to build documentation])
2184c05e22d7SmrgAC_MSG_RESULT([$build_docs])
2185c05e22d7Smrg]) # XORG_ENABLE_DOCS
2186c05e22d7Smrg
2187c05e22d7Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2188c05e22d7Smrg# ----------------
2189c05e22d7Smrg# Minimum version: 1.6.0
2190c05e22d7Smrg#
2191c05e22d7Smrg# This macro enables a builder to skip all developer documentation.
2192c05e22d7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2193c05e22d7Smrg# maximum flexibilty in controlling documentation building.
2194c05e22d7Smrg# Refer to:
2195c05e22d7Smrg# XORG_WITH_XMLTO         --with-xmlto
2196c05e22d7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2197c05e22d7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2198c05e22d7Smrg# XORG_WITH_FOP           --with-fop
2199c05e22d7Smrg# XORG_WITH_GROFF         --with-groff
2200c05e22d7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2201c05e22d7Smrg#
2202c05e22d7Smrg# Interface to module:
2203c05e22d7Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2204c05e22d7Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2205c05e22d7Smrg#			'no' user instructs the module not to generate developer docs
2206c05e22d7Smrg# parm1:		specify the default value, yes or no.
2207c05e22d7Smrg#
2208c05e22d7SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2209c05e22d7Smrgm4_define([devel_default], m4_default([$1], [yes]))
2210c05e22d7SmrgAC_ARG_ENABLE(devel-docs,
2211c05e22d7Smrg	AS_HELP_STRING([--enable-devel-docs],
2212c05e22d7Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2213c05e22d7Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2214c05e22d7Smrgm4_undefine([devel_default])
2215c05e22d7SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2216c05e22d7SmrgAC_MSG_CHECKING([whether to build developer documentation])
2217c05e22d7SmrgAC_MSG_RESULT([$build_devel_docs])
2218c05e22d7Smrg]) # XORG_ENABLE_DEVEL_DOCS
2219c05e22d7Smrg
2220c05e22d7Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2221c05e22d7Smrg# ----------------
2222c05e22d7Smrg# Minimum version: 1.6.0
2223c05e22d7Smrg#
2224c05e22d7Smrg# This macro enables a builder to skip all functional specification targets.
2225c05e22d7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2226c05e22d7Smrg# maximum flexibilty in controlling documentation building.
2227c05e22d7Smrg# Refer to:
2228c05e22d7Smrg# XORG_WITH_XMLTO         --with-xmlto
2229c05e22d7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2230c05e22d7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2231c05e22d7Smrg# XORG_WITH_FOP           --with-fop
2232c05e22d7Smrg# XORG_WITH_GROFF         --with-groff
2233c05e22d7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2234c05e22d7Smrg#
2235c05e22d7Smrg# Interface to module:
2236c05e22d7Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2237c05e22d7Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2238c05e22d7Smrg#			'no' user instructs the module not to generate specs
2239c05e22d7Smrg# parm1:		specify the default value, yes or no.
2240c05e22d7Smrg#
2241c05e22d7SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2242c05e22d7Smrgm4_define([spec_default], m4_default([$1], [yes]))
2243c05e22d7SmrgAC_ARG_ENABLE(specs,
2244c05e22d7Smrg	AS_HELP_STRING([--enable-specs],
2245c05e22d7Smrg	   [Enable building the specs (default: ]spec_default[)]),
2246c05e22d7Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2247c05e22d7Smrgm4_undefine([spec_default])
2248c05e22d7SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2249c05e22d7SmrgAC_MSG_CHECKING([whether to build functional specifications])
2250c05e22d7SmrgAC_MSG_RESULT([$build_specs])
2251c05e22d7Smrg]) # XORG_ENABLE_SPECS
22525dfecf96Smrg
225331de2854Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
225431de2854Smrg# ----------------------------------------------
225531de2854Smrg# Minimum version: 1.13.0
225631de2854Smrg#
225731de2854Smrg# This macro enables a builder to enable/disable unit testing
225831de2854Smrg# It makes no assumption about the test cases implementation
225931de2854Smrg# Test cases may or may not use Automake "Support for test suites"
226031de2854Smrg# They may or may not use the software utility library GLib
226131de2854Smrg#
226231de2854Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
226331de2854Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
226431de2854Smrg# The variable enable_unit_tests is used by other macros in this file.
226531de2854Smrg#
226631de2854Smrg# Interface to module:
226731de2854Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
226831de2854Smrg# enable_unit_tests:    used in configure.ac for additional configuration
226931de2854Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
227031de2854Smrg#			'no' user instructs the module not to build tests
227131de2854Smrg# parm1:		specify the default value, yes or no.
227231de2854Smrg#
227331de2854SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
227431de2854SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
227531de2854SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
227631de2854SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
227731de2854Smrgm4_define([_defopt], m4_default([$1], [auto]))
227831de2854SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
227931de2854Smrg	[Enable building unit test cases (default: ]_defopt[)]),
228031de2854Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
228131de2854Smrgm4_undefine([_defopt])
228231de2854SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
228331de2854SmrgAC_MSG_CHECKING([whether to build unit test cases])
228431de2854SmrgAC_MSG_RESULT([$enable_unit_tests])
228531de2854Smrg]) # XORG_ENABLE_UNIT_TESTS
228631de2854Smrg
228731de2854Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
228831de2854Smrg# ------------------------------------------------------
228931de2854Smrg# Minimum version: 1.17.0
229031de2854Smrg#
229131de2854Smrg# This macro enables a builder to enable/disable integration testing
229231de2854Smrg# It makes no assumption about the test cases' implementation
229331de2854Smrg# Test cases may or may not use Automake "Support for test suites"
229431de2854Smrg#
229531de2854Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
229631de2854Smrg# usually requires less dependencies and may be built and run under less
229731de2854Smrg# stringent environments than integration tests.
229831de2854Smrg#
229931de2854Smrg# Interface to module:
230031de2854Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
230131de2854Smrg# enable_integration_tests:   used in configure.ac for additional configuration
230231de2854Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
230331de2854Smrg#                             'no' user instructs the module not to build tests
230431de2854Smrg# parm1:                      specify the default value, yes or no.
230531de2854Smrg#
230631de2854SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
230731de2854SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
230831de2854Smrgm4_define([_defopt], m4_default([$1], [auto]))
230931de2854SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
231031de2854Smrg	[Enable building integration test cases (default: ]_defopt[)]),
231131de2854Smrg	[enable_integration_tests=$enableval],
231231de2854Smrg	[enable_integration_tests=]_defopt)
231331de2854Smrgm4_undefine([_defopt])
231431de2854SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
231531de2854Smrg	[test "x$enable_integration_tests" != xno])
231631de2854SmrgAC_MSG_CHECKING([whether to build unit test cases])
231731de2854SmrgAC_MSG_RESULT([$enable_integration_tests])
231831de2854Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
231931de2854Smrg
232031de2854Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
232131de2854Smrg# ----------------------------------------
232231de2854Smrg# Minimum version: 1.13.0
232331de2854Smrg#
232431de2854Smrg# GLib is a library which provides advanced data structures and functions.
232531de2854Smrg# This macro enables a module to test for the presence of Glib.
232631de2854Smrg#
232731de2854Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
232831de2854Smrg# Otherwise the value of $enable_unit_tests is blank.
232931de2854Smrg#
233031de2854Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
233131de2854Smrg# test support usually requires less dependencies and may be built and run under
233231de2854Smrg# less stringent environments than integration tests.
233331de2854Smrg#
233431de2854Smrg# Interface to module:
233531de2854Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
233631de2854Smrg# with_glib: used in configure.ac to know if GLib has been found
233731de2854Smrg# --with-glib:	'yes' user instructs the module to use glib
233831de2854Smrg#		'no' user instructs the module not to use glib
233931de2854Smrg#
234031de2854SmrgAC_DEFUN([XORG_WITH_GLIB],[
234131de2854SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
234231de2854Smrgm4_define([_defopt], m4_default([$2], [auto]))
234331de2854SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
234431de2854Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
234531de2854Smrg	[with_glib=$withval], [with_glib=]_defopt)
234631de2854Smrgm4_undefine([_defopt])
234731de2854Smrg
234831de2854Smrghave_glib=no
234931de2854Smrg# Do not probe GLib if user explicitly disabled unit testing
235031de2854Smrgif test "x$enable_unit_tests" != x"no"; then
235131de2854Smrg  # Do not probe GLib if user explicitly disabled it
235231de2854Smrg  if test "x$with_glib" != x"no"; then
235331de2854Smrg    m4_ifval(
235431de2854Smrg      [$1],
235531de2854Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
235631de2854Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
235731de2854Smrg    )
235831de2854Smrg  fi
235931de2854Smrgfi
236031de2854Smrg
236131de2854Smrg# Not having GLib when unit testing has been explicitly requested is an error
236231de2854Smrgif test "x$enable_unit_tests" = x"yes"; then
236331de2854Smrg  if test "x$have_glib" = x"no"; then
236431de2854Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
236531de2854Smrg  fi
236631de2854Smrgfi
236731de2854Smrg
236831de2854Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
236931de2854Smrgif test "x$enable_unit_tests" = x"no"; then
237031de2854Smrg  if test "x$with_glib" = x"yes"; then
237131de2854Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
237231de2854Smrg  fi
237331de2854Smrgfi
237431de2854Smrg
237531de2854Smrg# Not having GLib when it has been explicitly requested is an error
237631de2854Smrgif test "x$with_glib" = x"yes"; then
237731de2854Smrg  if test "x$have_glib" = x"no"; then
237831de2854Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
237931de2854Smrg  fi
238031de2854Smrgfi
238131de2854Smrg
238231de2854SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
238331de2854Smrg]) # XORG_WITH_GLIB
238431de2854Smrg
238531de2854Smrg# XORG_LD_WRAP([required|optional])
238631de2854Smrg# ---------------------------------
238731de2854Smrg# Minimum version: 1.13.0
238831de2854Smrg#
238931de2854Smrg# Check if linker supports -wrap, passed via compiler flags
239031de2854Smrg#
239131de2854Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
239231de2854Smrg# Otherwise the value of $enable_unit_tests is blank.
239331de2854Smrg#
239431de2854Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
239531de2854Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
239631de2854Smrg# available, an argument of "optional" allows use when some unit tests require
239731de2854Smrg# ld -wrap and others do not.
239831de2854Smrg#
239931de2854SmrgAC_DEFUN([XORG_LD_WRAP],[
240031de2854SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
240131de2854Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
240231de2854Smrg                      void __wrap_exit(int status) { return; }],
240331de2854Smrg                     [exit(0);])])
240431de2854Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
240531de2854Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
240631de2854Smrg  if test "x$have_ld_wrap" = x"no"; then
240731de2854Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
240831de2854Smrg  fi
240931de2854Smrgfi
241031de2854SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
241131de2854Smrg#
241231de2854Smrg]) # XORG_LD_WRAP
241331de2854Smrg
241431de2854Smrg# XORG_CHECK_LINKER_FLAGS
241531de2854Smrg# -----------------------
241631de2854Smrg# SYNOPSIS
241731de2854Smrg#
241831de2854Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
241931de2854Smrg#
242031de2854Smrg# DESCRIPTION
242131de2854Smrg#
242231de2854Smrg#   Check whether the given linker FLAGS work with the current language's
242331de2854Smrg#   linker, or whether they give an error.
242431de2854Smrg#
242531de2854Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
242631de2854Smrg#   success/failure.
242731de2854Smrg#
242831de2854Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
242931de2854Smrg#
243031de2854Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
243131de2854Smrg#
243231de2854Smrg# LICENSE
243331de2854Smrg#
243431de2854Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
243531de2854Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
243631de2854Smrg#   Copyright (c) 2009 Matteo Frigo
243731de2854Smrg#
243831de2854Smrg#   This program is free software: you can redistribute it and/or modify it
243931de2854Smrg#   under the terms of the GNU General Public License as published by the
244031de2854Smrg#   Free Software Foundation, either version 3 of the License, or (at your
244131de2854Smrg#   option) any later version.
244231de2854Smrg#
244331de2854Smrg#   This program is distributed in the hope that it will be useful, but
244431de2854Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
244531de2854Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
244631de2854Smrg#   Public License for more details.
244731de2854Smrg#
244831de2854Smrg#   You should have received a copy of the GNU General Public License along
244931de2854Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
245031de2854Smrg#
245131de2854Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
245231de2854Smrg#   gives unlimited permission to copy, distribute and modify the configure
245331de2854Smrg#   scripts that are the output of Autoconf when processing the Macro. You
245431de2854Smrg#   need not follow the terms of the GNU General Public License when using
245531de2854Smrg#   or distributing such scripts, even though portions of the text of the
245631de2854Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
245731de2854Smrg#   all other use of the material that constitutes the Autoconf Macro.
245831de2854Smrg#
245931de2854Smrg#   This special exception to the GPL applies to versions of the Autoconf
246031de2854Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
246131de2854Smrg#   modified version of the Autoconf Macro, you may extend this special
246231de2854Smrg#   exception to the GPL to apply to your modified version as well.#
246331de2854SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
246431de2854Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
246531de2854Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
246631de2854SmrgAS_LITERAL_IF([$1],
246731de2854Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
246831de2854Smrg      ax_save_FLAGS=$LDFLAGS
246931de2854Smrg      LDFLAGS="$1"
247031de2854Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
247131de2854Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
247231de2854Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
247331de2854Smrg      LDFLAGS=$ax_save_FLAGS])],
247431de2854Smrg  [ax_save_FLAGS=$LDFLAGS
247531de2854Smrg   LDFLAGS="$1"
247631de2854Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
247731de2854Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
247831de2854Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
247931de2854Smrg   LDFLAGS=$ax_save_FLAGS])
248031de2854Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
248131de2854SmrgAC_MSG_RESULT($xorg_check_linker_flags)
248231de2854Smrgif test "x$xorg_check_linker_flags" = xyes; then
248331de2854Smrg	m4_default([$2], :)
248431de2854Smrgelse
248531de2854Smrg	m4_default([$3], :)
248631de2854Smrgfi
248731de2854Smrg]) # XORG_CHECK_LINKER_FLAGS
248831de2854Smrg
248931de2854Smrg# XORG_MEMORY_CHECK_FLAGS
249031de2854Smrg# -----------------------
249131de2854Smrg# Minimum version: 1.16.0
249231de2854Smrg#
249331de2854Smrg# This macro attempts to find appropriate memory checking functionality
249431de2854Smrg# for various platforms which unit testing code may use to catch various
249531de2854Smrg# forms of memory allocation and access errors in testing.
249631de2854Smrg#
249731de2854Smrg# Interface to module:
249831de2854Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
249931de2854Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
250031de2854Smrg#
250131de2854Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
250231de2854Smrg#
250331de2854SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
250431de2854Smrg
250531de2854SmrgAC_REQUIRE([AC_CANONICAL_HOST])
250631de2854SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
250731de2854Smrg           [Environment variables to enable memory checking in tests])
250831de2854Smrg
250931de2854Smrg# Check for different types of support on different platforms
251031de2854Smrgcase $host_os in
251131de2854Smrg    solaris*)
251231de2854Smrg        AC_CHECK_LIB([umem], [umem_alloc],
251331de2854Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
251431de2854Smrg        ;;
251531de2854Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
251631de2854Smrg        # both directly and inverted, so should not be 0 or 255.
251731de2854Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
251831de2854Smrg        ;;
251931de2854Smrg    darwin*)
252031de2854Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
252131de2854Smrg        ;;
252231de2854Smrg    *bsd*)
252331de2854Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
252431de2854Smrg        ;;
252531de2854Smrgesac
252631de2854Smrg
252731de2854Smrg# User supplied flags override default flags
252831de2854Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
252931de2854Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
253031de2854Smrgfi
253131de2854Smrg
253231de2854SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
253331de2854Smrg]) # XORG_WITH_LINT
253431de2854Smrg
2535c05e22d7Smrg# XORG_CHECK_MALLOC_ZERO
2536c05e22d7Smrg# ----------------------
2537c05e22d7Smrg# Minimum version: 1.0.0
2538c05e22d7Smrg#
2539c05e22d7Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2540c05e22d7Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2541c05e22d7Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2542c05e22d7SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2543c05e22d7SmrgAC_ARG_ENABLE(malloc0returnsnull,
2544c05e22d7Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2545c05e22d7Smrg		       [malloc(0) returns NULL (default: auto)]),
2546c05e22d7Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2547c05e22d7Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
25485dfecf96Smrg
2549c05e22d7SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2550c05e22d7Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
255131de2854Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
255231de2854Smrg#include <stdlib.h>
255331de2854Smrg],[
2554c05e22d7Smrg    char *m0, *r0, *c0, *p;
2555c05e22d7Smrg    m0 = malloc(0);
2556c05e22d7Smrg    p = malloc(10);
2557c05e22d7Smrg    r0 = realloc(p,0);
255831de2854Smrg    c0 = calloc(0,10);
255931de2854Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
256031de2854Smrg])],
2561c05e22d7Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2562c05e22d7Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2563c05e22d7Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
25645dfecf96Smrgfi
2565c05e22d7SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2566c05e22d7Smrg
2567c05e22d7Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2568c05e22d7Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2569c05e22d7Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2570c05e22d7Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2571c05e22d7Smrgelse
2572c05e22d7Smrg	MALLOC_ZERO_CFLAGS=""
2573c05e22d7Smrg	XMALLOC_ZERO_CFLAGS=""
2574c05e22d7Smrg	XTMALLOC_ZERO_CFLAGS=""
25755dfecf96Smrgfi
25765dfecf96Smrg
2577c05e22d7SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2578c05e22d7SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2579c05e22d7SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2580c05e22d7Smrg]) # XORG_CHECK_MALLOC_ZERO
2581c05e22d7Smrg
2582c05e22d7Smrg# XORG_WITH_LINT()
2583c05e22d7Smrg# ----------------
2584c05e22d7Smrg# Minimum version: 1.1.0
2585f14f4646Smrg#
2586c05e22d7Smrg# This macro enables the use of a tool that flags some suspicious and
2587c05e22d7Smrg# non-portable constructs (likely to be bugs) in C language source code.
2588c05e22d7Smrg# It will attempt to locate the tool and use appropriate options.
2589c05e22d7Smrg# There are various lint type tools on different platforms.
2590c05e22d7Smrg#
2591c05e22d7Smrg# Interface to module:
2592c05e22d7Smrg# LINT:		returns the path to the tool found on the platform
2593c05e22d7Smrg#		or the value set to LINT on the configure cmd line
2594c05e22d7Smrg#		also an Automake conditional
2595c05e22d7Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2596c05e22d7Smrg#
2597c05e22d7Smrg# --with-lint:	'yes' user instructs the module to use lint
2598c05e22d7Smrg#		'no' user instructs the module not to use lint (default)
2599c05e22d7Smrg#
2600c05e22d7Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2601c05e22d7Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2602c05e22d7Smrg#
2603c05e22d7SmrgAC_DEFUN([XORG_WITH_LINT],[
2604f14f4646Smrg
2605c05e22d7SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2606c05e22d7SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2607c05e22d7SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2608c05e22d7Smrg		[Use a lint-style source code checker (default: disabled)])],
2609c05e22d7Smrg		[use_lint=$withval], [use_lint=no])
2610f14f4646Smrg
2611c05e22d7Smrg# Obtain platform specific info like program name and options
2612c05e22d7Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2613c05e22d7Smrgcase $host_os in
2614c05e22d7Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2615c05e22d7Smrg	lint_name=splint
2616c05e22d7Smrg	lint_options="-badflag"
2617c05e22d7Smrg	;;
2618c05e22d7Smrg  *freebsd* | *netbsd*)
2619c05e22d7Smrg	lint_name=lint
2620c05e22d7Smrg	lint_options="-u -b"
2621c05e22d7Smrg	;;
2622c05e22d7Smrg  *solaris*)
2623c05e22d7Smrg	lint_name=lint
2624c05e22d7Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2625c05e22d7Smrg	;;
2626c05e22d7Smrgesac
2627c05e22d7Smrg
2628c05e22d7Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2629c05e22d7Smrgif test "x$use_lint" = x"yes" ; then
2630c05e22d7Smrg   AC_PATH_PROG([LINT], [$lint_name])
2631c05e22d7Smrg   if test "x$LINT" = "x"; then
2632c05e22d7Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2633c05e22d7Smrg   fi
2634c05e22d7Smrgelif test "x$use_lint" = x"no" ; then
2635c05e22d7Smrg   if test "x$LINT" != "x"; then
2636c05e22d7Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2637c05e22d7Smrg   fi
2638c05e22d7Smrgelse
2639c05e22d7Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2640f14f4646Smrgfi
2641f14f4646Smrg
2642c05e22d7Smrg# User supplied flags override default flags
2643c05e22d7Smrgif test "x$LINT_FLAGS" != "x"; then
2644c05e22d7Smrg   lint_options=$LINT_FLAGS
2645c05e22d7Smrgfi
26465dfecf96Smrg
2647c05e22d7SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2648c05e22d7SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
26495dfecf96Smrg
2650c05e22d7Smrg]) # XORG_WITH_LINT
26515dfecf96Smrg
2652c05e22d7Smrg# XORG_LINT_LIBRARY(LIBNAME)
2653c05e22d7Smrg# --------------------------
2654c05e22d7Smrg# Minimum version: 1.1.0
2655c05e22d7Smrg#
2656c05e22d7Smrg# Sets up flags for building lint libraries for checking programs that call
2657c05e22d7Smrg# functions in the library.
2658c05e22d7Smrg#
2659c05e22d7Smrg# Interface to module:
2660c05e22d7Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2661c05e22d7Smrg# MAKE_LINT_LIB		- Automake conditional
2662c05e22d7Smrg#
2663c05e22d7Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2664c05e22d7Smrg#			  - 'no' user instructs the module not to create a lint library (default)
26655dfecf96Smrg
2666c05e22d7SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2667c05e22d7SmrgAC_REQUIRE([XORG_WITH_LINT])
2668c05e22d7SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2669c05e22d7Smrg	[Create lint library (default: disabled)])],
2670c05e22d7Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
26715dfecf96Smrg
2672c05e22d7Smrgif test "x$make_lint_lib" = x"yes" ; then
2673c05e22d7Smrg   LINTLIB=llib-l$1.ln
2674c05e22d7Smrg   if test "x$LINT" = "x"; then
2675c05e22d7Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2676c05e22d7Smrg   fi
2677c05e22d7Smrgelif test "x$make_lint_lib" != x"no" ; then
2678c05e22d7Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
26795dfecf96Smrgfi
26805dfecf96Smrg
2681c05e22d7SmrgAC_SUBST(LINTLIB)
2682c05e22d7SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
26835dfecf96Smrg
2684c05e22d7Smrg]) # XORG_LINT_LIBRARY
26855dfecf96Smrg
268631de2854Smrg# XORG_COMPILER_BRAND
268731de2854Smrg# -------------------
268831de2854Smrg# Minimum version: 1.14.0
268931de2854Smrg#
269031de2854Smrg# Checks for various brands of compilers and sets flags as appropriate:
269131de2854Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
269231de2854Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
269331de2854Smrg#   clang compiler - sets CLANGCC to "yes"
269431de2854Smrg#   Intel compiler - sets INTELCC to "yes"
269531de2854Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
269631de2854Smrg#
269731de2854SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
269831de2854SmrgAC_LANG_CASE(
269931de2854Smrg	[C], [
270031de2854Smrg		AC_REQUIRE([AC_PROG_CC_C99])
270131de2854Smrg	],
270231de2854Smrg	[C++], [
270331de2854Smrg		AC_REQUIRE([AC_PROG_CXX])
270431de2854Smrg	]
270531de2854Smrg)
270631de2854SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
270731de2854SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
270831de2854SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
270931de2854Smrg]) # XORG_COMPILER_BRAND
271031de2854Smrg
271131de2854Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
271231de2854Smrg# ---------------
271331de2854Smrg# Minimum version: 1.16.0
271431de2854Smrg#
271531de2854Smrg# Test if the compiler works when passed the given flag as a command line argument.
271631de2854Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
271731de2854Smrg# next flag in the list until there are no more options.
271831de2854Smrg#
271931de2854Smrg# Note that this does not guarantee that the compiler supports the flag as some
272031de2854Smrg# compilers will simply ignore arguments that they do not understand, but we do
272131de2854Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
272231de2854Smrg# -Werror=unused-command-line-argument
272331de2854Smrg#
272431de2854SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
272531de2854Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
272631de2854Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
272731de2854Smrg
272831de2854SmrgAC_LANG_COMPILER_REQUIRE
272931de2854Smrg
273031de2854SmrgAC_LANG_CASE(
273131de2854Smrg	[C], [
273231de2854Smrg		AC_REQUIRE([AC_PROG_CC_C99])
273331de2854Smrg		define([PREFIX], [C])
273431de2854Smrg		define([CACHE_PREFIX], [cc])
273531de2854Smrg		define([COMPILER], [$CC])
273631de2854Smrg	],
273731de2854Smrg	[C++], [
273831de2854Smrg		define([PREFIX], [CXX])
273931de2854Smrg		define([CACHE_PREFIX], [cxx])
274031de2854Smrg		define([COMPILER], [$CXX])
274131de2854Smrg	]
274231de2854Smrg)
274331de2854Smrg
274431de2854Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
274531de2854Smrg
274631de2854Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
274731de2854Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
274831de2854Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
274931de2854Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
275031de2854Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
275131de2854Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
275231de2854Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
275331de2854Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
275431de2854Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
275531de2854Smrgfi
275631de2854Smrg
275731de2854Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
275831de2854Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
275931de2854Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
276031de2854Smrg	fi
276131de2854Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
276231de2854Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
276331de2854Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
276431de2854Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
276531de2854Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
276631de2854Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
276731de2854Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
276831de2854Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
276931de2854Smrgfi
277031de2854Smrg
277131de2854Smrgfound="no"
277231de2854Smrgm4_foreach([flag], m4_cdr($@), [
277331de2854Smrg	if test $found = "no" ; then
277431de2854Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
277531de2854Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
277631de2854Smrg		fi
277731de2854Smrg
277831de2854Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
277931de2854Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
278031de2854Smrg		fi
278131de2854Smrg
278231de2854Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
278331de2854Smrg
278431de2854Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
278531de2854Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
278631de2854Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
278731de2854Smrg		AC_CACHE_VAL($cacheid,
278831de2854Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
278931de2854Smrg					     [eval $cacheid=yes],
279031de2854Smrg					     [eval $cacheid=no])])
279131de2854Smrg
279231de2854Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
279331de2854Smrg
279431de2854Smrg		eval supported=\$$cacheid
279531de2854Smrg		AC_MSG_RESULT([$supported])
279631de2854Smrg		if test "$supported" = "yes" ; then
279731de2854Smrg			$1="$$1 ]flag["
279831de2854Smrg			found="yes"
279931de2854Smrg		fi
280031de2854Smrg	fi
280131de2854Smrg])
280231de2854Smrg]) # XORG_TESTSET_CFLAG
280331de2854Smrg
280431de2854Smrg# XORG_COMPILER_FLAGS
280531de2854Smrg# ---------------
280631de2854Smrg# Minimum version: 1.16.0
280731de2854Smrg#
280831de2854Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
280931de2854Smrg# arguments supported by the selected compiler which do NOT alter the generated
281031de2854Smrg# code.  These arguments will cause the compiler to print various warnings
281131de2854Smrg# during compilation AND turn a conservative set of warnings into errors.
281231de2854Smrg#
281331de2854Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
281431de2854Smrg# future versions of util-macros as options are added to new compilers.
281531de2854Smrg#
281631de2854SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
281731de2854SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
281831de2854Smrg
281931de2854SmrgAC_ARG_ENABLE(selective-werror,
282031de2854Smrg              AS_HELP_STRING([--disable-selective-werror],
282131de2854Smrg                             [Turn off selective compiler errors. (default: enabled)]),
282231de2854Smrg              [SELECTIVE_WERROR=$enableval],
282331de2854Smrg              [SELECTIVE_WERROR=yes])
282431de2854Smrg
282531de2854SmrgAC_LANG_CASE(
282631de2854Smrg        [C], [
282731de2854Smrg                define([PREFIX], [C])
282831de2854Smrg        ],
282931de2854Smrg        [C++], [
283031de2854Smrg                define([PREFIX], [CXX])
283131de2854Smrg        ]
283231de2854Smrg)
283331de2854Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
283431de2854Smrgif test "x$SUNCC" = "xyes"; then
283531de2854Smrg    [BASE_]PREFIX[FLAGS]="-v"
283631de2854Smrgelse
283731de2854Smrg    [BASE_]PREFIX[FLAGS]=""
283831de2854Smrgfi
283931de2854Smrg
284031de2854Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
284131de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
284231de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
284331de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
284431de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
284531de2854Smrg
284631de2854SmrgAC_LANG_CASE(
284731de2854Smrg	[C], [
284831de2854Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
284931de2854Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
285031de2854Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
285131de2854Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
285231de2854Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
285331de2854Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
285431de2854Smrg	]
285531de2854Smrg)
285631de2854Smrg
285731de2854Smrg# This chunk adds additional warnings that could catch undesired effects.
285831de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
285931de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
286031de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
286131de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
286231de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
286331de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
286431de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
286531de2854Smrg
286631de2854Smrg# These are currently disabled because they are noisy.  They will be enabled
286731de2854Smrg# in the future once the codebase is sufficiently modernized to silence
286831de2854Smrg# them.  For now, I don't want them to drown out the other warnings.
286931de2854Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
287031de2854Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
287131de2854Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
287231de2854Smrg
287331de2854Smrg# Turn some warnings into errors, so we don't accidently get successful builds
287431de2854Smrg# when there are problems that should be fixed.
287531de2854Smrg
287631de2854Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
287731de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
287831de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
287931de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
288031de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
288131de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
288231de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
288331de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
288431de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
288531de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
288631de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
288731de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
288831de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
288931de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
289031de2854Smrgelse
289131de2854SmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
289231de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
289331de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
289431de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
289531de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
289631de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
289731de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
289831de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
289931de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
290031de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
290131de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
290231de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
290331de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
290431de2854SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
290531de2854Smrgfi
290631de2854Smrg
290731de2854SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
290831de2854Smrg]) # XORG_COMPILER_FLAGS
290931de2854Smrg
2910c05e22d7Smrg# XORG_CWARNFLAGS
2911c05e22d7Smrg# ---------------
2912c05e22d7Smrg# Minimum version: 1.2.0
291331de2854Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
29145dfecf96Smrg#
2915c05e22d7Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2916c05e22d7Smrg#
291731de2854Smrg# This function is deprecated because it defines -fno-strict-aliasing
291831de2854Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
291931de2854Smrg# is needed, then it should be added explicitly in the module when
292031de2854Smrg# it is updated to use BASE_CFLAGS.
292131de2854Smrg#
2922c05e22d7SmrgAC_DEFUN([XORG_CWARNFLAGS], [
292331de2854SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
292431de2854SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
292531de2854SmrgAC_LANG_CASE(
292631de2854Smrg	[C], [
292731de2854Smrg		CWARNFLAGS="$BASE_CFLAGS"
292831de2854Smrg		if  test "x$GCC" = xyes ; then
292931de2854Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
293031de2854Smrg		fi
293131de2854Smrg		AC_SUBST(CWARNFLAGS)
293231de2854Smrg	]
293331de2854Smrg)
2934c05e22d7Smrg]) # XORG_CWARNFLAGS
29355dfecf96Smrg
2936c05e22d7Smrg# XORG_STRICT_OPTION
29375dfecf96Smrg# -----------------------
2938c05e22d7Smrg# Minimum version: 1.3.0
2939c05e22d7Smrg#
294031de2854Smrg# Add configure option to enable strict compilation flags, such as treating
294131de2854Smrg# warnings as fatal errors.
294231de2854Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
294331de2854Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
294431de2854Smrg#
294531de2854Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
294631de2854Smrg# when strict compilation is unconditionally desired.
2947c05e22d7SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2948c05e22d7SmrgAC_REQUIRE([XORG_CWARNFLAGS])
294931de2854SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2950c05e22d7Smrg
2951c05e22d7SmrgAC_ARG_ENABLE(strict-compilation,
2952c05e22d7Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2953c05e22d7Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2954c05e22d7Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
295531de2854Smrg
295631de2854SmrgAC_LANG_CASE(
295731de2854Smrg        [C], [
295831de2854Smrg                define([PREFIX], [C])
295931de2854Smrg        ],
296031de2854Smrg        [C++], [
296131de2854Smrg                define([PREFIX], [CXX])
296231de2854Smrg        ]
296331de2854Smrg)
296431de2854Smrg
296531de2854Smrg[STRICT_]PREFIX[FLAGS]=""
296631de2854SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
296731de2854SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
296831de2854Smrg
296931de2854Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
297031de2854Smrg# activate it with -Werror, so we add it here explicitly.
297131de2854SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
297231de2854Smrg
2973c05e22d7Smrgif test "x$STRICT_COMPILE" = "xyes"; then
297431de2854Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
297531de2854Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2976c05e22d7Smrgfi
297731de2854SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
297831de2854SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
297931de2854SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2980c05e22d7Smrg]) # XORG_STRICT_OPTION
29815dfecf96Smrg
2982c05e22d7Smrg# XORG_DEFAULT_OPTIONS
2983c05e22d7Smrg# --------------------
2984c05e22d7Smrg# Minimum version: 1.3.0
2985c05e22d7Smrg#
2986c05e22d7Smrg# Defines default options for X.Org modules.
2987c05e22d7Smrg#
2988c05e22d7SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2989c05e22d7SmrgAC_REQUIRE([AC_PROG_INSTALL])
299031de2854SmrgXORG_COMPILER_FLAGS
2991c05e22d7SmrgXORG_CWARNFLAGS
2992c05e22d7SmrgXORG_STRICT_OPTION
2993c05e22d7SmrgXORG_RELEASE_VERSION
2994c05e22d7SmrgXORG_CHANGELOG
2995c05e22d7SmrgXORG_INSTALL
2996c05e22d7SmrgXORG_MANPAGE_SECTIONS
2997c05e22d7Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2998c05e22d7Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2999c05e22d7Smrg]) # XORG_DEFAULT_OPTIONS
3000c05e22d7Smrg
3001c05e22d7Smrg# XORG_INSTALL()
3002c05e22d7Smrg# ----------------
3003c05e22d7Smrg# Minimum version: 1.4.0
3004c05e22d7Smrg#
3005c05e22d7Smrg# Defines the variable INSTALL_CMD as the command to copy
3006c05e22d7Smrg# INSTALL from $prefix/share/util-macros.
3007c05e22d7Smrg#
3008c05e22d7SmrgAC_DEFUN([XORG_INSTALL], [
3009c05e22d7SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3010c05e22d7Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3011c05e22d7SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3012c05e22d7Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3013c05e22d7Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3014c05e22d7Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3015c05e22d7SmrgAC_SUBST([INSTALL_CMD])
3016c05e22d7Smrg]) # XORG_INSTALL
3017c05e22d7Smrgdnl Copyright 2005 Red Hat, Inc
3018c05e22d7Smrgdnl
3019c05e22d7Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3020c05e22d7Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3021c05e22d7Smrgdnl the above copyright notice appear in all copies and that both that
3022c05e22d7Smrgdnl copyright notice and this permission notice appear in supporting
3023c05e22d7Smrgdnl documentation.
3024c05e22d7Smrgdnl
3025c05e22d7Smrgdnl The above copyright notice and this permission notice shall be included
3026c05e22d7Smrgdnl in all copies or substantial portions of the Software.
3027c05e22d7Smrgdnl
3028c05e22d7Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3029c05e22d7Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3030c05e22d7Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3031c05e22d7Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3032c05e22d7Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3033c05e22d7Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3034c05e22d7Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3035c05e22d7Smrgdnl
3036c05e22d7Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3037c05e22d7Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3038c05e22d7Smrgdnl other dealings in this Software without prior written authorization
3039c05e22d7Smrgdnl from the copyright holders.
3040c05e22d7Smrgdnl
30415dfecf96Smrg
3042c05e22d7Smrg# XORG_RELEASE_VERSION
3043c05e22d7Smrg# --------------------
3044c05e22d7Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3045c05e22d7Smrg 
3046c05e22d7SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3047c05e22d7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3048c05e22d7Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3049c05e22d7Smrg		[Major version of this package])
3050c05e22d7Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3051c05e22d7Smrg	if test "x$PVM" = "x"; then
3052c05e22d7Smrg		PVM="0"
3053c05e22d7Smrg	fi
3054c05e22d7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3055c05e22d7Smrg		[$PVM],
3056c05e22d7Smrg		[Minor version of this package])
3057c05e22d7Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3058c05e22d7Smrg	if test "x$PVP" = "x"; then
3059c05e22d7Smrg		PVP="0"
3060c05e22d7Smrg	fi
3061c05e22d7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3062c05e22d7Smrg		[$PVP],
3063c05e22d7Smrg		[Patch version of this package])
3064c05e22d7Smrg])
30655dfecf96Smrg
3066c05e22d7Smrg# XORG_CHANGELOG()
3067c05e22d7Smrg# ----------------
3068c05e22d7Smrg# Minimum version: 1.2.0
3069c05e22d7Smrg#
3070c05e22d7Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3071c05e22d7Smrg# ChangeLog from git.
3072c05e22d7Smrg#
3073c05e22d7Smrg#
3074c05e22d7SmrgAC_DEFUN([XORG_CHANGELOG], [
3075c05e22d7SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3076c05e22d7Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3077c05e22d7Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3078c05e22d7Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3079c05e22d7SmrgAC_SUBST([CHANGELOG_CMD])
3080c05e22d7Smrg]) # XORG_CHANGELOG
30815dfecf96Smrg
3082