aclocal.m4 revision 8f34cbf9
18f34cbf9Ssnj# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
28f34cbf9Ssnj
38f34cbf9Ssnj# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4bbe1b32bSmrg
5bbe1b32bSmrg# This file is free software; the Free Software Foundation
6bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
7bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
8bbe1b32bSmrg
9bbe1b32bSmrg# This program is distributed in the hope that it will be useful,
10bbe1b32bSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11bbe1b32bSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12bbe1b32bSmrg# PARTICULAR PURPOSE.
13bbe1b32bSmrg
148f34cbf9Ssnjm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
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.
218f34cbf9SsnjTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22bbe1b32bSmrg
238f34cbf9Ssnj# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24ce6676dbSmrg#
25ce6676dbSmrg# This file is free software; the Free Software Foundation
26ce6676dbSmrg# gives unlimited permission to copy and/or distribute it,
27ce6676dbSmrg# with or without modifications, as long as this notice is preserved.
28bbe1b32bSmrg
29ce6676dbSmrg# AM_AUTOMAKE_VERSION(VERSION)
30ce6676dbSmrg# ----------------------------
31ce6676dbSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32ce6676dbSmrg# generated from the m4 files accompanying Automake X.Y.
33ce6676dbSmrg# (This private macro should not be called outside this file.)
34ce6676dbSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
358f34cbf9Ssnj[am__api_version='1.14'
36ce6676dbSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37ce6676dbSmrgdnl require some minimum version.  Point them to the right macro.
388f34cbf9Ssnjm4_if([$1], [1.14.1], [],
39ce6676dbSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40ce6676dbSmrg])
41bbe1b32bSmrg
42ce6676dbSmrg# _AM_AUTOCONF_VERSION(VERSION)
43ce6676dbSmrg# -----------------------------
44ce6676dbSmrg# aclocal traces this macro to find the Autoconf version.
45ce6676dbSmrg# This is a private macro too.  Using m4_define simplifies
46ce6676dbSmrg# the logic in aclocal, which can simply ignore this definition.
47ce6676dbSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48bbe1b32bSmrg
49ce6676dbSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50ce6676dbSmrg# -------------------------------
51ce6676dbSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5230f8ce46Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53ce6676dbSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
548f34cbf9Ssnj[AM_AUTOMAKE_VERSION([1.14.1])dnl
5530f8ce46Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5630f8ce46Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5730f8ce46Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58bbe1b32bSmrg
59ce6676dbSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60bbe1b32bSmrg
618f34cbf9Ssnj# Copyright (C) 2001-2013 Free Software Foundation, Inc.
62bbe1b32bSmrg#
63bbe1b32bSmrg# This file is free software; the Free Software Foundation
64bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
65bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
66bbe1b32bSmrg
67bbe1b32bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
688f34cbf9Ssnj# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
698f34cbf9Ssnj# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70bbe1b32bSmrg#
71bbe1b32bSmrg# Of course, Automake must honor this variable whenever it calls a
72bbe1b32bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73bbe1b32bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74bbe1b32bSmrg# depending on how configure is run.  This is pretty annoying, since
75bbe1b32bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76bbe1b32bSmrg# source directory, any form will work fine, but in subdirectories a
77bbe1b32bSmrg# relative path needs to be adjusted first.
78bbe1b32bSmrg#
79bbe1b32bSmrg# $ac_aux_dir/missing
80bbe1b32bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81bbe1b32bSmrg# $top_srcdir/$ac_aux_dir/missing
82bbe1b32bSmrg#    fails if $ac_aux_dir is absolute,
83bbe1b32bSmrg#    fails when called from a subdirectory in a VPATH build with
84bbe1b32bSmrg#          a relative $ac_aux_dir
85bbe1b32bSmrg#
86bbe1b32bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87bbe1b32bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
888f34cbf9Ssnj# harmless because $srcdir is '.', but things will broke when you
89bbe1b32bSmrg# start a VPATH build or use an absolute $srcdir.
90bbe1b32bSmrg#
91bbe1b32bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92bbe1b32bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93bbe1b32bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94bbe1b32bSmrg# and then we would define $MISSING as
95bbe1b32bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96bbe1b32bSmrg# This will work as long as MISSING is not called from configure, because
97bbe1b32bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98bbe1b32bSmrg# However there are other variables, like CC, which are often used in
99bbe1b32bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100bbe1b32bSmrg#
101bbe1b32bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102bbe1b32bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103bbe1b32bSmrg# configured tree to be moved without reconfiguration.
104bbe1b32bSmrg
105bbe1b32bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106bbe1b32bSmrg[dnl Rely on autoconf to set up CDPATH properly.
107bbe1b32bSmrgAC_PREREQ([2.50])dnl
108bbe1b32bSmrg# expand $ac_aux_dir to an absolute path
109bbe1b32bSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
110bbe1b32bSmrg])
111bbe1b32bSmrg
112bbe1b32bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113bbe1b32bSmrg
1148f34cbf9Ssnj# Copyright (C) 1997-2013 Free Software Foundation, Inc.
115bbe1b32bSmrg#
116bbe1b32bSmrg# This file is free software; the Free Software Foundation
117bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
118bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
119bbe1b32bSmrg
120bbe1b32bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
121bbe1b32bSmrg# -------------------------------------
122bbe1b32bSmrg# Define a conditional.
123bbe1b32bSmrgAC_DEFUN([AM_CONDITIONAL],
1248f34cbf9Ssnj[AC_PREREQ([2.52])dnl
1258f34cbf9Ssnj m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1268f34cbf9Ssnj       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
127bbe1b32bSmrgAC_SUBST([$1_TRUE])dnl
128bbe1b32bSmrgAC_SUBST([$1_FALSE])dnl
129bbe1b32bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
130bbe1b32bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13130f8ce46Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
132bbe1b32bSmrgif $2; then
133bbe1b32bSmrg  $1_TRUE=
134bbe1b32bSmrg  $1_FALSE='#'
135bbe1b32bSmrgelse
136bbe1b32bSmrg  $1_TRUE='#'
137bbe1b32bSmrg  $1_FALSE=
138bbe1b32bSmrgfi
139bbe1b32bSmrgAC_CONFIG_COMMANDS_PRE(
140bbe1b32bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
141bbe1b32bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
142bbe1b32bSmrgUsually this means the macro was only invoked conditionally.]])
143bbe1b32bSmrgfi])])
144bbe1b32bSmrg
1458f34cbf9Ssnj# Copyright (C) 1999-2013 Free Software Foundation, Inc.
146bbe1b32bSmrg#
147bbe1b32bSmrg# This file is free software; the Free Software Foundation
148bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
149bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
150bbe1b32bSmrg
151bbe1b32bSmrg
1528f34cbf9Ssnj# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
153bbe1b32bSmrg# written in clear, in which case automake, when reading aclocal.m4,
154bbe1b32bSmrg# will think it sees a *use*, and therefore will trigger all it's
155bbe1b32bSmrg# C support machinery.  Also note that it means that autoscan, seeing
156bbe1b32bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157bbe1b32bSmrg
158bbe1b32bSmrg
159bbe1b32bSmrg# _AM_DEPENDENCIES(NAME)
160bbe1b32bSmrg# ----------------------
161bbe1b32bSmrg# See how the compiler implements dependency checking.
1628f34cbf9Ssnj# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
163bbe1b32bSmrg# We try a few techniques and use that to set a single cache variable.
164bbe1b32bSmrg#
165bbe1b32bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
166bbe1b32bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
167bbe1b32bSmrg# dependency, and given that the user is not expected to run this macro,
168bbe1b32bSmrg# just rely on AC_PROG_CC.
169bbe1b32bSmrgAC_DEFUN([_AM_DEPENDENCIES],
170bbe1b32bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
171bbe1b32bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
172bbe1b32bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
173bbe1b32bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174bbe1b32bSmrg
1758f34cbf9Ssnjm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1768f34cbf9Ssnj      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1778f34cbf9Ssnj      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1788f34cbf9Ssnj      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1798f34cbf9Ssnj      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1808f34cbf9Ssnj      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1818f34cbf9Ssnj                    [depcc="$$1"   am_compiler_list=])
182bbe1b32bSmrg
183bbe1b32bSmrgAC_CACHE_CHECK([dependency style of $depcc],
184bbe1b32bSmrg               [am_cv_$1_dependencies_compiler_type],
185bbe1b32bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
186bbe1b32bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
187bbe1b32bSmrg  # making bogus files that we don't know about and never remove.  For
188bbe1b32bSmrg  # instance it was reported that on HP-UX the gcc test will end up
1898f34cbf9Ssnj  # making a dummy file named 'D' -- because '-MD' means "put the output
1908f34cbf9Ssnj  # in D".
19134f90d55Smrg  rm -rf conftest.dir
192bbe1b32bSmrg  mkdir conftest.dir
193bbe1b32bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
194bbe1b32bSmrg  # using a relative directory.
195bbe1b32bSmrg  cp "$am_depcomp" conftest.dir
196bbe1b32bSmrg  cd conftest.dir
197bbe1b32bSmrg  # We will build objects and dependencies in a subdirectory because
198bbe1b32bSmrg  # it helps to detect inapplicable dependency modes.  For instance
199bbe1b32bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
200bbe1b32bSmrg  # side effect of compilation, but ICC will put the dependencies in
201bbe1b32bSmrg  # the current directory while Tru64 will put them in the object
202bbe1b32bSmrg  # directory.
203bbe1b32bSmrg  mkdir sub
204bbe1b32bSmrg
205bbe1b32bSmrg  am_cv_$1_dependencies_compiler_type=none
206bbe1b32bSmrg  if test "$am_compiler_list" = ""; then
207bbe1b32bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
208bbe1b32bSmrg  fi
20930f8ce46Smrg  am__universal=false
21030f8ce46Smrg  m4_case([$1], [CC],
21130f8ce46Smrg    [case " $depcc " in #(
21230f8ce46Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21330f8ce46Smrg     esac],
21430f8ce46Smrg    [CXX],
21530f8ce46Smrg    [case " $depcc " in #(
21630f8ce46Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21730f8ce46Smrg     esac])
21830f8ce46Smrg
219bbe1b32bSmrg  for depmode in $am_compiler_list; do
220bbe1b32bSmrg    # Setup a source with many dependencies, because some compilers
221bbe1b32bSmrg    # like to wrap large dependency lists on column 80 (with \), and
222bbe1b32bSmrg    # we should not choose a depcomp mode which is confused by this.
223bbe1b32bSmrg    #
224bbe1b32bSmrg    # We need to recreate these files for each test, as the compiler may
225bbe1b32bSmrg    # overwrite some of them when testing with obscure command lines.
226bbe1b32bSmrg    # This happens at least with the AIX C compiler.
227bbe1b32bSmrg    : > sub/conftest.c
228bbe1b32bSmrg    for i in 1 2 3 4 5 6; do
229bbe1b32bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2308f34cbf9Ssnj      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2318f34cbf9Ssnj      # Solaris 10 /bin/sh.
2328f34cbf9Ssnj      echo '/* dummy */' > sub/conftst$i.h
233bbe1b32bSmrg    done
234bbe1b32bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235bbe1b32bSmrg
2368f34cbf9Ssnj    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23730f8ce46Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2388f34cbf9Ssnj    # handle '-M -o', and we need to detect this.  Also, some Intel
2398f34cbf9Ssnj    # versions had trouble with output in subdirs.
24030f8ce46Smrg    am__obj=sub/conftest.${OBJEXT-o}
24130f8ce46Smrg    am__minus_obj="-o $am__obj"
242bbe1b32bSmrg    case $depmode in
24330f8ce46Smrg    gcc)
24430f8ce46Smrg      # This depmode causes a compiler race in universal mode.
24530f8ce46Smrg      test "$am__universal" = false || continue
24630f8ce46Smrg      ;;
247bbe1b32bSmrg    nosideeffect)
2488f34cbf9Ssnj      # After this tag, mechanisms are not by side-effect, so they'll
2498f34cbf9Ssnj      # only be used when explicitly requested.
250bbe1b32bSmrg      if test "x$enable_dependency_tracking" = xyes; then
251bbe1b32bSmrg	continue
252bbe1b32bSmrg      else
253bbe1b32bSmrg	break
254bbe1b32bSmrg      fi
255bbe1b32bSmrg      ;;
25634f90d55Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2578f34cbf9Ssnj      # This compiler won't grok '-c -o', but also, the minuso test has
25830f8ce46Smrg      # not run yet.  These depmodes are late enough in the game, and
25930f8ce46Smrg      # so weak that their functioning should not be impacted.
26030f8ce46Smrg      am__obj=conftest.${OBJEXT-o}
26130f8ce46Smrg      am__minus_obj=
26230f8ce46Smrg      ;;
263bbe1b32bSmrg    none) break ;;
264bbe1b32bSmrg    esac
265bbe1b32bSmrg    if depmode=$depmode \
26630f8ce46Smrg       source=sub/conftest.c object=$am__obj \
267bbe1b32bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26830f8ce46Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
269bbe1b32bSmrg         >/dev/null 2>conftest.err &&
270bbe1b32bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
271bbe1b32bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27230f8ce46Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
273bbe1b32bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
274bbe1b32bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
275bbe1b32bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
276bbe1b32bSmrg      # that says an option was ignored or not supported.
277bbe1b32bSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
278bbe1b32bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
279bbe1b32bSmrg      # The diagnosis changed in icc 8.0:
280bbe1b32bSmrg      #   icc: Command line remark: option '-MP' not supported
281bbe1b32bSmrg      if (grep 'ignoring option' conftest.err ||
282bbe1b32bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
283bbe1b32bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
284bbe1b32bSmrg        break
285bbe1b32bSmrg      fi
286bbe1b32bSmrg    fi
287bbe1b32bSmrg  done
288bbe1b32bSmrg
289bbe1b32bSmrg  cd ..
290bbe1b32bSmrg  rm -rf conftest.dir
291bbe1b32bSmrgelse
292bbe1b32bSmrg  am_cv_$1_dependencies_compiler_type=none
293bbe1b32bSmrgfi
294bbe1b32bSmrg])
295bbe1b32bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
296bbe1b32bSmrgAM_CONDITIONAL([am__fastdep$1], [
297bbe1b32bSmrg  test "x$enable_dependency_tracking" != xno \
298bbe1b32bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
299bbe1b32bSmrg])
300bbe1b32bSmrg
301bbe1b32bSmrg
302bbe1b32bSmrg# AM_SET_DEPDIR
303bbe1b32bSmrg# -------------
304bbe1b32bSmrg# Choose a directory name for dependency files.
3058f34cbf9Ssnj# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
306bbe1b32bSmrgAC_DEFUN([AM_SET_DEPDIR],
307bbe1b32bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
308bbe1b32bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
309bbe1b32bSmrg])
310bbe1b32bSmrg
311bbe1b32bSmrg
312bbe1b32bSmrg# AM_DEP_TRACK
313bbe1b32bSmrg# ------------
314bbe1b32bSmrgAC_DEFUN([AM_DEP_TRACK],
3158f34cbf9Ssnj[AC_ARG_ENABLE([dependency-tracking], [dnl
3168f34cbf9SsnjAS_HELP_STRING(
3178f34cbf9Ssnj  [--enable-dependency-tracking],
3188f34cbf9Ssnj  [do not reject slow dependency extractors])
3198f34cbf9SsnjAS_HELP_STRING(
3208f34cbf9Ssnj  [--disable-dependency-tracking],
3218f34cbf9Ssnj  [speeds up one-time build])])
322bbe1b32bSmrgif test "x$enable_dependency_tracking" != xno; then
323bbe1b32bSmrg  am_depcomp="$ac_aux_dir/depcomp"
324bbe1b32bSmrg  AMDEPBACKSLASH='\'
32534f90d55Smrg  am__nodep='_no'
326bbe1b32bSmrgfi
327bbe1b32bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
328bbe1b32bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
329bbe1b32bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33034f90d55SmrgAC_SUBST([am__nodep])dnl
33134f90d55Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
332bbe1b32bSmrg])
333bbe1b32bSmrg
334bbe1b32bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335bbe1b32bSmrg
3368f34cbf9Ssnj# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337bbe1b32bSmrg#
338bbe1b32bSmrg# This file is free software; the Free Software Foundation
339bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
340bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
341bbe1b32bSmrg
342bbe1b32bSmrg
343bbe1b32bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
344bbe1b32bSmrg# ------------------------------
345bbe1b32bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34630f8ce46Smrg[{
3478f34cbf9Ssnj  # Older Autoconf quotes --file arguments for eval, but not when files
34830f8ce46Smrg  # are listed without --file.  Let's play safe and only enable the eval
34930f8ce46Smrg  # if we detect the quoting.
35030f8ce46Smrg  case $CONFIG_FILES in
35130f8ce46Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
35230f8ce46Smrg  *)   set x $CONFIG_FILES ;;
35330f8ce46Smrg  esac
35430f8ce46Smrg  shift
35530f8ce46Smrg  for mf
35630f8ce46Smrg  do
35730f8ce46Smrg    # Strip MF so we end up with the name of the file.
35830f8ce46Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35930f8ce46Smrg    # Check whether this is an Automake generated Makefile or not.
3608f34cbf9Ssnj    # We used to match only the files named 'Makefile.in', but
36130f8ce46Smrg    # some people rename them; so instead we look at the file content.
36230f8ce46Smrg    # Grep'ing the first line is not enough: some people post-process
36330f8ce46Smrg    # each Makefile.in and add a new line on top of each file to say so.
36430f8ce46Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
36530f8ce46Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36630f8ce46Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36730f8ce46Smrg      dirpart=`AS_DIRNAME("$mf")`
36830f8ce46Smrg    else
36930f8ce46Smrg      continue
37030f8ce46Smrg    fi
37130f8ce46Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3728f34cbf9Ssnj    # from the Makefile without running 'make'.
37330f8ce46Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37430f8ce46Smrg    test -z "$DEPDIR" && continue
37530f8ce46Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3768f34cbf9Ssnj    test -z "$am__include" && continue
37730f8ce46Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37830f8ce46Smrg    # Find all dependency output files, they are included files with
37930f8ce46Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
38030f8ce46Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38130f8ce46Smrg    # expansion.
38230f8ce46Smrg    for file in `sed -n "
38330f8ce46Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3848f34cbf9Ssnj	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
38530f8ce46Smrg      # Make sure the directory exists.
38630f8ce46Smrg      test -f "$dirpart/$file" && continue
38730f8ce46Smrg      fdir=`AS_DIRNAME(["$file"])`
38830f8ce46Smrg      AS_MKDIR_P([$dirpart/$fdir])
38930f8ce46Smrg      # echo "creating $dirpart/$file"
39030f8ce46Smrg      echo '# dummy' > "$dirpart/$file"
39130f8ce46Smrg    done
392bbe1b32bSmrg  done
39330f8ce46Smrg}
394bbe1b32bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395bbe1b32bSmrg
396bbe1b32bSmrg
397bbe1b32bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
398bbe1b32bSmrg# -----------------------------
399bbe1b32bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
400bbe1b32bSmrg#
401bbe1b32bSmrg# This code is only required when automatic dependency tracking
4028f34cbf9Ssnj# is enabled.  FIXME.  This creates each '.P' file that we will
403bbe1b32bSmrg# need in order to bootstrap the dependency handling code.
404bbe1b32bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
405bbe1b32bSmrg[AC_CONFIG_COMMANDS([depfiles],
406bbe1b32bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
407bbe1b32bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
408bbe1b32bSmrg])
409bbe1b32bSmrg
410bbe1b32bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
411bbe1b32bSmrg
4128f34cbf9Ssnj# Copyright (C) 1996-2013 Free Software Foundation, Inc.
413bbe1b32bSmrg#
414bbe1b32bSmrg# This file is free software; the Free Software Foundation
415bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
416bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
417bbe1b32bSmrg
418bbe1b32bSmrg# This macro actually does too much.  Some checks are only needed if
419bbe1b32bSmrg# your package does certain things.  But this isn't really a big deal.
420bbe1b32bSmrg
4218f34cbf9Ssnjdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4228f34cbf9Ssnjm4_define([AC_PROG_CC],
4238f34cbf9Ssnjm4_defn([AC_PROG_CC])
4248f34cbf9Ssnj[_AM_PROG_CC_C_O
4258f34cbf9Ssnj])
4268f34cbf9Ssnj
427bbe1b32bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
428bbe1b32bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
429bbe1b32bSmrg# -----------------------------------------------
430bbe1b32bSmrg# The call with PACKAGE and VERSION arguments is the old style
431bbe1b32bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
432bbe1b32bSmrg# and VERSION should now be passed to AC_INIT and removed from
433bbe1b32bSmrg# the call to AM_INIT_AUTOMAKE.
434bbe1b32bSmrg# We support both call styles for the transition.  After
435bbe1b32bSmrg# the next Automake release, Autoconf can make the AC_INIT
436bbe1b32bSmrg# arguments mandatory, and then we can depend on a new Autoconf
437bbe1b32bSmrg# release and drop the old call support.
438bbe1b32bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4398f34cbf9Ssnj[AC_PREREQ([2.65])dnl
440bbe1b32bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
441bbe1b32bSmrgdnl the ones we care about.
442bbe1b32bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
443bbe1b32bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
444bbe1b32bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
445bbe1b32bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
446bbe1b32bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
447bbe1b32bSmrg  # is not polluted with repeated "-I."
448bbe1b32bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
449bbe1b32bSmrg  # test to see if srcdir already configured
450bbe1b32bSmrg  if test -f $srcdir/config.status; then
451bbe1b32bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
452bbe1b32bSmrg  fi
453bbe1b32bSmrgfi
454bbe1b32bSmrg
455bbe1b32bSmrg# test whether we have cygpath
456bbe1b32bSmrgif test -z "$CYGPATH_W"; then
457bbe1b32bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
458bbe1b32bSmrg    CYGPATH_W='cygpath -w'
459bbe1b32bSmrg  else
460bbe1b32bSmrg    CYGPATH_W=echo
461bbe1b32bSmrg  fi
462bbe1b32bSmrgfi
463bbe1b32bSmrgAC_SUBST([CYGPATH_W])
464bbe1b32bSmrg
465bbe1b32bSmrg# Define the identity of the package.
466bbe1b32bSmrgdnl Distinguish between old-style and new-style calls.
467bbe1b32bSmrgm4_ifval([$2],
4688f34cbf9Ssnj[AC_DIAGNOSE([obsolete],
4698f34cbf9Ssnj             [$0: two- and three-arguments forms are deprecated.])
4708f34cbf9Ssnjm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
471bbe1b32bSmrg AC_SUBST([PACKAGE], [$1])dnl
472bbe1b32bSmrg AC_SUBST([VERSION], [$2])],
473bbe1b32bSmrg[_AM_SET_OPTIONS([$1])dnl
474bbe1b32bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4758f34cbf9Ssnjm4_if(
4768f34cbf9Ssnj  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4778f34cbf9Ssnj  [ok:ok],,
478bbe1b32bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
479bbe1b32bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
480bbe1b32bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
481bbe1b32bSmrg
482bbe1b32bSmrg_AM_IF_OPTION([no-define],,
4838f34cbf9Ssnj[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4848f34cbf9Ssnj AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
485bbe1b32bSmrg
486bbe1b32bSmrg# Some tools Automake needs.
487bbe1b32bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
488bbe1b32bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4898f34cbf9SsnjAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4908f34cbf9SsnjAM_MISSING_PROG([AUTOCONF], [autoconf])
4918f34cbf9SsnjAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4928f34cbf9SsnjAM_MISSING_PROG([AUTOHEADER], [autoheader])
4938f34cbf9SsnjAM_MISSING_PROG([MAKEINFO], [makeinfo])
49430f8ce46SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49530f8ce46SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4968f34cbf9SsnjAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4978f34cbf9Ssnj# For better backward compatibility.  To be removed once Automake 1.9.x
4988f34cbf9Ssnj# dies out for good.  For more background, see:
4998f34cbf9Ssnj# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
5008f34cbf9Ssnj# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5018f34cbf9SsnjAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
502bbe1b32bSmrg# We need awk for the "check" target.  The system "awk" is bad on
503bbe1b32bSmrg# some platforms.
504bbe1b32bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
505bbe1b32bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
506bbe1b32bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
507bbe1b32bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50830f8ce46Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50930f8ce46Smrg			     [_AM_PROG_TAR([v7])])])
510bbe1b32bSmrg_AM_IF_OPTION([no-dependencies],,
511bbe1b32bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5128f34cbf9Ssnj		  [_AM_DEPENDENCIES([CC])],
5138f34cbf9Ssnj		  [m4_define([AC_PROG_CC],
5148f34cbf9Ssnj			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
515bbe1b32bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5168f34cbf9Ssnj		  [_AM_DEPENDENCIES([CXX])],
5178f34cbf9Ssnj		  [m4_define([AC_PROG_CXX],
5188f34cbf9Ssnj			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
519bbe1b32bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5208f34cbf9Ssnj		  [_AM_DEPENDENCIES([OBJC])],
5218f34cbf9Ssnj		  [m4_define([AC_PROG_OBJC],
5228f34cbf9Ssnj			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5238f34cbf9SsnjAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5248f34cbf9Ssnj		  [_AM_DEPENDENCIES([OBJCXX])],
5258f34cbf9Ssnj		  [m4_define([AC_PROG_OBJCXX],
5268f34cbf9Ssnj			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
527bbe1b32bSmrg])
5288f34cbf9SsnjAC_REQUIRE([AM_SILENT_RULES])dnl
5298f34cbf9Ssnjdnl The testsuite driver may need to know about EXEEXT, so add the
5308f34cbf9Ssnjdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5318f34cbf9Ssnjdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
53230f8ce46SmrgAC_CONFIG_COMMANDS_PRE(dnl
53330f8ce46Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
53430f8ce46Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
535bbe1b32bSmrg
5368f34cbf9Ssnj# POSIX will say in a future version that running "rm -f" with no argument
5378f34cbf9Ssnj# is OK; and we want to be able to make that assumption in our Makefile
5388f34cbf9Ssnj# recipes.  So use an aggressive probe to check that the usage we want is
5398f34cbf9Ssnj# actually supported "in the wild" to an acceptable degree.
5408f34cbf9Ssnj# See automake bug#10828.
5418f34cbf9Ssnj# To make any issue more visible, cause the running configure to be aborted
5428f34cbf9Ssnj# by default if the 'rm' program in use doesn't match our expectations; the
5438f34cbf9Ssnj# user can still override this though.
5448f34cbf9Ssnjif rm -f && rm -fr && rm -rf; then : OK; else
5458f34cbf9Ssnj  cat >&2 <<'END'
5468f34cbf9SsnjOops!
5478f34cbf9Ssnj
5488f34cbf9SsnjYour 'rm' program seems unable to run without file operands specified
5498f34cbf9Ssnjon the command line, even when the '-f' option is present.  This is contrary
5508f34cbf9Ssnjto the behaviour of most rm programs out there, and not conforming with
5518f34cbf9Ssnjthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5528f34cbf9Ssnj
5538f34cbf9SsnjPlease tell bug-automake@gnu.org about your system, including the value
5548f34cbf9Ssnjof your $PATH and any error possibly output before this message.  This
5558f34cbf9Ssnjcan help us improve future automake versions.
5568f34cbf9Ssnj
5578f34cbf9SsnjEND
5588f34cbf9Ssnj  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5598f34cbf9Ssnj    echo 'Configuration will proceed anyway, since you have set the' >&2
5608f34cbf9Ssnj    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5618f34cbf9Ssnj    echo >&2
5628f34cbf9Ssnj  else
5638f34cbf9Ssnj    cat >&2 <<'END'
5648f34cbf9SsnjAborting the configuration process, to ensure you take notice of the issue.
5658f34cbf9Ssnj
5668f34cbf9SsnjYou can download and install GNU coreutils to get an 'rm' implementation
5678f34cbf9Ssnjthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5688f34cbf9Ssnj
5698f34cbf9SsnjIf you want to complete the configuration process using your problematic
5708f34cbf9Ssnj'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5718f34cbf9Ssnjto "yes", and re-run configure.
5728f34cbf9Ssnj
5738f34cbf9SsnjEND
5748f34cbf9Ssnj    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5758f34cbf9Ssnj  fi
5768f34cbf9Ssnjfi])
5778f34cbf9Ssnj
5788f34cbf9Ssnjdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
57930f8ce46Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
58030f8ce46Smrgdnl mangled by Autoconf and run in a shell conditional statement.
58130f8ce46Smrgm4_define([_AC_COMPILER_EXEEXT],
58230f8ce46Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
58330f8ce46Smrg
584bbe1b32bSmrg# When config.status generates a header, we must update the stamp-h file.
585bbe1b32bSmrg# This file resides in the same directory as the config header
586bbe1b32bSmrg# that is generated.  The stamp files are numbered to have different names.
587bbe1b32bSmrg
588bbe1b32bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
589bbe1b32bSmrg# loop where config.status creates the headers, so we can generate
590bbe1b32bSmrg# our stamp files there.
591bbe1b32bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
592bbe1b32bSmrg[# Compute $1's index in $config_headers.
59330f8ce46Smrg_am_arg=$1
594bbe1b32bSmrg_am_stamp_count=1
595bbe1b32bSmrgfor _am_header in $config_headers :; do
596bbe1b32bSmrg  case $_am_header in
59730f8ce46Smrg    $_am_arg | $_am_arg:* )
598bbe1b32bSmrg      break ;;
599bbe1b32bSmrg    * )
600bbe1b32bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
601bbe1b32bSmrg  esac
602bbe1b32bSmrgdone
60330f8ce46Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
604bbe1b32bSmrg
6058f34cbf9Ssnj# Copyright (C) 2001-2013 Free Software Foundation, Inc.
606bbe1b32bSmrg#
607bbe1b32bSmrg# This file is free software; the Free Software Foundation
608bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
609bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
610bbe1b32bSmrg
611bbe1b32bSmrg# AM_PROG_INSTALL_SH
612bbe1b32bSmrg# ------------------
613bbe1b32bSmrg# Define $install_sh.
614bbe1b32bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
615bbe1b32bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
61630f8ce46Smrgif test x"${install_sh}" != xset; then
61730f8ce46Smrg  case $am_aux_dir in
61830f8ce46Smrg  *\ * | *\	*)
61930f8ce46Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
62030f8ce46Smrg  *)
62130f8ce46Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
62230f8ce46Smrg  esac
62330f8ce46Smrgfi
6248f34cbf9SsnjAC_SUBST([install_sh])])
625bbe1b32bSmrg
6268f34cbf9Ssnj# Copyright (C) 2003-2013 Free Software Foundation, Inc.
627bbe1b32bSmrg#
628bbe1b32bSmrg# This file is free software; the Free Software Foundation
629bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
630bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
631bbe1b32bSmrg
632bbe1b32bSmrg# Check whether the underlying file-system supports filenames
633bbe1b32bSmrg# with a leading dot.  For instance MS-DOS doesn't.
634bbe1b32bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
635bbe1b32bSmrg[rm -rf .tst 2>/dev/null
636bbe1b32bSmrgmkdir .tst 2>/dev/null
637bbe1b32bSmrgif test -d .tst; then
638bbe1b32bSmrg  am__leading_dot=.
639bbe1b32bSmrgelse
640bbe1b32bSmrg  am__leading_dot=_
641bbe1b32bSmrgfi
642bbe1b32bSmrgrmdir .tst 2>/dev/null
643bbe1b32bSmrgAC_SUBST([am__leading_dot])])
644bbe1b32bSmrg
645bbe1b32bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
646bbe1b32bSmrg
6478f34cbf9Ssnj# Copyright (C) 2001-2013 Free Software Foundation, Inc.
648bbe1b32bSmrg#
649bbe1b32bSmrg# This file is free software; the Free Software Foundation
650bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
651bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
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
6708f34cbf9Ssnj# 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
6978f34cbf9Ssnj# Copyright (C) 1997-2013 Free Software Foundation, Inc.
698bbe1b32bSmrg#
699bbe1b32bSmrg# This file is free software; the Free Software Foundation
700bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
701bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
702bbe1b32bSmrg
703bbe1b32bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
704bbe1b32bSmrg# ------------------------------
705bbe1b32bSmrgAC_DEFUN([AM_MISSING_PROG],
706bbe1b32bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
707bbe1b32bSmrg$1=${$1-"${am_missing_run}$2"}
708bbe1b32bSmrgAC_SUBST($1)])
709bbe1b32bSmrg
710bbe1b32bSmrg# AM_MISSING_HAS_RUN
711bbe1b32bSmrg# ------------------
7128f34cbf9Ssnj# Define MISSING if not defined so far and test if it is modern enough.
7138f34cbf9Ssnj# If it is, set am_missing_run to use it, otherwise, to nothing.
714bbe1b32bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
715bbe1b32bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
716bbe1b32bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
71730f8ce46Smrgif test x"${MISSING+set}" != xset; then
71830f8ce46Smrg  case $am_aux_dir in
71930f8ce46Smrg  *\ * | *\	*)
72030f8ce46Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72130f8ce46Smrg  *)
72230f8ce46Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72330f8ce46Smrg  esac
72430f8ce46Smrgfi
725bbe1b32bSmrg# Use eval to expand $SHELL
7268f34cbf9Ssnjif eval "$MISSING --is-lightweight"; then
7278f34cbf9Ssnj  am_missing_run="$MISSING "
728bbe1b32bSmrgelse
729bbe1b32bSmrg  am_missing_run=
7308f34cbf9Ssnj  AC_MSG_WARN(['missing' script is too old or missing])
731bbe1b32bSmrgfi
732bbe1b32bSmrg])
733bbe1b32bSmrg
734bbe1b32bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
735bbe1b32bSmrg
7368f34cbf9Ssnj# Copyright (C) 2001-2013 Free Software Foundation, Inc.
737bbe1b32bSmrg#
738bbe1b32bSmrg# This file is free software; the Free Software Foundation
739bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
740bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
741bbe1b32bSmrg
742bbe1b32bSmrg# _AM_MANGLE_OPTION(NAME)
743bbe1b32bSmrg# -----------------------
744bbe1b32bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
745bbe1b32bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
746bbe1b32bSmrg
747bbe1b32bSmrg# _AM_SET_OPTION(NAME)
74834f90d55Smrg# --------------------
749bbe1b32bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
750bbe1b32bSmrgAC_DEFUN([_AM_SET_OPTION],
7518f34cbf9Ssnj[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
752bbe1b32bSmrg
753bbe1b32bSmrg# _AM_SET_OPTIONS(OPTIONS)
75434f90d55Smrg# ------------------------
755bbe1b32bSmrg# OPTIONS is a space-separated list of Automake options.
756bbe1b32bSmrgAC_DEFUN([_AM_SET_OPTIONS],
75730f8ce46Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
758bbe1b32bSmrg
759bbe1b32bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
760bbe1b32bSmrg# -------------------------------------------
761bbe1b32bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
762bbe1b32bSmrgAC_DEFUN([_AM_IF_OPTION],
763bbe1b32bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
764bbe1b32bSmrg
7658f34cbf9Ssnj# Copyright (C) 1999-2013 Free Software Foundation, Inc.
7668f34cbf9Ssnj#
7678f34cbf9Ssnj# This file is free software; the Free Software Foundation
7688f34cbf9Ssnj# gives unlimited permission to copy and/or distribute it,
7698f34cbf9Ssnj# with or without modifications, as long as this notice is preserved.
7708f34cbf9Ssnj
7718f34cbf9Ssnj# _AM_PROG_CC_C_O
7728f34cbf9Ssnj# ---------------
7738f34cbf9Ssnj# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7748f34cbf9Ssnj# to automatically call this.
7758f34cbf9SsnjAC_DEFUN([_AM_PROG_CC_C_O],
7768f34cbf9Ssnj[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7778f34cbf9SsnjAC_REQUIRE_AUX_FILE([compile])dnl
7788f34cbf9SsnjAC_LANG_PUSH([C])dnl
7798f34cbf9SsnjAC_CACHE_CHECK(
7808f34cbf9Ssnj  [whether $CC understands -c and -o together],
7818f34cbf9Ssnj  [am_cv_prog_cc_c_o],
7828f34cbf9Ssnj  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7838f34cbf9Ssnj  # Make sure it works both with $CC and with simple cc.
7848f34cbf9Ssnj  # Following AC_PROG_CC_C_O, we do the test twice because some
7858f34cbf9Ssnj  # compilers refuse to overwrite an existing .o file with -o,
7868f34cbf9Ssnj  # though they will create one.
7878f34cbf9Ssnj  am_cv_prog_cc_c_o=yes
7888f34cbf9Ssnj  for am_i in 1 2; do
7898f34cbf9Ssnj    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7908f34cbf9Ssnj         && test -f conftest2.$ac_objext; then
7918f34cbf9Ssnj      : OK
7928f34cbf9Ssnj    else
7938f34cbf9Ssnj      am_cv_prog_cc_c_o=no
7948f34cbf9Ssnj      break
7958f34cbf9Ssnj    fi
7968f34cbf9Ssnj  done
7978f34cbf9Ssnj  rm -f core conftest*
7988f34cbf9Ssnj  unset am_i])
7998f34cbf9Ssnjif test "$am_cv_prog_cc_c_o" != yes; then
8008f34cbf9Ssnj   # Losing compiler, so override with the script.
8018f34cbf9Ssnj   # FIXME: It is wrong to rewrite CC.
8028f34cbf9Ssnj   # But if we don't then we get into trouble of one sort or another.
8038f34cbf9Ssnj   # A longer-term fix would be to have automake use am__CC in this case,
8048f34cbf9Ssnj   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8058f34cbf9Ssnj   CC="$am_aux_dir/compile $CC"
8068f34cbf9Ssnjfi
8078f34cbf9SsnjAC_LANG_POP([C])])
808bbe1b32bSmrg
8098f34cbf9Ssnj# For backward compatibility.
8108f34cbf9SsnjAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8118f34cbf9Ssnj
8128f34cbf9Ssnj# Copyright (C) 2001-2013 Free Software Foundation, Inc.
813bbe1b32bSmrg#
814bbe1b32bSmrg# This file is free software; the Free Software Foundation
815bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
816bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
817bbe1b32bSmrg
8188f34cbf9Ssnj# AM_RUN_LOG(COMMAND)
8198f34cbf9Ssnj# -------------------
8208f34cbf9Ssnj# Run COMMAND, save the exit status in ac_status, and log it.
8218f34cbf9Ssnj# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8228f34cbf9SsnjAC_DEFUN([AM_RUN_LOG],
8238f34cbf9Ssnj[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8248f34cbf9Ssnj   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8258f34cbf9Ssnj   ac_status=$?
8268f34cbf9Ssnj   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8278f34cbf9Ssnj   (exit $ac_status); }])
8288f34cbf9Ssnj
8298f34cbf9Ssnj# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8308f34cbf9Ssnj
8318f34cbf9Ssnj# Copyright (C) 1996-2013 Free Software Foundation, Inc.
8328f34cbf9Ssnj#
8338f34cbf9Ssnj# This file is free software; the Free Software Foundation
8348f34cbf9Ssnj# gives unlimited permission to copy and/or distribute it,
8358f34cbf9Ssnj# with or without modifications, as long as this notice is preserved.
836bbe1b32bSmrg
837bbe1b32bSmrg# AM_SANITY_CHECK
838bbe1b32bSmrg# ---------------
839bbe1b32bSmrgAC_DEFUN([AM_SANITY_CHECK],
840bbe1b32bSmrg[AC_MSG_CHECKING([whether build environment is sane])
84130f8ce46Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84230f8ce46Smrg# name.  Accept space and tab only in the latter.
84330f8ce46Smrgam_lf='
84430f8ce46Smrg'
84530f8ce46Smrgcase `pwd` in
84630f8ce46Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84730f8ce46Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84830f8ce46Smrgesac
84930f8ce46Smrgcase $srcdir in
85030f8ce46Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8518f34cbf9Ssnj    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85230f8ce46Smrgesac
85330f8ce46Smrg
8548f34cbf9Ssnj# Do 'set' in a subshell so we don't clobber the current shell's
855bbe1b32bSmrg# arguments.  Must try -L first in case configure is actually a
856bbe1b32bSmrg# symlink; some systems play weird games with the mod time of symlinks
857bbe1b32bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
858bbe1b32bSmrg# directory).
859bbe1b32bSmrgif (
8608f34cbf9Ssnj   am_has_slept=no
8618f34cbf9Ssnj   for am_try in 1 2; do
8628f34cbf9Ssnj     echo "timestamp, slept: $am_has_slept" > conftest.file
8638f34cbf9Ssnj     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8648f34cbf9Ssnj     if test "$[*]" = "X"; then
8658f34cbf9Ssnj	# -L didn't work.
8668f34cbf9Ssnj	set X `ls -t "$srcdir/configure" conftest.file`
8678f34cbf9Ssnj     fi
8688f34cbf9Ssnj     if test "$[*]" != "X $srcdir/configure conftest.file" \
8698f34cbf9Ssnj	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8708f34cbf9Ssnj
8718f34cbf9Ssnj	# If neither matched, then we have a broken ls.  This can happen
8728f34cbf9Ssnj	# if, for instance, CONFIG_SHELL is bash and it inherits a
8738f34cbf9Ssnj	# broken ls alias from the environment.  This has actually
8748f34cbf9Ssnj	# happened.  Such a system could not be considered "sane".
8758f34cbf9Ssnj	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8768f34cbf9Ssnj  alias in your environment])
8778f34cbf9Ssnj     fi
8788f34cbf9Ssnj     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8798f34cbf9Ssnj       break
8808f34cbf9Ssnj     fi
8818f34cbf9Ssnj     # Just in case.
8828f34cbf9Ssnj     sleep 1
8838f34cbf9Ssnj     am_has_slept=yes
8848f34cbf9Ssnj   done
885bbe1b32bSmrg   test "$[2]" = conftest.file
886bbe1b32bSmrg   )
887bbe1b32bSmrgthen
888bbe1b32bSmrg   # Ok.
889bbe1b32bSmrg   :
890bbe1b32bSmrgelse
891bbe1b32bSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
892bbe1b32bSmrgCheck your system clock])
893bbe1b32bSmrgfi
8948f34cbf9SsnjAC_MSG_RESULT([yes])
8958f34cbf9Ssnj# If we didn't sleep, we still need to ensure time stamps of config.status and
8968f34cbf9Ssnj# generated files are strictly newer.
8978f34cbf9Ssnjam_sleep_pid=
8988f34cbf9Ssnjif grep 'slept: no' conftest.file >/dev/null 2>&1; then
8998f34cbf9Ssnj  ( sleep 1 ) &
9008f34cbf9Ssnj  am_sleep_pid=$!
9018f34cbf9Ssnjfi
9028f34cbf9SsnjAC_CONFIG_COMMANDS_PRE(
9038f34cbf9Ssnj  [AC_MSG_CHECKING([that generated files are newer than configure])
9048f34cbf9Ssnj   if test -n "$am_sleep_pid"; then
9058f34cbf9Ssnj     # Hide warnings about reused PIDs.
9068f34cbf9Ssnj     wait $am_sleep_pid 2>/dev/null
9078f34cbf9Ssnj   fi
9088f34cbf9Ssnj   AC_MSG_RESULT([done])])
9098f34cbf9Ssnjrm -f conftest.file
9108f34cbf9Ssnj])
911bbe1b32bSmrg
9128f34cbf9Ssnj# Copyright (C) 2009-2013 Free Software Foundation, Inc.
91330f8ce46Smrg#
91430f8ce46Smrg# This file is free software; the Free Software Foundation
91530f8ce46Smrg# gives unlimited permission to copy and/or distribute it,
91630f8ce46Smrg# with or without modifications, as long as this notice is preserved.
91730f8ce46Smrg
91830f8ce46Smrg# AM_SILENT_RULES([DEFAULT])
91930f8ce46Smrg# --------------------------
92030f8ce46Smrg# Enable less verbose build rules; with the default set to DEFAULT
9218f34cbf9Ssnj# ("yes" being less verbose, "no" or empty being verbose).
92230f8ce46SmrgAC_DEFUN([AM_SILENT_RULES],
9238f34cbf9Ssnj[AC_ARG_ENABLE([silent-rules], [dnl
9248f34cbf9SsnjAS_HELP_STRING(
9258f34cbf9Ssnj  [--enable-silent-rules],
9268f34cbf9Ssnj  [less verbose build output (undo: "make V=1")])
9278f34cbf9SsnjAS_HELP_STRING(
9288f34cbf9Ssnj  [--disable-silent-rules],
9298f34cbf9Ssnj  [verbose build output (undo: "make V=0")])dnl
9308f34cbf9Ssnj])
9318f34cbf9Ssnjcase $enable_silent_rules in @%:@ (((
9328f34cbf9Ssnj  yes) AM_DEFAULT_VERBOSITY=0;;
9338f34cbf9Ssnj   no) AM_DEFAULT_VERBOSITY=1;;
9348f34cbf9Ssnj    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93530f8ce46Smrgesac
9368f34cbf9Ssnjdnl
9378f34cbf9Ssnjdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9388f34cbf9Ssnjdnl do not support nested variable expansions.
9398f34cbf9Ssnjdnl See automake bug#9928 and bug#10237.
9408f34cbf9Ssnjam_make=${MAKE-make}
9418f34cbf9SsnjAC_CACHE_CHECK([whether $am_make supports nested variables],
9428f34cbf9Ssnj   [am_cv_make_support_nested_variables],
9438f34cbf9Ssnj   [if AS_ECHO([['TRUE=$(BAR$(V))
9448f34cbf9SsnjBAR0=false
9458f34cbf9SsnjBAR1=true
9468f34cbf9SsnjV=1
9478f34cbf9Ssnjam__doit:
9488f34cbf9Ssnj	@$(TRUE)
9498f34cbf9Ssnj.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9508f34cbf9Ssnj  am_cv_make_support_nested_variables=yes
9518f34cbf9Ssnjelse
9528f34cbf9Ssnj  am_cv_make_support_nested_variables=no
9538f34cbf9Ssnjfi])
9548f34cbf9Ssnjif test $am_cv_make_support_nested_variables = yes; then
9558f34cbf9Ssnj  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9568f34cbf9Ssnj  AM_V='$(V)'
9578f34cbf9Ssnj  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9588f34cbf9Ssnjelse
9598f34cbf9Ssnj  AM_V=$AM_DEFAULT_VERBOSITY
9608f34cbf9Ssnj  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9618f34cbf9Ssnjfi
9628f34cbf9SsnjAC_SUBST([AM_V])dnl
9638f34cbf9SsnjAM_SUBST_NOTMAKE([AM_V])dnl
9648f34cbf9SsnjAC_SUBST([AM_DEFAULT_V])dnl
9658f34cbf9SsnjAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96630f8ce46SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96730f8ce46SmrgAM_BACKSLASH='\'
96830f8ce46SmrgAC_SUBST([AM_BACKSLASH])dnl
96930f8ce46Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97030f8ce46Smrg])
97130f8ce46Smrg
9728f34cbf9Ssnj# Copyright (C) 2001-2013 Free Software Foundation, Inc.
973bbe1b32bSmrg#
974bbe1b32bSmrg# This file is free software; the Free Software Foundation
975bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
976bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
977bbe1b32bSmrg
978bbe1b32bSmrg# AM_PROG_INSTALL_STRIP
979bbe1b32bSmrg# ---------------------
9808f34cbf9Ssnj# One issue with vendor 'install' (even GNU) is that you can't
981bbe1b32bSmrg# specify the program used to strip binaries.  This is especially
982bbe1b32bSmrg# annoying in cross-compiling environments, where the build's strip
983bbe1b32bSmrg# is unlikely to handle the host's binaries.
984bbe1b32bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9858f34cbf9Ssnj# always use install-sh in "make install-strip", and initialize
986bbe1b32bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
987bbe1b32bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
988bbe1b32bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9898f34cbf9Ssnj# Installed binaries are usually stripped using 'strip' when the user
9908f34cbf9Ssnj# run "make install-strip".  However 'strip' might not be the right
991bbe1b32bSmrg# tool to use in cross-compilation environments, therefore Automake
9928f34cbf9Ssnj# will honor the 'STRIP' environment variable to overrule this program.
9938f34cbf9Ssnjdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
994bbe1b32bSmrgif test "$cross_compiling" != no; then
995bbe1b32bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
996bbe1b32bSmrgfi
997bbe1b32bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
998bbe1b32bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
999bbe1b32bSmrg
10008f34cbf9Ssnj# Copyright (C) 2006-2013 Free Software Foundation, Inc.
100130f8ce46Smrg#
100230f8ce46Smrg# This file is free software; the Free Software Foundation
100330f8ce46Smrg# gives unlimited permission to copy and/or distribute it,
100430f8ce46Smrg# with or without modifications, as long as this notice is preserved.
100530f8ce46Smrg
100630f8ce46Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100730f8ce46Smrg# ---------------------------
100830f8ce46Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
100930f8ce46Smrg# This macro is traced by Automake.
101030f8ce46SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101130f8ce46Smrg
101230f8ce46Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101334f90d55Smrg# --------------------------
101430f8ce46Smrg# Public sister of _AM_SUBST_NOTMAKE.
101530f8ce46SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101630f8ce46Smrg
101730f8ce46Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101830f8ce46Smrg
10198f34cbf9Ssnj# Copyright (C) 2004-2013 Free Software Foundation, Inc.
102030f8ce46Smrg#
102130f8ce46Smrg# This file is free software; the Free Software Foundation
102230f8ce46Smrg# gives unlimited permission to copy and/or distribute it,
102330f8ce46Smrg# with or without modifications, as long as this notice is preserved.
102430f8ce46Smrg
102530f8ce46Smrg# _AM_PROG_TAR(FORMAT)
102630f8ce46Smrg# --------------------
102730f8ce46Smrg# Check how to create a tarball in format FORMAT.
10288f34cbf9Ssnj# FORMAT should be one of 'v7', 'ustar', or 'pax'.
102930f8ce46Smrg#
103030f8ce46Smrg# Substitute a variable $(am__tar) that is a command
103130f8ce46Smrg# writing to stdout a FORMAT-tarball containing the directory
103230f8ce46Smrg# $tardir.
103330f8ce46Smrg#     tardir=directory && $(am__tar) > result.tar
103430f8ce46Smrg#
103530f8ce46Smrg# Substitute a variable $(am__untar) that extract such
103630f8ce46Smrg# a tarball read from stdin.
103730f8ce46Smrg#     $(am__untar) < result.tar
10388f34cbf9Ssnj#
103930f8ce46SmrgAC_DEFUN([_AM_PROG_TAR],
10408f34cbf9Ssnj[# Always define AMTAR for backward compatibility.  Yes, it's still used
10418f34cbf9Ssnj# in the wild :-(  We should find a proper way to deprecate it ...
10428f34cbf9SsnjAC_SUBST([AMTAR], ['$${TAR-tar}'])
10438f34cbf9Ssnj
10448f34cbf9Ssnj# We'll loop over all known methods to create a tar archive until one works.
104530f8ce46Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104630f8ce46Smrg
10478f34cbf9Ssnjm4_if([$1], [v7],
10488f34cbf9Ssnj  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10498f34cbf9Ssnj
10508f34cbf9Ssnj  [m4_case([$1],
10518f34cbf9Ssnj    [ustar],
10528f34cbf9Ssnj     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10538f34cbf9Ssnj      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10548f34cbf9Ssnj      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10558f34cbf9Ssnj      # and bug#13588).
10568f34cbf9Ssnj      am_max_uid=2097151 # 2^21 - 1
10578f34cbf9Ssnj      am_max_gid=$am_max_uid
10588f34cbf9Ssnj      # The $UID and $GID variables are not portable, so we need to resort
10598f34cbf9Ssnj      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10608f34cbf9Ssnj      # below are definitely unexpected, so allow the users to see them
10618f34cbf9Ssnj      # (that is, avoid stderr redirection).
10628f34cbf9Ssnj      am_uid=`id -u || echo unknown`
10638f34cbf9Ssnj      am_gid=`id -g || echo unknown`
10648f34cbf9Ssnj      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10658f34cbf9Ssnj      if test $am_uid -le $am_max_uid; then
10668f34cbf9Ssnj         AC_MSG_RESULT([yes])
10678f34cbf9Ssnj      else
10688f34cbf9Ssnj         AC_MSG_RESULT([no])
10698f34cbf9Ssnj         _am_tools=none
10708f34cbf9Ssnj      fi
10718f34cbf9Ssnj      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10728f34cbf9Ssnj      if test $am_gid -le $am_max_gid; then
10738f34cbf9Ssnj         AC_MSG_RESULT([yes])
10748f34cbf9Ssnj      else
10758f34cbf9Ssnj        AC_MSG_RESULT([no])
10768f34cbf9Ssnj        _am_tools=none
10778f34cbf9Ssnj      fi],
10788f34cbf9Ssnj
10798f34cbf9Ssnj  [pax],
10808f34cbf9Ssnj    [],
10818f34cbf9Ssnj
10828f34cbf9Ssnj  [m4_fatal([Unknown tar format])])
10838f34cbf9Ssnj
10848f34cbf9Ssnj  AC_MSG_CHECKING([how to create a $1 tar archive])
10858f34cbf9Ssnj
10868f34cbf9Ssnj  # Go ahead even if we have the value already cached.  We do so because we
10878f34cbf9Ssnj  # need to set the values for the 'am__tar' and 'am__untar' variables.
10888f34cbf9Ssnj  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10898f34cbf9Ssnj
10908f34cbf9Ssnj  for _am_tool in $_am_tools; do
10918f34cbf9Ssnj    case $_am_tool in
10928f34cbf9Ssnj    gnutar)
10938f34cbf9Ssnj      for _am_tar in tar gnutar gtar; do
10948f34cbf9Ssnj        AM_RUN_LOG([$_am_tar --version]) && break
10958f34cbf9Ssnj      done
10968f34cbf9Ssnj      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10978f34cbf9Ssnj      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10988f34cbf9Ssnj      am__untar="$_am_tar -xf -"
10998f34cbf9Ssnj      ;;
11008f34cbf9Ssnj    plaintar)
11018f34cbf9Ssnj      # Must skip GNU tar: if it does not support --format= it doesn't create
11028f34cbf9Ssnj      # ustar tarball either.
11038f34cbf9Ssnj      (tar --version) >/dev/null 2>&1 && continue
11048f34cbf9Ssnj      am__tar='tar chf - "$$tardir"'
11058f34cbf9Ssnj      am__tar_='tar chf - "$tardir"'
11068f34cbf9Ssnj      am__untar='tar xf -'
11078f34cbf9Ssnj      ;;
11088f34cbf9Ssnj    pax)
11098f34cbf9Ssnj      am__tar='pax -L -x $1 -w "$$tardir"'
11108f34cbf9Ssnj      am__tar_='pax -L -x $1 -w "$tardir"'
11118f34cbf9Ssnj      am__untar='pax -r'
11128f34cbf9Ssnj      ;;
11138f34cbf9Ssnj    cpio)
11148f34cbf9Ssnj      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11158f34cbf9Ssnj      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11168f34cbf9Ssnj      am__untar='cpio -i -H $1 -d'
11178f34cbf9Ssnj      ;;
11188f34cbf9Ssnj    none)
11198f34cbf9Ssnj      am__tar=false
11208f34cbf9Ssnj      am__tar_=false
11218f34cbf9Ssnj      am__untar=false
11228f34cbf9Ssnj      ;;
11238f34cbf9Ssnj    esac
112430f8ce46Smrg
11258f34cbf9Ssnj    # If the value was cached, stop now.  We just wanted to have am__tar
11268f34cbf9Ssnj    # and am__untar set.
11278f34cbf9Ssnj    test -n "${am_cv_prog_tar_$1}" && break
11288f34cbf9Ssnj
11298f34cbf9Ssnj    # tar/untar a dummy directory, and stop if the command works.
11308f34cbf9Ssnj    rm -rf conftest.dir
11318f34cbf9Ssnj    mkdir conftest.dir
11328f34cbf9Ssnj    echo GrepMe > conftest.dir/file
11338f34cbf9Ssnj    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11348f34cbf9Ssnj    rm -rf conftest.dir
11358f34cbf9Ssnj    if test -s conftest.tar; then
11368f34cbf9Ssnj      AM_RUN_LOG([$am__untar <conftest.tar])
11378f34cbf9Ssnj      AM_RUN_LOG([cat conftest.dir/file])
11388f34cbf9Ssnj      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11398f34cbf9Ssnj    fi
11408f34cbf9Ssnj  done
114130f8ce46Smrg  rm -rf conftest.dir
114230f8ce46Smrg
11438f34cbf9Ssnj  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11448f34cbf9Ssnj  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11458f34cbf9Ssnj
114630f8ce46SmrgAC_SUBST([am__tar])
114730f8ce46SmrgAC_SUBST([am__untar])
114830f8ce46Smrg]) # _AM_PROG_TAR
114930f8ce46Smrg
115030f8ce46Smrgm4_include([m4/ax_define_dir.m4])
115134f90d55Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
115234f90d55Smrg# 
115334f90d55Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115434f90d55Smrg#
115534f90d55Smrg# This program is free software; you can redistribute it and/or modify
115634f90d55Smrg# it under the terms of the GNU General Public License as published by
115734f90d55Smrg# the Free Software Foundation; either version 2 of the License, or
115834f90d55Smrg# (at your option) any later version.
115934f90d55Smrg#
116034f90d55Smrg# This program is distributed in the hope that it will be useful, but
116134f90d55Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
116234f90d55Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
116334f90d55Smrg# General Public License for more details.
116434f90d55Smrg#
116534f90d55Smrg# You should have received a copy of the GNU General Public License
116634f90d55Smrg# along with this program; if not, write to the Free Software
116734f90d55Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
116834f90d55Smrg#
116934f90d55Smrg# As a special exception to the GNU General Public License, if you
117034f90d55Smrg# distribute this file as part of a program that contains a
117134f90d55Smrg# configuration script generated by Autoconf, you may include it under
117234f90d55Smrg# the same distribution terms that you use for the rest of that program.
117334f90d55Smrg
117434f90d55Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
117534f90d55Smrg# ----------------------------------
117634f90d55SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
117734f90d55Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
117834f90d55Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
117934f90d55SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
118034f90d55Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
118134f90d55Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
118234f90d55Smrgfi
118334f90d55Smrgif test -n "$PKG_CONFIG"; then
118434f90d55Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
118534f90d55Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
118634f90d55Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
118734f90d55Smrg		AC_MSG_RESULT([yes])
118834f90d55Smrg	else
118934f90d55Smrg		AC_MSG_RESULT([no])
119034f90d55Smrg		PKG_CONFIG=""
119134f90d55Smrg	fi
119234f90d55Smrg		
119334f90d55Smrgfi[]dnl
119434f90d55Smrg])# PKG_PROG_PKG_CONFIG
119534f90d55Smrg
119634f90d55Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
119734f90d55Smrg#
119834f90d55Smrg# Check to see whether a particular set of modules exists.  Similar
119934f90d55Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
120034f90d55Smrg#
120134f90d55Smrg#
120234f90d55Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
120334f90d55Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
120434f90d55Smrg# PKG_CHECK_EXISTS manually
120534f90d55Smrg# --------------------------------------------------------------
120634f90d55SmrgAC_DEFUN([PKG_CHECK_EXISTS],
120734f90d55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
120834f90d55Smrgif test -n "$PKG_CONFIG" && \
120934f90d55Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
121034f90d55Smrg  m4_ifval([$2], [$2], [:])
121134f90d55Smrgm4_ifvaln([$3], [else
121234f90d55Smrg  $3])dnl
121334f90d55Smrgfi])
121434f90d55Smrg
121534f90d55Smrg
121634f90d55Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
121734f90d55Smrg# ---------------------------------------------
121834f90d55Smrgm4_define([_PKG_CONFIG],
121934f90d55Smrg[if test -n "$$1"; then
122034f90d55Smrg    pkg_cv_[]$1="$$1"
122134f90d55Smrg elif test -n "$PKG_CONFIG"; then
122234f90d55Smrg    PKG_CHECK_EXISTS([$3],
122334f90d55Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
122434f90d55Smrg		     [pkg_failed=yes])
122534f90d55Smrg else
122634f90d55Smrg    pkg_failed=untried
122734f90d55Smrgfi[]dnl
122834f90d55Smrg])# _PKG_CONFIG
122934f90d55Smrg
123034f90d55Smrg# _PKG_SHORT_ERRORS_SUPPORTED
123134f90d55Smrg# -----------------------------
123234f90d55SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
123334f90d55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123434f90d55Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
123534f90d55Smrg        _pkg_short_errors_supported=yes
123634f90d55Smrgelse
123734f90d55Smrg        _pkg_short_errors_supported=no
123834f90d55Smrgfi[]dnl
123934f90d55Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
124034f90d55Smrg
124134f90d55Smrg
124234f90d55Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
124334f90d55Smrg# [ACTION-IF-NOT-FOUND])
124434f90d55Smrg#
124534f90d55Smrg#
124634f90d55Smrg# Note that if there is a possibility the first call to
124734f90d55Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
124834f90d55Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
124934f90d55Smrg#
125034f90d55Smrg#
125134f90d55Smrg# --------------------------------------------------------------
125234f90d55SmrgAC_DEFUN([PKG_CHECK_MODULES],
125334f90d55Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
125434f90d55SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
125534f90d55SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
125634f90d55Smrg
125734f90d55Smrgpkg_failed=no
125834f90d55SmrgAC_MSG_CHECKING([for $1])
125934f90d55Smrg
126034f90d55Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
126134f90d55Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
126234f90d55Smrg
126334f90d55Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
126434f90d55Smrgand $1[]_LIBS to avoid the need to call pkg-config.
126534f90d55SmrgSee the pkg-config man page for more details.])
126634f90d55Smrg
126734f90d55Smrgif test $pkg_failed = yes; then
126834f90d55Smrg        _PKG_SHORT_ERRORS_SUPPORTED
126934f90d55Smrg        if test $_pkg_short_errors_supported = yes; then
127034f90d55Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
127134f90d55Smrg        else 
127234f90d55Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
127334f90d55Smrg        fi
127434f90d55Smrg	# Put the nasty error message in config.log where it belongs
127534f90d55Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
127634f90d55Smrg
127734f90d55Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
127834f90d55Smrg[Package requirements ($2) were not met:
127934f90d55Smrg
128034f90d55Smrg$$1_PKG_ERRORS
128134f90d55Smrg
128234f90d55SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
128334f90d55Smrginstalled software in a non-standard prefix.
128434f90d55Smrg
128534f90d55Smrg_PKG_TEXT
128634f90d55Smrg])],
128734f90d55Smrg		[AC_MSG_RESULT([no])
128834f90d55Smrg                $4])
128934f90d55Smrgelif test $pkg_failed = untried; then
129034f90d55Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
129134f90d55Smrg[The pkg-config script could not be found or is too old.  Make sure it
129234f90d55Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
129334f90d55Smrgpath to pkg-config.
129434f90d55Smrg
129534f90d55Smrg_PKG_TEXT
129634f90d55Smrg
129734f90d55SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
129834f90d55Smrg		[$4])
129934f90d55Smrgelse
130034f90d55Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
130134f90d55Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
130234f90d55Smrg        AC_MSG_RESULT([yes])
130334f90d55Smrg	ifelse([$3], , :, [$3])
130434f90d55Smrgfi[]dnl
130534f90d55Smrg])# PKG_CHECK_MODULES
130634f90d55Smrg
130730f8ce46Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
130830f8ce46Smrgdnl
130934f90d55Smrgdnl This file comes from X.Org's font-util 1.3.0
131030f8ce46Smrgdnl
131130f8ce46Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
131230f8ce46Smrgdnl
131330f8ce46Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
131430f8ce46Smrgdnl copy of this software and associated documentation files (the "Software"),
131530f8ce46Smrgdnl to deal in the Software without restriction, including without limitation
131630f8ce46Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
131730f8ce46Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
131830f8ce46Smrgdnl Software is furnished to do so, subject to the following conditions:
131930f8ce46Smrgdnl
132030f8ce46Smrgdnl The above copyright notice and this permission notice (including the next
132130f8ce46Smrgdnl paragraph) shall be included in all copies or substantial portions of the
132230f8ce46Smrgdnl Software.
132330f8ce46Smrgdnl
132430f8ce46Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132530f8ce46Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
132630f8ce46Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
132730f8ce46Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132830f8ce46Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
132930f8ce46Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
133030f8ce46Smrgdnl DEALINGS IN THE SOFTWARE.
133130f8ce46Smrgdnl
133230f8ce46Smrgdnl --------------------------------------------------------------------
133330f8ce46Smrgdnl
133430f8ce46Smrgdnl Copyright 2005 Red Hat, Inc
133530f8ce46Smrgdnl
133630f8ce46Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
133730f8ce46Smrgdnl documentation for any purpose is hereby granted without fee, provided that
133830f8ce46Smrgdnl the above copyright notice appear in all copies and that both that
133930f8ce46Smrgdnl copyright notice and this permission notice appear in supporting
134030f8ce46Smrgdnl documentation.
134130f8ce46Smrgdnl
134230f8ce46Smrgdnl The above copyright notice and this permission notice shall be included
134330f8ce46Smrgdnl in all copies or substantial portions of the Software.
134430f8ce46Smrgdnl
134530f8ce46Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
134630f8ce46Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
134730f8ce46Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
134830f8ce46Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
134930f8ce46Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
135030f8ce46Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
135130f8ce46Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
135230f8ce46Smrgdnl
135330f8ce46Smrgdnl Except as contained in this notice, the name of the copyright holders shall
135430f8ce46Smrgdnl not be used in advertising or otherwise to promote the sale, use or
135530f8ce46Smrgdnl other dealings in this Software without prior written authorization
135630f8ce46Smrgdnl from the copyright holders.
135730f8ce46Smrg
135830f8ce46Smrg# XORG_FONT_MACROS_VERSION(required-version)
135930f8ce46Smrg# ------------------------------------------
136030f8ce46Smrg# Minimum version: 1.1.0
136130f8ce46Smrg#
136230f8ce46Smrg# If you're using a macro added in Version 1.1 or newer, include this in
136330f8ce46Smrg# your configure.ac with the minimum required version, such as:
136430f8ce46Smrg# XORG_FONT_MACROS_VERSION(1.1)
136530f8ce46Smrg#
136630f8ce46Smrg# To ensure that this macro is defined, also add:
136730f8ce46Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
136830f8ce46Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
136930f8ce46Smrg#
137030f8ce46Smrg#
137130f8ce46Smrg# See the "minimum version" comment for each macro you use to see what
137230f8ce46Smrg# version you require.
137330f8ce46Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
137434f90d55Smrgm4_define([vers_have], [1.3.0])
137530f8ce46Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
137630f8ce46Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
137730f8ce46Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
137830f8ce46Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
137930f8ce46Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
138030f8ce46Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
138130f8ce46Smrgm4_undefine([vers_have])
138230f8ce46Smrgm4_undefine([maj_have])
138330f8ce46Smrgm4_undefine([maj_needed])
138430f8ce46Smrg]) # XORG_FONT_MACROS_VERSION
138530f8ce46Smrg
138630f8ce46Smrg# XORG_FONT_CHECK_{maps}()
138730f8ce46Smrg# ------------------------
138830f8ce46Smrg# Minimum version: 1.0.0
138930f8ce46Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
139030f8ce46Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
139130f8ce46Smrg
139230f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
139330f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
139430f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
139530f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
139630f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
139730f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
139830f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
139930f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
140030f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
140130f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
140230f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
140330f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
140430f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
140530f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
140630f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
140730f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
140830f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
140930f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
141030f8ce46Smrg
141130f8ce46Smrg# XORG_FONT_CHECK_ENCODING(encoding)
141230f8ce46Smrg# ----------------------------------
141330f8ce46Smrg# Minimum version: 1.1.0
141430f8ce46Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
141530f8ce46Smrg# It replaced individual copies of this code in the above macros in 1.1.
141630f8ce46Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
141730f8ce46Smrg# calls if this is not true in the future.
141830f8ce46Smrg
141930f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
142030f8ce46Smrg	AC_ARG_ENABLE(m4_tolower($1),
142130f8ce46Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
142230f8ce46Smrg				[Build $1 fonts (default: yes)]),
142330f8ce46Smrg		[AS_TR_SH($1)=$enableval])
142430f8ce46Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
142530f8ce46Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
142630f8ce46Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
142730f8ce46Smrg]) # XORG_FONT_CHECK_ENCODING
142830f8ce46Smrg
142930f8ce46Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
143030f8ce46Smrg# -----------------------------------------------------
143130f8ce46Smrg# Minimum version: 1.1.0
143230f8ce46Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
143330f8ce46Smrg# Add a shorthand --enable/disable-all-encodings option.
143430f8ce46Smrg
143530f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
143630f8ce46Smrg	AC_ARG_ENABLE([all-encodings],
143730f8ce46Smrg		AS_HELP_STRING([--disable-all-encodings],
143830f8ce46Smrg				[Disable building of all font encodings]),
143930f8ce46Smrg		[m4_foreach_w([enc], [$1], [
144030f8ce46Smrg			AS_TR_SH(enc)=$enableval
144130f8ce46Smrg		])],
144230f8ce46Smrg		[m4_foreach_w([enc], [$1], [
144330f8ce46Smrg			AS_TR_SH(enc)=yes
144430f8ce46Smrg		])])
144530f8ce46Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
144630f8ce46Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
144730f8ce46Smrg
144830f8ce46Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
144930f8ce46Smrg# ------------------------------------------
145030f8ce46Smrg# Minimum version: 1.1.0
145130f8ce46Smrg#
145230f8ce46Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
145330f8ce46Smrg#
145430f8ce46Smrg
145530f8ce46SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
145630f8ce46Smrg	AC_PATH_PROG($1, $2)
145730f8ce46Smrg	if test x"$$1" = x; then
145830f8ce46Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
145930f8ce46Smrg	fi
146030f8ce46Smrg])
146130f8ce46Smrg
146230f8ce46Smrg
146330f8ce46Smrg# XORG_FONT_FCCACHE()
146430f8ce46Smrg# -------------------
146530f8ce46Smrg# Minimum version: 1.1.0
146630f8ce46Smrg#
146730f8ce46Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
146830f8ce46Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
146934f90d55Smrg# to run fc-cache if found and not installing to $DESTDIR and not
147034f90d55Smrg# cross-compiling
147130f8ce46Smrg#
147230f8ce46Smrg# fc-cache is optional, not required, and should be skipped when making
147334f90d55Smrg# packages (installing to $DESTDIR) or cross-compiling
147430f8ce46Smrg#
147530f8ce46SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
147630f8ce46Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
147730f8ce46Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
147834f90d55Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
147930f8ce46Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
148030f8ce46Smrg	else
148130f8ce46Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
148230f8ce46Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
148330f8ce46Smrg	fi
148430f8ce46Smrg	AC_SUBST([RUN_FCCACHE])
148530f8ce46Smrg])
148630f8ce46Smrg
148734f90d55Smrg# XORG_FONT_MKFONTDIR()
148834f90d55Smrg# -------------------
148934f90d55Smrg# Minimum version: 1.3.0
149034f90d55Smrg#
149134f90d55Smrg# Set MKFONTDIR to path to mkfontdir.
149234f90d55Smrg#
149334f90d55Smrg# If cross-compiling, and if mkdir is not found, use a shell command
149434f90d55Smrg# which warns mkfontdir needs to be run on the target
149534f90d55Smrg#
149634f90d55Smrg# If not cross-compiling, mkfontdir must be found
149734f90d55Smrg#
149834f90d55SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
149934f90d55Smrg	if test x"$cross_compiling" != x"no" ; then
150034f90d55Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
150134f90d55Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
150234f90d55Smrg
150334f90d55Smrg		if test x"$MKFONTDIR" = x; then
150434f90d55Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
150534f90d55Smrg		fi
150634f90d55Smrg	else
150734f90d55Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
150834f90d55Smrg	fi
150934f90d55Smrg
151034f90d55Smrg	AC_SUBST([MKFONTDIR])
151134f90d55Smrg])
151230f8ce46Smrg
151330f8ce46Smrg# XORG_FONT_COMMON_UTILS()
151430f8ce46Smrg# ------------------------
151530f8ce46Smrg# Minimum version: 1.1.0
151630f8ce46Smrg#
151730f8ce46Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
151830f8ce46Smrg
151930f8ce46SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
152030f8ce46Smrg	XORG_FONT_FCCACHE
152134f90d55Smrg	XORG_FONT_MKFONTDIR
152230f8ce46Smrg])
152330f8ce46Smrg
152430f8ce46Smrg# XORG_FONT_SCALED_UTILS()
152530f8ce46Smrg# ------------------------
152630f8ce46Smrg# Minimum version: 1.1.0
152730f8ce46Smrg#
152830f8ce46Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
152930f8ce46Smrg# (TrueType, OpenType, Type1)
153030f8ce46Smrg
153130f8ce46SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
153230f8ce46Smrg	XORG_FONT_COMMON_UTILS
153330f8ce46Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
153430f8ce46Smrg])
153530f8ce46Smrg
153630f8ce46Smrg# XORG_FONT_BDF_UTILS()
153730f8ce46Smrg# ---------------------
153830f8ce46Smrg# Minimum version: 1.1.0
1539bbe1b32bSmrg#
154030f8ce46Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
154130f8ce46Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
154230f8ce46Smrg# PCF output files created by bdftopcf
1543bbe1b32bSmrg
154430f8ce46SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
154530f8ce46Smrg	XORG_FONT_COMMON_UTILS
154630f8ce46Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
154730f8ce46Smrg	XORG_FONT_CHECK_COMPRESSION
154830f8ce46Smrg])
1549bbe1b32bSmrg
155030f8ce46Smrg# XORG_FONT_CHECK_COMPRESSION()
155130f8ce46Smrg# -----------------------------
155230f8ce46Smrg# Minimum version: 1.1.0
155330f8ce46Smrg#
155430f8ce46Smrg# Offer a --with-compression flag to control what compression method is
155530f8ce46Smrg# used for pcf font files.   Offers all the methods currently supported
155630f8ce46Smrg# by libXfont, including no compression.
155730f8ce46Smrg
155830f8ce46SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
155930f8ce46Smrg	AC_MSG_CHECKING([font compression method])
156030f8ce46Smrg	AC_ARG_WITH(compression,
156130f8ce46Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
156230f8ce46Smrg			 [compression method to use on pcf fonts])],
156330f8ce46Smrg         [compression="$withval"], [compression="yes"])
156430f8ce46Smrg	if test x"$compression" = "xyes" ; then
156530f8ce46Smrg		compression="gzip"
156630f8ce46Smrg	fi
156730f8ce46Smrg	AC_MSG_RESULT([${compression}])
156830f8ce46Smrg	case ${compression} in
156930f8ce46Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
157030f8ce46Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
157130f8ce46Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
157230f8ce46Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
157330f8ce46Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
157430f8ce46Smrg	esac
157530f8ce46Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
157630f8ce46Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
157730f8ce46Smrg	fi
157830f8ce46Smrg	AC_SUBST([COMPRESS_SUFFIX])
157930f8ce46Smrg])
1580bbe1b32bSmrg
158130f8ce46Smrg# XORG_FONT_UCS2ANY()
158230f8ce46Smrg# -------------------
158330f8ce46Smrg# Minimum version: 1.1.0
1584bbe1b32bSmrg#
158530f8ce46Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
158630f8ce46Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
158730f8ce46Smrg# Also call pkg-config to find the directory with the encoding files needed
158830f8ce46Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
158930f8ce46Smrg
159030f8ce46SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
15918f34cbf9Ssnj	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
159230f8ce46Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
159330f8ce46Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
159430f8ce46Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
15958f34cbf9Ssnj	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
159630f8ce46Smrg	AC_SUBST(MAPFILES_PATH)
159730f8ce46Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
159830f8ce46Smrg])
1599bbe1b32bSmrg
1600bbe1b32bSmrg
160130f8ce46Smrg
160230f8ce46Smrg# XORG_FONT_FC_CONFDIR()
1603bbe1b32bSmrg# --------------------
160430f8ce46Smrg# Minimum version: 1.2.0
1605bbe1b32bSmrg#
160630f8ce46Smrg# Sets FC_CONFDIR to the fontconfig config directory
160730f8ce46Smrg# (which should be --with-confdir=... when building fontconfig)
160830f8ce46Smrg# found from:
160930f8ce46Smrg#	--with-fc-confdir=...
161030f8ce46Smrg#	pkg-config --variable=confdir fontconfig
161130f8ce46Smrg#	${sysconfdir}/fonts
161230f8ce46Smrg
161330f8ce46SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
161430f8ce46Smrg	dnl Ensure $PKG_CONFIG is set first
161530f8ce46Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
161630f8ce46Smrg
161730f8ce46Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
161830f8ce46Smrg	AC_ARG_WITH(fc-confdir,
161930f8ce46Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
162030f8ce46Smrg			   [Path to fontconfig's configuration directory]),
162130f8ce46Smrg		    [FC_CONFDIR="$withval"])
162230f8ce46Smrg	# if --with-fc-confdir was not specified
162330f8ce46Smrg	if test "x${FC_CONFDIR}" = "x"; then
162430f8ce46Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
162530f8ce46Smrg	fi
162630f8ce46Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
162730f8ce46Smrg	if test "x${FC_CONFDIR}" = "x"; then
162830f8ce46Smrg		FC_CONFDIR="${sysconfdir}/fonts"
162930f8ce46Smrg	fi
163030f8ce46Smrg	AC_SUBST(FC_CONFDIR)
163130f8ce46Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
163230f8ce46Smrg])
163330f8ce46Smrg
163430f8ce46Smrg
163530f8ce46Smrg
163630f8ce46Smrg# XORG_FONTROOTDIR()
163730f8ce46Smrg# --------------------
163830f8ce46Smrg# Minimum version: 1.1.0
1639bbe1b32bSmrg#
164030f8ce46Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
164130f8ce46Smrg# found from:
164230f8ce46Smrg#	--with-fontrootdir
164330f8ce46Smrg#	pkg-config --variable=fontrootdir fontutil
164430f8ce46Smrg#	${datadir}/fonts/X11
164530f8ce46Smrg
164630f8ce46SmrgAC_DEFUN([XORG_FONTROOTDIR],[
164730f8ce46Smrg	dnl Ensure $PKG_CONFIG is set first
164830f8ce46Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
164930f8ce46Smrg
165030f8ce46Smrg	AC_MSG_CHECKING([for root directory for font files])
165130f8ce46Smrg	AC_ARG_WITH(fontrootdir,
165230f8ce46Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
165330f8ce46Smrg			   [Path to root directory for font files]),
165430f8ce46Smrg		    [FONTROOTDIR="$withval"])
165530f8ce46Smrg	# if --with-fontrootdir not specified...
165630f8ce46Smrg	if test "x${FONTROOTDIR}" = "x"; then
165730f8ce46Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
165830f8ce46Smrg	fi
165930f8ce46Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
166030f8ce46Smrg	if test "x${FONTROOTDIR}" = "x"; then
166130f8ce46Smrg		FONTROOTDIR="${datadir}/fonts/X11"
166230f8ce46Smrg	fi
166330f8ce46Smrg	AC_SUBST(FONTROOTDIR)
166430f8ce46Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
166530f8ce46Smrg])
1666bbe1b32bSmrg
166730f8ce46Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
166830f8ce46Smrg# ---------------------------------------
166930f8ce46Smrg# Minimum version: 1.1.0
167030f8ce46Smrg#
167130f8ce46Smrg# Offer a --with-<flag> flag to control directory for font installation
167230f8ce46Smrg# Default is the specified <subdir> of the font root directory.
167330f8ce46Smrg# Sets <variable> to the selected directory
1674bbe1b32bSmrg
167530f8ce46SmrgAC_DEFUN([XORG_FONTSUBDIR],[
167630f8ce46Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
1677bbe1b32bSmrg
167830f8ce46Smrg	AC_MSG_CHECKING([for directory for $3 files])
167930f8ce46Smrg	AC_ARG_WITH($2,
168030f8ce46Smrg		    [AS_HELP_STRING([--with-$2=DIR],
168130f8ce46Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
168230f8ce46Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
168330f8ce46Smrg	AC_SUBST($1)
168430f8ce46Smrg	AC_MSG_RESULT([${$1}])
168530f8ce46Smrg]) # XORG_FONTSUBDIR
168630f8ce46Smrg
168730f8ce46Smrg# XORG_FONTDIR(subdir)
168830f8ce46Smrg# --------------------
168930f8ce46Smrg# Minimum version: 1.1.0
169030f8ce46Smrg#
169130f8ce46Smrg# Offer a --with-fontdir flag to control directory for font installation
169230f8ce46Smrg# Default is the specified subdir of the font root directory.
169330f8ce46Smrg# Sets FONTDIR to the selected directory
169430f8ce46Smrg
169530f8ce46SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1696bbe1b32bSmrg
1697ce6676dbSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1698ce6676dbSmrgdnl
169930f8ce46Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
17008f34cbf9Ssnjdnl
1701ce6676dbSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
170230f8ce46Smrgdnl copy of this software and associated documentation files (the "Software"),
170330f8ce46Smrgdnl to deal in the Software without restriction, including without limitation
170430f8ce46Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
170530f8ce46Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
170630f8ce46Smrgdnl Software is furnished to do so, subject to the following conditions:
1707ce6676dbSmrgdnl
170830f8ce46Smrgdnl The above copyright notice and this permission notice (including the next
170930f8ce46Smrgdnl paragraph) shall be included in all copies or substantial portions of the
171030f8ce46Smrgdnl Software.
1711ce6676dbSmrgdnl
171230f8ce46Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
171330f8ce46Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171430f8ce46Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
171530f8ce46Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
171630f8ce46Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
171730f8ce46Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
171830f8ce46Smrgdnl DEALINGS IN THE SOFTWARE.
1719ce6676dbSmrg
1720ce6676dbSmrg# XORG_MACROS_VERSION(required-version)
1721ce6676dbSmrg# -------------------------------------
1722ce6676dbSmrg# Minimum version: 1.1.0
1723ce6676dbSmrg#
1724ce6676dbSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1725ce6676dbSmrg# your configure.ac with the minimum required version, such as:
1726ce6676dbSmrg# XORG_MACROS_VERSION(1.1)
1727ce6676dbSmrg#
1728ce6676dbSmrg# To ensure that this macro is defined, also add:
1729ce6676dbSmrg# m4_ifndef([XORG_MACROS_VERSION],
1730ce6676dbSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1731ce6676dbSmrg#
1732ce6676dbSmrg#
17338f34cbf9Ssnj# See the "minimum version" comment for each macro you use to see what
1734ce6676dbSmrg# version you require.
1735ce6676dbSmrgm4_defun([XORG_MACROS_VERSION],[
17368f34cbf9Ssnjm4_define([vers_have], [1.19.0])
1737ce6676dbSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1738ce6676dbSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1739ce6676dbSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1740ce6676dbSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1741ce6676dbSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1742ce6676dbSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1743ce6676dbSmrgm4_undefine([vers_have])
1744ce6676dbSmrgm4_undefine([maj_have])
1745ce6676dbSmrgm4_undefine([maj_needed])
1746ce6676dbSmrg]) # XORG_MACROS_VERSION
1747ce6676dbSmrg
1748ce6676dbSmrg# XORG_PROG_RAWCPP()
1749ce6676dbSmrg# ------------------
1750ce6676dbSmrg# Minimum version: 1.0.0
1751ce6676dbSmrg#
1752ce6676dbSmrg# Find cpp program and necessary flags for use in pre-processing text files
1753ce6676dbSmrg# such as man pages and config files
1754ce6676dbSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1755ce6676dbSmrgAC_REQUIRE([AC_PROG_CPP])
17568f34cbf9SsnjAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1757ce6676dbSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1758ce6676dbSmrg
1759ce6676dbSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1760ce6676dbSmrg# which is not the best choice for supporting other OS'es, but covers most
1761ce6676dbSmrg# of the ones we need for now.
1762ce6676dbSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
176334f90d55SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1764ce6676dbSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1765ce6676dbSmrg	AC_MSG_RESULT([no])
1766ce6676dbSmrgelse
1767ce6676dbSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1768ce6676dbSmrg		RAWCPPFLAGS=-undef
1769ce6676dbSmrg		AC_MSG_RESULT([yes])
1770ce6676dbSmrg	# under Cygwin unix is still defined even with -undef
1771ce6676dbSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1772ce6676dbSmrg		RAWCPPFLAGS="-undef -ansi"
1773ce6676dbSmrg		AC_MSG_RESULT([yes, with -ansi])
1774ce6676dbSmrg	else
1775ce6676dbSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1776ce6676dbSmrg	fi
1777ce6676dbSmrgfi
1778ce6676dbSmrgrm -f conftest.$ac_ext
1779ce6676dbSmrg
1780ce6676dbSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
178134f90d55SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1782ce6676dbSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1783ce6676dbSmrg	AC_MSG_RESULT([no])
1784ce6676dbSmrgelse
1785ce6676dbSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
17868f34cbf9Ssnj		TRADITIONALCPPFLAGS="-traditional"
1787ce6676dbSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1788ce6676dbSmrg		AC_MSG_RESULT([yes])
1789ce6676dbSmrg	else
1790ce6676dbSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1791ce6676dbSmrg	fi
1792ce6676dbSmrgfi
1793ce6676dbSmrgrm -f conftest.$ac_ext
1794ce6676dbSmrgAC_SUBST(RAWCPPFLAGS)
17958f34cbf9SsnjAC_SUBST(TRADITIONALCPPFLAGS)
1796ce6676dbSmrg]) # XORG_PROG_RAWCPP
1797ce6676dbSmrg
1798ce6676dbSmrg# XORG_MANPAGE_SECTIONS()
1799ce6676dbSmrg# -----------------------
1800ce6676dbSmrg# Minimum version: 1.0.0
1801ce6676dbSmrg#
1802ce6676dbSmrg# Determine which sections man pages go in for the different man page types
1803ce6676dbSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1804ce6676dbSmrg# Not sure if there's any better way than just hardcoding by OS name.
1805ce6676dbSmrg# Override default settings by setting environment variables
180630f8ce46Smrg# Added MAN_SUBSTS in version 1.8
180730f8ce46Smrg# Added AC_PROG_SED in version 1.8
1808ce6676dbSmrg
1809ce6676dbSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1810ce6676dbSmrgAC_REQUIRE([AC_CANONICAL_HOST])
181130f8ce46SmrgAC_REQUIRE([AC_PROG_SED])
1812ce6676dbSmrg
1813ce6676dbSmrgif test x$APP_MAN_SUFFIX = x    ; then
1814ce6676dbSmrg    APP_MAN_SUFFIX=1
1815ce6676dbSmrgfi
1816ce6676dbSmrgif test x$APP_MAN_DIR = x    ; then
1817ce6676dbSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1818ce6676dbSmrgfi
1819ce6676dbSmrg
1820ce6676dbSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1821ce6676dbSmrg    LIB_MAN_SUFFIX=3
1822ce6676dbSmrgfi
1823ce6676dbSmrgif test x$LIB_MAN_DIR = x    ; then
1824ce6676dbSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1825ce6676dbSmrgfi
1826ce6676dbSmrg
1827ce6676dbSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1828ce6676dbSmrg    case $host_os in
1829ce6676dbSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1830ce6676dbSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1831ce6676dbSmrg    esac
1832ce6676dbSmrgfi
1833ce6676dbSmrgif test x$FILE_MAN_DIR = x    ; then
1834ce6676dbSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1835ce6676dbSmrgfi
1836ce6676dbSmrg
1837ce6676dbSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1838ce6676dbSmrg    case $host_os in
1839ce6676dbSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1840ce6676dbSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1841ce6676dbSmrg    esac
1842ce6676dbSmrgfi
1843ce6676dbSmrgif test x$MISC_MAN_DIR = x    ; then
1844ce6676dbSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1845ce6676dbSmrgfi
1846ce6676dbSmrg
1847ce6676dbSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1848ce6676dbSmrg    case $host_os in
1849ce6676dbSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1850ce6676dbSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1851ce6676dbSmrg    esac
1852ce6676dbSmrgfi
1853ce6676dbSmrgif test x$DRIVER_MAN_DIR = x    ; then
1854ce6676dbSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1855ce6676dbSmrgfi
1856ce6676dbSmrg
1857ce6676dbSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1858ce6676dbSmrg    case $host_os in
1859ce6676dbSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1860ce6676dbSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1861ce6676dbSmrg    esac
1862ce6676dbSmrgfi
1863ce6676dbSmrgif test x$ADMIN_MAN_DIR = x    ; then
1864ce6676dbSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1865ce6676dbSmrgfi
1866ce6676dbSmrg
1867ce6676dbSmrg
1868ce6676dbSmrgAC_SUBST([APP_MAN_SUFFIX])
1869ce6676dbSmrgAC_SUBST([LIB_MAN_SUFFIX])
1870ce6676dbSmrgAC_SUBST([FILE_MAN_SUFFIX])
1871ce6676dbSmrgAC_SUBST([MISC_MAN_SUFFIX])
1872ce6676dbSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1873ce6676dbSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1874ce6676dbSmrgAC_SUBST([APP_MAN_DIR])
1875ce6676dbSmrgAC_SUBST([LIB_MAN_DIR])
1876ce6676dbSmrgAC_SUBST([FILE_MAN_DIR])
1877ce6676dbSmrgAC_SUBST([MISC_MAN_DIR])
1878ce6676dbSmrgAC_SUBST([DRIVER_MAN_DIR])
1879ce6676dbSmrgAC_SUBST([ADMIN_MAN_DIR])
188030f8ce46Smrg
188130f8ce46SmrgXORG_MAN_PAGE="X Version 11"
188230f8ce46SmrgAC_SUBST([XORG_MAN_PAGE])
188330f8ce46SmrgMAN_SUBSTS="\
188430f8ce46Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
188530f8ce46Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
188630f8ce46Smrg	-e 's|__xservername__|Xorg|g' \
188730f8ce46Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
188830f8ce46Smrg	-e 's|__projectroot__|\$(prefix)|g' \
188930f8ce46Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
189030f8ce46Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
189130f8ce46Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
189230f8ce46Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
189330f8ce46Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
189430f8ce46Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
189530f8ce46Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
189630f8ce46SmrgAC_SUBST([MAN_SUBSTS])
189730f8ce46Smrg
1898ce6676dbSmrg]) # XORG_MANPAGE_SECTIONS
1899ce6676dbSmrg
190030f8ce46Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
190130f8ce46Smrg# ------------------------
190230f8ce46Smrg# Minimum version: 1.7.0
190330f8ce46Smrg#
190430f8ce46Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
190530f8ce46Smrg# provided by xorg-sgml-doctools, if installed.
190630f8ce46SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
190730f8ce46SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
190830f8ce46SmrgXORG_SGML_PATH=
190930f8ce46SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
191030f8ce46Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
191130f8ce46Smrg    [m4_ifval([$1],[:],
191230f8ce46Smrg        [if test x"$cross_compiling" != x"yes" ; then
191330f8ce46Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
191430f8ce46Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
191530f8ce46Smrg         fi])
191630f8ce46Smrg    ])
191730f8ce46Smrg
191830f8ce46Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
191930f8ce46Smrg# the path and the name of the doc stylesheet
192030f8ce46Smrgif test "x$XORG_SGML_PATH" != "x" ; then
192130f8ce46Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
192230f8ce46Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
192330f8ce46Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
192430f8ce46Smrgelse
192530f8ce46Smrg   AC_MSG_RESULT([no])
192630f8ce46Smrgfi
192730f8ce46Smrg
192830f8ce46SmrgAC_SUBST(XORG_SGML_PATH)
192930f8ce46SmrgAC_SUBST(STYLESHEET_SRCDIR)
193030f8ce46SmrgAC_SUBST(XSL_STYLESHEET)
193130f8ce46SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
193230f8ce46Smrg]) # XORG_CHECK_SGML_DOCTOOLS
193330f8ce46Smrg
1934ce6676dbSmrg# XORG_CHECK_LINUXDOC
1935ce6676dbSmrg# -------------------
1936ce6676dbSmrg# Minimum version: 1.0.0
1937ce6676dbSmrg#
1938ce6676dbSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1939ce6676dbSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1940ce6676dbSmrg# Whether or not the necessary tools and files are found can be checked
1941ce6676dbSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1942ce6676dbSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
194330f8ce46SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
194430f8ce46SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1945ce6676dbSmrg
1946ce6676dbSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1947ce6676dbSmrg
194830f8ce46SmrgAC_MSG_CHECKING([whether to build documentation])
1949ce6676dbSmrg
195030f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1951ce6676dbSmrg   BUILDDOC=yes
1952ce6676dbSmrgelse
1953ce6676dbSmrg   BUILDDOC=no
1954ce6676dbSmrgfi
1955ce6676dbSmrg
1956ce6676dbSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1957ce6676dbSmrg
1958ce6676dbSmrgAC_MSG_RESULT([$BUILDDOC])
1959ce6676dbSmrg
196030f8ce46SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1961ce6676dbSmrg
196230f8ce46Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1963ce6676dbSmrg   BUILDPDFDOC=yes
1964ce6676dbSmrgelse
1965ce6676dbSmrg   BUILDPDFDOC=no
1966ce6676dbSmrgfi
1967ce6676dbSmrg
1968ce6676dbSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1969ce6676dbSmrg
1970ce6676dbSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1971ce6676dbSmrg
197230f8ce46SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1973ce6676dbSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1974ce6676dbSmrgMAKE_PDF="$PS2PDF"
1975ce6676dbSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1976ce6676dbSmrg
1977ce6676dbSmrgAC_SUBST(MAKE_TEXT)
1978ce6676dbSmrgAC_SUBST(MAKE_PS)
1979ce6676dbSmrgAC_SUBST(MAKE_PDF)
1980ce6676dbSmrgAC_SUBST(MAKE_HTML)
1981ce6676dbSmrg]) # XORG_CHECK_LINUXDOC
1982ce6676dbSmrg
1983ce6676dbSmrg# XORG_CHECK_DOCBOOK
1984ce6676dbSmrg# -------------------
1985ce6676dbSmrg# Minimum version: 1.0.0
1986ce6676dbSmrg#
1987ce6676dbSmrg# Checks for the ability to build output formats from SGML DocBook source.
1988ce6676dbSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1989ce6676dbSmrg# indicates whether the necessary tools and files are found and, if set,
1990ce6676dbSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1991ce6676dbSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
199230f8ce46SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
199330f8ce46Smrg
1994ce6676dbSmrgBUILDTXTDOC=no
1995ce6676dbSmrgBUILDPDFDOC=no
1996ce6676dbSmrgBUILDPSDOC=no
1997ce6676dbSmrgBUILDHTMLDOC=no
1998ce6676dbSmrg
1999ce6676dbSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
2000ce6676dbSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
2001ce6676dbSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
2002ce6676dbSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
2003ce6676dbSmrg
200430f8ce46SmrgAC_MSG_CHECKING([whether to build text documentation])
200530f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
2006ce6676dbSmrg   test x$BUILD_TXTDOC != xno; then
2007ce6676dbSmrg	BUILDTXTDOC=yes
2008ce6676dbSmrgfi
2009ce6676dbSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
2010ce6676dbSmrgAC_MSG_RESULT([$BUILDTXTDOC])
2011ce6676dbSmrg
201230f8ce46SmrgAC_MSG_CHECKING([whether to build PDF documentation])
201330f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
2014ce6676dbSmrg   test x$BUILD_PDFDOC != xno; then
2015ce6676dbSmrg	BUILDPDFDOC=yes
2016ce6676dbSmrgfi
2017ce6676dbSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2018ce6676dbSmrgAC_MSG_RESULT([$BUILDPDFDOC])
2019ce6676dbSmrg
202030f8ce46SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
202130f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
2022ce6676dbSmrg   test x$BUILD_PSDOC != xno; then
2023ce6676dbSmrg	BUILDPSDOC=yes
2024ce6676dbSmrgfi
2025ce6676dbSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
2026ce6676dbSmrgAC_MSG_RESULT([$BUILDPSDOC])
2027ce6676dbSmrg
202830f8ce46SmrgAC_MSG_CHECKING([whether to build HTML documentation])
202930f8ce46Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
2030ce6676dbSmrg   test x$BUILD_HTMLDOC != xno; then
2031ce6676dbSmrg	BUILDHTMLDOC=yes
2032ce6676dbSmrgfi
2033ce6676dbSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
2034ce6676dbSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
2035ce6676dbSmrg
2036ce6676dbSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
2037ce6676dbSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
2038ce6676dbSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
2039ce6676dbSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
2040ce6676dbSmrg
2041ce6676dbSmrgAC_SUBST(MAKE_TEXT)
2042ce6676dbSmrgAC_SUBST(MAKE_PS)
2043ce6676dbSmrgAC_SUBST(MAKE_PDF)
2044ce6676dbSmrgAC_SUBST(MAKE_HTML)
2045ce6676dbSmrg]) # XORG_CHECK_DOCBOOK
2046ce6676dbSmrg
204730f8ce46Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
204830f8ce46Smrg# ----------------
204930f8ce46Smrg# Minimum version: 1.5.0
205030f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
205130f8ce46Smrg#
205230f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
205330f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
205430f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
205530f8ce46Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
205630f8ce46Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
205730f8ce46Smrg# --with-xmlto assumes 'auto'.
205830f8ce46Smrg#
205930f8ce46Smrg# Interface to module:
206030f8ce46Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
206130f8ce46Smrg# XMLTO:	returns the path of the xmlto program found
206230f8ce46Smrg#		returns the path set by the user in the environment
206330f8ce46Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
206430f8ce46Smrg#		'no' user instructs the module not to use xmlto
206530f8ce46Smrg#
206630f8ce46Smrg# Added in version 1.10.0
206730f8ce46Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
206830f8ce46Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
206930f8ce46Smrg#
207030f8ce46Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
207130f8ce46Smrg#
207230f8ce46SmrgAC_DEFUN([XORG_WITH_XMLTO],[
207330f8ce46SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
207430f8ce46Smrgm4_define([_defopt], m4_default([$2], [auto]))
207530f8ce46SmrgAC_ARG_WITH(xmlto,
207630f8ce46Smrg	AS_HELP_STRING([--with-xmlto],
207730f8ce46Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
207830f8ce46Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
207930f8ce46Smrgm4_undefine([_defopt])
208030f8ce46Smrg
208130f8ce46Smrgif test "x$use_xmlto" = x"auto"; then
208230f8ce46Smrg   AC_PATH_PROG([XMLTO], [xmlto])
208330f8ce46Smrg   if test "x$XMLTO" = "x"; then
208430f8ce46Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
208530f8ce46Smrg	have_xmlto=no
208630f8ce46Smrg   else
208730f8ce46Smrg        have_xmlto=yes
208830f8ce46Smrg   fi
208930f8ce46Smrgelif test "x$use_xmlto" = x"yes" ; then
209030f8ce46Smrg   AC_PATH_PROG([XMLTO], [xmlto])
209130f8ce46Smrg   if test "x$XMLTO" = "x"; then
209230f8ce46Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
209330f8ce46Smrg   fi
209430f8ce46Smrg   have_xmlto=yes
209530f8ce46Smrgelif test "x$use_xmlto" = x"no" ; then
209630f8ce46Smrg   if test "x$XMLTO" != "x"; then
209730f8ce46Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
209830f8ce46Smrg   fi
209930f8ce46Smrg   have_xmlto=no
210030f8ce46Smrgelse
210130f8ce46Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
210230f8ce46Smrgfi
210330f8ce46Smrg
210430f8ce46Smrg# Test for a minimum version of xmlto, if provided.
210530f8ce46Smrgm4_ifval([$1],
210630f8ce46Smrg[if test "$have_xmlto" = yes; then
210730f8ce46Smrg    # scrape the xmlto version
210830f8ce46Smrg    AC_MSG_CHECKING([the xmlto version])
210930f8ce46Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
211030f8ce46Smrg    AC_MSG_RESULT([$xmlto_version])
211130f8ce46Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
211230f8ce46Smrg        [if test "x$use_xmlto" = xauto; then
211330f8ce46Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
211430f8ce46Smrg            have_xmlto=no
211530f8ce46Smrg        else
211630f8ce46Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
211730f8ce46Smrg        fi])
211830f8ce46Smrgfi])
211930f8ce46Smrg
212030f8ce46Smrg# Test for the ability of xmlto to generate a text target
212130f8ce46Smrghave_xmlto_text=no
212230f8ce46Smrgcat > conftest.xml << "EOF"
212330f8ce46SmrgEOF
212430f8ce46SmrgAS_IF([test "$have_xmlto" = yes],
212530f8ce46Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
212630f8ce46Smrg             [have_xmlto_text=yes],
212730f8ce46Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
212830f8ce46Smrgrm -f conftest.xml
212930f8ce46SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
213030f8ce46SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
213130f8ce46Smrg]) # XORG_WITH_XMLTO
213230f8ce46Smrg
213334f90d55Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
213434f90d55Smrg# --------------------------------------------
213534f90d55Smrg# Minimum version: 1.12.0
213634f90d55Smrg# Minimum version for optional DEFAULT argument: 1.12.0
213734f90d55Smrg#
213834f90d55Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
213934f90d55Smrg# XML-based language used for the transformation of XML documents.
214034f90d55Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
214134f90d55Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
214234f90d55Smrg# The XSLT processor is often used as a standalone tool for transformations.
214334f90d55Smrg# It should not be assumed that this tool is used only to work with documnetation.
214434f90d55Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
214534f90d55Smrg#
214634f90d55Smrg# Interface to module:
214734f90d55Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
214834f90d55Smrg# XSLTPROC:	 returns the path of the xsltproc program found
214934f90d55Smrg#		 returns the path set by the user in the environment
215034f90d55Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
215134f90d55Smrg#		  'no' user instructs the module not to use xsltproc
215234f90d55Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
215334f90d55Smrg#
215434f90d55Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
215534f90d55Smrg#
215634f90d55SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
215734f90d55SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
215834f90d55Smrg# Preserves the interface, should it be implemented later
215934f90d55Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
216034f90d55Smrgm4_define([_defopt], m4_default([$2], [auto]))
216134f90d55SmrgAC_ARG_WITH(xsltproc,
216234f90d55Smrg	AS_HELP_STRING([--with-xsltproc],
216334f90d55Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
216434f90d55Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
216534f90d55Smrgm4_undefine([_defopt])
216634f90d55Smrg
216734f90d55Smrgif test "x$use_xsltproc" = x"auto"; then
216834f90d55Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
216934f90d55Smrg   if test "x$XSLTPROC" = "x"; then
217034f90d55Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
217134f90d55Smrg	have_xsltproc=no
217234f90d55Smrg   else
217334f90d55Smrg        have_xsltproc=yes
217434f90d55Smrg   fi
217534f90d55Smrgelif test "x$use_xsltproc" = x"yes" ; then
217634f90d55Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
217734f90d55Smrg   if test "x$XSLTPROC" = "x"; then
217834f90d55Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
217934f90d55Smrg   fi
218034f90d55Smrg   have_xsltproc=yes
218134f90d55Smrgelif test "x$use_xsltproc" = x"no" ; then
218234f90d55Smrg   if test "x$XSLTPROC" != "x"; then
218334f90d55Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
218434f90d55Smrg   fi
218534f90d55Smrg   have_xsltproc=no
218634f90d55Smrgelse
218734f90d55Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
218834f90d55Smrgfi
218934f90d55Smrg
219034f90d55SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
219134f90d55Smrg]) # XORG_WITH_XSLTPROC
219234f90d55Smrg
219334f90d55Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
219434f90d55Smrg# ----------------------------------------
219534f90d55Smrg# Minimum version: 1.15.0
219634f90d55Smrg#
219734f90d55Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
219834f90d55Smrg# scanning arbitrary text files, extracting information from those text files,
219934f90d55Smrg# and printing reports based on that information.
220034f90d55Smrg#
220134f90d55Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
220234f90d55Smrg#
220334f90d55Smrg# Interface to module:
220434f90d55Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
220534f90d55Smrg# PERL:	     returns the path of the perl program found
220634f90d55Smrg#	     returns the path set by the user in the environment
220734f90d55Smrg# --with-perl: 'yes' user instructs the module to use perl
220834f90d55Smrg#	       'no' user instructs the module not to use perl
220934f90d55Smrg# have_perl: returns yes if perl found in PATH or no
221034f90d55Smrg#
221134f90d55Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
221234f90d55Smrg#
221334f90d55SmrgAC_DEFUN([XORG_WITH_PERL],[
221434f90d55SmrgAC_ARG_VAR([PERL], [Path to perl command])
221534f90d55Smrg# Preserves the interface, should it be implemented later
221634f90d55Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
221734f90d55Smrgm4_define([_defopt], m4_default([$2], [auto]))
221834f90d55SmrgAC_ARG_WITH(perl,
221934f90d55Smrg	AS_HELP_STRING([--with-perl],
222034f90d55Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
222134f90d55Smrg	   [use_perl=$withval], [use_perl=]_defopt)
222234f90d55Smrgm4_undefine([_defopt])
222334f90d55Smrg
222434f90d55Smrgif test "x$use_perl" = x"auto"; then
222534f90d55Smrg   AC_PATH_PROG([PERL], [perl])
222634f90d55Smrg   if test "x$PERL" = "x"; then
222734f90d55Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
222834f90d55Smrg	have_perl=no
222934f90d55Smrg   else
223034f90d55Smrg        have_perl=yes
223134f90d55Smrg   fi
223234f90d55Smrgelif test "x$use_perl" = x"yes" ; then
223334f90d55Smrg   AC_PATH_PROG([PERL], [perl])
223434f90d55Smrg   if test "x$PERL" = "x"; then
223534f90d55Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
223634f90d55Smrg   fi
223734f90d55Smrg   have_perl=yes
223834f90d55Smrgelif test "x$use_perl" = x"no" ; then
223934f90d55Smrg   if test "x$PERL" != "x"; then
224034f90d55Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
224134f90d55Smrg   fi
224234f90d55Smrg   have_perl=no
224334f90d55Smrgelse
224434f90d55Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
224534f90d55Smrgfi
224634f90d55Smrg
224734f90d55SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
224834f90d55Smrg]) # XORG_WITH_PERL
224934f90d55Smrg
225030f8ce46Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
225130f8ce46Smrg# ----------------
225230f8ce46Smrg# Minimum version: 1.5.0
225330f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
225430f8ce46Smrg#
225530f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
225630f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
225730f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
225830f8ce46Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
225930f8ce46Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
226030f8ce46Smrg# --with-asciidoc assumes 'auto'.
226130f8ce46Smrg#
226230f8ce46Smrg# Interface to module:
226330f8ce46Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
226430f8ce46Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
226530f8ce46Smrg#		 returns the path set by the user in the environment
226630f8ce46Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
226730f8ce46Smrg#		  'no' user instructs the module not to use asciidoc
226830f8ce46Smrg#
226930f8ce46Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
227030f8ce46Smrg#
227130f8ce46SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
227230f8ce46SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
227330f8ce46Smrgm4_define([_defopt], m4_default([$2], [auto]))
227430f8ce46SmrgAC_ARG_WITH(asciidoc,
227530f8ce46Smrg	AS_HELP_STRING([--with-asciidoc],
227630f8ce46Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
227730f8ce46Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
227830f8ce46Smrgm4_undefine([_defopt])
227930f8ce46Smrg
228030f8ce46Smrgif test "x$use_asciidoc" = x"auto"; then
228130f8ce46Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
228230f8ce46Smrg   if test "x$ASCIIDOC" = "x"; then
228330f8ce46Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
228430f8ce46Smrg	have_asciidoc=no
228530f8ce46Smrg   else
228630f8ce46Smrg        have_asciidoc=yes
228730f8ce46Smrg   fi
228830f8ce46Smrgelif test "x$use_asciidoc" = x"yes" ; then
228930f8ce46Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
229030f8ce46Smrg   if test "x$ASCIIDOC" = "x"; then
229130f8ce46Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
229230f8ce46Smrg   fi
229330f8ce46Smrg   have_asciidoc=yes
229430f8ce46Smrgelif test "x$use_asciidoc" = x"no" ; then
229530f8ce46Smrg   if test "x$ASCIIDOC" != "x"; then
229630f8ce46Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
229730f8ce46Smrg   fi
229830f8ce46Smrg   have_asciidoc=no
229930f8ce46Smrgelse
230030f8ce46Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
230130f8ce46Smrgfi
230230f8ce46Smrgm4_ifval([$1],
230330f8ce46Smrg[if test "$have_asciidoc" = yes; then
230430f8ce46Smrg    # scrape the asciidoc version
230530f8ce46Smrg    AC_MSG_CHECKING([the asciidoc version])
230630f8ce46Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
230730f8ce46Smrg    AC_MSG_RESULT([$asciidoc_version])
230830f8ce46Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
230930f8ce46Smrg        [if test "x$use_asciidoc" = xauto; then
231030f8ce46Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
231130f8ce46Smrg            have_asciidoc=no
231230f8ce46Smrg        else
231330f8ce46Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
231430f8ce46Smrg        fi])
231530f8ce46Smrgfi])
231630f8ce46SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
231730f8ce46Smrg]) # XORG_WITH_ASCIIDOC
231830f8ce46Smrg
231930f8ce46Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
23208f34cbf9Ssnj# -------------------------------------------
232130f8ce46Smrg# Minimum version: 1.5.0
232230f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23238f34cbf9Ssnj# Minimum version for optional DOT checking: 1.18.0
232430f8ce46Smrg#
232530f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
232630f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
232730f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
232830f8ce46Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
232930f8ce46Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
233030f8ce46Smrg# --with-doxygen assumes 'auto'.
233130f8ce46Smrg#
233230f8ce46Smrg# Interface to module:
233330f8ce46Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
233430f8ce46Smrg# DOXYGEN:	 returns the path of the doxygen program found
233530f8ce46Smrg#		 returns the path set by the user in the environment
233630f8ce46Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
233730f8ce46Smrg#		  'no' user instructs the module not to use doxygen
233830f8ce46Smrg#
233930f8ce46Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
234030f8ce46Smrg#
234130f8ce46SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
234230f8ce46SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
23438f34cbf9SsnjAC_ARG_VAR([DOT], [Path to the dot graphics utility])
234430f8ce46Smrgm4_define([_defopt], m4_default([$2], [auto]))
234530f8ce46SmrgAC_ARG_WITH(doxygen,
234630f8ce46Smrg	AS_HELP_STRING([--with-doxygen],
234730f8ce46Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
234830f8ce46Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
234930f8ce46Smrgm4_undefine([_defopt])
235030f8ce46Smrg
235130f8ce46Smrgif test "x$use_doxygen" = x"auto"; then
235230f8ce46Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
235330f8ce46Smrg   if test "x$DOXYGEN" = "x"; then
235430f8ce46Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
235530f8ce46Smrg	have_doxygen=no
235630f8ce46Smrg   else
235730f8ce46Smrg        have_doxygen=yes
235830f8ce46Smrg   fi
235930f8ce46Smrgelif test "x$use_doxygen" = x"yes" ; then
236030f8ce46Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
236130f8ce46Smrg   if test "x$DOXYGEN" = "x"; then
236230f8ce46Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
236330f8ce46Smrg   fi
236430f8ce46Smrg   have_doxygen=yes
236530f8ce46Smrgelif test "x$use_doxygen" = x"no" ; then
236630f8ce46Smrg   if test "x$DOXYGEN" != "x"; then
236730f8ce46Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
236830f8ce46Smrg   fi
236930f8ce46Smrg   have_doxygen=no
237030f8ce46Smrgelse
237130f8ce46Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
237230f8ce46Smrgfi
237330f8ce46Smrgm4_ifval([$1],
237430f8ce46Smrg[if test "$have_doxygen" = yes; then
237530f8ce46Smrg    # scrape the doxygen version
237630f8ce46Smrg    AC_MSG_CHECKING([the doxygen version])
237730f8ce46Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
237830f8ce46Smrg    AC_MSG_RESULT([$doxygen_version])
237930f8ce46Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
238030f8ce46Smrg        [if test "x$use_doxygen" = xauto; then
238130f8ce46Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
238230f8ce46Smrg            have_doxygen=no
238330f8ce46Smrg        else
238430f8ce46Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
238530f8ce46Smrg        fi])
238630f8ce46Smrgfi])
23878f34cbf9Ssnj
23888f34cbf9Ssnjdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
23898f34cbf9Ssnjdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
23908f34cbf9Ssnjdnl 	HAVE_DOT = @HAVE_DOT@
23918f34cbf9SsnjHAVE_DOT=no
23928f34cbf9Ssnjif test "x$have_doxygen" = "xyes"; then
23938f34cbf9Ssnj  AC_PATH_PROG([DOT], [dot])
23948f34cbf9Ssnj    if test "x$DOT" != "x"; then
23958f34cbf9Ssnj      HAVE_DOT=yes
23968f34cbf9Ssnj    fi
23978f34cbf9Ssnjfi
23988f34cbf9Ssnj
23998f34cbf9SsnjAC_SUBST([HAVE_DOT])
24008f34cbf9SsnjAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
240130f8ce46SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
240230f8ce46Smrg]) # XORG_WITH_DOXYGEN
240330f8ce46Smrg
240430f8ce46Smrg# XORG_WITH_GROFF([DEFAULT])
240530f8ce46Smrg# ----------------
240630f8ce46Smrg# Minimum version: 1.6.0
240730f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
240830f8ce46Smrg#
240930f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
241030f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
241130f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
241230f8ce46Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
241330f8ce46Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
241430f8ce46Smrg# --with-groff assumes 'auto'.
241530f8ce46Smrg#
241630f8ce46Smrg# Interface to module:
241730f8ce46Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
241830f8ce46Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
241930f8ce46Smrg# HAVE_GROFF_MS: the -ms macros package
242030f8ce46Smrg# GROFF:	 returns the path of the groff program found
242130f8ce46Smrg#		 returns the path set by the user in the environment
242230f8ce46Smrg# --with-groff:	 'yes' user instructs the module to use groff
242330f8ce46Smrg#		 'no' user instructs the module not to use groff
242430f8ce46Smrg#
242530f8ce46Smrg# Added in version 1.9.0:
242630f8ce46Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
242730f8ce46Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
242830f8ce46Smrg#		   psselect from the psutils package.
242930f8ce46Smrg#		   the ghostcript package. Refer to the grohtml man pages
243030f8ce46Smrg#
243130f8ce46Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
243230f8ce46Smrg#
243330f8ce46Smrg# OS and distros often splits groff in a basic and full package, the former
243430f8ce46Smrg# having the groff program and the later having devices, fonts and macros
243530f8ce46Smrg# Checking for the groff executable is not enough.
243630f8ce46Smrg#
243730f8ce46Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
243830f8ce46Smrg# unset HAVE_GROFF or GROFF env variables.
243930f8ce46Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
244030f8ce46Smrg#
244130f8ce46SmrgAC_DEFUN([XORG_WITH_GROFF],[
244230f8ce46SmrgAC_ARG_VAR([GROFF], [Path to groff command])
244330f8ce46Smrgm4_define([_defopt], m4_default([$1], [auto]))
244430f8ce46SmrgAC_ARG_WITH(groff,
244530f8ce46Smrg	AS_HELP_STRING([--with-groff],
244630f8ce46Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
244730f8ce46Smrg	   [use_groff=$withval], [use_groff=]_defopt)
244830f8ce46Smrgm4_undefine([_defopt])
244930f8ce46Smrg
245030f8ce46Smrgif test "x$use_groff" = x"auto"; then
245130f8ce46Smrg   AC_PATH_PROG([GROFF], [groff])
245230f8ce46Smrg   if test "x$GROFF" = "x"; then
245330f8ce46Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
245430f8ce46Smrg	have_groff=no
245530f8ce46Smrg   else
245630f8ce46Smrg        have_groff=yes
245730f8ce46Smrg   fi
245830f8ce46Smrgelif test "x$use_groff" = x"yes" ; then
245930f8ce46Smrg   AC_PATH_PROG([GROFF], [groff])
246030f8ce46Smrg   if test "x$GROFF" = "x"; then
246130f8ce46Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
246230f8ce46Smrg   fi
246330f8ce46Smrg   have_groff=yes
246430f8ce46Smrgelif test "x$use_groff" = x"no" ; then
246530f8ce46Smrg   if test "x$GROFF" != "x"; then
246630f8ce46Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
246730f8ce46Smrg   fi
246830f8ce46Smrg   have_groff=no
246930f8ce46Smrgelse
247030f8ce46Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
247130f8ce46Smrgfi
247230f8ce46Smrg
247330f8ce46Smrg# We have groff, test for the presence of the macro packages
247430f8ce46Smrgif test "x$have_groff" = x"yes"; then
247530f8ce46Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
247630f8ce46Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
247730f8ce46Smrg        groff_ms_works=yes
247830f8ce46Smrg    else
247930f8ce46Smrg        groff_ms_works=no
248030f8ce46Smrg    fi
248130f8ce46Smrg    AC_MSG_RESULT([$groff_ms_works])
248230f8ce46Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
248330f8ce46Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
248430f8ce46Smrg        groff_mm_works=yes
248530f8ce46Smrg    else
248630f8ce46Smrg        groff_mm_works=no
248730f8ce46Smrg    fi
248830f8ce46Smrg    AC_MSG_RESULT([$groff_mm_works])
248930f8ce46Smrgfi
249030f8ce46Smrg
249130f8ce46Smrg# We have groff, test for HTML dependencies, one command per package
249230f8ce46Smrgif test "x$have_groff" = x"yes"; then
249330f8ce46Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
249430f8ce46Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
249530f8ce46Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
249630f8ce46Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
249730f8ce46Smrg      have_groff_html=yes
249830f8ce46Smrg   else
249930f8ce46Smrg      have_groff_html=no
250030f8ce46Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
250130f8ce46Smrg   fi
250230f8ce46Smrgfi
250330f8ce46Smrg
250430f8ce46Smrg# Set Automake conditionals for Makefiles
250530f8ce46SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
250630f8ce46SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
250730f8ce46SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
250830f8ce46SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
250930f8ce46Smrg]) # XORG_WITH_GROFF
251030f8ce46Smrg
251134f90d55Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
251234f90d55Smrg# ---------------------------------------
251330f8ce46Smrg# Minimum version: 1.6.0
251430f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
251534f90d55Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
251630f8ce46Smrg#
251730f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
251830f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
251930f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
252030f8ce46Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
252130f8ce46Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
252230f8ce46Smrg# --with-fop assumes 'auto'.
252330f8ce46Smrg#
252430f8ce46Smrg# Interface to module:
252530f8ce46Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
252630f8ce46Smrg# FOP:	 	returns the path of the fop program found
252730f8ce46Smrg#		returns the path set by the user in the environment
252830f8ce46Smrg# --with-fop: 	'yes' user instructs the module to use fop
252930f8ce46Smrg#		'no' user instructs the module not to use fop
253030f8ce46Smrg#
253130f8ce46Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
253230f8ce46Smrg#
253330f8ce46SmrgAC_DEFUN([XORG_WITH_FOP],[
253430f8ce46SmrgAC_ARG_VAR([FOP], [Path to fop command])
253534f90d55Smrgm4_define([_defopt], m4_default([$2], [auto]))
253630f8ce46SmrgAC_ARG_WITH(fop,
253730f8ce46Smrg	AS_HELP_STRING([--with-fop],
253830f8ce46Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
253930f8ce46Smrg	   [use_fop=$withval], [use_fop=]_defopt)
254030f8ce46Smrgm4_undefine([_defopt])
254130f8ce46Smrg
254230f8ce46Smrgif test "x$use_fop" = x"auto"; then
254330f8ce46Smrg   AC_PATH_PROG([FOP], [fop])
254430f8ce46Smrg   if test "x$FOP" = "x"; then
254530f8ce46Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
254630f8ce46Smrg	have_fop=no
254730f8ce46Smrg   else
254830f8ce46Smrg        have_fop=yes
254930f8ce46Smrg   fi
255030f8ce46Smrgelif test "x$use_fop" = x"yes" ; then
255130f8ce46Smrg   AC_PATH_PROG([FOP], [fop])
255230f8ce46Smrg   if test "x$FOP" = "x"; then
255330f8ce46Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
255430f8ce46Smrg   fi
255530f8ce46Smrg   have_fop=yes
255630f8ce46Smrgelif test "x$use_fop" = x"no" ; then
255730f8ce46Smrg   if test "x$FOP" != "x"; then
255830f8ce46Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
255930f8ce46Smrg   fi
256030f8ce46Smrg   have_fop=no
256130f8ce46Smrgelse
256230f8ce46Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
256330f8ce46Smrgfi
256434f90d55Smrg
256534f90d55Smrg# Test for a minimum version of fop, if provided.
256634f90d55Smrgm4_ifval([$1],
256734f90d55Smrg[if test "$have_fop" = yes; then
256834f90d55Smrg    # scrape the fop version
256934f90d55Smrg    AC_MSG_CHECKING([for fop minimum version])
257034f90d55Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
257134f90d55Smrg    AC_MSG_RESULT([$fop_version])
257234f90d55Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
257334f90d55Smrg        [if test "x$use_fop" = xauto; then
257434f90d55Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
257534f90d55Smrg            have_fop=no
257634f90d55Smrg        else
257734f90d55Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
257834f90d55Smrg        fi])
257934f90d55Smrgfi])
258030f8ce46SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
258130f8ce46Smrg]) # XORG_WITH_FOP
258230f8ce46Smrg
25838f34cbf9Ssnj# XORG_WITH_M4([MIN-VERSION])
25848f34cbf9Ssnj# ---------------------------
25858f34cbf9Ssnj# Minimum version: 1.19.0
25868f34cbf9Ssnj#
25878f34cbf9Ssnj# This macro attempts to locate an m4 macro processor which supports
25888f34cbf9Ssnj# -I option and is only useful for modules relying on M4 in order to
25898f34cbf9Ssnj# expand macros in source code files.
25908f34cbf9Ssnj#
25918f34cbf9Ssnj# Interface to module:
25928f34cbf9Ssnj# M4:	 	returns the path of the m4 program found
25938f34cbf9Ssnj#		returns the path set by the user in the environment
25948f34cbf9Ssnj#
25958f34cbf9SsnjAC_DEFUN([XORG_WITH_M4], [
25968f34cbf9SsnjAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
25978f34cbf9Ssnj   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
25988f34cbf9Ssnj       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
25998f34cbf9Ssnj         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
26008f34cbf9Ssnj   [AC_MSG_ERROR([could not find m4 that supports -I option])],
26018f34cbf9Ssnj   [$PATH:/usr/gnu/bin])])
26028f34cbf9Ssnj
26038f34cbf9SsnjAC_SUBST([M4], [$ac_cv_path_M4])
26048f34cbf9Ssnj]) # XORG_WITH_M4
26058f34cbf9Ssnj
260630f8ce46Smrg# XORG_WITH_PS2PDF([DEFAULT])
260730f8ce46Smrg# ----------------
260830f8ce46Smrg# Minimum version: 1.6.0
260930f8ce46Smrg# Minimum version for optional DEFAULT argument: 1.11.0
261030f8ce46Smrg#
261130f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
261230f8ce46Smrg# not at the appropriate level. This macro enables a module to test for the
261330f8ce46Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
261430f8ce46Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
261530f8ce46Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
261630f8ce46Smrg# --with-ps2pdf assumes 'auto'.
261730f8ce46Smrg#
261830f8ce46Smrg# Interface to module:
261930f8ce46Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
262030f8ce46Smrg# PS2PDF:	returns the path of the ps2pdf program found
262130f8ce46Smrg#		returns the path set by the user in the environment
262230f8ce46Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
262330f8ce46Smrg#		 'no' user instructs the module not to use ps2pdf
262430f8ce46Smrg#
262530f8ce46Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
262630f8ce46Smrg#
262730f8ce46SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
262830f8ce46SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
262930f8ce46Smrgm4_define([_defopt], m4_default([$1], [auto]))
263030f8ce46SmrgAC_ARG_WITH(ps2pdf,
263130f8ce46Smrg	AS_HELP_STRING([--with-ps2pdf],
263230f8ce46Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
263330f8ce46Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
263430f8ce46Smrgm4_undefine([_defopt])
263530f8ce46Smrg
263630f8ce46Smrgif test "x$use_ps2pdf" = x"auto"; then
263730f8ce46Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
263830f8ce46Smrg   if test "x$PS2PDF" = "x"; then
263930f8ce46Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
264030f8ce46Smrg	have_ps2pdf=no
264130f8ce46Smrg   else
264230f8ce46Smrg        have_ps2pdf=yes
264330f8ce46Smrg   fi
264430f8ce46Smrgelif test "x$use_ps2pdf" = x"yes" ; then
264530f8ce46Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
264630f8ce46Smrg   if test "x$PS2PDF" = "x"; then
264730f8ce46Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
264830f8ce46Smrg   fi
264930f8ce46Smrg   have_ps2pdf=yes
265030f8ce46Smrgelif test "x$use_ps2pdf" = x"no" ; then
265130f8ce46Smrg   if test "x$PS2PDF" != "x"; then
265230f8ce46Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
265330f8ce46Smrg   fi
265430f8ce46Smrg   have_ps2pdf=no
265530f8ce46Smrgelse
265630f8ce46Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
265730f8ce46Smrgfi
265830f8ce46SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
265930f8ce46Smrg]) # XORG_WITH_PS2PDF
266030f8ce46Smrg
266130f8ce46Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
266230f8ce46Smrg# ----------------
266330f8ce46Smrg# Minimum version: 1.6.0
266430f8ce46Smrg#
266530f8ce46Smrg# Documentation tools are not always available on all platforms and sometimes
266630f8ce46Smrg# not at the appropriate level. This macro enables a builder to skip all
266730f8ce46Smrg# documentation targets except traditional man pages.
266830f8ce46Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
266930f8ce46Smrg# maximum flexibilty in controlling documentation building.
267030f8ce46Smrg# Refer to:
267130f8ce46Smrg# XORG_WITH_XMLTO         --with-xmlto
267230f8ce46Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
267330f8ce46Smrg# XORG_WITH_DOXYGEN       --with-doxygen
267430f8ce46Smrg# XORG_WITH_FOP           --with-fop
267530f8ce46Smrg# XORG_WITH_GROFF         --with-groff
267630f8ce46Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
267730f8ce46Smrg#
267830f8ce46Smrg# Interface to module:
267930f8ce46Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
268030f8ce46Smrg# --enable-docs: 'yes' user instructs the module to generate docs
268130f8ce46Smrg#		 'no' user instructs the module not to generate docs
268230f8ce46Smrg# parm1:	specify the default value, yes or no.
268330f8ce46Smrg#
268430f8ce46SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
268534f90d55Smrgm4_define([docs_default], m4_default([$1], [yes]))
268630f8ce46SmrgAC_ARG_ENABLE(docs,
268730f8ce46Smrg	AS_HELP_STRING([--enable-docs],
268834f90d55Smrg	   [Enable building the documentation (default: ]docs_default[)]),
268934f90d55Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
269034f90d55Smrgm4_undefine([docs_default])
269130f8ce46SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
269230f8ce46SmrgAC_MSG_CHECKING([whether to build documentation])
269330f8ce46SmrgAC_MSG_RESULT([$build_docs])
269430f8ce46Smrg]) # XORG_ENABLE_DOCS
269530f8ce46Smrg
269630f8ce46Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
269730f8ce46Smrg# ----------------
269830f8ce46Smrg# Minimum version: 1.6.0
269930f8ce46Smrg#
270030f8ce46Smrg# This macro enables a builder to skip all developer documentation.
270130f8ce46Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
270230f8ce46Smrg# maximum flexibilty in controlling documentation building.
270330f8ce46Smrg# Refer to:
270430f8ce46Smrg# XORG_WITH_XMLTO         --with-xmlto
270530f8ce46Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
270630f8ce46Smrg# XORG_WITH_DOXYGEN       --with-doxygen
270730f8ce46Smrg# XORG_WITH_FOP           --with-fop
270830f8ce46Smrg# XORG_WITH_GROFF         --with-groff
270930f8ce46Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
271030f8ce46Smrg#
271130f8ce46Smrg# Interface to module:
271230f8ce46Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
271330f8ce46Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
271430f8ce46Smrg#			'no' user instructs the module not to generate developer docs
271530f8ce46Smrg# parm1:		specify the default value, yes or no.
271630f8ce46Smrg#
271730f8ce46SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
271830f8ce46Smrgm4_define([devel_default], m4_default([$1], [yes]))
271930f8ce46SmrgAC_ARG_ENABLE(devel-docs,
272030f8ce46Smrg	AS_HELP_STRING([--enable-devel-docs],
272130f8ce46Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
272230f8ce46Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
272330f8ce46Smrgm4_undefine([devel_default])
272430f8ce46SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
272530f8ce46SmrgAC_MSG_CHECKING([whether to build developer documentation])
272630f8ce46SmrgAC_MSG_RESULT([$build_devel_docs])
272730f8ce46Smrg]) # XORG_ENABLE_DEVEL_DOCS
272830f8ce46Smrg
272930f8ce46Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
273030f8ce46Smrg# ----------------
273130f8ce46Smrg# Minimum version: 1.6.0
273230f8ce46Smrg#
273330f8ce46Smrg# This macro enables a builder to skip all functional specification targets.
273430f8ce46Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
273530f8ce46Smrg# maximum flexibilty in controlling documentation building.
273630f8ce46Smrg# Refer to:
273730f8ce46Smrg# XORG_WITH_XMLTO         --with-xmlto
273830f8ce46Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
273930f8ce46Smrg# XORG_WITH_DOXYGEN       --with-doxygen
274030f8ce46Smrg# XORG_WITH_FOP           --with-fop
274130f8ce46Smrg# XORG_WITH_GROFF         --with-groff
274230f8ce46Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
274330f8ce46Smrg#
274430f8ce46Smrg# Interface to module:
274530f8ce46Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
274630f8ce46Smrg# --enable-specs:	'yes' user instructs the module to generate specs
274730f8ce46Smrg#			'no' user instructs the module not to generate specs
274830f8ce46Smrg# parm1:		specify the default value, yes or no.
274930f8ce46Smrg#
275030f8ce46SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
275130f8ce46Smrgm4_define([spec_default], m4_default([$1], [yes]))
275230f8ce46SmrgAC_ARG_ENABLE(specs,
275330f8ce46Smrg	AS_HELP_STRING([--enable-specs],
275430f8ce46Smrg	   [Enable building the specs (default: ]spec_default[)]),
275530f8ce46Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
275630f8ce46Smrgm4_undefine([spec_default])
275730f8ce46SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
275830f8ce46SmrgAC_MSG_CHECKING([whether to build functional specifications])
275930f8ce46SmrgAC_MSG_RESULT([$build_specs])
276030f8ce46Smrg]) # XORG_ENABLE_SPECS
276130f8ce46Smrg
276234f90d55Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
276334f90d55Smrg# ----------------------------------------------
276434f90d55Smrg# Minimum version: 1.13.0
276534f90d55Smrg#
276634f90d55Smrg# This macro enables a builder to enable/disable unit testing
276734f90d55Smrg# It makes no assumption about the test cases implementation
276834f90d55Smrg# Test cases may or may not use Automake "Support for test suites"
276934f90d55Smrg# They may or may not use the software utility library GLib
277034f90d55Smrg#
277134f90d55Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
277234f90d55Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
277334f90d55Smrg# The variable enable_unit_tests is used by other macros in this file.
277434f90d55Smrg#
277534f90d55Smrg# Interface to module:
277634f90d55Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
277734f90d55Smrg# enable_unit_tests:    used in configure.ac for additional configuration
277834f90d55Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
277934f90d55Smrg#			'no' user instructs the module not to build tests
278034f90d55Smrg# parm1:		specify the default value, yes or no.
278134f90d55Smrg#
278234f90d55SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
278334f90d55SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
278434f90d55SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
278534f90d55SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
278634f90d55Smrgm4_define([_defopt], m4_default([$1], [auto]))
278734f90d55SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
278834f90d55Smrg	[Enable building unit test cases (default: ]_defopt[)]),
278934f90d55Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
279034f90d55Smrgm4_undefine([_defopt])
279134f90d55SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
279234f90d55SmrgAC_MSG_CHECKING([whether to build unit test cases])
279334f90d55SmrgAC_MSG_RESULT([$enable_unit_tests])
279434f90d55Smrg]) # XORG_ENABLE_UNIT_TESTS
279534f90d55Smrg
279634f90d55Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
279734f90d55Smrg# ------------------------------------------------------
279834f90d55Smrg# Minimum version: 1.17.0
279934f90d55Smrg#
280034f90d55Smrg# This macro enables a builder to enable/disable integration testing
280134f90d55Smrg# It makes no assumption about the test cases' implementation
280234f90d55Smrg# Test cases may or may not use Automake "Support for test suites"
280334f90d55Smrg#
280434f90d55Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
280534f90d55Smrg# usually requires less dependencies and may be built and run under less
280634f90d55Smrg# stringent environments than integration tests.
280734f90d55Smrg#
280834f90d55Smrg# Interface to module:
280934f90d55Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
281034f90d55Smrg# enable_integration_tests:   used in configure.ac for additional configuration
281134f90d55Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
281234f90d55Smrg#                             'no' user instructs the module not to build tests
281334f90d55Smrg# parm1:                      specify the default value, yes or no.
281434f90d55Smrg#
281534f90d55SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
281634f90d55SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
281734f90d55Smrgm4_define([_defopt], m4_default([$1], [auto]))
281834f90d55SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
281934f90d55Smrg	[Enable building integration test cases (default: ]_defopt[)]),
282034f90d55Smrg	[enable_integration_tests=$enableval],
282134f90d55Smrg	[enable_integration_tests=]_defopt)
282234f90d55Smrgm4_undefine([_defopt])
282334f90d55SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
282434f90d55Smrg	[test "x$enable_integration_tests" != xno])
282534f90d55SmrgAC_MSG_CHECKING([whether to build unit test cases])
282634f90d55SmrgAC_MSG_RESULT([$enable_integration_tests])
282734f90d55Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
282834f90d55Smrg
282934f90d55Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
283034f90d55Smrg# ----------------------------------------
283134f90d55Smrg# Minimum version: 1.13.0
283234f90d55Smrg#
283334f90d55Smrg# GLib is a library which provides advanced data structures and functions.
283434f90d55Smrg# This macro enables a module to test for the presence of Glib.
283534f90d55Smrg#
283634f90d55Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
283734f90d55Smrg# Otherwise the value of $enable_unit_tests is blank.
283834f90d55Smrg#
283934f90d55Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
284034f90d55Smrg# test support usually requires less dependencies and may be built and run under
284134f90d55Smrg# less stringent environments than integration tests.
284234f90d55Smrg#
284334f90d55Smrg# Interface to module:
284434f90d55Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
284534f90d55Smrg# with_glib: used in configure.ac to know if GLib has been found
284634f90d55Smrg# --with-glib:	'yes' user instructs the module to use glib
284734f90d55Smrg#		'no' user instructs the module not to use glib
284834f90d55Smrg#
284934f90d55SmrgAC_DEFUN([XORG_WITH_GLIB],[
285034f90d55SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
285134f90d55Smrgm4_define([_defopt], m4_default([$2], [auto]))
285234f90d55SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
285334f90d55Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
285434f90d55Smrg	[with_glib=$withval], [with_glib=]_defopt)
285534f90d55Smrgm4_undefine([_defopt])
285634f90d55Smrg
285734f90d55Smrghave_glib=no
285834f90d55Smrg# Do not probe GLib if user explicitly disabled unit testing
285934f90d55Smrgif test "x$enable_unit_tests" != x"no"; then
286034f90d55Smrg  # Do not probe GLib if user explicitly disabled it
286134f90d55Smrg  if test "x$with_glib" != x"no"; then
286234f90d55Smrg    m4_ifval(
286334f90d55Smrg      [$1],
286434f90d55Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
286534f90d55Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
286634f90d55Smrg    )
286734f90d55Smrg  fi
286834f90d55Smrgfi
286934f90d55Smrg
287034f90d55Smrg# Not having GLib when unit testing has been explicitly requested is an error
287134f90d55Smrgif test "x$enable_unit_tests" = x"yes"; then
287234f90d55Smrg  if test "x$have_glib" = x"no"; then
287334f90d55Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
287434f90d55Smrg  fi
287534f90d55Smrgfi
287634f90d55Smrg
287734f90d55Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
287834f90d55Smrgif test "x$enable_unit_tests" = x"no"; then
287934f90d55Smrg  if test "x$with_glib" = x"yes"; then
288034f90d55Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
288134f90d55Smrg  fi
288234f90d55Smrgfi
288334f90d55Smrg
288434f90d55Smrg# Not having GLib when it has been explicitly requested is an error
288534f90d55Smrgif test "x$with_glib" = x"yes"; then
288634f90d55Smrg  if test "x$have_glib" = x"no"; then
288734f90d55Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
288834f90d55Smrg  fi
288934f90d55Smrgfi
289034f90d55Smrg
289134f90d55SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
289234f90d55Smrg]) # XORG_WITH_GLIB
289334f90d55Smrg
289434f90d55Smrg# XORG_LD_WRAP([required|optional])
289534f90d55Smrg# ---------------------------------
289634f90d55Smrg# Minimum version: 1.13.0
289734f90d55Smrg#
289834f90d55Smrg# Check if linker supports -wrap, passed via compiler flags
289934f90d55Smrg#
290034f90d55Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
290134f90d55Smrg# Otherwise the value of $enable_unit_tests is blank.
290234f90d55Smrg#
290334f90d55Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
290434f90d55Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
290534f90d55Smrg# available, an argument of "optional" allows use when some unit tests require
290634f90d55Smrg# ld -wrap and others do not.
290734f90d55Smrg#
290834f90d55SmrgAC_DEFUN([XORG_LD_WRAP],[
290934f90d55SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
291034f90d55Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
291134f90d55Smrg                      void __wrap_exit(int status) { return; }],
291234f90d55Smrg                     [exit(0);])])
291334f90d55Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
291434f90d55Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
291534f90d55Smrg  if test "x$have_ld_wrap" = x"no"; then
291634f90d55Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
291734f90d55Smrg  fi
291834f90d55Smrgfi
291934f90d55SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
292034f90d55Smrg#
292134f90d55Smrg]) # XORG_LD_WRAP
292234f90d55Smrg
292334f90d55Smrg# XORG_CHECK_LINKER_FLAGS
292434f90d55Smrg# -----------------------
292534f90d55Smrg# SYNOPSIS
292634f90d55Smrg#
292734f90d55Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
292834f90d55Smrg#
292934f90d55Smrg# DESCRIPTION
293034f90d55Smrg#
293134f90d55Smrg#   Check whether the given linker FLAGS work with the current language's
293234f90d55Smrg#   linker, or whether they give an error.
293334f90d55Smrg#
293434f90d55Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
293534f90d55Smrg#   success/failure.
293634f90d55Smrg#
293734f90d55Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
293834f90d55Smrg#
293934f90d55Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
294034f90d55Smrg#
294134f90d55Smrg# LICENSE
294234f90d55Smrg#
294334f90d55Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
294434f90d55Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
294534f90d55Smrg#   Copyright (c) 2009 Matteo Frigo
294634f90d55Smrg#
294734f90d55Smrg#   This program is free software: you can redistribute it and/or modify it
294834f90d55Smrg#   under the terms of the GNU General Public License as published by the
294934f90d55Smrg#   Free Software Foundation, either version 3 of the License, or (at your
295034f90d55Smrg#   option) any later version.
295134f90d55Smrg#
295234f90d55Smrg#   This program is distributed in the hope that it will be useful, but
295334f90d55Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
295434f90d55Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
295534f90d55Smrg#   Public License for more details.
295634f90d55Smrg#
295734f90d55Smrg#   You should have received a copy of the GNU General Public License along
295834f90d55Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
295934f90d55Smrg#
296034f90d55Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
296134f90d55Smrg#   gives unlimited permission to copy, distribute and modify the configure
296234f90d55Smrg#   scripts that are the output of Autoconf when processing the Macro. You
296334f90d55Smrg#   need not follow the terms of the GNU General Public License when using
296434f90d55Smrg#   or distributing such scripts, even though portions of the text of the
296534f90d55Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
296634f90d55Smrg#   all other use of the material that constitutes the Autoconf Macro.
296734f90d55Smrg#
296834f90d55Smrg#   This special exception to the GPL applies to versions of the Autoconf
296934f90d55Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
297034f90d55Smrg#   modified version of the Autoconf Macro, you may extend this special
297134f90d55Smrg#   exception to the GPL to apply to your modified version as well.#
297234f90d55SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
297334f90d55Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
297434f90d55Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
297534f90d55SmrgAS_LITERAL_IF([$1],
297634f90d55Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
297734f90d55Smrg      ax_save_FLAGS=$LDFLAGS
297834f90d55Smrg      LDFLAGS="$1"
297934f90d55Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
298034f90d55Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
298134f90d55Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
298234f90d55Smrg      LDFLAGS=$ax_save_FLAGS])],
298334f90d55Smrg  [ax_save_FLAGS=$LDFLAGS
298434f90d55Smrg   LDFLAGS="$1"
298534f90d55Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
298634f90d55Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
298734f90d55Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
298834f90d55Smrg   LDFLAGS=$ax_save_FLAGS])
298934f90d55Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
299034f90d55SmrgAC_MSG_RESULT($xorg_check_linker_flags)
299134f90d55Smrgif test "x$xorg_check_linker_flags" = xyes; then
299234f90d55Smrg	m4_default([$2], :)
299334f90d55Smrgelse
299434f90d55Smrg	m4_default([$3], :)
299534f90d55Smrgfi
299634f90d55Smrg]) # XORG_CHECK_LINKER_FLAGS
299734f90d55Smrg
299834f90d55Smrg# XORG_MEMORY_CHECK_FLAGS
299934f90d55Smrg# -----------------------
300034f90d55Smrg# Minimum version: 1.16.0
300134f90d55Smrg#
300234f90d55Smrg# This macro attempts to find appropriate memory checking functionality
300334f90d55Smrg# for various platforms which unit testing code may use to catch various
300434f90d55Smrg# forms of memory allocation and access errors in testing.
300534f90d55Smrg#
300634f90d55Smrg# Interface to module:
300734f90d55Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
300834f90d55Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
300934f90d55Smrg#
301034f90d55Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
301134f90d55Smrg#
301234f90d55SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
301334f90d55Smrg
301434f90d55SmrgAC_REQUIRE([AC_CANONICAL_HOST])
301534f90d55SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
301634f90d55Smrg           [Environment variables to enable memory checking in tests])
301734f90d55Smrg
301834f90d55Smrg# Check for different types of support on different platforms
301934f90d55Smrgcase $host_os in
302034f90d55Smrg    solaris*)
302134f90d55Smrg        AC_CHECK_LIB([umem], [umem_alloc],
302234f90d55Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
302334f90d55Smrg        ;;
302434f90d55Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
302534f90d55Smrg        # both directly and inverted, so should not be 0 or 255.
302634f90d55Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
302734f90d55Smrg        ;;
302834f90d55Smrg    darwin*)
302934f90d55Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
303034f90d55Smrg        ;;
303134f90d55Smrg    *bsd*)
303234f90d55Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
303334f90d55Smrg        ;;
303434f90d55Smrgesac
303534f90d55Smrg
303634f90d55Smrg# User supplied flags override default flags
303734f90d55Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
303834f90d55Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
303934f90d55Smrgfi
304034f90d55Smrg
304134f90d55SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
304234f90d55Smrg]) # XORG_WITH_LINT
304334f90d55Smrg
3044ce6676dbSmrg# XORG_CHECK_MALLOC_ZERO
3045ce6676dbSmrg# ----------------------
3046ce6676dbSmrg# Minimum version: 1.0.0
3047ce6676dbSmrg#
3048ce6676dbSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
3049ce6676dbSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
3050ce6676dbSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
3051ce6676dbSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
3052ce6676dbSmrgAC_ARG_ENABLE(malloc0returnsnull,
305330f8ce46Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
3054ce6676dbSmrg		       [malloc(0) returns NULL (default: auto)]),
3055ce6676dbSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
3056ce6676dbSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
3057ce6676dbSmrg
3058ce6676dbSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
3059ce6676dbSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
30608f34cbf9SsnjAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
30618f34cbf9Ssnj	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
306234f90d55Smrg#include <stdlib.h>
306334f90d55Smrg],[
3064ce6676dbSmrg    char *m0, *r0, *c0, *p;
3065ce6676dbSmrg    m0 = malloc(0);
3066ce6676dbSmrg    p = malloc(10);
3067ce6676dbSmrg    r0 = realloc(p,0);
306834f90d55Smrg    c0 = calloc(0,10);
306934f90d55Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
307034f90d55Smrg])],
30718f34cbf9Ssnj		[xorg_cv_malloc0_returns_null=yes],
30728f34cbf9Ssnj		[xorg_cv_malloc0_returns_null=no])])
30738f34cbf9SsnjMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
3074ce6676dbSmrgfi
3075ce6676dbSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
3076ce6676dbSmrg
3077ce6676dbSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
3078ce6676dbSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
3079ce6676dbSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
3080ce6676dbSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
3081ce6676dbSmrgelse
3082ce6676dbSmrg	MALLOC_ZERO_CFLAGS=""
3083ce6676dbSmrg	XMALLOC_ZERO_CFLAGS=""
3084ce6676dbSmrg	XTMALLOC_ZERO_CFLAGS=""
3085ce6676dbSmrgfi
3086ce6676dbSmrg
3087ce6676dbSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
3088ce6676dbSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
3089ce6676dbSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
3090ce6676dbSmrg]) # XORG_CHECK_MALLOC_ZERO
3091ce6676dbSmrg
3092ce6676dbSmrg# XORG_WITH_LINT()
3093ce6676dbSmrg# ----------------
3094ce6676dbSmrg# Minimum version: 1.1.0
3095ce6676dbSmrg#
309630f8ce46Smrg# This macro enables the use of a tool that flags some suspicious and
309730f8ce46Smrg# non-portable constructs (likely to be bugs) in C language source code.
309830f8ce46Smrg# It will attempt to locate the tool and use appropriate options.
309930f8ce46Smrg# There are various lint type tools on different platforms.
310030f8ce46Smrg#
310130f8ce46Smrg# Interface to module:
310230f8ce46Smrg# LINT:		returns the path to the tool found on the platform
310330f8ce46Smrg#		or the value set to LINT on the configure cmd line
310430f8ce46Smrg#		also an Automake conditional
310530f8ce46Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
310630f8ce46Smrg#
310730f8ce46Smrg# --with-lint:	'yes' user instructs the module to use lint
310830f8ce46Smrg#		'no' user instructs the module not to use lint (default)
310930f8ce46Smrg#
311030f8ce46Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
311130f8ce46Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3112ce6676dbSmrg#
3113ce6676dbSmrgAC_DEFUN([XORG_WITH_LINT],[
3114ce6676dbSmrg
311530f8ce46SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
311630f8ce46SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
311730f8ce46SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3118ce6676dbSmrg		[Use a lint-style source code checker (default: disabled)])],
3119ce6676dbSmrg		[use_lint=$withval], [use_lint=no])
312030f8ce46Smrg
312130f8ce46Smrg# Obtain platform specific info like program name and options
312230f8ce46Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
312330f8ce46Smrgcase $host_os in
312430f8ce46Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
312530f8ce46Smrg	lint_name=splint
312630f8ce46Smrg	lint_options="-badflag"
312730f8ce46Smrg	;;
312830f8ce46Smrg  *freebsd* | *netbsd*)
312930f8ce46Smrg	lint_name=lint
313030f8ce46Smrg	lint_options="-u -b"
313130f8ce46Smrg	;;
313230f8ce46Smrg  *solaris*)
313330f8ce46Smrg	lint_name=lint
313430f8ce46Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
313530f8ce46Smrg	;;
313630f8ce46Smrgesac
313730f8ce46Smrg
313830f8ce46Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
313930f8ce46Smrgif test "x$use_lint" = x"yes" ; then
314030f8ce46Smrg   AC_PATH_PROG([LINT], [$lint_name])
314130f8ce46Smrg   if test "x$LINT" = "x"; then
314230f8ce46Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
314330f8ce46Smrg   fi
314430f8ce46Smrgelif test "x$use_lint" = x"no" ; then
314530f8ce46Smrg   if test "x$LINT" != "x"; then
314630f8ce46Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
314730f8ce46Smrg   fi
3148ce6676dbSmrgelse
314930f8ce46Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3150ce6676dbSmrgfi
315130f8ce46Smrg
315230f8ce46Smrg# User supplied flags override default flags
315330f8ce46Smrgif test "x$LINT_FLAGS" != "x"; then
315430f8ce46Smrg   lint_options=$LINT_FLAGS
3155ce6676dbSmrgfi
3156ce6676dbSmrg
315730f8ce46SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
315830f8ce46SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3159ce6676dbSmrg
3160ce6676dbSmrg]) # XORG_WITH_LINT
3161ce6676dbSmrg
3162ce6676dbSmrg# XORG_LINT_LIBRARY(LIBNAME)
3163ce6676dbSmrg# --------------------------
3164ce6676dbSmrg# Minimum version: 1.1.0
3165ce6676dbSmrg#
3166ce6676dbSmrg# Sets up flags for building lint libraries for checking programs that call
3167ce6676dbSmrg# functions in the library.
3168ce6676dbSmrg#
316930f8ce46Smrg# Interface to module:
317030f8ce46Smrg# LINTLIB		- Automake variable with the name of lint library file to make
317130f8ce46Smrg# MAKE_LINT_LIB		- Automake conditional
317230f8ce46Smrg#
317330f8ce46Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
317430f8ce46Smrg#			  - 'no' user instructs the module not to create a lint library (default)
3175ce6676dbSmrg
3176ce6676dbSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3177ce6676dbSmrgAC_REQUIRE([XORG_WITH_LINT])
317830f8ce46SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3179ce6676dbSmrg	[Create lint library (default: disabled)])],
3180ce6676dbSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
318130f8ce46Smrg
318230f8ce46Smrgif test "x$make_lint_lib" = x"yes" ; then
318330f8ce46Smrg   LINTLIB=llib-l$1.ln
318430f8ce46Smrg   if test "x$LINT" = "x"; then
318530f8ce46Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
318630f8ce46Smrg   fi
318730f8ce46Smrgelif test "x$make_lint_lib" != x"no" ; then
318830f8ce46Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3189ce6676dbSmrgfi
319030f8ce46Smrg
3191ce6676dbSmrgAC_SUBST(LINTLIB)
3192ce6676dbSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3193ce6676dbSmrg
3194ce6676dbSmrg]) # XORG_LINT_LIBRARY
3195ce6676dbSmrg
319634f90d55Smrg# XORG_COMPILER_BRAND
319734f90d55Smrg# -------------------
319834f90d55Smrg# Minimum version: 1.14.0
319934f90d55Smrg#
320034f90d55Smrg# Checks for various brands of compilers and sets flags as appropriate:
320134f90d55Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
320234f90d55Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
320334f90d55Smrg#   clang compiler - sets CLANGCC to "yes"
320434f90d55Smrg#   Intel compiler - sets INTELCC to "yes"
320534f90d55Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
320634f90d55Smrg#
320734f90d55SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
320834f90d55SmrgAC_LANG_CASE(
320934f90d55Smrg	[C], [
321034f90d55Smrg		AC_REQUIRE([AC_PROG_CC_C99])
321134f90d55Smrg	],
321234f90d55Smrg	[C++], [
321334f90d55Smrg		AC_REQUIRE([AC_PROG_CXX])
321434f90d55Smrg	]
321534f90d55Smrg)
321634f90d55SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
321734f90d55SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
321834f90d55SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
321934f90d55Smrg]) # XORG_COMPILER_BRAND
322034f90d55Smrg
322134f90d55Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
322234f90d55Smrg# ---------------
322334f90d55Smrg# Minimum version: 1.16.0
322434f90d55Smrg#
322534f90d55Smrg# Test if the compiler works when passed the given flag as a command line argument.
322634f90d55Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
322734f90d55Smrg# next flag in the list until there are no more options.
322834f90d55Smrg#
322934f90d55Smrg# Note that this does not guarantee that the compiler supports the flag as some
323034f90d55Smrg# compilers will simply ignore arguments that they do not understand, but we do
323134f90d55Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
323234f90d55Smrg# -Werror=unused-command-line-argument
323334f90d55Smrg#
323434f90d55SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
323534f90d55Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
323634f90d55Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
323734f90d55Smrg
323834f90d55SmrgAC_LANG_COMPILER_REQUIRE
323934f90d55Smrg
324034f90d55SmrgAC_LANG_CASE(
324134f90d55Smrg	[C], [
324234f90d55Smrg		AC_REQUIRE([AC_PROG_CC_C99])
324334f90d55Smrg		define([PREFIX], [C])
324434f90d55Smrg		define([CACHE_PREFIX], [cc])
324534f90d55Smrg		define([COMPILER], [$CC])
324634f90d55Smrg	],
324734f90d55Smrg	[C++], [
324834f90d55Smrg		define([PREFIX], [CXX])
324934f90d55Smrg		define([CACHE_PREFIX], [cxx])
325034f90d55Smrg		define([COMPILER], [$CXX])
325134f90d55Smrg	]
325234f90d55Smrg)
325334f90d55Smrg
325434f90d55Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
325534f90d55Smrg
325634f90d55Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
325734f90d55Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
325834f90d55Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
325934f90d55Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
326034f90d55Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
326134f90d55Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
326234f90d55Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
326334f90d55Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
326434f90d55Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
326534f90d55Smrgfi
326634f90d55Smrg
326734f90d55Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
326834f90d55Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
326934f90d55Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
327034f90d55Smrg	fi
327134f90d55Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
327234f90d55Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
327334f90d55Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
327434f90d55Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
327534f90d55Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
327634f90d55Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
327734f90d55Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
327834f90d55Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
327934f90d55Smrgfi
328034f90d55Smrg
328134f90d55Smrgfound="no"
328234f90d55Smrgm4_foreach([flag], m4_cdr($@), [
328334f90d55Smrg	if test $found = "no" ; then
32848f34cbf9Ssnj		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
328534f90d55Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
328634f90d55Smrg		fi
328734f90d55Smrg
32888f34cbf9Ssnj		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
328934f90d55Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
329034f90d55Smrg		fi
329134f90d55Smrg
329234f90d55Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
329334f90d55Smrg
329434f90d55Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
329534f90d55Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
329634f90d55Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
329734f90d55Smrg		AC_CACHE_VAL($cacheid,
329834f90d55Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
329934f90d55Smrg					     [eval $cacheid=yes],
330034f90d55Smrg					     [eval $cacheid=no])])
330134f90d55Smrg
330234f90d55Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
330334f90d55Smrg
330434f90d55Smrg		eval supported=\$$cacheid
330534f90d55Smrg		AC_MSG_RESULT([$supported])
330634f90d55Smrg		if test "$supported" = "yes" ; then
330734f90d55Smrg			$1="$$1 ]flag["
330834f90d55Smrg			found="yes"
330934f90d55Smrg		fi
331034f90d55Smrg	fi
331134f90d55Smrg])
331234f90d55Smrg]) # XORG_TESTSET_CFLAG
331334f90d55Smrg
331434f90d55Smrg# XORG_COMPILER_FLAGS
331534f90d55Smrg# ---------------
331634f90d55Smrg# Minimum version: 1.16.0
331734f90d55Smrg#
331834f90d55Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
331934f90d55Smrg# arguments supported by the selected compiler which do NOT alter the generated
332034f90d55Smrg# code.  These arguments will cause the compiler to print various warnings
332134f90d55Smrg# during compilation AND turn a conservative set of warnings into errors.
332234f90d55Smrg#
332334f90d55Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
332434f90d55Smrg# future versions of util-macros as options are added to new compilers.
332534f90d55Smrg#
332634f90d55SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
332734f90d55SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
332834f90d55Smrg
332934f90d55SmrgAC_ARG_ENABLE(selective-werror,
333034f90d55Smrg              AS_HELP_STRING([--disable-selective-werror],
333134f90d55Smrg                             [Turn off selective compiler errors. (default: enabled)]),
333234f90d55Smrg              [SELECTIVE_WERROR=$enableval],
333334f90d55Smrg              [SELECTIVE_WERROR=yes])
333434f90d55Smrg
333534f90d55SmrgAC_LANG_CASE(
333634f90d55Smrg        [C], [
333734f90d55Smrg                define([PREFIX], [C])
333834f90d55Smrg        ],
333934f90d55Smrg        [C++], [
334034f90d55Smrg                define([PREFIX], [CXX])
334134f90d55Smrg        ]
334234f90d55Smrg)
334334f90d55Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
334434f90d55Smrgif test "x$SUNCC" = "xyes"; then
334534f90d55Smrg    [BASE_]PREFIX[FLAGS]="-v"
334634f90d55Smrgelse
334734f90d55Smrg    [BASE_]PREFIX[FLAGS]=""
334834f90d55Smrgfi
334934f90d55Smrg
335034f90d55Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
335134f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
335234f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
335334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
335434f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
335534f90d55Smrg
335634f90d55SmrgAC_LANG_CASE(
335734f90d55Smrg	[C], [
335834f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
335934f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
336034f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
336134f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
33628f34cbf9Ssnj		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
336334f90d55Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
336434f90d55Smrg	]
336534f90d55Smrg)
336634f90d55Smrg
336734f90d55Smrg# This chunk adds additional warnings that could catch undesired effects.
336834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
336934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
337034f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
337134f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
337234f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
337334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
33748f34cbf9SsnjXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
337534f90d55Smrg
337634f90d55Smrg# These are currently disabled because they are noisy.  They will be enabled
337734f90d55Smrg# in the future once the codebase is sufficiently modernized to silence
337834f90d55Smrg# them.  For now, I don't want them to drown out the other warnings.
337934f90d55Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
338034f90d55Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
33818f34cbf9Ssnj# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
338234f90d55Smrg
338334f90d55Smrg# Turn some warnings into errors, so we don't accidently get successful builds
338434f90d55Smrg# when there are problems that should be fixed.
338534f90d55Smrg
338634f90d55Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
338734f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
338834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
338934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
339034f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
339134f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
339234f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
339334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
339434f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
339534f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
339634f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
339734f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
339834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
339934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
340034f90d55Smrgelse
340134f90d55SmrgAC_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])
340234f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
340334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
340434f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
340534f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
340634f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
340734f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
340834f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
340934f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
341034f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
341134f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
341234f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
341334f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
341434f90d55SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
341534f90d55Smrgfi
341634f90d55Smrg
341734f90d55SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
341834f90d55Smrg]) # XORG_COMPILER_FLAGS
341934f90d55Smrg
3420ce6676dbSmrg# XORG_CWARNFLAGS
3421ce6676dbSmrg# ---------------
3422ce6676dbSmrg# Minimum version: 1.2.0
342334f90d55Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3424ce6676dbSmrg#
3425ce6676dbSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3426ce6676dbSmrg#
342734f90d55Smrg# This function is deprecated because it defines -fno-strict-aliasing
342834f90d55Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
342934f90d55Smrg# is needed, then it should be added explicitly in the module when
343034f90d55Smrg# it is updated to use BASE_CFLAGS.
343134f90d55Smrg#
3432ce6676dbSmrgAC_DEFUN([XORG_CWARNFLAGS], [
343334f90d55SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
343434f90d55SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
343534f90d55SmrgAC_LANG_CASE(
343634f90d55Smrg	[C], [
343734f90d55Smrg		CWARNFLAGS="$BASE_CFLAGS"
343834f90d55Smrg		if  test "x$GCC" = xyes ; then
343934f90d55Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
344034f90d55Smrg		fi
344134f90d55Smrg		AC_SUBST(CWARNFLAGS)
344234f90d55Smrg	]
344334f90d55Smrg)
3444ce6676dbSmrg]) # XORG_CWARNFLAGS
344530f8ce46Smrg
344630f8ce46Smrg# XORG_STRICT_OPTION
344730f8ce46Smrg# -----------------------
344830f8ce46Smrg# Minimum version: 1.3.0
344930f8ce46Smrg#
345034f90d55Smrg# Add configure option to enable strict compilation flags, such as treating
345134f90d55Smrg# warnings as fatal errors.
345234f90d55Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
345334f90d55Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
345434f90d55Smrg#
345534f90d55Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
345634f90d55Smrg# when strict compilation is unconditionally desired.
345730f8ce46SmrgAC_DEFUN([XORG_STRICT_OPTION], [
345830f8ce46SmrgAC_REQUIRE([XORG_CWARNFLAGS])
345934f90d55SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
346030f8ce46Smrg
346130f8ce46SmrgAC_ARG_ENABLE(strict-compilation,
346230f8ce46Smrg			  AS_HELP_STRING([--enable-strict-compilation],
346330f8ce46Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
346430f8ce46Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
346534f90d55Smrg
346634f90d55SmrgAC_LANG_CASE(
346734f90d55Smrg        [C], [
346834f90d55Smrg                define([PREFIX], [C])
346934f90d55Smrg        ],
347034f90d55Smrg        [C++], [
347134f90d55Smrg                define([PREFIX], [CXX])
347234f90d55Smrg        ]
347334f90d55Smrg)
347434f90d55Smrg
347534f90d55Smrg[STRICT_]PREFIX[FLAGS]=""
347634f90d55SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
347734f90d55SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
347834f90d55Smrg
347934f90d55Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
348034f90d55Smrg# activate it with -Werror, so we add it here explicitly.
348134f90d55SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
348234f90d55Smrg
348330f8ce46Smrgif test "x$STRICT_COMPILE" = "xyes"; then
348434f90d55Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
348534f90d55Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
348630f8ce46Smrgfi
348734f90d55SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
348834f90d55SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
348934f90d55SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
349030f8ce46Smrg]) # XORG_STRICT_OPTION
349130f8ce46Smrg
349230f8ce46Smrg# XORG_DEFAULT_OPTIONS
349330f8ce46Smrg# --------------------
349430f8ce46Smrg# Minimum version: 1.3.0
349530f8ce46Smrg#
349630f8ce46Smrg# Defines default options for X.Org modules.
349730f8ce46Smrg#
349830f8ce46SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
349930f8ce46SmrgAC_REQUIRE([AC_PROG_INSTALL])
350034f90d55SmrgXORG_COMPILER_FLAGS
350130f8ce46SmrgXORG_CWARNFLAGS
350230f8ce46SmrgXORG_STRICT_OPTION
350330f8ce46SmrgXORG_RELEASE_VERSION
350430f8ce46SmrgXORG_CHANGELOG
350530f8ce46SmrgXORG_INSTALL
350630f8ce46SmrgXORG_MANPAGE_SECTIONS
350730f8ce46Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
350830f8ce46Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
350930f8ce46Smrg]) # XORG_DEFAULT_OPTIONS
351030f8ce46Smrg
351130f8ce46Smrg# XORG_INSTALL()
351230f8ce46Smrg# ----------------
351330f8ce46Smrg# Minimum version: 1.4.0
351430f8ce46Smrg#
351530f8ce46Smrg# Defines the variable INSTALL_CMD as the command to copy
351630f8ce46Smrg# INSTALL from $prefix/share/util-macros.
351730f8ce46Smrg#
351830f8ce46SmrgAC_DEFUN([XORG_INSTALL], [
351930f8ce46SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
352030f8ce46Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
352130f8ce46SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
352230f8ce46Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
352330f8ce46Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
352430f8ce46Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
352530f8ce46SmrgAC_SUBST([INSTALL_CMD])
352630f8ce46Smrg]) # XORG_INSTALL
3527ce6676dbSmrgdnl Copyright 2005 Red Hat, Inc
3528ce6676dbSmrgdnl
3529ce6676dbSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3530ce6676dbSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3531ce6676dbSmrgdnl the above copyright notice appear in all copies and that both that
3532ce6676dbSmrgdnl copyright notice and this permission notice appear in supporting
3533ce6676dbSmrgdnl documentation.
3534ce6676dbSmrgdnl
3535ce6676dbSmrgdnl The above copyright notice and this permission notice shall be included
3536ce6676dbSmrgdnl in all copies or substantial portions of the Software.
3537ce6676dbSmrgdnl
3538ce6676dbSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3539ce6676dbSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3540ce6676dbSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3541ce6676dbSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3542ce6676dbSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3543ce6676dbSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3544ce6676dbSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3545ce6676dbSmrgdnl
3546ce6676dbSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3547ce6676dbSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3548ce6676dbSmrgdnl other dealings in this Software without prior written authorization
3549ce6676dbSmrgdnl from the copyright holders.
3550ce6676dbSmrgdnl
3551ce6676dbSmrg
3552ce6676dbSmrg# XORG_RELEASE_VERSION
3553ce6676dbSmrg# --------------------
355430f8ce46Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
35558f34cbf9Ssnj
3556ce6676dbSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3557ce6676dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3558ce6676dbSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3559ce6676dbSmrg		[Major version of this package])
3560ce6676dbSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3561ce6676dbSmrg	if test "x$PVM" = "x"; then
3562ce6676dbSmrg		PVM="0"
3563ce6676dbSmrg	fi
3564ce6676dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3565ce6676dbSmrg		[$PVM],
3566ce6676dbSmrg		[Minor version of this package])
3567ce6676dbSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3568ce6676dbSmrg	if test "x$PVP" = "x"; then
3569ce6676dbSmrg		PVP="0"
3570ce6676dbSmrg	fi
3571ce6676dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3572ce6676dbSmrg		[$PVP],
3573ce6676dbSmrg		[Patch version of this package])
3574ce6676dbSmrg])
3575ce6676dbSmrg
3576ce6676dbSmrg# XORG_CHANGELOG()
3577ce6676dbSmrg# ----------------
3578ce6676dbSmrg# Minimum version: 1.2.0
3579ce6676dbSmrg#
3580ce6676dbSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3581ce6676dbSmrg# ChangeLog from git.
3582ce6676dbSmrg#
3583ce6676dbSmrg#
3584ce6676dbSmrgAC_DEFUN([XORG_CHANGELOG], [
358530f8ce46SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
358630f8ce46Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
358730f8ce46Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3588ce6676dbSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3589ce6676dbSmrgAC_SUBST([CHANGELOG_CMD])
3590ce6676dbSmrg]) # XORG_CHANGELOG
3591ce6676dbSmrg
3592ce6676dbSmrgdnl
359334f90d55Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
359430f8ce46Smrgdnl
359530f8ce46Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
359630f8ce46Smrgdnl copy of this software and associated documentation files (the "Software"),
359730f8ce46Smrgdnl to deal in the Software without restriction, including without limitation
359830f8ce46Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
359930f8ce46Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
360030f8ce46Smrgdnl Software is furnished to do so, subject to the following conditions:
360130f8ce46Smrgdnl
360230f8ce46Smrgdnl The above copyright notice and this permission notice (including the next
360330f8ce46Smrgdnl paragraph) shall be included in all copies or substantial portions of the
360430f8ce46Smrgdnl Software.
360530f8ce46Smrgdnl
360630f8ce46Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
360730f8ce46Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
360830f8ce46Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
360930f8ce46Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
361030f8ce46Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
361130f8ce46Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
361230f8ce46Smrgdnl DEALINGS IN THE SOFTWARE.
361334f90d55Smrgdnl
3614ce6676dbSmrg
3615ce6676dbSmrg# XTRANS_TCP_FLAGS()
3616ce6676dbSmrg# ------------------
3617ce6676dbSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
3618ce6676dbSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
3619ce6676dbSmrg # SVR4 hides these in libraries other than libc
3620ce6676dbSmrg AC_SEARCH_LIBS(socket, [socket])
3621ce6676dbSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
362230f8ce46Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
36238f34cbf9Ssnj   AC_CHECK_LIB([ws2_32],[main])
362430f8ce46Smrg fi
3625ce6676dbSmrg
3626ce6676dbSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
362734f90d55Smrg AC_ARG_ENABLE(ipv6,
36288f34cbf9Ssnj	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
362934f90d55Smrg	[IPV6CONN=$enableval],
3630ce6676dbSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
3631ce6676dbSmrg AC_MSG_CHECKING([if IPv6 support should be built])
3632ce6676dbSmrg if test "$IPV6CONN" = "yes"; then
3633ce6676dbSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
3634ce6676dbSmrg fi
3635ce6676dbSmrg AC_MSG_RESULT($IPV6CONN)
3636ce6676dbSmrg
3637ce6676dbSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
363834f90d55Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
3639ce6676dbSmrg	AC_DEFINE([BSD44SOCKETS],1,
3640ce6676dbSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
3641ce6676dbSmrg#include <sys/types.h>
3642ce6676dbSmrg#include <sys/socket.h>
3643ce6676dbSmrg#include <netinet/in.h>
3644ce6676dbSmrg ])
3645ce6676dbSmrg
3646ce6676dbSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
3647ce6676dbSmrg AC_CHECK_TYPES([socklen_t], [], [], [
3648ce6676dbSmrgAC_INCLUDES_DEFAULT
3649ce6676dbSmrg#include <sys/socket.h>])
365034f90d55Smrg
36518f34cbf9Ssnj # XPG4v2/UNIX95 added msg_control - check to see if we need to define
36528f34cbf9Ssnj # _XOPEN_SOURCE to get it (such as on Solaris)
36538f34cbf9Ssnj AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
36548f34cbf9Ssnj                 [
36558f34cbf9SsnjAC_INCLUDES_DEFAULT
36568f34cbf9Ssnj#include <sys/socket.h>
36578f34cbf9Ssnj                 ])
36588f34cbf9Ssnj # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
36598f34cbf9Ssnj if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
36608f34cbf9Ssnj     unset ac_cv_member_struct_msghdr_msg_control
36618f34cbf9Ssnj     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
36628f34cbf9Ssnj     AC_CHECK_MEMBER([struct msghdr.msg_control],
36638f34cbf9Ssnj                     [AC_DEFINE([_XOPEN_SOURCE], [600],
36648f34cbf9Ssnj                       [Defined if needed to expose struct msghdr.msg_control])
36658f34cbf9Ssnj                     ], [], [
36668f34cbf9Ssnj#define _XOPEN_SOURCE 600
36678f34cbf9SsnjAC_INCLUDES_DEFAULT
36688f34cbf9Ssnj#include <sys/socket.h>
36698f34cbf9Ssnj                     ])
36708f34cbf9Ssnj fi
36718f34cbf9Ssnj # If that didn't work, fall back to XPG5/UNIX98 with C89
36728f34cbf9Ssnj if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
36738f34cbf9Ssnj     unset ac_cv_member_struct_msghdr_msg_control
36748f34cbf9Ssnj     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
36758f34cbf9Ssnj     AC_CHECK_MEMBER([struct msghdr.msg_control],
36768f34cbf9Ssnj                     [AC_DEFINE([_XOPEN_SOURCE], [500],
36778f34cbf9Ssnj                       [Defined if needed to expose struct msghdr.msg_control])
36788f34cbf9Ssnj                     ], [], [
36798f34cbf9Ssnj#define _XOPEN_SOURCE 500
36808f34cbf9SsnjAC_INCLUDES_DEFAULT
36818f34cbf9Ssnj#include <sys/socket.h>
36828f34cbf9Ssnj                     ])
36838f34cbf9Ssnj fi
36848f34cbf9Ssnj
36858f34cbf9Ssnj
3686ce6676dbSmrg]) # XTRANS_TCP_FLAGS
3687ce6676dbSmrg
3688ce6676dbSmrg# XTRANS_CONNECTION_FLAGS()
3689ce6676dbSmrg# -------------------------
3690ce6676dbSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
3691ce6676dbSmrg# that use Xtrans functions
3692ce6676dbSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
3693ce6676dbSmrg AC_REQUIRE([AC_CANONICAL_HOST])
3694ce6676dbSmrg [case $host_os in
3695ce6676dbSmrg	mingw*)	unixdef="no"   ;;
3696ce6676dbSmrg	*)	unixdef="yes"  ;;
3697ce6676dbSmrg esac]
3698ce6676dbSmrg AC_ARG_ENABLE(unix-transport,
36998f34cbf9Ssnj	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3700ce6676dbSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
3701ce6676dbSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
3702ce6676dbSmrg if test "$UNIXCONN" = "yes"; then
3703ce6676dbSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
3704ce6676dbSmrg fi
3705ce6676dbSmrg AC_MSG_RESULT($UNIXCONN)
370634f90d55Smrg AC_ARG_ENABLE(tcp-transport,
37078f34cbf9Ssnj	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3708ce6676dbSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
3709ce6676dbSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
3710ce6676dbSmrg AC_MSG_RESULT($TCPCONN)
3711ce6676dbSmrg if test "$TCPCONN" = "yes"; then
3712ce6676dbSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
3713ce6676dbSmrg	XTRANS_TCP_FLAGS
3714ce6676dbSmrg fi
3715ce6676dbSmrg [case $host_os in
3716ce6676dbSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
3717ce6676dbSmrg	*)			localdef="no"  ;;
3718ce6676dbSmrg esac]
3719ce6676dbSmrg AC_ARG_ENABLE(local-transport,
37208f34cbf9Ssnj	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
3721ce6676dbSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
3722ce6676dbSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
3723ce6676dbSmrg AC_MSG_RESULT($LOCALCONN)
3724ce6676dbSmrg if test "$LOCALCONN" = "yes"; then
3725ce6676dbSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
3726ce6676dbSmrg fi
372734f90d55Smrg
3728ce6676dbSmrg]) # XTRANS_CONNECTION_FLAGS
3729ce6676dbSmrg
3730ce6676dbSmrg
3731ce6676dbSmrg# XTRANS_SECURE_RPC_FLAGS()
3732ce6676dbSmrg# -------------------------
3733ce6676dbSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
3734ce6676dbSmrg# so that any necessary networking libraries are already found
3735ce6676dbSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
3736ce6676dbSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
373734f90d55Smrg AC_ARG_ENABLE(secure-rpc,
37388f34cbf9Ssnj	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
3739ce6676dbSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
3740ce6676dbSmrg
3741ce6676dbSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
3742ce6676dbSmrg	FOUND_SECURE_RPC="no"
3743ce6676dbSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
3744ce6676dbSmrg			[FOUND_SECURE_RPC="yes"])
3745ce6676dbSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
3746ce6676dbSmrg		if test "x$SECURE_RPC" = "xyes" ; then
3747ce6676dbSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
374834f90d55Smrg		fi
3749ce6676dbSmrg		SECURE_RPC="no"
3750ce6676dbSmrg	else
3751ce6676dbSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
3752ce6676dbSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
3753ce6676dbSmrg		SECURE_RPC="yes"
3754ce6676dbSmrg	fi
3755ce6676dbSmrg fi
3756ce6676dbSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
3757ce6676dbSmrg if test "x$SECURE_RPC" = "xyes" ; then
3758ce6676dbSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
3759ce6676dbSmrg fi
3760ce6676dbSmrg AC_MSG_RESULT($SECURE_RPC)
3761ce6676dbSmrg]) # XTRANS_SECURE_RPC_FLAGS
3762ce6676dbSmrg
3763ce6676dbSmrg
3764