aclocal.m4 revision 309c398a
18903d43aSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2e9554658Smrg
3e9554658Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4c2b339b4Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5e9554658Smrg# This file is free software; the Free Software Foundation
6e9554658Smrg# gives unlimited permission to copy and/or distribute it,
7e9554658Smrg# with or without modifications, as long as this notice is preserved.
8e9554658Smrg
9e9554658Smrg# This program is distributed in the hope that it will be useful,
10e9554658Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11e9554658Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12e9554658Smrg# PARTICULAR PURPOSE.
13e9554658Smrg
14c2b339b4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
15c2b339b4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
168903d43aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
178903d43aSmrg[m4_warning([this file was generated for autoconf 2.68.
18c2b339b4SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19c2b339b4SmrgIf you have problems, you may need to regenerate the build system entirely.
20c2b339b4SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21e9554658Smrg
22c2b339b4Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23e9554658Smrg#
24e9554658Smrg# This file is free software; the Free Software Foundation
25e9554658Smrg# gives unlimited permission to copy and/or distribute it,
26e9554658Smrg# with or without modifications, as long as this notice is preserved.
27e9554658Smrg
28e9554658Smrg# AM_AUTOMAKE_VERSION(VERSION)
29e9554658Smrg# ----------------------------
30e9554658Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31e9554658Smrg# generated from the m4 files accompanying Automake X.Y.
32e9554658Smrg# (This private macro should not be called outside this file.)
33e9554658SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34c2b339b4Smrg[am__api_version='1.11'
35e9554658Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36e9554658Smrgdnl require some minimum version.  Point them to the right macro.
378903d43aSmrgm4_if([$1], [1.11.1], [],
38e9554658Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39e9554658Smrg])
40e9554658Smrg
41e9554658Smrg# _AM_AUTOCONF_VERSION(VERSION)
42e9554658Smrg# -----------------------------
43e9554658Smrg# aclocal traces this macro to find the Autoconf version.
44e9554658Smrg# This is a private macro too.  Using m4_define simplifies
45e9554658Smrg# the logic in aclocal, which can simply ignore this definition.
46e9554658Smrgm4_define([_AM_AUTOCONF_VERSION], [])
47e9554658Smrg
48e9554658Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49e9554658Smrg# -------------------------------
50e9554658Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51c2b339b4Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52e9554658SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
538903d43aSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54c2b339b4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
55c2b339b4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56c2b339b4Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57e9554658Smrg
58e9554658Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59e9554658Smrg
60e9554658Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
61e9554658Smrg#
62e9554658Smrg# This file is free software; the Free Software Foundation
63e9554658Smrg# gives unlimited permission to copy and/or distribute it,
64e9554658Smrg# with or without modifications, as long as this notice is preserved.
65e9554658Smrg
66e9554658Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67e9554658Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68e9554658Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
69e9554658Smrg#
70e9554658Smrg# Of course, Automake must honor this variable whenever it calls a
71e9554658Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72e9554658Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73e9554658Smrg# depending on how configure is run.  This is pretty annoying, since
74e9554658Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75e9554658Smrg# source directory, any form will work fine, but in subdirectories a
76e9554658Smrg# relative path needs to be adjusted first.
77e9554658Smrg#
78e9554658Smrg# $ac_aux_dir/missing
79e9554658Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80e9554658Smrg# $top_srcdir/$ac_aux_dir/missing
81e9554658Smrg#    fails if $ac_aux_dir is absolute,
82e9554658Smrg#    fails when called from a subdirectory in a VPATH build with
83e9554658Smrg#          a relative $ac_aux_dir
84e9554658Smrg#
85e9554658Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86e9554658Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
87e9554658Smrg# harmless because $srcdir is `.', but things will broke when you
88e9554658Smrg# start a VPATH build or use an absolute $srcdir.
89e9554658Smrg#
90e9554658Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91e9554658Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92e9554658Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93e9554658Smrg# and then we would define $MISSING as
94e9554658Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95e9554658Smrg# This will work as long as MISSING is not called from configure, because
96e9554658Smrg# unfortunately $(top_srcdir) has no meaning in configure.
97e9554658Smrg# However there are other variables, like CC, which are often used in
98e9554658Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99e9554658Smrg#
100e9554658Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
101e9554658Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
102e9554658Smrg# configured tree to be moved without reconfiguration.
103e9554658Smrg
104e9554658SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105e9554658Smrg[dnl Rely on autoconf to set up CDPATH properly.
106e9554658SmrgAC_PREREQ([2.50])dnl
107e9554658Smrg# expand $ac_aux_dir to an absolute path
108e9554658Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
109e9554658Smrg])
110e9554658Smrg
111e9554658Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112e9554658Smrg
113c2b339b4Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114e9554658Smrg# Free Software Foundation, Inc.
115e9554658Smrg#
116e9554658Smrg# This file is free software; the Free Software Foundation
117e9554658Smrg# gives unlimited permission to copy and/or distribute it,
118e9554658Smrg# with or without modifications, as long as this notice is preserved.
119e9554658Smrg
120c2b339b4Smrg# serial 9
121e9554658Smrg
122e9554658Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123e9554658Smrg# -------------------------------------
124e9554658Smrg# Define a conditional.
125e9554658SmrgAC_DEFUN([AM_CONDITIONAL],
126e9554658Smrg[AC_PREREQ(2.52)dnl
127e9554658Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128e9554658Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
129e9554658SmrgAC_SUBST([$1_TRUE])dnl
130e9554658SmrgAC_SUBST([$1_FALSE])dnl
131e9554658Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
132e9554658Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133c2b339b4Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134e9554658Smrgif $2; then
135e9554658Smrg  $1_TRUE=
136e9554658Smrg  $1_FALSE='#'
137e9554658Smrgelse
138e9554658Smrg  $1_TRUE='#'
139e9554658Smrg  $1_FALSE=
140e9554658Smrgfi
141e9554658SmrgAC_CONFIG_COMMANDS_PRE(
142e9554658Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143e9554658Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144e9554658SmrgUsually this means the macro was only invoked conditionally.]])
145e9554658Smrgfi])])
146e9554658Smrg
147c2b339b4Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148e9554658Smrg# Free Software Foundation, Inc.
149e9554658Smrg#
150e9554658Smrg# This file is free software; the Free Software Foundation
151e9554658Smrg# gives unlimited permission to copy and/or distribute it,
152e9554658Smrg# with or without modifications, as long as this notice is preserved.
153e9554658Smrg
154c2b339b4Smrg# serial 10
155e9554658Smrg
156e9554658Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157e9554658Smrg# written in clear, in which case automake, when reading aclocal.m4,
158e9554658Smrg# will think it sees a *use*, and therefore will trigger all it's
159e9554658Smrg# C support machinery.  Also note that it means that autoscan, seeing
160e9554658Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161e9554658Smrg
162e9554658Smrg
163e9554658Smrg# _AM_DEPENDENCIES(NAME)
164e9554658Smrg# ----------------------
165e9554658Smrg# See how the compiler implements dependency checking.
166e9554658Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167e9554658Smrg# We try a few techniques and use that to set a single cache variable.
168e9554658Smrg#
169e9554658Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170e9554658Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171e9554658Smrg# dependency, and given that the user is not expected to run this macro,
172e9554658Smrg# just rely on AC_PROG_CC.
173e9554658SmrgAC_DEFUN([_AM_DEPENDENCIES],
174e9554658Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175e9554658SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176e9554658SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177e9554658SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178e9554658Smrg
179e9554658Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180e9554658Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181e9554658Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
182e9554658Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183e9554658Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184e9554658Smrg                   [depcc="$$1"   am_compiler_list=])
185e9554658Smrg
186e9554658SmrgAC_CACHE_CHECK([dependency style of $depcc],
187e9554658Smrg               [am_cv_$1_dependencies_compiler_type],
188e9554658Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189e9554658Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
190e9554658Smrg  # making bogus files that we don't know about and never remove.  For
191e9554658Smrg  # instance it was reported that on HP-UX the gcc test will end up
192e9554658Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
193e9554658Smrg  # in D'.
194e9554658Smrg  mkdir conftest.dir
195e9554658Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196e9554658Smrg  # using a relative directory.
197e9554658Smrg  cp "$am_depcomp" conftest.dir
198e9554658Smrg  cd conftest.dir
199e9554658Smrg  # We will build objects and dependencies in a subdirectory because
200e9554658Smrg  # it helps to detect inapplicable dependency modes.  For instance
201e9554658Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202e9554658Smrg  # side effect of compilation, but ICC will put the dependencies in
203e9554658Smrg  # the current directory while Tru64 will put them in the object
204e9554658Smrg  # directory.
205e9554658Smrg  mkdir sub
206e9554658Smrg
207e9554658Smrg  am_cv_$1_dependencies_compiler_type=none
208e9554658Smrg  if test "$am_compiler_list" = ""; then
209e9554658Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210e9554658Smrg  fi
211c2b339b4Smrg  am__universal=false
212c2b339b4Smrg  m4_case([$1], [CC],
213c2b339b4Smrg    [case " $depcc " in #(
214c2b339b4Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215c2b339b4Smrg     esac],
216c2b339b4Smrg    [CXX],
217c2b339b4Smrg    [case " $depcc " in #(
218c2b339b4Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219c2b339b4Smrg     esac])
220c2b339b4Smrg
221e9554658Smrg  for depmode in $am_compiler_list; do
222e9554658Smrg    # Setup a source with many dependencies, because some compilers
223e9554658Smrg    # like to wrap large dependency lists on column 80 (with \), and
224e9554658Smrg    # we should not choose a depcomp mode which is confused by this.
225e9554658Smrg    #
226e9554658Smrg    # We need to recreate these files for each test, as the compiler may
227e9554658Smrg    # overwrite some of them when testing with obscure command lines.
228e9554658Smrg    # This happens at least with the AIX C compiler.
229e9554658Smrg    : > sub/conftest.c
230e9554658Smrg    for i in 1 2 3 4 5 6; do
231e9554658Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232e9554658Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233e9554658Smrg      # Solaris 8's {/usr,}/bin/sh.
234e9554658Smrg      touch sub/conftst$i.h
235e9554658Smrg    done
236e9554658Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237e9554658Smrg
238c2b339b4Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239c2b339b4Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240c2b339b4Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241c2b339b4Smrg    # versions had trouble with output in subdirs
242c2b339b4Smrg    am__obj=sub/conftest.${OBJEXT-o}
243c2b339b4Smrg    am__minus_obj="-o $am__obj"
244e9554658Smrg    case $depmode in
245c2b339b4Smrg    gcc)
246c2b339b4Smrg      # This depmode causes a compiler race in universal mode.
247c2b339b4Smrg      test "$am__universal" = false || continue
248c2b339b4Smrg      ;;
249e9554658Smrg    nosideeffect)
250e9554658Smrg      # after this tag, mechanisms are not by side-effect, so they'll
251e9554658Smrg      # only be used when explicitly requested
252e9554658Smrg      if test "x$enable_dependency_tracking" = xyes; then
253e9554658Smrg	continue
254e9554658Smrg      else
255e9554658Smrg	break
256e9554658Smrg      fi
257e9554658Smrg      ;;
258c2b339b4Smrg    msvisualcpp | msvcmsys)
259c2b339b4Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
260c2b339b4Smrg      # not run yet.  These depmodes are late enough in the game, and
261c2b339b4Smrg      # so weak that their functioning should not be impacted.
262c2b339b4Smrg      am__obj=conftest.${OBJEXT-o}
263c2b339b4Smrg      am__minus_obj=
264c2b339b4Smrg      ;;
265e9554658Smrg    none) break ;;
266e9554658Smrg    esac
267e9554658Smrg    if depmode=$depmode \
268c2b339b4Smrg       source=sub/conftest.c object=$am__obj \
269e9554658Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270c2b339b4Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271e9554658Smrg         >/dev/null 2>conftest.err &&
272e9554658Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273e9554658Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274c2b339b4Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275e9554658Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276e9554658Smrg      # icc doesn't choke on unknown options, it will just issue warnings
277e9554658Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
278e9554658Smrg      # that says an option was ignored or not supported.
279e9554658Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280e9554658Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281e9554658Smrg      # The diagnosis changed in icc 8.0:
282e9554658Smrg      #   icc: Command line remark: option '-MP' not supported
283e9554658Smrg      if (grep 'ignoring option' conftest.err ||
284e9554658Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285e9554658Smrg        am_cv_$1_dependencies_compiler_type=$depmode
286e9554658Smrg        break
287e9554658Smrg      fi
288e9554658Smrg    fi
289e9554658Smrg  done
290e9554658Smrg
291e9554658Smrg  cd ..
292e9554658Smrg  rm -rf conftest.dir
293e9554658Smrgelse
294e9554658Smrg  am_cv_$1_dependencies_compiler_type=none
295e9554658Smrgfi
296e9554658Smrg])
297e9554658SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298e9554658SmrgAM_CONDITIONAL([am__fastdep$1], [
299e9554658Smrg  test "x$enable_dependency_tracking" != xno \
300e9554658Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301e9554658Smrg])
302e9554658Smrg
303e9554658Smrg
304e9554658Smrg# AM_SET_DEPDIR
305e9554658Smrg# -------------
306e9554658Smrg# Choose a directory name for dependency files.
307e9554658Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308e9554658SmrgAC_DEFUN([AM_SET_DEPDIR],
309e9554658Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310e9554658SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311e9554658Smrg])
312e9554658Smrg
313e9554658Smrg
314e9554658Smrg# AM_DEP_TRACK
315e9554658Smrg# ------------
316e9554658SmrgAC_DEFUN([AM_DEP_TRACK],
317e9554658Smrg[AC_ARG_ENABLE(dependency-tracking,
318e9554658Smrg[  --disable-dependency-tracking  speeds up one-time build
319e9554658Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320e9554658Smrgif test "x$enable_dependency_tracking" != xno; then
321e9554658Smrg  am_depcomp="$ac_aux_dir/depcomp"
322e9554658Smrg  AMDEPBACKSLASH='\'
323e9554658Smrgfi
324e9554658SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
325e9554658SmrgAC_SUBST([AMDEPBACKSLASH])dnl
326e9554658Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327e9554658Smrg])
328e9554658Smrg
329e9554658Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330e9554658Smrg
331c2b339b4Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332e9554658Smrg# Free Software Foundation, Inc.
333e9554658Smrg#
334e9554658Smrg# This file is free software; the Free Software Foundation
335e9554658Smrg# gives unlimited permission to copy and/or distribute it,
336e9554658Smrg# with or without modifications, as long as this notice is preserved.
337e9554658Smrg
338c2b339b4Smrg#serial 5
339e9554658Smrg
340e9554658Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341e9554658Smrg# ------------------------------
342e9554658SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343c2b339b4Smrg[{
344c2b339b4Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345c2b339b4Smrg  # are listed without --file.  Let's play safe and only enable the eval
346c2b339b4Smrg  # if we detect the quoting.
347c2b339b4Smrg  case $CONFIG_FILES in
348c2b339b4Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
349c2b339b4Smrg  *)   set x $CONFIG_FILES ;;
350c2b339b4Smrg  esac
351c2b339b4Smrg  shift
352c2b339b4Smrg  for mf
353c2b339b4Smrg  do
354c2b339b4Smrg    # Strip MF so we end up with the name of the file.
355c2b339b4Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356c2b339b4Smrg    # Check whether this is an Automake generated Makefile or not.
357c2b339b4Smrg    # We used to match only the files named `Makefile.in', but
358c2b339b4Smrg    # some people rename them; so instead we look at the file content.
359c2b339b4Smrg    # Grep'ing the first line is not enough: some people post-process
360c2b339b4Smrg    # each Makefile.in and add a new line on top of each file to say so.
361c2b339b4Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
362c2b339b4Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
363c2b339b4Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364c2b339b4Smrg      dirpart=`AS_DIRNAME("$mf")`
365c2b339b4Smrg    else
366c2b339b4Smrg      continue
367c2b339b4Smrg    fi
368c2b339b4Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
369c2b339b4Smrg    # from the Makefile without running `make'.
370c2b339b4Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371c2b339b4Smrg    test -z "$DEPDIR" && continue
372c2b339b4Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373c2b339b4Smrg    test -z "am__include" && continue
374c2b339b4Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375c2b339b4Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
376c2b339b4Smrg    U=`sed -n 's/^U = //p' < "$mf"`
377c2b339b4Smrg    # Find all dependency output files, they are included files with
378c2b339b4Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379c2b339b4Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380c2b339b4Smrg    # expansion.
381c2b339b4Smrg    for file in `sed -n "
382c2b339b4Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383c2b339b4Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384c2b339b4Smrg      # Make sure the directory exists.
385c2b339b4Smrg      test -f "$dirpart/$file" && continue
386c2b339b4Smrg      fdir=`AS_DIRNAME(["$file"])`
387c2b339b4Smrg      AS_MKDIR_P([$dirpart/$fdir])
388c2b339b4Smrg      # echo "creating $dirpart/$file"
389c2b339b4Smrg      echo '# dummy' > "$dirpart/$file"
390c2b339b4Smrg    done
391e9554658Smrg  done
392c2b339b4Smrg}
393e9554658Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394e9554658Smrg
395e9554658Smrg
396e9554658Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397e9554658Smrg# -----------------------------
398e9554658Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
399e9554658Smrg#
400e9554658Smrg# This code is only required when automatic dependency tracking
401e9554658Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
402e9554658Smrg# need in order to bootstrap the dependency handling code.
403e9554658SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404e9554658Smrg[AC_CONFIG_COMMANDS([depfiles],
405e9554658Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406e9554658Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407e9554658Smrg])
408e9554658Smrg
409e9554658Smrg# Do all the work for Automake.                             -*- Autoconf -*-
410e9554658Smrg
411e9554658Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412c2b339b4Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
413e9554658Smrg#
414e9554658Smrg# This file is free software; the Free Software Foundation
415e9554658Smrg# gives unlimited permission to copy and/or distribute it,
416e9554658Smrg# with or without modifications, as long as this notice is preserved.
417e9554658Smrg
418c2b339b4Smrg# serial 16
419e9554658Smrg
420e9554658Smrg# This macro actually does too much.  Some checks are only needed if
421e9554658Smrg# your package does certain things.  But this isn't really a big deal.
422e9554658Smrg
423e9554658Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
424e9554658Smrg# AM_INIT_AUTOMAKE([OPTIONS])
425e9554658Smrg# -----------------------------------------------
426e9554658Smrg# The call with PACKAGE and VERSION arguments is the old style
427e9554658Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
428e9554658Smrg# and VERSION should now be passed to AC_INIT and removed from
429e9554658Smrg# the call to AM_INIT_AUTOMAKE.
430e9554658Smrg# We support both call styles for the transition.  After
431e9554658Smrg# the next Automake release, Autoconf can make the AC_INIT
432e9554658Smrg# arguments mandatory, and then we can depend on a new Autoconf
433e9554658Smrg# release and drop the old call support.
434e9554658SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435c2b339b4Smrg[AC_PREREQ([2.62])dnl
436e9554658Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
437e9554658Smrgdnl the ones we care about.
438e9554658Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
439e9554658SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
440e9554658SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
441e9554658Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
442e9554658Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
443e9554658Smrg  # is not polluted with repeated "-I."
444e9554658Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
445e9554658Smrg  # test to see if srcdir already configured
446e9554658Smrg  if test -f $srcdir/config.status; then
447e9554658Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
448e9554658Smrg  fi
449e9554658Smrgfi
450e9554658Smrg
451e9554658Smrg# test whether we have cygpath
452e9554658Smrgif test -z "$CYGPATH_W"; then
453e9554658Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
454e9554658Smrg    CYGPATH_W='cygpath -w'
455e9554658Smrg  else
456e9554658Smrg    CYGPATH_W=echo
457e9554658Smrg  fi
458e9554658Smrgfi
459e9554658SmrgAC_SUBST([CYGPATH_W])
460e9554658Smrg
461e9554658Smrg# Define the identity of the package.
462e9554658Smrgdnl Distinguish between old-style and new-style calls.
463e9554658Smrgm4_ifval([$2],
464e9554658Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465e9554658Smrg AC_SUBST([PACKAGE], [$1])dnl
466e9554658Smrg AC_SUBST([VERSION], [$2])],
467e9554658Smrg[_AM_SET_OPTIONS([$1])dnl
468e9554658Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469e9554658Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
470e9554658Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
471e9554658Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
472e9554658Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473e9554658Smrg
474e9554658Smrg_AM_IF_OPTION([no-define],,
475e9554658Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
476e9554658Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477e9554658Smrg
478e9554658Smrg# Some tools Automake needs.
479e9554658SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
480e9554658SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
481e9554658SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
482e9554658SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
483e9554658SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
484e9554658SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
485e9554658SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486c2b339b4SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487c2b339b4SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
488e9554658SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
489e9554658Smrg# We need awk for the "check" target.  The system "awk" is bad on
490e9554658Smrg# some platforms.
491e9554658SmrgAC_REQUIRE([AC_PROG_AWK])dnl
492e9554658SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
493e9554658SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
494e9554658Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495c2b339b4Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496c2b339b4Smrg			     [_AM_PROG_TAR([v7])])])
497e9554658Smrg_AM_IF_OPTION([no-dependencies],,
498e9554658Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499c2b339b4Smrg		  [_AM_DEPENDENCIES(CC)],
500c2b339b4Smrg		  [define([AC_PROG_CC],
501c2b339b4Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
502e9554658SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503c2b339b4Smrg		  [_AM_DEPENDENCIES(CXX)],
504c2b339b4Smrg		  [define([AC_PROG_CXX],
505c2b339b4Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
506e9554658SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507c2b339b4Smrg		  [_AM_DEPENDENCIES(OBJC)],
508c2b339b4Smrg		  [define([AC_PROG_OBJC],
509c2b339b4Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
510e9554658Smrg])
511c2b339b4Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512c2b339b4Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513c2b339b4Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514c2b339b4Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515c2b339b4SmrgAC_CONFIG_COMMANDS_PRE(dnl
516c2b339b4Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517c2b339b4Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
518e9554658Smrg])
519e9554658Smrg
520c2b339b4Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521c2b339b4Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522c2b339b4Smrgdnl mangled by Autoconf and run in a shell conditional statement.
523c2b339b4Smrgm4_define([_AC_COMPILER_EXEEXT],
524c2b339b4Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525c2b339b4Smrg
526e9554658Smrg
527e9554658Smrg# When config.status generates a header, we must update the stamp-h file.
528e9554658Smrg# This file resides in the same directory as the config header
529e9554658Smrg# that is generated.  The stamp files are numbered to have different names.
530e9554658Smrg
531e9554658Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
532e9554658Smrg# loop where config.status creates the headers, so we can generate
533e9554658Smrg# our stamp files there.
534e9554658SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
535e9554658Smrg[# Compute $1's index in $config_headers.
536c2b339b4Smrg_am_arg=$1
537e9554658Smrg_am_stamp_count=1
538e9554658Smrgfor _am_header in $config_headers :; do
539e9554658Smrg  case $_am_header in
540c2b339b4Smrg    $_am_arg | $_am_arg:* )
541e9554658Smrg      break ;;
542e9554658Smrg    * )
543e9554658Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
544e9554658Smrg  esac
545e9554658Smrgdone
546c2b339b4Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
547e9554658Smrg
548c2b339b4Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
549e9554658Smrg#
550e9554658Smrg# This file is free software; the Free Software Foundation
551e9554658Smrg# gives unlimited permission to copy and/or distribute it,
552e9554658Smrg# with or without modifications, as long as this notice is preserved.
553e9554658Smrg
554e9554658Smrg# AM_PROG_INSTALL_SH
555e9554658Smrg# ------------------
556e9554658Smrg# Define $install_sh.
557e9554658SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
558e9554658Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559c2b339b4Smrgif test x"${install_sh}" != xset; then
560c2b339b4Smrg  case $am_aux_dir in
561c2b339b4Smrg  *\ * | *\	*)
562c2b339b4Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563c2b339b4Smrg  *)
564c2b339b4Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565c2b339b4Smrg  esac
566c2b339b4Smrgfi
567e9554658SmrgAC_SUBST(install_sh)])
568e9554658Smrg
569e9554658Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
570e9554658Smrg#
571e9554658Smrg# This file is free software; the Free Software Foundation
572e9554658Smrg# gives unlimited permission to copy and/or distribute it,
573e9554658Smrg# with or without modifications, as long as this notice is preserved.
574e9554658Smrg
575e9554658Smrg# serial 2
576e9554658Smrg
577e9554658Smrg# Check whether the underlying file-system supports filenames
578e9554658Smrg# with a leading dot.  For instance MS-DOS doesn't.
579e9554658SmrgAC_DEFUN([AM_SET_LEADING_DOT],
580e9554658Smrg[rm -rf .tst 2>/dev/null
581e9554658Smrgmkdir .tst 2>/dev/null
582e9554658Smrgif test -d .tst; then
583e9554658Smrg  am__leading_dot=.
584e9554658Smrgelse
585e9554658Smrg  am__leading_dot=_
586e9554658Smrgfi
587e9554658Smrgrmdir .tst 2>/dev/null
588e9554658SmrgAC_SUBST([am__leading_dot])])
589e9554658Smrg
590e9554658Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
591e9554658Smrg# From Jim Meyering
592e9554658Smrg
593c2b339b4Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
594e9554658Smrg# Free Software Foundation, Inc.
595e9554658Smrg#
596e9554658Smrg# This file is free software; the Free Software Foundation
597e9554658Smrg# gives unlimited permission to copy and/or distribute it,
598e9554658Smrg# with or without modifications, as long as this notice is preserved.
599e9554658Smrg
600c2b339b4Smrg# serial 5
601e9554658Smrg
602c2b339b4Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603c2b339b4Smrg# ----------------------------------
604c2b339b4Smrg# Control maintainer-specific portions of Makefiles.
605c2b339b4Smrg# Default is to disable them, unless `enable' is passed literally.
606c2b339b4Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607c2b339b4Smrg# can override the default with the --enable/--disable switch.
608e9554658SmrgAC_DEFUN([AM_MAINTAINER_MODE],
609c2b339b4Smrg[m4_case(m4_default([$1], [disable]),
610c2b339b4Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
611c2b339b4Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
612c2b339b4Smrg       [m4_define([am_maintainer_other], [enable])
613c2b339b4Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614c2b339b4SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615c2b339b4Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616c2b339b4Smrg  AC_ARG_ENABLE([maintainer-mode],
617c2b339b4Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
618e9554658Smrg			  (and sometimes confusing) to the casual installer],
619c2b339b4Smrg      [USE_MAINTAINER_MODE=$enableval],
620c2b339b4Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
621e9554658Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622c2b339b4Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
623e9554658Smrg  MAINT=$MAINTAINER_MODE_TRUE
624c2b339b4Smrg  AC_SUBST([MAINT])dnl
625e9554658Smrg]
626e9554658Smrg)
627e9554658Smrg
628e9554658SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629e9554658Smrg
630e9554658Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631e9554658Smrg
632c2b339b4Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
633e9554658Smrg#
634e9554658Smrg# This file is free software; the Free Software Foundation
635e9554658Smrg# gives unlimited permission to copy and/or distribute it,
636e9554658Smrg# with or without modifications, as long as this notice is preserved.
637e9554658Smrg
638c2b339b4Smrg# serial 4
639e9554658Smrg
640e9554658Smrg# AM_MAKE_INCLUDE()
641e9554658Smrg# -----------------
642e9554658Smrg# Check to see how make treats includes.
643e9554658SmrgAC_DEFUN([AM_MAKE_INCLUDE],
644e9554658Smrg[am_make=${MAKE-make}
645e9554658Smrgcat > confinc << 'END'
646e9554658Smrgam__doit:
647c2b339b4Smrg	@echo this is the am__doit target
648e9554658Smrg.PHONY: am__doit
649e9554658SmrgEND
650e9554658Smrg# If we don't find an include directive, just comment out the code.
651e9554658SmrgAC_MSG_CHECKING([for style of include used by $am_make])
652e9554658Smrgam__include="#"
653e9554658Smrgam__quote=
654e9554658Smrg_am_result=none
655e9554658Smrg# First try GNU make style include.
656e9554658Smrgecho "include confinc" > confmf
657c2b339b4Smrg# Ignore all kinds of additional output from `make'.
658c2b339b4Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659c2b339b4Smrg*the\ am__doit\ target*)
660c2b339b4Smrg  am__include=include
661c2b339b4Smrg  am__quote=
662c2b339b4Smrg  _am_result=GNU
663c2b339b4Smrg  ;;
664c2b339b4Smrgesac
665e9554658Smrg# Now try BSD make style include.
666e9554658Smrgif test "$am__include" = "#"; then
667e9554658Smrg   echo '.include "confinc"' > confmf
668c2b339b4Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669c2b339b4Smrg   *the\ am__doit\ target*)
670c2b339b4Smrg     am__include=.include
671c2b339b4Smrg     am__quote="\""
672c2b339b4Smrg     _am_result=BSD
673c2b339b4Smrg     ;;
674c2b339b4Smrg   esac
675e9554658Smrgfi
676e9554658SmrgAC_SUBST([am__include])
677e9554658SmrgAC_SUBST([am__quote])
678e9554658SmrgAC_MSG_RESULT([$_am_result])
679e9554658Smrgrm -f confinc confmf
680e9554658Smrg])
681e9554658Smrg
682e9554658Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
683e9554658Smrg
684c2b339b4Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
685e9554658Smrg# Free Software Foundation, Inc.
686e9554658Smrg#
687e9554658Smrg# This file is free software; the Free Software Foundation
688e9554658Smrg# gives unlimited permission to copy and/or distribute it,
689e9554658Smrg# with or without modifications, as long as this notice is preserved.
690e9554658Smrg
691c2b339b4Smrg# serial 6
692e9554658Smrg
693e9554658Smrg# AM_MISSING_PROG(NAME, PROGRAM)
694e9554658Smrg# ------------------------------
695e9554658SmrgAC_DEFUN([AM_MISSING_PROG],
696e9554658Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
697e9554658Smrg$1=${$1-"${am_missing_run}$2"}
698e9554658SmrgAC_SUBST($1)])
699e9554658Smrg
700e9554658Smrg
701e9554658Smrg# AM_MISSING_HAS_RUN
702e9554658Smrg# ------------------
703e9554658Smrg# Define MISSING if not defined so far and test if it supports --run.
704e9554658Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
705e9554658SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
706e9554658Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
707e9554658SmrgAC_REQUIRE_AUX_FILE([missing])dnl
708c2b339b4Smrgif test x"${MISSING+set}" != xset; then
709c2b339b4Smrg  case $am_aux_dir in
710c2b339b4Smrg  *\ * | *\	*)
711c2b339b4Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712c2b339b4Smrg  *)
713c2b339b4Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714c2b339b4Smrg  esac
715c2b339b4Smrgfi
716e9554658Smrg# Use eval to expand $SHELL
717e9554658Smrgif eval "$MISSING --run true"; then
718e9554658Smrg  am_missing_run="$MISSING --run "
719e9554658Smrgelse
720e9554658Smrg  am_missing_run=
721e9554658Smrg  AC_MSG_WARN([`missing' script is too old or missing])
722e9554658Smrgfi
723e9554658Smrg])
724e9554658Smrg
725e9554658Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726e9554658Smrg#
727e9554658Smrg# This file is free software; the Free Software Foundation
728e9554658Smrg# gives unlimited permission to copy and/or distribute it,
729e9554658Smrg# with or without modifications, as long as this notice is preserved.
730e9554658Smrg
731e9554658Smrg# AM_PROG_MKDIR_P
732e9554658Smrg# ---------------
733e9554658Smrg# Check for `mkdir -p'.
734e9554658SmrgAC_DEFUN([AM_PROG_MKDIR_P],
735e9554658Smrg[AC_PREREQ([2.60])dnl
736e9554658SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
737e9554658Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
738e9554658Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
739e9554658Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
740e9554658Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
741e9554658Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
742e9554658Smrgdnl adjustment using top_builddir (which is defined more often than
743e9554658Smrgdnl MKDIR_P).
744e9554658SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
745e9554658Smrgcase $mkdir_p in
746e9554658Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
747e9554658Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
748e9554658Smrgesac
749e9554658Smrg])
750e9554658Smrg
751e9554658Smrg# Helper functions for option handling.                     -*- Autoconf -*-
752e9554658Smrg
753c2b339b4Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754e9554658Smrg#
755e9554658Smrg# This file is free software; the Free Software Foundation
756e9554658Smrg# gives unlimited permission to copy and/or distribute it,
757e9554658Smrg# with or without modifications, as long as this notice is preserved.
758e9554658Smrg
759c2b339b4Smrg# serial 4
760e9554658Smrg
761e9554658Smrg# _AM_MANGLE_OPTION(NAME)
762e9554658Smrg# -----------------------
763e9554658SmrgAC_DEFUN([_AM_MANGLE_OPTION],
764e9554658Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
765e9554658Smrg
766e9554658Smrg# _AM_SET_OPTION(NAME)
767e9554658Smrg# ------------------------------
768e9554658Smrg# Set option NAME.  Presently that only means defining a flag for this option.
769e9554658SmrgAC_DEFUN([_AM_SET_OPTION],
770e9554658Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
771e9554658Smrg
772e9554658Smrg# _AM_SET_OPTIONS(OPTIONS)
773e9554658Smrg# ----------------------------------
774e9554658Smrg# OPTIONS is a space-separated list of Automake options.
775e9554658SmrgAC_DEFUN([_AM_SET_OPTIONS],
776c2b339b4Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
777e9554658Smrg
778e9554658Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
779e9554658Smrg# -------------------------------------------
780e9554658Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
781e9554658SmrgAC_DEFUN([_AM_IF_OPTION],
782e9554658Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
783e9554658Smrg
784e9554658Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
785e9554658Smrg
786c2b339b4Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
787e9554658Smrg# Free Software Foundation, Inc.
788e9554658Smrg#
789e9554658Smrg# This file is free software; the Free Software Foundation
790e9554658Smrg# gives unlimited permission to copy and/or distribute it,
791e9554658Smrg# with or without modifications, as long as this notice is preserved.
792e9554658Smrg
793c2b339b4Smrg# serial 5
794e9554658Smrg
795e9554658Smrg# AM_SANITY_CHECK
796e9554658Smrg# ---------------
797e9554658SmrgAC_DEFUN([AM_SANITY_CHECK],
798e9554658Smrg[AC_MSG_CHECKING([whether build environment is sane])
799e9554658Smrg# Just in case
800e9554658Smrgsleep 1
801e9554658Smrgecho timestamp > conftest.file
802c2b339b4Smrg# Reject unsafe characters in $srcdir or the absolute working directory
803c2b339b4Smrg# name.  Accept space and tab only in the latter.
804c2b339b4Smrgam_lf='
805c2b339b4Smrg'
806c2b339b4Smrgcase `pwd` in
807c2b339b4Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808c2b339b4Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809c2b339b4Smrgesac
810c2b339b4Smrgcase $srcdir in
811c2b339b4Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812c2b339b4Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813c2b339b4Smrgesac
814c2b339b4Smrg
815e9554658Smrg# Do `set' in a subshell so we don't clobber the current shell's
816e9554658Smrg# arguments.  Must try -L first in case configure is actually a
817e9554658Smrg# symlink; some systems play weird games with the mod time of symlinks
818e9554658Smrg# (eg FreeBSD returns the mod time of the symlink's containing
819e9554658Smrg# directory).
820e9554658Smrgif (
821c2b339b4Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
822e9554658Smrg   if test "$[*]" = "X"; then
823e9554658Smrg      # -L didn't work.
824c2b339b4Smrg      set X `ls -t "$srcdir/configure" conftest.file`
825e9554658Smrg   fi
826e9554658Smrg   rm -f conftest.file
827e9554658Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
828e9554658Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
829e9554658Smrg
830e9554658Smrg      # If neither matched, then we have a broken ls.  This can happen
831e9554658Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
832e9554658Smrg      # broken ls alias from the environment.  This has actually
833e9554658Smrg      # happened.  Such a system could not be considered "sane".
834e9554658Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
835e9554658Smrgalias in your environment])
836e9554658Smrg   fi
837e9554658Smrg
838e9554658Smrg   test "$[2]" = conftest.file
839e9554658Smrg   )
840e9554658Smrgthen
841e9554658Smrg   # Ok.
842e9554658Smrg   :
843e9554658Smrgelse
844e9554658Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
845e9554658SmrgCheck your system clock])
846e9554658Smrgfi
847e9554658SmrgAC_MSG_RESULT(yes)])
848e9554658Smrg
849c2b339b4Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
850c2b339b4Smrg#
851c2b339b4Smrg# This file is free software; the Free Software Foundation
852c2b339b4Smrg# gives unlimited permission to copy and/or distribute it,
853c2b339b4Smrg# with or without modifications, as long as this notice is preserved.
854c2b339b4Smrg
855c2b339b4Smrg# serial 1
856c2b339b4Smrg
857c2b339b4Smrg# AM_SILENT_RULES([DEFAULT])
858c2b339b4Smrg# --------------------------
859c2b339b4Smrg# Enable less verbose build rules; with the default set to DEFAULT
860c2b339b4Smrg# (`yes' being less verbose, `no' or empty being verbose).
861c2b339b4SmrgAC_DEFUN([AM_SILENT_RULES],
862c2b339b4Smrg[AC_ARG_ENABLE([silent-rules],
863c2b339b4Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864c2b339b4Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865c2b339b4Smrgcase $enable_silent_rules in
866c2b339b4Smrgyes) AM_DEFAULT_VERBOSITY=0;;
867c2b339b4Smrgno)  AM_DEFAULT_VERBOSITY=1;;
868c2b339b4Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
869c2b339b4Smrgesac
870c2b339b4SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871c2b339b4SmrgAM_BACKSLASH='\'
872c2b339b4SmrgAC_SUBST([AM_BACKSLASH])dnl
873c2b339b4Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874c2b339b4Smrg])
875c2b339b4Smrg
876e9554658Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
877e9554658Smrg#
878e9554658Smrg# This file is free software; the Free Software Foundation
879e9554658Smrg# gives unlimited permission to copy and/or distribute it,
880e9554658Smrg# with or without modifications, as long as this notice is preserved.
881e9554658Smrg
882e9554658Smrg# AM_PROG_INSTALL_STRIP
883e9554658Smrg# ---------------------
884e9554658Smrg# One issue with vendor `install' (even GNU) is that you can't
885e9554658Smrg# specify the program used to strip binaries.  This is especially
886e9554658Smrg# annoying in cross-compiling environments, where the build's strip
887e9554658Smrg# is unlikely to handle the host's binaries.
888e9554658Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
889e9554658Smrg# always use install-sh in `make install-strip', and initialize
890e9554658Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
891e9554658SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
892e9554658Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
893e9554658Smrg# Installed binaries are usually stripped using `strip' when the user
894e9554658Smrg# run `make install-strip'.  However `strip' might not be the right
895e9554658Smrg# tool to use in cross-compilation environments, therefore Automake
896e9554658Smrg# will honor the `STRIP' environment variable to overrule this program.
897e9554658Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
898e9554658Smrgif test "$cross_compiling" != no; then
899e9554658Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
900e9554658Smrgfi
901e9554658SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
902e9554658SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903e9554658Smrg
904c2b339b4Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
905e9554658Smrg#
906e9554658Smrg# This file is free software; the Free Software Foundation
907e9554658Smrg# gives unlimited permission to copy and/or distribute it,
908e9554658Smrg# with or without modifications, as long as this notice is preserved.
909e9554658Smrg
910c2b339b4Smrg# serial 2
911c2b339b4Smrg
912e9554658Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
913e9554658Smrg# ---------------------------
914c2b339b4Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
915e9554658Smrg# This macro is traced by Automake.
916e9554658SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
917e9554658Smrg
918c2b339b4Smrg# AM_SUBST_NOTMAKE(VARIABLE)
919c2b339b4Smrg# ---------------------------
920c2b339b4Smrg# Public sister of _AM_SUBST_NOTMAKE.
921c2b339b4SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922c2b339b4Smrg
923e9554658Smrg# Check how to create a tarball.                            -*- Autoconf -*-
924e9554658Smrg
925e9554658Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
926e9554658Smrg#
927e9554658Smrg# This file is free software; the Free Software Foundation
928e9554658Smrg# gives unlimited permission to copy and/or distribute it,
929e9554658Smrg# with or without modifications, as long as this notice is preserved.
930e9554658Smrg
931e9554658Smrg# serial 2
932e9554658Smrg
933e9554658Smrg# _AM_PROG_TAR(FORMAT)
934e9554658Smrg# --------------------
935e9554658Smrg# Check how to create a tarball in format FORMAT.
936e9554658Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
937e9554658Smrg#
938e9554658Smrg# Substitute a variable $(am__tar) that is a command
939e9554658Smrg# writing to stdout a FORMAT-tarball containing the directory
940e9554658Smrg# $tardir.
941e9554658Smrg#     tardir=directory && $(am__tar) > result.tar
942e9554658Smrg#
943e9554658Smrg# Substitute a variable $(am__untar) that extract such
944e9554658Smrg# a tarball read from stdin.
945e9554658Smrg#     $(am__untar) < result.tar
946e9554658SmrgAC_DEFUN([_AM_PROG_TAR],
947e9554658Smrg[# Always define AMTAR for backward compatibility.
948e9554658SmrgAM_MISSING_PROG([AMTAR], [tar])
949e9554658Smrgm4_if([$1], [v7],
950e9554658Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
951e9554658Smrg     [m4_case([$1], [ustar],, [pax],,
952e9554658Smrg              [m4_fatal([Unknown tar format])])
953e9554658SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
954e9554658Smrg# Loop over all known methods to create a tar archive until one works.
955e9554658Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
956e9554658Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
957e9554658Smrg# Do not fold the above two line into one, because Tru64 sh and
958e9554658Smrg# Solaris sh will not grok spaces in the rhs of `-'.
959e9554658Smrgfor _am_tool in $_am_tools
960e9554658Smrgdo
961e9554658Smrg  case $_am_tool in
962e9554658Smrg  gnutar)
963e9554658Smrg    for _am_tar in tar gnutar gtar;
964e9554658Smrg    do
965e9554658Smrg      AM_RUN_LOG([$_am_tar --version]) && break
966e9554658Smrg    done
967e9554658Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
968e9554658Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
969e9554658Smrg    am__untar="$_am_tar -xf -"
970e9554658Smrg    ;;
971e9554658Smrg  plaintar)
972e9554658Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
973e9554658Smrg    # ustar tarball either.
974e9554658Smrg    (tar --version) >/dev/null 2>&1 && continue
975e9554658Smrg    am__tar='tar chf - "$$tardir"'
976e9554658Smrg    am__tar_='tar chf - "$tardir"'
977e9554658Smrg    am__untar='tar xf -'
978e9554658Smrg    ;;
979e9554658Smrg  pax)
980e9554658Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
981e9554658Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
982e9554658Smrg    am__untar='pax -r'
983e9554658Smrg    ;;
984e9554658Smrg  cpio)
985e9554658Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
986e9554658Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
987e9554658Smrg    am__untar='cpio -i -H $1 -d'
988e9554658Smrg    ;;
989e9554658Smrg  none)
990e9554658Smrg    am__tar=false
991e9554658Smrg    am__tar_=false
992e9554658Smrg    am__untar=false
993e9554658Smrg    ;;
994e9554658Smrg  esac
995e9554658Smrg
996e9554658Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
997e9554658Smrg  # and am__untar set.
998e9554658Smrg  test -n "${am_cv_prog_tar_$1}" && break
999e9554658Smrg
1000e9554658Smrg  # tar/untar a dummy directory, and stop if the command works
1001e9554658Smrg  rm -rf conftest.dir
1002e9554658Smrg  mkdir conftest.dir
1003e9554658Smrg  echo GrepMe > conftest.dir/file
1004e9554658Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1005e9554658Smrg  rm -rf conftest.dir
1006e9554658Smrg  if test -s conftest.tar; then
1007e9554658Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
1008e9554658Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1009e9554658Smrg  fi
1010e9554658Smrgdone
1011e9554658Smrgrm -rf conftest.dir
1012e9554658Smrg
1013e9554658SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1014e9554658SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1015e9554658SmrgAC_SUBST([am__tar])
1016e9554658SmrgAC_SUBST([am__untar])
1017e9554658Smrg]) # _AM_PROG_TAR
1018e9554658Smrg
1019309c398aSmrg# iconv.m4 serial AM4 (gettext-0.11.3)
1020309c398aSmrgdnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
1021309c398aSmrgdnl This file is free software; the Free Software Foundation
1022309c398aSmrgdnl gives unlimited permission to copy and/or distribute it,
1023309c398aSmrgdnl with or without modifications, as long as this notice is preserved.
1024e9554658Smrg
1025309c398aSmrgdnl From Bruno Haible.
1026e9554658Smrg
1027309c398aSmrgAC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
1028309c398aSmrg[
1029309c398aSmrg  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
1030309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1031309c398aSmrg  AC_REQUIRE([AC_LIB_RPATH])
1032e9554658Smrg
1033309c398aSmrg  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
1034309c398aSmrg  dnl accordingly.
1035309c398aSmrg  AC_LIB_LINKFLAGS_BODY([iconv])
1036309c398aSmrg])
1037e9554658Smrg
1038309c398aSmrgAC_DEFUN([AM_ICONV_LINK],
1039309c398aSmrg[
1040309c398aSmrg  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1041309c398aSmrg  dnl those with the standalone portable GNU libiconv installed).
1042309c398aSmrg
1043309c398aSmrg  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
1044309c398aSmrg  dnl accordingly.
1045309c398aSmrg  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
1046309c398aSmrg
1047309c398aSmrg  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
1048309c398aSmrg  dnl because if the user has installed libiconv and not disabled its use
1049309c398aSmrg  dnl via --without-libiconv-prefix, he wants to use it. The first
1050309c398aSmrg  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
1051309c398aSmrg  am_save_CPPFLAGS="$CPPFLAGS"
1052309c398aSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
1053309c398aSmrg
1054309c398aSmrg  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
1055309c398aSmrg    am_cv_func_iconv="no, consider installing GNU libiconv"
1056309c398aSmrg    am_cv_lib_iconv=no
1057309c398aSmrg    AC_TRY_LINK([#include <stdlib.h>
1058309c398aSmrg#include <iconv.h>],
1059309c398aSmrg      [iconv_t cd = iconv_open("","");
1060309c398aSmrg       iconv(cd,NULL,NULL,NULL,NULL);
1061309c398aSmrg       iconv_close(cd);],
1062309c398aSmrg      am_cv_func_iconv=yes)
1063309c398aSmrg    if test "$am_cv_func_iconv" != yes; then
1064309c398aSmrg      am_save_LIBS="$LIBS"
1065309c398aSmrg      LIBS="$LIBS $LIBICONV"
1066309c398aSmrg      AC_TRY_LINK([#include <stdlib.h>
1067309c398aSmrg#include <iconv.h>],
1068309c398aSmrg        [iconv_t cd = iconv_open("","");
1069309c398aSmrg         iconv(cd,NULL,NULL,NULL,NULL);
1070309c398aSmrg         iconv_close(cd);],
1071309c398aSmrg        am_cv_lib_iconv=yes
1072309c398aSmrg        am_cv_func_iconv=yes)
1073309c398aSmrg      LIBS="$am_save_LIBS"
1074309c398aSmrg    fi
1075309c398aSmrg  ])
1076309c398aSmrg  if test "$am_cv_func_iconv" = yes; then
1077309c398aSmrg    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
1078309c398aSmrg  fi
1079309c398aSmrg  if test "$am_cv_lib_iconv" = yes; then
1080309c398aSmrg    AC_MSG_CHECKING([how to link with libiconv])
1081309c398aSmrg    AC_MSG_RESULT([$LIBICONV])
1082309c398aSmrg  else
1083309c398aSmrg    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
1084309c398aSmrg    dnl either.
1085309c398aSmrg    CPPFLAGS="$am_save_CPPFLAGS"
1086309c398aSmrg    LIBICONV=
1087309c398aSmrg    LTLIBICONV=
1088309c398aSmrg  fi
1089309c398aSmrg  AC_SUBST(LIBICONV)
1090309c398aSmrg  AC_SUBST(LTLIBICONV)
1091309c398aSmrg])
1092e9554658Smrg
1093309c398aSmrgAC_DEFUN([AM_ICONV],
1094309c398aSmrg[
1095309c398aSmrg  AM_ICONV_LINK
1096309c398aSmrg  if test "$am_cv_func_iconv" = yes; then
1097309c398aSmrg    AC_MSG_CHECKING([for iconv declaration])
1098309c398aSmrg    AC_CACHE_VAL(am_cv_proto_iconv, [
1099309c398aSmrg      AC_TRY_COMPILE([
1100309c398aSmrg#include <stdlib.h>
1101309c398aSmrg#include <iconv.h>
1102309c398aSmrgextern
1103309c398aSmrg#ifdef __cplusplus
1104309c398aSmrg"C"
1105309c398aSmrg#endif
1106309c398aSmrg#if defined(__STDC__) || defined(__cplusplus)
1107309c398aSmrgsize_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1108309c398aSmrg#else
1109309c398aSmrgsize_t iconv();
1110309c398aSmrg#endif
1111309c398aSmrg], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1112309c398aSmrg      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
1113309c398aSmrg    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1114309c398aSmrg    AC_MSG_RESULT([$]{ac_t:-
1115309c398aSmrg         }[$]am_cv_proto_iconv)
1116309c398aSmrg    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1117309c398aSmrg      [Define as const if the declaration of iconv() needs const.])
1118309c398aSmrg  fi
1119309c398aSmrg])
1120e9554658Smrg
1121309c398aSmrg# lib-ld.m4 serial 3 (gettext-0.13)
1122309c398aSmrgdnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
1123309c398aSmrgdnl This file is free software; the Free Software Foundation
1124309c398aSmrgdnl gives unlimited permission to copy and/or distribute it,
1125309c398aSmrgdnl with or without modifications, as long as this notice is preserved.
1126309c398aSmrg
1127309c398aSmrgdnl Subroutines of libtool.m4,
1128309c398aSmrgdnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
1129309c398aSmrgdnl with libtool.m4.
1130309c398aSmrg
1131309c398aSmrgdnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
1132309c398aSmrgAC_DEFUN([AC_LIB_PROG_LD_GNU],
1133309c398aSmrg[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
1134309c398aSmrg[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1135309c398aSmrgcase `$LD -v 2>&1 </dev/null` in
1136309c398aSmrg*GNU* | *'with BFD'*)
1137309c398aSmrg  acl_cv_prog_gnu_ld=yes ;;
1138309c398aSmrg*)
1139309c398aSmrg  acl_cv_prog_gnu_ld=no ;;
1140309c398aSmrgesac])
1141309c398aSmrgwith_gnu_ld=$acl_cv_prog_gnu_ld
1142309c398aSmrg])
1143e9554658Smrg
1144309c398aSmrgdnl From libtool-1.4. Sets the variable LD.
1145309c398aSmrgAC_DEFUN([AC_LIB_PROG_LD],
1146309c398aSmrg[AC_ARG_WITH(gnu-ld,
1147309c398aSmrg[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1148309c398aSmrgtest "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1149309c398aSmrgAC_REQUIRE([AC_PROG_CC])dnl
1150309c398aSmrgAC_REQUIRE([AC_CANONICAL_HOST])dnl
1151309c398aSmrg# Prepare PATH_SEPARATOR.
1152309c398aSmrg# The user is always right.
1153309c398aSmrgif test "${PATH_SEPARATOR+set}" != set; then
1154309c398aSmrg  echo "#! /bin/sh" >conf$$.sh
1155309c398aSmrg  echo  "exit 0"   >>conf$$.sh
1156309c398aSmrg  chmod +x conf$$.sh
1157309c398aSmrg  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
1158309c398aSmrg    PATH_SEPARATOR=';'
1159309c398aSmrg  else
1160309c398aSmrg    PATH_SEPARATOR=:
1161309c398aSmrg  fi
1162309c398aSmrg  rm -f conf$$.sh
1163e9554658Smrgfi
1164309c398aSmrgac_prog=ld
1165309c398aSmrgif test "$GCC" = yes; then
1166309c398aSmrg  # Check if gcc -print-prog-name=ld gives a path.
1167309c398aSmrg  AC_MSG_CHECKING([for ld used by GCC])
1168309c398aSmrg  case $host in
1169309c398aSmrg  *-*-mingw*)
1170309c398aSmrg    # gcc leaves a trailing carriage return which upsets mingw
1171309c398aSmrg    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1172309c398aSmrg  *)
1173309c398aSmrg    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1174309c398aSmrg  esac
1175309c398aSmrg  case $ac_prog in
1176309c398aSmrg    # Accept absolute paths.
1177309c398aSmrg    [[\\/]* | [A-Za-z]:[\\/]*)]
1178309c398aSmrg      [re_direlt='/[^/][^/]*/\.\./']
1179309c398aSmrg      # Canonicalize the path of ld
1180309c398aSmrg      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1181309c398aSmrg      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1182309c398aSmrg	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1183309c398aSmrg      done
1184309c398aSmrg      test -z "$LD" && LD="$ac_prog"
1185309c398aSmrg      ;;
1186309c398aSmrg  "")
1187309c398aSmrg    # If it fails, then pretend we aren't using GCC.
1188309c398aSmrg    ac_prog=ld
1189309c398aSmrg    ;;
1190309c398aSmrg  *)
1191309c398aSmrg    # If it is relative, then search for the first ld in PATH.
1192309c398aSmrg    with_gnu_ld=unknown
1193309c398aSmrg    ;;
1194309c398aSmrg  esac
1195309c398aSmrgelif test "$with_gnu_ld" = yes; then
1196309c398aSmrg  AC_MSG_CHECKING([for GNU ld])
1197309c398aSmrgelse
1198309c398aSmrg  AC_MSG_CHECKING([for non-GNU ld])
1199e9554658Smrgfi
1200309c398aSmrgAC_CACHE_VAL(acl_cv_path_LD,
1201309c398aSmrg[if test -z "$LD"; then
1202309c398aSmrg  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1203309c398aSmrg  for ac_dir in $PATH; do
1204309c398aSmrg    test -z "$ac_dir" && ac_dir=.
1205309c398aSmrg    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1206309c398aSmrg      acl_cv_path_LD="$ac_dir/$ac_prog"
1207309c398aSmrg      # Check to see if the program is GNU ld.  I'd rather use --version,
1208309c398aSmrg      # but apparently some GNU ld's only accept -v.
1209309c398aSmrg      # Break only if it was the GNU/non-GNU ld that we prefer.
1210309c398aSmrg      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
1211309c398aSmrg      *GNU* | *'with BFD'*)
1212309c398aSmrg	test "$with_gnu_ld" != no && break ;;
1213309c398aSmrg      *)
1214309c398aSmrg	test "$with_gnu_ld" != yes && break ;;
1215309c398aSmrg      esac
1216309c398aSmrg    fi
1217309c398aSmrg  done
1218309c398aSmrg  IFS="$ac_save_ifs"
1219309c398aSmrgelse
1220309c398aSmrg  acl_cv_path_LD="$LD" # Let the user override the test with a path.
1221309c398aSmrgfi])
1222309c398aSmrgLD="$acl_cv_path_LD"
1223309c398aSmrgif test -n "$LD"; then
1224309c398aSmrg  AC_MSG_RESULT($LD)
1225309c398aSmrgelse
1226309c398aSmrg  AC_MSG_RESULT(no)
1227e9554658Smrgfi
1228309c398aSmrgtest -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1229309c398aSmrgAC_LIB_PROG_LD_GNU
1230309c398aSmrg])
1231e9554658Smrg
1232309c398aSmrg# lib-link.m4 serial 9 (gettext-0.16)
1233309c398aSmrgdnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
1234309c398aSmrgdnl This file is free software; the Free Software Foundation
1235309c398aSmrgdnl gives unlimited permission to copy and/or distribute it,
1236309c398aSmrgdnl with or without modifications, as long as this notice is preserved.
1237309c398aSmrg
1238309c398aSmrgdnl From Bruno Haible.
1239309c398aSmrg
1240309c398aSmrgAC_PREREQ(2.50)
1241309c398aSmrg
1242309c398aSmrgdnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1243309c398aSmrgdnl the libraries corresponding to explicit and implicit dependencies.
1244309c398aSmrgdnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1245309c398aSmrgdnl augments the CPPFLAGS variable.
1246309c398aSmrgAC_DEFUN([AC_LIB_LINKFLAGS],
1247309c398aSmrg[
1248309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1249309c398aSmrg  AC_REQUIRE([AC_LIB_RPATH])
1250309c398aSmrg  define([Name],[translit([$1],[./-], [___])])
1251309c398aSmrg  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1252309c398aSmrg                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1253309c398aSmrg  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1254309c398aSmrg    AC_LIB_LINKFLAGS_BODY([$1], [$2])
1255309c398aSmrg    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1256309c398aSmrg    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1257309c398aSmrg    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1258309c398aSmrg  ])
1259309c398aSmrg  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1260309c398aSmrg  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1261309c398aSmrg  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1262309c398aSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1263309c398aSmrg  AC_SUBST([LIB]NAME)
1264309c398aSmrg  AC_SUBST([LTLIB]NAME)
1265309c398aSmrg  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1266309c398aSmrg  dnl results of this search when this library appears as a dependency.
1267309c398aSmrg  HAVE_LIB[]NAME=yes
1268309c398aSmrg  undefine([Name])
1269309c398aSmrg  undefine([NAME])
1270309c398aSmrg])
1271e9554658Smrg
1272309c398aSmrgdnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
1273309c398aSmrgdnl searches for libname and the libraries corresponding to explicit and
1274309c398aSmrgdnl implicit dependencies, together with the specified include files and
1275309c398aSmrgdnl the ability to compile and link the specified testcode. If found, it
1276309c398aSmrgdnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
1277309c398aSmrgdnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1278309c398aSmrgdnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1279309c398aSmrgdnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1280309c398aSmrgAC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1281309c398aSmrg[
1282309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1283309c398aSmrg  AC_REQUIRE([AC_LIB_RPATH])
1284309c398aSmrg  define([Name],[translit([$1],[./-], [___])])
1285309c398aSmrg  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1286309c398aSmrg                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1287309c398aSmrg
1288309c398aSmrg  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1289309c398aSmrg  dnl accordingly.
1290309c398aSmrg  AC_LIB_LINKFLAGS_BODY([$1], [$2])
1291309c398aSmrg
1292309c398aSmrg  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1293309c398aSmrg  dnl because if the user has installed lib[]Name and not disabled its use
1294309c398aSmrg  dnl via --without-lib[]Name-prefix, he wants to use it.
1295309c398aSmrg  ac_save_CPPFLAGS="$CPPFLAGS"
1296309c398aSmrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1297309c398aSmrg
1298309c398aSmrg  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1299309c398aSmrg    ac_save_LIBS="$LIBS"
1300309c398aSmrg    LIBS="$LIBS $LIB[]NAME"
1301309c398aSmrg    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
1302309c398aSmrg    LIBS="$ac_save_LIBS"
1303309c398aSmrg  ])
1304309c398aSmrg  if test "$ac_cv_lib[]Name" = yes; then
1305309c398aSmrg    HAVE_LIB[]NAME=yes
1306309c398aSmrg    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
1307309c398aSmrg    AC_MSG_CHECKING([how to link with lib[]$1])
1308309c398aSmrg    AC_MSG_RESULT([$LIB[]NAME])
1309309c398aSmrg  else
1310309c398aSmrg    HAVE_LIB[]NAME=no
1311309c398aSmrg    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1312309c398aSmrg    dnl $INC[]NAME either.
1313309c398aSmrg    CPPFLAGS="$ac_save_CPPFLAGS"
1314309c398aSmrg    LIB[]NAME=
1315309c398aSmrg    LTLIB[]NAME=
1316309c398aSmrg  fi
1317309c398aSmrg  AC_SUBST([HAVE_LIB]NAME)
1318309c398aSmrg  AC_SUBST([LIB]NAME)
1319309c398aSmrg  AC_SUBST([LTLIB]NAME)
1320309c398aSmrg  undefine([Name])
1321309c398aSmrg  undefine([NAME])
1322309c398aSmrg])
1323e9554658Smrg
1324309c398aSmrgdnl Determine the platform dependent parameters needed to use rpath:
1325309c398aSmrgdnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
1326309c398aSmrgdnl hardcode_direct, hardcode_minus_L.
1327309c398aSmrgAC_DEFUN([AC_LIB_RPATH],
1328309c398aSmrg[
1329309c398aSmrg  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
1330309c398aSmrg  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
1331309c398aSmrg  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1332309c398aSmrg  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1333309c398aSmrg  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1334309c398aSmrg  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1335309c398aSmrg  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
1336309c398aSmrg    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1337309c398aSmrg    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1338309c398aSmrg    . ./conftest.sh
1339309c398aSmrg    rm -f ./conftest.sh
1340309c398aSmrg    acl_cv_rpath=done
1341309c398aSmrg  ])
1342309c398aSmrg  wl="$acl_cv_wl"
1343309c398aSmrg  libext="$acl_cv_libext"
1344309c398aSmrg  shlibext="$acl_cv_shlibext"
1345309c398aSmrg  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1346309c398aSmrg  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1347309c398aSmrg  hardcode_direct="$acl_cv_hardcode_direct"
1348309c398aSmrg  hardcode_minus_L="$acl_cv_hardcode_minus_L"
1349309c398aSmrg  dnl Determine whether the user wants rpath handling at all.
1350309c398aSmrg  AC_ARG_ENABLE(rpath,
1351309c398aSmrg    [  --disable-rpath         do not hardcode runtime library paths],
1352309c398aSmrg    :, enable_rpath=yes)
1353309c398aSmrg])
1354e9554658Smrg
1355309c398aSmrgdnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1356309c398aSmrgdnl the libraries corresponding to explicit and implicit dependencies.
1357309c398aSmrgdnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1358309c398aSmrgAC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1359309c398aSmrg[
1360309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1361309c398aSmrg  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1362309c398aSmrg                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1363309c398aSmrg  dnl By default, look in $includedir and $libdir.
1364309c398aSmrg  use_additional=yes
1365309c398aSmrg  AC_LIB_WITH_FINAL_PREFIX([
1366309c398aSmrg    eval additional_includedir=\"$includedir\"
1367309c398aSmrg    eval additional_libdir=\"$libdir\"
1368309c398aSmrg  ])
1369309c398aSmrg  AC_LIB_ARG_WITH([lib$1-prefix],
1370309c398aSmrg[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
1371309c398aSmrg  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
1372309c398aSmrg[
1373309c398aSmrg    if test "X$withval" = "Xno"; then
1374309c398aSmrg      use_additional=no
1375309c398aSmrg    else
1376309c398aSmrg      if test "X$withval" = "X"; then
1377309c398aSmrg        AC_LIB_WITH_FINAL_PREFIX([
1378309c398aSmrg          eval additional_includedir=\"$includedir\"
1379309c398aSmrg          eval additional_libdir=\"$libdir\"
1380309c398aSmrg        ])
1381309c398aSmrg      else
1382309c398aSmrg        additional_includedir="$withval/include"
1383309c398aSmrg        additional_libdir="$withval/$acl_libdirstem"
1384309c398aSmrg      fi
1385309c398aSmrg    fi
1386309c398aSmrg])
1387309c398aSmrg  dnl Search the library and its dependencies in $additional_libdir and
1388309c398aSmrg  dnl $LDFLAGS. Using breadth-first-seach.
1389309c398aSmrg  LIB[]NAME=
1390309c398aSmrg  LTLIB[]NAME=
1391309c398aSmrg  INC[]NAME=
1392309c398aSmrg  rpathdirs=
1393309c398aSmrg  ltrpathdirs=
1394309c398aSmrg  names_already_handled=
1395309c398aSmrg  names_next_round='$1 $2'
1396309c398aSmrg  while test -n "$names_next_round"; do
1397309c398aSmrg    names_this_round="$names_next_round"
1398309c398aSmrg    names_next_round=
1399309c398aSmrg    for name in $names_this_round; do
1400309c398aSmrg      already_handled=
1401309c398aSmrg      for n in $names_already_handled; do
1402309c398aSmrg        if test "$n" = "$name"; then
1403309c398aSmrg          already_handled=yes
1404309c398aSmrg          break
1405309c398aSmrg        fi
1406309c398aSmrg      done
1407309c398aSmrg      if test -z "$already_handled"; then
1408309c398aSmrg        names_already_handled="$names_already_handled $name"
1409309c398aSmrg        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1410309c398aSmrg        dnl or AC_LIB_HAVE_LINKFLAGS call.
1411309c398aSmrg        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1412309c398aSmrg        eval value=\"\$HAVE_LIB$uppername\"
1413309c398aSmrg        if test -n "$value"; then
1414309c398aSmrg          if test "$value" = yes; then
1415309c398aSmrg            eval value=\"\$LIB$uppername\"
1416309c398aSmrg            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1417309c398aSmrg            eval value=\"\$LTLIB$uppername\"
1418309c398aSmrg            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1419309c398aSmrg          else
1420309c398aSmrg            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1421309c398aSmrg            dnl that this library doesn't exist. So just drop it.
1422309c398aSmrg            :
1423309c398aSmrg          fi
1424309c398aSmrg        else
1425309c398aSmrg          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1426309c398aSmrg          dnl and the already constructed $LIBNAME/$LTLIBNAME.
1427309c398aSmrg          found_dir=
1428309c398aSmrg          found_la=
1429309c398aSmrg          found_so=
1430309c398aSmrg          found_a=
1431309c398aSmrg          if test $use_additional = yes; then
1432309c398aSmrg            if test -n "$shlibext" \
1433309c398aSmrg               && { test -f "$additional_libdir/lib$name.$shlibext" \
1434309c398aSmrg                    || { test "$shlibext" = dll \
1435309c398aSmrg                         && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
1436309c398aSmrg              found_dir="$additional_libdir"
1437309c398aSmrg              if test -f "$additional_libdir/lib$name.$shlibext"; then
1438309c398aSmrg                found_so="$additional_libdir/lib$name.$shlibext"
1439309c398aSmrg              else
1440309c398aSmrg                found_so="$additional_libdir/lib$name.dll.a"
1441309c398aSmrg              fi
1442309c398aSmrg              if test -f "$additional_libdir/lib$name.la"; then
1443309c398aSmrg                found_la="$additional_libdir/lib$name.la"
1444309c398aSmrg              fi
1445309c398aSmrg            else
1446309c398aSmrg              if test -f "$additional_libdir/lib$name.$libext"; then
1447309c398aSmrg                found_dir="$additional_libdir"
1448309c398aSmrg                found_a="$additional_libdir/lib$name.$libext"
1449309c398aSmrg                if test -f "$additional_libdir/lib$name.la"; then
1450309c398aSmrg                  found_la="$additional_libdir/lib$name.la"
1451309c398aSmrg                fi
1452309c398aSmrg              fi
1453309c398aSmrg            fi
1454309c398aSmrg          fi
1455309c398aSmrg          if test "X$found_dir" = "X"; then
1456309c398aSmrg            for x in $LDFLAGS $LTLIB[]NAME; do
1457309c398aSmrg              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1458309c398aSmrg              case "$x" in
1459309c398aSmrg                -L*)
1460309c398aSmrg                  dir=`echo "X$x" | sed -e 's/^X-L//'`
1461309c398aSmrg                  if test -n "$shlibext" \
1462309c398aSmrg                     && { test -f "$dir/lib$name.$shlibext" \
1463309c398aSmrg                          || { test "$shlibext" = dll \
1464309c398aSmrg                               && test -f "$dir/lib$name.dll.a"; }; }; then
1465309c398aSmrg                    found_dir="$dir"
1466309c398aSmrg                    if test -f "$dir/lib$name.$shlibext"; then
1467309c398aSmrg                      found_so="$dir/lib$name.$shlibext"
1468309c398aSmrg                    else
1469309c398aSmrg                      found_so="$dir/lib$name.dll.a"
1470309c398aSmrg                    fi
1471309c398aSmrg                    if test -f "$dir/lib$name.la"; then
1472309c398aSmrg                      found_la="$dir/lib$name.la"
1473309c398aSmrg                    fi
1474309c398aSmrg                  else
1475309c398aSmrg                    if test -f "$dir/lib$name.$libext"; then
1476309c398aSmrg                      found_dir="$dir"
1477309c398aSmrg                      found_a="$dir/lib$name.$libext"
1478309c398aSmrg                      if test -f "$dir/lib$name.la"; then
1479309c398aSmrg                        found_la="$dir/lib$name.la"
1480309c398aSmrg                      fi
1481309c398aSmrg                    fi
1482309c398aSmrg                  fi
1483309c398aSmrg                  ;;
1484309c398aSmrg              esac
1485309c398aSmrg              if test "X$found_dir" != "X"; then
1486309c398aSmrg                break
1487309c398aSmrg              fi
1488309c398aSmrg            done
1489309c398aSmrg          fi
1490309c398aSmrg          if test "X$found_dir" != "X"; then
1491309c398aSmrg            dnl Found the library.
1492309c398aSmrg            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1493309c398aSmrg            if test "X$found_so" != "X"; then
1494309c398aSmrg              dnl Linking with a shared library. We attempt to hardcode its
1495309c398aSmrg              dnl directory into the executable's runpath, unless it's the
1496309c398aSmrg              dnl standard /usr/lib.
1497309c398aSmrg              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
1498309c398aSmrg                dnl No hardcoding is needed.
1499309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1500309c398aSmrg              else
1501309c398aSmrg                dnl Use an explicit option to hardcode DIR into the resulting
1502309c398aSmrg                dnl binary.
1503309c398aSmrg                dnl Potentially add DIR to ltrpathdirs.
1504309c398aSmrg                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1505309c398aSmrg                haveit=
1506309c398aSmrg                for x in $ltrpathdirs; do
1507309c398aSmrg                  if test "X$x" = "X$found_dir"; then
1508309c398aSmrg                    haveit=yes
1509309c398aSmrg                    break
1510309c398aSmrg                  fi
1511309c398aSmrg                done
1512309c398aSmrg                if test -z "$haveit"; then
1513309c398aSmrg                  ltrpathdirs="$ltrpathdirs $found_dir"
1514309c398aSmrg                fi
1515309c398aSmrg                dnl The hardcoding into $LIBNAME is system dependent.
1516309c398aSmrg                if test "$hardcode_direct" = yes; then
1517309c398aSmrg                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1518309c398aSmrg                  dnl resulting binary.
1519309c398aSmrg                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1520309c398aSmrg                else
1521309c398aSmrg                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1522309c398aSmrg                    dnl Use an explicit option to hardcode DIR into the resulting
1523309c398aSmrg                    dnl binary.
1524309c398aSmrg                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1525309c398aSmrg                    dnl Potentially add DIR to rpathdirs.
1526309c398aSmrg                    dnl The rpathdirs will be appended to $LIBNAME at the end.
1527309c398aSmrg                    haveit=
1528309c398aSmrg                    for x in $rpathdirs; do
1529309c398aSmrg                      if test "X$x" = "X$found_dir"; then
1530309c398aSmrg                        haveit=yes
1531309c398aSmrg                        break
1532309c398aSmrg                      fi
1533309c398aSmrg                    done
1534309c398aSmrg                    if test -z "$haveit"; then
1535309c398aSmrg                      rpathdirs="$rpathdirs $found_dir"
1536309c398aSmrg                    fi
1537309c398aSmrg                  else
1538309c398aSmrg                    dnl Rely on "-L$found_dir".
1539309c398aSmrg                    dnl But don't add it if it's already contained in the LDFLAGS
1540309c398aSmrg                    dnl or the already constructed $LIBNAME
1541309c398aSmrg                    haveit=
1542309c398aSmrg                    for x in $LDFLAGS $LIB[]NAME; do
1543309c398aSmrg                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1544309c398aSmrg                      if test "X$x" = "X-L$found_dir"; then
1545309c398aSmrg                        haveit=yes
1546309c398aSmrg                        break
1547309c398aSmrg                      fi
1548309c398aSmrg                    done
1549309c398aSmrg                    if test -z "$haveit"; then
1550309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1551309c398aSmrg                    fi
1552309c398aSmrg                    if test "$hardcode_minus_L" != no; then
1553309c398aSmrg                      dnl FIXME: Not sure whether we should use
1554309c398aSmrg                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1555309c398aSmrg                      dnl here.
1556309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1557309c398aSmrg                    else
1558309c398aSmrg                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
1559309c398aSmrg                      dnl here, because this doesn't fit in flags passed to the
1560309c398aSmrg                      dnl compiler. So give up. No hardcoding. This affects only
1561309c398aSmrg                      dnl very old systems.
1562309c398aSmrg                      dnl FIXME: Not sure whether we should use
1563309c398aSmrg                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1564309c398aSmrg                      dnl here.
1565309c398aSmrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1566309c398aSmrg                    fi
1567309c398aSmrg                  fi
1568309c398aSmrg                fi
1569309c398aSmrg              fi
1570309c398aSmrg            else
1571309c398aSmrg              if test "X$found_a" != "X"; then
1572309c398aSmrg                dnl Linking with a static library.
1573309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1574309c398aSmrg              else
1575309c398aSmrg                dnl We shouldn't come here, but anyway it's good to have a
1576309c398aSmrg                dnl fallback.
1577309c398aSmrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1578309c398aSmrg              fi
1579309c398aSmrg            fi
1580309c398aSmrg            dnl Assume the include files are nearby.
1581309c398aSmrg            additional_includedir=
1582309c398aSmrg            case "$found_dir" in
1583309c398aSmrg              */$acl_libdirstem | */$acl_libdirstem/)
1584309c398aSmrg                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
1585309c398aSmrg                additional_includedir="$basedir/include"
1586309c398aSmrg                ;;
1587309c398aSmrg            esac
1588309c398aSmrg            if test "X$additional_includedir" != "X"; then
1589309c398aSmrg              dnl Potentially add $additional_includedir to $INCNAME.
1590309c398aSmrg              dnl But don't add it
1591309c398aSmrg              dnl   1. if it's the standard /usr/include,
1592309c398aSmrg              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1593309c398aSmrg              dnl   3. if it's already present in $CPPFLAGS or the already
1594309c398aSmrg              dnl      constructed $INCNAME,
1595309c398aSmrg              dnl   4. if it doesn't exist as a directory.
1596309c398aSmrg              if test "X$additional_includedir" != "X/usr/include"; then
1597309c398aSmrg                haveit=
1598309c398aSmrg                if test "X$additional_includedir" = "X/usr/local/include"; then
1599309c398aSmrg                  if test -n "$GCC"; then
1600309c398aSmrg                    case $host_os in
1601309c398aSmrg                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1602309c398aSmrg                    esac
1603309c398aSmrg                  fi
1604309c398aSmrg                fi
1605309c398aSmrg                if test -z "$haveit"; then
1606309c398aSmrg                  for x in $CPPFLAGS $INC[]NAME; do
1607309c398aSmrg                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1608309c398aSmrg                    if test "X$x" = "X-I$additional_includedir"; then
1609309c398aSmrg                      haveit=yes
1610309c398aSmrg                      break
1611309c398aSmrg                    fi
1612309c398aSmrg                  done
1613309c398aSmrg                  if test -z "$haveit"; then
1614309c398aSmrg                    if test -d "$additional_includedir"; then
1615309c398aSmrg                      dnl Really add $additional_includedir to $INCNAME.
1616309c398aSmrg                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1617309c398aSmrg                    fi
1618309c398aSmrg                  fi
1619309c398aSmrg                fi
1620309c398aSmrg              fi
1621309c398aSmrg            fi
1622309c398aSmrg            dnl Look for dependencies.
1623309c398aSmrg            if test -n "$found_la"; then
1624309c398aSmrg              dnl Read the .la file. It defines the variables
1625309c398aSmrg              dnl dlname, library_names, old_library, dependency_libs, current,
1626309c398aSmrg              dnl age, revision, installed, dlopen, dlpreopen, libdir.
1627309c398aSmrg              save_libdir="$libdir"
1628309c398aSmrg              case "$found_la" in
1629309c398aSmrg                */* | *\\*) . "$found_la" ;;
1630309c398aSmrg                *) . "./$found_la" ;;
1631309c398aSmrg              esac
1632309c398aSmrg              libdir="$save_libdir"
1633309c398aSmrg              dnl We use only dependency_libs.
1634309c398aSmrg              for dep in $dependency_libs; do
1635309c398aSmrg                case "$dep" in
1636309c398aSmrg                  -L*)
1637309c398aSmrg                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1638309c398aSmrg                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1639309c398aSmrg                    dnl But don't add it
1640309c398aSmrg                    dnl   1. if it's the standard /usr/lib,
1641309c398aSmrg                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1642309c398aSmrg                    dnl   3. if it's already present in $LDFLAGS or the already
1643309c398aSmrg                    dnl      constructed $LIBNAME,
1644309c398aSmrg                    dnl   4. if it doesn't exist as a directory.
1645309c398aSmrg                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
1646309c398aSmrg                      haveit=
1647309c398aSmrg                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
1648309c398aSmrg                        if test -n "$GCC"; then
1649309c398aSmrg                          case $host_os in
1650309c398aSmrg                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1651309c398aSmrg                          esac
1652309c398aSmrg                        fi
1653309c398aSmrg                      fi
1654309c398aSmrg                      if test -z "$haveit"; then
1655309c398aSmrg                        haveit=
1656309c398aSmrg                        for x in $LDFLAGS $LIB[]NAME; do
1657309c398aSmrg                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1658309c398aSmrg                          if test "X$x" = "X-L$additional_libdir"; then
1659309c398aSmrg                            haveit=yes
1660309c398aSmrg                            break
1661309c398aSmrg                          fi
1662309c398aSmrg                        done
1663309c398aSmrg                        if test -z "$haveit"; then
1664309c398aSmrg                          if test -d "$additional_libdir"; then
1665309c398aSmrg                            dnl Really add $additional_libdir to $LIBNAME.
1666309c398aSmrg                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1667309c398aSmrg                          fi
1668309c398aSmrg                        fi
1669309c398aSmrg                        haveit=
1670309c398aSmrg                        for x in $LDFLAGS $LTLIB[]NAME; do
1671309c398aSmrg                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1672309c398aSmrg                          if test "X$x" = "X-L$additional_libdir"; then
1673309c398aSmrg                            haveit=yes
1674309c398aSmrg                            break
1675309c398aSmrg                          fi
1676309c398aSmrg                        done
1677309c398aSmrg                        if test -z "$haveit"; then
1678309c398aSmrg                          if test -d "$additional_libdir"; then
1679309c398aSmrg                            dnl Really add $additional_libdir to $LTLIBNAME.
1680309c398aSmrg                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1681309c398aSmrg                          fi
1682309c398aSmrg                        fi
1683309c398aSmrg                      fi
1684309c398aSmrg                    fi
1685309c398aSmrg                    ;;
1686309c398aSmrg                  -R*)
1687309c398aSmrg                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
1688309c398aSmrg                    if test "$enable_rpath" != no; then
1689309c398aSmrg                      dnl Potentially add DIR to rpathdirs.
1690309c398aSmrg                      dnl The rpathdirs will be appended to $LIBNAME at the end.
1691309c398aSmrg                      haveit=
1692309c398aSmrg                      for x in $rpathdirs; do
1693309c398aSmrg                        if test "X$x" = "X$dir"; then
1694309c398aSmrg                          haveit=yes
1695309c398aSmrg                          break
1696309c398aSmrg                        fi
1697309c398aSmrg                      done
1698309c398aSmrg                      if test -z "$haveit"; then
1699309c398aSmrg                        rpathdirs="$rpathdirs $dir"
1700309c398aSmrg                      fi
1701309c398aSmrg                      dnl Potentially add DIR to ltrpathdirs.
1702309c398aSmrg                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1703309c398aSmrg                      haveit=
1704309c398aSmrg                      for x in $ltrpathdirs; do
1705309c398aSmrg                        if test "X$x" = "X$dir"; then
1706309c398aSmrg                          haveit=yes
1707309c398aSmrg                          break
1708309c398aSmrg                        fi
1709309c398aSmrg                      done
1710309c398aSmrg                      if test -z "$haveit"; then
1711309c398aSmrg                        ltrpathdirs="$ltrpathdirs $dir"
1712309c398aSmrg                      fi
1713309c398aSmrg                    fi
1714309c398aSmrg                    ;;
1715309c398aSmrg                  -l*)
1716309c398aSmrg                    dnl Handle this in the next round.
1717309c398aSmrg                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1718309c398aSmrg                    ;;
1719309c398aSmrg                  *.la)
1720309c398aSmrg                    dnl Handle this in the next round. Throw away the .la's
1721309c398aSmrg                    dnl directory; it is already contained in a preceding -L
1722309c398aSmrg                    dnl option.
1723309c398aSmrg                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1724309c398aSmrg                    ;;
1725309c398aSmrg                  *)
1726309c398aSmrg                    dnl Most likely an immediate library name.
1727309c398aSmrg                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1728309c398aSmrg                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1729309c398aSmrg                    ;;
1730309c398aSmrg                esac
1731309c398aSmrg              done
1732309c398aSmrg            fi
1733309c398aSmrg          else
1734309c398aSmrg            dnl Didn't find the library; assume it is in the system directories
1735309c398aSmrg            dnl known to the linker and runtime loader. (All the system
1736309c398aSmrg            dnl directories known to the linker should also be known to the
1737309c398aSmrg            dnl runtime loader, otherwise the system is severely misconfigured.)
1738309c398aSmrg            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1739309c398aSmrg            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1740309c398aSmrg          fi
1741309c398aSmrg        fi
1742309c398aSmrg      fi
1743309c398aSmrg    done
1744309c398aSmrg  done
1745309c398aSmrg  if test "X$rpathdirs" != "X"; then
1746309c398aSmrg    if test -n "$hardcode_libdir_separator"; then
1747309c398aSmrg      dnl Weird platform: only the last -rpath option counts, the user must
1748309c398aSmrg      dnl pass all path elements in one option. We can arrange that for a
1749309c398aSmrg      dnl single library, but not when more than one $LIBNAMEs are used.
1750309c398aSmrg      alldirs=
1751309c398aSmrg      for found_dir in $rpathdirs; do
1752309c398aSmrg        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1753309c398aSmrg      done
1754309c398aSmrg      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1755309c398aSmrg      acl_save_libdir="$libdir"
1756309c398aSmrg      libdir="$alldirs"
1757309c398aSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
1758309c398aSmrg      libdir="$acl_save_libdir"
1759309c398aSmrg      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1760309c398aSmrg    else
1761309c398aSmrg      dnl The -rpath options are cumulative.
1762309c398aSmrg      for found_dir in $rpathdirs; do
1763309c398aSmrg        acl_save_libdir="$libdir"
1764309c398aSmrg        libdir="$found_dir"
1765309c398aSmrg        eval flag=\"$hardcode_libdir_flag_spec\"
1766309c398aSmrg        libdir="$acl_save_libdir"
1767309c398aSmrg        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1768309c398aSmrg      done
1769309c398aSmrg    fi
1770309c398aSmrg  fi
1771309c398aSmrg  if test "X$ltrpathdirs" != "X"; then
1772309c398aSmrg    dnl When using libtool, the option that works for both libraries and
1773309c398aSmrg    dnl executables is -R. The -R options are cumulative.
1774309c398aSmrg    for found_dir in $ltrpathdirs; do
1775309c398aSmrg      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1776309c398aSmrg    done
1777309c398aSmrg  fi
1778309c398aSmrg])
17798903d43aSmrg
1780309c398aSmrgdnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1781309c398aSmrgdnl unless already present in VAR.
1782309c398aSmrgdnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1783309c398aSmrgdnl contains two or three consecutive elements that belong together.
1784309c398aSmrgAC_DEFUN([AC_LIB_APPENDTOVAR],
1785309c398aSmrg[
1786309c398aSmrg  for element in [$2]; do
1787309c398aSmrg    haveit=
1788309c398aSmrg    for x in $[$1]; do
1789309c398aSmrg      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1790309c398aSmrg      if test "X$x" = "X$element"; then
1791309c398aSmrg        haveit=yes
1792309c398aSmrg        break
1793309c398aSmrg      fi
1794309c398aSmrg    done
1795309c398aSmrg    if test -z "$haveit"; then
1796309c398aSmrg      [$1]="${[$1]}${[$1]:+ }$element"
1797309c398aSmrg    fi
1798309c398aSmrg  done
1799309c398aSmrg])
18008903d43aSmrg
1801309c398aSmrgdnl For those cases where a variable contains several -L and -l options
1802309c398aSmrgdnl referring to unknown libraries and directories, this macro determines the
1803309c398aSmrgdnl necessary additional linker options for the runtime path.
1804309c398aSmrgdnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
1805309c398aSmrgdnl sets LDADDVAR to linker options needed together with LIBSVALUE.
1806309c398aSmrgdnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
1807309c398aSmrgdnl otherwise linking without libtool is assumed.
1808309c398aSmrgAC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
1809309c398aSmrg[
1810309c398aSmrg  AC_REQUIRE([AC_LIB_RPATH])
1811309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1812309c398aSmrg  $1=
1813309c398aSmrg  if test "$enable_rpath" != no; then
1814309c398aSmrg    if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1815309c398aSmrg      dnl Use an explicit option to hardcode directories into the resulting
1816309c398aSmrg      dnl binary.
1817309c398aSmrg      rpathdirs=
1818309c398aSmrg      next=
1819309c398aSmrg      for opt in $2; do
1820309c398aSmrg        if test -n "$next"; then
1821309c398aSmrg          dir="$next"
1822309c398aSmrg          dnl No need to hardcode the standard /usr/lib.
1823309c398aSmrg          if test "X$dir" != "X/usr/$acl_libdirstem"; then
1824309c398aSmrg            rpathdirs="$rpathdirs $dir"
1825309c398aSmrg          fi
1826309c398aSmrg          next=
1827309c398aSmrg        else
1828309c398aSmrg          case $opt in
1829309c398aSmrg            -L) next=yes ;;
1830309c398aSmrg            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
1831309c398aSmrg                 dnl No need to hardcode the standard /usr/lib.
1832309c398aSmrg                 if test "X$dir" != "X/usr/$acl_libdirstem"; then
1833309c398aSmrg                   rpathdirs="$rpathdirs $dir"
1834309c398aSmrg                 fi
1835309c398aSmrg                 next= ;;
1836309c398aSmrg            *) next= ;;
1837309c398aSmrg          esac
1838309c398aSmrg        fi
1839309c398aSmrg      done
1840309c398aSmrg      if test "X$rpathdirs" != "X"; then
1841309c398aSmrg        if test -n ""$3""; then
1842309c398aSmrg          dnl libtool is used for linking. Use -R options.
1843309c398aSmrg          for dir in $rpathdirs; do
1844309c398aSmrg            $1="${$1}${$1:+ }-R$dir"
1845309c398aSmrg          done
1846309c398aSmrg        else
1847309c398aSmrg          dnl The linker is used for linking directly.
1848309c398aSmrg          if test -n "$hardcode_libdir_separator"; then
1849309c398aSmrg            dnl Weird platform: only the last -rpath option counts, the user
1850309c398aSmrg            dnl must pass all path elements in one option.
1851309c398aSmrg            alldirs=
1852309c398aSmrg            for dir in $rpathdirs; do
1853309c398aSmrg              alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
1854309c398aSmrg            done
1855309c398aSmrg            acl_save_libdir="$libdir"
1856309c398aSmrg            libdir="$alldirs"
1857309c398aSmrg            eval flag=\"$hardcode_libdir_flag_spec\"
1858309c398aSmrg            libdir="$acl_save_libdir"
1859309c398aSmrg            $1="$flag"
1860309c398aSmrg          else
1861309c398aSmrg            dnl The -rpath options are cumulative.
1862309c398aSmrg            for dir in $rpathdirs; do
1863309c398aSmrg              acl_save_libdir="$libdir"
1864309c398aSmrg              libdir="$dir"
1865309c398aSmrg              eval flag=\"$hardcode_libdir_flag_spec\"
1866309c398aSmrg              libdir="$acl_save_libdir"
1867309c398aSmrg              $1="${$1}${$1:+ }$flag"
1868309c398aSmrg            done
1869309c398aSmrg          fi
1870309c398aSmrg        fi
1871309c398aSmrg      fi
1872309c398aSmrg    fi
1873309c398aSmrg  fi
1874309c398aSmrg  AC_SUBST([$1])
1875309c398aSmrg])
1876e9554658Smrg
1877309c398aSmrg# lib-prefix.m4 serial 5 (gettext-0.15)
1878309c398aSmrgdnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
1879309c398aSmrgdnl This file is free software; the Free Software Foundation
1880309c398aSmrgdnl gives unlimited permission to copy and/or distribute it,
1881309c398aSmrgdnl with or without modifications, as long as this notice is preserved.
1882309c398aSmrg
1883309c398aSmrgdnl From Bruno Haible.
1884309c398aSmrg
1885309c398aSmrgdnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
1886309c398aSmrgdnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
1887309c398aSmrgdnl require excessive bracketing.
1888309c398aSmrgifdef([AC_HELP_STRING],
1889309c398aSmrg[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
1890309c398aSmrg[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
1891309c398aSmrg
1892309c398aSmrgdnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1893309c398aSmrgdnl to access previously installed libraries. The basic assumption is that
1894309c398aSmrgdnl a user will want packages to use other packages he previously installed
1895309c398aSmrgdnl with the same --prefix option.
1896309c398aSmrgdnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1897309c398aSmrgdnl libraries, but is otherwise very convenient.
1898309c398aSmrgAC_DEFUN([AC_LIB_PREFIX],
1899309c398aSmrg[
1900309c398aSmrg  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1901309c398aSmrg  AC_REQUIRE([AC_PROG_CC])
1902309c398aSmrg  AC_REQUIRE([AC_CANONICAL_HOST])
1903309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1904309c398aSmrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1905309c398aSmrg  dnl By default, look in $includedir and $libdir.
1906309c398aSmrg  use_additional=yes
1907309c398aSmrg  AC_LIB_WITH_FINAL_PREFIX([
1908309c398aSmrg    eval additional_includedir=\"$includedir\"
1909309c398aSmrg    eval additional_libdir=\"$libdir\"
1910309c398aSmrg  ])
1911309c398aSmrg  AC_LIB_ARG_WITH([lib-prefix],
1912309c398aSmrg[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1913309c398aSmrg  --without-lib-prefix    don't search for libraries in includedir and libdir],
1914309c398aSmrg[
1915309c398aSmrg    if test "X$withval" = "Xno"; then
1916309c398aSmrg      use_additional=no
1917309c398aSmrg    else
1918309c398aSmrg      if test "X$withval" = "X"; then
1919309c398aSmrg        AC_LIB_WITH_FINAL_PREFIX([
1920309c398aSmrg          eval additional_includedir=\"$includedir\"
1921309c398aSmrg          eval additional_libdir=\"$libdir\"
1922309c398aSmrg        ])
1923309c398aSmrg      else
1924309c398aSmrg        additional_includedir="$withval/include"
1925309c398aSmrg        additional_libdir="$withval/$acl_libdirstem"
1926309c398aSmrg      fi
1927309c398aSmrg    fi
1928309c398aSmrg])
1929309c398aSmrg  if test $use_additional = yes; then
1930309c398aSmrg    dnl Potentially add $additional_includedir to $CPPFLAGS.
1931309c398aSmrg    dnl But don't add it
1932309c398aSmrg    dnl   1. if it's the standard /usr/include,
1933309c398aSmrg    dnl   2. if it's already present in $CPPFLAGS,
1934309c398aSmrg    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1935309c398aSmrg    dnl   4. if it doesn't exist as a directory.
1936309c398aSmrg    if test "X$additional_includedir" != "X/usr/include"; then
1937309c398aSmrg      haveit=
1938309c398aSmrg      for x in $CPPFLAGS; do
1939309c398aSmrg        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1940309c398aSmrg        if test "X$x" = "X-I$additional_includedir"; then
1941309c398aSmrg          haveit=yes
1942309c398aSmrg          break
1943309c398aSmrg        fi
1944309c398aSmrg      done
1945309c398aSmrg      if test -z "$haveit"; then
1946309c398aSmrg        if test "X$additional_includedir" = "X/usr/local/include"; then
1947309c398aSmrg          if test -n "$GCC"; then
1948309c398aSmrg            case $host_os in
1949309c398aSmrg              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1950309c398aSmrg            esac
1951309c398aSmrg          fi
1952309c398aSmrg        fi
1953309c398aSmrg        if test -z "$haveit"; then
1954309c398aSmrg          if test -d "$additional_includedir"; then
1955309c398aSmrg            dnl Really add $additional_includedir to $CPPFLAGS.
1956309c398aSmrg            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1957309c398aSmrg          fi
1958309c398aSmrg        fi
1959309c398aSmrg      fi
1960309c398aSmrg    fi
1961309c398aSmrg    dnl Potentially add $additional_libdir to $LDFLAGS.
1962309c398aSmrg    dnl But don't add it
1963309c398aSmrg    dnl   1. if it's the standard /usr/lib,
1964309c398aSmrg    dnl   2. if it's already present in $LDFLAGS,
1965309c398aSmrg    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1966309c398aSmrg    dnl   4. if it doesn't exist as a directory.
1967309c398aSmrg    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
1968309c398aSmrg      haveit=
1969309c398aSmrg      for x in $LDFLAGS; do
1970309c398aSmrg        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1971309c398aSmrg        if test "X$x" = "X-L$additional_libdir"; then
1972309c398aSmrg          haveit=yes
1973309c398aSmrg          break
1974309c398aSmrg        fi
1975309c398aSmrg      done
1976309c398aSmrg      if test -z "$haveit"; then
1977309c398aSmrg        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
1978309c398aSmrg          if test -n "$GCC"; then
1979309c398aSmrg            case $host_os in
1980309c398aSmrg              linux*) haveit=yes;;
1981309c398aSmrg            esac
1982309c398aSmrg          fi
1983309c398aSmrg        fi
1984309c398aSmrg        if test -z "$haveit"; then
1985309c398aSmrg          if test -d "$additional_libdir"; then
1986309c398aSmrg            dnl Really add $additional_libdir to $LDFLAGS.
1987309c398aSmrg            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1988309c398aSmrg          fi
1989309c398aSmrg        fi
1990309c398aSmrg      fi
1991309c398aSmrg    fi
1992309c398aSmrg  fi
1993309c398aSmrg])
1994309c398aSmrg
1995309c398aSmrgdnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1996309c398aSmrgdnl acl_final_exec_prefix, containing the values to which $prefix and
1997309c398aSmrgdnl $exec_prefix will expand at the end of the configure script.
1998309c398aSmrgAC_DEFUN([AC_LIB_PREPARE_PREFIX],
1999309c398aSmrg[
2000309c398aSmrg  dnl Unfortunately, prefix and exec_prefix get only finally determined
2001309c398aSmrg  dnl at the end of configure.
2002309c398aSmrg  if test "X$prefix" = "XNONE"; then
2003309c398aSmrg    acl_final_prefix="$ac_default_prefix"
2004309c398aSmrg  else
2005309c398aSmrg    acl_final_prefix="$prefix"
2006309c398aSmrg  fi
2007309c398aSmrg  if test "X$exec_prefix" = "XNONE"; then
2008309c398aSmrg    acl_final_exec_prefix='${prefix}'
2009309c398aSmrg  else
2010309c398aSmrg    acl_final_exec_prefix="$exec_prefix"
2011309c398aSmrg  fi
2012309c398aSmrg  acl_save_prefix="$prefix"
2013309c398aSmrg  prefix="$acl_final_prefix"
2014309c398aSmrg  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
2015309c398aSmrg  prefix="$acl_save_prefix"
2016309c398aSmrg])
2017309c398aSmrg
2018309c398aSmrgdnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
2019309c398aSmrgdnl variables prefix and exec_prefix bound to the values they will have
2020309c398aSmrgdnl at the end of the configure script.
2021309c398aSmrgAC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
2022309c398aSmrg[
2023309c398aSmrg  acl_save_prefix="$prefix"
2024309c398aSmrg  prefix="$acl_final_prefix"
2025309c398aSmrg  acl_save_exec_prefix="$exec_prefix"
2026309c398aSmrg  exec_prefix="$acl_final_exec_prefix"
2027309c398aSmrg  $1
2028309c398aSmrg  exec_prefix="$acl_save_exec_prefix"
2029309c398aSmrg  prefix="$acl_save_prefix"
2030309c398aSmrg])
2031309c398aSmrg
2032309c398aSmrgdnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
2033309c398aSmrgdnl the basename of the libdir, either "lib" or "lib64".
2034309c398aSmrgAC_DEFUN([AC_LIB_PREPARE_MULTILIB],
2035309c398aSmrg[
2036309c398aSmrg  dnl There is no formal standard regarding lib and lib64. The current
2037309c398aSmrg  dnl practice is that on a system supporting 32-bit and 64-bit instruction
2038309c398aSmrg  dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
2039309c398aSmrg  dnl libraries go under $prefix/lib. We determine the compiler's default
2040309c398aSmrg  dnl mode by looking at the compiler's library search path. If at least
2041309c398aSmrg  dnl of its elements ends in /lib64 or points to a directory whose absolute
2042309c398aSmrg  dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
2043309c398aSmrg  dnl default, namely "lib".
2044309c398aSmrg  acl_libdirstem=lib
2045309c398aSmrg  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
2046309c398aSmrg  if test -n "$searchpath"; then
2047309c398aSmrg    acl_save_IFS="${IFS= 	}"; IFS=":"
2048309c398aSmrg    for searchdir in $searchpath; do
2049309c398aSmrg      if test -d "$searchdir"; then
2050309c398aSmrg        case "$searchdir" in
2051309c398aSmrg          */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
2052309c398aSmrg          *) searchdir=`cd "$searchdir" && pwd`
2053309c398aSmrg             case "$searchdir" in
2054309c398aSmrg               */lib64 ) acl_libdirstem=lib64 ;;
2055309c398aSmrg             esac ;;
2056309c398aSmrg        esac
2057309c398aSmrg      fi
2058309c398aSmrg    done
2059309c398aSmrg    IFS="$acl_save_IFS"
2060309c398aSmrg  fi
2061309c398aSmrg])
2062309c398aSmrg
2063309c398aSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2064309c398aSmrg# 
2065309c398aSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2066309c398aSmrg#
2067309c398aSmrg# This program is free software; you can redistribute it and/or modify
2068309c398aSmrg# it under the terms of the GNU General Public License as published by
2069309c398aSmrg# the Free Software Foundation; either version 2 of the License, or
2070309c398aSmrg# (at your option) any later version.
2071309c398aSmrg#
2072309c398aSmrg# This program is distributed in the hope that it will be useful, but
2073309c398aSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
2074309c398aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2075309c398aSmrg# General Public License for more details.
2076309c398aSmrg#
2077309c398aSmrg# You should have received a copy of the GNU General Public License
2078309c398aSmrg# along with this program; if not, write to the Free Software
2079309c398aSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2080309c398aSmrg#
2081309c398aSmrg# As a special exception to the GNU General Public License, if you
2082309c398aSmrg# distribute this file as part of a program that contains a
2083309c398aSmrg# configuration script generated by Autoconf, you may include it under
2084309c398aSmrg# the same distribution terms that you use for the rest of that program.
2085309c398aSmrg
2086309c398aSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2087309c398aSmrg# ----------------------------------
2088309c398aSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
2089309c398aSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2090309c398aSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2091309c398aSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2092309c398aSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2093309c398aSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2094309c398aSmrgfi
2095309c398aSmrgif test -n "$PKG_CONFIG"; then
2096309c398aSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
2097309c398aSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2098309c398aSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2099309c398aSmrg		AC_MSG_RESULT([yes])
2100309c398aSmrg	else
2101309c398aSmrg		AC_MSG_RESULT([no])
2102309c398aSmrg		PKG_CONFIG=""
2103309c398aSmrg	fi
2104309c398aSmrg		
2105309c398aSmrgfi[]dnl
2106309c398aSmrg])# PKG_PROG_PKG_CONFIG
2107309c398aSmrg
2108309c398aSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2109309c398aSmrg#
2110309c398aSmrg# Check to see whether a particular set of modules exists.  Similar
2111309c398aSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2112309c398aSmrg#
2113309c398aSmrg#
2114309c398aSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2115309c398aSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
2116309c398aSmrg# PKG_CHECK_EXISTS manually
2117309c398aSmrg# --------------------------------------------------------------
2118309c398aSmrgAC_DEFUN([PKG_CHECK_EXISTS],
2119309c398aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2120309c398aSmrgif test -n "$PKG_CONFIG" && \
2121309c398aSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2122309c398aSmrg  m4_ifval([$2], [$2], [:])
2123309c398aSmrgm4_ifvaln([$3], [else
2124309c398aSmrg  $3])dnl
2125309c398aSmrgfi])
2126309c398aSmrg
2127309c398aSmrg
2128309c398aSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2129309c398aSmrg# ---------------------------------------------
2130309c398aSmrgm4_define([_PKG_CONFIG],
2131309c398aSmrg[if test -n "$$1"; then
2132309c398aSmrg    pkg_cv_[]$1="$$1"
2133309c398aSmrg elif test -n "$PKG_CONFIG"; then
2134309c398aSmrg    PKG_CHECK_EXISTS([$3],
2135309c398aSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2136309c398aSmrg		     [pkg_failed=yes])
2137309c398aSmrg else
2138309c398aSmrg    pkg_failed=untried
2139309c398aSmrgfi[]dnl
2140309c398aSmrg])# _PKG_CONFIG
2141309c398aSmrg
2142309c398aSmrg# _PKG_SHORT_ERRORS_SUPPORTED
2143309c398aSmrg# -----------------------------
2144309c398aSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2145309c398aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2146309c398aSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2147309c398aSmrg        _pkg_short_errors_supported=yes
2148309c398aSmrgelse
2149309c398aSmrg        _pkg_short_errors_supported=no
2150309c398aSmrgfi[]dnl
2151309c398aSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
2152309c398aSmrg
2153309c398aSmrg
2154309c398aSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2155309c398aSmrg# [ACTION-IF-NOT-FOUND])
2156309c398aSmrg#
2157309c398aSmrg#
2158309c398aSmrg# Note that if there is a possibility the first call to
2159309c398aSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
2160309c398aSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2161309c398aSmrg#
2162309c398aSmrg#
2163309c398aSmrg# --------------------------------------------------------------
2164309c398aSmrgAC_DEFUN([PKG_CHECK_MODULES],
2165309c398aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2166309c398aSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2167309c398aSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2168309c398aSmrg
2169309c398aSmrgpkg_failed=no
2170309c398aSmrgAC_MSG_CHECKING([for $1])
2171309c398aSmrg
2172309c398aSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2173309c398aSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2174309c398aSmrg
2175309c398aSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2176309c398aSmrgand $1[]_LIBS to avoid the need to call pkg-config.
2177309c398aSmrgSee the pkg-config man page for more details.])
2178309c398aSmrg
2179309c398aSmrgif test $pkg_failed = yes; then
2180309c398aSmrg        _PKG_SHORT_ERRORS_SUPPORTED
2181309c398aSmrg        if test $_pkg_short_errors_supported = yes; then
2182309c398aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2183309c398aSmrg        else 
2184309c398aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2185309c398aSmrg        fi
2186309c398aSmrg	# Put the nasty error message in config.log where it belongs
2187309c398aSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2188309c398aSmrg
2189309c398aSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
2190309c398aSmrg[Package requirements ($2) were not met:
2191309c398aSmrg
2192309c398aSmrg$$1_PKG_ERRORS
2193309c398aSmrg
2194309c398aSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
2195309c398aSmrginstalled software in a non-standard prefix.
2196309c398aSmrg
2197309c398aSmrg_PKG_TEXT
2198309c398aSmrg])],
2199309c398aSmrg		[AC_MSG_RESULT([no])
2200309c398aSmrg                $4])
2201309c398aSmrgelif test $pkg_failed = untried; then
2202309c398aSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
2203309c398aSmrg[The pkg-config script could not be found or is too old.  Make sure it
2204309c398aSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2205309c398aSmrgpath to pkg-config.
2206309c398aSmrg
2207309c398aSmrg_PKG_TEXT
2208309c398aSmrg
2209309c398aSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2210309c398aSmrg		[$4])
2211309c398aSmrgelse
2212309c398aSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2213309c398aSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2214309c398aSmrg        AC_MSG_RESULT([yes])
2215309c398aSmrg	ifelse([$3], , :, [$3])
2216309c398aSmrgfi[]dnl
2217309c398aSmrg])# PKG_CHECK_MODULES
2218309c398aSmrg
2219309c398aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
2220309c398aSmrgdnl
2221309c398aSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2222309c398aSmrgdnl 
2223309c398aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
2224309c398aSmrgdnl copy of this software and associated documentation files (the "Software"),
2225309c398aSmrgdnl to deal in the Software without restriction, including without limitation
2226309c398aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
2227309c398aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
2228309c398aSmrgdnl Software is furnished to do so, subject to the following conditions:
2229309c398aSmrgdnl
2230309c398aSmrgdnl The above copyright notice and this permission notice (including the next
2231309c398aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
2232309c398aSmrgdnl Software.
2233309c398aSmrgdnl
2234309c398aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2235309c398aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2236309c398aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2237309c398aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2238309c398aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2239309c398aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2240309c398aSmrgdnl DEALINGS IN THE SOFTWARE.
2241309c398aSmrg
2242309c398aSmrg# XORG_MACROS_VERSION(required-version)
2243309c398aSmrg# -------------------------------------
2244309c398aSmrg# Minimum version: 1.1.0
2245309c398aSmrg#
2246309c398aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
2247309c398aSmrg# your configure.ac with the minimum required version, such as:
2248309c398aSmrg# XORG_MACROS_VERSION(1.1)
2249309c398aSmrg#
2250309c398aSmrg# To ensure that this macro is defined, also add:
2251309c398aSmrg# m4_ifndef([XORG_MACROS_VERSION],
2252309c398aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
2253309c398aSmrg#
2254309c398aSmrg#
2255309c398aSmrg# See the "minimum version" comment for each macro you use to see what 
2256309c398aSmrg# version you require.
2257309c398aSmrgm4_defun([XORG_MACROS_VERSION],[
2258309c398aSmrgm4_define([vers_have], [1.16.1])
2259309c398aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
2260309c398aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
2261309c398aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
2262309c398aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
2263309c398aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
2264309c398aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
2265309c398aSmrgm4_undefine([vers_have])
2266309c398aSmrgm4_undefine([maj_have])
2267309c398aSmrgm4_undefine([maj_needed])
2268309c398aSmrg]) # XORG_MACROS_VERSION
2269309c398aSmrg
2270309c398aSmrg# XORG_PROG_RAWCPP()
2271309c398aSmrg# ------------------
2272309c398aSmrg# Minimum version: 1.0.0
2273309c398aSmrg#
2274309c398aSmrg# Find cpp program and necessary flags for use in pre-processing text files
2275309c398aSmrg# such as man pages and config files
2276309c398aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
2277309c398aSmrgAC_REQUIRE([AC_PROG_CPP])
2278309c398aSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
2279309c398aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
2280309c398aSmrg
2281309c398aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
2282309c398aSmrg# which is not the best choice for supporting other OS'es, but covers most
2283309c398aSmrg# of the ones we need for now.
2284309c398aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
2285309c398aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
2286309c398aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2287309c398aSmrg	AC_MSG_RESULT([no])
2288309c398aSmrgelse
2289309c398aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2290309c398aSmrg		RAWCPPFLAGS=-undef
2291309c398aSmrg		AC_MSG_RESULT([yes])
2292309c398aSmrg	# under Cygwin unix is still defined even with -undef
2293309c398aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2294309c398aSmrg		RAWCPPFLAGS="-undef -ansi"
2295309c398aSmrg		AC_MSG_RESULT([yes, with -ansi])
2296309c398aSmrg	else
2297309c398aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
2298309c398aSmrg	fi
2299309c398aSmrgfi
2300309c398aSmrgrm -f conftest.$ac_ext
2301309c398aSmrg
2302309c398aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
2303309c398aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
2304309c398aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
2305309c398aSmrg	AC_MSG_RESULT([no])
2306309c398aSmrgelse
2307309c398aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
2308309c398aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
2309309c398aSmrg		AC_MSG_RESULT([yes])
2310309c398aSmrg	else
2311309c398aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
2312309c398aSmrg	fi
2313309c398aSmrgfi
2314309c398aSmrgrm -f conftest.$ac_ext
2315309c398aSmrgAC_SUBST(RAWCPPFLAGS)
2316309c398aSmrg]) # XORG_PROG_RAWCPP
2317309c398aSmrg
2318309c398aSmrg# XORG_MANPAGE_SECTIONS()
2319309c398aSmrg# -----------------------
2320309c398aSmrg# Minimum version: 1.0.0
2321309c398aSmrg#
2322309c398aSmrg# Determine which sections man pages go in for the different man page types
2323309c398aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
2324309c398aSmrg# Not sure if there's any better way than just hardcoding by OS name.
2325309c398aSmrg# Override default settings by setting environment variables
2326309c398aSmrg# Added MAN_SUBSTS in version 1.8
2327309c398aSmrg# Added AC_PROG_SED in version 1.8
2328309c398aSmrg
2329309c398aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
2330309c398aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2331309c398aSmrgAC_REQUIRE([AC_PROG_SED])
2332309c398aSmrg
2333309c398aSmrgif test x$APP_MAN_SUFFIX = x    ; then
2334309c398aSmrg    APP_MAN_SUFFIX=1
2335309c398aSmrgfi
2336309c398aSmrgif test x$APP_MAN_DIR = x    ; then
2337309c398aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
2338309c398aSmrgfi
2339309c398aSmrg
2340309c398aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
2341309c398aSmrg    LIB_MAN_SUFFIX=3
2342309c398aSmrgfi
2343309c398aSmrgif test x$LIB_MAN_DIR = x    ; then
2344309c398aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
2345309c398aSmrgfi
2346309c398aSmrg
2347309c398aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
2348309c398aSmrg    case $host_os in
2349309c398aSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
2350309c398aSmrg	*)		FILE_MAN_SUFFIX=5  ;;
2351309c398aSmrg    esac
2352309c398aSmrgfi
2353309c398aSmrgif test x$FILE_MAN_DIR = x    ; then
2354309c398aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
2355309c398aSmrgfi
2356309c398aSmrg
2357309c398aSmrgif test x$MISC_MAN_SUFFIX = x    ; then
2358309c398aSmrg    case $host_os in
2359309c398aSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
2360309c398aSmrg	*)		MISC_MAN_SUFFIX=7  ;;
2361309c398aSmrg    esac
2362309c398aSmrgfi
2363309c398aSmrgif test x$MISC_MAN_DIR = x    ; then
2364309c398aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
2365309c398aSmrgfi
2366309c398aSmrg
2367309c398aSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
2368309c398aSmrg    case $host_os in
2369309c398aSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
2370309c398aSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
2371309c398aSmrg    esac
2372309c398aSmrgfi
2373309c398aSmrgif test x$DRIVER_MAN_DIR = x    ; then
2374309c398aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
2375309c398aSmrgfi
2376309c398aSmrg
2377309c398aSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
2378309c398aSmrg    case $host_os in
2379309c398aSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
2380309c398aSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
2381309c398aSmrg    esac
2382309c398aSmrgfi
2383309c398aSmrgif test x$ADMIN_MAN_DIR = x    ; then
2384309c398aSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
2385309c398aSmrgfi
2386309c398aSmrg
2387309c398aSmrg
2388309c398aSmrgAC_SUBST([APP_MAN_SUFFIX])
2389309c398aSmrgAC_SUBST([LIB_MAN_SUFFIX])
2390309c398aSmrgAC_SUBST([FILE_MAN_SUFFIX])
2391309c398aSmrgAC_SUBST([MISC_MAN_SUFFIX])
2392309c398aSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
2393309c398aSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
2394309c398aSmrgAC_SUBST([APP_MAN_DIR])
2395309c398aSmrgAC_SUBST([LIB_MAN_DIR])
2396309c398aSmrgAC_SUBST([FILE_MAN_DIR])
2397309c398aSmrgAC_SUBST([MISC_MAN_DIR])
2398309c398aSmrgAC_SUBST([DRIVER_MAN_DIR])
2399309c398aSmrgAC_SUBST([ADMIN_MAN_DIR])
2400309c398aSmrg
2401309c398aSmrgXORG_MAN_PAGE="X Version 11"
2402309c398aSmrgAC_SUBST([XORG_MAN_PAGE])
2403309c398aSmrgMAN_SUBSTS="\
2404309c398aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2405309c398aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2406309c398aSmrg	-e 's|__xservername__|Xorg|g' \
2407309c398aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
2408309c398aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
2409309c398aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
2410309c398aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
2411309c398aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
2412309c398aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
2413309c398aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
2414309c398aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
2415309c398aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
2416309c398aSmrgAC_SUBST([MAN_SUBSTS])
2417309c398aSmrg
2418309c398aSmrg]) # XORG_MANPAGE_SECTIONS
2419309c398aSmrg
2420309c398aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
2421309c398aSmrg# ------------------------
2422309c398aSmrg# Minimum version: 1.7.0
2423309c398aSmrg#
2424309c398aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
2425309c398aSmrg# provided by xorg-sgml-doctools, if installed.
24268903d43aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
24278903d43aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
24288903d43aSmrgXORG_SGML_PATH=
24298903d43aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
24308903d43aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
24318903d43aSmrg    [m4_ifval([$1],[:],
24328903d43aSmrg        [if test x"$cross_compiling" != x"yes" ; then
24338903d43aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
24348903d43aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
24358903d43aSmrg         fi])
24368903d43aSmrg    ])
24378903d43aSmrg
24388903d43aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
24398903d43aSmrg# the path and the name of the doc stylesheet
24408903d43aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
24418903d43aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
24428903d43aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
24438903d43aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
24448903d43aSmrgelse
24458903d43aSmrg   AC_MSG_RESULT([no])
24468903d43aSmrgfi
24478903d43aSmrg
24488903d43aSmrgAC_SUBST(XORG_SGML_PATH)
24498903d43aSmrgAC_SUBST(STYLESHEET_SRCDIR)
24508903d43aSmrgAC_SUBST(XSL_STYLESHEET)
24518903d43aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
24528903d43aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
24538903d43aSmrg
2454e9554658Smrg# XORG_CHECK_LINUXDOC
2455e9554658Smrg# -------------------
2456e9554658Smrg# Minimum version: 1.0.0
2457e9554658Smrg#
2458e9554658Smrg# Defines the variable MAKE_TEXT if the necessary tools and
2459e9554658Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
2460e9554658Smrg# Whether or not the necessary tools and files are found can be checked
2461e9554658Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
2462e9554658SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
24638903d43aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
24648903d43aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
2465e9554658Smrg
2466e9554658SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
2467e9554658Smrg
24688903d43aSmrgAC_MSG_CHECKING([whether to build documentation])
2469e9554658Smrg
24708903d43aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
2471e9554658Smrg   BUILDDOC=yes
2472e9554658Smrgelse
2473e9554658Smrg   BUILDDOC=no
2474e9554658Smrgfi
2475e9554658Smrg
2476e9554658SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
2477e9554658Smrg
2478e9554658SmrgAC_MSG_RESULT([$BUILDDOC])
2479e9554658Smrg
24808903d43aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
2481e9554658Smrg
24828903d43aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
2483e9554658Smrg   BUILDPDFDOC=yes
2484e9554658Smrgelse
2485e9554658Smrg   BUILDPDFDOC=no
2486e9554658Smrgfi
2487e9554658Smrg
2488e9554658SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2489e9554658Smrg
2490e9554658SmrgAC_MSG_RESULT([$BUILDPDFDOC])
2491e9554658Smrg
24928903d43aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
2493e9554658SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
2494e9554658SmrgMAKE_PDF="$PS2PDF"
2495e9554658SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
2496e9554658Smrg
2497e9554658SmrgAC_SUBST(MAKE_TEXT)
2498e9554658SmrgAC_SUBST(MAKE_PS)
2499e9554658SmrgAC_SUBST(MAKE_PDF)
2500e9554658SmrgAC_SUBST(MAKE_HTML)
2501e9554658Smrg]) # XORG_CHECK_LINUXDOC
2502e9554658Smrg
2503e9554658Smrg# XORG_CHECK_DOCBOOK
2504e9554658Smrg# -------------------
2505e9554658Smrg# Minimum version: 1.0.0
2506e9554658Smrg#
2507e9554658Smrg# Checks for the ability to build output formats from SGML DocBook source.
2508e9554658Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
2509e9554658Smrg# indicates whether the necessary tools and files are found and, if set,
2510e9554658Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
2511e9554658SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
25128903d43aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
25138903d43aSmrg
2514e9554658SmrgBUILDTXTDOC=no
2515e9554658SmrgBUILDPDFDOC=no
2516e9554658SmrgBUILDPSDOC=no
2517e9554658SmrgBUILDHTMLDOC=no
2518e9554658Smrg
2519e9554658SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
2520e9554658SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
2521e9554658SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
2522e9554658SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
2523e9554658Smrg
25248903d43aSmrgAC_MSG_CHECKING([whether to build text documentation])
25258903d43aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
2526e9554658Smrg   test x$BUILD_TXTDOC != xno; then
2527e9554658Smrg	BUILDTXTDOC=yes
2528e9554658Smrgfi
2529e9554658SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
2530e9554658SmrgAC_MSG_RESULT([$BUILDTXTDOC])
2531e9554658Smrg
25328903d43aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
25338903d43aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
2534e9554658Smrg   test x$BUILD_PDFDOC != xno; then
2535e9554658Smrg	BUILDPDFDOC=yes
2536e9554658Smrgfi
2537e9554658SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2538e9554658SmrgAC_MSG_RESULT([$BUILDPDFDOC])
2539e9554658Smrg
25408903d43aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
25418903d43aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
2542e9554658Smrg   test x$BUILD_PSDOC != xno; then
2543e9554658Smrg	BUILDPSDOC=yes
2544e9554658Smrgfi
2545e9554658SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
2546e9554658SmrgAC_MSG_RESULT([$BUILDPSDOC])
2547e9554658Smrg
25488903d43aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
25498903d43aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
2550e9554658Smrg   test x$BUILD_HTMLDOC != xno; then
2551e9554658Smrg	BUILDHTMLDOC=yes
2552e9554658Smrgfi
2553e9554658SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
2554e9554658SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
2555e9554658Smrg
2556e9554658SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
2557e9554658SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
2558e9554658SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
2559e9554658SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
2560e9554658Smrg
2561e9554658SmrgAC_SUBST(MAKE_TEXT)
2562e9554658SmrgAC_SUBST(MAKE_PS)
2563e9554658SmrgAC_SUBST(MAKE_PDF)
2564e9554658SmrgAC_SUBST(MAKE_HTML)
2565e9554658Smrg]) # XORG_CHECK_DOCBOOK
2566e9554658Smrg
2567309c398aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
25688903d43aSmrg# ----------------
25698903d43aSmrg# Minimum version: 1.5.0
2570309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
25718903d43aSmrg#
25728903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
25738903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
25748903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
25758903d43aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
2576309c398aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
2577309c398aSmrg# --with-xmlto assumes 'auto'.
25788903d43aSmrg#
25798903d43aSmrg# Interface to module:
25808903d43aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
25818903d43aSmrg# XMLTO:	returns the path of the xmlto program found
25828903d43aSmrg#		returns the path set by the user in the environment
25838903d43aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
25848903d43aSmrg#		'no' user instructs the module not to use xmlto
25858903d43aSmrg#
25868903d43aSmrg# Added in version 1.10.0
25878903d43aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
25888903d43aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
25898903d43aSmrg#
25908903d43aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
25918903d43aSmrg#
25928903d43aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
25938903d43aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
2594309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
25958903d43aSmrgAC_ARG_WITH(xmlto,
25968903d43aSmrg	AS_HELP_STRING([--with-xmlto],
2597309c398aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
2598309c398aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
2599309c398aSmrgm4_undefine([_defopt])
26008903d43aSmrg
26018903d43aSmrgif test "x$use_xmlto" = x"auto"; then
26028903d43aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
26038903d43aSmrg   if test "x$XMLTO" = "x"; then
26048903d43aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
26058903d43aSmrg	have_xmlto=no
26068903d43aSmrg   else
26078903d43aSmrg        have_xmlto=yes
26088903d43aSmrg   fi
26098903d43aSmrgelif test "x$use_xmlto" = x"yes" ; then
26108903d43aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
26118903d43aSmrg   if test "x$XMLTO" = "x"; then
26128903d43aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
26138903d43aSmrg   fi
26148903d43aSmrg   have_xmlto=yes
26158903d43aSmrgelif test "x$use_xmlto" = x"no" ; then
26168903d43aSmrg   if test "x$XMLTO" != "x"; then
26178903d43aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
26188903d43aSmrg   fi
26198903d43aSmrg   have_xmlto=no
26208903d43aSmrgelse
26218903d43aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
26228903d43aSmrgfi
26238903d43aSmrg
26248903d43aSmrg# Test for a minimum version of xmlto, if provided.
26258903d43aSmrgm4_ifval([$1],
26268903d43aSmrg[if test "$have_xmlto" = yes; then
26278903d43aSmrg    # scrape the xmlto version
26288903d43aSmrg    AC_MSG_CHECKING([the xmlto version])
26298903d43aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
26308903d43aSmrg    AC_MSG_RESULT([$xmlto_version])
26318903d43aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
26328903d43aSmrg        [if test "x$use_xmlto" = xauto; then
26338903d43aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
26348903d43aSmrg            have_xmlto=no
26358903d43aSmrg        else
26368903d43aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
26378903d43aSmrg        fi])
26388903d43aSmrgfi])
26398903d43aSmrg
26408903d43aSmrg# Test for the ability of xmlto to generate a text target
26418903d43aSmrghave_xmlto_text=no
26428903d43aSmrgcat > conftest.xml << "EOF"
26438903d43aSmrgEOF
26448903d43aSmrgAS_IF([test "$have_xmlto" = yes],
26458903d43aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
26468903d43aSmrg             [have_xmlto_text=yes],
26478903d43aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
26488903d43aSmrgrm -f conftest.xml
26498903d43aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
26508903d43aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
26518903d43aSmrg]) # XORG_WITH_XMLTO
26528903d43aSmrg
2653309c398aSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2654309c398aSmrg# --------------------------------------------
2655309c398aSmrg# Minimum version: 1.12.0
2656309c398aSmrg# Minimum version for optional DEFAULT argument: 1.12.0
2657309c398aSmrg#
2658309c398aSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2659309c398aSmrg# XML-based language used for the transformation of XML documents.
2660309c398aSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2661309c398aSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2662309c398aSmrg# The XSLT processor is often used as a standalone tool for transformations.
2663309c398aSmrg# It should not be assumed that this tool is used only to work with documnetation.
2664309c398aSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2665309c398aSmrg#
2666309c398aSmrg# Interface to module:
2667309c398aSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2668309c398aSmrg# XSLTPROC:	 returns the path of the xsltproc program found
2669309c398aSmrg#		 returns the path set by the user in the environment
2670309c398aSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2671309c398aSmrg#		  'no' user instructs the module not to use xsltproc
2672309c398aSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2673309c398aSmrg#
2674309c398aSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2675309c398aSmrg#
2676309c398aSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2677309c398aSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2678309c398aSmrg# Preserves the interface, should it be implemented later
2679309c398aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2680309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2681309c398aSmrgAC_ARG_WITH(xsltproc,
2682309c398aSmrg	AS_HELP_STRING([--with-xsltproc],
2683309c398aSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2684309c398aSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2685309c398aSmrgm4_undefine([_defopt])
2686309c398aSmrg
2687309c398aSmrgif test "x$use_xsltproc" = x"auto"; then
2688309c398aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2689309c398aSmrg   if test "x$XSLTPROC" = "x"; then
2690309c398aSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2691309c398aSmrg	have_xsltproc=no
2692309c398aSmrg   else
2693309c398aSmrg        have_xsltproc=yes
2694309c398aSmrg   fi
2695309c398aSmrgelif test "x$use_xsltproc" = x"yes" ; then
2696309c398aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2697309c398aSmrg   if test "x$XSLTPROC" = "x"; then
2698309c398aSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2699309c398aSmrg   fi
2700309c398aSmrg   have_xsltproc=yes
2701309c398aSmrgelif test "x$use_xsltproc" = x"no" ; then
2702309c398aSmrg   if test "x$XSLTPROC" != "x"; then
2703309c398aSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2704309c398aSmrg   fi
2705309c398aSmrg   have_xsltproc=no
2706309c398aSmrgelse
2707309c398aSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2708309c398aSmrgfi
2709309c398aSmrg
2710309c398aSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2711309c398aSmrg]) # XORG_WITH_XSLTPROC
2712309c398aSmrg
2713309c398aSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2714309c398aSmrg# ----------------------------------------
2715309c398aSmrg# Minimum version: 1.15.0
2716309c398aSmrg#
2717309c398aSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
2718309c398aSmrg# scanning arbitrary text files, extracting information from those text files,
2719309c398aSmrg# and printing reports based on that information.
2720309c398aSmrg#
2721309c398aSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2722309c398aSmrg#
2723309c398aSmrg# Interface to module:
2724309c398aSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
2725309c398aSmrg# PERL:	     returns the path of the perl program found
2726309c398aSmrg#	     returns the path set by the user in the environment
2727309c398aSmrg# --with-perl: 'yes' user instructs the module to use perl
2728309c398aSmrg#	       'no' user instructs the module not to use perl
2729309c398aSmrg# have_perl: returns yes if perl found in PATH or no
2730309c398aSmrg#
2731309c398aSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2732309c398aSmrg#
2733309c398aSmrgAC_DEFUN([XORG_WITH_PERL],[
2734309c398aSmrgAC_ARG_VAR([PERL], [Path to perl command])
2735309c398aSmrg# Preserves the interface, should it be implemented later
2736309c398aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2737309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2738309c398aSmrgAC_ARG_WITH(perl,
2739309c398aSmrg	AS_HELP_STRING([--with-perl],
2740309c398aSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2741309c398aSmrg	   [use_perl=$withval], [use_perl=]_defopt)
2742309c398aSmrgm4_undefine([_defopt])
2743309c398aSmrg
2744309c398aSmrgif test "x$use_perl" = x"auto"; then
2745309c398aSmrg   AC_PATH_PROG([PERL], [perl])
2746309c398aSmrg   if test "x$PERL" = "x"; then
2747309c398aSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2748309c398aSmrg	have_perl=no
2749309c398aSmrg   else
2750309c398aSmrg        have_perl=yes
2751309c398aSmrg   fi
2752309c398aSmrgelif test "x$use_perl" = x"yes" ; then
2753309c398aSmrg   AC_PATH_PROG([PERL], [perl])
2754309c398aSmrg   if test "x$PERL" = "x"; then
2755309c398aSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2756309c398aSmrg   fi
2757309c398aSmrg   have_perl=yes
2758309c398aSmrgelif test "x$use_perl" = x"no" ; then
2759309c398aSmrg   if test "x$PERL" != "x"; then
2760309c398aSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2761309c398aSmrg   fi
2762309c398aSmrg   have_perl=no
2763309c398aSmrgelse
2764309c398aSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2765309c398aSmrgfi
2766309c398aSmrg
2767309c398aSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2768309c398aSmrg]) # XORG_WITH_PERL
2769309c398aSmrg
2770309c398aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
27718903d43aSmrg# ----------------
27728903d43aSmrg# Minimum version: 1.5.0
2773309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
27748903d43aSmrg#
27758903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
27768903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
27778903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
27788903d43aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
2779309c398aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2780309c398aSmrg# --with-asciidoc assumes 'auto'.
27818903d43aSmrg#
27828903d43aSmrg# Interface to module:
27838903d43aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
27848903d43aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
27858903d43aSmrg#		 returns the path set by the user in the environment
27868903d43aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
27878903d43aSmrg#		  'no' user instructs the module not to use asciidoc
27888903d43aSmrg#
27898903d43aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
27908903d43aSmrg#
27918903d43aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
27928903d43aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2793309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
27948903d43aSmrgAC_ARG_WITH(asciidoc,
27958903d43aSmrg	AS_HELP_STRING([--with-asciidoc],
2796309c398aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2797309c398aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2798309c398aSmrgm4_undefine([_defopt])
27998903d43aSmrg
28008903d43aSmrgif test "x$use_asciidoc" = x"auto"; then
28018903d43aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
28028903d43aSmrg   if test "x$ASCIIDOC" = "x"; then
28038903d43aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
28048903d43aSmrg	have_asciidoc=no
28058903d43aSmrg   else
28068903d43aSmrg        have_asciidoc=yes
28078903d43aSmrg   fi
28088903d43aSmrgelif test "x$use_asciidoc" = x"yes" ; then
28098903d43aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
28108903d43aSmrg   if test "x$ASCIIDOC" = "x"; then
28118903d43aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
28128903d43aSmrg   fi
28138903d43aSmrg   have_asciidoc=yes
28148903d43aSmrgelif test "x$use_asciidoc" = x"no" ; then
28158903d43aSmrg   if test "x$ASCIIDOC" != "x"; then
28168903d43aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
28178903d43aSmrg   fi
28188903d43aSmrg   have_asciidoc=no
28198903d43aSmrgelse
28208903d43aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
28218903d43aSmrgfi
28228903d43aSmrgm4_ifval([$1],
28238903d43aSmrg[if test "$have_asciidoc" = yes; then
28248903d43aSmrg    # scrape the asciidoc version
28258903d43aSmrg    AC_MSG_CHECKING([the asciidoc version])
28268903d43aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
28278903d43aSmrg    AC_MSG_RESULT([$asciidoc_version])
28288903d43aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
28298903d43aSmrg        [if test "x$use_asciidoc" = xauto; then
28308903d43aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
28318903d43aSmrg            have_asciidoc=no
28328903d43aSmrg        else
28338903d43aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
28348903d43aSmrg        fi])
28358903d43aSmrgfi])
28368903d43aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
28378903d43aSmrg]) # XORG_WITH_ASCIIDOC
28388903d43aSmrg
2839309c398aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
28408903d43aSmrg# --------------------------------
28418903d43aSmrg# Minimum version: 1.5.0
2842309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
28438903d43aSmrg#
28448903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
28458903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
28468903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
28478903d43aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
2848309c398aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2849309c398aSmrg# --with-doxygen assumes 'auto'.
28508903d43aSmrg#
28518903d43aSmrg# Interface to module:
28528903d43aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
28538903d43aSmrg# DOXYGEN:	 returns the path of the doxygen program found
28548903d43aSmrg#		 returns the path set by the user in the environment
28558903d43aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
28568903d43aSmrg#		  'no' user instructs the module not to use doxygen
28578903d43aSmrg#
28588903d43aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
28598903d43aSmrg#
28608903d43aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
28618903d43aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2862309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
28638903d43aSmrgAC_ARG_WITH(doxygen,
28648903d43aSmrg	AS_HELP_STRING([--with-doxygen],
2865309c398aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2866309c398aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2867309c398aSmrgm4_undefine([_defopt])
28688903d43aSmrg
28698903d43aSmrgif test "x$use_doxygen" = x"auto"; then
28708903d43aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
28718903d43aSmrg   if test "x$DOXYGEN" = "x"; then
28728903d43aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
28738903d43aSmrg	have_doxygen=no
28748903d43aSmrg   else
28758903d43aSmrg        have_doxygen=yes
28768903d43aSmrg   fi
28778903d43aSmrgelif test "x$use_doxygen" = x"yes" ; then
28788903d43aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
28798903d43aSmrg   if test "x$DOXYGEN" = "x"; then
28808903d43aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
28818903d43aSmrg   fi
28828903d43aSmrg   have_doxygen=yes
28838903d43aSmrgelif test "x$use_doxygen" = x"no" ; then
28848903d43aSmrg   if test "x$DOXYGEN" != "x"; then
28858903d43aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
28868903d43aSmrg   fi
28878903d43aSmrg   have_doxygen=no
28888903d43aSmrgelse
28898903d43aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
28908903d43aSmrgfi
28918903d43aSmrgm4_ifval([$1],
28928903d43aSmrg[if test "$have_doxygen" = yes; then
28938903d43aSmrg    # scrape the doxygen version
28948903d43aSmrg    AC_MSG_CHECKING([the doxygen version])
28958903d43aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
28968903d43aSmrg    AC_MSG_RESULT([$doxygen_version])
28978903d43aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
28988903d43aSmrg        [if test "x$use_doxygen" = xauto; then
28998903d43aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
29008903d43aSmrg            have_doxygen=no
29018903d43aSmrg        else
29028903d43aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
29038903d43aSmrg        fi])
29048903d43aSmrgfi])
29058903d43aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
29068903d43aSmrg]) # XORG_WITH_DOXYGEN
29078903d43aSmrg
2908309c398aSmrg# XORG_WITH_GROFF([DEFAULT])
29098903d43aSmrg# ----------------
29108903d43aSmrg# Minimum version: 1.6.0
2911309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
29128903d43aSmrg#
29138903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
29148903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
29158903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
29168903d43aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2917309c398aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2918309c398aSmrg# --with-groff assumes 'auto'.
29198903d43aSmrg#
29208903d43aSmrg# Interface to module:
29218903d43aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
29228903d43aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
29238903d43aSmrg# HAVE_GROFF_MS: the -ms macros package
29248903d43aSmrg# GROFF:	 returns the path of the groff program found
29258903d43aSmrg#		 returns the path set by the user in the environment
29268903d43aSmrg# --with-groff:	 'yes' user instructs the module to use groff
29278903d43aSmrg#		 'no' user instructs the module not to use groff
29288903d43aSmrg#
29298903d43aSmrg# Added in version 1.9.0:
29308903d43aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
29318903d43aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
29328903d43aSmrg#		   psselect from the psutils package.
29338903d43aSmrg#		   the ghostcript package. Refer to the grohtml man pages
29348903d43aSmrg#
29358903d43aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
29368903d43aSmrg#
29378903d43aSmrg# OS and distros often splits groff in a basic and full package, the former
29388903d43aSmrg# having the groff program and the later having devices, fonts and macros
29398903d43aSmrg# Checking for the groff executable is not enough.
29408903d43aSmrg#
29418903d43aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
29428903d43aSmrg# unset HAVE_GROFF or GROFF env variables.
29438903d43aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
29448903d43aSmrg#
29458903d43aSmrgAC_DEFUN([XORG_WITH_GROFF],[
29468903d43aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2947309c398aSmrgm4_define([_defopt], m4_default([$1], [auto]))
29488903d43aSmrgAC_ARG_WITH(groff,
29498903d43aSmrg	AS_HELP_STRING([--with-groff],
2950309c398aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2951309c398aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2952309c398aSmrgm4_undefine([_defopt])
29538903d43aSmrg
29548903d43aSmrgif test "x$use_groff" = x"auto"; then
29558903d43aSmrg   AC_PATH_PROG([GROFF], [groff])
29568903d43aSmrg   if test "x$GROFF" = "x"; then
29578903d43aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
29588903d43aSmrg	have_groff=no
29598903d43aSmrg   else
29608903d43aSmrg        have_groff=yes
29618903d43aSmrg   fi
29628903d43aSmrgelif test "x$use_groff" = x"yes" ; then
29638903d43aSmrg   AC_PATH_PROG([GROFF], [groff])
29648903d43aSmrg   if test "x$GROFF" = "x"; then
29658903d43aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
29668903d43aSmrg   fi
29678903d43aSmrg   have_groff=yes
29688903d43aSmrgelif test "x$use_groff" = x"no" ; then
29698903d43aSmrg   if test "x$GROFF" != "x"; then
29708903d43aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
29718903d43aSmrg   fi
29728903d43aSmrg   have_groff=no
29738903d43aSmrgelse
29748903d43aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
29758903d43aSmrgfi
29768903d43aSmrg
29778903d43aSmrg# We have groff, test for the presence of the macro packages
29788903d43aSmrgif test "x$have_groff" = x"yes"; then
29798903d43aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
29808903d43aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
29818903d43aSmrg        groff_ms_works=yes
29828903d43aSmrg    else
29838903d43aSmrg        groff_ms_works=no
29848903d43aSmrg    fi
29858903d43aSmrg    AC_MSG_RESULT([$groff_ms_works])
29868903d43aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
29878903d43aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
29888903d43aSmrg        groff_mm_works=yes
29898903d43aSmrg    else
29908903d43aSmrg        groff_mm_works=no
29918903d43aSmrg    fi
29928903d43aSmrg    AC_MSG_RESULT([$groff_mm_works])
29938903d43aSmrgfi
29948903d43aSmrg
29958903d43aSmrg# We have groff, test for HTML dependencies, one command per package
29968903d43aSmrgif test "x$have_groff" = x"yes"; then
29978903d43aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
29988903d43aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
29998903d43aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
30008903d43aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
30018903d43aSmrg      have_groff_html=yes
30028903d43aSmrg   else
30038903d43aSmrg      have_groff_html=no
30048903d43aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
30058903d43aSmrg   fi
30068903d43aSmrgfi
30078903d43aSmrg
30088903d43aSmrg# Set Automake conditionals for Makefiles
30098903d43aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
30108903d43aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
30118903d43aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
30128903d43aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
30138903d43aSmrg]) # XORG_WITH_GROFF
30148903d43aSmrg
3015309c398aSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
3016309c398aSmrg# ---------------------------------------
30178903d43aSmrg# Minimum version: 1.6.0
3018309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
3019309c398aSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
30208903d43aSmrg#
30218903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
30228903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
30238903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
30248903d43aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
3025309c398aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
3026309c398aSmrg# --with-fop assumes 'auto'.
30278903d43aSmrg#
30288903d43aSmrg# Interface to module:
30298903d43aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
30308903d43aSmrg# FOP:	 	returns the path of the fop program found
30318903d43aSmrg#		returns the path set by the user in the environment
30328903d43aSmrg# --with-fop: 	'yes' user instructs the module to use fop
30338903d43aSmrg#		'no' user instructs the module not to use fop
30348903d43aSmrg#
30358903d43aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
30368903d43aSmrg#
30378903d43aSmrgAC_DEFUN([XORG_WITH_FOP],[
30388903d43aSmrgAC_ARG_VAR([FOP], [Path to fop command])
3039309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
30408903d43aSmrgAC_ARG_WITH(fop,
30418903d43aSmrg	AS_HELP_STRING([--with-fop],
3042309c398aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
3043309c398aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
3044309c398aSmrgm4_undefine([_defopt])
30458903d43aSmrg
30468903d43aSmrgif test "x$use_fop" = x"auto"; then
30478903d43aSmrg   AC_PATH_PROG([FOP], [fop])
30488903d43aSmrg   if test "x$FOP" = "x"; then
30498903d43aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
30508903d43aSmrg	have_fop=no
30518903d43aSmrg   else
30528903d43aSmrg        have_fop=yes
30538903d43aSmrg   fi
30548903d43aSmrgelif test "x$use_fop" = x"yes" ; then
30558903d43aSmrg   AC_PATH_PROG([FOP], [fop])
30568903d43aSmrg   if test "x$FOP" = "x"; then
30578903d43aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
30588903d43aSmrg   fi
30598903d43aSmrg   have_fop=yes
30608903d43aSmrgelif test "x$use_fop" = x"no" ; then
30618903d43aSmrg   if test "x$FOP" != "x"; then
30628903d43aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
30638903d43aSmrg   fi
30648903d43aSmrg   have_fop=no
30658903d43aSmrgelse
30668903d43aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
30678903d43aSmrgfi
3068309c398aSmrg
3069309c398aSmrg# Test for a minimum version of fop, if provided.
3070309c398aSmrgm4_ifval([$1],
3071309c398aSmrg[if test "$have_fop" = yes; then
3072309c398aSmrg    # scrape the fop version
3073309c398aSmrg    AC_MSG_CHECKING([for fop minimum version])
3074309c398aSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
3075309c398aSmrg    AC_MSG_RESULT([$fop_version])
3076309c398aSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
3077309c398aSmrg        [if test "x$use_fop" = xauto; then
3078309c398aSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
3079309c398aSmrg            have_fop=no
3080309c398aSmrg        else
3081309c398aSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
3082309c398aSmrg        fi])
3083309c398aSmrgfi])
30848903d43aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
30858903d43aSmrg]) # XORG_WITH_FOP
30868903d43aSmrg
3087309c398aSmrg# XORG_WITH_PS2PDF([DEFAULT])
30888903d43aSmrg# ----------------
30898903d43aSmrg# Minimum version: 1.6.0
3090309c398aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
30918903d43aSmrg#
30928903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
30938903d43aSmrg# not at the appropriate level. This macro enables a module to test for the
30948903d43aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
30958903d43aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
3096309c398aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
3097309c398aSmrg# --with-ps2pdf assumes 'auto'.
30988903d43aSmrg#
30998903d43aSmrg# Interface to module:
31008903d43aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
31018903d43aSmrg# PS2PDF:	returns the path of the ps2pdf program found
31028903d43aSmrg#		returns the path set by the user in the environment
31038903d43aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
31048903d43aSmrg#		 'no' user instructs the module not to use ps2pdf
31058903d43aSmrg#
31068903d43aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
31078903d43aSmrg#
31088903d43aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
31098903d43aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
3110309c398aSmrgm4_define([_defopt], m4_default([$1], [auto]))
31118903d43aSmrgAC_ARG_WITH(ps2pdf,
31128903d43aSmrg	AS_HELP_STRING([--with-ps2pdf],
3113309c398aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
3114309c398aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
3115309c398aSmrgm4_undefine([_defopt])
31168903d43aSmrg
31178903d43aSmrgif test "x$use_ps2pdf" = x"auto"; then
31188903d43aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
31198903d43aSmrg   if test "x$PS2PDF" = "x"; then
31208903d43aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
31218903d43aSmrg	have_ps2pdf=no
31228903d43aSmrg   else
31238903d43aSmrg        have_ps2pdf=yes
31248903d43aSmrg   fi
31258903d43aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
31268903d43aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
31278903d43aSmrg   if test "x$PS2PDF" = "x"; then
31288903d43aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
31298903d43aSmrg   fi
31308903d43aSmrg   have_ps2pdf=yes
31318903d43aSmrgelif test "x$use_ps2pdf" = x"no" ; then
31328903d43aSmrg   if test "x$PS2PDF" != "x"; then
31338903d43aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
31348903d43aSmrg   fi
31358903d43aSmrg   have_ps2pdf=no
31368903d43aSmrgelse
31378903d43aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
31388903d43aSmrgfi
31398903d43aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
31408903d43aSmrg]) # XORG_WITH_PS2PDF
31418903d43aSmrg
31428903d43aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
31438903d43aSmrg# ----------------
31448903d43aSmrg# Minimum version: 1.6.0
31458903d43aSmrg#
31468903d43aSmrg# Documentation tools are not always available on all platforms and sometimes
31478903d43aSmrg# not at the appropriate level. This macro enables a builder to skip all
31488903d43aSmrg# documentation targets except traditional man pages.
31498903d43aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
31508903d43aSmrg# maximum flexibilty in controlling documentation building.
31518903d43aSmrg# Refer to:
31528903d43aSmrg# XORG_WITH_XMLTO         --with-xmlto
31538903d43aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
31548903d43aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
31558903d43aSmrg# XORG_WITH_FOP           --with-fop
31568903d43aSmrg# XORG_WITH_GROFF         --with-groff
31578903d43aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
31588903d43aSmrg#
31598903d43aSmrg# Interface to module:
31608903d43aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
31618903d43aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
31628903d43aSmrg#		 'no' user instructs the module not to generate docs
31638903d43aSmrg# parm1:	specify the default value, yes or no.
31648903d43aSmrg#
31658903d43aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
3166309c398aSmrgm4_define([docs_default], m4_default([$1], [yes]))
31678903d43aSmrgAC_ARG_ENABLE(docs,
31688903d43aSmrg	AS_HELP_STRING([--enable-docs],
3169309c398aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
3170309c398aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
3171309c398aSmrgm4_undefine([docs_default])
31728903d43aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
31738903d43aSmrgAC_MSG_CHECKING([whether to build documentation])
31748903d43aSmrgAC_MSG_RESULT([$build_docs])
31758903d43aSmrg]) # XORG_ENABLE_DOCS
31768903d43aSmrg
31778903d43aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
31788903d43aSmrg# ----------------
31798903d43aSmrg# Minimum version: 1.6.0
31808903d43aSmrg#
31818903d43aSmrg# This macro enables a builder to skip all developer documentation.
31828903d43aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
31838903d43aSmrg# maximum flexibilty in controlling documentation building.
31848903d43aSmrg# Refer to:
31858903d43aSmrg# XORG_WITH_XMLTO         --with-xmlto
31868903d43aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
31878903d43aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
31888903d43aSmrg# XORG_WITH_FOP           --with-fop
31898903d43aSmrg# XORG_WITH_GROFF         --with-groff
31908903d43aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
31918903d43aSmrg#
31928903d43aSmrg# Interface to module:
31938903d43aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
31948903d43aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
31958903d43aSmrg#			'no' user instructs the module not to generate developer docs
31968903d43aSmrg# parm1:		specify the default value, yes or no.
31978903d43aSmrg#
31988903d43aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
3199309c398aSmrgm4_define([devel_default], m4_default([$1], [yes]))
32008903d43aSmrgAC_ARG_ENABLE(devel-docs,
32018903d43aSmrg	AS_HELP_STRING([--enable-devel-docs],
3202309c398aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
3203309c398aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
3204309c398aSmrgm4_undefine([devel_default])
32058903d43aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
32068903d43aSmrgAC_MSG_CHECKING([whether to build developer documentation])
32078903d43aSmrgAC_MSG_RESULT([$build_devel_docs])
32088903d43aSmrg]) # XORG_ENABLE_DEVEL_DOCS
32098903d43aSmrg
32108903d43aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
32118903d43aSmrg# ----------------
32128903d43aSmrg# Minimum version: 1.6.0
32138903d43aSmrg#
32148903d43aSmrg# This macro enables a builder to skip all functional specification targets.
32158903d43aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
32168903d43aSmrg# maximum flexibilty in controlling documentation building.
32178903d43aSmrg# Refer to:
32188903d43aSmrg# XORG_WITH_XMLTO         --with-xmlto
32198903d43aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
32208903d43aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
32218903d43aSmrg# XORG_WITH_FOP           --with-fop
32228903d43aSmrg# XORG_WITH_GROFF         --with-groff
32238903d43aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
32248903d43aSmrg#
32258903d43aSmrg# Interface to module:
32268903d43aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
32278903d43aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
32288903d43aSmrg#			'no' user instructs the module not to generate specs
32298903d43aSmrg# parm1:		specify the default value, yes or no.
32308903d43aSmrg#
32318903d43aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
3232309c398aSmrgm4_define([spec_default], m4_default([$1], [yes]))
32338903d43aSmrgAC_ARG_ENABLE(specs,
32348903d43aSmrg	AS_HELP_STRING([--enable-specs],
3235309c398aSmrg	   [Enable building the specs (default: ]spec_default[)]),
3236309c398aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
3237309c398aSmrgm4_undefine([spec_default])
32388903d43aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
32398903d43aSmrgAC_MSG_CHECKING([whether to build functional specifications])
32408903d43aSmrgAC_MSG_RESULT([$build_specs])
32418903d43aSmrg]) # XORG_ENABLE_SPECS
32428903d43aSmrg
3243309c398aSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
3244309c398aSmrg# ----------------------------------------------
3245309c398aSmrg# Minimum version: 1.13.0
3246309c398aSmrg#
3247309c398aSmrg# This macro enables a builder to enable/disable unit testing
3248309c398aSmrg# It makes no assumption about the test cases implementation
3249309c398aSmrg# Test cases may or may not use Automake "Support for test suites"
3250309c398aSmrg# They may or may not use the software utility library GLib
3251309c398aSmrg#
3252309c398aSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
3253309c398aSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
3254309c398aSmrg# The variable enable_unit_tests is used by other macros in this file.
3255309c398aSmrg#
3256309c398aSmrg# Interface to module:
3257309c398aSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
3258309c398aSmrg# enable_unit_tests:    used in configure.ac for additional configuration
3259309c398aSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
3260309c398aSmrg#			'no' user instructs the module not to build tests
3261309c398aSmrg# parm1:		specify the default value, yes or no.
3262309c398aSmrg#
3263309c398aSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
3264309c398aSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
3265309c398aSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
3266309c398aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
3267309c398aSmrgm4_define([_defopt], m4_default([$1], [auto]))
3268309c398aSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
3269309c398aSmrg	[Enable building unit test cases (default: ]_defopt[)]),
3270309c398aSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
3271309c398aSmrgm4_undefine([_defopt])
3272309c398aSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
3273309c398aSmrgAC_MSG_CHECKING([whether to build unit test cases])
3274309c398aSmrgAC_MSG_RESULT([$enable_unit_tests])
3275309c398aSmrg]) # XORG_ENABLE_UNIT_TESTS
3276309c398aSmrg
3277309c398aSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
3278309c398aSmrg# ----------------------------------------
3279309c398aSmrg# Minimum version: 1.13.0
3280309c398aSmrg#
3281309c398aSmrg# GLib is a library which provides advanced data structures and functions.
3282309c398aSmrg# This macro enables a module to test for the presence of Glib.
3283309c398aSmrg#
3284309c398aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
3285309c398aSmrg# Otherwise the value of $enable_unit_tests is blank.
3286309c398aSmrg#
3287309c398aSmrg# Interface to module:
3288309c398aSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
3289309c398aSmrg# with_glib: used in configure.ac to know if GLib has been found
3290309c398aSmrg# --with-glib:	'yes' user instructs the module to use glib
3291309c398aSmrg#		'no' user instructs the module not to use glib
3292309c398aSmrg#
3293309c398aSmrgAC_DEFUN([XORG_WITH_GLIB],[
3294309c398aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3295309c398aSmrgm4_define([_defopt], m4_default([$2], [auto]))
3296309c398aSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
3297309c398aSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
3298309c398aSmrg	[with_glib=$withval], [with_glib=]_defopt)
3299309c398aSmrgm4_undefine([_defopt])
3300309c398aSmrg
3301309c398aSmrghave_glib=no
3302309c398aSmrg# Do not probe GLib if user explicitly disabled unit testing
3303309c398aSmrgif test "x$enable_unit_tests" != x"no"; then
3304309c398aSmrg  # Do not probe GLib if user explicitly disabled it
3305309c398aSmrg  if test "x$with_glib" != x"no"; then
3306309c398aSmrg    m4_ifval(
3307309c398aSmrg      [$1],
3308309c398aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
3309309c398aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
3310309c398aSmrg    )
3311309c398aSmrg  fi
3312309c398aSmrgfi
3313309c398aSmrg
3314309c398aSmrg# Not having GLib when unit testing has been explicitly requested is an error
3315309c398aSmrgif test "x$enable_unit_tests" = x"yes"; then
3316309c398aSmrg  if test "x$have_glib" = x"no"; then
3317309c398aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3318309c398aSmrg  fi
3319309c398aSmrgfi
3320309c398aSmrg
3321309c398aSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
3322309c398aSmrgif test "x$enable_unit_tests" = x"no"; then
3323309c398aSmrg  if test "x$with_glib" = x"yes"; then
3324309c398aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3325309c398aSmrg  fi
3326309c398aSmrgfi
3327309c398aSmrg
3328309c398aSmrg# Not having GLib when it has been explicitly requested is an error
3329309c398aSmrgif test "x$with_glib" = x"yes"; then
3330309c398aSmrg  if test "x$have_glib" = x"no"; then
3331309c398aSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
3332309c398aSmrg  fi
3333309c398aSmrgfi
3334309c398aSmrg
3335309c398aSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
3336309c398aSmrg]) # XORG_WITH_GLIB
3337309c398aSmrg
3338309c398aSmrg# XORG_LD_WRAP([required|optional])
3339309c398aSmrg# ---------------------------------
3340309c398aSmrg# Minimum version: 1.13.0
3341309c398aSmrg#
3342309c398aSmrg# Check if linker supports -wrap, passed via compiler flags
3343309c398aSmrg#
3344309c398aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
3345309c398aSmrg# Otherwise the value of $enable_unit_tests is blank.
3346309c398aSmrg#
3347309c398aSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
3348309c398aSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
3349309c398aSmrg# available, an argument of "optional" allows use when some unit tests require
3350309c398aSmrg# ld -wrap and others do not.
3351309c398aSmrg#
3352309c398aSmrgAC_DEFUN([XORG_LD_WRAP],[
3353309c398aSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
3354309c398aSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
3355309c398aSmrg                      void __wrap_exit(int status) { return; }],
3356309c398aSmrg                     [exit(0);])])
3357309c398aSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
3358309c398aSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
3359309c398aSmrg  if test "x$have_ld_wrap" = x"no"; then
3360309c398aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
3361309c398aSmrg  fi
3362309c398aSmrgfi
3363309c398aSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
3364309c398aSmrg#
3365309c398aSmrg]) # XORG_LD_WRAP
3366309c398aSmrg
3367309c398aSmrg# XORG_CHECK_LINKER_FLAGS
3368309c398aSmrg# -----------------------
3369309c398aSmrg# SYNOPSIS
3370309c398aSmrg#
3371309c398aSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
3372309c398aSmrg#
3373309c398aSmrg# DESCRIPTION
3374309c398aSmrg#
3375309c398aSmrg#   Check whether the given linker FLAGS work with the current language's
3376309c398aSmrg#   linker, or whether they give an error.
3377309c398aSmrg#
3378309c398aSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
3379309c398aSmrg#   success/failure.
3380309c398aSmrg#
3381309c398aSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
3382309c398aSmrg#
3383309c398aSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
3384309c398aSmrg#
3385309c398aSmrg# LICENSE
3386309c398aSmrg#
3387309c398aSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
3388309c398aSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
3389309c398aSmrg#   Copyright (c) 2009 Matteo Frigo
3390309c398aSmrg#
3391309c398aSmrg#   This program is free software: you can redistribute it and/or modify it
3392309c398aSmrg#   under the terms of the GNU General Public License as published by the
3393309c398aSmrg#   Free Software Foundation, either version 3 of the License, or (at your
3394309c398aSmrg#   option) any later version.
3395309c398aSmrg#
3396309c398aSmrg#   This program is distributed in the hope that it will be useful, but
3397309c398aSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
3398309c398aSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
3399309c398aSmrg#   Public License for more details.
3400309c398aSmrg#
3401309c398aSmrg#   You should have received a copy of the GNU General Public License along
3402309c398aSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
3403309c398aSmrg#
3404309c398aSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
3405309c398aSmrg#   gives unlimited permission to copy, distribute and modify the configure
3406309c398aSmrg#   scripts that are the output of Autoconf when processing the Macro. You
3407309c398aSmrg#   need not follow the terms of the GNU General Public License when using
3408309c398aSmrg#   or distributing such scripts, even though portions of the text of the
3409309c398aSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
3410309c398aSmrg#   all other use of the material that constitutes the Autoconf Macro.
3411309c398aSmrg#
3412309c398aSmrg#   This special exception to the GPL applies to versions of the Autoconf
3413309c398aSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
3414309c398aSmrg#   modified version of the Autoconf Macro, you may extend this special
3415309c398aSmrg#   exception to the GPL to apply to your modified version as well.#
3416309c398aSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
3417309c398aSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
3418309c398aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
3419309c398aSmrgAS_LITERAL_IF([$1],
3420309c398aSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
3421309c398aSmrg      ax_save_FLAGS=$LDFLAGS
3422309c398aSmrg      LDFLAGS="$1"
3423309c398aSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
3424309c398aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3425309c398aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3426309c398aSmrg      LDFLAGS=$ax_save_FLAGS])],
3427309c398aSmrg  [ax_save_FLAGS=$LDFLAGS
3428309c398aSmrg   LDFLAGS="$1"
3429309c398aSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3430309c398aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3431309c398aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3432309c398aSmrg   LDFLAGS=$ax_save_FLAGS])
3433309c398aSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
3434309c398aSmrgAC_MSG_RESULT($xorg_check_linker_flags)
3435309c398aSmrgif test "x$xorg_check_linker_flags" = xyes; then
3436309c398aSmrg	m4_default([$2], :)
3437309c398aSmrgelse
3438309c398aSmrg	m4_default([$3], :)
3439309c398aSmrgfi
3440309c398aSmrg]) # XORG_CHECK_LINKER_FLAGS
3441309c398aSmrg
3442309c398aSmrg# XORG_MEMORY_CHECK_FLAGS
3443309c398aSmrg# -----------------------
3444309c398aSmrg# Minimum version: 1.16.0
3445309c398aSmrg#
3446309c398aSmrg# This macro attempts to find appropriate memory checking functionality
3447309c398aSmrg# for various platforms which unit testing code may use to catch various
3448309c398aSmrg# forms of memory allocation and access errors in testing.
3449309c398aSmrg#
3450309c398aSmrg# Interface to module:
3451309c398aSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
3452309c398aSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
3453309c398aSmrg#
3454309c398aSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
3455309c398aSmrg#
3456309c398aSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
3457309c398aSmrg
3458309c398aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
3459309c398aSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
3460309c398aSmrg           [Environment variables to enable memory checking in tests])
3461309c398aSmrg
3462309c398aSmrg# Check for different types of support on different platforms
3463309c398aSmrgcase $host_os in
3464309c398aSmrg    solaris*)
3465309c398aSmrg        AC_CHECK_LIB([umem], [umem_alloc],
3466309c398aSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
3467309c398aSmrg        ;;
3468309c398aSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
3469309c398aSmrg        # both directly and inverted, so should not be 0 or 255.
3470309c398aSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
3471309c398aSmrg        ;;
3472309c398aSmrg    darwin*)
3473309c398aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
3474309c398aSmrg        ;;
3475309c398aSmrg    *bsd*)
3476309c398aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
3477309c398aSmrg        ;;
3478309c398aSmrgesac
3479309c398aSmrg
3480309c398aSmrg# User supplied flags override default flags
3481309c398aSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
3482309c398aSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
3483309c398aSmrgfi
3484309c398aSmrg
3485309c398aSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
3486309c398aSmrg]) # XORG_WITH_LINT
3487309c398aSmrg
3488e9554658Smrg# XORG_CHECK_MALLOC_ZERO
3489e9554658Smrg# ----------------------
3490e9554658Smrg# Minimum version: 1.0.0
3491e9554658Smrg#
3492e9554658Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
3493e9554658Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
3494e9554658Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
3495e9554658SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
3496e9554658SmrgAC_ARG_ENABLE(malloc0returnsnull,
3497c2b339b4Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
3498e9554658Smrg		       [malloc(0) returns NULL (default: auto)]),
3499e9554658Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
3500e9554658Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
3501e9554658Smrg
3502e9554658SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
3503e9554658Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
3504309c398aSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
3505309c398aSmrg#include <stdlib.h>
3506309c398aSmrg],[
3507e9554658Smrg    char *m0, *r0, *c0, *p;
3508e9554658Smrg    m0 = malloc(0);
3509e9554658Smrg    p = malloc(10);
3510e9554658Smrg    r0 = realloc(p,0);
3511309c398aSmrg    c0 = calloc(0,10);
3512309c398aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
3513309c398aSmrg])],
3514e9554658Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
35158903d43aSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
35168903d43aSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
3517e9554658Smrgfi
3518e9554658SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
3519e9554658Smrg
3520e9554658Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
3521e9554658Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
3522e9554658Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
3523e9554658Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
3524e9554658Smrgelse
3525e9554658Smrg	MALLOC_ZERO_CFLAGS=""
3526e9554658Smrg	XMALLOC_ZERO_CFLAGS=""
3527e9554658Smrg	XTMALLOC_ZERO_CFLAGS=""
3528e9554658Smrgfi
3529e9554658Smrg
3530e9554658SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
3531e9554658SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
3532e9554658SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
3533e9554658Smrg]) # XORG_CHECK_MALLOC_ZERO
3534e9554658Smrg
3535e9554658Smrg# XORG_WITH_LINT()
3536e9554658Smrg# ----------------
3537e9554658Smrg# Minimum version: 1.1.0
3538e9554658Smrg#
35398903d43aSmrg# This macro enables the use of a tool that flags some suspicious and
35408903d43aSmrg# non-portable constructs (likely to be bugs) in C language source code.
35418903d43aSmrg# It will attempt to locate the tool and use appropriate options.
35428903d43aSmrg# There are various lint type tools on different platforms.
35438903d43aSmrg#
35448903d43aSmrg# Interface to module:
35458903d43aSmrg# LINT:		returns the path to the tool found on the platform
35468903d43aSmrg#		or the value set to LINT on the configure cmd line
35478903d43aSmrg#		also an Automake conditional
35488903d43aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
35498903d43aSmrg#
35508903d43aSmrg# --with-lint:	'yes' user instructs the module to use lint
35518903d43aSmrg#		'no' user instructs the module not to use lint (default)
35528903d43aSmrg#
35538903d43aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
35548903d43aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3555e9554658Smrg#
3556e9554658SmrgAC_DEFUN([XORG_WITH_LINT],[
3557e9554658Smrg
35588903d43aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
35598903d43aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3560c2b339b4SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3561e9554658Smrg		[Use a lint-style source code checker (default: disabled)])],
3562e9554658Smrg		[use_lint=$withval], [use_lint=no])
35638903d43aSmrg
35648903d43aSmrg# Obtain platform specific info like program name and options
35658903d43aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
35668903d43aSmrgcase $host_os in
35678903d43aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
35688903d43aSmrg	lint_name=splint
35698903d43aSmrg	lint_options="-badflag"
35708903d43aSmrg	;;
35718903d43aSmrg  *freebsd* | *netbsd*)
35728903d43aSmrg	lint_name=lint
35738903d43aSmrg	lint_options="-u -b"
35748903d43aSmrg	;;
35758903d43aSmrg  *solaris*)
35768903d43aSmrg	lint_name=lint
35778903d43aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
35788903d43aSmrg	;;
35798903d43aSmrgesac
35808903d43aSmrg
35818903d43aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
35828903d43aSmrgif test "x$use_lint" = x"yes" ; then
35838903d43aSmrg   AC_PATH_PROG([LINT], [$lint_name])
35848903d43aSmrg   if test "x$LINT" = "x"; then
35858903d43aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
35868903d43aSmrg   fi
35878903d43aSmrgelif test "x$use_lint" = x"no" ; then
35888903d43aSmrg   if test "x$LINT" != "x"; then
35898903d43aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
35908903d43aSmrg   fi
3591e9554658Smrgelse
35928903d43aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3593e9554658Smrgfi
35948903d43aSmrg
35958903d43aSmrg# User supplied flags override default flags
35968903d43aSmrgif test "x$LINT_FLAGS" != "x"; then
35978903d43aSmrg   lint_options=$LINT_FLAGS
3598e9554658Smrgfi
3599e9554658Smrg
36008903d43aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
36018903d43aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3602e9554658Smrg
3603e9554658Smrg]) # XORG_WITH_LINT
3604e9554658Smrg
3605e9554658Smrg# XORG_LINT_LIBRARY(LIBNAME)
3606e9554658Smrg# --------------------------
3607e9554658Smrg# Minimum version: 1.1.0
3608e9554658Smrg#
3609e9554658Smrg# Sets up flags for building lint libraries for checking programs that call
3610e9554658Smrg# functions in the library.
3611e9554658Smrg#
36128903d43aSmrg# Interface to module:
36138903d43aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
36148903d43aSmrg# MAKE_LINT_LIB		- Automake conditional
36158903d43aSmrg#
36168903d43aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
36178903d43aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
3618e9554658Smrg
3619e9554658SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3620e9554658SmrgAC_REQUIRE([XORG_WITH_LINT])
3621c2b339b4SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3622e9554658Smrg	[Create lint library (default: disabled)])],
3623e9554658Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
36248903d43aSmrg
36258903d43aSmrgif test "x$make_lint_lib" = x"yes" ; then
36268903d43aSmrg   LINTLIB=llib-l$1.ln
36278903d43aSmrg   if test "x$LINT" = "x"; then
36288903d43aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
36298903d43aSmrg   fi
36308903d43aSmrgelif test "x$make_lint_lib" != x"no" ; then
36318903d43aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3632e9554658Smrgfi
36338903d43aSmrg
3634e9554658SmrgAC_SUBST(LINTLIB)
3635e9554658SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3636e9554658Smrg
3637e9554658Smrg]) # XORG_LINT_LIBRARY
3638e9554658Smrg
3639309c398aSmrg# XORG_COMPILER_BRAND
3640309c398aSmrg# -------------------
3641309c398aSmrg# Minimum version: 1.14.0
3642309c398aSmrg#
3643309c398aSmrg# Checks for various brands of compilers and sets flags as appropriate:
3644309c398aSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3645309c398aSmrg#   clang compiler - sets CLANGCC to "yes"
3646309c398aSmrg#   Intel compiler - sets INTELCC to "yes"
3647309c398aSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3648309c398aSmrg#
3649309c398aSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3650309c398aSmrgAC_REQUIRE([AC_PROG_CC_C99])
3651309c398aSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3652309c398aSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3653309c398aSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3654309c398aSmrg]) # XORG_COMPILER_BRAND
3655309c398aSmrg
3656309c398aSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3657309c398aSmrg# ---------------
3658309c398aSmrg# Minimum version: 1.16.0
3659309c398aSmrg#
3660309c398aSmrg# Test if the compiler works when passed the given flag as a command line argument.
3661309c398aSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
3662309c398aSmrg# next flag in the list until there are no more options.
3663309c398aSmrg#
3664309c398aSmrg# Note that this does not guarantee that the compiler supports the flag as some
3665309c398aSmrg# compilers will simply ignore arguments that they do not understand, but we do
3666309c398aSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3667309c398aSmrg# -Werror=unused-command-line-argument
3668309c398aSmrg#
3669309c398aSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3670309c398aSmrgAC_REQUIRE([AC_PROG_CC_C99])
3671309c398aSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3672309c398aSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3673309c398aSmrg
3674309c398aSmrgxorg_testset_save_CFLAGS="$CFLAGS"
3675309c398aSmrg
3676309c398aSmrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
3677309c398aSmrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
3678309c398aSmrg	AC_CACHE_CHECK([if $CC supports -Werror=unknown-warning-option],
3679309c398aSmrg			xorg_cv_cc_flag_unknown_warning_option,
3680309c398aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3681309c398aSmrg					  [xorg_cv_cc_flag_unknown_warning_option=yes],
3682309c398aSmrg					  [xorg_cv_cc_flag_unknown_warning_option=no]))
3683309c398aSmrg	xorg_testset_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option
3684309c398aSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
3685309c398aSmrgfi
3686309c398aSmrg
3687309c398aSmrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
3688309c398aSmrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
3689309c398aSmrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
3690309c398aSmrg	fi
3691309c398aSmrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
3692309c398aSmrg	AC_CACHE_CHECK([if $CC supports -Werror=unused-command-line-argument],
3693309c398aSmrg			xorg_cv_cc_flag_unused_command_line_argument,
3694309c398aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3695309c398aSmrg					  [xorg_cv_cc_flag_unused_command_line_argument=yes],
3696309c398aSmrg					  [xorg_cv_cc_flag_unused_command_line_argument=no]))
3697309c398aSmrg	xorg_testset_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument
3698309c398aSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
3699309c398aSmrgfi
3700309c398aSmrg
3701309c398aSmrgfound="no"
3702309c398aSmrgm4_foreach([flag], m4_cdr($@), [
3703309c398aSmrg	if test $found = "no" ; then
3704309c398aSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
3705309c398aSmrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
3706309c398aSmrg		fi
3707309c398aSmrg
3708309c398aSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
3709309c398aSmrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
3710309c398aSmrg		fi
3711309c398aSmrg
3712309c398aSmrg		CFLAGS="$CFLAGS ]flag["
3713309c398aSmrg
3714309c398aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3715309c398aSmrg		AC_MSG_CHECKING([if $CC supports ]flag[])
3716309c398aSmrg		cacheid=`AS_ECHO_N([xorg_cv_cc_flag_]flag[])`
3717309c398aSmrg		AC_CACHE_VAL(AS_TR_SH($cacheid),
3718309c398aSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3719309c398aSmrg					     [eval AS_TR_SH($cacheid)=yes],
3720309c398aSmrg					     [eval AS_TR_SH($cacheid)=no])])
3721309c398aSmrg
3722309c398aSmrg		CFLAGS="$xorg_testset_save_CFLAGS"
3723309c398aSmrg
3724309c398aSmrg		eval supported=$AS_TR_SH($cacheid)
3725309c398aSmrg		AC_MSG_RESULT([$supported])
3726309c398aSmrg		if test "$supported" = "yes" ; then
3727309c398aSmrg			$1="$$1 ]flag["
3728309c398aSmrg			found="yes"
3729309c398aSmrg		fi
3730309c398aSmrg	fi
3731309c398aSmrg])
3732309c398aSmrg]) # XORG_TESTSET_CFLAG
3733309c398aSmrg
3734309c398aSmrg# XORG_COMPILER_FLAGS
3735309c398aSmrg# ---------------
3736309c398aSmrg# Minimum version: 1.16.0
3737309c398aSmrg#
3738309c398aSmrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
3739309c398aSmrg# by the selected compiler which do NOT alter the generated code.  These
3740309c398aSmrg# arguments will cause the compiler to print various warnings during
3741309c398aSmrg# compilation AND turn a conservative set of warnings into errors.
3742309c398aSmrg#
3743309c398aSmrg# The set of flags supported by BASE_CFLAGS will grow in future
3744309c398aSmrg# versions of util-macros as options are added to new compilers.
3745309c398aSmrg#
3746309c398aSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3747309c398aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3748309c398aSmrg
3749309c398aSmrgAC_ARG_ENABLE(selective-werror,
3750309c398aSmrg              AS_HELP_STRING([--disable-selective-werror],
3751309c398aSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3752309c398aSmrg              [SELECTIVE_WERROR=$enableval],
3753309c398aSmrg              [SELECTIVE_WERROR=yes])
3754309c398aSmrg
3755309c398aSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3756309c398aSmrgif test "x$SUNCC" = "xyes"; then
3757309c398aSmrg    BASE_CFLAGS="-v"
3758309c398aSmrgelse
3759309c398aSmrg    BASE_CFLAGS=""
3760309c398aSmrgfi
3761309c398aSmrg
3762309c398aSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3763309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
3764309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
3765309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
3766309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
3767309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
3768309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
3769309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
3770309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
3771309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
3772309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
3773309c398aSmrg
3774309c398aSmrg# This chunk adds additional warnings that could catch undesired effects.
3775309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
3776309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
3777309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
3778309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
3779309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
3780309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
3781309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
3782309c398aSmrg
3783309c398aSmrg# These are currently disabled because they are noisy.  They will be enabled
3784309c398aSmrg# in the future once the codebase is sufficiently modernized to silence
3785309c398aSmrg# them.  For now, I don't want them to drown out the other warnings.
3786309c398aSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
3787309c398aSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
3788309c398aSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
3789309c398aSmrg
3790309c398aSmrg# Turn some warnings into errors, so we don't accidently get successful builds
3791309c398aSmrg# when there are problems that should be fixed.
3792309c398aSmrg
3793309c398aSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3794309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3795309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
3796309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
3797309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
3798309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
3799309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
3800309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3801309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
3802309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
3803309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
3804309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
3805309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3806309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3807309c398aSmrgelse
3808309c398aSmrgAC_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])
3809309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
3810309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
3811309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
3812309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
3813309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
3814309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
3815309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
3816309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
3817309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
3818309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
3819309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
3820309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
3821309c398aSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
3822309c398aSmrgfi
3823309c398aSmrg
3824309c398aSmrgAC_SUBST([BASE_CFLAGS])
3825309c398aSmrg]) # XORG_COMPILER_FLAGS
3826309c398aSmrg
3827c2b339b4Smrg# XORG_CWARNFLAGS
3828c2b339b4Smrg# ---------------
3829c2b339b4Smrg# Minimum version: 1.2.0
3830309c398aSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3831c2b339b4Smrg#
3832c2b339b4Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3833c2b339b4Smrg#
3834309c398aSmrg# This function is deprecated because it defines -fno-strict-aliasing
3835309c398aSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3836309c398aSmrg# is needed, then it should be added explicitly in the module when
3837309c398aSmrg# it is updated to use BASE_CFLAGS.
3838309c398aSmrg#
3839c2b339b4SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3840309c398aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3841309c398aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3842309c398aSmrgCWARNFLAGS="$BASE_CFLAGS"
3843c2b339b4Smrgif  test "x$GCC" = xyes ; then
3844309c398aSmrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3845c2b339b4Smrgfi
3846c2b339b4SmrgAC_SUBST(CWARNFLAGS)
3847c2b339b4Smrg]) # XORG_CWARNFLAGS
3848c2b339b4Smrg
3849c2b339b4Smrg# XORG_STRICT_OPTION
3850c2b339b4Smrg# -----------------------
3851c2b339b4Smrg# Minimum version: 1.3.0
3852c2b339b4Smrg#
3853309c398aSmrg# Add configure option to enable strict compilation flags, such as treating
3854309c398aSmrg# warnings as fatal errors.
3855309c398aSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3856309c398aSmrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
3857309c398aSmrg#
3858309c398aSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3859309c398aSmrg# when strict compilation is unconditionally desired.
3860c2b339b4SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3861c2b339b4SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3862309c398aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3863c2b339b4Smrg
3864c2b339b4SmrgAC_ARG_ENABLE(strict-compilation,
3865c2b339b4Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3866c2b339b4Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3867c2b339b4Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3868309c398aSmrg
3869309c398aSmrgSTRICT_CFLAGS=""
3870309c398aSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
3871309c398aSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
3872309c398aSmrg
3873309c398aSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3874309c398aSmrg# activate it with -Werror, so we add it here explicitly.
3875309c398aSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
3876309c398aSmrg
3877c2b339b4Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3878309c398aSmrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
3879309c398aSmrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
3880c2b339b4Smrgfi
3881309c398aSmrgAC_SUBST([STRICT_CFLAGS])
3882309c398aSmrgAC_SUBST([BASE_CFLAGS])
3883c2b339b4SmrgAC_SUBST([CWARNFLAGS])
3884c2b339b4Smrg]) # XORG_STRICT_OPTION
3885c2b339b4Smrg
3886c2b339b4Smrg# XORG_DEFAULT_OPTIONS
3887c2b339b4Smrg# --------------------
3888c2b339b4Smrg# Minimum version: 1.3.0
3889c2b339b4Smrg#
3890c2b339b4Smrg# Defines default options for X.Org modules.
3891c2b339b4Smrg#
3892c2b339b4SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
38938903d43aSmrgAC_REQUIRE([AC_PROG_INSTALL])
3894309c398aSmrgXORG_COMPILER_FLAGS
3895c2b339b4SmrgXORG_CWARNFLAGS
3896c2b339b4SmrgXORG_STRICT_OPTION
3897c2b339b4SmrgXORG_RELEASE_VERSION
3898c2b339b4SmrgXORG_CHANGELOG
38998903d43aSmrgXORG_INSTALL
3900c2b339b4SmrgXORG_MANPAGE_SECTIONS
39018903d43aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
39028903d43aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3903c2b339b4Smrg]) # XORG_DEFAULT_OPTIONS
39048903d43aSmrg
39058903d43aSmrg# XORG_INSTALL()
39068903d43aSmrg# ----------------
39078903d43aSmrg# Minimum version: 1.4.0
39088903d43aSmrg#
39098903d43aSmrg# Defines the variable INSTALL_CMD as the command to copy
39108903d43aSmrg# INSTALL from $prefix/share/util-macros.
39118903d43aSmrg#
39128903d43aSmrgAC_DEFUN([XORG_INSTALL], [
39138903d43aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
39148903d43aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
39158903d43aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
39168903d43aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
39178903d43aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
39188903d43aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
39198903d43aSmrgAC_SUBST([INSTALL_CMD])
39208903d43aSmrg]) # XORG_INSTALL
3921e9554658Smrgdnl Copyright 2005 Red Hat, Inc
3922e9554658Smrgdnl
3923e9554658Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3924e9554658Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3925e9554658Smrgdnl the above copyright notice appear in all copies and that both that
3926e9554658Smrgdnl copyright notice and this permission notice appear in supporting
3927e9554658Smrgdnl documentation.
3928e9554658Smrgdnl
3929e9554658Smrgdnl The above copyright notice and this permission notice shall be included
3930e9554658Smrgdnl in all copies or substantial portions of the Software.
3931e9554658Smrgdnl
3932e9554658Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3933e9554658Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3934e9554658Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3935e9554658Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3936e9554658Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3937e9554658Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3938e9554658Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3939e9554658Smrgdnl
3940e9554658Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3941e9554658Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3942e9554658Smrgdnl other dealings in this Software without prior written authorization
3943e9554658Smrgdnl from the copyright holders.
3944e9554658Smrgdnl
3945e9554658Smrg
3946e9554658Smrg# XORG_RELEASE_VERSION
3947e9554658Smrg# --------------------
39488903d43aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3949e9554658Smrg 
3950e9554658SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3951e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3952e9554658Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3953e9554658Smrg		[Major version of this package])
3954c2b339b4Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3955e9554658Smrg	if test "x$PVM" = "x"; then
3956e9554658Smrg		PVM="0"
3957e9554658Smrg	fi
3958e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3959e9554658Smrg		[$PVM],
3960e9554658Smrg		[Minor version of this package])
3961c2b339b4Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3962e9554658Smrg	if test "x$PVP" = "x"; then
3963e9554658Smrg		PVP="0"
3964e9554658Smrg	fi
3965e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3966e9554658Smrg		[$PVP],
3967e9554658Smrg		[Patch version of this package])
3968e9554658Smrg])
3969e9554658Smrg
3970c2b339b4Smrg# XORG_CHANGELOG()
3971c2b339b4Smrg# ----------------
3972c2b339b4Smrg# Minimum version: 1.2.0
3973c2b339b4Smrg#
3974c2b339b4Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3975c2b339b4Smrg# ChangeLog from git.
3976c2b339b4Smrg#
3977c2b339b4Smrg#
3978c2b339b4SmrgAC_DEFUN([XORG_CHANGELOG], [
39798903d43aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
39808903d43aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
39818903d43aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3982c2b339b4Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3983c2b339b4SmrgAC_SUBST([CHANGELOG_CMD])
3984c2b339b4Smrg]) # XORG_CHANGELOG
3985c2b339b4Smrg
3986