aclocal.m4 revision a8bb11d0
148e69166Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2fd0c672fSmrg
3fd0c672fSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
448e69166Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5fd0c672fSmrg# This file is free software; the Free Software Foundation
6fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
7fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
8fd0c672fSmrg
9fd0c672fSmrg# This program is distributed in the hope that it will be useful,
10fd0c672fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11fd0c672fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12fd0c672fSmrg# PARTICULAR PURPOSE.
13fd0c672fSmrg
1448e69166Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1548e69166Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1648e69166Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1748e69166Smrg[m4_warning([this file was generated for autoconf 2.68.
1848e69166SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
1948e69166SmrgIf you have problems, you may need to regenerate the build system entirely.
2048e69166SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2148e69166Smrg
2248e69166Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23fd0c672fSmrg#
24fd0c672fSmrg# This file is free software; the Free Software Foundation
25fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
26fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
27fd0c672fSmrg
28fd0c672fSmrg# AM_AUTOMAKE_VERSION(VERSION)
29fd0c672fSmrg# ----------------------------
30fd0c672fSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31fd0c672fSmrg# generated from the m4 files accompanying Automake X.Y.
3248e69166Smrg# (This private macro should not be called outside this file.)
3348e69166SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3448e69166Smrg[am__api_version='1.11'
3548e69166Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3648e69166Smrgdnl require some minimum version.  Point them to the right macro.
3748e69166Smrgm4_if([$1], [1.11.1], [],
3848e69166Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3948e69166Smrg])
4048e69166Smrg
4148e69166Smrg# _AM_AUTOCONF_VERSION(VERSION)
4248e69166Smrg# -----------------------------
4348e69166Smrg# aclocal traces this macro to find the Autoconf version.
4448e69166Smrg# This is a private macro too.  Using m4_define simplifies
4548e69166Smrg# the logic in aclocal, which can simply ignore this definition.
4648e69166Smrgm4_define([_AM_AUTOCONF_VERSION], [])
47fd0c672fSmrg
48fd0c672fSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49fd0c672fSmrg# -------------------------------
5048e69166Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5148e69166Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52fd0c672fSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5348e69166Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
5448e69166Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5548e69166Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5648e69166Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57fd0c672fSmrg
58fd0c672fSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59fd0c672fSmrg
60fd0c672fSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
61fd0c672fSmrg#
62fd0c672fSmrg# This file is free software; the Free Software Foundation
63fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
64fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
65fd0c672fSmrg
66fd0c672fSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67fd0c672fSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68fd0c672fSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
69fd0c672fSmrg#
70fd0c672fSmrg# Of course, Automake must honor this variable whenever it calls a
71fd0c672fSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72fd0c672fSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73fd0c672fSmrg# depending on how configure is run.  This is pretty annoying, since
74fd0c672fSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75fd0c672fSmrg# source directory, any form will work fine, but in subdirectories a
76fd0c672fSmrg# relative path needs to be adjusted first.
77fd0c672fSmrg#
78fd0c672fSmrg# $ac_aux_dir/missing
79fd0c672fSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80fd0c672fSmrg# $top_srcdir/$ac_aux_dir/missing
81fd0c672fSmrg#    fails if $ac_aux_dir is absolute,
82fd0c672fSmrg#    fails when called from a subdirectory in a VPATH build with
83fd0c672fSmrg#          a relative $ac_aux_dir
84fd0c672fSmrg#
85fd0c672fSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86fd0c672fSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
87fd0c672fSmrg# harmless because $srcdir is `.', but things will broke when you
88fd0c672fSmrg# start a VPATH build or use an absolute $srcdir.
89fd0c672fSmrg#
90fd0c672fSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91fd0c672fSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92fd0c672fSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93fd0c672fSmrg# and then we would define $MISSING as
94fd0c672fSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95fd0c672fSmrg# This will work as long as MISSING is not called from configure, because
96fd0c672fSmrg# unfortunately $(top_srcdir) has no meaning in configure.
97fd0c672fSmrg# However there are other variables, like CC, which are often used in
98fd0c672fSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99fd0c672fSmrg#
100fd0c672fSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
101fd0c672fSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
102fd0c672fSmrg# configured tree to be moved without reconfiguration.
103fd0c672fSmrg
104fd0c672fSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105fd0c672fSmrg[dnl Rely on autoconf to set up CDPATH properly.
106fd0c672fSmrgAC_PREREQ([2.50])dnl
107fd0c672fSmrg# expand $ac_aux_dir to an absolute path
108fd0c672fSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
109fd0c672fSmrg])
110fd0c672fSmrg
111fd0c672fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112fd0c672fSmrg
11348e69166Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114fd0c672fSmrg# Free Software Foundation, Inc.
115fd0c672fSmrg#
116fd0c672fSmrg# This file is free software; the Free Software Foundation
117fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
118fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
119fd0c672fSmrg
12048e69166Smrg# serial 9
121fd0c672fSmrg
122fd0c672fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123fd0c672fSmrg# -------------------------------------
124fd0c672fSmrg# Define a conditional.
125fd0c672fSmrgAC_DEFUN([AM_CONDITIONAL],
126fd0c672fSmrg[AC_PREREQ(2.52)dnl
127fd0c672fSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128fd0c672fSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12948e69166SmrgAC_SUBST([$1_TRUE])dnl
13048e69166SmrgAC_SUBST([$1_FALSE])dnl
13148e69166Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13248e69166Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13348e69166Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134fd0c672fSmrgif $2; then
135fd0c672fSmrg  $1_TRUE=
136fd0c672fSmrg  $1_FALSE='#'
137fd0c672fSmrgelse
138fd0c672fSmrg  $1_TRUE='#'
139fd0c672fSmrg  $1_FALSE=
140fd0c672fSmrgfi
141fd0c672fSmrgAC_CONFIG_COMMANDS_PRE(
142fd0c672fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143fd0c672fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144fd0c672fSmrgUsually this means the macro was only invoked conditionally.]])
145fd0c672fSmrgfi])])
146fd0c672fSmrg
14748e69166Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148fd0c672fSmrg# Free Software Foundation, Inc.
149fd0c672fSmrg#
150fd0c672fSmrg# This file is free software; the Free Software Foundation
151fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
152fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
153fd0c672fSmrg
15448e69166Smrg# serial 10
155fd0c672fSmrg
156fd0c672fSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157fd0c672fSmrg# written in clear, in which case automake, when reading aclocal.m4,
158fd0c672fSmrg# will think it sees a *use*, and therefore will trigger all it's
159fd0c672fSmrg# C support machinery.  Also note that it means that autoscan, seeing
160fd0c672fSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161fd0c672fSmrg
162fd0c672fSmrg
163fd0c672fSmrg# _AM_DEPENDENCIES(NAME)
164fd0c672fSmrg# ----------------------
165fd0c672fSmrg# See how the compiler implements dependency checking.
166fd0c672fSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167fd0c672fSmrg# We try a few techniques and use that to set a single cache variable.
168fd0c672fSmrg#
169fd0c672fSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170fd0c672fSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171fd0c672fSmrg# dependency, and given that the user is not expected to run this macro,
172fd0c672fSmrg# just rely on AC_PROG_CC.
173fd0c672fSmrgAC_DEFUN([_AM_DEPENDENCIES],
174fd0c672fSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175fd0c672fSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176fd0c672fSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177fd0c672fSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178fd0c672fSmrg
179fd0c672fSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180fd0c672fSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181fd0c672fSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18248e69166Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183fd0c672fSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184fd0c672fSmrg                   [depcc="$$1"   am_compiler_list=])
185fd0c672fSmrg
186fd0c672fSmrgAC_CACHE_CHECK([dependency style of $depcc],
187fd0c672fSmrg               [am_cv_$1_dependencies_compiler_type],
188fd0c672fSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189fd0c672fSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
190fd0c672fSmrg  # making bogus files that we don't know about and never remove.  For
191fd0c672fSmrg  # instance it was reported that on HP-UX the gcc test will end up
192fd0c672fSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
193fd0c672fSmrg  # in D'.
194fd0c672fSmrg  mkdir conftest.dir
195fd0c672fSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196fd0c672fSmrg  # using a relative directory.
197fd0c672fSmrg  cp "$am_depcomp" conftest.dir
198fd0c672fSmrg  cd conftest.dir
199fd0c672fSmrg  # We will build objects and dependencies in a subdirectory because
200fd0c672fSmrg  # it helps to detect inapplicable dependency modes.  For instance
201fd0c672fSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202fd0c672fSmrg  # side effect of compilation, but ICC will put the dependencies in
203fd0c672fSmrg  # the current directory while Tru64 will put them in the object
204fd0c672fSmrg  # directory.
205fd0c672fSmrg  mkdir sub
206fd0c672fSmrg
207fd0c672fSmrg  am_cv_$1_dependencies_compiler_type=none
208fd0c672fSmrg  if test "$am_compiler_list" = ""; then
209fd0c672fSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210fd0c672fSmrg  fi
21148e69166Smrg  am__universal=false
21248e69166Smrg  m4_case([$1], [CC],
21348e69166Smrg    [case " $depcc " in #(
21448e69166Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21548e69166Smrg     esac],
21648e69166Smrg    [CXX],
21748e69166Smrg    [case " $depcc " in #(
21848e69166Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21948e69166Smrg     esac])
22048e69166Smrg
221fd0c672fSmrg  for depmode in $am_compiler_list; do
222fd0c672fSmrg    # Setup a source with many dependencies, because some compilers
223fd0c672fSmrg    # like to wrap large dependency lists on column 80 (with \), and
224fd0c672fSmrg    # we should not choose a depcomp mode which is confused by this.
225fd0c672fSmrg    #
226fd0c672fSmrg    # We need to recreate these files for each test, as the compiler may
227fd0c672fSmrg    # overwrite some of them when testing with obscure command lines.
228fd0c672fSmrg    # This happens at least with the AIX C compiler.
229fd0c672fSmrg    : > sub/conftest.c
230fd0c672fSmrg    for i in 1 2 3 4 5 6; do
231fd0c672fSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232fd0c672fSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233fd0c672fSmrg      # Solaris 8's {/usr,}/bin/sh.
234fd0c672fSmrg      touch sub/conftst$i.h
235fd0c672fSmrg    done
236fd0c672fSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237fd0c672fSmrg
23848e69166Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
23948e69166Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24048e69166Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24148e69166Smrg    # versions had trouble with output in subdirs
24248e69166Smrg    am__obj=sub/conftest.${OBJEXT-o}
24348e69166Smrg    am__minus_obj="-o $am__obj"
244fd0c672fSmrg    case $depmode in
24548e69166Smrg    gcc)
24648e69166Smrg      # This depmode causes a compiler race in universal mode.
24748e69166Smrg      test "$am__universal" = false || continue
24848e69166Smrg      ;;
249fd0c672fSmrg    nosideeffect)
250fd0c672fSmrg      # after this tag, mechanisms are not by side-effect, so they'll
251fd0c672fSmrg      # only be used when explicitly requested
252fd0c672fSmrg      if test "x$enable_dependency_tracking" = xyes; then
253fd0c672fSmrg	continue
254fd0c672fSmrg      else
255fd0c672fSmrg	break
256fd0c672fSmrg      fi
257fd0c672fSmrg      ;;
25848e69166Smrg    msvisualcpp | msvcmsys)
25948e69166Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
26048e69166Smrg      # not run yet.  These depmodes are late enough in the game, and
26148e69166Smrg      # so weak that their functioning should not be impacted.
26248e69166Smrg      am__obj=conftest.${OBJEXT-o}
26348e69166Smrg      am__minus_obj=
26448e69166Smrg      ;;
265fd0c672fSmrg    none) break ;;
266fd0c672fSmrg    esac
267fd0c672fSmrg    if depmode=$depmode \
26848e69166Smrg       source=sub/conftest.c object=$am__obj \
269fd0c672fSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27048e69166Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271fd0c672fSmrg         >/dev/null 2>conftest.err &&
27248e69166Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273fd0c672fSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27448e69166Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275fd0c672fSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276fd0c672fSmrg      # icc doesn't choke on unknown options, it will just issue warnings
277fd0c672fSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
278fd0c672fSmrg      # that says an option was ignored or not supported.
279fd0c672fSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280fd0c672fSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281fd0c672fSmrg      # The diagnosis changed in icc 8.0:
282fd0c672fSmrg      #   icc: Command line remark: option '-MP' not supported
283fd0c672fSmrg      if (grep 'ignoring option' conftest.err ||
284fd0c672fSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285fd0c672fSmrg        am_cv_$1_dependencies_compiler_type=$depmode
286fd0c672fSmrg        break
287fd0c672fSmrg      fi
288fd0c672fSmrg    fi
289fd0c672fSmrg  done
290fd0c672fSmrg
291fd0c672fSmrg  cd ..
292fd0c672fSmrg  rm -rf conftest.dir
293fd0c672fSmrgelse
294fd0c672fSmrg  am_cv_$1_dependencies_compiler_type=none
295fd0c672fSmrgfi
296fd0c672fSmrg])
297fd0c672fSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298fd0c672fSmrgAM_CONDITIONAL([am__fastdep$1], [
299fd0c672fSmrg  test "x$enable_dependency_tracking" != xno \
300fd0c672fSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301fd0c672fSmrg])
302fd0c672fSmrg
303fd0c672fSmrg
304fd0c672fSmrg# AM_SET_DEPDIR
305fd0c672fSmrg# -------------
306fd0c672fSmrg# Choose a directory name for dependency files.
307fd0c672fSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308fd0c672fSmrgAC_DEFUN([AM_SET_DEPDIR],
309fd0c672fSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310fd0c672fSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311fd0c672fSmrg])
312fd0c672fSmrg
313fd0c672fSmrg
314fd0c672fSmrg# AM_DEP_TRACK
315fd0c672fSmrg# ------------
316fd0c672fSmrgAC_DEFUN([AM_DEP_TRACK],
317fd0c672fSmrg[AC_ARG_ENABLE(dependency-tracking,
318fd0c672fSmrg[  --disable-dependency-tracking  speeds up one-time build
319fd0c672fSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320fd0c672fSmrgif test "x$enable_dependency_tracking" != xno; then
321fd0c672fSmrg  am_depcomp="$ac_aux_dir/depcomp"
322fd0c672fSmrg  AMDEPBACKSLASH='\'
323fd0c672fSmrgfi
324fd0c672fSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32548e69166SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32648e69166Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327fd0c672fSmrg])
328fd0c672fSmrg
329fd0c672fSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330fd0c672fSmrg
33148e69166Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332fd0c672fSmrg# Free Software Foundation, Inc.
333fd0c672fSmrg#
334fd0c672fSmrg# This file is free software; the Free Software Foundation
335fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
336fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
337fd0c672fSmrg
33848e69166Smrg#serial 5
339fd0c672fSmrg
340fd0c672fSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341fd0c672fSmrg# ------------------------------
342fd0c672fSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34348e69166Smrg[{
34448e69166Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
34548e69166Smrg  # are listed without --file.  Let's play safe and only enable the eval
34648e69166Smrg  # if we detect the quoting.
34748e69166Smrg  case $CONFIG_FILES in
34848e69166Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
34948e69166Smrg  *)   set x $CONFIG_FILES ;;
35048e69166Smrg  esac
35148e69166Smrg  shift
35248e69166Smrg  for mf
35348e69166Smrg  do
35448e69166Smrg    # Strip MF so we end up with the name of the file.
35548e69166Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35648e69166Smrg    # Check whether this is an Automake generated Makefile or not.
35748e69166Smrg    # We used to match only the files named `Makefile.in', but
35848e69166Smrg    # some people rename them; so instead we look at the file content.
35948e69166Smrg    # Grep'ing the first line is not enough: some people post-process
36048e69166Smrg    # each Makefile.in and add a new line on top of each file to say so.
36148e69166Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
36248e69166Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36348e69166Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36448e69166Smrg      dirpart=`AS_DIRNAME("$mf")`
36548e69166Smrg    else
36648e69166Smrg      continue
36748e69166Smrg    fi
36848e69166Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
36948e69166Smrg    # from the Makefile without running `make'.
37048e69166Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37148e69166Smrg    test -z "$DEPDIR" && continue
37248e69166Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37348e69166Smrg    test -z "am__include" && continue
37448e69166Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37548e69166Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
37648e69166Smrg    U=`sed -n 's/^U = //p' < "$mf"`
37748e69166Smrg    # Find all dependency output files, they are included files with
37848e69166Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
37948e69166Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38048e69166Smrg    # expansion.
38148e69166Smrg    for file in `sed -n "
38248e69166Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38348e69166Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
38448e69166Smrg      # Make sure the directory exists.
38548e69166Smrg      test -f "$dirpart/$file" && continue
38648e69166Smrg      fdir=`AS_DIRNAME(["$file"])`
38748e69166Smrg      AS_MKDIR_P([$dirpart/$fdir])
38848e69166Smrg      # echo "creating $dirpart/$file"
38948e69166Smrg      echo '# dummy' > "$dirpart/$file"
39048e69166Smrg    done
391fd0c672fSmrg  done
39248e69166Smrg}
393fd0c672fSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394fd0c672fSmrg
395fd0c672fSmrg
396fd0c672fSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397fd0c672fSmrg# -----------------------------
398fd0c672fSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
399fd0c672fSmrg#
400fd0c672fSmrg# This code is only required when automatic dependency tracking
401fd0c672fSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
402fd0c672fSmrg# need in order to bootstrap the dependency handling code.
403fd0c672fSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404fd0c672fSmrg[AC_CONFIG_COMMANDS([depfiles],
405fd0c672fSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406fd0c672fSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407fd0c672fSmrg])
408fd0c672fSmrg
409fd0c672fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
410fd0c672fSmrg
41148e69166Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
41248e69166Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
413fd0c672fSmrg#
414fd0c672fSmrg# This file is free software; the Free Software Foundation
415fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
416fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
417fd0c672fSmrg
41848e69166Smrg# serial 16
419fd0c672fSmrg
420fd0c672fSmrg# This macro actually does too much.  Some checks are only needed if
421fd0c672fSmrg# your package does certain things.  But this isn't really a big deal.
422fd0c672fSmrg
423fd0c672fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
424fd0c672fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
425fd0c672fSmrg# -----------------------------------------------
426fd0c672fSmrg# The call with PACKAGE and VERSION arguments is the old style
427fd0c672fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
428fd0c672fSmrg# and VERSION should now be passed to AC_INIT and removed from
429fd0c672fSmrg# the call to AM_INIT_AUTOMAKE.
430fd0c672fSmrg# We support both call styles for the transition.  After
431fd0c672fSmrg# the next Automake release, Autoconf can make the AC_INIT
432fd0c672fSmrg# arguments mandatory, and then we can depend on a new Autoconf
433fd0c672fSmrg# release and drop the old call support.
434fd0c672fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43548e69166Smrg[AC_PREREQ([2.62])dnl
436fd0c672fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
437fd0c672fSmrgdnl the ones we care about.
438fd0c672fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
439fd0c672fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
440fd0c672fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44148e69166Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44248e69166Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44348e69166Smrg  # is not polluted with repeated "-I."
44448e69166Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44548e69166Smrg  # test to see if srcdir already configured
44648e69166Smrg  if test -f $srcdir/config.status; then
44748e69166Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44848e69166Smrg  fi
449fd0c672fSmrgfi
450fd0c672fSmrg
451fd0c672fSmrg# test whether we have cygpath
452fd0c672fSmrgif test -z "$CYGPATH_W"; then
453fd0c672fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
454fd0c672fSmrg    CYGPATH_W='cygpath -w'
455fd0c672fSmrg  else
456fd0c672fSmrg    CYGPATH_W=echo
457fd0c672fSmrg  fi
458fd0c672fSmrgfi
459fd0c672fSmrgAC_SUBST([CYGPATH_W])
460fd0c672fSmrg
461fd0c672fSmrg# Define the identity of the package.
462fd0c672fSmrgdnl Distinguish between old-style and new-style calls.
463fd0c672fSmrgm4_ifval([$2],
464fd0c672fSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465fd0c672fSmrg AC_SUBST([PACKAGE], [$1])dnl
466fd0c672fSmrg AC_SUBST([VERSION], [$2])],
467fd0c672fSmrg[_AM_SET_OPTIONS([$1])dnl
46848e69166Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
46948e69166Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
47048e69166Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
471fd0c672fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
472fd0c672fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473fd0c672fSmrg
474fd0c672fSmrg_AM_IF_OPTION([no-define],,
475fd0c672fSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
476fd0c672fSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477fd0c672fSmrg
478fd0c672fSmrg# Some tools Automake needs.
479fd0c672fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
480fd0c672fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
481fd0c672fSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
482fd0c672fSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
483fd0c672fSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
484fd0c672fSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
485fd0c672fSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
48648e69166SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
48748e69166SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
488fd0c672fSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
489fd0c672fSmrg# We need awk for the "check" target.  The system "awk" is bad on
490fd0c672fSmrg# some platforms.
491fd0c672fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
492fd0c672fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
493fd0c672fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
494fd0c672fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
49548e69166Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
49648e69166Smrg			     [_AM_PROG_TAR([v7])])])
497fd0c672fSmrg_AM_IF_OPTION([no-dependencies],,
498fd0c672fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
49948e69166Smrg		  [_AM_DEPENDENCIES(CC)],
50048e69166Smrg		  [define([AC_PROG_CC],
50148e69166Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
502fd0c672fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
50348e69166Smrg		  [_AM_DEPENDENCIES(CXX)],
50448e69166Smrg		  [define([AC_PROG_CXX],
50548e69166Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
50648e69166SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
50748e69166Smrg		  [_AM_DEPENDENCIES(OBJC)],
50848e69166Smrg		  [define([AC_PROG_OBJC],
50948e69166Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
510fd0c672fSmrg])
51148e69166Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
51248e69166Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
51348e69166Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
51448e69166Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
51548e69166SmrgAC_CONFIG_COMMANDS_PRE(dnl
51648e69166Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
51748e69166Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
518fd0c672fSmrg])
519fd0c672fSmrg
52048e69166Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
52148e69166Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
52248e69166Smrgdnl mangled by Autoconf and run in a shell conditional statement.
52348e69166Smrgm4_define([_AC_COMPILER_EXEEXT],
52448e69166Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
52548e69166Smrg
526fd0c672fSmrg
527fd0c672fSmrg# When config.status generates a header, we must update the stamp-h file.
528fd0c672fSmrg# This file resides in the same directory as the config header
529fd0c672fSmrg# that is generated.  The stamp files are numbered to have different names.
530fd0c672fSmrg
531fd0c672fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
532fd0c672fSmrg# loop where config.status creates the headers, so we can generate
533fd0c672fSmrg# our stamp files there.
534fd0c672fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
535fd0c672fSmrg[# Compute $1's index in $config_headers.
53648e69166Smrg_am_arg=$1
537fd0c672fSmrg_am_stamp_count=1
538fd0c672fSmrgfor _am_header in $config_headers :; do
539fd0c672fSmrg  case $_am_header in
54048e69166Smrg    $_am_arg | $_am_arg:* )
541fd0c672fSmrg      break ;;
542fd0c672fSmrg    * )
543fd0c672fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
544fd0c672fSmrg  esac
545fd0c672fSmrgdone
54648e69166Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
547fd0c672fSmrg
54848e69166Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
549fd0c672fSmrg#
550fd0c672fSmrg# This file is free software; the Free Software Foundation
551fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
552fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
553fd0c672fSmrg
554fd0c672fSmrg# AM_PROG_INSTALL_SH
555fd0c672fSmrg# ------------------
556fd0c672fSmrg# Define $install_sh.
557fd0c672fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
558fd0c672fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
55948e69166Smrgif test x"${install_sh}" != xset; then
56048e69166Smrg  case $am_aux_dir in
56148e69166Smrg  *\ * | *\	*)
56248e69166Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
56348e69166Smrg  *)
56448e69166Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
56548e69166Smrg  esac
56648e69166Smrgfi
567fd0c672fSmrgAC_SUBST(install_sh)])
568fd0c672fSmrg
569fd0c672fSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
570fd0c672fSmrg#
571fd0c672fSmrg# This file is free software; the Free Software Foundation
572fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
573fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
574fd0c672fSmrg
575fd0c672fSmrg# serial 2
576fd0c672fSmrg
577fd0c672fSmrg# Check whether the underlying file-system supports filenames
578fd0c672fSmrg# with a leading dot.  For instance MS-DOS doesn't.
579fd0c672fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
580fd0c672fSmrg[rm -rf .tst 2>/dev/null
581fd0c672fSmrgmkdir .tst 2>/dev/null
582fd0c672fSmrgif test -d .tst; then
583fd0c672fSmrg  am__leading_dot=.
584fd0c672fSmrgelse
585fd0c672fSmrg  am__leading_dot=_
586fd0c672fSmrgfi
587fd0c672fSmrgrmdir .tst 2>/dev/null
588fd0c672fSmrgAC_SUBST([am__leading_dot])])
589fd0c672fSmrg
590fd0c672fSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
591fd0c672fSmrg# From Jim Meyering
592fd0c672fSmrg
59348e69166Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
594fd0c672fSmrg# Free Software Foundation, Inc.
595fd0c672fSmrg#
596fd0c672fSmrg# This file is free software; the Free Software Foundation
597fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
598fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
599fd0c672fSmrg
60048e69166Smrg# serial 5
601fd0c672fSmrg
60248e69166Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
60348e69166Smrg# ----------------------------------
60448e69166Smrg# Control maintainer-specific portions of Makefiles.
60548e69166Smrg# Default is to disable them, unless `enable' is passed literally.
60648e69166Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
60748e69166Smrg# can override the default with the --enable/--disable switch.
608fd0c672fSmrgAC_DEFUN([AM_MAINTAINER_MODE],
60948e69166Smrg[m4_case(m4_default([$1], [disable]),
61048e69166Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
61148e69166Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
61248e69166Smrg       [m4_define([am_maintainer_other], [enable])
61348e69166Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
61448e69166SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
61548e69166Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
61648e69166Smrg  AC_ARG_ENABLE([maintainer-mode],
61748e69166Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
618fd0c672fSmrg			  (and sometimes confusing) to the casual installer],
61948e69166Smrg      [USE_MAINTAINER_MODE=$enableval],
62048e69166Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
621fd0c672fSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
62248e69166Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
623fd0c672fSmrg  MAINT=$MAINTAINER_MODE_TRUE
62448e69166Smrg  AC_SUBST([MAINT])dnl
625fd0c672fSmrg]
626fd0c672fSmrg)
627fd0c672fSmrg
628fd0c672fSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629fd0c672fSmrg
630fd0c672fSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631fd0c672fSmrg
63248e69166Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
633fd0c672fSmrg#
634fd0c672fSmrg# This file is free software; the Free Software Foundation
635fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
636fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
637fd0c672fSmrg
63848e69166Smrg# serial 4
639fd0c672fSmrg
640fd0c672fSmrg# AM_MAKE_INCLUDE()
641fd0c672fSmrg# -----------------
642fd0c672fSmrg# Check to see how make treats includes.
643fd0c672fSmrgAC_DEFUN([AM_MAKE_INCLUDE],
644fd0c672fSmrg[am_make=${MAKE-make}
645fd0c672fSmrgcat > confinc << 'END'
646fd0c672fSmrgam__doit:
64748e69166Smrg	@echo this is the am__doit target
648fd0c672fSmrg.PHONY: am__doit
649fd0c672fSmrgEND
650fd0c672fSmrg# If we don't find an include directive, just comment out the code.
651fd0c672fSmrgAC_MSG_CHECKING([for style of include used by $am_make])
652fd0c672fSmrgam__include="#"
653fd0c672fSmrgam__quote=
654fd0c672fSmrg_am_result=none
655fd0c672fSmrg# First try GNU make style include.
656fd0c672fSmrgecho "include confinc" > confmf
65748e69166Smrg# Ignore all kinds of additional output from `make'.
65848e69166Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
65948e69166Smrg*the\ am__doit\ target*)
66048e69166Smrg  am__include=include
66148e69166Smrg  am__quote=
66248e69166Smrg  _am_result=GNU
66348e69166Smrg  ;;
66448e69166Smrgesac
665fd0c672fSmrg# Now try BSD make style include.
666fd0c672fSmrgif test "$am__include" = "#"; then
667fd0c672fSmrg   echo '.include "confinc"' > confmf
66848e69166Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
66948e69166Smrg   *the\ am__doit\ target*)
67048e69166Smrg     am__include=.include
67148e69166Smrg     am__quote="\""
67248e69166Smrg     _am_result=BSD
67348e69166Smrg     ;;
67448e69166Smrg   esac
675fd0c672fSmrgfi
676fd0c672fSmrgAC_SUBST([am__include])
677fd0c672fSmrgAC_SUBST([am__quote])
678fd0c672fSmrgAC_MSG_RESULT([$_am_result])
679fd0c672fSmrgrm -f confinc confmf
680fd0c672fSmrg])
681fd0c672fSmrg
682fd0c672fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
683fd0c672fSmrg
68448e69166Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
685fd0c672fSmrg# Free Software Foundation, Inc.
686fd0c672fSmrg#
687fd0c672fSmrg# This file is free software; the Free Software Foundation
688fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
689fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
690fd0c672fSmrg
69148e69166Smrg# serial 6
692fd0c672fSmrg
693fd0c672fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
694fd0c672fSmrg# ------------------------------
695fd0c672fSmrgAC_DEFUN([AM_MISSING_PROG],
696fd0c672fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
697fd0c672fSmrg$1=${$1-"${am_missing_run}$2"}
698fd0c672fSmrgAC_SUBST($1)])
699fd0c672fSmrg
700fd0c672fSmrg
701fd0c672fSmrg# AM_MISSING_HAS_RUN
702fd0c672fSmrg# ------------------
703fd0c672fSmrg# Define MISSING if not defined so far and test if it supports --run.
704fd0c672fSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
705fd0c672fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
706fd0c672fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
70748e69166SmrgAC_REQUIRE_AUX_FILE([missing])dnl
70848e69166Smrgif test x"${MISSING+set}" != xset; then
70948e69166Smrg  case $am_aux_dir in
71048e69166Smrg  *\ * | *\	*)
71148e69166Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
71248e69166Smrg  *)
71348e69166Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
71448e69166Smrg  esac
71548e69166Smrgfi
716fd0c672fSmrg# Use eval to expand $SHELL
717fd0c672fSmrgif eval "$MISSING --run true"; then
718fd0c672fSmrg  am_missing_run="$MISSING --run "
719fd0c672fSmrgelse
720fd0c672fSmrg  am_missing_run=
721fd0c672fSmrg  AC_MSG_WARN([`missing' script is too old or missing])
722fd0c672fSmrgfi
723fd0c672fSmrg])
724fd0c672fSmrg
72548e69166Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726fd0c672fSmrg#
727fd0c672fSmrg# This file is free software; the Free Software Foundation
728fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
729fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
730fd0c672fSmrg
731fd0c672fSmrg# AM_PROG_MKDIR_P
732fd0c672fSmrg# ---------------
73348e69166Smrg# Check for `mkdir -p'.
734fd0c672fSmrgAC_DEFUN([AM_PROG_MKDIR_P],
73548e69166Smrg[AC_PREREQ([2.60])dnl
73648e69166SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
73748e69166Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
73848e69166Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
73948e69166Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
74048e69166Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
74148e69166Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
74248e69166Smrgdnl adjustment using top_builddir (which is defined more often than
74348e69166Smrgdnl MKDIR_P).
74448e69166SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
74548e69166Smrgcase $mkdir_p in
74648e69166Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
74748e69166Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
74848e69166Smrgesac
74948e69166Smrg])
750fd0c672fSmrg
751fd0c672fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
752fd0c672fSmrg
75348e69166Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754fd0c672fSmrg#
755fd0c672fSmrg# This file is free software; the Free Software Foundation
756fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
757fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
758fd0c672fSmrg
75948e69166Smrg# serial 4
760fd0c672fSmrg
761fd0c672fSmrg# _AM_MANGLE_OPTION(NAME)
762fd0c672fSmrg# -----------------------
763fd0c672fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
764fd0c672fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
765fd0c672fSmrg
766fd0c672fSmrg# _AM_SET_OPTION(NAME)
767fd0c672fSmrg# ------------------------------
768fd0c672fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
769fd0c672fSmrgAC_DEFUN([_AM_SET_OPTION],
770fd0c672fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
771fd0c672fSmrg
772fd0c672fSmrg# _AM_SET_OPTIONS(OPTIONS)
773fd0c672fSmrg# ----------------------------------
774fd0c672fSmrg# OPTIONS is a space-separated list of Automake options.
775fd0c672fSmrgAC_DEFUN([_AM_SET_OPTIONS],
77648e69166Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
777fd0c672fSmrg
778fd0c672fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
779fd0c672fSmrg# -------------------------------------------
780fd0c672fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
781fd0c672fSmrgAC_DEFUN([_AM_IF_OPTION],
782fd0c672fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
783fd0c672fSmrg
784fd0c672fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
785fd0c672fSmrg
78648e69166Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
787fd0c672fSmrg# Free Software Foundation, Inc.
788fd0c672fSmrg#
789fd0c672fSmrg# This file is free software; the Free Software Foundation
790fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
791fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
792fd0c672fSmrg
79348e69166Smrg# serial 5
794fd0c672fSmrg
795fd0c672fSmrg# AM_SANITY_CHECK
796fd0c672fSmrg# ---------------
797fd0c672fSmrgAC_DEFUN([AM_SANITY_CHECK],
798fd0c672fSmrg[AC_MSG_CHECKING([whether build environment is sane])
799fd0c672fSmrg# Just in case
800fd0c672fSmrgsleep 1
801fd0c672fSmrgecho timestamp > conftest.file
80248e69166Smrg# Reject unsafe characters in $srcdir or the absolute working directory
80348e69166Smrg# name.  Accept space and tab only in the latter.
80448e69166Smrgam_lf='
80548e69166Smrg'
80648e69166Smrgcase `pwd` in
80748e69166Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
80848e69166Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
80948e69166Smrgesac
81048e69166Smrgcase $srcdir in
81148e69166Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
81248e69166Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
81348e69166Smrgesac
81448e69166Smrg
815fd0c672fSmrg# Do `set' in a subshell so we don't clobber the current shell's
816fd0c672fSmrg# arguments.  Must try -L first in case configure is actually a
817fd0c672fSmrg# symlink; some systems play weird games with the mod time of symlinks
818fd0c672fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
819fd0c672fSmrg# directory).
820fd0c672fSmrgif (
82148e69166Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
822fd0c672fSmrg   if test "$[*]" = "X"; then
823fd0c672fSmrg      # -L didn't work.
82448e69166Smrg      set X `ls -t "$srcdir/configure" conftest.file`
825fd0c672fSmrg   fi
826fd0c672fSmrg   rm -f conftest.file
827fd0c672fSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
828fd0c672fSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
829fd0c672fSmrg
830fd0c672fSmrg      # If neither matched, then we have a broken ls.  This can happen
831fd0c672fSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
832fd0c672fSmrg      # broken ls alias from the environment.  This has actually
833fd0c672fSmrg      # happened.  Such a system could not be considered "sane".
834fd0c672fSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
835fd0c672fSmrgalias in your environment])
836fd0c672fSmrg   fi
837fd0c672fSmrg
838fd0c672fSmrg   test "$[2]" = conftest.file
839fd0c672fSmrg   )
840fd0c672fSmrgthen
841fd0c672fSmrg   # Ok.
842fd0c672fSmrg   :
843fd0c672fSmrgelse
844fd0c672fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
845fd0c672fSmrgCheck your system clock])
846fd0c672fSmrgfi
847fd0c672fSmrgAC_MSG_RESULT(yes)])
848fd0c672fSmrg
84948e69166Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
85048e69166Smrg#
85148e69166Smrg# This file is free software; the Free Software Foundation
85248e69166Smrg# gives unlimited permission to copy and/or distribute it,
85348e69166Smrg# with or without modifications, as long as this notice is preserved.
85448e69166Smrg
85548e69166Smrg# serial 1
85648e69166Smrg
85748e69166Smrg# AM_SILENT_RULES([DEFAULT])
85848e69166Smrg# --------------------------
85948e69166Smrg# Enable less verbose build rules; with the default set to DEFAULT
86048e69166Smrg# (`yes' being less verbose, `no' or empty being verbose).
86148e69166SmrgAC_DEFUN([AM_SILENT_RULES],
86248e69166Smrg[AC_ARG_ENABLE([silent-rules],
86348e69166Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
86448e69166Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
86548e69166Smrgcase $enable_silent_rules in
86648e69166Smrgyes) AM_DEFAULT_VERBOSITY=0;;
86748e69166Smrgno)  AM_DEFAULT_VERBOSITY=1;;
86848e69166Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
86948e69166Smrgesac
87048e69166SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
87148e69166SmrgAM_BACKSLASH='\'
87248e69166SmrgAC_SUBST([AM_BACKSLASH])dnl
87348e69166Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
87448e69166Smrg])
87548e69166Smrg
876fd0c672fSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
877fd0c672fSmrg#
878fd0c672fSmrg# This file is free software; the Free Software Foundation
879fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
880fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
881fd0c672fSmrg
882fd0c672fSmrg# AM_PROG_INSTALL_STRIP
883fd0c672fSmrg# ---------------------
884fd0c672fSmrg# One issue with vendor `install' (even GNU) is that you can't
885fd0c672fSmrg# specify the program used to strip binaries.  This is especially
886fd0c672fSmrg# annoying in cross-compiling environments, where the build's strip
887fd0c672fSmrg# is unlikely to handle the host's binaries.
888fd0c672fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
889fd0c672fSmrg# always use install-sh in `make install-strip', and initialize
890fd0c672fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
891fd0c672fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
892fd0c672fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
893fd0c672fSmrg# Installed binaries are usually stripped using `strip' when the user
894fd0c672fSmrg# run `make install-strip'.  However `strip' might not be the right
895fd0c672fSmrg# tool to use in cross-compilation environments, therefore Automake
896fd0c672fSmrg# will honor the `STRIP' environment variable to overrule this program.
897fd0c672fSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
898fd0c672fSmrgif test "$cross_compiling" != no; then
899fd0c672fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
900fd0c672fSmrgfi
90148e69166SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
902fd0c672fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903fd0c672fSmrg
90448e69166Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
90548e69166Smrg#
90648e69166Smrg# This file is free software; the Free Software Foundation
90748e69166Smrg# gives unlimited permission to copy and/or distribute it,
90848e69166Smrg# with or without modifications, as long as this notice is preserved.
90948e69166Smrg
91048e69166Smrg# serial 2
91148e69166Smrg
91248e69166Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
91348e69166Smrg# ---------------------------
91448e69166Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
91548e69166Smrg# This macro is traced by Automake.
91648e69166SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
91748e69166Smrg
91848e69166Smrg# AM_SUBST_NOTMAKE(VARIABLE)
91948e69166Smrg# ---------------------------
92048e69166Smrg# Public sister of _AM_SUBST_NOTMAKE.
92148e69166SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
92248e69166Smrg
923fd0c672fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
924fd0c672fSmrg
925fd0c672fSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
926fd0c672fSmrg#
927fd0c672fSmrg# This file is free software; the Free Software Foundation
928fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
929fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
930fd0c672fSmrg
931fd0c672fSmrg# serial 2
932fd0c672fSmrg
933fd0c672fSmrg# _AM_PROG_TAR(FORMAT)
934fd0c672fSmrg# --------------------
935fd0c672fSmrg# Check how to create a tarball in format FORMAT.
936fd0c672fSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
937fd0c672fSmrg#
938fd0c672fSmrg# Substitute a variable $(am__tar) that is a command
939fd0c672fSmrg# writing to stdout a FORMAT-tarball containing the directory
940fd0c672fSmrg# $tardir.
941fd0c672fSmrg#     tardir=directory && $(am__tar) > result.tar
942fd0c672fSmrg#
943fd0c672fSmrg# Substitute a variable $(am__untar) that extract such
944fd0c672fSmrg# a tarball read from stdin.
945fd0c672fSmrg#     $(am__untar) < result.tar
946fd0c672fSmrgAC_DEFUN([_AM_PROG_TAR],
947fd0c672fSmrg[# Always define AMTAR for backward compatibility.
948fd0c672fSmrgAM_MISSING_PROG([AMTAR], [tar])
949fd0c672fSmrgm4_if([$1], [v7],
950fd0c672fSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
951fd0c672fSmrg     [m4_case([$1], [ustar],, [pax],,
952fd0c672fSmrg              [m4_fatal([Unknown tar format])])
953fd0c672fSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
954fd0c672fSmrg# Loop over all known methods to create a tar archive until one works.
955fd0c672fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
956fd0c672fSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
957fd0c672fSmrg# Do not fold the above two line into one, because Tru64 sh and
958fd0c672fSmrg# Solaris sh will not grok spaces in the rhs of `-'.
959fd0c672fSmrgfor _am_tool in $_am_tools
960fd0c672fSmrgdo
961fd0c672fSmrg  case $_am_tool in
962fd0c672fSmrg  gnutar)
963fd0c672fSmrg    for _am_tar in tar gnutar gtar;
964fd0c672fSmrg    do
965fd0c672fSmrg      AM_RUN_LOG([$_am_tar --version]) && break
966fd0c672fSmrg    done
967fd0c672fSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
968fd0c672fSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
969fd0c672fSmrg    am__untar="$_am_tar -xf -"
970fd0c672fSmrg    ;;
971fd0c672fSmrg  plaintar)
972fd0c672fSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
973fd0c672fSmrg    # ustar tarball either.
974fd0c672fSmrg    (tar --version) >/dev/null 2>&1 && continue
975fd0c672fSmrg    am__tar='tar chf - "$$tardir"'
976fd0c672fSmrg    am__tar_='tar chf - "$tardir"'
977fd0c672fSmrg    am__untar='tar xf -'
978fd0c672fSmrg    ;;
979fd0c672fSmrg  pax)
980fd0c672fSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
981fd0c672fSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
982fd0c672fSmrg    am__untar='pax -r'
983fd0c672fSmrg    ;;
984fd0c672fSmrg  cpio)
985fd0c672fSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
986fd0c672fSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
987fd0c672fSmrg    am__untar='cpio -i -H $1 -d'
988fd0c672fSmrg    ;;
989fd0c672fSmrg  none)
990fd0c672fSmrg    am__tar=false
991fd0c672fSmrg    am__tar_=false
992fd0c672fSmrg    am__untar=false
993fd0c672fSmrg    ;;
994fd0c672fSmrg  esac
995fd0c672fSmrg
996fd0c672fSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
997fd0c672fSmrg  # and am__untar set.
998fd0c672fSmrg  test -n "${am_cv_prog_tar_$1}" && break
999fd0c672fSmrg
1000fd0c672fSmrg  # tar/untar a dummy directory, and stop if the command works
1001fd0c672fSmrg  rm -rf conftest.dir
1002fd0c672fSmrg  mkdir conftest.dir
1003fd0c672fSmrg  echo GrepMe > conftest.dir/file
1004fd0c672fSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1005fd0c672fSmrg  rm -rf conftest.dir
1006fd0c672fSmrg  if test -s conftest.tar; then
1007fd0c672fSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
1008fd0c672fSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1009fd0c672fSmrg  fi
1010fd0c672fSmrgdone
1011fd0c672fSmrgrm -rf conftest.dir
1012fd0c672fSmrg
1013fd0c672fSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1014fd0c672fSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1015fd0c672fSmrgAC_SUBST([am__tar])
1016fd0c672fSmrgAC_SUBST([am__untar])
1017fd0c672fSmrg]) # _AM_PROG_TAR
1018fd0c672fSmrg
101948e69166Smrgm4_include([m4/ax_define_dir.m4])
1020a8bb11d0Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1021a8bb11d0Smrg# 
1022a8bb11d0Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1023a8bb11d0Smrg#
1024a8bb11d0Smrg# This program is free software; you can redistribute it and/or modify
1025a8bb11d0Smrg# it under the terms of the GNU General Public License as published by
1026a8bb11d0Smrg# the Free Software Foundation; either version 2 of the License, or
1027a8bb11d0Smrg# (at your option) any later version.
1028a8bb11d0Smrg#
1029a8bb11d0Smrg# This program is distributed in the hope that it will be useful, but
1030a8bb11d0Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1031a8bb11d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1032a8bb11d0Smrg# General Public License for more details.
1033a8bb11d0Smrg#
1034a8bb11d0Smrg# You should have received a copy of the GNU General Public License
1035a8bb11d0Smrg# along with this program; if not, write to the Free Software
1036a8bb11d0Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1037a8bb11d0Smrg#
1038a8bb11d0Smrg# As a special exception to the GNU General Public License, if you
1039a8bb11d0Smrg# distribute this file as part of a program that contains a
1040a8bb11d0Smrg# configuration script generated by Autoconf, you may include it under
1041a8bb11d0Smrg# the same distribution terms that you use for the rest of that program.
1042a8bb11d0Smrg
1043a8bb11d0Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1044a8bb11d0Smrg# ----------------------------------
1045a8bb11d0SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1046a8bb11d0Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1047a8bb11d0Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1048a8bb11d0SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1049a8bb11d0Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1050a8bb11d0Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1051a8bb11d0Smrgfi
1052a8bb11d0Smrgif test -n "$PKG_CONFIG"; then
1053a8bb11d0Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1054a8bb11d0Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1055a8bb11d0Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1056a8bb11d0Smrg		AC_MSG_RESULT([yes])
1057a8bb11d0Smrg	else
1058a8bb11d0Smrg		AC_MSG_RESULT([no])
1059a8bb11d0Smrg		PKG_CONFIG=""
1060a8bb11d0Smrg	fi
1061a8bb11d0Smrg		
1062a8bb11d0Smrgfi[]dnl
1063a8bb11d0Smrg])# PKG_PROG_PKG_CONFIG
1064a8bb11d0Smrg
1065a8bb11d0Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1066a8bb11d0Smrg#
1067a8bb11d0Smrg# Check to see whether a particular set of modules exists.  Similar
1068a8bb11d0Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1069a8bb11d0Smrg#
1070a8bb11d0Smrg#
1071a8bb11d0Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1072a8bb11d0Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1073a8bb11d0Smrg# PKG_CHECK_EXISTS manually
1074a8bb11d0Smrg# --------------------------------------------------------------
1075a8bb11d0SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1076a8bb11d0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1077a8bb11d0Smrgif test -n "$PKG_CONFIG" && \
1078a8bb11d0Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1079a8bb11d0Smrg  m4_ifval([$2], [$2], [:])
1080a8bb11d0Smrgm4_ifvaln([$3], [else
1081a8bb11d0Smrg  $3])dnl
1082a8bb11d0Smrgfi])
1083a8bb11d0Smrg
1084a8bb11d0Smrg
1085a8bb11d0Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1086a8bb11d0Smrg# ---------------------------------------------
1087a8bb11d0Smrgm4_define([_PKG_CONFIG],
1088a8bb11d0Smrg[if test -n "$$1"; then
1089a8bb11d0Smrg    pkg_cv_[]$1="$$1"
1090a8bb11d0Smrg elif test -n "$PKG_CONFIG"; then
1091a8bb11d0Smrg    PKG_CHECK_EXISTS([$3],
1092a8bb11d0Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1093a8bb11d0Smrg		     [pkg_failed=yes])
1094a8bb11d0Smrg else
1095a8bb11d0Smrg    pkg_failed=untried
1096a8bb11d0Smrgfi[]dnl
1097a8bb11d0Smrg])# _PKG_CONFIG
1098a8bb11d0Smrg
1099a8bb11d0Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1100a8bb11d0Smrg# -----------------------------
1101a8bb11d0SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1102a8bb11d0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1103a8bb11d0Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1104a8bb11d0Smrg        _pkg_short_errors_supported=yes
1105a8bb11d0Smrgelse
1106a8bb11d0Smrg        _pkg_short_errors_supported=no
1107a8bb11d0Smrgfi[]dnl
1108a8bb11d0Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1109a8bb11d0Smrg
1110a8bb11d0Smrg
1111a8bb11d0Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1112a8bb11d0Smrg# [ACTION-IF-NOT-FOUND])
1113a8bb11d0Smrg#
1114a8bb11d0Smrg#
1115a8bb11d0Smrg# Note that if there is a possibility the first call to
1116a8bb11d0Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1117a8bb11d0Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1118a8bb11d0Smrg#
1119a8bb11d0Smrg#
1120a8bb11d0Smrg# --------------------------------------------------------------
1121a8bb11d0SmrgAC_DEFUN([PKG_CHECK_MODULES],
1122a8bb11d0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1123a8bb11d0SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1124a8bb11d0SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1125a8bb11d0Smrg
1126a8bb11d0Smrgpkg_failed=no
1127a8bb11d0SmrgAC_MSG_CHECKING([for $1])
1128a8bb11d0Smrg
1129a8bb11d0Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1130a8bb11d0Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1131a8bb11d0Smrg
1132a8bb11d0Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1133a8bb11d0Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1134a8bb11d0SmrgSee the pkg-config man page for more details.])
1135a8bb11d0Smrg
1136a8bb11d0Smrgif test $pkg_failed = yes; then
1137a8bb11d0Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1138a8bb11d0Smrg        if test $_pkg_short_errors_supported = yes; then
1139a8bb11d0Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1140a8bb11d0Smrg        else 
1141a8bb11d0Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1142a8bb11d0Smrg        fi
1143a8bb11d0Smrg	# Put the nasty error message in config.log where it belongs
1144a8bb11d0Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1145a8bb11d0Smrg
1146a8bb11d0Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1147a8bb11d0Smrg[Package requirements ($2) were not met:
1148a8bb11d0Smrg
1149a8bb11d0Smrg$$1_PKG_ERRORS
1150a8bb11d0Smrg
1151a8bb11d0SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1152a8bb11d0Smrginstalled software in a non-standard prefix.
1153a8bb11d0Smrg
1154a8bb11d0Smrg_PKG_TEXT
1155a8bb11d0Smrg])],
1156a8bb11d0Smrg		[AC_MSG_RESULT([no])
1157a8bb11d0Smrg                $4])
1158a8bb11d0Smrgelif test $pkg_failed = untried; then
1159a8bb11d0Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1160a8bb11d0Smrg[The pkg-config script could not be found or is too old.  Make sure it
1161a8bb11d0Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1162a8bb11d0Smrgpath to pkg-config.
1163a8bb11d0Smrg
1164a8bb11d0Smrg_PKG_TEXT
1165a8bb11d0Smrg
1166a8bb11d0SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1167a8bb11d0Smrg		[$4])
1168a8bb11d0Smrgelse
1169a8bb11d0Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1170a8bb11d0Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1171a8bb11d0Smrg        AC_MSG_RESULT([yes])
1172a8bb11d0Smrg	ifelse([$3], , :, [$3])
1173a8bb11d0Smrgfi[]dnl
1174a8bb11d0Smrg])# PKG_CHECK_MODULES
1175a8bb11d0Smrg
117648e69166Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1177fd0c672fSmrgdnl
117848e69166Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1179fd0c672fSmrgdnl 
1180fd0c672fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
118148e69166Smrgdnl copy of this software and associated documentation files (the "Software"),
118248e69166Smrgdnl to deal in the Software without restriction, including without limitation
118348e69166Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
118448e69166Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
118548e69166Smrgdnl Software is furnished to do so, subject to the following conditions:
1186fd0c672fSmrgdnl
118748e69166Smrgdnl The above copyright notice and this permission notice (including the next
118848e69166Smrgdnl paragraph) shall be included in all copies or substantial portions of the
118948e69166Smrgdnl Software.
1190fd0c672fSmrgdnl
119148e69166Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
119248e69166Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119348e69166Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
119448e69166Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119548e69166Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
119648e69166Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
119748e69166Smrgdnl DEALINGS IN THE SOFTWARE.
1198fd0c672fSmrg
1199fd0c672fSmrg# XORG_MACROS_VERSION(required-version)
1200fd0c672fSmrg# -------------------------------------
1201fd0c672fSmrg# Minimum version: 1.1.0
1202fd0c672fSmrg#
1203fd0c672fSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1204fd0c672fSmrg# your configure.ac with the minimum required version, such as:
1205fd0c672fSmrg# XORG_MACROS_VERSION(1.1)
1206fd0c672fSmrg#
120748e69166Smrg# To ensure that this macro is defined, also add:
120848e69166Smrg# m4_ifndef([XORG_MACROS_VERSION],
120948e69166Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1210fd0c672fSmrg#
1211fd0c672fSmrg#
1212fd0c672fSmrg# See the "minimum version" comment for each macro you use to see what 
1213fd0c672fSmrg# version you require.
121448e69166Smrgm4_defun([XORG_MACROS_VERSION],[
1215a8bb11d0Smrgm4_define([vers_have], [1.17])
121648e69166Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
121748e69166Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
121848e69166Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
121948e69166Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
122048e69166Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
122148e69166Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
122248e69166Smrgm4_undefine([vers_have])
122348e69166Smrgm4_undefine([maj_have])
122448e69166Smrgm4_undefine([maj_needed])
1225fd0c672fSmrg]) # XORG_MACROS_VERSION
1226fd0c672fSmrg
1227fd0c672fSmrg# XORG_PROG_RAWCPP()
1228fd0c672fSmrg# ------------------
1229fd0c672fSmrg# Minimum version: 1.0.0
1230fd0c672fSmrg#
1231fd0c672fSmrg# Find cpp program and necessary flags for use in pre-processing text files
1232fd0c672fSmrg# such as man pages and config files
1233fd0c672fSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1234fd0c672fSmrgAC_REQUIRE([AC_PROG_CPP])
1235fd0c672fSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1236fd0c672fSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1237fd0c672fSmrg
1238fd0c672fSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1239fd0c672fSmrg# which is not the best choice for supporting other OS'es, but covers most
1240fd0c672fSmrg# of the ones we need for now.
1241fd0c672fSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1242a8bb11d0SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1243fd0c672fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1244fd0c672fSmrg	AC_MSG_RESULT([no])
1245fd0c672fSmrgelse
1246fd0c672fSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1247fd0c672fSmrg		RAWCPPFLAGS=-undef
1248fd0c672fSmrg		AC_MSG_RESULT([yes])
124948e69166Smrg	# under Cygwin unix is still defined even with -undef
125048e69166Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
125148e69166Smrg		RAWCPPFLAGS="-undef -ansi"
125248e69166Smrg		AC_MSG_RESULT([yes, with -ansi])
1253fd0c672fSmrg	else
1254fd0c672fSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1255fd0c672fSmrg	fi
1256fd0c672fSmrgfi
1257fd0c672fSmrgrm -f conftest.$ac_ext
1258fd0c672fSmrg
1259fd0c672fSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1260a8bb11d0SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1261fd0c672fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1262fd0c672fSmrg	AC_MSG_RESULT([no])
1263fd0c672fSmrgelse
1264fd0c672fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1265fd0c672fSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1266fd0c672fSmrg		AC_MSG_RESULT([yes])
1267fd0c672fSmrg	else
1268fd0c672fSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1269fd0c672fSmrg	fi
1270fd0c672fSmrgfi
1271fd0c672fSmrgrm -f conftest.$ac_ext
1272fd0c672fSmrgAC_SUBST(RAWCPPFLAGS)
1273fd0c672fSmrg]) # XORG_PROG_RAWCPP
1274fd0c672fSmrg
1275fd0c672fSmrg# XORG_MANPAGE_SECTIONS()
1276fd0c672fSmrg# -----------------------
1277fd0c672fSmrg# Minimum version: 1.0.0
1278fd0c672fSmrg#
1279fd0c672fSmrg# Determine which sections man pages go in for the different man page types
1280fd0c672fSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1281fd0c672fSmrg# Not sure if there's any better way than just hardcoding by OS name.
1282fd0c672fSmrg# Override default settings by setting environment variables
128348e69166Smrg# Added MAN_SUBSTS in version 1.8
128448e69166Smrg# Added AC_PROG_SED in version 1.8
1285fd0c672fSmrg
1286fd0c672fSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1287fd0c672fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
128848e69166SmrgAC_REQUIRE([AC_PROG_SED])
1289fd0c672fSmrg
1290fd0c672fSmrgif test x$APP_MAN_SUFFIX = x    ; then
1291fd0c672fSmrg    APP_MAN_SUFFIX=1
1292fd0c672fSmrgfi
1293fd0c672fSmrgif test x$APP_MAN_DIR = x    ; then
1294fd0c672fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1295fd0c672fSmrgfi
1296fd0c672fSmrg
1297fd0c672fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1298fd0c672fSmrg    LIB_MAN_SUFFIX=3
1299fd0c672fSmrgfi
1300fd0c672fSmrgif test x$LIB_MAN_DIR = x    ; then
1301fd0c672fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1302fd0c672fSmrgfi
1303fd0c672fSmrg
1304fd0c672fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1305fd0c672fSmrg    case $host_os in
1306fd0c672fSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1307fd0c672fSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1308fd0c672fSmrg    esac
1309fd0c672fSmrgfi
1310fd0c672fSmrgif test x$FILE_MAN_DIR = x    ; then
1311fd0c672fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1312fd0c672fSmrgfi
1313fd0c672fSmrg
1314fd0c672fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1315fd0c672fSmrg    case $host_os in
1316fd0c672fSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1317fd0c672fSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1318fd0c672fSmrg    esac
1319fd0c672fSmrgfi
1320fd0c672fSmrgif test x$MISC_MAN_DIR = x    ; then
1321fd0c672fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1322fd0c672fSmrgfi
1323fd0c672fSmrg
1324fd0c672fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1325fd0c672fSmrg    case $host_os in
1326fd0c672fSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1327fd0c672fSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1328fd0c672fSmrg    esac
1329fd0c672fSmrgfi
1330fd0c672fSmrgif test x$DRIVER_MAN_DIR = x    ; then
1331fd0c672fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1332fd0c672fSmrgfi
1333fd0c672fSmrg
1334fd0c672fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1335fd0c672fSmrg    case $host_os in
1336fd0c672fSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1337fd0c672fSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1338fd0c672fSmrg    esac
1339fd0c672fSmrgfi
1340fd0c672fSmrgif test x$ADMIN_MAN_DIR = x    ; then
1341fd0c672fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1342fd0c672fSmrgfi
1343fd0c672fSmrg
1344fd0c672fSmrg
1345fd0c672fSmrgAC_SUBST([APP_MAN_SUFFIX])
1346fd0c672fSmrgAC_SUBST([LIB_MAN_SUFFIX])
1347fd0c672fSmrgAC_SUBST([FILE_MAN_SUFFIX])
1348fd0c672fSmrgAC_SUBST([MISC_MAN_SUFFIX])
1349fd0c672fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1350fd0c672fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1351fd0c672fSmrgAC_SUBST([APP_MAN_DIR])
1352fd0c672fSmrgAC_SUBST([LIB_MAN_DIR])
1353fd0c672fSmrgAC_SUBST([FILE_MAN_DIR])
1354fd0c672fSmrgAC_SUBST([MISC_MAN_DIR])
1355fd0c672fSmrgAC_SUBST([DRIVER_MAN_DIR])
1356fd0c672fSmrgAC_SUBST([ADMIN_MAN_DIR])
135748e69166Smrg
135848e69166SmrgXORG_MAN_PAGE="X Version 11"
135948e69166SmrgAC_SUBST([XORG_MAN_PAGE])
136048e69166SmrgMAN_SUBSTS="\
136148e69166Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136248e69166Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136348e69166Smrg	-e 's|__xservername__|Xorg|g' \
136448e69166Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
136548e69166Smrg	-e 's|__projectroot__|\$(prefix)|g' \
136648e69166Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
136748e69166Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
136848e69166Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
136948e69166Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
137048e69166Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
137148e69166Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
137248e69166Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
137348e69166SmrgAC_SUBST([MAN_SUBSTS])
137448e69166Smrg
1375fd0c672fSmrg]) # XORG_MANPAGE_SECTIONS
1376fd0c672fSmrg
137748e69166Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
137848e69166Smrg# ------------------------
137948e69166Smrg# Minimum version: 1.7.0
138048e69166Smrg#
138148e69166Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
138248e69166Smrg# provided by xorg-sgml-doctools, if installed.
138348e69166SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
138448e69166SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
138548e69166SmrgXORG_SGML_PATH=
138648e69166SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
138748e69166Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
138848e69166Smrg    [m4_ifval([$1],[:],
138948e69166Smrg        [if test x"$cross_compiling" != x"yes" ; then
139048e69166Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
139148e69166Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
139248e69166Smrg         fi])
139348e69166Smrg    ])
139448e69166Smrg
139548e69166Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
139648e69166Smrg# the path and the name of the doc stylesheet
139748e69166Smrgif test "x$XORG_SGML_PATH" != "x" ; then
139848e69166Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
139948e69166Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
140048e69166Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
140148e69166Smrgelse
140248e69166Smrg   AC_MSG_RESULT([no])
140348e69166Smrgfi
140448e69166Smrg
140548e69166SmrgAC_SUBST(XORG_SGML_PATH)
140648e69166SmrgAC_SUBST(STYLESHEET_SRCDIR)
140748e69166SmrgAC_SUBST(XSL_STYLESHEET)
140848e69166SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
140948e69166Smrg]) # XORG_CHECK_SGML_DOCTOOLS
141048e69166Smrg
1411fd0c672fSmrg# XORG_CHECK_LINUXDOC
1412fd0c672fSmrg# -------------------
1413fd0c672fSmrg# Minimum version: 1.0.0
1414fd0c672fSmrg#
1415fd0c672fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1416fd0c672fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1417fd0c672fSmrg# Whether or not the necessary tools and files are found can be checked
1418fd0c672fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1419fd0c672fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
142048e69166SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
142148e69166SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1422fd0c672fSmrg
1423fd0c672fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1424fd0c672fSmrg
142548e69166SmrgAC_MSG_CHECKING([whether to build documentation])
1426fd0c672fSmrg
142748e69166Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1428fd0c672fSmrg   BUILDDOC=yes
1429fd0c672fSmrgelse
1430fd0c672fSmrg   BUILDDOC=no
1431fd0c672fSmrgfi
1432fd0c672fSmrg
1433fd0c672fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1434fd0c672fSmrg
1435fd0c672fSmrgAC_MSG_RESULT([$BUILDDOC])
1436fd0c672fSmrg
143748e69166SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1438fd0c672fSmrg
143948e69166Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1440fd0c672fSmrg   BUILDPDFDOC=yes
1441fd0c672fSmrgelse
1442fd0c672fSmrg   BUILDPDFDOC=no
1443fd0c672fSmrgfi
1444fd0c672fSmrg
1445fd0c672fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1446fd0c672fSmrg
1447fd0c672fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1448fd0c672fSmrg
144948e69166SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1450fd0c672fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1451fd0c672fSmrgMAKE_PDF="$PS2PDF"
1452fd0c672fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1453fd0c672fSmrg
1454fd0c672fSmrgAC_SUBST(MAKE_TEXT)
1455fd0c672fSmrgAC_SUBST(MAKE_PS)
1456fd0c672fSmrgAC_SUBST(MAKE_PDF)
1457fd0c672fSmrgAC_SUBST(MAKE_HTML)
1458fd0c672fSmrg]) # XORG_CHECK_LINUXDOC
1459fd0c672fSmrg
1460fd0c672fSmrg# XORG_CHECK_DOCBOOK
1461fd0c672fSmrg# -------------------
1462fd0c672fSmrg# Minimum version: 1.0.0
1463fd0c672fSmrg#
1464fd0c672fSmrg# Checks for the ability to build output formats from SGML DocBook source.
1465fd0c672fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1466fd0c672fSmrg# indicates whether the necessary tools and files are found and, if set,
1467fd0c672fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1468fd0c672fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
146948e69166SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
147048e69166Smrg
1471fd0c672fSmrgBUILDTXTDOC=no
1472fd0c672fSmrgBUILDPDFDOC=no
1473fd0c672fSmrgBUILDPSDOC=no
1474fd0c672fSmrgBUILDHTMLDOC=no
1475fd0c672fSmrg
1476fd0c672fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1477fd0c672fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1478fd0c672fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1479fd0c672fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1480fd0c672fSmrg
148148e69166SmrgAC_MSG_CHECKING([whether to build text documentation])
148248e69166Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1483fd0c672fSmrg   test x$BUILD_TXTDOC != xno; then
1484fd0c672fSmrg	BUILDTXTDOC=yes
1485fd0c672fSmrgfi
1486fd0c672fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1487fd0c672fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1488fd0c672fSmrg
148948e69166SmrgAC_MSG_CHECKING([whether to build PDF documentation])
149048e69166Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1491fd0c672fSmrg   test x$BUILD_PDFDOC != xno; then
1492fd0c672fSmrg	BUILDPDFDOC=yes
1493fd0c672fSmrgfi
1494fd0c672fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1495fd0c672fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1496fd0c672fSmrg
149748e69166SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
149848e69166Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1499fd0c672fSmrg   test x$BUILD_PSDOC != xno; then
1500fd0c672fSmrg	BUILDPSDOC=yes
1501fd0c672fSmrgfi
1502fd0c672fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1503fd0c672fSmrgAC_MSG_RESULT([$BUILDPSDOC])
1504fd0c672fSmrg
150548e69166SmrgAC_MSG_CHECKING([whether to build HTML documentation])
150648e69166Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1507fd0c672fSmrg   test x$BUILD_HTMLDOC != xno; then
1508fd0c672fSmrg	BUILDHTMLDOC=yes
1509fd0c672fSmrgfi
1510fd0c672fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1511fd0c672fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1512fd0c672fSmrg
1513fd0c672fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1514fd0c672fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1515fd0c672fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1516fd0c672fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1517fd0c672fSmrg
1518fd0c672fSmrgAC_SUBST(MAKE_TEXT)
1519fd0c672fSmrgAC_SUBST(MAKE_PS)
1520fd0c672fSmrgAC_SUBST(MAKE_PDF)
1521fd0c672fSmrgAC_SUBST(MAKE_HTML)
1522fd0c672fSmrg]) # XORG_CHECK_DOCBOOK
1523fd0c672fSmrg
1524a8bb11d0Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
152548e69166Smrg# ----------------
152648e69166Smrg# Minimum version: 1.5.0
1527a8bb11d0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
152848e69166Smrg#
152948e69166Smrg# Documentation tools are not always available on all platforms and sometimes
153048e69166Smrg# not at the appropriate level. This macro enables a module to test for the
153148e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
153248e69166Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1533a8bb11d0Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1534a8bb11d0Smrg# --with-xmlto assumes 'auto'.
153548e69166Smrg#
153648e69166Smrg# Interface to module:
153748e69166Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
153848e69166Smrg# XMLTO:	returns the path of the xmlto program found
153948e69166Smrg#		returns the path set by the user in the environment
154048e69166Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
154148e69166Smrg#		'no' user instructs the module not to use xmlto
154248e69166Smrg#
154348e69166Smrg# Added in version 1.10.0
154448e69166Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
154548e69166Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
154648e69166Smrg#
154748e69166Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
154848e69166Smrg#
154948e69166SmrgAC_DEFUN([XORG_WITH_XMLTO],[
155048e69166SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1551a8bb11d0Smrgm4_define([_defopt], m4_default([$2], [auto]))
155248e69166SmrgAC_ARG_WITH(xmlto,
155348e69166Smrg	AS_HELP_STRING([--with-xmlto],
1554a8bb11d0Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1555a8bb11d0Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1556a8bb11d0Smrgm4_undefine([_defopt])
155748e69166Smrg
155848e69166Smrgif test "x$use_xmlto" = x"auto"; then
155948e69166Smrg   AC_PATH_PROG([XMLTO], [xmlto])
156048e69166Smrg   if test "x$XMLTO" = "x"; then
156148e69166Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
156248e69166Smrg	have_xmlto=no
156348e69166Smrg   else
156448e69166Smrg        have_xmlto=yes
156548e69166Smrg   fi
156648e69166Smrgelif test "x$use_xmlto" = x"yes" ; then
156748e69166Smrg   AC_PATH_PROG([XMLTO], [xmlto])
156848e69166Smrg   if test "x$XMLTO" = "x"; then
156948e69166Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
157048e69166Smrg   fi
157148e69166Smrg   have_xmlto=yes
157248e69166Smrgelif test "x$use_xmlto" = x"no" ; then
157348e69166Smrg   if test "x$XMLTO" != "x"; then
157448e69166Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
157548e69166Smrg   fi
157648e69166Smrg   have_xmlto=no
157748e69166Smrgelse
157848e69166Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
157948e69166Smrgfi
158048e69166Smrg
158148e69166Smrg# Test for a minimum version of xmlto, if provided.
158248e69166Smrgm4_ifval([$1],
158348e69166Smrg[if test "$have_xmlto" = yes; then
158448e69166Smrg    # scrape the xmlto version
158548e69166Smrg    AC_MSG_CHECKING([the xmlto version])
158648e69166Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
158748e69166Smrg    AC_MSG_RESULT([$xmlto_version])
158848e69166Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
158948e69166Smrg        [if test "x$use_xmlto" = xauto; then
159048e69166Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
159148e69166Smrg            have_xmlto=no
159248e69166Smrg        else
159348e69166Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
159448e69166Smrg        fi])
159548e69166Smrgfi])
159648e69166Smrg
159748e69166Smrg# Test for the ability of xmlto to generate a text target
159848e69166Smrghave_xmlto_text=no
159948e69166Smrgcat > conftest.xml << "EOF"
160048e69166SmrgEOF
160148e69166SmrgAS_IF([test "$have_xmlto" = yes],
160248e69166Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
160348e69166Smrg             [have_xmlto_text=yes],
160448e69166Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
160548e69166Smrgrm -f conftest.xml
160648e69166SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
160748e69166SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
160848e69166Smrg]) # XORG_WITH_XMLTO
160948e69166Smrg
1610a8bb11d0Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1611a8bb11d0Smrg# --------------------------------------------
1612a8bb11d0Smrg# Minimum version: 1.12.0
1613a8bb11d0Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1614a8bb11d0Smrg#
1615a8bb11d0Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1616a8bb11d0Smrg# XML-based language used for the transformation of XML documents.
1617a8bb11d0Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1618a8bb11d0Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1619a8bb11d0Smrg# The XSLT processor is often used as a standalone tool for transformations.
1620a8bb11d0Smrg# It should not be assumed that this tool is used only to work with documnetation.
1621a8bb11d0Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1622a8bb11d0Smrg#
1623a8bb11d0Smrg# Interface to module:
1624a8bb11d0Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1625a8bb11d0Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1626a8bb11d0Smrg#		 returns the path set by the user in the environment
1627a8bb11d0Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1628a8bb11d0Smrg#		  'no' user instructs the module not to use xsltproc
1629a8bb11d0Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1630a8bb11d0Smrg#
1631a8bb11d0Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1632a8bb11d0Smrg#
1633a8bb11d0SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1634a8bb11d0SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1635a8bb11d0Smrg# Preserves the interface, should it be implemented later
1636a8bb11d0Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1637a8bb11d0Smrgm4_define([_defopt], m4_default([$2], [auto]))
1638a8bb11d0SmrgAC_ARG_WITH(xsltproc,
1639a8bb11d0Smrg	AS_HELP_STRING([--with-xsltproc],
1640a8bb11d0Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1641a8bb11d0Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1642a8bb11d0Smrgm4_undefine([_defopt])
1643a8bb11d0Smrg
1644a8bb11d0Smrgif test "x$use_xsltproc" = x"auto"; then
1645a8bb11d0Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1646a8bb11d0Smrg   if test "x$XSLTPROC" = "x"; then
1647a8bb11d0Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1648a8bb11d0Smrg	have_xsltproc=no
1649a8bb11d0Smrg   else
1650a8bb11d0Smrg        have_xsltproc=yes
1651a8bb11d0Smrg   fi
1652a8bb11d0Smrgelif test "x$use_xsltproc" = x"yes" ; then
1653a8bb11d0Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1654a8bb11d0Smrg   if test "x$XSLTPROC" = "x"; then
1655a8bb11d0Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1656a8bb11d0Smrg   fi
1657a8bb11d0Smrg   have_xsltproc=yes
1658a8bb11d0Smrgelif test "x$use_xsltproc" = x"no" ; then
1659a8bb11d0Smrg   if test "x$XSLTPROC" != "x"; then
1660a8bb11d0Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1661a8bb11d0Smrg   fi
1662a8bb11d0Smrg   have_xsltproc=no
1663a8bb11d0Smrgelse
1664a8bb11d0Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1665a8bb11d0Smrgfi
1666a8bb11d0Smrg
1667a8bb11d0SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1668a8bb11d0Smrg]) # XORG_WITH_XSLTPROC
1669a8bb11d0Smrg
1670a8bb11d0Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1671a8bb11d0Smrg# ----------------------------------------
1672a8bb11d0Smrg# Minimum version: 1.15.0
1673a8bb11d0Smrg#
1674a8bb11d0Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1675a8bb11d0Smrg# scanning arbitrary text files, extracting information from those text files,
1676a8bb11d0Smrg# and printing reports based on that information.
1677a8bb11d0Smrg#
1678a8bb11d0Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1679a8bb11d0Smrg#
1680a8bb11d0Smrg# Interface to module:
1681a8bb11d0Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1682a8bb11d0Smrg# PERL:	     returns the path of the perl program found
1683a8bb11d0Smrg#	     returns the path set by the user in the environment
1684a8bb11d0Smrg# --with-perl: 'yes' user instructs the module to use perl
1685a8bb11d0Smrg#	       'no' user instructs the module not to use perl
1686a8bb11d0Smrg# have_perl: returns yes if perl found in PATH or no
1687a8bb11d0Smrg#
1688a8bb11d0Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1689a8bb11d0Smrg#
1690a8bb11d0SmrgAC_DEFUN([XORG_WITH_PERL],[
1691a8bb11d0SmrgAC_ARG_VAR([PERL], [Path to perl command])
1692a8bb11d0Smrg# Preserves the interface, should it be implemented later
1693a8bb11d0Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1694a8bb11d0Smrgm4_define([_defopt], m4_default([$2], [auto]))
1695a8bb11d0SmrgAC_ARG_WITH(perl,
1696a8bb11d0Smrg	AS_HELP_STRING([--with-perl],
1697a8bb11d0Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1698a8bb11d0Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1699a8bb11d0Smrgm4_undefine([_defopt])
1700a8bb11d0Smrg
1701a8bb11d0Smrgif test "x$use_perl" = x"auto"; then
1702a8bb11d0Smrg   AC_PATH_PROG([PERL], [perl])
1703a8bb11d0Smrg   if test "x$PERL" = "x"; then
1704a8bb11d0Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1705a8bb11d0Smrg	have_perl=no
1706a8bb11d0Smrg   else
1707a8bb11d0Smrg        have_perl=yes
1708a8bb11d0Smrg   fi
1709a8bb11d0Smrgelif test "x$use_perl" = x"yes" ; then
1710a8bb11d0Smrg   AC_PATH_PROG([PERL], [perl])
1711a8bb11d0Smrg   if test "x$PERL" = "x"; then
1712a8bb11d0Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1713a8bb11d0Smrg   fi
1714a8bb11d0Smrg   have_perl=yes
1715a8bb11d0Smrgelif test "x$use_perl" = x"no" ; then
1716a8bb11d0Smrg   if test "x$PERL" != "x"; then
1717a8bb11d0Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1718a8bb11d0Smrg   fi
1719a8bb11d0Smrg   have_perl=no
1720a8bb11d0Smrgelse
1721a8bb11d0Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1722a8bb11d0Smrgfi
1723a8bb11d0Smrg
1724a8bb11d0SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1725a8bb11d0Smrg]) # XORG_WITH_PERL
1726a8bb11d0Smrg
1727a8bb11d0Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
172848e69166Smrg# ----------------
172948e69166Smrg# Minimum version: 1.5.0
1730a8bb11d0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
173148e69166Smrg#
173248e69166Smrg# Documentation tools are not always available on all platforms and sometimes
173348e69166Smrg# not at the appropriate level. This macro enables a module to test for the
173448e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
173548e69166Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1736a8bb11d0Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1737a8bb11d0Smrg# --with-asciidoc assumes 'auto'.
173848e69166Smrg#
173948e69166Smrg# Interface to module:
174048e69166Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
174148e69166Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
174248e69166Smrg#		 returns the path set by the user in the environment
174348e69166Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
174448e69166Smrg#		  'no' user instructs the module not to use asciidoc
174548e69166Smrg#
174648e69166Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
174748e69166Smrg#
174848e69166SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
174948e69166SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1750a8bb11d0Smrgm4_define([_defopt], m4_default([$2], [auto]))
175148e69166SmrgAC_ARG_WITH(asciidoc,
175248e69166Smrg	AS_HELP_STRING([--with-asciidoc],
1753a8bb11d0Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1754a8bb11d0Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1755a8bb11d0Smrgm4_undefine([_defopt])
175648e69166Smrg
175748e69166Smrgif test "x$use_asciidoc" = x"auto"; then
175848e69166Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
175948e69166Smrg   if test "x$ASCIIDOC" = "x"; then
176048e69166Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
176148e69166Smrg	have_asciidoc=no
176248e69166Smrg   else
176348e69166Smrg        have_asciidoc=yes
176448e69166Smrg   fi
176548e69166Smrgelif test "x$use_asciidoc" = x"yes" ; then
176648e69166Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
176748e69166Smrg   if test "x$ASCIIDOC" = "x"; then
176848e69166Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
176948e69166Smrg   fi
177048e69166Smrg   have_asciidoc=yes
177148e69166Smrgelif test "x$use_asciidoc" = x"no" ; then
177248e69166Smrg   if test "x$ASCIIDOC" != "x"; then
177348e69166Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
177448e69166Smrg   fi
177548e69166Smrg   have_asciidoc=no
177648e69166Smrgelse
177748e69166Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
177848e69166Smrgfi
177948e69166Smrgm4_ifval([$1],
178048e69166Smrg[if test "$have_asciidoc" = yes; then
178148e69166Smrg    # scrape the asciidoc version
178248e69166Smrg    AC_MSG_CHECKING([the asciidoc version])
178348e69166Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
178448e69166Smrg    AC_MSG_RESULT([$asciidoc_version])
178548e69166Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
178648e69166Smrg        [if test "x$use_asciidoc" = xauto; then
178748e69166Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
178848e69166Smrg            have_asciidoc=no
178948e69166Smrg        else
179048e69166Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
179148e69166Smrg        fi])
179248e69166Smrgfi])
179348e69166SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
179448e69166Smrg]) # XORG_WITH_ASCIIDOC
179548e69166Smrg
1796a8bb11d0Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
179748e69166Smrg# --------------------------------
179848e69166Smrg# Minimum version: 1.5.0
1799a8bb11d0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
180048e69166Smrg#
180148e69166Smrg# Documentation tools are not always available on all platforms and sometimes
180248e69166Smrg# not at the appropriate level. This macro enables a module to test for the
180348e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
180448e69166Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1805a8bb11d0Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1806a8bb11d0Smrg# --with-doxygen assumes 'auto'.
180748e69166Smrg#
180848e69166Smrg# Interface to module:
180948e69166Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
181048e69166Smrg# DOXYGEN:	 returns the path of the doxygen program found
181148e69166Smrg#		 returns the path set by the user in the environment
181248e69166Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
181348e69166Smrg#		  'no' user instructs the module not to use doxygen
181448e69166Smrg#
181548e69166Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
181648e69166Smrg#
181748e69166SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
181848e69166SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1819a8bb11d0Smrgm4_define([_defopt], m4_default([$2], [auto]))
182048e69166SmrgAC_ARG_WITH(doxygen,
182148e69166Smrg	AS_HELP_STRING([--with-doxygen],
1822a8bb11d0Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1823a8bb11d0Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1824a8bb11d0Smrgm4_undefine([_defopt])
182548e69166Smrg
182648e69166Smrgif test "x$use_doxygen" = x"auto"; then
182748e69166Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
182848e69166Smrg   if test "x$DOXYGEN" = "x"; then
182948e69166Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
183048e69166Smrg	have_doxygen=no
183148e69166Smrg   else
183248e69166Smrg        have_doxygen=yes
183348e69166Smrg   fi
183448e69166Smrgelif test "x$use_doxygen" = x"yes" ; then
183548e69166Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
183648e69166Smrg   if test "x$DOXYGEN" = "x"; then
183748e69166Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
183848e69166Smrg   fi
183948e69166Smrg   have_doxygen=yes
184048e69166Smrgelif test "x$use_doxygen" = x"no" ; then
184148e69166Smrg   if test "x$DOXYGEN" != "x"; then
184248e69166Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
184348e69166Smrg   fi
184448e69166Smrg   have_doxygen=no
184548e69166Smrgelse
184648e69166Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
184748e69166Smrgfi
184848e69166Smrgm4_ifval([$1],
184948e69166Smrg[if test "$have_doxygen" = yes; then
185048e69166Smrg    # scrape the doxygen version
185148e69166Smrg    AC_MSG_CHECKING([the doxygen version])
185248e69166Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
185348e69166Smrg    AC_MSG_RESULT([$doxygen_version])
185448e69166Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
185548e69166Smrg        [if test "x$use_doxygen" = xauto; then
185648e69166Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
185748e69166Smrg            have_doxygen=no
185848e69166Smrg        else
185948e69166Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
186048e69166Smrg        fi])
186148e69166Smrgfi])
186248e69166SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
186348e69166Smrg]) # XORG_WITH_DOXYGEN
186448e69166Smrg
1865a8bb11d0Smrg# XORG_WITH_GROFF([DEFAULT])
186648e69166Smrg# ----------------
186748e69166Smrg# Minimum version: 1.6.0
1868a8bb11d0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
186948e69166Smrg#
187048e69166Smrg# Documentation tools are not always available on all platforms and sometimes
187148e69166Smrg# not at the appropriate level. This macro enables a module to test for the
187248e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
187348e69166Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1874a8bb11d0Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1875a8bb11d0Smrg# --with-groff assumes 'auto'.
187648e69166Smrg#
187748e69166Smrg# Interface to module:
187848e69166Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
187948e69166Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
188048e69166Smrg# HAVE_GROFF_MS: the -ms macros package
188148e69166Smrg# GROFF:	 returns the path of the groff program found
188248e69166Smrg#		 returns the path set by the user in the environment
188348e69166Smrg# --with-groff:	 'yes' user instructs the module to use groff
188448e69166Smrg#		 'no' user instructs the module not to use groff
188548e69166Smrg#
188648e69166Smrg# Added in version 1.9.0:
188748e69166Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
188848e69166Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
188948e69166Smrg#		   psselect from the psutils package.
189048e69166Smrg#		   the ghostcript package. Refer to the grohtml man pages
189148e69166Smrg#
189248e69166Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
189348e69166Smrg#
189448e69166Smrg# OS and distros often splits groff in a basic and full package, the former
189548e69166Smrg# having the groff program and the later having devices, fonts and macros
189648e69166Smrg# Checking for the groff executable is not enough.
189748e69166Smrg#
189848e69166Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
189948e69166Smrg# unset HAVE_GROFF or GROFF env variables.
190048e69166Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
190148e69166Smrg#
190248e69166SmrgAC_DEFUN([XORG_WITH_GROFF],[
190348e69166SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1904a8bb11d0Smrgm4_define([_defopt], m4_default([$1], [auto]))
190548e69166SmrgAC_ARG_WITH(groff,
190648e69166Smrg	AS_HELP_STRING([--with-groff],
1907a8bb11d0Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1908a8bb11d0Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1909a8bb11d0Smrgm4_undefine([_defopt])
191048e69166Smrg
191148e69166Smrgif test "x$use_groff" = x"auto"; then
191248e69166Smrg   AC_PATH_PROG([GROFF], [groff])
191348e69166Smrg   if test "x$GROFF" = "x"; then
191448e69166Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
191548e69166Smrg	have_groff=no
191648e69166Smrg   else
191748e69166Smrg        have_groff=yes
191848e69166Smrg   fi
191948e69166Smrgelif test "x$use_groff" = x"yes" ; then
192048e69166Smrg   AC_PATH_PROG([GROFF], [groff])
192148e69166Smrg   if test "x$GROFF" = "x"; then
192248e69166Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
192348e69166Smrg   fi
192448e69166Smrg   have_groff=yes
192548e69166Smrgelif test "x$use_groff" = x"no" ; then
192648e69166Smrg   if test "x$GROFF" != "x"; then
192748e69166Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
192848e69166Smrg   fi
192948e69166Smrg   have_groff=no
193048e69166Smrgelse
193148e69166Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
193248e69166Smrgfi
193348e69166Smrg
193448e69166Smrg# We have groff, test for the presence of the macro packages
193548e69166Smrgif test "x$have_groff" = x"yes"; then
193648e69166Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
193748e69166Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
193848e69166Smrg        groff_ms_works=yes
193948e69166Smrg    else
194048e69166Smrg        groff_ms_works=no
194148e69166Smrg    fi
194248e69166Smrg    AC_MSG_RESULT([$groff_ms_works])
194348e69166Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
194448e69166Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
194548e69166Smrg        groff_mm_works=yes
194648e69166Smrg    else
194748e69166Smrg        groff_mm_works=no
194848e69166Smrg    fi
194948e69166Smrg    AC_MSG_RESULT([$groff_mm_works])
195048e69166Smrgfi
195148e69166Smrg
195248e69166Smrg# We have groff, test for HTML dependencies, one command per package
195348e69166Smrgif test "x$have_groff" = x"yes"; then
195448e69166Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
195548e69166Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
195648e69166Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
195748e69166Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
195848e69166Smrg      have_groff_html=yes
195948e69166Smrg   else
196048e69166Smrg      have_groff_html=no
196148e69166Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
196248e69166Smrg   fi
196348e69166Smrgfi
196448e69166Smrg
196548e69166Smrg# Set Automake conditionals for Makefiles
196648e69166SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
196748e69166SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
196848e69166SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
196948e69166SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
197048e69166Smrg]) # XORG_WITH_GROFF
197148e69166Smrg
1972a8bb11d0Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1973a8bb11d0Smrg# ---------------------------------------
197448e69166Smrg# Minimum version: 1.6.0
1975a8bb11d0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1976a8bb11d0Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
197748e69166Smrg#
197848e69166Smrg# Documentation tools are not always available on all platforms and sometimes
197948e69166Smrg# not at the appropriate level. This macro enables a module to test for the
198048e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
198148e69166Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
1982a8bb11d0Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
1983a8bb11d0Smrg# --with-fop assumes 'auto'.
198448e69166Smrg#
198548e69166Smrg# Interface to module:
198648e69166Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
198748e69166Smrg# FOP:	 	returns the path of the fop program found
198848e69166Smrg#		returns the path set by the user in the environment
198948e69166Smrg# --with-fop: 	'yes' user instructs the module to use fop
199048e69166Smrg#		'no' user instructs the module not to use fop
199148e69166Smrg#
199248e69166Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
199348e69166Smrg#
199448e69166SmrgAC_DEFUN([XORG_WITH_FOP],[
199548e69166SmrgAC_ARG_VAR([FOP], [Path to fop command])
1996a8bb11d0Smrgm4_define([_defopt], m4_default([$2], [auto]))
199748e69166SmrgAC_ARG_WITH(fop,
199848e69166Smrg	AS_HELP_STRING([--with-fop],
1999a8bb11d0Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2000a8bb11d0Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2001a8bb11d0Smrgm4_undefine([_defopt])
200248e69166Smrg
200348e69166Smrgif test "x$use_fop" = x"auto"; then
200448e69166Smrg   AC_PATH_PROG([FOP], [fop])
200548e69166Smrg   if test "x$FOP" = "x"; then
200648e69166Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
200748e69166Smrg	have_fop=no
200848e69166Smrg   else
200948e69166Smrg        have_fop=yes
201048e69166Smrg   fi
201148e69166Smrgelif test "x$use_fop" = x"yes" ; then
201248e69166Smrg   AC_PATH_PROG([FOP], [fop])
201348e69166Smrg   if test "x$FOP" = "x"; then
201448e69166Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
201548e69166Smrg   fi
201648e69166Smrg   have_fop=yes
201748e69166Smrgelif test "x$use_fop" = x"no" ; then
201848e69166Smrg   if test "x$FOP" != "x"; then
201948e69166Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
202048e69166Smrg   fi
202148e69166Smrg   have_fop=no
202248e69166Smrgelse
202348e69166Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
202448e69166Smrgfi
2025a8bb11d0Smrg
2026a8bb11d0Smrg# Test for a minimum version of fop, if provided.
2027a8bb11d0Smrgm4_ifval([$1],
2028a8bb11d0Smrg[if test "$have_fop" = yes; then
2029a8bb11d0Smrg    # scrape the fop version
2030a8bb11d0Smrg    AC_MSG_CHECKING([for fop minimum version])
2031a8bb11d0Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2032a8bb11d0Smrg    AC_MSG_RESULT([$fop_version])
2033a8bb11d0Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2034a8bb11d0Smrg        [if test "x$use_fop" = xauto; then
2035a8bb11d0Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2036a8bb11d0Smrg            have_fop=no
2037a8bb11d0Smrg        else
2038a8bb11d0Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2039a8bb11d0Smrg        fi])
2040a8bb11d0Smrgfi])
204148e69166SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
204248e69166Smrg]) # XORG_WITH_FOP
204348e69166Smrg
2044a8bb11d0Smrg# XORG_WITH_PS2PDF([DEFAULT])
204548e69166Smrg# ----------------
204648e69166Smrg# Minimum version: 1.6.0
2047a8bb11d0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
204848e69166Smrg#
204948e69166Smrg# Documentation tools are not always available on all platforms and sometimes
205048e69166Smrg# not at the appropriate level. This macro enables a module to test for the
205148e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
205248e69166Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2053a8bb11d0Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2054a8bb11d0Smrg# --with-ps2pdf assumes 'auto'.
205548e69166Smrg#
205648e69166Smrg# Interface to module:
205748e69166Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
205848e69166Smrg# PS2PDF:	returns the path of the ps2pdf program found
205948e69166Smrg#		returns the path set by the user in the environment
206048e69166Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
206148e69166Smrg#		 'no' user instructs the module not to use ps2pdf
206248e69166Smrg#
206348e69166Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
206448e69166Smrg#
206548e69166SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
206648e69166SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2067a8bb11d0Smrgm4_define([_defopt], m4_default([$1], [auto]))
206848e69166SmrgAC_ARG_WITH(ps2pdf,
206948e69166Smrg	AS_HELP_STRING([--with-ps2pdf],
2070a8bb11d0Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2071a8bb11d0Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2072a8bb11d0Smrgm4_undefine([_defopt])
207348e69166Smrg
207448e69166Smrgif test "x$use_ps2pdf" = x"auto"; then
207548e69166Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
207648e69166Smrg   if test "x$PS2PDF" = "x"; then
207748e69166Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
207848e69166Smrg	have_ps2pdf=no
207948e69166Smrg   else
208048e69166Smrg        have_ps2pdf=yes
208148e69166Smrg   fi
208248e69166Smrgelif test "x$use_ps2pdf" = x"yes" ; then
208348e69166Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
208448e69166Smrg   if test "x$PS2PDF" = "x"; then
208548e69166Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
208648e69166Smrg   fi
208748e69166Smrg   have_ps2pdf=yes
208848e69166Smrgelif test "x$use_ps2pdf" = x"no" ; then
208948e69166Smrg   if test "x$PS2PDF" != "x"; then
209048e69166Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
209148e69166Smrg   fi
209248e69166Smrg   have_ps2pdf=no
209348e69166Smrgelse
209448e69166Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
209548e69166Smrgfi
209648e69166SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
209748e69166Smrg]) # XORG_WITH_PS2PDF
209848e69166Smrg
209948e69166Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
210048e69166Smrg# ----------------
210148e69166Smrg# Minimum version: 1.6.0
210248e69166Smrg#
210348e69166Smrg# Documentation tools are not always available on all platforms and sometimes
210448e69166Smrg# not at the appropriate level. This macro enables a builder to skip all
210548e69166Smrg# documentation targets except traditional man pages.
210648e69166Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
210748e69166Smrg# maximum flexibilty in controlling documentation building.
210848e69166Smrg# Refer to:
210948e69166Smrg# XORG_WITH_XMLTO         --with-xmlto
211048e69166Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
211148e69166Smrg# XORG_WITH_DOXYGEN       --with-doxygen
211248e69166Smrg# XORG_WITH_FOP           --with-fop
211348e69166Smrg# XORG_WITH_GROFF         --with-groff
211448e69166Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
211548e69166Smrg#
211648e69166Smrg# Interface to module:
211748e69166Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
211848e69166Smrg# --enable-docs: 'yes' user instructs the module to generate docs
211948e69166Smrg#		 'no' user instructs the module not to generate docs
212048e69166Smrg# parm1:	specify the default value, yes or no.
212148e69166Smrg#
212248e69166SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2123a8bb11d0Smrgm4_define([docs_default], m4_default([$1], [yes]))
212448e69166SmrgAC_ARG_ENABLE(docs,
212548e69166Smrg	AS_HELP_STRING([--enable-docs],
2126a8bb11d0Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2127a8bb11d0Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2128a8bb11d0Smrgm4_undefine([docs_default])
212948e69166SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
213048e69166SmrgAC_MSG_CHECKING([whether to build documentation])
213148e69166SmrgAC_MSG_RESULT([$build_docs])
213248e69166Smrg]) # XORG_ENABLE_DOCS
213348e69166Smrg
213448e69166Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
213548e69166Smrg# ----------------
213648e69166Smrg# Minimum version: 1.6.0
213748e69166Smrg#
213848e69166Smrg# This macro enables a builder to skip all developer documentation.
213948e69166Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
214048e69166Smrg# maximum flexibilty in controlling documentation building.
214148e69166Smrg# Refer to:
214248e69166Smrg# XORG_WITH_XMLTO         --with-xmlto
214348e69166Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
214448e69166Smrg# XORG_WITH_DOXYGEN       --with-doxygen
214548e69166Smrg# XORG_WITH_FOP           --with-fop
214648e69166Smrg# XORG_WITH_GROFF         --with-groff
214748e69166Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
214848e69166Smrg#
214948e69166Smrg# Interface to module:
215048e69166Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
215148e69166Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
215248e69166Smrg#			'no' user instructs the module not to generate developer docs
215348e69166Smrg# parm1:		specify the default value, yes or no.
215448e69166Smrg#
215548e69166SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2156a8bb11d0Smrgm4_define([devel_default], m4_default([$1], [yes]))
215748e69166SmrgAC_ARG_ENABLE(devel-docs,
215848e69166Smrg	AS_HELP_STRING([--enable-devel-docs],
2159a8bb11d0Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2160a8bb11d0Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2161a8bb11d0Smrgm4_undefine([devel_default])
216248e69166SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
216348e69166SmrgAC_MSG_CHECKING([whether to build developer documentation])
216448e69166SmrgAC_MSG_RESULT([$build_devel_docs])
216548e69166Smrg]) # XORG_ENABLE_DEVEL_DOCS
216648e69166Smrg
216748e69166Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
216848e69166Smrg# ----------------
216948e69166Smrg# Minimum version: 1.6.0
217048e69166Smrg#
217148e69166Smrg# This macro enables a builder to skip all functional specification targets.
217248e69166Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
217348e69166Smrg# maximum flexibilty in controlling documentation building.
217448e69166Smrg# Refer to:
217548e69166Smrg# XORG_WITH_XMLTO         --with-xmlto
217648e69166Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
217748e69166Smrg# XORG_WITH_DOXYGEN       --with-doxygen
217848e69166Smrg# XORG_WITH_FOP           --with-fop
217948e69166Smrg# XORG_WITH_GROFF         --with-groff
218048e69166Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
218148e69166Smrg#
218248e69166Smrg# Interface to module:
218348e69166Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
218448e69166Smrg# --enable-specs:	'yes' user instructs the module to generate specs
218548e69166Smrg#			'no' user instructs the module not to generate specs
218648e69166Smrg# parm1:		specify the default value, yes or no.
218748e69166Smrg#
218848e69166SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2189a8bb11d0Smrgm4_define([spec_default], m4_default([$1], [yes]))
219048e69166SmrgAC_ARG_ENABLE(specs,
219148e69166Smrg	AS_HELP_STRING([--enable-specs],
2192a8bb11d0Smrg	   [Enable building the specs (default: ]spec_default[)]),
2193a8bb11d0Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2194a8bb11d0Smrgm4_undefine([spec_default])
219548e69166SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
219648e69166SmrgAC_MSG_CHECKING([whether to build functional specifications])
219748e69166SmrgAC_MSG_RESULT([$build_specs])
219848e69166Smrg]) # XORG_ENABLE_SPECS
219948e69166Smrg
2200a8bb11d0Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2201a8bb11d0Smrg# ----------------------------------------------
2202a8bb11d0Smrg# Minimum version: 1.13.0
2203a8bb11d0Smrg#
2204a8bb11d0Smrg# This macro enables a builder to enable/disable unit testing
2205a8bb11d0Smrg# It makes no assumption about the test cases implementation
2206a8bb11d0Smrg# Test cases may or may not use Automake "Support for test suites"
2207a8bb11d0Smrg# They may or may not use the software utility library GLib
2208a8bb11d0Smrg#
2209a8bb11d0Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2210a8bb11d0Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2211a8bb11d0Smrg# The variable enable_unit_tests is used by other macros in this file.
2212a8bb11d0Smrg#
2213a8bb11d0Smrg# Interface to module:
2214a8bb11d0Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2215a8bb11d0Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2216a8bb11d0Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2217a8bb11d0Smrg#			'no' user instructs the module not to build tests
2218a8bb11d0Smrg# parm1:		specify the default value, yes or no.
2219a8bb11d0Smrg#
2220a8bb11d0SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2221a8bb11d0SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2222a8bb11d0SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2223a8bb11d0SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2224a8bb11d0Smrgm4_define([_defopt], m4_default([$1], [auto]))
2225a8bb11d0SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2226a8bb11d0Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2227a8bb11d0Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2228a8bb11d0Smrgm4_undefine([_defopt])
2229a8bb11d0SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2230a8bb11d0SmrgAC_MSG_CHECKING([whether to build unit test cases])
2231a8bb11d0SmrgAC_MSG_RESULT([$enable_unit_tests])
2232a8bb11d0Smrg]) # XORG_ENABLE_UNIT_TESTS
2233a8bb11d0Smrg
2234a8bb11d0Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2235a8bb11d0Smrg# ------------------------------------------------------
2236a8bb11d0Smrg# Minimum version: 1.17.0
2237a8bb11d0Smrg#
2238a8bb11d0Smrg# This macro enables a builder to enable/disable integration testing
2239a8bb11d0Smrg# It makes no assumption about the test cases' implementation
2240a8bb11d0Smrg# Test cases may or may not use Automake "Support for test suites"
2241a8bb11d0Smrg#
2242a8bb11d0Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2243a8bb11d0Smrg# usually requires less dependencies and may be built and run under less
2244a8bb11d0Smrg# stringent environments than integration tests.
2245a8bb11d0Smrg#
2246a8bb11d0Smrg# Interface to module:
2247a8bb11d0Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2248a8bb11d0Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2249a8bb11d0Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2250a8bb11d0Smrg#                             'no' user instructs the module not to build tests
2251a8bb11d0Smrg# parm1:                      specify the default value, yes or no.
2252a8bb11d0Smrg#
2253a8bb11d0SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2254a8bb11d0SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2255a8bb11d0Smrgm4_define([_defopt], m4_default([$1], [auto]))
2256a8bb11d0SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2257a8bb11d0Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2258a8bb11d0Smrg	[enable_integration_tests=$enableval],
2259a8bb11d0Smrg	[enable_integration_tests=]_defopt)
2260a8bb11d0Smrgm4_undefine([_defopt])
2261a8bb11d0SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2262a8bb11d0Smrg	[test "x$enable_integration_tests" != xno])
2263a8bb11d0SmrgAC_MSG_CHECKING([whether to build unit test cases])
2264a8bb11d0SmrgAC_MSG_RESULT([$enable_integration_tests])
2265a8bb11d0Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2266a8bb11d0Smrg
2267a8bb11d0Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2268a8bb11d0Smrg# ----------------------------------------
2269a8bb11d0Smrg# Minimum version: 1.13.0
2270a8bb11d0Smrg#
2271a8bb11d0Smrg# GLib is a library which provides advanced data structures and functions.
2272a8bb11d0Smrg# This macro enables a module to test for the presence of Glib.
2273a8bb11d0Smrg#
2274a8bb11d0Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2275a8bb11d0Smrg# Otherwise the value of $enable_unit_tests is blank.
2276a8bb11d0Smrg#
2277a8bb11d0Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2278a8bb11d0Smrg# test support usually requires less dependencies and may be built and run under
2279a8bb11d0Smrg# less stringent environments than integration tests.
2280a8bb11d0Smrg#
2281a8bb11d0Smrg# Interface to module:
2282a8bb11d0Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2283a8bb11d0Smrg# with_glib: used in configure.ac to know if GLib has been found
2284a8bb11d0Smrg# --with-glib:	'yes' user instructs the module to use glib
2285a8bb11d0Smrg#		'no' user instructs the module not to use glib
2286a8bb11d0Smrg#
2287a8bb11d0SmrgAC_DEFUN([XORG_WITH_GLIB],[
2288a8bb11d0SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2289a8bb11d0Smrgm4_define([_defopt], m4_default([$2], [auto]))
2290a8bb11d0SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2291a8bb11d0Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2292a8bb11d0Smrg	[with_glib=$withval], [with_glib=]_defopt)
2293a8bb11d0Smrgm4_undefine([_defopt])
2294a8bb11d0Smrg
2295a8bb11d0Smrghave_glib=no
2296a8bb11d0Smrg# Do not probe GLib if user explicitly disabled unit testing
2297a8bb11d0Smrgif test "x$enable_unit_tests" != x"no"; then
2298a8bb11d0Smrg  # Do not probe GLib if user explicitly disabled it
2299a8bb11d0Smrg  if test "x$with_glib" != x"no"; then
2300a8bb11d0Smrg    m4_ifval(
2301a8bb11d0Smrg      [$1],
2302a8bb11d0Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2303a8bb11d0Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2304a8bb11d0Smrg    )
2305a8bb11d0Smrg  fi
2306a8bb11d0Smrgfi
2307a8bb11d0Smrg
2308a8bb11d0Smrg# Not having GLib when unit testing has been explicitly requested is an error
2309a8bb11d0Smrgif test "x$enable_unit_tests" = x"yes"; then
2310a8bb11d0Smrg  if test "x$have_glib" = x"no"; then
2311a8bb11d0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2312a8bb11d0Smrg  fi
2313a8bb11d0Smrgfi
2314a8bb11d0Smrg
2315a8bb11d0Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2316a8bb11d0Smrgif test "x$enable_unit_tests" = x"no"; then
2317a8bb11d0Smrg  if test "x$with_glib" = x"yes"; then
2318a8bb11d0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2319a8bb11d0Smrg  fi
2320a8bb11d0Smrgfi
2321a8bb11d0Smrg
2322a8bb11d0Smrg# Not having GLib when it has been explicitly requested is an error
2323a8bb11d0Smrgif test "x$with_glib" = x"yes"; then
2324a8bb11d0Smrg  if test "x$have_glib" = x"no"; then
2325a8bb11d0Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2326a8bb11d0Smrg  fi
2327a8bb11d0Smrgfi
2328a8bb11d0Smrg
2329a8bb11d0SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2330a8bb11d0Smrg]) # XORG_WITH_GLIB
2331a8bb11d0Smrg
2332a8bb11d0Smrg# XORG_LD_WRAP([required|optional])
2333a8bb11d0Smrg# ---------------------------------
2334a8bb11d0Smrg# Minimum version: 1.13.0
2335a8bb11d0Smrg#
2336a8bb11d0Smrg# Check if linker supports -wrap, passed via compiler flags
2337a8bb11d0Smrg#
2338a8bb11d0Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2339a8bb11d0Smrg# Otherwise the value of $enable_unit_tests is blank.
2340a8bb11d0Smrg#
2341a8bb11d0Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2342a8bb11d0Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2343a8bb11d0Smrg# available, an argument of "optional" allows use when some unit tests require
2344a8bb11d0Smrg# ld -wrap and others do not.
2345a8bb11d0Smrg#
2346a8bb11d0SmrgAC_DEFUN([XORG_LD_WRAP],[
2347a8bb11d0SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2348a8bb11d0Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2349a8bb11d0Smrg                      void __wrap_exit(int status) { return; }],
2350a8bb11d0Smrg                     [exit(0);])])
2351a8bb11d0Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2352a8bb11d0Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2353a8bb11d0Smrg  if test "x$have_ld_wrap" = x"no"; then
2354a8bb11d0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2355a8bb11d0Smrg  fi
2356a8bb11d0Smrgfi
2357a8bb11d0SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2358a8bb11d0Smrg#
2359a8bb11d0Smrg]) # XORG_LD_WRAP
2360a8bb11d0Smrg
2361a8bb11d0Smrg# XORG_CHECK_LINKER_FLAGS
2362a8bb11d0Smrg# -----------------------
2363a8bb11d0Smrg# SYNOPSIS
2364a8bb11d0Smrg#
2365a8bb11d0Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2366a8bb11d0Smrg#
2367a8bb11d0Smrg# DESCRIPTION
2368a8bb11d0Smrg#
2369a8bb11d0Smrg#   Check whether the given linker FLAGS work with the current language's
2370a8bb11d0Smrg#   linker, or whether they give an error.
2371a8bb11d0Smrg#
2372a8bb11d0Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2373a8bb11d0Smrg#   success/failure.
2374a8bb11d0Smrg#
2375a8bb11d0Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2376a8bb11d0Smrg#
2377a8bb11d0Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2378a8bb11d0Smrg#
2379a8bb11d0Smrg# LICENSE
2380a8bb11d0Smrg#
2381a8bb11d0Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2382a8bb11d0Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2383a8bb11d0Smrg#   Copyright (c) 2009 Matteo Frigo
2384a8bb11d0Smrg#
2385a8bb11d0Smrg#   This program is free software: you can redistribute it and/or modify it
2386a8bb11d0Smrg#   under the terms of the GNU General Public License as published by the
2387a8bb11d0Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2388a8bb11d0Smrg#   option) any later version.
2389a8bb11d0Smrg#
2390a8bb11d0Smrg#   This program is distributed in the hope that it will be useful, but
2391a8bb11d0Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2392a8bb11d0Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2393a8bb11d0Smrg#   Public License for more details.
2394a8bb11d0Smrg#
2395a8bb11d0Smrg#   You should have received a copy of the GNU General Public License along
2396a8bb11d0Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2397a8bb11d0Smrg#
2398a8bb11d0Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2399a8bb11d0Smrg#   gives unlimited permission to copy, distribute and modify the configure
2400a8bb11d0Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2401a8bb11d0Smrg#   need not follow the terms of the GNU General Public License when using
2402a8bb11d0Smrg#   or distributing such scripts, even though portions of the text of the
2403a8bb11d0Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2404a8bb11d0Smrg#   all other use of the material that constitutes the Autoconf Macro.
2405a8bb11d0Smrg#
2406a8bb11d0Smrg#   This special exception to the GPL applies to versions of the Autoconf
2407a8bb11d0Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2408a8bb11d0Smrg#   modified version of the Autoconf Macro, you may extend this special
2409a8bb11d0Smrg#   exception to the GPL to apply to your modified version as well.#
2410a8bb11d0SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2411a8bb11d0Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2412a8bb11d0Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2413a8bb11d0SmrgAS_LITERAL_IF([$1],
2414a8bb11d0Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2415a8bb11d0Smrg      ax_save_FLAGS=$LDFLAGS
2416a8bb11d0Smrg      LDFLAGS="$1"
2417a8bb11d0Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2418a8bb11d0Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2419a8bb11d0Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2420a8bb11d0Smrg      LDFLAGS=$ax_save_FLAGS])],
2421a8bb11d0Smrg  [ax_save_FLAGS=$LDFLAGS
2422a8bb11d0Smrg   LDFLAGS="$1"
2423a8bb11d0Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2424a8bb11d0Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2425a8bb11d0Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2426a8bb11d0Smrg   LDFLAGS=$ax_save_FLAGS])
2427a8bb11d0Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2428a8bb11d0SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2429a8bb11d0Smrgif test "x$xorg_check_linker_flags" = xyes; then
2430a8bb11d0Smrg	m4_default([$2], :)
2431a8bb11d0Smrgelse
2432a8bb11d0Smrg	m4_default([$3], :)
2433a8bb11d0Smrgfi
2434a8bb11d0Smrg]) # XORG_CHECK_LINKER_FLAGS
2435a8bb11d0Smrg
2436a8bb11d0Smrg# XORG_MEMORY_CHECK_FLAGS
2437a8bb11d0Smrg# -----------------------
2438a8bb11d0Smrg# Minimum version: 1.16.0
2439a8bb11d0Smrg#
2440a8bb11d0Smrg# This macro attempts to find appropriate memory checking functionality
2441a8bb11d0Smrg# for various platforms which unit testing code may use to catch various
2442a8bb11d0Smrg# forms of memory allocation and access errors in testing.
2443a8bb11d0Smrg#
2444a8bb11d0Smrg# Interface to module:
2445a8bb11d0Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2446a8bb11d0Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2447a8bb11d0Smrg#
2448a8bb11d0Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2449a8bb11d0Smrg#
2450a8bb11d0SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2451a8bb11d0Smrg
2452a8bb11d0SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2453a8bb11d0SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2454a8bb11d0Smrg           [Environment variables to enable memory checking in tests])
2455a8bb11d0Smrg
2456a8bb11d0Smrg# Check for different types of support on different platforms
2457a8bb11d0Smrgcase $host_os in
2458a8bb11d0Smrg    solaris*)
2459a8bb11d0Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2460a8bb11d0Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2461a8bb11d0Smrg        ;;
2462a8bb11d0Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2463a8bb11d0Smrg        # both directly and inverted, so should not be 0 or 255.
2464a8bb11d0Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2465a8bb11d0Smrg        ;;
2466a8bb11d0Smrg    darwin*)
2467a8bb11d0Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2468a8bb11d0Smrg        ;;
2469a8bb11d0Smrg    *bsd*)
2470a8bb11d0Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2471a8bb11d0Smrg        ;;
2472a8bb11d0Smrgesac
2473a8bb11d0Smrg
2474a8bb11d0Smrg# User supplied flags override default flags
2475a8bb11d0Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2476a8bb11d0Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2477a8bb11d0Smrgfi
2478a8bb11d0Smrg
2479a8bb11d0SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2480a8bb11d0Smrg]) # XORG_WITH_LINT
2481a8bb11d0Smrg
2482fd0c672fSmrg# XORG_CHECK_MALLOC_ZERO
2483fd0c672fSmrg# ----------------------
2484fd0c672fSmrg# Minimum version: 1.0.0
2485fd0c672fSmrg#
2486fd0c672fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2487fd0c672fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2488fd0c672fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2489fd0c672fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2490fd0c672fSmrgAC_ARG_ENABLE(malloc0returnsnull,
249148e69166Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2492fd0c672fSmrg		       [malloc(0) returns NULL (default: auto)]),
2493fd0c672fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2494fd0c672fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2495fd0c672fSmrg
2496fd0c672fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2497fd0c672fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2498a8bb11d0Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2499a8bb11d0Smrg#include <stdlib.h>
2500a8bb11d0Smrg],[
2501fd0c672fSmrg    char *m0, *r0, *c0, *p;
2502fd0c672fSmrg    m0 = malloc(0);
2503fd0c672fSmrg    p = malloc(10);
2504fd0c672fSmrg    r0 = realloc(p,0);
2505a8bb11d0Smrg    c0 = calloc(0,10);
2506a8bb11d0Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2507a8bb11d0Smrg])],
2508fd0c672fSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
250948e69166Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
251048e69166Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2511fd0c672fSmrgfi
2512fd0c672fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2513fd0c672fSmrg
2514fd0c672fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2515fd0c672fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2516fd0c672fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2517fd0c672fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2518fd0c672fSmrgelse
2519fd0c672fSmrg	MALLOC_ZERO_CFLAGS=""
2520fd0c672fSmrg	XMALLOC_ZERO_CFLAGS=""
2521fd0c672fSmrg	XTMALLOC_ZERO_CFLAGS=""
2522fd0c672fSmrgfi
2523fd0c672fSmrg
2524fd0c672fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2525fd0c672fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2526fd0c672fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2527fd0c672fSmrg]) # XORG_CHECK_MALLOC_ZERO
2528fd0c672fSmrg
2529fd0c672fSmrg# XORG_WITH_LINT()
2530fd0c672fSmrg# ----------------
2531fd0c672fSmrg# Minimum version: 1.1.0
2532fd0c672fSmrg#
253348e69166Smrg# This macro enables the use of a tool that flags some suspicious and
253448e69166Smrg# non-portable constructs (likely to be bugs) in C language source code.
253548e69166Smrg# It will attempt to locate the tool and use appropriate options.
253648e69166Smrg# There are various lint type tools on different platforms.
253748e69166Smrg#
253848e69166Smrg# Interface to module:
253948e69166Smrg# LINT:		returns the path to the tool found on the platform
254048e69166Smrg#		or the value set to LINT on the configure cmd line
254148e69166Smrg#		also an Automake conditional
254248e69166Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
254348e69166Smrg#
254448e69166Smrg# --with-lint:	'yes' user instructs the module to use lint
254548e69166Smrg#		'no' user instructs the module not to use lint (default)
254648e69166Smrg#
254748e69166Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
254848e69166Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2549fd0c672fSmrg#
2550fd0c672fSmrgAC_DEFUN([XORG_WITH_LINT],[
2551fd0c672fSmrg
255248e69166SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
255348e69166SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
255448e69166SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2555fd0c672fSmrg		[Use a lint-style source code checker (default: disabled)])],
2556fd0c672fSmrg		[use_lint=$withval], [use_lint=no])
255748e69166Smrg
255848e69166Smrg# Obtain platform specific info like program name and options
255948e69166Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
256048e69166Smrgcase $host_os in
256148e69166Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
256248e69166Smrg	lint_name=splint
256348e69166Smrg	lint_options="-badflag"
256448e69166Smrg	;;
256548e69166Smrg  *freebsd* | *netbsd*)
256648e69166Smrg	lint_name=lint
256748e69166Smrg	lint_options="-u -b"
256848e69166Smrg	;;
256948e69166Smrg  *solaris*)
257048e69166Smrg	lint_name=lint
257148e69166Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
257248e69166Smrg	;;
257348e69166Smrgesac
257448e69166Smrg
257548e69166Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
257648e69166Smrgif test "x$use_lint" = x"yes" ; then
257748e69166Smrg   AC_PATH_PROG([LINT], [$lint_name])
257848e69166Smrg   if test "x$LINT" = "x"; then
257948e69166Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
258048e69166Smrg   fi
258148e69166Smrgelif test "x$use_lint" = x"no" ; then
258248e69166Smrg   if test "x$LINT" != "x"; then
258348e69166Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
258448e69166Smrg   fi
2585fd0c672fSmrgelse
258648e69166Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2587fd0c672fSmrgfi
258848e69166Smrg
258948e69166Smrg# User supplied flags override default flags
259048e69166Smrgif test "x$LINT_FLAGS" != "x"; then
259148e69166Smrg   lint_options=$LINT_FLAGS
2592fd0c672fSmrgfi
2593fd0c672fSmrg
259448e69166SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
259548e69166SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2596fd0c672fSmrg
2597fd0c672fSmrg]) # XORG_WITH_LINT
2598fd0c672fSmrg
2599fd0c672fSmrg# XORG_LINT_LIBRARY(LIBNAME)
2600fd0c672fSmrg# --------------------------
2601fd0c672fSmrg# Minimum version: 1.1.0
2602fd0c672fSmrg#
2603fd0c672fSmrg# Sets up flags for building lint libraries for checking programs that call
2604fd0c672fSmrg# functions in the library.
2605fd0c672fSmrg#
260648e69166Smrg# Interface to module:
260748e69166Smrg# LINTLIB		- Automake variable with the name of lint library file to make
260848e69166Smrg# MAKE_LINT_LIB		- Automake conditional
260948e69166Smrg#
261048e69166Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
261148e69166Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2612fd0c672fSmrg
2613fd0c672fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2614fd0c672fSmrgAC_REQUIRE([XORG_WITH_LINT])
261548e69166SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2616fd0c672fSmrg	[Create lint library (default: disabled)])],
2617fd0c672fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
261848e69166Smrg
261948e69166Smrgif test "x$make_lint_lib" = x"yes" ; then
262048e69166Smrg   LINTLIB=llib-l$1.ln
262148e69166Smrg   if test "x$LINT" = "x"; then
262248e69166Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
262348e69166Smrg   fi
262448e69166Smrgelif test "x$make_lint_lib" != x"no" ; then
262548e69166Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2626fd0c672fSmrgfi
262748e69166Smrg
2628fd0c672fSmrgAC_SUBST(LINTLIB)
2629fd0c672fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2630fd0c672fSmrg
2631fd0c672fSmrg]) # XORG_LINT_LIBRARY
2632fd0c672fSmrg
2633a8bb11d0Smrg# XORG_COMPILER_BRAND
2634a8bb11d0Smrg# -------------------
2635a8bb11d0Smrg# Minimum version: 1.14.0
2636a8bb11d0Smrg#
2637a8bb11d0Smrg# Checks for various brands of compilers and sets flags as appropriate:
2638a8bb11d0Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2639a8bb11d0Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2640a8bb11d0Smrg#   clang compiler - sets CLANGCC to "yes"
2641a8bb11d0Smrg#   Intel compiler - sets INTELCC to "yes"
2642a8bb11d0Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2643a8bb11d0Smrg#
2644a8bb11d0SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2645a8bb11d0SmrgAC_LANG_CASE(
2646a8bb11d0Smrg	[C], [
2647a8bb11d0Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2648a8bb11d0Smrg	],
2649a8bb11d0Smrg	[C++], [
2650a8bb11d0Smrg		AC_REQUIRE([AC_PROG_CXX])
2651a8bb11d0Smrg	]
2652a8bb11d0Smrg)
2653a8bb11d0SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2654a8bb11d0SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2655a8bb11d0SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2656a8bb11d0Smrg]) # XORG_COMPILER_BRAND
2657a8bb11d0Smrg
2658a8bb11d0Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2659a8bb11d0Smrg# ---------------
2660a8bb11d0Smrg# Minimum version: 1.16.0
2661a8bb11d0Smrg#
2662a8bb11d0Smrg# Test if the compiler works when passed the given flag as a command line argument.
2663a8bb11d0Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2664a8bb11d0Smrg# next flag in the list until there are no more options.
2665a8bb11d0Smrg#
2666a8bb11d0Smrg# Note that this does not guarantee that the compiler supports the flag as some
2667a8bb11d0Smrg# compilers will simply ignore arguments that they do not understand, but we do
2668a8bb11d0Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2669a8bb11d0Smrg# -Werror=unused-command-line-argument
2670a8bb11d0Smrg#
2671a8bb11d0SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2672a8bb11d0Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2673a8bb11d0Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2674a8bb11d0Smrg
2675a8bb11d0SmrgAC_LANG_COMPILER_REQUIRE
2676a8bb11d0Smrg
2677a8bb11d0SmrgAC_LANG_CASE(
2678a8bb11d0Smrg	[C], [
2679a8bb11d0Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2680a8bb11d0Smrg		define([PREFIX], [C])
2681a8bb11d0Smrg		define([CACHE_PREFIX], [cc])
2682a8bb11d0Smrg		define([COMPILER], [$CC])
2683a8bb11d0Smrg	],
2684a8bb11d0Smrg	[C++], [
2685a8bb11d0Smrg		define([PREFIX], [CXX])
2686a8bb11d0Smrg		define([CACHE_PREFIX], [cxx])
2687a8bb11d0Smrg		define([COMPILER], [$CXX])
2688a8bb11d0Smrg	]
2689a8bb11d0Smrg)
2690a8bb11d0Smrg
2691a8bb11d0Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2692a8bb11d0Smrg
2693a8bb11d0Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2694a8bb11d0Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2695a8bb11d0Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2696a8bb11d0Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2697a8bb11d0Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2698a8bb11d0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2699a8bb11d0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2700a8bb11d0Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2701a8bb11d0Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2702a8bb11d0Smrgfi
2703a8bb11d0Smrg
2704a8bb11d0Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2705a8bb11d0Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2706a8bb11d0Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2707a8bb11d0Smrg	fi
2708a8bb11d0Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2709a8bb11d0Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2710a8bb11d0Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2711a8bb11d0Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2712a8bb11d0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2713a8bb11d0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2714a8bb11d0Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2715a8bb11d0Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2716a8bb11d0Smrgfi
2717a8bb11d0Smrg
2718a8bb11d0Smrgfound="no"
2719a8bb11d0Smrgm4_foreach([flag], m4_cdr($@), [
2720a8bb11d0Smrg	if test $found = "no" ; then
2721a8bb11d0Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2722a8bb11d0Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2723a8bb11d0Smrg		fi
2724a8bb11d0Smrg
2725a8bb11d0Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2726a8bb11d0Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2727a8bb11d0Smrg		fi
2728a8bb11d0Smrg
2729a8bb11d0Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2730a8bb11d0Smrg
2731a8bb11d0Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2732a8bb11d0Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
2733a8bb11d0Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2734a8bb11d0Smrg		AC_CACHE_VAL($cacheid,
2735a8bb11d0Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2736a8bb11d0Smrg					     [eval $cacheid=yes],
2737a8bb11d0Smrg					     [eval $cacheid=no])])
2738a8bb11d0Smrg
2739a8bb11d0Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2740a8bb11d0Smrg
2741a8bb11d0Smrg		eval supported=\$$cacheid
2742a8bb11d0Smrg		AC_MSG_RESULT([$supported])
2743a8bb11d0Smrg		if test "$supported" = "yes" ; then
2744a8bb11d0Smrg			$1="$$1 ]flag["
2745a8bb11d0Smrg			found="yes"
2746a8bb11d0Smrg		fi
2747a8bb11d0Smrg	fi
2748a8bb11d0Smrg])
2749a8bb11d0Smrg]) # XORG_TESTSET_CFLAG
2750a8bb11d0Smrg
2751a8bb11d0Smrg# XORG_COMPILER_FLAGS
2752a8bb11d0Smrg# ---------------
2753a8bb11d0Smrg# Minimum version: 1.16.0
2754a8bb11d0Smrg#
2755a8bb11d0Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2756a8bb11d0Smrg# arguments supported by the selected compiler which do NOT alter the generated
2757a8bb11d0Smrg# code.  These arguments will cause the compiler to print various warnings
2758a8bb11d0Smrg# during compilation AND turn a conservative set of warnings into errors.
2759a8bb11d0Smrg#
2760a8bb11d0Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2761a8bb11d0Smrg# future versions of util-macros as options are added to new compilers.
2762a8bb11d0Smrg#
2763a8bb11d0SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2764a8bb11d0SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2765a8bb11d0Smrg
2766a8bb11d0SmrgAC_ARG_ENABLE(selective-werror,
2767a8bb11d0Smrg              AS_HELP_STRING([--disable-selective-werror],
2768a8bb11d0Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2769a8bb11d0Smrg              [SELECTIVE_WERROR=$enableval],
2770a8bb11d0Smrg              [SELECTIVE_WERROR=yes])
2771a8bb11d0Smrg
2772a8bb11d0SmrgAC_LANG_CASE(
2773a8bb11d0Smrg        [C], [
2774a8bb11d0Smrg                define([PREFIX], [C])
2775a8bb11d0Smrg        ],
2776a8bb11d0Smrg        [C++], [
2777a8bb11d0Smrg                define([PREFIX], [CXX])
2778a8bb11d0Smrg        ]
2779a8bb11d0Smrg)
2780a8bb11d0Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2781a8bb11d0Smrgif test "x$SUNCC" = "xyes"; then
2782a8bb11d0Smrg    [BASE_]PREFIX[FLAGS]="-v"
2783a8bb11d0Smrgelse
2784a8bb11d0Smrg    [BASE_]PREFIX[FLAGS]=""
2785a8bb11d0Smrgfi
2786a8bb11d0Smrg
2787a8bb11d0Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2788a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2789a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2790a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2791a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2792a8bb11d0Smrg
2793a8bb11d0SmrgAC_LANG_CASE(
2794a8bb11d0Smrg	[C], [
2795a8bb11d0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2796a8bb11d0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2797a8bb11d0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2798a8bb11d0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2799a8bb11d0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2800a8bb11d0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2801a8bb11d0Smrg	]
2802a8bb11d0Smrg)
2803a8bb11d0Smrg
2804a8bb11d0Smrg# This chunk adds additional warnings that could catch undesired effects.
2805a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2806a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2807a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2808a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2809a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2810a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2811a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2812a8bb11d0Smrg
2813a8bb11d0Smrg# These are currently disabled because they are noisy.  They will be enabled
2814a8bb11d0Smrg# in the future once the codebase is sufficiently modernized to silence
2815a8bb11d0Smrg# them.  For now, I don't want them to drown out the other warnings.
2816a8bb11d0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2817a8bb11d0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2818a8bb11d0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2819a8bb11d0Smrg
2820a8bb11d0Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2821a8bb11d0Smrg# when there are problems that should be fixed.
2822a8bb11d0Smrg
2823a8bb11d0Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2824a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2825a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2826a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2827a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2828a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2829a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2830a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2831a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2832a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2833a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2834a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2835a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2836a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2837a8bb11d0Smrgelse
2838a8bb11d0SmrgAC_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])
2839a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2840a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2841a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2842a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2843a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2844a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2845a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2846a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2847a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2848a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2849a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2850a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2851a8bb11d0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2852a8bb11d0Smrgfi
2853a8bb11d0Smrg
2854a8bb11d0SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2855a8bb11d0Smrg]) # XORG_COMPILER_FLAGS
2856a8bb11d0Smrg
285748e69166Smrg# XORG_CWARNFLAGS
285848e69166Smrg# ---------------
285948e69166Smrg# Minimum version: 1.2.0
2860a8bb11d0Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
286148e69166Smrg#
286248e69166Smrg# Defines CWARNFLAGS to enable C compiler warnings.
286348e69166Smrg#
2864a8bb11d0Smrg# This function is deprecated because it defines -fno-strict-aliasing
2865a8bb11d0Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2866a8bb11d0Smrg# is needed, then it should be added explicitly in the module when
2867a8bb11d0Smrg# it is updated to use BASE_CFLAGS.
2868a8bb11d0Smrg#
286948e69166SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2870a8bb11d0SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2871a8bb11d0SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2872a8bb11d0SmrgAC_LANG_CASE(
2873a8bb11d0Smrg	[C], [
2874a8bb11d0Smrg		CWARNFLAGS="$BASE_CFLAGS"
2875a8bb11d0Smrg		if  test "x$GCC" = xyes ; then
2876a8bb11d0Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2877a8bb11d0Smrg		fi
2878a8bb11d0Smrg		AC_SUBST(CWARNFLAGS)
2879a8bb11d0Smrg	]
2880a8bb11d0Smrg)
288148e69166Smrg]) # XORG_CWARNFLAGS
288248e69166Smrg
288348e69166Smrg# XORG_STRICT_OPTION
288448e69166Smrg# -----------------------
288548e69166Smrg# Minimum version: 1.3.0
288648e69166Smrg#
2887a8bb11d0Smrg# Add configure option to enable strict compilation flags, such as treating
2888a8bb11d0Smrg# warnings as fatal errors.
2889a8bb11d0Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2890a8bb11d0Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2891a8bb11d0Smrg#
2892a8bb11d0Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2893a8bb11d0Smrg# when strict compilation is unconditionally desired.
289448e69166SmrgAC_DEFUN([XORG_STRICT_OPTION], [
289548e69166SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2896a8bb11d0SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
289748e69166Smrg
289848e69166SmrgAC_ARG_ENABLE(strict-compilation,
289948e69166Smrg			  AS_HELP_STRING([--enable-strict-compilation],
290048e69166Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
290148e69166Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2902a8bb11d0Smrg
2903a8bb11d0SmrgAC_LANG_CASE(
2904a8bb11d0Smrg        [C], [
2905a8bb11d0Smrg                define([PREFIX], [C])
2906a8bb11d0Smrg        ],
2907a8bb11d0Smrg        [C++], [
2908a8bb11d0Smrg                define([PREFIX], [CXX])
2909a8bb11d0Smrg        ]
2910a8bb11d0Smrg)
2911a8bb11d0Smrg
2912a8bb11d0Smrg[STRICT_]PREFIX[FLAGS]=""
2913a8bb11d0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2914a8bb11d0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2915a8bb11d0Smrg
2916a8bb11d0Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2917a8bb11d0Smrg# activate it with -Werror, so we add it here explicitly.
2918a8bb11d0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2919a8bb11d0Smrg
292048e69166Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2921a8bb11d0Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2922a8bb11d0Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
292348e69166Smrgfi
2924a8bb11d0SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2925a8bb11d0SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2926a8bb11d0SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
292748e69166Smrg]) # XORG_STRICT_OPTION
292848e69166Smrg
292948e69166Smrg# XORG_DEFAULT_OPTIONS
293048e69166Smrg# --------------------
293148e69166Smrg# Minimum version: 1.3.0
293248e69166Smrg#
293348e69166Smrg# Defines default options for X.Org modules.
293448e69166Smrg#
293548e69166SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
293648e69166SmrgAC_REQUIRE([AC_PROG_INSTALL])
2937a8bb11d0SmrgXORG_COMPILER_FLAGS
293848e69166SmrgXORG_CWARNFLAGS
293948e69166SmrgXORG_STRICT_OPTION
294048e69166SmrgXORG_RELEASE_VERSION
294148e69166SmrgXORG_CHANGELOG
294248e69166SmrgXORG_INSTALL
294348e69166SmrgXORG_MANPAGE_SECTIONS
294448e69166Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
294548e69166Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
294648e69166Smrg]) # XORG_DEFAULT_OPTIONS
294748e69166Smrg
294848e69166Smrg# XORG_INSTALL()
294948e69166Smrg# ----------------
295048e69166Smrg# Minimum version: 1.4.0
295148e69166Smrg#
295248e69166Smrg# Defines the variable INSTALL_CMD as the command to copy
295348e69166Smrg# INSTALL from $prefix/share/util-macros.
295448e69166Smrg#
295548e69166SmrgAC_DEFUN([XORG_INSTALL], [
295648e69166SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
295748e69166Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
295848e69166SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
295948e69166Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
296048e69166Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
296148e69166Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
296248e69166SmrgAC_SUBST([INSTALL_CMD])
296348e69166Smrg]) # XORG_INSTALL
2964fd0c672fSmrgdnl Copyright 2005 Red Hat, Inc
2965fd0c672fSmrgdnl
2966fd0c672fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2967fd0c672fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2968fd0c672fSmrgdnl the above copyright notice appear in all copies and that both that
2969fd0c672fSmrgdnl copyright notice and this permission notice appear in supporting
2970fd0c672fSmrgdnl documentation.
2971fd0c672fSmrgdnl
2972fd0c672fSmrgdnl The above copyright notice and this permission notice shall be included
2973fd0c672fSmrgdnl in all copies or substantial portions of the Software.
2974fd0c672fSmrgdnl
2975fd0c672fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2976fd0c672fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2977fd0c672fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2978fd0c672fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2979fd0c672fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2980fd0c672fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2981fd0c672fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2982fd0c672fSmrgdnl
2983fd0c672fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2984fd0c672fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2985fd0c672fSmrgdnl other dealings in this Software without prior written authorization
2986fd0c672fSmrgdnl from the copyright holders.
2987fd0c672fSmrgdnl
2988fd0c672fSmrg
2989fd0c672fSmrg# XORG_RELEASE_VERSION
2990fd0c672fSmrg# --------------------
299148e69166Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2992fd0c672fSmrg 
2993fd0c672fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2994fd0c672fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2995fd0c672fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2996fd0c672fSmrg		[Major version of this package])
299748e69166Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2998fd0c672fSmrg	if test "x$PVM" = "x"; then
2999fd0c672fSmrg		PVM="0"
3000fd0c672fSmrg	fi
3001fd0c672fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3002fd0c672fSmrg		[$PVM],
3003fd0c672fSmrg		[Minor version of this package])
300448e69166Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3005fd0c672fSmrg	if test "x$PVP" = "x"; then
3006fd0c672fSmrg		PVP="0"
3007fd0c672fSmrg	fi
3008fd0c672fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3009fd0c672fSmrg		[$PVP],
3010fd0c672fSmrg		[Patch version of this package])
3011fd0c672fSmrg])
3012fd0c672fSmrg
301348e69166Smrg# XORG_CHANGELOG()
301448e69166Smrg# ----------------
301548e69166Smrg# Minimum version: 1.2.0
301648e69166Smrg#
301748e69166Smrg# Defines the variable CHANGELOG_CMD as the command to generate
301848e69166Smrg# ChangeLog from git.
301948e69166Smrg#
302048e69166Smrg#
302148e69166SmrgAC_DEFUN([XORG_CHANGELOG], [
302248e69166SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
302348e69166Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
302448e69166Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
302548e69166Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
302648e69166SmrgAC_SUBST([CHANGELOG_CMD])
302748e69166Smrg]) # XORG_CHANGELOG
302848e69166Smrg
3029