aclocal.m4 revision a85aecdf
1a85aecdfSmrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2fd7d9bd3Smrg
3350952b9Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4a85aecdfSmrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
5a85aecdfSmrg# Inc.
6fd7d9bd3Smrg# This file is free software; the Free Software Foundation
7fd7d9bd3Smrg# gives unlimited permission to copy and/or distribute it,
8fd7d9bd3Smrg# with or without modifications, as long as this notice is preserved.
9fd7d9bd3Smrg
10fd7d9bd3Smrg# This program is distributed in the hope that it will be useful,
11fd7d9bd3Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12fd7d9bd3Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13fd7d9bd3Smrg# PARTICULAR PURPOSE.
14fd7d9bd3Smrg
15350952b9Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16350952b9Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
179aa2a2b5Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
189aa2a2b5Smrg[m4_warning([this file was generated for autoconf 2.68.
19350952b9SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20350952b9SmrgIf you have problems, you may need to regenerate the build system entirely.
21350952b9SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22fd7d9bd3Smrg
23a85aecdfSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
24a85aecdfSmrg# Foundation, Inc.
25350952b9Smrg#
26350952b9Smrg# This file is free software; the Free Software Foundation
27350952b9Smrg# gives unlimited permission to copy and/or distribute it,
28350952b9Smrg# with or without modifications, as long as this notice is preserved.
29fd7d9bd3Smrg
30a85aecdfSmrg# serial 1
31a85aecdfSmrg
32fd7d9bd3Smrg# AM_AUTOMAKE_VERSION(VERSION)
33fd7d9bd3Smrg# ----------------------------
34fd7d9bd3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
35fd7d9bd3Smrg# generated from the m4 files accompanying Automake X.Y.
36350952b9Smrg# (This private macro should not be called outside this file.)
37350952b9SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
38350952b9Smrg[am__api_version='1.11'
39350952b9Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40350952b9Smrgdnl require some minimum version.  Point them to the right macro.
41a85aecdfSmrgm4_if([$1], [1.11.2], [],
42350952b9Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43350952b9Smrg])
44350952b9Smrg
45350952b9Smrg# _AM_AUTOCONF_VERSION(VERSION)
46350952b9Smrg# -----------------------------
47350952b9Smrg# aclocal traces this macro to find the Autoconf version.
48350952b9Smrg# This is a private macro too.  Using m4_define simplifies
49350952b9Smrg# the logic in aclocal, which can simply ignore this definition.
50350952b9Smrgm4_define([_AM_AUTOCONF_VERSION], [])
51fd7d9bd3Smrg
52fd7d9bd3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
53fd7d9bd3Smrg# -------------------------------
54350952b9Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
55350952b9Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56fd7d9bd3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
57a85aecdfSmrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
58350952b9Smrgm4_ifndef([AC_AUTOCONF_VERSION],
59350952b9Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
60350952b9Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61fd7d9bd3Smrg
62350952b9Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
63fd7d9bd3Smrg
64a85aecdfSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65fd7d9bd3Smrg#
66350952b9Smrg# This file is free software; the Free Software Foundation
67350952b9Smrg# gives unlimited permission to copy and/or distribute it,
68350952b9Smrg# with or without modifications, as long as this notice is preserved.
69fd7d9bd3Smrg
70a85aecdfSmrg# serial 1
71a85aecdfSmrg
72fd7d9bd3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73fd7d9bd3Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74fd7d9bd3Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75fd7d9bd3Smrg#
76fd7d9bd3Smrg# Of course, Automake must honor this variable whenever it calls a
77fd7d9bd3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
78fd7d9bd3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
79fd7d9bd3Smrg# depending on how configure is run.  This is pretty annoying, since
80fd7d9bd3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81fd7d9bd3Smrg# source directory, any form will work fine, but in subdirectories a
82fd7d9bd3Smrg# relative path needs to be adjusted first.
83fd7d9bd3Smrg#
84fd7d9bd3Smrg# $ac_aux_dir/missing
85fd7d9bd3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
86fd7d9bd3Smrg# $top_srcdir/$ac_aux_dir/missing
87fd7d9bd3Smrg#    fails if $ac_aux_dir is absolute,
88fd7d9bd3Smrg#    fails when called from a subdirectory in a VPATH build with
89fd7d9bd3Smrg#          a relative $ac_aux_dir
90fd7d9bd3Smrg#
91fd7d9bd3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92fd7d9bd3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
93fd7d9bd3Smrg# harmless because $srcdir is `.', but things will broke when you
94fd7d9bd3Smrg# start a VPATH build or use an absolute $srcdir.
95fd7d9bd3Smrg#
96fd7d9bd3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97fd7d9bd3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98fd7d9bd3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99fd7d9bd3Smrg# and then we would define $MISSING as
100fd7d9bd3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
101fd7d9bd3Smrg# This will work as long as MISSING is not called from configure, because
102fd7d9bd3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
103fd7d9bd3Smrg# However there are other variables, like CC, which are often used in
104fd7d9bd3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
105fd7d9bd3Smrg#
106fd7d9bd3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
107fd7d9bd3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
108fd7d9bd3Smrg# configured tree to be moved without reconfiguration.
109fd7d9bd3Smrg
110350952b9SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
111350952b9Smrg[dnl Rely on autoconf to set up CDPATH properly.
112350952b9SmrgAC_PREREQ([2.50])dnl
113fd7d9bd3Smrg# expand $ac_aux_dir to an absolute path
114fd7d9bd3Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
115fd7d9bd3Smrg])
116fd7d9bd3Smrg
117350952b9Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
118fd7d9bd3Smrg
119350952b9Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120350952b9Smrg# Free Software Foundation, Inc.
121350952b9Smrg#
122350952b9Smrg# This file is free software; the Free Software Foundation
123350952b9Smrg# gives unlimited permission to copy and/or distribute it,
124350952b9Smrg# with or without modifications, as long as this notice is preserved.
125fd7d9bd3Smrg
126350952b9Smrg# serial 9
127fd7d9bd3Smrg
128350952b9Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129350952b9Smrg# -------------------------------------
130350952b9Smrg# Define a conditional.
131350952b9SmrgAC_DEFUN([AM_CONDITIONAL],
132350952b9Smrg[AC_PREREQ(2.52)dnl
133350952b9Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
134350952b9Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135350952b9SmrgAC_SUBST([$1_TRUE])dnl
136350952b9SmrgAC_SUBST([$1_FALSE])dnl
137350952b9Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138350952b9Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
139350952b9Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
140350952b9Smrgif $2; then
141350952b9Smrg  $1_TRUE=
142350952b9Smrg  $1_FALSE='#'
143fd7d9bd3Smrgelse
144350952b9Smrg  $1_TRUE='#'
145350952b9Smrg  $1_FALSE=
146fd7d9bd3Smrgfi
147350952b9SmrgAC_CONFIG_COMMANDS_PRE(
148350952b9Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149350952b9Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
150350952b9SmrgUsually this means the macro was only invoked conditionally.]])
151350952b9Smrgfi])])
152fd7d9bd3Smrg
153a85aecdfSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
154a85aecdfSmrg# 2010, 2011 Free Software Foundation, Inc.
155350952b9Smrg#
156350952b9Smrg# This file is free software; the Free Software Foundation
157350952b9Smrg# gives unlimited permission to copy and/or distribute it,
158350952b9Smrg# with or without modifications, as long as this notice is preserved.
159fd7d9bd3Smrg
160a85aecdfSmrg# serial 12
161fd7d9bd3Smrg
162fd7d9bd3Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163fd7d9bd3Smrg# written in clear, in which case automake, when reading aclocal.m4,
164fd7d9bd3Smrg# will think it sees a *use*, and therefore will trigger all it's
165fd7d9bd3Smrg# C support machinery.  Also note that it means that autoscan, seeing
166fd7d9bd3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167fd7d9bd3Smrg
168fd7d9bd3Smrg
169fd7d9bd3Smrg# _AM_DEPENDENCIES(NAME)
170fd7d9bd3Smrg# ----------------------
171fd7d9bd3Smrg# See how the compiler implements dependency checking.
172fd7d9bd3Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
173fd7d9bd3Smrg# We try a few techniques and use that to set a single cache variable.
174fd7d9bd3Smrg#
175fd7d9bd3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176fd7d9bd3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177fd7d9bd3Smrg# dependency, and given that the user is not expected to run this macro,
178fd7d9bd3Smrg# just rely on AC_PROG_CC.
179fd7d9bd3SmrgAC_DEFUN([_AM_DEPENDENCIES],
180fd7d9bd3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
181fd7d9bd3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182fd7d9bd3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
183fd7d9bd3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
184fd7d9bd3Smrg
185fd7d9bd3Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186fd7d9bd3Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187fd7d9bd3Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
188350952b9Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189fd7d9bd3Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190fd7d9bd3Smrg                   [depcc="$$1"   am_compiler_list=])
191fd7d9bd3Smrg
192fd7d9bd3SmrgAC_CACHE_CHECK([dependency style of $depcc],
193fd7d9bd3Smrg               [am_cv_$1_dependencies_compiler_type],
194fd7d9bd3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195fd7d9bd3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
196fd7d9bd3Smrg  # making bogus files that we don't know about and never remove.  For
197fd7d9bd3Smrg  # instance it was reported that on HP-UX the gcc test will end up
198fd7d9bd3Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
199fd7d9bd3Smrg  # in D'.
200a85aecdfSmrg  rm -rf conftest.dir
201fd7d9bd3Smrg  mkdir conftest.dir
202fd7d9bd3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
203fd7d9bd3Smrg  # using a relative directory.
204fd7d9bd3Smrg  cp "$am_depcomp" conftest.dir
205fd7d9bd3Smrg  cd conftest.dir
206fd7d9bd3Smrg  # We will build objects and dependencies in a subdirectory because
207fd7d9bd3Smrg  # it helps to detect inapplicable dependency modes.  For instance
208fd7d9bd3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
209fd7d9bd3Smrg  # side effect of compilation, but ICC will put the dependencies in
210fd7d9bd3Smrg  # the current directory while Tru64 will put them in the object
211fd7d9bd3Smrg  # directory.
212fd7d9bd3Smrg  mkdir sub
213fd7d9bd3Smrg
214fd7d9bd3Smrg  am_cv_$1_dependencies_compiler_type=none
215fd7d9bd3Smrg  if test "$am_compiler_list" = ""; then
216fd7d9bd3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217fd7d9bd3Smrg  fi
218350952b9Smrg  am__universal=false
219350952b9Smrg  m4_case([$1], [CC],
220350952b9Smrg    [case " $depcc " in #(
221350952b9Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
222350952b9Smrg     esac],
223350952b9Smrg    [CXX],
224350952b9Smrg    [case " $depcc " in #(
225350952b9Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
226350952b9Smrg     esac])
227350952b9Smrg
228fd7d9bd3Smrg  for depmode in $am_compiler_list; do
229fd7d9bd3Smrg    # Setup a source with many dependencies, because some compilers
230fd7d9bd3Smrg    # like to wrap large dependency lists on column 80 (with \), and
231fd7d9bd3Smrg    # we should not choose a depcomp mode which is confused by this.
232fd7d9bd3Smrg    #
233fd7d9bd3Smrg    # We need to recreate these files for each test, as the compiler may
234fd7d9bd3Smrg    # overwrite some of them when testing with obscure command lines.
235fd7d9bd3Smrg    # This happens at least with the AIX C compiler.
236fd7d9bd3Smrg    : > sub/conftest.c
237fd7d9bd3Smrg    for i in 1 2 3 4 5 6; do
238fd7d9bd3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
239350952b9Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
240350952b9Smrg      # Solaris 8's {/usr,}/bin/sh.
241350952b9Smrg      touch sub/conftst$i.h
242fd7d9bd3Smrg    done
243fd7d9bd3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244fd7d9bd3Smrg
245350952b9Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
246350952b9Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
247350952b9Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
248350952b9Smrg    # versions had trouble with output in subdirs
249350952b9Smrg    am__obj=sub/conftest.${OBJEXT-o}
250350952b9Smrg    am__minus_obj="-o $am__obj"
251fd7d9bd3Smrg    case $depmode in
252350952b9Smrg    gcc)
253350952b9Smrg      # This depmode causes a compiler race in universal mode.
254350952b9Smrg      test "$am__universal" = false || continue
255350952b9Smrg      ;;
256fd7d9bd3Smrg    nosideeffect)
257fd7d9bd3Smrg      # after this tag, mechanisms are not by side-effect, so they'll
258fd7d9bd3Smrg      # only be used when explicitly requested
259fd7d9bd3Smrg      if test "x$enable_dependency_tracking" = xyes; then
260fd7d9bd3Smrg	continue
261fd7d9bd3Smrg      else
262fd7d9bd3Smrg	break
263fd7d9bd3Smrg      fi
264fd7d9bd3Smrg      ;;
265a85aecdfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
266350952b9Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
267350952b9Smrg      # not run yet.  These depmodes are late enough in the game, and
268350952b9Smrg      # so weak that their functioning should not be impacted.
269350952b9Smrg      am__obj=conftest.${OBJEXT-o}
270350952b9Smrg      am__minus_obj=
271350952b9Smrg      ;;
272fd7d9bd3Smrg    none) break ;;
273fd7d9bd3Smrg    esac
274fd7d9bd3Smrg    if depmode=$depmode \
275350952b9Smrg       source=sub/conftest.c object=$am__obj \
276fd7d9bd3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
277350952b9Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278fd7d9bd3Smrg         >/dev/null 2>conftest.err &&
279350952b9Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280fd7d9bd3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
281350952b9Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282fd7d9bd3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283fd7d9bd3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
284350952b9Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
285350952b9Smrg      # that says an option was ignored or not supported.
286350952b9Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
287350952b9Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
288350952b9Smrg      # The diagnosis changed in icc 8.0:
289350952b9Smrg      #   icc: Command line remark: option '-MP' not supported
290350952b9Smrg      if (grep 'ignoring option' conftest.err ||
291350952b9Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292fd7d9bd3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
293fd7d9bd3Smrg        break
294fd7d9bd3Smrg      fi
295fd7d9bd3Smrg    fi
296fd7d9bd3Smrg  done
297fd7d9bd3Smrg
298fd7d9bd3Smrg  cd ..
299fd7d9bd3Smrg  rm -rf conftest.dir
300fd7d9bd3Smrgelse
301fd7d9bd3Smrg  am_cv_$1_dependencies_compiler_type=none
302fd7d9bd3Smrgfi
303fd7d9bd3Smrg])
304fd7d9bd3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305fd7d9bd3SmrgAM_CONDITIONAL([am__fastdep$1], [
306fd7d9bd3Smrg  test "x$enable_dependency_tracking" != xno \
307fd7d9bd3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308fd7d9bd3Smrg])
309fd7d9bd3Smrg
310fd7d9bd3Smrg
311fd7d9bd3Smrg# AM_SET_DEPDIR
312fd7d9bd3Smrg# -------------
313fd7d9bd3Smrg# Choose a directory name for dependency files.
314fd7d9bd3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315fd7d9bd3SmrgAC_DEFUN([AM_SET_DEPDIR],
316fd7d9bd3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317fd7d9bd3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318fd7d9bd3Smrg])
319fd7d9bd3Smrg
320fd7d9bd3Smrg
321fd7d9bd3Smrg# AM_DEP_TRACK
322fd7d9bd3Smrg# ------------
323fd7d9bd3SmrgAC_DEFUN([AM_DEP_TRACK],
324fd7d9bd3Smrg[AC_ARG_ENABLE(dependency-tracking,
325350952b9Smrg[  --disable-dependency-tracking  speeds up one-time build
326350952b9Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
327fd7d9bd3Smrgif test "x$enable_dependency_tracking" != xno; then
328fd7d9bd3Smrg  am_depcomp="$ac_aux_dir/depcomp"
329fd7d9bd3Smrg  AMDEPBACKSLASH='\'
330a85aecdfSmrg  am__nodep='_no'
331fd7d9bd3Smrgfi
332fd7d9bd3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
333350952b9SmrgAC_SUBST([AMDEPBACKSLASH])dnl
334350952b9Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
335a85aecdfSmrgAC_SUBST([am__nodep])dnl
336a85aecdfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
337fd7d9bd3Smrg])
338fd7d9bd3Smrg
339350952b9Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
340fd7d9bd3Smrg
341350952b9Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
342350952b9Smrg# Free Software Foundation, Inc.
343350952b9Smrg#
344350952b9Smrg# This file is free software; the Free Software Foundation
345350952b9Smrg# gives unlimited permission to copy and/or distribute it,
346350952b9Smrg# with or without modifications, as long as this notice is preserved.
347fd7d9bd3Smrg
348350952b9Smrg#serial 5
349fd7d9bd3Smrg
350fd7d9bd3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
351fd7d9bd3Smrg# ------------------------------
352fd7d9bd3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
353350952b9Smrg[{
354350952b9Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
355350952b9Smrg  # are listed without --file.  Let's play safe and only enable the eval
356350952b9Smrg  # if we detect the quoting.
357350952b9Smrg  case $CONFIG_FILES in
358350952b9Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
359350952b9Smrg  *)   set x $CONFIG_FILES ;;
360350952b9Smrg  esac
361350952b9Smrg  shift
362350952b9Smrg  for mf
363350952b9Smrg  do
364350952b9Smrg    # Strip MF so we end up with the name of the file.
365350952b9Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
366350952b9Smrg    # Check whether this is an Automake generated Makefile or not.
367350952b9Smrg    # We used to match only the files named `Makefile.in', but
368350952b9Smrg    # some people rename them; so instead we look at the file content.
369350952b9Smrg    # Grep'ing the first line is not enough: some people post-process
370350952b9Smrg    # each Makefile.in and add a new line on top of each file to say so.
371350952b9Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
372350952b9Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
373350952b9Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
374350952b9Smrg      dirpart=`AS_DIRNAME("$mf")`
375350952b9Smrg    else
376350952b9Smrg      continue
377350952b9Smrg    fi
378350952b9Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
379350952b9Smrg    # from the Makefile without running `make'.
380350952b9Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
381350952b9Smrg    test -z "$DEPDIR" && continue
382350952b9Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
383350952b9Smrg    test -z "am__include" && continue
384350952b9Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
385350952b9Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
386350952b9Smrg    U=`sed -n 's/^U = //p' < "$mf"`
387350952b9Smrg    # Find all dependency output files, they are included files with
388350952b9Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
389350952b9Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
390350952b9Smrg    # expansion.
391350952b9Smrg    for file in `sed -n "
392350952b9Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
393350952b9Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
394350952b9Smrg      # Make sure the directory exists.
395350952b9Smrg      test -f "$dirpart/$file" && continue
396350952b9Smrg      fdir=`AS_DIRNAME(["$file"])`
397350952b9Smrg      AS_MKDIR_P([$dirpart/$fdir])
398350952b9Smrg      # echo "creating $dirpart/$file"
399350952b9Smrg      echo '# dummy' > "$dirpart/$file"
400350952b9Smrg    done
401fd7d9bd3Smrg  done
402350952b9Smrg}
403fd7d9bd3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404fd7d9bd3Smrg
405fd7d9bd3Smrg
406fd7d9bd3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
407fd7d9bd3Smrg# -----------------------------
408fd7d9bd3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
409fd7d9bd3Smrg#
410fd7d9bd3Smrg# This code is only required when automatic dependency tracking
411fd7d9bd3Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
412fd7d9bd3Smrg# need in order to bootstrap the dependency handling code.
413fd7d9bd3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414fd7d9bd3Smrg[AC_CONFIG_COMMANDS([depfiles],
415fd7d9bd3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416fd7d9bd3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417fd7d9bd3Smrg])
418fd7d9bd3Smrg
419350952b9Smrg# Do all the work for Automake.                             -*- Autoconf -*-
420fd7d9bd3Smrg
421350952b9Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
422350952b9Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423350952b9Smrg#
424350952b9Smrg# This file is free software; the Free Software Foundation
425350952b9Smrg# gives unlimited permission to copy and/or distribute it,
426350952b9Smrg# with or without modifications, as long as this notice is preserved.
427fd7d9bd3Smrg
428350952b9Smrg# serial 16
429fd7d9bd3Smrg
430350952b9Smrg# This macro actually does too much.  Some checks are only needed if
431350952b9Smrg# your package does certain things.  But this isn't really a big deal.
432350952b9Smrg
433350952b9Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
434350952b9Smrg# AM_INIT_AUTOMAKE([OPTIONS])
435350952b9Smrg# -----------------------------------------------
436350952b9Smrg# The call with PACKAGE and VERSION arguments is the old style
437350952b9Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
438350952b9Smrg# and VERSION should now be passed to AC_INIT and removed from
439350952b9Smrg# the call to AM_INIT_AUTOMAKE.
440350952b9Smrg# We support both call styles for the transition.  After
441350952b9Smrg# the next Automake release, Autoconf can make the AC_INIT
442350952b9Smrg# arguments mandatory, and then we can depend on a new Autoconf
443350952b9Smrg# release and drop the old call support.
444350952b9SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
445350952b9Smrg[AC_PREREQ([2.62])dnl
446350952b9Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
447350952b9Smrgdnl the ones we care about.
448350952b9Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
449350952b9SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
450350952b9SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
451350952b9Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
452350952b9Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
453350952b9Smrg  # is not polluted with repeated "-I."
454350952b9Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
455350952b9Smrg  # test to see if srcdir already configured
456350952b9Smrg  if test -f $srcdir/config.status; then
457350952b9Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
458350952b9Smrg  fi
459fd7d9bd3Smrgfi
460350952b9Smrg
461350952b9Smrg# test whether we have cygpath
462350952b9Smrgif test -z "$CYGPATH_W"; then
463350952b9Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
464350952b9Smrg    CYGPATH_W='cygpath -w'
465350952b9Smrg  else
466350952b9Smrg    CYGPATH_W=echo
467350952b9Smrg  fi
468fd7d9bd3Smrgfi
469350952b9SmrgAC_SUBST([CYGPATH_W])
470fd7d9bd3Smrg
471350952b9Smrg# Define the identity of the package.
472350952b9Smrgdnl Distinguish between old-style and new-style calls.
473350952b9Smrgm4_ifval([$2],
474350952b9Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
475350952b9Smrg AC_SUBST([PACKAGE], [$1])dnl
476350952b9Smrg AC_SUBST([VERSION], [$2])],
477350952b9Smrg[_AM_SET_OPTIONS([$1])dnl
478350952b9Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
479350952b9Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
480350952b9Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
481350952b9Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
482350952b9Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483fd7d9bd3Smrg
484350952b9Smrg_AM_IF_OPTION([no-define],,
485350952b9Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
486350952b9Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487fd7d9bd3Smrg
488350952b9Smrg# Some tools Automake needs.
489350952b9SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
490350952b9SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
491350952b9SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
492350952b9SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
493350952b9SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
494350952b9SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
495350952b9SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
496350952b9SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
497350952b9SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
498350952b9SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
499350952b9Smrg# We need awk for the "check" target.  The system "awk" is bad on
500350952b9Smrg# some platforms.
501350952b9SmrgAC_REQUIRE([AC_PROG_AWK])dnl
502350952b9SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
503350952b9SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
504350952b9Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
505350952b9Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
506350952b9Smrg			     [_AM_PROG_TAR([v7])])])
507350952b9Smrg_AM_IF_OPTION([no-dependencies],,
508350952b9Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
509350952b9Smrg		  [_AM_DEPENDENCIES(CC)],
510350952b9Smrg		  [define([AC_PROG_CC],
511350952b9Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
512350952b9SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
513350952b9Smrg		  [_AM_DEPENDENCIES(CXX)],
514350952b9Smrg		  [define([AC_PROG_CXX],
515350952b9Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
516350952b9SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
517350952b9Smrg		  [_AM_DEPENDENCIES(OBJC)],
518350952b9Smrg		  [define([AC_PROG_OBJC],
519350952b9Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
520350952b9Smrg])
521350952b9Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
522350952b9Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
523350952b9Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
524350952b9Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
525350952b9SmrgAC_CONFIG_COMMANDS_PRE(dnl
526350952b9Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
527350952b9Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
528350952b9Smrg])
529fd7d9bd3Smrg
530350952b9Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
531350952b9Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
532350952b9Smrgdnl mangled by Autoconf and run in a shell conditional statement.
533350952b9Smrgm4_define([_AC_COMPILER_EXEEXT],
534350952b9Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
535fd7d9bd3Smrg
536fd7d9bd3Smrg
537350952b9Smrg# When config.status generates a header, we must update the stamp-h file.
538350952b9Smrg# This file resides in the same directory as the config header
539350952b9Smrg# that is generated.  The stamp files are numbered to have different names.
540350952b9Smrg
541350952b9Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
542350952b9Smrg# loop where config.status creates the headers, so we can generate
543350952b9Smrg# our stamp files there.
544350952b9SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
545350952b9Smrg[# Compute $1's index in $config_headers.
546350952b9Smrg_am_arg=$1
547350952b9Smrg_am_stamp_count=1
548350952b9Smrgfor _am_header in $config_headers :; do
549350952b9Smrg  case $_am_header in
550350952b9Smrg    $_am_arg | $_am_arg:* )
551350952b9Smrg      break ;;
552350952b9Smrg    * )
553350952b9Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
554350952b9Smrg  esac
555350952b9Smrgdone
556350952b9Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557fd7d9bd3Smrg
558a85aecdfSmrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
559a85aecdfSmrg# Inc.
560350952b9Smrg#
561350952b9Smrg# This file is free software; the Free Software Foundation
562350952b9Smrg# gives unlimited permission to copy and/or distribute it,
563350952b9Smrg# with or without modifications, as long as this notice is preserved.
564fd7d9bd3Smrg
565a85aecdfSmrg# serial 1
566a85aecdfSmrg
567350952b9Smrg# AM_PROG_INSTALL_SH
568350952b9Smrg# ------------------
569350952b9Smrg# Define $install_sh.
570350952b9SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
571350952b9Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
572350952b9Smrgif test x"${install_sh}" != xset; then
573350952b9Smrg  case $am_aux_dir in
574350952b9Smrg  *\ * | *\	*)
575350952b9Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
576350952b9Smrg  *)
577350952b9Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
578350952b9Smrg  esac
579fd7d9bd3Smrgfi
580350952b9SmrgAC_SUBST(install_sh)])
581fd7d9bd3Smrg
582350952b9Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
583350952b9Smrg#
584350952b9Smrg# This file is free software; the Free Software Foundation
585350952b9Smrg# gives unlimited permission to copy and/or distribute it,
586350952b9Smrg# with or without modifications, as long as this notice is preserved.
587fd7d9bd3Smrg
588350952b9Smrg# serial 2
589fd7d9bd3Smrg
590350952b9Smrg# Check whether the underlying file-system supports filenames
591350952b9Smrg# with a leading dot.  For instance MS-DOS doesn't.
592350952b9SmrgAC_DEFUN([AM_SET_LEADING_DOT],
593350952b9Smrg[rm -rf .tst 2>/dev/null
594350952b9Smrgmkdir .tst 2>/dev/null
595350952b9Smrgif test -d .tst; then
596350952b9Smrg  am__leading_dot=.
597350952b9Smrgelse
598350952b9Smrg  am__leading_dot=_
599350952b9Smrgfi
600350952b9Smrgrmdir .tst 2>/dev/null
601350952b9SmrgAC_SUBST([am__leading_dot])])
602fd7d9bd3Smrg
603350952b9Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
604350952b9Smrg# From Jim Meyering
605fd7d9bd3Smrg
606a85aecdfSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
607a85aecdfSmrg# 2011 Free Software Foundation, Inc.
608350952b9Smrg#
609350952b9Smrg# This file is free software; the Free Software Foundation
610350952b9Smrg# gives unlimited permission to copy and/or distribute it,
611350952b9Smrg# with or without modifications, as long as this notice is preserved.
612fd7d9bd3Smrg
613350952b9Smrg# serial 5
614fd7d9bd3Smrg
615350952b9Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
616350952b9Smrg# ----------------------------------
617350952b9Smrg# Control maintainer-specific portions of Makefiles.
618350952b9Smrg# Default is to disable them, unless `enable' is passed literally.
619350952b9Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
620350952b9Smrg# can override the default with the --enable/--disable switch.
621fd7d9bd3SmrgAC_DEFUN([AM_MAINTAINER_MODE],
622350952b9Smrg[m4_case(m4_default([$1], [disable]),
623350952b9Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
624350952b9Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
625350952b9Smrg       [m4_define([am_maintainer_other], [enable])
626350952b9Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
627a85aecdfSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
628350952b9Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
629350952b9Smrg  AC_ARG_ENABLE([maintainer-mode],
630350952b9Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
631350952b9Smrg			  (and sometimes confusing) to the casual installer],
632350952b9Smrg      [USE_MAINTAINER_MODE=$enableval],
633350952b9Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634fd7d9bd3Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
635350952b9Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636fd7d9bd3Smrg  MAINT=$MAINTAINER_MODE_TRUE
637350952b9Smrg  AC_SUBST([MAINT])dnl
638fd7d9bd3Smrg]
639fd7d9bd3Smrg)
640fd7d9bd3Smrg
641fd7d9bd3SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
642fd7d9bd3Smrg
643350952b9Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644fd7d9bd3Smrg
645350952b9Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
646350952b9Smrg#
647350952b9Smrg# This file is free software; the Free Software Foundation
648350952b9Smrg# gives unlimited permission to copy and/or distribute it,
649350952b9Smrg# with or without modifications, as long as this notice is preserved.
650fd7d9bd3Smrg
651350952b9Smrg# serial 4
652fd7d9bd3Smrg
653350952b9Smrg# AM_MAKE_INCLUDE()
654350952b9Smrg# -----------------
655350952b9Smrg# Check to see how make treats includes.
656350952b9SmrgAC_DEFUN([AM_MAKE_INCLUDE],
657350952b9Smrg[am_make=${MAKE-make}
658350952b9Smrgcat > confinc << 'END'
659350952b9Smrgam__doit:
660350952b9Smrg	@echo this is the am__doit target
661350952b9Smrg.PHONY: am__doit
662350952b9SmrgEND
663350952b9Smrg# If we don't find an include directive, just comment out the code.
664350952b9SmrgAC_MSG_CHECKING([for style of include used by $am_make])
665350952b9Smrgam__include="#"
666350952b9Smrgam__quote=
667350952b9Smrg_am_result=none
668350952b9Smrg# First try GNU make style include.
669350952b9Smrgecho "include confinc" > confmf
670350952b9Smrg# Ignore all kinds of additional output from `make'.
671350952b9Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
672350952b9Smrg*the\ am__doit\ target*)
673350952b9Smrg  am__include=include
674350952b9Smrg  am__quote=
675350952b9Smrg  _am_result=GNU
676350952b9Smrg  ;;
677350952b9Smrgesac
678350952b9Smrg# Now try BSD make style include.
679350952b9Smrgif test "$am__include" = "#"; then
680350952b9Smrg   echo '.include "confinc"' > confmf
681350952b9Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
682350952b9Smrg   *the\ am__doit\ target*)
683350952b9Smrg     am__include=.include
684350952b9Smrg     am__quote="\""
685350952b9Smrg     _am_result=BSD
686350952b9Smrg     ;;
687350952b9Smrg   esac
688350952b9Smrgfi
689350952b9SmrgAC_SUBST([am__include])
690350952b9SmrgAC_SUBST([am__quote])
691350952b9SmrgAC_MSG_RESULT([$_am_result])
692350952b9Smrgrm -f confinc confmf
693350952b9Smrg])
694fd7d9bd3Smrg
695350952b9Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
696fd7d9bd3Smrg
697350952b9Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
698350952b9Smrg# Free Software Foundation, Inc.
699350952b9Smrg#
700350952b9Smrg# This file is free software; the Free Software Foundation
701350952b9Smrg# gives unlimited permission to copy and/or distribute it,
702350952b9Smrg# with or without modifications, as long as this notice is preserved.
703fd7d9bd3Smrg
704fd7d9bd3Smrg# serial 6
705fd7d9bd3Smrg
706350952b9Smrg# AM_MISSING_PROG(NAME, PROGRAM)
707350952b9Smrg# ------------------------------
708350952b9SmrgAC_DEFUN([AM_MISSING_PROG],
709350952b9Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710350952b9Smrg$1=${$1-"${am_missing_run}$2"}
711350952b9SmrgAC_SUBST($1)])
712fd7d9bd3Smrg
713fd7d9bd3Smrg
714350952b9Smrg# AM_MISSING_HAS_RUN
715350952b9Smrg# ------------------
716350952b9Smrg# Define MISSING if not defined so far and test if it supports --run.
717350952b9Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
718350952b9SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
719350952b9Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
720350952b9SmrgAC_REQUIRE_AUX_FILE([missing])dnl
721350952b9Smrgif test x"${MISSING+set}" != xset; then
722350952b9Smrg  case $am_aux_dir in
723350952b9Smrg  *\ * | *\	*)
724350952b9Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
725350952b9Smrg  *)
726350952b9Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
727350952b9Smrg  esac
728350952b9Smrgfi
729350952b9Smrg# Use eval to expand $SHELL
730350952b9Smrgif eval "$MISSING --run true"; then
731350952b9Smrg  am_missing_run="$MISSING --run "
732350952b9Smrgelse
733350952b9Smrg  am_missing_run=
734350952b9Smrg  AC_MSG_WARN([`missing' script is too old or missing])
735350952b9Smrgfi
736350952b9Smrg])
737fd7d9bd3Smrg
738a85aecdfSmrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
739a85aecdfSmrg# Inc.
740350952b9Smrg#
741350952b9Smrg# This file is free software; the Free Software Foundation
742350952b9Smrg# gives unlimited permission to copy and/or distribute it,
743350952b9Smrg# with or without modifications, as long as this notice is preserved.
744fd7d9bd3Smrg
745a85aecdfSmrg# serial 1
746a85aecdfSmrg
747350952b9Smrg# AM_PROG_MKDIR_P
748350952b9Smrg# ---------------
749350952b9Smrg# Check for `mkdir -p'.
750350952b9SmrgAC_DEFUN([AM_PROG_MKDIR_P],
751350952b9Smrg[AC_PREREQ([2.60])dnl
752350952b9SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
753350952b9Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
754350952b9Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
755350952b9Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
756350952b9Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
757350952b9Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
758350952b9Smrgdnl adjustment using top_builddir (which is defined more often than
759350952b9Smrgdnl MKDIR_P).
760350952b9SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
761350952b9Smrgcase $mkdir_p in
762350952b9Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
763350952b9Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
764350952b9Smrgesac
765fd7d9bd3Smrg])
766fd7d9bd3Smrg
767350952b9Smrg# Helper functions for option handling.                     -*- Autoconf -*-
768350952b9Smrg
769a85aecdfSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
770a85aecdfSmrg# Foundation, Inc.
771fd7d9bd3Smrg#
772350952b9Smrg# This file is free software; the Free Software Foundation
773350952b9Smrg# gives unlimited permission to copy and/or distribute it,
774350952b9Smrg# with or without modifications, as long as this notice is preserved.
775fd7d9bd3Smrg
776a85aecdfSmrg# serial 5
777350952b9Smrg
778350952b9Smrg# _AM_MANGLE_OPTION(NAME)
779350952b9Smrg# -----------------------
780350952b9SmrgAC_DEFUN([_AM_MANGLE_OPTION],
781350952b9Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782350952b9Smrg
783350952b9Smrg# _AM_SET_OPTION(NAME)
784a85aecdfSmrg# --------------------
785350952b9Smrg# Set option NAME.  Presently that only means defining a flag for this option.
786350952b9SmrgAC_DEFUN([_AM_SET_OPTION],
787350952b9Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
788350952b9Smrg
789350952b9Smrg# _AM_SET_OPTIONS(OPTIONS)
790a85aecdfSmrg# ------------------------
791350952b9Smrg# OPTIONS is a space-separated list of Automake options.
792350952b9SmrgAC_DEFUN([_AM_SET_OPTIONS],
793350952b9Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794fd7d9bd3Smrg
795350952b9Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
796350952b9Smrg# -------------------------------------------
797350952b9Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
798350952b9SmrgAC_DEFUN([_AM_IF_OPTION],
799350952b9Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800350952b9Smrg
801350952b9Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
802350952b9Smrg
803350952b9Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
804350952b9Smrg# Free Software Foundation, Inc.
805fd7d9bd3Smrg#
806350952b9Smrg# This file is free software; the Free Software Foundation
807350952b9Smrg# gives unlimited permission to copy and/or distribute it,
808350952b9Smrg# with or without modifications, as long as this notice is preserved.
809fd7d9bd3Smrg
810350952b9Smrg# serial 5
811fd7d9bd3Smrg
812350952b9Smrg# AM_SANITY_CHECK
813350952b9Smrg# ---------------
814350952b9SmrgAC_DEFUN([AM_SANITY_CHECK],
815350952b9Smrg[AC_MSG_CHECKING([whether build environment is sane])
816350952b9Smrg# Just in case
817350952b9Smrgsleep 1
818350952b9Smrgecho timestamp > conftest.file
819350952b9Smrg# Reject unsafe characters in $srcdir or the absolute working directory
820350952b9Smrg# name.  Accept space and tab only in the latter.
821350952b9Smrgam_lf='
822350952b9Smrg'
823350952b9Smrgcase `pwd` in
824350952b9Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
825350952b9Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
826350952b9Smrgesac
827350952b9Smrgcase $srcdir in
828350952b9Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
829350952b9Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
830350952b9Smrgesac
831fd7d9bd3Smrg
832350952b9Smrg# Do `set' in a subshell so we don't clobber the current shell's
833350952b9Smrg# arguments.  Must try -L first in case configure is actually a
834350952b9Smrg# symlink; some systems play weird games with the mod time of symlinks
835350952b9Smrg# (eg FreeBSD returns the mod time of the symlink's containing
836350952b9Smrg# directory).
837350952b9Smrgif (
838350952b9Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
839350952b9Smrg   if test "$[*]" = "X"; then
840350952b9Smrg      # -L didn't work.
841350952b9Smrg      set X `ls -t "$srcdir/configure" conftest.file`
842350952b9Smrg   fi
843350952b9Smrg   rm -f conftest.file
844350952b9Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
845350952b9Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
846fd7d9bd3Smrg
847350952b9Smrg      # If neither matched, then we have a broken ls.  This can happen
848350952b9Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
849350952b9Smrg      # broken ls alias from the environment.  This has actually
850350952b9Smrg      # happened.  Such a system could not be considered "sane".
851350952b9Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
852350952b9Smrgalias in your environment])
853350952b9Smrg   fi
854fd7d9bd3Smrg
855350952b9Smrg   test "$[2]" = conftest.file
856350952b9Smrg   )
857350952b9Smrgthen
858350952b9Smrg   # Ok.
859350952b9Smrg   :
860350952b9Smrgelse
861350952b9Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
862350952b9SmrgCheck your system clock])
863350952b9Smrgfi
864350952b9SmrgAC_MSG_RESULT(yes)])
865350952b9Smrg
866350952b9Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
867fd7d9bd3Smrg#
868350952b9Smrg# This file is free software; the Free Software Foundation
869350952b9Smrg# gives unlimited permission to copy and/or distribute it,
870350952b9Smrg# with or without modifications, as long as this notice is preserved.
871350952b9Smrg
872350952b9Smrg# serial 1
873350952b9Smrg
874350952b9Smrg# AM_SILENT_RULES([DEFAULT])
875350952b9Smrg# --------------------------
876350952b9Smrg# Enable less verbose build rules; with the default set to DEFAULT
877350952b9Smrg# (`yes' being less verbose, `no' or empty being verbose).
878350952b9SmrgAC_DEFUN([AM_SILENT_RULES],
879350952b9Smrg[AC_ARG_ENABLE([silent-rules],
880350952b9Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
881350952b9Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
882350952b9Smrgcase $enable_silent_rules in
883350952b9Smrgyes) AM_DEFAULT_VERBOSITY=0;;
884350952b9Smrgno)  AM_DEFAULT_VERBOSITY=1;;
885350952b9Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
886350952b9Smrgesac
887350952b9SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
888350952b9SmrgAM_BACKSLASH='\'
889350952b9SmrgAC_SUBST([AM_BACKSLASH])dnl
890350952b9Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
891350952b9Smrg])
892350952b9Smrg
893a85aecdfSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
894fd7d9bd3Smrg#
895350952b9Smrg# This file is free software; the Free Software Foundation
896350952b9Smrg# gives unlimited permission to copy and/or distribute it,
897350952b9Smrg# with or without modifications, as long as this notice is preserved.
898fd7d9bd3Smrg
899a85aecdfSmrg# serial 1
900a85aecdfSmrg
901350952b9Smrg# AM_PROG_INSTALL_STRIP
902350952b9Smrg# ---------------------
903350952b9Smrg# One issue with vendor `install' (even GNU) is that you can't
904350952b9Smrg# specify the program used to strip binaries.  This is especially
905350952b9Smrg# annoying in cross-compiling environments, where the build's strip
906350952b9Smrg# is unlikely to handle the host's binaries.
907350952b9Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
908350952b9Smrg# always use install-sh in `make install-strip', and initialize
909350952b9Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
910350952b9SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
911350952b9Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
912350952b9Smrg# Installed binaries are usually stripped using `strip' when the user
913350952b9Smrg# run `make install-strip'.  However `strip' might not be the right
914350952b9Smrg# tool to use in cross-compilation environments, therefore Automake
915350952b9Smrg# will honor the `STRIP' environment variable to overrule this program.
916350952b9Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
917350952b9Smrgif test "$cross_compiling" != no; then
918350952b9Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
919350952b9Smrgfi
920350952b9SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
921350952b9SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
922fd7d9bd3Smrg
923a85aecdfSmrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
924350952b9Smrg#
925350952b9Smrg# This file is free software; the Free Software Foundation
926350952b9Smrg# gives unlimited permission to copy and/or distribute it,
927350952b9Smrg# with or without modifications, as long as this notice is preserved.
928fd7d9bd3Smrg
929a85aecdfSmrg# serial 3
930fd7d9bd3Smrg
931350952b9Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
932350952b9Smrg# ---------------------------
933350952b9Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
934350952b9Smrg# This macro is traced by Automake.
935350952b9SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
936fd7d9bd3Smrg
937350952b9Smrg# AM_SUBST_NOTMAKE(VARIABLE)
938a85aecdfSmrg# --------------------------
939350952b9Smrg# Public sister of _AM_SUBST_NOTMAKE.
940350952b9SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
941fd7d9bd3Smrg
942350952b9Smrg# Check how to create a tarball.                            -*- Autoconf -*-
943fd7d9bd3Smrg
944350952b9Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
945350952b9Smrg#
946350952b9Smrg# This file is free software; the Free Software Foundation
947350952b9Smrg# gives unlimited permission to copy and/or distribute it,
948350952b9Smrg# with or without modifications, as long as this notice is preserved.
949fd7d9bd3Smrg
950350952b9Smrg# serial 2
951fd7d9bd3Smrg
952350952b9Smrg# _AM_PROG_TAR(FORMAT)
953350952b9Smrg# --------------------
954350952b9Smrg# Check how to create a tarball in format FORMAT.
955350952b9Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
956350952b9Smrg#
957350952b9Smrg# Substitute a variable $(am__tar) that is a command
958350952b9Smrg# writing to stdout a FORMAT-tarball containing the directory
959350952b9Smrg# $tardir.
960350952b9Smrg#     tardir=directory && $(am__tar) > result.tar
961350952b9Smrg#
962350952b9Smrg# Substitute a variable $(am__untar) that extract such
963350952b9Smrg# a tarball read from stdin.
964350952b9Smrg#     $(am__untar) < result.tar
965350952b9SmrgAC_DEFUN([_AM_PROG_TAR],
966350952b9Smrg[# Always define AMTAR for backward compatibility.
967350952b9SmrgAM_MISSING_PROG([AMTAR], [tar])
968350952b9Smrgm4_if([$1], [v7],
969350952b9Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
970350952b9Smrg     [m4_case([$1], [ustar],, [pax],,
971350952b9Smrg              [m4_fatal([Unknown tar format])])
972350952b9SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
973350952b9Smrg# Loop over all known methods to create a tar archive until one works.
974350952b9Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
975350952b9Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
976350952b9Smrg# Do not fold the above two line into one, because Tru64 sh and
977350952b9Smrg# Solaris sh will not grok spaces in the rhs of `-'.
978350952b9Smrgfor _am_tool in $_am_tools
979350952b9Smrgdo
980350952b9Smrg  case $_am_tool in
981350952b9Smrg  gnutar)
982350952b9Smrg    for _am_tar in tar gnutar gtar;
983350952b9Smrg    do
984350952b9Smrg      AM_RUN_LOG([$_am_tar --version]) && break
985350952b9Smrg    done
986350952b9Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
987350952b9Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
988350952b9Smrg    am__untar="$_am_tar -xf -"
989350952b9Smrg    ;;
990350952b9Smrg  plaintar)
991350952b9Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
992350952b9Smrg    # ustar tarball either.
993350952b9Smrg    (tar --version) >/dev/null 2>&1 && continue
994350952b9Smrg    am__tar='tar chf - "$$tardir"'
995350952b9Smrg    am__tar_='tar chf - "$tardir"'
996350952b9Smrg    am__untar='tar xf -'
997350952b9Smrg    ;;
998350952b9Smrg  pax)
999350952b9Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
1000350952b9Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
1001350952b9Smrg    am__untar='pax -r'
1002350952b9Smrg    ;;
1003350952b9Smrg  cpio)
1004350952b9Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1005350952b9Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1006350952b9Smrg    am__untar='cpio -i -H $1 -d'
1007350952b9Smrg    ;;
1008350952b9Smrg  none)
1009350952b9Smrg    am__tar=false
1010350952b9Smrg    am__tar_=false
1011350952b9Smrg    am__untar=false
1012350952b9Smrg    ;;
1013350952b9Smrg  esac
1014fd7d9bd3Smrg
1015350952b9Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
1016350952b9Smrg  # and am__untar set.
1017350952b9Smrg  test -n "${am_cv_prog_tar_$1}" && break
1018350952b9Smrg
1019350952b9Smrg  # tar/untar a dummy directory, and stop if the command works
1020350952b9Smrg  rm -rf conftest.dir
1021350952b9Smrg  mkdir conftest.dir
1022350952b9Smrg  echo GrepMe > conftest.dir/file
1023350952b9Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1024350952b9Smrg  rm -rf conftest.dir
1025350952b9Smrg  if test -s conftest.tar; then
1026350952b9Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1027350952b9Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1028350952b9Smrg  fi
1029350952b9Smrgdone
1030350952b9Smrgrm -rf conftest.dir
1031350952b9Smrg
1032350952b9SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1033350952b9SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1034350952b9SmrgAC_SUBST([am__tar])
1035350952b9SmrgAC_SUBST([am__untar])
1036350952b9Smrg]) # _AM_PROG_TAR
1037fd7d9bd3Smrg
1038a85aecdfSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1039a85aecdfSmrg# 
1040a85aecdfSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1041a85aecdfSmrg#
1042a85aecdfSmrg# This program is free software; you can redistribute it and/or modify
1043a85aecdfSmrg# it under the terms of the GNU General Public License as published by
1044a85aecdfSmrg# the Free Software Foundation; either version 2 of the License, or
1045a85aecdfSmrg# (at your option) any later version.
1046a85aecdfSmrg#
1047a85aecdfSmrg# This program is distributed in the hope that it will be useful, but
1048a85aecdfSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1049a85aecdfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1050a85aecdfSmrg# General Public License for more details.
1051a85aecdfSmrg#
1052a85aecdfSmrg# You should have received a copy of the GNU General Public License
1053a85aecdfSmrg# along with this program; if not, write to the Free Software
1054a85aecdfSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1055a85aecdfSmrg#
1056a85aecdfSmrg# As a special exception to the GNU General Public License, if you
1057a85aecdfSmrg# distribute this file as part of a program that contains a
1058a85aecdfSmrg# configuration script generated by Autoconf, you may include it under
1059a85aecdfSmrg# the same distribution terms that you use for the rest of that program.
1060a85aecdfSmrg
1061a85aecdfSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1062a85aecdfSmrg# ----------------------------------
1063a85aecdfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1064a85aecdfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1065a85aecdfSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1066a85aecdfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1067a85aecdfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1068a85aecdfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1069a85aecdfSmrgfi
1070a85aecdfSmrgif test -n "$PKG_CONFIG"; then
1071a85aecdfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1072a85aecdfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1073a85aecdfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1074a85aecdfSmrg		AC_MSG_RESULT([yes])
1075a85aecdfSmrg	else
1076a85aecdfSmrg		AC_MSG_RESULT([no])
1077a85aecdfSmrg		PKG_CONFIG=""
1078a85aecdfSmrg	fi
1079a85aecdfSmrg		
1080a85aecdfSmrgfi[]dnl
1081a85aecdfSmrg])# PKG_PROG_PKG_CONFIG
1082a85aecdfSmrg
1083a85aecdfSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1084a85aecdfSmrg#
1085a85aecdfSmrg# Check to see whether a particular set of modules exists.  Similar
1086a85aecdfSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1087a85aecdfSmrg#
1088a85aecdfSmrg#
1089a85aecdfSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1090a85aecdfSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1091a85aecdfSmrg# PKG_CHECK_EXISTS manually
1092a85aecdfSmrg# --------------------------------------------------------------
1093a85aecdfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1094a85aecdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1095a85aecdfSmrgif test -n "$PKG_CONFIG" && \
1096a85aecdfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1097a85aecdfSmrg  m4_ifval([$2], [$2], [:])
1098a85aecdfSmrgm4_ifvaln([$3], [else
1099a85aecdfSmrg  $3])dnl
1100a85aecdfSmrgfi])
1101a85aecdfSmrg
1102a85aecdfSmrg
1103a85aecdfSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1104a85aecdfSmrg# ---------------------------------------------
1105a85aecdfSmrgm4_define([_PKG_CONFIG],
1106a85aecdfSmrg[if test -n "$$1"; then
1107a85aecdfSmrg    pkg_cv_[]$1="$$1"
1108a85aecdfSmrg elif test -n "$PKG_CONFIG"; then
1109a85aecdfSmrg    PKG_CHECK_EXISTS([$3],
1110a85aecdfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1111a85aecdfSmrg		     [pkg_failed=yes])
1112a85aecdfSmrg else
1113a85aecdfSmrg    pkg_failed=untried
1114a85aecdfSmrgfi[]dnl
1115a85aecdfSmrg])# _PKG_CONFIG
1116a85aecdfSmrg
1117a85aecdfSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1118a85aecdfSmrg# -----------------------------
1119a85aecdfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1120a85aecdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1121a85aecdfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1122a85aecdfSmrg        _pkg_short_errors_supported=yes
1123a85aecdfSmrgelse
1124a85aecdfSmrg        _pkg_short_errors_supported=no
1125a85aecdfSmrgfi[]dnl
1126a85aecdfSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1127a85aecdfSmrg
1128a85aecdfSmrg
1129a85aecdfSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1130a85aecdfSmrg# [ACTION-IF-NOT-FOUND])
1131a85aecdfSmrg#
1132a85aecdfSmrg#
1133a85aecdfSmrg# Note that if there is a possibility the first call to
1134a85aecdfSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1135a85aecdfSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1136a85aecdfSmrg#
1137a85aecdfSmrg#
1138a85aecdfSmrg# --------------------------------------------------------------
1139a85aecdfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1140a85aecdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1141a85aecdfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1142a85aecdfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1143a85aecdfSmrg
1144a85aecdfSmrgpkg_failed=no
1145a85aecdfSmrgAC_MSG_CHECKING([for $1])
1146a85aecdfSmrg
1147a85aecdfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1148a85aecdfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1149a85aecdfSmrg
1150a85aecdfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1151a85aecdfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1152a85aecdfSmrgSee the pkg-config man page for more details.])
1153a85aecdfSmrg
1154a85aecdfSmrgif test $pkg_failed = yes; then
1155a85aecdfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1156a85aecdfSmrg        if test $_pkg_short_errors_supported = yes; then
1157a85aecdfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1158a85aecdfSmrg        else 
1159a85aecdfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1160a85aecdfSmrg        fi
1161a85aecdfSmrg	# Put the nasty error message in config.log where it belongs
1162a85aecdfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1163a85aecdfSmrg
1164a85aecdfSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1165a85aecdfSmrg[Package requirements ($2) were not met:
1166a85aecdfSmrg
1167a85aecdfSmrg$$1_PKG_ERRORS
1168a85aecdfSmrg
1169a85aecdfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1170a85aecdfSmrginstalled software in a non-standard prefix.
1171a85aecdfSmrg
1172a85aecdfSmrg_PKG_TEXT
1173a85aecdfSmrg])],
1174a85aecdfSmrg		[AC_MSG_RESULT([no])
1175a85aecdfSmrg                $4])
1176a85aecdfSmrgelif test $pkg_failed = untried; then
1177a85aecdfSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1178a85aecdfSmrg[The pkg-config script could not be found or is too old.  Make sure it
1179a85aecdfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1180a85aecdfSmrgpath to pkg-config.
1181a85aecdfSmrg
1182a85aecdfSmrg_PKG_TEXT
1183a85aecdfSmrg
1184a85aecdfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1185a85aecdfSmrg		[$4])
1186a85aecdfSmrgelse
1187a85aecdfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1188a85aecdfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1189a85aecdfSmrg        AC_MSG_RESULT([yes])
1190a85aecdfSmrg	ifelse([$3], , :, [$3])
1191a85aecdfSmrgfi[]dnl
1192a85aecdfSmrg])# PKG_CHECK_MODULES
1193a85aecdfSmrg
1194350952b9Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1195fd7d9bd3Smrgdnl
11969aa2a2b5Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1197fd7d9bd3Smrgdnl 
1198350952b9Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
11999aa2a2b5Smrgdnl copy of this software and associated documentation files (the "Software"),
12009aa2a2b5Smrgdnl to deal in the Software without restriction, including without limitation
12019aa2a2b5Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
12029aa2a2b5Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
12039aa2a2b5Smrgdnl Software is furnished to do so, subject to the following conditions:
1204350952b9Smrgdnl
12059aa2a2b5Smrgdnl The above copyright notice and this permission notice (including the next
12069aa2a2b5Smrgdnl paragraph) shall be included in all copies or substantial portions of the
12079aa2a2b5Smrgdnl Software.
1208350952b9Smrgdnl
12099aa2a2b5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12109aa2a2b5Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12119aa2a2b5Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
12129aa2a2b5Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12139aa2a2b5Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
12149aa2a2b5Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
12159aa2a2b5Smrgdnl DEALINGS IN THE SOFTWARE.
1216350952b9Smrg
1217350952b9Smrg# XORG_MACROS_VERSION(required-version)
1218350952b9Smrg# -------------------------------------
1219350952b9Smrg# Minimum version: 1.1.0
1220350952b9Smrg#
1221350952b9Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1222350952b9Smrg# your configure.ac with the minimum required version, such as:
1223350952b9Smrg# XORG_MACROS_VERSION(1.1)
1224350952b9Smrg#
1225350952b9Smrg# To ensure that this macro is defined, also add:
1226350952b9Smrg# m4_ifndef([XORG_MACROS_VERSION],
1227350952b9Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1228350952b9Smrg#
1229350952b9Smrg#
1230350952b9Smrg# See the "minimum version" comment for each macro you use to see what 
1231350952b9Smrg# version you require.
1232350952b9Smrgm4_defun([XORG_MACROS_VERSION],[
1233a85aecdfSmrgm4_define([vers_have], [1.17])
1234350952b9Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1235350952b9Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1236350952b9Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1237350952b9Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1238350952b9Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1239350952b9Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1240350952b9Smrgm4_undefine([vers_have])
1241350952b9Smrgm4_undefine([maj_have])
1242350952b9Smrgm4_undefine([maj_needed])
1243350952b9Smrg]) # XORG_MACROS_VERSION
1244fd7d9bd3Smrg
1245fd7d9bd3Smrg# XORG_PROG_RAWCPP()
1246fd7d9bd3Smrg# ------------------
1247350952b9Smrg# Minimum version: 1.0.0
1248350952b9Smrg#
1249fd7d9bd3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1250fd7d9bd3Smrg# such as man pages and config files
1251fd7d9bd3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1252fd7d9bd3SmrgAC_REQUIRE([AC_PROG_CPP])
1253fd7d9bd3SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1254fd7d9bd3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1255fd7d9bd3Smrg
1256fd7d9bd3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1257fd7d9bd3Smrg# which is not the best choice for supporting other OS'es, but covers most
1258fd7d9bd3Smrg# of the ones we need for now.
1259fd7d9bd3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1260a85aecdfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1261fd7d9bd3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1262fd7d9bd3Smrg	AC_MSG_RESULT([no])
1263fd7d9bd3Smrgelse
1264fd7d9bd3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1265fd7d9bd3Smrg		RAWCPPFLAGS=-undef
1266fd7d9bd3Smrg		AC_MSG_RESULT([yes])
1267350952b9Smrg	# under Cygwin unix is still defined even with -undef
1268350952b9Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1269350952b9Smrg		RAWCPPFLAGS="-undef -ansi"
1270350952b9Smrg		AC_MSG_RESULT([yes, with -ansi])
1271fd7d9bd3Smrg	else
1272fd7d9bd3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1273fd7d9bd3Smrg	fi
1274fd7d9bd3Smrgfi
1275fd7d9bd3Smrgrm -f conftest.$ac_ext
1276fd7d9bd3Smrg
1277fd7d9bd3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1278a85aecdfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1279fd7d9bd3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1280fd7d9bd3Smrg	AC_MSG_RESULT([no])
1281fd7d9bd3Smrgelse
1282fd7d9bd3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1283fd7d9bd3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1284fd7d9bd3Smrg		AC_MSG_RESULT([yes])
1285fd7d9bd3Smrg	else
1286fd7d9bd3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1287fd7d9bd3Smrg	fi
1288fd7d9bd3Smrgfi
1289fd7d9bd3Smrgrm -f conftest.$ac_ext
1290fd7d9bd3SmrgAC_SUBST(RAWCPPFLAGS)
1291fd7d9bd3Smrg]) # XORG_PROG_RAWCPP
1292fd7d9bd3Smrg
1293fd7d9bd3Smrg# XORG_MANPAGE_SECTIONS()
1294fd7d9bd3Smrg# -----------------------
1295350952b9Smrg# Minimum version: 1.0.0
1296350952b9Smrg#
1297fd7d9bd3Smrg# Determine which sections man pages go in for the different man page types
1298fd7d9bd3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1299fd7d9bd3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1300fd7d9bd3Smrg# Override default settings by setting environment variables
13019aa2a2b5Smrg# Added MAN_SUBSTS in version 1.8
13029aa2a2b5Smrg# Added AC_PROG_SED in version 1.8
1303fd7d9bd3Smrg
1304fd7d9bd3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1305fd7d9bd3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
13069aa2a2b5SmrgAC_REQUIRE([AC_PROG_SED])
1307fd7d9bd3Smrg
1308fd7d9bd3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1309350952b9Smrg    APP_MAN_SUFFIX=1
1310fd7d9bd3Smrgfi
1311fd7d9bd3Smrgif test x$APP_MAN_DIR = x    ; then
1312350952b9Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1313fd7d9bd3Smrgfi
1314fd7d9bd3Smrg
1315fd7d9bd3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1316350952b9Smrg    LIB_MAN_SUFFIX=3
1317fd7d9bd3Smrgfi
1318fd7d9bd3Smrgif test x$LIB_MAN_DIR = x    ; then
1319350952b9Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1320fd7d9bd3Smrgfi
1321fd7d9bd3Smrg
1322fd7d9bd3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1323fd7d9bd3Smrg    case $host_os in
1324fd7d9bd3Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1325fd7d9bd3Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1326fd7d9bd3Smrg    esac
1327fd7d9bd3Smrgfi
1328fd7d9bd3Smrgif test x$FILE_MAN_DIR = x    ; then
1329350952b9Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1330fd7d9bd3Smrgfi
1331fd7d9bd3Smrg
1332fd7d9bd3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1333fd7d9bd3Smrg    case $host_os in
1334fd7d9bd3Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1335fd7d9bd3Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1336fd7d9bd3Smrg    esac
1337fd7d9bd3Smrgfi
1338fd7d9bd3Smrgif test x$MISC_MAN_DIR = x    ; then
1339350952b9Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1340fd7d9bd3Smrgfi
1341fd7d9bd3Smrg
1342fd7d9bd3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1343fd7d9bd3Smrg    case $host_os in
1344fd7d9bd3Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1345fd7d9bd3Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1346fd7d9bd3Smrg    esac
1347fd7d9bd3Smrgfi
1348fd7d9bd3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1349350952b9Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1350fd7d9bd3Smrgfi
1351fd7d9bd3Smrg
1352fd7d9bd3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1353fd7d9bd3Smrg    case $host_os in
1354fd7d9bd3Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1355fd7d9bd3Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1356fd7d9bd3Smrg    esac
1357fd7d9bd3Smrgfi
1358fd7d9bd3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1359fd7d9bd3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1360fd7d9bd3Smrgfi
1361fd7d9bd3Smrg
1362fd7d9bd3Smrg
1363fd7d9bd3SmrgAC_SUBST([APP_MAN_SUFFIX])
1364fd7d9bd3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1365fd7d9bd3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1366fd7d9bd3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1367fd7d9bd3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1368fd7d9bd3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1369fd7d9bd3SmrgAC_SUBST([APP_MAN_DIR])
1370fd7d9bd3SmrgAC_SUBST([LIB_MAN_DIR])
1371fd7d9bd3SmrgAC_SUBST([FILE_MAN_DIR])
1372fd7d9bd3SmrgAC_SUBST([MISC_MAN_DIR])
1373fd7d9bd3SmrgAC_SUBST([DRIVER_MAN_DIR])
1374fd7d9bd3SmrgAC_SUBST([ADMIN_MAN_DIR])
13759aa2a2b5Smrg
13769aa2a2b5SmrgXORG_MAN_PAGE="X Version 11"
13779aa2a2b5SmrgAC_SUBST([XORG_MAN_PAGE])
13789aa2a2b5SmrgMAN_SUBSTS="\
13799aa2a2b5Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13809aa2a2b5Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13819aa2a2b5Smrg	-e 's|__xservername__|Xorg|g' \
13829aa2a2b5Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
13839aa2a2b5Smrg	-e 's|__projectroot__|\$(prefix)|g' \
13849aa2a2b5Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
13859aa2a2b5Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
13869aa2a2b5Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
13879aa2a2b5Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
13889aa2a2b5Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
13899aa2a2b5Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
13909aa2a2b5Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
13919aa2a2b5SmrgAC_SUBST([MAN_SUBSTS])
13929aa2a2b5Smrg
1393fd7d9bd3Smrg]) # XORG_MANPAGE_SECTIONS
1394fd7d9bd3Smrg
13959aa2a2b5Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
13969aa2a2b5Smrg# ------------------------
13979aa2a2b5Smrg# Minimum version: 1.7.0
13989aa2a2b5Smrg#
13999aa2a2b5Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
14009aa2a2b5Smrg# provided by xorg-sgml-doctools, if installed.
14019aa2a2b5SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
14029aa2a2b5SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
14039aa2a2b5SmrgXORG_SGML_PATH=
14049aa2a2b5SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
14059aa2a2b5Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
14069aa2a2b5Smrg    [m4_ifval([$1],[:],
14079aa2a2b5Smrg        [if test x"$cross_compiling" != x"yes" ; then
14089aa2a2b5Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
14099aa2a2b5Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
14109aa2a2b5Smrg         fi])
14119aa2a2b5Smrg    ])
14129aa2a2b5Smrg
14139aa2a2b5Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
14149aa2a2b5Smrg# the path and the name of the doc stylesheet
14159aa2a2b5Smrgif test "x$XORG_SGML_PATH" != "x" ; then
14169aa2a2b5Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
14179aa2a2b5Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
14189aa2a2b5Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
14199aa2a2b5Smrgelse
14209aa2a2b5Smrg   AC_MSG_RESULT([no])
14219aa2a2b5Smrgfi
14229aa2a2b5Smrg
14239aa2a2b5SmrgAC_SUBST(XORG_SGML_PATH)
14249aa2a2b5SmrgAC_SUBST(STYLESHEET_SRCDIR)
14259aa2a2b5SmrgAC_SUBST(XSL_STYLESHEET)
14269aa2a2b5SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
14279aa2a2b5Smrg]) # XORG_CHECK_SGML_DOCTOOLS
14289aa2a2b5Smrg
1429fd7d9bd3Smrg# XORG_CHECK_LINUXDOC
1430fd7d9bd3Smrg# -------------------
1431350952b9Smrg# Minimum version: 1.0.0
1432350952b9Smrg#
1433fd7d9bd3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1434fd7d9bd3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1435fd7d9bd3Smrg# Whether or not the necessary tools and files are found can be checked
1436fd7d9bd3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1437fd7d9bd3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
14389aa2a2b5SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14399aa2a2b5SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1440fd7d9bd3Smrg
1441fd7d9bd3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1442fd7d9bd3Smrg
14439aa2a2b5SmrgAC_MSG_CHECKING([whether to build documentation])
1444fd7d9bd3Smrg
14459aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1446fd7d9bd3Smrg   BUILDDOC=yes
1447fd7d9bd3Smrgelse
1448fd7d9bd3Smrg   BUILDDOC=no
1449fd7d9bd3Smrgfi
1450fd7d9bd3Smrg
1451fd7d9bd3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1452fd7d9bd3Smrg
1453fd7d9bd3SmrgAC_MSG_RESULT([$BUILDDOC])
1454fd7d9bd3Smrg
14559aa2a2b5SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1456fd7d9bd3Smrg
14579aa2a2b5Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1458fd7d9bd3Smrg   BUILDPDFDOC=yes
1459fd7d9bd3Smrgelse
1460fd7d9bd3Smrg   BUILDPDFDOC=no
1461fd7d9bd3Smrgfi
1462fd7d9bd3Smrg
1463fd7d9bd3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1464fd7d9bd3Smrg
1465fd7d9bd3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1466fd7d9bd3Smrg
14679aa2a2b5SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1468350952b9SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1469fd7d9bd3SmrgMAKE_PDF="$PS2PDF"
1470350952b9SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1471fd7d9bd3Smrg
1472fd7d9bd3SmrgAC_SUBST(MAKE_TEXT)
1473fd7d9bd3SmrgAC_SUBST(MAKE_PS)
1474fd7d9bd3SmrgAC_SUBST(MAKE_PDF)
1475fd7d9bd3SmrgAC_SUBST(MAKE_HTML)
1476fd7d9bd3Smrg]) # XORG_CHECK_LINUXDOC
1477fd7d9bd3Smrg
1478350952b9Smrg# XORG_CHECK_DOCBOOK
1479350952b9Smrg# -------------------
1480350952b9Smrg# Minimum version: 1.0.0
1481350952b9Smrg#
1482350952b9Smrg# Checks for the ability to build output formats from SGML DocBook source.
1483350952b9Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1484350952b9Smrg# indicates whether the necessary tools and files are found and, if set,
1485350952b9Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1486350952b9SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
14879aa2a2b5SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14889aa2a2b5Smrg
1489350952b9SmrgBUILDTXTDOC=no
1490350952b9SmrgBUILDPDFDOC=no
1491350952b9SmrgBUILDPSDOC=no
1492350952b9SmrgBUILDHTMLDOC=no
1493350952b9Smrg
1494350952b9SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1495350952b9SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1496350952b9SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1497350952b9SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1498350952b9Smrg
14999aa2a2b5SmrgAC_MSG_CHECKING([whether to build text documentation])
15009aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1501350952b9Smrg   test x$BUILD_TXTDOC != xno; then
1502350952b9Smrg	BUILDTXTDOC=yes
1503350952b9Smrgfi
1504350952b9SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1505350952b9SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1506350952b9Smrg
15079aa2a2b5SmrgAC_MSG_CHECKING([whether to build PDF documentation])
15089aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1509350952b9Smrg   test x$BUILD_PDFDOC != xno; then
1510350952b9Smrg	BUILDPDFDOC=yes
1511350952b9Smrgfi
1512350952b9SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1513350952b9SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1514350952b9Smrg
15159aa2a2b5SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
15169aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1517350952b9Smrg   test x$BUILD_PSDOC != xno; then
1518350952b9Smrg	BUILDPSDOC=yes
1519350952b9Smrgfi
1520350952b9SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1521350952b9SmrgAC_MSG_RESULT([$BUILDPSDOC])
1522350952b9Smrg
15239aa2a2b5SmrgAC_MSG_CHECKING([whether to build HTML documentation])
15249aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1525350952b9Smrg   test x$BUILD_HTMLDOC != xno; then
1526350952b9Smrg	BUILDHTMLDOC=yes
1527350952b9Smrgfi
1528350952b9SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1529350952b9SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1530350952b9Smrg
1531350952b9SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1532350952b9SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1533350952b9SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1534350952b9SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1535350952b9Smrg
1536350952b9SmrgAC_SUBST(MAKE_TEXT)
1537350952b9SmrgAC_SUBST(MAKE_PS)
1538350952b9SmrgAC_SUBST(MAKE_PDF)
1539350952b9SmrgAC_SUBST(MAKE_HTML)
1540350952b9Smrg]) # XORG_CHECK_DOCBOOK
1541350952b9Smrg
15429aa2a2b5Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
15439aa2a2b5Smrg# ----------------
15449aa2a2b5Smrg# Minimum version: 1.5.0
15459aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
15469aa2a2b5Smrg#
15479aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
15489aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
15499aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
15509aa2a2b5Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
15519aa2a2b5Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
15529aa2a2b5Smrg# --with-xmlto assumes 'auto'.
15539aa2a2b5Smrg#
15549aa2a2b5Smrg# Interface to module:
15559aa2a2b5Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
15569aa2a2b5Smrg# XMLTO:	returns the path of the xmlto program found
15579aa2a2b5Smrg#		returns the path set by the user in the environment
15589aa2a2b5Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
15599aa2a2b5Smrg#		'no' user instructs the module not to use xmlto
15609aa2a2b5Smrg#
15619aa2a2b5Smrg# Added in version 1.10.0
15629aa2a2b5Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
15639aa2a2b5Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
15649aa2a2b5Smrg#
15659aa2a2b5Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
15669aa2a2b5Smrg#
15679aa2a2b5SmrgAC_DEFUN([XORG_WITH_XMLTO],[
15689aa2a2b5SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
15699aa2a2b5Smrgm4_define([_defopt], m4_default([$2], [auto]))
15709aa2a2b5SmrgAC_ARG_WITH(xmlto,
15719aa2a2b5Smrg	AS_HELP_STRING([--with-xmlto],
15729aa2a2b5Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
15739aa2a2b5Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
15749aa2a2b5Smrgm4_undefine([_defopt])
15759aa2a2b5Smrg
15769aa2a2b5Smrgif test "x$use_xmlto" = x"auto"; then
15779aa2a2b5Smrg   AC_PATH_PROG([XMLTO], [xmlto])
15789aa2a2b5Smrg   if test "x$XMLTO" = "x"; then
15799aa2a2b5Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
15809aa2a2b5Smrg	have_xmlto=no
15819aa2a2b5Smrg   else
15829aa2a2b5Smrg        have_xmlto=yes
15839aa2a2b5Smrg   fi
15849aa2a2b5Smrgelif test "x$use_xmlto" = x"yes" ; then
15859aa2a2b5Smrg   AC_PATH_PROG([XMLTO], [xmlto])
15869aa2a2b5Smrg   if test "x$XMLTO" = "x"; then
15879aa2a2b5Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
15889aa2a2b5Smrg   fi
15899aa2a2b5Smrg   have_xmlto=yes
15909aa2a2b5Smrgelif test "x$use_xmlto" = x"no" ; then
15919aa2a2b5Smrg   if test "x$XMLTO" != "x"; then
15929aa2a2b5Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
15939aa2a2b5Smrg   fi
15949aa2a2b5Smrg   have_xmlto=no
15959aa2a2b5Smrgelse
15969aa2a2b5Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
15979aa2a2b5Smrgfi
15989aa2a2b5Smrg
15999aa2a2b5Smrg# Test for a minimum version of xmlto, if provided.
16009aa2a2b5Smrgm4_ifval([$1],
16019aa2a2b5Smrg[if test "$have_xmlto" = yes; then
16029aa2a2b5Smrg    # scrape the xmlto version
16039aa2a2b5Smrg    AC_MSG_CHECKING([the xmlto version])
16049aa2a2b5Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
16059aa2a2b5Smrg    AC_MSG_RESULT([$xmlto_version])
16069aa2a2b5Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
16079aa2a2b5Smrg        [if test "x$use_xmlto" = xauto; then
16089aa2a2b5Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
16099aa2a2b5Smrg            have_xmlto=no
16109aa2a2b5Smrg        else
16119aa2a2b5Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
16129aa2a2b5Smrg        fi])
16139aa2a2b5Smrgfi])
16149aa2a2b5Smrg
16159aa2a2b5Smrg# Test for the ability of xmlto to generate a text target
16169aa2a2b5Smrghave_xmlto_text=no
16179aa2a2b5Smrgcat > conftest.xml << "EOF"
16189aa2a2b5SmrgEOF
16199aa2a2b5SmrgAS_IF([test "$have_xmlto" = yes],
16209aa2a2b5Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
16219aa2a2b5Smrg             [have_xmlto_text=yes],
16229aa2a2b5Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
16239aa2a2b5Smrgrm -f conftest.xml
16249aa2a2b5SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
16259aa2a2b5SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
16269aa2a2b5Smrg]) # XORG_WITH_XMLTO
16279aa2a2b5Smrg
1628a85aecdfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1629a85aecdfSmrg# --------------------------------------------
1630a85aecdfSmrg# Minimum version: 1.12.0
1631a85aecdfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1632a85aecdfSmrg#
1633a85aecdfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1634a85aecdfSmrg# XML-based language used for the transformation of XML documents.
1635a85aecdfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1636a85aecdfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1637a85aecdfSmrg# The XSLT processor is often used as a standalone tool for transformations.
1638a85aecdfSmrg# It should not be assumed that this tool is used only to work with documnetation.
1639a85aecdfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1640a85aecdfSmrg#
1641a85aecdfSmrg# Interface to module:
1642a85aecdfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1643a85aecdfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1644a85aecdfSmrg#		 returns the path set by the user in the environment
1645a85aecdfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1646a85aecdfSmrg#		  'no' user instructs the module not to use xsltproc
1647a85aecdfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1648a85aecdfSmrg#
1649a85aecdfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1650a85aecdfSmrg#
1651a85aecdfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1652a85aecdfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1653a85aecdfSmrg# Preserves the interface, should it be implemented later
1654a85aecdfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1655a85aecdfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1656a85aecdfSmrgAC_ARG_WITH(xsltproc,
1657a85aecdfSmrg	AS_HELP_STRING([--with-xsltproc],
1658a85aecdfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1659a85aecdfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1660a85aecdfSmrgm4_undefine([_defopt])
1661a85aecdfSmrg
1662a85aecdfSmrgif test "x$use_xsltproc" = x"auto"; then
1663a85aecdfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1664a85aecdfSmrg   if test "x$XSLTPROC" = "x"; then
1665a85aecdfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1666a85aecdfSmrg	have_xsltproc=no
1667a85aecdfSmrg   else
1668a85aecdfSmrg        have_xsltproc=yes
1669a85aecdfSmrg   fi
1670a85aecdfSmrgelif test "x$use_xsltproc" = x"yes" ; then
1671a85aecdfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1672a85aecdfSmrg   if test "x$XSLTPROC" = "x"; then
1673a85aecdfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1674a85aecdfSmrg   fi
1675a85aecdfSmrg   have_xsltproc=yes
1676a85aecdfSmrgelif test "x$use_xsltproc" = x"no" ; then
1677a85aecdfSmrg   if test "x$XSLTPROC" != "x"; then
1678a85aecdfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1679a85aecdfSmrg   fi
1680a85aecdfSmrg   have_xsltproc=no
1681a85aecdfSmrgelse
1682a85aecdfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1683a85aecdfSmrgfi
1684a85aecdfSmrg
1685a85aecdfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1686a85aecdfSmrg]) # XORG_WITH_XSLTPROC
1687a85aecdfSmrg
1688a85aecdfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1689a85aecdfSmrg# ----------------------------------------
1690a85aecdfSmrg# Minimum version: 1.15.0
1691a85aecdfSmrg#
1692a85aecdfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1693a85aecdfSmrg# scanning arbitrary text files, extracting information from those text files,
1694a85aecdfSmrg# and printing reports based on that information.
1695a85aecdfSmrg#
1696a85aecdfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1697a85aecdfSmrg#
1698a85aecdfSmrg# Interface to module:
1699a85aecdfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1700a85aecdfSmrg# PERL:	     returns the path of the perl program found
1701a85aecdfSmrg#	     returns the path set by the user in the environment
1702a85aecdfSmrg# --with-perl: 'yes' user instructs the module to use perl
1703a85aecdfSmrg#	       'no' user instructs the module not to use perl
1704a85aecdfSmrg# have_perl: returns yes if perl found in PATH or no
1705a85aecdfSmrg#
1706a85aecdfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1707a85aecdfSmrg#
1708a85aecdfSmrgAC_DEFUN([XORG_WITH_PERL],[
1709a85aecdfSmrgAC_ARG_VAR([PERL], [Path to perl command])
1710a85aecdfSmrg# Preserves the interface, should it be implemented later
1711a85aecdfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1712a85aecdfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1713a85aecdfSmrgAC_ARG_WITH(perl,
1714a85aecdfSmrg	AS_HELP_STRING([--with-perl],
1715a85aecdfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1716a85aecdfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1717a85aecdfSmrgm4_undefine([_defopt])
1718a85aecdfSmrg
1719a85aecdfSmrgif test "x$use_perl" = x"auto"; then
1720a85aecdfSmrg   AC_PATH_PROG([PERL], [perl])
1721a85aecdfSmrg   if test "x$PERL" = "x"; then
1722a85aecdfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1723a85aecdfSmrg	have_perl=no
1724a85aecdfSmrg   else
1725a85aecdfSmrg        have_perl=yes
1726a85aecdfSmrg   fi
1727a85aecdfSmrgelif test "x$use_perl" = x"yes" ; then
1728a85aecdfSmrg   AC_PATH_PROG([PERL], [perl])
1729a85aecdfSmrg   if test "x$PERL" = "x"; then
1730a85aecdfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1731a85aecdfSmrg   fi
1732a85aecdfSmrg   have_perl=yes
1733a85aecdfSmrgelif test "x$use_perl" = x"no" ; then
1734a85aecdfSmrg   if test "x$PERL" != "x"; then
1735a85aecdfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1736a85aecdfSmrg   fi
1737a85aecdfSmrg   have_perl=no
1738a85aecdfSmrgelse
1739a85aecdfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1740a85aecdfSmrgfi
1741a85aecdfSmrg
1742a85aecdfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1743a85aecdfSmrg]) # XORG_WITH_PERL
1744a85aecdfSmrg
17459aa2a2b5Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
17469aa2a2b5Smrg# ----------------
17479aa2a2b5Smrg# Minimum version: 1.5.0
17489aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17499aa2a2b5Smrg#
17509aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
17519aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
17529aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17539aa2a2b5Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
17549aa2a2b5Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
17559aa2a2b5Smrg# --with-asciidoc assumes 'auto'.
17569aa2a2b5Smrg#
17579aa2a2b5Smrg# Interface to module:
17589aa2a2b5Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
17599aa2a2b5Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
17609aa2a2b5Smrg#		 returns the path set by the user in the environment
17619aa2a2b5Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
17629aa2a2b5Smrg#		  'no' user instructs the module not to use asciidoc
17639aa2a2b5Smrg#
17649aa2a2b5Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
17659aa2a2b5Smrg#
17669aa2a2b5SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
17679aa2a2b5SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
17689aa2a2b5Smrgm4_define([_defopt], m4_default([$2], [auto]))
17699aa2a2b5SmrgAC_ARG_WITH(asciidoc,
17709aa2a2b5Smrg	AS_HELP_STRING([--with-asciidoc],
17719aa2a2b5Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
17729aa2a2b5Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
17739aa2a2b5Smrgm4_undefine([_defopt])
17749aa2a2b5Smrg
17759aa2a2b5Smrgif test "x$use_asciidoc" = x"auto"; then
17769aa2a2b5Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17779aa2a2b5Smrg   if test "x$ASCIIDOC" = "x"; then
17789aa2a2b5Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
17799aa2a2b5Smrg	have_asciidoc=no
17809aa2a2b5Smrg   else
17819aa2a2b5Smrg        have_asciidoc=yes
17829aa2a2b5Smrg   fi
17839aa2a2b5Smrgelif test "x$use_asciidoc" = x"yes" ; then
17849aa2a2b5Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17859aa2a2b5Smrg   if test "x$ASCIIDOC" = "x"; then
17869aa2a2b5Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
17879aa2a2b5Smrg   fi
17889aa2a2b5Smrg   have_asciidoc=yes
17899aa2a2b5Smrgelif test "x$use_asciidoc" = x"no" ; then
17909aa2a2b5Smrg   if test "x$ASCIIDOC" != "x"; then
17919aa2a2b5Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
17929aa2a2b5Smrg   fi
17939aa2a2b5Smrg   have_asciidoc=no
17949aa2a2b5Smrgelse
17959aa2a2b5Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
17969aa2a2b5Smrgfi
17979aa2a2b5Smrgm4_ifval([$1],
17989aa2a2b5Smrg[if test "$have_asciidoc" = yes; then
17999aa2a2b5Smrg    # scrape the asciidoc version
18009aa2a2b5Smrg    AC_MSG_CHECKING([the asciidoc version])
18019aa2a2b5Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
18029aa2a2b5Smrg    AC_MSG_RESULT([$asciidoc_version])
18039aa2a2b5Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
18049aa2a2b5Smrg        [if test "x$use_asciidoc" = xauto; then
18059aa2a2b5Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
18069aa2a2b5Smrg            have_asciidoc=no
18079aa2a2b5Smrg        else
18089aa2a2b5Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
18099aa2a2b5Smrg        fi])
18109aa2a2b5Smrgfi])
18119aa2a2b5SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
18129aa2a2b5Smrg]) # XORG_WITH_ASCIIDOC
18139aa2a2b5Smrg
18149aa2a2b5Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
18159aa2a2b5Smrg# --------------------------------
18169aa2a2b5Smrg# Minimum version: 1.5.0
18179aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18189aa2a2b5Smrg#
18199aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
18209aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
18219aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
18229aa2a2b5Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
18239aa2a2b5Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
18249aa2a2b5Smrg# --with-doxygen assumes 'auto'.
18259aa2a2b5Smrg#
18269aa2a2b5Smrg# Interface to module:
18279aa2a2b5Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
18289aa2a2b5Smrg# DOXYGEN:	 returns the path of the doxygen program found
18299aa2a2b5Smrg#		 returns the path set by the user in the environment
18309aa2a2b5Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
18319aa2a2b5Smrg#		  'no' user instructs the module not to use doxygen
18329aa2a2b5Smrg#
18339aa2a2b5Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
18349aa2a2b5Smrg#
18359aa2a2b5SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
18369aa2a2b5SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
18379aa2a2b5Smrgm4_define([_defopt], m4_default([$2], [auto]))
18389aa2a2b5SmrgAC_ARG_WITH(doxygen,
18399aa2a2b5Smrg	AS_HELP_STRING([--with-doxygen],
18409aa2a2b5Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
18419aa2a2b5Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
18429aa2a2b5Smrgm4_undefine([_defopt])
18439aa2a2b5Smrg
18449aa2a2b5Smrgif test "x$use_doxygen" = x"auto"; then
18459aa2a2b5Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18469aa2a2b5Smrg   if test "x$DOXYGEN" = "x"; then
18479aa2a2b5Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
18489aa2a2b5Smrg	have_doxygen=no
18499aa2a2b5Smrg   else
18509aa2a2b5Smrg        have_doxygen=yes
18519aa2a2b5Smrg   fi
18529aa2a2b5Smrgelif test "x$use_doxygen" = x"yes" ; then
18539aa2a2b5Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18549aa2a2b5Smrg   if test "x$DOXYGEN" = "x"; then
18559aa2a2b5Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
18569aa2a2b5Smrg   fi
18579aa2a2b5Smrg   have_doxygen=yes
18589aa2a2b5Smrgelif test "x$use_doxygen" = x"no" ; then
18599aa2a2b5Smrg   if test "x$DOXYGEN" != "x"; then
18609aa2a2b5Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
18619aa2a2b5Smrg   fi
18629aa2a2b5Smrg   have_doxygen=no
18639aa2a2b5Smrgelse
18649aa2a2b5Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
18659aa2a2b5Smrgfi
18669aa2a2b5Smrgm4_ifval([$1],
18679aa2a2b5Smrg[if test "$have_doxygen" = yes; then
18689aa2a2b5Smrg    # scrape the doxygen version
18699aa2a2b5Smrg    AC_MSG_CHECKING([the doxygen version])
18709aa2a2b5Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
18719aa2a2b5Smrg    AC_MSG_RESULT([$doxygen_version])
18729aa2a2b5Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
18739aa2a2b5Smrg        [if test "x$use_doxygen" = xauto; then
18749aa2a2b5Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
18759aa2a2b5Smrg            have_doxygen=no
18769aa2a2b5Smrg        else
18779aa2a2b5Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
18789aa2a2b5Smrg        fi])
18799aa2a2b5Smrgfi])
18809aa2a2b5SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
18819aa2a2b5Smrg]) # XORG_WITH_DOXYGEN
18829aa2a2b5Smrg
18839aa2a2b5Smrg# XORG_WITH_GROFF([DEFAULT])
18849aa2a2b5Smrg# ----------------
18859aa2a2b5Smrg# Minimum version: 1.6.0
18869aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18879aa2a2b5Smrg#
18889aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
18899aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
18909aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
18919aa2a2b5Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
18929aa2a2b5Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
18939aa2a2b5Smrg# --with-groff assumes 'auto'.
18949aa2a2b5Smrg#
18959aa2a2b5Smrg# Interface to module:
18969aa2a2b5Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
18979aa2a2b5Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
18989aa2a2b5Smrg# HAVE_GROFF_MS: the -ms macros package
18999aa2a2b5Smrg# GROFF:	 returns the path of the groff program found
19009aa2a2b5Smrg#		 returns the path set by the user in the environment
19019aa2a2b5Smrg# --with-groff:	 'yes' user instructs the module to use groff
19029aa2a2b5Smrg#		 'no' user instructs the module not to use groff
19039aa2a2b5Smrg#
19049aa2a2b5Smrg# Added in version 1.9.0:
19059aa2a2b5Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
19069aa2a2b5Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
19079aa2a2b5Smrg#		   psselect from the psutils package.
19089aa2a2b5Smrg#		   the ghostcript package. Refer to the grohtml man pages
19099aa2a2b5Smrg#
19109aa2a2b5Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
19119aa2a2b5Smrg#
19129aa2a2b5Smrg# OS and distros often splits groff in a basic and full package, the former
19139aa2a2b5Smrg# having the groff program and the later having devices, fonts and macros
19149aa2a2b5Smrg# Checking for the groff executable is not enough.
19159aa2a2b5Smrg#
19169aa2a2b5Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
19179aa2a2b5Smrg# unset HAVE_GROFF or GROFF env variables.
19189aa2a2b5Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
19199aa2a2b5Smrg#
19209aa2a2b5SmrgAC_DEFUN([XORG_WITH_GROFF],[
19219aa2a2b5SmrgAC_ARG_VAR([GROFF], [Path to groff command])
19229aa2a2b5Smrgm4_define([_defopt], m4_default([$1], [auto]))
19239aa2a2b5SmrgAC_ARG_WITH(groff,
19249aa2a2b5Smrg	AS_HELP_STRING([--with-groff],
19259aa2a2b5Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
19269aa2a2b5Smrg	   [use_groff=$withval], [use_groff=]_defopt)
19279aa2a2b5Smrgm4_undefine([_defopt])
19289aa2a2b5Smrg
19299aa2a2b5Smrgif test "x$use_groff" = x"auto"; then
19309aa2a2b5Smrg   AC_PATH_PROG([GROFF], [groff])
19319aa2a2b5Smrg   if test "x$GROFF" = "x"; then
19329aa2a2b5Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
19339aa2a2b5Smrg	have_groff=no
19349aa2a2b5Smrg   else
19359aa2a2b5Smrg        have_groff=yes
19369aa2a2b5Smrg   fi
19379aa2a2b5Smrgelif test "x$use_groff" = x"yes" ; then
19389aa2a2b5Smrg   AC_PATH_PROG([GROFF], [groff])
19399aa2a2b5Smrg   if test "x$GROFF" = "x"; then
19409aa2a2b5Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
19419aa2a2b5Smrg   fi
19429aa2a2b5Smrg   have_groff=yes
19439aa2a2b5Smrgelif test "x$use_groff" = x"no" ; then
19449aa2a2b5Smrg   if test "x$GROFF" != "x"; then
19459aa2a2b5Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
19469aa2a2b5Smrg   fi
19479aa2a2b5Smrg   have_groff=no
19489aa2a2b5Smrgelse
19499aa2a2b5Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19509aa2a2b5Smrgfi
19519aa2a2b5Smrg
19529aa2a2b5Smrg# We have groff, test for the presence of the macro packages
19539aa2a2b5Smrgif test "x$have_groff" = x"yes"; then
19549aa2a2b5Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
19559aa2a2b5Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
19569aa2a2b5Smrg        groff_ms_works=yes
19579aa2a2b5Smrg    else
19589aa2a2b5Smrg        groff_ms_works=no
19599aa2a2b5Smrg    fi
19609aa2a2b5Smrg    AC_MSG_RESULT([$groff_ms_works])
19619aa2a2b5Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
19629aa2a2b5Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
19639aa2a2b5Smrg        groff_mm_works=yes
19649aa2a2b5Smrg    else
19659aa2a2b5Smrg        groff_mm_works=no
19669aa2a2b5Smrg    fi
19679aa2a2b5Smrg    AC_MSG_RESULT([$groff_mm_works])
19689aa2a2b5Smrgfi
19699aa2a2b5Smrg
19709aa2a2b5Smrg# We have groff, test for HTML dependencies, one command per package
19719aa2a2b5Smrgif test "x$have_groff" = x"yes"; then
19729aa2a2b5Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
19739aa2a2b5Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
19749aa2a2b5Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
19759aa2a2b5Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
19769aa2a2b5Smrg      have_groff_html=yes
19779aa2a2b5Smrg   else
19789aa2a2b5Smrg      have_groff_html=no
19799aa2a2b5Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
19809aa2a2b5Smrg   fi
19819aa2a2b5Smrgfi
19829aa2a2b5Smrg
19839aa2a2b5Smrg# Set Automake conditionals for Makefiles
19849aa2a2b5SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
19859aa2a2b5SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
19869aa2a2b5SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
19879aa2a2b5SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
19889aa2a2b5Smrg]) # XORG_WITH_GROFF
19899aa2a2b5Smrg
1990a85aecdfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1991a85aecdfSmrg# ---------------------------------------
19929aa2a2b5Smrg# Minimum version: 1.6.0
19939aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1994a85aecdfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
19959aa2a2b5Smrg#
19969aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
19979aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
19989aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19999aa2a2b5Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
20009aa2a2b5Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
20019aa2a2b5Smrg# --with-fop assumes 'auto'.
20029aa2a2b5Smrg#
20039aa2a2b5Smrg# Interface to module:
20049aa2a2b5Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
20059aa2a2b5Smrg# FOP:	 	returns the path of the fop program found
20069aa2a2b5Smrg#		returns the path set by the user in the environment
20079aa2a2b5Smrg# --with-fop: 	'yes' user instructs the module to use fop
20089aa2a2b5Smrg#		'no' user instructs the module not to use fop
20099aa2a2b5Smrg#
20109aa2a2b5Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
20119aa2a2b5Smrg#
20129aa2a2b5SmrgAC_DEFUN([XORG_WITH_FOP],[
20139aa2a2b5SmrgAC_ARG_VAR([FOP], [Path to fop command])
2014a85aecdfSmrgm4_define([_defopt], m4_default([$2], [auto]))
20159aa2a2b5SmrgAC_ARG_WITH(fop,
20169aa2a2b5Smrg	AS_HELP_STRING([--with-fop],
20179aa2a2b5Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
20189aa2a2b5Smrg	   [use_fop=$withval], [use_fop=]_defopt)
20199aa2a2b5Smrgm4_undefine([_defopt])
20209aa2a2b5Smrg
20219aa2a2b5Smrgif test "x$use_fop" = x"auto"; then
20229aa2a2b5Smrg   AC_PATH_PROG([FOP], [fop])
20239aa2a2b5Smrg   if test "x$FOP" = "x"; then
20249aa2a2b5Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
20259aa2a2b5Smrg	have_fop=no
20269aa2a2b5Smrg   else
20279aa2a2b5Smrg        have_fop=yes
20289aa2a2b5Smrg   fi
20299aa2a2b5Smrgelif test "x$use_fop" = x"yes" ; then
20309aa2a2b5Smrg   AC_PATH_PROG([FOP], [fop])
20319aa2a2b5Smrg   if test "x$FOP" = "x"; then
20329aa2a2b5Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
20339aa2a2b5Smrg   fi
20349aa2a2b5Smrg   have_fop=yes
20359aa2a2b5Smrgelif test "x$use_fop" = x"no" ; then
20369aa2a2b5Smrg   if test "x$FOP" != "x"; then
20379aa2a2b5Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
20389aa2a2b5Smrg   fi
20399aa2a2b5Smrg   have_fop=no
20409aa2a2b5Smrgelse
20419aa2a2b5Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20429aa2a2b5Smrgfi
2043a85aecdfSmrg
2044a85aecdfSmrg# Test for a minimum version of fop, if provided.
2045a85aecdfSmrgm4_ifval([$1],
2046a85aecdfSmrg[if test "$have_fop" = yes; then
2047a85aecdfSmrg    # scrape the fop version
2048a85aecdfSmrg    AC_MSG_CHECKING([for fop minimum version])
2049a85aecdfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2050a85aecdfSmrg    AC_MSG_RESULT([$fop_version])
2051a85aecdfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2052a85aecdfSmrg        [if test "x$use_fop" = xauto; then
2053a85aecdfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2054a85aecdfSmrg            have_fop=no
2055a85aecdfSmrg        else
2056a85aecdfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2057a85aecdfSmrg        fi])
2058a85aecdfSmrgfi])
20599aa2a2b5SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
20609aa2a2b5Smrg]) # XORG_WITH_FOP
20619aa2a2b5Smrg
20629aa2a2b5Smrg# XORG_WITH_PS2PDF([DEFAULT])
20639aa2a2b5Smrg# ----------------
20649aa2a2b5Smrg# Minimum version: 1.6.0
20659aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20669aa2a2b5Smrg#
20679aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
20689aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
20699aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20709aa2a2b5Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
20719aa2a2b5Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
20729aa2a2b5Smrg# --with-ps2pdf assumes 'auto'.
20739aa2a2b5Smrg#
20749aa2a2b5Smrg# Interface to module:
20759aa2a2b5Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
20769aa2a2b5Smrg# PS2PDF:	returns the path of the ps2pdf program found
20779aa2a2b5Smrg#		returns the path set by the user in the environment
20789aa2a2b5Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
20799aa2a2b5Smrg#		 'no' user instructs the module not to use ps2pdf
20809aa2a2b5Smrg#
20819aa2a2b5Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
20829aa2a2b5Smrg#
20839aa2a2b5SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
20849aa2a2b5SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
20859aa2a2b5Smrgm4_define([_defopt], m4_default([$1], [auto]))
20869aa2a2b5SmrgAC_ARG_WITH(ps2pdf,
20879aa2a2b5Smrg	AS_HELP_STRING([--with-ps2pdf],
20889aa2a2b5Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
20899aa2a2b5Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
20909aa2a2b5Smrgm4_undefine([_defopt])
20919aa2a2b5Smrg
20929aa2a2b5Smrgif test "x$use_ps2pdf" = x"auto"; then
20939aa2a2b5Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
20949aa2a2b5Smrg   if test "x$PS2PDF" = "x"; then
20959aa2a2b5Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
20969aa2a2b5Smrg	have_ps2pdf=no
20979aa2a2b5Smrg   else
20989aa2a2b5Smrg        have_ps2pdf=yes
20999aa2a2b5Smrg   fi
21009aa2a2b5Smrgelif test "x$use_ps2pdf" = x"yes" ; then
21019aa2a2b5Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
21029aa2a2b5Smrg   if test "x$PS2PDF" = "x"; then
21039aa2a2b5Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
21049aa2a2b5Smrg   fi
21059aa2a2b5Smrg   have_ps2pdf=yes
21069aa2a2b5Smrgelif test "x$use_ps2pdf" = x"no" ; then
21079aa2a2b5Smrg   if test "x$PS2PDF" != "x"; then
21089aa2a2b5Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
21099aa2a2b5Smrg   fi
21109aa2a2b5Smrg   have_ps2pdf=no
21119aa2a2b5Smrgelse
21129aa2a2b5Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
21139aa2a2b5Smrgfi
21149aa2a2b5SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
21159aa2a2b5Smrg]) # XORG_WITH_PS2PDF
21169aa2a2b5Smrg
21179aa2a2b5Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
21189aa2a2b5Smrg# ----------------
21199aa2a2b5Smrg# Minimum version: 1.6.0
21209aa2a2b5Smrg#
21219aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
21229aa2a2b5Smrg# not at the appropriate level. This macro enables a builder to skip all
21239aa2a2b5Smrg# documentation targets except traditional man pages.
21249aa2a2b5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21259aa2a2b5Smrg# maximum flexibilty in controlling documentation building.
21269aa2a2b5Smrg# Refer to:
21279aa2a2b5Smrg# XORG_WITH_XMLTO         --with-xmlto
21289aa2a2b5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21299aa2a2b5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21309aa2a2b5Smrg# XORG_WITH_FOP           --with-fop
21319aa2a2b5Smrg# XORG_WITH_GROFF         --with-groff
21329aa2a2b5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21339aa2a2b5Smrg#
21349aa2a2b5Smrg# Interface to module:
21359aa2a2b5Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
21369aa2a2b5Smrg# --enable-docs: 'yes' user instructs the module to generate docs
21379aa2a2b5Smrg#		 'no' user instructs the module not to generate docs
21389aa2a2b5Smrg# parm1:	specify the default value, yes or no.
21399aa2a2b5Smrg#
21409aa2a2b5SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2141a85aecdfSmrgm4_define([docs_default], m4_default([$1], [yes]))
21429aa2a2b5SmrgAC_ARG_ENABLE(docs,
21439aa2a2b5Smrg	AS_HELP_STRING([--enable-docs],
2144a85aecdfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2145a85aecdfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2146a85aecdfSmrgm4_undefine([docs_default])
21479aa2a2b5SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
21489aa2a2b5SmrgAC_MSG_CHECKING([whether to build documentation])
21499aa2a2b5SmrgAC_MSG_RESULT([$build_docs])
21509aa2a2b5Smrg]) # XORG_ENABLE_DOCS
21519aa2a2b5Smrg
21529aa2a2b5Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
21539aa2a2b5Smrg# ----------------
21549aa2a2b5Smrg# Minimum version: 1.6.0
21559aa2a2b5Smrg#
21569aa2a2b5Smrg# This macro enables a builder to skip all developer documentation.
21579aa2a2b5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21589aa2a2b5Smrg# maximum flexibilty in controlling documentation building.
21599aa2a2b5Smrg# Refer to:
21609aa2a2b5Smrg# XORG_WITH_XMLTO         --with-xmlto
21619aa2a2b5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21629aa2a2b5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21639aa2a2b5Smrg# XORG_WITH_FOP           --with-fop
21649aa2a2b5Smrg# XORG_WITH_GROFF         --with-groff
21659aa2a2b5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21669aa2a2b5Smrg#
21679aa2a2b5Smrg# Interface to module:
21689aa2a2b5Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
21699aa2a2b5Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
21709aa2a2b5Smrg#			'no' user instructs the module not to generate developer docs
21719aa2a2b5Smrg# parm1:		specify the default value, yes or no.
21729aa2a2b5Smrg#
21739aa2a2b5SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
21749aa2a2b5Smrgm4_define([devel_default], m4_default([$1], [yes]))
21759aa2a2b5SmrgAC_ARG_ENABLE(devel-docs,
21769aa2a2b5Smrg	AS_HELP_STRING([--enable-devel-docs],
21779aa2a2b5Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
21789aa2a2b5Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
21799aa2a2b5Smrgm4_undefine([devel_default])
21809aa2a2b5SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
21819aa2a2b5SmrgAC_MSG_CHECKING([whether to build developer documentation])
21829aa2a2b5SmrgAC_MSG_RESULT([$build_devel_docs])
21839aa2a2b5Smrg]) # XORG_ENABLE_DEVEL_DOCS
21849aa2a2b5Smrg
21859aa2a2b5Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
21869aa2a2b5Smrg# ----------------
21879aa2a2b5Smrg# Minimum version: 1.6.0
21889aa2a2b5Smrg#
21899aa2a2b5Smrg# This macro enables a builder to skip all functional specification targets.
21909aa2a2b5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21919aa2a2b5Smrg# maximum flexibilty in controlling documentation building.
21929aa2a2b5Smrg# Refer to:
21939aa2a2b5Smrg# XORG_WITH_XMLTO         --with-xmlto
21949aa2a2b5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21959aa2a2b5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21969aa2a2b5Smrg# XORG_WITH_FOP           --with-fop
21979aa2a2b5Smrg# XORG_WITH_GROFF         --with-groff
21989aa2a2b5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21999aa2a2b5Smrg#
22009aa2a2b5Smrg# Interface to module:
22019aa2a2b5Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
22029aa2a2b5Smrg# --enable-specs:	'yes' user instructs the module to generate specs
22039aa2a2b5Smrg#			'no' user instructs the module not to generate specs
22049aa2a2b5Smrg# parm1:		specify the default value, yes or no.
22059aa2a2b5Smrg#
22069aa2a2b5SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
22079aa2a2b5Smrgm4_define([spec_default], m4_default([$1], [yes]))
22089aa2a2b5SmrgAC_ARG_ENABLE(specs,
22099aa2a2b5Smrg	AS_HELP_STRING([--enable-specs],
22109aa2a2b5Smrg	   [Enable building the specs (default: ]spec_default[)]),
22119aa2a2b5Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
22129aa2a2b5Smrgm4_undefine([spec_default])
22139aa2a2b5SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
22149aa2a2b5SmrgAC_MSG_CHECKING([whether to build functional specifications])
22159aa2a2b5SmrgAC_MSG_RESULT([$build_specs])
22169aa2a2b5Smrg]) # XORG_ENABLE_SPECS
22179aa2a2b5Smrg
2218a85aecdfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2219a85aecdfSmrg# ----------------------------------------------
2220a85aecdfSmrg# Minimum version: 1.13.0
2221a85aecdfSmrg#
2222a85aecdfSmrg# This macro enables a builder to enable/disable unit testing
2223a85aecdfSmrg# It makes no assumption about the test cases implementation
2224a85aecdfSmrg# Test cases may or may not use Automake "Support for test suites"
2225a85aecdfSmrg# They may or may not use the software utility library GLib
2226a85aecdfSmrg#
2227a85aecdfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2228a85aecdfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2229a85aecdfSmrg# The variable enable_unit_tests is used by other macros in this file.
2230a85aecdfSmrg#
2231a85aecdfSmrg# Interface to module:
2232a85aecdfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2233a85aecdfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2234a85aecdfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2235a85aecdfSmrg#			'no' user instructs the module not to build tests
2236a85aecdfSmrg# parm1:		specify the default value, yes or no.
2237a85aecdfSmrg#
2238a85aecdfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2239a85aecdfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2240a85aecdfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2241a85aecdfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2242a85aecdfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2243a85aecdfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2244a85aecdfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2245a85aecdfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2246a85aecdfSmrgm4_undefine([_defopt])
2247a85aecdfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2248a85aecdfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2249a85aecdfSmrgAC_MSG_RESULT([$enable_unit_tests])
2250a85aecdfSmrg]) # XORG_ENABLE_UNIT_TESTS
2251a85aecdfSmrg
2252a85aecdfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2253a85aecdfSmrg# ------------------------------------------------------
2254a85aecdfSmrg# Minimum version: 1.17.0
2255a85aecdfSmrg#
2256a85aecdfSmrg# This macro enables a builder to enable/disable integration testing
2257a85aecdfSmrg# It makes no assumption about the test cases' implementation
2258a85aecdfSmrg# Test cases may or may not use Automake "Support for test suites"
2259a85aecdfSmrg#
2260a85aecdfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2261a85aecdfSmrg# usually requires less dependencies and may be built and run under less
2262a85aecdfSmrg# stringent environments than integration tests.
2263a85aecdfSmrg#
2264a85aecdfSmrg# Interface to module:
2265a85aecdfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2266a85aecdfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2267a85aecdfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2268a85aecdfSmrg#                             'no' user instructs the module not to build tests
2269a85aecdfSmrg# parm1:                      specify the default value, yes or no.
2270a85aecdfSmrg#
2271a85aecdfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2272a85aecdfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2273a85aecdfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2274a85aecdfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2275a85aecdfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2276a85aecdfSmrg	[enable_integration_tests=$enableval],
2277a85aecdfSmrg	[enable_integration_tests=]_defopt)
2278a85aecdfSmrgm4_undefine([_defopt])
2279a85aecdfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2280a85aecdfSmrg	[test "x$enable_integration_tests" != xno])
2281a85aecdfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2282a85aecdfSmrgAC_MSG_RESULT([$enable_integration_tests])
2283a85aecdfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2284a85aecdfSmrg
2285a85aecdfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2286a85aecdfSmrg# ----------------------------------------
2287a85aecdfSmrg# Minimum version: 1.13.0
2288a85aecdfSmrg#
2289a85aecdfSmrg# GLib is a library which provides advanced data structures and functions.
2290a85aecdfSmrg# This macro enables a module to test for the presence of Glib.
2291a85aecdfSmrg#
2292a85aecdfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2293a85aecdfSmrg# Otherwise the value of $enable_unit_tests is blank.
2294a85aecdfSmrg#
2295a85aecdfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2296a85aecdfSmrg# test support usually requires less dependencies and may be built and run under
2297a85aecdfSmrg# less stringent environments than integration tests.
2298a85aecdfSmrg#
2299a85aecdfSmrg# Interface to module:
2300a85aecdfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2301a85aecdfSmrg# with_glib: used in configure.ac to know if GLib has been found
2302a85aecdfSmrg# --with-glib:	'yes' user instructs the module to use glib
2303a85aecdfSmrg#		'no' user instructs the module not to use glib
2304a85aecdfSmrg#
2305a85aecdfSmrgAC_DEFUN([XORG_WITH_GLIB],[
2306a85aecdfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2307a85aecdfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2308a85aecdfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2309a85aecdfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2310a85aecdfSmrg	[with_glib=$withval], [with_glib=]_defopt)
2311a85aecdfSmrgm4_undefine([_defopt])
2312a85aecdfSmrg
2313a85aecdfSmrghave_glib=no
2314a85aecdfSmrg# Do not probe GLib if user explicitly disabled unit testing
2315a85aecdfSmrgif test "x$enable_unit_tests" != x"no"; then
2316a85aecdfSmrg  # Do not probe GLib if user explicitly disabled it
2317a85aecdfSmrg  if test "x$with_glib" != x"no"; then
2318a85aecdfSmrg    m4_ifval(
2319a85aecdfSmrg      [$1],
2320a85aecdfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2321a85aecdfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2322a85aecdfSmrg    )
2323a85aecdfSmrg  fi
2324a85aecdfSmrgfi
2325a85aecdfSmrg
2326a85aecdfSmrg# Not having GLib when unit testing has been explicitly requested is an error
2327a85aecdfSmrgif test "x$enable_unit_tests" = x"yes"; then
2328a85aecdfSmrg  if test "x$have_glib" = x"no"; then
2329a85aecdfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2330a85aecdfSmrg  fi
2331a85aecdfSmrgfi
2332a85aecdfSmrg
2333a85aecdfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2334a85aecdfSmrgif test "x$enable_unit_tests" = x"no"; then
2335a85aecdfSmrg  if test "x$with_glib" = x"yes"; then
2336a85aecdfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2337a85aecdfSmrg  fi
2338a85aecdfSmrgfi
2339a85aecdfSmrg
2340a85aecdfSmrg# Not having GLib when it has been explicitly requested is an error
2341a85aecdfSmrgif test "x$with_glib" = x"yes"; then
2342a85aecdfSmrg  if test "x$have_glib" = x"no"; then
2343a85aecdfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2344a85aecdfSmrg  fi
2345a85aecdfSmrgfi
2346a85aecdfSmrg
2347a85aecdfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2348a85aecdfSmrg]) # XORG_WITH_GLIB
2349a85aecdfSmrg
2350a85aecdfSmrg# XORG_LD_WRAP([required|optional])
2351a85aecdfSmrg# ---------------------------------
2352a85aecdfSmrg# Minimum version: 1.13.0
2353a85aecdfSmrg#
2354a85aecdfSmrg# Check if linker supports -wrap, passed via compiler flags
2355a85aecdfSmrg#
2356a85aecdfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2357a85aecdfSmrg# Otherwise the value of $enable_unit_tests is blank.
2358a85aecdfSmrg#
2359a85aecdfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2360a85aecdfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2361a85aecdfSmrg# available, an argument of "optional" allows use when some unit tests require
2362a85aecdfSmrg# ld -wrap and others do not.
2363a85aecdfSmrg#
2364a85aecdfSmrgAC_DEFUN([XORG_LD_WRAP],[
2365a85aecdfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2366a85aecdfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2367a85aecdfSmrg                      void __wrap_exit(int status) { return; }],
2368a85aecdfSmrg                     [exit(0);])])
2369a85aecdfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2370a85aecdfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2371a85aecdfSmrg  if test "x$have_ld_wrap" = x"no"; then
2372a85aecdfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2373a85aecdfSmrg  fi
2374a85aecdfSmrgfi
2375a85aecdfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2376a85aecdfSmrg#
2377a85aecdfSmrg]) # XORG_LD_WRAP
2378a85aecdfSmrg
2379a85aecdfSmrg# XORG_CHECK_LINKER_FLAGS
2380a85aecdfSmrg# -----------------------
2381a85aecdfSmrg# SYNOPSIS
2382a85aecdfSmrg#
2383a85aecdfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2384a85aecdfSmrg#
2385a85aecdfSmrg# DESCRIPTION
2386a85aecdfSmrg#
2387a85aecdfSmrg#   Check whether the given linker FLAGS work with the current language's
2388a85aecdfSmrg#   linker, or whether they give an error.
2389a85aecdfSmrg#
2390a85aecdfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2391a85aecdfSmrg#   success/failure.
2392a85aecdfSmrg#
2393a85aecdfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2394a85aecdfSmrg#
2395a85aecdfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2396a85aecdfSmrg#
2397a85aecdfSmrg# LICENSE
2398a85aecdfSmrg#
2399a85aecdfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2400a85aecdfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2401a85aecdfSmrg#   Copyright (c) 2009 Matteo Frigo
2402a85aecdfSmrg#
2403a85aecdfSmrg#   This program is free software: you can redistribute it and/or modify it
2404a85aecdfSmrg#   under the terms of the GNU General Public License as published by the
2405a85aecdfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2406a85aecdfSmrg#   option) any later version.
2407a85aecdfSmrg#
2408a85aecdfSmrg#   This program is distributed in the hope that it will be useful, but
2409a85aecdfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2410a85aecdfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2411a85aecdfSmrg#   Public License for more details.
2412a85aecdfSmrg#
2413a85aecdfSmrg#   You should have received a copy of the GNU General Public License along
2414a85aecdfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2415a85aecdfSmrg#
2416a85aecdfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2417a85aecdfSmrg#   gives unlimited permission to copy, distribute and modify the configure
2418a85aecdfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2419a85aecdfSmrg#   need not follow the terms of the GNU General Public License when using
2420a85aecdfSmrg#   or distributing such scripts, even though portions of the text of the
2421a85aecdfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2422a85aecdfSmrg#   all other use of the material that constitutes the Autoconf Macro.
2423a85aecdfSmrg#
2424a85aecdfSmrg#   This special exception to the GPL applies to versions of the Autoconf
2425a85aecdfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2426a85aecdfSmrg#   modified version of the Autoconf Macro, you may extend this special
2427a85aecdfSmrg#   exception to the GPL to apply to your modified version as well.#
2428a85aecdfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2429a85aecdfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2430a85aecdfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2431a85aecdfSmrgAS_LITERAL_IF([$1],
2432a85aecdfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2433a85aecdfSmrg      ax_save_FLAGS=$LDFLAGS
2434a85aecdfSmrg      LDFLAGS="$1"
2435a85aecdfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2436a85aecdfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2437a85aecdfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2438a85aecdfSmrg      LDFLAGS=$ax_save_FLAGS])],
2439a85aecdfSmrg  [ax_save_FLAGS=$LDFLAGS
2440a85aecdfSmrg   LDFLAGS="$1"
2441a85aecdfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2442a85aecdfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2443a85aecdfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2444a85aecdfSmrg   LDFLAGS=$ax_save_FLAGS])
2445a85aecdfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2446a85aecdfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2447a85aecdfSmrgif test "x$xorg_check_linker_flags" = xyes; then
2448a85aecdfSmrg	m4_default([$2], :)
2449a85aecdfSmrgelse
2450a85aecdfSmrg	m4_default([$3], :)
2451a85aecdfSmrgfi
2452a85aecdfSmrg]) # XORG_CHECK_LINKER_FLAGS
2453a85aecdfSmrg
2454a85aecdfSmrg# XORG_MEMORY_CHECK_FLAGS
2455a85aecdfSmrg# -----------------------
2456a85aecdfSmrg# Minimum version: 1.16.0
2457a85aecdfSmrg#
2458a85aecdfSmrg# This macro attempts to find appropriate memory checking functionality
2459a85aecdfSmrg# for various platforms which unit testing code may use to catch various
2460a85aecdfSmrg# forms of memory allocation and access errors in testing.
2461a85aecdfSmrg#
2462a85aecdfSmrg# Interface to module:
2463a85aecdfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2464a85aecdfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2465a85aecdfSmrg#
2466a85aecdfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2467a85aecdfSmrg#
2468a85aecdfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2469a85aecdfSmrg
2470a85aecdfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2471a85aecdfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2472a85aecdfSmrg           [Environment variables to enable memory checking in tests])
2473a85aecdfSmrg
2474a85aecdfSmrg# Check for different types of support on different platforms
2475a85aecdfSmrgcase $host_os in
2476a85aecdfSmrg    solaris*)
2477a85aecdfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2478a85aecdfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2479a85aecdfSmrg        ;;
2480a85aecdfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2481a85aecdfSmrg        # both directly and inverted, so should not be 0 or 255.
2482a85aecdfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2483a85aecdfSmrg        ;;
2484a85aecdfSmrg    darwin*)
2485a85aecdfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2486a85aecdfSmrg        ;;
2487a85aecdfSmrg    *bsd*)
2488a85aecdfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2489a85aecdfSmrg        ;;
2490a85aecdfSmrgesac
2491a85aecdfSmrg
2492a85aecdfSmrg# User supplied flags override default flags
2493a85aecdfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2494a85aecdfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2495a85aecdfSmrgfi
2496a85aecdfSmrg
2497a85aecdfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2498a85aecdfSmrg]) # XORG_WITH_LINT
2499a85aecdfSmrg
2500fd7d9bd3Smrg# XORG_CHECK_MALLOC_ZERO
2501fd7d9bd3Smrg# ----------------------
2502350952b9Smrg# Minimum version: 1.0.0
2503350952b9Smrg#
2504fd7d9bd3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2505fd7d9bd3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2506fd7d9bd3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2507fd7d9bd3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2508fd7d9bd3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2509350952b9Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2510fd7d9bd3Smrg		       [malloc(0) returns NULL (default: auto)]),
2511fd7d9bd3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2512fd7d9bd3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2513fd7d9bd3Smrg
2514fd7d9bd3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2515fd7d9bd3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2516a85aecdfSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2517a85aecdfSmrg#include <stdlib.h>
2518a85aecdfSmrg],[
2519fd7d9bd3Smrg    char *m0, *r0, *c0, *p;
2520fd7d9bd3Smrg    m0 = malloc(0);
2521fd7d9bd3Smrg    p = malloc(10);
2522fd7d9bd3Smrg    r0 = realloc(p,0);
2523a85aecdfSmrg    c0 = calloc(0,10);
2524a85aecdfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2525a85aecdfSmrg])],
2526fd7d9bd3Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
25279aa2a2b5Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
25289aa2a2b5Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2529fd7d9bd3Smrgfi
2530fd7d9bd3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2531fd7d9bd3Smrg
2532fd7d9bd3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2533fd7d9bd3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2534fd7d9bd3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2535fd7d9bd3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2536fd7d9bd3Smrgelse
2537fd7d9bd3Smrg	MALLOC_ZERO_CFLAGS=""
2538fd7d9bd3Smrg	XMALLOC_ZERO_CFLAGS=""
2539fd7d9bd3Smrg	XTMALLOC_ZERO_CFLAGS=""
2540fd7d9bd3Smrgfi
2541fd7d9bd3Smrg
2542fd7d9bd3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2543fd7d9bd3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2544fd7d9bd3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2545fd7d9bd3Smrg]) # XORG_CHECK_MALLOC_ZERO
2546fd7d9bd3Smrg
2547350952b9Smrg# XORG_WITH_LINT()
2548350952b9Smrg# ----------------
2549350952b9Smrg# Minimum version: 1.1.0
2550350952b9Smrg#
25519aa2a2b5Smrg# This macro enables the use of a tool that flags some suspicious and
25529aa2a2b5Smrg# non-portable constructs (likely to be bugs) in C language source code.
25539aa2a2b5Smrg# It will attempt to locate the tool and use appropriate options.
25549aa2a2b5Smrg# There are various lint type tools on different platforms.
25559aa2a2b5Smrg#
25569aa2a2b5Smrg# Interface to module:
25579aa2a2b5Smrg# LINT:		returns the path to the tool found on the platform
25589aa2a2b5Smrg#		or the value set to LINT on the configure cmd line
25599aa2a2b5Smrg#		also an Automake conditional
25609aa2a2b5Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
25619aa2a2b5Smrg#
25629aa2a2b5Smrg# --with-lint:	'yes' user instructs the module to use lint
25639aa2a2b5Smrg#		'no' user instructs the module not to use lint (default)
25649aa2a2b5Smrg#
25659aa2a2b5Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
25669aa2a2b5Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2567350952b9Smrg#
2568350952b9SmrgAC_DEFUN([XORG_WITH_LINT],[
2569350952b9Smrg
25709aa2a2b5SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
25719aa2a2b5SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2572350952b9SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2573350952b9Smrg		[Use a lint-style source code checker (default: disabled)])],
2574350952b9Smrg		[use_lint=$withval], [use_lint=no])
25759aa2a2b5Smrg
25769aa2a2b5Smrg# Obtain platform specific info like program name and options
25779aa2a2b5Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
25789aa2a2b5Smrgcase $host_os in
25799aa2a2b5Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
25809aa2a2b5Smrg	lint_name=splint
25819aa2a2b5Smrg	lint_options="-badflag"
25829aa2a2b5Smrg	;;
25839aa2a2b5Smrg  *freebsd* | *netbsd*)
25849aa2a2b5Smrg	lint_name=lint
25859aa2a2b5Smrg	lint_options="-u -b"
25869aa2a2b5Smrg	;;
25879aa2a2b5Smrg  *solaris*)
25889aa2a2b5Smrg	lint_name=lint
25899aa2a2b5Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
25909aa2a2b5Smrg	;;
25919aa2a2b5Smrgesac
25929aa2a2b5Smrg
25939aa2a2b5Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
25949aa2a2b5Smrgif test "x$use_lint" = x"yes" ; then
25959aa2a2b5Smrg   AC_PATH_PROG([LINT], [$lint_name])
25969aa2a2b5Smrg   if test "x$LINT" = "x"; then
25979aa2a2b5Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
25989aa2a2b5Smrg   fi
25999aa2a2b5Smrgelif test "x$use_lint" = x"no" ; then
26009aa2a2b5Smrg   if test "x$LINT" != "x"; then
26019aa2a2b5Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
26029aa2a2b5Smrg   fi
2603350952b9Smrgelse
26049aa2a2b5Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2605350952b9Smrgfi
26069aa2a2b5Smrg
26079aa2a2b5Smrg# User supplied flags override default flags
26089aa2a2b5Smrgif test "x$LINT_FLAGS" != "x"; then
26099aa2a2b5Smrg   lint_options=$LINT_FLAGS
2610350952b9Smrgfi
2611350952b9Smrg
26129aa2a2b5SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
26139aa2a2b5SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2614350952b9Smrg
2615350952b9Smrg]) # XORG_WITH_LINT
2616350952b9Smrg
2617350952b9Smrg# XORG_LINT_LIBRARY(LIBNAME)
2618350952b9Smrg# --------------------------
2619350952b9Smrg# Minimum version: 1.1.0
2620350952b9Smrg#
2621350952b9Smrg# Sets up flags for building lint libraries for checking programs that call
2622350952b9Smrg# functions in the library.
2623350952b9Smrg#
26249aa2a2b5Smrg# Interface to module:
26259aa2a2b5Smrg# LINTLIB		- Automake variable with the name of lint library file to make
26269aa2a2b5Smrg# MAKE_LINT_LIB		- Automake conditional
26279aa2a2b5Smrg#
26289aa2a2b5Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
26299aa2a2b5Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2630350952b9Smrg
2631350952b9SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2632350952b9SmrgAC_REQUIRE([XORG_WITH_LINT])
2633350952b9SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2634350952b9Smrg	[Create lint library (default: disabled)])],
2635350952b9Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
26369aa2a2b5Smrg
26379aa2a2b5Smrgif test "x$make_lint_lib" = x"yes" ; then
26389aa2a2b5Smrg   LINTLIB=llib-l$1.ln
26399aa2a2b5Smrg   if test "x$LINT" = "x"; then
26409aa2a2b5Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
26419aa2a2b5Smrg   fi
26429aa2a2b5Smrgelif test "x$make_lint_lib" != x"no" ; then
26439aa2a2b5Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2644350952b9Smrgfi
26459aa2a2b5Smrg
2646350952b9SmrgAC_SUBST(LINTLIB)
2647350952b9SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2648350952b9Smrg
2649350952b9Smrg]) # XORG_LINT_LIBRARY
2650350952b9Smrg
2651a85aecdfSmrg# XORG_COMPILER_BRAND
2652a85aecdfSmrg# -------------------
2653a85aecdfSmrg# Minimum version: 1.14.0
2654a85aecdfSmrg#
2655a85aecdfSmrg# Checks for various brands of compilers and sets flags as appropriate:
2656a85aecdfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2657a85aecdfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2658a85aecdfSmrg#   clang compiler - sets CLANGCC to "yes"
2659a85aecdfSmrg#   Intel compiler - sets INTELCC to "yes"
2660a85aecdfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2661a85aecdfSmrg#
2662a85aecdfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2663a85aecdfSmrgAC_LANG_CASE(
2664a85aecdfSmrg	[C], [
2665a85aecdfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2666a85aecdfSmrg	],
2667a85aecdfSmrg	[C++], [
2668a85aecdfSmrg		AC_REQUIRE([AC_PROG_CXX])
2669a85aecdfSmrg	]
2670a85aecdfSmrg)
2671a85aecdfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2672a85aecdfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2673a85aecdfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2674a85aecdfSmrg]) # XORG_COMPILER_BRAND
2675a85aecdfSmrg
2676a85aecdfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2677a85aecdfSmrg# ---------------
2678a85aecdfSmrg# Minimum version: 1.16.0
2679a85aecdfSmrg#
2680a85aecdfSmrg# Test if the compiler works when passed the given flag as a command line argument.
2681a85aecdfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2682a85aecdfSmrg# next flag in the list until there are no more options.
2683a85aecdfSmrg#
2684a85aecdfSmrg# Note that this does not guarantee that the compiler supports the flag as some
2685a85aecdfSmrg# compilers will simply ignore arguments that they do not understand, but we do
2686a85aecdfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2687a85aecdfSmrg# -Werror=unused-command-line-argument
2688a85aecdfSmrg#
2689a85aecdfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2690a85aecdfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2691a85aecdfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2692a85aecdfSmrg
2693a85aecdfSmrgAC_LANG_COMPILER_REQUIRE
2694a85aecdfSmrg
2695a85aecdfSmrgAC_LANG_CASE(
2696a85aecdfSmrg	[C], [
2697a85aecdfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2698a85aecdfSmrg		define([PREFIX], [C])
2699a85aecdfSmrg		define([CACHE_PREFIX], [cc])
2700a85aecdfSmrg		define([COMPILER], [$CC])
2701a85aecdfSmrg	],
2702a85aecdfSmrg	[C++], [
2703a85aecdfSmrg		define([PREFIX], [CXX])
2704a85aecdfSmrg		define([CACHE_PREFIX], [cxx])
2705a85aecdfSmrg		define([COMPILER], [$CXX])
2706a85aecdfSmrg	]
2707a85aecdfSmrg)
2708a85aecdfSmrg
2709a85aecdfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2710a85aecdfSmrg
2711a85aecdfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2712a85aecdfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2713a85aecdfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2714a85aecdfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2715a85aecdfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2716a85aecdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2717a85aecdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2718a85aecdfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2719a85aecdfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2720a85aecdfSmrgfi
2721a85aecdfSmrg
2722a85aecdfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2723a85aecdfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2724a85aecdfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2725a85aecdfSmrg	fi
2726a85aecdfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2727a85aecdfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2728a85aecdfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2729a85aecdfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2730a85aecdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2731a85aecdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2732a85aecdfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2733a85aecdfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2734a85aecdfSmrgfi
2735a85aecdfSmrg
2736a85aecdfSmrgfound="no"
2737a85aecdfSmrgm4_foreach([flag], m4_cdr($@), [
2738a85aecdfSmrg	if test $found = "no" ; then
2739a85aecdfSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2740a85aecdfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2741a85aecdfSmrg		fi
2742a85aecdfSmrg
2743a85aecdfSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2744a85aecdfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2745a85aecdfSmrg		fi
2746a85aecdfSmrg
2747a85aecdfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2748a85aecdfSmrg
2749a85aecdfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2750a85aecdfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2751a85aecdfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2752a85aecdfSmrg		AC_CACHE_VAL($cacheid,
2753a85aecdfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2754a85aecdfSmrg					     [eval $cacheid=yes],
2755a85aecdfSmrg					     [eval $cacheid=no])])
2756a85aecdfSmrg
2757a85aecdfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2758a85aecdfSmrg
2759a85aecdfSmrg		eval supported=\$$cacheid
2760a85aecdfSmrg		AC_MSG_RESULT([$supported])
2761a85aecdfSmrg		if test "$supported" = "yes" ; then
2762a85aecdfSmrg			$1="$$1 ]flag["
2763a85aecdfSmrg			found="yes"
2764a85aecdfSmrg		fi
2765a85aecdfSmrg	fi
2766a85aecdfSmrg])
2767a85aecdfSmrg]) # XORG_TESTSET_CFLAG
2768a85aecdfSmrg
2769a85aecdfSmrg# XORG_COMPILER_FLAGS
2770a85aecdfSmrg# ---------------
2771a85aecdfSmrg# Minimum version: 1.16.0
2772a85aecdfSmrg#
2773a85aecdfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2774a85aecdfSmrg# arguments supported by the selected compiler which do NOT alter the generated
2775a85aecdfSmrg# code.  These arguments will cause the compiler to print various warnings
2776a85aecdfSmrg# during compilation AND turn a conservative set of warnings into errors.
2777a85aecdfSmrg#
2778a85aecdfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2779a85aecdfSmrg# future versions of util-macros as options are added to new compilers.
2780a85aecdfSmrg#
2781a85aecdfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2782a85aecdfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2783a85aecdfSmrg
2784a85aecdfSmrgAC_ARG_ENABLE(selective-werror,
2785a85aecdfSmrg              AS_HELP_STRING([--disable-selective-werror],
2786a85aecdfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2787a85aecdfSmrg              [SELECTIVE_WERROR=$enableval],
2788a85aecdfSmrg              [SELECTIVE_WERROR=yes])
2789a85aecdfSmrg
2790a85aecdfSmrgAC_LANG_CASE(
2791a85aecdfSmrg        [C], [
2792a85aecdfSmrg                define([PREFIX], [C])
2793a85aecdfSmrg        ],
2794a85aecdfSmrg        [C++], [
2795a85aecdfSmrg                define([PREFIX], [CXX])
2796a85aecdfSmrg        ]
2797a85aecdfSmrg)
2798a85aecdfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2799a85aecdfSmrgif test "x$SUNCC" = "xyes"; then
2800a85aecdfSmrg    [BASE_]PREFIX[FLAGS]="-v"
2801a85aecdfSmrgelse
2802a85aecdfSmrg    [BASE_]PREFIX[FLAGS]=""
2803a85aecdfSmrgfi
2804a85aecdfSmrg
2805a85aecdfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2806a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2807a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2808a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2809a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2810a85aecdfSmrg
2811a85aecdfSmrgAC_LANG_CASE(
2812a85aecdfSmrg	[C], [
2813a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2814a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2815a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2816a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2817a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2818a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2819a85aecdfSmrg	]
2820a85aecdfSmrg)
2821a85aecdfSmrg
2822a85aecdfSmrg# This chunk adds additional warnings that could catch undesired effects.
2823a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2824a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2825a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2826a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2827a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2828a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2829a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2830a85aecdfSmrg
2831a85aecdfSmrg# These are currently disabled because they are noisy.  They will be enabled
2832a85aecdfSmrg# in the future once the codebase is sufficiently modernized to silence
2833a85aecdfSmrg# them.  For now, I don't want them to drown out the other warnings.
2834a85aecdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2835a85aecdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2836a85aecdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2837a85aecdfSmrg
2838a85aecdfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2839a85aecdfSmrg# when there are problems that should be fixed.
2840a85aecdfSmrg
2841a85aecdfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2842a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2843a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2844a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2845a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2846a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2847a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2848a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2849a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2850a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2851a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2852a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2853a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2854a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2855a85aecdfSmrgelse
2856a85aecdfSmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
2857a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2858a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2859a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2860a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2861a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2862a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2863a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2864a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2865a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2866a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2867a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2868a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2869a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2870a85aecdfSmrgfi
2871a85aecdfSmrg
2872a85aecdfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2873a85aecdfSmrg]) # XORG_COMPILER_FLAGS
2874a85aecdfSmrg
2875350952b9Smrg# XORG_CWARNFLAGS
2876350952b9Smrg# ---------------
2877350952b9Smrg# Minimum version: 1.2.0
2878a85aecdfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2879350952b9Smrg#
2880350952b9Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2881350952b9Smrg#
2882a85aecdfSmrg# This function is deprecated because it defines -fno-strict-aliasing
2883a85aecdfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2884a85aecdfSmrg# is needed, then it should be added explicitly in the module when
2885a85aecdfSmrg# it is updated to use BASE_CFLAGS.
2886a85aecdfSmrg#
2887350952b9SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2888a85aecdfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2889a85aecdfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2890a85aecdfSmrgAC_LANG_CASE(
2891a85aecdfSmrg	[C], [
2892a85aecdfSmrg		CWARNFLAGS="$BASE_CFLAGS"
2893a85aecdfSmrg		if  test "x$GCC" = xyes ; then
2894a85aecdfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2895a85aecdfSmrg		fi
2896a85aecdfSmrg		AC_SUBST(CWARNFLAGS)
2897a85aecdfSmrg	]
2898a85aecdfSmrg)
2899350952b9Smrg]) # XORG_CWARNFLAGS
2900350952b9Smrg
2901350952b9Smrg# XORG_STRICT_OPTION
2902350952b9Smrg# -----------------------
2903350952b9Smrg# Minimum version: 1.3.0
2904350952b9Smrg#
2905a85aecdfSmrg# Add configure option to enable strict compilation flags, such as treating
2906a85aecdfSmrg# warnings as fatal errors.
2907a85aecdfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2908a85aecdfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2909a85aecdfSmrg#
2910a85aecdfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2911a85aecdfSmrg# when strict compilation is unconditionally desired.
2912350952b9SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2913350952b9SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2914a85aecdfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2915350952b9Smrg
2916350952b9SmrgAC_ARG_ENABLE(strict-compilation,
2917350952b9Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2918350952b9Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2919350952b9Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2920a85aecdfSmrg
2921a85aecdfSmrgAC_LANG_CASE(
2922a85aecdfSmrg        [C], [
2923a85aecdfSmrg                define([PREFIX], [C])
2924a85aecdfSmrg        ],
2925a85aecdfSmrg        [C++], [
2926a85aecdfSmrg                define([PREFIX], [CXX])
2927a85aecdfSmrg        ]
2928a85aecdfSmrg)
2929a85aecdfSmrg
2930a85aecdfSmrg[STRICT_]PREFIX[FLAGS]=""
2931a85aecdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2932a85aecdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2933a85aecdfSmrg
2934a85aecdfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2935a85aecdfSmrg# activate it with -Werror, so we add it here explicitly.
2936a85aecdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2937a85aecdfSmrg
2938350952b9Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2939a85aecdfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2940a85aecdfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2941350952b9Smrgfi
2942a85aecdfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2943a85aecdfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2944a85aecdfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2945350952b9Smrg]) # XORG_STRICT_OPTION
2946350952b9Smrg
2947350952b9Smrg# XORG_DEFAULT_OPTIONS
2948350952b9Smrg# --------------------
2949350952b9Smrg# Minimum version: 1.3.0
2950350952b9Smrg#
2951350952b9Smrg# Defines default options for X.Org modules.
2952350952b9Smrg#
2953350952b9SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
29549aa2a2b5SmrgAC_REQUIRE([AC_PROG_INSTALL])
2955a85aecdfSmrgXORG_COMPILER_FLAGS
2956350952b9SmrgXORG_CWARNFLAGS
2957350952b9SmrgXORG_STRICT_OPTION
2958350952b9SmrgXORG_RELEASE_VERSION
2959350952b9SmrgXORG_CHANGELOG
29609aa2a2b5SmrgXORG_INSTALL
2961350952b9SmrgXORG_MANPAGE_SECTIONS
29629aa2a2b5Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
29639aa2a2b5Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2964350952b9Smrg]) # XORG_DEFAULT_OPTIONS
29659aa2a2b5Smrg
29669aa2a2b5Smrg# XORG_INSTALL()
29679aa2a2b5Smrg# ----------------
29689aa2a2b5Smrg# Minimum version: 1.4.0
29699aa2a2b5Smrg#
29709aa2a2b5Smrg# Defines the variable INSTALL_CMD as the command to copy
29719aa2a2b5Smrg# INSTALL from $prefix/share/util-macros.
29729aa2a2b5Smrg#
29739aa2a2b5SmrgAC_DEFUN([XORG_INSTALL], [
29749aa2a2b5SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
29759aa2a2b5Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
29769aa2a2b5SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
29779aa2a2b5Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
29789aa2a2b5Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
29799aa2a2b5Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
29809aa2a2b5SmrgAC_SUBST([INSTALL_CMD])
29819aa2a2b5Smrg]) # XORG_INSTALL
2982fd7d9bd3Smrgdnl Copyright 2005 Red Hat, Inc
2983fd7d9bd3Smrgdnl
2984fd7d9bd3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2985fd7d9bd3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2986fd7d9bd3Smrgdnl the above copyright notice appear in all copies and that both that
2987fd7d9bd3Smrgdnl copyright notice and this permission notice appear in supporting
2988fd7d9bd3Smrgdnl documentation.
2989fd7d9bd3Smrgdnl
2990fd7d9bd3Smrgdnl The above copyright notice and this permission notice shall be included
2991fd7d9bd3Smrgdnl in all copies or substantial portions of the Software.
2992fd7d9bd3Smrgdnl
2993fd7d9bd3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2994fd7d9bd3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2995fd7d9bd3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2996fd7d9bd3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2997fd7d9bd3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2998fd7d9bd3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2999fd7d9bd3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3000fd7d9bd3Smrgdnl
3001fd7d9bd3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3002fd7d9bd3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3003fd7d9bd3Smrgdnl other dealings in this Software without prior written authorization
3004fd7d9bd3Smrgdnl from the copyright holders.
3005fd7d9bd3Smrgdnl
3006fd7d9bd3Smrg
3007fd7d9bd3Smrg# XORG_RELEASE_VERSION
3008fd7d9bd3Smrg# --------------------
30099aa2a2b5Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3010fd7d9bd3Smrg 
3011fd7d9bd3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3012350952b9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3013350952b9Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3014350952b9Smrg		[Major version of this package])
3015350952b9Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3016350952b9Smrg	if test "x$PVM" = "x"; then
3017350952b9Smrg		PVM="0"
3018350952b9Smrg	fi
3019350952b9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3020350952b9Smrg		[$PVM],
3021350952b9Smrg		[Minor version of this package])
3022350952b9Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3023350952b9Smrg	if test "x$PVP" = "x"; then
3024350952b9Smrg		PVP="0"
3025350952b9Smrg	fi
3026350952b9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3027350952b9Smrg		[$PVP],
3028350952b9Smrg		[Patch version of this package])
3029fd7d9bd3Smrg])
3030fd7d9bd3Smrg
3031350952b9Smrg# XORG_CHANGELOG()
3032350952b9Smrg# ----------------
3033350952b9Smrg# Minimum version: 1.2.0
3034350952b9Smrg#
3035350952b9Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3036350952b9Smrg# ChangeLog from git.
3037350952b9Smrg#
3038350952b9Smrg#
3039350952b9SmrgAC_DEFUN([XORG_CHANGELOG], [
30409aa2a2b5SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
30419aa2a2b5Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
30429aa2a2b5Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3043350952b9Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3044350952b9SmrgAC_SUBST([CHANGELOG_CMD])
3045350952b9Smrg]) # XORG_CHANGELOG
3046350952b9Smrg
3047