aclocal.m4 revision 34f90d55
134f90d55Smrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2bbe1b32bSmrg
3bbe1b32bSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
434f90d55Smrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
534f90d55Smrg# Inc.
6bbe1b32bSmrg# This file is free software; the Free Software Foundation
7bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
8bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
9bbe1b32bSmrg
10bbe1b32bSmrg# This program is distributed in the hope that it will be useful,
11bbe1b32bSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12bbe1b32bSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13bbe1b32bSmrg# PARTICULAR PURPOSE.
14bbe1b32bSmrg
1530f8ce46Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1630f8ce46Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1730f8ce46Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1830f8ce46Smrg[m4_warning([this file was generated for autoconf 2.68.
1930f8ce46SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2030f8ce46SmrgIf you have problems, you may need to regenerate the build system entirely.
2130f8ce46SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22bbe1b32bSmrg
2334f90d55Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
2434f90d55Smrg# Foundation, Inc.
25ce6676dbSmrg#
26ce6676dbSmrg# This file is free software; the Free Software Foundation
27ce6676dbSmrg# gives unlimited permission to copy and/or distribute it,
28ce6676dbSmrg# with or without modifications, as long as this notice is preserved.
29bbe1b32bSmrg
3034f90d55Smrg# serial 1
3134f90d55Smrg
32ce6676dbSmrg# AM_AUTOMAKE_VERSION(VERSION)
33ce6676dbSmrg# ----------------------------
34ce6676dbSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
35ce6676dbSmrg# generated from the m4 files accompanying Automake X.Y.
36ce6676dbSmrg# (This private macro should not be called outside this file.)
37ce6676dbSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3830f8ce46Smrg[am__api_version='1.11'
39ce6676dbSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40ce6676dbSmrgdnl require some minimum version.  Point them to the right macro.
4134f90d55Smrgm4_if([$1], [1.11.2], [],
42ce6676dbSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43ce6676dbSmrg])
44bbe1b32bSmrg
45ce6676dbSmrg# _AM_AUTOCONF_VERSION(VERSION)
46ce6676dbSmrg# -----------------------------
47ce6676dbSmrg# aclocal traces this macro to find the Autoconf version.
48ce6676dbSmrg# This is a private macro too.  Using m4_define simplifies
49ce6676dbSmrg# the logic in aclocal, which can simply ignore this definition.
50ce6676dbSmrgm4_define([_AM_AUTOCONF_VERSION], [])
51bbe1b32bSmrg
52ce6676dbSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
53ce6676dbSmrg# -------------------------------
54ce6676dbSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5530f8ce46Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56ce6676dbSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5734f90d55Smrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
5830f8ce46Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5930f8ce46Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
6030f8ce46Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61bbe1b32bSmrg
62ce6676dbSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
63bbe1b32bSmrg
6434f90d55Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65bbe1b32bSmrg#
66bbe1b32bSmrg# This file is free software; the Free Software Foundation
67bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
68bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
69bbe1b32bSmrg
7034f90d55Smrg# serial 1
7134f90d55Smrg
72bbe1b32bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73bbe1b32bSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74bbe1b32bSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75bbe1b32bSmrg#
76bbe1b32bSmrg# Of course, Automake must honor this variable whenever it calls a
77bbe1b32bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
78bbe1b32bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
79bbe1b32bSmrg# depending on how configure is run.  This is pretty annoying, since
80bbe1b32bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81bbe1b32bSmrg# source directory, any form will work fine, but in subdirectories a
82bbe1b32bSmrg# relative path needs to be adjusted first.
83bbe1b32bSmrg#
84bbe1b32bSmrg# $ac_aux_dir/missing
85bbe1b32bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
86bbe1b32bSmrg# $top_srcdir/$ac_aux_dir/missing
87bbe1b32bSmrg#    fails if $ac_aux_dir is absolute,
88bbe1b32bSmrg#    fails when called from a subdirectory in a VPATH build with
89bbe1b32bSmrg#          a relative $ac_aux_dir
90bbe1b32bSmrg#
91bbe1b32bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92bbe1b32bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
93bbe1b32bSmrg# harmless because $srcdir is `.', but things will broke when you
94bbe1b32bSmrg# start a VPATH build or use an absolute $srcdir.
95bbe1b32bSmrg#
96bbe1b32bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97bbe1b32bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98bbe1b32bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99bbe1b32bSmrg# and then we would define $MISSING as
100bbe1b32bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
101bbe1b32bSmrg# This will work as long as MISSING is not called from configure, because
102bbe1b32bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
103bbe1b32bSmrg# However there are other variables, like CC, which are often used in
104bbe1b32bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
105bbe1b32bSmrg#
106bbe1b32bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
107bbe1b32bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
108bbe1b32bSmrg# configured tree to be moved without reconfiguration.
109bbe1b32bSmrg
110bbe1b32bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
111bbe1b32bSmrg[dnl Rely on autoconf to set up CDPATH properly.
112bbe1b32bSmrgAC_PREREQ([2.50])dnl
113bbe1b32bSmrg# expand $ac_aux_dir to an absolute path
114bbe1b32bSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
115bbe1b32bSmrg])
116bbe1b32bSmrg
117bbe1b32bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
118bbe1b32bSmrg
11930f8ce46Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120bbe1b32bSmrg# Free Software Foundation, Inc.
121bbe1b32bSmrg#
122bbe1b32bSmrg# This file is free software; the Free Software Foundation
123bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
124bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
125bbe1b32bSmrg
12630f8ce46Smrg# serial 9
127bbe1b32bSmrg
128bbe1b32bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129bbe1b32bSmrg# -------------------------------------
130bbe1b32bSmrg# Define a conditional.
131bbe1b32bSmrgAC_DEFUN([AM_CONDITIONAL],
132bbe1b32bSmrg[AC_PREREQ(2.52)dnl
133bbe1b32bSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
134bbe1b32bSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135bbe1b32bSmrgAC_SUBST([$1_TRUE])dnl
136bbe1b32bSmrgAC_SUBST([$1_FALSE])dnl
137bbe1b32bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138bbe1b32bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13930f8ce46Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
140bbe1b32bSmrgif $2; then
141bbe1b32bSmrg  $1_TRUE=
142bbe1b32bSmrg  $1_FALSE='#'
143bbe1b32bSmrgelse
144bbe1b32bSmrg  $1_TRUE='#'
145bbe1b32bSmrg  $1_FALSE=
146bbe1b32bSmrgfi
147bbe1b32bSmrgAC_CONFIG_COMMANDS_PRE(
148bbe1b32bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149bbe1b32bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
150bbe1b32bSmrgUsually this means the macro was only invoked conditionally.]])
151bbe1b32bSmrgfi])])
152bbe1b32bSmrg
15334f90d55Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
15434f90d55Smrg# 2010, 2011 Free Software Foundation, Inc.
155bbe1b32bSmrg#
156bbe1b32bSmrg# This file is free software; the Free Software Foundation
157bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
158bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
159bbe1b32bSmrg
16034f90d55Smrg# serial 12
161bbe1b32bSmrg
162bbe1b32bSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163bbe1b32bSmrg# written in clear, in which case automake, when reading aclocal.m4,
164bbe1b32bSmrg# will think it sees a *use*, and therefore will trigger all it's
165bbe1b32bSmrg# C support machinery.  Also note that it means that autoscan, seeing
166bbe1b32bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167bbe1b32bSmrg
168bbe1b32bSmrg
169bbe1b32bSmrg# _AM_DEPENDENCIES(NAME)
170bbe1b32bSmrg# ----------------------
171bbe1b32bSmrg# See how the compiler implements dependency checking.
172bbe1b32bSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
173bbe1b32bSmrg# We try a few techniques and use that to set a single cache variable.
174bbe1b32bSmrg#
175bbe1b32bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176bbe1b32bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177bbe1b32bSmrg# dependency, and given that the user is not expected to run this macro,
178bbe1b32bSmrg# just rely on AC_PROG_CC.
179bbe1b32bSmrgAC_DEFUN([_AM_DEPENDENCIES],
180bbe1b32bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
181bbe1b32bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182bbe1b32bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
183bbe1b32bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
184bbe1b32bSmrg
185bbe1b32bSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186bbe1b32bSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187bbe1b32bSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
188bbe1b32bSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189bbe1b32bSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190bbe1b32bSmrg                   [depcc="$$1"   am_compiler_list=])
191bbe1b32bSmrg
192bbe1b32bSmrgAC_CACHE_CHECK([dependency style of $depcc],
193bbe1b32bSmrg               [am_cv_$1_dependencies_compiler_type],
194bbe1b32bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195bbe1b32bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
196bbe1b32bSmrg  # making bogus files that we don't know about and never remove.  For
197bbe1b32bSmrg  # instance it was reported that on HP-UX the gcc test will end up
198bbe1b32bSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
199bbe1b32bSmrg  # in D'.
20034f90d55Smrg  rm -rf conftest.dir
201bbe1b32bSmrg  mkdir conftest.dir
202bbe1b32bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
203bbe1b32bSmrg  # using a relative directory.
204bbe1b32bSmrg  cp "$am_depcomp" conftest.dir
205bbe1b32bSmrg  cd conftest.dir
206bbe1b32bSmrg  # We will build objects and dependencies in a subdirectory because
207bbe1b32bSmrg  # it helps to detect inapplicable dependency modes.  For instance
208bbe1b32bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
209bbe1b32bSmrg  # side effect of compilation, but ICC will put the dependencies in
210bbe1b32bSmrg  # the current directory while Tru64 will put them in the object
211bbe1b32bSmrg  # directory.
212bbe1b32bSmrg  mkdir sub
213bbe1b32bSmrg
214bbe1b32bSmrg  am_cv_$1_dependencies_compiler_type=none
215bbe1b32bSmrg  if test "$am_compiler_list" = ""; then
216bbe1b32bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217bbe1b32bSmrg  fi
21830f8ce46Smrg  am__universal=false
21930f8ce46Smrg  m4_case([$1], [CC],
22030f8ce46Smrg    [case " $depcc " in #(
22130f8ce46Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
22230f8ce46Smrg     esac],
22330f8ce46Smrg    [CXX],
22430f8ce46Smrg    [case " $depcc " in #(
22530f8ce46Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
22630f8ce46Smrg     esac])
22730f8ce46Smrg
228bbe1b32bSmrg  for depmode in $am_compiler_list; do
229bbe1b32bSmrg    # Setup a source with many dependencies, because some compilers
230bbe1b32bSmrg    # like to wrap large dependency lists on column 80 (with \), and
231bbe1b32bSmrg    # we should not choose a depcomp mode which is confused by this.
232bbe1b32bSmrg    #
233bbe1b32bSmrg    # We need to recreate these files for each test, as the compiler may
234bbe1b32bSmrg    # overwrite some of them when testing with obscure command lines.
235bbe1b32bSmrg    # This happens at least with the AIX C compiler.
236bbe1b32bSmrg    : > sub/conftest.c
237bbe1b32bSmrg    for i in 1 2 3 4 5 6; do
238bbe1b32bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
239bbe1b32bSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
240bbe1b32bSmrg      # Solaris 8's {/usr,}/bin/sh.
241bbe1b32bSmrg      touch sub/conftst$i.h
242bbe1b32bSmrg    done
243bbe1b32bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244bbe1b32bSmrg
24530f8ce46Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
24630f8ce46Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24730f8ce46Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24830f8ce46Smrg    # versions had trouble with output in subdirs
24930f8ce46Smrg    am__obj=sub/conftest.${OBJEXT-o}
25030f8ce46Smrg    am__minus_obj="-o $am__obj"
251bbe1b32bSmrg    case $depmode in
25230f8ce46Smrg    gcc)
25330f8ce46Smrg      # This depmode causes a compiler race in universal mode.
25430f8ce46Smrg      test "$am__universal" = false || continue
25530f8ce46Smrg      ;;
256bbe1b32bSmrg    nosideeffect)
257bbe1b32bSmrg      # after this tag, mechanisms are not by side-effect, so they'll
258bbe1b32bSmrg      # only be used when explicitly requested
259bbe1b32bSmrg      if test "x$enable_dependency_tracking" = xyes; then
260bbe1b32bSmrg	continue
261bbe1b32bSmrg      else
262bbe1b32bSmrg	break
263bbe1b32bSmrg      fi
264bbe1b32bSmrg      ;;
26534f90d55Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
26630f8ce46Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
26730f8ce46Smrg      # not run yet.  These depmodes are late enough in the game, and
26830f8ce46Smrg      # so weak that their functioning should not be impacted.
26930f8ce46Smrg      am__obj=conftest.${OBJEXT-o}
27030f8ce46Smrg      am__minus_obj=
27130f8ce46Smrg      ;;
272bbe1b32bSmrg    none) break ;;
273bbe1b32bSmrg    esac
274bbe1b32bSmrg    if depmode=$depmode \
27530f8ce46Smrg       source=sub/conftest.c object=$am__obj \
276bbe1b32bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27730f8ce46Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278bbe1b32bSmrg         >/dev/null 2>conftest.err &&
279bbe1b32bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280bbe1b32bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
28130f8ce46Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282bbe1b32bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283bbe1b32bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
284bbe1b32bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
285bbe1b32bSmrg      # that says an option was ignored or not supported.
286bbe1b32bSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
287bbe1b32bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
288bbe1b32bSmrg      # The diagnosis changed in icc 8.0:
289bbe1b32bSmrg      #   icc: Command line remark: option '-MP' not supported
290bbe1b32bSmrg      if (grep 'ignoring option' conftest.err ||
291bbe1b32bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292bbe1b32bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
293bbe1b32bSmrg        break
294bbe1b32bSmrg      fi
295bbe1b32bSmrg    fi
296bbe1b32bSmrg  done
297bbe1b32bSmrg
298bbe1b32bSmrg  cd ..
299bbe1b32bSmrg  rm -rf conftest.dir
300bbe1b32bSmrgelse
301bbe1b32bSmrg  am_cv_$1_dependencies_compiler_type=none
302bbe1b32bSmrgfi
303bbe1b32bSmrg])
304bbe1b32bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305bbe1b32bSmrgAM_CONDITIONAL([am__fastdep$1], [
306bbe1b32bSmrg  test "x$enable_dependency_tracking" != xno \
307bbe1b32bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308bbe1b32bSmrg])
309bbe1b32bSmrg
310bbe1b32bSmrg
311bbe1b32bSmrg# AM_SET_DEPDIR
312bbe1b32bSmrg# -------------
313bbe1b32bSmrg# Choose a directory name for dependency files.
314bbe1b32bSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315bbe1b32bSmrgAC_DEFUN([AM_SET_DEPDIR],
316bbe1b32bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317bbe1b32bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318bbe1b32bSmrg])
319bbe1b32bSmrg
320bbe1b32bSmrg
321bbe1b32bSmrg# AM_DEP_TRACK
322bbe1b32bSmrg# ------------
323bbe1b32bSmrgAC_DEFUN([AM_DEP_TRACK],
324bbe1b32bSmrg[AC_ARG_ENABLE(dependency-tracking,
325bbe1b32bSmrg[  --disable-dependency-tracking  speeds up one-time build
326bbe1b32bSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
327bbe1b32bSmrgif test "x$enable_dependency_tracking" != xno; then
328bbe1b32bSmrg  am_depcomp="$ac_aux_dir/depcomp"
329bbe1b32bSmrg  AMDEPBACKSLASH='\'
33034f90d55Smrg  am__nodep='_no'
331bbe1b32bSmrgfi
332bbe1b32bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
333bbe1b32bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
334bbe1b32bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33534f90d55SmrgAC_SUBST([am__nodep])dnl
33634f90d55Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
337bbe1b32bSmrg])
338bbe1b32bSmrg
339bbe1b32bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
340bbe1b32bSmrg
34130f8ce46Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
342bbe1b32bSmrg# Free Software Foundation, Inc.
343bbe1b32bSmrg#
344bbe1b32bSmrg# This file is free software; the Free Software Foundation
345bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
346bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
347bbe1b32bSmrg
34830f8ce46Smrg#serial 5
349bbe1b32bSmrg
350bbe1b32bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
351bbe1b32bSmrg# ------------------------------
352bbe1b32bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
35330f8ce46Smrg[{
35430f8ce46Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
35530f8ce46Smrg  # are listed without --file.  Let's play safe and only enable the eval
35630f8ce46Smrg  # if we detect the quoting.
35730f8ce46Smrg  case $CONFIG_FILES in
35830f8ce46Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
35930f8ce46Smrg  *)   set x $CONFIG_FILES ;;
36030f8ce46Smrg  esac
36130f8ce46Smrg  shift
36230f8ce46Smrg  for mf
36330f8ce46Smrg  do
36430f8ce46Smrg    # Strip MF so we end up with the name of the file.
36530f8ce46Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
36630f8ce46Smrg    # Check whether this is an Automake generated Makefile or not.
36730f8ce46Smrg    # We used to match only the files named `Makefile.in', but
36830f8ce46Smrg    # some people rename them; so instead we look at the file content.
36930f8ce46Smrg    # Grep'ing the first line is not enough: some people post-process
37030f8ce46Smrg    # each Makefile.in and add a new line on top of each file to say so.
37130f8ce46Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
37230f8ce46Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
37330f8ce46Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
37430f8ce46Smrg      dirpart=`AS_DIRNAME("$mf")`
37530f8ce46Smrg    else
37630f8ce46Smrg      continue
37730f8ce46Smrg    fi
37830f8ce46Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
37930f8ce46Smrg    # from the Makefile without running `make'.
38030f8ce46Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
38130f8ce46Smrg    test -z "$DEPDIR" && continue
38230f8ce46Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
38330f8ce46Smrg    test -z "am__include" && continue
38430f8ce46Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
38530f8ce46Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
38630f8ce46Smrg    U=`sed -n 's/^U = //p' < "$mf"`
38730f8ce46Smrg    # Find all dependency output files, they are included files with
38830f8ce46Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
38930f8ce46Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
39030f8ce46Smrg    # expansion.
39130f8ce46Smrg    for file in `sed -n "
39230f8ce46Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
39330f8ce46Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
39430f8ce46Smrg      # Make sure the directory exists.
39530f8ce46Smrg      test -f "$dirpart/$file" && continue
39630f8ce46Smrg      fdir=`AS_DIRNAME(["$file"])`
39730f8ce46Smrg      AS_MKDIR_P([$dirpart/$fdir])
39830f8ce46Smrg      # echo "creating $dirpart/$file"
39930f8ce46Smrg      echo '# dummy' > "$dirpart/$file"
40030f8ce46Smrg    done
401bbe1b32bSmrg  done
40230f8ce46Smrg}
403bbe1b32bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404bbe1b32bSmrg
405bbe1b32bSmrg
406bbe1b32bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
407bbe1b32bSmrg# -----------------------------
408bbe1b32bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
409bbe1b32bSmrg#
410bbe1b32bSmrg# This code is only required when automatic dependency tracking
411bbe1b32bSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
412bbe1b32bSmrg# need in order to bootstrap the dependency handling code.
413bbe1b32bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414bbe1b32bSmrg[AC_CONFIG_COMMANDS([depfiles],
415bbe1b32bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416bbe1b32bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417bbe1b32bSmrg])
418bbe1b32bSmrg
419bbe1b32bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
420bbe1b32bSmrg
421bbe1b32bSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
42230f8ce46Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423bbe1b32bSmrg#
424bbe1b32bSmrg# This file is free software; the Free Software Foundation
425bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
426bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
427bbe1b32bSmrg
42830f8ce46Smrg# serial 16
429bbe1b32bSmrg
430bbe1b32bSmrg# This macro actually does too much.  Some checks are only needed if
431bbe1b32bSmrg# your package does certain things.  But this isn't really a big deal.
432bbe1b32bSmrg
433bbe1b32bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
434bbe1b32bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
435bbe1b32bSmrg# -----------------------------------------------
436bbe1b32bSmrg# The call with PACKAGE and VERSION arguments is the old style
437bbe1b32bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
438bbe1b32bSmrg# and VERSION should now be passed to AC_INIT and removed from
439bbe1b32bSmrg# the call to AM_INIT_AUTOMAKE.
440bbe1b32bSmrg# We support both call styles for the transition.  After
441bbe1b32bSmrg# the next Automake release, Autoconf can make the AC_INIT
442bbe1b32bSmrg# arguments mandatory, and then we can depend on a new Autoconf
443bbe1b32bSmrg# release and drop the old call support.
444bbe1b32bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
44530f8ce46Smrg[AC_PREREQ([2.62])dnl
446bbe1b32bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
447bbe1b32bSmrgdnl the ones we care about.
448bbe1b32bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
449bbe1b32bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
450bbe1b32bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
451bbe1b32bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
452bbe1b32bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
453bbe1b32bSmrg  # is not polluted with repeated "-I."
454bbe1b32bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
455bbe1b32bSmrg  # test to see if srcdir already configured
456bbe1b32bSmrg  if test -f $srcdir/config.status; then
457bbe1b32bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
458bbe1b32bSmrg  fi
459bbe1b32bSmrgfi
460bbe1b32bSmrg
461bbe1b32bSmrg# test whether we have cygpath
462bbe1b32bSmrgif test -z "$CYGPATH_W"; then
463bbe1b32bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
464bbe1b32bSmrg    CYGPATH_W='cygpath -w'
465bbe1b32bSmrg  else
466bbe1b32bSmrg    CYGPATH_W=echo
467bbe1b32bSmrg  fi
468bbe1b32bSmrgfi
469bbe1b32bSmrgAC_SUBST([CYGPATH_W])
470bbe1b32bSmrg
471bbe1b32bSmrg# Define the identity of the package.
472bbe1b32bSmrgdnl Distinguish between old-style and new-style calls.
473bbe1b32bSmrgm4_ifval([$2],
474bbe1b32bSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
475bbe1b32bSmrg AC_SUBST([PACKAGE], [$1])dnl
476bbe1b32bSmrg AC_SUBST([VERSION], [$2])],
477bbe1b32bSmrg[_AM_SET_OPTIONS([$1])dnl
478bbe1b32bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
479bbe1b32bSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
480bbe1b32bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
481bbe1b32bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
482bbe1b32bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483bbe1b32bSmrg
484bbe1b32bSmrg_AM_IF_OPTION([no-define],,
485bbe1b32bSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
486bbe1b32bSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487bbe1b32bSmrg
488bbe1b32bSmrg# Some tools Automake needs.
489bbe1b32bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
490bbe1b32bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
491bbe1b32bSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
492bbe1b32bSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
493bbe1b32bSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
494bbe1b32bSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
495bbe1b32bSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
49630f8ce46SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49730f8ce46SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
498bbe1b32bSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
499bbe1b32bSmrg# We need awk for the "check" target.  The system "awk" is bad on
500bbe1b32bSmrg# some platforms.
501bbe1b32bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
502bbe1b32bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
503bbe1b32bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
504bbe1b32bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50530f8ce46Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50630f8ce46Smrg			     [_AM_PROG_TAR([v7])])])
507bbe1b32bSmrg_AM_IF_OPTION([no-dependencies],,
508bbe1b32bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50930f8ce46Smrg		  [_AM_DEPENDENCIES(CC)],
51030f8ce46Smrg		  [define([AC_PROG_CC],
51130f8ce46Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
512bbe1b32bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51330f8ce46Smrg		  [_AM_DEPENDENCIES(CXX)],
51430f8ce46Smrg		  [define([AC_PROG_CXX],
51530f8ce46Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
516bbe1b32bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51730f8ce46Smrg		  [_AM_DEPENDENCIES(OBJC)],
51830f8ce46Smrg		  [define([AC_PROG_OBJC],
51930f8ce46Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
520bbe1b32bSmrg])
52130f8ce46Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
52230f8ce46Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
52330f8ce46Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
52430f8ce46Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
52530f8ce46SmrgAC_CONFIG_COMMANDS_PRE(dnl
52630f8ce46Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
52730f8ce46Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
528bbe1b32bSmrg])
529bbe1b32bSmrg
53030f8ce46Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
53130f8ce46Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
53230f8ce46Smrgdnl mangled by Autoconf and run in a shell conditional statement.
53330f8ce46Smrgm4_define([_AC_COMPILER_EXEEXT],
53430f8ce46Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
53530f8ce46Smrg
536bbe1b32bSmrg
537bbe1b32bSmrg# When config.status generates a header, we must update the stamp-h file.
538bbe1b32bSmrg# This file resides in the same directory as the config header
539bbe1b32bSmrg# that is generated.  The stamp files are numbered to have different names.
540bbe1b32bSmrg
541bbe1b32bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
542bbe1b32bSmrg# loop where config.status creates the headers, so we can generate
543bbe1b32bSmrg# our stamp files there.
544bbe1b32bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
545bbe1b32bSmrg[# Compute $1's index in $config_headers.
54630f8ce46Smrg_am_arg=$1
547bbe1b32bSmrg_am_stamp_count=1
548bbe1b32bSmrgfor _am_header in $config_headers :; do
549bbe1b32bSmrg  case $_am_header in
55030f8ce46Smrg    $_am_arg | $_am_arg:* )
551bbe1b32bSmrg      break ;;
552bbe1b32bSmrg    * )
553bbe1b32bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
554bbe1b32bSmrg  esac
555bbe1b32bSmrgdone
55630f8ce46Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557bbe1b32bSmrg
55834f90d55Smrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
55934f90d55Smrg# Inc.
560bbe1b32bSmrg#
561bbe1b32bSmrg# This file is free software; the Free Software Foundation
562bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
563bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
564bbe1b32bSmrg
56534f90d55Smrg# serial 1
56634f90d55Smrg
567bbe1b32bSmrg# AM_PROG_INSTALL_SH
568bbe1b32bSmrg# ------------------
569bbe1b32bSmrg# Define $install_sh.
570bbe1b32bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
571bbe1b32bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
57230f8ce46Smrgif test x"${install_sh}" != xset; then
57330f8ce46Smrg  case $am_aux_dir in
57430f8ce46Smrg  *\ * | *\	*)
57530f8ce46Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
57630f8ce46Smrg  *)
57730f8ce46Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
57830f8ce46Smrg  esac
57930f8ce46Smrgfi
580bbe1b32bSmrgAC_SUBST(install_sh)])
581bbe1b32bSmrg
582bbe1b32bSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
583bbe1b32bSmrg#
584bbe1b32bSmrg# This file is free software; the Free Software Foundation
585bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
586bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
587bbe1b32bSmrg
588bbe1b32bSmrg# serial 2
589bbe1b32bSmrg
590bbe1b32bSmrg# Check whether the underlying file-system supports filenames
591bbe1b32bSmrg# with a leading dot.  For instance MS-DOS doesn't.
592bbe1b32bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
593bbe1b32bSmrg[rm -rf .tst 2>/dev/null
594bbe1b32bSmrgmkdir .tst 2>/dev/null
595bbe1b32bSmrgif test -d .tst; then
596bbe1b32bSmrg  am__leading_dot=.
597bbe1b32bSmrgelse
598bbe1b32bSmrg  am__leading_dot=_
599bbe1b32bSmrgfi
600bbe1b32bSmrgrmdir .tst 2>/dev/null
601bbe1b32bSmrgAC_SUBST([am__leading_dot])])
602bbe1b32bSmrg
603bbe1b32bSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
604bbe1b32bSmrg# From Jim Meyering
605bbe1b32bSmrg
60634f90d55Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
60734f90d55Smrg# 2011 Free Software Foundation, Inc.
608bbe1b32bSmrg#
609bbe1b32bSmrg# This file is free software; the Free Software Foundation
610bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
611bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
612bbe1b32bSmrg
61330f8ce46Smrg# serial 5
614bbe1b32bSmrg
61530f8ce46Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
61630f8ce46Smrg# ----------------------------------
61730f8ce46Smrg# Control maintainer-specific portions of Makefiles.
61830f8ce46Smrg# Default is to disable them, unless `enable' is passed literally.
61930f8ce46Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
62030f8ce46Smrg# can override the default with the --enable/--disable switch.
621bbe1b32bSmrgAC_DEFUN([AM_MAINTAINER_MODE],
62230f8ce46Smrg[m4_case(m4_default([$1], [disable]),
62330f8ce46Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
62430f8ce46Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
62530f8ce46Smrg       [m4_define([am_maintainer_other], [enable])
62630f8ce46Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
62734f90d55SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
62830f8ce46Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
62930f8ce46Smrg  AC_ARG_ENABLE([maintainer-mode],
63030f8ce46Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
631bbe1b32bSmrg			  (and sometimes confusing) to the casual installer],
63230f8ce46Smrg      [USE_MAINTAINER_MODE=$enableval],
63330f8ce46Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634bbe1b32bSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
63530f8ce46Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636bbe1b32bSmrg  MAINT=$MAINTAINER_MODE_TRUE
63730f8ce46Smrg  AC_SUBST([MAINT])dnl
638bbe1b32bSmrg]
639bbe1b32bSmrg)
640bbe1b32bSmrg
641bbe1b32bSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
642bbe1b32bSmrg
643bbe1b32bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644bbe1b32bSmrg
64530f8ce46Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
646bbe1b32bSmrg#
647bbe1b32bSmrg# This file is free software; the Free Software Foundation
648bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
649bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
650bbe1b32bSmrg
65130f8ce46Smrg# serial 4
652bbe1b32bSmrg
653bbe1b32bSmrg# AM_MAKE_INCLUDE()
654bbe1b32bSmrg# -----------------
655bbe1b32bSmrg# Check to see how make treats includes.
656bbe1b32bSmrgAC_DEFUN([AM_MAKE_INCLUDE],
657bbe1b32bSmrg[am_make=${MAKE-make}
658bbe1b32bSmrgcat > confinc << 'END'
659bbe1b32bSmrgam__doit:
66030f8ce46Smrg	@echo this is the am__doit target
661bbe1b32bSmrg.PHONY: am__doit
662bbe1b32bSmrgEND
663bbe1b32bSmrg# If we don't find an include directive, just comment out the code.
664bbe1b32bSmrgAC_MSG_CHECKING([for style of include used by $am_make])
665bbe1b32bSmrgam__include="#"
666bbe1b32bSmrgam__quote=
667bbe1b32bSmrg_am_result=none
668bbe1b32bSmrg# First try GNU make style include.
669bbe1b32bSmrgecho "include confinc" > confmf
67030f8ce46Smrg# Ignore all kinds of additional output from `make'.
67130f8ce46Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
67230f8ce46Smrg*the\ am__doit\ target*)
67330f8ce46Smrg  am__include=include
67430f8ce46Smrg  am__quote=
67530f8ce46Smrg  _am_result=GNU
67630f8ce46Smrg  ;;
67730f8ce46Smrgesac
678bbe1b32bSmrg# Now try BSD make style include.
679bbe1b32bSmrgif test "$am__include" = "#"; then
680bbe1b32bSmrg   echo '.include "confinc"' > confmf
68130f8ce46Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
68230f8ce46Smrg   *the\ am__doit\ target*)
68330f8ce46Smrg     am__include=.include
68430f8ce46Smrg     am__quote="\""
68530f8ce46Smrg     _am_result=BSD
68630f8ce46Smrg     ;;
68730f8ce46Smrg   esac
688bbe1b32bSmrgfi
689bbe1b32bSmrgAC_SUBST([am__include])
690bbe1b32bSmrgAC_SUBST([am__quote])
691bbe1b32bSmrgAC_MSG_RESULT([$_am_result])
692bbe1b32bSmrgrm -f confinc confmf
693bbe1b32bSmrg])
694bbe1b32bSmrg
695bbe1b32bSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
696bbe1b32bSmrg
69730f8ce46Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
698bbe1b32bSmrg# Free Software Foundation, Inc.
699bbe1b32bSmrg#
700bbe1b32bSmrg# This file is free software; the Free Software Foundation
701bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
702bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
703bbe1b32bSmrg
70430f8ce46Smrg# serial 6
705bbe1b32bSmrg
706bbe1b32bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
707bbe1b32bSmrg# ------------------------------
708bbe1b32bSmrgAC_DEFUN([AM_MISSING_PROG],
709bbe1b32bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710bbe1b32bSmrg$1=${$1-"${am_missing_run}$2"}
711bbe1b32bSmrgAC_SUBST($1)])
712bbe1b32bSmrg
713bbe1b32bSmrg
714bbe1b32bSmrg# AM_MISSING_HAS_RUN
715bbe1b32bSmrg# ------------------
716bbe1b32bSmrg# Define MISSING if not defined so far and test if it supports --run.
717bbe1b32bSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
718bbe1b32bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
719bbe1b32bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
720bbe1b32bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72130f8ce46Smrgif test x"${MISSING+set}" != xset; then
72230f8ce46Smrg  case $am_aux_dir in
72330f8ce46Smrg  *\ * | *\	*)
72430f8ce46Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72530f8ce46Smrg  *)
72630f8ce46Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72730f8ce46Smrg  esac
72830f8ce46Smrgfi
729bbe1b32bSmrg# Use eval to expand $SHELL
730bbe1b32bSmrgif eval "$MISSING --run true"; then
731bbe1b32bSmrg  am_missing_run="$MISSING --run "
732bbe1b32bSmrgelse
733bbe1b32bSmrg  am_missing_run=
734bbe1b32bSmrg  AC_MSG_WARN([`missing' script is too old or missing])
735bbe1b32bSmrgfi
736bbe1b32bSmrg])
737bbe1b32bSmrg
73834f90d55Smrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
73934f90d55Smrg# Inc.
740bbe1b32bSmrg#
741bbe1b32bSmrg# This file is free software; the Free Software Foundation
742bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
743bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
744bbe1b32bSmrg
74534f90d55Smrg# serial 1
74634f90d55Smrg
747bbe1b32bSmrg# AM_PROG_MKDIR_P
748bbe1b32bSmrg# ---------------
749bbe1b32bSmrg# Check for `mkdir -p'.
750bbe1b32bSmrgAC_DEFUN([AM_PROG_MKDIR_P],
751bbe1b32bSmrg[AC_PREREQ([2.60])dnl
752bbe1b32bSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
753bbe1b32bSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
754bbe1b32bSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
755bbe1b32bSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
756bbe1b32bSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
757bbe1b32bSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
758bbe1b32bSmrgdnl adjustment using top_builddir (which is defined more often than
759bbe1b32bSmrgdnl MKDIR_P).
760bbe1b32bSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
761bbe1b32bSmrgcase $mkdir_p in
762bbe1b32bSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
763bbe1b32bSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
764bbe1b32bSmrgesac
765bbe1b32bSmrg])
766bbe1b32bSmrg
767bbe1b32bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
768bbe1b32bSmrg
76934f90d55Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
77034f90d55Smrg# Foundation, Inc.
771bbe1b32bSmrg#
772bbe1b32bSmrg# This file is free software; the Free Software Foundation
773bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
774bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
775bbe1b32bSmrg
77634f90d55Smrg# serial 5
777bbe1b32bSmrg
778bbe1b32bSmrg# _AM_MANGLE_OPTION(NAME)
779bbe1b32bSmrg# -----------------------
780bbe1b32bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
781bbe1b32bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782bbe1b32bSmrg
783bbe1b32bSmrg# _AM_SET_OPTION(NAME)
78434f90d55Smrg# --------------------
785bbe1b32bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
786bbe1b32bSmrgAC_DEFUN([_AM_SET_OPTION],
787bbe1b32bSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
788bbe1b32bSmrg
789bbe1b32bSmrg# _AM_SET_OPTIONS(OPTIONS)
79034f90d55Smrg# ------------------------
791bbe1b32bSmrg# OPTIONS is a space-separated list of Automake options.
792bbe1b32bSmrgAC_DEFUN([_AM_SET_OPTIONS],
79330f8ce46Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794bbe1b32bSmrg
795bbe1b32bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
796bbe1b32bSmrg# -------------------------------------------
797bbe1b32bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
798bbe1b32bSmrgAC_DEFUN([_AM_IF_OPTION],
799bbe1b32bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800bbe1b32bSmrg
801bbe1b32bSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
802bbe1b32bSmrg
80330f8ce46Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
804bbe1b32bSmrg# Free Software Foundation, Inc.
805bbe1b32bSmrg#
806bbe1b32bSmrg# This file is free software; the Free Software Foundation
807bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
808bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
809bbe1b32bSmrg
81030f8ce46Smrg# serial 5
811bbe1b32bSmrg
812bbe1b32bSmrg# AM_SANITY_CHECK
813bbe1b32bSmrg# ---------------
814bbe1b32bSmrgAC_DEFUN([AM_SANITY_CHECK],
815bbe1b32bSmrg[AC_MSG_CHECKING([whether build environment is sane])
816bbe1b32bSmrg# Just in case
817bbe1b32bSmrgsleep 1
818bbe1b32bSmrgecho timestamp > conftest.file
81930f8ce46Smrg# Reject unsafe characters in $srcdir or the absolute working directory
82030f8ce46Smrg# name.  Accept space and tab only in the latter.
82130f8ce46Smrgam_lf='
82230f8ce46Smrg'
82330f8ce46Smrgcase `pwd` in
82430f8ce46Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
82530f8ce46Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
82630f8ce46Smrgesac
82730f8ce46Smrgcase $srcdir in
82830f8ce46Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
82930f8ce46Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
83030f8ce46Smrgesac
83130f8ce46Smrg
832bbe1b32bSmrg# Do `set' in a subshell so we don't clobber the current shell's
833bbe1b32bSmrg# arguments.  Must try -L first in case configure is actually a
834bbe1b32bSmrg# symlink; some systems play weird games with the mod time of symlinks
835bbe1b32bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
836bbe1b32bSmrg# directory).
837bbe1b32bSmrgif (
83830f8ce46Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
839bbe1b32bSmrg   if test "$[*]" = "X"; then
840bbe1b32bSmrg      # -L didn't work.
84130f8ce46Smrg      set X `ls -t "$srcdir/configure" conftest.file`
842bbe1b32bSmrg   fi
843bbe1b32bSmrg   rm -f conftest.file
844bbe1b32bSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
845bbe1b32bSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
846bbe1b32bSmrg
847bbe1b32bSmrg      # If neither matched, then we have a broken ls.  This can happen
848bbe1b32bSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
849bbe1b32bSmrg      # broken ls alias from the environment.  This has actually
850bbe1b32bSmrg      # happened.  Such a system could not be considered "sane".
851bbe1b32bSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
852bbe1b32bSmrgalias in your environment])
853bbe1b32bSmrg   fi
854bbe1b32bSmrg
855bbe1b32bSmrg   test "$[2]" = conftest.file
856bbe1b32bSmrg   )
857bbe1b32bSmrgthen
858bbe1b32bSmrg   # Ok.
859bbe1b32bSmrg   :
860bbe1b32bSmrgelse
861bbe1b32bSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
862bbe1b32bSmrgCheck your system clock])
863bbe1b32bSmrgfi
864bbe1b32bSmrgAC_MSG_RESULT(yes)])
865bbe1b32bSmrg
86630f8ce46Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
86730f8ce46Smrg#
86830f8ce46Smrg# This file is free software; the Free Software Foundation
86930f8ce46Smrg# gives unlimited permission to copy and/or distribute it,
87030f8ce46Smrg# with or without modifications, as long as this notice is preserved.
87130f8ce46Smrg
87230f8ce46Smrg# serial 1
87330f8ce46Smrg
87430f8ce46Smrg# AM_SILENT_RULES([DEFAULT])
87530f8ce46Smrg# --------------------------
87630f8ce46Smrg# Enable less verbose build rules; with the default set to DEFAULT
87730f8ce46Smrg# (`yes' being less verbose, `no' or empty being verbose).
87830f8ce46SmrgAC_DEFUN([AM_SILENT_RULES],
87930f8ce46Smrg[AC_ARG_ENABLE([silent-rules],
88030f8ce46Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
88130f8ce46Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
88230f8ce46Smrgcase $enable_silent_rules in
88330f8ce46Smrgyes) AM_DEFAULT_VERBOSITY=0;;
88430f8ce46Smrgno)  AM_DEFAULT_VERBOSITY=1;;
88530f8ce46Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
88630f8ce46Smrgesac
88730f8ce46SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
88830f8ce46SmrgAM_BACKSLASH='\'
88930f8ce46SmrgAC_SUBST([AM_BACKSLASH])dnl
89030f8ce46Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
89130f8ce46Smrg])
89230f8ce46Smrg
89334f90d55Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
894bbe1b32bSmrg#
895bbe1b32bSmrg# This file is free software; the Free Software Foundation
896bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
897bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
898bbe1b32bSmrg
89934f90d55Smrg# serial 1
90034f90d55Smrg
901bbe1b32bSmrg# AM_PROG_INSTALL_STRIP
902bbe1b32bSmrg# ---------------------
903bbe1b32bSmrg# One issue with vendor `install' (even GNU) is that you can't
904bbe1b32bSmrg# specify the program used to strip binaries.  This is especially
905bbe1b32bSmrg# annoying in cross-compiling environments, where the build's strip
906bbe1b32bSmrg# is unlikely to handle the host's binaries.
907bbe1b32bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
908bbe1b32bSmrg# always use install-sh in `make install-strip', and initialize
909bbe1b32bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
910bbe1b32bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
911bbe1b32bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
912bbe1b32bSmrg# Installed binaries are usually stripped using `strip' when the user
913bbe1b32bSmrg# run `make install-strip'.  However `strip' might not be the right
914bbe1b32bSmrg# tool to use in cross-compilation environments, therefore Automake
915bbe1b32bSmrg# will honor the `STRIP' environment variable to overrule this program.
916bbe1b32bSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
917bbe1b32bSmrgif test "$cross_compiling" != no; then
918bbe1b32bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
919bbe1b32bSmrgfi
920bbe1b32bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
921bbe1b32bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
922bbe1b32bSmrg
92334f90d55Smrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
92430f8ce46Smrg#
92530f8ce46Smrg# This file is free software; the Free Software Foundation
92630f8ce46Smrg# gives unlimited permission to copy and/or distribute it,
92730f8ce46Smrg# with or without modifications, as long as this notice is preserved.
92830f8ce46Smrg
92934f90d55Smrg# serial 3
93030f8ce46Smrg
93130f8ce46Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
93230f8ce46Smrg# ---------------------------
93330f8ce46Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
93430f8ce46Smrg# This macro is traced by Automake.
93530f8ce46SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
93630f8ce46Smrg
93730f8ce46Smrg# AM_SUBST_NOTMAKE(VARIABLE)
93834f90d55Smrg# --------------------------
93930f8ce46Smrg# Public sister of _AM_SUBST_NOTMAKE.
94030f8ce46SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
94130f8ce46Smrg
94230f8ce46Smrg# Check how to create a tarball.                            -*- Autoconf -*-
94330f8ce46Smrg
94430f8ce46Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
94530f8ce46Smrg#
94630f8ce46Smrg# This file is free software; the Free Software Foundation
94730f8ce46Smrg# gives unlimited permission to copy and/or distribute it,
94830f8ce46Smrg# with or without modifications, as long as this notice is preserved.
94930f8ce46Smrg
95030f8ce46Smrg# serial 2
95130f8ce46Smrg
95230f8ce46Smrg# _AM_PROG_TAR(FORMAT)
95330f8ce46Smrg# --------------------
95430f8ce46Smrg# Check how to create a tarball in format FORMAT.
95530f8ce46Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
95630f8ce46Smrg#
95730f8ce46Smrg# Substitute a variable $(am__tar) that is a command
95830f8ce46Smrg# writing to stdout a FORMAT-tarball containing the directory
95930f8ce46Smrg# $tardir.
96030f8ce46Smrg#     tardir=directory && $(am__tar) > result.tar
96130f8ce46Smrg#
96230f8ce46Smrg# Substitute a variable $(am__untar) that extract such
96330f8ce46Smrg# a tarball read from stdin.
96430f8ce46Smrg#     $(am__untar) < result.tar
96530f8ce46SmrgAC_DEFUN([_AM_PROG_TAR],
96630f8ce46Smrg[# Always define AMTAR for backward compatibility.
96730f8ce46SmrgAM_MISSING_PROG([AMTAR], [tar])
96830f8ce46Smrgm4_if([$1], [v7],
96930f8ce46Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
97030f8ce46Smrg     [m4_case([$1], [ustar],, [pax],,
97130f8ce46Smrg              [m4_fatal([Unknown tar format])])
97230f8ce46SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
97330f8ce46Smrg# Loop over all known methods to create a tar archive until one works.
97430f8ce46Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
97530f8ce46Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
97630f8ce46Smrg# Do not fold the above two line into one, because Tru64 sh and
97730f8ce46Smrg# Solaris sh will not grok spaces in the rhs of `-'.
97830f8ce46Smrgfor _am_tool in $_am_tools
97930f8ce46Smrgdo
98030f8ce46Smrg  case $_am_tool in
98130f8ce46Smrg  gnutar)
98230f8ce46Smrg    for _am_tar in tar gnutar gtar;
98330f8ce46Smrg    do
98430f8ce46Smrg      AM_RUN_LOG([$_am_tar --version]) && break
98530f8ce46Smrg    done
98630f8ce46Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
98730f8ce46Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
98830f8ce46Smrg    am__untar="$_am_tar -xf -"
98930f8ce46Smrg    ;;
99030f8ce46Smrg  plaintar)
99130f8ce46Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
99230f8ce46Smrg    # ustar tarball either.
99330f8ce46Smrg    (tar --version) >/dev/null 2>&1 && continue
99430f8ce46Smrg    am__tar='tar chf - "$$tardir"'
99530f8ce46Smrg    am__tar_='tar chf - "$tardir"'
99630f8ce46Smrg    am__untar='tar xf -'
99730f8ce46Smrg    ;;
99830f8ce46Smrg  pax)
99930f8ce46Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
100030f8ce46Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
100130f8ce46Smrg    am__untar='pax -r'
100230f8ce46Smrg    ;;
100330f8ce46Smrg  cpio)
100430f8ce46Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
100530f8ce46Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
100630f8ce46Smrg    am__untar='cpio -i -H $1 -d'
100730f8ce46Smrg    ;;
100830f8ce46Smrg  none)
100930f8ce46Smrg    am__tar=false
101030f8ce46Smrg    am__tar_=false
101130f8ce46Smrg    am__untar=false
101230f8ce46Smrg    ;;
101330f8ce46Smrg  esac
101430f8ce46Smrg
101530f8ce46Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
101630f8ce46Smrg  # and am__untar set.
101730f8ce46Smrg  test -n "${am_cv_prog_tar_$1}" && break
101830f8ce46Smrg
101930f8ce46Smrg  # tar/untar a dummy directory, and stop if the command works
102030f8ce46Smrg  rm -rf conftest.dir
102130f8ce46Smrg  mkdir conftest.dir
102230f8ce46Smrg  echo GrepMe > conftest.dir/file
102330f8ce46Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
102430f8ce46Smrg  rm -rf conftest.dir
102530f8ce46Smrg  if test -s conftest.tar; then
102630f8ce46Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
102730f8ce46Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
102830f8ce46Smrg  fi
102930f8ce46Smrgdone
103030f8ce46Smrgrm -rf conftest.dir
103130f8ce46Smrg
103230f8ce46SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
103330f8ce46SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
103430f8ce46SmrgAC_SUBST([am__tar])
103530f8ce46SmrgAC_SUBST([am__untar])
103630f8ce46Smrg]) # _AM_PROG_TAR
103730f8ce46Smrg
103830f8ce46Smrgm4_include([m4/ax_define_dir.m4])
103934f90d55Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
104034f90d55Smrg# 
104134f90d55Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
104234f90d55Smrg#
104334f90d55Smrg# This program is free software; you can redistribute it and/or modify
104434f90d55Smrg# it under the terms of the GNU General Public License as published by
104534f90d55Smrg# the Free Software Foundation; either version 2 of the License, or
104634f90d55Smrg# (at your option) any later version.
104734f90d55Smrg#
104834f90d55Smrg# This program is distributed in the hope that it will be useful, but
104934f90d55Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
105034f90d55Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
105134f90d55Smrg# General Public License for more details.
105234f90d55Smrg#
105334f90d55Smrg# You should have received a copy of the GNU General Public License
105434f90d55Smrg# along with this program; if not, write to the Free Software
105534f90d55Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
105634f90d55Smrg#
105734f90d55Smrg# As a special exception to the GNU General Public License, if you
105834f90d55Smrg# distribute this file as part of a program that contains a
105934f90d55Smrg# configuration script generated by Autoconf, you may include it under
106034f90d55Smrg# the same distribution terms that you use for the rest of that program.
106134f90d55Smrg
106234f90d55Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
106334f90d55Smrg# ----------------------------------
106434f90d55SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
106534f90d55Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
106634f90d55Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
106734f90d55SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
106834f90d55Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
106934f90d55Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
107034f90d55Smrgfi
107134f90d55Smrgif test -n "$PKG_CONFIG"; then
107234f90d55Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
107334f90d55Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
107434f90d55Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
107534f90d55Smrg		AC_MSG_RESULT([yes])
107634f90d55Smrg	else
107734f90d55Smrg		AC_MSG_RESULT([no])
107834f90d55Smrg		PKG_CONFIG=""
107934f90d55Smrg	fi
108034f90d55Smrg		
108134f90d55Smrgfi[]dnl
108234f90d55Smrg])# PKG_PROG_PKG_CONFIG
108334f90d55Smrg
108434f90d55Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
108534f90d55Smrg#
108634f90d55Smrg# Check to see whether a particular set of modules exists.  Similar
108734f90d55Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
108834f90d55Smrg#
108934f90d55Smrg#
109034f90d55Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
109134f90d55Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
109234f90d55Smrg# PKG_CHECK_EXISTS manually
109334f90d55Smrg# --------------------------------------------------------------
109434f90d55SmrgAC_DEFUN([PKG_CHECK_EXISTS],
109534f90d55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
109634f90d55Smrgif test -n "$PKG_CONFIG" && \
109734f90d55Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
109834f90d55Smrg  m4_ifval([$2], [$2], [:])
109934f90d55Smrgm4_ifvaln([$3], [else
110034f90d55Smrg  $3])dnl
110134f90d55Smrgfi])
110234f90d55Smrg
110334f90d55Smrg
110434f90d55Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
110534f90d55Smrg# ---------------------------------------------
110634f90d55Smrgm4_define([_PKG_CONFIG],
110734f90d55Smrg[if test -n "$$1"; then
110834f90d55Smrg    pkg_cv_[]$1="$$1"
110934f90d55Smrg elif test -n "$PKG_CONFIG"; then
111034f90d55Smrg    PKG_CHECK_EXISTS([$3],
111134f90d55Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
111234f90d55Smrg		     [pkg_failed=yes])
111334f90d55Smrg else
111434f90d55Smrg    pkg_failed=untried
111534f90d55Smrgfi[]dnl
111634f90d55Smrg])# _PKG_CONFIG
111734f90d55Smrg
111834f90d55Smrg# _PKG_SHORT_ERRORS_SUPPORTED
111934f90d55Smrg# -----------------------------
112034f90d55SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
112134f90d55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
112234f90d55Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
112334f90d55Smrg        _pkg_short_errors_supported=yes
112434f90d55Smrgelse
112534f90d55Smrg        _pkg_short_errors_supported=no
112634f90d55Smrgfi[]dnl
112734f90d55Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
112834f90d55Smrg
112934f90d55Smrg
113034f90d55Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
113134f90d55Smrg# [ACTION-IF-NOT-FOUND])
113234f90d55Smrg#
113334f90d55Smrg#
113434f90d55Smrg# Note that if there is a possibility the first call to
113534f90d55Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
113634f90d55Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
113734f90d55Smrg#
113834f90d55Smrg#
113934f90d55Smrg# --------------------------------------------------------------
114034f90d55SmrgAC_DEFUN([PKG_CHECK_MODULES],
114134f90d55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
114234f90d55SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
114334f90d55SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
114434f90d55Smrg
114534f90d55Smrgpkg_failed=no
114634f90d55SmrgAC_MSG_CHECKING([for $1])
114734f90d55Smrg
114834f90d55Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
114934f90d55Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
115034f90d55Smrg
115134f90d55Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
115234f90d55Smrgand $1[]_LIBS to avoid the need to call pkg-config.
115334f90d55SmrgSee the pkg-config man page for more details.])
115434f90d55Smrg
115534f90d55Smrgif test $pkg_failed = yes; then
115634f90d55Smrg        _PKG_SHORT_ERRORS_SUPPORTED
115734f90d55Smrg        if test $_pkg_short_errors_supported = yes; then
115834f90d55Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
115934f90d55Smrg        else 
116034f90d55Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
116134f90d55Smrg        fi
116234f90d55Smrg	# Put the nasty error message in config.log where it belongs
116334f90d55Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
116434f90d55Smrg
116534f90d55Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
116634f90d55Smrg[Package requirements ($2) were not met:
116734f90d55Smrg
116834f90d55Smrg$$1_PKG_ERRORS
116934f90d55Smrg
117034f90d55SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
117134f90d55Smrginstalled software in a non-standard prefix.
117234f90d55Smrg
117334f90d55Smrg_PKG_TEXT
117434f90d55Smrg])],
117534f90d55Smrg		[AC_MSG_RESULT([no])
117634f90d55Smrg                $4])
117734f90d55Smrgelif test $pkg_failed = untried; then
117834f90d55Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
117934f90d55Smrg[The pkg-config script could not be found or is too old.  Make sure it
118034f90d55Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
118134f90d55Smrgpath to pkg-config.
118234f90d55Smrg
118334f90d55Smrg_PKG_TEXT
118434f90d55Smrg
118534f90d55SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
118634f90d55Smrg		[$4])
118734f90d55Smrgelse
118834f90d55Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
118934f90d55Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
119034f90d55Smrg        AC_MSG_RESULT([yes])
119134f90d55Smrg	ifelse([$3], , :, [$3])
119234f90d55Smrgfi[]dnl
119334f90d55Smrg])# PKG_CHECK_MODULES
119434f90d55Smrg
119530f8ce46Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
119630f8ce46Smrgdnl
119734f90d55Smrgdnl This file comes from X.Org's font-util 1.3.0
119830f8ce46Smrgdnl
119930f8ce46Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
120030f8ce46Smrgdnl
120130f8ce46Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
120230f8ce46Smrgdnl copy of this software and associated documentation files (the "Software"),
120330f8ce46Smrgdnl to deal in the Software without restriction, including without limitation
120430f8ce46Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
120530f8ce46Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
120630f8ce46Smrgdnl Software is furnished to do so, subject to the following conditions:
120730f8ce46Smrgdnl
120830f8ce46Smrgdnl The above copyright notice and this permission notice (including the next
120930f8ce46Smrgdnl paragraph) shall be included in all copies or substantial portions of the
121030f8ce46Smrgdnl Software.
121130f8ce46Smrgdnl
121230f8ce46Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
121330f8ce46Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
121430f8ce46Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
121530f8ce46Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121630f8ce46Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
121730f8ce46Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
121830f8ce46Smrgdnl DEALINGS IN THE SOFTWARE.
121930f8ce46Smrgdnl
122030f8ce46Smrgdnl --------------------------------------------------------------------
122130f8ce46Smrgdnl
122230f8ce46Smrgdnl Copyright 2005 Red Hat, Inc
122330f8ce46Smrgdnl
122430f8ce46Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
122530f8ce46Smrgdnl documentation for any purpose is hereby granted without fee, provided that
122630f8ce46Smrgdnl the above copyright notice appear in all copies and that both that
122730f8ce46Smrgdnl copyright notice and this permission notice appear in supporting
122830f8ce46Smrgdnl documentation.
122930f8ce46Smrgdnl
123030f8ce46Smrgdnl The above copyright notice and this permission notice shall be included
123130f8ce46Smrgdnl in all copies or substantial portions of the Software.
123230f8ce46Smrgdnl
123330f8ce46Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
123430f8ce46Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
123530f8ce46Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
123630f8ce46Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
123730f8ce46Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
123830f8ce46Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
123930f8ce46Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
124030f8ce46Smrgdnl
124130f8ce46Smrgdnl Except as contained in this notice, the name of the copyright holders shall
124230f8ce46Smrgdnl not be used in advertising or otherwise to promote the sale, use or
124330f8ce46Smrgdnl other dealings in this Software without prior written authorization
124430f8ce46Smrgdnl from the copyright holders.
124530f8ce46Smrg
124630f8ce46Smrg# XORG_FONT_MACROS_VERSION(required-version)
124730f8ce46Smrg# ------------------------------------------
124830f8ce46Smrg# Minimum version: 1.1.0
124930f8ce46Smrg#
125030f8ce46Smrg# If you're using a macro added in Version 1.1 or newer, include this in
125130f8ce46Smrg# your configure.ac with the minimum required version, such as:
125230f8ce46Smrg# XORG_FONT_MACROS_VERSION(1.1)
125330f8ce46Smrg#
125430f8ce46Smrg# To ensure that this macro is defined, also add:
125530f8ce46Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
125630f8ce46Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
125730f8ce46Smrg#
125830f8ce46Smrg#
125930f8ce46Smrg# See the "minimum version" comment for each macro you use to see what
126030f8ce46Smrg# version you require.
126130f8ce46Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
126234f90d55Smrgm4_define([vers_have], [1.3.0])
126330f8ce46Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
126430f8ce46Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
126530f8ce46Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
126630f8ce46Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
126730f8ce46Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
126830f8ce46Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
126930f8ce46Smrgm4_undefine([vers_have])
127030f8ce46Smrgm4_undefine([maj_have])
127130f8ce46Smrgm4_undefine([maj_needed])
127230f8ce46Smrg]) # XORG_FONT_MACROS_VERSION
127330f8ce46Smrg
127430f8ce46Smrg# XORG_FONT_CHECK_{maps}()
127530f8ce46Smrg# ------------------------
127630f8ce46Smrg# Minimum version: 1.0.0
127730f8ce46Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
127830f8ce46Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
127930f8ce46Smrg
128030f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
128130f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
128230f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
128330f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
128430f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
128530f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
128630f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
128730f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
128830f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
128930f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
129030f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
129130f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
129230f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
129330f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
129430f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
129530f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
129630f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
129730f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
129830f8ce46Smrg
129930f8ce46Smrg# XORG_FONT_CHECK_ENCODING(encoding)
130030f8ce46Smrg# ----------------------------------
130130f8ce46Smrg# Minimum version: 1.1.0
130230f8ce46Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
130330f8ce46Smrg# It replaced individual copies of this code in the above macros in 1.1.
130430f8ce46Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
130530f8ce46Smrg# calls if this is not true in the future.
130630f8ce46Smrg
130730f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
130830f8ce46Smrg	AC_ARG_ENABLE(m4_tolower($1),
130930f8ce46Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
131030f8ce46Smrg				[Build $1 fonts (default: yes)]),
131130f8ce46Smrg		[AS_TR_SH($1)=$enableval])
131230f8ce46Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
131330f8ce46Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
131430f8ce46Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
131530f8ce46Smrg]) # XORG_FONT_CHECK_ENCODING
131630f8ce46Smrg
131730f8ce46Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
131830f8ce46Smrg# -----------------------------------------------------
131930f8ce46Smrg# Minimum version: 1.1.0
132030f8ce46Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
132130f8ce46Smrg# Add a shorthand --enable/disable-all-encodings option.
132230f8ce46Smrg
132330f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
132430f8ce46Smrg	AC_ARG_ENABLE([all-encodings],
132530f8ce46Smrg		AS_HELP_STRING([--disable-all-encodings],
132630f8ce46Smrg				[Disable building of all font encodings]),
132730f8ce46Smrg		[m4_foreach_w([enc], [$1], [
132830f8ce46Smrg			AS_TR_SH(enc)=$enableval
132930f8ce46Smrg		])],
133030f8ce46Smrg		[m4_foreach_w([enc], [$1], [
133130f8ce46Smrg			AS_TR_SH(enc)=yes
133230f8ce46Smrg		])])
133330f8ce46Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
133430f8ce46Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
133530f8ce46Smrg
133630f8ce46Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
133730f8ce46Smrg# ------------------------------------------
133830f8ce46Smrg# Minimum version: 1.1.0
133930f8ce46Smrg#
134030f8ce46Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
134130f8ce46Smrg#
134230f8ce46Smrg
134330f8ce46SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
134430f8ce46Smrg	AC_PATH_PROG($1, $2)
134530f8ce46Smrg	if test x"$$1" = x; then
134630f8ce46Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
134730f8ce46Smrg	fi
134830f8ce46Smrg])
134930f8ce46Smrg
135030f8ce46Smrg
135130f8ce46Smrg# XORG_FONT_FCCACHE()
135230f8ce46Smrg# -------------------
135330f8ce46Smrg# Minimum version: 1.1.0
135430f8ce46Smrg#
135530f8ce46Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
135630f8ce46Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
135734f90d55Smrg# to run fc-cache if found and not installing to $DESTDIR and not
135834f90d55Smrg# cross-compiling
135930f8ce46Smrg#
136030f8ce46Smrg# fc-cache is optional, not required, and should be skipped when making
136134f90d55Smrg# packages (installing to $DESTDIR) or cross-compiling
136230f8ce46Smrg#
136330f8ce46SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
136430f8ce46Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
136530f8ce46Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
136634f90d55Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
136730f8ce46Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
136830f8ce46Smrg	else
136930f8ce46Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
137030f8ce46Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
137130f8ce46Smrg	fi
137230f8ce46Smrg	AC_SUBST([RUN_FCCACHE])
137330f8ce46Smrg])
137430f8ce46Smrg
137534f90d55Smrg# XORG_FONT_MKFONTDIR()
137634f90d55Smrg# -------------------
137734f90d55Smrg# Minimum version: 1.3.0
137834f90d55Smrg#
137934f90d55Smrg# Set MKFONTDIR to path to mkfontdir.
138034f90d55Smrg#
138134f90d55Smrg# If cross-compiling, and if mkdir is not found, use a shell command
138234f90d55Smrg# which warns mkfontdir needs to be run on the target
138334f90d55Smrg#
138434f90d55Smrg# If not cross-compiling, mkfontdir must be found
138534f90d55Smrg#
138634f90d55SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
138734f90d55Smrg	if test x"$cross_compiling" != x"no" ; then
138834f90d55Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
138934f90d55Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
139034f90d55Smrg
139134f90d55Smrg		if test x"$MKFONTDIR" = x; then
139234f90d55Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
139334f90d55Smrg		fi
139434f90d55Smrg	else
139534f90d55Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
139634f90d55Smrg	fi
139734f90d55Smrg
139834f90d55Smrg	AC_SUBST([MKFONTDIR])
139934f90d55Smrg])
140030f8ce46Smrg
140130f8ce46Smrg# XORG_FONT_COMMON_UTILS()
140230f8ce46Smrg# ------------------------
140330f8ce46Smrg# Minimum version: 1.1.0
140430f8ce46Smrg#
140530f8ce46Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
140630f8ce46Smrg
140730f8ce46SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
140830f8ce46Smrg	XORG_FONT_FCCACHE
140934f90d55Smrg	XORG_FONT_MKFONTDIR
141030f8ce46Smrg])
141130f8ce46Smrg
141230f8ce46Smrg# XORG_FONT_SCALED_UTILS()
141330f8ce46Smrg# ------------------------
141430f8ce46Smrg# Minimum version: 1.1.0
141530f8ce46Smrg#
141630f8ce46Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
141730f8ce46Smrg# (TrueType, OpenType, Type1)
141830f8ce46Smrg
141930f8ce46SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
142030f8ce46Smrg	XORG_FONT_COMMON_UTILS
142130f8ce46Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
142230f8ce46Smrg])
142330f8ce46Smrg
142430f8ce46Smrg# XORG_FONT_BDF_UTILS()
142530f8ce46Smrg# ---------------------
142630f8ce46Smrg# Minimum version: 1.1.0
1427bbe1b32bSmrg#
142830f8ce46Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
142930f8ce46Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
143030f8ce46Smrg# PCF output files created by bdftopcf
1431bbe1b32bSmrg
143230f8ce46SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
143330f8ce46Smrg	XORG_FONT_COMMON_UTILS
143430f8ce46Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
143530f8ce46Smrg	XORG_FONT_CHECK_COMPRESSION
143630f8ce46Smrg])
1437bbe1b32bSmrg
143830f8ce46Smrg# XORG_FONT_CHECK_COMPRESSION()
143930f8ce46Smrg# -----------------------------
144030f8ce46Smrg# Minimum version: 1.1.0
144130f8ce46Smrg#
144230f8ce46Smrg# Offer a --with-compression flag to control what compression method is
144330f8ce46Smrg# used for pcf font files.   Offers all the methods currently supported
144430f8ce46Smrg# by libXfont, including no compression.
144530f8ce46Smrg
144630f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
144730f8ce46Smrg	AC_MSG_CHECKING([font compression method])
144830f8ce46Smrg	AC_ARG_WITH(compression,
144930f8ce46Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
145030f8ce46Smrg			 [compression method to use on pcf fonts])],
145130f8ce46Smrg         [compression="$withval"], [compression="yes"])
145230f8ce46Smrg	if test x"$compression" = "xyes" ; then
145330f8ce46Smrg		compression="gzip"
145430f8ce46Smrg	fi
145530f8ce46Smrg	AC_MSG_RESULT([${compression}])
145630f8ce46Smrg	case ${compression} in
145730f8ce46Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
145830f8ce46Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
145930f8ce46Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
146030f8ce46Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
146130f8ce46Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
146230f8ce46Smrg	esac
146330f8ce46Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
146430f8ce46Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
146530f8ce46Smrg	fi
146630f8ce46Smrg	AC_SUBST([COMPRESS_SUFFIX])
146730f8ce46Smrg])
1468bbe1b32bSmrg
146930f8ce46Smrg# XORG_FONT_UCS2ANY()
147030f8ce46Smrg# -------------------
147130f8ce46Smrg# Minimum version: 1.1.0
1472bbe1b32bSmrg#
147330f8ce46Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
147430f8ce46Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
147530f8ce46Smrg# Also call pkg-config to find the directory with the encoding files needed
147630f8ce46Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
147730f8ce46Smrg
147830f8ce46SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
147930f8ce46Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
148030f8ce46Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
148130f8ce46Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
148230f8ce46Smrg	MAPFILES_PATH=`pkg-config --variable=mapdir fontutil`
148330f8ce46Smrg	AC_SUBST(MAPFILES_PATH)
148430f8ce46Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
148530f8ce46Smrg])
1486bbe1b32bSmrg
1487bbe1b32bSmrg
148830f8ce46Smrg
148930f8ce46Smrg# XORG_FONT_FC_CONFDIR()
1490bbe1b32bSmrg# --------------------
149130f8ce46Smrg# Minimum version: 1.2.0
1492bbe1b32bSmrg#
149330f8ce46Smrg# Sets FC_CONFDIR to the fontconfig config directory
149430f8ce46Smrg# (which should be --with-confdir=... when building fontconfig)
149530f8ce46Smrg# found from:
149630f8ce46Smrg#	--with-fc-confdir=...
149730f8ce46Smrg#	pkg-config --variable=confdir fontconfig
149830f8ce46Smrg#	${sysconfdir}/fonts
149930f8ce46Smrg
150030f8ce46SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
150130f8ce46Smrg	dnl Ensure $PKG_CONFIG is set first
150230f8ce46Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
150330f8ce46Smrg
150430f8ce46Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
150530f8ce46Smrg	AC_ARG_WITH(fc-confdir,
150630f8ce46Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
150730f8ce46Smrg			   [Path to fontconfig's configuration directory]),
150830f8ce46Smrg		    [FC_CONFDIR="$withval"])
150930f8ce46Smrg	# if --with-fc-confdir was not specified
151030f8ce46Smrg	if test "x${FC_CONFDIR}" = "x"; then
151130f8ce46Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
151230f8ce46Smrg	fi
151330f8ce46Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
151430f8ce46Smrg	if test "x${FC_CONFDIR}" = "x"; then
151530f8ce46Smrg		FC_CONFDIR="${sysconfdir}/fonts"
151630f8ce46Smrg	fi
151730f8ce46Smrg	AC_SUBST(FC_CONFDIR)
151830f8ce46Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
151930f8ce46Smrg])
152030f8ce46Smrg
152130f8ce46Smrg
152230f8ce46Smrg
152330f8ce46Smrg# XORG_FONTROOTDIR()
152430f8ce46Smrg# --------------------
152530f8ce46Smrg# Minimum version: 1.1.0
1526bbe1b32bSmrg#
152730f8ce46Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
152830f8ce46Smrg# found from:
152930f8ce46Smrg#	--with-fontrootdir
153030f8ce46Smrg#	pkg-config --variable=fontrootdir fontutil
153130f8ce46Smrg#	${datadir}/fonts/X11
153230f8ce46Smrg
153330f8ce46SmrgAC_DEFUN([XORG_FONTROOTDIR],[
153430f8ce46Smrg	dnl Ensure $PKG_CONFIG is set first
153530f8ce46Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
153630f8ce46Smrg
153730f8ce46Smrg	AC_MSG_CHECKING([for root directory for font files])
153830f8ce46Smrg	AC_ARG_WITH(fontrootdir,
153930f8ce46Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
154030f8ce46Smrg			   [Path to root directory for font files]),
154130f8ce46Smrg		    [FONTROOTDIR="$withval"])
154230f8ce46Smrg	# if --with-fontrootdir not specified...
154330f8ce46Smrg	if test "x${FONTROOTDIR}" = "x"; then
154430f8ce46Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
154530f8ce46Smrg	fi
154630f8ce46Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
154730f8ce46Smrg	if test "x${FONTROOTDIR}" = "x"; then
154830f8ce46Smrg		FONTROOTDIR="${datadir}/fonts/X11"
154930f8ce46Smrg	fi
155030f8ce46Smrg	AC_SUBST(FONTROOTDIR)
155130f8ce46Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
155230f8ce46Smrg])
1553bbe1b32bSmrg
155430f8ce46Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
155530f8ce46Smrg# ---------------------------------------
155630f8ce46Smrg# Minimum version: 1.1.0
155730f8ce46Smrg#
155830f8ce46Smrg# Offer a --with-<flag> flag to control directory for font installation
155930f8ce46Smrg# Default is the specified <subdir> of the font root directory.
156030f8ce46Smrg# Sets <variable> to the selected directory
1561bbe1b32bSmrg
156230f8ce46SmrgAC_DEFUN([XORG_FONTSUBDIR],[
156330f8ce46Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
1564bbe1b32bSmrg
156530f8ce46Smrg	AC_MSG_CHECKING([for directory for $3 files])
156630f8ce46Smrg	AC_ARG_WITH($2,
156730f8ce46Smrg		    [AS_HELP_STRING([--with-$2=DIR],
156830f8ce46Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
156930f8ce46Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
157030f8ce46Smrg	AC_SUBST($1)
157130f8ce46Smrg	AC_MSG_RESULT([${$1}])
157230f8ce46Smrg]) # XORG_FONTSUBDIR
157330f8ce46Smrg
157430f8ce46Smrg# XORG_FONTDIR(subdir)
157530f8ce46Smrg# --------------------
157630f8ce46Smrg# Minimum version: 1.1.0
157730f8ce46Smrg#
157830f8ce46Smrg# Offer a --with-fontdir flag to control directory for font installation
157930f8ce46Smrg# Default is the specified subdir of the font root directory.
158030f8ce46Smrg# Sets FONTDIR to the selected directory
158130f8ce46Smrg
158230f8ce46SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1583bbe1b32bSmrg
1584ce6676dbSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585ce6676dbSmrgdnl
158630f8ce46Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1587ce6676dbSmrgdnl 
1588ce6676dbSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
158930f8ce46Smrgdnl copy of this software and associated documentation files (the "Software"),
159030f8ce46Smrgdnl to deal in the Software without restriction, including without limitation
159130f8ce46Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
159230f8ce46Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
159330f8ce46Smrgdnl Software is furnished to do so, subject to the following conditions:
1594ce6676dbSmrgdnl
159530f8ce46Smrgdnl The above copyright notice and this permission notice (including the next
159630f8ce46Smrgdnl paragraph) shall be included in all copies or substantial portions of the
159730f8ce46Smrgdnl Software.
1598ce6676dbSmrgdnl
159930f8ce46Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
160030f8ce46Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
160130f8ce46Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
160230f8ce46Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
160330f8ce46Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
160430f8ce46Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
160530f8ce46Smrgdnl DEALINGS IN THE SOFTWARE.
1606ce6676dbSmrg
1607ce6676dbSmrg# XORG_MACROS_VERSION(required-version)
1608ce6676dbSmrg# -------------------------------------
1609ce6676dbSmrg# Minimum version: 1.1.0
1610ce6676dbSmrg#
1611ce6676dbSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1612ce6676dbSmrg# your configure.ac with the minimum required version, such as:
1613ce6676dbSmrg# XORG_MACROS_VERSION(1.1)
1614ce6676dbSmrg#
1615ce6676dbSmrg# To ensure that this macro is defined, also add:
1616ce6676dbSmrg# m4_ifndef([XORG_MACROS_VERSION],
1617ce6676dbSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1618ce6676dbSmrg#
1619ce6676dbSmrg#
1620ce6676dbSmrg# See the "minimum version" comment for each macro you use to see what 
1621ce6676dbSmrg# version you require.
1622ce6676dbSmrgm4_defun([XORG_MACROS_VERSION],[
162334f90d55Smrgm4_define([vers_have], [1.17])
1624ce6676dbSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625ce6676dbSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626ce6676dbSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627ce6676dbSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628ce6676dbSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629ce6676dbSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630ce6676dbSmrgm4_undefine([vers_have])
1631ce6676dbSmrgm4_undefine([maj_have])
1632ce6676dbSmrgm4_undefine([maj_needed])
1633ce6676dbSmrg]) # XORG_MACROS_VERSION
1634ce6676dbSmrg
1635ce6676dbSmrg# XORG_PROG_RAWCPP()
1636ce6676dbSmrg# ------------------
1637ce6676dbSmrg# Minimum version: 1.0.0
1638ce6676dbSmrg#
1639ce6676dbSmrg# Find cpp program and necessary flags for use in pre-processing text files
1640ce6676dbSmrg# such as man pages and config files
1641ce6676dbSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642ce6676dbSmrgAC_REQUIRE([AC_PROG_CPP])
1643ce6676dbSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1644ce6676dbSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1645ce6676dbSmrg
1646ce6676dbSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647ce6676dbSmrg# which is not the best choice for supporting other OS'es, but covers most
1648ce6676dbSmrg# of the ones we need for now.
1649ce6676dbSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
165034f90d55SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651ce6676dbSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652ce6676dbSmrg	AC_MSG_RESULT([no])
1653ce6676dbSmrgelse
1654ce6676dbSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655ce6676dbSmrg		RAWCPPFLAGS=-undef
1656ce6676dbSmrg		AC_MSG_RESULT([yes])
1657ce6676dbSmrg	# under Cygwin unix is still defined even with -undef
1658ce6676dbSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659ce6676dbSmrg		RAWCPPFLAGS="-undef -ansi"
1660ce6676dbSmrg		AC_MSG_RESULT([yes, with -ansi])
1661ce6676dbSmrg	else
1662ce6676dbSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663ce6676dbSmrg	fi
1664ce6676dbSmrgfi
1665ce6676dbSmrgrm -f conftest.$ac_ext
1666ce6676dbSmrg
1667ce6676dbSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
166834f90d55SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1669ce6676dbSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1670ce6676dbSmrg	AC_MSG_RESULT([no])
1671ce6676dbSmrgelse
1672ce6676dbSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1673ce6676dbSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1674ce6676dbSmrg		AC_MSG_RESULT([yes])
1675ce6676dbSmrg	else
1676ce6676dbSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1677ce6676dbSmrg	fi
1678ce6676dbSmrgfi
1679ce6676dbSmrgrm -f conftest.$ac_ext
1680ce6676dbSmrgAC_SUBST(RAWCPPFLAGS)
1681ce6676dbSmrg]) # XORG_PROG_RAWCPP
1682ce6676dbSmrg
1683ce6676dbSmrg# XORG_MANPAGE_SECTIONS()
1684ce6676dbSmrg# -----------------------
1685ce6676dbSmrg# Minimum version: 1.0.0
1686ce6676dbSmrg#
1687ce6676dbSmrg# Determine which sections man pages go in for the different man page types
1688ce6676dbSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1689ce6676dbSmrg# Not sure if there's any better way than just hardcoding by OS name.
1690ce6676dbSmrg# Override default settings by setting environment variables
169130f8ce46Smrg# Added MAN_SUBSTS in version 1.8
169230f8ce46Smrg# Added AC_PROG_SED in version 1.8
1693ce6676dbSmrg
1694ce6676dbSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1695ce6676dbSmrgAC_REQUIRE([AC_CANONICAL_HOST])
169630f8ce46SmrgAC_REQUIRE([AC_PROG_SED])
1697ce6676dbSmrg
1698ce6676dbSmrgif test x$APP_MAN_SUFFIX = x    ; then
1699ce6676dbSmrg    APP_MAN_SUFFIX=1
1700ce6676dbSmrgfi
1701ce6676dbSmrgif test x$APP_MAN_DIR = x    ; then
1702ce6676dbSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1703ce6676dbSmrgfi
1704ce6676dbSmrg
1705ce6676dbSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1706ce6676dbSmrg    LIB_MAN_SUFFIX=3
1707ce6676dbSmrgfi
1708ce6676dbSmrgif test x$LIB_MAN_DIR = x    ; then
1709ce6676dbSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1710ce6676dbSmrgfi
1711ce6676dbSmrg
1712ce6676dbSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1713ce6676dbSmrg    case $host_os in
1714ce6676dbSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1715ce6676dbSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1716ce6676dbSmrg    esac
1717ce6676dbSmrgfi
1718ce6676dbSmrgif test x$FILE_MAN_DIR = x    ; then
1719ce6676dbSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1720ce6676dbSmrgfi
1721ce6676dbSmrg
1722ce6676dbSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1723ce6676dbSmrg    case $host_os in
1724ce6676dbSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1725ce6676dbSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1726ce6676dbSmrg    esac
1727ce6676dbSmrgfi
1728ce6676dbSmrgif test x$MISC_MAN_DIR = x    ; then
1729ce6676dbSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1730ce6676dbSmrgfi
1731ce6676dbSmrg
1732ce6676dbSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1733ce6676dbSmrg    case $host_os in
1734ce6676dbSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1735ce6676dbSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1736ce6676dbSmrg    esac
1737ce6676dbSmrgfi
1738ce6676dbSmrgif test x$DRIVER_MAN_DIR = x    ; then
1739ce6676dbSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1740ce6676dbSmrgfi
1741ce6676dbSmrg
1742ce6676dbSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1743ce6676dbSmrg    case $host_os in
1744ce6676dbSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1745ce6676dbSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1746ce6676dbSmrg    esac
1747ce6676dbSmrgfi
1748ce6676dbSmrgif test x$ADMIN_MAN_DIR = x    ; then
1749ce6676dbSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1750ce6676dbSmrgfi
1751ce6676dbSmrg
1752ce6676dbSmrg
1753ce6676dbSmrgAC_SUBST([APP_MAN_SUFFIX])
1754ce6676dbSmrgAC_SUBST([LIB_MAN_SUFFIX])
1755ce6676dbSmrgAC_SUBST([FILE_MAN_SUFFIX])
1756ce6676dbSmrgAC_SUBST([MISC_MAN_SUFFIX])
1757ce6676dbSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1758ce6676dbSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1759ce6676dbSmrgAC_SUBST([APP_MAN_DIR])
1760ce6676dbSmrgAC_SUBST([LIB_MAN_DIR])
1761ce6676dbSmrgAC_SUBST([FILE_MAN_DIR])
1762ce6676dbSmrgAC_SUBST([MISC_MAN_DIR])
1763ce6676dbSmrgAC_SUBST([DRIVER_MAN_DIR])
1764ce6676dbSmrgAC_SUBST([ADMIN_MAN_DIR])
176530f8ce46Smrg
176630f8ce46SmrgXORG_MAN_PAGE="X Version 11"
176730f8ce46SmrgAC_SUBST([XORG_MAN_PAGE])
176830f8ce46SmrgMAN_SUBSTS="\
176930f8ce46Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
177030f8ce46Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
177130f8ce46Smrg	-e 's|__xservername__|Xorg|g' \
177230f8ce46Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
177330f8ce46Smrg	-e 's|__projectroot__|\$(prefix)|g' \
177430f8ce46Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
177530f8ce46Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
177630f8ce46Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
177730f8ce46Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
177830f8ce46Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
177930f8ce46Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
178030f8ce46Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
178130f8ce46SmrgAC_SUBST([MAN_SUBSTS])
178230f8ce46Smrg
1783ce6676dbSmrg]) # XORG_MANPAGE_SECTIONS
1784ce6676dbSmrg
178530f8ce46Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
178630f8ce46Smrg# ------------------------
178730f8ce46Smrg# Minimum version: 1.7.0
178830f8ce46Smrg#
178930f8ce46Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
179030f8ce46Smrg# provided by xorg-sgml-doctools, if installed.
179130f8ce46SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
179230f8ce46SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
179330f8ce46SmrgXORG_SGML_PATH=
179430f8ce46SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
179530f8ce46Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
179630f8ce46Smrg    [m4_ifval([$1],[:],
179730f8ce46Smrg        [if test x"$cross_compiling" != x"yes" ; then
179830f8ce46Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
179930f8ce46Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
180030f8ce46Smrg         fi])
180130f8ce46Smrg    ])
180230f8ce46Smrg
180330f8ce46Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
180430f8ce46Smrg# the path and the name of the doc stylesheet
180530f8ce46Smrgif test "x$XORG_SGML_PATH" != "x" ; then
180630f8ce46Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
180730f8ce46Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
180830f8ce46Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
180930f8ce46Smrgelse
181030f8ce46Smrg   AC_MSG_RESULT([no])
181130f8ce46Smrgfi
181230f8ce46Smrg
181330f8ce46SmrgAC_SUBST(XORG_SGML_PATH)
181430f8ce46SmrgAC_SUBST(STYLESHEET_SRCDIR)
181530f8ce46SmrgAC_SUBST(XSL_STYLESHEET)
181630f8ce46SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
181730f8ce46Smrg]) # XORG_CHECK_SGML_DOCTOOLS
181830f8ce46Smrg
1819ce6676dbSmrg# XORG_CHECK_LINUXDOC
1820ce6676dbSmrg# -------------------
1821ce6676dbSmrg# Minimum version: 1.0.0
1822ce6676dbSmrg#
1823ce6676dbSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1824ce6676dbSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1825ce6676dbSmrg# Whether or not the necessary tools and files are found can be checked
1826ce6676dbSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1827ce6676dbSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
182830f8ce46SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
182930f8ce46SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1830ce6676dbSmrg
1831ce6676dbSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1832ce6676dbSmrg
183330f8ce46SmrgAC_MSG_CHECKING([whether to build documentation])
1834ce6676dbSmrg
183530f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1836ce6676dbSmrg   BUILDDOC=yes
1837ce6676dbSmrgelse
1838ce6676dbSmrg   BUILDDOC=no
1839ce6676dbSmrgfi
1840ce6676dbSmrg
1841ce6676dbSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1842ce6676dbSmrg
1843ce6676dbSmrgAC_MSG_RESULT([$BUILDDOC])
1844ce6676dbSmrg
184530f8ce46SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1846ce6676dbSmrg
184730f8ce46Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1848ce6676dbSmrg   BUILDPDFDOC=yes
1849ce6676dbSmrgelse
1850ce6676dbSmrg   BUILDPDFDOC=no
1851ce6676dbSmrgfi
1852ce6676dbSmrg
1853ce6676dbSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1854ce6676dbSmrg
1855ce6676dbSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1856ce6676dbSmrg
185730f8ce46SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1858ce6676dbSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1859ce6676dbSmrgMAKE_PDF="$PS2PDF"
1860ce6676dbSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1861ce6676dbSmrg
1862ce6676dbSmrgAC_SUBST(MAKE_TEXT)
1863ce6676dbSmrgAC_SUBST(MAKE_PS)
1864ce6676dbSmrgAC_SUBST(MAKE_PDF)
1865ce6676dbSmrgAC_SUBST(MAKE_HTML)
1866ce6676dbSmrg]) # XORG_CHECK_LINUXDOC
1867ce6676dbSmrg
1868ce6676dbSmrg# XORG_CHECK_DOCBOOK
1869ce6676dbSmrg# -------------------
1870ce6676dbSmrg# Minimum version: 1.0.0
1871ce6676dbSmrg#
1872ce6676dbSmrg# Checks for the ability to build output formats from SGML DocBook source.
1873ce6676dbSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1874ce6676dbSmrg# indicates whether the necessary tools and files are found and, if set,
1875ce6676dbSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1876ce6676dbSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
187730f8ce46SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
187830f8ce46Smrg
1879ce6676dbSmrgBUILDTXTDOC=no
1880ce6676dbSmrgBUILDPDFDOC=no
1881ce6676dbSmrgBUILDPSDOC=no
1882ce6676dbSmrgBUILDHTMLDOC=no
1883ce6676dbSmrg
1884ce6676dbSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1885ce6676dbSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1886ce6676dbSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1887ce6676dbSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1888ce6676dbSmrg
188930f8ce46SmrgAC_MSG_CHECKING([whether to build text documentation])
189030f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1891ce6676dbSmrg   test x$BUILD_TXTDOC != xno; then
1892ce6676dbSmrg	BUILDTXTDOC=yes
1893ce6676dbSmrgfi
1894ce6676dbSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1895ce6676dbSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1896ce6676dbSmrg
189730f8ce46SmrgAC_MSG_CHECKING([whether to build PDF documentation])
189830f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1899ce6676dbSmrg   test x$BUILD_PDFDOC != xno; then
1900ce6676dbSmrg	BUILDPDFDOC=yes
1901ce6676dbSmrgfi
1902ce6676dbSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1903ce6676dbSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1904ce6676dbSmrg
190530f8ce46SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
190630f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1907ce6676dbSmrg   test x$BUILD_PSDOC != xno; then
1908ce6676dbSmrg	BUILDPSDOC=yes
1909ce6676dbSmrgfi
1910ce6676dbSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1911ce6676dbSmrgAC_MSG_RESULT([$BUILDPSDOC])
1912ce6676dbSmrg
191330f8ce46SmrgAC_MSG_CHECKING([whether to build HTML documentation])
191430f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1915ce6676dbSmrg   test x$BUILD_HTMLDOC != xno; then
1916ce6676dbSmrg	BUILDHTMLDOC=yes
1917ce6676dbSmrgfi
1918ce6676dbSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1919ce6676dbSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1920ce6676dbSmrg
1921ce6676dbSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1922ce6676dbSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1923ce6676dbSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1924ce6676dbSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1925ce6676dbSmrg
1926ce6676dbSmrgAC_SUBST(MAKE_TEXT)
1927ce6676dbSmrgAC_SUBST(MAKE_PS)
1928ce6676dbSmrgAC_SUBST(MAKE_PDF)
1929ce6676dbSmrgAC_SUBST(MAKE_HTML)
1930ce6676dbSmrg]) # XORG_CHECK_DOCBOOK
1931ce6676dbSmrg
193230f8ce46Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
193330f8ce46Smrg# ----------------
193430f8ce46Smrg# Minimum version: 1.5.0
193530f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
193630f8ce46Smrg#
193730f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
193830f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
193930f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
194030f8ce46Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
194130f8ce46Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
194230f8ce46Smrg# --with-xmlto assumes 'auto'.
194330f8ce46Smrg#
194430f8ce46Smrg# Interface to module:
194530f8ce46Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
194630f8ce46Smrg# XMLTO:	returns the path of the xmlto program found
194730f8ce46Smrg#		returns the path set by the user in the environment
194830f8ce46Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
194930f8ce46Smrg#		'no' user instructs the module not to use xmlto
195030f8ce46Smrg#
195130f8ce46Smrg# Added in version 1.10.0
195230f8ce46Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
195330f8ce46Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
195430f8ce46Smrg#
195530f8ce46Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
195630f8ce46Smrg#
195730f8ce46SmrgAC_DEFUN([XORG_WITH_XMLTO],[
195830f8ce46SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
195930f8ce46Smrgm4_define([_defopt], m4_default([$2], [auto]))
196030f8ce46SmrgAC_ARG_WITH(xmlto,
196130f8ce46Smrg	AS_HELP_STRING([--with-xmlto],
196230f8ce46Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
196330f8ce46Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
196430f8ce46Smrgm4_undefine([_defopt])
196530f8ce46Smrg
196630f8ce46Smrgif test "x$use_xmlto" = x"auto"; then
196730f8ce46Smrg   AC_PATH_PROG([XMLTO], [xmlto])
196830f8ce46Smrg   if test "x$XMLTO" = "x"; then
196930f8ce46Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
197030f8ce46Smrg	have_xmlto=no
197130f8ce46Smrg   else
197230f8ce46Smrg        have_xmlto=yes
197330f8ce46Smrg   fi
197430f8ce46Smrgelif test "x$use_xmlto" = x"yes" ; then
197530f8ce46Smrg   AC_PATH_PROG([XMLTO], [xmlto])
197630f8ce46Smrg   if test "x$XMLTO" = "x"; then
197730f8ce46Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
197830f8ce46Smrg   fi
197930f8ce46Smrg   have_xmlto=yes
198030f8ce46Smrgelif test "x$use_xmlto" = x"no" ; then
198130f8ce46Smrg   if test "x$XMLTO" != "x"; then
198230f8ce46Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
198330f8ce46Smrg   fi
198430f8ce46Smrg   have_xmlto=no
198530f8ce46Smrgelse
198630f8ce46Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
198730f8ce46Smrgfi
198830f8ce46Smrg
198930f8ce46Smrg# Test for a minimum version of xmlto, if provided.
199030f8ce46Smrgm4_ifval([$1],
199130f8ce46Smrg[if test "$have_xmlto" = yes; then
199230f8ce46Smrg    # scrape the xmlto version
199330f8ce46Smrg    AC_MSG_CHECKING([the xmlto version])
199430f8ce46Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
199530f8ce46Smrg    AC_MSG_RESULT([$xmlto_version])
199630f8ce46Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
199730f8ce46Smrg        [if test "x$use_xmlto" = xauto; then
199830f8ce46Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
199930f8ce46Smrg            have_xmlto=no
200030f8ce46Smrg        else
200130f8ce46Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
200230f8ce46Smrg        fi])
200330f8ce46Smrgfi])
200430f8ce46Smrg
200530f8ce46Smrg# Test for the ability of xmlto to generate a text target
200630f8ce46Smrghave_xmlto_text=no
200730f8ce46Smrgcat > conftest.xml << "EOF"
200830f8ce46SmrgEOF
200930f8ce46SmrgAS_IF([test "$have_xmlto" = yes],
201030f8ce46Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
201130f8ce46Smrg             [have_xmlto_text=yes],
201230f8ce46Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
201330f8ce46Smrgrm -f conftest.xml
201430f8ce46SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
201530f8ce46SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
201630f8ce46Smrg]) # XORG_WITH_XMLTO
201730f8ce46Smrg
201834f90d55Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
201934f90d55Smrg# --------------------------------------------
202034f90d55Smrg# Minimum version: 1.12.0
202134f90d55Smrg# Minimum version for optional DEFAULT argument: 1.12.0
202234f90d55Smrg#
202334f90d55Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
202434f90d55Smrg# XML-based language used for the transformation of XML documents.
202534f90d55Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
202634f90d55Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
202734f90d55Smrg# The XSLT processor is often used as a standalone tool for transformations.
202834f90d55Smrg# It should not be assumed that this tool is used only to work with documnetation.
202934f90d55Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
203034f90d55Smrg#
203134f90d55Smrg# Interface to module:
203234f90d55Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
203334f90d55Smrg# XSLTPROC:	 returns the path of the xsltproc program found
203434f90d55Smrg#		 returns the path set by the user in the environment
203534f90d55Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
203634f90d55Smrg#		  'no' user instructs the module not to use xsltproc
203734f90d55Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
203834f90d55Smrg#
203934f90d55Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
204034f90d55Smrg#
204134f90d55SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
204234f90d55SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
204334f90d55Smrg# Preserves the interface, should it be implemented later
204434f90d55Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
204534f90d55Smrgm4_define([_defopt], m4_default([$2], [auto]))
204634f90d55SmrgAC_ARG_WITH(xsltproc,
204734f90d55Smrg	AS_HELP_STRING([--with-xsltproc],
204834f90d55Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
204934f90d55Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
205034f90d55Smrgm4_undefine([_defopt])
205134f90d55Smrg
205234f90d55Smrgif test "x$use_xsltproc" = x"auto"; then
205334f90d55Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
205434f90d55Smrg   if test "x$XSLTPROC" = "x"; then
205534f90d55Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
205634f90d55Smrg	have_xsltproc=no
205734f90d55Smrg   else
205834f90d55Smrg        have_xsltproc=yes
205934f90d55Smrg   fi
206034f90d55Smrgelif test "x$use_xsltproc" = x"yes" ; then
206134f90d55Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
206234f90d55Smrg   if test "x$XSLTPROC" = "x"; then
206334f90d55Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
206434f90d55Smrg   fi
206534f90d55Smrg   have_xsltproc=yes
206634f90d55Smrgelif test "x$use_xsltproc" = x"no" ; then
206734f90d55Smrg   if test "x$XSLTPROC" != "x"; then
206834f90d55Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
206934f90d55Smrg   fi
207034f90d55Smrg   have_xsltproc=no
207134f90d55Smrgelse
207234f90d55Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
207334f90d55Smrgfi
207434f90d55Smrg
207534f90d55SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
207634f90d55Smrg]) # XORG_WITH_XSLTPROC
207734f90d55Smrg
207834f90d55Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
207934f90d55Smrg# ----------------------------------------
208034f90d55Smrg# Minimum version: 1.15.0
208134f90d55Smrg#
208234f90d55Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
208334f90d55Smrg# scanning arbitrary text files, extracting information from those text files,
208434f90d55Smrg# and printing reports based on that information.
208534f90d55Smrg#
208634f90d55Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
208734f90d55Smrg#
208834f90d55Smrg# Interface to module:
208934f90d55Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
209034f90d55Smrg# PERL:	     returns the path of the perl program found
209134f90d55Smrg#	     returns the path set by the user in the environment
209234f90d55Smrg# --with-perl: 'yes' user instructs the module to use perl
209334f90d55Smrg#	       'no' user instructs the module not to use perl
209434f90d55Smrg# have_perl: returns yes if perl found in PATH or no
209534f90d55Smrg#
209634f90d55Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
209734f90d55Smrg#
209834f90d55SmrgAC_DEFUN([XORG_WITH_PERL],[
209934f90d55SmrgAC_ARG_VAR([PERL], [Path to perl command])
210034f90d55Smrg# Preserves the interface, should it be implemented later
210134f90d55Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
210234f90d55Smrgm4_define([_defopt], m4_default([$2], [auto]))
210334f90d55SmrgAC_ARG_WITH(perl,
210434f90d55Smrg	AS_HELP_STRING([--with-perl],
210534f90d55Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
210634f90d55Smrg	   [use_perl=$withval], [use_perl=]_defopt)
210734f90d55Smrgm4_undefine([_defopt])
210834f90d55Smrg
210934f90d55Smrgif test "x$use_perl" = x"auto"; then
211034f90d55Smrg   AC_PATH_PROG([PERL], [perl])
211134f90d55Smrg   if test "x$PERL" = "x"; then
211234f90d55Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
211334f90d55Smrg	have_perl=no
211434f90d55Smrg   else
211534f90d55Smrg        have_perl=yes
211634f90d55Smrg   fi
211734f90d55Smrgelif test "x$use_perl" = x"yes" ; then
211834f90d55Smrg   AC_PATH_PROG([PERL], [perl])
211934f90d55Smrg   if test "x$PERL" = "x"; then
212034f90d55Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
212134f90d55Smrg   fi
212234f90d55Smrg   have_perl=yes
212334f90d55Smrgelif test "x$use_perl" = x"no" ; then
212434f90d55Smrg   if test "x$PERL" != "x"; then
212534f90d55Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
212634f90d55Smrg   fi
212734f90d55Smrg   have_perl=no
212834f90d55Smrgelse
212934f90d55Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
213034f90d55Smrgfi
213134f90d55Smrg
213234f90d55SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
213334f90d55Smrg]) # XORG_WITH_PERL
213434f90d55Smrg
213530f8ce46Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
213630f8ce46Smrg# ----------------
213730f8ce46Smrg# Minimum version: 1.5.0
213830f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
213930f8ce46Smrg#
214030f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
214130f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
214230f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
214330f8ce46Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
214430f8ce46Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
214530f8ce46Smrg# --with-asciidoc assumes 'auto'.
214630f8ce46Smrg#
214730f8ce46Smrg# Interface to module:
214830f8ce46Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
214930f8ce46Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
215030f8ce46Smrg#		 returns the path set by the user in the environment
215130f8ce46Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
215230f8ce46Smrg#		  'no' user instructs the module not to use asciidoc
215330f8ce46Smrg#
215430f8ce46Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
215530f8ce46Smrg#
215630f8ce46SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
215730f8ce46SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
215830f8ce46Smrgm4_define([_defopt], m4_default([$2], [auto]))
215930f8ce46SmrgAC_ARG_WITH(asciidoc,
216030f8ce46Smrg	AS_HELP_STRING([--with-asciidoc],
216130f8ce46Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
216230f8ce46Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
216330f8ce46Smrgm4_undefine([_defopt])
216430f8ce46Smrg
216530f8ce46Smrgif test "x$use_asciidoc" = x"auto"; then
216630f8ce46Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
216730f8ce46Smrg   if test "x$ASCIIDOC" = "x"; then
216830f8ce46Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
216930f8ce46Smrg	have_asciidoc=no
217030f8ce46Smrg   else
217130f8ce46Smrg        have_asciidoc=yes
217230f8ce46Smrg   fi
217330f8ce46Smrgelif test "x$use_asciidoc" = x"yes" ; then
217430f8ce46Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
217530f8ce46Smrg   if test "x$ASCIIDOC" = "x"; then
217630f8ce46Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
217730f8ce46Smrg   fi
217830f8ce46Smrg   have_asciidoc=yes
217930f8ce46Smrgelif test "x$use_asciidoc" = x"no" ; then
218030f8ce46Smrg   if test "x$ASCIIDOC" != "x"; then
218130f8ce46Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
218230f8ce46Smrg   fi
218330f8ce46Smrg   have_asciidoc=no
218430f8ce46Smrgelse
218530f8ce46Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
218630f8ce46Smrgfi
218730f8ce46Smrgm4_ifval([$1],
218830f8ce46Smrg[if test "$have_asciidoc" = yes; then
218930f8ce46Smrg    # scrape the asciidoc version
219030f8ce46Smrg    AC_MSG_CHECKING([the asciidoc version])
219130f8ce46Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
219230f8ce46Smrg    AC_MSG_RESULT([$asciidoc_version])
219330f8ce46Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
219430f8ce46Smrg        [if test "x$use_asciidoc" = xauto; then
219530f8ce46Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
219630f8ce46Smrg            have_asciidoc=no
219730f8ce46Smrg        else
219830f8ce46Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
219930f8ce46Smrg        fi])
220030f8ce46Smrgfi])
220130f8ce46SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
220230f8ce46Smrg]) # XORG_WITH_ASCIIDOC
220330f8ce46Smrg
220430f8ce46Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
220530f8ce46Smrg# --------------------------------
220630f8ce46Smrg# Minimum version: 1.5.0
220730f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
220830f8ce46Smrg#
220930f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
221030f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
221130f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
221230f8ce46Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
221330f8ce46Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
221430f8ce46Smrg# --with-doxygen assumes 'auto'.
221530f8ce46Smrg#
221630f8ce46Smrg# Interface to module:
221730f8ce46Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
221830f8ce46Smrg# DOXYGEN:	 returns the path of the doxygen program found
221930f8ce46Smrg#		 returns the path set by the user in the environment
222030f8ce46Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
222130f8ce46Smrg#		  'no' user instructs the module not to use doxygen
222230f8ce46Smrg#
222330f8ce46Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
222430f8ce46Smrg#
222530f8ce46SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
222630f8ce46SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
222730f8ce46Smrgm4_define([_defopt], m4_default([$2], [auto]))
222830f8ce46SmrgAC_ARG_WITH(doxygen,
222930f8ce46Smrg	AS_HELP_STRING([--with-doxygen],
223030f8ce46Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
223130f8ce46Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
223230f8ce46Smrgm4_undefine([_defopt])
223330f8ce46Smrg
223430f8ce46Smrgif test "x$use_doxygen" = x"auto"; then
223530f8ce46Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
223630f8ce46Smrg   if test "x$DOXYGEN" = "x"; then
223730f8ce46Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
223830f8ce46Smrg	have_doxygen=no
223930f8ce46Smrg   else
224030f8ce46Smrg        have_doxygen=yes
224130f8ce46Smrg   fi
224230f8ce46Smrgelif test "x$use_doxygen" = x"yes" ; then
224330f8ce46Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
224430f8ce46Smrg   if test "x$DOXYGEN" = "x"; then
224530f8ce46Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
224630f8ce46Smrg   fi
224730f8ce46Smrg   have_doxygen=yes
224830f8ce46Smrgelif test "x$use_doxygen" = x"no" ; then
224930f8ce46Smrg   if test "x$DOXYGEN" != "x"; then
225030f8ce46Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
225130f8ce46Smrg   fi
225230f8ce46Smrg   have_doxygen=no
225330f8ce46Smrgelse
225430f8ce46Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
225530f8ce46Smrgfi
225630f8ce46Smrgm4_ifval([$1],
225730f8ce46Smrg[if test "$have_doxygen" = yes; then
225830f8ce46Smrg    # scrape the doxygen version
225930f8ce46Smrg    AC_MSG_CHECKING([the doxygen version])
226030f8ce46Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
226130f8ce46Smrg    AC_MSG_RESULT([$doxygen_version])
226230f8ce46Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
226330f8ce46Smrg        [if test "x$use_doxygen" = xauto; then
226430f8ce46Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
226530f8ce46Smrg            have_doxygen=no
226630f8ce46Smrg        else
226730f8ce46Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
226830f8ce46Smrg        fi])
226930f8ce46Smrgfi])
227030f8ce46SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
227130f8ce46Smrg]) # XORG_WITH_DOXYGEN
227230f8ce46Smrg
227330f8ce46Smrg# XORG_WITH_GROFF([DEFAULT])
227430f8ce46Smrg# ----------------
227530f8ce46Smrg# Minimum version: 1.6.0
227630f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
227730f8ce46Smrg#
227830f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
227930f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
228030f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
228130f8ce46Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
228230f8ce46Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
228330f8ce46Smrg# --with-groff assumes 'auto'.
228430f8ce46Smrg#
228530f8ce46Smrg# Interface to module:
228630f8ce46Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
228730f8ce46Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
228830f8ce46Smrg# HAVE_GROFF_MS: the -ms macros package
228930f8ce46Smrg# GROFF:	 returns the path of the groff program found
229030f8ce46Smrg#		 returns the path set by the user in the environment
229130f8ce46Smrg# --with-groff:	 'yes' user instructs the module to use groff
229230f8ce46Smrg#		 'no' user instructs the module not to use groff
229330f8ce46Smrg#
229430f8ce46Smrg# Added in version 1.9.0:
229530f8ce46Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
229630f8ce46Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
229730f8ce46Smrg#		   psselect from the psutils package.
229830f8ce46Smrg#		   the ghostcript package. Refer to the grohtml man pages
229930f8ce46Smrg#
230030f8ce46Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
230130f8ce46Smrg#
230230f8ce46Smrg# OS and distros often splits groff in a basic and full package, the former
230330f8ce46Smrg# having the groff program and the later having devices, fonts and macros
230430f8ce46Smrg# Checking for the groff executable is not enough.
230530f8ce46Smrg#
230630f8ce46Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
230730f8ce46Smrg# unset HAVE_GROFF or GROFF env variables.
230830f8ce46Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
230930f8ce46Smrg#
231030f8ce46SmrgAC_DEFUN([XORG_WITH_GROFF],[
231130f8ce46SmrgAC_ARG_VAR([GROFF], [Path to groff command])
231230f8ce46Smrgm4_define([_defopt], m4_default([$1], [auto]))
231330f8ce46SmrgAC_ARG_WITH(groff,
231430f8ce46Smrg	AS_HELP_STRING([--with-groff],
231530f8ce46Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
231630f8ce46Smrg	   [use_groff=$withval], [use_groff=]_defopt)
231730f8ce46Smrgm4_undefine([_defopt])
231830f8ce46Smrg
231930f8ce46Smrgif test "x$use_groff" = x"auto"; then
232030f8ce46Smrg   AC_PATH_PROG([GROFF], [groff])
232130f8ce46Smrg   if test "x$GROFF" = "x"; then
232230f8ce46Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
232330f8ce46Smrg	have_groff=no
232430f8ce46Smrg   else
232530f8ce46Smrg        have_groff=yes
232630f8ce46Smrg   fi
232730f8ce46Smrgelif test "x$use_groff" = x"yes" ; then
232830f8ce46Smrg   AC_PATH_PROG([GROFF], [groff])
232930f8ce46Smrg   if test "x$GROFF" = "x"; then
233030f8ce46Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
233130f8ce46Smrg   fi
233230f8ce46Smrg   have_groff=yes
233330f8ce46Smrgelif test "x$use_groff" = x"no" ; then
233430f8ce46Smrg   if test "x$GROFF" != "x"; then
233530f8ce46Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
233630f8ce46Smrg   fi
233730f8ce46Smrg   have_groff=no
233830f8ce46Smrgelse
233930f8ce46Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
234030f8ce46Smrgfi
234130f8ce46Smrg
234230f8ce46Smrg# We have groff, test for the presence of the macro packages
234330f8ce46Smrgif test "x$have_groff" = x"yes"; then
234430f8ce46Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
234530f8ce46Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
234630f8ce46Smrg        groff_ms_works=yes
234730f8ce46Smrg    else
234830f8ce46Smrg        groff_ms_works=no
234930f8ce46Smrg    fi
235030f8ce46Smrg    AC_MSG_RESULT([$groff_ms_works])
235130f8ce46Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
235230f8ce46Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
235330f8ce46Smrg        groff_mm_works=yes
235430f8ce46Smrg    else
235530f8ce46Smrg        groff_mm_works=no
235630f8ce46Smrg    fi
235730f8ce46Smrg    AC_MSG_RESULT([$groff_mm_works])
235830f8ce46Smrgfi
235930f8ce46Smrg
236030f8ce46Smrg# We have groff, test for HTML dependencies, one command per package
236130f8ce46Smrgif test "x$have_groff" = x"yes"; then
236230f8ce46Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
236330f8ce46Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
236430f8ce46Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
236530f8ce46Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
236630f8ce46Smrg      have_groff_html=yes
236730f8ce46Smrg   else
236830f8ce46Smrg      have_groff_html=no
236930f8ce46Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
237030f8ce46Smrg   fi
237130f8ce46Smrgfi
237230f8ce46Smrg
237330f8ce46Smrg# Set Automake conditionals for Makefiles
237430f8ce46SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
237530f8ce46SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
237630f8ce46SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
237730f8ce46SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
237830f8ce46Smrg]) # XORG_WITH_GROFF
237930f8ce46Smrg
238034f90d55Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
238134f90d55Smrg# ---------------------------------------
238230f8ce46Smrg# Minimum version: 1.6.0
238330f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
238434f90d55Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
238530f8ce46Smrg#
238630f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
238730f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
238830f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
238930f8ce46Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
239030f8ce46Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
239130f8ce46Smrg# --with-fop assumes 'auto'.
239230f8ce46Smrg#
239330f8ce46Smrg# Interface to module:
239430f8ce46Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
239530f8ce46Smrg# FOP:	 	returns the path of the fop program found
239630f8ce46Smrg#		returns the path set by the user in the environment
239730f8ce46Smrg# --with-fop: 	'yes' user instructs the module to use fop
239830f8ce46Smrg#		'no' user instructs the module not to use fop
239930f8ce46Smrg#
240030f8ce46Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
240130f8ce46Smrg#
240230f8ce46SmrgAC_DEFUN([XORG_WITH_FOP],[
240330f8ce46SmrgAC_ARG_VAR([FOP], [Path to fop command])
240434f90d55Smrgm4_define([_defopt], m4_default([$2], [auto]))
240530f8ce46SmrgAC_ARG_WITH(fop,
240630f8ce46Smrg	AS_HELP_STRING([--with-fop],
240730f8ce46Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
240830f8ce46Smrg	   [use_fop=$withval], [use_fop=]_defopt)
240930f8ce46Smrgm4_undefine([_defopt])
241030f8ce46Smrg
241130f8ce46Smrgif test "x$use_fop" = x"auto"; then
241230f8ce46Smrg   AC_PATH_PROG([FOP], [fop])
241330f8ce46Smrg   if test "x$FOP" = "x"; then
241430f8ce46Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
241530f8ce46Smrg	have_fop=no
241630f8ce46Smrg   else
241730f8ce46Smrg        have_fop=yes
241830f8ce46Smrg   fi
241930f8ce46Smrgelif test "x$use_fop" = x"yes" ; then
242030f8ce46Smrg   AC_PATH_PROG([FOP], [fop])
242130f8ce46Smrg   if test "x$FOP" = "x"; then
242230f8ce46Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
242330f8ce46Smrg   fi
242430f8ce46Smrg   have_fop=yes
242530f8ce46Smrgelif test "x$use_fop" = x"no" ; then
242630f8ce46Smrg   if test "x$FOP" != "x"; then
242730f8ce46Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
242830f8ce46Smrg   fi
242930f8ce46Smrg   have_fop=no
243030f8ce46Smrgelse
243130f8ce46Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
243230f8ce46Smrgfi
243334f90d55Smrg
243434f90d55Smrg# Test for a minimum version of fop, if provided.
243534f90d55Smrgm4_ifval([$1],
243634f90d55Smrg[if test "$have_fop" = yes; then
243734f90d55Smrg    # scrape the fop version
243834f90d55Smrg    AC_MSG_CHECKING([for fop minimum version])
243934f90d55Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
244034f90d55Smrg    AC_MSG_RESULT([$fop_version])
244134f90d55Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
244234f90d55Smrg        [if test "x$use_fop" = xauto; then
244334f90d55Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
244434f90d55Smrg            have_fop=no
244534f90d55Smrg        else
244634f90d55Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
244734f90d55Smrg        fi])
244834f90d55Smrgfi])
244930f8ce46SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
245030f8ce46Smrg]) # XORG_WITH_FOP
245130f8ce46Smrg
245230f8ce46Smrg# XORG_WITH_PS2PDF([DEFAULT])
245330f8ce46Smrg# ----------------
245430f8ce46Smrg# Minimum version: 1.6.0
245530f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
245630f8ce46Smrg#
245730f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
245830f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
245930f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
246030f8ce46Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
246130f8ce46Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
246230f8ce46Smrg# --with-ps2pdf assumes 'auto'.
246330f8ce46Smrg#
246430f8ce46Smrg# Interface to module:
246530f8ce46Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
246630f8ce46Smrg# PS2PDF:	returns the path of the ps2pdf program found
246730f8ce46Smrg#		returns the path set by the user in the environment
246830f8ce46Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
246930f8ce46Smrg#		 'no' user instructs the module not to use ps2pdf
247030f8ce46Smrg#
247130f8ce46Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
247230f8ce46Smrg#
247330f8ce46SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
247430f8ce46SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
247530f8ce46Smrgm4_define([_defopt], m4_default([$1], [auto]))
247630f8ce46SmrgAC_ARG_WITH(ps2pdf,
247730f8ce46Smrg	AS_HELP_STRING([--with-ps2pdf],
247830f8ce46Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
247930f8ce46Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
248030f8ce46Smrgm4_undefine([_defopt])
248130f8ce46Smrg
248230f8ce46Smrgif test "x$use_ps2pdf" = x"auto"; then
248330f8ce46Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
248430f8ce46Smrg   if test "x$PS2PDF" = "x"; then
248530f8ce46Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
248630f8ce46Smrg	have_ps2pdf=no
248730f8ce46Smrg   else
248830f8ce46Smrg        have_ps2pdf=yes
248930f8ce46Smrg   fi
249030f8ce46Smrgelif test "x$use_ps2pdf" = x"yes" ; then
249130f8ce46Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
249230f8ce46Smrg   if test "x$PS2PDF" = "x"; then
249330f8ce46Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
249430f8ce46Smrg   fi
249530f8ce46Smrg   have_ps2pdf=yes
249630f8ce46Smrgelif test "x$use_ps2pdf" = x"no" ; then
249730f8ce46Smrg   if test "x$PS2PDF" != "x"; then
249830f8ce46Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
249930f8ce46Smrg   fi
250030f8ce46Smrg   have_ps2pdf=no
250130f8ce46Smrgelse
250230f8ce46Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
250330f8ce46Smrgfi
250430f8ce46SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
250530f8ce46Smrg]) # XORG_WITH_PS2PDF
250630f8ce46Smrg
250730f8ce46Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
250830f8ce46Smrg# ----------------
250930f8ce46Smrg# Minimum version: 1.6.0
251030f8ce46Smrg#
251130f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
251230f8ce46Smrg# not at the appropriate level. This macro enables a builder to skip all
251330f8ce46Smrg# documentation targets except traditional man pages.
251430f8ce46Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
251530f8ce46Smrg# maximum flexibilty in controlling documentation building.
251630f8ce46Smrg# Refer to:
251730f8ce46Smrg# XORG_WITH_XMLTO         --with-xmlto
251830f8ce46Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
251930f8ce46Smrg# XORG_WITH_DOXYGEN       --with-doxygen
252030f8ce46Smrg# XORG_WITH_FOP           --with-fop
252130f8ce46Smrg# XORG_WITH_GROFF         --with-groff
252230f8ce46Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
252330f8ce46Smrg#
252430f8ce46Smrg# Interface to module:
252530f8ce46Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
252630f8ce46Smrg# --enable-docs: 'yes' user instructs the module to generate docs
252730f8ce46Smrg#		 'no' user instructs the module not to generate docs
252830f8ce46Smrg# parm1:	specify the default value, yes or no.
252930f8ce46Smrg#
253030f8ce46SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
253134f90d55Smrgm4_define([docs_default], m4_default([$1], [yes]))
253230f8ce46SmrgAC_ARG_ENABLE(docs,
253330f8ce46Smrg	AS_HELP_STRING([--enable-docs],
253434f90d55Smrg	   [Enable building the documentation (default: ]docs_default[)]),
253534f90d55Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
253634f90d55Smrgm4_undefine([docs_default])
253730f8ce46SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
253830f8ce46SmrgAC_MSG_CHECKING([whether to build documentation])
253930f8ce46SmrgAC_MSG_RESULT([$build_docs])
254030f8ce46Smrg]) # XORG_ENABLE_DOCS
254130f8ce46Smrg
254230f8ce46Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
254330f8ce46Smrg# ----------------
254430f8ce46Smrg# Minimum version: 1.6.0
254530f8ce46Smrg#
254630f8ce46Smrg# This macro enables a builder to skip all developer documentation.
254730f8ce46Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
254830f8ce46Smrg# maximum flexibilty in controlling documentation building.
254930f8ce46Smrg# Refer to:
255030f8ce46Smrg# XORG_WITH_XMLTO         --with-xmlto
255130f8ce46Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
255230f8ce46Smrg# XORG_WITH_DOXYGEN       --with-doxygen
255330f8ce46Smrg# XORG_WITH_FOP           --with-fop
255430f8ce46Smrg# XORG_WITH_GROFF         --with-groff
255530f8ce46Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
255630f8ce46Smrg#
255730f8ce46Smrg# Interface to module:
255830f8ce46Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
255930f8ce46Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
256030f8ce46Smrg#			'no' user instructs the module not to generate developer docs
256130f8ce46Smrg# parm1:		specify the default value, yes or no.
256230f8ce46Smrg#
256330f8ce46SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
256430f8ce46Smrgm4_define([devel_default], m4_default([$1], [yes]))
256530f8ce46SmrgAC_ARG_ENABLE(devel-docs,
256630f8ce46Smrg	AS_HELP_STRING([--enable-devel-docs],
256730f8ce46Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
256830f8ce46Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
256930f8ce46Smrgm4_undefine([devel_default])
257030f8ce46SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
257130f8ce46SmrgAC_MSG_CHECKING([whether to build developer documentation])
257230f8ce46SmrgAC_MSG_RESULT([$build_devel_docs])
257330f8ce46Smrg]) # XORG_ENABLE_DEVEL_DOCS
257430f8ce46Smrg
257530f8ce46Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
257630f8ce46Smrg# ----------------
257730f8ce46Smrg# Minimum version: 1.6.0
257830f8ce46Smrg#
257930f8ce46Smrg# This macro enables a builder to skip all functional specification targets.
258030f8ce46Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
258130f8ce46Smrg# maximum flexibilty in controlling documentation building.
258230f8ce46Smrg# Refer to:
258330f8ce46Smrg# XORG_WITH_XMLTO         --with-xmlto
258430f8ce46Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
258530f8ce46Smrg# XORG_WITH_DOXYGEN       --with-doxygen
258630f8ce46Smrg# XORG_WITH_FOP           --with-fop
258730f8ce46Smrg# XORG_WITH_GROFF         --with-groff
258830f8ce46Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
258930f8ce46Smrg#
259030f8ce46Smrg# Interface to module:
259130f8ce46Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
259230f8ce46Smrg# --enable-specs:	'yes' user instructs the module to generate specs
259330f8ce46Smrg#			'no' user instructs the module not to generate specs
259430f8ce46Smrg# parm1:		specify the default value, yes or no.
259530f8ce46Smrg#
259630f8ce46SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
259730f8ce46Smrgm4_define([spec_default], m4_default([$1], [yes]))
259830f8ce46SmrgAC_ARG_ENABLE(specs,
259930f8ce46Smrg	AS_HELP_STRING([--enable-specs],
260030f8ce46Smrg	   [Enable building the specs (default: ]spec_default[)]),
260130f8ce46Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
260230f8ce46Smrgm4_undefine([spec_default])
260330f8ce46SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
260430f8ce46SmrgAC_MSG_CHECKING([whether to build functional specifications])
260530f8ce46SmrgAC_MSG_RESULT([$build_specs])
260630f8ce46Smrg]) # XORG_ENABLE_SPECS
260730f8ce46Smrg
260834f90d55Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
260934f90d55Smrg# ----------------------------------------------
261034f90d55Smrg# Minimum version: 1.13.0
261134f90d55Smrg#
261234f90d55Smrg# This macro enables a builder to enable/disable unit testing
261334f90d55Smrg# It makes no assumption about the test cases implementation
261434f90d55Smrg# Test cases may or may not use Automake "Support for test suites"
261534f90d55Smrg# They may or may not use the software utility library GLib
261634f90d55Smrg#
261734f90d55Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
261834f90d55Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
261934f90d55Smrg# The variable enable_unit_tests is used by other macros in this file.
262034f90d55Smrg#
262134f90d55Smrg# Interface to module:
262234f90d55Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
262334f90d55Smrg# enable_unit_tests:    used in configure.ac for additional configuration
262434f90d55Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
262534f90d55Smrg#			'no' user instructs the module not to build tests
262634f90d55Smrg# parm1:		specify the default value, yes or no.
262734f90d55Smrg#
262834f90d55SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
262934f90d55SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
263034f90d55SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
263134f90d55SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
263234f90d55Smrgm4_define([_defopt], m4_default([$1], [auto]))
263334f90d55SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
263434f90d55Smrg	[Enable building unit test cases (default: ]_defopt[)]),
263534f90d55Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
263634f90d55Smrgm4_undefine([_defopt])
263734f90d55SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
263834f90d55SmrgAC_MSG_CHECKING([whether to build unit test cases])
263934f90d55SmrgAC_MSG_RESULT([$enable_unit_tests])
264034f90d55Smrg]) # XORG_ENABLE_UNIT_TESTS
264134f90d55Smrg
264234f90d55Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
264334f90d55Smrg# ------------------------------------------------------
264434f90d55Smrg# Minimum version: 1.17.0
264534f90d55Smrg#
264634f90d55Smrg# This macro enables a builder to enable/disable integration testing
264734f90d55Smrg# It makes no assumption about the test cases' implementation
264834f90d55Smrg# Test cases may or may not use Automake "Support for test suites"
264934f90d55Smrg#
265034f90d55Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
265134f90d55Smrg# usually requires less dependencies and may be built and run under less
265234f90d55Smrg# stringent environments than integration tests.
265334f90d55Smrg#
265434f90d55Smrg# Interface to module:
265534f90d55Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
265634f90d55Smrg# enable_integration_tests:   used in configure.ac for additional configuration
265734f90d55Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
265834f90d55Smrg#                             'no' user instructs the module not to build tests
265934f90d55Smrg# parm1:                      specify the default value, yes or no.
266034f90d55Smrg#
266134f90d55SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
266234f90d55SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
266334f90d55Smrgm4_define([_defopt], m4_default([$1], [auto]))
266434f90d55SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
266534f90d55Smrg	[Enable building integration test cases (default: ]_defopt[)]),
266634f90d55Smrg	[enable_integration_tests=$enableval],
266734f90d55Smrg	[enable_integration_tests=]_defopt)
266834f90d55Smrgm4_undefine([_defopt])
266934f90d55SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
267034f90d55Smrg	[test "x$enable_integration_tests" != xno])
267134f90d55SmrgAC_MSG_CHECKING([whether to build unit test cases])
267234f90d55SmrgAC_MSG_RESULT([$enable_integration_tests])
267334f90d55Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
267434f90d55Smrg
267534f90d55Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
267634f90d55Smrg# ----------------------------------------
267734f90d55Smrg# Minimum version: 1.13.0
267834f90d55Smrg#
267934f90d55Smrg# GLib is a library which provides advanced data structures and functions.
268034f90d55Smrg# This macro enables a module to test for the presence of Glib.
268134f90d55Smrg#
268234f90d55Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
268334f90d55Smrg# Otherwise the value of $enable_unit_tests is blank.
268434f90d55Smrg#
268534f90d55Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
268634f90d55Smrg# test support usually requires less dependencies and may be built and run under
268734f90d55Smrg# less stringent environments than integration tests.
268834f90d55Smrg#
268934f90d55Smrg# Interface to module:
269034f90d55Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
269134f90d55Smrg# with_glib: used in configure.ac to know if GLib has been found
269234f90d55Smrg# --with-glib:	'yes' user instructs the module to use glib
269334f90d55Smrg#		'no' user instructs the module not to use glib
269434f90d55Smrg#
269534f90d55SmrgAC_DEFUN([XORG_WITH_GLIB],[
269634f90d55SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
269734f90d55Smrgm4_define([_defopt], m4_default([$2], [auto]))
269834f90d55SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
269934f90d55Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
270034f90d55Smrg	[with_glib=$withval], [with_glib=]_defopt)
270134f90d55Smrgm4_undefine([_defopt])
270234f90d55Smrg
270334f90d55Smrghave_glib=no
270434f90d55Smrg# Do not probe GLib if user explicitly disabled unit testing
270534f90d55Smrgif test "x$enable_unit_tests" != x"no"; then
270634f90d55Smrg  # Do not probe GLib if user explicitly disabled it
270734f90d55Smrg  if test "x$with_glib" != x"no"; then
270834f90d55Smrg    m4_ifval(
270934f90d55Smrg      [$1],
271034f90d55Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
271134f90d55Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
271234f90d55Smrg    )
271334f90d55Smrg  fi
271434f90d55Smrgfi
271534f90d55Smrg
271634f90d55Smrg# Not having GLib when unit testing has been explicitly requested is an error
271734f90d55Smrgif test "x$enable_unit_tests" = x"yes"; then
271834f90d55Smrg  if test "x$have_glib" = x"no"; then
271934f90d55Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
272034f90d55Smrg  fi
272134f90d55Smrgfi
272234f90d55Smrg
272334f90d55Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
272434f90d55Smrgif test "x$enable_unit_tests" = x"no"; then
272534f90d55Smrg  if test "x$with_glib" = x"yes"; then
272634f90d55Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
272734f90d55Smrg  fi
272834f90d55Smrgfi
272934f90d55Smrg
273034f90d55Smrg# Not having GLib when it has been explicitly requested is an error
273134f90d55Smrgif test "x$with_glib" = x"yes"; then
273234f90d55Smrg  if test "x$have_glib" = x"no"; then
273334f90d55Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
273434f90d55Smrg  fi
273534f90d55Smrgfi
273634f90d55Smrg
273734f90d55SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
273834f90d55Smrg]) # XORG_WITH_GLIB
273934f90d55Smrg
274034f90d55Smrg# XORG_LD_WRAP([required|optional])
274134f90d55Smrg# ---------------------------------
274234f90d55Smrg# Minimum version: 1.13.0
274334f90d55Smrg#
274434f90d55Smrg# Check if linker supports -wrap, passed via compiler flags
274534f90d55Smrg#
274634f90d55Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
274734f90d55Smrg# Otherwise the value of $enable_unit_tests is blank.
274834f90d55Smrg#
274934f90d55Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
275034f90d55Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
275134f90d55Smrg# available, an argument of "optional" allows use when some unit tests require
275234f90d55Smrg# ld -wrap and others do not.
275334f90d55Smrg#
275434f90d55SmrgAC_DEFUN([XORG_LD_WRAP],[
275534f90d55SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
275634f90d55Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
275734f90d55Smrg                      void __wrap_exit(int status) { return; }],
275834f90d55Smrg                     [exit(0);])])
275934f90d55Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
276034f90d55Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
276134f90d55Smrg  if test "x$have_ld_wrap" = x"no"; then
276234f90d55Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
276334f90d55Smrg  fi
276434f90d55Smrgfi
276534f90d55SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
276634f90d55Smrg#
276734f90d55Smrg]) # XORG_LD_WRAP
276834f90d55Smrg
276934f90d55Smrg# XORG_CHECK_LINKER_FLAGS
277034f90d55Smrg# -----------------------
277134f90d55Smrg# SYNOPSIS
277234f90d55Smrg#
277334f90d55Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
277434f90d55Smrg#
277534f90d55Smrg# DESCRIPTION
277634f90d55Smrg#
277734f90d55Smrg#   Check whether the given linker FLAGS work with the current language's
277834f90d55Smrg#   linker, or whether they give an error.
277934f90d55Smrg#
278034f90d55Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
278134f90d55Smrg#   success/failure.
278234f90d55Smrg#
278334f90d55Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
278434f90d55Smrg#
278534f90d55Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
278634f90d55Smrg#
278734f90d55Smrg# LICENSE
278834f90d55Smrg#
278934f90d55Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
279034f90d55Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
279134f90d55Smrg#   Copyright (c) 2009 Matteo Frigo
279234f90d55Smrg#
279334f90d55Smrg#   This program is free software: you can redistribute it and/or modify it
279434f90d55Smrg#   under the terms of the GNU General Public License as published by the
279534f90d55Smrg#   Free Software Foundation, either version 3 of the License, or (at your
279634f90d55Smrg#   option) any later version.
279734f90d55Smrg#
279834f90d55Smrg#   This program is distributed in the hope that it will be useful, but
279934f90d55Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
280034f90d55Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
280134f90d55Smrg#   Public License for more details.
280234f90d55Smrg#
280334f90d55Smrg#   You should have received a copy of the GNU General Public License along
280434f90d55Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
280534f90d55Smrg#
280634f90d55Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
280734f90d55Smrg#   gives unlimited permission to copy, distribute and modify the configure
280834f90d55Smrg#   scripts that are the output of Autoconf when processing the Macro. You
280934f90d55Smrg#   need not follow the terms of the GNU General Public License when using
281034f90d55Smrg#   or distributing such scripts, even though portions of the text of the
281134f90d55Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
281234f90d55Smrg#   all other use of the material that constitutes the Autoconf Macro.
281334f90d55Smrg#
281434f90d55Smrg#   This special exception to the GPL applies to versions of the Autoconf
281534f90d55Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
281634f90d55Smrg#   modified version of the Autoconf Macro, you may extend this special
281734f90d55Smrg#   exception to the GPL to apply to your modified version as well.#
281834f90d55SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
281934f90d55Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
282034f90d55Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
282134f90d55SmrgAS_LITERAL_IF([$1],
282234f90d55Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
282334f90d55Smrg      ax_save_FLAGS=$LDFLAGS
282434f90d55Smrg      LDFLAGS="$1"
282534f90d55Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
282634f90d55Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
282734f90d55Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
282834f90d55Smrg      LDFLAGS=$ax_save_FLAGS])],
282934f90d55Smrg  [ax_save_FLAGS=$LDFLAGS
283034f90d55Smrg   LDFLAGS="$1"
283134f90d55Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
283234f90d55Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
283334f90d55Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
283434f90d55Smrg   LDFLAGS=$ax_save_FLAGS])
283534f90d55Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
283634f90d55SmrgAC_MSG_RESULT($xorg_check_linker_flags)
283734f90d55Smrgif test "x$xorg_check_linker_flags" = xyes; then
283834f90d55Smrg	m4_default([$2], :)
283934f90d55Smrgelse
284034f90d55Smrg	m4_default([$3], :)
284134f90d55Smrgfi
284234f90d55Smrg]) # XORG_CHECK_LINKER_FLAGS
284334f90d55Smrg
284434f90d55Smrg# XORG_MEMORY_CHECK_FLAGS
284534f90d55Smrg# -----------------------
284634f90d55Smrg# Minimum version: 1.16.0
284734f90d55Smrg#
284834f90d55Smrg# This macro attempts to find appropriate memory checking functionality
284934f90d55Smrg# for various platforms which unit testing code may use to catch various
285034f90d55Smrg# forms of memory allocation and access errors in testing.
285134f90d55Smrg#
285234f90d55Smrg# Interface to module:
285334f90d55Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
285434f90d55Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
285534f90d55Smrg#
285634f90d55Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
285734f90d55Smrg#
285834f90d55SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
285934f90d55Smrg
286034f90d55SmrgAC_REQUIRE([AC_CANONICAL_HOST])
286134f90d55SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
286234f90d55Smrg           [Environment variables to enable memory checking in tests])
286334f90d55Smrg
286434f90d55Smrg# Check for different types of support on different platforms
286534f90d55Smrgcase $host_os in
286634f90d55Smrg    solaris*)
286734f90d55Smrg        AC_CHECK_LIB([umem], [umem_alloc],
286834f90d55Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
286934f90d55Smrg        ;;
287034f90d55Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
287134f90d55Smrg        # both directly and inverted, so should not be 0 or 255.
287234f90d55Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
287334f90d55Smrg        ;;
287434f90d55Smrg    darwin*)
287534f90d55Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
287634f90d55Smrg        ;;
287734f90d55Smrg    *bsd*)
287834f90d55Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
287934f90d55Smrg        ;;
288034f90d55Smrgesac
288134f90d55Smrg
288234f90d55Smrg# User supplied flags override default flags
288334f90d55Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
288434f90d55Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
288534f90d55Smrgfi
288634f90d55Smrg
288734f90d55SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
288834f90d55Smrg]) # XORG_WITH_LINT
288934f90d55Smrg
2890ce6676dbSmrg# XORG_CHECK_MALLOC_ZERO
2891ce6676dbSmrg# ----------------------
2892ce6676dbSmrg# Minimum version: 1.0.0
2893ce6676dbSmrg#
2894ce6676dbSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2895ce6676dbSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2896ce6676dbSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2897ce6676dbSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2898ce6676dbSmrgAC_ARG_ENABLE(malloc0returnsnull,
289930f8ce46Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2900ce6676dbSmrg		       [malloc(0) returns NULL (default: auto)]),
2901ce6676dbSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2902ce6676dbSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2903ce6676dbSmrg
2904ce6676dbSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2905ce6676dbSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
290634f90d55Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
290734f90d55Smrg#include <stdlib.h>
290834f90d55Smrg],[
2909ce6676dbSmrg    char *m0, *r0, *c0, *p;
2910ce6676dbSmrg    m0 = malloc(0);
2911ce6676dbSmrg    p = malloc(10);
2912ce6676dbSmrg    r0 = realloc(p,0);
291334f90d55Smrg    c0 = calloc(0,10);
291434f90d55Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
291534f90d55Smrg])],
2916ce6676dbSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
291730f8ce46Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
291830f8ce46Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2919ce6676dbSmrgfi
2920ce6676dbSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2921ce6676dbSmrg
2922ce6676dbSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2923ce6676dbSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2924ce6676dbSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2925ce6676dbSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2926ce6676dbSmrgelse
2927ce6676dbSmrg	MALLOC_ZERO_CFLAGS=""
2928ce6676dbSmrg	XMALLOC_ZERO_CFLAGS=""
2929ce6676dbSmrg	XTMALLOC_ZERO_CFLAGS=""
2930ce6676dbSmrgfi
2931ce6676dbSmrg
2932ce6676dbSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2933ce6676dbSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2934ce6676dbSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2935ce6676dbSmrg]) # XORG_CHECK_MALLOC_ZERO
2936ce6676dbSmrg
2937ce6676dbSmrg# XORG_WITH_LINT()
2938ce6676dbSmrg# ----------------
2939ce6676dbSmrg# Minimum version: 1.1.0
2940ce6676dbSmrg#
294130f8ce46Smrg# This macro enables the use of a tool that flags some suspicious and
294230f8ce46Smrg# non-portable constructs (likely to be bugs) in C language source code.
294330f8ce46Smrg# It will attempt to locate the tool and use appropriate options.
294430f8ce46Smrg# There are various lint type tools on different platforms.
294530f8ce46Smrg#
294630f8ce46Smrg# Interface to module:
294730f8ce46Smrg# LINT:		returns the path to the tool found on the platform
294830f8ce46Smrg#		or the value set to LINT on the configure cmd line
294930f8ce46Smrg#		also an Automake conditional
295030f8ce46Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
295130f8ce46Smrg#
295230f8ce46Smrg# --with-lint:	'yes' user instructs the module to use lint
295330f8ce46Smrg#		'no' user instructs the module not to use lint (default)
295430f8ce46Smrg#
295530f8ce46Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
295630f8ce46Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2957ce6676dbSmrg#
2958ce6676dbSmrgAC_DEFUN([XORG_WITH_LINT],[
2959ce6676dbSmrg
296030f8ce46SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
296130f8ce46SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
296230f8ce46SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2963ce6676dbSmrg		[Use a lint-style source code checker (default: disabled)])],
2964ce6676dbSmrg		[use_lint=$withval], [use_lint=no])
296530f8ce46Smrg
296630f8ce46Smrg# Obtain platform specific info like program name and options
296730f8ce46Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
296830f8ce46Smrgcase $host_os in
296930f8ce46Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
297030f8ce46Smrg	lint_name=splint
297130f8ce46Smrg	lint_options="-badflag"
297230f8ce46Smrg	;;
297330f8ce46Smrg  *freebsd* | *netbsd*)
297430f8ce46Smrg	lint_name=lint
297530f8ce46Smrg	lint_options="-u -b"
297630f8ce46Smrg	;;
297730f8ce46Smrg  *solaris*)
297830f8ce46Smrg	lint_name=lint
297930f8ce46Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
298030f8ce46Smrg	;;
298130f8ce46Smrgesac
298230f8ce46Smrg
298330f8ce46Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
298430f8ce46Smrgif test "x$use_lint" = x"yes" ; then
298530f8ce46Smrg   AC_PATH_PROG([LINT], [$lint_name])
298630f8ce46Smrg   if test "x$LINT" = "x"; then
298730f8ce46Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
298830f8ce46Smrg   fi
298930f8ce46Smrgelif test "x$use_lint" = x"no" ; then
299030f8ce46Smrg   if test "x$LINT" != "x"; then
299130f8ce46Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
299230f8ce46Smrg   fi
2993ce6676dbSmrgelse
299430f8ce46Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2995ce6676dbSmrgfi
299630f8ce46Smrg
299730f8ce46Smrg# User supplied flags override default flags
299830f8ce46Smrgif test "x$LINT_FLAGS" != "x"; then
299930f8ce46Smrg   lint_options=$LINT_FLAGS
3000ce6676dbSmrgfi
3001ce6676dbSmrg
300230f8ce46SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
300330f8ce46SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3004ce6676dbSmrg
3005ce6676dbSmrg]) # XORG_WITH_LINT
3006ce6676dbSmrg
3007ce6676dbSmrg# XORG_LINT_LIBRARY(LIBNAME)
3008ce6676dbSmrg# --------------------------
3009ce6676dbSmrg# Minimum version: 1.1.0
3010ce6676dbSmrg#
3011ce6676dbSmrg# Sets up flags for building lint libraries for checking programs that call
3012ce6676dbSmrg# functions in the library.
3013ce6676dbSmrg#
301430f8ce46Smrg# Interface to module:
301530f8ce46Smrg# LINTLIB		- Automake variable with the name of lint library file to make
301630f8ce46Smrg# MAKE_LINT_LIB		- Automake conditional
301730f8ce46Smrg#
301830f8ce46Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
301930f8ce46Smrg#			  - 'no' user instructs the module not to create a lint library (default)
3020ce6676dbSmrg
3021ce6676dbSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3022ce6676dbSmrgAC_REQUIRE([XORG_WITH_LINT])
302330f8ce46SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3024ce6676dbSmrg	[Create lint library (default: disabled)])],
3025ce6676dbSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
302630f8ce46Smrg
302730f8ce46Smrgif test "x$make_lint_lib" = x"yes" ; then
302830f8ce46Smrg   LINTLIB=llib-l$1.ln
302930f8ce46Smrg   if test "x$LINT" = "x"; then
303030f8ce46Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
303130f8ce46Smrg   fi
303230f8ce46Smrgelif test "x$make_lint_lib" != x"no" ; then
303330f8ce46Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3034ce6676dbSmrgfi
303530f8ce46Smrg
3036ce6676dbSmrgAC_SUBST(LINTLIB)
3037ce6676dbSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3038ce6676dbSmrg
3039ce6676dbSmrg]) # XORG_LINT_LIBRARY
3040ce6676dbSmrg
304134f90d55Smrg# XORG_COMPILER_BRAND
304234f90d55Smrg# -------------------
304334f90d55Smrg# Minimum version: 1.14.0
304434f90d55Smrg#
304534f90d55Smrg# Checks for various brands of compilers and sets flags as appropriate:
304634f90d55Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
304734f90d55Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
304834f90d55Smrg#   clang compiler - sets CLANGCC to "yes"
304934f90d55Smrg#   Intel compiler - sets INTELCC to "yes"
305034f90d55Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
305134f90d55Smrg#
305234f90d55SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
305334f90d55SmrgAC_LANG_CASE(
305434f90d55Smrg	[C], [
305534f90d55Smrg		AC_REQUIRE([AC_PROG_CC_C99])
305634f90d55Smrg	],
305734f90d55Smrg	[C++], [
305834f90d55Smrg		AC_REQUIRE([AC_PROG_CXX])
305934f90d55Smrg	]
306034f90d55Smrg)
306134f90d55SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
306234f90d55SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
306334f90d55SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
306434f90d55Smrg]) # XORG_COMPILER_BRAND
306534f90d55Smrg
306634f90d55Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
306734f90d55Smrg# ---------------
306834f90d55Smrg# Minimum version: 1.16.0
306934f90d55Smrg#
307034f90d55Smrg# Test if the compiler works when passed the given flag as a command line argument.
307134f90d55Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
307234f90d55Smrg# next flag in the list until there are no more options.
307334f90d55Smrg#
307434f90d55Smrg# Note that this does not guarantee that the compiler supports the flag as some
307534f90d55Smrg# compilers will simply ignore arguments that they do not understand, but we do
307634f90d55Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
307734f90d55Smrg# -Werror=unused-command-line-argument
307834f90d55Smrg#
307934f90d55SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
308034f90d55Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
308134f90d55Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
308234f90d55Smrg
308334f90d55SmrgAC_LANG_COMPILER_REQUIRE
308434f90d55Smrg
308534f90d55SmrgAC_LANG_CASE(
308634f90d55Smrg	[C], [
308734f90d55Smrg		AC_REQUIRE([AC_PROG_CC_C99])
308834f90d55Smrg		define([PREFIX], [C])
308934f90d55Smrg		define([CACHE_PREFIX], [cc])
309034f90d55Smrg		define([COMPILER], [$CC])
309134f90d55Smrg	],
309234f90d55Smrg	[C++], [
309334f90d55Smrg		define([PREFIX], [CXX])
309434f90d55Smrg		define([CACHE_PREFIX], [cxx])
309534f90d55Smrg		define([COMPILER], [$CXX])
309634f90d55Smrg	]
309734f90d55Smrg)
309834f90d55Smrg
309934f90d55Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
310034f90d55Smrg
310134f90d55Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
310234f90d55Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
310334f90d55Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
310434f90d55Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
310534f90d55Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
310634f90d55Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
310734f90d55Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
310834f90d55Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
310934f90d55Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
311034f90d55Smrgfi
311134f90d55Smrg
311234f90d55Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
311334f90d55Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
311434f90d55Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
311534f90d55Smrg	fi
311634f90d55Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
311734f90d55Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
311834f90d55Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
311934f90d55Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
312034f90d55Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
312134f90d55Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
312234f90d55Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
312334f90d55Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
312434f90d55Smrgfi
312534f90d55Smrg
312634f90d55Smrgfound="no"
312734f90d55Smrgm4_foreach([flag], m4_cdr($@), [
312834f90d55Smrg	if test $found = "no" ; then
312934f90d55Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
313034f90d55Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
313134f90d55Smrg		fi
313234f90d55Smrg
313334f90d55Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
313434f90d55Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
313534f90d55Smrg		fi
313634f90d55Smrg
313734f90d55Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
313834f90d55Smrg
313934f90d55Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
314034f90d55Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
314134f90d55Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
314234f90d55Smrg		AC_CACHE_VAL($cacheid,
314334f90d55Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
314434f90d55Smrg					     [eval $cacheid=yes],
314534f90d55Smrg					     [eval $cacheid=no])])
314634f90d55Smrg
314734f90d55Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
314834f90d55Smrg
314934f90d55Smrg		eval supported=\$$cacheid
315034f90d55Smrg		AC_MSG_RESULT([$supported])
315134f90d55Smrg		if test "$supported" = "yes" ; then
315234f90d55Smrg			$1="$$1 ]flag["
315334f90d55Smrg			found="yes"
315434f90d55Smrg		fi
315534f90d55Smrg	fi
315634f90d55Smrg])
315734f90d55Smrg]) # XORG_TESTSET_CFLAG
315834f90d55Smrg
315934f90d55Smrg# XORG_COMPILER_FLAGS
316034f90d55Smrg# ---------------
316134f90d55Smrg# Minimum version: 1.16.0
316234f90d55Smrg#
316334f90d55Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
316434f90d55Smrg# arguments supported by the selected compiler which do NOT alter the generated
316534f90d55Smrg# code.  These arguments will cause the compiler to print various warnings
316634f90d55Smrg# during compilation AND turn a conservative set of warnings into errors.
316734f90d55Smrg#
316834f90d55Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
316934f90d55Smrg# future versions of util-macros as options are added to new compilers.
317034f90d55Smrg#
317134f90d55SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
317234f90d55SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
317334f90d55Smrg
317434f90d55SmrgAC_ARG_ENABLE(selective-werror,
317534f90d55Smrg              AS_HELP_STRING([--disable-selective-werror],
317634f90d55Smrg                             [Turn off selective compiler errors. (default: enabled)]),
317734f90d55Smrg              [SELECTIVE_WERROR=$enableval],
317834f90d55Smrg              [SELECTIVE_WERROR=yes])
317934f90d55Smrg
318034f90d55SmrgAC_LANG_CASE(
318134f90d55Smrg        [C], [
318234f90d55Smrg                define([PREFIX], [C])
318334f90d55Smrg        ],
318434f90d55Smrg        [C++], [
318534f90d55Smrg                define([PREFIX], [CXX])
318634f90d55Smrg        ]
318734f90d55Smrg)
318834f90d55Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
318934f90d55Smrgif test "x$SUNCC" = "xyes"; then
319034f90d55Smrg    [BASE_]PREFIX[FLAGS]="-v"
319134f90d55Smrgelse
319234f90d55Smrg    [BASE_]PREFIX[FLAGS]=""
319334f90d55Smrgfi
319434f90d55Smrg
319534f90d55Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
319634f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
319734f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
319834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
319934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
320034f90d55Smrg
320134f90d55SmrgAC_LANG_CASE(
320234f90d55Smrg	[C], [
320334f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
320434f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
320534f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
320634f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
320734f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
320834f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
320934f90d55Smrg	]
321034f90d55Smrg)
321134f90d55Smrg
321234f90d55Smrg# This chunk adds additional warnings that could catch undesired effects.
321334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
321434f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
321534f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
321634f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
321734f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
321834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
321934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
322034f90d55Smrg
322134f90d55Smrg# These are currently disabled because they are noisy.  They will be enabled
322234f90d55Smrg# in the future once the codebase is sufficiently modernized to silence
322334f90d55Smrg# them.  For now, I don't want them to drown out the other warnings.
322434f90d55Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
322534f90d55Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
322634f90d55Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
322734f90d55Smrg
322834f90d55Smrg# Turn some warnings into errors, so we don't accidently get successful builds
322934f90d55Smrg# when there are problems that should be fixed.
323034f90d55Smrg
323134f90d55Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
323234f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
323334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
323434f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
323534f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
323634f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
323734f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
323834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
323934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
324034f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
324134f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
324234f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
324334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
324434f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
324534f90d55Smrgelse
324634f90d55SmrgAC_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])
324734f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
324834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
324934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
325034f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
325134f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
325234f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
325334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
325434f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
325534f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
325634f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
325734f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
325834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
325934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
326034f90d55Smrgfi
326134f90d55Smrg
326234f90d55SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
326334f90d55Smrg]) # XORG_COMPILER_FLAGS
326434f90d55Smrg
3265ce6676dbSmrg# XORG_CWARNFLAGS
3266ce6676dbSmrg# ---------------
3267ce6676dbSmrg# Minimum version: 1.2.0
326834f90d55Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3269ce6676dbSmrg#
3270ce6676dbSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3271ce6676dbSmrg#
327234f90d55Smrg# This function is deprecated because it defines -fno-strict-aliasing
327334f90d55Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
327434f90d55Smrg# is needed, then it should be added explicitly in the module when
327534f90d55Smrg# it is updated to use BASE_CFLAGS.
327634f90d55Smrg#
3277ce6676dbSmrgAC_DEFUN([XORG_CWARNFLAGS], [
327834f90d55SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
327934f90d55SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
328034f90d55SmrgAC_LANG_CASE(
328134f90d55Smrg	[C], [
328234f90d55Smrg		CWARNFLAGS="$BASE_CFLAGS"
328334f90d55Smrg		if  test "x$GCC" = xyes ; then
328434f90d55Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
328534f90d55Smrg		fi
328634f90d55Smrg		AC_SUBST(CWARNFLAGS)
328734f90d55Smrg	]
328834f90d55Smrg)
3289ce6676dbSmrg]) # XORG_CWARNFLAGS
329030f8ce46Smrg
329130f8ce46Smrg# XORG_STRICT_OPTION
329230f8ce46Smrg# -----------------------
329330f8ce46Smrg# Minimum version: 1.3.0
329430f8ce46Smrg#
329534f90d55Smrg# Add configure option to enable strict compilation flags, such as treating
329634f90d55Smrg# warnings as fatal errors.
329734f90d55Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
329834f90d55Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
329934f90d55Smrg#
330034f90d55Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
330134f90d55Smrg# when strict compilation is unconditionally desired.
330230f8ce46SmrgAC_DEFUN([XORG_STRICT_OPTION], [
330330f8ce46SmrgAC_REQUIRE([XORG_CWARNFLAGS])
330434f90d55SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
330530f8ce46Smrg
330630f8ce46SmrgAC_ARG_ENABLE(strict-compilation,
330730f8ce46Smrg			  AS_HELP_STRING([--enable-strict-compilation],
330830f8ce46Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
330930f8ce46Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
331034f90d55Smrg
331134f90d55SmrgAC_LANG_CASE(
331234f90d55Smrg        [C], [
331334f90d55Smrg                define([PREFIX], [C])
331434f90d55Smrg        ],
331534f90d55Smrg        [C++], [
331634f90d55Smrg                define([PREFIX], [CXX])
331734f90d55Smrg        ]
331834f90d55Smrg)
331934f90d55Smrg
332034f90d55Smrg[STRICT_]PREFIX[FLAGS]=""
332134f90d55SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
332234f90d55SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
332334f90d55Smrg
332434f90d55Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
332534f90d55Smrg# activate it with -Werror, so we add it here explicitly.
332634f90d55SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
332734f90d55Smrg
332830f8ce46Smrgif test "x$STRICT_COMPILE" = "xyes"; then
332934f90d55Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
333034f90d55Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
333130f8ce46Smrgfi
333234f90d55SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
333334f90d55SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
333434f90d55SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
333530f8ce46Smrg]) # XORG_STRICT_OPTION
333630f8ce46Smrg
333730f8ce46Smrg# XORG_DEFAULT_OPTIONS
333830f8ce46Smrg# --------------------
333930f8ce46Smrg# Minimum version: 1.3.0
334030f8ce46Smrg#
334130f8ce46Smrg# Defines default options for X.Org modules.
334230f8ce46Smrg#
334330f8ce46SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
334430f8ce46SmrgAC_REQUIRE([AC_PROG_INSTALL])
334534f90d55SmrgXORG_COMPILER_FLAGS
334630f8ce46SmrgXORG_CWARNFLAGS
334730f8ce46SmrgXORG_STRICT_OPTION
334830f8ce46SmrgXORG_RELEASE_VERSION
334930f8ce46SmrgXORG_CHANGELOG
335030f8ce46SmrgXORG_INSTALL
335130f8ce46SmrgXORG_MANPAGE_SECTIONS
335230f8ce46Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
335330f8ce46Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
335430f8ce46Smrg]) # XORG_DEFAULT_OPTIONS
335530f8ce46Smrg
335630f8ce46Smrg# XORG_INSTALL()
335730f8ce46Smrg# ----------------
335830f8ce46Smrg# Minimum version: 1.4.0
335930f8ce46Smrg#
336030f8ce46Smrg# Defines the variable INSTALL_CMD as the command to copy
336130f8ce46Smrg# INSTALL from $prefix/share/util-macros.
336230f8ce46Smrg#
336330f8ce46SmrgAC_DEFUN([XORG_INSTALL], [
336430f8ce46SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
336530f8ce46Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
336630f8ce46SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
336730f8ce46Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
336830f8ce46Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
336930f8ce46Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
337030f8ce46SmrgAC_SUBST([INSTALL_CMD])
337130f8ce46Smrg]) # XORG_INSTALL
3372ce6676dbSmrgdnl Copyright 2005 Red Hat, Inc
3373ce6676dbSmrgdnl
3374ce6676dbSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3375ce6676dbSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3376ce6676dbSmrgdnl the above copyright notice appear in all copies and that both that
3377ce6676dbSmrgdnl copyright notice and this permission notice appear in supporting
3378ce6676dbSmrgdnl documentation.
3379ce6676dbSmrgdnl
3380ce6676dbSmrgdnl The above copyright notice and this permission notice shall be included
3381ce6676dbSmrgdnl in all copies or substantial portions of the Software.
3382ce6676dbSmrgdnl
3383ce6676dbSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3384ce6676dbSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3385ce6676dbSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3386ce6676dbSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3387ce6676dbSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3388ce6676dbSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3389ce6676dbSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3390ce6676dbSmrgdnl
3391ce6676dbSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3392ce6676dbSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3393ce6676dbSmrgdnl other dealings in this Software without prior written authorization
3394ce6676dbSmrgdnl from the copyright holders.
3395ce6676dbSmrgdnl
3396ce6676dbSmrg
3397ce6676dbSmrg# XORG_RELEASE_VERSION
3398ce6676dbSmrg# --------------------
339930f8ce46Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3400ce6676dbSmrg 
3401ce6676dbSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3402ce6676dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3403ce6676dbSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3404ce6676dbSmrg		[Major version of this package])
3405ce6676dbSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3406ce6676dbSmrg	if test "x$PVM" = "x"; then
3407ce6676dbSmrg		PVM="0"
3408ce6676dbSmrg	fi
3409ce6676dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3410ce6676dbSmrg		[$PVM],
3411ce6676dbSmrg		[Minor version of this package])
3412ce6676dbSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3413ce6676dbSmrg	if test "x$PVP" = "x"; then
3414ce6676dbSmrg		PVP="0"
3415ce6676dbSmrg	fi
3416ce6676dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3417ce6676dbSmrg		[$PVP],
3418ce6676dbSmrg		[Patch version of this package])
3419ce6676dbSmrg])
3420ce6676dbSmrg
3421ce6676dbSmrg# XORG_CHANGELOG()
3422ce6676dbSmrg# ----------------
3423ce6676dbSmrg# Minimum version: 1.2.0
3424ce6676dbSmrg#
3425ce6676dbSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3426ce6676dbSmrg# ChangeLog from git.
3427ce6676dbSmrg#
3428ce6676dbSmrg#
3429ce6676dbSmrgAC_DEFUN([XORG_CHANGELOG], [
343030f8ce46SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
343130f8ce46Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
343230f8ce46Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3433ce6676dbSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3434ce6676dbSmrgAC_SUBST([CHANGELOG_CMD])
3435ce6676dbSmrg]) # XORG_CHANGELOG
3436ce6676dbSmrg
3437ce6676dbSmrgdnl
343834f90d55Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
343930f8ce46Smrgdnl
344030f8ce46Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
344130f8ce46Smrgdnl copy of this software and associated documentation files (the "Software"),
344230f8ce46Smrgdnl to deal in the Software without restriction, including without limitation
344330f8ce46Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
344430f8ce46Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
344530f8ce46Smrgdnl Software is furnished to do so, subject to the following conditions:
344630f8ce46Smrgdnl
344730f8ce46Smrgdnl The above copyright notice and this permission notice (including the next
344830f8ce46Smrgdnl paragraph) shall be included in all copies or substantial portions of the
344930f8ce46Smrgdnl Software.
345030f8ce46Smrgdnl
345130f8ce46Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
345230f8ce46Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
345330f8ce46Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
345430f8ce46Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
345530f8ce46Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
345630f8ce46Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
345730f8ce46Smrgdnl DEALINGS IN THE SOFTWARE.
345834f90d55Smrgdnl
3459ce6676dbSmrg
3460ce6676dbSmrg# XTRANS_TCP_FLAGS()
3461ce6676dbSmrg# ------------------
3462ce6676dbSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
3463ce6676dbSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
3464ce6676dbSmrg # SVR4 hides these in libraries other than libc
3465ce6676dbSmrg AC_SEARCH_LIBS(socket, [socket])
3466ce6676dbSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
346730f8ce46Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
346830f8ce46Smrg   AC_HAVE_LIBRARY([ws2_32])
346930f8ce46Smrg fi
3470ce6676dbSmrg
3471ce6676dbSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
347234f90d55Smrg AC_ARG_ENABLE(ipv6,
3473ce6676dbSmrg	AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
347434f90d55Smrg	[IPV6CONN=$enableval],
3475ce6676dbSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
3476ce6676dbSmrg AC_MSG_CHECKING([if IPv6 support should be built])
3477ce6676dbSmrg if test "$IPV6CONN" = "yes"; then
3478ce6676dbSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
3479ce6676dbSmrg fi
3480ce6676dbSmrg AC_MSG_RESULT($IPV6CONN)
3481ce6676dbSmrg
3482ce6676dbSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
348334f90d55Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
3484ce6676dbSmrg	AC_DEFINE([BSD44SOCKETS],1,
3485ce6676dbSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
3486ce6676dbSmrg#include <sys/types.h>
3487ce6676dbSmrg#include <sys/socket.h>
3488ce6676dbSmrg#include <netinet/in.h>
3489ce6676dbSmrg ])
3490ce6676dbSmrg
3491ce6676dbSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
3492ce6676dbSmrg AC_CHECK_TYPES([socklen_t], [], [], [
3493ce6676dbSmrgAC_INCLUDES_DEFAULT
3494ce6676dbSmrg#include <sys/socket.h>])
349534f90d55Smrg
3496ce6676dbSmrg]) # XTRANS_TCP_FLAGS
3497ce6676dbSmrg
3498ce6676dbSmrg# XTRANS_CONNECTION_FLAGS()
3499ce6676dbSmrg# -------------------------
3500ce6676dbSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
3501ce6676dbSmrg# that use Xtrans functions
3502ce6676dbSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
3503ce6676dbSmrg AC_REQUIRE([AC_CANONICAL_HOST])
3504ce6676dbSmrg AC_REQUIRE([AC_TYPE_SIGNAL])
3505ce6676dbSmrg [case $host_os in
3506ce6676dbSmrg	mingw*)	unixdef="no"   ;;
3507ce6676dbSmrg	*)	unixdef="yes"  ;;
3508ce6676dbSmrg esac]
3509ce6676dbSmrg AC_ARG_ENABLE(unix-transport,
3510ce6676dbSmrg	AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3511ce6676dbSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
3512ce6676dbSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
3513ce6676dbSmrg if test "$UNIXCONN" = "yes"; then
3514ce6676dbSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
3515ce6676dbSmrg fi
3516ce6676dbSmrg AC_MSG_RESULT($UNIXCONN)
351734f90d55Smrg AC_ARG_ENABLE(tcp-transport,
3518ce6676dbSmrg	AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3519ce6676dbSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
3520ce6676dbSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
3521ce6676dbSmrg AC_MSG_RESULT($TCPCONN)
3522ce6676dbSmrg if test "$TCPCONN" = "yes"; then
3523ce6676dbSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
3524ce6676dbSmrg	XTRANS_TCP_FLAGS
3525ce6676dbSmrg fi
3526ce6676dbSmrg [case $host_os in
3527ce6676dbSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
3528ce6676dbSmrg	*)			localdef="no"  ;;
3529ce6676dbSmrg esac]
3530ce6676dbSmrg AC_ARG_ENABLE(local-transport,
3531ce6676dbSmrg	AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
3532ce6676dbSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
3533ce6676dbSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
3534ce6676dbSmrg AC_MSG_RESULT($LOCALCONN)
3535ce6676dbSmrg if test "$LOCALCONN" = "yes"; then
3536ce6676dbSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
3537ce6676dbSmrg fi
353834f90d55Smrg
3539ce6676dbSmrg]) # XTRANS_CONNECTION_FLAGS
3540ce6676dbSmrg
3541ce6676dbSmrg
3542ce6676dbSmrg# XTRANS_SECURE_RPC_FLAGS()
3543ce6676dbSmrg# -------------------------
3544ce6676dbSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
3545ce6676dbSmrg# so that any necessary networking libraries are already found
3546ce6676dbSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
3547ce6676dbSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
354834f90d55Smrg AC_ARG_ENABLE(secure-rpc,
3549ce6676dbSmrg	AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
3550ce6676dbSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
3551ce6676dbSmrg
3552ce6676dbSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
3553ce6676dbSmrg	FOUND_SECURE_RPC="no"
3554ce6676dbSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
3555ce6676dbSmrg			[FOUND_SECURE_RPC="yes"])
3556ce6676dbSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
3557ce6676dbSmrg		if test "x$SECURE_RPC" = "xyes" ; then
3558ce6676dbSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
355934f90d55Smrg		fi
3560ce6676dbSmrg		SECURE_RPC="no"
3561ce6676dbSmrg	else
3562ce6676dbSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
3563ce6676dbSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
3564ce6676dbSmrg		SECURE_RPC="yes"
3565ce6676dbSmrg	fi
3566ce6676dbSmrg fi
3567ce6676dbSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
3568ce6676dbSmrg if test "x$SECURE_RPC" = "xyes" ; then
3569ce6676dbSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
3570ce6676dbSmrg fi
3571ce6676dbSmrg AC_MSG_RESULT($SECURE_RPC)
3572ce6676dbSmrg]) # XTRANS_SECURE_RPC_FLAGS
3573ce6676dbSmrg
3574ce6676dbSmrg
3575