aclocal.m4 revision 1a054510
1576bae58Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
214c0a534Smrg
314c0a534Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4bf2eeab3Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
514c0a534Smrg# This file is free software; the Free Software Foundation
614c0a534Smrg# gives unlimited permission to copy and/or distribute it,
714c0a534Smrg# with or without modifications, as long as this notice is preserved.
814c0a534Smrg
914c0a534Smrg# This program is distributed in the hope that it will be useful,
1014c0a534Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1114c0a534Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1214c0a534Smrg# PARTICULAR PURPOSE.
1314c0a534Smrg
14bf2eeab3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
15bf2eeab3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16576bae58Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17576bae58Smrg[m4_warning([this file was generated for autoconf 2.68.
18bf2eeab3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19bf2eeab3SmrgIf you have problems, you may need to regenerate the build system entirely.
20bf2eeab3SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2114c0a534Smrg
22bf2eeab3Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
2314c0a534Smrg#
24bf2eeab3Smrg# This file is free software; the Free Software Foundation
25bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
26bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
2714c0a534Smrg
28bf2eeab3Smrg# AM_AUTOMAKE_VERSION(VERSION)
29bf2eeab3Smrg# ----------------------------
30bf2eeab3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31bf2eeab3Smrg# generated from the m4 files accompanying Automake X.Y.
32bf2eeab3Smrg# (This private macro should not be called outside this file.)
33bf2eeab3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34bf2eeab3Smrg[am__api_version='1.11'
35bf2eeab3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36bf2eeab3Smrgdnl require some minimum version.  Point them to the right macro.
37576bae58Smrgm4_if([$1], [1.11.1], [],
38bf2eeab3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39bf2eeab3Smrg])
4014c0a534Smrg
41bf2eeab3Smrg# _AM_AUTOCONF_VERSION(VERSION)
4214c0a534Smrg# -----------------------------
43bf2eeab3Smrg# aclocal traces this macro to find the Autoconf version.
44bf2eeab3Smrg# This is a private macro too.  Using m4_define simplifies
45bf2eeab3Smrg# the logic in aclocal, which can simply ignore this definition.
46bf2eeab3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
47bf2eeab3Smrg
48bf2eeab3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49bf2eeab3Smrg# -------------------------------
50bf2eeab3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51bf2eeab3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52bf2eeab3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53576bae58Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54bf2eeab3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
55bf2eeab3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56bf2eeab3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5714c0a534Smrg
58bf2eeab3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
5914c0a534Smrg
60bf2eeab3Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
61bf2eeab3Smrg#
62bf2eeab3Smrg# This file is free software; the Free Software Foundation
63bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
64bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
65bf2eeab3Smrg
66bf2eeab3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67bf2eeab3Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68bf2eeab3Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6914c0a534Smrg#
70bf2eeab3Smrg# Of course, Automake must honor this variable whenever it calls a
71bf2eeab3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72bf2eeab3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73bf2eeab3Smrg# depending on how configure is run.  This is pretty annoying, since
74bf2eeab3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75bf2eeab3Smrg# source directory, any form will work fine, but in subdirectories a
76bf2eeab3Smrg# relative path needs to be adjusted first.
7714c0a534Smrg#
78bf2eeab3Smrg# $ac_aux_dir/missing
79bf2eeab3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80bf2eeab3Smrg# $top_srcdir/$ac_aux_dir/missing
81bf2eeab3Smrg#    fails if $ac_aux_dir is absolute,
82bf2eeab3Smrg#    fails when called from a subdirectory in a VPATH build with
83bf2eeab3Smrg#          a relative $ac_aux_dir
8414c0a534Smrg#
85bf2eeab3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86bf2eeab3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
87bf2eeab3Smrg# harmless because $srcdir is `.', but things will broke when you
88bf2eeab3Smrg# start a VPATH build or use an absolute $srcdir.
8914c0a534Smrg#
90bf2eeab3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91bf2eeab3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92bf2eeab3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93bf2eeab3Smrg# and then we would define $MISSING as
94bf2eeab3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95bf2eeab3Smrg# This will work as long as MISSING is not called from configure, because
96bf2eeab3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
97bf2eeab3Smrg# However there are other variables, like CC, which are often used in
98bf2eeab3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99bf2eeab3Smrg#
100bf2eeab3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
101bf2eeab3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
102bf2eeab3Smrg# configured tree to be moved without reconfiguration.
10314c0a534Smrg
104bf2eeab3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105bf2eeab3Smrg[dnl Rely on autoconf to set up CDPATH properly.
106bf2eeab3SmrgAC_PREREQ([2.50])dnl
107bf2eeab3Smrg# expand $ac_aux_dir to an absolute path
108bf2eeab3Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
109bf2eeab3Smrg])
11014c0a534Smrg
111bf2eeab3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11214c0a534Smrg
113bf2eeab3Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114bf2eeab3Smrg# Free Software Foundation, Inc.
115bf2eeab3Smrg#
116bf2eeab3Smrg# This file is free software; the Free Software Foundation
117bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
118bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
11914c0a534Smrg
120bf2eeab3Smrg# serial 9
12114c0a534Smrg
122bf2eeab3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123bf2eeab3Smrg# -------------------------------------
124bf2eeab3Smrg# Define a conditional.
125bf2eeab3SmrgAC_DEFUN([AM_CONDITIONAL],
126bf2eeab3Smrg[AC_PREREQ(2.52)dnl
127bf2eeab3Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128bf2eeab3Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
129bf2eeab3SmrgAC_SUBST([$1_TRUE])dnl
130bf2eeab3SmrgAC_SUBST([$1_FALSE])dnl
131bf2eeab3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
132bf2eeab3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133bf2eeab3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134bf2eeab3Smrgif $2; then
135bf2eeab3Smrg  $1_TRUE=
136bf2eeab3Smrg  $1_FALSE='#'
137bf2eeab3Smrgelse
138bf2eeab3Smrg  $1_TRUE='#'
139bf2eeab3Smrg  $1_FALSE=
140bf2eeab3Smrgfi
141bf2eeab3SmrgAC_CONFIG_COMMANDS_PRE(
142bf2eeab3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143bf2eeab3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144bf2eeab3SmrgUsually this means the macro was only invoked conditionally.]])
145bf2eeab3Smrgfi])])
14614c0a534Smrg
147bf2eeab3Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148bf2eeab3Smrg# Free Software Foundation, Inc.
149bf2eeab3Smrg#
150bf2eeab3Smrg# This file is free software; the Free Software Foundation
151bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
152bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
15314c0a534Smrg
154bf2eeab3Smrg# serial 10
15514c0a534Smrg
156bf2eeab3Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157bf2eeab3Smrg# written in clear, in which case automake, when reading aclocal.m4,
158bf2eeab3Smrg# will think it sees a *use*, and therefore will trigger all it's
159bf2eeab3Smrg# C support machinery.  Also note that it means that autoscan, seeing
160bf2eeab3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
16114c0a534Smrg
16214c0a534Smrg
163bf2eeab3Smrg# _AM_DEPENDENCIES(NAME)
164bf2eeab3Smrg# ----------------------
165bf2eeab3Smrg# See how the compiler implements dependency checking.
166bf2eeab3Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167bf2eeab3Smrg# We try a few techniques and use that to set a single cache variable.
168bf2eeab3Smrg#
169bf2eeab3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170bf2eeab3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171bf2eeab3Smrg# dependency, and given that the user is not expected to run this macro,
172bf2eeab3Smrg# just rely on AC_PROG_CC.
173bf2eeab3SmrgAC_DEFUN([_AM_DEPENDENCIES],
174bf2eeab3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175bf2eeab3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176bf2eeab3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177bf2eeab3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17814c0a534Smrg
179bf2eeab3Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180bf2eeab3Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181bf2eeab3Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
182bf2eeab3Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183bf2eeab3Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184bf2eeab3Smrg                   [depcc="$$1"   am_compiler_list=])
18514c0a534Smrg
186bf2eeab3SmrgAC_CACHE_CHECK([dependency style of $depcc],
187bf2eeab3Smrg               [am_cv_$1_dependencies_compiler_type],
188bf2eeab3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189bf2eeab3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
190bf2eeab3Smrg  # making bogus files that we don't know about and never remove.  For
191bf2eeab3Smrg  # instance it was reported that on HP-UX the gcc test will end up
192bf2eeab3Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
193bf2eeab3Smrg  # in D'.
194bf2eeab3Smrg  mkdir conftest.dir
195bf2eeab3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196bf2eeab3Smrg  # using a relative directory.
197bf2eeab3Smrg  cp "$am_depcomp" conftest.dir
198bf2eeab3Smrg  cd conftest.dir
199bf2eeab3Smrg  # We will build objects and dependencies in a subdirectory because
200bf2eeab3Smrg  # it helps to detect inapplicable dependency modes.  For instance
201bf2eeab3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202bf2eeab3Smrg  # side effect of compilation, but ICC will put the dependencies in
203bf2eeab3Smrg  # the current directory while Tru64 will put them in the object
204bf2eeab3Smrg  # directory.
205bf2eeab3Smrg  mkdir sub
20614c0a534Smrg
207bf2eeab3Smrg  am_cv_$1_dependencies_compiler_type=none
208bf2eeab3Smrg  if test "$am_compiler_list" = ""; then
209bf2eeab3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210bf2eeab3Smrg  fi
211bf2eeab3Smrg  am__universal=false
212bf2eeab3Smrg  m4_case([$1], [CC],
213bf2eeab3Smrg    [case " $depcc " in #(
214bf2eeab3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215bf2eeab3Smrg     esac],
216bf2eeab3Smrg    [CXX],
217bf2eeab3Smrg    [case " $depcc " in #(
218bf2eeab3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219bf2eeab3Smrg     esac])
22014c0a534Smrg
221bf2eeab3Smrg  for depmode in $am_compiler_list; do
222bf2eeab3Smrg    # Setup a source with many dependencies, because some compilers
223bf2eeab3Smrg    # like to wrap large dependency lists on column 80 (with \), and
224bf2eeab3Smrg    # we should not choose a depcomp mode which is confused by this.
225bf2eeab3Smrg    #
226bf2eeab3Smrg    # We need to recreate these files for each test, as the compiler may
227bf2eeab3Smrg    # overwrite some of them when testing with obscure command lines.
228bf2eeab3Smrg    # This happens at least with the AIX C compiler.
229bf2eeab3Smrg    : > sub/conftest.c
230bf2eeab3Smrg    for i in 1 2 3 4 5 6; do
231bf2eeab3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232bf2eeab3Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233bf2eeab3Smrg      # Solaris 8's {/usr,}/bin/sh.
234bf2eeab3Smrg      touch sub/conftst$i.h
235bf2eeab3Smrg    done
236bf2eeab3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237bf2eeab3Smrg
238bf2eeab3Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239bf2eeab3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240bf2eeab3Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241bf2eeab3Smrg    # versions had trouble with output in subdirs
242bf2eeab3Smrg    am__obj=sub/conftest.${OBJEXT-o}
243bf2eeab3Smrg    am__minus_obj="-o $am__obj"
244bf2eeab3Smrg    case $depmode in
245bf2eeab3Smrg    gcc)
246bf2eeab3Smrg      # This depmode causes a compiler race in universal mode.
247bf2eeab3Smrg      test "$am__universal" = false || continue
248bf2eeab3Smrg      ;;
249bf2eeab3Smrg    nosideeffect)
250bf2eeab3Smrg      # after this tag, mechanisms are not by side-effect, so they'll
251bf2eeab3Smrg      # only be used when explicitly requested
252bf2eeab3Smrg      if test "x$enable_dependency_tracking" = xyes; then
253bf2eeab3Smrg	continue
254bf2eeab3Smrg      else
255bf2eeab3Smrg	break
256bf2eeab3Smrg      fi
257bf2eeab3Smrg      ;;
258bf2eeab3Smrg    msvisualcpp | msvcmsys)
259bf2eeab3Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
260bf2eeab3Smrg      # not run yet.  These depmodes are late enough in the game, and
261bf2eeab3Smrg      # so weak that their functioning should not be impacted.
262bf2eeab3Smrg      am__obj=conftest.${OBJEXT-o}
263bf2eeab3Smrg      am__minus_obj=
264bf2eeab3Smrg      ;;
265bf2eeab3Smrg    none) break ;;
266bf2eeab3Smrg    esac
267bf2eeab3Smrg    if depmode=$depmode \
268bf2eeab3Smrg       source=sub/conftest.c object=$am__obj \
269bf2eeab3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270bf2eeab3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271bf2eeab3Smrg         >/dev/null 2>conftest.err &&
272bf2eeab3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273bf2eeab3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274bf2eeab3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275bf2eeab3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276bf2eeab3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
277bf2eeab3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
278bf2eeab3Smrg      # that says an option was ignored or not supported.
279bf2eeab3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280bf2eeab3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281bf2eeab3Smrg      # The diagnosis changed in icc 8.0:
282bf2eeab3Smrg      #   icc: Command line remark: option '-MP' not supported
283bf2eeab3Smrg      if (grep 'ignoring option' conftest.err ||
284bf2eeab3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285bf2eeab3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
286bf2eeab3Smrg        break
287bf2eeab3Smrg      fi
288bf2eeab3Smrg    fi
289bf2eeab3Smrg  done
290bf2eeab3Smrg
291bf2eeab3Smrg  cd ..
292bf2eeab3Smrg  rm -rf conftest.dir
29314c0a534Smrgelse
294bf2eeab3Smrg  am_cv_$1_dependencies_compiler_type=none
29514c0a534Smrgfi
296bf2eeab3Smrg])
297bf2eeab3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298bf2eeab3SmrgAM_CONDITIONAL([am__fastdep$1], [
299bf2eeab3Smrg  test "x$enable_dependency_tracking" != xno \
300bf2eeab3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301bf2eeab3Smrg])
30214c0a534Smrg
30314c0a534Smrg
304bf2eeab3Smrg# AM_SET_DEPDIR
305bf2eeab3Smrg# -------------
306bf2eeab3Smrg# Choose a directory name for dependency files.
307bf2eeab3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308bf2eeab3SmrgAC_DEFUN([AM_SET_DEPDIR],
309bf2eeab3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310bf2eeab3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311bf2eeab3Smrg])
31214c0a534Smrg
31314c0a534Smrg
314bf2eeab3Smrg# AM_DEP_TRACK
315bf2eeab3Smrg# ------------
316bf2eeab3SmrgAC_DEFUN([AM_DEP_TRACK],
317bf2eeab3Smrg[AC_ARG_ENABLE(dependency-tracking,
318bf2eeab3Smrg[  --disable-dependency-tracking  speeds up one-time build
319bf2eeab3Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320bf2eeab3Smrgif test "x$enable_dependency_tracking" != xno; then
321bf2eeab3Smrg  am_depcomp="$ac_aux_dir/depcomp"
322bf2eeab3Smrg  AMDEPBACKSLASH='\'
32314c0a534Smrgfi
324bf2eeab3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
325bf2eeab3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
326bf2eeab3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327bf2eeab3Smrg])
32814c0a534Smrg
329bf2eeab3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330bf2eeab3Smrg
331bf2eeab3Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332bf2eeab3Smrg# Free Software Foundation, Inc.
333bf2eeab3Smrg#
334bf2eeab3Smrg# This file is free software; the Free Software Foundation
335bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
336bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
337bf2eeab3Smrg
338bf2eeab3Smrg#serial 5
339bf2eeab3Smrg
340bf2eeab3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341bf2eeab3Smrg# ------------------------------
342bf2eeab3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343bf2eeab3Smrg[{
344bf2eeab3Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345bf2eeab3Smrg  # are listed without --file.  Let's play safe and only enable the eval
346bf2eeab3Smrg  # if we detect the quoting.
347bf2eeab3Smrg  case $CONFIG_FILES in
348bf2eeab3Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
349bf2eeab3Smrg  *)   set x $CONFIG_FILES ;;
350bf2eeab3Smrg  esac
351bf2eeab3Smrg  shift
352bf2eeab3Smrg  for mf
353bf2eeab3Smrg  do
354bf2eeab3Smrg    # Strip MF so we end up with the name of the file.
355bf2eeab3Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356bf2eeab3Smrg    # Check whether this is an Automake generated Makefile or not.
357bf2eeab3Smrg    # We used to match only the files named `Makefile.in', but
358bf2eeab3Smrg    # some people rename them; so instead we look at the file content.
359bf2eeab3Smrg    # Grep'ing the first line is not enough: some people post-process
360bf2eeab3Smrg    # each Makefile.in and add a new line on top of each file to say so.
361bf2eeab3Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
362bf2eeab3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
363bf2eeab3Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364bf2eeab3Smrg      dirpart=`AS_DIRNAME("$mf")`
365bf2eeab3Smrg    else
366bf2eeab3Smrg      continue
367bf2eeab3Smrg    fi
368bf2eeab3Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
369bf2eeab3Smrg    # from the Makefile without running `make'.
370bf2eeab3Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371bf2eeab3Smrg    test -z "$DEPDIR" && continue
372bf2eeab3Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373bf2eeab3Smrg    test -z "am__include" && continue
374bf2eeab3Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375bf2eeab3Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
376bf2eeab3Smrg    U=`sed -n 's/^U = //p' < "$mf"`
377bf2eeab3Smrg    # Find all dependency output files, they are included files with
378bf2eeab3Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379bf2eeab3Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380bf2eeab3Smrg    # expansion.
381bf2eeab3Smrg    for file in `sed -n "
382bf2eeab3Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383bf2eeab3Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384bf2eeab3Smrg      # Make sure the directory exists.
385bf2eeab3Smrg      test -f "$dirpart/$file" && continue
386bf2eeab3Smrg      fdir=`AS_DIRNAME(["$file"])`
387bf2eeab3Smrg      AS_MKDIR_P([$dirpart/$fdir])
388bf2eeab3Smrg      # echo "creating $dirpart/$file"
389bf2eeab3Smrg      echo '# dummy' > "$dirpart/$file"
390bf2eeab3Smrg    done
391bf2eeab3Smrg  done
392bf2eeab3Smrg}
393bf2eeab3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394bf2eeab3Smrg
395bf2eeab3Smrg
396bf2eeab3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397bf2eeab3Smrg# -----------------------------
398bf2eeab3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
399bf2eeab3Smrg#
400bf2eeab3Smrg# This code is only required when automatic dependency tracking
401bf2eeab3Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
402bf2eeab3Smrg# need in order to bootstrap the dependency handling code.
403bf2eeab3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404bf2eeab3Smrg[AC_CONFIG_COMMANDS([depfiles],
405bf2eeab3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406bf2eeab3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407bf2eeab3Smrg])
408bf2eeab3Smrg
409bf2eeab3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
410bf2eeab3Smrg
411bf2eeab3Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412bf2eeab3Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
413bf2eeab3Smrg#
414bf2eeab3Smrg# This file is free software; the Free Software Foundation
415bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
416bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
417bf2eeab3Smrg
418bf2eeab3Smrg# serial 16
419bf2eeab3Smrg
420bf2eeab3Smrg# This macro actually does too much.  Some checks are only needed if
421bf2eeab3Smrg# your package does certain things.  But this isn't really a big deal.
422bf2eeab3Smrg
423bf2eeab3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
424bf2eeab3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
425bf2eeab3Smrg# -----------------------------------------------
426bf2eeab3Smrg# The call with PACKAGE and VERSION arguments is the old style
427bf2eeab3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
428bf2eeab3Smrg# and VERSION should now be passed to AC_INIT and removed from
429bf2eeab3Smrg# the call to AM_INIT_AUTOMAKE.
430bf2eeab3Smrg# We support both call styles for the transition.  After
431bf2eeab3Smrg# the next Automake release, Autoconf can make the AC_INIT
432bf2eeab3Smrg# arguments mandatory, and then we can depend on a new Autoconf
433bf2eeab3Smrg# release and drop the old call support.
434bf2eeab3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435bf2eeab3Smrg[AC_PREREQ([2.62])dnl
436bf2eeab3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
437bf2eeab3Smrgdnl the ones we care about.
438bf2eeab3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
439bf2eeab3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
440bf2eeab3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
441bf2eeab3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
442bf2eeab3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
443bf2eeab3Smrg  # is not polluted with repeated "-I."
444bf2eeab3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
445bf2eeab3Smrg  # test to see if srcdir already configured
446bf2eeab3Smrg  if test -f $srcdir/config.status; then
447bf2eeab3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
448bf2eeab3Smrg  fi
44914c0a534Smrgfi
45014c0a534Smrg
451bf2eeab3Smrg# test whether we have cygpath
452bf2eeab3Smrgif test -z "$CYGPATH_W"; then
453bf2eeab3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
454bf2eeab3Smrg    CYGPATH_W='cygpath -w'
455bf2eeab3Smrg  else
456bf2eeab3Smrg    CYGPATH_W=echo
457bf2eeab3Smrg  fi
45814c0a534Smrgfi
459bf2eeab3SmrgAC_SUBST([CYGPATH_W])
460bf2eeab3Smrg
461bf2eeab3Smrg# Define the identity of the package.
462bf2eeab3Smrgdnl Distinguish between old-style and new-style calls.
463bf2eeab3Smrgm4_ifval([$2],
464bf2eeab3Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465bf2eeab3Smrg AC_SUBST([PACKAGE], [$1])dnl
466bf2eeab3Smrg AC_SUBST([VERSION], [$2])],
467bf2eeab3Smrg[_AM_SET_OPTIONS([$1])dnl
468bf2eeab3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469bf2eeab3Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
470bf2eeab3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
471bf2eeab3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
472bf2eeab3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473bf2eeab3Smrg
474bf2eeab3Smrg_AM_IF_OPTION([no-define],,
475bf2eeab3Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
476bf2eeab3Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477bf2eeab3Smrg
478bf2eeab3Smrg# Some tools Automake needs.
479bf2eeab3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
480bf2eeab3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
481bf2eeab3SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
482bf2eeab3SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
483bf2eeab3SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
484bf2eeab3SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
485bf2eeab3SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486bf2eeab3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487bf2eeab3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
488bf2eeab3SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
489bf2eeab3Smrg# We need awk for the "check" target.  The system "awk" is bad on
490bf2eeab3Smrg# some platforms.
491bf2eeab3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
492bf2eeab3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
493bf2eeab3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
494bf2eeab3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495bf2eeab3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496bf2eeab3Smrg			     [_AM_PROG_TAR([v7])])])
497bf2eeab3Smrg_AM_IF_OPTION([no-dependencies],,
498bf2eeab3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499bf2eeab3Smrg		  [_AM_DEPENDENCIES(CC)],
500bf2eeab3Smrg		  [define([AC_PROG_CC],
501bf2eeab3Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
502bf2eeab3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503bf2eeab3Smrg		  [_AM_DEPENDENCIES(CXX)],
504bf2eeab3Smrg		  [define([AC_PROG_CXX],
505bf2eeab3Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
506bf2eeab3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507bf2eeab3Smrg		  [_AM_DEPENDENCIES(OBJC)],
508bf2eeab3Smrg		  [define([AC_PROG_OBJC],
509bf2eeab3Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
510bf2eeab3Smrg])
511bf2eeab3Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512bf2eeab3Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513bf2eeab3Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514bf2eeab3Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515bf2eeab3SmrgAC_CONFIG_COMMANDS_PRE(dnl
516bf2eeab3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517bf2eeab3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
518bf2eeab3Smrg])
519bf2eeab3Smrg
520bf2eeab3Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521bf2eeab3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522bf2eeab3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
523bf2eeab3Smrgm4_define([_AC_COMPILER_EXEEXT],
524bf2eeab3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525bf2eeab3Smrg
526bf2eeab3Smrg
527bf2eeab3Smrg# When config.status generates a header, we must update the stamp-h file.
528bf2eeab3Smrg# This file resides in the same directory as the config header
529bf2eeab3Smrg# that is generated.  The stamp files are numbered to have different names.
530bf2eeab3Smrg
531bf2eeab3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
532bf2eeab3Smrg# loop where config.status creates the headers, so we can generate
533bf2eeab3Smrg# our stamp files there.
534bf2eeab3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
535bf2eeab3Smrg[# Compute $1's index in $config_headers.
536bf2eeab3Smrg_am_arg=$1
537bf2eeab3Smrg_am_stamp_count=1
538bf2eeab3Smrgfor _am_header in $config_headers :; do
539bf2eeab3Smrg  case $_am_header in
540bf2eeab3Smrg    $_am_arg | $_am_arg:* )
541bf2eeab3Smrg      break ;;
542bf2eeab3Smrg    * )
543bf2eeab3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
544bf2eeab3Smrg  esac
545bf2eeab3Smrgdone
546bf2eeab3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
547bf2eeab3Smrg
548bf2eeab3Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
549bf2eeab3Smrg#
550bf2eeab3Smrg# This file is free software; the Free Software Foundation
551bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
552bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
553bf2eeab3Smrg
554bf2eeab3Smrg# AM_PROG_INSTALL_SH
555bf2eeab3Smrg# ------------------
556bf2eeab3Smrg# Define $install_sh.
557bf2eeab3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
558bf2eeab3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559bf2eeab3Smrgif test x"${install_sh}" != xset; then
560bf2eeab3Smrg  case $am_aux_dir in
561bf2eeab3Smrg  *\ * | *\	*)
562bf2eeab3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563bf2eeab3Smrg  *)
564bf2eeab3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565bf2eeab3Smrg  esac
56614c0a534Smrgfi
567bf2eeab3SmrgAC_SUBST(install_sh)])
56814c0a534Smrg
569bf2eeab3Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
570bf2eeab3Smrg#
571bf2eeab3Smrg# This file is free software; the Free Software Foundation
572bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
573bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
574bf2eeab3Smrg
575bf2eeab3Smrg# serial 2
576bf2eeab3Smrg
577bf2eeab3Smrg# Check whether the underlying file-system supports filenames
578bf2eeab3Smrg# with a leading dot.  For instance MS-DOS doesn't.
579bf2eeab3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
580bf2eeab3Smrg[rm -rf .tst 2>/dev/null
581bf2eeab3Smrgmkdir .tst 2>/dev/null
582bf2eeab3Smrgif test -d .tst; then
583bf2eeab3Smrg  am__leading_dot=.
584bf2eeab3Smrgelse
585bf2eeab3Smrg  am__leading_dot=_
58614c0a534Smrgfi
587bf2eeab3Smrgrmdir .tst 2>/dev/null
588bf2eeab3SmrgAC_SUBST([am__leading_dot])])
589bf2eeab3Smrg
590bf2eeab3Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
591bf2eeab3Smrg# From Jim Meyering
592bf2eeab3Smrg
593bf2eeab3Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
594bf2eeab3Smrg# Free Software Foundation, Inc.
595bf2eeab3Smrg#
596bf2eeab3Smrg# This file is free software; the Free Software Foundation
597bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
598bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
599bf2eeab3Smrg
600bf2eeab3Smrg# serial 5
601bf2eeab3Smrg
602bf2eeab3Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603bf2eeab3Smrg# ----------------------------------
604bf2eeab3Smrg# Control maintainer-specific portions of Makefiles.
605bf2eeab3Smrg# Default is to disable them, unless `enable' is passed literally.
606bf2eeab3Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607bf2eeab3Smrg# can override the default with the --enable/--disable switch.
608bf2eeab3SmrgAC_DEFUN([AM_MAINTAINER_MODE],
609bf2eeab3Smrg[m4_case(m4_default([$1], [disable]),
610bf2eeab3Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
611bf2eeab3Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
612bf2eeab3Smrg       [m4_define([am_maintainer_other], [enable])
613bf2eeab3Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614bf2eeab3SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615bf2eeab3Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616bf2eeab3Smrg  AC_ARG_ENABLE([maintainer-mode],
617bf2eeab3Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
618bf2eeab3Smrg			  (and sometimes confusing) to the casual installer],
619bf2eeab3Smrg      [USE_MAINTAINER_MODE=$enableval],
620bf2eeab3Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
621bf2eeab3Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622bf2eeab3Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
623bf2eeab3Smrg  MAINT=$MAINTAINER_MODE_TRUE
624bf2eeab3Smrg  AC_SUBST([MAINT])dnl
625bf2eeab3Smrg]
626bf2eeab3Smrg)
627bf2eeab3Smrg
628bf2eeab3SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629bf2eeab3Smrg
630bf2eeab3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631bf2eeab3Smrg
632bf2eeab3Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
633bf2eeab3Smrg#
634bf2eeab3Smrg# This file is free software; the Free Software Foundation
635bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
636bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
637bf2eeab3Smrg
638bf2eeab3Smrg# serial 4
639bf2eeab3Smrg
640bf2eeab3Smrg# AM_MAKE_INCLUDE()
641bf2eeab3Smrg# -----------------
642bf2eeab3Smrg# Check to see how make treats includes.
643bf2eeab3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
644bf2eeab3Smrg[am_make=${MAKE-make}
645bf2eeab3Smrgcat > confinc << 'END'
646bf2eeab3Smrgam__doit:
647bf2eeab3Smrg	@echo this is the am__doit target
648bf2eeab3Smrg.PHONY: am__doit
649bf2eeab3SmrgEND
650bf2eeab3Smrg# If we don't find an include directive, just comment out the code.
651bf2eeab3SmrgAC_MSG_CHECKING([for style of include used by $am_make])
652bf2eeab3Smrgam__include="#"
653bf2eeab3Smrgam__quote=
654bf2eeab3Smrg_am_result=none
655bf2eeab3Smrg# First try GNU make style include.
656bf2eeab3Smrgecho "include confinc" > confmf
657bf2eeab3Smrg# Ignore all kinds of additional output from `make'.
658bf2eeab3Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659bf2eeab3Smrg*the\ am__doit\ target*)
660bf2eeab3Smrg  am__include=include
661bf2eeab3Smrg  am__quote=
662bf2eeab3Smrg  _am_result=GNU
663bf2eeab3Smrg  ;;
664bf2eeab3Smrgesac
665bf2eeab3Smrg# Now try BSD make style include.
666bf2eeab3Smrgif test "$am__include" = "#"; then
667bf2eeab3Smrg   echo '.include "confinc"' > confmf
668bf2eeab3Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669bf2eeab3Smrg   *the\ am__doit\ target*)
670bf2eeab3Smrg     am__include=.include
671bf2eeab3Smrg     am__quote="\""
672bf2eeab3Smrg     _am_result=BSD
673bf2eeab3Smrg     ;;
674bf2eeab3Smrg   esac
67514c0a534Smrgfi
676bf2eeab3SmrgAC_SUBST([am__include])
677bf2eeab3SmrgAC_SUBST([am__quote])
678bf2eeab3SmrgAC_MSG_RESULT([$_am_result])
679bf2eeab3Smrgrm -f confinc confmf
680bf2eeab3Smrg])
68114c0a534Smrg
682bf2eeab3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
683bf2eeab3Smrg
684bf2eeab3Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
685bf2eeab3Smrg# Free Software Foundation, Inc.
686bf2eeab3Smrg#
687bf2eeab3Smrg# This file is free software; the Free Software Foundation
688bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
689bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
690bf2eeab3Smrg
691bf2eeab3Smrg# serial 6
692bf2eeab3Smrg
693bf2eeab3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
694bf2eeab3Smrg# ------------------------------
695bf2eeab3SmrgAC_DEFUN([AM_MISSING_PROG],
696bf2eeab3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
697bf2eeab3Smrg$1=${$1-"${am_missing_run}$2"}
698bf2eeab3SmrgAC_SUBST($1)])
699bf2eeab3Smrg
700bf2eeab3Smrg
701bf2eeab3Smrg# AM_MISSING_HAS_RUN
702bf2eeab3Smrg# ------------------
703bf2eeab3Smrg# Define MISSING if not defined so far and test if it supports --run.
704bf2eeab3Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
705bf2eeab3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
706bf2eeab3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
707bf2eeab3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
708bf2eeab3Smrgif test x"${MISSING+set}" != xset; then
709bf2eeab3Smrg  case $am_aux_dir in
710bf2eeab3Smrg  *\ * | *\	*)
711bf2eeab3Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712bf2eeab3Smrg  *)
713bf2eeab3Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714bf2eeab3Smrg  esac
71514c0a534Smrgfi
716bf2eeab3Smrg# Use eval to expand $SHELL
717bf2eeab3Smrgif eval "$MISSING --run true"; then
718bf2eeab3Smrg  am_missing_run="$MISSING --run "
719bf2eeab3Smrgelse
720bf2eeab3Smrg  am_missing_run=
721bf2eeab3Smrg  AC_MSG_WARN([`missing' script is too old or missing])
72214c0a534Smrgfi
723bf2eeab3Smrg])
72414c0a534Smrg
725bf2eeab3Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726bf2eeab3Smrg#
727bf2eeab3Smrg# This file is free software; the Free Software Foundation
728bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
729bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
73014c0a534Smrg
731bf2eeab3Smrg# AM_PROG_MKDIR_P
732bf2eeab3Smrg# ---------------
733bf2eeab3Smrg# Check for `mkdir -p'.
734bf2eeab3SmrgAC_DEFUN([AM_PROG_MKDIR_P],
735bf2eeab3Smrg[AC_PREREQ([2.60])dnl
736bf2eeab3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
737bf2eeab3Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
738bf2eeab3Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
739bf2eeab3Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
740bf2eeab3Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
741bf2eeab3Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
742bf2eeab3Smrgdnl adjustment using top_builddir (which is defined more often than
743bf2eeab3Smrgdnl MKDIR_P).
744bf2eeab3SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
745bf2eeab3Smrgcase $mkdir_p in
746bf2eeab3Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
747bf2eeab3Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
748bf2eeab3Smrgesac
749bf2eeab3Smrg])
75014c0a534Smrg
751bf2eeab3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
752bf2eeab3Smrg
753bf2eeab3Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754bf2eeab3Smrg#
755bf2eeab3Smrg# This file is free software; the Free Software Foundation
756bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
757bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
758bf2eeab3Smrg
759bf2eeab3Smrg# serial 4
760bf2eeab3Smrg
761bf2eeab3Smrg# _AM_MANGLE_OPTION(NAME)
762bf2eeab3Smrg# -----------------------
763bf2eeab3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
764bf2eeab3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
765bf2eeab3Smrg
766bf2eeab3Smrg# _AM_SET_OPTION(NAME)
767bf2eeab3Smrg# ------------------------------
768bf2eeab3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
769bf2eeab3SmrgAC_DEFUN([_AM_SET_OPTION],
770bf2eeab3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
771bf2eeab3Smrg
772bf2eeab3Smrg# _AM_SET_OPTIONS(OPTIONS)
773bf2eeab3Smrg# ----------------------------------
774bf2eeab3Smrg# OPTIONS is a space-separated list of Automake options.
775bf2eeab3SmrgAC_DEFUN([_AM_SET_OPTIONS],
776bf2eeab3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
77714c0a534Smrg
778bf2eeab3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
779bf2eeab3Smrg# -------------------------------------------
780bf2eeab3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
781bf2eeab3SmrgAC_DEFUN([_AM_IF_OPTION],
782bf2eeab3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
78314c0a534Smrg
784bf2eeab3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
78514c0a534Smrg
786bf2eeab3Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
787bf2eeab3Smrg# Free Software Foundation, Inc.
788bf2eeab3Smrg#
789bf2eeab3Smrg# This file is free software; the Free Software Foundation
790bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
791bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
79214c0a534Smrg
793bf2eeab3Smrg# serial 5
79414c0a534Smrg
795bf2eeab3Smrg# AM_SANITY_CHECK
796bf2eeab3Smrg# ---------------
797bf2eeab3SmrgAC_DEFUN([AM_SANITY_CHECK],
798bf2eeab3Smrg[AC_MSG_CHECKING([whether build environment is sane])
799bf2eeab3Smrg# Just in case
800bf2eeab3Smrgsleep 1
801bf2eeab3Smrgecho timestamp > conftest.file
802bf2eeab3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
803bf2eeab3Smrg# name.  Accept space and tab only in the latter.
804bf2eeab3Smrgam_lf='
805bf2eeab3Smrg'
806bf2eeab3Smrgcase `pwd` in
807bf2eeab3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808bf2eeab3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809bf2eeab3Smrgesac
810bf2eeab3Smrgcase $srcdir in
811bf2eeab3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812bf2eeab3Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813bf2eeab3Smrgesac
81414c0a534Smrg
815bf2eeab3Smrg# Do `set' in a subshell so we don't clobber the current shell's
816bf2eeab3Smrg# arguments.  Must try -L first in case configure is actually a
817bf2eeab3Smrg# symlink; some systems play weird games with the mod time of symlinks
818bf2eeab3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
819bf2eeab3Smrg# directory).
820bf2eeab3Smrgif (
821bf2eeab3Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
822bf2eeab3Smrg   if test "$[*]" = "X"; then
823bf2eeab3Smrg      # -L didn't work.
824bf2eeab3Smrg      set X `ls -t "$srcdir/configure" conftest.file`
825bf2eeab3Smrg   fi
826bf2eeab3Smrg   rm -f conftest.file
827bf2eeab3Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
828bf2eeab3Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
82914c0a534Smrg
830bf2eeab3Smrg      # If neither matched, then we have a broken ls.  This can happen
831bf2eeab3Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
832bf2eeab3Smrg      # broken ls alias from the environment.  This has actually
833bf2eeab3Smrg      # happened.  Such a system could not be considered "sane".
834bf2eeab3Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
835bf2eeab3Smrgalias in your environment])
836bf2eeab3Smrg   fi
837bf2eeab3Smrg
838bf2eeab3Smrg   test "$[2]" = conftest.file
839bf2eeab3Smrg   )
840bf2eeab3Smrgthen
841bf2eeab3Smrg   # Ok.
842bf2eeab3Smrg   :
84314c0a534Smrgelse
844bf2eeab3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
845bf2eeab3SmrgCheck your system clock])
84614c0a534Smrgfi
847bf2eeab3SmrgAC_MSG_RESULT(yes)])
84814c0a534Smrg
849bf2eeab3Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
850bf2eeab3Smrg#
851bf2eeab3Smrg# This file is free software; the Free Software Foundation
852bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
853bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
85414c0a534Smrg
855bf2eeab3Smrg# serial 1
856bf2eeab3Smrg
857bf2eeab3Smrg# AM_SILENT_RULES([DEFAULT])
858bf2eeab3Smrg# --------------------------
859bf2eeab3Smrg# Enable less verbose build rules; with the default set to DEFAULT
860bf2eeab3Smrg# (`yes' being less verbose, `no' or empty being verbose).
861bf2eeab3SmrgAC_DEFUN([AM_SILENT_RULES],
862bf2eeab3Smrg[AC_ARG_ENABLE([silent-rules],
863bf2eeab3Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864bf2eeab3Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865bf2eeab3Smrgcase $enable_silent_rules in
866bf2eeab3Smrgyes) AM_DEFAULT_VERBOSITY=0;;
867bf2eeab3Smrgno)  AM_DEFAULT_VERBOSITY=1;;
868bf2eeab3Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
869bf2eeab3Smrgesac
870bf2eeab3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871bf2eeab3SmrgAM_BACKSLASH='\'
872bf2eeab3SmrgAC_SUBST([AM_BACKSLASH])dnl
873bf2eeab3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874bf2eeab3Smrg])
87514c0a534Smrg
876bf2eeab3Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
877bf2eeab3Smrg#
878bf2eeab3Smrg# This file is free software; the Free Software Foundation
879bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
880bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
88114c0a534Smrg
882bf2eeab3Smrg# AM_PROG_INSTALL_STRIP
883bf2eeab3Smrg# ---------------------
884bf2eeab3Smrg# One issue with vendor `install' (even GNU) is that you can't
885bf2eeab3Smrg# specify the program used to strip binaries.  This is especially
886bf2eeab3Smrg# annoying in cross-compiling environments, where the build's strip
887bf2eeab3Smrg# is unlikely to handle the host's binaries.
888bf2eeab3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
889bf2eeab3Smrg# always use install-sh in `make install-strip', and initialize
890bf2eeab3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
891bf2eeab3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
892bf2eeab3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
893bf2eeab3Smrg# Installed binaries are usually stripped using `strip' when the user
894bf2eeab3Smrg# run `make install-strip'.  However `strip' might not be the right
895bf2eeab3Smrg# tool to use in cross-compilation environments, therefore Automake
896bf2eeab3Smrg# will honor the `STRIP' environment variable to overrule this program.
897bf2eeab3Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
898bf2eeab3Smrgif test "$cross_compiling" != no; then
899bf2eeab3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
90014c0a534Smrgfi
901bf2eeab3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
902bf2eeab3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
90314c0a534Smrg
904bf2eeab3Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
905bf2eeab3Smrg#
906bf2eeab3Smrg# This file is free software; the Free Software Foundation
907bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
908bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
90914c0a534Smrg
910bf2eeab3Smrg# serial 2
91114c0a534Smrg
912bf2eeab3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
913bf2eeab3Smrg# ---------------------------
914bf2eeab3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
915bf2eeab3Smrg# This macro is traced by Automake.
916bf2eeab3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
91714c0a534Smrg
918bf2eeab3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
919bf2eeab3Smrg# ---------------------------
920bf2eeab3Smrg# Public sister of _AM_SUBST_NOTMAKE.
921bf2eeab3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
92214c0a534Smrg
923bf2eeab3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
924bf2eeab3Smrg
925bf2eeab3Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
92614c0a534Smrg#
92714c0a534Smrg# This file is free software; the Free Software Foundation
92814c0a534Smrg# gives unlimited permission to copy and/or distribute it,
92914c0a534Smrg# with or without modifications, as long as this notice is preserved.
93014c0a534Smrg
931bf2eeab3Smrg# serial 2
932bf2eeab3Smrg
933bf2eeab3Smrg# _AM_PROG_TAR(FORMAT)
934bf2eeab3Smrg# --------------------
935bf2eeab3Smrg# Check how to create a tarball in format FORMAT.
936bf2eeab3Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
937bf2eeab3Smrg#
938bf2eeab3Smrg# Substitute a variable $(am__tar) that is a command
939bf2eeab3Smrg# writing to stdout a FORMAT-tarball containing the directory
940bf2eeab3Smrg# $tardir.
941bf2eeab3Smrg#     tardir=directory && $(am__tar) > result.tar
942bf2eeab3Smrg#
943bf2eeab3Smrg# Substitute a variable $(am__untar) that extract such
944bf2eeab3Smrg# a tarball read from stdin.
945bf2eeab3Smrg#     $(am__untar) < result.tar
946bf2eeab3SmrgAC_DEFUN([_AM_PROG_TAR],
947bf2eeab3Smrg[# Always define AMTAR for backward compatibility.
948bf2eeab3SmrgAM_MISSING_PROG([AMTAR], [tar])
949bf2eeab3Smrgm4_if([$1], [v7],
950bf2eeab3Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
951bf2eeab3Smrg     [m4_case([$1], [ustar],, [pax],,
952bf2eeab3Smrg              [m4_fatal([Unknown tar format])])
953bf2eeab3SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
954bf2eeab3Smrg# Loop over all known methods to create a tar archive until one works.
955bf2eeab3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
956bf2eeab3Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
957bf2eeab3Smrg# Do not fold the above two line into one, because Tru64 sh and
958bf2eeab3Smrg# Solaris sh will not grok spaces in the rhs of `-'.
959bf2eeab3Smrgfor _am_tool in $_am_tools
960bf2eeab3Smrgdo
961bf2eeab3Smrg  case $_am_tool in
962bf2eeab3Smrg  gnutar)
963bf2eeab3Smrg    for _am_tar in tar gnutar gtar;
964bf2eeab3Smrg    do
965bf2eeab3Smrg      AM_RUN_LOG([$_am_tar --version]) && break
966bf2eeab3Smrg    done
967bf2eeab3Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
968bf2eeab3Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
969bf2eeab3Smrg    am__untar="$_am_tar -xf -"
970bf2eeab3Smrg    ;;
971bf2eeab3Smrg  plaintar)
972bf2eeab3Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
973bf2eeab3Smrg    # ustar tarball either.
974bf2eeab3Smrg    (tar --version) >/dev/null 2>&1 && continue
975bf2eeab3Smrg    am__tar='tar chf - "$$tardir"'
976bf2eeab3Smrg    am__tar_='tar chf - "$tardir"'
977bf2eeab3Smrg    am__untar='tar xf -'
978bf2eeab3Smrg    ;;
979bf2eeab3Smrg  pax)
980bf2eeab3Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
981bf2eeab3Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
982bf2eeab3Smrg    am__untar='pax -r'
983bf2eeab3Smrg    ;;
984bf2eeab3Smrg  cpio)
985bf2eeab3Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
986bf2eeab3Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
987bf2eeab3Smrg    am__untar='cpio -i -H $1 -d'
988bf2eeab3Smrg    ;;
989bf2eeab3Smrg  none)
990bf2eeab3Smrg    am__tar=false
991bf2eeab3Smrg    am__tar_=false
992bf2eeab3Smrg    am__untar=false
993bf2eeab3Smrg    ;;
994bf2eeab3Smrg  esac
995bf2eeab3Smrg
996bf2eeab3Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
997bf2eeab3Smrg  # and am__untar set.
998bf2eeab3Smrg  test -n "${am_cv_prog_tar_$1}" && break
99914c0a534Smrg
1000bf2eeab3Smrg  # tar/untar a dummy directory, and stop if the command works
1001bf2eeab3Smrg  rm -rf conftest.dir
1002bf2eeab3Smrg  mkdir conftest.dir
1003bf2eeab3Smrg  echo GrepMe > conftest.dir/file
1004bf2eeab3Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1005bf2eeab3Smrg  rm -rf conftest.dir
1006bf2eeab3Smrg  if test -s conftest.tar; then
1007bf2eeab3Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1008bf2eeab3Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1009bf2eeab3Smrg  fi
1010bf2eeab3Smrgdone
1011bf2eeab3Smrgrm -rf conftest.dir
101214c0a534Smrg
1013bf2eeab3SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1014bf2eeab3SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1015bf2eeab3SmrgAC_SUBST([am__tar])
1016bf2eeab3SmrgAC_SUBST([am__untar])
1017bf2eeab3Smrg]) # _AM_PROG_TAR
101814c0a534Smrg
1019bf2eeab3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1020bf2eeab3Smrgdnl
1021576bae58Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1022bf2eeab3Smrgdnl 
1023bf2eeab3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1024576bae58Smrgdnl copy of this software and associated documentation files (the "Software"),
1025576bae58Smrgdnl to deal in the Software without restriction, including without limitation
1026576bae58Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1027576bae58Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1028576bae58Smrgdnl Software is furnished to do so, subject to the following conditions:
1029bf2eeab3Smrgdnl
1030576bae58Smrgdnl The above copyright notice and this permission notice (including the next
1031576bae58Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1032576bae58Smrgdnl Software.
1033bf2eeab3Smrgdnl
1034576bae58Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1035576bae58Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1036576bae58Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1037576bae58Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1038576bae58Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1039576bae58Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1040576bae58Smrgdnl DEALINGS IN THE SOFTWARE.
104114c0a534Smrg
1042bf2eeab3Smrg# XORG_MACROS_VERSION(required-version)
1043bf2eeab3Smrg# -------------------------------------
1044bf2eeab3Smrg# Minimum version: 1.1.0
104514c0a534Smrg#
1046bf2eeab3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1047bf2eeab3Smrg# your configure.ac with the minimum required version, such as:
1048bf2eeab3Smrg# XORG_MACROS_VERSION(1.1)
104914c0a534Smrg#
1050bf2eeab3Smrg# To ensure that this macro is defined, also add:
1051bf2eeab3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1052bf2eeab3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
105314c0a534Smrg#
105414c0a534Smrg#
1055bf2eeab3Smrg# See the "minimum version" comment for each macro you use to see what 
1056bf2eeab3Smrg# version you require.
1057bf2eeab3Smrgm4_defun([XORG_MACROS_VERSION],[
10581a054510Smrgm4_define([vers_have], [1.15.0])
1059bf2eeab3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1060bf2eeab3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1061bf2eeab3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1062bf2eeab3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1063bf2eeab3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1064bf2eeab3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1065bf2eeab3Smrgm4_undefine([vers_have])
1066bf2eeab3Smrgm4_undefine([maj_have])
1067bf2eeab3Smrgm4_undefine([maj_needed])
1068bf2eeab3Smrg]) # XORG_MACROS_VERSION
106914c0a534Smrg
1070bf2eeab3Smrg# XORG_PROG_RAWCPP()
1071bf2eeab3Smrg# ------------------
1072bf2eeab3Smrg# Minimum version: 1.0.0
107314c0a534Smrg#
1074bf2eeab3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1075bf2eeab3Smrg# such as man pages and config files
1076bf2eeab3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1077bf2eeab3SmrgAC_REQUIRE([AC_PROG_CPP])
1078bf2eeab3SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1079bf2eeab3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
108014c0a534Smrg
1081bf2eeab3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1082bf2eeab3Smrg# which is not the best choice for supporting other OS'es, but covers most
1083bf2eeab3Smrg# of the ones we need for now.
1084bf2eeab3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
10851a054510SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1086bf2eeab3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1087bf2eeab3Smrg	AC_MSG_RESULT([no])
108814c0a534Smrgelse
1089bf2eeab3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1090bf2eeab3Smrg		RAWCPPFLAGS=-undef
1091bf2eeab3Smrg		AC_MSG_RESULT([yes])
1092bf2eeab3Smrg	# under Cygwin unix is still defined even with -undef
1093bf2eeab3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1094bf2eeab3Smrg		RAWCPPFLAGS="-undef -ansi"
1095bf2eeab3Smrg		AC_MSG_RESULT([yes, with -ansi])
1096bf2eeab3Smrg	else
1097bf2eeab3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1098bf2eeab3Smrg	fi
109914c0a534Smrgfi
1100bf2eeab3Smrgrm -f conftest.$ac_ext
110114c0a534Smrg
1102bf2eeab3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
11031a054510SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1104bf2eeab3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1105bf2eeab3Smrg	AC_MSG_RESULT([no])
1106bf2eeab3Smrgelse
1107bf2eeab3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1108bf2eeab3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1109bf2eeab3Smrg		AC_MSG_RESULT([yes])
1110bf2eeab3Smrg	else
1111bf2eeab3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1112bf2eeab3Smrg	fi
1113bf2eeab3Smrgfi
1114bf2eeab3Smrgrm -f conftest.$ac_ext
1115bf2eeab3SmrgAC_SUBST(RAWCPPFLAGS)
1116bf2eeab3Smrg]) # XORG_PROG_RAWCPP
111714c0a534Smrg
1118bf2eeab3Smrg# XORG_MANPAGE_SECTIONS()
1119bf2eeab3Smrg# -----------------------
1120bf2eeab3Smrg# Minimum version: 1.0.0
112114c0a534Smrg#
1122bf2eeab3Smrg# Determine which sections man pages go in for the different man page types
1123bf2eeab3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1124bf2eeab3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1125bf2eeab3Smrg# Override default settings by setting environment variables
1126576bae58Smrg# Added MAN_SUBSTS in version 1.8
1127576bae58Smrg# Added AC_PROG_SED in version 1.8
112814c0a534Smrg
1129bf2eeab3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1130bf2eeab3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1131576bae58SmrgAC_REQUIRE([AC_PROG_SED])
113214c0a534Smrg
1133bf2eeab3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1134bf2eeab3Smrg    APP_MAN_SUFFIX=1
1135bf2eeab3Smrgfi
1136bf2eeab3Smrgif test x$APP_MAN_DIR = x    ; then
1137bf2eeab3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1138bf2eeab3Smrgfi
113914c0a534Smrg
1140bf2eeab3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1141bf2eeab3Smrg    LIB_MAN_SUFFIX=3
1142bf2eeab3Smrgfi
1143bf2eeab3Smrgif test x$LIB_MAN_DIR = x    ; then
1144bf2eeab3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
114514c0a534Smrgfi
114614c0a534Smrg
1147bf2eeab3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1148bf2eeab3Smrg    case $host_os in
1149bf2eeab3Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1150bf2eeab3Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1151bf2eeab3Smrg    esac
1152bf2eeab3Smrgfi
1153bf2eeab3Smrgif test x$FILE_MAN_DIR = x    ; then
1154bf2eeab3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1155bf2eeab3Smrgfi
115614c0a534Smrg
1157bf2eeab3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1158bf2eeab3Smrg    case $host_os in
1159bf2eeab3Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1160bf2eeab3Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1161bf2eeab3Smrg    esac
1162bf2eeab3Smrgfi
1163bf2eeab3Smrgif test x$MISC_MAN_DIR = x    ; then
1164bf2eeab3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1165bf2eeab3Smrgfi
116614c0a534Smrg
1167bf2eeab3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1168bf2eeab3Smrg    case $host_os in
1169bf2eeab3Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1170bf2eeab3Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1171bf2eeab3Smrg    esac
1172bf2eeab3Smrgfi
1173bf2eeab3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1174bf2eeab3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1175bf2eeab3Smrgfi
117614c0a534Smrg
1177bf2eeab3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1178bf2eeab3Smrg    case $host_os in
1179bf2eeab3Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1180bf2eeab3Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1181bf2eeab3Smrg    esac
1182bf2eeab3Smrgfi
1183bf2eeab3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1184bf2eeab3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
118514c0a534Smrgfi
118614c0a534Smrg
118714c0a534Smrg
1188bf2eeab3SmrgAC_SUBST([APP_MAN_SUFFIX])
1189bf2eeab3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1190bf2eeab3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1191bf2eeab3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1192bf2eeab3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1193bf2eeab3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1194bf2eeab3SmrgAC_SUBST([APP_MAN_DIR])
1195bf2eeab3SmrgAC_SUBST([LIB_MAN_DIR])
1196bf2eeab3SmrgAC_SUBST([FILE_MAN_DIR])
1197bf2eeab3SmrgAC_SUBST([MISC_MAN_DIR])
1198bf2eeab3SmrgAC_SUBST([DRIVER_MAN_DIR])
1199bf2eeab3SmrgAC_SUBST([ADMIN_MAN_DIR])
1200576bae58Smrg
1201576bae58SmrgXORG_MAN_PAGE="X Version 11"
1202576bae58SmrgAC_SUBST([XORG_MAN_PAGE])
1203576bae58SmrgMAN_SUBSTS="\
1204576bae58Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1205576bae58Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1206576bae58Smrg	-e 's|__xservername__|Xorg|g' \
1207576bae58Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1208576bae58Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1209576bae58Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1210576bae58Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1211576bae58Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1212576bae58Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1213576bae58Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1214576bae58Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1215576bae58Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1216576bae58SmrgAC_SUBST([MAN_SUBSTS])
1217576bae58Smrg
1218bf2eeab3Smrg]) # XORG_MANPAGE_SECTIONS
1219bf2eeab3Smrg
1220576bae58Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1221576bae58Smrg# ------------------------
1222576bae58Smrg# Minimum version: 1.7.0
1223576bae58Smrg#
1224576bae58Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1225576bae58Smrg# provided by xorg-sgml-doctools, if installed.
1226576bae58SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1227576bae58SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1228576bae58SmrgXORG_SGML_PATH=
1229576bae58SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1230576bae58Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1231576bae58Smrg    [m4_ifval([$1],[:],
1232576bae58Smrg        [if test x"$cross_compiling" != x"yes" ; then
1233576bae58Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1234576bae58Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1235576bae58Smrg         fi])
1236576bae58Smrg    ])
1237576bae58Smrg
1238576bae58Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1239576bae58Smrg# the path and the name of the doc stylesheet
1240576bae58Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1241576bae58Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1242576bae58Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1243576bae58Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1244576bae58Smrgelse
1245576bae58Smrg   AC_MSG_RESULT([no])
1246576bae58Smrgfi
1247576bae58Smrg
1248576bae58SmrgAC_SUBST(XORG_SGML_PATH)
1249576bae58SmrgAC_SUBST(STYLESHEET_SRCDIR)
1250576bae58SmrgAC_SUBST(XSL_STYLESHEET)
1251576bae58SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1252576bae58Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1253576bae58Smrg
1254bf2eeab3Smrg# XORG_CHECK_LINUXDOC
1255bf2eeab3Smrg# -------------------
1256bf2eeab3Smrg# Minimum version: 1.0.0
125714c0a534Smrg#
1258bf2eeab3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1259bf2eeab3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1260bf2eeab3Smrg# Whether or not the necessary tools and files are found can be checked
1261bf2eeab3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1262bf2eeab3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1263576bae58SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1264576bae58SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
126514c0a534Smrg
1266bf2eeab3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
126714c0a534Smrg
1268576bae58SmrgAC_MSG_CHECKING([whether to build documentation])
126914c0a534Smrg
1270576bae58Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1271bf2eeab3Smrg   BUILDDOC=yes
1272bf2eeab3Smrgelse
1273bf2eeab3Smrg   BUILDDOC=no
1274bf2eeab3Smrgfi
127514c0a534Smrg
1276bf2eeab3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
127714c0a534Smrg
1278bf2eeab3SmrgAC_MSG_RESULT([$BUILDDOC])
127914c0a534Smrg
1280576bae58SmrgAC_MSG_CHECKING([whether to build pdf documentation])
128114c0a534Smrg
1282576bae58Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1283bf2eeab3Smrg   BUILDPDFDOC=yes
1284bf2eeab3Smrgelse
1285bf2eeab3Smrg   BUILDPDFDOC=no
1286bf2eeab3Smrgfi
128714c0a534Smrg
1288bf2eeab3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
128914c0a534Smrg
1290bf2eeab3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
129114c0a534Smrg
1292576bae58SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1293bf2eeab3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1294bf2eeab3SmrgMAKE_PDF="$PS2PDF"
1295bf2eeab3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
129614c0a534Smrg
1297bf2eeab3SmrgAC_SUBST(MAKE_TEXT)
1298bf2eeab3SmrgAC_SUBST(MAKE_PS)
1299bf2eeab3SmrgAC_SUBST(MAKE_PDF)
1300bf2eeab3SmrgAC_SUBST(MAKE_HTML)
1301bf2eeab3Smrg]) # XORG_CHECK_LINUXDOC
1302bf2eeab3Smrg
1303bf2eeab3Smrg# XORG_CHECK_DOCBOOK
1304bf2eeab3Smrg# -------------------
1305bf2eeab3Smrg# Minimum version: 1.0.0
1306bf2eeab3Smrg#
1307bf2eeab3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1308bf2eeab3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1309bf2eeab3Smrg# indicates whether the necessary tools and files are found and, if set,
1310bf2eeab3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1311bf2eeab3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1312576bae58SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1313576bae58Smrg
1314bf2eeab3SmrgBUILDTXTDOC=no
1315bf2eeab3SmrgBUILDPDFDOC=no
1316bf2eeab3SmrgBUILDPSDOC=no
1317bf2eeab3SmrgBUILDHTMLDOC=no
1318bf2eeab3Smrg
1319bf2eeab3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1320bf2eeab3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1321bf2eeab3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1322bf2eeab3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1323bf2eeab3Smrg
1324576bae58SmrgAC_MSG_CHECKING([whether to build text documentation])
1325576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1326bf2eeab3Smrg   test x$BUILD_TXTDOC != xno; then
1327bf2eeab3Smrg	BUILDTXTDOC=yes
1328bf2eeab3Smrgfi
1329bf2eeab3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1330bf2eeab3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
133114c0a534Smrg
1332576bae58SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1333576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1334bf2eeab3Smrg   test x$BUILD_PDFDOC != xno; then
1335bf2eeab3Smrg	BUILDPDFDOC=yes
133614c0a534Smrgfi
1337bf2eeab3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1338bf2eeab3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
133914c0a534Smrg
1340576bae58SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1341576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1342bf2eeab3Smrg   test x$BUILD_PSDOC != xno; then
1343bf2eeab3Smrg	BUILDPSDOC=yes
1344bf2eeab3Smrgfi
1345bf2eeab3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1346bf2eeab3SmrgAC_MSG_RESULT([$BUILDPSDOC])
134714c0a534Smrg
1348576bae58SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1349576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1350bf2eeab3Smrg   test x$BUILD_HTMLDOC != xno; then
1351bf2eeab3Smrg	BUILDHTMLDOC=yes
1352bf2eeab3Smrgfi
1353bf2eeab3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1354bf2eeab3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
135514c0a534Smrg
1356bf2eeab3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1357bf2eeab3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1358bf2eeab3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1359bf2eeab3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
136014c0a534Smrg
1361bf2eeab3SmrgAC_SUBST(MAKE_TEXT)
1362bf2eeab3SmrgAC_SUBST(MAKE_PS)
1363bf2eeab3SmrgAC_SUBST(MAKE_PDF)
1364bf2eeab3SmrgAC_SUBST(MAKE_HTML)
1365bf2eeab3Smrg]) # XORG_CHECK_DOCBOOK
136614c0a534Smrg
13671a054510Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1368576bae58Smrg# ----------------
1369576bae58Smrg# Minimum version: 1.5.0
13701a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1371576bae58Smrg#
1372576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1373576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1374576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1375576bae58Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
13761a054510Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
13771a054510Smrg# --with-xmlto assumes 'auto'.
1378576bae58Smrg#
1379576bae58Smrg# Interface to module:
1380576bae58Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1381576bae58Smrg# XMLTO:	returns the path of the xmlto program found
1382576bae58Smrg#		returns the path set by the user in the environment
1383576bae58Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1384576bae58Smrg#		'no' user instructs the module not to use xmlto
1385576bae58Smrg#
1386576bae58Smrg# Added in version 1.10.0
1387576bae58Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1388576bae58Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1389576bae58Smrg#
1390576bae58Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1391576bae58Smrg#
1392576bae58SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1393576bae58SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
13941a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1395576bae58SmrgAC_ARG_WITH(xmlto,
1396576bae58Smrg	AS_HELP_STRING([--with-xmlto],
13971a054510Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
13981a054510Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
13991a054510Smrgm4_undefine([_defopt])
1400576bae58Smrg
1401576bae58Smrgif test "x$use_xmlto" = x"auto"; then
1402576bae58Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1403576bae58Smrg   if test "x$XMLTO" = "x"; then
1404576bae58Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1405576bae58Smrg	have_xmlto=no
1406576bae58Smrg   else
1407576bae58Smrg        have_xmlto=yes
1408576bae58Smrg   fi
1409576bae58Smrgelif test "x$use_xmlto" = x"yes" ; then
1410576bae58Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1411576bae58Smrg   if test "x$XMLTO" = "x"; then
1412576bae58Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1413576bae58Smrg   fi
1414576bae58Smrg   have_xmlto=yes
1415576bae58Smrgelif test "x$use_xmlto" = x"no" ; then
1416576bae58Smrg   if test "x$XMLTO" != "x"; then
1417576bae58Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1418576bae58Smrg   fi
1419576bae58Smrg   have_xmlto=no
1420576bae58Smrgelse
1421576bae58Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1422576bae58Smrgfi
1423576bae58Smrg
1424576bae58Smrg# Test for a minimum version of xmlto, if provided.
1425576bae58Smrgm4_ifval([$1],
1426576bae58Smrg[if test "$have_xmlto" = yes; then
1427576bae58Smrg    # scrape the xmlto version
1428576bae58Smrg    AC_MSG_CHECKING([the xmlto version])
1429576bae58Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1430576bae58Smrg    AC_MSG_RESULT([$xmlto_version])
1431576bae58Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1432576bae58Smrg        [if test "x$use_xmlto" = xauto; then
1433576bae58Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1434576bae58Smrg            have_xmlto=no
1435576bae58Smrg        else
1436576bae58Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1437576bae58Smrg        fi])
1438576bae58Smrgfi])
1439576bae58Smrg
1440576bae58Smrg# Test for the ability of xmlto to generate a text target
1441576bae58Smrghave_xmlto_text=no
1442576bae58Smrgcat > conftest.xml << "EOF"
1443576bae58SmrgEOF
1444576bae58SmrgAS_IF([test "$have_xmlto" = yes],
1445576bae58Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1446576bae58Smrg             [have_xmlto_text=yes],
1447576bae58Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1448576bae58Smrgrm -f conftest.xml
1449576bae58SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1450576bae58SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1451576bae58Smrg]) # XORG_WITH_XMLTO
1452576bae58Smrg
14531a054510Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
14541a054510Smrg# --------------------------------------------
14551a054510Smrg# Minimum version: 1.12.0
14561a054510Smrg# Minimum version for optional DEFAULT argument: 1.12.0
14571a054510Smrg#
14581a054510Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
14591a054510Smrg# XML-based language used for the transformation of XML documents.
14601a054510Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
14611a054510Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
14621a054510Smrg# The XSLT processor is often used as a standalone tool for transformations.
14631a054510Smrg# It should not be assumed that this tool is used only to work with documnetation.
14641a054510Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
14651a054510Smrg#
14661a054510Smrg# Interface to module:
14671a054510Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
14681a054510Smrg# XSLTPROC:	 returns the path of the xsltproc program found
14691a054510Smrg#		 returns the path set by the user in the environment
14701a054510Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
14711a054510Smrg#		  'no' user instructs the module not to use xsltproc
14721a054510Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
14731a054510Smrg#
14741a054510Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
14751a054510Smrg#
14761a054510SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
14771a054510SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
14781a054510Smrg# Preserves the interface, should it be implemented later
14791a054510Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
14801a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
14811a054510SmrgAC_ARG_WITH(xsltproc,
14821a054510Smrg	AS_HELP_STRING([--with-xsltproc],
14831a054510Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
14841a054510Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
14851a054510Smrgm4_undefine([_defopt])
14861a054510Smrg
14871a054510Smrgif test "x$use_xsltproc" = x"auto"; then
14881a054510Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
14891a054510Smrg   if test "x$XSLTPROC" = "x"; then
14901a054510Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
14911a054510Smrg	have_xsltproc=no
14921a054510Smrg   else
14931a054510Smrg        have_xsltproc=yes
14941a054510Smrg   fi
14951a054510Smrgelif test "x$use_xsltproc" = x"yes" ; then
14961a054510Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
14971a054510Smrg   if test "x$XSLTPROC" = "x"; then
14981a054510Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
14991a054510Smrg   fi
15001a054510Smrg   have_xsltproc=yes
15011a054510Smrgelif test "x$use_xsltproc" = x"no" ; then
15021a054510Smrg   if test "x$XSLTPROC" != "x"; then
15031a054510Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
15041a054510Smrg   fi
15051a054510Smrg   have_xsltproc=no
15061a054510Smrgelse
15071a054510Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
15081a054510Smrgfi
15091a054510Smrg
15101a054510SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
15111a054510Smrg]) # XORG_WITH_XSLTPROC
15121a054510Smrg
15131a054510Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
15141a054510Smrg# ----------------------------------------
15151a054510Smrg# Minimum version: 1.15.0
15161a054510Smrg#
15171a054510Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
15181a054510Smrg# scanning arbitrary text files, extracting information from those text files,
15191a054510Smrg# and printing reports based on that information.
15201a054510Smrg#
15211a054510Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
15221a054510Smrg#
15231a054510Smrg# Interface to module:
15241a054510Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
15251a054510Smrg# PERL:	     returns the path of the perl program found
15261a054510Smrg#	     returns the path set by the user in the environment
15271a054510Smrg# --with-perl: 'yes' user instructs the module to use perl
15281a054510Smrg#	       'no' user instructs the module not to use perl
15291a054510Smrg# have_perl: returns yes if perl found in PATH or no
15301a054510Smrg#
15311a054510Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
15321a054510Smrg#
15331a054510SmrgAC_DEFUN([XORG_WITH_PERL],[
15341a054510SmrgAC_ARG_VAR([PERL], [Path to perl command])
15351a054510Smrg# Preserves the interface, should it be implemented later
15361a054510Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
15371a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
15381a054510SmrgAC_ARG_WITH(perl,
15391a054510Smrg	AS_HELP_STRING([--with-perl],
15401a054510Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
15411a054510Smrg	   [use_perl=$withval], [use_perl=]_defopt)
15421a054510Smrgm4_undefine([_defopt])
15431a054510Smrg
15441a054510Smrgif test "x$use_perl" = x"auto"; then
15451a054510Smrg   AC_PATH_PROG([PERL], [perl])
15461a054510Smrg   if test "x$PERL" = "x"; then
15471a054510Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
15481a054510Smrg	have_perl=no
15491a054510Smrg   else
15501a054510Smrg        have_perl=yes
15511a054510Smrg   fi
15521a054510Smrgelif test "x$use_perl" = x"yes" ; then
15531a054510Smrg   AC_PATH_PROG([PERL], [perl])
15541a054510Smrg   if test "x$PERL" = "x"; then
15551a054510Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
15561a054510Smrg   fi
15571a054510Smrg   have_perl=yes
15581a054510Smrgelif test "x$use_perl" = x"no" ; then
15591a054510Smrg   if test "x$PERL" != "x"; then
15601a054510Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
15611a054510Smrg   fi
15621a054510Smrg   have_perl=no
15631a054510Smrgelse
15641a054510Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
15651a054510Smrgfi
15661a054510Smrg
15671a054510SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
15681a054510Smrg]) # XORG_WITH_PERL
15691a054510Smrg
15701a054510Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1571576bae58Smrg# ----------------
1572576bae58Smrg# Minimum version: 1.5.0
15731a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1574576bae58Smrg#
1575576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1576576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1577576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1578576bae58Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
15791a054510Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
15801a054510Smrg# --with-asciidoc assumes 'auto'.
1581576bae58Smrg#
1582576bae58Smrg# Interface to module:
1583576bae58Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1584576bae58Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1585576bae58Smrg#		 returns the path set by the user in the environment
1586576bae58Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1587576bae58Smrg#		  'no' user instructs the module not to use asciidoc
1588576bae58Smrg#
1589576bae58Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1590576bae58Smrg#
1591576bae58SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1592576bae58SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
15931a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1594576bae58SmrgAC_ARG_WITH(asciidoc,
1595576bae58Smrg	AS_HELP_STRING([--with-asciidoc],
15961a054510Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
15971a054510Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
15981a054510Smrgm4_undefine([_defopt])
1599576bae58Smrg
1600576bae58Smrgif test "x$use_asciidoc" = x"auto"; then
1601576bae58Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1602576bae58Smrg   if test "x$ASCIIDOC" = "x"; then
1603576bae58Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1604576bae58Smrg	have_asciidoc=no
1605576bae58Smrg   else
1606576bae58Smrg        have_asciidoc=yes
1607576bae58Smrg   fi
1608576bae58Smrgelif test "x$use_asciidoc" = x"yes" ; then
1609576bae58Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1610576bae58Smrg   if test "x$ASCIIDOC" = "x"; then
1611576bae58Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1612576bae58Smrg   fi
1613576bae58Smrg   have_asciidoc=yes
1614576bae58Smrgelif test "x$use_asciidoc" = x"no" ; then
1615576bae58Smrg   if test "x$ASCIIDOC" != "x"; then
1616576bae58Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1617576bae58Smrg   fi
1618576bae58Smrg   have_asciidoc=no
1619576bae58Smrgelse
1620576bae58Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1621576bae58Smrgfi
1622576bae58Smrgm4_ifval([$1],
1623576bae58Smrg[if test "$have_asciidoc" = yes; then
1624576bae58Smrg    # scrape the asciidoc version
1625576bae58Smrg    AC_MSG_CHECKING([the asciidoc version])
1626576bae58Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1627576bae58Smrg    AC_MSG_RESULT([$asciidoc_version])
1628576bae58Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1629576bae58Smrg        [if test "x$use_asciidoc" = xauto; then
1630576bae58Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1631576bae58Smrg            have_asciidoc=no
1632576bae58Smrg        else
1633576bae58Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1634576bae58Smrg        fi])
1635576bae58Smrgfi])
1636576bae58SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1637576bae58Smrg]) # XORG_WITH_ASCIIDOC
1638576bae58Smrg
16391a054510Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1640576bae58Smrg# --------------------------------
1641576bae58Smrg# Minimum version: 1.5.0
16421a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1643576bae58Smrg#
1644576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1645576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1646576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1647576bae58Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
16481a054510Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
16491a054510Smrg# --with-doxygen assumes 'auto'.
1650576bae58Smrg#
1651576bae58Smrg# Interface to module:
1652576bae58Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1653576bae58Smrg# DOXYGEN:	 returns the path of the doxygen program found
1654576bae58Smrg#		 returns the path set by the user in the environment
1655576bae58Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1656576bae58Smrg#		  'no' user instructs the module not to use doxygen
1657576bae58Smrg#
1658576bae58Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1659576bae58Smrg#
1660576bae58SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1661576bae58SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
16621a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1663576bae58SmrgAC_ARG_WITH(doxygen,
1664576bae58Smrg	AS_HELP_STRING([--with-doxygen],
16651a054510Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
16661a054510Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
16671a054510Smrgm4_undefine([_defopt])
1668576bae58Smrg
1669576bae58Smrgif test "x$use_doxygen" = x"auto"; then
1670576bae58Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1671576bae58Smrg   if test "x$DOXYGEN" = "x"; then
1672576bae58Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1673576bae58Smrg	have_doxygen=no
1674576bae58Smrg   else
1675576bae58Smrg        have_doxygen=yes
1676576bae58Smrg   fi
1677576bae58Smrgelif test "x$use_doxygen" = x"yes" ; then
1678576bae58Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1679576bae58Smrg   if test "x$DOXYGEN" = "x"; then
1680576bae58Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1681576bae58Smrg   fi
1682576bae58Smrg   have_doxygen=yes
1683576bae58Smrgelif test "x$use_doxygen" = x"no" ; then
1684576bae58Smrg   if test "x$DOXYGEN" != "x"; then
1685576bae58Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1686576bae58Smrg   fi
1687576bae58Smrg   have_doxygen=no
1688576bae58Smrgelse
1689576bae58Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1690576bae58Smrgfi
1691576bae58Smrgm4_ifval([$1],
1692576bae58Smrg[if test "$have_doxygen" = yes; then
1693576bae58Smrg    # scrape the doxygen version
1694576bae58Smrg    AC_MSG_CHECKING([the doxygen version])
1695576bae58Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1696576bae58Smrg    AC_MSG_RESULT([$doxygen_version])
1697576bae58Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1698576bae58Smrg        [if test "x$use_doxygen" = xauto; then
1699576bae58Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1700576bae58Smrg            have_doxygen=no
1701576bae58Smrg        else
1702576bae58Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1703576bae58Smrg        fi])
1704576bae58Smrgfi])
1705576bae58SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1706576bae58Smrg]) # XORG_WITH_DOXYGEN
1707576bae58Smrg
17081a054510Smrg# XORG_WITH_GROFF([DEFAULT])
1709576bae58Smrg# ----------------
1710576bae58Smrg# Minimum version: 1.6.0
17111a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1712576bae58Smrg#
1713576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1714576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1715576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1716576bae58Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
17171a054510Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
17181a054510Smrg# --with-groff assumes 'auto'.
1719576bae58Smrg#
1720576bae58Smrg# Interface to module:
1721576bae58Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1722576bae58Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1723576bae58Smrg# HAVE_GROFF_MS: the -ms macros package
1724576bae58Smrg# GROFF:	 returns the path of the groff program found
1725576bae58Smrg#		 returns the path set by the user in the environment
1726576bae58Smrg# --with-groff:	 'yes' user instructs the module to use groff
1727576bae58Smrg#		 'no' user instructs the module not to use groff
1728576bae58Smrg#
1729576bae58Smrg# Added in version 1.9.0:
1730576bae58Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1731576bae58Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1732576bae58Smrg#		   psselect from the psutils package.
1733576bae58Smrg#		   the ghostcript package. Refer to the grohtml man pages
1734576bae58Smrg#
1735576bae58Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1736576bae58Smrg#
1737576bae58Smrg# OS and distros often splits groff in a basic and full package, the former
1738576bae58Smrg# having the groff program and the later having devices, fonts and macros
1739576bae58Smrg# Checking for the groff executable is not enough.
1740576bae58Smrg#
1741576bae58Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1742576bae58Smrg# unset HAVE_GROFF or GROFF env variables.
1743576bae58Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1744576bae58Smrg#
1745576bae58SmrgAC_DEFUN([XORG_WITH_GROFF],[
1746576bae58SmrgAC_ARG_VAR([GROFF], [Path to groff command])
17471a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
1748576bae58SmrgAC_ARG_WITH(groff,
1749576bae58Smrg	AS_HELP_STRING([--with-groff],
17501a054510Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
17511a054510Smrg	   [use_groff=$withval], [use_groff=]_defopt)
17521a054510Smrgm4_undefine([_defopt])
1753576bae58Smrg
1754576bae58Smrgif test "x$use_groff" = x"auto"; then
1755576bae58Smrg   AC_PATH_PROG([GROFF], [groff])
1756576bae58Smrg   if test "x$GROFF" = "x"; then
1757576bae58Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1758576bae58Smrg	have_groff=no
1759576bae58Smrg   else
1760576bae58Smrg        have_groff=yes
1761576bae58Smrg   fi
1762576bae58Smrgelif test "x$use_groff" = x"yes" ; then
1763576bae58Smrg   AC_PATH_PROG([GROFF], [groff])
1764576bae58Smrg   if test "x$GROFF" = "x"; then
1765576bae58Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1766576bae58Smrg   fi
1767576bae58Smrg   have_groff=yes
1768576bae58Smrgelif test "x$use_groff" = x"no" ; then
1769576bae58Smrg   if test "x$GROFF" != "x"; then
1770576bae58Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1771576bae58Smrg   fi
1772576bae58Smrg   have_groff=no
1773576bae58Smrgelse
1774576bae58Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1775576bae58Smrgfi
1776576bae58Smrg
1777576bae58Smrg# We have groff, test for the presence of the macro packages
1778576bae58Smrgif test "x$have_groff" = x"yes"; then
1779576bae58Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1780576bae58Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1781576bae58Smrg        groff_ms_works=yes
1782576bae58Smrg    else
1783576bae58Smrg        groff_ms_works=no
1784576bae58Smrg    fi
1785576bae58Smrg    AC_MSG_RESULT([$groff_ms_works])
1786576bae58Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1787576bae58Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1788576bae58Smrg        groff_mm_works=yes
1789576bae58Smrg    else
1790576bae58Smrg        groff_mm_works=no
1791576bae58Smrg    fi
1792576bae58Smrg    AC_MSG_RESULT([$groff_mm_works])
1793576bae58Smrgfi
1794576bae58Smrg
1795576bae58Smrg# We have groff, test for HTML dependencies, one command per package
1796576bae58Smrgif test "x$have_groff" = x"yes"; then
1797576bae58Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1798576bae58Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1799576bae58Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1800576bae58Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1801576bae58Smrg      have_groff_html=yes
1802576bae58Smrg   else
1803576bae58Smrg      have_groff_html=no
1804576bae58Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1805576bae58Smrg   fi
1806576bae58Smrgfi
1807576bae58Smrg
1808576bae58Smrg# Set Automake conditionals for Makefiles
1809576bae58SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1810576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1811576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1812576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1813576bae58Smrg]) # XORG_WITH_GROFF
1814576bae58Smrg
18151a054510Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
18161a054510Smrg# ---------------------------------------
1817576bae58Smrg# Minimum version: 1.6.0
18181a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18191a054510Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1820576bae58Smrg#
1821576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1822576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1823576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1824576bae58Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
18251a054510Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
18261a054510Smrg# --with-fop assumes 'auto'.
1827576bae58Smrg#
1828576bae58Smrg# Interface to module:
1829576bae58Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1830576bae58Smrg# FOP:	 	returns the path of the fop program found
1831576bae58Smrg#		returns the path set by the user in the environment
1832576bae58Smrg# --with-fop: 	'yes' user instructs the module to use fop
1833576bae58Smrg#		'no' user instructs the module not to use fop
1834576bae58Smrg#
1835576bae58Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1836576bae58Smrg#
1837576bae58SmrgAC_DEFUN([XORG_WITH_FOP],[
1838576bae58SmrgAC_ARG_VAR([FOP], [Path to fop command])
18391a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1840576bae58SmrgAC_ARG_WITH(fop,
1841576bae58Smrg	AS_HELP_STRING([--with-fop],
18421a054510Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
18431a054510Smrg	   [use_fop=$withval], [use_fop=]_defopt)
18441a054510Smrgm4_undefine([_defopt])
1845576bae58Smrg
1846576bae58Smrgif test "x$use_fop" = x"auto"; then
1847576bae58Smrg   AC_PATH_PROG([FOP], [fop])
1848576bae58Smrg   if test "x$FOP" = "x"; then
1849576bae58Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1850576bae58Smrg	have_fop=no
1851576bae58Smrg   else
1852576bae58Smrg        have_fop=yes
1853576bae58Smrg   fi
1854576bae58Smrgelif test "x$use_fop" = x"yes" ; then
1855576bae58Smrg   AC_PATH_PROG([FOP], [fop])
1856576bae58Smrg   if test "x$FOP" = "x"; then
1857576bae58Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1858576bae58Smrg   fi
1859576bae58Smrg   have_fop=yes
1860576bae58Smrgelif test "x$use_fop" = x"no" ; then
1861576bae58Smrg   if test "x$FOP" != "x"; then
1862576bae58Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1863576bae58Smrg   fi
1864576bae58Smrg   have_fop=no
1865576bae58Smrgelse
1866576bae58Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1867576bae58Smrgfi
18681a054510Smrg
18691a054510Smrg# Test for a minimum version of fop, if provided.
18701a054510Smrgm4_ifval([$1],
18711a054510Smrg[if test "$have_fop" = yes; then
18721a054510Smrg    # scrape the fop version
18731a054510Smrg    AC_MSG_CHECKING([for fop minimum version])
18741a054510Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
18751a054510Smrg    AC_MSG_RESULT([$fop_version])
18761a054510Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
18771a054510Smrg        [if test "x$use_fop" = xauto; then
18781a054510Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
18791a054510Smrg            have_fop=no
18801a054510Smrg        else
18811a054510Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
18821a054510Smrg        fi])
18831a054510Smrgfi])
1884576bae58SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1885576bae58Smrg]) # XORG_WITH_FOP
1886576bae58Smrg
18871a054510Smrg# XORG_WITH_PS2PDF([DEFAULT])
1888576bae58Smrg# ----------------
1889576bae58Smrg# Minimum version: 1.6.0
18901a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1891576bae58Smrg#
1892576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1893576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1894576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1895576bae58Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
18961a054510Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
18971a054510Smrg# --with-ps2pdf assumes 'auto'.
1898576bae58Smrg#
1899576bae58Smrg# Interface to module:
1900576bae58Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1901576bae58Smrg# PS2PDF:	returns the path of the ps2pdf program found
1902576bae58Smrg#		returns the path set by the user in the environment
1903576bae58Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1904576bae58Smrg#		 'no' user instructs the module not to use ps2pdf
1905576bae58Smrg#
1906576bae58Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1907576bae58Smrg#
1908576bae58SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1909576bae58SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
19101a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
1911576bae58SmrgAC_ARG_WITH(ps2pdf,
1912576bae58Smrg	AS_HELP_STRING([--with-ps2pdf],
19131a054510Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
19141a054510Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
19151a054510Smrgm4_undefine([_defopt])
1916576bae58Smrg
1917576bae58Smrgif test "x$use_ps2pdf" = x"auto"; then
1918576bae58Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1919576bae58Smrg   if test "x$PS2PDF" = "x"; then
1920576bae58Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1921576bae58Smrg	have_ps2pdf=no
1922576bae58Smrg   else
1923576bae58Smrg        have_ps2pdf=yes
1924576bae58Smrg   fi
1925576bae58Smrgelif test "x$use_ps2pdf" = x"yes" ; then
1926576bae58Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1927576bae58Smrg   if test "x$PS2PDF" = "x"; then
1928576bae58Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1929576bae58Smrg   fi
1930576bae58Smrg   have_ps2pdf=yes
1931576bae58Smrgelif test "x$use_ps2pdf" = x"no" ; then
1932576bae58Smrg   if test "x$PS2PDF" != "x"; then
1933576bae58Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1934576bae58Smrg   fi
1935576bae58Smrg   have_ps2pdf=no
1936576bae58Smrgelse
1937576bae58Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1938576bae58Smrgfi
1939576bae58SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1940576bae58Smrg]) # XORG_WITH_PS2PDF
1941576bae58Smrg
1942576bae58Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
1943576bae58Smrg# ----------------
1944576bae58Smrg# Minimum version: 1.6.0
1945576bae58Smrg#
1946576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1947576bae58Smrg# not at the appropriate level. This macro enables a builder to skip all
1948576bae58Smrg# documentation targets except traditional man pages.
1949576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1950576bae58Smrg# maximum flexibilty in controlling documentation building.
1951576bae58Smrg# Refer to:
1952576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
1953576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1954576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1955576bae58Smrg# XORG_WITH_FOP           --with-fop
1956576bae58Smrg# XORG_WITH_GROFF         --with-groff
1957576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1958576bae58Smrg#
1959576bae58Smrg# Interface to module:
1960576bae58Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1961576bae58Smrg# --enable-docs: 'yes' user instructs the module to generate docs
1962576bae58Smrg#		 'no' user instructs the module not to generate docs
1963576bae58Smrg# parm1:	specify the default value, yes or no.
1964576bae58Smrg#
1965576bae58SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
19661a054510Smrgm4_define([docs_default], m4_default([$1], [yes]))
1967576bae58SmrgAC_ARG_ENABLE(docs,
1968576bae58Smrg	AS_HELP_STRING([--enable-docs],
19691a054510Smrg	   [Enable building the documentation (default: ]docs_default[)]),
19701a054510Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
19711a054510Smrgm4_undefine([docs_default])
1972576bae58SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1973576bae58SmrgAC_MSG_CHECKING([whether to build documentation])
1974576bae58SmrgAC_MSG_RESULT([$build_docs])
1975576bae58Smrg]) # XORG_ENABLE_DOCS
1976576bae58Smrg
1977576bae58Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1978576bae58Smrg# ----------------
1979576bae58Smrg# Minimum version: 1.6.0
1980576bae58Smrg#
1981576bae58Smrg# This macro enables a builder to skip all developer documentation.
1982576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1983576bae58Smrg# maximum flexibilty in controlling documentation building.
1984576bae58Smrg# Refer to:
1985576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
1986576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1987576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1988576bae58Smrg# XORG_WITH_FOP           --with-fop
1989576bae58Smrg# XORG_WITH_GROFF         --with-groff
1990576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1991576bae58Smrg#
1992576bae58Smrg# Interface to module:
1993576bae58Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1994576bae58Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1995576bae58Smrg#			'no' user instructs the module not to generate developer docs
1996576bae58Smrg# parm1:		specify the default value, yes or no.
1997576bae58Smrg#
1998576bae58SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
19991a054510Smrgm4_define([devel_default], m4_default([$1], [yes]))
2000576bae58SmrgAC_ARG_ENABLE(devel-docs,
2001576bae58Smrg	AS_HELP_STRING([--enable-devel-docs],
20021a054510Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
20031a054510Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
20041a054510Smrgm4_undefine([devel_default])
2005576bae58SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2006576bae58SmrgAC_MSG_CHECKING([whether to build developer documentation])
2007576bae58SmrgAC_MSG_RESULT([$build_devel_docs])
2008576bae58Smrg]) # XORG_ENABLE_DEVEL_DOCS
2009576bae58Smrg
2010576bae58Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2011576bae58Smrg# ----------------
2012576bae58Smrg# Minimum version: 1.6.0
2013576bae58Smrg#
2014576bae58Smrg# This macro enables a builder to skip all functional specification targets.
2015576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2016576bae58Smrg# maximum flexibilty in controlling documentation building.
2017576bae58Smrg# Refer to:
2018576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2019576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2020576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2021576bae58Smrg# XORG_WITH_FOP           --with-fop
2022576bae58Smrg# XORG_WITH_GROFF         --with-groff
2023576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2024576bae58Smrg#
2025576bae58Smrg# Interface to module:
2026576bae58Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2027576bae58Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2028576bae58Smrg#			'no' user instructs the module not to generate specs
2029576bae58Smrg# parm1:		specify the default value, yes or no.
2030576bae58Smrg#
2031576bae58SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
20321a054510Smrgm4_define([spec_default], m4_default([$1], [yes]))
2033576bae58SmrgAC_ARG_ENABLE(specs,
2034576bae58Smrg	AS_HELP_STRING([--enable-specs],
20351a054510Smrg	   [Enable building the specs (default: ]spec_default[)]),
20361a054510Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
20371a054510Smrgm4_undefine([spec_default])
2038576bae58SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2039576bae58SmrgAC_MSG_CHECKING([whether to build functional specifications])
2040576bae58SmrgAC_MSG_RESULT([$build_specs])
2041576bae58Smrg]) # XORG_ENABLE_SPECS
2042576bae58Smrg
20431a054510Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
20441a054510Smrg# ----------------------------------------------
20451a054510Smrg# Minimum version: 1.13.0
20461a054510Smrg#
20471a054510Smrg# This macro enables a builder to enable/disable unit testing
20481a054510Smrg# It makes no assumption about the test cases implementation
20491a054510Smrg# Test cases may or may not use Automake "Support for test suites"
20501a054510Smrg# They may or may not use the software utility library GLib
20511a054510Smrg#
20521a054510Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
20531a054510Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
20541a054510Smrg# The variable enable_unit_tests is used by other macros in this file.
20551a054510Smrg#
20561a054510Smrg# Interface to module:
20571a054510Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
20581a054510Smrg# enable_unit_tests:    used in configure.ac for additional configuration
20591a054510Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
20601a054510Smrg#			'no' user instructs the module not to build tests
20611a054510Smrg# parm1:		specify the default value, yes or no.
20621a054510Smrg#
20631a054510SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
20641a054510SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
20651a054510SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
20661a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
20671a054510SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
20681a054510Smrg	[Enable building unit test cases (default: ]_defopt[)]),
20691a054510Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
20701a054510Smrgm4_undefine([_defopt])
20711a054510SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
20721a054510SmrgAC_MSG_CHECKING([whether to build unit test cases])
20731a054510SmrgAC_MSG_RESULT([$enable_unit_tests])
20741a054510Smrg]) # XORG_ENABLE_UNIT_TESTS
20751a054510Smrg
20761a054510Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
20771a054510Smrg# ----------------------------------------
20781a054510Smrg# Minimum version: 1.13.0
20791a054510Smrg#
20801a054510Smrg# GLib is a library which provides advanced data structures and functions.
20811a054510Smrg# This macro enables a module to test for the presence of Glib.
20821a054510Smrg#
20831a054510Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
20841a054510Smrg# Otherwise the value of $enable_unit_tests is blank.
20851a054510Smrg#
20861a054510Smrg# Interface to module:
20871a054510Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
20881a054510Smrg# with_glib: used in configure.ac to know if GLib has been found
20891a054510Smrg# --with-glib:	'yes' user instructs the module to use glib
20901a054510Smrg#		'no' user instructs the module not to use glib
20911a054510Smrg#
20921a054510SmrgAC_DEFUN([XORG_WITH_GLIB],[
20931a054510SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
20941a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
20951a054510SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
20961a054510Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
20971a054510Smrg	[with_glib=$withval], [with_glib=]_defopt)
20981a054510Smrgm4_undefine([_defopt])
20991a054510Smrg
21001a054510Smrghave_glib=no
21011a054510Smrg# Do not probe GLib if user explicitly disabled unit testing
21021a054510Smrgif test "x$enable_unit_tests" != x"no"; then
21031a054510Smrg  # Do not probe GLib if user explicitly disabled it
21041a054510Smrg  if test "x$with_glib" != x"no"; then
21051a054510Smrg    m4_ifval(
21061a054510Smrg      [$1],
21071a054510Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
21081a054510Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
21091a054510Smrg    )
21101a054510Smrg  fi
21111a054510Smrgfi
21121a054510Smrg
21131a054510Smrg# Not having GLib when unit testing has been explicitly requested is an error
21141a054510Smrgif test "x$enable_unit_tests" = x"yes"; then
21151a054510Smrg  if test "x$have_glib" = x"no"; then
21161a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
21171a054510Smrg  fi
21181a054510Smrgfi
21191a054510Smrg
21201a054510Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
21211a054510Smrgif test "x$enable_unit_tests" = x"no"; then
21221a054510Smrg  if test "x$with_glib" = x"yes"; then
21231a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
21241a054510Smrg  fi
21251a054510Smrgfi
21261a054510Smrg
21271a054510Smrg# Not having GLib when it has been explicitly requested is an error
21281a054510Smrgif test "x$with_glib" = x"yes"; then
21291a054510Smrg  if test "x$have_glib" = x"no"; then
21301a054510Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
21311a054510Smrg  fi
21321a054510Smrgfi
21331a054510Smrg
21341a054510SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
21351a054510Smrg]) # XORG_WITH_GLIB
21361a054510Smrg
21371a054510Smrg# XORG_LD_WRAP
21381a054510Smrg# ------------
21391a054510Smrg# Minimum version: 1.13.0
21401a054510Smrg#
21411a054510Smrg# Check if linker supports -wrap, passed via compiler flags
21421a054510Smrg#
21431a054510Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
21441a054510Smrg# Otherwise the value of $enable_unit_tests is blank.
21451a054510Smrg#
21461a054510SmrgAC_DEFUN([XORG_LD_WRAP],[
21471a054510SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
21481a054510Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
21491a054510Smrgif test "x$enable_unit_tests" = x"yes"; then
21501a054510Smrg  if test "x$have_ld_wrap" = x"no"; then
21511a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
21521a054510Smrg  fi
21531a054510Smrgfi
21541a054510SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
21551a054510Smrg#
21561a054510Smrg]) # XORG_LD_WRAP
21571a054510Smrg
21581a054510Smrg# XORG_CHECK_LINKER_FLAGS
21591a054510Smrg# -----------------------
21601a054510Smrg# SYNOPSIS
21611a054510Smrg#
21621a054510Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
21631a054510Smrg#
21641a054510Smrg# DESCRIPTION
21651a054510Smrg#
21661a054510Smrg#   Check whether the given linker FLAGS work with the current language's
21671a054510Smrg#   linker, or whether they give an error.
21681a054510Smrg#
21691a054510Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
21701a054510Smrg#   success/failure.
21711a054510Smrg#
21721a054510Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
21731a054510Smrg#
21741a054510Smrg# LICENSE
21751a054510Smrg#
21761a054510Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
21771a054510Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
21781a054510Smrg#   Copyright (c) 2009 Matteo Frigo
21791a054510Smrg#
21801a054510Smrg#   This program is free software: you can redistribute it and/or modify it
21811a054510Smrg#   under the terms of the GNU General Public License as published by the
21821a054510Smrg#   Free Software Foundation, either version 3 of the License, or (at your
21831a054510Smrg#   option) any later version.
21841a054510Smrg#
21851a054510Smrg#   This program is distributed in the hope that it will be useful, but
21861a054510Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
21871a054510Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
21881a054510Smrg#   Public License for more details.
21891a054510Smrg#
21901a054510Smrg#   You should have received a copy of the GNU General Public License along
21911a054510Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
21921a054510Smrg#
21931a054510Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
21941a054510Smrg#   gives unlimited permission to copy, distribute and modify the configure
21951a054510Smrg#   scripts that are the output of Autoconf when processing the Macro. You
21961a054510Smrg#   need not follow the terms of the GNU General Public License when using
21971a054510Smrg#   or distributing such scripts, even though portions of the text of the
21981a054510Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
21991a054510Smrg#   all other use of the material that constitutes the Autoconf Macro.
22001a054510Smrg#
22011a054510Smrg#   This special exception to the GPL applies to versions of the Autoconf
22021a054510Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
22031a054510Smrg#   modified version of the Autoconf Macro, you may extend this special
22041a054510Smrg#   exception to the GPL to apply to your modified version as well.#
22051a054510SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
22061a054510Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
22071a054510Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
22081a054510SmrgAS_LITERAL_IF([$1],
22091a054510Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
22101a054510Smrg      ax_save_FLAGS=$LDFLAGS
22111a054510Smrg      LDFLAGS="$1"
22121a054510Smrg      AC_LINK_IFELSE([AC_LANG_PROGRAM()],
22131a054510Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
22141a054510Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
22151a054510Smrg      LDFLAGS=$ax_save_FLAGS])],
22161a054510Smrg  [ax_save_FLAGS=$LDFLAGS
22171a054510Smrg   LDFLAGS="$1"
22181a054510Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
22191a054510Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
22201a054510Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
22211a054510Smrg   LDFLAGS=$ax_save_FLAGS])
22221a054510Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
22231a054510SmrgAC_MSG_RESULT($xorg_check_linker_flags)
22241a054510Smrgif test "x$xorg_check_linker_flags" = xyes; then
22251a054510Smrg	m4_default([$2], :)
22261a054510Smrgelse
22271a054510Smrg	m4_default([$3], :)
22281a054510Smrgfi
22291a054510Smrg]) # XORG_CHECK_LINKER_FLAGS
22301a054510Smrg
2231bf2eeab3Smrg# XORG_CHECK_MALLOC_ZERO
2232bf2eeab3Smrg# ----------------------
2233bf2eeab3Smrg# Minimum version: 1.0.0
2234bf2eeab3Smrg#
2235bf2eeab3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2236bf2eeab3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2237bf2eeab3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2238bf2eeab3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2239bf2eeab3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2240bf2eeab3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2241bf2eeab3Smrg		       [malloc(0) returns NULL (default: auto)]),
2242bf2eeab3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2243bf2eeab3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
224414c0a534Smrg
2245bf2eeab3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2246bf2eeab3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
22471a054510Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
22481a054510Smrg#include <stdlib.h>
22491a054510Smrg],[
2250bf2eeab3Smrg    char *m0, *r0, *c0, *p;
2251bf2eeab3Smrg    m0 = malloc(0);
2252bf2eeab3Smrg    p = malloc(10);
2253bf2eeab3Smrg    r0 = realloc(p,0);
22541a054510Smrg    c0 = calloc(0,10);
22551a054510Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
22561a054510Smrg])],
2257bf2eeab3Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2258576bae58Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2259576bae58Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2260bf2eeab3Smrgfi
2261bf2eeab3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
226214c0a534Smrg
2263bf2eeab3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2264bf2eeab3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2265bf2eeab3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2266bf2eeab3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2267bf2eeab3Smrgelse
2268bf2eeab3Smrg	MALLOC_ZERO_CFLAGS=""
2269bf2eeab3Smrg	XMALLOC_ZERO_CFLAGS=""
2270bf2eeab3Smrg	XTMALLOC_ZERO_CFLAGS=""
2271bf2eeab3Smrgfi
227214c0a534Smrg
2273bf2eeab3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2274bf2eeab3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2275bf2eeab3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2276bf2eeab3Smrg]) # XORG_CHECK_MALLOC_ZERO
227714c0a534Smrg
2278bf2eeab3Smrg# XORG_WITH_LINT()
2279bf2eeab3Smrg# ----------------
2280bf2eeab3Smrg# Minimum version: 1.1.0
228114c0a534Smrg#
2282576bae58Smrg# This macro enables the use of a tool that flags some suspicious and
2283576bae58Smrg# non-portable constructs (likely to be bugs) in C language source code.
2284576bae58Smrg# It will attempt to locate the tool and use appropriate options.
2285576bae58Smrg# There are various lint type tools on different platforms.
2286576bae58Smrg#
2287576bae58Smrg# Interface to module:
2288576bae58Smrg# LINT:		returns the path to the tool found on the platform
2289576bae58Smrg#		or the value set to LINT on the configure cmd line
2290576bae58Smrg#		also an Automake conditional
2291576bae58Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2292576bae58Smrg#
2293576bae58Smrg# --with-lint:	'yes' user instructs the module to use lint
2294576bae58Smrg#		'no' user instructs the module not to use lint (default)
2295576bae58Smrg#
2296576bae58Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2297576bae58Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2298bf2eeab3Smrg#
2299bf2eeab3SmrgAC_DEFUN([XORG_WITH_LINT],[
2300bf2eeab3Smrg
2301576bae58SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2302576bae58SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2303bf2eeab3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2304bf2eeab3Smrg		[Use a lint-style source code checker (default: disabled)])],
2305bf2eeab3Smrg		[use_lint=$withval], [use_lint=no])
2306576bae58Smrg
2307576bae58Smrg# Obtain platform specific info like program name and options
2308576bae58Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2309576bae58Smrgcase $host_os in
2310576bae58Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2311576bae58Smrg	lint_name=splint
2312576bae58Smrg	lint_options="-badflag"
2313576bae58Smrg	;;
2314576bae58Smrg  *freebsd* | *netbsd*)
2315576bae58Smrg	lint_name=lint
2316576bae58Smrg	lint_options="-u -b"
2317576bae58Smrg	;;
2318576bae58Smrg  *solaris*)
2319576bae58Smrg	lint_name=lint
2320576bae58Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2321576bae58Smrg	;;
2322576bae58Smrgesac
2323576bae58Smrg
2324576bae58Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2325576bae58Smrgif test "x$use_lint" = x"yes" ; then
2326576bae58Smrg   AC_PATH_PROG([LINT], [$lint_name])
2327576bae58Smrg   if test "x$LINT" = "x"; then
2328576bae58Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2329576bae58Smrg   fi
2330576bae58Smrgelif test "x$use_lint" = x"no" ; then
2331576bae58Smrg   if test "x$LINT" != "x"; then
2332576bae58Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2333576bae58Smrg   fi
233414c0a534Smrgelse
2335576bae58Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2336bf2eeab3Smrgfi
2337576bae58Smrg
2338576bae58Smrg# User supplied flags override default flags
2339576bae58Smrgif test "x$LINT_FLAGS" != "x"; then
2340576bae58Smrg   lint_options=$LINT_FLAGS
234114c0a534Smrgfi
234214c0a534Smrg
2343576bae58SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2344576bae58SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
234514c0a534Smrg
2346bf2eeab3Smrg]) # XORG_WITH_LINT
234714c0a534Smrg
2348bf2eeab3Smrg# XORG_LINT_LIBRARY(LIBNAME)
2349bf2eeab3Smrg# --------------------------
2350bf2eeab3Smrg# Minimum version: 1.1.0
2351bf2eeab3Smrg#
2352bf2eeab3Smrg# Sets up flags for building lint libraries for checking programs that call
2353bf2eeab3Smrg# functions in the library.
2354bf2eeab3Smrg#
2355576bae58Smrg# Interface to module:
2356576bae58Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2357576bae58Smrg# MAKE_LINT_LIB		- Automake conditional
2358576bae58Smrg#
2359576bae58Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2360576bae58Smrg#			  - 'no' user instructs the module not to create a lint library (default)
236114c0a534Smrg
2362bf2eeab3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2363bf2eeab3SmrgAC_REQUIRE([XORG_WITH_LINT])
2364bf2eeab3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2365bf2eeab3Smrg	[Create lint library (default: disabled)])],
2366bf2eeab3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2367576bae58Smrg
2368576bae58Smrgif test "x$make_lint_lib" = x"yes" ; then
2369576bae58Smrg   LINTLIB=llib-l$1.ln
2370576bae58Smrg   if test "x$LINT" = "x"; then
2371576bae58Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2372576bae58Smrg   fi
2373576bae58Smrgelif test "x$make_lint_lib" != x"no" ; then
2374576bae58Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2375bf2eeab3Smrgfi
2376576bae58Smrg
2377bf2eeab3SmrgAC_SUBST(LINTLIB)
2378bf2eeab3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
237914c0a534Smrg
2380bf2eeab3Smrg]) # XORG_LINT_LIBRARY
238114c0a534Smrg
23821a054510Smrg# XORG_COMPILER_BRAND
23831a054510Smrg# -------------------
23841a054510Smrg# Minimum version: 1.14.0
23851a054510Smrg#
23861a054510Smrg# Checks for various brands of compilers and sets flags as appropriate:
23871a054510Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
23881a054510Smrg#   clang compiler - sets CLANGCC to "yes"
23891a054510Smrg#   Intel compiler - sets INTELCC to "yes"
23901a054510Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
23911a054510Smrg#
23921a054510SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
23931a054510SmrgAC_REQUIRE([AC_PROG_CC_C99])
23941a054510SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
23951a054510SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
23961a054510SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
23971a054510Smrg]) # XORG_COMPILER_BRAND
23981a054510Smrg
2399bf2eeab3Smrg# XORG_CWARNFLAGS
2400bf2eeab3Smrg# ---------------
2401bf2eeab3Smrg# Minimum version: 1.2.0
2402bf2eeab3Smrg#
2403bf2eeab3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2404bf2eeab3Smrg#
2405bf2eeab3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2406576bae58SmrgAC_REQUIRE([AC_PROG_CC_C99])
24071a054510SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2408bf2eeab3Smrgif  test "x$GCC" = xyes ; then
2409bf2eeab3Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
2410bf2eeab3Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
2411576bae58Smrg-Wbad-function-cast -Wformat=2"
2412bf2eeab3Smrg    case `$CC -dumpversion` in
2413bf2eeab3Smrg    3.4.* | 4.*)
2414bf2eeab3Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
2415bf2eeab3Smrg	;;
2416bf2eeab3Smrg    esac
2417bf2eeab3Smrgelse
2418bf2eeab3Smrg    if test "x$SUNCC" = "xyes"; then
2419bf2eeab3Smrg	CWARNFLAGS="-v"
2420bf2eeab3Smrg    fi
2421bf2eeab3Smrgfi
2422bf2eeab3SmrgAC_SUBST(CWARNFLAGS)
2423bf2eeab3Smrg]) # XORG_CWARNFLAGS
242414c0a534Smrg
2425bf2eeab3Smrg# XORG_STRICT_OPTION
2426bf2eeab3Smrg# -----------------------
2427bf2eeab3Smrg# Minimum version: 1.3.0
242814c0a534Smrg#
24291a054510Smrg# Add configure option to enable strict compilation flags, such as treating
24301a054510Smrg# warnings as fatal errors.
24311a054510Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
24321a054510Smrg# $CWARNFLAGS.
24331a054510Smrg#
24341a054510Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
24351a054510Smrg# when strict compilation is unconditionally desired.
2436bf2eeab3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2437576bae58Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
2438bf2eeab3SmrgAC_REQUIRE([AC_PROG_CC_C99])
24391a054510SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2440bf2eeab3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2441bf2eeab3Smrg
2442bf2eeab3SmrgAC_ARG_ENABLE(strict-compilation,
2443bf2eeab3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2444bf2eeab3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2445bf2eeab3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
24461a054510Smrgif test "x$GCC" = xyes ; then
24471a054510Smrg    STRICT_CFLAGS="-pedantic -Werror"
24481a054510Smrg    # Add -Werror=attributes if supported (gcc 4.2 & later)
24491a054510Smrg    AC_MSG_CHECKING([if $CC supports -Werror=attributes])
24501a054510Smrg    save_CFLAGS="$CFLAGS"
24511a054510Smrg    CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes"
24521a054510Smrg    AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
24531a054510Smrg		      [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes"
24541a054510Smrg		       AC_MSG_RESULT([yes])],
24551a054510Smrg		      [AC_MSG_RESULT([no])])
24561a054510Smrg    CFLAGS="$save_CFLAGS"
24571a054510Smrgelif test "x$SUNCC" = "xyes"; then
24581a054510Smrg    STRICT_CFLAGS="-errwarn"
24591a054510Smrgelif test "x$INTELCC" = "xyes"; then
24601a054510Smrg    STRICT_CFLAGS="-Werror"
24611a054510Smrgfi
2462bf2eeab3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
24631a054510Smrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2464bf2eeab3Smrgfi
24651a054510SmrgAC_SUBST([STRICT_CFLAGS])
2466bf2eeab3SmrgAC_SUBST([CWARNFLAGS])
2467bf2eeab3Smrg]) # XORG_STRICT_OPTION
246814c0a534Smrg
2469bf2eeab3Smrg# XORG_DEFAULT_OPTIONS
2470bf2eeab3Smrg# --------------------
2471bf2eeab3Smrg# Minimum version: 1.3.0
2472bf2eeab3Smrg#
2473bf2eeab3Smrg# Defines default options for X.Org modules.
2474bf2eeab3Smrg#
2475bf2eeab3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2476576bae58SmrgAC_REQUIRE([AC_PROG_INSTALL])
2477bf2eeab3SmrgXORG_CWARNFLAGS
2478bf2eeab3SmrgXORG_STRICT_OPTION
2479bf2eeab3SmrgXORG_RELEASE_VERSION
2480bf2eeab3SmrgXORG_CHANGELOG
2481576bae58SmrgXORG_INSTALL
2482bf2eeab3SmrgXORG_MANPAGE_SECTIONS
2483576bae58Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2484576bae58Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2485bf2eeab3Smrg]) # XORG_DEFAULT_OPTIONS
2486576bae58Smrg
2487576bae58Smrg# XORG_INSTALL()
2488576bae58Smrg# ----------------
2489576bae58Smrg# Minimum version: 1.4.0
2490576bae58Smrg#
2491576bae58Smrg# Defines the variable INSTALL_CMD as the command to copy
2492576bae58Smrg# INSTALL from $prefix/share/util-macros.
2493576bae58Smrg#
2494576bae58SmrgAC_DEFUN([XORG_INSTALL], [
2495576bae58SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2496576bae58Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2497576bae58SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2498576bae58Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2499576bae58Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2500576bae58Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2501576bae58SmrgAC_SUBST([INSTALL_CMD])
2502576bae58Smrg]) # XORG_INSTALL
2503bf2eeab3Smrgdnl Copyright 2005 Red Hat, Inc
2504bf2eeab3Smrgdnl
2505bf2eeab3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2506bf2eeab3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2507bf2eeab3Smrgdnl the above copyright notice appear in all copies and that both that
2508bf2eeab3Smrgdnl copyright notice and this permission notice appear in supporting
2509bf2eeab3Smrgdnl documentation.
2510bf2eeab3Smrgdnl
2511bf2eeab3Smrgdnl The above copyright notice and this permission notice shall be included
2512bf2eeab3Smrgdnl in all copies or substantial portions of the Software.
2513bf2eeab3Smrgdnl
2514bf2eeab3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2515bf2eeab3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2516bf2eeab3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2517bf2eeab3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2518bf2eeab3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2519bf2eeab3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2520bf2eeab3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
2521bf2eeab3Smrgdnl
2522bf2eeab3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
2523bf2eeab3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
2524bf2eeab3Smrgdnl other dealings in this Software without prior written authorization
2525bf2eeab3Smrgdnl from the copyright holders.
2526bf2eeab3Smrgdnl
252714c0a534Smrg
2528bf2eeab3Smrg# XORG_RELEASE_VERSION
2529bf2eeab3Smrg# --------------------
2530576bae58Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2531bf2eeab3Smrg 
2532bf2eeab3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2533bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2534bf2eeab3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2535bf2eeab3Smrg		[Major version of this package])
2536bf2eeab3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2537bf2eeab3Smrg	if test "x$PVM" = "x"; then
2538bf2eeab3Smrg		PVM="0"
2539bf2eeab3Smrg	fi
2540bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2541bf2eeab3Smrg		[$PVM],
2542bf2eeab3Smrg		[Minor version of this package])
2543bf2eeab3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2544bf2eeab3Smrg	if test "x$PVP" = "x"; then
2545bf2eeab3Smrg		PVP="0"
2546bf2eeab3Smrg	fi
2547bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2548bf2eeab3Smrg		[$PVP],
2549bf2eeab3Smrg		[Patch version of this package])
255014c0a534Smrg])
255114c0a534Smrg
2552bf2eeab3Smrg# XORG_CHANGELOG()
2553bf2eeab3Smrg# ----------------
2554bf2eeab3Smrg# Minimum version: 1.2.0
2555bf2eeab3Smrg#
2556bf2eeab3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
2557bf2eeab3Smrg# ChangeLog from git.
2558bf2eeab3Smrg#
2559bf2eeab3Smrg#
2560bf2eeab3SmrgAC_DEFUN([XORG_CHANGELOG], [
2561576bae58SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2562576bae58Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2563576bae58Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2564bf2eeab3Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2565bf2eeab3SmrgAC_SUBST([CHANGELOG_CMD])
2566bf2eeab3Smrg]) # XORG_CHANGELOG
256714c0a534Smrg
2568bf2eeab3Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2569bf2eeab3Smrg# 
2570bf2eeab3Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
257114c0a534Smrg#
2572bf2eeab3Smrg# This program is free software; you can redistribute it and/or modify
2573bf2eeab3Smrg# it under the terms of the GNU General Public License as published by
2574bf2eeab3Smrg# the Free Software Foundation; either version 2 of the License, or
2575bf2eeab3Smrg# (at your option) any later version.
2576bf2eeab3Smrg#
2577bf2eeab3Smrg# This program is distributed in the hope that it will be useful, but
2578bf2eeab3Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
2579bf2eeab3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2580bf2eeab3Smrg# General Public License for more details.
2581bf2eeab3Smrg#
2582bf2eeab3Smrg# You should have received a copy of the GNU General Public License
2583bf2eeab3Smrg# along with this program; if not, write to the Free Software
2584bf2eeab3Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2585bf2eeab3Smrg#
2586bf2eeab3Smrg# As a special exception to the GNU General Public License, if you
2587bf2eeab3Smrg# distribute this file as part of a program that contains a
2588bf2eeab3Smrg# configuration script generated by Autoconf, you may include it under
2589bf2eeab3Smrg# the same distribution terms that you use for the rest of that program.
259014c0a534Smrg
2591bf2eeab3Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2592bf2eeab3Smrg# ----------------------------------
2593bf2eeab3SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
2594bf2eeab3Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2595bf2eeab3Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2596bf2eeab3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2597bf2eeab3Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2598bf2eeab3Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2599bf2eeab3Smrgfi
2600bf2eeab3Smrgif test -n "$PKG_CONFIG"; then
2601bf2eeab3Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
2602bf2eeab3Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2603bf2eeab3Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2604bf2eeab3Smrg		AC_MSG_RESULT([yes])
2605bf2eeab3Smrg	else
2606bf2eeab3Smrg		AC_MSG_RESULT([no])
2607bf2eeab3Smrg		PKG_CONFIG=""
2608bf2eeab3Smrg	fi
2609bf2eeab3Smrg		
2610bf2eeab3Smrgfi[]dnl
2611bf2eeab3Smrg])# PKG_PROG_PKG_CONFIG
261214c0a534Smrg
2613bf2eeab3Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2614bf2eeab3Smrg#
2615bf2eeab3Smrg# Check to see whether a particular set of modules exists.  Similar
2616bf2eeab3Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2617bf2eeab3Smrg#
2618bf2eeab3Smrg#
2619bf2eeab3Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2620bf2eeab3Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
2621bf2eeab3Smrg# PKG_CHECK_EXISTS manually
2622bf2eeab3Smrg# --------------------------------------------------------------
2623bf2eeab3SmrgAC_DEFUN([PKG_CHECK_EXISTS],
2624bf2eeab3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2625bf2eeab3Smrgif test -n "$PKG_CONFIG" && \
2626bf2eeab3Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2627bf2eeab3Smrg  m4_ifval([$2], [$2], [:])
2628bf2eeab3Smrgm4_ifvaln([$3], [else
2629bf2eeab3Smrg  $3])dnl
2630bf2eeab3Smrgfi])
263114c0a534Smrg
263214c0a534Smrg
2633bf2eeab3Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2634bf2eeab3Smrg# ---------------------------------------------
2635bf2eeab3Smrgm4_define([_PKG_CONFIG],
2636bf2eeab3Smrg[if test -n "$$1"; then
2637bf2eeab3Smrg    pkg_cv_[]$1="$$1"
2638bf2eeab3Smrg elif test -n "$PKG_CONFIG"; then
2639bf2eeab3Smrg    PKG_CHECK_EXISTS([$3],
2640bf2eeab3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2641bf2eeab3Smrg		     [pkg_failed=yes])
2642bf2eeab3Smrg else
2643bf2eeab3Smrg    pkg_failed=untried
2644bf2eeab3Smrgfi[]dnl
2645bf2eeab3Smrg])# _PKG_CONFIG
2646bf2eeab3Smrg
2647bf2eeab3Smrg# _PKG_SHORT_ERRORS_SUPPORTED
2648bf2eeab3Smrg# -----------------------------
2649bf2eeab3SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2650bf2eeab3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2651bf2eeab3Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2652bf2eeab3Smrg        _pkg_short_errors_supported=yes
265314c0a534Smrgelse
2654bf2eeab3Smrg        _pkg_short_errors_supported=no
2655bf2eeab3Smrgfi[]dnl
2656bf2eeab3Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
265714c0a534Smrg
265814c0a534Smrg
2659bf2eeab3Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2660bf2eeab3Smrg# [ACTION-IF-NOT-FOUND])
266114c0a534Smrg#
266214c0a534Smrg#
2663bf2eeab3Smrg# Note that if there is a possibility the first call to
2664bf2eeab3Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
2665bf2eeab3Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
266614c0a534Smrg#
266714c0a534Smrg#
2668bf2eeab3Smrg# --------------------------------------------------------------
2669bf2eeab3SmrgAC_DEFUN([PKG_CHECK_MODULES],
2670bf2eeab3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2671bf2eeab3SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2672bf2eeab3SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
267314c0a534Smrg
2674bf2eeab3Smrgpkg_failed=no
2675bf2eeab3SmrgAC_MSG_CHECKING([for $1])
267614c0a534Smrg
2677bf2eeab3Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2678bf2eeab3Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
267914c0a534Smrg
2680bf2eeab3Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2681bf2eeab3Smrgand $1[]_LIBS to avoid the need to call pkg-config.
2682bf2eeab3SmrgSee the pkg-config man page for more details.])
268314c0a534Smrg
2684bf2eeab3Smrgif test $pkg_failed = yes; then
2685bf2eeab3Smrg        _PKG_SHORT_ERRORS_SUPPORTED
2686bf2eeab3Smrg        if test $_pkg_short_errors_supported = yes; then
2687bf2eeab3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2688bf2eeab3Smrg        else 
2689bf2eeab3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2690bf2eeab3Smrg        fi
2691bf2eeab3Smrg	# Put the nasty error message in config.log where it belongs
2692bf2eeab3Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
269314c0a534Smrg
2694bf2eeab3Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
2695bf2eeab3Smrg[Package requirements ($2) were not met:
269614c0a534Smrg
2697bf2eeab3Smrg$$1_PKG_ERRORS
269814c0a534Smrg
2699bf2eeab3SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
2700bf2eeab3Smrginstalled software in a non-standard prefix.
270114c0a534Smrg
2702bf2eeab3Smrg_PKG_TEXT
2703bf2eeab3Smrg])],
2704bf2eeab3Smrg		[AC_MSG_RESULT([no])
2705bf2eeab3Smrg                $4])
2706bf2eeab3Smrgelif test $pkg_failed = untried; then
2707bf2eeab3Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
2708bf2eeab3Smrg[The pkg-config script could not be found or is too old.  Make sure it
2709bf2eeab3Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2710bf2eeab3Smrgpath to pkg-config.
271114c0a534Smrg
2712bf2eeab3Smrg_PKG_TEXT
271314c0a534Smrg
2714bf2eeab3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2715bf2eeab3Smrg		[$4])
271614c0a534Smrgelse
2717bf2eeab3Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2718bf2eeab3Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2719bf2eeab3Smrg        AC_MSG_RESULT([yes])
2720bf2eeab3Smrg	ifelse([$3], , :, [$3])
2721bf2eeab3Smrgfi[]dnl
2722bf2eeab3Smrg])# PKG_CHECK_MODULES
272314c0a534Smrg
2724