aclocal.m4 revision c3d5982a
1c3d5982aSmrg# generated automatically by aclocal 1.13.2 -*- Autoconf -*-
2c3d5982aSmrg
3c3d5982aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
47da8b7e3Smrg
57da8b7e3Smrg# This file is free software; the Free Software Foundation
67da8b7e3Smrg# gives unlimited permission to copy and/or distribute it,
77da8b7e3Smrg# with or without modifications, as long as this notice is preserved.
87da8b7e3Smrg
97da8b7e3Smrg# This program is distributed in the hope that it will be useful,
107da8b7e3Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117da8b7e3Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127da8b7e3Smrg# PARTICULAR PURPOSE.
137da8b7e3Smrg
14c3d5982aSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15123e2cc7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16123e2cc7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17bded5d25Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18bded5d25Smrg[m4_warning([this file was generated for autoconf 2.68.
19123e2cc7SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20123e2cc7SmrgIf you have problems, you may need to regenerate the build system entirely.
21c3d5982aSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227da8b7e3Smrg
23c3d5982aSmrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
247da8b7e3Smrg#
25123e2cc7Smrg# This file is free software; the Free Software Foundation
26123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
27123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
287da8b7e3Smrg
29123e2cc7Smrg# AM_AUTOMAKE_VERSION(VERSION)
30123e2cc7Smrg# ----------------------------
31123e2cc7Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32123e2cc7Smrg# generated from the m4 files accompanying Automake X.Y.
33123e2cc7Smrg# (This private macro should not be called outside this file.)
34123e2cc7SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35c3d5982aSmrg[am__api_version='1.13'
36123e2cc7Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37123e2cc7Smrgdnl require some minimum version.  Point them to the right macro.
38c3d5982aSmrgm4_if([$1], [1.13.2], [],
39123e2cc7Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40123e2cc7Smrg])
417da8b7e3Smrg
42123e2cc7Smrg# _AM_AUTOCONF_VERSION(VERSION)
437da8b7e3Smrg# -----------------------------
44123e2cc7Smrg# aclocal traces this macro to find the Autoconf version.
45123e2cc7Smrg# This is a private macro too.  Using m4_define simplifies
46123e2cc7Smrg# the logic in aclocal, which can simply ignore this definition.
47123e2cc7Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48123e2cc7Smrg
49123e2cc7Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50123e2cc7Smrg# -------------------------------
51123e2cc7Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52123e2cc7Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53123e2cc7SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54c3d5982aSmrg[AM_AUTOMAKE_VERSION([1.13.2])dnl
55123e2cc7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56123e2cc7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57123e2cc7Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
587da8b7e3Smrg
59123e2cc7Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
607da8b7e3Smrg
61c3d5982aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
62123e2cc7Smrg#
63123e2cc7Smrg# This file is free software; the Free Software Foundation
64123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
65123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
66123e2cc7Smrg
67123e2cc7Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68c3d5982aSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69c3d5982aSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
707da8b7e3Smrg#
71123e2cc7Smrg# Of course, Automake must honor this variable whenever it calls a
72123e2cc7Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73123e2cc7Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74123e2cc7Smrg# depending on how configure is run.  This is pretty annoying, since
75123e2cc7Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76123e2cc7Smrg# source directory, any form will work fine, but in subdirectories a
77123e2cc7Smrg# relative path needs to be adjusted first.
787da8b7e3Smrg#
79123e2cc7Smrg# $ac_aux_dir/missing
80123e2cc7Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81123e2cc7Smrg# $top_srcdir/$ac_aux_dir/missing
82123e2cc7Smrg#    fails if $ac_aux_dir is absolute,
83123e2cc7Smrg#    fails when called from a subdirectory in a VPATH build with
84123e2cc7Smrg#          a relative $ac_aux_dir
857da8b7e3Smrg#
86123e2cc7Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87123e2cc7Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88c3d5982aSmrg# harmless because $srcdir is '.', but things will broke when you
89123e2cc7Smrg# start a VPATH build or use an absolute $srcdir.
907da8b7e3Smrg#
91123e2cc7Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92123e2cc7Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93123e2cc7Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94123e2cc7Smrg# and then we would define $MISSING as
95123e2cc7Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96123e2cc7Smrg# This will work as long as MISSING is not called from configure, because
97123e2cc7Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98123e2cc7Smrg# However there are other variables, like CC, which are often used in
99123e2cc7Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100123e2cc7Smrg#
101123e2cc7Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102123e2cc7Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103123e2cc7Smrg# configured tree to be moved without reconfiguration.
1047da8b7e3Smrg
105123e2cc7SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106123e2cc7Smrg[dnl Rely on autoconf to set up CDPATH properly.
107123e2cc7SmrgAC_PREREQ([2.50])dnl
108123e2cc7Smrg# expand $ac_aux_dir to an absolute path
109123e2cc7Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
110123e2cc7Smrg])
1117da8b7e3Smrg
112123e2cc7Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1137da8b7e3Smrg
114c3d5982aSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
115123e2cc7Smrg#
116123e2cc7Smrg# This file is free software; the Free Software Foundation
117123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
118123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
1197da8b7e3Smrg
120123e2cc7Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
121123e2cc7Smrg# -------------------------------------
122123e2cc7Smrg# Define a conditional.
123123e2cc7SmrgAC_DEFUN([AM_CONDITIONAL],
124c3d5982aSmrg[AC_PREREQ([2.52])dnl
125c3d5982aSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
126c3d5982aSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
127123e2cc7SmrgAC_SUBST([$1_TRUE])dnl
128123e2cc7SmrgAC_SUBST([$1_FALSE])dnl
129123e2cc7Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
130123e2cc7Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
131123e2cc7Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
132123e2cc7Smrgif $2; then
133123e2cc7Smrg  $1_TRUE=
134123e2cc7Smrg  $1_FALSE='#'
135123e2cc7Smrgelse
136123e2cc7Smrg  $1_TRUE='#'
137123e2cc7Smrg  $1_FALSE=
138123e2cc7Smrgfi
139123e2cc7SmrgAC_CONFIG_COMMANDS_PRE(
140123e2cc7Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
141123e2cc7Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
142123e2cc7SmrgUsually this means the macro was only invoked conditionally.]])
143123e2cc7Smrgfi])])
1447da8b7e3Smrg
145c3d5982aSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
146123e2cc7Smrg#
147123e2cc7Smrg# This file is free software; the Free Software Foundation
148123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
149123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
1507da8b7e3Smrg
1517da8b7e3Smrg
152c3d5982aSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
153123e2cc7Smrg# written in clear, in which case automake, when reading aclocal.m4,
154123e2cc7Smrg# will think it sees a *use*, and therefore will trigger all it's
155123e2cc7Smrg# C support machinery.  Also note that it means that autoscan, seeing
156123e2cc7Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1577da8b7e3Smrg
1587da8b7e3Smrg
159123e2cc7Smrg# _AM_DEPENDENCIES(NAME)
160123e2cc7Smrg# ----------------------
161123e2cc7Smrg# See how the compiler implements dependency checking.
162c3d5982aSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
163123e2cc7Smrg# We try a few techniques and use that to set a single cache variable.
164123e2cc7Smrg#
165123e2cc7Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
166123e2cc7Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
167123e2cc7Smrg# dependency, and given that the user is not expected to run this macro,
168123e2cc7Smrg# just rely on AC_PROG_CC.
169123e2cc7SmrgAC_DEFUN([_AM_DEPENDENCIES],
170123e2cc7Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
171123e2cc7SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
172123e2cc7SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
173123e2cc7SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1747da8b7e3Smrg
175c3d5982aSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
176c3d5982aSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
177c3d5982aSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
178c3d5982aSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
179c3d5982aSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
180c3d5982aSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
181c3d5982aSmrg                    [depcc="$$1"   am_compiler_list=])
1827da8b7e3Smrg
183123e2cc7SmrgAC_CACHE_CHECK([dependency style of $depcc],
184123e2cc7Smrg               [am_cv_$1_dependencies_compiler_type],
185123e2cc7Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
186123e2cc7Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
187123e2cc7Smrg  # making bogus files that we don't know about and never remove.  For
188123e2cc7Smrg  # instance it was reported that on HP-UX the gcc test will end up
189c3d5982aSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
190c3d5982aSmrg  # in D".
191c3d5982aSmrg  rm -rf conftest.dir
192123e2cc7Smrg  mkdir conftest.dir
193123e2cc7Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
194123e2cc7Smrg  # using a relative directory.
195123e2cc7Smrg  cp "$am_depcomp" conftest.dir
196123e2cc7Smrg  cd conftest.dir
197123e2cc7Smrg  # We will build objects and dependencies in a subdirectory because
198123e2cc7Smrg  # it helps to detect inapplicable dependency modes.  For instance
199123e2cc7Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
200123e2cc7Smrg  # side effect of compilation, but ICC will put the dependencies in
201123e2cc7Smrg  # the current directory while Tru64 will put them in the object
202123e2cc7Smrg  # directory.
203123e2cc7Smrg  mkdir sub
2047da8b7e3Smrg
205123e2cc7Smrg  am_cv_$1_dependencies_compiler_type=none
206123e2cc7Smrg  if test "$am_compiler_list" = ""; then
207123e2cc7Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
208123e2cc7Smrg  fi
209123e2cc7Smrg  am__universal=false
210123e2cc7Smrg  m4_case([$1], [CC],
211123e2cc7Smrg    [case " $depcc " in #(
212123e2cc7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
213123e2cc7Smrg     esac],
214123e2cc7Smrg    [CXX],
215123e2cc7Smrg    [case " $depcc " in #(
216123e2cc7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
217123e2cc7Smrg     esac])
2187da8b7e3Smrg
219123e2cc7Smrg  for depmode in $am_compiler_list; do
220123e2cc7Smrg    # Setup a source with many dependencies, because some compilers
221123e2cc7Smrg    # like to wrap large dependency lists on column 80 (with \), and
222123e2cc7Smrg    # we should not choose a depcomp mode which is confused by this.
223123e2cc7Smrg    #
224123e2cc7Smrg    # We need to recreate these files for each test, as the compiler may
225123e2cc7Smrg    # overwrite some of them when testing with obscure command lines.
226123e2cc7Smrg    # This happens at least with the AIX C compiler.
227123e2cc7Smrg    : > sub/conftest.c
228123e2cc7Smrg    for i in 1 2 3 4 5 6; do
229123e2cc7Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
230c3d5982aSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
231c3d5982aSmrg      # Solaris 10 /bin/sh.
232c3d5982aSmrg      echo '/* dummy */' > sub/conftst$i.h
233123e2cc7Smrg    done
234123e2cc7Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235123e2cc7Smrg
236c3d5982aSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
237123e2cc7Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
238c3d5982aSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
239c3d5982aSmrg    # versions had trouble with output in subdirs.
240123e2cc7Smrg    am__obj=sub/conftest.${OBJEXT-o}
241123e2cc7Smrg    am__minus_obj="-o $am__obj"
242123e2cc7Smrg    case $depmode in
243123e2cc7Smrg    gcc)
244123e2cc7Smrg      # This depmode causes a compiler race in universal mode.
245123e2cc7Smrg      test "$am__universal" = false || continue
246123e2cc7Smrg      ;;
247123e2cc7Smrg    nosideeffect)
248c3d5982aSmrg      # After this tag, mechanisms are not by side-effect, so they'll
249c3d5982aSmrg      # only be used when explicitly requested.
250123e2cc7Smrg      if test "x$enable_dependency_tracking" = xyes; then
251123e2cc7Smrg	continue
252123e2cc7Smrg      else
253123e2cc7Smrg	break
254123e2cc7Smrg      fi
255123e2cc7Smrg      ;;
256c3d5982aSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
257c3d5982aSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
258123e2cc7Smrg      # not run yet.  These depmodes are late enough in the game, and
259123e2cc7Smrg      # so weak that their functioning should not be impacted.
260123e2cc7Smrg      am__obj=conftest.${OBJEXT-o}
261123e2cc7Smrg      am__minus_obj=
262123e2cc7Smrg      ;;
263123e2cc7Smrg    none) break ;;
264123e2cc7Smrg    esac
265123e2cc7Smrg    if depmode=$depmode \
266123e2cc7Smrg       source=sub/conftest.c object=$am__obj \
267123e2cc7Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
268123e2cc7Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
269123e2cc7Smrg         >/dev/null 2>conftest.err &&
270123e2cc7Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
271123e2cc7Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
272123e2cc7Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
273123e2cc7Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
274123e2cc7Smrg      # icc doesn't choke on unknown options, it will just issue warnings
275123e2cc7Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
276123e2cc7Smrg      # that says an option was ignored or not supported.
277123e2cc7Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
278123e2cc7Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
279123e2cc7Smrg      # The diagnosis changed in icc 8.0:
280123e2cc7Smrg      #   icc: Command line remark: option '-MP' not supported
281123e2cc7Smrg      if (grep 'ignoring option' conftest.err ||
282123e2cc7Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
283123e2cc7Smrg        am_cv_$1_dependencies_compiler_type=$depmode
284123e2cc7Smrg        break
285123e2cc7Smrg      fi
286123e2cc7Smrg    fi
287123e2cc7Smrg  done
288123e2cc7Smrg
289123e2cc7Smrg  cd ..
290123e2cc7Smrg  rm -rf conftest.dir
2917da8b7e3Smrgelse
292123e2cc7Smrg  am_cv_$1_dependencies_compiler_type=none
2937da8b7e3Smrgfi
294123e2cc7Smrg])
295123e2cc7SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
296123e2cc7SmrgAM_CONDITIONAL([am__fastdep$1], [
297123e2cc7Smrg  test "x$enable_dependency_tracking" != xno \
298123e2cc7Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
299123e2cc7Smrg])
3007da8b7e3Smrg
3017da8b7e3Smrg
302123e2cc7Smrg# AM_SET_DEPDIR
303123e2cc7Smrg# -------------
304123e2cc7Smrg# Choose a directory name for dependency files.
305c3d5982aSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
306123e2cc7SmrgAC_DEFUN([AM_SET_DEPDIR],
307123e2cc7Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
308123e2cc7SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
309123e2cc7Smrg])
3107da8b7e3Smrg
3117da8b7e3Smrg
312123e2cc7Smrg# AM_DEP_TRACK
313123e2cc7Smrg# ------------
314123e2cc7SmrgAC_DEFUN([AM_DEP_TRACK],
315c3d5982aSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
316c3d5982aSmrgAS_HELP_STRING(
317c3d5982aSmrg  [--enable-dependency-tracking],
318c3d5982aSmrg  [do not reject slow dependency extractors])
319c3d5982aSmrgAS_HELP_STRING(
320c3d5982aSmrg  [--disable-dependency-tracking],
321c3d5982aSmrg  [speeds up one-time build])])
322123e2cc7Smrgif test "x$enable_dependency_tracking" != xno; then
323123e2cc7Smrg  am_depcomp="$ac_aux_dir/depcomp"
324123e2cc7Smrg  AMDEPBACKSLASH='\'
325c3d5982aSmrg  am__nodep='_no'
3267da8b7e3Smrgfi
327123e2cc7SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
328123e2cc7SmrgAC_SUBST([AMDEPBACKSLASH])dnl
329123e2cc7Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
330c3d5982aSmrgAC_SUBST([am__nodep])dnl
331c3d5982aSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
332123e2cc7Smrg])
3337da8b7e3Smrg
334123e2cc7Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335123e2cc7Smrg
336c3d5982aSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337123e2cc7Smrg#
338123e2cc7Smrg# This file is free software; the Free Software Foundation
339123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
340123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
341123e2cc7Smrg
342123e2cc7Smrg
343123e2cc7Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
344123e2cc7Smrg# ------------------------------
345123e2cc7SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
346123e2cc7Smrg[{
347c3d5982aSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
348123e2cc7Smrg  # are listed without --file.  Let's play safe and only enable the eval
349123e2cc7Smrg  # if we detect the quoting.
350123e2cc7Smrg  case $CONFIG_FILES in
351123e2cc7Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
352123e2cc7Smrg  *)   set x $CONFIG_FILES ;;
353123e2cc7Smrg  esac
354123e2cc7Smrg  shift
355123e2cc7Smrg  for mf
356123e2cc7Smrg  do
357123e2cc7Smrg    # Strip MF so we end up with the name of the file.
358123e2cc7Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
359123e2cc7Smrg    # Check whether this is an Automake generated Makefile or not.
360c3d5982aSmrg    # We used to match only the files named 'Makefile.in', but
361123e2cc7Smrg    # some people rename them; so instead we look at the file content.
362123e2cc7Smrg    # Grep'ing the first line is not enough: some people post-process
363123e2cc7Smrg    # each Makefile.in and add a new line on top of each file to say so.
364123e2cc7Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
365123e2cc7Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
366123e2cc7Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
367123e2cc7Smrg      dirpart=`AS_DIRNAME("$mf")`
368123e2cc7Smrg    else
369123e2cc7Smrg      continue
370123e2cc7Smrg    fi
371123e2cc7Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
372c3d5982aSmrg    # from the Makefile without running 'make'.
373123e2cc7Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
374123e2cc7Smrg    test -z "$DEPDIR" && continue
375123e2cc7Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
376c3d5982aSmrg    test -z "$am__include" && continue
377123e2cc7Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
378123e2cc7Smrg    # Find all dependency output files, they are included files with
379123e2cc7Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
380123e2cc7Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
381123e2cc7Smrg    # expansion.
382123e2cc7Smrg    for file in `sed -n "
383123e2cc7Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
384c3d5982aSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
385123e2cc7Smrg      # Make sure the directory exists.
386123e2cc7Smrg      test -f "$dirpart/$file" && continue
387123e2cc7Smrg      fdir=`AS_DIRNAME(["$file"])`
388123e2cc7Smrg      AS_MKDIR_P([$dirpart/$fdir])
389123e2cc7Smrg      # echo "creating $dirpart/$file"
390123e2cc7Smrg      echo '# dummy' > "$dirpart/$file"
391123e2cc7Smrg    done
392123e2cc7Smrg  done
393123e2cc7Smrg}
394123e2cc7Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395123e2cc7Smrg
396123e2cc7Smrg
397123e2cc7Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
398123e2cc7Smrg# -----------------------------
399123e2cc7Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
400123e2cc7Smrg#
401123e2cc7Smrg# This code is only required when automatic dependency tracking
402c3d5982aSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
403123e2cc7Smrg# need in order to bootstrap the dependency handling code.
404123e2cc7SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
405123e2cc7Smrg[AC_CONFIG_COMMANDS([depfiles],
406123e2cc7Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
407123e2cc7Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
408123e2cc7Smrg])
409123e2cc7Smrg
410123e2cc7Smrg# Do all the work for Automake.                             -*- Autoconf -*-
411123e2cc7Smrg
412c3d5982aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
413123e2cc7Smrg#
414123e2cc7Smrg# This file is free software; the Free Software Foundation
415123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
416123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
417123e2cc7Smrg
418123e2cc7Smrg# This macro actually does too much.  Some checks are only needed if
419123e2cc7Smrg# your package does certain things.  But this isn't really a big deal.
420123e2cc7Smrg
421123e2cc7Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
422123e2cc7Smrg# AM_INIT_AUTOMAKE([OPTIONS])
423123e2cc7Smrg# -----------------------------------------------
424123e2cc7Smrg# The call with PACKAGE and VERSION arguments is the old style
425123e2cc7Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
426123e2cc7Smrg# and VERSION should now be passed to AC_INIT and removed from
427123e2cc7Smrg# the call to AM_INIT_AUTOMAKE.
428123e2cc7Smrg# We support both call styles for the transition.  After
429123e2cc7Smrg# the next Automake release, Autoconf can make the AC_INIT
430123e2cc7Smrg# arguments mandatory, and then we can depend on a new Autoconf
431123e2cc7Smrg# release and drop the old call support.
432123e2cc7SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
433c3d5982aSmrg[AC_PREREQ([2.65])dnl
434123e2cc7Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
435123e2cc7Smrgdnl the ones we care about.
436123e2cc7Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
437123e2cc7SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
438123e2cc7SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
439123e2cc7Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
440123e2cc7Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
441123e2cc7Smrg  # is not polluted with repeated "-I."
442123e2cc7Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
443123e2cc7Smrg  # test to see if srcdir already configured
444123e2cc7Smrg  if test -f $srcdir/config.status; then
445123e2cc7Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
446123e2cc7Smrg  fi
4477da8b7e3Smrgfi
4487da8b7e3Smrg
449123e2cc7Smrg# test whether we have cygpath
450123e2cc7Smrgif test -z "$CYGPATH_W"; then
451123e2cc7Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
452123e2cc7Smrg    CYGPATH_W='cygpath -w'
453123e2cc7Smrg  else
454123e2cc7Smrg    CYGPATH_W=echo
455123e2cc7Smrg  fi
4567da8b7e3Smrgfi
457123e2cc7SmrgAC_SUBST([CYGPATH_W])
458123e2cc7Smrg
459123e2cc7Smrg# Define the identity of the package.
460123e2cc7Smrgdnl Distinguish between old-style and new-style calls.
461123e2cc7Smrgm4_ifval([$2],
462c3d5982aSmrg[AC_DIAGNOSE([obsolete],
463c3d5982aSmrg             [$0: two- and three-arguments forms are deprecated.])
464c3d5982aSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465123e2cc7Smrg AC_SUBST([PACKAGE], [$1])dnl
466123e2cc7Smrg AC_SUBST([VERSION], [$2])],
467123e2cc7Smrg[_AM_SET_OPTIONS([$1])dnl
468123e2cc7Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469c3d5982aSmrgm4_if(
470c3d5982aSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
471c3d5982aSmrg  [ok:ok],,
472123e2cc7Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
473123e2cc7Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
474123e2cc7Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
475123e2cc7Smrg
476123e2cc7Smrg_AM_IF_OPTION([no-define],,
477c3d5982aSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
478c3d5982aSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
479123e2cc7Smrg
480123e2cc7Smrg# Some tools Automake needs.
481123e2cc7SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
482123e2cc7SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
483c3d5982aSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
484c3d5982aSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
485c3d5982aSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
486c3d5982aSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
487c3d5982aSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
488123e2cc7SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
489123e2cc7SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
490c3d5982aSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
491c3d5982aSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
492c3d5982aSmrg# dies out for good.  For more background, see:
493c3d5982aSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
494c3d5982aSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
495c3d5982aSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
496123e2cc7Smrg# We need awk for the "check" target.  The system "awk" is bad on
497123e2cc7Smrg# some platforms.
498123e2cc7SmrgAC_REQUIRE([AC_PROG_AWK])dnl
499123e2cc7SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
500123e2cc7SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
501123e2cc7Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
502123e2cc7Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
503123e2cc7Smrg			     [_AM_PROG_TAR([v7])])])
504123e2cc7Smrg_AM_IF_OPTION([no-dependencies],,
505123e2cc7Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
506c3d5982aSmrg		  [_AM_DEPENDENCIES([CC])],
507c3d5982aSmrg		  [m4_define([AC_PROG_CC],
508c3d5982aSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
509123e2cc7SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
510c3d5982aSmrg		  [_AM_DEPENDENCIES([CXX])],
511c3d5982aSmrg		  [m4_define([AC_PROG_CXX],
512c3d5982aSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
513123e2cc7SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
514c3d5982aSmrg		  [_AM_DEPENDENCIES([OBJC])],
515c3d5982aSmrg		  [m4_define([AC_PROG_OBJC],
516c3d5982aSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
517c3d5982aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
518c3d5982aSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
519c3d5982aSmrg		  [m4_define([AC_PROG_OBJCXX],
520c3d5982aSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
521123e2cc7Smrg])
522c3d5982aSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
523c3d5982aSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
524c3d5982aSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
525c3d5982aSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
526123e2cc7SmrgAC_CONFIG_COMMANDS_PRE(dnl
527123e2cc7Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
528123e2cc7Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
529123e2cc7Smrg])
530123e2cc7Smrg
531c3d5982aSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
532123e2cc7Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
533123e2cc7Smrgdnl mangled by Autoconf and run in a shell conditional statement.
534123e2cc7Smrgm4_define([_AC_COMPILER_EXEEXT],
535123e2cc7Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
536123e2cc7Smrg
537123e2cc7Smrg
538123e2cc7Smrg# When config.status generates a header, we must update the stamp-h file.
539123e2cc7Smrg# This file resides in the same directory as the config header
540123e2cc7Smrg# that is generated.  The stamp files are numbered to have different names.
541123e2cc7Smrg
542123e2cc7Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
543123e2cc7Smrg# loop where config.status creates the headers, so we can generate
544123e2cc7Smrg# our stamp files there.
545123e2cc7SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
546123e2cc7Smrg[# Compute $1's index in $config_headers.
547123e2cc7Smrg_am_arg=$1
548123e2cc7Smrg_am_stamp_count=1
549123e2cc7Smrgfor _am_header in $config_headers :; do
550123e2cc7Smrg  case $_am_header in
551123e2cc7Smrg    $_am_arg | $_am_arg:* )
552123e2cc7Smrg      break ;;
553123e2cc7Smrg    * )
554123e2cc7Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
555123e2cc7Smrg  esac
556123e2cc7Smrgdone
557123e2cc7Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
558123e2cc7Smrg
559c3d5982aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
560123e2cc7Smrg#
561123e2cc7Smrg# This file is free software; the Free Software Foundation
562123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
563123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
564123e2cc7Smrg
565123e2cc7Smrg# AM_PROG_INSTALL_SH
566123e2cc7Smrg# ------------------
567123e2cc7Smrg# Define $install_sh.
568123e2cc7SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
569123e2cc7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
570123e2cc7Smrgif test x"${install_sh}" != xset; then
571123e2cc7Smrg  case $am_aux_dir in
572123e2cc7Smrg  *\ * | *\	*)
573123e2cc7Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
574123e2cc7Smrg  *)
575123e2cc7Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
576123e2cc7Smrg  esac
5777da8b7e3Smrgfi
578c3d5982aSmrgAC_SUBST([install_sh])])
5797da8b7e3Smrg
580c3d5982aSmrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
581123e2cc7Smrg#
582123e2cc7Smrg# This file is free software; the Free Software Foundation
583123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
584123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
585123e2cc7Smrg
586123e2cc7Smrg# Check whether the underlying file-system supports filenames
587123e2cc7Smrg# with a leading dot.  For instance MS-DOS doesn't.
588123e2cc7SmrgAC_DEFUN([AM_SET_LEADING_DOT],
589123e2cc7Smrg[rm -rf .tst 2>/dev/null
590123e2cc7Smrgmkdir .tst 2>/dev/null
591123e2cc7Smrgif test -d .tst; then
592123e2cc7Smrg  am__leading_dot=.
593123e2cc7Smrgelse
594123e2cc7Smrg  am__leading_dot=_
5957da8b7e3Smrgfi
596123e2cc7Smrgrmdir .tst 2>/dev/null
597123e2cc7SmrgAC_SUBST([am__leading_dot])])
598123e2cc7Smrg
599123e2cc7Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
600123e2cc7Smrg# From Jim Meyering
601123e2cc7Smrg
602c3d5982aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
603123e2cc7Smrg#
604123e2cc7Smrg# This file is free software; the Free Software Foundation
605123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
606123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
607123e2cc7Smrg
608123e2cc7Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
609123e2cc7Smrg# ----------------------------------
610123e2cc7Smrg# Control maintainer-specific portions of Makefiles.
611c3d5982aSmrg# Default is to disable them, unless 'enable' is passed literally.
612c3d5982aSmrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
613123e2cc7Smrg# can override the default with the --enable/--disable switch.
614123e2cc7SmrgAC_DEFUN([AM_MAINTAINER_MODE],
615123e2cc7Smrg[m4_case(m4_default([$1], [disable]),
616123e2cc7Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
617123e2cc7Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
618123e2cc7Smrg       [m4_define([am_maintainer_other], [enable])
619123e2cc7Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
620c3d5982aSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
621123e2cc7Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
622123e2cc7Smrg  AC_ARG_ENABLE([maintainer-mode],
623c3d5982aSmrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
624c3d5982aSmrg      am_maintainer_other[ make rules and dependencies not useful
625c3d5982aSmrg      (and sometimes confusing) to the casual installer])],
626c3d5982aSmrg    [USE_MAINTAINER_MODE=$enableval],
627c3d5982aSmrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
628123e2cc7Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
629123e2cc7Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
630123e2cc7Smrg  MAINT=$MAINTAINER_MODE_TRUE
631123e2cc7Smrg  AC_SUBST([MAINT])dnl
632123e2cc7Smrg]
633123e2cc7Smrg)
634123e2cc7Smrg
635123e2cc7Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
636123e2cc7Smrg
637c3d5982aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
638123e2cc7Smrg#
639123e2cc7Smrg# This file is free software; the Free Software Foundation
640123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
641123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
642123e2cc7Smrg
643123e2cc7Smrg# AM_MAKE_INCLUDE()
644123e2cc7Smrg# -----------------
645123e2cc7Smrg# Check to see how make treats includes.
646123e2cc7SmrgAC_DEFUN([AM_MAKE_INCLUDE],
647123e2cc7Smrg[am_make=${MAKE-make}
648123e2cc7Smrgcat > confinc << 'END'
649123e2cc7Smrgam__doit:
650123e2cc7Smrg	@echo this is the am__doit target
651123e2cc7Smrg.PHONY: am__doit
652123e2cc7SmrgEND
653123e2cc7Smrg# If we don't find an include directive, just comment out the code.
654123e2cc7SmrgAC_MSG_CHECKING([for style of include used by $am_make])
655123e2cc7Smrgam__include="#"
656123e2cc7Smrgam__quote=
657123e2cc7Smrg_am_result=none
658123e2cc7Smrg# First try GNU make style include.
659123e2cc7Smrgecho "include confinc" > confmf
660c3d5982aSmrg# Ignore all kinds of additional output from 'make'.
661123e2cc7Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
662123e2cc7Smrg*the\ am__doit\ target*)
663123e2cc7Smrg  am__include=include
664123e2cc7Smrg  am__quote=
665123e2cc7Smrg  _am_result=GNU
666123e2cc7Smrg  ;;
667123e2cc7Smrgesac
668123e2cc7Smrg# Now try BSD make style include.
669123e2cc7Smrgif test "$am__include" = "#"; then
670123e2cc7Smrg   echo '.include "confinc"' > confmf
671123e2cc7Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
672123e2cc7Smrg   *the\ am__doit\ target*)
673123e2cc7Smrg     am__include=.include
674123e2cc7Smrg     am__quote="\""
675123e2cc7Smrg     _am_result=BSD
676123e2cc7Smrg     ;;
677123e2cc7Smrg   esac
6787da8b7e3Smrgfi
679123e2cc7SmrgAC_SUBST([am__include])
680123e2cc7SmrgAC_SUBST([am__quote])
681123e2cc7SmrgAC_MSG_RESULT([$_am_result])
682123e2cc7Smrgrm -f confinc confmf
683123e2cc7Smrg])
6847da8b7e3Smrg
685123e2cc7Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
686123e2cc7Smrg
687c3d5982aSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
688123e2cc7Smrg#
689123e2cc7Smrg# This file is free software; the Free Software Foundation
690123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
691123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
692123e2cc7Smrg
693123e2cc7Smrg# AM_MISSING_PROG(NAME, PROGRAM)
694123e2cc7Smrg# ------------------------------
695123e2cc7SmrgAC_DEFUN([AM_MISSING_PROG],
696123e2cc7Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
697123e2cc7Smrg$1=${$1-"${am_missing_run}$2"}
698123e2cc7SmrgAC_SUBST($1)])
699123e2cc7Smrg
700123e2cc7Smrg# AM_MISSING_HAS_RUN
701123e2cc7Smrg# ------------------
702c3d5982aSmrg# Define MISSING if not defined so far and test if it is modern enough.
703c3d5982aSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
704123e2cc7SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
705123e2cc7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
706123e2cc7SmrgAC_REQUIRE_AUX_FILE([missing])dnl
707123e2cc7Smrgif test x"${MISSING+set}" != xset; then
708123e2cc7Smrg  case $am_aux_dir in
709123e2cc7Smrg  *\ * | *\	*)
710123e2cc7Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
711123e2cc7Smrg  *)
712123e2cc7Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
713123e2cc7Smrg  esac
7147da8b7e3Smrgfi
715123e2cc7Smrg# Use eval to expand $SHELL
716c3d5982aSmrgif eval "$MISSING --is-lightweight"; then
717c3d5982aSmrg  am_missing_run="$MISSING "
718123e2cc7Smrgelse
719123e2cc7Smrg  am_missing_run=
720c3d5982aSmrg  AC_MSG_WARN(['missing' script is too old or missing])
7217da8b7e3Smrgfi
722123e2cc7Smrg])
7237da8b7e3Smrg
724123e2cc7Smrg# Helper functions for option handling.                     -*- Autoconf -*-
725123e2cc7Smrg
726c3d5982aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
727123e2cc7Smrg#
728123e2cc7Smrg# This file is free software; the Free Software Foundation
729123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
730123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
731123e2cc7Smrg
732123e2cc7Smrg# _AM_MANGLE_OPTION(NAME)
733123e2cc7Smrg# -----------------------
734123e2cc7SmrgAC_DEFUN([_AM_MANGLE_OPTION],
735123e2cc7Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
736123e2cc7Smrg
737123e2cc7Smrg# _AM_SET_OPTION(NAME)
738c3d5982aSmrg# --------------------
739123e2cc7Smrg# Set option NAME.  Presently that only means defining a flag for this option.
740123e2cc7SmrgAC_DEFUN([_AM_SET_OPTION],
741c3d5982aSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
742123e2cc7Smrg
743123e2cc7Smrg# _AM_SET_OPTIONS(OPTIONS)
744c3d5982aSmrg# ------------------------
745123e2cc7Smrg# OPTIONS is a space-separated list of Automake options.
746123e2cc7SmrgAC_DEFUN([_AM_SET_OPTIONS],
747123e2cc7Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7487da8b7e3Smrg
749123e2cc7Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
750123e2cc7Smrg# -------------------------------------------
751123e2cc7Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
752123e2cc7SmrgAC_DEFUN([_AM_IF_OPTION],
753123e2cc7Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7547da8b7e3Smrg
755123e2cc7Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7567da8b7e3Smrg
757c3d5982aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
758123e2cc7Smrg#
759123e2cc7Smrg# This file is free software; the Free Software Foundation
760123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
761123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
7627da8b7e3Smrg
763123e2cc7Smrg# AM_SANITY_CHECK
764123e2cc7Smrg# ---------------
765123e2cc7SmrgAC_DEFUN([AM_SANITY_CHECK],
766123e2cc7Smrg[AC_MSG_CHECKING([whether build environment is sane])
767123e2cc7Smrg# Reject unsafe characters in $srcdir or the absolute working directory
768123e2cc7Smrg# name.  Accept space and tab only in the latter.
769123e2cc7Smrgam_lf='
770123e2cc7Smrg'
771123e2cc7Smrgcase `pwd` in
772123e2cc7Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
773123e2cc7Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
774123e2cc7Smrgesac
775123e2cc7Smrgcase $srcdir in
776123e2cc7Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
777c3d5982aSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
778123e2cc7Smrgesac
7797da8b7e3Smrg
780c3d5982aSmrg# Do 'set' in a subshell so we don't clobber the current shell's
781123e2cc7Smrg# arguments.  Must try -L first in case configure is actually a
782123e2cc7Smrg# symlink; some systems play weird games with the mod time of symlinks
783123e2cc7Smrg# (eg FreeBSD returns the mod time of the symlink's containing
784123e2cc7Smrg# directory).
785123e2cc7Smrgif (
786c3d5982aSmrg   am_has_slept=no
787c3d5982aSmrg   for am_try in 1 2; do
788c3d5982aSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
789c3d5982aSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
790c3d5982aSmrg     if test "$[*]" = "X"; then
791c3d5982aSmrg	# -L didn't work.
792c3d5982aSmrg	set X `ls -t "$srcdir/configure" conftest.file`
793c3d5982aSmrg     fi
794c3d5982aSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
795c3d5982aSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
796c3d5982aSmrg
797c3d5982aSmrg	# If neither matched, then we have a broken ls.  This can happen
798c3d5982aSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
799c3d5982aSmrg	# broken ls alias from the environment.  This has actually
800c3d5982aSmrg	# happened.  Such a system could not be considered "sane".
801c3d5982aSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
802c3d5982aSmrg  alias in your environment])
803c3d5982aSmrg     fi
804c3d5982aSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
805c3d5982aSmrg       break
806c3d5982aSmrg     fi
807c3d5982aSmrg     # Just in case.
808c3d5982aSmrg     sleep 1
809c3d5982aSmrg     am_has_slept=yes
810c3d5982aSmrg   done
811123e2cc7Smrg   test "$[2]" = conftest.file
812123e2cc7Smrg   )
813123e2cc7Smrgthen
814123e2cc7Smrg   # Ok.
815123e2cc7Smrg   :
8167da8b7e3Smrgelse
817123e2cc7Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
818123e2cc7SmrgCheck your system clock])
8197da8b7e3Smrgfi
820c3d5982aSmrgAC_MSG_RESULT([yes])
821c3d5982aSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
822c3d5982aSmrg# generated files are strictly newer.
823c3d5982aSmrgam_sleep_pid=
824c3d5982aSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
825c3d5982aSmrg  ( sleep 1 ) &
826c3d5982aSmrg  am_sleep_pid=$!
827c3d5982aSmrgfi
828c3d5982aSmrgAC_CONFIG_COMMANDS_PRE(
829c3d5982aSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
830c3d5982aSmrg   if test -n "$am_sleep_pid"; then
831c3d5982aSmrg     # Hide warnings about reused PIDs.
832c3d5982aSmrg     wait $am_sleep_pid 2>/dev/null
833c3d5982aSmrg   fi
834c3d5982aSmrg   AC_MSG_RESULT([done])])
835c3d5982aSmrgrm -f conftest.file
836c3d5982aSmrg])
8377da8b7e3Smrg
838c3d5982aSmrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
839123e2cc7Smrg#
840123e2cc7Smrg# This file is free software; the Free Software Foundation
841123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
842123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
8437da8b7e3Smrg
844123e2cc7Smrg# AM_SILENT_RULES([DEFAULT])
845123e2cc7Smrg# --------------------------
846123e2cc7Smrg# Enable less verbose build rules; with the default set to DEFAULT
847c3d5982aSmrg# ("yes" being less verbose, "no" or empty being verbose).
848123e2cc7SmrgAC_DEFUN([AM_SILENT_RULES],
849c3d5982aSmrg[AC_ARG_ENABLE([silent-rules], [dnl
850c3d5982aSmrgAS_HELP_STRING(
851c3d5982aSmrg  [--enable-silent-rules],
852c3d5982aSmrg  [less verbose build output (undo: "make V=1")])
853c3d5982aSmrgAS_HELP_STRING(
854c3d5982aSmrg  [--disable-silent-rules],
855c3d5982aSmrg  [verbose build output (undo: "make V=0")])dnl
856c3d5982aSmrg])
857c3d5982aSmrgcase $enable_silent_rules in @%:@ (((
858c3d5982aSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
859c3d5982aSmrg   no) AM_DEFAULT_VERBOSITY=1;;
860c3d5982aSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
861123e2cc7Smrgesac
862c3d5982aSmrgdnl
863c3d5982aSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
864c3d5982aSmrgdnl do not support nested variable expansions.
865c3d5982aSmrgdnl See automake bug#9928 and bug#10237.
866c3d5982aSmrgam_make=${MAKE-make}
867c3d5982aSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
868c3d5982aSmrg   [am_cv_make_support_nested_variables],
869c3d5982aSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
870c3d5982aSmrgBAR0=false
871c3d5982aSmrgBAR1=true
872c3d5982aSmrgV=1
873c3d5982aSmrgam__doit:
874c3d5982aSmrg	@$(TRUE)
875c3d5982aSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
876c3d5982aSmrg  am_cv_make_support_nested_variables=yes
877c3d5982aSmrgelse
878c3d5982aSmrg  am_cv_make_support_nested_variables=no
879c3d5982aSmrgfi])
880c3d5982aSmrgif test $am_cv_make_support_nested_variables = yes; then
881c3d5982aSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
882c3d5982aSmrg  AM_V='$(V)'
883c3d5982aSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
884c3d5982aSmrgelse
885c3d5982aSmrg  AM_V=$AM_DEFAULT_VERBOSITY
886c3d5982aSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
887c3d5982aSmrgfi
888c3d5982aSmrgAC_SUBST([AM_V])dnl
889c3d5982aSmrgAM_SUBST_NOTMAKE([AM_V])dnl
890c3d5982aSmrgAC_SUBST([AM_DEFAULT_V])dnl
891c3d5982aSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
892123e2cc7SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
893123e2cc7SmrgAM_BACKSLASH='\'
894123e2cc7SmrgAC_SUBST([AM_BACKSLASH])dnl
895123e2cc7Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
896123e2cc7Smrg])
8977da8b7e3Smrg
898c3d5982aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
899123e2cc7Smrg#
900123e2cc7Smrg# This file is free software; the Free Software Foundation
901123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
902123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
9037da8b7e3Smrg
904123e2cc7Smrg# AM_PROG_INSTALL_STRIP
905123e2cc7Smrg# ---------------------
906c3d5982aSmrg# One issue with vendor 'install' (even GNU) is that you can't
907123e2cc7Smrg# specify the program used to strip binaries.  This is especially
908123e2cc7Smrg# annoying in cross-compiling environments, where the build's strip
909123e2cc7Smrg# is unlikely to handle the host's binaries.
910123e2cc7Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
911c3d5982aSmrg# always use install-sh in "make install-strip", and initialize
912123e2cc7Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
913123e2cc7SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
914123e2cc7Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
915c3d5982aSmrg# Installed binaries are usually stripped using 'strip' when the user
916c3d5982aSmrg# run "make install-strip".  However 'strip' might not be the right
917123e2cc7Smrg# tool to use in cross-compilation environments, therefore Automake
918c3d5982aSmrg# will honor the 'STRIP' environment variable to overrule this program.
919c3d5982aSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
920123e2cc7Smrgif test "$cross_compiling" != no; then
921123e2cc7Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9227da8b7e3Smrgfi
923123e2cc7SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
924123e2cc7SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
9257da8b7e3Smrg
926c3d5982aSmrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
927123e2cc7Smrg#
928123e2cc7Smrg# This file is free software; the Free Software Foundation
929123e2cc7Smrg# gives unlimited permission to copy and/or distribute it,
930123e2cc7Smrg# with or without modifications, as long as this notice is preserved.
9317da8b7e3Smrg
932123e2cc7Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
933123e2cc7Smrg# ---------------------------
934123e2cc7Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
935123e2cc7Smrg# This macro is traced by Automake.
936123e2cc7SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9377da8b7e3Smrg
938123e2cc7Smrg# AM_SUBST_NOTMAKE(VARIABLE)
939c3d5982aSmrg# --------------------------
940123e2cc7Smrg# Public sister of _AM_SUBST_NOTMAKE.
941123e2cc7SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9427da8b7e3Smrg
943123e2cc7Smrg# Check how to create a tarball.                            -*- Autoconf -*-
944123e2cc7Smrg
945c3d5982aSmrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
9467da8b7e3Smrg#
9477da8b7e3Smrg# This file is free software; the Free Software Foundation
9487da8b7e3Smrg# gives unlimited permission to copy and/or distribute it,
9497da8b7e3Smrg# with or without modifications, as long as this notice is preserved.
9507da8b7e3Smrg
951123e2cc7Smrg# _AM_PROG_TAR(FORMAT)
952123e2cc7Smrg# --------------------
953123e2cc7Smrg# Check how to create a tarball in format FORMAT.
954c3d5982aSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
955123e2cc7Smrg#
956123e2cc7Smrg# Substitute a variable $(am__tar) that is a command
957123e2cc7Smrg# writing to stdout a FORMAT-tarball containing the directory
958123e2cc7Smrg# $tardir.
959123e2cc7Smrg#     tardir=directory && $(am__tar) > result.tar
960123e2cc7Smrg#
961123e2cc7Smrg# Substitute a variable $(am__untar) that extract such
962123e2cc7Smrg# a tarball read from stdin.
963123e2cc7Smrg#     $(am__untar) < result.tar
964c3d5982aSmrg#
965123e2cc7SmrgAC_DEFUN([_AM_PROG_TAR],
966c3d5982aSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
967c3d5982aSmrg# in the wild :-(  We should find a proper way to deprecate it ...
968c3d5982aSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
969c3d5982aSmrg
970c3d5982aSmrg# We'll loop over all known methods to create a tar archive until one works.
971123e2cc7Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
972123e2cc7Smrg
973c3d5982aSmrgm4_if([$1], [v7],
974c3d5982aSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
975c3d5982aSmrg
976c3d5982aSmrg  [m4_case([$1],
977c3d5982aSmrg    [ustar],
978c3d5982aSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
979c3d5982aSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
980c3d5982aSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
981c3d5982aSmrg      # and bug#13588).
982c3d5982aSmrg      am_max_uid=2097151 # 2^21 - 1
983c3d5982aSmrg      am_max_gid=$am_max_uid
984c3d5982aSmrg      # The $UID and $GID variables are not portable, so we need to resort
985c3d5982aSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
986c3d5982aSmrg      # below are definitely unexpected, so allow the users to see them
987c3d5982aSmrg      # (that is, avoid stderr redirection).
988c3d5982aSmrg      am_uid=`id -u || echo unknown`
989c3d5982aSmrg      am_gid=`id -g || echo unknown`
990c3d5982aSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
991c3d5982aSmrg      if test $am_uid -le $am_max_uid; then
992c3d5982aSmrg         AC_MSG_RESULT([yes])
993c3d5982aSmrg      else
994c3d5982aSmrg         AC_MSG_RESULT([no])
995c3d5982aSmrg         _am_tools=none
996c3d5982aSmrg      fi
997c3d5982aSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
998c3d5982aSmrg      if test $am_gid -le $am_max_gid; then
999c3d5982aSmrg         AC_MSG_RESULT([yes])
1000c3d5982aSmrg      else
1001c3d5982aSmrg        AC_MSG_RESULT([no])
1002c3d5982aSmrg        _am_tools=none
1003c3d5982aSmrg      fi],
1004c3d5982aSmrg
1005c3d5982aSmrg  [pax],
1006c3d5982aSmrg    [],
1007c3d5982aSmrg
1008c3d5982aSmrg  [m4_fatal([Unknown tar format])])
1009c3d5982aSmrg
1010c3d5982aSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1011c3d5982aSmrg
1012c3d5982aSmrg  # Go ahead even if we have the value already cached.  We do so because we
1013c3d5982aSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1014c3d5982aSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1015c3d5982aSmrg
1016c3d5982aSmrg  for _am_tool in $_am_tools; do
1017c3d5982aSmrg    case $_am_tool in
1018c3d5982aSmrg    gnutar)
1019c3d5982aSmrg      for _am_tar in tar gnutar gtar; do
1020c3d5982aSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1021c3d5982aSmrg      done
1022c3d5982aSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1023c3d5982aSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1024c3d5982aSmrg      am__untar="$_am_tar -xf -"
1025c3d5982aSmrg      ;;
1026c3d5982aSmrg    plaintar)
1027c3d5982aSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1028c3d5982aSmrg      # ustar tarball either.
1029c3d5982aSmrg      (tar --version) >/dev/null 2>&1 && continue
1030c3d5982aSmrg      am__tar='tar chf - "$$tardir"'
1031c3d5982aSmrg      am__tar_='tar chf - "$tardir"'
1032c3d5982aSmrg      am__untar='tar xf -'
1033c3d5982aSmrg      ;;
1034c3d5982aSmrg    pax)
1035c3d5982aSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1036c3d5982aSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1037c3d5982aSmrg      am__untar='pax -r'
1038c3d5982aSmrg      ;;
1039c3d5982aSmrg    cpio)
1040c3d5982aSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1041c3d5982aSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1042c3d5982aSmrg      am__untar='cpio -i -H $1 -d'
1043c3d5982aSmrg      ;;
1044c3d5982aSmrg    none)
1045c3d5982aSmrg      am__tar=false
1046c3d5982aSmrg      am__tar_=false
1047c3d5982aSmrg      am__untar=false
1048c3d5982aSmrg      ;;
1049c3d5982aSmrg    esac
10507da8b7e3Smrg
1051c3d5982aSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1052c3d5982aSmrg    # and am__untar set.
1053c3d5982aSmrg    test -n "${am_cv_prog_tar_$1}" && break
1054c3d5982aSmrg
1055c3d5982aSmrg    # tar/untar a dummy directory, and stop if the command works.
1056c3d5982aSmrg    rm -rf conftest.dir
1057c3d5982aSmrg    mkdir conftest.dir
1058c3d5982aSmrg    echo GrepMe > conftest.dir/file
1059c3d5982aSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1060c3d5982aSmrg    rm -rf conftest.dir
1061c3d5982aSmrg    if test -s conftest.tar; then
1062c3d5982aSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1063c3d5982aSmrg      AM_RUN_LOG([cat conftest.dir/file])
1064c3d5982aSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1065c3d5982aSmrg    fi
1066c3d5982aSmrg  done
1067123e2cc7Smrg  rm -rf conftest.dir
10687da8b7e3Smrg
1069c3d5982aSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1070c3d5982aSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1071c3d5982aSmrg
1072123e2cc7SmrgAC_SUBST([am__tar])
1073123e2cc7SmrgAC_SUBST([am__untar])
1074123e2cc7Smrg]) # _AM_PROG_TAR
10757da8b7e3Smrg
1076c3d5982aSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1077c3d5982aSmrg# 
1078c3d5982aSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1079c3d5982aSmrg#
1080c3d5982aSmrg# This program is free software; you can redistribute it and/or modify
1081c3d5982aSmrg# it under the terms of the GNU General Public License as published by
1082c3d5982aSmrg# the Free Software Foundation; either version 2 of the License, or
1083c3d5982aSmrg# (at your option) any later version.
1084c3d5982aSmrg#
1085c3d5982aSmrg# This program is distributed in the hope that it will be useful, but
1086c3d5982aSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1087c3d5982aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1088c3d5982aSmrg# General Public License for more details.
1089c3d5982aSmrg#
1090c3d5982aSmrg# You should have received a copy of the GNU General Public License
1091c3d5982aSmrg# along with this program; if not, write to the Free Software
1092c3d5982aSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1093c3d5982aSmrg#
1094c3d5982aSmrg# As a special exception to the GNU General Public License, if you
1095c3d5982aSmrg# distribute this file as part of a program that contains a
1096c3d5982aSmrg# configuration script generated by Autoconf, you may include it under
1097c3d5982aSmrg# the same distribution terms that you use for the rest of that program.
1098c3d5982aSmrg
1099c3d5982aSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1100c3d5982aSmrg# ----------------------------------
1101c3d5982aSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1102c3d5982aSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1103c3d5982aSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1104c3d5982aSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1105c3d5982aSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1106c3d5982aSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1107c3d5982aSmrgfi
1108c3d5982aSmrgif test -n "$PKG_CONFIG"; then
1109c3d5982aSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1110c3d5982aSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1111c3d5982aSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1112c3d5982aSmrg		AC_MSG_RESULT([yes])
1113c3d5982aSmrg	else
1114c3d5982aSmrg		AC_MSG_RESULT([no])
1115c3d5982aSmrg		PKG_CONFIG=""
1116c3d5982aSmrg	fi
1117c3d5982aSmrg		
1118c3d5982aSmrgfi[]dnl
1119c3d5982aSmrg])# PKG_PROG_PKG_CONFIG
1120c3d5982aSmrg
1121c3d5982aSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1122c3d5982aSmrg#
1123c3d5982aSmrg# Check to see whether a particular set of modules exists.  Similar
1124c3d5982aSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1125c3d5982aSmrg#
1126c3d5982aSmrg#
1127c3d5982aSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1128c3d5982aSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1129c3d5982aSmrg# PKG_CHECK_EXISTS manually
1130c3d5982aSmrg# --------------------------------------------------------------
1131c3d5982aSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1132c3d5982aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1133c3d5982aSmrgif test -n "$PKG_CONFIG" && \
1134c3d5982aSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1135c3d5982aSmrg  m4_ifval([$2], [$2], [:])
1136c3d5982aSmrgm4_ifvaln([$3], [else
1137c3d5982aSmrg  $3])dnl
1138c3d5982aSmrgfi])
1139c3d5982aSmrg
1140c3d5982aSmrg
1141c3d5982aSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1142c3d5982aSmrg# ---------------------------------------------
1143c3d5982aSmrgm4_define([_PKG_CONFIG],
1144c3d5982aSmrg[if test -n "$$1"; then
1145c3d5982aSmrg    pkg_cv_[]$1="$$1"
1146c3d5982aSmrg elif test -n "$PKG_CONFIG"; then
1147c3d5982aSmrg    PKG_CHECK_EXISTS([$3],
1148c3d5982aSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1149c3d5982aSmrg		     [pkg_failed=yes])
1150c3d5982aSmrg else
1151c3d5982aSmrg    pkg_failed=untried
1152c3d5982aSmrgfi[]dnl
1153c3d5982aSmrg])# _PKG_CONFIG
1154c3d5982aSmrg
1155c3d5982aSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1156c3d5982aSmrg# -----------------------------
1157c3d5982aSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1158c3d5982aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1159c3d5982aSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1160c3d5982aSmrg        _pkg_short_errors_supported=yes
1161c3d5982aSmrgelse
1162c3d5982aSmrg        _pkg_short_errors_supported=no
1163c3d5982aSmrgfi[]dnl
1164c3d5982aSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1165c3d5982aSmrg
1166c3d5982aSmrg
1167c3d5982aSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1168c3d5982aSmrg# [ACTION-IF-NOT-FOUND])
1169c3d5982aSmrg#
1170c3d5982aSmrg#
1171c3d5982aSmrg# Note that if there is a possibility the first call to
1172c3d5982aSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1173c3d5982aSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1174c3d5982aSmrg#
1175c3d5982aSmrg#
1176c3d5982aSmrg# --------------------------------------------------------------
1177c3d5982aSmrgAC_DEFUN([PKG_CHECK_MODULES],
1178c3d5982aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1179c3d5982aSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1180c3d5982aSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1181c3d5982aSmrg
1182c3d5982aSmrgpkg_failed=no
1183c3d5982aSmrgAC_MSG_CHECKING([for $1])
1184c3d5982aSmrg
1185c3d5982aSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1186c3d5982aSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1187c3d5982aSmrg
1188c3d5982aSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1189c3d5982aSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1190c3d5982aSmrgSee the pkg-config man page for more details.])
1191c3d5982aSmrg
1192c3d5982aSmrgif test $pkg_failed = yes; then
1193c3d5982aSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1194c3d5982aSmrg        if test $_pkg_short_errors_supported = yes; then
1195c3d5982aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1196c3d5982aSmrg        else 
1197c3d5982aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1198c3d5982aSmrg        fi
1199c3d5982aSmrg	# Put the nasty error message in config.log where it belongs
1200c3d5982aSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1201c3d5982aSmrg
1202c3d5982aSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1203c3d5982aSmrg[Package requirements ($2) were not met:
1204c3d5982aSmrg
1205c3d5982aSmrg$$1_PKG_ERRORS
1206c3d5982aSmrg
1207c3d5982aSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1208c3d5982aSmrginstalled software in a non-standard prefix.
1209c3d5982aSmrg
1210c3d5982aSmrg_PKG_TEXT
1211c3d5982aSmrg])],
1212c3d5982aSmrg		[AC_MSG_RESULT([no])
1213c3d5982aSmrg                $4])
1214c3d5982aSmrgelif test $pkg_failed = untried; then
1215c3d5982aSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1216c3d5982aSmrg[The pkg-config script could not be found or is too old.  Make sure it
1217c3d5982aSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1218c3d5982aSmrgpath to pkg-config.
1219c3d5982aSmrg
1220c3d5982aSmrg_PKG_TEXT
1221c3d5982aSmrg
1222c3d5982aSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1223c3d5982aSmrg		[$4])
1224c3d5982aSmrgelse
1225c3d5982aSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1226c3d5982aSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1227c3d5982aSmrg        AC_MSG_RESULT([yes])
1228c3d5982aSmrg	ifelse([$3], , :, [$3])
1229c3d5982aSmrgfi[]dnl
1230c3d5982aSmrg])# PKG_CHECK_MODULES
1231c3d5982aSmrg
1232123e2cc7Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1233123e2cc7Smrgdnl
1234bded5d25Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1235123e2cc7Smrgdnl 
1236123e2cc7Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1237bded5d25Smrgdnl copy of this software and associated documentation files (the "Software"),
1238bded5d25Smrgdnl to deal in the Software without restriction, including without limitation
1239bded5d25Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1240bded5d25Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1241bded5d25Smrgdnl Software is furnished to do so, subject to the following conditions:
1242123e2cc7Smrgdnl
1243bded5d25Smrgdnl The above copyright notice and this permission notice (including the next
1244bded5d25Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1245bded5d25Smrgdnl Software.
1246123e2cc7Smrgdnl
1247bded5d25Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1248bded5d25Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1249bded5d25Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1250bded5d25Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1251bded5d25Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1252bded5d25Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1253bded5d25Smrgdnl DEALINGS IN THE SOFTWARE.
12547da8b7e3Smrg
1255123e2cc7Smrg# XORG_MACROS_VERSION(required-version)
1256123e2cc7Smrg# -------------------------------------
1257123e2cc7Smrg# Minimum version: 1.1.0
12587da8b7e3Smrg#
1259123e2cc7Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1260123e2cc7Smrg# your configure.ac with the minimum required version, such as:
1261123e2cc7Smrg# XORG_MACROS_VERSION(1.1)
12627da8b7e3Smrg#
1263123e2cc7Smrg# To ensure that this macro is defined, also add:
1264123e2cc7Smrg# m4_ifndef([XORG_MACROS_VERSION],
1265123e2cc7Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
12667da8b7e3Smrg#
12677da8b7e3Smrg#
1268123e2cc7Smrg# See the "minimum version" comment for each macro you use to see what 
1269123e2cc7Smrg# version you require.
1270123e2cc7Smrgm4_defun([XORG_MACROS_VERSION],[
1271c3d5982aSmrgm4_define([vers_have], [1.17])
1272123e2cc7Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1273123e2cc7Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1274123e2cc7Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1275123e2cc7Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1276123e2cc7Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1277123e2cc7Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1278123e2cc7Smrgm4_undefine([vers_have])
1279123e2cc7Smrgm4_undefine([maj_have])
1280123e2cc7Smrgm4_undefine([maj_needed])
1281123e2cc7Smrg]) # XORG_MACROS_VERSION
12827da8b7e3Smrg
1283123e2cc7Smrg# XORG_PROG_RAWCPP()
1284123e2cc7Smrg# ------------------
1285123e2cc7Smrg# Minimum version: 1.0.0
12867da8b7e3Smrg#
1287123e2cc7Smrg# Find cpp program and necessary flags for use in pre-processing text files
1288123e2cc7Smrg# such as man pages and config files
1289123e2cc7SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1290123e2cc7SmrgAC_REQUIRE([AC_PROG_CPP])
1291123e2cc7SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1292123e2cc7Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
12937da8b7e3Smrg
1294123e2cc7Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1295123e2cc7Smrg# which is not the best choice for supporting other OS'es, but covers most
1296123e2cc7Smrg# of the ones we need for now.
1297123e2cc7SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1298c3d5982aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1299123e2cc7Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1300123e2cc7Smrg	AC_MSG_RESULT([no])
13017da8b7e3Smrgelse
1302123e2cc7Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1303123e2cc7Smrg		RAWCPPFLAGS=-undef
1304123e2cc7Smrg		AC_MSG_RESULT([yes])
1305123e2cc7Smrg	# under Cygwin unix is still defined even with -undef
1306123e2cc7Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1307123e2cc7Smrg		RAWCPPFLAGS="-undef -ansi"
1308123e2cc7Smrg		AC_MSG_RESULT([yes, with -ansi])
1309123e2cc7Smrg	else
1310123e2cc7Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1311123e2cc7Smrg	fi
13127da8b7e3Smrgfi
1313123e2cc7Smrgrm -f conftest.$ac_ext
13147da8b7e3Smrg
1315123e2cc7SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1316c3d5982aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1317123e2cc7Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1318123e2cc7Smrg	AC_MSG_RESULT([no])
1319123e2cc7Smrgelse
1320123e2cc7Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1321123e2cc7Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1322123e2cc7Smrg		AC_MSG_RESULT([yes])
1323123e2cc7Smrg	else
1324123e2cc7Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1325123e2cc7Smrg	fi
1326123e2cc7Smrgfi
1327123e2cc7Smrgrm -f conftest.$ac_ext
1328123e2cc7SmrgAC_SUBST(RAWCPPFLAGS)
1329123e2cc7Smrg]) # XORG_PROG_RAWCPP
13307da8b7e3Smrg
1331123e2cc7Smrg# XORG_MANPAGE_SECTIONS()
1332123e2cc7Smrg# -----------------------
1333123e2cc7Smrg# Minimum version: 1.0.0
13347da8b7e3Smrg#
1335123e2cc7Smrg# Determine which sections man pages go in for the different man page types
1336123e2cc7Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1337123e2cc7Smrg# Not sure if there's any better way than just hardcoding by OS name.
1338123e2cc7Smrg# Override default settings by setting environment variables
1339bded5d25Smrg# Added MAN_SUBSTS in version 1.8
1340bded5d25Smrg# Added AC_PROG_SED in version 1.8
13417da8b7e3Smrg
1342123e2cc7SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1343123e2cc7SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1344bded5d25SmrgAC_REQUIRE([AC_PROG_SED])
13457da8b7e3Smrg
1346123e2cc7Smrgif test x$APP_MAN_SUFFIX = x    ; then
1347123e2cc7Smrg    APP_MAN_SUFFIX=1
1348123e2cc7Smrgfi
1349123e2cc7Smrgif test x$APP_MAN_DIR = x    ; then
1350123e2cc7Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1351123e2cc7Smrgfi
13527da8b7e3Smrg
1353123e2cc7Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1354123e2cc7Smrg    LIB_MAN_SUFFIX=3
1355123e2cc7Smrgfi
1356123e2cc7Smrgif test x$LIB_MAN_DIR = x    ; then
1357123e2cc7Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13587da8b7e3Smrgfi
13597da8b7e3Smrg
1360123e2cc7Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1361123e2cc7Smrg    case $host_os in
1362123e2cc7Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1363123e2cc7Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1364123e2cc7Smrg    esac
1365123e2cc7Smrgfi
1366123e2cc7Smrgif test x$FILE_MAN_DIR = x    ; then
1367123e2cc7Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1368123e2cc7Smrgfi
13697da8b7e3Smrg
1370123e2cc7Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1371123e2cc7Smrg    case $host_os in
1372123e2cc7Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1373123e2cc7Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1374123e2cc7Smrg    esac
1375123e2cc7Smrgfi
1376123e2cc7Smrgif test x$MISC_MAN_DIR = x    ; then
1377123e2cc7Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1378123e2cc7Smrgfi
13797da8b7e3Smrg
1380123e2cc7Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1381123e2cc7Smrg    case $host_os in
1382123e2cc7Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1383123e2cc7Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1384123e2cc7Smrg    esac
1385123e2cc7Smrgfi
1386123e2cc7Smrgif test x$DRIVER_MAN_DIR = x    ; then
1387123e2cc7Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1388123e2cc7Smrgfi
13897da8b7e3Smrg
1390123e2cc7Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1391123e2cc7Smrg    case $host_os in
1392123e2cc7Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1393123e2cc7Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1394123e2cc7Smrg    esac
1395123e2cc7Smrgfi
1396123e2cc7Smrgif test x$ADMIN_MAN_DIR = x    ; then
1397123e2cc7Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13987da8b7e3Smrgfi
13997da8b7e3Smrg
14007da8b7e3Smrg
1401123e2cc7SmrgAC_SUBST([APP_MAN_SUFFIX])
1402123e2cc7SmrgAC_SUBST([LIB_MAN_SUFFIX])
1403123e2cc7SmrgAC_SUBST([FILE_MAN_SUFFIX])
1404123e2cc7SmrgAC_SUBST([MISC_MAN_SUFFIX])
1405123e2cc7SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1406123e2cc7SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1407123e2cc7SmrgAC_SUBST([APP_MAN_DIR])
1408123e2cc7SmrgAC_SUBST([LIB_MAN_DIR])
1409123e2cc7SmrgAC_SUBST([FILE_MAN_DIR])
1410123e2cc7SmrgAC_SUBST([MISC_MAN_DIR])
1411123e2cc7SmrgAC_SUBST([DRIVER_MAN_DIR])
1412123e2cc7SmrgAC_SUBST([ADMIN_MAN_DIR])
1413bded5d25Smrg
1414bded5d25SmrgXORG_MAN_PAGE="X Version 11"
1415bded5d25SmrgAC_SUBST([XORG_MAN_PAGE])
1416bded5d25SmrgMAN_SUBSTS="\
1417bded5d25Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1418bded5d25Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1419bded5d25Smrg	-e 's|__xservername__|Xorg|g' \
1420bded5d25Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1421bded5d25Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1422bded5d25Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1423bded5d25Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1424bded5d25Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1425bded5d25Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1426bded5d25Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1427bded5d25Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1428bded5d25Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1429bded5d25SmrgAC_SUBST([MAN_SUBSTS])
1430bded5d25Smrg
1431123e2cc7Smrg]) # XORG_MANPAGE_SECTIONS
1432123e2cc7Smrg
1433bded5d25Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1434bded5d25Smrg# ------------------------
1435bded5d25Smrg# Minimum version: 1.7.0
1436bded5d25Smrg#
1437bded5d25Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1438bded5d25Smrg# provided by xorg-sgml-doctools, if installed.
1439bded5d25SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1440bded5d25SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1441bded5d25SmrgXORG_SGML_PATH=
1442bded5d25SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1443bded5d25Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1444bded5d25Smrg    [m4_ifval([$1],[:],
1445bded5d25Smrg        [if test x"$cross_compiling" != x"yes" ; then
1446bded5d25Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1447bded5d25Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1448bded5d25Smrg         fi])
1449bded5d25Smrg    ])
1450bded5d25Smrg
1451bded5d25Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1452bded5d25Smrg# the path and the name of the doc stylesheet
1453bded5d25Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1454bded5d25Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1455bded5d25Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1456bded5d25Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1457bded5d25Smrgelse
1458bded5d25Smrg   AC_MSG_RESULT([no])
1459bded5d25Smrgfi
1460bded5d25Smrg
1461bded5d25SmrgAC_SUBST(XORG_SGML_PATH)
1462bded5d25SmrgAC_SUBST(STYLESHEET_SRCDIR)
1463bded5d25SmrgAC_SUBST(XSL_STYLESHEET)
1464bded5d25SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1465bded5d25Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1466bded5d25Smrg
1467123e2cc7Smrg# XORG_CHECK_LINUXDOC
1468123e2cc7Smrg# -------------------
1469123e2cc7Smrg# Minimum version: 1.0.0
14707da8b7e3Smrg#
1471123e2cc7Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1472123e2cc7Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1473123e2cc7Smrg# Whether or not the necessary tools and files are found can be checked
1474123e2cc7Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1475123e2cc7SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1476bded5d25SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1477bded5d25SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
14787da8b7e3Smrg
1479123e2cc7SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
14807da8b7e3Smrg
1481bded5d25SmrgAC_MSG_CHECKING([whether to build documentation])
14827da8b7e3Smrg
1483bded5d25Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1484123e2cc7Smrg   BUILDDOC=yes
1485123e2cc7Smrgelse
1486123e2cc7Smrg   BUILDDOC=no
1487123e2cc7Smrgfi
14887da8b7e3Smrg
1489123e2cc7SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
14907da8b7e3Smrg
1491123e2cc7SmrgAC_MSG_RESULT([$BUILDDOC])
14927da8b7e3Smrg
1493bded5d25SmrgAC_MSG_CHECKING([whether to build pdf documentation])
14947da8b7e3Smrg
1495bded5d25Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1496123e2cc7Smrg   BUILDPDFDOC=yes
1497123e2cc7Smrgelse
1498123e2cc7Smrg   BUILDPDFDOC=no
1499123e2cc7Smrgfi
15007da8b7e3Smrg
1501123e2cc7SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15027da8b7e3Smrg
1503123e2cc7SmrgAC_MSG_RESULT([$BUILDPDFDOC])
15047da8b7e3Smrg
1505bded5d25SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1506123e2cc7SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1507123e2cc7SmrgMAKE_PDF="$PS2PDF"
1508123e2cc7SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
15097da8b7e3Smrg
1510123e2cc7SmrgAC_SUBST(MAKE_TEXT)
1511123e2cc7SmrgAC_SUBST(MAKE_PS)
1512123e2cc7SmrgAC_SUBST(MAKE_PDF)
1513123e2cc7SmrgAC_SUBST(MAKE_HTML)
1514123e2cc7Smrg]) # XORG_CHECK_LINUXDOC
1515123e2cc7Smrg
1516123e2cc7Smrg# XORG_CHECK_DOCBOOK
1517123e2cc7Smrg# -------------------
1518123e2cc7Smrg# Minimum version: 1.0.0
1519123e2cc7Smrg#
1520123e2cc7Smrg# Checks for the ability to build output formats from SGML DocBook source.
1521123e2cc7Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1522123e2cc7Smrg# indicates whether the necessary tools and files are found and, if set,
1523123e2cc7Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1524123e2cc7SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1525bded5d25SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1526bded5d25Smrg
1527123e2cc7SmrgBUILDTXTDOC=no
1528123e2cc7SmrgBUILDPDFDOC=no
1529123e2cc7SmrgBUILDPSDOC=no
1530123e2cc7SmrgBUILDHTMLDOC=no
1531123e2cc7Smrg
1532123e2cc7SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1533123e2cc7SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1534123e2cc7SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1535123e2cc7SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1536123e2cc7Smrg
1537bded5d25SmrgAC_MSG_CHECKING([whether to build text documentation])
1538bded5d25Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1539123e2cc7Smrg   test x$BUILD_TXTDOC != xno; then
1540123e2cc7Smrg	BUILDTXTDOC=yes
1541123e2cc7Smrgfi
1542123e2cc7SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1543123e2cc7SmrgAC_MSG_RESULT([$BUILDTXTDOC])
15447da8b7e3Smrg
1545bded5d25SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1546bded5d25Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1547123e2cc7Smrg   test x$BUILD_PDFDOC != xno; then
1548123e2cc7Smrg	BUILDPDFDOC=yes
15497da8b7e3Smrgfi
1550123e2cc7SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1551123e2cc7SmrgAC_MSG_RESULT([$BUILDPDFDOC])
15527da8b7e3Smrg
1553bded5d25SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1554bded5d25Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1555123e2cc7Smrg   test x$BUILD_PSDOC != xno; then
1556123e2cc7Smrg	BUILDPSDOC=yes
1557123e2cc7Smrgfi
1558123e2cc7SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1559123e2cc7SmrgAC_MSG_RESULT([$BUILDPSDOC])
15607da8b7e3Smrg
1561bded5d25SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1562bded5d25Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1563123e2cc7Smrg   test x$BUILD_HTMLDOC != xno; then
1564123e2cc7Smrg	BUILDHTMLDOC=yes
1565123e2cc7Smrgfi
1566123e2cc7SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1567123e2cc7SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
15687da8b7e3Smrg
1569123e2cc7SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1570123e2cc7SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1571123e2cc7SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1572123e2cc7SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
15737da8b7e3Smrg
1574123e2cc7SmrgAC_SUBST(MAKE_TEXT)
1575123e2cc7SmrgAC_SUBST(MAKE_PS)
1576123e2cc7SmrgAC_SUBST(MAKE_PDF)
1577123e2cc7SmrgAC_SUBST(MAKE_HTML)
1578123e2cc7Smrg]) # XORG_CHECK_DOCBOOK
15797da8b7e3Smrg
1580bded5d25Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1581bded5d25Smrg# ----------------
1582bded5d25Smrg# Minimum version: 1.5.0
1583bded5d25Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1584bded5d25Smrg#
1585bded5d25Smrg# Documentation tools are not always available on all platforms and sometimes
1586bded5d25Smrg# not at the appropriate level. This macro enables a module to test for the
1587bded5d25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1588bded5d25Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1589bded5d25Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1590bded5d25Smrg# --with-xmlto assumes 'auto'.
1591bded5d25Smrg#
1592bded5d25Smrg# Interface to module:
1593bded5d25Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1594bded5d25Smrg# XMLTO:	returns the path of the xmlto program found
1595bded5d25Smrg#		returns the path set by the user in the environment
1596bded5d25Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1597bded5d25Smrg#		'no' user instructs the module not to use xmlto
1598bded5d25Smrg#
1599bded5d25Smrg# Added in version 1.10.0
1600bded5d25Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1601bded5d25Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1602bded5d25Smrg#
1603bded5d25Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1604bded5d25Smrg#
1605bded5d25SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1606bded5d25SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1607bded5d25Smrgm4_define([_defopt], m4_default([$2], [auto]))
1608bded5d25SmrgAC_ARG_WITH(xmlto,
1609bded5d25Smrg	AS_HELP_STRING([--with-xmlto],
1610bded5d25Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1611bded5d25Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1612bded5d25Smrgm4_undefine([_defopt])
1613bded5d25Smrg
1614bded5d25Smrgif test "x$use_xmlto" = x"auto"; then
1615bded5d25Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1616bded5d25Smrg   if test "x$XMLTO" = "x"; then
1617bded5d25Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1618bded5d25Smrg	have_xmlto=no
1619bded5d25Smrg   else
1620bded5d25Smrg        have_xmlto=yes
1621bded5d25Smrg   fi
1622bded5d25Smrgelif test "x$use_xmlto" = x"yes" ; then
1623bded5d25Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1624bded5d25Smrg   if test "x$XMLTO" = "x"; then
1625bded5d25Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1626bded5d25Smrg   fi
1627bded5d25Smrg   have_xmlto=yes
1628bded5d25Smrgelif test "x$use_xmlto" = x"no" ; then
1629bded5d25Smrg   if test "x$XMLTO" != "x"; then
1630bded5d25Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1631bded5d25Smrg   fi
1632bded5d25Smrg   have_xmlto=no
1633bded5d25Smrgelse
1634bded5d25Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1635bded5d25Smrgfi
1636bded5d25Smrg
1637bded5d25Smrg# Test for a minimum version of xmlto, if provided.
1638bded5d25Smrgm4_ifval([$1],
1639bded5d25Smrg[if test "$have_xmlto" = yes; then
1640bded5d25Smrg    # scrape the xmlto version
1641bded5d25Smrg    AC_MSG_CHECKING([the xmlto version])
1642bded5d25Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1643bded5d25Smrg    AC_MSG_RESULT([$xmlto_version])
1644bded5d25Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1645bded5d25Smrg        [if test "x$use_xmlto" = xauto; then
1646bded5d25Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1647bded5d25Smrg            have_xmlto=no
1648bded5d25Smrg        else
1649bded5d25Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1650bded5d25Smrg        fi])
1651bded5d25Smrgfi])
1652bded5d25Smrg
1653bded5d25Smrg# Test for the ability of xmlto to generate a text target
1654bded5d25Smrghave_xmlto_text=no
1655bded5d25Smrgcat > conftest.xml << "EOF"
1656bded5d25SmrgEOF
1657bded5d25SmrgAS_IF([test "$have_xmlto" = yes],
1658bded5d25Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1659bded5d25Smrg             [have_xmlto_text=yes],
1660bded5d25Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1661bded5d25Smrgrm -f conftest.xml
1662bded5d25SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1663bded5d25SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1664bded5d25Smrg]) # XORG_WITH_XMLTO
1665bded5d25Smrg
1666c3d5982aSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1667c3d5982aSmrg# --------------------------------------------
1668c3d5982aSmrg# Minimum version: 1.12.0
1669c3d5982aSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1670c3d5982aSmrg#
1671c3d5982aSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1672c3d5982aSmrg# XML-based language used for the transformation of XML documents.
1673c3d5982aSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1674c3d5982aSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1675c3d5982aSmrg# The XSLT processor is often used as a standalone tool for transformations.
1676c3d5982aSmrg# It should not be assumed that this tool is used only to work with documnetation.
1677c3d5982aSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1678c3d5982aSmrg#
1679c3d5982aSmrg# Interface to module:
1680c3d5982aSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1681c3d5982aSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1682c3d5982aSmrg#		 returns the path set by the user in the environment
1683c3d5982aSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1684c3d5982aSmrg#		  'no' user instructs the module not to use xsltproc
1685c3d5982aSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1686c3d5982aSmrg#
1687c3d5982aSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1688c3d5982aSmrg#
1689c3d5982aSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1690c3d5982aSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1691c3d5982aSmrg# Preserves the interface, should it be implemented later
1692c3d5982aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1693c3d5982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1694c3d5982aSmrgAC_ARG_WITH(xsltproc,
1695c3d5982aSmrg	AS_HELP_STRING([--with-xsltproc],
1696c3d5982aSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1697c3d5982aSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1698c3d5982aSmrgm4_undefine([_defopt])
1699c3d5982aSmrg
1700c3d5982aSmrgif test "x$use_xsltproc" = x"auto"; then
1701c3d5982aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1702c3d5982aSmrg   if test "x$XSLTPROC" = "x"; then
1703c3d5982aSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1704c3d5982aSmrg	have_xsltproc=no
1705c3d5982aSmrg   else
1706c3d5982aSmrg        have_xsltproc=yes
1707c3d5982aSmrg   fi
1708c3d5982aSmrgelif test "x$use_xsltproc" = x"yes" ; then
1709c3d5982aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1710c3d5982aSmrg   if test "x$XSLTPROC" = "x"; then
1711c3d5982aSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1712c3d5982aSmrg   fi
1713c3d5982aSmrg   have_xsltproc=yes
1714c3d5982aSmrgelif test "x$use_xsltproc" = x"no" ; then
1715c3d5982aSmrg   if test "x$XSLTPROC" != "x"; then
1716c3d5982aSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1717c3d5982aSmrg   fi
1718c3d5982aSmrg   have_xsltproc=no
1719c3d5982aSmrgelse
1720c3d5982aSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1721c3d5982aSmrgfi
1722c3d5982aSmrg
1723c3d5982aSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1724c3d5982aSmrg]) # XORG_WITH_XSLTPROC
1725c3d5982aSmrg
1726c3d5982aSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1727c3d5982aSmrg# ----------------------------------------
1728c3d5982aSmrg# Minimum version: 1.15.0
1729c3d5982aSmrg#
1730c3d5982aSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1731c3d5982aSmrg# scanning arbitrary text files, extracting information from those text files,
1732c3d5982aSmrg# and printing reports based on that information.
1733c3d5982aSmrg#
1734c3d5982aSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1735c3d5982aSmrg#
1736c3d5982aSmrg# Interface to module:
1737c3d5982aSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1738c3d5982aSmrg# PERL:	     returns the path of the perl program found
1739c3d5982aSmrg#	     returns the path set by the user in the environment
1740c3d5982aSmrg# --with-perl: 'yes' user instructs the module to use perl
1741c3d5982aSmrg#	       'no' user instructs the module not to use perl
1742c3d5982aSmrg# have_perl: returns yes if perl found in PATH or no
1743c3d5982aSmrg#
1744c3d5982aSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1745c3d5982aSmrg#
1746c3d5982aSmrgAC_DEFUN([XORG_WITH_PERL],[
1747c3d5982aSmrgAC_ARG_VAR([PERL], [Path to perl command])
1748c3d5982aSmrg# Preserves the interface, should it be implemented later
1749c3d5982aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1750c3d5982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1751c3d5982aSmrgAC_ARG_WITH(perl,
1752c3d5982aSmrg	AS_HELP_STRING([--with-perl],
1753c3d5982aSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1754c3d5982aSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1755c3d5982aSmrgm4_undefine([_defopt])
1756c3d5982aSmrg
1757c3d5982aSmrgif test "x$use_perl" = x"auto"; then
1758c3d5982aSmrg   AC_PATH_PROG([PERL], [perl])
1759c3d5982aSmrg   if test "x$PERL" = "x"; then
1760c3d5982aSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1761c3d5982aSmrg	have_perl=no
1762c3d5982aSmrg   else
1763c3d5982aSmrg        have_perl=yes
1764c3d5982aSmrg   fi
1765c3d5982aSmrgelif test "x$use_perl" = x"yes" ; then
1766c3d5982aSmrg   AC_PATH_PROG([PERL], [perl])
1767c3d5982aSmrg   if test "x$PERL" = "x"; then
1768c3d5982aSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1769c3d5982aSmrg   fi
1770c3d5982aSmrg   have_perl=yes
1771c3d5982aSmrgelif test "x$use_perl" = x"no" ; then
1772c3d5982aSmrg   if test "x$PERL" != "x"; then
1773c3d5982aSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1774c3d5982aSmrg   fi
1775c3d5982aSmrg   have_perl=no
1776c3d5982aSmrgelse
1777c3d5982aSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1778c3d5982aSmrgfi
1779c3d5982aSmrg
1780c3d5982aSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1781c3d5982aSmrg]) # XORG_WITH_PERL
1782c3d5982aSmrg
1783bded5d25Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1784bded5d25Smrg# ----------------
1785bded5d25Smrg# Minimum version: 1.5.0
1786bded5d25Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1787bded5d25Smrg#
1788bded5d25Smrg# Documentation tools are not always available on all platforms and sometimes
1789bded5d25Smrg# not at the appropriate level. This macro enables a module to test for the
1790bded5d25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1791bded5d25Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1792bded5d25Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1793bded5d25Smrg# --with-asciidoc assumes 'auto'.
1794bded5d25Smrg#
1795bded5d25Smrg# Interface to module:
1796bded5d25Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1797bded5d25Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1798bded5d25Smrg#		 returns the path set by the user in the environment
1799bded5d25Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1800bded5d25Smrg#		  'no' user instructs the module not to use asciidoc
1801bded5d25Smrg#
1802bded5d25Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1803bded5d25Smrg#
1804bded5d25SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1805bded5d25SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1806bded5d25Smrgm4_define([_defopt], m4_default([$2], [auto]))
1807bded5d25SmrgAC_ARG_WITH(asciidoc,
1808bded5d25Smrg	AS_HELP_STRING([--with-asciidoc],
1809bded5d25Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1810bded5d25Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1811bded5d25Smrgm4_undefine([_defopt])
1812bded5d25Smrg
1813bded5d25Smrgif test "x$use_asciidoc" = x"auto"; then
1814bded5d25Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1815bded5d25Smrg   if test "x$ASCIIDOC" = "x"; then
1816bded5d25Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1817bded5d25Smrg	have_asciidoc=no
1818bded5d25Smrg   else
1819bded5d25Smrg        have_asciidoc=yes
1820bded5d25Smrg   fi
1821bded5d25Smrgelif test "x$use_asciidoc" = x"yes" ; then
1822bded5d25Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1823bded5d25Smrg   if test "x$ASCIIDOC" = "x"; then
1824bded5d25Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1825bded5d25Smrg   fi
1826bded5d25Smrg   have_asciidoc=yes
1827bded5d25Smrgelif test "x$use_asciidoc" = x"no" ; then
1828bded5d25Smrg   if test "x$ASCIIDOC" != "x"; then
1829bded5d25Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1830bded5d25Smrg   fi
1831bded5d25Smrg   have_asciidoc=no
1832bded5d25Smrgelse
1833bded5d25Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1834bded5d25Smrgfi
1835bded5d25Smrgm4_ifval([$1],
1836bded5d25Smrg[if test "$have_asciidoc" = yes; then
1837bded5d25Smrg    # scrape the asciidoc version
1838bded5d25Smrg    AC_MSG_CHECKING([the asciidoc version])
1839bded5d25Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1840bded5d25Smrg    AC_MSG_RESULT([$asciidoc_version])
1841bded5d25Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1842bded5d25Smrg        [if test "x$use_asciidoc" = xauto; then
1843bded5d25Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1844bded5d25Smrg            have_asciidoc=no
1845bded5d25Smrg        else
1846bded5d25Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1847bded5d25Smrg        fi])
1848bded5d25Smrgfi])
1849bded5d25SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1850bded5d25Smrg]) # XORG_WITH_ASCIIDOC
1851bded5d25Smrg
1852bded5d25Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1853bded5d25Smrg# --------------------------------
1854bded5d25Smrg# Minimum version: 1.5.0
1855bded5d25Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1856bded5d25Smrg#
1857bded5d25Smrg# Documentation tools are not always available on all platforms and sometimes
1858bded5d25Smrg# not at the appropriate level. This macro enables a module to test for the
1859bded5d25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1860bded5d25Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1861bded5d25Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1862bded5d25Smrg# --with-doxygen assumes 'auto'.
1863bded5d25Smrg#
1864bded5d25Smrg# Interface to module:
1865bded5d25Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1866bded5d25Smrg# DOXYGEN:	 returns the path of the doxygen program found
1867bded5d25Smrg#		 returns the path set by the user in the environment
1868bded5d25Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1869bded5d25Smrg#		  'no' user instructs the module not to use doxygen
1870bded5d25Smrg#
1871bded5d25Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1872bded5d25Smrg#
1873bded5d25SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1874bded5d25SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1875bded5d25Smrgm4_define([_defopt], m4_default([$2], [auto]))
1876bded5d25SmrgAC_ARG_WITH(doxygen,
1877bded5d25Smrg	AS_HELP_STRING([--with-doxygen],
1878bded5d25Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1879bded5d25Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1880bded5d25Smrgm4_undefine([_defopt])
1881bded5d25Smrg
1882bded5d25Smrgif test "x$use_doxygen" = x"auto"; then
1883bded5d25Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1884bded5d25Smrg   if test "x$DOXYGEN" = "x"; then
1885bded5d25Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1886bded5d25Smrg	have_doxygen=no
1887bded5d25Smrg   else
1888bded5d25Smrg        have_doxygen=yes
1889bded5d25Smrg   fi
1890bded5d25Smrgelif test "x$use_doxygen" = x"yes" ; then
1891bded5d25Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1892bded5d25Smrg   if test "x$DOXYGEN" = "x"; then
1893bded5d25Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1894bded5d25Smrg   fi
1895bded5d25Smrg   have_doxygen=yes
1896bded5d25Smrgelif test "x$use_doxygen" = x"no" ; then
1897bded5d25Smrg   if test "x$DOXYGEN" != "x"; then
1898bded5d25Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1899bded5d25Smrg   fi
1900bded5d25Smrg   have_doxygen=no
1901bded5d25Smrgelse
1902bded5d25Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1903bded5d25Smrgfi
1904bded5d25Smrgm4_ifval([$1],
1905bded5d25Smrg[if test "$have_doxygen" = yes; then
1906bded5d25Smrg    # scrape the doxygen version
1907bded5d25Smrg    AC_MSG_CHECKING([the doxygen version])
1908bded5d25Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1909bded5d25Smrg    AC_MSG_RESULT([$doxygen_version])
1910bded5d25Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1911bded5d25Smrg        [if test "x$use_doxygen" = xauto; then
1912bded5d25Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1913bded5d25Smrg            have_doxygen=no
1914bded5d25Smrg        else
1915bded5d25Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1916bded5d25Smrg        fi])
1917bded5d25Smrgfi])
1918bded5d25SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1919bded5d25Smrg]) # XORG_WITH_DOXYGEN
1920bded5d25Smrg
1921bded5d25Smrg# XORG_WITH_GROFF([DEFAULT])
1922bded5d25Smrg# ----------------
1923bded5d25Smrg# Minimum version: 1.6.0
1924bded5d25Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1925bded5d25Smrg#
1926bded5d25Smrg# Documentation tools are not always available on all platforms and sometimes
1927bded5d25Smrg# not at the appropriate level. This macro enables a module to test for the
1928bded5d25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1929bded5d25Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1930bded5d25Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1931bded5d25Smrg# --with-groff assumes 'auto'.
1932bded5d25Smrg#
1933bded5d25Smrg# Interface to module:
1934bded5d25Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1935bded5d25Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1936bded5d25Smrg# HAVE_GROFF_MS: the -ms macros package
1937bded5d25Smrg# GROFF:	 returns the path of the groff program found
1938bded5d25Smrg#		 returns the path set by the user in the environment
1939bded5d25Smrg# --with-groff:	 'yes' user instructs the module to use groff
1940bded5d25Smrg#		 'no' user instructs the module not to use groff
1941bded5d25Smrg#
1942bded5d25Smrg# Added in version 1.9.0:
1943bded5d25Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1944bded5d25Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1945bded5d25Smrg#		   psselect from the psutils package.
1946bded5d25Smrg#		   the ghostcript package. Refer to the grohtml man pages
1947bded5d25Smrg#
1948bded5d25Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1949bded5d25Smrg#
1950bded5d25Smrg# OS and distros often splits groff in a basic and full package, the former
1951bded5d25Smrg# having the groff program and the later having devices, fonts and macros
1952bded5d25Smrg# Checking for the groff executable is not enough.
1953bded5d25Smrg#
1954bded5d25Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1955bded5d25Smrg# unset HAVE_GROFF or GROFF env variables.
1956bded5d25Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1957bded5d25Smrg#
1958bded5d25SmrgAC_DEFUN([XORG_WITH_GROFF],[
1959bded5d25SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1960bded5d25Smrgm4_define([_defopt], m4_default([$1], [auto]))
1961bded5d25SmrgAC_ARG_WITH(groff,
1962bded5d25Smrg	AS_HELP_STRING([--with-groff],
1963bded5d25Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1964bded5d25Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1965bded5d25Smrgm4_undefine([_defopt])
1966bded5d25Smrg
1967bded5d25Smrgif test "x$use_groff" = x"auto"; then
1968bded5d25Smrg   AC_PATH_PROG([GROFF], [groff])
1969bded5d25Smrg   if test "x$GROFF" = "x"; then
1970bded5d25Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1971bded5d25Smrg	have_groff=no
1972bded5d25Smrg   else
1973bded5d25Smrg        have_groff=yes
1974bded5d25Smrg   fi
1975bded5d25Smrgelif test "x$use_groff" = x"yes" ; then
1976bded5d25Smrg   AC_PATH_PROG([GROFF], [groff])
1977bded5d25Smrg   if test "x$GROFF" = "x"; then
1978bded5d25Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1979bded5d25Smrg   fi
1980bded5d25Smrg   have_groff=yes
1981bded5d25Smrgelif test "x$use_groff" = x"no" ; then
1982bded5d25Smrg   if test "x$GROFF" != "x"; then
1983bded5d25Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1984bded5d25Smrg   fi
1985bded5d25Smrg   have_groff=no
1986bded5d25Smrgelse
1987bded5d25Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1988bded5d25Smrgfi
1989bded5d25Smrg
1990bded5d25Smrg# We have groff, test for the presence of the macro packages
1991bded5d25Smrgif test "x$have_groff" = x"yes"; then
1992bded5d25Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1993bded5d25Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1994bded5d25Smrg        groff_ms_works=yes
1995bded5d25Smrg    else
1996bded5d25Smrg        groff_ms_works=no
1997bded5d25Smrg    fi
1998bded5d25Smrg    AC_MSG_RESULT([$groff_ms_works])
1999bded5d25Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2000bded5d25Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2001bded5d25Smrg        groff_mm_works=yes
2002bded5d25Smrg    else
2003bded5d25Smrg        groff_mm_works=no
2004bded5d25Smrg    fi
2005bded5d25Smrg    AC_MSG_RESULT([$groff_mm_works])
2006bded5d25Smrgfi
2007bded5d25Smrg
2008bded5d25Smrg# We have groff, test for HTML dependencies, one command per package
2009bded5d25Smrgif test "x$have_groff" = x"yes"; then
2010bded5d25Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2011bded5d25Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2012bded5d25Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2013bded5d25Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2014bded5d25Smrg      have_groff_html=yes
2015bded5d25Smrg   else
2016bded5d25Smrg      have_groff_html=no
2017bded5d25Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2018bded5d25Smrg   fi
2019bded5d25Smrgfi
2020bded5d25Smrg
2021bded5d25Smrg# Set Automake conditionals for Makefiles
2022bded5d25SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2023bded5d25SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2024bded5d25SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2025bded5d25SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2026bded5d25Smrg]) # XORG_WITH_GROFF
2027bded5d25Smrg
2028c3d5982aSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2029c3d5982aSmrg# ---------------------------------------
2030bded5d25Smrg# Minimum version: 1.6.0
2031bded5d25Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2032c3d5982aSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2033bded5d25Smrg#
2034bded5d25Smrg# Documentation tools are not always available on all platforms and sometimes
2035bded5d25Smrg# not at the appropriate level. This macro enables a module to test for the
2036bded5d25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2037bded5d25Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2038bded5d25Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2039bded5d25Smrg# --with-fop assumes 'auto'.
2040bded5d25Smrg#
2041bded5d25Smrg# Interface to module:
2042bded5d25Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2043bded5d25Smrg# FOP:	 	returns the path of the fop program found
2044bded5d25Smrg#		returns the path set by the user in the environment
2045bded5d25Smrg# --with-fop: 	'yes' user instructs the module to use fop
2046bded5d25Smrg#		'no' user instructs the module not to use fop
2047bded5d25Smrg#
2048bded5d25Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2049bded5d25Smrg#
2050bded5d25SmrgAC_DEFUN([XORG_WITH_FOP],[
2051bded5d25SmrgAC_ARG_VAR([FOP], [Path to fop command])
2052c3d5982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2053bded5d25SmrgAC_ARG_WITH(fop,
2054bded5d25Smrg	AS_HELP_STRING([--with-fop],
2055bded5d25Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2056bded5d25Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2057bded5d25Smrgm4_undefine([_defopt])
2058bded5d25Smrg
2059bded5d25Smrgif test "x$use_fop" = x"auto"; then
2060bded5d25Smrg   AC_PATH_PROG([FOP], [fop])
2061bded5d25Smrg   if test "x$FOP" = "x"; then
2062bded5d25Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2063bded5d25Smrg	have_fop=no
2064bded5d25Smrg   else
2065bded5d25Smrg        have_fop=yes
2066bded5d25Smrg   fi
2067bded5d25Smrgelif test "x$use_fop" = x"yes" ; then
2068bded5d25Smrg   AC_PATH_PROG([FOP], [fop])
2069bded5d25Smrg   if test "x$FOP" = "x"; then
2070bded5d25Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2071bded5d25Smrg   fi
2072bded5d25Smrg   have_fop=yes
2073bded5d25Smrgelif test "x$use_fop" = x"no" ; then
2074bded5d25Smrg   if test "x$FOP" != "x"; then
2075bded5d25Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2076bded5d25Smrg   fi
2077bded5d25Smrg   have_fop=no
2078bded5d25Smrgelse
2079bded5d25Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2080bded5d25Smrgfi
2081c3d5982aSmrg
2082c3d5982aSmrg# Test for a minimum version of fop, if provided.
2083c3d5982aSmrgm4_ifval([$1],
2084c3d5982aSmrg[if test "$have_fop" = yes; then
2085c3d5982aSmrg    # scrape the fop version
2086c3d5982aSmrg    AC_MSG_CHECKING([for fop minimum version])
2087c3d5982aSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2088c3d5982aSmrg    AC_MSG_RESULT([$fop_version])
2089c3d5982aSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2090c3d5982aSmrg        [if test "x$use_fop" = xauto; then
2091c3d5982aSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2092c3d5982aSmrg            have_fop=no
2093c3d5982aSmrg        else
2094c3d5982aSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2095c3d5982aSmrg        fi])
2096c3d5982aSmrgfi])
2097bded5d25SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2098bded5d25Smrg]) # XORG_WITH_FOP
2099bded5d25Smrg
2100bded5d25Smrg# XORG_WITH_PS2PDF([DEFAULT])
2101bded5d25Smrg# ----------------
2102bded5d25Smrg# Minimum version: 1.6.0
2103bded5d25Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2104bded5d25Smrg#
2105bded5d25Smrg# Documentation tools are not always available on all platforms and sometimes
2106bded5d25Smrg# not at the appropriate level. This macro enables a module to test for the
2107bded5d25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2108bded5d25Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2109bded5d25Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2110bded5d25Smrg# --with-ps2pdf assumes 'auto'.
2111bded5d25Smrg#
2112bded5d25Smrg# Interface to module:
2113bded5d25Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2114bded5d25Smrg# PS2PDF:	returns the path of the ps2pdf program found
2115bded5d25Smrg#		returns the path set by the user in the environment
2116bded5d25Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2117bded5d25Smrg#		 'no' user instructs the module not to use ps2pdf
2118bded5d25Smrg#
2119bded5d25Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2120bded5d25Smrg#
2121bded5d25SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2122bded5d25SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2123bded5d25Smrgm4_define([_defopt], m4_default([$1], [auto]))
2124bded5d25SmrgAC_ARG_WITH(ps2pdf,
2125bded5d25Smrg	AS_HELP_STRING([--with-ps2pdf],
2126bded5d25Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2127bded5d25Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2128bded5d25Smrgm4_undefine([_defopt])
2129bded5d25Smrg
2130bded5d25Smrgif test "x$use_ps2pdf" = x"auto"; then
2131bded5d25Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2132bded5d25Smrg   if test "x$PS2PDF" = "x"; then
2133bded5d25Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2134bded5d25Smrg	have_ps2pdf=no
2135bded5d25Smrg   else
2136bded5d25Smrg        have_ps2pdf=yes
2137bded5d25Smrg   fi
2138bded5d25Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2139bded5d25Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2140bded5d25Smrg   if test "x$PS2PDF" = "x"; then
2141bded5d25Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2142bded5d25Smrg   fi
2143bded5d25Smrg   have_ps2pdf=yes
2144bded5d25Smrgelif test "x$use_ps2pdf" = x"no" ; then
2145bded5d25Smrg   if test "x$PS2PDF" != "x"; then
2146bded5d25Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2147bded5d25Smrg   fi
2148bded5d25Smrg   have_ps2pdf=no
2149bded5d25Smrgelse
2150bded5d25Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2151bded5d25Smrgfi
2152bded5d25SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2153bded5d25Smrg]) # XORG_WITH_PS2PDF
2154bded5d25Smrg
2155bded5d25Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2156bded5d25Smrg# ----------------
2157bded5d25Smrg# Minimum version: 1.6.0
2158bded5d25Smrg#
2159bded5d25Smrg# Documentation tools are not always available on all platforms and sometimes
2160bded5d25Smrg# not at the appropriate level. This macro enables a builder to skip all
2161bded5d25Smrg# documentation targets except traditional man pages.
2162bded5d25Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2163bded5d25Smrg# maximum flexibilty in controlling documentation building.
2164bded5d25Smrg# Refer to:
2165bded5d25Smrg# XORG_WITH_XMLTO         --with-xmlto
2166bded5d25Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2167bded5d25Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2168bded5d25Smrg# XORG_WITH_FOP           --with-fop
2169bded5d25Smrg# XORG_WITH_GROFF         --with-groff
2170bded5d25Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2171bded5d25Smrg#
2172bded5d25Smrg# Interface to module:
2173bded5d25Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2174bded5d25Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2175bded5d25Smrg#		 'no' user instructs the module not to generate docs
2176bded5d25Smrg# parm1:	specify the default value, yes or no.
2177bded5d25Smrg#
2178bded5d25SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2179c3d5982aSmrgm4_define([docs_default], m4_default([$1], [yes]))
2180bded5d25SmrgAC_ARG_ENABLE(docs,
2181bded5d25Smrg	AS_HELP_STRING([--enable-docs],
2182c3d5982aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2183c3d5982aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2184c3d5982aSmrgm4_undefine([docs_default])
2185bded5d25SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2186bded5d25SmrgAC_MSG_CHECKING([whether to build documentation])
2187bded5d25SmrgAC_MSG_RESULT([$build_docs])
2188bded5d25Smrg]) # XORG_ENABLE_DOCS
2189bded5d25Smrg
2190bded5d25Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2191bded5d25Smrg# ----------------
2192bded5d25Smrg# Minimum version: 1.6.0
2193bded5d25Smrg#
2194bded5d25Smrg# This macro enables a builder to skip all developer documentation.
2195bded5d25Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2196bded5d25Smrg# maximum flexibilty in controlling documentation building.
2197bded5d25Smrg# Refer to:
2198bded5d25Smrg# XORG_WITH_XMLTO         --with-xmlto
2199bded5d25Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2200bded5d25Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2201bded5d25Smrg# XORG_WITH_FOP           --with-fop
2202bded5d25Smrg# XORG_WITH_GROFF         --with-groff
2203bded5d25Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2204bded5d25Smrg#
2205bded5d25Smrg# Interface to module:
2206bded5d25Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2207bded5d25Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2208bded5d25Smrg#			'no' user instructs the module not to generate developer docs
2209bded5d25Smrg# parm1:		specify the default value, yes or no.
2210bded5d25Smrg#
2211bded5d25SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2212bded5d25Smrgm4_define([devel_default], m4_default([$1], [yes]))
2213bded5d25SmrgAC_ARG_ENABLE(devel-docs,
2214bded5d25Smrg	AS_HELP_STRING([--enable-devel-docs],
2215bded5d25Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2216bded5d25Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2217bded5d25Smrgm4_undefine([devel_default])
2218bded5d25SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2219bded5d25SmrgAC_MSG_CHECKING([whether to build developer documentation])
2220bded5d25SmrgAC_MSG_RESULT([$build_devel_docs])
2221bded5d25Smrg]) # XORG_ENABLE_DEVEL_DOCS
2222bded5d25Smrg
2223bded5d25Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2224bded5d25Smrg# ----------------
2225bded5d25Smrg# Minimum version: 1.6.0
2226bded5d25Smrg#
2227bded5d25Smrg# This macro enables a builder to skip all functional specification targets.
2228bded5d25Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2229bded5d25Smrg# maximum flexibilty in controlling documentation building.
2230bded5d25Smrg# Refer to:
2231bded5d25Smrg# XORG_WITH_XMLTO         --with-xmlto
2232bded5d25Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2233bded5d25Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2234bded5d25Smrg# XORG_WITH_FOP           --with-fop
2235bded5d25Smrg# XORG_WITH_GROFF         --with-groff
2236bded5d25Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2237bded5d25Smrg#
2238bded5d25Smrg# Interface to module:
2239bded5d25Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2240bded5d25Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2241bded5d25Smrg#			'no' user instructs the module not to generate specs
2242bded5d25Smrg# parm1:		specify the default value, yes or no.
2243bded5d25Smrg#
2244bded5d25SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2245bded5d25Smrgm4_define([spec_default], m4_default([$1], [yes]))
2246bded5d25SmrgAC_ARG_ENABLE(specs,
2247bded5d25Smrg	AS_HELP_STRING([--enable-specs],
2248bded5d25Smrg	   [Enable building the specs (default: ]spec_default[)]),
2249bded5d25Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2250bded5d25Smrgm4_undefine([spec_default])
2251bded5d25SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2252bded5d25SmrgAC_MSG_CHECKING([whether to build functional specifications])
2253bded5d25SmrgAC_MSG_RESULT([$build_specs])
2254bded5d25Smrg]) # XORG_ENABLE_SPECS
2255bded5d25Smrg
2256c3d5982aSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2257c3d5982aSmrg# ----------------------------------------------
2258c3d5982aSmrg# Minimum version: 1.13.0
2259c3d5982aSmrg#
2260c3d5982aSmrg# This macro enables a builder to enable/disable unit testing
2261c3d5982aSmrg# It makes no assumption about the test cases implementation
2262c3d5982aSmrg# Test cases may or may not use Automake "Support for test suites"
2263c3d5982aSmrg# They may or may not use the software utility library GLib
2264c3d5982aSmrg#
2265c3d5982aSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2266c3d5982aSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2267c3d5982aSmrg# The variable enable_unit_tests is used by other macros in this file.
2268c3d5982aSmrg#
2269c3d5982aSmrg# Interface to module:
2270c3d5982aSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2271c3d5982aSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2272c3d5982aSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2273c3d5982aSmrg#			'no' user instructs the module not to build tests
2274c3d5982aSmrg# parm1:		specify the default value, yes or no.
2275c3d5982aSmrg#
2276c3d5982aSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2277c3d5982aSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2278c3d5982aSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2279c3d5982aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2280c3d5982aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2281c3d5982aSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2282c3d5982aSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2283c3d5982aSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2284c3d5982aSmrgm4_undefine([_defopt])
2285c3d5982aSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2286c3d5982aSmrgAC_MSG_CHECKING([whether to build unit test cases])
2287c3d5982aSmrgAC_MSG_RESULT([$enable_unit_tests])
2288c3d5982aSmrg]) # XORG_ENABLE_UNIT_TESTS
2289c3d5982aSmrg
2290c3d5982aSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2291c3d5982aSmrg# ------------------------------------------------------
2292c3d5982aSmrg# Minimum version: 1.17.0
2293c3d5982aSmrg#
2294c3d5982aSmrg# This macro enables a builder to enable/disable integration testing
2295c3d5982aSmrg# It makes no assumption about the test cases' implementation
2296c3d5982aSmrg# Test cases may or may not use Automake "Support for test suites"
2297c3d5982aSmrg#
2298c3d5982aSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2299c3d5982aSmrg# usually requires less dependencies and may be built and run under less
2300c3d5982aSmrg# stringent environments than integration tests.
2301c3d5982aSmrg#
2302c3d5982aSmrg# Interface to module:
2303c3d5982aSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2304c3d5982aSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2305c3d5982aSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2306c3d5982aSmrg#                             'no' user instructs the module not to build tests
2307c3d5982aSmrg# parm1:                      specify the default value, yes or no.
2308c3d5982aSmrg#
2309c3d5982aSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2310c3d5982aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2311c3d5982aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2312c3d5982aSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2313c3d5982aSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2314c3d5982aSmrg	[enable_integration_tests=$enableval],
2315c3d5982aSmrg	[enable_integration_tests=]_defopt)
2316c3d5982aSmrgm4_undefine([_defopt])
2317c3d5982aSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2318c3d5982aSmrg	[test "x$enable_integration_tests" != xno])
2319c3d5982aSmrgAC_MSG_CHECKING([whether to build unit test cases])
2320c3d5982aSmrgAC_MSG_RESULT([$enable_integration_tests])
2321c3d5982aSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2322c3d5982aSmrg
2323c3d5982aSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2324c3d5982aSmrg# ----------------------------------------
2325c3d5982aSmrg# Minimum version: 1.13.0
2326c3d5982aSmrg#
2327c3d5982aSmrg# GLib is a library which provides advanced data structures and functions.
2328c3d5982aSmrg# This macro enables a module to test for the presence of Glib.
2329c3d5982aSmrg#
2330c3d5982aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2331c3d5982aSmrg# Otherwise the value of $enable_unit_tests is blank.
2332c3d5982aSmrg#
2333c3d5982aSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2334c3d5982aSmrg# test support usually requires less dependencies and may be built and run under
2335c3d5982aSmrg# less stringent environments than integration tests.
2336c3d5982aSmrg#
2337c3d5982aSmrg# Interface to module:
2338c3d5982aSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2339c3d5982aSmrg# with_glib: used in configure.ac to know if GLib has been found
2340c3d5982aSmrg# --with-glib:	'yes' user instructs the module to use glib
2341c3d5982aSmrg#		'no' user instructs the module not to use glib
2342c3d5982aSmrg#
2343c3d5982aSmrgAC_DEFUN([XORG_WITH_GLIB],[
2344c3d5982aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2345c3d5982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2346c3d5982aSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2347c3d5982aSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2348c3d5982aSmrg	[with_glib=$withval], [with_glib=]_defopt)
2349c3d5982aSmrgm4_undefine([_defopt])
2350c3d5982aSmrg
2351c3d5982aSmrghave_glib=no
2352c3d5982aSmrg# Do not probe GLib if user explicitly disabled unit testing
2353c3d5982aSmrgif test "x$enable_unit_tests" != x"no"; then
2354c3d5982aSmrg  # Do not probe GLib if user explicitly disabled it
2355c3d5982aSmrg  if test "x$with_glib" != x"no"; then
2356c3d5982aSmrg    m4_ifval(
2357c3d5982aSmrg      [$1],
2358c3d5982aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2359c3d5982aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2360c3d5982aSmrg    )
2361c3d5982aSmrg  fi
2362c3d5982aSmrgfi
2363c3d5982aSmrg
2364c3d5982aSmrg# Not having GLib when unit testing has been explicitly requested is an error
2365c3d5982aSmrgif test "x$enable_unit_tests" = x"yes"; then
2366c3d5982aSmrg  if test "x$have_glib" = x"no"; then
2367c3d5982aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2368c3d5982aSmrg  fi
2369c3d5982aSmrgfi
2370c3d5982aSmrg
2371c3d5982aSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2372c3d5982aSmrgif test "x$enable_unit_tests" = x"no"; then
2373c3d5982aSmrg  if test "x$with_glib" = x"yes"; then
2374c3d5982aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2375c3d5982aSmrg  fi
2376c3d5982aSmrgfi
2377c3d5982aSmrg
2378c3d5982aSmrg# Not having GLib when it has been explicitly requested is an error
2379c3d5982aSmrgif test "x$with_glib" = x"yes"; then
2380c3d5982aSmrg  if test "x$have_glib" = x"no"; then
2381c3d5982aSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2382c3d5982aSmrg  fi
2383c3d5982aSmrgfi
2384c3d5982aSmrg
2385c3d5982aSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2386c3d5982aSmrg]) # XORG_WITH_GLIB
2387c3d5982aSmrg
2388c3d5982aSmrg# XORG_LD_WRAP([required|optional])
2389c3d5982aSmrg# ---------------------------------
2390c3d5982aSmrg# Minimum version: 1.13.0
2391c3d5982aSmrg#
2392c3d5982aSmrg# Check if linker supports -wrap, passed via compiler flags
2393c3d5982aSmrg#
2394c3d5982aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2395c3d5982aSmrg# Otherwise the value of $enable_unit_tests is blank.
2396c3d5982aSmrg#
2397c3d5982aSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2398c3d5982aSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2399c3d5982aSmrg# available, an argument of "optional" allows use when some unit tests require
2400c3d5982aSmrg# ld -wrap and others do not.
2401c3d5982aSmrg#
2402c3d5982aSmrgAC_DEFUN([XORG_LD_WRAP],[
2403c3d5982aSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2404c3d5982aSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2405c3d5982aSmrg                      void __wrap_exit(int status) { return; }],
2406c3d5982aSmrg                     [exit(0);])])
2407c3d5982aSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2408c3d5982aSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2409c3d5982aSmrg  if test "x$have_ld_wrap" = x"no"; then
2410c3d5982aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2411c3d5982aSmrg  fi
2412c3d5982aSmrgfi
2413c3d5982aSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2414c3d5982aSmrg#
2415c3d5982aSmrg]) # XORG_LD_WRAP
2416c3d5982aSmrg
2417c3d5982aSmrg# XORG_CHECK_LINKER_FLAGS
2418c3d5982aSmrg# -----------------------
2419c3d5982aSmrg# SYNOPSIS
2420c3d5982aSmrg#
2421c3d5982aSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2422c3d5982aSmrg#
2423c3d5982aSmrg# DESCRIPTION
2424c3d5982aSmrg#
2425c3d5982aSmrg#   Check whether the given linker FLAGS work with the current language's
2426c3d5982aSmrg#   linker, or whether they give an error.
2427c3d5982aSmrg#
2428c3d5982aSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2429c3d5982aSmrg#   success/failure.
2430c3d5982aSmrg#
2431c3d5982aSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2432c3d5982aSmrg#
2433c3d5982aSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2434c3d5982aSmrg#
2435c3d5982aSmrg# LICENSE
2436c3d5982aSmrg#
2437c3d5982aSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2438c3d5982aSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2439c3d5982aSmrg#   Copyright (c) 2009 Matteo Frigo
2440c3d5982aSmrg#
2441c3d5982aSmrg#   This program is free software: you can redistribute it and/or modify it
2442c3d5982aSmrg#   under the terms of the GNU General Public License as published by the
2443c3d5982aSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2444c3d5982aSmrg#   option) any later version.
2445c3d5982aSmrg#
2446c3d5982aSmrg#   This program is distributed in the hope that it will be useful, but
2447c3d5982aSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2448c3d5982aSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2449c3d5982aSmrg#   Public License for more details.
2450c3d5982aSmrg#
2451c3d5982aSmrg#   You should have received a copy of the GNU General Public License along
2452c3d5982aSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2453c3d5982aSmrg#
2454c3d5982aSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2455c3d5982aSmrg#   gives unlimited permission to copy, distribute and modify the configure
2456c3d5982aSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2457c3d5982aSmrg#   need not follow the terms of the GNU General Public License when using
2458c3d5982aSmrg#   or distributing such scripts, even though portions of the text of the
2459c3d5982aSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2460c3d5982aSmrg#   all other use of the material that constitutes the Autoconf Macro.
2461c3d5982aSmrg#
2462c3d5982aSmrg#   This special exception to the GPL applies to versions of the Autoconf
2463c3d5982aSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2464c3d5982aSmrg#   modified version of the Autoconf Macro, you may extend this special
2465c3d5982aSmrg#   exception to the GPL to apply to your modified version as well.#
2466c3d5982aSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2467c3d5982aSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2468c3d5982aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2469c3d5982aSmrgAS_LITERAL_IF([$1],
2470c3d5982aSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2471c3d5982aSmrg      ax_save_FLAGS=$LDFLAGS
2472c3d5982aSmrg      LDFLAGS="$1"
2473c3d5982aSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2474c3d5982aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2475c3d5982aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2476c3d5982aSmrg      LDFLAGS=$ax_save_FLAGS])],
2477c3d5982aSmrg  [ax_save_FLAGS=$LDFLAGS
2478c3d5982aSmrg   LDFLAGS="$1"
2479c3d5982aSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2480c3d5982aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2481c3d5982aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2482c3d5982aSmrg   LDFLAGS=$ax_save_FLAGS])
2483c3d5982aSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2484c3d5982aSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2485c3d5982aSmrgif test "x$xorg_check_linker_flags" = xyes; then
2486c3d5982aSmrg	m4_default([$2], :)
2487c3d5982aSmrgelse
2488c3d5982aSmrg	m4_default([$3], :)
2489c3d5982aSmrgfi
2490c3d5982aSmrg]) # XORG_CHECK_LINKER_FLAGS
2491c3d5982aSmrg
2492c3d5982aSmrg# XORG_MEMORY_CHECK_FLAGS
2493c3d5982aSmrg# -----------------------
2494c3d5982aSmrg# Minimum version: 1.16.0
2495c3d5982aSmrg#
2496c3d5982aSmrg# This macro attempts to find appropriate memory checking functionality
2497c3d5982aSmrg# for various platforms which unit testing code may use to catch various
2498c3d5982aSmrg# forms of memory allocation and access errors in testing.
2499c3d5982aSmrg#
2500c3d5982aSmrg# Interface to module:
2501c3d5982aSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2502c3d5982aSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2503c3d5982aSmrg#
2504c3d5982aSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2505c3d5982aSmrg#
2506c3d5982aSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2507c3d5982aSmrg
2508c3d5982aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2509c3d5982aSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2510c3d5982aSmrg           [Environment variables to enable memory checking in tests])
2511c3d5982aSmrg
2512c3d5982aSmrg# Check for different types of support on different platforms
2513c3d5982aSmrgcase $host_os in
2514c3d5982aSmrg    solaris*)
2515c3d5982aSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2516c3d5982aSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2517c3d5982aSmrg        ;;
2518c3d5982aSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2519c3d5982aSmrg        # both directly and inverted, so should not be 0 or 255.
2520c3d5982aSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2521c3d5982aSmrg        ;;
2522c3d5982aSmrg    darwin*)
2523c3d5982aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2524c3d5982aSmrg        ;;
2525c3d5982aSmrg    *bsd*)
2526c3d5982aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2527c3d5982aSmrg        ;;
2528c3d5982aSmrgesac
2529c3d5982aSmrg
2530c3d5982aSmrg# User supplied flags override default flags
2531c3d5982aSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2532c3d5982aSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2533c3d5982aSmrgfi
2534c3d5982aSmrg
2535c3d5982aSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2536c3d5982aSmrg]) # XORG_WITH_LINT
2537c3d5982aSmrg
2538123e2cc7Smrg# XORG_CHECK_MALLOC_ZERO
2539123e2cc7Smrg# ----------------------
2540123e2cc7Smrg# Minimum version: 1.0.0
2541123e2cc7Smrg#
2542123e2cc7Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2543123e2cc7Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2544123e2cc7Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2545123e2cc7SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2546123e2cc7SmrgAC_ARG_ENABLE(malloc0returnsnull,
2547123e2cc7Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2548123e2cc7Smrg		       [malloc(0) returns NULL (default: auto)]),
2549123e2cc7Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2550123e2cc7Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
25517da8b7e3Smrg
2552123e2cc7SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2553123e2cc7Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2554c3d5982aSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2555c3d5982aSmrg#include <stdlib.h>
2556c3d5982aSmrg],[
2557123e2cc7Smrg    char *m0, *r0, *c0, *p;
2558123e2cc7Smrg    m0 = malloc(0);
2559123e2cc7Smrg    p = malloc(10);
2560123e2cc7Smrg    r0 = realloc(p,0);
2561c3d5982aSmrg    c0 = calloc(0,10);
2562c3d5982aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2563c3d5982aSmrg])],
2564123e2cc7Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2565bded5d25Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2566bded5d25Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2567123e2cc7Smrgfi
2568123e2cc7SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
25697da8b7e3Smrg
2570123e2cc7Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2571123e2cc7Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2572123e2cc7Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2573123e2cc7Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2574123e2cc7Smrgelse
2575123e2cc7Smrg	MALLOC_ZERO_CFLAGS=""
2576123e2cc7Smrg	XMALLOC_ZERO_CFLAGS=""
2577123e2cc7Smrg	XTMALLOC_ZERO_CFLAGS=""
2578123e2cc7Smrgfi
25797da8b7e3Smrg
2580123e2cc7SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2581123e2cc7SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2582123e2cc7SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2583123e2cc7Smrg]) # XORG_CHECK_MALLOC_ZERO
25847da8b7e3Smrg
2585123e2cc7Smrg# XORG_WITH_LINT()
2586123e2cc7Smrg# ----------------
2587123e2cc7Smrg# Minimum version: 1.1.0
25887da8b7e3Smrg#
2589bded5d25Smrg# This macro enables the use of a tool that flags some suspicious and
2590bded5d25Smrg# non-portable constructs (likely to be bugs) in C language source code.
2591bded5d25Smrg# It will attempt to locate the tool and use appropriate options.
2592bded5d25Smrg# There are various lint type tools on different platforms.
2593bded5d25Smrg#
2594bded5d25Smrg# Interface to module:
2595bded5d25Smrg# LINT:		returns the path to the tool found on the platform
2596bded5d25Smrg#		or the value set to LINT on the configure cmd line
2597bded5d25Smrg#		also an Automake conditional
2598bded5d25Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2599bded5d25Smrg#
2600bded5d25Smrg# --with-lint:	'yes' user instructs the module to use lint
2601bded5d25Smrg#		'no' user instructs the module not to use lint (default)
2602bded5d25Smrg#
2603bded5d25Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2604bded5d25Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2605123e2cc7Smrg#
2606123e2cc7SmrgAC_DEFUN([XORG_WITH_LINT],[
2607123e2cc7Smrg
2608bded5d25SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2609bded5d25SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2610123e2cc7SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2611123e2cc7Smrg		[Use a lint-style source code checker (default: disabled)])],
2612123e2cc7Smrg		[use_lint=$withval], [use_lint=no])
2613bded5d25Smrg
2614bded5d25Smrg# Obtain platform specific info like program name and options
2615bded5d25Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2616bded5d25Smrgcase $host_os in
2617bded5d25Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2618bded5d25Smrg	lint_name=splint
2619bded5d25Smrg	lint_options="-badflag"
2620bded5d25Smrg	;;
2621bded5d25Smrg  *freebsd* | *netbsd*)
2622bded5d25Smrg	lint_name=lint
2623bded5d25Smrg	lint_options="-u -b"
2624bded5d25Smrg	;;
2625bded5d25Smrg  *solaris*)
2626bded5d25Smrg	lint_name=lint
2627bded5d25Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2628bded5d25Smrg	;;
2629bded5d25Smrgesac
2630bded5d25Smrg
2631bded5d25Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2632bded5d25Smrgif test "x$use_lint" = x"yes" ; then
2633bded5d25Smrg   AC_PATH_PROG([LINT], [$lint_name])
2634bded5d25Smrg   if test "x$LINT" = "x"; then
2635bded5d25Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2636bded5d25Smrg   fi
2637bded5d25Smrgelif test "x$use_lint" = x"no" ; then
2638bded5d25Smrg   if test "x$LINT" != "x"; then
2639bded5d25Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2640bded5d25Smrg   fi
26417da8b7e3Smrgelse
2642bded5d25Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2643123e2cc7Smrgfi
2644bded5d25Smrg
2645bded5d25Smrg# User supplied flags override default flags
2646bded5d25Smrgif test "x$LINT_FLAGS" != "x"; then
2647bded5d25Smrg   lint_options=$LINT_FLAGS
26487da8b7e3Smrgfi
26497da8b7e3Smrg
2650bded5d25SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2651bded5d25SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
26527da8b7e3Smrg
2653123e2cc7Smrg]) # XORG_WITH_LINT
26547da8b7e3Smrg
2655123e2cc7Smrg# XORG_LINT_LIBRARY(LIBNAME)
2656123e2cc7Smrg# --------------------------
2657123e2cc7Smrg# Minimum version: 1.1.0
2658123e2cc7Smrg#
2659123e2cc7Smrg# Sets up flags for building lint libraries for checking programs that call
2660123e2cc7Smrg# functions in the library.
2661123e2cc7Smrg#
2662bded5d25Smrg# Interface to module:
2663bded5d25Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2664bded5d25Smrg# MAKE_LINT_LIB		- Automake conditional
2665bded5d25Smrg#
2666bded5d25Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2667bded5d25Smrg#			  - 'no' user instructs the module not to create a lint library (default)
26687da8b7e3Smrg
2669123e2cc7SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2670123e2cc7SmrgAC_REQUIRE([XORG_WITH_LINT])
2671123e2cc7SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2672123e2cc7Smrg	[Create lint library (default: disabled)])],
2673123e2cc7Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2674bded5d25Smrg
2675bded5d25Smrgif test "x$make_lint_lib" = x"yes" ; then
2676bded5d25Smrg   LINTLIB=llib-l$1.ln
2677bded5d25Smrg   if test "x$LINT" = "x"; then
2678bded5d25Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2679bded5d25Smrg   fi
2680bded5d25Smrgelif test "x$make_lint_lib" != x"no" ; then
2681bded5d25Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2682123e2cc7Smrgfi
2683bded5d25Smrg
2684123e2cc7SmrgAC_SUBST(LINTLIB)
2685123e2cc7SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
26867da8b7e3Smrg
2687123e2cc7Smrg]) # XORG_LINT_LIBRARY
26887da8b7e3Smrg
2689c3d5982aSmrg# XORG_COMPILER_BRAND
2690c3d5982aSmrg# -------------------
2691c3d5982aSmrg# Minimum version: 1.14.0
2692c3d5982aSmrg#
2693c3d5982aSmrg# Checks for various brands of compilers and sets flags as appropriate:
2694c3d5982aSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2695c3d5982aSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2696c3d5982aSmrg#   clang compiler - sets CLANGCC to "yes"
2697c3d5982aSmrg#   Intel compiler - sets INTELCC to "yes"
2698c3d5982aSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2699c3d5982aSmrg#
2700c3d5982aSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2701c3d5982aSmrgAC_LANG_CASE(
2702c3d5982aSmrg	[C], [
2703c3d5982aSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2704c3d5982aSmrg	],
2705c3d5982aSmrg	[C++], [
2706c3d5982aSmrg		AC_REQUIRE([AC_PROG_CXX])
2707c3d5982aSmrg	]
2708c3d5982aSmrg)
2709c3d5982aSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2710c3d5982aSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2711c3d5982aSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2712c3d5982aSmrg]) # XORG_COMPILER_BRAND
2713c3d5982aSmrg
2714c3d5982aSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2715c3d5982aSmrg# ---------------
2716c3d5982aSmrg# Minimum version: 1.16.0
2717c3d5982aSmrg#
2718c3d5982aSmrg# Test if the compiler works when passed the given flag as a command line argument.
2719c3d5982aSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2720c3d5982aSmrg# next flag in the list until there are no more options.
2721c3d5982aSmrg#
2722c3d5982aSmrg# Note that this does not guarantee that the compiler supports the flag as some
2723c3d5982aSmrg# compilers will simply ignore arguments that they do not understand, but we do
2724c3d5982aSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2725c3d5982aSmrg# -Werror=unused-command-line-argument
2726c3d5982aSmrg#
2727c3d5982aSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2728c3d5982aSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2729c3d5982aSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2730c3d5982aSmrg
2731c3d5982aSmrgAC_LANG_COMPILER_REQUIRE
2732c3d5982aSmrg
2733c3d5982aSmrgAC_LANG_CASE(
2734c3d5982aSmrg	[C], [
2735c3d5982aSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2736c3d5982aSmrg		define([PREFIX], [C])
2737c3d5982aSmrg		define([CACHE_PREFIX], [cc])
2738c3d5982aSmrg		define([COMPILER], [$CC])
2739c3d5982aSmrg	],
2740c3d5982aSmrg	[C++], [
2741c3d5982aSmrg		define([PREFIX], [CXX])
2742c3d5982aSmrg		define([CACHE_PREFIX], [cxx])
2743c3d5982aSmrg		define([COMPILER], [$CXX])
2744c3d5982aSmrg	]
2745c3d5982aSmrg)
2746c3d5982aSmrg
2747c3d5982aSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2748c3d5982aSmrg
2749c3d5982aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2750c3d5982aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2751c3d5982aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2752c3d5982aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2753c3d5982aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2754c3d5982aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2755c3d5982aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2756c3d5982aSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2757c3d5982aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2758c3d5982aSmrgfi
2759c3d5982aSmrg
2760c3d5982aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2761c3d5982aSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2762c3d5982aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2763c3d5982aSmrg	fi
2764c3d5982aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2765c3d5982aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2766c3d5982aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2767c3d5982aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2768c3d5982aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2769c3d5982aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2770c3d5982aSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2771c3d5982aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2772c3d5982aSmrgfi
2773c3d5982aSmrg
2774c3d5982aSmrgfound="no"
2775c3d5982aSmrgm4_foreach([flag], m4_cdr($@), [
2776c3d5982aSmrg	if test $found = "no" ; then
2777c3d5982aSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2778c3d5982aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2779c3d5982aSmrg		fi
2780c3d5982aSmrg
2781c3d5982aSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2782c3d5982aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2783c3d5982aSmrg		fi
2784c3d5982aSmrg
2785c3d5982aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2786c3d5982aSmrg
2787c3d5982aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2788c3d5982aSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2789c3d5982aSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2790c3d5982aSmrg		AC_CACHE_VAL($cacheid,
2791c3d5982aSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2792c3d5982aSmrg					     [eval $cacheid=yes],
2793c3d5982aSmrg					     [eval $cacheid=no])])
2794c3d5982aSmrg
2795c3d5982aSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2796c3d5982aSmrg
2797c3d5982aSmrg		eval supported=\$$cacheid
2798c3d5982aSmrg		AC_MSG_RESULT([$supported])
2799c3d5982aSmrg		if test "$supported" = "yes" ; then
2800c3d5982aSmrg			$1="$$1 ]flag["
2801c3d5982aSmrg			found="yes"
2802c3d5982aSmrg		fi
2803c3d5982aSmrg	fi
2804c3d5982aSmrg])
2805c3d5982aSmrg]) # XORG_TESTSET_CFLAG
2806c3d5982aSmrg
2807c3d5982aSmrg# XORG_COMPILER_FLAGS
2808c3d5982aSmrg# ---------------
2809c3d5982aSmrg# Minimum version: 1.16.0
2810c3d5982aSmrg#
2811c3d5982aSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2812c3d5982aSmrg# arguments supported by the selected compiler which do NOT alter the generated
2813c3d5982aSmrg# code.  These arguments will cause the compiler to print various warnings
2814c3d5982aSmrg# during compilation AND turn a conservative set of warnings into errors.
2815c3d5982aSmrg#
2816c3d5982aSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2817c3d5982aSmrg# future versions of util-macros as options are added to new compilers.
2818c3d5982aSmrg#
2819c3d5982aSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2820c3d5982aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2821c3d5982aSmrg
2822c3d5982aSmrgAC_ARG_ENABLE(selective-werror,
2823c3d5982aSmrg              AS_HELP_STRING([--disable-selective-werror],
2824c3d5982aSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2825c3d5982aSmrg              [SELECTIVE_WERROR=$enableval],
2826c3d5982aSmrg              [SELECTIVE_WERROR=yes])
2827c3d5982aSmrg
2828c3d5982aSmrgAC_LANG_CASE(
2829c3d5982aSmrg        [C], [
2830c3d5982aSmrg                define([PREFIX], [C])
2831c3d5982aSmrg        ],
2832c3d5982aSmrg        [C++], [
2833c3d5982aSmrg                define([PREFIX], [CXX])
2834c3d5982aSmrg        ]
2835c3d5982aSmrg)
2836c3d5982aSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2837c3d5982aSmrgif test "x$SUNCC" = "xyes"; then
2838c3d5982aSmrg    [BASE_]PREFIX[FLAGS]="-v"
2839c3d5982aSmrgelse
2840c3d5982aSmrg    [BASE_]PREFIX[FLAGS]=""
2841c3d5982aSmrgfi
2842c3d5982aSmrg
2843c3d5982aSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2844c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2845c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2846c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2847c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2848c3d5982aSmrg
2849c3d5982aSmrgAC_LANG_CASE(
2850c3d5982aSmrg	[C], [
2851c3d5982aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2852c3d5982aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2853c3d5982aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2854c3d5982aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2855c3d5982aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2856c3d5982aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2857c3d5982aSmrg	]
2858c3d5982aSmrg)
2859c3d5982aSmrg
2860c3d5982aSmrg# This chunk adds additional warnings that could catch undesired effects.
2861c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2862c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2863c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2864c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2865c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2866c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2867c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2868c3d5982aSmrg
2869c3d5982aSmrg# These are currently disabled because they are noisy.  They will be enabled
2870c3d5982aSmrg# in the future once the codebase is sufficiently modernized to silence
2871c3d5982aSmrg# them.  For now, I don't want them to drown out the other warnings.
2872c3d5982aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2873c3d5982aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2874c3d5982aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2875c3d5982aSmrg
2876c3d5982aSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2877c3d5982aSmrg# when there are problems that should be fixed.
2878c3d5982aSmrg
2879c3d5982aSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2880c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2881c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2882c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2883c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2884c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2885c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2886c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2887c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2888c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2889c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2890c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2891c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2892c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2893c3d5982aSmrgelse
2894c3d5982aSmrgAC_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])
2895c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2896c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2897c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2898c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2899c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2900c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2901c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2902c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2903c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2904c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2905c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2906c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2907c3d5982aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2908c3d5982aSmrgfi
2909c3d5982aSmrg
2910c3d5982aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2911c3d5982aSmrg]) # XORG_COMPILER_FLAGS
2912c3d5982aSmrg
2913123e2cc7Smrg# XORG_CWARNFLAGS
2914123e2cc7Smrg# ---------------
2915123e2cc7Smrg# Minimum version: 1.2.0
2916c3d5982aSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2917123e2cc7Smrg#
2918123e2cc7Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2919123e2cc7Smrg#
2920c3d5982aSmrg# This function is deprecated because it defines -fno-strict-aliasing
2921c3d5982aSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2922c3d5982aSmrg# is needed, then it should be added explicitly in the module when
2923c3d5982aSmrg# it is updated to use BASE_CFLAGS.
2924c3d5982aSmrg#
2925123e2cc7SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2926c3d5982aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2927c3d5982aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2928c3d5982aSmrgAC_LANG_CASE(
2929c3d5982aSmrg	[C], [
2930c3d5982aSmrg		CWARNFLAGS="$BASE_CFLAGS"
2931c3d5982aSmrg		if  test "x$GCC" = xyes ; then
2932c3d5982aSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2933c3d5982aSmrg		fi
2934c3d5982aSmrg		AC_SUBST(CWARNFLAGS)
2935c3d5982aSmrg	]
2936c3d5982aSmrg)
2937123e2cc7Smrg]) # XORG_CWARNFLAGS
29387da8b7e3Smrg
2939123e2cc7Smrg# XORG_STRICT_OPTION
2940123e2cc7Smrg# -----------------------
2941123e2cc7Smrg# Minimum version: 1.3.0
29427da8b7e3Smrg#
2943c3d5982aSmrg# Add configure option to enable strict compilation flags, such as treating
2944c3d5982aSmrg# warnings as fatal errors.
2945c3d5982aSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2946c3d5982aSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2947c3d5982aSmrg#
2948c3d5982aSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2949c3d5982aSmrg# when strict compilation is unconditionally desired.
2950123e2cc7SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2951123e2cc7SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2952c3d5982aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2953123e2cc7Smrg
2954123e2cc7SmrgAC_ARG_ENABLE(strict-compilation,
2955123e2cc7Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2956123e2cc7Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2957123e2cc7Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2958c3d5982aSmrg
2959c3d5982aSmrgAC_LANG_CASE(
2960c3d5982aSmrg        [C], [
2961c3d5982aSmrg                define([PREFIX], [C])
2962c3d5982aSmrg        ],
2963c3d5982aSmrg        [C++], [
2964c3d5982aSmrg                define([PREFIX], [CXX])
2965c3d5982aSmrg        ]
2966c3d5982aSmrg)
2967c3d5982aSmrg
2968c3d5982aSmrg[STRICT_]PREFIX[FLAGS]=""
2969c3d5982aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2970c3d5982aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2971c3d5982aSmrg
2972c3d5982aSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2973c3d5982aSmrg# activate it with -Werror, so we add it here explicitly.
2974c3d5982aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2975c3d5982aSmrg
2976123e2cc7Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2977c3d5982aSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2978c3d5982aSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2979123e2cc7Smrgfi
2980c3d5982aSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2981c3d5982aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2982c3d5982aSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2983123e2cc7Smrg]) # XORG_STRICT_OPTION
29847da8b7e3Smrg
2985123e2cc7Smrg# XORG_DEFAULT_OPTIONS
2986123e2cc7Smrg# --------------------
2987123e2cc7Smrg# Minimum version: 1.3.0
2988123e2cc7Smrg#
2989123e2cc7Smrg# Defines default options for X.Org modules.
2990123e2cc7Smrg#
2991123e2cc7SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2992bded5d25SmrgAC_REQUIRE([AC_PROG_INSTALL])
2993c3d5982aSmrgXORG_COMPILER_FLAGS
2994123e2cc7SmrgXORG_CWARNFLAGS
2995123e2cc7SmrgXORG_STRICT_OPTION
2996123e2cc7SmrgXORG_RELEASE_VERSION
2997123e2cc7SmrgXORG_CHANGELOG
2998bded5d25SmrgXORG_INSTALL
2999123e2cc7SmrgXORG_MANPAGE_SECTIONS
3000bded5d25Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3001bded5d25Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3002123e2cc7Smrg]) # XORG_DEFAULT_OPTIONS
3003bded5d25Smrg
3004bded5d25Smrg# XORG_INSTALL()
3005bded5d25Smrg# ----------------
3006bded5d25Smrg# Minimum version: 1.4.0
3007bded5d25Smrg#
3008bded5d25Smrg# Defines the variable INSTALL_CMD as the command to copy
3009bded5d25Smrg# INSTALL from $prefix/share/util-macros.
3010bded5d25Smrg#
3011bded5d25SmrgAC_DEFUN([XORG_INSTALL], [
3012bded5d25SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3013bded5d25Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3014bded5d25SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3015bded5d25Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3016bded5d25Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3017bded5d25Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3018bded5d25SmrgAC_SUBST([INSTALL_CMD])
3019bded5d25Smrg]) # XORG_INSTALL
3020123e2cc7Smrgdnl Copyright 2005 Red Hat, Inc
3021123e2cc7Smrgdnl
3022123e2cc7Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3023123e2cc7Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3024123e2cc7Smrgdnl the above copyright notice appear in all copies and that both that
3025123e2cc7Smrgdnl copyright notice and this permission notice appear in supporting
3026123e2cc7Smrgdnl documentation.
3027123e2cc7Smrgdnl
3028123e2cc7Smrgdnl The above copyright notice and this permission notice shall be included
3029123e2cc7Smrgdnl in all copies or substantial portions of the Software.
3030123e2cc7Smrgdnl
3031123e2cc7Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3032123e2cc7Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3033123e2cc7Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3034123e2cc7Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3035123e2cc7Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3036123e2cc7Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3037123e2cc7Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3038123e2cc7Smrgdnl
3039123e2cc7Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3040123e2cc7Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3041123e2cc7Smrgdnl other dealings in this Software without prior written authorization
3042123e2cc7Smrgdnl from the copyright holders.
3043123e2cc7Smrgdnl
30447da8b7e3Smrg
3045123e2cc7Smrg# XORG_RELEASE_VERSION
3046123e2cc7Smrg# --------------------
3047bded5d25Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3048123e2cc7Smrg 
3049123e2cc7SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3050123e2cc7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3051123e2cc7Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3052123e2cc7Smrg		[Major version of this package])
3053123e2cc7Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3054123e2cc7Smrg	if test "x$PVM" = "x"; then
3055123e2cc7Smrg		PVM="0"
3056123e2cc7Smrg	fi
3057123e2cc7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3058123e2cc7Smrg		[$PVM],
3059123e2cc7Smrg		[Minor version of this package])
3060123e2cc7Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3061123e2cc7Smrg	if test "x$PVP" = "x"; then
3062123e2cc7Smrg		PVP="0"
3063123e2cc7Smrg	fi
3064123e2cc7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3065123e2cc7Smrg		[$PVP],
3066123e2cc7Smrg		[Patch version of this package])
30677da8b7e3Smrg])
30687da8b7e3Smrg
3069123e2cc7Smrg# XORG_CHANGELOG()
3070123e2cc7Smrg# ----------------
3071123e2cc7Smrg# Minimum version: 1.2.0
3072123e2cc7Smrg#
3073123e2cc7Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3074123e2cc7Smrg# ChangeLog from git.
3075123e2cc7Smrg#
3076123e2cc7Smrg#
3077123e2cc7SmrgAC_DEFUN([XORG_CHANGELOG], [
3078bded5d25SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3079bded5d25Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3080bded5d25Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3081123e2cc7Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3082123e2cc7SmrgAC_SUBST([CHANGELOG_CMD])
3083123e2cc7Smrg]) # XORG_CHANGELOG
30847da8b7e3Smrg
3085