aclocal.m4 revision bd8ad950
148f45e26Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
287aef7c3Smrg
348f45e26Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4ea6ae205Smrg
5ea6ae205Smrg# This file is free software; the Free Software Foundation
6ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
7ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
8ea6ae205Smrg
9ea6ae205Smrg# This program is distributed in the hope that it will be useful,
10ea6ae205Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11ea6ae205Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12ea6ae205Smrg# PARTICULAR PURPOSE.
13ea6ae205Smrg
1487aef7c3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15e83ac88aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16e83ac88aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1748f45e26Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1848f45e26Smrg[m4_warning([this file was generated for autoconf 2.69.
19e83ac88aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20e83ac88aSmrgIf you have problems, you may need to regenerate the build system entirely.
2187aef7c3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22ea6ae205Smrg
23bd8ad950Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
24bd8ad950Smrg#
25bd8ad950Smrg# This file is free software; the Free Software Foundation
26bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
27bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
28ea6ae205Smrg
29bd8ad950Smrg# AM_AUTOMAKE_VERSION(VERSION)
30bd8ad950Smrg# ----------------------------
31bd8ad950Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32bd8ad950Smrg# generated from the m4 files accompanying Automake X.Y.
33bd8ad950Smrg# (This private macro should not be called outside this file.)
34bd8ad950SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35bd8ad950Smrg[am__api_version='1.15'
36bd8ad950Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37bd8ad950Smrgdnl require some minimum version.  Point them to the right macro.
38bd8ad950Smrgm4_if([$1], [1.15], [],
39bd8ad950Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40bd8ad950Smrg])
41ea6ae205Smrg
42bd8ad950Smrg# _AM_AUTOCONF_VERSION(VERSION)
43bd8ad950Smrg# -----------------------------
44bd8ad950Smrg# aclocal traces this macro to find the Autoconf version.
45bd8ad950Smrg# This is a private macro too.  Using m4_define simplifies
46bd8ad950Smrg# the logic in aclocal, which can simply ignore this definition.
47bd8ad950Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48ea6ae205Smrg
49bd8ad950Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50bd8ad950Smrg# -------------------------------
51bd8ad950Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52bd8ad950Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53bd8ad950SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54bd8ad950Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
55bd8ad950Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56bd8ad950Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57bd8ad950Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58ea6ae205Smrg
59bd8ad950Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60ea6ae205Smrg
61bd8ad950Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
62bd8ad950Smrg#
63bd8ad950Smrg# This file is free software; the Free Software Foundation
64bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
65bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
66ea6ae205Smrg
67bd8ad950Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68bd8ad950Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69bd8ad950Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70bd8ad950Smrg#
71bd8ad950Smrg# Of course, Automake must honor this variable whenever it calls a
72bd8ad950Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73bd8ad950Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74bd8ad950Smrg# depending on how configure is run.  This is pretty annoying, since
75bd8ad950Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76bd8ad950Smrg# source directory, any form will work fine, but in subdirectories a
77bd8ad950Smrg# relative path needs to be adjusted first.
78bd8ad950Smrg#
79bd8ad950Smrg# $ac_aux_dir/missing
80bd8ad950Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81bd8ad950Smrg# $top_srcdir/$ac_aux_dir/missing
82bd8ad950Smrg#    fails if $ac_aux_dir is absolute,
83bd8ad950Smrg#    fails when called from a subdirectory in a VPATH build with
84bd8ad950Smrg#          a relative $ac_aux_dir
85bd8ad950Smrg#
86bd8ad950Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87bd8ad950Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88bd8ad950Smrg# harmless because $srcdir is '.', but things will broke when you
89bd8ad950Smrg# start a VPATH build or use an absolute $srcdir.
90bd8ad950Smrg#
91bd8ad950Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92bd8ad950Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93bd8ad950Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94bd8ad950Smrg# and then we would define $MISSING as
95bd8ad950Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96bd8ad950Smrg# This will work as long as MISSING is not called from configure, because
97bd8ad950Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98bd8ad950Smrg# However there are other variables, like CC, which are often used in
99bd8ad950Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100bd8ad950Smrg#
101bd8ad950Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102bd8ad950Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103bd8ad950Smrg# configured tree to be moved without reconfiguration.
104ea6ae205Smrg
105bd8ad950SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106bd8ad950Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107bd8ad950Smrg# Expand $ac_aux_dir to an absolute path.
108bd8ad950Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109bd8ad950Smrg])
110ea6ae205Smrg
111bd8ad950Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112ea6ae205Smrg
113bd8ad950Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
114bd8ad950Smrg#
115bd8ad950Smrg# This file is free software; the Free Software Foundation
116bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
117bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
118ea6ae205Smrg
119bd8ad950Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120bd8ad950Smrg# -------------------------------------
121bd8ad950Smrg# Define a conditional.
122bd8ad950SmrgAC_DEFUN([AM_CONDITIONAL],
123bd8ad950Smrg[AC_PREREQ([2.52])dnl
124bd8ad950Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125bd8ad950Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126bd8ad950SmrgAC_SUBST([$1_TRUE])dnl
127bd8ad950SmrgAC_SUBST([$1_FALSE])dnl
128bd8ad950Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129bd8ad950Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130bd8ad950Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131bd8ad950Smrgif $2; then
132bd8ad950Smrg  $1_TRUE=
133bd8ad950Smrg  $1_FALSE='#'
134bd8ad950Smrgelse
135bd8ad950Smrg  $1_TRUE='#'
136bd8ad950Smrg  $1_FALSE=
137bd8ad950Smrgfi
138bd8ad950SmrgAC_CONFIG_COMMANDS_PRE(
139bd8ad950Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140bd8ad950Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141bd8ad950SmrgUsually this means the macro was only invoked conditionally.]])
142bd8ad950Smrgfi])])
143ea6ae205Smrg
144bd8ad950Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
145bd8ad950Smrg#
146bd8ad950Smrg# This file is free software; the Free Software Foundation
147bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
148bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
149ea6ae205Smrg
150e83ac88aSmrg
151bd8ad950Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152bd8ad950Smrg# written in clear, in which case automake, when reading aclocal.m4,
153bd8ad950Smrg# will think it sees a *use*, and therefore will trigger all it's
154bd8ad950Smrg# C support machinery.  Also note that it means that autoscan, seeing
155bd8ad950Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156ea6ae205Smrg
157ea6ae205Smrg
158bd8ad950Smrg# _AM_DEPENDENCIES(NAME)
159bd8ad950Smrg# ----------------------
160bd8ad950Smrg# See how the compiler implements dependency checking.
161bd8ad950Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162bd8ad950Smrg# We try a few techniques and use that to set a single cache variable.
163bd8ad950Smrg#
164bd8ad950Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165bd8ad950Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166bd8ad950Smrg# dependency, and given that the user is not expected to run this macro,
167bd8ad950Smrg# just rely on AC_PROG_CC.
168bd8ad950SmrgAC_DEFUN([_AM_DEPENDENCIES],
169bd8ad950Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170bd8ad950SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171bd8ad950SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172bd8ad950SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173ea6ae205Smrg
174bd8ad950Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175bd8ad950Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176bd8ad950Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177bd8ad950Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178bd8ad950Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179bd8ad950Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180bd8ad950Smrg                    [depcc="$$1"   am_compiler_list=])
181ea6ae205Smrg
182bd8ad950SmrgAC_CACHE_CHECK([dependency style of $depcc],
183bd8ad950Smrg               [am_cv_$1_dependencies_compiler_type],
184bd8ad950Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185bd8ad950Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186bd8ad950Smrg  # making bogus files that we don't know about and never remove.  For
187bd8ad950Smrg  # instance it was reported that on HP-UX the gcc test will end up
188bd8ad950Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189bd8ad950Smrg  # in D".
190bd8ad950Smrg  rm -rf conftest.dir
191bd8ad950Smrg  mkdir conftest.dir
192bd8ad950Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193bd8ad950Smrg  # using a relative directory.
194bd8ad950Smrg  cp "$am_depcomp" conftest.dir
195bd8ad950Smrg  cd conftest.dir
196bd8ad950Smrg  # We will build objects and dependencies in a subdirectory because
197bd8ad950Smrg  # it helps to detect inapplicable dependency modes.  For instance
198bd8ad950Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199bd8ad950Smrg  # side effect of compilation, but ICC will put the dependencies in
200bd8ad950Smrg  # the current directory while Tru64 will put them in the object
201bd8ad950Smrg  # directory.
202bd8ad950Smrg  mkdir sub
203ea6ae205Smrg
204bd8ad950Smrg  am_cv_$1_dependencies_compiler_type=none
205bd8ad950Smrg  if test "$am_compiler_list" = ""; then
206bd8ad950Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207bd8ad950Smrg  fi
208bd8ad950Smrg  am__universal=false
209bd8ad950Smrg  m4_case([$1], [CC],
210bd8ad950Smrg    [case " $depcc " in #(
211bd8ad950Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212bd8ad950Smrg     esac],
213bd8ad950Smrg    [CXX],
214bd8ad950Smrg    [case " $depcc " in #(
215bd8ad950Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216bd8ad950Smrg     esac])
217ea6ae205Smrg
218bd8ad950Smrg  for depmode in $am_compiler_list; do
219bd8ad950Smrg    # Setup a source with many dependencies, because some compilers
220bd8ad950Smrg    # like to wrap large dependency lists on column 80 (with \), and
221bd8ad950Smrg    # we should not choose a depcomp mode which is confused by this.
222bd8ad950Smrg    #
223bd8ad950Smrg    # We need to recreate these files for each test, as the compiler may
224bd8ad950Smrg    # overwrite some of them when testing with obscure command lines.
225bd8ad950Smrg    # This happens at least with the AIX C compiler.
226bd8ad950Smrg    : > sub/conftest.c
227bd8ad950Smrg    for i in 1 2 3 4 5 6; do
228bd8ad950Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229bd8ad950Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230bd8ad950Smrg      # Solaris 10 /bin/sh.
231bd8ad950Smrg      echo '/* dummy */' > sub/conftst$i.h
232bd8ad950Smrg    done
233bd8ad950Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234ea6ae205Smrg
235bd8ad950Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236bd8ad950Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237bd8ad950Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238bd8ad950Smrg    # versions had trouble with output in subdirs.
239bd8ad950Smrg    am__obj=sub/conftest.${OBJEXT-o}
240bd8ad950Smrg    am__minus_obj="-o $am__obj"
241bd8ad950Smrg    case $depmode in
242bd8ad950Smrg    gcc)
243bd8ad950Smrg      # This depmode causes a compiler race in universal mode.
244bd8ad950Smrg      test "$am__universal" = false || continue
245bd8ad950Smrg      ;;
246bd8ad950Smrg    nosideeffect)
247bd8ad950Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248bd8ad950Smrg      # only be used when explicitly requested.
249bd8ad950Smrg      if test "x$enable_dependency_tracking" = xyes; then
250bd8ad950Smrg	continue
251bd8ad950Smrg      else
252bd8ad950Smrg	break
253bd8ad950Smrg      fi
254bd8ad950Smrg      ;;
255bd8ad950Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256bd8ad950Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257bd8ad950Smrg      # not run yet.  These depmodes are late enough in the game, and
258bd8ad950Smrg      # so weak that their functioning should not be impacted.
259bd8ad950Smrg      am__obj=conftest.${OBJEXT-o}
260bd8ad950Smrg      am__minus_obj=
261bd8ad950Smrg      ;;
262bd8ad950Smrg    none) break ;;
263bd8ad950Smrg    esac
264bd8ad950Smrg    if depmode=$depmode \
265bd8ad950Smrg       source=sub/conftest.c object=$am__obj \
266bd8ad950Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267bd8ad950Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268bd8ad950Smrg         >/dev/null 2>conftest.err &&
269bd8ad950Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270bd8ad950Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271bd8ad950Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272bd8ad950Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273bd8ad950Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274bd8ad950Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275bd8ad950Smrg      # that says an option was ignored or not supported.
276bd8ad950Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277bd8ad950Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278bd8ad950Smrg      # The diagnosis changed in icc 8.0:
279bd8ad950Smrg      #   icc: Command line remark: option '-MP' not supported
280bd8ad950Smrg      if (grep 'ignoring option' conftest.err ||
281bd8ad950Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282bd8ad950Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283bd8ad950Smrg        break
284bd8ad950Smrg      fi
285bd8ad950Smrg    fi
286bd8ad950Smrg  done
287ea6ae205Smrg
288bd8ad950Smrg  cd ..
289bd8ad950Smrg  rm -rf conftest.dir
290bd8ad950Smrgelse
291bd8ad950Smrg  am_cv_$1_dependencies_compiler_type=none
292bd8ad950Smrgfi
293bd8ad950Smrg])
294bd8ad950SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295bd8ad950SmrgAM_CONDITIONAL([am__fastdep$1], [
296bd8ad950Smrg  test "x$enable_dependency_tracking" != xno \
297bd8ad950Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298bd8ad950Smrg])
299ea6ae205Smrg
300ea6ae205Smrg
301bd8ad950Smrg# AM_SET_DEPDIR
302bd8ad950Smrg# -------------
303bd8ad950Smrg# Choose a directory name for dependency files.
304bd8ad950Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305bd8ad950SmrgAC_DEFUN([AM_SET_DEPDIR],
306bd8ad950Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307bd8ad950SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308bd8ad950Smrg])
309ea6ae205Smrg
310ea6ae205Smrg
311bd8ad950Smrg# AM_DEP_TRACK
312bd8ad950Smrg# ------------
313bd8ad950SmrgAC_DEFUN([AM_DEP_TRACK],
314bd8ad950Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315bd8ad950SmrgAS_HELP_STRING(
316bd8ad950Smrg  [--enable-dependency-tracking],
317bd8ad950Smrg  [do not reject slow dependency extractors])
318bd8ad950SmrgAS_HELP_STRING(
319bd8ad950Smrg  [--disable-dependency-tracking],
320bd8ad950Smrg  [speeds up one-time build])])
321bd8ad950Smrgif test "x$enable_dependency_tracking" != xno; then
322bd8ad950Smrg  am_depcomp="$ac_aux_dir/depcomp"
323bd8ad950Smrg  AMDEPBACKSLASH='\'
324bd8ad950Smrg  am__nodep='_no'
325bd8ad950Smrgfi
326bd8ad950SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327bd8ad950SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328bd8ad950Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329bd8ad950SmrgAC_SUBST([am__nodep])dnl
330bd8ad950Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331bd8ad950Smrg])
33212458b28Smrg
333bd8ad950Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33412458b28Smrg
335bd8ad950Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
33612458b28Smrg#
337bd8ad950Smrg# This file is free software; the Free Software Foundation
338bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
339bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
340ea6ae205Smrg
341ea6ae205Smrg
342bd8ad950Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
343bd8ad950Smrg# ------------------------------
344bd8ad950SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345bd8ad950Smrg[{
346bd8ad950Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
347bd8ad950Smrg  # are listed without --file.  Let's play safe and only enable the eval
348bd8ad950Smrg  # if we detect the quoting.
349bd8ad950Smrg  case $CONFIG_FILES in
350bd8ad950Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
351bd8ad950Smrg  *)   set x $CONFIG_FILES ;;
352bd8ad950Smrg  esac
353bd8ad950Smrg  shift
354bd8ad950Smrg  for mf
355bd8ad950Smrg  do
356bd8ad950Smrg    # Strip MF so we end up with the name of the file.
357bd8ad950Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358bd8ad950Smrg    # Check whether this is an Automake generated Makefile or not.
359bd8ad950Smrg    # We used to match only the files named 'Makefile.in', but
360bd8ad950Smrg    # some people rename them; so instead we look at the file content.
361bd8ad950Smrg    # Grep'ing the first line is not enough: some people post-process
362bd8ad950Smrg    # each Makefile.in and add a new line on top of each file to say so.
363bd8ad950Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
364bd8ad950Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
365bd8ad950Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366bd8ad950Smrg      dirpart=`AS_DIRNAME("$mf")`
367bd8ad950Smrg    else
368bd8ad950Smrg      continue
369bd8ad950Smrg    fi
370bd8ad950Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
371bd8ad950Smrg    # from the Makefile without running 'make'.
372bd8ad950Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373bd8ad950Smrg    test -z "$DEPDIR" && continue
374bd8ad950Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
375bd8ad950Smrg    test -z "$am__include" && continue
376bd8ad950Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377bd8ad950Smrg    # Find all dependency output files, they are included files with
378bd8ad950Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379bd8ad950Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380bd8ad950Smrg    # expansion.
381bd8ad950Smrg    for file in `sed -n "
382bd8ad950Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383bd8ad950Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384bd8ad950Smrg      # Make sure the directory exists.
385bd8ad950Smrg      test -f "$dirpart/$file" && continue
386bd8ad950Smrg      fdir=`AS_DIRNAME(["$file"])`
387bd8ad950Smrg      AS_MKDIR_P([$dirpart/$fdir])
388bd8ad950Smrg      # echo "creating $dirpart/$file"
389bd8ad950Smrg      echo '# dummy' > "$dirpart/$file"
390bd8ad950Smrg    done
391bd8ad950Smrg  done
392bd8ad950Smrg}
393bd8ad950Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39487aef7c3Smrg
395ea6ae205Smrg
396bd8ad950Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397bd8ad950Smrg# -----------------------------
398bd8ad950Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39912458b28Smrg#
400bd8ad950Smrg# This code is only required when automatic dependency tracking
401bd8ad950Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
402bd8ad950Smrg# need in order to bootstrap the dependency handling code.
403bd8ad950SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404bd8ad950Smrg[AC_CONFIG_COMMANDS([depfiles],
405bd8ad950Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406bd8ad950Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407bd8ad950Smrg])
40812458b28Smrg
409bd8ad950Smrg# Do all the work for Automake.                             -*- Autoconf -*-
41012458b28Smrg
411bd8ad950Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
412bd8ad950Smrg#
413bd8ad950Smrg# This file is free software; the Free Software Foundation
414bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
415bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
416ea6ae205Smrg
417bd8ad950Smrg# This macro actually does too much.  Some checks are only needed if
418bd8ad950Smrg# your package does certain things.  But this isn't really a big deal.
419ea6ae205Smrg
420bd8ad950Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
421bd8ad950Smrgm4_define([AC_PROG_CC],
422bd8ad950Smrgm4_defn([AC_PROG_CC])
423bd8ad950Smrg[_AM_PROG_CC_C_O
424bd8ad950Smrg])
425ea6ae205Smrg
426bd8ad950Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
427bd8ad950Smrg# AM_INIT_AUTOMAKE([OPTIONS])
428bd8ad950Smrg# -----------------------------------------------
429bd8ad950Smrg# The call with PACKAGE and VERSION arguments is the old style
430bd8ad950Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
431bd8ad950Smrg# and VERSION should now be passed to AC_INIT and removed from
432bd8ad950Smrg# the call to AM_INIT_AUTOMAKE.
433bd8ad950Smrg# We support both call styles for the transition.  After
434bd8ad950Smrg# the next Automake release, Autoconf can make the AC_INIT
435bd8ad950Smrg# arguments mandatory, and then we can depend on a new Autoconf
436bd8ad950Smrg# release and drop the old call support.
437bd8ad950SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
438bd8ad950Smrg[AC_PREREQ([2.65])dnl
439bd8ad950Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
440bd8ad950Smrgdnl the ones we care about.
441bd8ad950Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
442bd8ad950SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
443bd8ad950SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
444bd8ad950Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
445bd8ad950Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
446bd8ad950Smrg  # is not polluted with repeated "-I."
447bd8ad950Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
448bd8ad950Smrg  # test to see if srcdir already configured
449bd8ad950Smrg  if test -f $srcdir/config.status; then
450bd8ad950Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
451bd8ad950Smrg  fi
45212458b28Smrgfi
45387aef7c3Smrg
454bd8ad950Smrg# test whether we have cygpath
455bd8ad950Smrgif test -z "$CYGPATH_W"; then
456bd8ad950Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
457bd8ad950Smrg    CYGPATH_W='cygpath -w'
458bd8ad950Smrg  else
459bd8ad950Smrg    CYGPATH_W=echo
460bd8ad950Smrg  fi
46112458b28Smrgfi
462bd8ad950SmrgAC_SUBST([CYGPATH_W])
46387aef7c3Smrg
464bd8ad950Smrg# Define the identity of the package.
465bd8ad950Smrgdnl Distinguish between old-style and new-style calls.
466bd8ad950Smrgm4_ifval([$2],
467bd8ad950Smrg[AC_DIAGNOSE([obsolete],
468bd8ad950Smrg             [$0: two- and three-arguments forms are deprecated.])
469bd8ad950Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
470bd8ad950Smrg AC_SUBST([PACKAGE], [$1])dnl
471bd8ad950Smrg AC_SUBST([VERSION], [$2])],
472bd8ad950Smrg[_AM_SET_OPTIONS([$1])dnl
473bd8ad950Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
474bd8ad950Smrgm4_if(
475bd8ad950Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
476bd8ad950Smrg  [ok:ok],,
477bd8ad950Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
478bd8ad950Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
479bd8ad950Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
48087aef7c3Smrg
481bd8ad950Smrg_AM_IF_OPTION([no-define],,
482bd8ad950Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
483bd8ad950Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48487aef7c3Smrg
485bd8ad950Smrg# Some tools Automake needs.
486bd8ad950SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
487bd8ad950SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
488bd8ad950SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
489bd8ad950SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
490bd8ad950SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
491bd8ad950SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
492bd8ad950SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493bd8ad950SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494bd8ad950SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
495bd8ad950SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
496bd8ad950Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
497bd8ad950Smrg# dies out for good.  For more background, see:
498bd8ad950Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
499bd8ad950Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
500bd8ad950SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
501bd8ad950Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
502bd8ad950Smrg# system "awk" is bad on some platforms.
503bd8ad950SmrgAC_REQUIRE([AC_PROG_AWK])dnl
504bd8ad950SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
505bd8ad950SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
506bd8ad950Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507bd8ad950Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508bd8ad950Smrg			     [_AM_PROG_TAR([v7])])])
509bd8ad950Smrg_AM_IF_OPTION([no-dependencies],,
510bd8ad950Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
511bd8ad950Smrg		  [_AM_DEPENDENCIES([CC])],
512bd8ad950Smrg		  [m4_define([AC_PROG_CC],
513bd8ad950Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
514bd8ad950SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
515bd8ad950Smrg		  [_AM_DEPENDENCIES([CXX])],
516bd8ad950Smrg		  [m4_define([AC_PROG_CXX],
517bd8ad950Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
518bd8ad950SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
519bd8ad950Smrg		  [_AM_DEPENDENCIES([OBJC])],
520bd8ad950Smrg		  [m4_define([AC_PROG_OBJC],
521bd8ad950Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
522bd8ad950SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
523bd8ad950Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
524bd8ad950Smrg		  [m4_define([AC_PROG_OBJCXX],
525bd8ad950Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
526bd8ad950Smrg])
527bd8ad950SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
528bd8ad950Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
529bd8ad950Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
530bd8ad950Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531bd8ad950SmrgAC_CONFIG_COMMANDS_PRE(dnl
532bd8ad950Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533bd8ad950Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
53487aef7c3Smrg
535bd8ad950Smrg# POSIX will say in a future version that running "rm -f" with no argument
536bd8ad950Smrg# is OK; and we want to be able to make that assumption in our Makefile
537bd8ad950Smrg# recipes.  So use an aggressive probe to check that the usage we want is
538bd8ad950Smrg# actually supported "in the wild" to an acceptable degree.
539bd8ad950Smrg# See automake bug#10828.
540bd8ad950Smrg# To make any issue more visible, cause the running configure to be aborted
541bd8ad950Smrg# by default if the 'rm' program in use doesn't match our expectations; the
542bd8ad950Smrg# user can still override this though.
543bd8ad950Smrgif rm -f && rm -fr && rm -rf; then : OK; else
544bd8ad950Smrg  cat >&2 <<'END'
545bd8ad950SmrgOops!
54612458b28Smrg
547bd8ad950SmrgYour 'rm' program seems unable to run without file operands specified
548bd8ad950Smrgon the command line, even when the '-f' option is present.  This is contrary
549bd8ad950Smrgto the behaviour of most rm programs out there, and not conforming with
550bd8ad950Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55187aef7c3Smrg
552bd8ad950SmrgPlease tell bug-automake@gnu.org about your system, including the value
553bd8ad950Smrgof your $PATH and any error possibly output before this message.  This
554bd8ad950Smrgcan help us improve future automake versions.
555e83ac88aSmrg
556bd8ad950SmrgEND
557bd8ad950Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
558bd8ad950Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
559bd8ad950Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
560bd8ad950Smrg    echo >&2
561bd8ad950Smrg  else
562bd8ad950Smrg    cat >&2 <<'END'
563bd8ad950SmrgAborting the configuration process, to ensure you take notice of the issue.
5647978d3cdSmrg
565bd8ad950SmrgYou can download and install GNU coreutils to get an 'rm' implementation
566bd8ad950Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5677978d3cdSmrg
568bd8ad950SmrgIf you want to complete the configuration process using your problematic
569bd8ad950Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
570bd8ad950Smrgto "yes", and re-run configure.
571ea6ae205Smrg
572bd8ad950SmrgEND
573bd8ad950Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
574bd8ad950Smrg  fi
575e83ac88aSmrgfi
576bd8ad950Smrgdnl The trailing newline in this macro's definition is deliberate, for
577bd8ad950Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
578bd8ad950Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
579bd8ad950Smrg])
580ea6ae205Smrg
581bd8ad950Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582bd8ad950Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583bd8ad950Smrgdnl mangled by Autoconf and run in a shell conditional statement.
584bd8ad950Smrgm4_define([_AC_COMPILER_EXEEXT],
585bd8ad950Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5867978d3cdSmrg
587bd8ad950Smrg# When config.status generates a header, we must update the stamp-h file.
588bd8ad950Smrg# This file resides in the same directory as the config header
589bd8ad950Smrg# that is generated.  The stamp files are numbered to have different names.
590ea6ae205Smrg
591bd8ad950Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
592bd8ad950Smrg# loop where config.status creates the headers, so we can generate
593bd8ad950Smrg# our stamp files there.
594bd8ad950SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
595bd8ad950Smrg[# Compute $1's index in $config_headers.
596bd8ad950Smrg_am_arg=$1
597bd8ad950Smrg_am_stamp_count=1
598bd8ad950Smrgfor _am_header in $config_headers :; do
599bd8ad950Smrg  case $_am_header in
600bd8ad950Smrg    $_am_arg | $_am_arg:* )
601bd8ad950Smrg      break ;;
602bd8ad950Smrg    * )
603bd8ad950Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
604bd8ad950Smrg  esac
605bd8ad950Smrgdone
606bd8ad950Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
607ea6ae205Smrg
608bd8ad950Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
609bd8ad950Smrg#
610bd8ad950Smrg# This file is free software; the Free Software Foundation
611bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
612bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
613ea6ae205Smrg
614bd8ad950Smrg# AM_PROG_INSTALL_SH
615bd8ad950Smrg# ------------------
616bd8ad950Smrg# Define $install_sh.
617bd8ad950SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
618bd8ad950Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
619bd8ad950Smrgif test x"${install_sh+set}" != xset; then
620bd8ad950Smrg  case $am_aux_dir in
621bd8ad950Smrg  *\ * | *\	*)
622bd8ad950Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623bd8ad950Smrg  *)
624bd8ad950Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625bd8ad950Smrg  esac
626bd8ad950Smrgfi
627bd8ad950SmrgAC_SUBST([install_sh])])
628ea6ae205Smrg
629bd8ad950Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
630ea6ae205Smrg#
631bd8ad950Smrg# This file is free software; the Free Software Foundation
632bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
633bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
634ea6ae205Smrg
635bd8ad950Smrg# Check whether the underlying file-system supports filenames
636bd8ad950Smrg# with a leading dot.  For instance MS-DOS doesn't.
637bd8ad950SmrgAC_DEFUN([AM_SET_LEADING_DOT],
638bd8ad950Smrg[rm -rf .tst 2>/dev/null
639bd8ad950Smrgmkdir .tst 2>/dev/null
640bd8ad950Smrgif test -d .tst; then
641bd8ad950Smrg  am__leading_dot=.
642bd8ad950Smrgelse
643bd8ad950Smrg  am__leading_dot=_
64412458b28Smrgfi
645bd8ad950Smrgrmdir .tst 2>/dev/null
646bd8ad950SmrgAC_SUBST([am__leading_dot])])
647ea6ae205Smrg
648bd8ad950Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
64987aef7c3Smrg
650bd8ad950Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
651bd8ad950Smrg#
652bd8ad950Smrg# This file is free software; the Free Software Foundation
653bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
654bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
65587aef7c3Smrg
656bd8ad950Smrg# AM_MAKE_INCLUDE()
657bd8ad950Smrg# -----------------
658bd8ad950Smrg# Check to see how make treats includes.
659bd8ad950SmrgAC_DEFUN([AM_MAKE_INCLUDE],
660bd8ad950Smrg[am_make=${MAKE-make}
661bd8ad950Smrgcat > confinc << 'END'
662bd8ad950Smrgam__doit:
663bd8ad950Smrg	@echo this is the am__doit target
664bd8ad950Smrg.PHONY: am__doit
665bd8ad950SmrgEND
666bd8ad950Smrg# If we don't find an include directive, just comment out the code.
667bd8ad950SmrgAC_MSG_CHECKING([for style of include used by $am_make])
668bd8ad950Smrgam__include="#"
669bd8ad950Smrgam__quote=
670bd8ad950Smrg_am_result=none
671bd8ad950Smrg# First try GNU make style include.
672bd8ad950Smrgecho "include confinc" > confmf
673bd8ad950Smrg# Ignore all kinds of additional output from 'make'.
674bd8ad950Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675bd8ad950Smrg*the\ am__doit\ target*)
676bd8ad950Smrg  am__include=include
677bd8ad950Smrg  am__quote=
678bd8ad950Smrg  _am_result=GNU
679bd8ad950Smrg  ;;
680bd8ad950Smrgesac
681bd8ad950Smrg# Now try BSD make style include.
682bd8ad950Smrgif test "$am__include" = "#"; then
683bd8ad950Smrg   echo '.include "confinc"' > confmf
684bd8ad950Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685bd8ad950Smrg   *the\ am__doit\ target*)
686bd8ad950Smrg     am__include=.include
687bd8ad950Smrg     am__quote="\""
688bd8ad950Smrg     _am_result=BSD
689bd8ad950Smrg     ;;
690bd8ad950Smrg   esac
69112458b28Smrgfi
692bd8ad950SmrgAC_SUBST([am__include])
693bd8ad950SmrgAC_SUBST([am__quote])
694bd8ad950SmrgAC_MSG_RESULT([$_am_result])
695bd8ad950Smrgrm -f confinc confmf
696bd8ad950Smrg])
69787aef7c3Smrg
698bd8ad950Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69987aef7c3Smrg
700bd8ad950Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
70112458b28Smrg#
702bd8ad950Smrg# This file is free software; the Free Software Foundation
703bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
704bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
70587aef7c3Smrg
706bd8ad950Smrg# AM_MISSING_PROG(NAME, PROGRAM)
707bd8ad950Smrg# ------------------------------
708bd8ad950SmrgAC_DEFUN([AM_MISSING_PROG],
709bd8ad950Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710bd8ad950Smrg$1=${$1-"${am_missing_run}$2"}
711bd8ad950SmrgAC_SUBST($1)])
712bd8ad950Smrg
713bd8ad950Smrg# AM_MISSING_HAS_RUN
714bd8ad950Smrg# ------------------
715bd8ad950Smrg# Define MISSING if not defined so far and test if it is modern enough.
716bd8ad950Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
717bd8ad950SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
718bd8ad950Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
719bd8ad950SmrgAC_REQUIRE_AUX_FILE([missing])dnl
720bd8ad950Smrgif test x"${MISSING+set}" != xset; then
721bd8ad950Smrg  case $am_aux_dir in
722bd8ad950Smrg  *\ * | *\	*)
723bd8ad950Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724bd8ad950Smrg  *)
725bd8ad950Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726bd8ad950Smrg  esac
727bd8ad950Smrgfi
728bd8ad950Smrg# Use eval to expand $SHELL
729bd8ad950Smrgif eval "$MISSING --is-lightweight"; then
730bd8ad950Smrg  am_missing_run="$MISSING "
731ea6ae205Smrgelse
732bd8ad950Smrg  am_missing_run=
733bd8ad950Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73487aef7c3Smrgfi
735bd8ad950Smrg])
736ea6ae205Smrg
737bd8ad950Smrg# Helper functions for option handling.                     -*- Autoconf -*-
738e83ac88aSmrg
739bd8ad950Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
7407978d3cdSmrg#
741bd8ad950Smrg# This file is free software; the Free Software Foundation
742bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
743bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
744ea6ae205Smrg
745bd8ad950Smrg# _AM_MANGLE_OPTION(NAME)
746bd8ad950Smrg# -----------------------
747bd8ad950SmrgAC_DEFUN([_AM_MANGLE_OPTION],
748bd8ad950Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
749ea6ae205Smrg
750bd8ad950Smrg# _AM_SET_OPTION(NAME)
751bd8ad950Smrg# --------------------
752bd8ad950Smrg# Set option NAME.  Presently that only means defining a flag for this option.
753bd8ad950SmrgAC_DEFUN([_AM_SET_OPTION],
754bd8ad950Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
755e83ac88aSmrg
756bd8ad950Smrg# _AM_SET_OPTIONS(OPTIONS)
757bd8ad950Smrg# ------------------------
758bd8ad950Smrg# OPTIONS is a space-separated list of Automake options.
759bd8ad950SmrgAC_DEFUN([_AM_SET_OPTIONS],
760bd8ad950Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
761ea6ae205Smrg
762bd8ad950Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
763bd8ad950Smrg# -------------------------------------------
764bd8ad950Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
765bd8ad950SmrgAC_DEFUN([_AM_IF_OPTION],
766bd8ad950Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
767bd8ad950Smrg
768bd8ad950Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
76912458b28Smrg#
770bd8ad950Smrg# This file is free software; the Free Software Foundation
771bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
772bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
77387aef7c3Smrg
774bd8ad950Smrg# _AM_PROG_CC_C_O
775bd8ad950Smrg# ---------------
776bd8ad950Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
777bd8ad950Smrg# to automatically call this.
778bd8ad950SmrgAC_DEFUN([_AM_PROG_CC_C_O],
779bd8ad950Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
780bd8ad950SmrgAC_REQUIRE_AUX_FILE([compile])dnl
781bd8ad950SmrgAC_LANG_PUSH([C])dnl
782bd8ad950SmrgAC_CACHE_CHECK(
783bd8ad950Smrg  [whether $CC understands -c and -o together],
784bd8ad950Smrg  [am_cv_prog_cc_c_o],
785bd8ad950Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
786bd8ad950Smrg  # Make sure it works both with $CC and with simple cc.
787bd8ad950Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
788bd8ad950Smrg  # compilers refuse to overwrite an existing .o file with -o,
789bd8ad950Smrg  # though they will create one.
790bd8ad950Smrg  am_cv_prog_cc_c_o=yes
791bd8ad950Smrg  for am_i in 1 2; do
792bd8ad950Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
793bd8ad950Smrg         && test -f conftest2.$ac_objext; then
794bd8ad950Smrg      : OK
795bd8ad950Smrg    else
796bd8ad950Smrg      am_cv_prog_cc_c_o=no
797bd8ad950Smrg      break
798bd8ad950Smrg    fi
799bd8ad950Smrg  done
800bd8ad950Smrg  rm -f core conftest*
801bd8ad950Smrg  unset am_i])
802bd8ad950Smrgif test "$am_cv_prog_cc_c_o" != yes; then
803bd8ad950Smrg   # Losing compiler, so override with the script.
804bd8ad950Smrg   # FIXME: It is wrong to rewrite CC.
805bd8ad950Smrg   # But if we don't then we get into trouble of one sort or another.
806bd8ad950Smrg   # A longer-term fix would be to have automake use am__CC in this case,
807bd8ad950Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
808bd8ad950Smrg   CC="$am_aux_dir/compile $CC"
80912458b28Smrgfi
810bd8ad950SmrgAC_LANG_POP([C])])
81187aef7c3Smrg
812bd8ad950Smrg# For backward compatibility.
813bd8ad950SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81487aef7c3Smrg
815bd8ad950Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
81612458b28Smrg#
817bd8ad950Smrg# This file is free software; the Free Software Foundation
818bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
819bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
82087aef7c3Smrg
821bd8ad950Smrg# AM_RUN_LOG(COMMAND)
822bd8ad950Smrg# -------------------
823bd8ad950Smrg# Run COMMAND, save the exit status in ac_status, and log it.
824bd8ad950Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
825bd8ad950SmrgAC_DEFUN([AM_RUN_LOG],
826bd8ad950Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
827bd8ad950Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
828bd8ad950Smrg   ac_status=$?
829bd8ad950Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
830bd8ad950Smrg   (exit $ac_status); }])
83187aef7c3Smrg
832bd8ad950Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
833663cdc11Smrg
834bd8ad950Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
835bd8ad950Smrg#
836bd8ad950Smrg# This file is free software; the Free Software Foundation
837bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
838bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
839663cdc11Smrg
840bd8ad950Smrg# AM_SANITY_CHECK
841bd8ad950Smrg# ---------------
842bd8ad950SmrgAC_DEFUN([AM_SANITY_CHECK],
843bd8ad950Smrg[AC_MSG_CHECKING([whether build environment is sane])
844bd8ad950Smrg# Reject unsafe characters in $srcdir or the absolute working directory
845bd8ad950Smrg# name.  Accept space and tab only in the latter.
846bd8ad950Smrgam_lf='
847bd8ad950Smrg'
848bd8ad950Smrgcase `pwd` in
849bd8ad950Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850bd8ad950Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851bd8ad950Smrgesac
852bd8ad950Smrgcase $srcdir in
853bd8ad950Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
854bd8ad950Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855bd8ad950Smrgesac
856663cdc11Smrg
857bd8ad950Smrg# Do 'set' in a subshell so we don't clobber the current shell's
858bd8ad950Smrg# arguments.  Must try -L first in case configure is actually a
859bd8ad950Smrg# symlink; some systems play weird games with the mod time of symlinks
860bd8ad950Smrg# (eg FreeBSD returns the mod time of the symlink's containing
861bd8ad950Smrg# directory).
862bd8ad950Smrgif (
863bd8ad950Smrg   am_has_slept=no
864bd8ad950Smrg   for am_try in 1 2; do
865bd8ad950Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
866bd8ad950Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
867bd8ad950Smrg     if test "$[*]" = "X"; then
868bd8ad950Smrg	# -L didn't work.
869bd8ad950Smrg	set X `ls -t "$srcdir/configure" conftest.file`
870bd8ad950Smrg     fi
871bd8ad950Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
872bd8ad950Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
873663cdc11Smrg
874bd8ad950Smrg	# If neither matched, then we have a broken ls.  This can happen
875bd8ad950Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
876bd8ad950Smrg	# broken ls alias from the environment.  This has actually
877bd8ad950Smrg	# happened.  Such a system could not be considered "sane".
878bd8ad950Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
879bd8ad950Smrg  alias in your environment])
880bd8ad950Smrg     fi
881bd8ad950Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
882bd8ad950Smrg       break
883bd8ad950Smrg     fi
884bd8ad950Smrg     # Just in case.
885bd8ad950Smrg     sleep 1
886bd8ad950Smrg     am_has_slept=yes
887bd8ad950Smrg   done
888bd8ad950Smrg   test "$[2]" = conftest.file
889bd8ad950Smrg   )
890bd8ad950Smrgthen
891bd8ad950Smrg   # Ok.
892bd8ad950Smrg   :
893663cdc11Smrgelse
894bd8ad950Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
895bd8ad950SmrgCheck your system clock])
89612458b28Smrgfi
897bd8ad950SmrgAC_MSG_RESULT([yes])
898bd8ad950Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
899bd8ad950Smrg# generated files are strictly newer.
900bd8ad950Smrgam_sleep_pid=
901bd8ad950Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
902bd8ad950Smrg  ( sleep 1 ) &
903bd8ad950Smrg  am_sleep_pid=$!
90412458b28Smrgfi
905bd8ad950SmrgAC_CONFIG_COMMANDS_PRE(
906bd8ad950Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
907bd8ad950Smrg   if test -n "$am_sleep_pid"; then
908bd8ad950Smrg     # Hide warnings about reused PIDs.
909bd8ad950Smrg     wait $am_sleep_pid 2>/dev/null
91012458b28Smrg   fi
911bd8ad950Smrg   AC_MSG_RESULT([done])])
912bd8ad950Smrgrm -f conftest.file
913bd8ad950Smrg])
914d87830e5Smrg
915bd8ad950Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
91612458b28Smrg#
917bd8ad950Smrg# This file is free software; the Free Software Foundation
918bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
919bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
920d87830e5Smrg
921bd8ad950Smrg# AM_SILENT_RULES([DEFAULT])
922bd8ad950Smrg# --------------------------
923bd8ad950Smrg# Enable less verbose build rules; with the default set to DEFAULT
924bd8ad950Smrg# ("yes" being less verbose, "no" or empty being verbose).
925bd8ad950SmrgAC_DEFUN([AM_SILENT_RULES],
926bd8ad950Smrg[AC_ARG_ENABLE([silent-rules], [dnl
927bd8ad950SmrgAS_HELP_STRING(
928bd8ad950Smrg  [--enable-silent-rules],
929bd8ad950Smrg  [less verbose build output (undo: "make V=1")])
930bd8ad950SmrgAS_HELP_STRING(
931bd8ad950Smrg  [--disable-silent-rules],
932bd8ad950Smrg  [verbose build output (undo: "make V=0")])dnl
933bd8ad950Smrg])
934bd8ad950Smrgcase $enable_silent_rules in @%:@ (((
935bd8ad950Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
936bd8ad950Smrg   no) AM_DEFAULT_VERBOSITY=1;;
937bd8ad950Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938bd8ad950Smrgesac
939bd8ad950Smrgdnl
940bd8ad950Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
941bd8ad950Smrgdnl do not support nested variable expansions.
942bd8ad950Smrgdnl See automake bug#9928 and bug#10237.
943bd8ad950Smrgam_make=${MAKE-make}
944bd8ad950SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
945bd8ad950Smrg   [am_cv_make_support_nested_variables],
946bd8ad950Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
947bd8ad950SmrgBAR0=false
948bd8ad950SmrgBAR1=true
949bd8ad950SmrgV=1
950bd8ad950Smrgam__doit:
951bd8ad950Smrg	@$(TRUE)
952bd8ad950Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
953bd8ad950Smrg  am_cv_make_support_nested_variables=yes
95412458b28Smrgelse
955bd8ad950Smrg  am_cv_make_support_nested_variables=no
95612458b28Smrgfi])
957bd8ad950Smrgif test $am_cv_make_support_nested_variables = yes; then
958bd8ad950Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
959bd8ad950Smrg  AM_V='$(V)'
960bd8ad950Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
961bd8ad950Smrgelse
962bd8ad950Smrg  AM_V=$AM_DEFAULT_VERBOSITY
963bd8ad950Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
964bd8ad950Smrgfi
965bd8ad950SmrgAC_SUBST([AM_V])dnl
966bd8ad950SmrgAM_SUBST_NOTMAKE([AM_V])dnl
967bd8ad950SmrgAC_SUBST([AM_DEFAULT_V])dnl
968bd8ad950SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969bd8ad950SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970bd8ad950SmrgAM_BACKSLASH='\'
971bd8ad950SmrgAC_SUBST([AM_BACKSLASH])dnl
972bd8ad950Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973bd8ad950Smrg])
974663cdc11Smrg
975bd8ad950Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
97612458b28Smrg#
977bd8ad950Smrg# This file is free software; the Free Software Foundation
978bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
979bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
980bd8ad950Smrg
981bd8ad950Smrg# AM_PROG_INSTALL_STRIP
982bd8ad950Smrg# ---------------------
983bd8ad950Smrg# One issue with vendor 'install' (even GNU) is that you can't
984bd8ad950Smrg# specify the program used to strip binaries.  This is especially
985bd8ad950Smrg# annoying in cross-compiling environments, where the build's strip
986bd8ad950Smrg# is unlikely to handle the host's binaries.
987bd8ad950Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
988bd8ad950Smrg# always use install-sh in "make install-strip", and initialize
989bd8ad950Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
990bd8ad950SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
991bd8ad950Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
992bd8ad950Smrg# Installed binaries are usually stripped using 'strip' when the user
993bd8ad950Smrg# run "make install-strip".  However 'strip' might not be the right
994bd8ad950Smrg# tool to use in cross-compilation environments, therefore Automake
995bd8ad950Smrg# will honor the 'STRIP' environment variable to overrule this program.
996bd8ad950Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
997bd8ad950Smrgif test "$cross_compiling" != no; then
998bd8ad950Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
999bd8ad950Smrgfi
1000bd8ad950SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1001bd8ad950SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1002bd8ad950Smrg
1003bd8ad950Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
100412458b28Smrg#
1005bd8ad950Smrg# This file is free software; the Free Software Foundation
1006bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
1007bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
1008ea6ae205Smrg
1009bd8ad950Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1010bd8ad950Smrg# ---------------------------
1011bd8ad950Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1012bd8ad950Smrg# This macro is traced by Automake.
1013bd8ad950SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101412458b28Smrg
1015bd8ad950Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1016bd8ad950Smrg# --------------------------
1017bd8ad950Smrg# Public sister of _AM_SUBST_NOTMAKE.
1018bd8ad950SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019bd8ad950Smrg
1020bd8ad950Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1021bd8ad950Smrg
1022bd8ad950Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
10237978d3cdSmrg#
1024bd8ad950Smrg# This file is free software; the Free Software Foundation
1025bd8ad950Smrg# gives unlimited permission to copy and/or distribute it,
1026bd8ad950Smrg# with or without modifications, as long as this notice is preserved.
1027bd8ad950Smrg
1028bd8ad950Smrg# _AM_PROG_TAR(FORMAT)
1029bd8ad950Smrg# --------------------
1030bd8ad950Smrg# Check how to create a tarball in format FORMAT.
1031bd8ad950Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10327978d3cdSmrg#
1033bd8ad950Smrg# Substitute a variable $(am__tar) that is a command
1034bd8ad950Smrg# writing to stdout a FORMAT-tarball containing the directory
1035bd8ad950Smrg# $tardir.
1036bd8ad950Smrg#     tardir=directory && $(am__tar) > result.tar
10377978d3cdSmrg#
1038bd8ad950Smrg# Substitute a variable $(am__untar) that extract such
1039bd8ad950Smrg# a tarball read from stdin.
1040bd8ad950Smrg#     $(am__untar) < result.tar
10417978d3cdSmrg#
1042bd8ad950SmrgAC_DEFUN([_AM_PROG_TAR],
1043bd8ad950Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1044bd8ad950Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1045bd8ad950SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1046ea6ae205Smrg
1047bd8ad950Smrg# We'll loop over all known methods to create a tar archive until one works.
1048bd8ad950Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1049ea6ae205Smrg
1050bd8ad950Smrgm4_if([$1], [v7],
1051bd8ad950Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1052ea6ae205Smrg
1053bd8ad950Smrg  [m4_case([$1],
1054bd8ad950Smrg    [ustar],
1055bd8ad950Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1056bd8ad950Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1057bd8ad950Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1058bd8ad950Smrg      # and bug#13588).
1059bd8ad950Smrg      am_max_uid=2097151 # 2^21 - 1
1060bd8ad950Smrg      am_max_gid=$am_max_uid
1061bd8ad950Smrg      # The $UID and $GID variables are not portable, so we need to resort
1062bd8ad950Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1063bd8ad950Smrg      # below are definitely unexpected, so allow the users to see them
1064bd8ad950Smrg      # (that is, avoid stderr redirection).
1065bd8ad950Smrg      am_uid=`id -u || echo unknown`
1066bd8ad950Smrg      am_gid=`id -g || echo unknown`
1067bd8ad950Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1068bd8ad950Smrg      if test $am_uid -le $am_max_uid; then
1069bd8ad950Smrg         AC_MSG_RESULT([yes])
1070bd8ad950Smrg      else
1071bd8ad950Smrg         AC_MSG_RESULT([no])
1072bd8ad950Smrg         _am_tools=none
1073bd8ad950Smrg      fi
1074bd8ad950Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1075bd8ad950Smrg      if test $am_gid -le $am_max_gid; then
1076bd8ad950Smrg         AC_MSG_RESULT([yes])
1077bd8ad950Smrg      else
1078bd8ad950Smrg        AC_MSG_RESULT([no])
1079bd8ad950Smrg        _am_tools=none
1080bd8ad950Smrg      fi],
108112458b28Smrg
1082bd8ad950Smrg  [pax],
1083bd8ad950Smrg    [],
1084bd8ad950Smrg
1085bd8ad950Smrg  [m4_fatal([Unknown tar format])])
1086bd8ad950Smrg
1087bd8ad950Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1088bd8ad950Smrg
1089bd8ad950Smrg  # Go ahead even if we have the value already cached.  We do so because we
1090bd8ad950Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1091bd8ad950Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1092bd8ad950Smrg
1093bd8ad950Smrg  for _am_tool in $_am_tools; do
1094bd8ad950Smrg    case $_am_tool in
1095bd8ad950Smrg    gnutar)
1096bd8ad950Smrg      for _am_tar in tar gnutar gtar; do
1097bd8ad950Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1098bd8ad950Smrg      done
1099bd8ad950Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1100bd8ad950Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1101bd8ad950Smrg      am__untar="$_am_tar -xf -"
1102bd8ad950Smrg      ;;
1103bd8ad950Smrg    plaintar)
1104bd8ad950Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1105bd8ad950Smrg      # ustar tarball either.
1106bd8ad950Smrg      (tar --version) >/dev/null 2>&1 && continue
1107bd8ad950Smrg      am__tar='tar chf - "$$tardir"'
1108bd8ad950Smrg      am__tar_='tar chf - "$tardir"'
1109bd8ad950Smrg      am__untar='tar xf -'
1110bd8ad950Smrg      ;;
1111bd8ad950Smrg    pax)
1112bd8ad950Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1113bd8ad950Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1114bd8ad950Smrg      am__untar='pax -r'
1115bd8ad950Smrg      ;;
1116bd8ad950Smrg    cpio)
1117bd8ad950Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1118bd8ad950Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1119bd8ad950Smrg      am__untar='cpio -i -H $1 -d'
1120bd8ad950Smrg      ;;
1121bd8ad950Smrg    none)
1122bd8ad950Smrg      am__tar=false
1123bd8ad950Smrg      am__tar_=false
1124bd8ad950Smrg      am__untar=false
1125bd8ad950Smrg      ;;
1126bd8ad950Smrg    esac
1127bd8ad950Smrg
1128bd8ad950Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1129bd8ad950Smrg    # and am__untar set.
1130bd8ad950Smrg    test -n "${am_cv_prog_tar_$1}" && break
1131bd8ad950Smrg
1132bd8ad950Smrg    # tar/untar a dummy directory, and stop if the command works.
1133bd8ad950Smrg    rm -rf conftest.dir
1134bd8ad950Smrg    mkdir conftest.dir
1135bd8ad950Smrg    echo GrepMe > conftest.dir/file
1136bd8ad950Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1137bd8ad950Smrg    rm -rf conftest.dir
1138bd8ad950Smrg    if test -s conftest.tar; then
1139bd8ad950Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1140bd8ad950Smrg      AM_RUN_LOG([cat conftest.dir/file])
1141bd8ad950Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1142bd8ad950Smrg    fi
1143bd8ad950Smrg  done
1144bd8ad950Smrg  rm -rf conftest.dir
1145bd8ad950Smrg
1146bd8ad950Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1147bd8ad950Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1148bd8ad950Smrg
1149bd8ad950SmrgAC_SUBST([am__tar])
1150bd8ad950SmrgAC_SUBST([am__untar])
1151bd8ad950Smrg]) # _AM_PROG_TAR
1152bd8ad950Smrg
1153bd8ad950Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1154bd8ad950Smrgdnl serial 11 (pkg-config-0.29)
1155bd8ad950Smrgdnl
1156bd8ad950Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1157bd8ad950Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1158bd8ad950Smrgdnl
1159bd8ad950Smrgdnl This program is free software; you can redistribute it and/or modify
1160bd8ad950Smrgdnl it under the terms of the GNU General Public License as published by
1161bd8ad950Smrgdnl the Free Software Foundation; either version 2 of the License, or
1162bd8ad950Smrgdnl (at your option) any later version.
1163bd8ad950Smrgdnl
1164bd8ad950Smrgdnl This program is distributed in the hope that it will be useful, but
1165bd8ad950Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1166bd8ad950Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1167bd8ad950Smrgdnl General Public License for more details.
1168bd8ad950Smrgdnl
1169bd8ad950Smrgdnl You should have received a copy of the GNU General Public License
1170bd8ad950Smrgdnl along with this program; if not, write to the Free Software
1171bd8ad950Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1172bd8ad950Smrgdnl 02111-1307, USA.
1173bd8ad950Smrgdnl
1174bd8ad950Smrgdnl As a special exception to the GNU General Public License, if you
1175bd8ad950Smrgdnl distribute this file as part of a program that contains a
1176bd8ad950Smrgdnl configuration script generated by Autoconf, you may include it under
1177bd8ad950Smrgdnl the same distribution terms that you use for the rest of that
1178bd8ad950Smrgdnl program.
1179bd8ad950Smrg
1180bd8ad950Smrgdnl PKG_PREREQ(MIN-VERSION)
1181bd8ad950Smrgdnl -----------------------
1182bd8ad950Smrgdnl Since: 0.29
1183bd8ad950Smrgdnl
1184bd8ad950Smrgdnl Verify that the version of the pkg-config macros are at least
1185bd8ad950Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1186bd8ad950Smrgdnl installed version of pkg-config, this checks the developer's version
1187bd8ad950Smrgdnl of pkg.m4 when generating configure.
1188bd8ad950Smrgdnl
1189bd8ad950Smrgdnl To ensure that this macro is defined, also add:
1190bd8ad950Smrgdnl m4_ifndef([PKG_PREREQ],
1191bd8ad950Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1192bd8ad950Smrgdnl
1193bd8ad950Smrgdnl See the "Since" comment for each macro you use to see what version
1194bd8ad950Smrgdnl of the macros you require.
1195bd8ad950Smrgm4_defun([PKG_PREREQ],
1196bd8ad950Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1197bd8ad950Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1198bd8ad950Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1199bd8ad950Smrg])dnl PKG_PREREQ
1200bd8ad950Smrg
1201bd8ad950Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1202bd8ad950Smrgdnl ----------------------------------
1203bd8ad950Smrgdnl Since: 0.16
1204bd8ad950Smrgdnl
1205bd8ad950Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1206bd8ad950Smrgdnl first found in the path. Checks that the version of pkg-config found
1207bd8ad950Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1208bd8ad950Smrgdnl used since that's the first version where most current features of
1209bd8ad950Smrgdnl pkg-config existed.
1210bd8ad950SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1211bd8ad950Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1212bd8ad950Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1213bd8ad950Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1214bd8ad950SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1215bd8ad950SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1216bd8ad950SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1217bd8ad950Smrg
1218bd8ad950Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1219bd8ad950Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1220bd8ad950Smrgfi
1221bd8ad950Smrgif test -n "$PKG_CONFIG"; then
1222bd8ad950Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1223bd8ad950Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1224bd8ad950Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1225bd8ad950Smrg		AC_MSG_RESULT([yes])
1226bd8ad950Smrg	else
1227bd8ad950Smrg		AC_MSG_RESULT([no])
1228bd8ad950Smrg		PKG_CONFIG=""
1229bd8ad950Smrg	fi
1230bd8ad950Smrgfi[]dnl
1231bd8ad950Smrg])dnl PKG_PROG_PKG_CONFIG
1232bd8ad950Smrg
1233bd8ad950Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1234bd8ad950Smrgdnl -------------------------------------------------------------------
1235bd8ad950Smrgdnl Since: 0.18
1236bd8ad950Smrgdnl
1237bd8ad950Smrgdnl Check to see whether a particular set of modules exists. Similar to
1238bd8ad950Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1239bd8ad950Smrgdnl
1240bd8ad950Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1241bd8ad950Smrgdnl only at the first occurence in configure.ac, so if the first place
1242bd8ad950Smrgdnl it's called might be skipped (such as if it is within an "if", you
1243bd8ad950Smrgdnl have to call PKG_CHECK_EXISTS manually
1244bd8ad950SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1245bd8ad950Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1246bd8ad950Smrgif test -n "$PKG_CONFIG" && \
1247bd8ad950Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1248bd8ad950Smrg  m4_default([$2], [:])
1249bd8ad950Smrgm4_ifvaln([$3], [else
1250bd8ad950Smrg  $3])dnl
1251bd8ad950Smrgfi])
1252bd8ad950Smrg
1253bd8ad950Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1254bd8ad950Smrgdnl ---------------------------------------------
1255bd8ad950Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1256bd8ad950Smrgdnl pkg_failed based on the result.
1257bd8ad950Smrgm4_define([_PKG_CONFIG],
1258bd8ad950Smrg[if test -n "$$1"; then
1259bd8ad950Smrg    pkg_cv_[]$1="$$1"
1260bd8ad950Smrg elif test -n "$PKG_CONFIG"; then
1261bd8ad950Smrg    PKG_CHECK_EXISTS([$3],
1262bd8ad950Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1263bd8ad950Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1264bd8ad950Smrg		     [pkg_failed=yes])
1265bd8ad950Smrg else
1266bd8ad950Smrg    pkg_failed=untried
1267bd8ad950Smrgfi[]dnl
1268bd8ad950Smrg])dnl _PKG_CONFIG
1269bd8ad950Smrg
1270bd8ad950Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1271bd8ad950Smrgdnl ---------------------------
1272bd8ad950Smrgdnl Internal check to see if pkg-config supports short errors.
1273bd8ad950SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1274bd8ad950Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1275bd8ad950Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1276bd8ad950Smrg        _pkg_short_errors_supported=yes
1277bd8ad950Smrgelse
1278bd8ad950Smrg        _pkg_short_errors_supported=no
1279bd8ad950Smrgfi[]dnl
1280bd8ad950Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1281bd8ad950Smrg
1282bd8ad950Smrg
1283bd8ad950Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1284bd8ad950Smrgdnl   [ACTION-IF-NOT-FOUND])
1285bd8ad950Smrgdnl --------------------------------------------------------------
1286bd8ad950Smrgdnl Since: 0.4.0
1287bd8ad950Smrgdnl
1288bd8ad950Smrgdnl Note that if there is a possibility the first call to
1289bd8ad950Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1290bd8ad950Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1291bd8ad950SmrgAC_DEFUN([PKG_CHECK_MODULES],
1292bd8ad950Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1293bd8ad950SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1294bd8ad950SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129512458b28Smrg
1296bd8ad950Smrgpkg_failed=no
1297bd8ad950SmrgAC_MSG_CHECKING([for $1])
1298ea6ae205Smrg
1299bd8ad950Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1300bd8ad950Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1301ea6ae205Smrg
1302bd8ad950Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1303bd8ad950Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1304bd8ad950SmrgSee the pkg-config man page for more details.])
1305d87830e5Smrg
1306bd8ad950Smrgif test $pkg_failed = yes; then
1307bd8ad950Smrg   	AC_MSG_RESULT([no])
1308bd8ad950Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1309bd8ad950Smrg        if test $_pkg_short_errors_supported = yes; then
1310bd8ad950Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1311bd8ad950Smrg        else 
1312bd8ad950Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1313bd8ad950Smrg        fi
1314bd8ad950Smrg	# Put the nasty error message in config.log where it belongs
1315bd8ad950Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1316ea6ae205Smrg
1317bd8ad950Smrg	m4_default([$4], [AC_MSG_ERROR(
1318bd8ad950Smrg[Package requirements ($2) were not met:
1319ea6ae205Smrg
1320bd8ad950Smrg$$1_PKG_ERRORS
1321ea6ae205Smrg
1322bd8ad950SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1323bd8ad950Smrginstalled software in a non-standard prefix.
1324ea6ae205Smrg
1325bd8ad950Smrg_PKG_TEXT])[]dnl
1326bd8ad950Smrg        ])
1327bd8ad950Smrgelif test $pkg_failed = untried; then
1328bd8ad950Smrg     	AC_MSG_RESULT([no])
1329bd8ad950Smrg	m4_default([$4], [AC_MSG_FAILURE(
1330bd8ad950Smrg[The pkg-config script could not be found or is too old.  Make sure it
1331bd8ad950Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1332bd8ad950Smrgpath to pkg-config.
1333ea6ae205Smrg
1334bd8ad950Smrg_PKG_TEXT
1335b6f2c9ccSmrg
1336bd8ad950SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1337bd8ad950Smrg        ])
1338b6f2c9ccSmrgelse
1339bd8ad950Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1340bd8ad950Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1341bd8ad950Smrg        AC_MSG_RESULT([yes])
1342bd8ad950Smrg	$3
1343bd8ad950Smrgfi[]dnl
1344bd8ad950Smrg])dnl PKG_CHECK_MODULES
1345b6f2c9ccSmrg
1346ea6ae205Smrg
1347bd8ad950Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1348bd8ad950Smrgdnl   [ACTION-IF-NOT-FOUND])
1349bd8ad950Smrgdnl ---------------------------------------------------------------------
1350bd8ad950Smrgdnl Since: 0.29
1351bd8ad950Smrgdnl
1352bd8ad950Smrgdnl Checks for existence of MODULES and gathers its build flags with
1353bd8ad950Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1354bd8ad950Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1355bd8ad950Smrgdnl
1356bd8ad950Smrgdnl Note that if there is a possibility the first call to
1357bd8ad950Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1358bd8ad950Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1359bd8ad950Smrgdnl configure.ac.
1360bd8ad950SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1361bd8ad950Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1362bd8ad950Smrg_save_PKG_CONFIG=$PKG_CONFIG
1363bd8ad950SmrgPKG_CONFIG="$PKG_CONFIG --static"
1364bd8ad950SmrgPKG_CHECK_MODULES($@)
1365bd8ad950SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1366bd8ad950Smrg])dnl PKG_CHECK_MODULES_STATIC
1367ea6ae205Smrg
1368ea6ae205Smrg
1369bd8ad950Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1370bd8ad950Smrgdnl -------------------------
1371bd8ad950Smrgdnl Since: 0.27
1372bd8ad950Smrgdnl
1373bd8ad950Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1374bd8ad950Smrgdnl should install pkg-config .pc files. By default the directory is
1375bd8ad950Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1376bd8ad950Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1377bd8ad950Smrgdnl parameter.
1378bd8ad950SmrgAC_DEFUN([PKG_INSTALLDIR],
1379bd8ad950Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1380bd8ad950Smrgm4_pushdef([pkg_description],
1381bd8ad950Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1382bd8ad950SmrgAC_ARG_WITH([pkgconfigdir],
1383bd8ad950Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1384bd8ad950Smrg    [with_pkgconfigdir=]pkg_default)
1385bd8ad950SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1386bd8ad950Smrgm4_popdef([pkg_default])
1387bd8ad950Smrgm4_popdef([pkg_description])
1388bd8ad950Smrg])dnl PKG_INSTALLDIR
1389ea6ae205Smrg
1390ea6ae205Smrg
1391bd8ad950Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1392bd8ad950Smrgdnl --------------------------------
1393bd8ad950Smrgdnl Since: 0.27
1394bd8ad950Smrgdnl
1395bd8ad950Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1396bd8ad950Smrgdnl module should install arch-independent pkg-config .pc files. By
1397bd8ad950Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1398bd8ad950Smrgdnl changed by passing DIRECTORY. The user can override through the
1399bd8ad950Smrgdnl --with-noarch-pkgconfigdir parameter.
1400bd8ad950SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1401bd8ad950Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1402bd8ad950Smrgm4_pushdef([pkg_description],
1403bd8ad950Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1404bd8ad950SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1405bd8ad950Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1406bd8ad950Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1407bd8ad950SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1408bd8ad950Smrgm4_popdef([pkg_default])
1409bd8ad950Smrgm4_popdef([pkg_description])
1410bd8ad950Smrg])dnl PKG_NOARCH_INSTALLDIR
1411bd8ad950Smrg
1412bd8ad950Smrg
1413bd8ad950Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1414bd8ad950Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1415bd8ad950Smrgdnl -------------------------------------------
1416bd8ad950Smrgdnl Since: 0.28
1417bd8ad950Smrgdnl
1418bd8ad950Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1419bd8ad950SmrgAC_DEFUN([PKG_CHECK_VAR],
1420bd8ad950Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1421bd8ad950SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1422bd8ad950Smrg
1423bd8ad950Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1424bd8ad950SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1425bd8ad950Smrg
1426bd8ad950SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1427bd8ad950Smrg])dnl PKG_CHECK_VAR
1428bd8ad950Smrg
1429bd8ad950Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1430bd8ad950Smrgdnl
1431bd8ad950Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
1432bd8ad950Smrgdnl
1433bd8ad950Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1434bd8ad950Smrgdnl copy of this software and associated documentation files (the "Software"),
1435bd8ad950Smrgdnl to deal in the Software without restriction, including without limitation
1436bd8ad950Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1437bd8ad950Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1438bd8ad950Smrgdnl Software is furnished to do so, subject to the following conditions:
1439bd8ad950Smrgdnl
1440bd8ad950Smrgdnl The above copyright notice and this permission notice (including the next
1441bd8ad950Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1442bd8ad950Smrgdnl Software.
1443bd8ad950Smrgdnl
1444bd8ad950Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1445bd8ad950Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1446bd8ad950Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1447bd8ad950Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1448bd8ad950Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1449bd8ad950Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1450bd8ad950Smrgdnl DEALINGS IN THE SOFTWARE.
1451bd8ad950Smrg
1452bd8ad950Smrg# XORG_MACROS_VERSION(required-version)
1453bd8ad950Smrg# -------------------------------------
1454bd8ad950Smrg# Minimum version: 1.1.0
1455bd8ad950Smrg#
1456bd8ad950Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1457bd8ad950Smrg# your configure.ac with the minimum required version, such as:
1458bd8ad950Smrg# XORG_MACROS_VERSION(1.1)
1459bd8ad950Smrg#
1460bd8ad950Smrg# To ensure that this macro is defined, also add:
1461bd8ad950Smrg# m4_ifndef([XORG_MACROS_VERSION],
1462bd8ad950Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1463bd8ad950Smrg#
1464bd8ad950Smrg#
1465bd8ad950Smrg# See the "minimum version" comment for each macro you use to see what
1466bd8ad950Smrg# version you require.
1467bd8ad950Smrgm4_defun([XORG_MACROS_VERSION],[
1468bd8ad950Smrgm4_define([vers_have], [1.19.2])
1469bd8ad950Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1470bd8ad950Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1471bd8ad950Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1472bd8ad950Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1473bd8ad950Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1474bd8ad950Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1475bd8ad950Smrgm4_undefine([vers_have])
1476bd8ad950Smrgm4_undefine([maj_have])
1477bd8ad950Smrgm4_undefine([maj_needed])
1478bd8ad950Smrg]) # XORG_MACROS_VERSION
1479bd8ad950Smrg
1480bd8ad950Smrg# XORG_PROG_RAWCPP()
1481bd8ad950Smrg# ------------------
148212458b28Smrg# Minimum version: 1.0.0
148312458b28Smrg#
1484bd8ad950Smrg# Find cpp program and necessary flags for use in pre-processing text files
1485bd8ad950Smrg# such as man pages and config files
1486bd8ad950SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1487bd8ad950SmrgAC_REQUIRE([AC_PROG_CPP])
1488bd8ad950SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1489bd8ad950Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1490ea6ae205Smrg
1491bd8ad950Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1492bd8ad950Smrg# which is not the best choice for supporting other OS'es, but covers most
1493bd8ad950Smrg# of the ones we need for now.
1494bd8ad950SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1495bd8ad950SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1496bd8ad950Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1497bd8ad950Smrg	AC_MSG_RESULT([no])
1498bd8ad950Smrgelse
1499bd8ad950Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1500bd8ad950Smrg		RAWCPPFLAGS=-undef
1501bd8ad950Smrg		AC_MSG_RESULT([yes])
1502bd8ad950Smrg	# under Cygwin unix is still defined even with -undef
1503bd8ad950Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1504bd8ad950Smrg		RAWCPPFLAGS="-undef -ansi"
1505bd8ad950Smrg		AC_MSG_RESULT([yes, with -ansi])
1506bd8ad950Smrg	else
1507bd8ad950Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1508bd8ad950Smrg	fi
150912458b28Smrgfi
1510bd8ad950Smrgrm -f conftest.$ac_ext
1511ea6ae205Smrg
1512bd8ad950SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1513bd8ad950SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1514bd8ad950Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1515bd8ad950Smrg	AC_MSG_RESULT([no])
15167978d3cdSmrgelse
1517bd8ad950Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1518bd8ad950Smrg		TRADITIONALCPPFLAGS="-traditional"
1519bd8ad950Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1520bd8ad950Smrg		AC_MSG_RESULT([yes])
1521bd8ad950Smrg	else
1522bd8ad950Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1523bd8ad950Smrg	fi
15247978d3cdSmrgfi
1525bd8ad950Smrgrm -f conftest.$ac_ext
1526bd8ad950SmrgAC_SUBST(RAWCPPFLAGS)
1527bd8ad950SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1528bd8ad950Smrg]) # XORG_PROG_RAWCPP
1529ea6ae205Smrg
1530bd8ad950Smrg# XORG_MANPAGE_SECTIONS()
1531bd8ad950Smrg# -----------------------
1532bd8ad950Smrg# Minimum version: 1.0.0
153312458b28Smrg#
1534bd8ad950Smrg# Determine which sections man pages go in for the different man page types
1535bd8ad950Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1536bd8ad950Smrg# Not sure if there's any better way than just hardcoding by OS name.
1537bd8ad950Smrg# Override default settings by setting environment variables
1538bd8ad950Smrg# Added MAN_SUBSTS in version 1.8
1539bd8ad950Smrg# Added AC_PROG_SED in version 1.8
1540ea6ae205Smrg
1541bd8ad950SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1542bd8ad950SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1543bd8ad950SmrgAC_REQUIRE([AC_PROG_SED])
1544ea6ae205Smrg
154512458b28Smrgcase $host_os in
1546bd8ad950Smrg    solaris*)
1547bd8ad950Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1548bd8ad950Smrg        # check for a man page file found in later versions that use
1549bd8ad950Smrg        # traditional section numbers instead
1550bd8ad950Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1551bd8ad950Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1552bd8ad950Smrg        ;;
1553bd8ad950Smrg    *) SYSV_MAN_SECTIONS=false ;;
155412458b28Smrgesac
1555ea6ae205Smrg
1556bd8ad950Smrgif test x$APP_MAN_SUFFIX = x    ; then
1557bd8ad950Smrg    APP_MAN_SUFFIX=1
15587978d3cdSmrgfi
1559bd8ad950Smrgif test x$APP_MAN_DIR = x    ; then
1560bd8ad950Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1561ea6ae205Smrgfi
1562ea6ae205Smrg
1563bd8ad950Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1564bd8ad950Smrg    LIB_MAN_SUFFIX=3
1565bd8ad950Smrgfi
1566bd8ad950Smrgif test x$LIB_MAN_DIR = x    ; then
1567bd8ad950Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1568bd8ad950Smrgfi
1569ea6ae205Smrg
1570bd8ad950Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1571bd8ad950Smrg    case $SYSV_MAN_SECTIONS in
1572bd8ad950Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1573bd8ad950Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1574bd8ad950Smrg    esac
1575bd8ad950Smrgfi
1576bd8ad950Smrgif test x$FILE_MAN_DIR = x    ; then
1577bd8ad950Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1578bd8ad950Smrgfi
1579ea6ae205Smrg
1580bd8ad950Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1581bd8ad950Smrg    case $SYSV_MAN_SECTIONS in
1582bd8ad950Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1583bd8ad950Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1584bd8ad950Smrg    esac
1585bd8ad950Smrgfi
1586bd8ad950Smrgif test x$MISC_MAN_DIR = x    ; then
1587bd8ad950Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1588bd8ad950Smrgfi
1589b6f2c9ccSmrg
1590bd8ad950Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1591bd8ad950Smrg    case $SYSV_MAN_SECTIONS in
1592bd8ad950Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1593bd8ad950Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1594bd8ad950Smrg    esac
1595bd8ad950Smrgfi
1596bd8ad950Smrgif test x$DRIVER_MAN_DIR = x    ; then
1597bd8ad950Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1598bd8ad950Smrgfi
159912458b28Smrg
1600bd8ad950Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1601bd8ad950Smrg    case $SYSV_MAN_SECTIONS in
1602bd8ad950Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1603bd8ad950Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1604bd8ad950Smrg    esac
1605bd8ad950Smrgfi
1606bd8ad950Smrgif test x$ADMIN_MAN_DIR = x    ; then
1607bd8ad950Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1608b6f2c9ccSmrgfi
1609b6f2c9ccSmrg
1610b6f2c9ccSmrg
1611bd8ad950SmrgAC_SUBST([APP_MAN_SUFFIX])
1612bd8ad950SmrgAC_SUBST([LIB_MAN_SUFFIX])
1613bd8ad950SmrgAC_SUBST([FILE_MAN_SUFFIX])
1614bd8ad950SmrgAC_SUBST([MISC_MAN_SUFFIX])
1615bd8ad950SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1616bd8ad950SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1617bd8ad950SmrgAC_SUBST([APP_MAN_DIR])
1618bd8ad950SmrgAC_SUBST([LIB_MAN_DIR])
1619bd8ad950SmrgAC_SUBST([FILE_MAN_DIR])
1620bd8ad950SmrgAC_SUBST([MISC_MAN_DIR])
1621bd8ad950SmrgAC_SUBST([DRIVER_MAN_DIR])
1622bd8ad950SmrgAC_SUBST([ADMIN_MAN_DIR])
162312458b28Smrg
1624bd8ad950SmrgXORG_MAN_PAGE="X Version 11"
1625bd8ad950SmrgAC_SUBST([XORG_MAN_PAGE])
1626bd8ad950SmrgMAN_SUBSTS="\
1627bd8ad950Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1628bd8ad950Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1629bd8ad950Smrg	-e 's|__xservername__|Xorg|g' \
1630bd8ad950Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1631bd8ad950Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1632bd8ad950Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1633bd8ad950Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1634bd8ad950Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1635bd8ad950Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1636bd8ad950Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1637bd8ad950Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1638bd8ad950Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1639bd8ad950SmrgAC_SUBST([MAN_SUBSTS])
1640b6f2c9ccSmrg
1641bd8ad950Smrg]) # XORG_MANPAGE_SECTIONS
1642bd8ad950Smrg
1643bd8ad950Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1644bd8ad950Smrg# ------------------------
1645bd8ad950Smrg# Minimum version: 1.7.0
1646245f6787Smrg#
1647bd8ad950Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1648bd8ad950Smrg# provided by xorg-sgml-doctools, if installed.
1649bd8ad950SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1650bd8ad950SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1651bd8ad950SmrgXORG_SGML_PATH=
1652bd8ad950SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1653bd8ad950Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1654bd8ad950Smrg    [m4_ifval([$1],[:],
1655bd8ad950Smrg        [if test x"$cross_compiling" != x"yes" ; then
1656bd8ad950Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1657bd8ad950Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1658bd8ad950Smrg         fi])
1659bd8ad950Smrg    ])
1660bd8ad950Smrg
1661bd8ad950Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1662bd8ad950Smrg# the path and the name of the doc stylesheet
1663bd8ad950Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1664bd8ad950Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1665bd8ad950Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1666bd8ad950Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1667bd8ad950Smrgelse
1668bd8ad950Smrg   AC_MSG_RESULT([no])
1669bd8ad950Smrgfi
1670bd8ad950Smrg
1671bd8ad950SmrgAC_SUBST(XORG_SGML_PATH)
1672bd8ad950SmrgAC_SUBST(STYLESHEET_SRCDIR)
1673bd8ad950SmrgAC_SUBST(XSL_STYLESHEET)
1674bd8ad950SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1675bd8ad950Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1676bd8ad950Smrg
1677bd8ad950Smrg# XORG_CHECK_LINUXDOC
1678bd8ad950Smrg# -------------------
1679bd8ad950Smrg# Minimum version: 1.0.0
168012458b28Smrg#
1681bd8ad950Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1682bd8ad950Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1683bd8ad950Smrg# Whether or not the necessary tools and files are found can be checked
1684bd8ad950Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1685bd8ad950SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1686bd8ad950SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1687bd8ad950SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1688bd8ad950Smrg
1689bd8ad950SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1690bd8ad950Smrg
1691bd8ad950SmrgAC_MSG_CHECKING([whether to build documentation])
169212458b28Smrg
1693bd8ad950Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1694bd8ad950Smrg   BUILDDOC=yes
1695bd8ad950Smrgelse
1696bd8ad950Smrg   BUILDDOC=no
1697bd8ad950Smrgfi
169812458b28Smrg
1699bd8ad950SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
170012458b28Smrg
1701bd8ad950SmrgAC_MSG_RESULT([$BUILDDOC])
170212458b28Smrg
1703bd8ad950SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170412458b28Smrg
1705bd8ad950Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1706bd8ad950Smrg   BUILDPDFDOC=yes
1707bd8ad950Smrgelse
1708bd8ad950Smrg   BUILDPDFDOC=no
170912458b28Smrgfi
171012458b28Smrg
1711bd8ad950SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171212458b28Smrg
1713bd8ad950SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171412458b28Smrg
1715bd8ad950SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1716bd8ad950SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1717bd8ad950SmrgMAKE_PDF="$PS2PDF"
1718bd8ad950SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171912458b28Smrg
1720bd8ad950SmrgAC_SUBST(MAKE_TEXT)
1721bd8ad950SmrgAC_SUBST(MAKE_PS)
1722bd8ad950SmrgAC_SUBST(MAKE_PDF)
1723bd8ad950SmrgAC_SUBST(MAKE_HTML)
1724bd8ad950Smrg]) # XORG_CHECK_LINUXDOC
172512458b28Smrg
1726bd8ad950Smrg# XORG_CHECK_DOCBOOK
1727bd8ad950Smrg# -------------------
1728bd8ad950Smrg# Minimum version: 1.0.0
1729bd8ad950Smrg#
1730bd8ad950Smrg# Checks for the ability to build output formats from SGML DocBook source.
1731bd8ad950Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1732bd8ad950Smrg# indicates whether the necessary tools and files are found and, if set,
1733bd8ad950Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1734bd8ad950SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1735bd8ad950SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173612458b28Smrg
1737bd8ad950SmrgBUILDTXTDOC=no
1738bd8ad950SmrgBUILDPDFDOC=no
1739bd8ad950SmrgBUILDPSDOC=no
1740bd8ad950SmrgBUILDHTMLDOC=no
174112458b28Smrg
1742bd8ad950SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1743bd8ad950SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1744bd8ad950SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1745bd8ad950SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1746245f6787Smrg
1747bd8ad950SmrgAC_MSG_CHECKING([whether to build text documentation])
1748bd8ad950Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1749bd8ad950Smrg   test x$BUILD_TXTDOC != xno; then
1750bd8ad950Smrg	BUILDTXTDOC=yes
1751bd8ad950Smrgfi
1752bd8ad950SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1753bd8ad950SmrgAC_MSG_RESULT([$BUILDTXTDOC])
175412458b28Smrg
1755bd8ad950SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1756bd8ad950Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1757bd8ad950Smrg   test x$BUILD_PDFDOC != xno; then
1758bd8ad950Smrg	BUILDPDFDOC=yes
1759245f6787Smrgfi
1760bd8ad950SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1761bd8ad950SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1762245f6787Smrg
1763bd8ad950SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1764bd8ad950Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1765bd8ad950Smrg   test x$BUILD_PSDOC != xno; then
1766bd8ad950Smrg	BUILDPSDOC=yes
1767bd8ad950Smrgfi
1768bd8ad950SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1769bd8ad950SmrgAC_MSG_RESULT([$BUILDPSDOC])
1770245f6787Smrg
1771bd8ad950SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1772bd8ad950Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1773bd8ad950Smrg   test x$BUILD_HTMLDOC != xno; then
1774bd8ad950Smrg	BUILDHTMLDOC=yes
1775bd8ad950Smrgfi
1776bd8ad950SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1777bd8ad950SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177812458b28Smrg
1779bd8ad950SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1780bd8ad950SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1781bd8ad950SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1782bd8ad950SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178312458b28Smrg
1784bd8ad950SmrgAC_SUBST(MAKE_TEXT)
1785bd8ad950SmrgAC_SUBST(MAKE_PS)
1786bd8ad950SmrgAC_SUBST(MAKE_PDF)
1787bd8ad950SmrgAC_SUBST(MAKE_HTML)
1788bd8ad950Smrg]) # XORG_CHECK_DOCBOOK
178912458b28Smrg
1790bd8ad950Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1791bd8ad950Smrg# ----------------
1792bd8ad950Smrg# Minimum version: 1.5.0
1793bd8ad950Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1794bd8ad950Smrg#
1795bd8ad950Smrg# Documentation tools are not always available on all platforms and sometimes
1796bd8ad950Smrg# not at the appropriate level. This macro enables a module to test for the
1797bd8ad950Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1798bd8ad950Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1799bd8ad950Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1800bd8ad950Smrg# --with-xmlto assumes 'auto'.
1801bd8ad950Smrg#
1802bd8ad950Smrg# Interface to module:
1803bd8ad950Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1804bd8ad950Smrg# XMLTO:	returns the path of the xmlto program found
1805bd8ad950Smrg#		returns the path set by the user in the environment
1806bd8ad950Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1807bd8ad950Smrg#		'no' user instructs the module not to use xmlto
1808bd8ad950Smrg#
1809bd8ad950Smrg# Added in version 1.10.0
1810bd8ad950Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1811bd8ad950Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1812bd8ad950Smrg#
1813bd8ad950Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1814bd8ad950Smrg#
1815bd8ad950SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1816bd8ad950SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1817bd8ad950Smrgm4_define([_defopt], m4_default([$2], [auto]))
1818bd8ad950SmrgAC_ARG_WITH(xmlto,
1819bd8ad950Smrg	AS_HELP_STRING([--with-xmlto],
1820bd8ad950Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1821bd8ad950Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1822bd8ad950Smrgm4_undefine([_defopt])
182312458b28Smrg
1824bd8ad950Smrgif test "x$use_xmlto" = x"auto"; then
1825bd8ad950Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1826bd8ad950Smrg   if test "x$XMLTO" = "x"; then
1827bd8ad950Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1828bd8ad950Smrg	have_xmlto=no
1829bd8ad950Smrg   else
1830bd8ad950Smrg        have_xmlto=yes
1831bd8ad950Smrg   fi
1832bd8ad950Smrgelif test "x$use_xmlto" = x"yes" ; then
1833bd8ad950Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1834bd8ad950Smrg   if test "x$XMLTO" = "x"; then
1835bd8ad950Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1836bd8ad950Smrg   fi
1837bd8ad950Smrg   have_xmlto=yes
1838bd8ad950Smrgelif test "x$use_xmlto" = x"no" ; then
1839bd8ad950Smrg   if test "x$XMLTO" != "x"; then
1840bd8ad950Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1841bd8ad950Smrg   fi
1842bd8ad950Smrg   have_xmlto=no
184312458b28Smrgelse
1844bd8ad950Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184512458b28Smrgfi
184612458b28Smrg
1847bd8ad950Smrg# Test for a minimum version of xmlto, if provided.
1848bd8ad950Smrgm4_ifval([$1],
1849bd8ad950Smrg[if test "$have_xmlto" = yes; then
1850bd8ad950Smrg    # scrape the xmlto version
1851bd8ad950Smrg    AC_MSG_CHECKING([the xmlto version])
1852bd8ad950Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1853bd8ad950Smrg    AC_MSG_RESULT([$xmlto_version])
1854bd8ad950Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1855bd8ad950Smrg        [if test "x$use_xmlto" = xauto; then
1856bd8ad950Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1857bd8ad950Smrg            have_xmlto=no
1858bd8ad950Smrg        else
1859bd8ad950Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1860bd8ad950Smrg        fi])
1861bd8ad950Smrgfi])
186212458b28Smrg
1863bd8ad950Smrg# Test for the ability of xmlto to generate a text target
1864245f6787Smrg#
1865bd8ad950Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1866bd8ad950Smrg# following test for empty XML docbook files.
1867bd8ad950Smrg# For compatibility reasons use the following empty XML docbook file and if
1868bd8ad950Smrg# it fails try it again with a non-empty XML file.
1869bd8ad950Smrghave_xmlto_text=no
1870bd8ad950Smrgcat > conftest.xml << "EOF"
1871bd8ad950SmrgEOF
1872bd8ad950SmrgAS_IF([test "$have_xmlto" = yes],
1873bd8ad950Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1874bd8ad950Smrg             [have_xmlto_text=yes],
1875bd8ad950Smrg             [# Try it again with a non-empty XML file.
1876bd8ad950Smrg              cat > conftest.xml << "EOF"
1877bd8ad950Smrg<x></x>
1878bd8ad950SmrgEOF
1879bd8ad950Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1880bd8ad950Smrg                    [have_xmlto_text=yes],
1881bd8ad950Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1882bd8ad950Smrgrm -f conftest.xml
1883bd8ad950SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1884bd8ad950SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1885bd8ad950Smrg]) # XORG_WITH_XMLTO
1886bd8ad950Smrg
1887bd8ad950Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1888bd8ad950Smrg# --------------------------------------------
1889bd8ad950Smrg# Minimum version: 1.12.0
1890bd8ad950Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1891245f6787Smrg#
1892bd8ad950Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1893bd8ad950Smrg# XML-based language used for the transformation of XML documents.
1894bd8ad950Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1895bd8ad950Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1896bd8ad950Smrg# The XSLT processor is often used as a standalone tool for transformations.
1897bd8ad950Smrg# It should not be assumed that this tool is used only to work with documnetation.
1898bd8ad950Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1899245f6787Smrg#
1900bd8ad950Smrg# Interface to module:
1901bd8ad950Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1902bd8ad950Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1903bd8ad950Smrg#		 returns the path set by the user in the environment
1904bd8ad950Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1905bd8ad950Smrg#		  'no' user instructs the module not to use xsltproc
1906bd8ad950Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1907245f6787Smrg#
1908bd8ad950Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1909245f6787Smrg#
1910bd8ad950SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1911bd8ad950SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1912bd8ad950Smrg# Preserves the interface, should it be implemented later
1913bd8ad950Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1914bd8ad950Smrgm4_define([_defopt], m4_default([$2], [auto]))
1915bd8ad950SmrgAC_ARG_WITH(xsltproc,
1916bd8ad950Smrg	AS_HELP_STRING([--with-xsltproc],
1917bd8ad950Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1918bd8ad950Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1919bd8ad950Smrgm4_undefine([_defopt])
192012458b28Smrg
1921bd8ad950Smrgif test "x$use_xsltproc" = x"auto"; then
1922bd8ad950Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1923bd8ad950Smrg   if test "x$XSLTPROC" = "x"; then
1924bd8ad950Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1925bd8ad950Smrg	have_xsltproc=no
1926bd8ad950Smrg   else
1927bd8ad950Smrg        have_xsltproc=yes
1928bd8ad950Smrg   fi
1929bd8ad950Smrgelif test "x$use_xsltproc" = x"yes" ; then
1930bd8ad950Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1931bd8ad950Smrg   if test "x$XSLTPROC" = "x"; then
1932bd8ad950Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1933bd8ad950Smrg   fi
1934bd8ad950Smrg   have_xsltproc=yes
1935bd8ad950Smrgelif test "x$use_xsltproc" = x"no" ; then
1936bd8ad950Smrg   if test "x$XSLTPROC" != "x"; then
1937bd8ad950Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1938bd8ad950Smrg   fi
1939bd8ad950Smrg   have_xsltproc=no
1940bd8ad950Smrgelse
1941bd8ad950Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1942245f6787Smrgfi
1943245f6787Smrg
1944bd8ad950SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1945bd8ad950Smrg]) # XORG_WITH_XSLTPROC
1946bd8ad950Smrg
1947bd8ad950Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1948bd8ad950Smrg# ----------------------------------------
1949bd8ad950Smrg# Minimum version: 1.15.0
195012458b28Smrg#
1951bd8ad950Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1952bd8ad950Smrg# scanning arbitrary text files, extracting information from those text files,
1953bd8ad950Smrg# and printing reports based on that information.
195412458b28Smrg#
1955bd8ad950Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1956b6f2c9ccSmrg#
1957bd8ad950Smrg# Interface to module:
1958bd8ad950Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1959bd8ad950Smrg# PERL:	     returns the path of the perl program found
1960bd8ad950Smrg#	     returns the path set by the user in the environment
1961bd8ad950Smrg# --with-perl: 'yes' user instructs the module to use perl
1962bd8ad950Smrg#	       'no' user instructs the module not to use perl
1963bd8ad950Smrg# have_perl: returns yes if perl found in PATH or no
1964b6f2c9ccSmrg#
1965bd8ad950Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1966bd8ad950Smrg#
1967bd8ad950SmrgAC_DEFUN([XORG_WITH_PERL],[
1968bd8ad950SmrgAC_ARG_VAR([PERL], [Path to perl command])
1969bd8ad950Smrg# Preserves the interface, should it be implemented later
1970bd8ad950Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1971bd8ad950Smrgm4_define([_defopt], m4_default([$2], [auto]))
1972bd8ad950SmrgAC_ARG_WITH(perl,
1973bd8ad950Smrg	AS_HELP_STRING([--with-perl],
1974bd8ad950Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1975bd8ad950Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1976bd8ad950Smrgm4_undefine([_defopt])
1977b6f2c9ccSmrg
1978bd8ad950Smrgif test "x$use_perl" = x"auto"; then
1979bd8ad950Smrg   AC_PATH_PROG([PERL], [perl])
1980bd8ad950Smrg   if test "x$PERL" = "x"; then
1981bd8ad950Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1982bd8ad950Smrg	have_perl=no
1983bd8ad950Smrg   else
1984bd8ad950Smrg        have_perl=yes
1985bd8ad950Smrg   fi
1986bd8ad950Smrgelif test "x$use_perl" = x"yes" ; then
1987bd8ad950Smrg   AC_PATH_PROG([PERL], [perl])
1988bd8ad950Smrg   if test "x$PERL" = "x"; then
1989bd8ad950Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1990bd8ad950Smrg   fi
1991bd8ad950Smrg   have_perl=yes
1992bd8ad950Smrgelif test "x$use_perl" = x"no" ; then
1993bd8ad950Smrg   if test "x$PERL" != "x"; then
1994bd8ad950Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1995bd8ad950Smrg   fi
1996bd8ad950Smrg   have_perl=no
1997bd8ad950Smrgelse
1998bd8ad950Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1999bd8ad950Smrgfi
2000b6f2c9ccSmrg
2001bd8ad950SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2002bd8ad950Smrg]) # XORG_WITH_PERL
200312458b28Smrg
2004bd8ad950Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200512458b28Smrg# ----------------
2006bd8ad950Smrg# Minimum version: 1.5.0
2007bd8ad950Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2008b6f2c9ccSmrg#
2009bd8ad950Smrg# Documentation tools are not always available on all platforms and sometimes
2010bd8ad950Smrg# not at the appropriate level. This macro enables a module to test for the
2011bd8ad950Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2012bd8ad950Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
2013bd8ad950Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2014bd8ad950Smrg# --with-asciidoc assumes 'auto'.
2015b6f2c9ccSmrg#
2016bd8ad950Smrg# Interface to module:
2017bd8ad950Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2018bd8ad950Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2019bd8ad950Smrg#		 returns the path set by the user in the environment
2020bd8ad950Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2021bd8ad950Smrg#		  'no' user instructs the module not to use asciidoc
2022b6f2c9ccSmrg#
2023bd8ad950Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2024b6f2c9ccSmrg#
2025bd8ad950SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2026bd8ad950SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2027bd8ad950Smrgm4_define([_defopt], m4_default([$2], [auto]))
2028bd8ad950SmrgAC_ARG_WITH(asciidoc,
2029bd8ad950Smrg	AS_HELP_STRING([--with-asciidoc],
2030bd8ad950Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2031bd8ad950Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2032bd8ad950Smrgm4_undefine([_defopt])
2033b6f2c9ccSmrg
2034bd8ad950Smrgif test "x$use_asciidoc" = x"auto"; then
2035bd8ad950Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2036bd8ad950Smrg   if test "x$ASCIIDOC" = "x"; then
2037bd8ad950Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2038bd8ad950Smrg	have_asciidoc=no
2039bd8ad950Smrg   else
2040bd8ad950Smrg        have_asciidoc=yes
2041bd8ad950Smrg   fi
2042bd8ad950Smrgelif test "x$use_asciidoc" = x"yes" ; then
2043bd8ad950Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2044bd8ad950Smrg   if test "x$ASCIIDOC" = "x"; then
2045bd8ad950Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2046bd8ad950Smrg   fi
2047bd8ad950Smrg   have_asciidoc=yes
2048bd8ad950Smrgelif test "x$use_asciidoc" = x"no" ; then
2049bd8ad950Smrg   if test "x$ASCIIDOC" != "x"; then
2050bd8ad950Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2051bd8ad950Smrg   fi
2052bd8ad950Smrg   have_asciidoc=no
2053bd8ad950Smrgelse
2054bd8ad950Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2055bd8ad950Smrgfi
2056bd8ad950Smrgm4_ifval([$1],
2057bd8ad950Smrg[if test "$have_asciidoc" = yes; then
2058bd8ad950Smrg    # scrape the asciidoc version
2059bd8ad950Smrg    AC_MSG_CHECKING([the asciidoc version])
2060bd8ad950Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2061bd8ad950Smrg    AC_MSG_RESULT([$asciidoc_version])
2062bd8ad950Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2063bd8ad950Smrg        [if test "x$use_asciidoc" = xauto; then
2064bd8ad950Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2065bd8ad950Smrg            have_asciidoc=no
2066bd8ad950Smrg        else
2067bd8ad950Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2068bd8ad950Smrg        fi])
2069bd8ad950Smrgfi])
2070bd8ad950SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2071bd8ad950Smrg]) # XORG_WITH_ASCIIDOC
207248f45e26Smrg
2073bd8ad950Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2074bd8ad950Smrg# -------------------------------------------
2075bd8ad950Smrg# Minimum version: 1.5.0
2076bd8ad950Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2077bd8ad950Smrg# Minimum version for optional DOT checking: 1.18.0
2078bd8ad950Smrg#
2079bd8ad950Smrg# Documentation tools are not always available on all platforms and sometimes
2080bd8ad950Smrg# not at the appropriate level. This macro enables a module to test for the
2081bd8ad950Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2082bd8ad950Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
2083bd8ad950Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2084bd8ad950Smrg# --with-doxygen assumes 'auto'.
2085bd8ad950Smrg#
2086bd8ad950Smrg# Interface to module:
2087bd8ad950Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2088bd8ad950Smrg# DOXYGEN:	 returns the path of the doxygen program found
2089bd8ad950Smrg#		 returns the path set by the user in the environment
2090bd8ad950Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2091bd8ad950Smrg#		  'no' user instructs the module not to use doxygen
2092bd8ad950Smrg#
2093bd8ad950Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2094bd8ad950Smrg#
2095bd8ad950SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2096bd8ad950SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2097bd8ad950SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2098bd8ad950Smrgm4_define([_defopt], m4_default([$2], [auto]))
2099bd8ad950SmrgAC_ARG_WITH(doxygen,
2100bd8ad950Smrg	AS_HELP_STRING([--with-doxygen],
2101bd8ad950Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2102bd8ad950Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2103bd8ad950Smrgm4_undefine([_defopt])
210448f45e26Smrg
2105bd8ad950Smrgif test "x$use_doxygen" = x"auto"; then
2106bd8ad950Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2107bd8ad950Smrg   if test "x$DOXYGEN" = "x"; then
2108bd8ad950Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2109bd8ad950Smrg	have_doxygen=no
2110bd8ad950Smrg   else
2111bd8ad950Smrg        have_doxygen=yes
2112bd8ad950Smrg   fi
2113bd8ad950Smrgelif test "x$use_doxygen" = x"yes" ; then
2114bd8ad950Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2115bd8ad950Smrg   if test "x$DOXYGEN" = "x"; then
2116bd8ad950Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2117bd8ad950Smrg   fi
2118bd8ad950Smrg   have_doxygen=yes
2119bd8ad950Smrgelif test "x$use_doxygen" = x"no" ; then
2120bd8ad950Smrg   if test "x$DOXYGEN" != "x"; then
2121bd8ad950Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2122bd8ad950Smrg   fi
2123bd8ad950Smrg   have_doxygen=no
2124bd8ad950Smrgelse
2125bd8ad950Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2126bd8ad950Smrgfi
2127bd8ad950Smrgm4_ifval([$1],
2128bd8ad950Smrg[if test "$have_doxygen" = yes; then
2129bd8ad950Smrg    # scrape the doxygen version
2130bd8ad950Smrg    AC_MSG_CHECKING([the doxygen version])
2131bd8ad950Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2132bd8ad950Smrg    AC_MSG_RESULT([$doxygen_version])
2133bd8ad950Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2134bd8ad950Smrg        [if test "x$use_doxygen" = xauto; then
2135bd8ad950Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2136bd8ad950Smrg            have_doxygen=no
2137bd8ad950Smrg        else
2138bd8ad950Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2139bd8ad950Smrg        fi])
2140bd8ad950Smrgfi])
2141b6f2c9ccSmrg
2142bd8ad950Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2143bd8ad950Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2144bd8ad950Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2145bd8ad950SmrgHAVE_DOT=no
2146bd8ad950Smrgif test "x$have_doxygen" = "xyes"; then
2147bd8ad950Smrg  AC_PATH_PROG([DOT], [dot])
2148bd8ad950Smrg    if test "x$DOT" != "x"; then
2149bd8ad950Smrg      HAVE_DOT=yes
2150bd8ad950Smrg    fi
2151bd8ad950Smrgfi
215212458b28Smrg
2153bd8ad950SmrgAC_SUBST([HAVE_DOT])
2154bd8ad950SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2155bd8ad950SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2156bd8ad950Smrg]) # XORG_WITH_DOXYGEN
215712458b28Smrg
2158bd8ad950Smrg# XORG_WITH_GROFF([DEFAULT])
2159bd8ad950Smrg# ----------------
2160bd8ad950Smrg# Minimum version: 1.6.0
2161bd8ad950Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2162b6f2c9ccSmrg#
2163bd8ad950Smrg# Documentation tools are not always available on all platforms and sometimes
2164bd8ad950Smrg# not at the appropriate level. This macro enables a module to test for the
2165bd8ad950Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2166bd8ad950Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
2167bd8ad950Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2168bd8ad950Smrg# --with-groff assumes 'auto'.
2169b6f2c9ccSmrg#
2170bd8ad950Smrg# Interface to module:
2171bd8ad950Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2172bd8ad950Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2173bd8ad950Smrg# HAVE_GROFF_MS: the -ms macros package
2174bd8ad950Smrg# GROFF:	 returns the path of the groff program found
2175bd8ad950Smrg#		 returns the path set by the user in the environment
2176bd8ad950Smrg# --with-groff:	 'yes' user instructs the module to use groff
2177bd8ad950Smrg#		 'no' user instructs the module not to use groff
2178b6f2c9ccSmrg#
2179bd8ad950Smrg# Added in version 1.9.0:
2180bd8ad950Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2181bd8ad950Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2182bd8ad950Smrg#		   psselect from the psutils package.
2183bd8ad950Smrg#		   the ghostcript package. Refer to the grohtml man pages
2184b6f2c9ccSmrg#
2185bd8ad950Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218612458b28Smrg#
2187bd8ad950Smrg# OS and distros often splits groff in a basic and full package, the former
2188bd8ad950Smrg# having the groff program and the later having devices, fonts and macros
2189bd8ad950Smrg# Checking for the groff executable is not enough.
219012458b28Smrg#
2191bd8ad950Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2192bd8ad950Smrg# unset HAVE_GROFF or GROFF env variables.
2193bd8ad950Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219412458b28Smrg#
2195bd8ad950SmrgAC_DEFUN([XORG_WITH_GROFF],[
2196bd8ad950SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2197bd8ad950Smrgm4_define([_defopt], m4_default([$1], [auto]))
2198bd8ad950SmrgAC_ARG_WITH(groff,
2199bd8ad950Smrg	AS_HELP_STRING([--with-groff],
2200bd8ad950Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2201bd8ad950Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2202bd8ad950Smrgm4_undefine([_defopt])
2203b6f2c9ccSmrg
2204bd8ad950Smrgif test "x$use_groff" = x"auto"; then
2205bd8ad950Smrg   AC_PATH_PROG([GROFF], [groff])
2206bd8ad950Smrg   if test "x$GROFF" = "x"; then
2207bd8ad950Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2208bd8ad950Smrg	have_groff=no
2209bd8ad950Smrg   else
2210bd8ad950Smrg        have_groff=yes
2211bd8ad950Smrg   fi
2212bd8ad950Smrgelif test "x$use_groff" = x"yes" ; then
2213bd8ad950Smrg   AC_PATH_PROG([GROFF], [groff])
2214bd8ad950Smrg   if test "x$GROFF" = "x"; then
2215bd8ad950Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2216bd8ad950Smrg   fi
2217bd8ad950Smrg   have_groff=yes
2218bd8ad950Smrgelif test "x$use_groff" = x"no" ; then
2219bd8ad950Smrg   if test "x$GROFF" != "x"; then
2220bd8ad950Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2221bd8ad950Smrg   fi
2222bd8ad950Smrg   have_groff=no
222312458b28Smrgelse
2224bd8ad950Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2225b6f2c9ccSmrgfi
2226b6f2c9ccSmrg
2227bd8ad950Smrg# We have groff, test for the presence of the macro packages
2228bd8ad950Smrgif test "x$have_groff" = x"yes"; then
2229bd8ad950Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2230bd8ad950Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2231bd8ad950Smrg        groff_ms_works=yes
2232bd8ad950Smrg    else
2233bd8ad950Smrg        groff_ms_works=no
2234bd8ad950Smrg    fi
2235bd8ad950Smrg    AC_MSG_RESULT([$groff_ms_works])
2236bd8ad950Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2237bd8ad950Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2238bd8ad950Smrg        groff_mm_works=yes
2239bd8ad950Smrg    else
2240bd8ad950Smrg        groff_mm_works=no
2241bd8ad950Smrg    fi
2242bd8ad950Smrg    AC_MSG_RESULT([$groff_mm_works])
2243bd8ad950Smrgfi
2244b6f2c9ccSmrg
2245bd8ad950Smrg# We have groff, test for HTML dependencies, one command per package
2246bd8ad950Smrgif test "x$have_groff" = x"yes"; then
2247bd8ad950Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2248bd8ad950Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2249bd8ad950Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2250bd8ad950Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2251bd8ad950Smrg      have_groff_html=yes
2252bd8ad950Smrg   else
2253bd8ad950Smrg      have_groff_html=no
2254bd8ad950Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2255bd8ad950Smrg   fi
2256bd8ad950Smrgfi
2257b6f2c9ccSmrg
2258bd8ad950Smrg# Set Automake conditionals for Makefiles
2259bd8ad950SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2260bd8ad950SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2261bd8ad950SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2262bd8ad950SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2263bd8ad950Smrg]) # XORG_WITH_GROFF
226412458b28Smrg
2265bd8ad950Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2266bd8ad950Smrg# ---------------------------------------
2267bd8ad950Smrg# Minimum version: 1.6.0
2268bd8ad950Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2269bd8ad950Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2270bd8ad950Smrg#
2271bd8ad950Smrg# Documentation tools are not always available on all platforms and sometimes
2272bd8ad950Smrg# not at the appropriate level. This macro enables a module to test for the
2273bd8ad950Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2274bd8ad950Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2275bd8ad950Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2276bd8ad950Smrg# --with-fop assumes 'auto'.
2277bd8ad950Smrg#
2278bd8ad950Smrg# Interface to module:
2279bd8ad950Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2280bd8ad950Smrg# FOP:	 	returns the path of the fop program found
2281bd8ad950Smrg#		returns the path set by the user in the environment
2282bd8ad950Smrg# --with-fop: 	'yes' user instructs the module to use fop
2283bd8ad950Smrg#		'no' user instructs the module not to use fop
2284bd8ad950Smrg#
2285bd8ad950Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2286bd8ad950Smrg#
2287bd8ad950SmrgAC_DEFUN([XORG_WITH_FOP],[
2288bd8ad950SmrgAC_ARG_VAR([FOP], [Path to fop command])
2289bd8ad950Smrgm4_define([_defopt], m4_default([$2], [auto]))
2290bd8ad950SmrgAC_ARG_WITH(fop,
2291bd8ad950Smrg	AS_HELP_STRING([--with-fop],
2292bd8ad950Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2293bd8ad950Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2294bd8ad950Smrgm4_undefine([_defopt])
2295bd8ad950Smrg
2296bd8ad950Smrgif test "x$use_fop" = x"auto"; then
2297bd8ad950Smrg   AC_PATH_PROG([FOP], [fop])
2298bd8ad950Smrg   if test "x$FOP" = "x"; then
2299bd8ad950Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2300bd8ad950Smrg	have_fop=no
2301bd8ad950Smrg   else
2302bd8ad950Smrg        have_fop=yes
2303bd8ad950Smrg   fi
2304bd8ad950Smrgelif test "x$use_fop" = x"yes" ; then
2305bd8ad950Smrg   AC_PATH_PROG([FOP], [fop])
2306bd8ad950Smrg   if test "x$FOP" = "x"; then
2307bd8ad950Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2308bd8ad950Smrg   fi
2309bd8ad950Smrg   have_fop=yes
2310bd8ad950Smrgelif test "x$use_fop" = x"no" ; then
2311bd8ad950Smrg   if test "x$FOP" != "x"; then
2312bd8ad950Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2313bd8ad950Smrg   fi
2314bd8ad950Smrg   have_fop=no
2315bd8ad950Smrgelse
2316bd8ad950Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2317b6f2c9ccSmrgfi
2318245f6787Smrg
2319bd8ad950Smrg# Test for a minimum version of fop, if provided.
2320bd8ad950Smrgm4_ifval([$1],
2321bd8ad950Smrg[if test "$have_fop" = yes; then
2322bd8ad950Smrg    # scrape the fop version
2323bd8ad950Smrg    AC_MSG_CHECKING([for fop minimum version])
2324bd8ad950Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2325bd8ad950Smrg    AC_MSG_RESULT([$fop_version])
2326bd8ad950Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2327bd8ad950Smrg        [if test "x$use_fop" = xauto; then
2328bd8ad950Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2329bd8ad950Smrg            have_fop=no
2330bd8ad950Smrg        else
2331bd8ad950Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2332bd8ad950Smrg        fi])
2333bd8ad950Smrgfi])
2334bd8ad950SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2335bd8ad950Smrg]) # XORG_WITH_FOP
2336b6f2c9ccSmrg
2337bd8ad950Smrg# XORG_WITH_M4([MIN-VERSION])
2338bd8ad950Smrg# ---------------------------
2339bd8ad950Smrg# Minimum version: 1.19.0
234048f45e26Smrg#
2341bd8ad950Smrg# This macro attempts to locate an m4 macro processor which supports
2342bd8ad950Smrg# -I option and is only useful for modules relying on M4 in order to
2343bd8ad950Smrg# expand macros in source code files.
2344bd8ad950Smrg#
2345bd8ad950Smrg# Interface to module:
2346bd8ad950Smrg# M4:	 	returns the path of the m4 program found
2347bd8ad950Smrg#		returns the path set by the user in the environment
2348bd8ad950Smrg#
2349bd8ad950SmrgAC_DEFUN([XORG_WITH_M4], [
2350bd8ad950SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2351bd8ad950Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2352bd8ad950Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2353bd8ad950Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2354bd8ad950Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2355bd8ad950Smrg   [$PATH:/usr/gnu/bin])])
235648f45e26Smrg
2357bd8ad950SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2358bd8ad950Smrg]) # XORG_WITH_M4
2359b6f2c9ccSmrg
2360bd8ad950Smrg# XORG_WITH_PS2PDF([DEFAULT])
2361bd8ad950Smrg# ----------------
2362bd8ad950Smrg# Minimum version: 1.6.0
2363bd8ad950Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2364bd8ad950Smrg#
2365bd8ad950Smrg# Documentation tools are not always available on all platforms and sometimes
2366bd8ad950Smrg# not at the appropriate level. This macro enables a module to test for the
2367bd8ad950Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2368bd8ad950Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2369bd8ad950Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2370bd8ad950Smrg# --with-ps2pdf assumes 'auto'.
2371bd8ad950Smrg#
2372bd8ad950Smrg# Interface to module:
2373bd8ad950Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2374bd8ad950Smrg# PS2PDF:	returns the path of the ps2pdf program found
2375bd8ad950Smrg#		returns the path set by the user in the environment
2376bd8ad950Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2377bd8ad950Smrg#		 'no' user instructs the module not to use ps2pdf
2378bd8ad950Smrg#
2379bd8ad950Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2380bd8ad950Smrg#
2381bd8ad950SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2382bd8ad950SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2383bd8ad950Smrgm4_define([_defopt], m4_default([$1], [auto]))
2384bd8ad950SmrgAC_ARG_WITH(ps2pdf,
2385bd8ad950Smrg	AS_HELP_STRING([--with-ps2pdf],
2386bd8ad950Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2387bd8ad950Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2388bd8ad950Smrgm4_undefine([_defopt])
2389bd8ad950Smrg
2390bd8ad950Smrgif test "x$use_ps2pdf" = x"auto"; then
2391bd8ad950Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2392bd8ad950Smrg   if test "x$PS2PDF" = "x"; then
2393bd8ad950Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2394bd8ad950Smrg	have_ps2pdf=no
2395bd8ad950Smrg   else
2396bd8ad950Smrg        have_ps2pdf=yes
2397bd8ad950Smrg   fi
2398bd8ad950Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2399bd8ad950Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2400bd8ad950Smrg   if test "x$PS2PDF" = "x"; then
2401bd8ad950Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2402bd8ad950Smrg   fi
2403bd8ad950Smrg   have_ps2pdf=yes
2404bd8ad950Smrgelif test "x$use_ps2pdf" = x"no" ; then
2405bd8ad950Smrg   if test "x$PS2PDF" != "x"; then
2406bd8ad950Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2407bd8ad950Smrg   fi
2408bd8ad950Smrg   have_ps2pdf=no
2409bd8ad950Smrgelse
2410bd8ad950Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2411bd8ad950Smrgfi
2412bd8ad950SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2413bd8ad950Smrg]) # XORG_WITH_PS2PDF
2414b6f2c9ccSmrg
2415bd8ad950Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2416bd8ad950Smrg# ----------------
2417bd8ad950Smrg# Minimum version: 1.6.0
2418bd8ad950Smrg#
2419bd8ad950Smrg# Documentation tools are not always available on all platforms and sometimes
2420bd8ad950Smrg# not at the appropriate level. This macro enables a builder to skip all
2421bd8ad950Smrg# documentation targets except traditional man pages.
2422bd8ad950Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2423bd8ad950Smrg# maximum flexibilty in controlling documentation building.
2424bd8ad950Smrg# Refer to:
2425bd8ad950Smrg# XORG_WITH_XMLTO         --with-xmlto
2426bd8ad950Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2427bd8ad950Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2428bd8ad950Smrg# XORG_WITH_FOP           --with-fop
2429bd8ad950Smrg# XORG_WITH_GROFF         --with-groff
2430bd8ad950Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2431bd8ad950Smrg#
2432bd8ad950Smrg# Interface to module:
2433bd8ad950Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2434bd8ad950Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2435bd8ad950Smrg#		 'no' user instructs the module not to generate docs
2436bd8ad950Smrg# parm1:	specify the default value, yes or no.
2437bd8ad950Smrg#
2438bd8ad950SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2439bd8ad950Smrgm4_define([docs_default], m4_default([$1], [yes]))
2440bd8ad950SmrgAC_ARG_ENABLE(docs,
2441bd8ad950Smrg	AS_HELP_STRING([--enable-docs],
2442bd8ad950Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2443bd8ad950Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2444bd8ad950Smrgm4_undefine([docs_default])
2445bd8ad950SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2446bd8ad950SmrgAC_MSG_CHECKING([whether to build documentation])
2447bd8ad950SmrgAC_MSG_RESULT([$build_docs])
2448bd8ad950Smrg]) # XORG_ENABLE_DOCS
2449b6f2c9ccSmrg
2450bd8ad950Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2451bd8ad950Smrg# ----------------
2452bd8ad950Smrg# Minimum version: 1.6.0
2453b6f2c9ccSmrg#
2454bd8ad950Smrg# This macro enables a builder to skip all developer documentation.
2455bd8ad950Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2456bd8ad950Smrg# maximum flexibilty in controlling documentation building.
2457bd8ad950Smrg# Refer to:
2458bd8ad950Smrg# XORG_WITH_XMLTO         --with-xmlto
2459bd8ad950Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2460bd8ad950Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2461bd8ad950Smrg# XORG_WITH_FOP           --with-fop
2462bd8ad950Smrg# XORG_WITH_GROFF         --with-groff
2463bd8ad950Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2464bd8ad950Smrg#
2465bd8ad950Smrg# Interface to module:
2466bd8ad950Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2467bd8ad950Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2468bd8ad950Smrg#			'no' user instructs the module not to generate developer docs
2469bd8ad950Smrg# parm1:		specify the default value, yes or no.
2470bd8ad950Smrg#
2471bd8ad950SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2472bd8ad950Smrgm4_define([devel_default], m4_default([$1], [yes]))
2473bd8ad950SmrgAC_ARG_ENABLE(devel-docs,
2474bd8ad950Smrg	AS_HELP_STRING([--enable-devel-docs],
2475bd8ad950Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2476bd8ad950Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2477bd8ad950Smrgm4_undefine([devel_default])
2478bd8ad950SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2479bd8ad950SmrgAC_MSG_CHECKING([whether to build developer documentation])
2480bd8ad950SmrgAC_MSG_RESULT([$build_devel_docs])
2481bd8ad950Smrg]) # XORG_ENABLE_DEVEL_DOCS
2482b6f2c9ccSmrg
2483bd8ad950Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2484bd8ad950Smrg# ----------------
2485bd8ad950Smrg# Minimum version: 1.6.0
2486bd8ad950Smrg#
2487bd8ad950Smrg# This macro enables a builder to skip all functional specification targets.
2488bd8ad950Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2489bd8ad950Smrg# maximum flexibilty in controlling documentation building.
2490bd8ad950Smrg# Refer to:
2491bd8ad950Smrg# XORG_WITH_XMLTO         --with-xmlto
2492bd8ad950Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2493bd8ad950Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2494bd8ad950Smrg# XORG_WITH_FOP           --with-fop
2495bd8ad950Smrg# XORG_WITH_GROFF         --with-groff
2496bd8ad950Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2497bd8ad950Smrg#
2498bd8ad950Smrg# Interface to module:
2499bd8ad950Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2500bd8ad950Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2501bd8ad950Smrg#			'no' user instructs the module not to generate specs
2502bd8ad950Smrg# parm1:		specify the default value, yes or no.
2503bd8ad950Smrg#
2504bd8ad950SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2505bd8ad950Smrgm4_define([spec_default], m4_default([$1], [yes]))
2506bd8ad950SmrgAC_ARG_ENABLE(specs,
2507bd8ad950Smrg	AS_HELP_STRING([--enable-specs],
2508bd8ad950Smrg	   [Enable building the specs (default: ]spec_default[)]),
2509bd8ad950Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2510bd8ad950Smrgm4_undefine([spec_default])
2511bd8ad950SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2512bd8ad950SmrgAC_MSG_CHECKING([whether to build functional specifications])
2513bd8ad950SmrgAC_MSG_RESULT([$build_specs])
2514bd8ad950Smrg]) # XORG_ENABLE_SPECS
2515b6f2c9ccSmrg
2516bd8ad950Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2517bd8ad950Smrg# ----------------------------------------------
2518bd8ad950Smrg# Minimum version: 1.13.0
2519245f6787Smrg#
2520bd8ad950Smrg# This macro enables a builder to enable/disable unit testing
2521bd8ad950Smrg# It makes no assumption about the test cases implementation
2522bd8ad950Smrg# Test cases may or may not use Automake "Support for test suites"
2523bd8ad950Smrg# They may or may not use the software utility library GLib
2524bd8ad950Smrg#
2525bd8ad950Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2526bd8ad950Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2527bd8ad950Smrg# The variable enable_unit_tests is used by other macros in this file.
2528bd8ad950Smrg#
2529bd8ad950Smrg# Interface to module:
2530bd8ad950Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2531bd8ad950Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2532bd8ad950Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2533bd8ad950Smrg#			'no' user instructs the module not to build tests
2534bd8ad950Smrg# parm1:		specify the default value, yes or no.
2535bd8ad950Smrg#
2536bd8ad950SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2537bd8ad950SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2538bd8ad950SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2539bd8ad950SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2540bd8ad950Smrgm4_define([_defopt], m4_default([$1], [auto]))
2541bd8ad950SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2542bd8ad950Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2543bd8ad950Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2544bd8ad950Smrgm4_undefine([_defopt])
2545bd8ad950SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2546bd8ad950SmrgAC_MSG_CHECKING([whether to build unit test cases])
2547bd8ad950SmrgAC_MSG_RESULT([$enable_unit_tests])
2548bd8ad950Smrg]) # XORG_ENABLE_UNIT_TESTS
2549245f6787Smrg
2550bd8ad950Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2551bd8ad950Smrg# ------------------------------------------------------
2552bd8ad950Smrg# Minimum version: 1.17.0
2553bd8ad950Smrg#
2554bd8ad950Smrg# This macro enables a builder to enable/disable integration testing
2555bd8ad950Smrg# It makes no assumption about the test cases' implementation
2556bd8ad950Smrg# Test cases may or may not use Automake "Support for test suites"
2557bd8ad950Smrg#
2558bd8ad950Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2559bd8ad950Smrg# usually requires less dependencies and may be built and run under less
2560bd8ad950Smrg# stringent environments than integration tests.
2561bd8ad950Smrg#
2562bd8ad950Smrg# Interface to module:
2563bd8ad950Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2564bd8ad950Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2565bd8ad950Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2566bd8ad950Smrg#                             'no' user instructs the module not to build tests
2567bd8ad950Smrg# parm1:                      specify the default value, yes or no.
2568bd8ad950Smrg#
2569bd8ad950SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2570bd8ad950SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2571bd8ad950Smrgm4_define([_defopt], m4_default([$1], [auto]))
2572bd8ad950SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2573bd8ad950Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2574bd8ad950Smrg	[enable_integration_tests=$enableval],
2575bd8ad950Smrg	[enable_integration_tests=]_defopt)
2576bd8ad950Smrgm4_undefine([_defopt])
2577bd8ad950SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2578bd8ad950Smrg	[test "x$enable_integration_tests" != xno])
2579bd8ad950SmrgAC_MSG_CHECKING([whether to build unit test cases])
2580bd8ad950SmrgAC_MSG_RESULT([$enable_integration_tests])
2581bd8ad950Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
258287aef7c3Smrg
2583bd8ad950Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2584bd8ad950Smrg# ----------------------------------------
2585bd8ad950Smrg# Minimum version: 1.13.0
2586bd8ad950Smrg#
2587bd8ad950Smrg# GLib is a library which provides advanced data structures and functions.
2588bd8ad950Smrg# This macro enables a module to test for the presence of Glib.
2589bd8ad950Smrg#
2590bd8ad950Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2591bd8ad950Smrg# Otherwise the value of $enable_unit_tests is blank.
2592bd8ad950Smrg#
2593bd8ad950Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2594bd8ad950Smrg# test support usually requires less dependencies and may be built and run under
2595bd8ad950Smrg# less stringent environments than integration tests.
2596bd8ad950Smrg#
2597bd8ad950Smrg# Interface to module:
2598bd8ad950Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2599bd8ad950Smrg# with_glib: used in configure.ac to know if GLib has been found
2600bd8ad950Smrg# --with-glib:	'yes' user instructs the module to use glib
2601bd8ad950Smrg#		'no' user instructs the module not to use glib
2602bd8ad950Smrg#
2603bd8ad950SmrgAC_DEFUN([XORG_WITH_GLIB],[
2604bd8ad950SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2605bd8ad950Smrgm4_define([_defopt], m4_default([$2], [auto]))
2606bd8ad950SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2607bd8ad950Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2608bd8ad950Smrg	[with_glib=$withval], [with_glib=]_defopt)
2609bd8ad950Smrgm4_undefine([_defopt])
2610245f6787Smrg
2611bd8ad950Smrghave_glib=no
2612bd8ad950Smrg# Do not probe GLib if user explicitly disabled unit testing
2613bd8ad950Smrgif test "x$enable_unit_tests" != x"no"; then
2614bd8ad950Smrg  # Do not probe GLib if user explicitly disabled it
2615bd8ad950Smrg  if test "x$with_glib" != x"no"; then
2616bd8ad950Smrg    m4_ifval(
2617bd8ad950Smrg      [$1],
2618bd8ad950Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2619bd8ad950Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2620bd8ad950Smrg    )
2621245f6787Smrg  fi
2622245f6787Smrgfi
2623245f6787Smrg
2624bd8ad950Smrg# Not having GLib when unit testing has been explicitly requested is an error
2625bd8ad950Smrgif test "x$enable_unit_tests" = x"yes"; then
2626bd8ad950Smrg  if test "x$have_glib" = x"no"; then
2627bd8ad950Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2628245f6787Smrg  fi
2629245f6787Smrgfi
2630663cdc11Smrg
2631bd8ad950Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2632bd8ad950Smrgif test "x$enable_unit_tests" = x"no"; then
2633bd8ad950Smrg  if test "x$with_glib" = x"yes"; then
2634bd8ad950Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2635bd8ad950Smrg  fi
2636bd8ad950Smrgfi
2637663cdc11Smrg
2638bd8ad950Smrg# Not having GLib when it has been explicitly requested is an error
2639bd8ad950Smrgif test "x$with_glib" = x"yes"; then
2640bd8ad950Smrg  if test "x$have_glib" = x"no"; then
2641bd8ad950Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264212458b28Smrg  fi
2643663cdc11Smrgfi
2644663cdc11Smrg
2645bd8ad950SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2646bd8ad950Smrg]) # XORG_WITH_GLIB
2647663cdc11Smrg
2648bd8ad950Smrg# XORG_LD_WRAP([required|optional])
2649bd8ad950Smrg# ---------------------------------
2650bd8ad950Smrg# Minimum version: 1.13.0
2651bd8ad950Smrg#
2652bd8ad950Smrg# Check if linker supports -wrap, passed via compiler flags
2653bd8ad950Smrg#
2654bd8ad950Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2655bd8ad950Smrg# Otherwise the value of $enable_unit_tests is blank.
2656bd8ad950Smrg#
2657bd8ad950Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2658bd8ad950Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2659bd8ad950Smrg# available, an argument of "optional" allows use when some unit tests require
2660bd8ad950Smrg# ld -wrap and others do not.
2661bd8ad950Smrg#
2662bd8ad950SmrgAC_DEFUN([XORG_LD_WRAP],[
2663bd8ad950SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2664bd8ad950Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2665bd8ad950Smrg                      void __wrap_exit(int status) { return; }],
2666bd8ad950Smrg                     [exit(0);])])
2667bd8ad950Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2668bd8ad950Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2669bd8ad950Smrg  if test "x$have_ld_wrap" = x"no"; then
2670bd8ad950Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2671bd8ad950Smrg  fi
2672bd8ad950Smrgfi
2673bd8ad950SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2674bd8ad950Smrg#
2675bd8ad950Smrg]) # XORG_LD_WRAP
267612458b28Smrg
2677bd8ad950Smrg# XORG_CHECK_LINKER_FLAGS
2678bd8ad950Smrg# -----------------------
2679bd8ad950Smrg# SYNOPSIS
2680bd8ad950Smrg#
2681bd8ad950Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2682bd8ad950Smrg#
2683bd8ad950Smrg# DESCRIPTION
2684bd8ad950Smrg#
2685bd8ad950Smrg#   Check whether the given linker FLAGS work with the current language's
2686bd8ad950Smrg#   linker, or whether they give an error.
2687bd8ad950Smrg#
2688bd8ad950Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2689bd8ad950Smrg#   success/failure.
2690bd8ad950Smrg#
2691bd8ad950Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2692bd8ad950Smrg#
2693bd8ad950Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2694bd8ad950Smrg#
2695bd8ad950Smrg# LICENSE
2696bd8ad950Smrg#
2697bd8ad950Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2698bd8ad950Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2699bd8ad950Smrg#   Copyright (c) 2009 Matteo Frigo
2700bd8ad950Smrg#
2701bd8ad950Smrg#   This program is free software: you can redistribute it and/or modify it
2702bd8ad950Smrg#   under the terms of the GNU General Public License as published by the
2703bd8ad950Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2704bd8ad950Smrg#   option) any later version.
2705bd8ad950Smrg#
2706bd8ad950Smrg#   This program is distributed in the hope that it will be useful, but
2707bd8ad950Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2708bd8ad950Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2709bd8ad950Smrg#   Public License for more details.
2710bd8ad950Smrg#
2711bd8ad950Smrg#   You should have received a copy of the GNU General Public License along
2712bd8ad950Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2713bd8ad950Smrg#
2714bd8ad950Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2715bd8ad950Smrg#   gives unlimited permission to copy, distribute and modify the configure
2716bd8ad950Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2717bd8ad950Smrg#   need not follow the terms of the GNU General Public License when using
2718bd8ad950Smrg#   or distributing such scripts, even though portions of the text of the
2719bd8ad950Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2720bd8ad950Smrg#   all other use of the material that constitutes the Autoconf Macro.
2721bd8ad950Smrg#
2722bd8ad950Smrg#   This special exception to the GPL applies to versions of the Autoconf
2723bd8ad950Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2724bd8ad950Smrg#   modified version of the Autoconf Macro, you may extend this special
2725bd8ad950Smrg#   exception to the GPL to apply to your modified version as well.#
2726bd8ad950SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2727bd8ad950Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2728bd8ad950Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2729bd8ad950SmrgAS_LITERAL_IF([$1],
2730bd8ad950Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2731bd8ad950Smrg      ax_save_FLAGS=$LDFLAGS
2732bd8ad950Smrg      LDFLAGS="$1"
2733bd8ad950Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2734bd8ad950Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2735bd8ad950Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2736bd8ad950Smrg      LDFLAGS=$ax_save_FLAGS])],
2737bd8ad950Smrg  [ax_save_FLAGS=$LDFLAGS
2738bd8ad950Smrg   LDFLAGS="$1"
2739bd8ad950Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2740bd8ad950Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2741bd8ad950Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2742bd8ad950Smrg   LDFLAGS=$ax_save_FLAGS])
2743bd8ad950Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2744bd8ad950SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2745bd8ad950Smrgif test "x$xorg_check_linker_flags" = xyes; then
2746bd8ad950Smrg	m4_default([$2], :)
2747bd8ad950Smrgelse
2748bd8ad950Smrg	m4_default([$3], :)
2749bd8ad950Smrgfi
2750bd8ad950Smrg]) # XORG_CHECK_LINKER_FLAGS
275112458b28Smrg
2752bd8ad950Smrg# XORG_MEMORY_CHECK_FLAGS
2753bd8ad950Smrg# -----------------------
2754bd8ad950Smrg# Minimum version: 1.16.0
2755ea6ae205Smrg#
2756bd8ad950Smrg# This macro attempts to find appropriate memory checking functionality
2757bd8ad950Smrg# for various platforms which unit testing code may use to catch various
2758bd8ad950Smrg# forms of memory allocation and access errors in testing.
2759bd8ad950Smrg#
2760bd8ad950Smrg# Interface to module:
2761bd8ad950Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2762bd8ad950Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2763bd8ad950Smrg#
2764bd8ad950Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2765bd8ad950Smrg#
2766bd8ad950SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2767ea6ae205Smrg
2768bd8ad950SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2769bd8ad950SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2770bd8ad950Smrg           [Environment variables to enable memory checking in tests])
2771ea6ae205Smrg
2772bd8ad950Smrg# Check for different types of support on different platforms
2773bd8ad950Smrgcase $host_os in
2774bd8ad950Smrg    solaris*)
2775bd8ad950Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2776bd8ad950Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2777bd8ad950Smrg        ;;
2778bd8ad950Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2779bd8ad950Smrg        # both directly and inverted, so should not be 0 or 255.
2780bd8ad950Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2781bd8ad950Smrg        ;;
2782bd8ad950Smrg    darwin*)
2783bd8ad950Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2784bd8ad950Smrg        ;;
2785bd8ad950Smrg    *bsd*)
2786bd8ad950Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2787bd8ad950Smrg        ;;
2788bd8ad950Smrgesac
278912458b28Smrg
2790bd8ad950Smrg# User supplied flags override default flags
2791bd8ad950Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2792bd8ad950Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27937978d3cdSmrgfi
2794ea6ae205Smrg
2795bd8ad950SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2796bd8ad950Smrg]) # XORG_WITH_LINT
2797ea6ae205Smrg
2798bd8ad950Smrg# XORG_CHECK_MALLOC_ZERO
2799bd8ad950Smrg# ----------------------
2800bd8ad950Smrg# Minimum version: 1.0.0
28017978d3cdSmrg#
2802bd8ad950Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2803bd8ad950Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2804bd8ad950Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2805bd8ad950SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2806bd8ad950SmrgAC_ARG_ENABLE(malloc0returnsnull,
2807bd8ad950Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2808bd8ad950Smrg		       [malloc(0) returns NULL (default: auto)]),
2809bd8ad950Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2810bd8ad950Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2811b6f2c9ccSmrg
2812bd8ad950SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2813bd8ad950Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2814bd8ad950SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2815bd8ad950Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2816bd8ad950Smrg#include <stdlib.h>
2817bd8ad950Smrg],[
2818bd8ad950Smrg    char *m0, *r0, *c0, *p;
2819bd8ad950Smrg    m0 = malloc(0);
2820bd8ad950Smrg    p = malloc(10);
2821bd8ad950Smrg    r0 = realloc(p,0);
2822bd8ad950Smrg    c0 = calloc(0,10);
2823bd8ad950Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2824bd8ad950Smrg])],
2825bd8ad950Smrg		[xorg_cv_malloc0_returns_null=yes],
2826bd8ad950Smrg		[xorg_cv_malloc0_returns_null=no])])
2827bd8ad950SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282812458b28Smrgfi
2829bd8ad950SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2830b6f2c9ccSmrg
2831bd8ad950Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2832bd8ad950Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2833bd8ad950Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2834bd8ad950Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2835bd8ad950Smrgelse
2836bd8ad950Smrg	MALLOC_ZERO_CFLAGS=""
2837bd8ad950Smrg	XMALLOC_ZERO_CFLAGS=""
2838bd8ad950Smrg	XTMALLOC_ZERO_CFLAGS=""
2839bd8ad950Smrgfi
284012458b28Smrg
2841bd8ad950SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2842bd8ad950SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2843bd8ad950SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2844bd8ad950Smrg]) # XORG_CHECK_MALLOC_ZERO
2845bd8ad950Smrg
2846bd8ad950Smrg# XORG_WITH_LINT()
2847bd8ad950Smrg# ----------------
2848bd8ad950Smrg# Minimum version: 1.1.0
284912458b28Smrg#
2850bd8ad950Smrg# This macro enables the use of a tool that flags some suspicious and
2851bd8ad950Smrg# non-portable constructs (likely to be bugs) in C language source code.
2852bd8ad950Smrg# It will attempt to locate the tool and use appropriate options.
2853bd8ad950Smrg# There are various lint type tools on different platforms.
2854bd8ad950Smrg#
2855bd8ad950Smrg# Interface to module:
2856bd8ad950Smrg# LINT:		returns the path to the tool found on the platform
2857bd8ad950Smrg#		or the value set to LINT on the configure cmd line
2858bd8ad950Smrg#		also an Automake conditional
2859bd8ad950Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2860bd8ad950Smrg#
2861bd8ad950Smrg# --with-lint:	'yes' user instructs the module to use lint
2862bd8ad950Smrg#		'no' user instructs the module not to use lint (default)
2863bd8ad950Smrg#
2864bd8ad950Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2865bd8ad950Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2866bd8ad950Smrg#
2867bd8ad950SmrgAC_DEFUN([XORG_WITH_LINT],[
286812458b28Smrg
2869bd8ad950SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2870bd8ad950SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2871bd8ad950SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2872bd8ad950Smrg		[Use a lint-style source code checker (default: disabled)])],
2873bd8ad950Smrg		[use_lint=$withval], [use_lint=no])
287412458b28Smrg
2875bd8ad950Smrg# Obtain platform specific info like program name and options
2876bd8ad950Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2877bd8ad950Smrgcase $host_os in
2878bd8ad950Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2879bd8ad950Smrg	lint_name=splint
2880bd8ad950Smrg	lint_options="-badflag"
2881bd8ad950Smrg	;;
2882bd8ad950Smrg  *freebsd* | *netbsd*)
2883bd8ad950Smrg	lint_name=lint
2884bd8ad950Smrg	lint_options="-u -b"
2885bd8ad950Smrg	;;
2886bd8ad950Smrg  *solaris*)
2887bd8ad950Smrg	lint_name=lint
2888bd8ad950Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2889bd8ad950Smrg	;;
2890bd8ad950Smrgesac
2891bd8ad950Smrg
2892bd8ad950Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2893bd8ad950Smrgif test "x$use_lint" = x"yes" ; then
2894bd8ad950Smrg   AC_PATH_PROG([LINT], [$lint_name])
2895bd8ad950Smrg   if test "x$LINT" = "x"; then
2896bd8ad950Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2897bd8ad950Smrg   fi
2898bd8ad950Smrgelif test "x$use_lint" = x"no" ; then
2899bd8ad950Smrg   if test "x$LINT" != "x"; then
2900bd8ad950Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2901bd8ad950Smrg   fi
290212458b28Smrgelse
2903bd8ad950Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29047978d3cdSmrgfi
2905b6f2c9ccSmrg
2906bd8ad950Smrg# User supplied flags override default flags
2907bd8ad950Smrgif test "x$LINT_FLAGS" != "x"; then
2908bd8ad950Smrg   lint_options=$LINT_FLAGS
2909bd8ad950Smrgfi
2910b6f2c9ccSmrg
2911bd8ad950SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2912bd8ad950SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2913ea6ae205Smrg
2914bd8ad950Smrg]) # XORG_WITH_LINT
29157978d3cdSmrg
2916bd8ad950Smrg# XORG_LINT_LIBRARY(LIBNAME)
2917bd8ad950Smrg# --------------------------
2918bd8ad950Smrg# Minimum version: 1.1.0
2919245f6787Smrg#
2920bd8ad950Smrg# Sets up flags for building lint libraries for checking programs that call
2921bd8ad950Smrg# functions in the library.
2922bd8ad950Smrg#
2923bd8ad950Smrg# Interface to module:
2924bd8ad950Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2925bd8ad950Smrg# MAKE_LINT_LIB		- Automake conditional
2926bd8ad950Smrg#
2927bd8ad950Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2928bd8ad950Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2929245f6787Smrg
2930bd8ad950SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2931bd8ad950SmrgAC_REQUIRE([XORG_WITH_LINT])
2932bd8ad950SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2933bd8ad950Smrg	[Create lint library (default: disabled)])],
2934bd8ad950Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2935bd8ad950Smrg
2936bd8ad950Smrgif test "x$make_lint_lib" = x"yes" ; then
2937bd8ad950Smrg   LINTLIB=llib-l$1.ln
2938bd8ad950Smrg   if test "x$LINT" = "x"; then
2939bd8ad950Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2940bd8ad950Smrg   fi
2941bd8ad950Smrgelif test "x$make_lint_lib" != x"no" ; then
2942bd8ad950Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2943663cdc11Smrgfi
2944663cdc11Smrg
2945bd8ad950SmrgAC_SUBST(LINTLIB)
2946bd8ad950SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2947663cdc11Smrg
2948bd8ad950Smrg]) # XORG_LINT_LIBRARY
2949663cdc11Smrg
2950bd8ad950Smrg# XORG_COMPILER_BRAND
295112458b28Smrg# -------------------
2952bd8ad950Smrg# Minimum version: 1.14.0
295312458b28Smrg#
2954bd8ad950Smrg# Checks for various brands of compilers and sets flags as appropriate:
2955bd8ad950Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2956bd8ad950Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2957bd8ad950Smrg#   clang compiler - sets CLANGCC to "yes"
2958bd8ad950Smrg#   Intel compiler - sets INTELCC to "yes"
2959bd8ad950Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2960bd8ad950Smrg#
2961bd8ad950SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2962bd8ad950SmrgAC_LANG_CASE(
2963bd8ad950Smrg	[C], [
2964bd8ad950Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2965bd8ad950Smrg	],
2966bd8ad950Smrg	[C++], [
2967bd8ad950Smrg		AC_REQUIRE([AC_PROG_CXX])
2968bd8ad950Smrg	]
2969bd8ad950Smrg)
2970bd8ad950SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2971bd8ad950SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2972bd8ad950SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2973bd8ad950Smrg]) # XORG_COMPILER_BRAND
2974663cdc11Smrg
2975bd8ad950Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297612458b28Smrg# ---------------
2977bd8ad950Smrg# Minimum version: 1.16.0
2978bd8ad950Smrg#
2979bd8ad950Smrg# Test if the compiler works when passed the given flag as a command line argument.
2980bd8ad950Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2981bd8ad950Smrg# next flag in the list until there are no more options.
2982bd8ad950Smrg#
2983bd8ad950Smrg# Note that this does not guarantee that the compiler supports the flag as some
2984bd8ad950Smrg# compilers will simply ignore arguments that they do not understand, but we do
2985bd8ad950Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2986bd8ad950Smrg# -Werror=unused-command-line-argument
2987bd8ad950Smrg#
2988bd8ad950SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2989bd8ad950Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2990bd8ad950Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299112458b28Smrg
2992bd8ad950SmrgAC_LANG_COMPILER_REQUIRE
2993663cdc11Smrg
2994bd8ad950SmrgAC_LANG_CASE(
2995bd8ad950Smrg	[C], [
2996bd8ad950Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2997bd8ad950Smrg		define([PREFIX], [C])
2998bd8ad950Smrg		define([CACHE_PREFIX], [cc])
2999bd8ad950Smrg		define([COMPILER], [$CC])
3000bd8ad950Smrg	],
3001bd8ad950Smrg	[C++], [
3002bd8ad950Smrg		define([PREFIX], [CXX])
3003bd8ad950Smrg		define([CACHE_PREFIX], [cxx])
3004bd8ad950Smrg		define([COMPILER], [$CXX])
3005bd8ad950Smrg	]
3006bd8ad950Smrg)
3007bd8ad950Smrg
3008bd8ad950Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3009bd8ad950Smrg
3010bd8ad950Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3011bd8ad950Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3012bd8ad950Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3013bd8ad950Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3014bd8ad950Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3015bd8ad950Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3016bd8ad950Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3017bd8ad950Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3018bd8ad950Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
301912458b28Smrgfi
3020bd8ad950Smrg
3021bd8ad950Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3022bd8ad950Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3023bd8ad950Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3024bd8ad950Smrg	fi
3025bd8ad950Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3026bd8ad950Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3027bd8ad950Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3028bd8ad950Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3029bd8ad950Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3030bd8ad950Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3031bd8ad950Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3032bd8ad950Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3033bd8ad950Smrgfi
3034bd8ad950Smrg
3035bd8ad950Smrgfound="no"
3036bd8ad950Smrgm4_foreach([flag], m4_cdr($@), [
3037bd8ad950Smrg	if test $found = "no" ; then
3038bd8ad950Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3039bd8ad950Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3040bd8ad950Smrg		fi
3041bd8ad950Smrg
3042bd8ad950Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3043bd8ad950Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3044bd8ad950Smrg		fi
3045bd8ad950Smrg
3046bd8ad950Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3047bd8ad950Smrg
3048bd8ad950Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3049bd8ad950Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3050bd8ad950Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3051bd8ad950Smrg		AC_CACHE_VAL($cacheid,
3052bd8ad950Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3053bd8ad950Smrg					     [eval $cacheid=yes],
3054bd8ad950Smrg					     [eval $cacheid=no])])
3055bd8ad950Smrg
3056bd8ad950Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3057bd8ad950Smrg
3058bd8ad950Smrg		eval supported=\$$cacheid
3059bd8ad950Smrg		AC_MSG_RESULT([$supported])
3060bd8ad950Smrg		if test "$supported" = "yes" ; then
3061bd8ad950Smrg			$1="$$1 ]flag["
3062bd8ad950Smrg			found="yes"
3063bd8ad950Smrg		fi
3064bd8ad950Smrg	fi
3065663cdc11Smrg])
3066bd8ad950Smrg]) # XORG_TESTSET_CFLAG
3067663cdc11Smrg
3068bd8ad950Smrg# XORG_COMPILER_FLAGS
3069bd8ad950Smrg# ---------------
3070bd8ad950Smrg# Minimum version: 1.16.0
3071663cdc11Smrg#
3072bd8ad950Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3073bd8ad950Smrg# arguments supported by the selected compiler which do NOT alter the generated
3074bd8ad950Smrg# code.  These arguments will cause the compiler to print various warnings
3075bd8ad950Smrg# during compilation AND turn a conservative set of warnings into errors.
3076bd8ad950Smrg#
3077bd8ad950Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3078bd8ad950Smrg# future versions of util-macros as options are added to new compilers.
3079bd8ad950Smrg#
3080bd8ad950SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3081bd8ad950SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3082663cdc11Smrg
3083bd8ad950SmrgAC_ARG_ENABLE(selective-werror,
3084bd8ad950Smrg              AS_HELP_STRING([--disable-selective-werror],
3085bd8ad950Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3086bd8ad950Smrg              [SELECTIVE_WERROR=$enableval],
3087bd8ad950Smrg              [SELECTIVE_WERROR=yes])
3088bd8ad950Smrg
3089bd8ad950SmrgAC_LANG_CASE(
3090bd8ad950Smrg        [C], [
3091bd8ad950Smrg                define([PREFIX], [C])
3092bd8ad950Smrg        ],
3093bd8ad950Smrg        [C++], [
3094bd8ad950Smrg                define([PREFIX], [CXX])
3095bd8ad950Smrg        ]
3096bd8ad950Smrg)
3097bd8ad950Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3098bd8ad950Smrgif test "x$SUNCC" = "xyes"; then
3099bd8ad950Smrg    [BASE_]PREFIX[FLAGS]="-v"
310012458b28Smrgelse
3101bd8ad950Smrg    [BASE_]PREFIX[FLAGS]=""
3102663cdc11Smrgfi
3103663cdc11Smrg
3104bd8ad950Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3105bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3106bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3107bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3108bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3109663cdc11Smrg
3110bd8ad950SmrgAC_LANG_CASE(
3111bd8ad950Smrg	[C], [
3112bd8ad950Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3113bd8ad950Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3114bd8ad950Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3115bd8ad950Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3116bd8ad950Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3117bd8ad950Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3118bd8ad950Smrg	]
3119bd8ad950Smrg)
3120663cdc11Smrg
3121bd8ad950Smrg# This chunk adds additional warnings that could catch undesired effects.
3122bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3123bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3124bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3125bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3126bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3127bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3128bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3129663cdc11Smrg
3130bd8ad950Smrg# These are currently disabled because they are noisy.  They will be enabled
3131bd8ad950Smrg# in the future once the codebase is sufficiently modernized to silence
3132bd8ad950Smrg# them.  For now, I don't want them to drown out the other warnings.
3133bd8ad950Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3134bd8ad950Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3135bd8ad950Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3136663cdc11Smrg
3137bd8ad950Smrg# Turn some warnings into errors, so we don't accidently get successful builds
3138bd8ad950Smrg# when there are problems that should be fixed.
313987aef7c3Smrg
3140bd8ad950Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3141bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3142bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3143bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3144bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3145bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3146bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3147bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3148bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3149bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3150bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3151bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3152bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3153bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3154bd8ad950Smrgelse
3155bd8ad950SmrgAC_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])
3156bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3157bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3158bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3159bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3160bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3161bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3162bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3163bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3164bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3165bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3166bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3167bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3168bd8ad950SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3169bd8ad950Smrgfi
3170663cdc11Smrg
3171bd8ad950SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3172bd8ad950Smrg]) # XORG_COMPILER_FLAGS
3173e83ac88aSmrg
3174bd8ad950Smrg# XORG_CWARNFLAGS
3175bd8ad950Smrg# ---------------
3176bd8ad950Smrg# Minimum version: 1.2.0
3177bd8ad950Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3178e83ac88aSmrg#
3179bd8ad950Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3180245f6787Smrg#
3181bd8ad950Smrg# This function is deprecated because it defines -fno-strict-aliasing
3182bd8ad950Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3183bd8ad950Smrg# is needed, then it should be added explicitly in the module when
3184bd8ad950Smrg# it is updated to use BASE_CFLAGS.
318512458b28Smrg#
3186bd8ad950SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3187bd8ad950SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3188bd8ad950SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3189bd8ad950SmrgAC_LANG_CASE(
3190bd8ad950Smrg	[C], [
3191bd8ad950Smrg		CWARNFLAGS="$BASE_CFLAGS"
3192bd8ad950Smrg		if  test "x$GCC" = xyes ; then
3193bd8ad950Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3194bd8ad950Smrg		fi
3195bd8ad950Smrg		AC_SUBST(CWARNFLAGS)
3196bd8ad950Smrg	]
3197bd8ad950Smrg)
3198bd8ad950Smrg]) # XORG_CWARNFLAGS
3199663cdc11Smrg
3200bd8ad950Smrg# XORG_STRICT_OPTION
3201bd8ad950Smrg# -----------------------
3202bd8ad950Smrg# Minimum version: 1.3.0
3203bd8ad950Smrg#
3204bd8ad950Smrg# Add configure option to enable strict compilation flags, such as treating
3205bd8ad950Smrg# warnings as fatal errors.
3206bd8ad950Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3207bd8ad950Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3208bd8ad950Smrg#
3209bd8ad950Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3210bd8ad950Smrg# when strict compilation is unconditionally desired.
3211bd8ad950SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3212bd8ad950SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3213bd8ad950SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
321487aef7c3Smrg
3215bd8ad950SmrgAC_ARG_ENABLE(strict-compilation,
3216bd8ad950Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3217bd8ad950Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3218bd8ad950Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3219663cdc11Smrg
3220bd8ad950SmrgAC_LANG_CASE(
3221bd8ad950Smrg        [C], [
3222bd8ad950Smrg                define([PREFIX], [C])
3223bd8ad950Smrg        ],
3224bd8ad950Smrg        [C++], [
3225bd8ad950Smrg                define([PREFIX], [CXX])
3226bd8ad950Smrg        ]
3227bd8ad950Smrg)
3228663cdc11Smrg
3229bd8ad950Smrg[STRICT_]PREFIX[FLAGS]=""
3230bd8ad950SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3231bd8ad950SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3232e83ac88aSmrg
3233bd8ad950Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3234bd8ad950Smrg# activate it with -Werror, so we add it here explicitly.
3235bd8ad950SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3236b6f2c9ccSmrg
3237bd8ad950Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3238bd8ad950Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3239bd8ad950Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3240bd8ad950Smrgfi
3241bd8ad950SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3242bd8ad950SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3243bd8ad950SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3244bd8ad950Smrg]) # XORG_STRICT_OPTION
3245ea6ae205Smrg
3246bd8ad950Smrg# XORG_DEFAULT_OPTIONS
3247bd8ad950Smrg# --------------------
3248bd8ad950Smrg# Minimum version: 1.3.0
3249bd8ad950Smrg#
3250bd8ad950Smrg# Defines default options for X.Org modules.
3251bd8ad950Smrg#
3252bd8ad950SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3253bd8ad950SmrgAC_REQUIRE([AC_PROG_INSTALL])
3254bd8ad950SmrgXORG_COMPILER_FLAGS
3255bd8ad950SmrgXORG_CWARNFLAGS
3256bd8ad950SmrgXORG_STRICT_OPTION
3257bd8ad950SmrgXORG_RELEASE_VERSION
3258bd8ad950SmrgXORG_CHANGELOG
3259bd8ad950SmrgXORG_INSTALL
3260bd8ad950SmrgXORG_MANPAGE_SECTIONS
3261bd8ad950Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3262bd8ad950Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3263bd8ad950Smrg]) # XORG_DEFAULT_OPTIONS
326448f45e26Smrg
3265bd8ad950Smrg# XORG_INSTALL()
3266bd8ad950Smrg# ----------------
3267bd8ad950Smrg# Minimum version: 1.4.0
3268bd8ad950Smrg#
3269bd8ad950Smrg# Defines the variable INSTALL_CMD as the command to copy
3270bd8ad950Smrg# INSTALL from $prefix/share/util-macros.
3271bd8ad950Smrg#
3272bd8ad950SmrgAC_DEFUN([XORG_INSTALL], [
3273bd8ad950SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3274bd8ad950Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3275bd8ad950SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3276bd8ad950Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3277bd8ad950Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3278bd8ad950Smrgtouch \$(top_srcdir)/INSTALL; \
3279bd8ad950Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3280bd8ad950SmrgAC_SUBST([INSTALL_CMD])
3281bd8ad950Smrg]) # XORG_INSTALL
3282bd8ad950Smrgdnl Copyright 2005 Red Hat, Inc
3283bd8ad950Smrgdnl
3284bd8ad950Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3285bd8ad950Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3286bd8ad950Smrgdnl the above copyright notice appear in all copies and that both that
3287bd8ad950Smrgdnl copyright notice and this permission notice appear in supporting
3288bd8ad950Smrgdnl documentation.
3289bd8ad950Smrgdnl
3290bd8ad950Smrgdnl The above copyright notice and this permission notice shall be included
3291bd8ad950Smrgdnl in all copies or substantial portions of the Software.
3292bd8ad950Smrgdnl
3293bd8ad950Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3294bd8ad950Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3295bd8ad950Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3296bd8ad950Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3297bd8ad950Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3298bd8ad950Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3299bd8ad950Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3300bd8ad950Smrgdnl
3301bd8ad950Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3302bd8ad950Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3303bd8ad950Smrgdnl other dealings in this Software without prior written authorization
3304bd8ad950Smrgdnl from the copyright holders.
3305bd8ad950Smrgdnl
3306ea6ae205Smrg
3307bd8ad950Smrg# XORG_RELEASE_VERSION
3308bd8ad950Smrg# --------------------
3309bd8ad950Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
331012458b28Smrg
3311bd8ad950SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3312bd8ad950Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3313bd8ad950Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3314bd8ad950Smrg		[Major version of this package])
3315bd8ad950Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3316bd8ad950Smrg	if test "x$PVM" = "x"; then
3317bd8ad950Smrg		PVM="0"
3318bd8ad950Smrg	fi
3319bd8ad950Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3320bd8ad950Smrg		[$PVM],
3321bd8ad950Smrg		[Minor version of this package])
3322bd8ad950Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3323bd8ad950Smrg	if test "x$PVP" = "x"; then
3324bd8ad950Smrg		PVP="0"
3325bd8ad950Smrg	fi
3326bd8ad950Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3327bd8ad950Smrg		[$PVP],
3328bd8ad950Smrg		[Patch version of this package])
3329bd8ad950Smrg])
333012458b28Smrg
3331bd8ad950Smrg# XORG_CHANGELOG()
3332bd8ad950Smrg# ----------------
3333bd8ad950Smrg# Minimum version: 1.2.0
3334bd8ad950Smrg#
3335bd8ad950Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3336bd8ad950Smrg# ChangeLog from git.
3337bd8ad950Smrg#
3338bd8ad950Smrg#
3339bd8ad950SmrgAC_DEFUN([XORG_CHANGELOG], [
3340bd8ad950SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3341bd8ad950Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3342bd8ad950Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3343bd8ad950Smrgtouch \$(top_srcdir)/ChangeLog; \
3344bd8ad950Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3345bd8ad950SmrgAC_SUBST([CHANGELOG_CMD])
3346bd8ad950Smrg]) # XORG_CHANGELOG
3347ea6ae205Smrg
3348