aclocal.m4 revision 8831d3fb
18831d3fbSmrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2100ae103Smrg
3100ae103Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
48831d3fbSmrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
58831d3fbSmrg# Inc.
6100ae103Smrg# This file is free software; the Free Software Foundation
7100ae103Smrg# gives unlimited permission to copy and/or distribute it,
8100ae103Smrg# with or without modifications, as long as this notice is preserved.
9100ae103Smrg
10100ae103Smrg# This program is distributed in the hope that it will be useful,
11100ae103Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12100ae103Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13100ae103Smrg# PARTICULAR PURPOSE.
14100ae103Smrg
15165cb819Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16165cb819Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178831d3fbSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
188831d3fbSmrg[m4_warning([this file was generated for autoconf 2.68.
19165cb819SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20165cb819SmrgIf you have problems, you may need to regenerate the build system entirely.
21165cb819SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22100ae103Smrg
238831d3fbSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
248831d3fbSmrg# Foundation, Inc.
25100ae103Smrg#
26100ae103Smrg# This file is free software; the Free Software Foundation
27100ae103Smrg# gives unlimited permission to copy and/or distribute it,
28100ae103Smrg# with or without modifications, as long as this notice is preserved.
29100ae103Smrg
308831d3fbSmrg# serial 1
318831d3fbSmrg
32100ae103Smrg# AM_AUTOMAKE_VERSION(VERSION)
33100ae103Smrg# ----------------------------
34100ae103Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
35100ae103Smrg# generated from the m4 files accompanying Automake X.Y.
36165cb819Smrg# (This private macro should not be called outside this file.)
37165cb819SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
38165cb819Smrg[am__api_version='1.11'
39165cb819Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40165cb819Smrgdnl require some minimum version.  Point them to the right macro.
418831d3fbSmrgm4_if([$1], [1.11.2], [],
42165cb819Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43165cb819Smrg])
44165cb819Smrg
45165cb819Smrg# _AM_AUTOCONF_VERSION(VERSION)
46165cb819Smrg# -----------------------------
47165cb819Smrg# aclocal traces this macro to find the Autoconf version.
48165cb819Smrg# This is a private macro too.  Using m4_define simplifies
49165cb819Smrg# the logic in aclocal, which can simply ignore this definition.
50165cb819Smrgm4_define([_AM_AUTOCONF_VERSION], [])
51100ae103Smrg
52100ae103Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
53100ae103Smrg# -------------------------------
54165cb819Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
55165cb819Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56100ae103SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
578831d3fbSmrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
58165cb819Smrgm4_ifndef([AC_AUTOCONF_VERSION],
59165cb819Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
60165cb819Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61100ae103Smrg
62100ae103Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
63100ae103Smrg
648831d3fbSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65100ae103Smrg#
66100ae103Smrg# This file is free software; the Free Software Foundation
67100ae103Smrg# gives unlimited permission to copy and/or distribute it,
68100ae103Smrg# with or without modifications, as long as this notice is preserved.
69100ae103Smrg
708831d3fbSmrg# serial 1
718831d3fbSmrg
72100ae103Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73100ae103Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74100ae103Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75100ae103Smrg#
76100ae103Smrg# Of course, Automake must honor this variable whenever it calls a
77100ae103Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
78100ae103Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
79100ae103Smrg# depending on how configure is run.  This is pretty annoying, since
80100ae103Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81100ae103Smrg# source directory, any form will work fine, but in subdirectories a
82100ae103Smrg# relative path needs to be adjusted first.
83100ae103Smrg#
84100ae103Smrg# $ac_aux_dir/missing
85100ae103Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
86100ae103Smrg# $top_srcdir/$ac_aux_dir/missing
87100ae103Smrg#    fails if $ac_aux_dir is absolute,
88100ae103Smrg#    fails when called from a subdirectory in a VPATH build with
89100ae103Smrg#          a relative $ac_aux_dir
90100ae103Smrg#
91100ae103Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92100ae103Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
93100ae103Smrg# harmless because $srcdir is `.', but things will broke when you
94100ae103Smrg# start a VPATH build or use an absolute $srcdir.
95100ae103Smrg#
96100ae103Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97100ae103Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98100ae103Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99100ae103Smrg# and then we would define $MISSING as
100100ae103Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
101100ae103Smrg# This will work as long as MISSING is not called from configure, because
102100ae103Smrg# unfortunately $(top_srcdir) has no meaning in configure.
103100ae103Smrg# However there are other variables, like CC, which are often used in
104100ae103Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
105100ae103Smrg#
106100ae103Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
107100ae103Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
108100ae103Smrg# configured tree to be moved without reconfiguration.
109100ae103Smrg
110100ae103SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
111100ae103Smrg[dnl Rely on autoconf to set up CDPATH properly.
112100ae103SmrgAC_PREREQ([2.50])dnl
113100ae103Smrg# expand $ac_aux_dir to an absolute path
114100ae103Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
115100ae103Smrg])
116100ae103Smrg
117100ae103Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
118100ae103Smrg
119165cb819Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120100ae103Smrg# Free Software Foundation, Inc.
121100ae103Smrg#
122100ae103Smrg# This file is free software; the Free Software Foundation
123100ae103Smrg# gives unlimited permission to copy and/or distribute it,
124100ae103Smrg# with or without modifications, as long as this notice is preserved.
125100ae103Smrg
126165cb819Smrg# serial 9
127100ae103Smrg
128100ae103Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129100ae103Smrg# -------------------------------------
130100ae103Smrg# Define a conditional.
131100ae103SmrgAC_DEFUN([AM_CONDITIONAL],
132100ae103Smrg[AC_PREREQ(2.52)dnl
133100ae103Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
134100ae103Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135165cb819SmrgAC_SUBST([$1_TRUE])dnl
136165cb819SmrgAC_SUBST([$1_FALSE])dnl
137165cb819Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138165cb819Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
139165cb819Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
140100ae103Smrgif $2; then
141100ae103Smrg  $1_TRUE=
142100ae103Smrg  $1_FALSE='#'
143100ae103Smrgelse
144100ae103Smrg  $1_TRUE='#'
145100ae103Smrg  $1_FALSE=
146100ae103Smrgfi
147100ae103SmrgAC_CONFIG_COMMANDS_PRE(
148100ae103Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149100ae103Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
150100ae103SmrgUsually this means the macro was only invoked conditionally.]])
151100ae103Smrgfi])])
152100ae103Smrg
1538831d3fbSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
1548831d3fbSmrg# 2010, 2011 Free Software Foundation, Inc.
155100ae103Smrg#
156100ae103Smrg# This file is free software; the Free Software Foundation
157100ae103Smrg# gives unlimited permission to copy and/or distribute it,
158100ae103Smrg# with or without modifications, as long as this notice is preserved.
159100ae103Smrg
1608831d3fbSmrg# serial 12
161100ae103Smrg
162100ae103Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163100ae103Smrg# written in clear, in which case automake, when reading aclocal.m4,
164100ae103Smrg# will think it sees a *use*, and therefore will trigger all it's
165100ae103Smrg# C support machinery.  Also note that it means that autoscan, seeing
166100ae103Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167100ae103Smrg
168100ae103Smrg
169100ae103Smrg# _AM_DEPENDENCIES(NAME)
170100ae103Smrg# ----------------------
171100ae103Smrg# See how the compiler implements dependency checking.
172100ae103Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
173100ae103Smrg# We try a few techniques and use that to set a single cache variable.
174100ae103Smrg#
175100ae103Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176100ae103Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177100ae103Smrg# dependency, and given that the user is not expected to run this macro,
178100ae103Smrg# just rely on AC_PROG_CC.
179100ae103SmrgAC_DEFUN([_AM_DEPENDENCIES],
180100ae103Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
181100ae103SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182100ae103SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
183100ae103SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
184100ae103Smrg
185100ae103Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186100ae103Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187100ae103Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
188165cb819Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189100ae103Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190100ae103Smrg                   [depcc="$$1"   am_compiler_list=])
191100ae103Smrg
192100ae103SmrgAC_CACHE_CHECK([dependency style of $depcc],
193100ae103Smrg               [am_cv_$1_dependencies_compiler_type],
194100ae103Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195100ae103Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
196100ae103Smrg  # making bogus files that we don't know about and never remove.  For
197100ae103Smrg  # instance it was reported that on HP-UX the gcc test will end up
198100ae103Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
199100ae103Smrg  # in D'.
2008831d3fbSmrg  rm -rf conftest.dir
201100ae103Smrg  mkdir conftest.dir
202100ae103Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
203100ae103Smrg  # using a relative directory.
204100ae103Smrg  cp "$am_depcomp" conftest.dir
205100ae103Smrg  cd conftest.dir
206100ae103Smrg  # We will build objects and dependencies in a subdirectory because
207100ae103Smrg  # it helps to detect inapplicable dependency modes.  For instance
208100ae103Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
209100ae103Smrg  # side effect of compilation, but ICC will put the dependencies in
210100ae103Smrg  # the current directory while Tru64 will put them in the object
211100ae103Smrg  # directory.
212100ae103Smrg  mkdir sub
213100ae103Smrg
214100ae103Smrg  am_cv_$1_dependencies_compiler_type=none
215100ae103Smrg  if test "$am_compiler_list" = ""; then
216100ae103Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217100ae103Smrg  fi
218165cb819Smrg  am__universal=false
219165cb819Smrg  m4_case([$1], [CC],
220165cb819Smrg    [case " $depcc " in #(
221165cb819Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
222165cb819Smrg     esac],
223165cb819Smrg    [CXX],
224165cb819Smrg    [case " $depcc " in #(
225165cb819Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
226165cb819Smrg     esac])
227165cb819Smrg
228100ae103Smrg  for depmode in $am_compiler_list; do
229100ae103Smrg    # Setup a source with many dependencies, because some compilers
230100ae103Smrg    # like to wrap large dependency lists on column 80 (with \), and
231100ae103Smrg    # we should not choose a depcomp mode which is confused by this.
232100ae103Smrg    #
233100ae103Smrg    # We need to recreate these files for each test, as the compiler may
234100ae103Smrg    # overwrite some of them when testing with obscure command lines.
235100ae103Smrg    # This happens at least with the AIX C compiler.
236100ae103Smrg    : > sub/conftest.c
237100ae103Smrg    for i in 1 2 3 4 5 6; do
238100ae103Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
239100ae103Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
240100ae103Smrg      # Solaris 8's {/usr,}/bin/sh.
241100ae103Smrg      touch sub/conftst$i.h
242100ae103Smrg    done
243100ae103Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244100ae103Smrg
245165cb819Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
246165cb819Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
247165cb819Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
248165cb819Smrg    # versions had trouble with output in subdirs
249165cb819Smrg    am__obj=sub/conftest.${OBJEXT-o}
250165cb819Smrg    am__minus_obj="-o $am__obj"
251100ae103Smrg    case $depmode in
252165cb819Smrg    gcc)
253165cb819Smrg      # This depmode causes a compiler race in universal mode.
254165cb819Smrg      test "$am__universal" = false || continue
255165cb819Smrg      ;;
256100ae103Smrg    nosideeffect)
257100ae103Smrg      # after this tag, mechanisms are not by side-effect, so they'll
258100ae103Smrg      # only be used when explicitly requested
259100ae103Smrg      if test "x$enable_dependency_tracking" = xyes; then
260100ae103Smrg	continue
261100ae103Smrg      else
262100ae103Smrg	break
263100ae103Smrg      fi
264100ae103Smrg      ;;
2658831d3fbSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
266165cb819Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
267165cb819Smrg      # not run yet.  These depmodes are late enough in the game, and
268165cb819Smrg      # so weak that their functioning should not be impacted.
269165cb819Smrg      am__obj=conftest.${OBJEXT-o}
270165cb819Smrg      am__minus_obj=
271165cb819Smrg      ;;
272100ae103Smrg    none) break ;;
273100ae103Smrg    esac
274100ae103Smrg    if depmode=$depmode \
275165cb819Smrg       source=sub/conftest.c object=$am__obj \
276100ae103Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
277165cb819Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278100ae103Smrg         >/dev/null 2>conftest.err &&
279165cb819Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280100ae103Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
281165cb819Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282100ae103Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283100ae103Smrg      # icc doesn't choke on unknown options, it will just issue warnings
284100ae103Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
285100ae103Smrg      # that says an option was ignored or not supported.
286100ae103Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
287100ae103Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
288100ae103Smrg      # The diagnosis changed in icc 8.0:
289100ae103Smrg      #   icc: Command line remark: option '-MP' not supported
290100ae103Smrg      if (grep 'ignoring option' conftest.err ||
291100ae103Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292100ae103Smrg        am_cv_$1_dependencies_compiler_type=$depmode
293100ae103Smrg        break
294100ae103Smrg      fi
295100ae103Smrg    fi
296100ae103Smrg  done
297100ae103Smrg
298100ae103Smrg  cd ..
299100ae103Smrg  rm -rf conftest.dir
300100ae103Smrgelse
301100ae103Smrg  am_cv_$1_dependencies_compiler_type=none
302100ae103Smrgfi
303100ae103Smrg])
304100ae103SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305100ae103SmrgAM_CONDITIONAL([am__fastdep$1], [
306100ae103Smrg  test "x$enable_dependency_tracking" != xno \
307100ae103Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308100ae103Smrg])
309100ae103Smrg
310100ae103Smrg
311100ae103Smrg# AM_SET_DEPDIR
312100ae103Smrg# -------------
313100ae103Smrg# Choose a directory name for dependency files.
314100ae103Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315100ae103SmrgAC_DEFUN([AM_SET_DEPDIR],
316100ae103Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317100ae103SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318100ae103Smrg])
319100ae103Smrg
320100ae103Smrg
321100ae103Smrg# AM_DEP_TRACK
322100ae103Smrg# ------------
323100ae103SmrgAC_DEFUN([AM_DEP_TRACK],
324100ae103Smrg[AC_ARG_ENABLE(dependency-tracking,
325100ae103Smrg[  --disable-dependency-tracking  speeds up one-time build
326100ae103Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
327100ae103Smrgif test "x$enable_dependency_tracking" != xno; then
328100ae103Smrg  am_depcomp="$ac_aux_dir/depcomp"
329100ae103Smrg  AMDEPBACKSLASH='\'
3308831d3fbSmrg  am__nodep='_no'
331100ae103Smrgfi
332100ae103SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
333165cb819SmrgAC_SUBST([AMDEPBACKSLASH])dnl
334165cb819Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3358831d3fbSmrgAC_SUBST([am__nodep])dnl
3368831d3fbSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
337100ae103Smrg])
338100ae103Smrg
339100ae103Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
340100ae103Smrg
341165cb819Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
342100ae103Smrg# Free Software Foundation, Inc.
343100ae103Smrg#
344100ae103Smrg# This file is free software; the Free Software Foundation
345100ae103Smrg# gives unlimited permission to copy and/or distribute it,
346100ae103Smrg# with or without modifications, as long as this notice is preserved.
347100ae103Smrg
348165cb819Smrg#serial 5
349100ae103Smrg
350100ae103Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
351100ae103Smrg# ------------------------------
352100ae103SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
353165cb819Smrg[{
354165cb819Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
355165cb819Smrg  # are listed without --file.  Let's play safe and only enable the eval
356165cb819Smrg  # if we detect the quoting.
357165cb819Smrg  case $CONFIG_FILES in
358165cb819Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
359165cb819Smrg  *)   set x $CONFIG_FILES ;;
360165cb819Smrg  esac
361165cb819Smrg  shift
362165cb819Smrg  for mf
363165cb819Smrg  do
364165cb819Smrg    # Strip MF so we end up with the name of the file.
365165cb819Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
366165cb819Smrg    # Check whether this is an Automake generated Makefile or not.
367165cb819Smrg    # We used to match only the files named `Makefile.in', but
368165cb819Smrg    # some people rename them; so instead we look at the file content.
369165cb819Smrg    # Grep'ing the first line is not enough: some people post-process
370165cb819Smrg    # each Makefile.in and add a new line on top of each file to say so.
371165cb819Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
372165cb819Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
373165cb819Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
374165cb819Smrg      dirpart=`AS_DIRNAME("$mf")`
375165cb819Smrg    else
376165cb819Smrg      continue
377165cb819Smrg    fi
378165cb819Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
379165cb819Smrg    # from the Makefile without running `make'.
380165cb819Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
381165cb819Smrg    test -z "$DEPDIR" && continue
382165cb819Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
383165cb819Smrg    test -z "am__include" && continue
384165cb819Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
385165cb819Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
386165cb819Smrg    U=`sed -n 's/^U = //p' < "$mf"`
387165cb819Smrg    # Find all dependency output files, they are included files with
388165cb819Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
389165cb819Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
390165cb819Smrg    # expansion.
391165cb819Smrg    for file in `sed -n "
392165cb819Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
393165cb819Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
394165cb819Smrg      # Make sure the directory exists.
395165cb819Smrg      test -f "$dirpart/$file" && continue
396165cb819Smrg      fdir=`AS_DIRNAME(["$file"])`
397165cb819Smrg      AS_MKDIR_P([$dirpart/$fdir])
398165cb819Smrg      # echo "creating $dirpart/$file"
399165cb819Smrg      echo '# dummy' > "$dirpart/$file"
400165cb819Smrg    done
401100ae103Smrg  done
402165cb819Smrg}
403100ae103Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404100ae103Smrg
405100ae103Smrg
406100ae103Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
407100ae103Smrg# -----------------------------
408100ae103Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
409100ae103Smrg#
410100ae103Smrg# This code is only required when automatic dependency tracking
411100ae103Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
412100ae103Smrg# need in order to bootstrap the dependency handling code.
413100ae103SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414100ae103Smrg[AC_CONFIG_COMMANDS([depfiles],
415100ae103Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416100ae103Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417100ae103Smrg])
418100ae103Smrg
419100ae103Smrg# Do all the work for Automake.                             -*- Autoconf -*-
420100ae103Smrg
421165cb819Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
422165cb819Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423100ae103Smrg#
424100ae103Smrg# This file is free software; the Free Software Foundation
425100ae103Smrg# gives unlimited permission to copy and/or distribute it,
426100ae103Smrg# with or without modifications, as long as this notice is preserved.
427100ae103Smrg
428165cb819Smrg# serial 16
429100ae103Smrg
430100ae103Smrg# This macro actually does too much.  Some checks are only needed if
431100ae103Smrg# your package does certain things.  But this isn't really a big deal.
432100ae103Smrg
433100ae103Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
434100ae103Smrg# AM_INIT_AUTOMAKE([OPTIONS])
435100ae103Smrg# -----------------------------------------------
436100ae103Smrg# The call with PACKAGE and VERSION arguments is the old style
437100ae103Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
438100ae103Smrg# and VERSION should now be passed to AC_INIT and removed from
439100ae103Smrg# the call to AM_INIT_AUTOMAKE.
440100ae103Smrg# We support both call styles for the transition.  After
441100ae103Smrg# the next Automake release, Autoconf can make the AC_INIT
442100ae103Smrg# arguments mandatory, and then we can depend on a new Autoconf
443100ae103Smrg# release and drop the old call support.
444100ae103SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
445165cb819Smrg[AC_PREREQ([2.62])dnl
446100ae103Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
447100ae103Smrgdnl the ones we care about.
448100ae103Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
449100ae103SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
450100ae103SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
451165cb819Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
452165cb819Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
453165cb819Smrg  # is not polluted with repeated "-I."
454165cb819Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
455165cb819Smrg  # test to see if srcdir already configured
456165cb819Smrg  if test -f $srcdir/config.status; then
457165cb819Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
458165cb819Smrg  fi
459100ae103Smrgfi
460100ae103Smrg
461100ae103Smrg# test whether we have cygpath
462100ae103Smrgif test -z "$CYGPATH_W"; then
463100ae103Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
464100ae103Smrg    CYGPATH_W='cygpath -w'
465100ae103Smrg  else
466100ae103Smrg    CYGPATH_W=echo
467100ae103Smrg  fi
468100ae103Smrgfi
469100ae103SmrgAC_SUBST([CYGPATH_W])
470100ae103Smrg
471100ae103Smrg# Define the identity of the package.
472100ae103Smrgdnl Distinguish between old-style and new-style calls.
473100ae103Smrgm4_ifval([$2],
474100ae103Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
475100ae103Smrg AC_SUBST([PACKAGE], [$1])dnl
476100ae103Smrg AC_SUBST([VERSION], [$2])],
477100ae103Smrg[_AM_SET_OPTIONS([$1])dnl
478165cb819Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
479165cb819Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
480165cb819Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
481100ae103Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
482100ae103Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483100ae103Smrg
484100ae103Smrg_AM_IF_OPTION([no-define],,
485100ae103Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
486100ae103Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487100ae103Smrg
488100ae103Smrg# Some tools Automake needs.
489100ae103SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
490100ae103SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
491100ae103SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
492100ae103SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
493100ae103SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
494100ae103SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
495100ae103SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
496165cb819SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
497165cb819SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
498100ae103SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
499100ae103Smrg# We need awk for the "check" target.  The system "awk" is bad on
500100ae103Smrg# some platforms.
501100ae103SmrgAC_REQUIRE([AC_PROG_AWK])dnl
502100ae103SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
503100ae103SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
504100ae103Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
505165cb819Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
506165cb819Smrg			     [_AM_PROG_TAR([v7])])])
507100ae103Smrg_AM_IF_OPTION([no-dependencies],,
508100ae103Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
509165cb819Smrg		  [_AM_DEPENDENCIES(CC)],
510165cb819Smrg		  [define([AC_PROG_CC],
511165cb819Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
512100ae103SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
513165cb819Smrg		  [_AM_DEPENDENCIES(CXX)],
514165cb819Smrg		  [define([AC_PROG_CXX],
515165cb819Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
516165cb819SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
517165cb819Smrg		  [_AM_DEPENDENCIES(OBJC)],
518165cb819Smrg		  [define([AC_PROG_OBJC],
519165cb819Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
520100ae103Smrg])
521165cb819Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
522165cb819Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
523165cb819Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
524165cb819Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
525165cb819SmrgAC_CONFIG_COMMANDS_PRE(dnl
526165cb819Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
527165cb819Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
528100ae103Smrg])
529100ae103Smrg
530165cb819Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
531165cb819Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
532165cb819Smrgdnl mangled by Autoconf and run in a shell conditional statement.
533165cb819Smrgm4_define([_AC_COMPILER_EXEEXT],
534165cb819Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
535165cb819Smrg
536100ae103Smrg
537100ae103Smrg# When config.status generates a header, we must update the stamp-h file.
538100ae103Smrg# This file resides in the same directory as the config header
539100ae103Smrg# that is generated.  The stamp files are numbered to have different names.
540100ae103Smrg
541100ae103Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
542100ae103Smrg# loop where config.status creates the headers, so we can generate
543100ae103Smrg# our stamp files there.
544100ae103SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
545100ae103Smrg[# Compute $1's index in $config_headers.
546165cb819Smrg_am_arg=$1
547100ae103Smrg_am_stamp_count=1
548100ae103Smrgfor _am_header in $config_headers :; do
549100ae103Smrg  case $_am_header in
550165cb819Smrg    $_am_arg | $_am_arg:* )
551100ae103Smrg      break ;;
552100ae103Smrg    * )
553100ae103Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
554100ae103Smrg  esac
555100ae103Smrgdone
556165cb819Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557100ae103Smrg
5588831d3fbSmrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
5598831d3fbSmrg# Inc.
560100ae103Smrg#
561100ae103Smrg# This file is free software; the Free Software Foundation
562100ae103Smrg# gives unlimited permission to copy and/or distribute it,
563100ae103Smrg# with or without modifications, as long as this notice is preserved.
564100ae103Smrg
5658831d3fbSmrg# serial 1
5668831d3fbSmrg
567100ae103Smrg# AM_PROG_INSTALL_SH
568100ae103Smrg# ------------------
569100ae103Smrg# Define $install_sh.
570100ae103SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
571100ae103Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
572165cb819Smrgif test x"${install_sh}" != xset; then
573165cb819Smrg  case $am_aux_dir in
574165cb819Smrg  *\ * | *\	*)
575165cb819Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
576165cb819Smrg  *)
577165cb819Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
578165cb819Smrg  esac
579165cb819Smrgfi
580100ae103SmrgAC_SUBST(install_sh)])
581100ae103Smrg
582100ae103Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
583100ae103Smrg#
584100ae103Smrg# This file is free software; the Free Software Foundation
585100ae103Smrg# gives unlimited permission to copy and/or distribute it,
586100ae103Smrg# with or without modifications, as long as this notice is preserved.
587100ae103Smrg
588100ae103Smrg# serial 2
589100ae103Smrg
590100ae103Smrg# Check whether the underlying file-system supports filenames
591100ae103Smrg# with a leading dot.  For instance MS-DOS doesn't.
592100ae103SmrgAC_DEFUN([AM_SET_LEADING_DOT],
593100ae103Smrg[rm -rf .tst 2>/dev/null
594100ae103Smrgmkdir .tst 2>/dev/null
595100ae103Smrgif test -d .tst; then
596100ae103Smrg  am__leading_dot=.
597100ae103Smrgelse
598100ae103Smrg  am__leading_dot=_
599100ae103Smrgfi
600100ae103Smrgrmdir .tst 2>/dev/null
601100ae103SmrgAC_SUBST([am__leading_dot])])
602100ae103Smrg
603100ae103Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
604100ae103Smrg# From Jim Meyering
605100ae103Smrg
6068831d3fbSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
6078831d3fbSmrg# 2011 Free Software Foundation, Inc.
608100ae103Smrg#
609100ae103Smrg# This file is free software; the Free Software Foundation
610100ae103Smrg# gives unlimited permission to copy and/or distribute it,
611100ae103Smrg# with or without modifications, as long as this notice is preserved.
612100ae103Smrg
613165cb819Smrg# serial 5
614100ae103Smrg
615165cb819Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
616165cb819Smrg# ----------------------------------
617165cb819Smrg# Control maintainer-specific portions of Makefiles.
618165cb819Smrg# Default is to disable them, unless `enable' is passed literally.
619165cb819Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
620165cb819Smrg# can override the default with the --enable/--disable switch.
621100ae103SmrgAC_DEFUN([AM_MAINTAINER_MODE],
622165cb819Smrg[m4_case(m4_default([$1], [disable]),
623165cb819Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
624165cb819Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
625165cb819Smrg       [m4_define([am_maintainer_other], [enable])
626165cb819Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6278831d3fbSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
628165cb819Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
629165cb819Smrg  AC_ARG_ENABLE([maintainer-mode],
630165cb819Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
631100ae103Smrg			  (and sometimes confusing) to the casual installer],
632165cb819Smrg      [USE_MAINTAINER_MODE=$enableval],
633165cb819Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634100ae103Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
635165cb819Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636100ae103Smrg  MAINT=$MAINTAINER_MODE_TRUE
637165cb819Smrg  AC_SUBST([MAINT])dnl
638100ae103Smrg]
639100ae103Smrg)
640100ae103Smrg
641100ae103SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
642100ae103Smrg
643100ae103Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644100ae103Smrg
645165cb819Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
646100ae103Smrg#
647100ae103Smrg# This file is free software; the Free Software Foundation
648100ae103Smrg# gives unlimited permission to copy and/or distribute it,
649100ae103Smrg# with or without modifications, as long as this notice is preserved.
650100ae103Smrg
651165cb819Smrg# serial 4
652100ae103Smrg
653100ae103Smrg# AM_MAKE_INCLUDE()
654100ae103Smrg# -----------------
655100ae103Smrg# Check to see how make treats includes.
656100ae103SmrgAC_DEFUN([AM_MAKE_INCLUDE],
657100ae103Smrg[am_make=${MAKE-make}
658100ae103Smrgcat > confinc << 'END'
659100ae103Smrgam__doit:
660165cb819Smrg	@echo this is the am__doit target
661100ae103Smrg.PHONY: am__doit
662100ae103SmrgEND
663100ae103Smrg# If we don't find an include directive, just comment out the code.
664100ae103SmrgAC_MSG_CHECKING([for style of include used by $am_make])
665100ae103Smrgam__include="#"
666100ae103Smrgam__quote=
667100ae103Smrg_am_result=none
668100ae103Smrg# First try GNU make style include.
669100ae103Smrgecho "include confinc" > confmf
670165cb819Smrg# Ignore all kinds of additional output from `make'.
671165cb819Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
672165cb819Smrg*the\ am__doit\ target*)
673165cb819Smrg  am__include=include
674165cb819Smrg  am__quote=
675165cb819Smrg  _am_result=GNU
676165cb819Smrg  ;;
677165cb819Smrgesac
678100ae103Smrg# Now try BSD make style include.
679100ae103Smrgif test "$am__include" = "#"; then
680100ae103Smrg   echo '.include "confinc"' > confmf
681165cb819Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
682165cb819Smrg   *the\ am__doit\ target*)
683165cb819Smrg     am__include=.include
684165cb819Smrg     am__quote="\""
685165cb819Smrg     _am_result=BSD
686165cb819Smrg     ;;
687165cb819Smrg   esac
688100ae103Smrgfi
689100ae103SmrgAC_SUBST([am__include])
690100ae103SmrgAC_SUBST([am__quote])
691100ae103SmrgAC_MSG_RESULT([$_am_result])
692100ae103Smrgrm -f confinc confmf
693100ae103Smrg])
694100ae103Smrg
695100ae103Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
696100ae103Smrg
697165cb819Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
698100ae103Smrg# Free Software Foundation, Inc.
699100ae103Smrg#
700100ae103Smrg# This file is free software; the Free Software Foundation
701100ae103Smrg# gives unlimited permission to copy and/or distribute it,
702100ae103Smrg# with or without modifications, as long as this notice is preserved.
703100ae103Smrg
704165cb819Smrg# serial 6
705100ae103Smrg
706100ae103Smrg# AM_MISSING_PROG(NAME, PROGRAM)
707100ae103Smrg# ------------------------------
708100ae103SmrgAC_DEFUN([AM_MISSING_PROG],
709100ae103Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710100ae103Smrg$1=${$1-"${am_missing_run}$2"}
711100ae103SmrgAC_SUBST($1)])
712100ae103Smrg
713100ae103Smrg
714100ae103Smrg# AM_MISSING_HAS_RUN
715100ae103Smrg# ------------------
716100ae103Smrg# Define MISSING if not defined so far and test if it supports --run.
717100ae103Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
718100ae103SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
719100ae103Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
720165cb819SmrgAC_REQUIRE_AUX_FILE([missing])dnl
721165cb819Smrgif test x"${MISSING+set}" != xset; then
722165cb819Smrg  case $am_aux_dir in
723165cb819Smrg  *\ * | *\	*)
724165cb819Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
725165cb819Smrg  *)
726165cb819Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
727165cb819Smrg  esac
728165cb819Smrgfi
729100ae103Smrg# Use eval to expand $SHELL
730100ae103Smrgif eval "$MISSING --run true"; then
731100ae103Smrg  am_missing_run="$MISSING --run "
732100ae103Smrgelse
733100ae103Smrg  am_missing_run=
734100ae103Smrg  AC_MSG_WARN([`missing' script is too old or missing])
735100ae103Smrgfi
736100ae103Smrg])
737100ae103Smrg
7388831d3fbSmrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
7398831d3fbSmrg# Inc.
740100ae103Smrg#
741100ae103Smrg# This file is free software; the Free Software Foundation
742100ae103Smrg# gives unlimited permission to copy and/or distribute it,
743100ae103Smrg# with or without modifications, as long as this notice is preserved.
744100ae103Smrg
7458831d3fbSmrg# serial 1
7468831d3fbSmrg
747100ae103Smrg# AM_PROG_MKDIR_P
748100ae103Smrg# ---------------
749165cb819Smrg# Check for `mkdir -p'.
750100ae103SmrgAC_DEFUN([AM_PROG_MKDIR_P],
751165cb819Smrg[AC_PREREQ([2.60])dnl
752165cb819SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
753165cb819Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
754165cb819Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
755165cb819Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
756165cb819Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
757165cb819Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
758165cb819Smrgdnl adjustment using top_builddir (which is defined more often than
759165cb819Smrgdnl MKDIR_P).
760165cb819SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
761165cb819Smrgcase $mkdir_p in
762165cb819Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
763165cb819Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
764165cb819Smrgesac
765165cb819Smrg])
766100ae103Smrg
767100ae103Smrg# Helper functions for option handling.                     -*- Autoconf -*-
768100ae103Smrg
7698831d3fbSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
7708831d3fbSmrg# Foundation, Inc.
771100ae103Smrg#
772100ae103Smrg# This file is free software; the Free Software Foundation
773100ae103Smrg# gives unlimited permission to copy and/or distribute it,
774100ae103Smrg# with or without modifications, as long as this notice is preserved.
775100ae103Smrg
7768831d3fbSmrg# serial 5
777100ae103Smrg
778100ae103Smrg# _AM_MANGLE_OPTION(NAME)
779100ae103Smrg# -----------------------
780100ae103SmrgAC_DEFUN([_AM_MANGLE_OPTION],
781100ae103Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782100ae103Smrg
783100ae103Smrg# _AM_SET_OPTION(NAME)
7848831d3fbSmrg# --------------------
785100ae103Smrg# Set option NAME.  Presently that only means defining a flag for this option.
786100ae103SmrgAC_DEFUN([_AM_SET_OPTION],
787100ae103Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
788100ae103Smrg
789100ae103Smrg# _AM_SET_OPTIONS(OPTIONS)
7908831d3fbSmrg# ------------------------
791100ae103Smrg# OPTIONS is a space-separated list of Automake options.
792100ae103SmrgAC_DEFUN([_AM_SET_OPTIONS],
793165cb819Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794100ae103Smrg
795100ae103Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
796100ae103Smrg# -------------------------------------------
797100ae103Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
798100ae103SmrgAC_DEFUN([_AM_IF_OPTION],
799100ae103Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800100ae103Smrg
801100ae103Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
802100ae103Smrg
803165cb819Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
804100ae103Smrg# Free Software Foundation, Inc.
805100ae103Smrg#
806100ae103Smrg# This file is free software; the Free Software Foundation
807100ae103Smrg# gives unlimited permission to copy and/or distribute it,
808100ae103Smrg# with or without modifications, as long as this notice is preserved.
809100ae103Smrg
810165cb819Smrg# serial 5
811100ae103Smrg
812100ae103Smrg# AM_SANITY_CHECK
813100ae103Smrg# ---------------
814100ae103SmrgAC_DEFUN([AM_SANITY_CHECK],
815100ae103Smrg[AC_MSG_CHECKING([whether build environment is sane])
816100ae103Smrg# Just in case
817100ae103Smrgsleep 1
818100ae103Smrgecho timestamp > conftest.file
819165cb819Smrg# Reject unsafe characters in $srcdir or the absolute working directory
820165cb819Smrg# name.  Accept space and tab only in the latter.
821165cb819Smrgam_lf='
822165cb819Smrg'
823165cb819Smrgcase `pwd` in
824165cb819Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
825165cb819Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
826165cb819Smrgesac
827165cb819Smrgcase $srcdir in
828165cb819Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
829165cb819Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
830165cb819Smrgesac
831165cb819Smrg
832100ae103Smrg# Do `set' in a subshell so we don't clobber the current shell's
833100ae103Smrg# arguments.  Must try -L first in case configure is actually a
834100ae103Smrg# symlink; some systems play weird games with the mod time of symlinks
835100ae103Smrg# (eg FreeBSD returns the mod time of the symlink's containing
836100ae103Smrg# directory).
837100ae103Smrgif (
838165cb819Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
839100ae103Smrg   if test "$[*]" = "X"; then
840100ae103Smrg      # -L didn't work.
841165cb819Smrg      set X `ls -t "$srcdir/configure" conftest.file`
842100ae103Smrg   fi
843100ae103Smrg   rm -f conftest.file
844100ae103Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
845100ae103Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
846100ae103Smrg
847100ae103Smrg      # If neither matched, then we have a broken ls.  This can happen
848100ae103Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
849100ae103Smrg      # broken ls alias from the environment.  This has actually
850100ae103Smrg      # happened.  Such a system could not be considered "sane".
851100ae103Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
852100ae103Smrgalias in your environment])
853100ae103Smrg   fi
854100ae103Smrg
855100ae103Smrg   test "$[2]" = conftest.file
856100ae103Smrg   )
857100ae103Smrgthen
858100ae103Smrg   # Ok.
859100ae103Smrg   :
860100ae103Smrgelse
861100ae103Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
862100ae103SmrgCheck your system clock])
863100ae103Smrgfi
864100ae103SmrgAC_MSG_RESULT(yes)])
865100ae103Smrg
866165cb819Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
867165cb819Smrg#
868165cb819Smrg# This file is free software; the Free Software Foundation
869165cb819Smrg# gives unlimited permission to copy and/or distribute it,
870165cb819Smrg# with or without modifications, as long as this notice is preserved.
871165cb819Smrg
872165cb819Smrg# serial 1
873165cb819Smrg
874165cb819Smrg# AM_SILENT_RULES([DEFAULT])
875165cb819Smrg# --------------------------
876165cb819Smrg# Enable less verbose build rules; with the default set to DEFAULT
877165cb819Smrg# (`yes' being less verbose, `no' or empty being verbose).
878165cb819SmrgAC_DEFUN([AM_SILENT_RULES],
879165cb819Smrg[AC_ARG_ENABLE([silent-rules],
880165cb819Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
881165cb819Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
882165cb819Smrgcase $enable_silent_rules in
883165cb819Smrgyes) AM_DEFAULT_VERBOSITY=0;;
884165cb819Smrgno)  AM_DEFAULT_VERBOSITY=1;;
885165cb819Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
886165cb819Smrgesac
887165cb819SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
888165cb819SmrgAM_BACKSLASH='\'
889165cb819SmrgAC_SUBST([AM_BACKSLASH])dnl
890165cb819Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
891165cb819Smrg])
892165cb819Smrg
8938831d3fbSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
894100ae103Smrg#
895100ae103Smrg# This file is free software; the Free Software Foundation
896100ae103Smrg# gives unlimited permission to copy and/or distribute it,
897100ae103Smrg# with or without modifications, as long as this notice is preserved.
898100ae103Smrg
8998831d3fbSmrg# serial 1
9008831d3fbSmrg
901100ae103Smrg# AM_PROG_INSTALL_STRIP
902100ae103Smrg# ---------------------
903100ae103Smrg# One issue with vendor `install' (even GNU) is that you can't
904100ae103Smrg# specify the program used to strip binaries.  This is especially
905100ae103Smrg# annoying in cross-compiling environments, where the build's strip
906100ae103Smrg# is unlikely to handle the host's binaries.
907100ae103Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
908100ae103Smrg# always use install-sh in `make install-strip', and initialize
909100ae103Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
910100ae103SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
911100ae103Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
912100ae103Smrg# Installed binaries are usually stripped using `strip' when the user
913100ae103Smrg# run `make install-strip'.  However `strip' might not be the right
914100ae103Smrg# tool to use in cross-compilation environments, therefore Automake
915100ae103Smrg# will honor the `STRIP' environment variable to overrule this program.
916100ae103Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
917100ae103Smrgif test "$cross_compiling" != no; then
918100ae103Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
919100ae103Smrgfi
920165cb819SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
921100ae103SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
922100ae103Smrg
9238831d3fbSmrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
924165cb819Smrg#
925165cb819Smrg# This file is free software; the Free Software Foundation
926165cb819Smrg# gives unlimited permission to copy and/or distribute it,
927165cb819Smrg# with or without modifications, as long as this notice is preserved.
928165cb819Smrg
9298831d3fbSmrg# serial 3
930165cb819Smrg
931165cb819Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
932165cb819Smrg# ---------------------------
933165cb819Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
934165cb819Smrg# This macro is traced by Automake.
935165cb819SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
936165cb819Smrg
937165cb819Smrg# AM_SUBST_NOTMAKE(VARIABLE)
9388831d3fbSmrg# --------------------------
939165cb819Smrg# Public sister of _AM_SUBST_NOTMAKE.
940165cb819SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
941165cb819Smrg
942100ae103Smrg# Check how to create a tarball.                            -*- Autoconf -*-
943100ae103Smrg
944100ae103Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
945100ae103Smrg#
946100ae103Smrg# This file is free software; the Free Software Foundation
947100ae103Smrg# gives unlimited permission to copy and/or distribute it,
948100ae103Smrg# with or without modifications, as long as this notice is preserved.
949100ae103Smrg
950100ae103Smrg# serial 2
951100ae103Smrg
952100ae103Smrg# _AM_PROG_TAR(FORMAT)
953100ae103Smrg# --------------------
954100ae103Smrg# Check how to create a tarball in format FORMAT.
955100ae103Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
956100ae103Smrg#
957100ae103Smrg# Substitute a variable $(am__tar) that is a command
958100ae103Smrg# writing to stdout a FORMAT-tarball containing the directory
959100ae103Smrg# $tardir.
960100ae103Smrg#     tardir=directory && $(am__tar) > result.tar
961100ae103Smrg#
962100ae103Smrg# Substitute a variable $(am__untar) that extract such
963100ae103Smrg# a tarball read from stdin.
964100ae103Smrg#     $(am__untar) < result.tar
965100ae103SmrgAC_DEFUN([_AM_PROG_TAR],
966100ae103Smrg[# Always define AMTAR for backward compatibility.
967100ae103SmrgAM_MISSING_PROG([AMTAR], [tar])
968100ae103Smrgm4_if([$1], [v7],
969100ae103Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
970100ae103Smrg     [m4_case([$1], [ustar],, [pax],,
971100ae103Smrg              [m4_fatal([Unknown tar format])])
972100ae103SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
973100ae103Smrg# Loop over all known methods to create a tar archive until one works.
974100ae103Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
975100ae103Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
976100ae103Smrg# Do not fold the above two line into one, because Tru64 sh and
977100ae103Smrg# Solaris sh will not grok spaces in the rhs of `-'.
978100ae103Smrgfor _am_tool in $_am_tools
979100ae103Smrgdo
980100ae103Smrg  case $_am_tool in
981100ae103Smrg  gnutar)
982100ae103Smrg    for _am_tar in tar gnutar gtar;
983100ae103Smrg    do
984100ae103Smrg      AM_RUN_LOG([$_am_tar --version]) && break
985100ae103Smrg    done
986100ae103Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
987100ae103Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
988100ae103Smrg    am__untar="$_am_tar -xf -"
989100ae103Smrg    ;;
990100ae103Smrg  plaintar)
991100ae103Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
992100ae103Smrg    # ustar tarball either.
993100ae103Smrg    (tar --version) >/dev/null 2>&1 && continue
994100ae103Smrg    am__tar='tar chf - "$$tardir"'
995100ae103Smrg    am__tar_='tar chf - "$tardir"'
996100ae103Smrg    am__untar='tar xf -'
997100ae103Smrg    ;;
998100ae103Smrg  pax)
999100ae103Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
1000100ae103Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
1001100ae103Smrg    am__untar='pax -r'
1002100ae103Smrg    ;;
1003100ae103Smrg  cpio)
1004100ae103Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1005100ae103Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1006100ae103Smrg    am__untar='cpio -i -H $1 -d'
1007100ae103Smrg    ;;
1008100ae103Smrg  none)
1009100ae103Smrg    am__tar=false
1010100ae103Smrg    am__tar_=false
1011100ae103Smrg    am__untar=false
1012100ae103Smrg    ;;
1013100ae103Smrg  esac
1014100ae103Smrg
1015100ae103Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
1016100ae103Smrg  # and am__untar set.
1017100ae103Smrg  test -n "${am_cv_prog_tar_$1}" && break
1018100ae103Smrg
1019100ae103Smrg  # tar/untar a dummy directory, and stop if the command works
1020100ae103Smrg  rm -rf conftest.dir
1021100ae103Smrg  mkdir conftest.dir
1022100ae103Smrg  echo GrepMe > conftest.dir/file
1023100ae103Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1024100ae103Smrg  rm -rf conftest.dir
1025100ae103Smrg  if test -s conftest.tar; then
1026100ae103Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1027100ae103Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1028100ae103Smrg  fi
1029100ae103Smrgdone
1030100ae103Smrgrm -rf conftest.dir
1031100ae103Smrg
1032100ae103SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1033100ae103SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1034100ae103SmrgAC_SUBST([am__tar])
1035100ae103SmrgAC_SUBST([am__untar])
1036100ae103Smrg]) # _AM_PROG_TAR
1037100ae103Smrg
10388831d3fbSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
10398831d3fbSmrg# 
10408831d3fbSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
10418831d3fbSmrg#
10428831d3fbSmrg# This program is free software; you can redistribute it and/or modify
10438831d3fbSmrg# it under the terms of the GNU General Public License as published by
10448831d3fbSmrg# the Free Software Foundation; either version 2 of the License, or
10458831d3fbSmrg# (at your option) any later version.
10468831d3fbSmrg#
10478831d3fbSmrg# This program is distributed in the hope that it will be useful, but
10488831d3fbSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
10498831d3fbSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10508831d3fbSmrg# General Public License for more details.
10518831d3fbSmrg#
10528831d3fbSmrg# You should have received a copy of the GNU General Public License
10538831d3fbSmrg# along with this program; if not, write to the Free Software
10548831d3fbSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
10558831d3fbSmrg#
10568831d3fbSmrg# As a special exception to the GNU General Public License, if you
10578831d3fbSmrg# distribute this file as part of a program that contains a
10588831d3fbSmrg# configuration script generated by Autoconf, you may include it under
10598831d3fbSmrg# the same distribution terms that you use for the rest of that program.
10608831d3fbSmrg
10618831d3fbSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
10628831d3fbSmrg# ----------------------------------
10638831d3fbSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
10648831d3fbSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
10658831d3fbSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
10668831d3fbSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
10678831d3fbSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
10688831d3fbSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
10698831d3fbSmrgfi
10708831d3fbSmrgif test -n "$PKG_CONFIG"; then
10718831d3fbSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
10728831d3fbSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
10738831d3fbSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
10748831d3fbSmrg		AC_MSG_RESULT([yes])
10758831d3fbSmrg	else
10768831d3fbSmrg		AC_MSG_RESULT([no])
10778831d3fbSmrg		PKG_CONFIG=""
10788831d3fbSmrg	fi
10798831d3fbSmrg		
10808831d3fbSmrgfi[]dnl
10818831d3fbSmrg])# PKG_PROG_PKG_CONFIG
10828831d3fbSmrg
10838831d3fbSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10848831d3fbSmrg#
10858831d3fbSmrg# Check to see whether a particular set of modules exists.  Similar
10868831d3fbSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
10878831d3fbSmrg#
10888831d3fbSmrg#
10898831d3fbSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
10908831d3fbSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
10918831d3fbSmrg# PKG_CHECK_EXISTS manually
10928831d3fbSmrg# --------------------------------------------------------------
10938831d3fbSmrgAC_DEFUN([PKG_CHECK_EXISTS],
10948831d3fbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10958831d3fbSmrgif test -n "$PKG_CONFIG" && \
10968831d3fbSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
10978831d3fbSmrg  m4_ifval([$2], [$2], [:])
10988831d3fbSmrgm4_ifvaln([$3], [else
10998831d3fbSmrg  $3])dnl
11008831d3fbSmrgfi])
11018831d3fbSmrg
11028831d3fbSmrg
11038831d3fbSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
11048831d3fbSmrg# ---------------------------------------------
11058831d3fbSmrgm4_define([_PKG_CONFIG],
11068831d3fbSmrg[if test -n "$$1"; then
11078831d3fbSmrg    pkg_cv_[]$1="$$1"
11088831d3fbSmrg elif test -n "$PKG_CONFIG"; then
11098831d3fbSmrg    PKG_CHECK_EXISTS([$3],
11108831d3fbSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
11118831d3fbSmrg		     [pkg_failed=yes])
11128831d3fbSmrg else
11138831d3fbSmrg    pkg_failed=untried
11148831d3fbSmrgfi[]dnl
11158831d3fbSmrg])# _PKG_CONFIG
11168831d3fbSmrg
11178831d3fbSmrg# _PKG_SHORT_ERRORS_SUPPORTED
11188831d3fbSmrg# -----------------------------
11198831d3fbSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
11208831d3fbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11218831d3fbSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
11228831d3fbSmrg        _pkg_short_errors_supported=yes
11238831d3fbSmrgelse
11248831d3fbSmrg        _pkg_short_errors_supported=no
11258831d3fbSmrgfi[]dnl
11268831d3fbSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
11278831d3fbSmrg
11288831d3fbSmrg
11298831d3fbSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
11308831d3fbSmrg# [ACTION-IF-NOT-FOUND])
11318831d3fbSmrg#
11328831d3fbSmrg#
11338831d3fbSmrg# Note that if there is a possibility the first call to
11348831d3fbSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
11358831d3fbSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
11368831d3fbSmrg#
11378831d3fbSmrg#
11388831d3fbSmrg# --------------------------------------------------------------
11398831d3fbSmrgAC_DEFUN([PKG_CHECK_MODULES],
11408831d3fbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11418831d3fbSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
11428831d3fbSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
11438831d3fbSmrg
11448831d3fbSmrgpkg_failed=no
11458831d3fbSmrgAC_MSG_CHECKING([for $1])
11468831d3fbSmrg
11478831d3fbSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
11488831d3fbSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
11498831d3fbSmrg
11508831d3fbSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
11518831d3fbSmrgand $1[]_LIBS to avoid the need to call pkg-config.
11528831d3fbSmrgSee the pkg-config man page for more details.])
11538831d3fbSmrg
11548831d3fbSmrgif test $pkg_failed = yes; then
11558831d3fbSmrg        _PKG_SHORT_ERRORS_SUPPORTED
11568831d3fbSmrg        if test $_pkg_short_errors_supported = yes; then
11578831d3fbSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
11588831d3fbSmrg        else 
11598831d3fbSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
11608831d3fbSmrg        fi
11618831d3fbSmrg	# Put the nasty error message in config.log where it belongs
11628831d3fbSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
11638831d3fbSmrg
11648831d3fbSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
11658831d3fbSmrg[Package requirements ($2) were not met:
11668831d3fbSmrg
11678831d3fbSmrg$$1_PKG_ERRORS
11688831d3fbSmrg
11698831d3fbSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
11708831d3fbSmrginstalled software in a non-standard prefix.
11718831d3fbSmrg
11728831d3fbSmrg_PKG_TEXT
11738831d3fbSmrg])],
11748831d3fbSmrg		[AC_MSG_RESULT([no])
11758831d3fbSmrg                $4])
11768831d3fbSmrgelif test $pkg_failed = untried; then
11778831d3fbSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
11788831d3fbSmrg[The pkg-config script could not be found or is too old.  Make sure it
11798831d3fbSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
11808831d3fbSmrgpath to pkg-config.
11818831d3fbSmrg
11828831d3fbSmrg_PKG_TEXT
11838831d3fbSmrg
11848831d3fbSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
11858831d3fbSmrg		[$4])
11868831d3fbSmrgelse
11878831d3fbSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
11888831d3fbSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
11898831d3fbSmrg        AC_MSG_RESULT([yes])
11908831d3fbSmrg	ifelse([$3], , :, [$3])
11918831d3fbSmrgfi[]dnl
11928831d3fbSmrg])# PKG_CHECK_MODULES
11938831d3fbSmrg
1194165cb819Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1195100ae103Smrgdnl
11968831d3fbSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1197100ae103Smrgdnl 
1198100ae103Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1199165cb819Smrgdnl copy of this software and associated documentation files (the "Software"),
1200165cb819Smrgdnl to deal in the Software without restriction, including without limitation
1201165cb819Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1202165cb819Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1203165cb819Smrgdnl Software is furnished to do so, subject to the following conditions:
1204100ae103Smrgdnl
1205165cb819Smrgdnl The above copyright notice and this permission notice (including the next
1206165cb819Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1207165cb819Smrgdnl Software.
1208100ae103Smrgdnl
1209165cb819Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1210165cb819Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1211165cb819Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1212165cb819Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1213165cb819Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1214165cb819Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1215165cb819Smrgdnl DEALINGS IN THE SOFTWARE.
1216100ae103Smrg
1217100ae103Smrg# XORG_MACROS_VERSION(required-version)
1218100ae103Smrg# -------------------------------------
1219100ae103Smrg# Minimum version: 1.1.0
1220100ae103Smrg#
1221100ae103Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1222100ae103Smrg# your configure.ac with the minimum required version, such as:
1223100ae103Smrg# XORG_MACROS_VERSION(1.1)
1224100ae103Smrg#
1225165cb819Smrg# To ensure that this macro is defined, also add:
1226165cb819Smrg# m4_ifndef([XORG_MACROS_VERSION],
1227165cb819Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1228100ae103Smrg#
1229100ae103Smrg#
1230100ae103Smrg# See the "minimum version" comment for each macro you use to see what 
1231100ae103Smrg# version you require.
1232165cb819Smrgm4_defun([XORG_MACROS_VERSION],[
12338831d3fbSmrgm4_define([vers_have], [1.17])
1234165cb819Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1235165cb819Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1236165cb819Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1237165cb819Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1238165cb819Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1239165cb819Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1240165cb819Smrgm4_undefine([vers_have])
1241165cb819Smrgm4_undefine([maj_have])
1242165cb819Smrgm4_undefine([maj_needed])
1243100ae103Smrg]) # XORG_MACROS_VERSION
1244100ae103Smrg
1245100ae103Smrg# XORG_PROG_RAWCPP()
1246100ae103Smrg# ------------------
1247100ae103Smrg# Minimum version: 1.0.0
1248100ae103Smrg#
1249100ae103Smrg# Find cpp program and necessary flags for use in pre-processing text files
1250100ae103Smrg# such as man pages and config files
1251100ae103SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1252100ae103SmrgAC_REQUIRE([AC_PROG_CPP])
1253100ae103SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1254100ae103Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1255100ae103Smrg
1256100ae103Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1257100ae103Smrg# which is not the best choice for supporting other OS'es, but covers most
1258100ae103Smrg# of the ones we need for now.
1259100ae103SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
12608831d3fbSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1261100ae103Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1262100ae103Smrg	AC_MSG_RESULT([no])
1263100ae103Smrgelse
1264100ae103Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1265100ae103Smrg		RAWCPPFLAGS=-undef
1266100ae103Smrg		AC_MSG_RESULT([yes])
1267165cb819Smrg	# under Cygwin unix is still defined even with -undef
1268165cb819Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1269165cb819Smrg		RAWCPPFLAGS="-undef -ansi"
1270165cb819Smrg		AC_MSG_RESULT([yes, with -ansi])
1271100ae103Smrg	else
1272100ae103Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1273100ae103Smrg	fi
1274100ae103Smrgfi
1275100ae103Smrgrm -f conftest.$ac_ext
1276100ae103Smrg
1277100ae103SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
12788831d3fbSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1279100ae103Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1280100ae103Smrg	AC_MSG_RESULT([no])
1281100ae103Smrgelse
1282100ae103Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1283100ae103Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1284100ae103Smrg		AC_MSG_RESULT([yes])
1285100ae103Smrg	else
1286100ae103Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1287100ae103Smrg	fi
1288100ae103Smrgfi
1289100ae103Smrgrm -f conftest.$ac_ext
1290100ae103SmrgAC_SUBST(RAWCPPFLAGS)
1291100ae103Smrg]) # XORG_PROG_RAWCPP
1292100ae103Smrg
1293100ae103Smrg# XORG_MANPAGE_SECTIONS()
1294100ae103Smrg# -----------------------
1295100ae103Smrg# Minimum version: 1.0.0
1296100ae103Smrg#
1297100ae103Smrg# Determine which sections man pages go in for the different man page types
1298100ae103Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1299100ae103Smrg# Not sure if there's any better way than just hardcoding by OS name.
1300100ae103Smrg# Override default settings by setting environment variables
13018831d3fbSmrg# Added MAN_SUBSTS in version 1.8
13028831d3fbSmrg# Added AC_PROG_SED in version 1.8
1303100ae103Smrg
1304100ae103SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1305100ae103SmrgAC_REQUIRE([AC_CANONICAL_HOST])
13068831d3fbSmrgAC_REQUIRE([AC_PROG_SED])
1307100ae103Smrg
1308100ae103Smrgif test x$APP_MAN_SUFFIX = x    ; then
1309100ae103Smrg    APP_MAN_SUFFIX=1
1310100ae103Smrgfi
1311100ae103Smrgif test x$APP_MAN_DIR = x    ; then
1312100ae103Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1313100ae103Smrgfi
1314100ae103Smrg
1315100ae103Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1316100ae103Smrg    LIB_MAN_SUFFIX=3
1317100ae103Smrgfi
1318100ae103Smrgif test x$LIB_MAN_DIR = x    ; then
1319100ae103Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1320100ae103Smrgfi
1321100ae103Smrg
1322100ae103Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1323100ae103Smrg    case $host_os in
1324100ae103Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1325100ae103Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1326100ae103Smrg    esac
1327100ae103Smrgfi
1328100ae103Smrgif test x$FILE_MAN_DIR = x    ; then
1329100ae103Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1330100ae103Smrgfi
1331100ae103Smrg
1332100ae103Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1333100ae103Smrg    case $host_os in
1334100ae103Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1335100ae103Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1336100ae103Smrg    esac
1337100ae103Smrgfi
1338100ae103Smrgif test x$MISC_MAN_DIR = x    ; then
1339100ae103Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1340100ae103Smrgfi
1341100ae103Smrg
1342100ae103Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1343100ae103Smrg    case $host_os in
1344100ae103Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1345100ae103Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1346100ae103Smrg    esac
1347100ae103Smrgfi
1348100ae103Smrgif test x$DRIVER_MAN_DIR = x    ; then
1349100ae103Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1350100ae103Smrgfi
1351100ae103Smrg
1352100ae103Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1353100ae103Smrg    case $host_os in
1354100ae103Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1355100ae103Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1356100ae103Smrg    esac
1357100ae103Smrgfi
1358100ae103Smrgif test x$ADMIN_MAN_DIR = x    ; then
1359100ae103Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1360100ae103Smrgfi
1361100ae103Smrg
1362100ae103Smrg
1363100ae103SmrgAC_SUBST([APP_MAN_SUFFIX])
1364100ae103SmrgAC_SUBST([LIB_MAN_SUFFIX])
1365100ae103SmrgAC_SUBST([FILE_MAN_SUFFIX])
1366100ae103SmrgAC_SUBST([MISC_MAN_SUFFIX])
1367100ae103SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1368100ae103SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1369100ae103SmrgAC_SUBST([APP_MAN_DIR])
1370100ae103SmrgAC_SUBST([LIB_MAN_DIR])
1371100ae103SmrgAC_SUBST([FILE_MAN_DIR])
1372100ae103SmrgAC_SUBST([MISC_MAN_DIR])
1373100ae103SmrgAC_SUBST([DRIVER_MAN_DIR])
1374100ae103SmrgAC_SUBST([ADMIN_MAN_DIR])
13758831d3fbSmrg
13768831d3fbSmrgXORG_MAN_PAGE="X Version 11"
13778831d3fbSmrgAC_SUBST([XORG_MAN_PAGE])
13788831d3fbSmrgMAN_SUBSTS="\
13798831d3fbSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13808831d3fbSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13818831d3fbSmrg	-e 's|__xservername__|Xorg|g' \
13828831d3fbSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
13838831d3fbSmrg	-e 's|__projectroot__|\$(prefix)|g' \
13848831d3fbSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
13858831d3fbSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
13868831d3fbSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
13878831d3fbSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
13888831d3fbSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
13898831d3fbSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
13908831d3fbSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
13918831d3fbSmrgAC_SUBST([MAN_SUBSTS])
13928831d3fbSmrg
1393100ae103Smrg]) # XORG_MANPAGE_SECTIONS
1394100ae103Smrg
13958831d3fbSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
13968831d3fbSmrg# ------------------------
13978831d3fbSmrg# Minimum version: 1.7.0
13988831d3fbSmrg#
13998831d3fbSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
14008831d3fbSmrg# provided by xorg-sgml-doctools, if installed.
14018831d3fbSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
14028831d3fbSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
14038831d3fbSmrgXORG_SGML_PATH=
14048831d3fbSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
14058831d3fbSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
14068831d3fbSmrg    [m4_ifval([$1],[:],
14078831d3fbSmrg        [if test x"$cross_compiling" != x"yes" ; then
14088831d3fbSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
14098831d3fbSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
14108831d3fbSmrg         fi])
14118831d3fbSmrg    ])
14128831d3fbSmrg
14138831d3fbSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
14148831d3fbSmrg# the path and the name of the doc stylesheet
14158831d3fbSmrgif test "x$XORG_SGML_PATH" != "x" ; then
14168831d3fbSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
14178831d3fbSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
14188831d3fbSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
14198831d3fbSmrgelse
14208831d3fbSmrg   AC_MSG_RESULT([no])
14218831d3fbSmrgfi
14228831d3fbSmrg
14238831d3fbSmrgAC_SUBST(XORG_SGML_PATH)
14248831d3fbSmrgAC_SUBST(STYLESHEET_SRCDIR)
14258831d3fbSmrgAC_SUBST(XSL_STYLESHEET)
14268831d3fbSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
14278831d3fbSmrg]) # XORG_CHECK_SGML_DOCTOOLS
14288831d3fbSmrg
1429100ae103Smrg# XORG_CHECK_LINUXDOC
1430100ae103Smrg# -------------------
1431100ae103Smrg# Minimum version: 1.0.0
1432100ae103Smrg#
1433100ae103Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1434100ae103Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1435100ae103Smrg# Whether or not the necessary tools and files are found can be checked
1436100ae103Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1437100ae103SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
14388831d3fbSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14398831d3fbSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1440100ae103Smrg
1441100ae103SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1442100ae103Smrg
14438831d3fbSmrgAC_MSG_CHECKING([whether to build documentation])
1444100ae103Smrg
14458831d3fbSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1446100ae103Smrg   BUILDDOC=yes
1447100ae103Smrgelse
1448100ae103Smrg   BUILDDOC=no
1449100ae103Smrgfi
1450100ae103Smrg
1451100ae103SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1452100ae103Smrg
1453100ae103SmrgAC_MSG_RESULT([$BUILDDOC])
1454100ae103Smrg
14558831d3fbSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1456100ae103Smrg
14578831d3fbSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1458100ae103Smrg   BUILDPDFDOC=yes
1459100ae103Smrgelse
1460100ae103Smrg   BUILDPDFDOC=no
1461100ae103Smrgfi
1462100ae103Smrg
1463100ae103SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1464100ae103Smrg
1465100ae103SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1466100ae103Smrg
14678831d3fbSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1468100ae103SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1469100ae103SmrgMAKE_PDF="$PS2PDF"
1470100ae103SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1471100ae103Smrg
1472100ae103SmrgAC_SUBST(MAKE_TEXT)
1473100ae103SmrgAC_SUBST(MAKE_PS)
1474100ae103SmrgAC_SUBST(MAKE_PDF)
1475100ae103SmrgAC_SUBST(MAKE_HTML)
1476100ae103Smrg]) # XORG_CHECK_LINUXDOC
1477100ae103Smrg
1478100ae103Smrg# XORG_CHECK_DOCBOOK
1479100ae103Smrg# -------------------
1480100ae103Smrg# Minimum version: 1.0.0
1481100ae103Smrg#
1482100ae103Smrg# Checks for the ability to build output formats from SGML DocBook source.
1483100ae103Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1484100ae103Smrg# indicates whether the necessary tools and files are found and, if set,
1485100ae103Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1486100ae103SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
14878831d3fbSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14888831d3fbSmrg
1489100ae103SmrgBUILDTXTDOC=no
1490100ae103SmrgBUILDPDFDOC=no
1491100ae103SmrgBUILDPSDOC=no
1492100ae103SmrgBUILDHTMLDOC=no
1493100ae103Smrg
1494100ae103SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1495100ae103SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1496100ae103SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1497100ae103SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1498100ae103Smrg
14998831d3fbSmrgAC_MSG_CHECKING([whether to build text documentation])
15008831d3fbSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1501100ae103Smrg   test x$BUILD_TXTDOC != xno; then
1502100ae103Smrg	BUILDTXTDOC=yes
1503100ae103Smrgfi
1504100ae103SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1505100ae103SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1506100ae103Smrg
15078831d3fbSmrgAC_MSG_CHECKING([whether to build PDF documentation])
15088831d3fbSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1509100ae103Smrg   test x$BUILD_PDFDOC != xno; then
1510100ae103Smrg	BUILDPDFDOC=yes
1511100ae103Smrgfi
1512100ae103SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1513100ae103SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1514100ae103Smrg
15158831d3fbSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
15168831d3fbSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1517100ae103Smrg   test x$BUILD_PSDOC != xno; then
1518100ae103Smrg	BUILDPSDOC=yes
1519100ae103Smrgfi
1520100ae103SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1521100ae103SmrgAC_MSG_RESULT([$BUILDPSDOC])
1522100ae103Smrg
15238831d3fbSmrgAC_MSG_CHECKING([whether to build HTML documentation])
15248831d3fbSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1525100ae103Smrg   test x$BUILD_HTMLDOC != xno; then
1526100ae103Smrg	BUILDHTMLDOC=yes
1527100ae103Smrgfi
1528100ae103SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1529100ae103SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1530100ae103Smrg
1531100ae103SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1532100ae103SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1533100ae103SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1534100ae103SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1535100ae103Smrg
1536100ae103SmrgAC_SUBST(MAKE_TEXT)
1537100ae103SmrgAC_SUBST(MAKE_PS)
1538100ae103SmrgAC_SUBST(MAKE_PDF)
1539100ae103SmrgAC_SUBST(MAKE_HTML)
1540100ae103Smrg]) # XORG_CHECK_DOCBOOK
1541100ae103Smrg
15428831d3fbSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1543165cb819Smrg# ----------------
1544165cb819Smrg# Minimum version: 1.5.0
15458831d3fbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1546165cb819Smrg#
1547165cb819Smrg# Documentation tools are not always available on all platforms and sometimes
1548165cb819Smrg# not at the appropriate level. This macro enables a module to test for the
1549165cb819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1550165cb819Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
15518831d3fbSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
15528831d3fbSmrg# --with-xmlto assumes 'auto'.
1553165cb819Smrg#
1554165cb819Smrg# Interface to module:
1555165cb819Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1556165cb819Smrg# XMLTO:	returns the path of the xmlto program found
1557165cb819Smrg#		returns the path set by the user in the environment
1558165cb819Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1559165cb819Smrg#		'no' user instructs the module not to use xmlto
1560165cb819Smrg#
15618831d3fbSmrg# Added in version 1.10.0
15628831d3fbSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
15638831d3fbSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
15648831d3fbSmrg#
1565165cb819Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1566165cb819Smrg#
1567165cb819SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1568165cb819SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
15698831d3fbSmrgm4_define([_defopt], m4_default([$2], [auto]))
1570165cb819SmrgAC_ARG_WITH(xmlto,
1571165cb819Smrg	AS_HELP_STRING([--with-xmlto],
15728831d3fbSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
15738831d3fbSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
15748831d3fbSmrgm4_undefine([_defopt])
1575165cb819Smrg
1576165cb819Smrgif test "x$use_xmlto" = x"auto"; then
1577165cb819Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1578165cb819Smrg   if test "x$XMLTO" = "x"; then
1579165cb819Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1580165cb819Smrg	have_xmlto=no
1581165cb819Smrg   else
1582165cb819Smrg        have_xmlto=yes
1583165cb819Smrg   fi
1584165cb819Smrgelif test "x$use_xmlto" = x"yes" ; then
1585165cb819Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1586165cb819Smrg   if test "x$XMLTO" = "x"; then
1587165cb819Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1588165cb819Smrg   fi
1589165cb819Smrg   have_xmlto=yes
1590165cb819Smrgelif test "x$use_xmlto" = x"no" ; then
1591165cb819Smrg   if test "x$XMLTO" != "x"; then
1592165cb819Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1593165cb819Smrg   fi
1594165cb819Smrg   have_xmlto=no
1595165cb819Smrgelse
1596165cb819Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1597165cb819Smrgfi
15988831d3fbSmrg
15998831d3fbSmrg# Test for a minimum version of xmlto, if provided.
16008831d3fbSmrgm4_ifval([$1],
16018831d3fbSmrg[if test "$have_xmlto" = yes; then
16028831d3fbSmrg    # scrape the xmlto version
16038831d3fbSmrg    AC_MSG_CHECKING([the xmlto version])
16048831d3fbSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
16058831d3fbSmrg    AC_MSG_RESULT([$xmlto_version])
16068831d3fbSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
16078831d3fbSmrg        [if test "x$use_xmlto" = xauto; then
16088831d3fbSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
16098831d3fbSmrg            have_xmlto=no
16108831d3fbSmrg        else
16118831d3fbSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
16128831d3fbSmrg        fi])
16138831d3fbSmrgfi])
16148831d3fbSmrg
16158831d3fbSmrg# Test for the ability of xmlto to generate a text target
16168831d3fbSmrghave_xmlto_text=no
16178831d3fbSmrgcat > conftest.xml << "EOF"
16188831d3fbSmrgEOF
16198831d3fbSmrgAS_IF([test "$have_xmlto" = yes],
16208831d3fbSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
16218831d3fbSmrg             [have_xmlto_text=yes],
16228831d3fbSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
16238831d3fbSmrgrm -f conftest.xml
16248831d3fbSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1625165cb819SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
16268831d3fbSmrg]) # XORG_WITH_XMLTO
16278831d3fbSmrg
16288831d3fbSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
16298831d3fbSmrg# --------------------------------------------
16308831d3fbSmrg# Minimum version: 1.12.0
16318831d3fbSmrg# Minimum version for optional DEFAULT argument: 1.12.0
16328831d3fbSmrg#
16338831d3fbSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
16348831d3fbSmrg# XML-based language used for the transformation of XML documents.
16358831d3fbSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
16368831d3fbSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
16378831d3fbSmrg# The XSLT processor is often used as a standalone tool for transformations.
16388831d3fbSmrg# It should not be assumed that this tool is used only to work with documnetation.
16398831d3fbSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
16408831d3fbSmrg#
16418831d3fbSmrg# Interface to module:
16428831d3fbSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
16438831d3fbSmrg# XSLTPROC:	 returns the path of the xsltproc program found
16448831d3fbSmrg#		 returns the path set by the user in the environment
16458831d3fbSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
16468831d3fbSmrg#		  'no' user instructs the module not to use xsltproc
16478831d3fbSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
16488831d3fbSmrg#
16498831d3fbSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
16508831d3fbSmrg#
16518831d3fbSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
16528831d3fbSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
16538831d3fbSmrg# Preserves the interface, should it be implemented later
16548831d3fbSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
16558831d3fbSmrgm4_define([_defopt], m4_default([$2], [auto]))
16568831d3fbSmrgAC_ARG_WITH(xsltproc,
16578831d3fbSmrg	AS_HELP_STRING([--with-xsltproc],
16588831d3fbSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
16598831d3fbSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
16608831d3fbSmrgm4_undefine([_defopt])
16618831d3fbSmrg
16628831d3fbSmrgif test "x$use_xsltproc" = x"auto"; then
16638831d3fbSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16648831d3fbSmrg   if test "x$XSLTPROC" = "x"; then
16658831d3fbSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
16668831d3fbSmrg	have_xsltproc=no
16678831d3fbSmrg   else
16688831d3fbSmrg        have_xsltproc=yes
16698831d3fbSmrg   fi
16708831d3fbSmrgelif test "x$use_xsltproc" = x"yes" ; then
16718831d3fbSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16728831d3fbSmrg   if test "x$XSLTPROC" = "x"; then
16738831d3fbSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
16748831d3fbSmrg   fi
16758831d3fbSmrg   have_xsltproc=yes
16768831d3fbSmrgelif test "x$use_xsltproc" = x"no" ; then
16778831d3fbSmrg   if test "x$XSLTPROC" != "x"; then
16788831d3fbSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
16798831d3fbSmrg   fi
16808831d3fbSmrg   have_xsltproc=no
16818831d3fbSmrgelse
16828831d3fbSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
16838831d3fbSmrgfi
16848831d3fbSmrg
16858831d3fbSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
16868831d3fbSmrg]) # XORG_WITH_XSLTPROC
16878831d3fbSmrg
16888831d3fbSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
16898831d3fbSmrg# ----------------------------------------
16908831d3fbSmrg# Minimum version: 1.15.0
16918831d3fbSmrg#
16928831d3fbSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
16938831d3fbSmrg# scanning arbitrary text files, extracting information from those text files,
16948831d3fbSmrg# and printing reports based on that information.
16958831d3fbSmrg#
16968831d3fbSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
16978831d3fbSmrg#
16988831d3fbSmrg# Interface to module:
16998831d3fbSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
17008831d3fbSmrg# PERL:	     returns the path of the perl program found
17018831d3fbSmrg#	     returns the path set by the user in the environment
17028831d3fbSmrg# --with-perl: 'yes' user instructs the module to use perl
17038831d3fbSmrg#	       'no' user instructs the module not to use perl
17048831d3fbSmrg# have_perl: returns yes if perl found in PATH or no
17058831d3fbSmrg#
17068831d3fbSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
17078831d3fbSmrg#
17088831d3fbSmrgAC_DEFUN([XORG_WITH_PERL],[
17098831d3fbSmrgAC_ARG_VAR([PERL], [Path to perl command])
17108831d3fbSmrg# Preserves the interface, should it be implemented later
17118831d3fbSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
17128831d3fbSmrgm4_define([_defopt], m4_default([$2], [auto]))
17138831d3fbSmrgAC_ARG_WITH(perl,
17148831d3fbSmrg	AS_HELP_STRING([--with-perl],
17158831d3fbSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
17168831d3fbSmrg	   [use_perl=$withval], [use_perl=]_defopt)
17178831d3fbSmrgm4_undefine([_defopt])
17188831d3fbSmrg
17198831d3fbSmrgif test "x$use_perl" = x"auto"; then
17208831d3fbSmrg   AC_PATH_PROG([PERL], [perl])
17218831d3fbSmrg   if test "x$PERL" = "x"; then
17228831d3fbSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
17238831d3fbSmrg	have_perl=no
17248831d3fbSmrg   else
17258831d3fbSmrg        have_perl=yes
17268831d3fbSmrg   fi
17278831d3fbSmrgelif test "x$use_perl" = x"yes" ; then
17288831d3fbSmrg   AC_PATH_PROG([PERL], [perl])
17298831d3fbSmrg   if test "x$PERL" = "x"; then
17308831d3fbSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
17318831d3fbSmrg   fi
17328831d3fbSmrg   have_perl=yes
17338831d3fbSmrgelif test "x$use_perl" = x"no" ; then
17348831d3fbSmrg   if test "x$PERL" != "x"; then
17358831d3fbSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
17368831d3fbSmrg   fi
17378831d3fbSmrg   have_perl=no
17388831d3fbSmrgelse
17398831d3fbSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
17408831d3fbSmrgfi
17418831d3fbSmrg
17428831d3fbSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
17438831d3fbSmrg]) # XORG_WITH_PERL
1744165cb819Smrg
17458831d3fbSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1746165cb819Smrg# ----------------
1747165cb819Smrg# Minimum version: 1.5.0
17488831d3fbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1749165cb819Smrg#
1750165cb819Smrg# Documentation tools are not always available on all platforms and sometimes
1751165cb819Smrg# not at the appropriate level. This macro enables a module to test for the
1752165cb819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1753165cb819Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
17548831d3fbSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
17558831d3fbSmrg# --with-asciidoc assumes 'auto'.
1756165cb819Smrg#
1757165cb819Smrg# Interface to module:
1758165cb819Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1759165cb819Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1760165cb819Smrg#		 returns the path set by the user in the environment
1761165cb819Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1762165cb819Smrg#		  'no' user instructs the module not to use asciidoc
1763165cb819Smrg#
1764165cb819Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1765165cb819Smrg#
1766165cb819SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1767165cb819SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
17688831d3fbSmrgm4_define([_defopt], m4_default([$2], [auto]))
1769165cb819SmrgAC_ARG_WITH(asciidoc,
1770165cb819Smrg	AS_HELP_STRING([--with-asciidoc],
17718831d3fbSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
17728831d3fbSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
17738831d3fbSmrgm4_undefine([_defopt])
1774165cb819Smrg
1775165cb819Smrgif test "x$use_asciidoc" = x"auto"; then
1776165cb819Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1777165cb819Smrg   if test "x$ASCIIDOC" = "x"; then
1778165cb819Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1779165cb819Smrg	have_asciidoc=no
1780165cb819Smrg   else
1781165cb819Smrg        have_asciidoc=yes
1782165cb819Smrg   fi
1783165cb819Smrgelif test "x$use_asciidoc" = x"yes" ; then
1784165cb819Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1785165cb819Smrg   if test "x$ASCIIDOC" = "x"; then
1786165cb819Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1787165cb819Smrg   fi
1788165cb819Smrg   have_asciidoc=yes
1789165cb819Smrgelif test "x$use_asciidoc" = x"no" ; then
1790165cb819Smrg   if test "x$ASCIIDOC" != "x"; then
1791165cb819Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1792165cb819Smrg   fi
1793165cb819Smrg   have_asciidoc=no
1794165cb819Smrgelse
1795165cb819Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1796165cb819Smrgfi
17978831d3fbSmrgm4_ifval([$1],
17988831d3fbSmrg[if test "$have_asciidoc" = yes; then
17998831d3fbSmrg    # scrape the asciidoc version
18008831d3fbSmrg    AC_MSG_CHECKING([the asciidoc version])
18018831d3fbSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
18028831d3fbSmrg    AC_MSG_RESULT([$asciidoc_version])
18038831d3fbSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
18048831d3fbSmrg        [if test "x$use_asciidoc" = xauto; then
18058831d3fbSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
18068831d3fbSmrg            have_asciidoc=no
18078831d3fbSmrg        else
18088831d3fbSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
18098831d3fbSmrg        fi])
18108831d3fbSmrgfi])
1811165cb819SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
18128831d3fbSmrg]) # XORG_WITH_ASCIIDOC
1813165cb819Smrg
18148831d3fbSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
18158831d3fbSmrg# --------------------------------
1816165cb819Smrg# Minimum version: 1.5.0
18178831d3fbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1818165cb819Smrg#
1819165cb819Smrg# Documentation tools are not always available on all platforms and sometimes
1820165cb819Smrg# not at the appropriate level. This macro enables a module to test for the
1821165cb819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1822165cb819Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
18238831d3fbSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
18248831d3fbSmrg# --with-doxygen assumes 'auto'.
1825165cb819Smrg#
1826165cb819Smrg# Interface to module:
1827165cb819Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1828165cb819Smrg# DOXYGEN:	 returns the path of the doxygen program found
1829165cb819Smrg#		 returns the path set by the user in the environment
1830165cb819Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1831165cb819Smrg#		  'no' user instructs the module not to use doxygen
1832165cb819Smrg#
1833165cb819Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1834165cb819Smrg#
1835165cb819SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1836165cb819SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
18378831d3fbSmrgm4_define([_defopt], m4_default([$2], [auto]))
1838165cb819SmrgAC_ARG_WITH(doxygen,
1839165cb819Smrg	AS_HELP_STRING([--with-doxygen],
18408831d3fbSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
18418831d3fbSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
18428831d3fbSmrgm4_undefine([_defopt])
1843165cb819Smrg
1844165cb819Smrgif test "x$use_doxygen" = x"auto"; then
1845165cb819Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1846165cb819Smrg   if test "x$DOXYGEN" = "x"; then
1847165cb819Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1848165cb819Smrg	have_doxygen=no
1849165cb819Smrg   else
1850165cb819Smrg        have_doxygen=yes
1851165cb819Smrg   fi
1852165cb819Smrgelif test "x$use_doxygen" = x"yes" ; then
1853165cb819Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1854165cb819Smrg   if test "x$DOXYGEN" = "x"; then
1855165cb819Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1856165cb819Smrg   fi
1857165cb819Smrg   have_doxygen=yes
1858165cb819Smrgelif test "x$use_doxygen" = x"no" ; then
1859165cb819Smrg   if test "x$DOXYGEN" != "x"; then
1860165cb819Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1861165cb819Smrg   fi
1862165cb819Smrg   have_doxygen=no
1863165cb819Smrgelse
1864165cb819Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1865165cb819Smrgfi
18668831d3fbSmrgm4_ifval([$1],
18678831d3fbSmrg[if test "$have_doxygen" = yes; then
18688831d3fbSmrg    # scrape the doxygen version
18698831d3fbSmrg    AC_MSG_CHECKING([the doxygen version])
18708831d3fbSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
18718831d3fbSmrg    AC_MSG_RESULT([$doxygen_version])
18728831d3fbSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
18738831d3fbSmrg        [if test "x$use_doxygen" = xauto; then
18748831d3fbSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
18758831d3fbSmrg            have_doxygen=no
18768831d3fbSmrg        else
18778831d3fbSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
18788831d3fbSmrg        fi])
18798831d3fbSmrgfi])
1880165cb819SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
18818831d3fbSmrg]) # XORG_WITH_DOXYGEN
1882165cb819Smrg
18838831d3fbSmrg# XORG_WITH_GROFF([DEFAULT])
18848831d3fbSmrg# ----------------
18858831d3fbSmrg# Minimum version: 1.6.0
18868831d3fbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1887100ae103Smrg#
18888831d3fbSmrg# Documentation tools are not always available on all platforms and sometimes
18898831d3fbSmrg# not at the appropriate level. This macro enables a module to test for the
18908831d3fbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18918831d3fbSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
18928831d3fbSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
18938831d3fbSmrg# --with-groff assumes 'auto'.
18948831d3fbSmrg#
18958831d3fbSmrg# Interface to module:
18968831d3fbSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
18978831d3fbSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
18988831d3fbSmrg# HAVE_GROFF_MS: the -ms macros package
18998831d3fbSmrg# GROFF:	 returns the path of the groff program found
19008831d3fbSmrg#		 returns the path set by the user in the environment
19018831d3fbSmrg# --with-groff:	 'yes' user instructs the module to use groff
19028831d3fbSmrg#		 'no' user instructs the module not to use groff
19038831d3fbSmrg#
19048831d3fbSmrg# Added in version 1.9.0:
19058831d3fbSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
19068831d3fbSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
19078831d3fbSmrg#		   psselect from the psutils package.
19088831d3fbSmrg#		   the ghostcript package. Refer to the grohtml man pages
19098831d3fbSmrg#
19108831d3fbSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
19118831d3fbSmrg#
19128831d3fbSmrg# OS and distros often splits groff in a basic and full package, the former
19138831d3fbSmrg# having the groff program and the later having devices, fonts and macros
19148831d3fbSmrg# Checking for the groff executable is not enough.
19158831d3fbSmrg#
19168831d3fbSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
19178831d3fbSmrg# unset HAVE_GROFF or GROFF env variables.
19188831d3fbSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
19198831d3fbSmrg#
19208831d3fbSmrgAC_DEFUN([XORG_WITH_GROFF],[
19218831d3fbSmrgAC_ARG_VAR([GROFF], [Path to groff command])
19228831d3fbSmrgm4_define([_defopt], m4_default([$1], [auto]))
19238831d3fbSmrgAC_ARG_WITH(groff,
19248831d3fbSmrg	AS_HELP_STRING([--with-groff],
19258831d3fbSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
19268831d3fbSmrg	   [use_groff=$withval], [use_groff=]_defopt)
19278831d3fbSmrgm4_undefine([_defopt])
19288831d3fbSmrg
19298831d3fbSmrgif test "x$use_groff" = x"auto"; then
19308831d3fbSmrg   AC_PATH_PROG([GROFF], [groff])
19318831d3fbSmrg   if test "x$GROFF" = "x"; then
19328831d3fbSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
19338831d3fbSmrg	have_groff=no
19348831d3fbSmrg   else
19358831d3fbSmrg        have_groff=yes
19368831d3fbSmrg   fi
19378831d3fbSmrgelif test "x$use_groff" = x"yes" ; then
19388831d3fbSmrg   AC_PATH_PROG([GROFF], [groff])
19398831d3fbSmrg   if test "x$GROFF" = "x"; then
19408831d3fbSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
19418831d3fbSmrg   fi
19428831d3fbSmrg   have_groff=yes
19438831d3fbSmrgelif test "x$use_groff" = x"no" ; then
19448831d3fbSmrg   if test "x$GROFF" != "x"; then
19458831d3fbSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
19468831d3fbSmrg   fi
19478831d3fbSmrg   have_groff=no
19488831d3fbSmrgelse
19498831d3fbSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19508831d3fbSmrgfi
1951100ae103Smrg
19528831d3fbSmrg# We have groff, test for the presence of the macro packages
19538831d3fbSmrgif test "x$have_groff" = x"yes"; then
19548831d3fbSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
19558831d3fbSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
19568831d3fbSmrg        groff_ms_works=yes
19578831d3fbSmrg    else
19588831d3fbSmrg        groff_ms_works=no
19598831d3fbSmrg    fi
19608831d3fbSmrg    AC_MSG_RESULT([$groff_ms_works])
19618831d3fbSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
19628831d3fbSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
19638831d3fbSmrg        groff_mm_works=yes
19648831d3fbSmrg    else
19658831d3fbSmrg        groff_mm_works=no
19668831d3fbSmrg    fi
19678831d3fbSmrg    AC_MSG_RESULT([$groff_mm_works])
19688831d3fbSmrgfi
19698831d3fbSmrg
19708831d3fbSmrg# We have groff, test for HTML dependencies, one command per package
19718831d3fbSmrgif test "x$have_groff" = x"yes"; then
19728831d3fbSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
19738831d3fbSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
19748831d3fbSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
19758831d3fbSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
19768831d3fbSmrg      have_groff_html=yes
19778831d3fbSmrg   else
19788831d3fbSmrg      have_groff_html=no
19798831d3fbSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
19808831d3fbSmrg   fi
19818831d3fbSmrgfi
19828831d3fbSmrg
19838831d3fbSmrg# Set Automake conditionals for Makefiles
19848831d3fbSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
19858831d3fbSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
19868831d3fbSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
19878831d3fbSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
19888831d3fbSmrg]) # XORG_WITH_GROFF
19898831d3fbSmrg
19908831d3fbSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
19918831d3fbSmrg# ---------------------------------------
19928831d3fbSmrg# Minimum version: 1.6.0
19938831d3fbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19948831d3fbSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
19958831d3fbSmrg#
19968831d3fbSmrg# Documentation tools are not always available on all platforms and sometimes
19978831d3fbSmrg# not at the appropriate level. This macro enables a module to test for the
19988831d3fbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19998831d3fbSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
20008831d3fbSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
20018831d3fbSmrg# --with-fop assumes 'auto'.
20028831d3fbSmrg#
20038831d3fbSmrg# Interface to module:
20048831d3fbSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
20058831d3fbSmrg# FOP:	 	returns the path of the fop program found
20068831d3fbSmrg#		returns the path set by the user in the environment
20078831d3fbSmrg# --with-fop: 	'yes' user instructs the module to use fop
20088831d3fbSmrg#		'no' user instructs the module not to use fop
20098831d3fbSmrg#
20108831d3fbSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
20118831d3fbSmrg#
20128831d3fbSmrgAC_DEFUN([XORG_WITH_FOP],[
20138831d3fbSmrgAC_ARG_VAR([FOP], [Path to fop command])
20148831d3fbSmrgm4_define([_defopt], m4_default([$2], [auto]))
20158831d3fbSmrgAC_ARG_WITH(fop,
20168831d3fbSmrg	AS_HELP_STRING([--with-fop],
20178831d3fbSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
20188831d3fbSmrg	   [use_fop=$withval], [use_fop=]_defopt)
20198831d3fbSmrgm4_undefine([_defopt])
20208831d3fbSmrg
20218831d3fbSmrgif test "x$use_fop" = x"auto"; then
20228831d3fbSmrg   AC_PATH_PROG([FOP], [fop])
20238831d3fbSmrg   if test "x$FOP" = "x"; then
20248831d3fbSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
20258831d3fbSmrg	have_fop=no
20268831d3fbSmrg   else
20278831d3fbSmrg        have_fop=yes
20288831d3fbSmrg   fi
20298831d3fbSmrgelif test "x$use_fop" = x"yes" ; then
20308831d3fbSmrg   AC_PATH_PROG([FOP], [fop])
20318831d3fbSmrg   if test "x$FOP" = "x"; then
20328831d3fbSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
20338831d3fbSmrg   fi
20348831d3fbSmrg   have_fop=yes
20358831d3fbSmrgelif test "x$use_fop" = x"no" ; then
20368831d3fbSmrg   if test "x$FOP" != "x"; then
20378831d3fbSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
20388831d3fbSmrg   fi
20398831d3fbSmrg   have_fop=no
20408831d3fbSmrgelse
20418831d3fbSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20428831d3fbSmrgfi
20438831d3fbSmrg
20448831d3fbSmrg# Test for a minimum version of fop, if provided.
20458831d3fbSmrgm4_ifval([$1],
20468831d3fbSmrg[if test "$have_fop" = yes; then
20478831d3fbSmrg    # scrape the fop version
20488831d3fbSmrg    AC_MSG_CHECKING([for fop minimum version])
20498831d3fbSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
20508831d3fbSmrg    AC_MSG_RESULT([$fop_version])
20518831d3fbSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
20528831d3fbSmrg        [if test "x$use_fop" = xauto; then
20538831d3fbSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
20548831d3fbSmrg            have_fop=no
20558831d3fbSmrg        else
20568831d3fbSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
20578831d3fbSmrg        fi])
20588831d3fbSmrgfi])
20598831d3fbSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
20608831d3fbSmrg]) # XORG_WITH_FOP
20618831d3fbSmrg
20628831d3fbSmrg# XORG_WITH_PS2PDF([DEFAULT])
20638831d3fbSmrg# ----------------
20648831d3fbSmrg# Minimum version: 1.6.0
20658831d3fbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20668831d3fbSmrg#
20678831d3fbSmrg# Documentation tools are not always available on all platforms and sometimes
20688831d3fbSmrg# not at the appropriate level. This macro enables a module to test for the
20698831d3fbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20708831d3fbSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
20718831d3fbSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
20728831d3fbSmrg# --with-ps2pdf assumes 'auto'.
20738831d3fbSmrg#
20748831d3fbSmrg# Interface to module:
20758831d3fbSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
20768831d3fbSmrg# PS2PDF:	returns the path of the ps2pdf program found
20778831d3fbSmrg#		returns the path set by the user in the environment
20788831d3fbSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
20798831d3fbSmrg#		 'no' user instructs the module not to use ps2pdf
20808831d3fbSmrg#
20818831d3fbSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
20828831d3fbSmrg#
20838831d3fbSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
20848831d3fbSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
20858831d3fbSmrgm4_define([_defopt], m4_default([$1], [auto]))
20868831d3fbSmrgAC_ARG_WITH(ps2pdf,
20878831d3fbSmrg	AS_HELP_STRING([--with-ps2pdf],
20888831d3fbSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
20898831d3fbSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
20908831d3fbSmrgm4_undefine([_defopt])
20918831d3fbSmrg
20928831d3fbSmrgif test "x$use_ps2pdf" = x"auto"; then
20938831d3fbSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
20948831d3fbSmrg   if test "x$PS2PDF" = "x"; then
20958831d3fbSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
20968831d3fbSmrg	have_ps2pdf=no
20978831d3fbSmrg   else
20988831d3fbSmrg        have_ps2pdf=yes
20998831d3fbSmrg   fi
21008831d3fbSmrgelif test "x$use_ps2pdf" = x"yes" ; then
21018831d3fbSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
21028831d3fbSmrg   if test "x$PS2PDF" = "x"; then
21038831d3fbSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
21048831d3fbSmrg   fi
21058831d3fbSmrg   have_ps2pdf=yes
21068831d3fbSmrgelif test "x$use_ps2pdf" = x"no" ; then
21078831d3fbSmrg   if test "x$PS2PDF" != "x"; then
21088831d3fbSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
21098831d3fbSmrg   fi
21108831d3fbSmrg   have_ps2pdf=no
21118831d3fbSmrgelse
21128831d3fbSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
21138831d3fbSmrgfi
21148831d3fbSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
21158831d3fbSmrg]) # XORG_WITH_PS2PDF
21168831d3fbSmrg
21178831d3fbSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
21188831d3fbSmrg# ----------------
21198831d3fbSmrg# Minimum version: 1.6.0
21208831d3fbSmrg#
21218831d3fbSmrg# Documentation tools are not always available on all platforms and sometimes
21228831d3fbSmrg# not at the appropriate level. This macro enables a builder to skip all
21238831d3fbSmrg# documentation targets except traditional man pages.
21248831d3fbSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21258831d3fbSmrg# maximum flexibilty in controlling documentation building.
21268831d3fbSmrg# Refer to:
21278831d3fbSmrg# XORG_WITH_XMLTO         --with-xmlto
21288831d3fbSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21298831d3fbSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21308831d3fbSmrg# XORG_WITH_FOP           --with-fop
21318831d3fbSmrg# XORG_WITH_GROFF         --with-groff
21328831d3fbSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21338831d3fbSmrg#
21348831d3fbSmrg# Interface to module:
21358831d3fbSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
21368831d3fbSmrg# --enable-docs: 'yes' user instructs the module to generate docs
21378831d3fbSmrg#		 'no' user instructs the module not to generate docs
21388831d3fbSmrg# parm1:	specify the default value, yes or no.
21398831d3fbSmrg#
21408831d3fbSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
21418831d3fbSmrgm4_define([docs_default], m4_default([$1], [yes]))
21428831d3fbSmrgAC_ARG_ENABLE(docs,
21438831d3fbSmrg	AS_HELP_STRING([--enable-docs],
21448831d3fbSmrg	   [Enable building the documentation (default: ]docs_default[)]),
21458831d3fbSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
21468831d3fbSmrgm4_undefine([docs_default])
21478831d3fbSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
21488831d3fbSmrgAC_MSG_CHECKING([whether to build documentation])
21498831d3fbSmrgAC_MSG_RESULT([$build_docs])
21508831d3fbSmrg]) # XORG_ENABLE_DOCS
21518831d3fbSmrg
21528831d3fbSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
21538831d3fbSmrg# ----------------
21548831d3fbSmrg# Minimum version: 1.6.0
21558831d3fbSmrg#
21568831d3fbSmrg# This macro enables a builder to skip all developer documentation.
21578831d3fbSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21588831d3fbSmrg# maximum flexibilty in controlling documentation building.
21598831d3fbSmrg# Refer to:
21608831d3fbSmrg# XORG_WITH_XMLTO         --with-xmlto
21618831d3fbSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21628831d3fbSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21638831d3fbSmrg# XORG_WITH_FOP           --with-fop
21648831d3fbSmrg# XORG_WITH_GROFF         --with-groff
21658831d3fbSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21668831d3fbSmrg#
21678831d3fbSmrg# Interface to module:
21688831d3fbSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
21698831d3fbSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
21708831d3fbSmrg#			'no' user instructs the module not to generate developer docs
21718831d3fbSmrg# parm1:		specify the default value, yes or no.
21728831d3fbSmrg#
21738831d3fbSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
21748831d3fbSmrgm4_define([devel_default], m4_default([$1], [yes]))
21758831d3fbSmrgAC_ARG_ENABLE(devel-docs,
21768831d3fbSmrg	AS_HELP_STRING([--enable-devel-docs],
21778831d3fbSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
21788831d3fbSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
21798831d3fbSmrgm4_undefine([devel_default])
21808831d3fbSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
21818831d3fbSmrgAC_MSG_CHECKING([whether to build developer documentation])
21828831d3fbSmrgAC_MSG_RESULT([$build_devel_docs])
21838831d3fbSmrg]) # XORG_ENABLE_DEVEL_DOCS
21848831d3fbSmrg
21858831d3fbSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
21868831d3fbSmrg# ----------------
21878831d3fbSmrg# Minimum version: 1.6.0
21888831d3fbSmrg#
21898831d3fbSmrg# This macro enables a builder to skip all functional specification targets.
21908831d3fbSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21918831d3fbSmrg# maximum flexibilty in controlling documentation building.
21928831d3fbSmrg# Refer to:
21938831d3fbSmrg# XORG_WITH_XMLTO         --with-xmlto
21948831d3fbSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21958831d3fbSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21968831d3fbSmrg# XORG_WITH_FOP           --with-fop
21978831d3fbSmrg# XORG_WITH_GROFF         --with-groff
21988831d3fbSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21998831d3fbSmrg#
22008831d3fbSmrg# Interface to module:
22018831d3fbSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
22028831d3fbSmrg# --enable-specs:	'yes' user instructs the module to generate specs
22038831d3fbSmrg#			'no' user instructs the module not to generate specs
22048831d3fbSmrg# parm1:		specify the default value, yes or no.
22058831d3fbSmrg#
22068831d3fbSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
22078831d3fbSmrgm4_define([spec_default], m4_default([$1], [yes]))
22088831d3fbSmrgAC_ARG_ENABLE(specs,
22098831d3fbSmrg	AS_HELP_STRING([--enable-specs],
22108831d3fbSmrg	   [Enable building the specs (default: ]spec_default[)]),
22118831d3fbSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
22128831d3fbSmrgm4_undefine([spec_default])
22138831d3fbSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
22148831d3fbSmrgAC_MSG_CHECKING([whether to build functional specifications])
22158831d3fbSmrgAC_MSG_RESULT([$build_specs])
22168831d3fbSmrg]) # XORG_ENABLE_SPECS
22178831d3fbSmrg
22188831d3fbSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
22198831d3fbSmrg# ----------------------------------------------
22208831d3fbSmrg# Minimum version: 1.13.0
22218831d3fbSmrg#
22228831d3fbSmrg# This macro enables a builder to enable/disable unit testing
22238831d3fbSmrg# It makes no assumption about the test cases implementation
22248831d3fbSmrg# Test cases may or may not use Automake "Support for test suites"
22258831d3fbSmrg# They may or may not use the software utility library GLib
22268831d3fbSmrg#
22278831d3fbSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
22288831d3fbSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
22298831d3fbSmrg# The variable enable_unit_tests is used by other macros in this file.
22308831d3fbSmrg#
22318831d3fbSmrg# Interface to module:
22328831d3fbSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
22338831d3fbSmrg# enable_unit_tests:    used in configure.ac for additional configuration
22348831d3fbSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
22358831d3fbSmrg#			'no' user instructs the module not to build tests
22368831d3fbSmrg# parm1:		specify the default value, yes or no.
22378831d3fbSmrg#
22388831d3fbSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
22398831d3fbSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
22408831d3fbSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
22418831d3fbSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22428831d3fbSmrgm4_define([_defopt], m4_default([$1], [auto]))
22438831d3fbSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
22448831d3fbSmrg	[Enable building unit test cases (default: ]_defopt[)]),
22458831d3fbSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
22468831d3fbSmrgm4_undefine([_defopt])
22478831d3fbSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
22488831d3fbSmrgAC_MSG_CHECKING([whether to build unit test cases])
22498831d3fbSmrgAC_MSG_RESULT([$enable_unit_tests])
22508831d3fbSmrg]) # XORG_ENABLE_UNIT_TESTS
22518831d3fbSmrg
22528831d3fbSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
22538831d3fbSmrg# ------------------------------------------------------
22548831d3fbSmrg# Minimum version: 1.17.0
22558831d3fbSmrg#
22568831d3fbSmrg# This macro enables a builder to enable/disable integration testing
22578831d3fbSmrg# It makes no assumption about the test cases' implementation
22588831d3fbSmrg# Test cases may or may not use Automake "Support for test suites"
22598831d3fbSmrg#
22608831d3fbSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
22618831d3fbSmrg# usually requires less dependencies and may be built and run under less
22628831d3fbSmrg# stringent environments than integration tests.
22638831d3fbSmrg#
22648831d3fbSmrg# Interface to module:
22658831d3fbSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
22668831d3fbSmrg# enable_integration_tests:   used in configure.ac for additional configuration
22678831d3fbSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
22688831d3fbSmrg#                             'no' user instructs the module not to build tests
22698831d3fbSmrg# parm1:                      specify the default value, yes or no.
22708831d3fbSmrg#
22718831d3fbSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
22728831d3fbSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22738831d3fbSmrgm4_define([_defopt], m4_default([$1], [auto]))
22748831d3fbSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
22758831d3fbSmrg	[Enable building integration test cases (default: ]_defopt[)]),
22768831d3fbSmrg	[enable_integration_tests=$enableval],
22778831d3fbSmrg	[enable_integration_tests=]_defopt)
22788831d3fbSmrgm4_undefine([_defopt])
22798831d3fbSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
22808831d3fbSmrg	[test "x$enable_integration_tests" != xno])
22818831d3fbSmrgAC_MSG_CHECKING([whether to build unit test cases])
22828831d3fbSmrgAC_MSG_RESULT([$enable_integration_tests])
22838831d3fbSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
22848831d3fbSmrg
22858831d3fbSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
22868831d3fbSmrg# ----------------------------------------
22878831d3fbSmrg# Minimum version: 1.13.0
22888831d3fbSmrg#
22898831d3fbSmrg# GLib is a library which provides advanced data structures and functions.
22908831d3fbSmrg# This macro enables a module to test for the presence of Glib.
22918831d3fbSmrg#
22928831d3fbSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
22938831d3fbSmrg# Otherwise the value of $enable_unit_tests is blank.
22948831d3fbSmrg#
22958831d3fbSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
22968831d3fbSmrg# test support usually requires less dependencies and may be built and run under
22978831d3fbSmrg# less stringent environments than integration tests.
22988831d3fbSmrg#
22998831d3fbSmrg# Interface to module:
23008831d3fbSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
23018831d3fbSmrg# with_glib: used in configure.ac to know if GLib has been found
23028831d3fbSmrg# --with-glib:	'yes' user instructs the module to use glib
23038831d3fbSmrg#		'no' user instructs the module not to use glib
23048831d3fbSmrg#
23058831d3fbSmrgAC_DEFUN([XORG_WITH_GLIB],[
23068831d3fbSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
23078831d3fbSmrgm4_define([_defopt], m4_default([$2], [auto]))
23088831d3fbSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
23098831d3fbSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
23108831d3fbSmrg	[with_glib=$withval], [with_glib=]_defopt)
23118831d3fbSmrgm4_undefine([_defopt])
23128831d3fbSmrg
23138831d3fbSmrghave_glib=no
23148831d3fbSmrg# Do not probe GLib if user explicitly disabled unit testing
23158831d3fbSmrgif test "x$enable_unit_tests" != x"no"; then
23168831d3fbSmrg  # Do not probe GLib if user explicitly disabled it
23178831d3fbSmrg  if test "x$with_glib" != x"no"; then
23188831d3fbSmrg    m4_ifval(
23198831d3fbSmrg      [$1],
23208831d3fbSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
23218831d3fbSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
23228831d3fbSmrg    )
23238831d3fbSmrg  fi
23248831d3fbSmrgfi
23258831d3fbSmrg
23268831d3fbSmrg# Not having GLib when unit testing has been explicitly requested is an error
23278831d3fbSmrgif test "x$enable_unit_tests" = x"yes"; then
23288831d3fbSmrg  if test "x$have_glib" = x"no"; then
23298831d3fbSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23308831d3fbSmrg  fi
23318831d3fbSmrgfi
23328831d3fbSmrg
23338831d3fbSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
23348831d3fbSmrgif test "x$enable_unit_tests" = x"no"; then
23358831d3fbSmrg  if test "x$with_glib" = x"yes"; then
23368831d3fbSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23378831d3fbSmrg  fi
23388831d3fbSmrgfi
23398831d3fbSmrg
23408831d3fbSmrg# Not having GLib when it has been explicitly requested is an error
23418831d3fbSmrgif test "x$with_glib" = x"yes"; then
23428831d3fbSmrg  if test "x$have_glib" = x"no"; then
23438831d3fbSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
23448831d3fbSmrg  fi
23458831d3fbSmrgfi
23468831d3fbSmrg
23478831d3fbSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
23488831d3fbSmrg]) # XORG_WITH_GLIB
23498831d3fbSmrg
23508831d3fbSmrg# XORG_LD_WRAP([required|optional])
23518831d3fbSmrg# ---------------------------------
23528831d3fbSmrg# Minimum version: 1.13.0
23538831d3fbSmrg#
23548831d3fbSmrg# Check if linker supports -wrap, passed via compiler flags
23558831d3fbSmrg#
23568831d3fbSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
23578831d3fbSmrg# Otherwise the value of $enable_unit_tests is blank.
23588831d3fbSmrg#
23598831d3fbSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
23608831d3fbSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
23618831d3fbSmrg# available, an argument of "optional" allows use when some unit tests require
23628831d3fbSmrg# ld -wrap and others do not.
23638831d3fbSmrg#
23648831d3fbSmrgAC_DEFUN([XORG_LD_WRAP],[
23658831d3fbSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
23668831d3fbSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
23678831d3fbSmrg                      void __wrap_exit(int status) { return; }],
23688831d3fbSmrg                     [exit(0);])])
23698831d3fbSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
23708831d3fbSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
23718831d3fbSmrg  if test "x$have_ld_wrap" = x"no"; then
23728831d3fbSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
23738831d3fbSmrg  fi
23748831d3fbSmrgfi
23758831d3fbSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
23768831d3fbSmrg#
23778831d3fbSmrg]) # XORG_LD_WRAP
23788831d3fbSmrg
23798831d3fbSmrg# XORG_CHECK_LINKER_FLAGS
23808831d3fbSmrg# -----------------------
23818831d3fbSmrg# SYNOPSIS
23828831d3fbSmrg#
23838831d3fbSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
23848831d3fbSmrg#
23858831d3fbSmrg# DESCRIPTION
23868831d3fbSmrg#
23878831d3fbSmrg#   Check whether the given linker FLAGS work with the current language's
23888831d3fbSmrg#   linker, or whether they give an error.
23898831d3fbSmrg#
23908831d3fbSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
23918831d3fbSmrg#   success/failure.
23928831d3fbSmrg#
23938831d3fbSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
23948831d3fbSmrg#
23958831d3fbSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
23968831d3fbSmrg#
23978831d3fbSmrg# LICENSE
23988831d3fbSmrg#
23998831d3fbSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
24008831d3fbSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
24018831d3fbSmrg#   Copyright (c) 2009 Matteo Frigo
24028831d3fbSmrg#
24038831d3fbSmrg#   This program is free software: you can redistribute it and/or modify it
24048831d3fbSmrg#   under the terms of the GNU General Public License as published by the
24058831d3fbSmrg#   Free Software Foundation, either version 3 of the License, or (at your
24068831d3fbSmrg#   option) any later version.
24078831d3fbSmrg#
24088831d3fbSmrg#   This program is distributed in the hope that it will be useful, but
24098831d3fbSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
24108831d3fbSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
24118831d3fbSmrg#   Public License for more details.
24128831d3fbSmrg#
24138831d3fbSmrg#   You should have received a copy of the GNU General Public License along
24148831d3fbSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
24158831d3fbSmrg#
24168831d3fbSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
24178831d3fbSmrg#   gives unlimited permission to copy, distribute and modify the configure
24188831d3fbSmrg#   scripts that are the output of Autoconf when processing the Macro. You
24198831d3fbSmrg#   need not follow the terms of the GNU General Public License when using
24208831d3fbSmrg#   or distributing such scripts, even though portions of the text of the
24218831d3fbSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
24228831d3fbSmrg#   all other use of the material that constitutes the Autoconf Macro.
24238831d3fbSmrg#
24248831d3fbSmrg#   This special exception to the GPL applies to versions of the Autoconf
24258831d3fbSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
24268831d3fbSmrg#   modified version of the Autoconf Macro, you may extend this special
24278831d3fbSmrg#   exception to the GPL to apply to your modified version as well.#
24288831d3fbSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
24298831d3fbSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
24308831d3fbSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
24318831d3fbSmrgAS_LITERAL_IF([$1],
24328831d3fbSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
24338831d3fbSmrg      ax_save_FLAGS=$LDFLAGS
24348831d3fbSmrg      LDFLAGS="$1"
24358831d3fbSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
24368831d3fbSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24378831d3fbSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24388831d3fbSmrg      LDFLAGS=$ax_save_FLAGS])],
24398831d3fbSmrg  [ax_save_FLAGS=$LDFLAGS
24408831d3fbSmrg   LDFLAGS="$1"
24418831d3fbSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
24428831d3fbSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24438831d3fbSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24448831d3fbSmrg   LDFLAGS=$ax_save_FLAGS])
24458831d3fbSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
24468831d3fbSmrgAC_MSG_RESULT($xorg_check_linker_flags)
24478831d3fbSmrgif test "x$xorg_check_linker_flags" = xyes; then
24488831d3fbSmrg	m4_default([$2], :)
24498831d3fbSmrgelse
24508831d3fbSmrg	m4_default([$3], :)
24518831d3fbSmrgfi
24528831d3fbSmrg]) # XORG_CHECK_LINKER_FLAGS
24538831d3fbSmrg
24548831d3fbSmrg# XORG_MEMORY_CHECK_FLAGS
24558831d3fbSmrg# -----------------------
24568831d3fbSmrg# Minimum version: 1.16.0
24578831d3fbSmrg#
24588831d3fbSmrg# This macro attempts to find appropriate memory checking functionality
24598831d3fbSmrg# for various platforms which unit testing code may use to catch various
24608831d3fbSmrg# forms of memory allocation and access errors in testing.
24618831d3fbSmrg#
24628831d3fbSmrg# Interface to module:
24638831d3fbSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
24648831d3fbSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
24658831d3fbSmrg#
24668831d3fbSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
24678831d3fbSmrg#
24688831d3fbSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
24698831d3fbSmrg
24708831d3fbSmrgAC_REQUIRE([AC_CANONICAL_HOST])
24718831d3fbSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
24728831d3fbSmrg           [Environment variables to enable memory checking in tests])
24738831d3fbSmrg
24748831d3fbSmrg# Check for different types of support on different platforms
24758831d3fbSmrgcase $host_os in
24768831d3fbSmrg    solaris*)
24778831d3fbSmrg        AC_CHECK_LIB([umem], [umem_alloc],
24788831d3fbSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
24798831d3fbSmrg        ;;
24808831d3fbSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
24818831d3fbSmrg        # both directly and inverted, so should not be 0 or 255.
24828831d3fbSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
24838831d3fbSmrg        ;;
24848831d3fbSmrg    darwin*)
24858831d3fbSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
24868831d3fbSmrg        ;;
24878831d3fbSmrg    *bsd*)
24888831d3fbSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
24898831d3fbSmrg        ;;
24908831d3fbSmrgesac
24918831d3fbSmrg
24928831d3fbSmrg# User supplied flags override default flags
24938831d3fbSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
24948831d3fbSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
24958831d3fbSmrgfi
24968831d3fbSmrg
24978831d3fbSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
24988831d3fbSmrg]) # XORG_WITH_LINT
24998831d3fbSmrg
25008831d3fbSmrg# XORG_CHECK_MALLOC_ZERO
25018831d3fbSmrg# ----------------------
25028831d3fbSmrg# Minimum version: 1.0.0
25038831d3fbSmrg#
25048831d3fbSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
25058831d3fbSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
25068831d3fbSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
25078831d3fbSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
25088831d3fbSmrgAC_ARG_ENABLE(malloc0returnsnull,
25098831d3fbSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
25108831d3fbSmrg		       [malloc(0) returns NULL (default: auto)]),
25118831d3fbSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
25128831d3fbSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
25138831d3fbSmrg
25148831d3fbSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
25158831d3fbSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
25168831d3fbSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
25178831d3fbSmrg#include <stdlib.h>
25188831d3fbSmrg],[
2519100ae103Smrg    char *m0, *r0, *c0, *p;
2520100ae103Smrg    m0 = malloc(0);
2521100ae103Smrg    p = malloc(10);
2522100ae103Smrg    r0 = realloc(p,0);
25238831d3fbSmrg    c0 = calloc(0,10);
25248831d3fbSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
25258831d3fbSmrg])],
2526100ae103Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2527165cb819Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2528165cb819Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2529100ae103Smrgfi
2530100ae103SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2531100ae103Smrg
2532100ae103Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2533100ae103Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2534100ae103Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2535100ae103Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2536100ae103Smrgelse
2537100ae103Smrg	MALLOC_ZERO_CFLAGS=""
2538100ae103Smrg	XMALLOC_ZERO_CFLAGS=""
2539100ae103Smrg	XTMALLOC_ZERO_CFLAGS=""
2540100ae103Smrgfi
2541100ae103Smrg
2542100ae103SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2543100ae103SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2544100ae103SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2545100ae103Smrg]) # XORG_CHECK_MALLOC_ZERO
2546100ae103Smrg
2547100ae103Smrg# XORG_WITH_LINT()
2548100ae103Smrg# ----------------
2549100ae103Smrg# Minimum version: 1.1.0
2550100ae103Smrg#
25518831d3fbSmrg# This macro enables the use of a tool that flags some suspicious and
25528831d3fbSmrg# non-portable constructs (likely to be bugs) in C language source code.
25538831d3fbSmrg# It will attempt to locate the tool and use appropriate options.
25548831d3fbSmrg# There are various lint type tools on different platforms.
25558831d3fbSmrg#
25568831d3fbSmrg# Interface to module:
25578831d3fbSmrg# LINT:		returns the path to the tool found on the platform
25588831d3fbSmrg#		or the value set to LINT on the configure cmd line
25598831d3fbSmrg#		also an Automake conditional
25608831d3fbSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
25618831d3fbSmrg#
25628831d3fbSmrg# --with-lint:	'yes' user instructs the module to use lint
25638831d3fbSmrg#		'no' user instructs the module not to use lint (default)
25648831d3fbSmrg#
25658831d3fbSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
25668831d3fbSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2567100ae103Smrg#
2568100ae103SmrgAC_DEFUN([XORG_WITH_LINT],[
2569100ae103Smrg
25708831d3fbSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
25718831d3fbSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2572165cb819SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2573100ae103Smrg		[Use a lint-style source code checker (default: disabled)])],
2574100ae103Smrg		[use_lint=$withval], [use_lint=no])
25758831d3fbSmrg
25768831d3fbSmrg# Obtain platform specific info like program name and options
25778831d3fbSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
25788831d3fbSmrgcase $host_os in
25798831d3fbSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
25808831d3fbSmrg	lint_name=splint
25818831d3fbSmrg	lint_options="-badflag"
25828831d3fbSmrg	;;
25838831d3fbSmrg  *freebsd* | *netbsd*)
25848831d3fbSmrg	lint_name=lint
25858831d3fbSmrg	lint_options="-u -b"
25868831d3fbSmrg	;;
25878831d3fbSmrg  *solaris*)
25888831d3fbSmrg	lint_name=lint
25898831d3fbSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
25908831d3fbSmrg	;;
25918831d3fbSmrgesac
25928831d3fbSmrg
25938831d3fbSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
25948831d3fbSmrgif test "x$use_lint" = x"yes" ; then
25958831d3fbSmrg   AC_PATH_PROG([LINT], [$lint_name])
25968831d3fbSmrg   if test "x$LINT" = "x"; then
25978831d3fbSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
25988831d3fbSmrg   fi
25998831d3fbSmrgelif test "x$use_lint" = x"no" ; then
26008831d3fbSmrg   if test "x$LINT" != "x"; then
26018831d3fbSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
26028831d3fbSmrg   fi
2603100ae103Smrgelse
26048831d3fbSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2605100ae103Smrgfi
26068831d3fbSmrg
26078831d3fbSmrg# User supplied flags override default flags
26088831d3fbSmrgif test "x$LINT_FLAGS" != "x"; then
26098831d3fbSmrg   lint_options=$LINT_FLAGS
2610100ae103Smrgfi
2611100ae103Smrg
26128831d3fbSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
26138831d3fbSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2614100ae103Smrg
2615100ae103Smrg]) # XORG_WITH_LINT
2616100ae103Smrg
2617100ae103Smrg# XORG_LINT_LIBRARY(LIBNAME)
2618100ae103Smrg# --------------------------
2619100ae103Smrg# Minimum version: 1.1.0
2620100ae103Smrg#
2621100ae103Smrg# Sets up flags for building lint libraries for checking programs that call
2622100ae103Smrg# functions in the library.
2623100ae103Smrg#
26248831d3fbSmrg# Interface to module:
26258831d3fbSmrg# LINTLIB		- Automake variable with the name of lint library file to make
26268831d3fbSmrg# MAKE_LINT_LIB		- Automake conditional
26278831d3fbSmrg#
26288831d3fbSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
26298831d3fbSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2630100ae103Smrg
2631100ae103SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2632100ae103SmrgAC_REQUIRE([XORG_WITH_LINT])
2633165cb819SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2634100ae103Smrg	[Create lint library (default: disabled)])],
2635100ae103Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
26368831d3fbSmrg
26378831d3fbSmrgif test "x$make_lint_lib" = x"yes" ; then
26388831d3fbSmrg   LINTLIB=llib-l$1.ln
26398831d3fbSmrg   if test "x$LINT" = "x"; then
26408831d3fbSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
26418831d3fbSmrg   fi
26428831d3fbSmrgelif test "x$make_lint_lib" != x"no" ; then
26438831d3fbSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2644100ae103Smrgfi
26458831d3fbSmrg
2646100ae103SmrgAC_SUBST(LINTLIB)
2647100ae103SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2648100ae103Smrg
2649100ae103Smrg]) # XORG_LINT_LIBRARY
2650100ae103Smrg
26518831d3fbSmrg# XORG_COMPILER_BRAND
26528831d3fbSmrg# -------------------
26538831d3fbSmrg# Minimum version: 1.14.0
26548831d3fbSmrg#
26558831d3fbSmrg# Checks for various brands of compilers and sets flags as appropriate:
26568831d3fbSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
26578831d3fbSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
26588831d3fbSmrg#   clang compiler - sets CLANGCC to "yes"
26598831d3fbSmrg#   Intel compiler - sets INTELCC to "yes"
26608831d3fbSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
26618831d3fbSmrg#
26628831d3fbSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
26638831d3fbSmrgAC_LANG_CASE(
26648831d3fbSmrg	[C], [
26658831d3fbSmrg		AC_REQUIRE([AC_PROG_CC_C99])
26668831d3fbSmrg	],
26678831d3fbSmrg	[C++], [
26688831d3fbSmrg		AC_REQUIRE([AC_PROG_CXX])
26698831d3fbSmrg	]
26708831d3fbSmrg)
26718831d3fbSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
26728831d3fbSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
26738831d3fbSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
26748831d3fbSmrg]) # XORG_COMPILER_BRAND
26758831d3fbSmrg
26768831d3fbSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
26778831d3fbSmrg# ---------------
26788831d3fbSmrg# Minimum version: 1.16.0
26798831d3fbSmrg#
26808831d3fbSmrg# Test if the compiler works when passed the given flag as a command line argument.
26818831d3fbSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
26828831d3fbSmrg# next flag in the list until there are no more options.
26838831d3fbSmrg#
26848831d3fbSmrg# Note that this does not guarantee that the compiler supports the flag as some
26858831d3fbSmrg# compilers will simply ignore arguments that they do not understand, but we do
26868831d3fbSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
26878831d3fbSmrg# -Werror=unused-command-line-argument
26888831d3fbSmrg#
26898831d3fbSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
26908831d3fbSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26918831d3fbSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26928831d3fbSmrg
26938831d3fbSmrgAC_LANG_COMPILER_REQUIRE
26948831d3fbSmrg
26958831d3fbSmrgAC_LANG_CASE(
26968831d3fbSmrg	[C], [
26978831d3fbSmrg		AC_REQUIRE([AC_PROG_CC_C99])
26988831d3fbSmrg		define([PREFIX], [C])
26998831d3fbSmrg		define([CACHE_PREFIX], [cc])
27008831d3fbSmrg		define([COMPILER], [$CC])
27018831d3fbSmrg	],
27028831d3fbSmrg	[C++], [
27038831d3fbSmrg		define([PREFIX], [CXX])
27048831d3fbSmrg		define([CACHE_PREFIX], [cxx])
27058831d3fbSmrg		define([COMPILER], [$CXX])
27068831d3fbSmrg	]
27078831d3fbSmrg)
27088831d3fbSmrg
27098831d3fbSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
27108831d3fbSmrg
27118831d3fbSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
27128831d3fbSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27138831d3fbSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
27148831d3fbSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
27158831d3fbSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27168831d3fbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
27178831d3fbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
27188831d3fbSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
27198831d3fbSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27208831d3fbSmrgfi
27218831d3fbSmrg
27228831d3fbSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
27238831d3fbSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
27248831d3fbSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27258831d3fbSmrg	fi
27268831d3fbSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27278831d3fbSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
27288831d3fbSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
27298831d3fbSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27308831d3fbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
27318831d3fbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
27328831d3fbSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
27338831d3fbSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27348831d3fbSmrgfi
27358831d3fbSmrg
27368831d3fbSmrgfound="no"
27378831d3fbSmrgm4_foreach([flag], m4_cdr($@), [
27388831d3fbSmrg	if test $found = "no" ; then
27398831d3fbSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
27408831d3fbSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27418831d3fbSmrg		fi
27428831d3fbSmrg
27438831d3fbSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
27448831d3fbSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27458831d3fbSmrg		fi
27468831d3fbSmrg
27478831d3fbSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
27488831d3fbSmrg
27498831d3fbSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
27508831d3fbSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
27518831d3fbSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
27528831d3fbSmrg		AC_CACHE_VAL($cacheid,
27538831d3fbSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
27548831d3fbSmrg					     [eval $cacheid=yes],
27558831d3fbSmrg					     [eval $cacheid=no])])
27568831d3fbSmrg
27578831d3fbSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27588831d3fbSmrg
27598831d3fbSmrg		eval supported=\$$cacheid
27608831d3fbSmrg		AC_MSG_RESULT([$supported])
27618831d3fbSmrg		if test "$supported" = "yes" ; then
27628831d3fbSmrg			$1="$$1 ]flag["
27638831d3fbSmrg			found="yes"
27648831d3fbSmrg		fi
27658831d3fbSmrg	fi
27668831d3fbSmrg])
27678831d3fbSmrg]) # XORG_TESTSET_CFLAG
27688831d3fbSmrg
27698831d3fbSmrg# XORG_COMPILER_FLAGS
27708831d3fbSmrg# ---------------
27718831d3fbSmrg# Minimum version: 1.16.0
27728831d3fbSmrg#
27738831d3fbSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
27748831d3fbSmrg# arguments supported by the selected compiler which do NOT alter the generated
27758831d3fbSmrg# code.  These arguments will cause the compiler to print various warnings
27768831d3fbSmrg# during compilation AND turn a conservative set of warnings into errors.
27778831d3fbSmrg#
27788831d3fbSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
27798831d3fbSmrg# future versions of util-macros as options are added to new compilers.
27808831d3fbSmrg#
27818831d3fbSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
27828831d3fbSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
27838831d3fbSmrg
27848831d3fbSmrgAC_ARG_ENABLE(selective-werror,
27858831d3fbSmrg              AS_HELP_STRING([--disable-selective-werror],
27868831d3fbSmrg                             [Turn off selective compiler errors. (default: enabled)]),
27878831d3fbSmrg              [SELECTIVE_WERROR=$enableval],
27888831d3fbSmrg              [SELECTIVE_WERROR=yes])
27898831d3fbSmrg
27908831d3fbSmrgAC_LANG_CASE(
27918831d3fbSmrg        [C], [
27928831d3fbSmrg                define([PREFIX], [C])
27938831d3fbSmrg        ],
27948831d3fbSmrg        [C++], [
27958831d3fbSmrg                define([PREFIX], [CXX])
27968831d3fbSmrg        ]
27978831d3fbSmrg)
27988831d3fbSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
27998831d3fbSmrgif test "x$SUNCC" = "xyes"; then
28008831d3fbSmrg    [BASE_]PREFIX[FLAGS]="-v"
28018831d3fbSmrgelse
28028831d3fbSmrg    [BASE_]PREFIX[FLAGS]=""
28038831d3fbSmrgfi
28048831d3fbSmrg
28058831d3fbSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
28068831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
28078831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
28088831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
28098831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
28108831d3fbSmrg
28118831d3fbSmrgAC_LANG_CASE(
28128831d3fbSmrg	[C], [
28138831d3fbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
28148831d3fbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
28158831d3fbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
28168831d3fbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
28178831d3fbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
28188831d3fbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
28198831d3fbSmrg	]
28208831d3fbSmrg)
28218831d3fbSmrg
28228831d3fbSmrg# This chunk adds additional warnings that could catch undesired effects.
28238831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
28248831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
28258831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
28268831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
28278831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
28288831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
28298831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
28308831d3fbSmrg
28318831d3fbSmrg# These are currently disabled because they are noisy.  They will be enabled
28328831d3fbSmrg# in the future once the codebase is sufficiently modernized to silence
28338831d3fbSmrg# them.  For now, I don't want them to drown out the other warnings.
28348831d3fbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
28358831d3fbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
28368831d3fbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
28378831d3fbSmrg
28388831d3fbSmrg# Turn some warnings into errors, so we don't accidently get successful builds
28398831d3fbSmrg# when there are problems that should be fixed.
28408831d3fbSmrg
28418831d3fbSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
28428831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
28438831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
28448831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
28458831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
28468831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
28478831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
28488831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
28498831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
28508831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
28518831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
28528831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
28538831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
28548831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
28558831d3fbSmrgelse
28568831d3fbSmrgAC_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])
28578831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
28588831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
28598831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
28608831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
28618831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
28628831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
28638831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
28648831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
28658831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
28668831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
28678831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
28688831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
28698831d3fbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
28708831d3fbSmrgfi
28718831d3fbSmrg
28728831d3fbSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
28738831d3fbSmrg]) # XORG_COMPILER_FLAGS
28748831d3fbSmrg
2875165cb819Smrg# XORG_CWARNFLAGS
2876165cb819Smrg# ---------------
2877165cb819Smrg# Minimum version: 1.2.0
28788831d3fbSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2879165cb819Smrg#
2880165cb819Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2881165cb819Smrg#
28828831d3fbSmrg# This function is deprecated because it defines -fno-strict-aliasing
28838831d3fbSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
28848831d3fbSmrg# is needed, then it should be added explicitly in the module when
28858831d3fbSmrg# it is updated to use BASE_CFLAGS.
28868831d3fbSmrg#
2887165cb819SmrgAC_DEFUN([XORG_CWARNFLAGS], [
28888831d3fbSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
28898831d3fbSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
28908831d3fbSmrgAC_LANG_CASE(
28918831d3fbSmrg	[C], [
28928831d3fbSmrg		CWARNFLAGS="$BASE_CFLAGS"
28938831d3fbSmrg		if  test "x$GCC" = xyes ; then
28948831d3fbSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
28958831d3fbSmrg		fi
28968831d3fbSmrg		AC_SUBST(CWARNFLAGS)
28978831d3fbSmrg	]
28988831d3fbSmrg)
2899165cb819Smrg]) # XORG_CWARNFLAGS
2900165cb819Smrg
2901165cb819Smrg# XORG_STRICT_OPTION
2902165cb819Smrg# -----------------------
2903165cb819Smrg# Minimum version: 1.3.0
2904165cb819Smrg#
29058831d3fbSmrg# Add configure option to enable strict compilation flags, such as treating
29068831d3fbSmrg# warnings as fatal errors.
29078831d3fbSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
29088831d3fbSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
29098831d3fbSmrg#
29108831d3fbSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
29118831d3fbSmrg# when strict compilation is unconditionally desired.
2912165cb819SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2913165cb819SmrgAC_REQUIRE([XORG_CWARNFLAGS])
29148831d3fbSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2915165cb819Smrg
2916165cb819SmrgAC_ARG_ENABLE(strict-compilation,
2917165cb819Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2918165cb819Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2919165cb819Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
29208831d3fbSmrg
29218831d3fbSmrgAC_LANG_CASE(
29228831d3fbSmrg        [C], [
29238831d3fbSmrg                define([PREFIX], [C])
29248831d3fbSmrg        ],
29258831d3fbSmrg        [C++], [
29268831d3fbSmrg                define([PREFIX], [CXX])
29278831d3fbSmrg        ]
29288831d3fbSmrg)
29298831d3fbSmrg
29308831d3fbSmrg[STRICT_]PREFIX[FLAGS]=""
29318831d3fbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
29328831d3fbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
29338831d3fbSmrg
29348831d3fbSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
29358831d3fbSmrg# activate it with -Werror, so we add it here explicitly.
29368831d3fbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
29378831d3fbSmrg
2938165cb819Smrgif test "x$STRICT_COMPILE" = "xyes"; then
29398831d3fbSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
29408831d3fbSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2941165cb819Smrgfi
29428831d3fbSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
29438831d3fbSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
29448831d3fbSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2945165cb819Smrg]) # XORG_STRICT_OPTION
2946165cb819Smrg
2947165cb819Smrg# XORG_DEFAULT_OPTIONS
2948165cb819Smrg# --------------------
2949165cb819Smrg# Minimum version: 1.3.0
2950165cb819Smrg#
2951165cb819Smrg# Defines default options for X.Org modules.
2952165cb819Smrg#
2953165cb819SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
29548831d3fbSmrgAC_REQUIRE([AC_PROG_INSTALL])
29558831d3fbSmrgXORG_COMPILER_FLAGS
2956165cb819SmrgXORG_CWARNFLAGS
2957165cb819SmrgXORG_STRICT_OPTION
2958165cb819SmrgXORG_RELEASE_VERSION
2959165cb819SmrgXORG_CHANGELOG
2960165cb819SmrgXORG_INSTALL
2961165cb819SmrgXORG_MANPAGE_SECTIONS
29628831d3fbSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
29638831d3fbSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2964165cb819Smrg]) # XORG_DEFAULT_OPTIONS
2965165cb819Smrg
2966165cb819Smrg# XORG_INSTALL()
2967165cb819Smrg# ----------------
2968165cb819Smrg# Minimum version: 1.4.0
2969165cb819Smrg#
2970165cb819Smrg# Defines the variable INSTALL_CMD as the command to copy
2971165cb819Smrg# INSTALL from $prefix/share/util-macros.
2972165cb819Smrg#
2973165cb819SmrgAC_DEFUN([XORG_INSTALL], [
2974165cb819SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2975165cb819Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2976165cb819SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2977165cb819Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2978165cb819Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2979165cb819Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2980165cb819SmrgAC_SUBST([INSTALL_CMD])
2981165cb819Smrg]) # XORG_INSTALL
2982100ae103Smrgdnl Copyright 2005 Red Hat, Inc
2983100ae103Smrgdnl
2984100ae103Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2985100ae103Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2986100ae103Smrgdnl the above copyright notice appear in all copies and that both that
2987100ae103Smrgdnl copyright notice and this permission notice appear in supporting
2988100ae103Smrgdnl documentation.
2989100ae103Smrgdnl
2990100ae103Smrgdnl The above copyright notice and this permission notice shall be included
2991100ae103Smrgdnl in all copies or substantial portions of the Software.
2992100ae103Smrgdnl
2993100ae103Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2994100ae103Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2995100ae103Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2996100ae103Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2997100ae103Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2998100ae103Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2999100ae103Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3000100ae103Smrgdnl
3001100ae103Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3002100ae103Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3003100ae103Smrgdnl other dealings in this Software without prior written authorization
3004100ae103Smrgdnl from the copyright holders.
3005100ae103Smrgdnl
3006100ae103Smrg
3007100ae103Smrg# XORG_RELEASE_VERSION
3008100ae103Smrg# --------------------
30098831d3fbSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3010100ae103Smrg 
3011100ae103SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3012100ae103Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3013100ae103Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3014100ae103Smrg		[Major version of this package])
3015165cb819Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3016100ae103Smrg	if test "x$PVM" = "x"; then
3017100ae103Smrg		PVM="0"
3018100ae103Smrg	fi
3019100ae103Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3020100ae103Smrg		[$PVM],
3021100ae103Smrg		[Minor version of this package])
3022165cb819Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3023100ae103Smrg	if test "x$PVP" = "x"; then
3024100ae103Smrg		PVP="0"
3025100ae103Smrg	fi
3026100ae103Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3027100ae103Smrg		[$PVP],
3028100ae103Smrg		[Patch version of this package])
3029100ae103Smrg])
3030100ae103Smrg
3031165cb819Smrg# XORG_CHANGELOG()
3032165cb819Smrg# ----------------
3033165cb819Smrg# Minimum version: 1.2.0
3034165cb819Smrg#
3035165cb819Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3036165cb819Smrg# ChangeLog from git.
3037165cb819Smrg#
3038165cb819Smrg#
3039165cb819SmrgAC_DEFUN([XORG_CHANGELOG], [
3040165cb819SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3041165cb819Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3042165cb819Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3043165cb819Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3044165cb819SmrgAC_SUBST([CHANGELOG_CMD])
3045165cb819Smrg]) # XORG_CHANGELOG
3046165cb819Smrg
3047