1706f2543Smrg# generated automatically by aclocal 1.10 -*- Autoconf -*-
2706f2543Smrg
3706f2543Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4706f2543Smrg# 2005, 2006  Free Software Foundation, Inc.
5706f2543Smrg# This file is free software; the Free Software Foundation
6706f2543Smrg# gives unlimited permission to copy and/or distribute it,
7706f2543Smrg# with or without modifications, as long as this notice is preserved.
8706f2543Smrg
9706f2543Smrg# This program is distributed in the hope that it will be useful,
10706f2543Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11706f2543Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12706f2543Smrg# PARTICULAR PURPOSE.
13706f2543Smrg
14706f2543Smrgm4_if(m4_PACKAGE_VERSION, [2.61],,
15706f2543Smrg[m4_fatal([this file was generated for autoconf 2.61.
16706f2543SmrgYou have another version of autoconf.  If you want to use that,
17706f2543Smrgyou should regenerate the build system entirely.], [63])])
18706f2543Smrg
19706f2543Smrg# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
20706f2543Smrg#
21706f2543Smrg# This file is free software; the Free Software Foundation
22706f2543Smrg# gives unlimited permission to copy and/or distribute it,
23706f2543Smrg# with or without modifications, as long as this notice is preserved.
24706f2543Smrg
25706f2543Smrg# AM_AUTOMAKE_VERSION(VERSION)
26706f2543Smrg# ----------------------------
27706f2543Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
28706f2543Smrg# generated from the m4 files accompanying Automake X.Y.
29706f2543Smrg# (This private macro should not be called outside this file.)
30706f2543SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
31706f2543Smrg[am__api_version='1.10'
32706f2543Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
33706f2543Smrgdnl require some minimum version.  Point them to the right macro.
34706f2543Smrgm4_if([$1], [1.10], [],
35706f2543Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
36706f2543Smrg])
37706f2543Smrg
38706f2543Smrg# _AM_AUTOCONF_VERSION(VERSION)
39706f2543Smrg# -----------------------------
40706f2543Smrg# aclocal traces this macro to find the Autoconf version.
41706f2543Smrg# This is a private macro too.  Using m4_define simplifies
42706f2543Smrg# the logic in aclocal, which can simply ignore this definition.
43706f2543Smrgm4_define([_AM_AUTOCONF_VERSION], [])
44706f2543Smrg
45706f2543Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
46706f2543Smrg# -------------------------------
47706f2543Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
48706f2543Smrg# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
49706f2543SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
50706f2543Smrg[AM_AUTOMAKE_VERSION([1.10])dnl
51706f2543Smrg_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
52706f2543Smrg
53706f2543Smrg# Figure out how to run the assembler.                      -*- Autoconf -*-
54706f2543Smrg
55706f2543Smrg# Copyright (C) 2001, 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
56706f2543Smrg#
57706f2543Smrg# This file is free software; the Free Software Foundation
58706f2543Smrg# gives unlimited permission to copy and/or distribute it,
59706f2543Smrg# with or without modifications, as long as this notice is preserved.
60706f2543Smrg
61706f2543Smrg# serial 5
62706f2543Smrg
63706f2543Smrg# AM_PROG_AS
64706f2543Smrg# ----------
65706f2543SmrgAC_DEFUN([AM_PROG_AS],
66706f2543Smrg[# By default we simply use the C compiler to build assembly code.
67706f2543SmrgAC_REQUIRE([AC_PROG_CC])
68706f2543Smrgtest "${CCAS+set}" = set || CCAS=$CC
69706f2543Smrgtest "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
70706f2543SmrgAC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
71706f2543SmrgAC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
72706f2543Smrg_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
73706f2543Smrg])
74706f2543Smrg
75706f2543Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
76706f2543Smrg
77706f2543Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
78706f2543Smrg#
79706f2543Smrg# This file is free software; the Free Software Foundation
80706f2543Smrg# gives unlimited permission to copy and/or distribute it,
81706f2543Smrg# with or without modifications, as long as this notice is preserved.
82706f2543Smrg
83706f2543Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
84706f2543Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
85706f2543Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
86706f2543Smrg#
87706f2543Smrg# Of course, Automake must honor this variable whenever it calls a
88706f2543Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
89706f2543Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
90706f2543Smrg# depending on how configure is run.  This is pretty annoying, since
91706f2543Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
92706f2543Smrg# source directory, any form will work fine, but in subdirectories a
93706f2543Smrg# relative path needs to be adjusted first.
94706f2543Smrg#
95706f2543Smrg# $ac_aux_dir/missing
96706f2543Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
97706f2543Smrg# $top_srcdir/$ac_aux_dir/missing
98706f2543Smrg#    fails if $ac_aux_dir is absolute,
99706f2543Smrg#    fails when called from a subdirectory in a VPATH build with
100706f2543Smrg#          a relative $ac_aux_dir
101706f2543Smrg#
102706f2543Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
103706f2543Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
104706f2543Smrg# harmless because $srcdir is `.', but things will broke when you
105706f2543Smrg# start a VPATH build or use an absolute $srcdir.
106706f2543Smrg#
107706f2543Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
108706f2543Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
109706f2543Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
110706f2543Smrg# and then we would define $MISSING as
111706f2543Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
112706f2543Smrg# This will work as long as MISSING is not called from configure, because
113706f2543Smrg# unfortunately $(top_srcdir) has no meaning in configure.
114706f2543Smrg# However there are other variables, like CC, which are often used in
115706f2543Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
116706f2543Smrg#
117706f2543Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
118706f2543Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
119706f2543Smrg# configured tree to be moved without reconfiguration.
120706f2543Smrg
121706f2543SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
122706f2543Smrg[dnl Rely on autoconf to set up CDPATH properly.
123706f2543SmrgAC_PREREQ([2.50])dnl
124706f2543Smrg# expand $ac_aux_dir to an absolute path
125706f2543Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
126706f2543Smrg])
127706f2543Smrg
128706f2543Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
129706f2543Smrg
130706f2543Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
131706f2543Smrg# Free Software Foundation, Inc.
132706f2543Smrg#
133706f2543Smrg# This file is free software; the Free Software Foundation
134706f2543Smrg# gives unlimited permission to copy and/or distribute it,
135706f2543Smrg# with or without modifications, as long as this notice is preserved.
136706f2543Smrg
137706f2543Smrg# serial 8
138706f2543Smrg
139706f2543Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
140706f2543Smrg# -------------------------------------
141706f2543Smrg# Define a conditional.
142706f2543SmrgAC_DEFUN([AM_CONDITIONAL],
143706f2543Smrg[AC_PREREQ(2.52)dnl
144706f2543Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
145706f2543Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
146706f2543SmrgAC_SUBST([$1_TRUE])dnl
147706f2543SmrgAC_SUBST([$1_FALSE])dnl
148706f2543Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
149706f2543Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
150706f2543Smrgif $2; then
151706f2543Smrg  $1_TRUE=
152706f2543Smrg  $1_FALSE='#'
153706f2543Smrgelse
154706f2543Smrg  $1_TRUE='#'
155706f2543Smrg  $1_FALSE=
156706f2543Smrgfi
157706f2543SmrgAC_CONFIG_COMMANDS_PRE(
158706f2543Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
159706f2543Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
160706f2543SmrgUsually this means the macro was only invoked conditionally.]])
161706f2543Smrgfi])])
162706f2543Smrg
163706f2543Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
164706f2543Smrg# Free Software Foundation, Inc.
165706f2543Smrg#
166706f2543Smrg# This file is free software; the Free Software Foundation
167706f2543Smrg# gives unlimited permission to copy and/or distribute it,
168706f2543Smrg# with or without modifications, as long as this notice is preserved.
169706f2543Smrg
170706f2543Smrg# serial 9
171706f2543Smrg
172706f2543Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
173706f2543Smrg# written in clear, in which case automake, when reading aclocal.m4,
174706f2543Smrg# will think it sees a *use*, and therefore will trigger all it's
175706f2543Smrg# C support machinery.  Also note that it means that autoscan, seeing
176706f2543Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
177706f2543Smrg
178706f2543Smrg
179706f2543Smrg# _AM_DEPENDENCIES(NAME)
180706f2543Smrg# ----------------------
181706f2543Smrg# See how the compiler implements dependency checking.
182706f2543Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
183706f2543Smrg# We try a few techniques and use that to set a single cache variable.
184706f2543Smrg#
185706f2543Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
186706f2543Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
187706f2543Smrg# dependency, and given that the user is not expected to run this macro,
188706f2543Smrg# just rely on AC_PROG_CC.
189706f2543SmrgAC_DEFUN([_AM_DEPENDENCIES],
190706f2543Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
191706f2543SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
192706f2543SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
193706f2543SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
194706f2543Smrg
195706f2543Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
196706f2543Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
197706f2543Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
198706f2543Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
199706f2543Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
200706f2543Smrg                   [depcc="$$1"   am_compiler_list=])
201706f2543Smrg
202706f2543SmrgAC_CACHE_CHECK([dependency style of $depcc],
203706f2543Smrg               [am_cv_$1_dependencies_compiler_type],
204706f2543Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
205706f2543Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
206706f2543Smrg  # making bogus files that we don't know about and never remove.  For
207706f2543Smrg  # instance it was reported that on HP-UX the gcc test will end up
208706f2543Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
209706f2543Smrg  # in D'.
210706f2543Smrg  mkdir conftest.dir
211706f2543Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
212706f2543Smrg  # using a relative directory.
213706f2543Smrg  cp "$am_depcomp" conftest.dir
214706f2543Smrg  cd conftest.dir
215706f2543Smrg  # We will build objects and dependencies in a subdirectory because
216706f2543Smrg  # it helps to detect inapplicable dependency modes.  For instance
217706f2543Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
218706f2543Smrg  # side effect of compilation, but ICC will put the dependencies in
219706f2543Smrg  # the current directory while Tru64 will put them in the object
220706f2543Smrg  # directory.
221706f2543Smrg  mkdir sub
222706f2543Smrg
223706f2543Smrg  am_cv_$1_dependencies_compiler_type=none
224706f2543Smrg  if test "$am_compiler_list" = ""; then
225706f2543Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
226706f2543Smrg  fi
227706f2543Smrg  for depmode in $am_compiler_list; do
228706f2543Smrg    # Setup a source with many dependencies, because some compilers
229706f2543Smrg    # like to wrap large dependency lists on column 80 (with \), and
230706f2543Smrg    # we should not choose a depcomp mode which is confused by this.
231706f2543Smrg    #
232706f2543Smrg    # We need to recreate these files for each test, as the compiler may
233706f2543Smrg    # overwrite some of them when testing with obscure command lines.
234706f2543Smrg    # This happens at least with the AIX C compiler.
235706f2543Smrg    : > sub/conftest.c
236706f2543Smrg    for i in 1 2 3 4 5 6; do
237706f2543Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
238706f2543Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
239706f2543Smrg      # Solaris 8's {/usr,}/bin/sh.
240706f2543Smrg      touch sub/conftst$i.h
241706f2543Smrg    done
242706f2543Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
243706f2543Smrg
244706f2543Smrg    case $depmode in
245706f2543Smrg    nosideeffect)
246706f2543Smrg      # after this tag, mechanisms are not by side-effect, so they'll
247706f2543Smrg      # only be used when explicitly requested
248706f2543Smrg      if test "x$enable_dependency_tracking" = xyes; then
249706f2543Smrg	continue
250706f2543Smrg      else
251706f2543Smrg	break
252706f2543Smrg      fi
253706f2543Smrg      ;;
254706f2543Smrg    none) break ;;
255706f2543Smrg    esac
256706f2543Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
257706f2543Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
258706f2543Smrg    # handle `-M -o', and we need to detect this.
259706f2543Smrg    if depmode=$depmode \
260706f2543Smrg       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
261706f2543Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
262706f2543Smrg       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
263706f2543Smrg         >/dev/null 2>conftest.err &&
264706f2543Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
265706f2543Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
266706f2543Smrg       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
267706f2543Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
268706f2543Smrg      # icc doesn't choke on unknown options, it will just issue warnings
269706f2543Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
270706f2543Smrg      # that says an option was ignored or not supported.
271706f2543Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
272706f2543Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
273706f2543Smrg      # The diagnosis changed in icc 8.0:
274706f2543Smrg      #   icc: Command line remark: option '-MP' not supported
275706f2543Smrg      if (grep 'ignoring option' conftest.err ||
276706f2543Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
277706f2543Smrg        am_cv_$1_dependencies_compiler_type=$depmode
278706f2543Smrg        break
279706f2543Smrg      fi
280706f2543Smrg    fi
281706f2543Smrg  done
282706f2543Smrg
283706f2543Smrg  cd ..
284706f2543Smrg  rm -rf conftest.dir
285706f2543Smrgelse
286706f2543Smrg  am_cv_$1_dependencies_compiler_type=none
287706f2543Smrgfi
288706f2543Smrg])
289706f2543SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
290706f2543SmrgAM_CONDITIONAL([am__fastdep$1], [
291706f2543Smrg  test "x$enable_dependency_tracking" != xno \
292706f2543Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
293706f2543Smrg])
294706f2543Smrg
295706f2543Smrg
296706f2543Smrg# AM_SET_DEPDIR
297706f2543Smrg# -------------
298706f2543Smrg# Choose a directory name for dependency files.
299706f2543Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
300706f2543SmrgAC_DEFUN([AM_SET_DEPDIR],
301706f2543Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
302706f2543SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
303706f2543Smrg])
304706f2543Smrg
305706f2543Smrg
306706f2543Smrg# AM_DEP_TRACK
307706f2543Smrg# ------------
308706f2543SmrgAC_DEFUN([AM_DEP_TRACK],
309706f2543Smrg[AC_ARG_ENABLE(dependency-tracking,
310706f2543Smrg[  --disable-dependency-tracking  speeds up one-time build
311706f2543Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
312706f2543Smrgif test "x$enable_dependency_tracking" != xno; then
313706f2543Smrg  am_depcomp="$ac_aux_dir/depcomp"
314706f2543Smrg  AMDEPBACKSLASH='\'
315706f2543Smrgfi
316706f2543SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
317706f2543SmrgAC_SUBST([AMDEPBACKSLASH])dnl
318706f2543Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
319706f2543Smrg])
320706f2543Smrg
321706f2543Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
322706f2543Smrg
323706f2543Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
324706f2543Smrg# Free Software Foundation, Inc.
325706f2543Smrg#
326706f2543Smrg# This file is free software; the Free Software Foundation
327706f2543Smrg# gives unlimited permission to copy and/or distribute it,
328706f2543Smrg# with or without modifications, as long as this notice is preserved.
329706f2543Smrg
330706f2543Smrg#serial 3
331706f2543Smrg
332706f2543Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
333706f2543Smrg# ------------------------------
334706f2543SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
335706f2543Smrg[for mf in $CONFIG_FILES; do
336706f2543Smrg  # Strip MF so we end up with the name of the file.
337706f2543Smrg  mf=`echo "$mf" | sed -e 's/:.*$//'`
338706f2543Smrg  # Check whether this is an Automake generated Makefile or not.
339706f2543Smrg  # We used to match only the files named `Makefile.in', but
340706f2543Smrg  # some people rename them; so instead we look at the file content.
341706f2543Smrg  # Grep'ing the first line is not enough: some people post-process
342706f2543Smrg  # each Makefile.in and add a new line on top of each file to say so.
343706f2543Smrg  # Grep'ing the whole file is not good either: AIX grep has a line
344706f2543Smrg  # limit of 2048, but all sed's we know have understand at least 4000.
345706f2543Smrg  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
346706f2543Smrg    dirpart=`AS_DIRNAME("$mf")`
347706f2543Smrg  else
348706f2543Smrg    continue
349706f2543Smrg  fi
350706f2543Smrg  # Extract the definition of DEPDIR, am__include, and am__quote
351706f2543Smrg  # from the Makefile without running `make'.
352706f2543Smrg  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
353706f2543Smrg  test -z "$DEPDIR" && continue
354706f2543Smrg  am__include=`sed -n 's/^am__include = //p' < "$mf"`
355706f2543Smrg  test -z "am__include" && continue
356706f2543Smrg  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
357706f2543Smrg  # When using ansi2knr, U may be empty or an underscore; expand it
358706f2543Smrg  U=`sed -n 's/^U = //p' < "$mf"`
359706f2543Smrg  # Find all dependency output files, they are included files with
360706f2543Smrg  # $(DEPDIR) in their names.  We invoke sed twice because it is the
361706f2543Smrg  # simplest approach to changing $(DEPDIR) to its actual value in the
362706f2543Smrg  # expansion.
363706f2543Smrg  for file in `sed -n "
364706f2543Smrg    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
365706f2543Smrg       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
366706f2543Smrg    # Make sure the directory exists.
367706f2543Smrg    test -f "$dirpart/$file" && continue
368706f2543Smrg    fdir=`AS_DIRNAME(["$file"])`
369706f2543Smrg    AS_MKDIR_P([$dirpart/$fdir])
370706f2543Smrg    # echo "creating $dirpart/$file"
371706f2543Smrg    echo '# dummy' > "$dirpart/$file"
372706f2543Smrg  done
373706f2543Smrgdone
374706f2543Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
375706f2543Smrg
376706f2543Smrg
377706f2543Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
378706f2543Smrg# -----------------------------
379706f2543Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
380706f2543Smrg#
381706f2543Smrg# This code is only required when automatic dependency tracking
382706f2543Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
383706f2543Smrg# need in order to bootstrap the dependency handling code.
384706f2543SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
385706f2543Smrg[AC_CONFIG_COMMANDS([depfiles],
386706f2543Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
387706f2543Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
388706f2543Smrg])
389706f2543Smrg
390706f2543Smrg# Do all the work for Automake.                             -*- Autoconf -*-
391706f2543Smrg
392706f2543Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
393706f2543Smrg# 2005, 2006 Free Software Foundation, Inc.
394706f2543Smrg#
395706f2543Smrg# This file is free software; the Free Software Foundation
396706f2543Smrg# gives unlimited permission to copy and/or distribute it,
397706f2543Smrg# with or without modifications, as long as this notice is preserved.
398706f2543Smrg
399706f2543Smrg# serial 12
400706f2543Smrg
401706f2543Smrg# This macro actually does too much.  Some checks are only needed if
402706f2543Smrg# your package does certain things.  But this isn't really a big deal.
403706f2543Smrg
404706f2543Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
405706f2543Smrg# AM_INIT_AUTOMAKE([OPTIONS])
406706f2543Smrg# -----------------------------------------------
407706f2543Smrg# The call with PACKAGE and VERSION arguments is the old style
408706f2543Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
409706f2543Smrg# and VERSION should now be passed to AC_INIT and removed from
410706f2543Smrg# the call to AM_INIT_AUTOMAKE.
411706f2543Smrg# We support both call styles for the transition.  After
412706f2543Smrg# the next Automake release, Autoconf can make the AC_INIT
413706f2543Smrg# arguments mandatory, and then we can depend on a new Autoconf
414706f2543Smrg# release and drop the old call support.
415706f2543SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
416706f2543Smrg[AC_PREREQ([2.60])dnl
417706f2543Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
418706f2543Smrgdnl the ones we care about.
419706f2543Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
420706f2543SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
421706f2543SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
422706f2543Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
423706f2543Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
424706f2543Smrg  # is not polluted with repeated "-I."
425706f2543Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
426706f2543Smrg  # test to see if srcdir already configured
427706f2543Smrg  if test -f $srcdir/config.status; then
428706f2543Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
429706f2543Smrg  fi
430706f2543Smrgfi
431706f2543Smrg
432706f2543Smrg# test whether we have cygpath
433706f2543Smrgif test -z "$CYGPATH_W"; then
434706f2543Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
435706f2543Smrg    CYGPATH_W='cygpath -w'
436706f2543Smrg  else
437706f2543Smrg    CYGPATH_W=echo
438706f2543Smrg  fi
439706f2543Smrgfi
440706f2543SmrgAC_SUBST([CYGPATH_W])
441706f2543Smrg
442706f2543Smrg# Define the identity of the package.
443706f2543Smrgdnl Distinguish between old-style and new-style calls.
444706f2543Smrgm4_ifval([$2],
445706f2543Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
446706f2543Smrg AC_SUBST([PACKAGE], [$1])dnl
447706f2543Smrg AC_SUBST([VERSION], [$2])],
448706f2543Smrg[_AM_SET_OPTIONS([$1])dnl
449706f2543Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
450706f2543Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
451706f2543Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
452706f2543Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
453706f2543Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
454706f2543Smrg
455706f2543Smrg_AM_IF_OPTION([no-define],,
456706f2543Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
457706f2543Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
458706f2543Smrg
459706f2543Smrg# Some tools Automake needs.
460706f2543SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
461706f2543SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
462706f2543SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
463706f2543SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
464706f2543SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
465706f2543SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
466706f2543SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
467706f2543SmrgAM_PROG_INSTALL_SH
468706f2543SmrgAM_PROG_INSTALL_STRIP
469706f2543SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
470706f2543Smrg# We need awk for the "check" target.  The system "awk" is bad on
471706f2543Smrg# some platforms.
472706f2543SmrgAC_REQUIRE([AC_PROG_AWK])dnl
473706f2543SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
474706f2543SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
475706f2543Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
476706f2543Smrg              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
477706f2543Smrg	      		     [_AM_PROG_TAR([v7])])])
478706f2543Smrg_AM_IF_OPTION([no-dependencies],,
479706f2543Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
480706f2543Smrg                  [_AM_DEPENDENCIES(CC)],
481706f2543Smrg                  [define([AC_PROG_CC],
482706f2543Smrg                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
483706f2543SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
484706f2543Smrg                  [_AM_DEPENDENCIES(CXX)],
485706f2543Smrg                  [define([AC_PROG_CXX],
486706f2543Smrg                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
487706f2543SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
488706f2543Smrg                  [_AM_DEPENDENCIES(OBJC)],
489706f2543Smrg                  [define([AC_PROG_OBJC],
490706f2543Smrg                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
491706f2543Smrg])
492706f2543Smrg])
493706f2543Smrg
494706f2543Smrg
495706f2543Smrg# When config.status generates a header, we must update the stamp-h file.
496706f2543Smrg# This file resides in the same directory as the config header
497706f2543Smrg# that is generated.  The stamp files are numbered to have different names.
498706f2543Smrg
499706f2543Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
500706f2543Smrg# loop where config.status creates the headers, so we can generate
501706f2543Smrg# our stamp files there.
502706f2543SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
503706f2543Smrg[# Compute $1's index in $config_headers.
504706f2543Smrg_am_stamp_count=1
505706f2543Smrgfor _am_header in $config_headers :; do
506706f2543Smrg  case $_am_header in
507706f2543Smrg    $1 | $1:* )
508706f2543Smrg      break ;;
509706f2543Smrg    * )
510706f2543Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
511706f2543Smrg  esac
512706f2543Smrgdone
513706f2543Smrgecho "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
514706f2543Smrg
515706f2543Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
516706f2543Smrg#
517706f2543Smrg# This file is free software; the Free Software Foundation
518706f2543Smrg# gives unlimited permission to copy and/or distribute it,
519706f2543Smrg# with or without modifications, as long as this notice is preserved.
520706f2543Smrg
521706f2543Smrg# AM_PROG_INSTALL_SH
522706f2543Smrg# ------------------
523706f2543Smrg# Define $install_sh.
524706f2543SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
525706f2543Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
526706f2543Smrginstall_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
527706f2543SmrgAC_SUBST(install_sh)])
528706f2543Smrg
529706f2543Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
530706f2543Smrg#
531706f2543Smrg# This file is free software; the Free Software Foundation
532706f2543Smrg# gives unlimited permission to copy and/or distribute it,
533706f2543Smrg# with or without modifications, as long as this notice is preserved.
534706f2543Smrg
535706f2543Smrg# serial 2
536706f2543Smrg
537706f2543Smrg# Check whether the underlying file-system supports filenames
538706f2543Smrg# with a leading dot.  For instance MS-DOS doesn't.
539706f2543SmrgAC_DEFUN([AM_SET_LEADING_DOT],
540706f2543Smrg[rm -rf .tst 2>/dev/null
541706f2543Smrgmkdir .tst 2>/dev/null
542706f2543Smrgif test -d .tst; then
543706f2543Smrg  am__leading_dot=.
544706f2543Smrgelse
545706f2543Smrg  am__leading_dot=_
546706f2543Smrgfi
547706f2543Smrgrmdir .tst 2>/dev/null
548706f2543SmrgAC_SUBST([am__leading_dot])])
549706f2543Smrg
550706f2543Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
551706f2543Smrg# From Jim Meyering
552706f2543Smrg
553706f2543Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
554706f2543Smrg# Free Software Foundation, Inc.
555706f2543Smrg#
556706f2543Smrg# This file is free software; the Free Software Foundation
557706f2543Smrg# gives unlimited permission to copy and/or distribute it,
558706f2543Smrg# with or without modifications, as long as this notice is preserved.
559706f2543Smrg
560706f2543Smrg# serial 4
561706f2543Smrg
562706f2543SmrgAC_DEFUN([AM_MAINTAINER_MODE],
563706f2543Smrg[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
564706f2543Smrg  dnl maintainer-mode is disabled by default
565706f2543Smrg  AC_ARG_ENABLE(maintainer-mode,
566706f2543Smrg[  --enable-maintainer-mode  enable make rules and dependencies not useful
567706f2543Smrg			  (and sometimes confusing) to the casual installer],
568706f2543Smrg      USE_MAINTAINER_MODE=$enableval,
569706f2543Smrg      USE_MAINTAINER_MODE=no)
570706f2543Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
571706f2543Smrg  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
572706f2543Smrg  MAINT=$MAINTAINER_MODE_TRUE
573706f2543Smrg  AC_SUBST(MAINT)dnl
574706f2543Smrg]
575706f2543Smrg)
576706f2543Smrg
577706f2543SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
578706f2543Smrg
579706f2543Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
580706f2543Smrg
581706f2543Smrg# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
582706f2543Smrg#
583706f2543Smrg# This file is free software; the Free Software Foundation
584706f2543Smrg# gives unlimited permission to copy and/or distribute it,
585706f2543Smrg# with or without modifications, as long as this notice is preserved.
586706f2543Smrg
587706f2543Smrg# serial 3
588706f2543Smrg
589706f2543Smrg# AM_MAKE_INCLUDE()
590706f2543Smrg# -----------------
591706f2543Smrg# Check to see how make treats includes.
592706f2543SmrgAC_DEFUN([AM_MAKE_INCLUDE],
593706f2543Smrg[am_make=${MAKE-make}
594706f2543Smrgcat > confinc << 'END'
595706f2543Smrgam__doit:
596706f2543Smrg	@echo done
597706f2543Smrg.PHONY: am__doit
598706f2543SmrgEND
599706f2543Smrg# If we don't find an include directive, just comment out the code.
600706f2543SmrgAC_MSG_CHECKING([for style of include used by $am_make])
601706f2543Smrgam__include="#"
602706f2543Smrgam__quote=
603706f2543Smrg_am_result=none
604706f2543Smrg# First try GNU make style include.
605706f2543Smrgecho "include confinc" > confmf
606706f2543Smrg# We grep out `Entering directory' and `Leaving directory'
607706f2543Smrg# messages which can occur if `w' ends up in MAKEFLAGS.
608706f2543Smrg# In particular we don't look at `^make:' because GNU make might
609706f2543Smrg# be invoked under some other name (usually "gmake"), in which
610706f2543Smrg# case it prints its new name instead of `make'.
611706f2543Smrgif test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
612706f2543Smrg   am__include=include
613706f2543Smrg   am__quote=
614706f2543Smrg   _am_result=GNU
615706f2543Smrgfi
616706f2543Smrg# Now try BSD make style include.
617706f2543Smrgif test "$am__include" = "#"; then
618706f2543Smrg   echo '.include "confinc"' > confmf
619706f2543Smrg   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
620706f2543Smrg      am__include=.include
621706f2543Smrg      am__quote="\""
622706f2543Smrg      _am_result=BSD
623706f2543Smrg   fi
624706f2543Smrgfi
625706f2543SmrgAC_SUBST([am__include])
626706f2543SmrgAC_SUBST([am__quote])
627706f2543SmrgAC_MSG_RESULT([$_am_result])
628706f2543Smrgrm -f confinc confmf
629706f2543Smrg])
630706f2543Smrg
631706f2543Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
632706f2543Smrg
633706f2543Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
634706f2543Smrg# Free Software Foundation, Inc.
635706f2543Smrg#
636706f2543Smrg# This file is free software; the Free Software Foundation
637706f2543Smrg# gives unlimited permission to copy and/or distribute it,
638706f2543Smrg# with or without modifications, as long as this notice is preserved.
639706f2543Smrg
640706f2543Smrg# serial 5
641706f2543Smrg
642706f2543Smrg# AM_MISSING_PROG(NAME, PROGRAM)
643706f2543Smrg# ------------------------------
644706f2543SmrgAC_DEFUN([AM_MISSING_PROG],
645706f2543Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
646706f2543Smrg$1=${$1-"${am_missing_run}$2"}
647706f2543SmrgAC_SUBST($1)])
648706f2543Smrg
649706f2543Smrg
650706f2543Smrg# AM_MISSING_HAS_RUN
651706f2543Smrg# ------------------
652706f2543Smrg# Define MISSING if not defined so far and test if it supports --run.
653706f2543Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
654706f2543SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
655706f2543Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
656706f2543SmrgAC_REQUIRE_AUX_FILE([missing])dnl
657706f2543Smrgtest x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
658706f2543Smrg# Use eval to expand $SHELL
659706f2543Smrgif eval "$MISSING --run true"; then
660706f2543Smrg  am_missing_run="$MISSING --run "
661706f2543Smrgelse
662706f2543Smrg  am_missing_run=
663706f2543Smrg  AC_MSG_WARN([`missing' script is too old or missing])
664706f2543Smrgfi
665706f2543Smrg])
666706f2543Smrg
667706f2543Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
668706f2543Smrg#
669706f2543Smrg# This file is free software; the Free Software Foundation
670706f2543Smrg# gives unlimited permission to copy and/or distribute it,
671706f2543Smrg# with or without modifications, as long as this notice is preserved.
672706f2543Smrg
673706f2543Smrg# AM_PROG_MKDIR_P
674706f2543Smrg# ---------------
675706f2543Smrg# Check for `mkdir -p'.
676706f2543SmrgAC_DEFUN([AM_PROG_MKDIR_P],
677706f2543Smrg[AC_PREREQ([2.60])dnl
678706f2543SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
679706f2543Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
680706f2543Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
681706f2543Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
682706f2543Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
683706f2543Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
684706f2543Smrgdnl adjustment using top_builddir (which is defined more often than
685706f2543Smrgdnl MKDIR_P).
686706f2543SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
687706f2543Smrgcase $mkdir_p in
688706f2543Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
689706f2543Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
690706f2543Smrgesac
691706f2543Smrg])
692706f2543Smrg
693706f2543Smrg# Helper functions for option handling.                     -*- Autoconf -*-
694706f2543Smrg
695706f2543Smrg# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
696706f2543Smrg#
697706f2543Smrg# This file is free software; the Free Software Foundation
698706f2543Smrg# gives unlimited permission to copy and/or distribute it,
699706f2543Smrg# with or without modifications, as long as this notice is preserved.
700706f2543Smrg
701706f2543Smrg# serial 3
702706f2543Smrg
703706f2543Smrg# _AM_MANGLE_OPTION(NAME)
704706f2543Smrg# -----------------------
705706f2543SmrgAC_DEFUN([_AM_MANGLE_OPTION],
706706f2543Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
707706f2543Smrg
708706f2543Smrg# _AM_SET_OPTION(NAME)
709706f2543Smrg# ------------------------------
710706f2543Smrg# Set option NAME.  Presently that only means defining a flag for this option.
711706f2543SmrgAC_DEFUN([_AM_SET_OPTION],
712706f2543Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
713706f2543Smrg
714706f2543Smrg# _AM_SET_OPTIONS(OPTIONS)
715706f2543Smrg# ----------------------------------
716706f2543Smrg# OPTIONS is a space-separated list of Automake options.
717706f2543SmrgAC_DEFUN([_AM_SET_OPTIONS],
718706f2543Smrg[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
719706f2543Smrg
720706f2543Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
721706f2543Smrg# -------------------------------------------
722706f2543Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
723706f2543SmrgAC_DEFUN([_AM_IF_OPTION],
724706f2543Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
725706f2543Smrg
726706f2543Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
727706f2543Smrg
728706f2543Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
729706f2543Smrg# Free Software Foundation, Inc.
730706f2543Smrg#
731706f2543Smrg# This file is free software; the Free Software Foundation
732706f2543Smrg# gives unlimited permission to copy and/or distribute it,
733706f2543Smrg# with or without modifications, as long as this notice is preserved.
734706f2543Smrg
735706f2543Smrg# serial 4
736706f2543Smrg
737706f2543Smrg# AM_SANITY_CHECK
738706f2543Smrg# ---------------
739706f2543SmrgAC_DEFUN([AM_SANITY_CHECK],
740706f2543Smrg[AC_MSG_CHECKING([whether build environment is sane])
741706f2543Smrg# Just in case
742706f2543Smrgsleep 1
743706f2543Smrgecho timestamp > conftest.file
744706f2543Smrg# Do `set' in a subshell so we don't clobber the current shell's
745706f2543Smrg# arguments.  Must try -L first in case configure is actually a
746706f2543Smrg# symlink; some systems play weird games with the mod time of symlinks
747706f2543Smrg# (eg FreeBSD returns the mod time of the symlink's containing
748706f2543Smrg# directory).
749706f2543Smrgif (
750706f2543Smrg   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
751706f2543Smrg   if test "$[*]" = "X"; then
752706f2543Smrg      # -L didn't work.
753706f2543Smrg      set X `ls -t $srcdir/configure conftest.file`
754706f2543Smrg   fi
755706f2543Smrg   rm -f conftest.file
756706f2543Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
757706f2543Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
758706f2543Smrg
759706f2543Smrg      # If neither matched, then we have a broken ls.  This can happen
760706f2543Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
761706f2543Smrg      # broken ls alias from the environment.  This has actually
762706f2543Smrg      # happened.  Such a system could not be considered "sane".
763706f2543Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
764706f2543Smrgalias in your environment])
765706f2543Smrg   fi
766706f2543Smrg
767706f2543Smrg   test "$[2]" = conftest.file
768706f2543Smrg   )
769706f2543Smrgthen
770706f2543Smrg   # Ok.
771706f2543Smrg   :
772706f2543Smrgelse
773706f2543Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
774706f2543SmrgCheck your system clock])
775706f2543Smrgfi
776706f2543SmrgAC_MSG_RESULT(yes)])
777706f2543Smrg
778706f2543Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
779706f2543Smrg#
780706f2543Smrg# This file is free software; the Free Software Foundation
781706f2543Smrg# gives unlimited permission to copy and/or distribute it,
782706f2543Smrg# with or without modifications, as long as this notice is preserved.
783706f2543Smrg
784706f2543Smrg# AM_PROG_INSTALL_STRIP
785706f2543Smrg# ---------------------
786706f2543Smrg# One issue with vendor `install' (even GNU) is that you can't
787706f2543Smrg# specify the program used to strip binaries.  This is especially
788706f2543Smrg# annoying in cross-compiling environments, where the build's strip
789706f2543Smrg# is unlikely to handle the host's binaries.
790706f2543Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
791706f2543Smrg# always use install-sh in `make install-strip', and initialize
792706f2543Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
793706f2543SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
794706f2543Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
795706f2543Smrg# Installed binaries are usually stripped using `strip' when the user
796706f2543Smrg# run `make install-strip'.  However `strip' might not be the right
797706f2543Smrg# tool to use in cross-compilation environments, therefore Automake
798706f2543Smrg# will honor the `STRIP' environment variable to overrule this program.
799706f2543Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
800706f2543Smrgif test "$cross_compiling" != no; then
801706f2543Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
802706f2543Smrgfi
803706f2543SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
804706f2543SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
805706f2543Smrg
806706f2543Smrg# Copyright (C) 2006  Free Software Foundation, Inc.
807706f2543Smrg#
808706f2543Smrg# This file is free software; the Free Software Foundation
809706f2543Smrg# gives unlimited permission to copy and/or distribute it,
810706f2543Smrg# with or without modifications, as long as this notice is preserved.
811706f2543Smrg
812706f2543Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
813706f2543Smrg# ---------------------------
814706f2543Smrg# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
815706f2543Smrg# This macro is traced by Automake.
816706f2543SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
817706f2543Smrg
818706f2543Smrg# Check how to create a tarball.                            -*- Autoconf -*-
819706f2543Smrg
820706f2543Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
821706f2543Smrg#
822706f2543Smrg# This file is free software; the Free Software Foundation
823706f2543Smrg# gives unlimited permission to copy and/or distribute it,
824706f2543Smrg# with or without modifications, as long as this notice is preserved.
825706f2543Smrg
826706f2543Smrg# serial 2
827706f2543Smrg
828706f2543Smrg# _AM_PROG_TAR(FORMAT)
829706f2543Smrg# --------------------
830706f2543Smrg# Check how to create a tarball in format FORMAT.
831706f2543Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
832706f2543Smrg#
833706f2543Smrg# Substitute a variable $(am__tar) that is a command
834706f2543Smrg# writing to stdout a FORMAT-tarball containing the directory
835706f2543Smrg# $tardir.
836706f2543Smrg#     tardir=directory && $(am__tar) > result.tar
837706f2543Smrg#
838706f2543Smrg# Substitute a variable $(am__untar) that extract such
839706f2543Smrg# a tarball read from stdin.
840706f2543Smrg#     $(am__untar) < result.tar
841706f2543SmrgAC_DEFUN([_AM_PROG_TAR],
842706f2543Smrg[# Always define AMTAR for backward compatibility.
843706f2543SmrgAM_MISSING_PROG([AMTAR], [tar])
844706f2543Smrgm4_if([$1], [v7],
845706f2543Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
846706f2543Smrg     [m4_case([$1], [ustar],, [pax],,
847706f2543Smrg              [m4_fatal([Unknown tar format])])
848706f2543SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
849706f2543Smrg# Loop over all known methods to create a tar archive until one works.
850706f2543Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
851706f2543Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
852706f2543Smrg# Do not fold the above two line into one, because Tru64 sh and
853706f2543Smrg# Solaris sh will not grok spaces in the rhs of `-'.
854706f2543Smrgfor _am_tool in $_am_tools
855706f2543Smrgdo
856706f2543Smrg  case $_am_tool in
857706f2543Smrg  gnutar)
858706f2543Smrg    for _am_tar in tar gnutar gtar;
859706f2543Smrg    do
860706f2543Smrg      AM_RUN_LOG([$_am_tar --version]) && break
861706f2543Smrg    done
862706f2543Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
863706f2543Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
864706f2543Smrg    am__untar="$_am_tar -xf -"
865706f2543Smrg    ;;
866706f2543Smrg  plaintar)
867706f2543Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
868706f2543Smrg    # ustar tarball either.
869706f2543Smrg    (tar --version) >/dev/null 2>&1 && continue
870706f2543Smrg    am__tar='tar chf - "$$tardir"'
871706f2543Smrg    am__tar_='tar chf - "$tardir"'
872706f2543Smrg    am__untar='tar xf -'
873706f2543Smrg    ;;
874706f2543Smrg  pax)
875706f2543Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
876706f2543Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
877706f2543Smrg    am__untar='pax -r'
878706f2543Smrg    ;;
879706f2543Smrg  cpio)
880706f2543Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
881706f2543Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
882706f2543Smrg    am__untar='cpio -i -H $1 -d'
883706f2543Smrg    ;;
884706f2543Smrg  none)
885706f2543Smrg    am__tar=false
886706f2543Smrg    am__tar_=false
887706f2543Smrg    am__untar=false
888706f2543Smrg    ;;
889706f2543Smrg  esac
890706f2543Smrg
891706f2543Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
892706f2543Smrg  # and am__untar set.
893706f2543Smrg  test -n "${am_cv_prog_tar_$1}" && break
894706f2543Smrg
895706f2543Smrg  # tar/untar a dummy directory, and stop if the command works
896706f2543Smrg  rm -rf conftest.dir
897706f2543Smrg  mkdir conftest.dir
898706f2543Smrg  echo GrepMe > conftest.dir/file
899706f2543Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
900706f2543Smrg  rm -rf conftest.dir
901706f2543Smrg  if test -s conftest.tar; then
902706f2543Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
903706f2543Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
904706f2543Smrg  fi
905706f2543Smrgdone
906706f2543Smrgrm -rf conftest.dir
907706f2543Smrg
908706f2543SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
909706f2543SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
910706f2543SmrgAC_SUBST([am__tar])
911706f2543SmrgAC_SUBST([am__untar])
912706f2543Smrg]) # _AM_PROG_TAR
913706f2543Smrg
914706f2543Smrgm4_include([m4/ac_define_dir.m4])
915706f2543Smrgm4_include([m4/ax_tls.m4])
916706f2543Smrgm4_include([m4/libtool.m4])
917706f2543Smrgm4_include([m4/ltoptions.m4])
918706f2543Smrgm4_include([m4/ltsugar.m4])
919706f2543Smrgm4_include([m4/ltversion.m4])
920706f2543Smrgm4_include([m4/lt~obsolete.m4])
921706f2543Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
922706f2543Smrg# serial 1 (pkg-config-0.24)
923706f2543Smrg# 
924706f2543Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
925706f2543Smrg#
926706f2543Smrg# This program is free software; you can redistribute it and/or modify
927706f2543Smrg# it under the terms of the GNU General Public License as published by
928706f2543Smrg# the Free Software Foundation; either version 2 of the License, or
929706f2543Smrg# (at your option) any later version.
930706f2543Smrg#
931706f2543Smrg# This program is distributed in the hope that it will be useful, but
932706f2543Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
933706f2543Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
934706f2543Smrg# General Public License for more details.
935706f2543Smrg#
936706f2543Smrg# You should have received a copy of the GNU General Public License
937706f2543Smrg# along with this program; if not, write to the Free Software
938706f2543Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
939706f2543Smrg#
940706f2543Smrg# As a special exception to the GNU General Public License, if you
941706f2543Smrg# distribute this file as part of a program that contains a
942706f2543Smrg# configuration script generated by Autoconf, you may include it under
943706f2543Smrg# the same distribution terms that you use for the rest of that program.
944706f2543Smrg
945706f2543Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
946706f2543Smrg# ----------------------------------
947706f2543SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
948706f2543Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
949706f2543Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
950706f2543SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
951706f2543SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
952706f2543SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
953706f2543Smrg
954706f2543Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
955706f2543Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
956706f2543Smrgfi
957706f2543Smrgif test -n "$PKG_CONFIG"; then
958706f2543Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
959706f2543Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
960706f2543Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
961706f2543Smrg		AC_MSG_RESULT([yes])
962706f2543Smrg	else
963706f2543Smrg		AC_MSG_RESULT([no])
964706f2543Smrg		PKG_CONFIG=""
965706f2543Smrg	fi
966706f2543Smrgfi[]dnl
967706f2543Smrg])# PKG_PROG_PKG_CONFIG
968706f2543Smrg
969706f2543Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
970706f2543Smrg#
971706f2543Smrg# Check to see whether a particular set of modules exists.  Similar
972706f2543Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
973706f2543Smrg#
974706f2543Smrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
975706f2543Smrg# only at the first occurence in configure.ac, so if the first place
976706f2543Smrg# it's called might be skipped (such as if it is within an "if", you
977706f2543Smrg# have to call PKG_CHECK_EXISTS manually
978706f2543Smrg# --------------------------------------------------------------
979706f2543SmrgAC_DEFUN([PKG_CHECK_EXISTS],
980706f2543Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
981706f2543Smrgif test -n "$PKG_CONFIG" && \
982706f2543Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
983706f2543Smrg  m4_default([$2], [:])
984706f2543Smrgm4_ifvaln([$3], [else
985706f2543Smrg  $3])dnl
986706f2543Smrgfi])
987706f2543Smrg
988706f2543Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
989706f2543Smrg# ---------------------------------------------
990706f2543Smrgm4_define([_PKG_CONFIG],
991706f2543Smrg[if test -n "$$1"; then
992706f2543Smrg    pkg_cv_[]$1="$$1"
993706f2543Smrg elif test -n "$PKG_CONFIG"; then
994706f2543Smrg    PKG_CHECK_EXISTS([$3],
995706f2543Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
996706f2543Smrg		     [pkg_failed=yes])
997706f2543Smrg else
998706f2543Smrg    pkg_failed=untried
999706f2543Smrgfi[]dnl
1000706f2543Smrg])# _PKG_CONFIG
1001706f2543Smrg
1002706f2543Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1003706f2543Smrg# -----------------------------
1004706f2543SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1005706f2543Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1006706f2543Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1007706f2543Smrg        _pkg_short_errors_supported=yes
1008706f2543Smrgelse
1009706f2543Smrg        _pkg_short_errors_supported=no
1010706f2543Smrgfi[]dnl
1011706f2543Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1012706f2543Smrg
1013706f2543Smrg
1014706f2543Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1015706f2543Smrg# [ACTION-IF-NOT-FOUND])
1016706f2543Smrg#
1017706f2543Smrg#
1018706f2543Smrg# Note that if there is a possibility the first call to
1019706f2543Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1020706f2543Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1021706f2543Smrg#
1022706f2543Smrg#
1023706f2543Smrg# --------------------------------------------------------------
1024706f2543SmrgAC_DEFUN([PKG_CHECK_MODULES],
1025706f2543Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1026706f2543SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1027706f2543SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1028706f2543Smrg
1029706f2543Smrgpkg_failed=no
1030706f2543SmrgAC_MSG_CHECKING([for $1])
1031706f2543Smrg
1032706f2543Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1033706f2543Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1034706f2543Smrg
1035706f2543Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1036706f2543Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1037706f2543SmrgSee the pkg-config man page for more details.])
1038706f2543Smrg
1039706f2543Smrgif test $pkg_failed = yes; then
1040706f2543Smrg   	AC_MSG_RESULT([no])
1041706f2543Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1042706f2543Smrg        if test $_pkg_short_errors_supported = yes; then
1043706f2543Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1044706f2543Smrg        else 
1045706f2543Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1046706f2543Smrg        fi
1047706f2543Smrg	# Put the nasty error message in config.log where it belongs
1048706f2543Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1049706f2543Smrg
1050706f2543Smrg	m4_default([$4], [AC_MSG_ERROR(
1051706f2543Smrg[Package requirements ($2) were not met:
1052706f2543Smrg
1053706f2543Smrg$$1_PKG_ERRORS
1054706f2543Smrg
1055706f2543SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1056706f2543Smrginstalled software in a non-standard prefix.
1057706f2543Smrg
1058706f2543Smrg_PKG_TEXT])[]dnl
1059706f2543Smrg        ])
1060706f2543Smrgelif test $pkg_failed = untried; then
1061706f2543Smrg     	AC_MSG_RESULT([no])
1062706f2543Smrg	m4_default([$4], [AC_MSG_FAILURE(
1063706f2543Smrg[The pkg-config script could not be found or is too old.  Make sure it
1064706f2543Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1065706f2543Smrgpath to pkg-config.
1066706f2543Smrg
1067706f2543Smrg_PKG_TEXT
1068706f2543Smrg
1069706f2543SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
1070706f2543Smrg        ])
1071706f2543Smrgelse
1072706f2543Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1073706f2543Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1074706f2543Smrg        AC_MSG_RESULT([yes])
1075706f2543Smrg	$3
1076706f2543Smrgfi[]dnl
1077706f2543Smrg])# PKG_CHECK_MODULES
1078706f2543Smrg
1079706f2543Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
1080706f2543Smrgdnl
1081706f2543Smrgdnl This file comes from X.Org's font-util 1.2.0
1082706f2543Smrgdnl
1083706f2543Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1084706f2543Smrgdnl
1085706f2543Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1086706f2543Smrgdnl copy of this software and associated documentation files (the "Software"),
1087706f2543Smrgdnl to deal in the Software without restriction, including without limitation
1088706f2543Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1089706f2543Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1090706f2543Smrgdnl Software is furnished to do so, subject to the following conditions:
1091706f2543Smrgdnl
1092706f2543Smrgdnl The above copyright notice and this permission notice (including the next
1093706f2543Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1094706f2543Smrgdnl Software.
1095706f2543Smrgdnl
1096706f2543Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1097706f2543Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1098706f2543Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1099706f2543Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1100706f2543Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1101706f2543Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1102706f2543Smrgdnl DEALINGS IN THE SOFTWARE.
1103706f2543Smrgdnl
1104706f2543Smrgdnl --------------------------------------------------------------------
1105706f2543Smrgdnl
1106706f2543Smrgdnl Copyright 2005 Red Hat, Inc
1107706f2543Smrgdnl
1108706f2543Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1109706f2543Smrgdnl documentation for any purpose is hereby granted without fee, provided that
1110706f2543Smrgdnl the above copyright notice appear in all copies and that both that
1111706f2543Smrgdnl copyright notice and this permission notice appear in supporting
1112706f2543Smrgdnl documentation.
1113706f2543Smrgdnl
1114706f2543Smrgdnl The above copyright notice and this permission notice shall be included
1115706f2543Smrgdnl in all copies or substantial portions of the Software.
1116706f2543Smrgdnl
1117706f2543Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1118706f2543Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1119706f2543Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1120706f2543Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1121706f2543Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1122706f2543Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1123706f2543Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
1124706f2543Smrgdnl
1125706f2543Smrgdnl Except as contained in this notice, the name of the copyright holders shall
1126706f2543Smrgdnl not be used in advertising or otherwise to promote the sale, use or
1127706f2543Smrgdnl other dealings in this Software without prior written authorization
1128706f2543Smrgdnl from the copyright holders.
1129706f2543Smrg
1130706f2543Smrg# XORG_FONT_MACROS_VERSION(required-version)
1131706f2543Smrg# ------------------------------------------
1132706f2543Smrg# Minimum version: 1.1.0
1133706f2543Smrg#
1134706f2543Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1135706f2543Smrg# your configure.ac with the minimum required version, such as:
1136706f2543Smrg# XORG_FONT_MACROS_VERSION(1.1)
1137706f2543Smrg#
1138706f2543Smrg# To ensure that this macro is defined, also add:
1139706f2543Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
1140706f2543Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
1141706f2543Smrg#
1142706f2543Smrg#
1143706f2543Smrg# See the "minimum version" comment for each macro you use to see what
1144706f2543Smrg# version you require.
1145706f2543Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
1146706f2543Smrgm4_define([vers_have], [1.2.0])
1147706f2543Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1148706f2543Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1149706f2543Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1150706f2543Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
1151706f2543Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1152706f2543Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
1153706f2543Smrgm4_undefine([vers_have])
1154706f2543Smrgm4_undefine([maj_have])
1155706f2543Smrgm4_undefine([maj_needed])
1156706f2543Smrg]) # XORG_FONT_MACROS_VERSION
1157706f2543Smrg
1158706f2543Smrg# XORG_FONT_CHECK_{maps}()
1159706f2543Smrg# ------------------------
1160706f2543Smrg# Minimum version: 1.0.0
1161706f2543Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
1162706f2543Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
1163706f2543Smrg
1164706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
1165706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
1166706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
1167706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
1168706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
1169706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
1170706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
1171706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
1172706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
1173706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
1174706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
1175706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
1176706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
1177706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
1178706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
1179706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
1180706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
1181706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1182706f2543Smrg
1183706f2543Smrg# XORG_FONT_CHECK_ENCODING(encoding)
1184706f2543Smrg# ----------------------------------
1185706f2543Smrg# Minimum version: 1.1.0
1186706f2543Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
1187706f2543Smrg# It replaced individual copies of this code in the above macros in 1.1.
1188706f2543Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
1189706f2543Smrg# calls if this is not true in the future.
1190706f2543Smrg
1191706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
1192706f2543Smrg	AC_ARG_ENABLE(m4_tolower($1),
1193706f2543Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
1194706f2543Smrg				[Build $1 fonts (default: yes)]),
1195706f2543Smrg		[AS_TR_SH($1)=$enableval])
1196706f2543Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
1197706f2543Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
1198706f2543Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
1199706f2543Smrg]) # XORG_FONT_CHECK_ENCODING
1200706f2543Smrg
1201706f2543Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
1202706f2543Smrg# -----------------------------------------------------
1203706f2543Smrg# Minimum version: 1.1.0
1204706f2543Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1205706f2543Smrg# Add a shorthand --enable/disable-all-encodings option.
1206706f2543Smrg
1207706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1208706f2543Smrg	AC_ARG_ENABLE([all-encodings],
1209706f2543Smrg		AS_HELP_STRING([--disable-all-encodings],
1210706f2543Smrg				[Disable building of all font encodings]),
1211706f2543Smrg		[m4_foreach_w([enc], [$1], [
1212706f2543Smrg			AS_TR_SH(enc)=$enableval
1213706f2543Smrg		])],
1214706f2543Smrg		[m4_foreach_w([enc], [$1], [
1215706f2543Smrg			AS_TR_SH(enc)=yes
1216706f2543Smrg		])])
1217706f2543Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1218706f2543Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
1219706f2543Smrg
1220706f2543Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1221706f2543Smrg# ------------------------------------------
1222706f2543Smrg# Minimum version: 1.1.0
1223706f2543Smrg#
1224706f2543Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
1225706f2543Smrg#
1226706f2543Smrg
1227706f2543SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1228706f2543Smrg	AC_PATH_PROG($1, $2)
1229706f2543Smrg	if test x"$$1" = x; then
1230706f2543Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1231706f2543Smrg	fi
1232706f2543Smrg])
1233706f2543Smrg
1234706f2543Smrg
1235706f2543Smrg# XORG_FONT_FCCACHE()
1236706f2543Smrg# -------------------
1237706f2543Smrg# Minimum version: 1.1.0
1238706f2543Smrg#
1239706f2543Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1240706f2543Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
1241706f2543Smrg# to run fc-cache if found and not installing to $DESTDIR
1242706f2543Smrg#
1243706f2543Smrg# fc-cache is optional, not required, and should be skipped when making
1244706f2543Smrg# packages (installing to $DESTDIR).
1245706f2543Smrg#
1246706f2543SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1247706f2543Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
1248706f2543Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
1249706f2543Smrg	if test x"$FCCACHE" = x ; then
1250706f2543Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
1251706f2543Smrg	else
1252706f2543Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1253706f2543Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1254706f2543Smrg	fi
1255706f2543Smrg	AC_SUBST([RUN_FCCACHE])
1256706f2543Smrg])
1257706f2543Smrg
1258706f2543Smrg
1259706f2543Smrg# XORG_FONT_COMMON_UTILS()
1260706f2543Smrg# ------------------------
1261706f2543Smrg# Minimum version: 1.1.0
1262706f2543Smrg#
1263706f2543Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1264706f2543Smrg
1265706f2543SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1266706f2543Smrg	XORG_FONT_FCCACHE
1267706f2543Smrg	XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
1268706f2543Smrg])
1269706f2543Smrg
1270706f2543Smrg# XORG_FONT_SCALED_UTILS()
1271706f2543Smrg# ------------------------
1272706f2543Smrg# Minimum version: 1.1.0
1273706f2543Smrg#
1274706f2543Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1275706f2543Smrg# (TrueType, OpenType, Type1)
1276706f2543Smrg
1277706f2543SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1278706f2543Smrg	XORG_FONT_COMMON_UTILS
1279706f2543Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1280706f2543Smrg])
1281706f2543Smrg
1282706f2543Smrg# XORG_FONT_BDF_UTILS()
1283706f2543Smrg# ---------------------
1284706f2543Smrg# Minimum version: 1.1.0
1285706f2543Smrg#
1286706f2543Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1287706f2543Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1288706f2543Smrg# PCF output files created by bdftopcf
1289706f2543Smrg
1290706f2543SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1291706f2543Smrg	XORG_FONT_COMMON_UTILS
1292706f2543Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1293706f2543Smrg	XORG_FONT_CHECK_COMPRESSION
1294706f2543Smrg])
1295706f2543Smrg
1296706f2543Smrg# XORG_FONT_CHECK_COMPRESSION()
1297706f2543Smrg# -----------------------------
1298706f2543Smrg# Minimum version: 1.1.0
1299706f2543Smrg#
1300706f2543Smrg# Offer a --with-compression flag to control what compression method is
1301706f2543Smrg# used for pcf font files.   Offers all the methods currently supported
1302706f2543Smrg# by libXfont, including no compression.
1303706f2543Smrg
1304706f2543SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1305706f2543Smrg	AC_MSG_CHECKING([font compression method])
1306706f2543Smrg	AC_ARG_WITH(compression,
1307706f2543Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1308706f2543Smrg			 [compression method to use on pcf fonts])],
1309706f2543Smrg         [compression="$withval"], [compression="yes"])
1310706f2543Smrg	if test x"$compression" = "xyes" ; then
1311706f2543Smrg		compression="gzip"
1312706f2543Smrg	fi
1313706f2543Smrg	AC_MSG_RESULT([${compression}])
1314706f2543Smrg	case ${compression} in
1315706f2543Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1316706f2543Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
1317706f2543Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1318706f2543Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1319706f2543Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1320706f2543Smrg	esac
1321706f2543Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1322706f2543Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1323706f2543Smrg	fi
1324706f2543Smrg	AC_SUBST([COMPRESS_SUFFIX])
1325706f2543Smrg])
1326706f2543Smrg
1327706f2543Smrg# XORG_FONT_UCS2ANY()
1328706f2543Smrg# -------------------
1329706f2543Smrg# Minimum version: 1.1.0
1330706f2543Smrg#
1331706f2543Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1332706f2543Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1333706f2543Smrg# Also call pkg-config to find the directory with the encoding files needed
1334706f2543Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1335706f2543Smrg
1336706f2543SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
1337706f2543Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1338706f2543Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1339706f2543Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
1340706f2543Smrg	MAPFILES_PATH=`pkg-config --variable=mapdir fontutil`
1341706f2543Smrg	AC_SUBST(MAPFILES_PATH)
1342706f2543Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1343706f2543Smrg])
1344706f2543Smrg
1345706f2543Smrg
1346706f2543Smrg
1347706f2543Smrg# XORG_FONT_FC_CONFDIR()
1348706f2543Smrg# --------------------
1349706f2543Smrg# Minimum version: 1.2.0
1350706f2543Smrg#
1351706f2543Smrg# Sets FC_CONFDIR to the fontconfig config directory
1352706f2543Smrg# (which should be --with-confdir=... when building fontconfig)
1353706f2543Smrg# found from:
1354706f2543Smrg#	--with-fc-confdir=...
1355706f2543Smrg#	pkg-config --variable=confdir fontconfig
1356706f2543Smrg#	${sysconfdir}/fonts
1357706f2543Smrg
1358706f2543SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1359706f2543Smrg	dnl Ensure $PKG_CONFIG is set first
1360706f2543Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1361706f2543Smrg
1362706f2543Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1363706f2543Smrg	AC_ARG_WITH(fc-confdir,
1364706f2543Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1365706f2543Smrg			   [Path to fontconfig's configuration directory]),
1366706f2543Smrg		    [FC_CONFDIR="$withval"])
1367706f2543Smrg	# if --with-fc-confdir was not specified
1368706f2543Smrg	if test "x${FC_CONFDIR}" = "x"; then
1369706f2543Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1370706f2543Smrg	fi
1371706f2543Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1372706f2543Smrg	if test "x${FC_CONFDIR}" = "x"; then
1373706f2543Smrg		FC_CONFDIR="${sysconfdir}/fonts"
1374706f2543Smrg	fi
1375706f2543Smrg	AC_SUBST(FC_CONFDIR)
1376706f2543Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
1377706f2543Smrg])
1378706f2543Smrg
1379706f2543Smrg
1380706f2543Smrg
1381706f2543Smrg# XORG_FONTROOTDIR()
1382706f2543Smrg# --------------------
1383706f2543Smrg# Minimum version: 1.1.0
1384706f2543Smrg#
1385706f2543Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1386706f2543Smrg# found from:
1387706f2543Smrg#	--with-fontrootdir
1388706f2543Smrg#	pkg-config --variable=fontrootdir fontutil
1389706f2543Smrg#	${datadir}/fonts/X11
1390706f2543Smrg
1391706f2543SmrgAC_DEFUN([XORG_FONTROOTDIR],[
1392706f2543Smrg	dnl Ensure $PKG_CONFIG is set first
1393706f2543Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1394706f2543Smrg
1395706f2543Smrg	AC_MSG_CHECKING([for root directory for font files])
1396706f2543Smrg	AC_ARG_WITH(fontrootdir,
1397706f2543Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1398706f2543Smrg			   [Path to root directory for font files]),
1399706f2543Smrg		    [FONTROOTDIR="$withval"])
1400706f2543Smrg	# if --with-fontrootdir not specified...
1401706f2543Smrg	if test "x${FONTROOTDIR}" = "x"; then
1402706f2543Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1403706f2543Smrg	fi
1404706f2543Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1405706f2543Smrg	if test "x${FONTROOTDIR}" = "x"; then
1406706f2543Smrg		FONTROOTDIR="${datadir}/fonts/X11"
1407706f2543Smrg	fi
1408706f2543Smrg	AC_SUBST(FONTROOTDIR)
1409706f2543Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
1410706f2543Smrg])
1411706f2543Smrg
1412706f2543Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
1413706f2543Smrg# ---------------------------------------
1414706f2543Smrg# Minimum version: 1.1.0
1415706f2543Smrg#
1416706f2543Smrg# Offer a --with-<flag> flag to control directory for font installation
1417706f2543Smrg# Default is the specified <subdir> of the font root directory.
1418706f2543Smrg# Sets <variable> to the selected directory
1419706f2543Smrg
1420706f2543SmrgAC_DEFUN([XORG_FONTSUBDIR],[
1421706f2543Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
1422706f2543Smrg
1423706f2543Smrg	AC_MSG_CHECKING([for directory for $3 files])
1424706f2543Smrg	AC_ARG_WITH($2,
1425706f2543Smrg		    [AS_HELP_STRING([--with-$2=DIR],
1426706f2543Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1427706f2543Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1428706f2543Smrg	AC_SUBST($1)
1429706f2543Smrg	AC_MSG_RESULT([${$1}])
1430706f2543Smrg]) # XORG_FONTSUBDIR
1431706f2543Smrg
1432706f2543Smrg# XORG_FONTDIR(subdir)
1433706f2543Smrg# --------------------
1434706f2543Smrg# Minimum version: 1.1.0
1435706f2543Smrg#
1436706f2543Smrg# Offer a --with-fontdir flag to control directory for font installation
1437706f2543Smrg# Default is the specified subdir of the font root directory.
1438706f2543Smrg# Sets FONTDIR to the selected directory
1439706f2543Smrg
1440706f2543SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1441706f2543Smrg
1442706f2543Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1443706f2543Smrgdnl
1444706f2543Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1445706f2543Smrgdnl 
1446706f2543Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1447706f2543Smrgdnl copy of this software and associated documentation files (the "Software"),
1448706f2543Smrgdnl to deal in the Software without restriction, including without limitation
1449706f2543Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1450706f2543Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1451706f2543Smrgdnl Software is furnished to do so, subject to the following conditions:
1452706f2543Smrgdnl
1453706f2543Smrgdnl The above copyright notice and this permission notice (including the next
1454706f2543Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1455706f2543Smrgdnl Software.
1456706f2543Smrgdnl
1457706f2543Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1458706f2543Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1459706f2543Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1460706f2543Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1461706f2543Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1462706f2543Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1463706f2543Smrgdnl DEALINGS IN THE SOFTWARE.
1464706f2543Smrg
1465706f2543Smrg# XORG_MACROS_VERSION(required-version)
1466706f2543Smrg# -------------------------------------
1467706f2543Smrg# Minimum version: 1.1.0
1468706f2543Smrg#
1469706f2543Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1470706f2543Smrg# your configure.ac with the minimum required version, such as:
1471706f2543Smrg# XORG_MACROS_VERSION(1.1)
1472706f2543Smrg#
1473706f2543Smrg# To ensure that this macro is defined, also add:
1474706f2543Smrg# m4_ifndef([XORG_MACROS_VERSION],
1475706f2543Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1476706f2543Smrg#
1477706f2543Smrg#
1478706f2543Smrg# See the "minimum version" comment for each macro you use to see what 
1479706f2543Smrg# version you require.
1480706f2543Smrgm4_defun([XORG_MACROS_VERSION],[
1481706f2543Smrgm4_define([vers_have], [1.16.0])
1482706f2543Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1483706f2543Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1484706f2543Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1485706f2543Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1486706f2543Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1487706f2543Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1488706f2543Smrgm4_undefine([vers_have])
1489706f2543Smrgm4_undefine([maj_have])
1490706f2543Smrgm4_undefine([maj_needed])
1491706f2543Smrg]) # XORG_MACROS_VERSION
1492706f2543Smrg
1493706f2543Smrg# XORG_PROG_RAWCPP()
1494706f2543Smrg# ------------------
1495706f2543Smrg# Minimum version: 1.0.0
1496706f2543Smrg#
1497706f2543Smrg# Find cpp program and necessary flags for use in pre-processing text files
1498706f2543Smrg# such as man pages and config files
1499706f2543SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1500706f2543SmrgAC_REQUIRE([AC_PROG_CPP])
1501706f2543SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1502706f2543Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1503706f2543Smrg
1504706f2543Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1505706f2543Smrg# which is not the best choice for supporting other OS'es, but covers most
1506706f2543Smrg# of the ones we need for now.
1507706f2543SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1508706f2543SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1509706f2543Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1510706f2543Smrg	AC_MSG_RESULT([no])
1511706f2543Smrgelse
1512706f2543Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1513706f2543Smrg		RAWCPPFLAGS=-undef
1514706f2543Smrg		AC_MSG_RESULT([yes])
1515706f2543Smrg	# under Cygwin unix is still defined even with -undef
1516706f2543Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1517706f2543Smrg		RAWCPPFLAGS="-undef -ansi"
1518706f2543Smrg		AC_MSG_RESULT([yes, with -ansi])
1519706f2543Smrg	else
1520706f2543Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1521706f2543Smrg	fi
1522706f2543Smrgfi
1523706f2543Smrgrm -f conftest.$ac_ext
1524706f2543Smrg
1525706f2543SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1526706f2543SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1527706f2543Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1528706f2543Smrg	AC_MSG_RESULT([no])
1529706f2543Smrgelse
1530706f2543Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1531706f2543Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1532706f2543Smrg		AC_MSG_RESULT([yes])
1533706f2543Smrg	else
1534706f2543Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1535706f2543Smrg	fi
1536706f2543Smrgfi
1537706f2543Smrgrm -f conftest.$ac_ext
1538706f2543SmrgAC_SUBST(RAWCPPFLAGS)
1539706f2543Smrg]) # XORG_PROG_RAWCPP
1540706f2543Smrg
1541706f2543Smrg# XORG_MANPAGE_SECTIONS()
1542706f2543Smrg# -----------------------
1543706f2543Smrg# Minimum version: 1.0.0
1544706f2543Smrg#
1545706f2543Smrg# Determine which sections man pages go in for the different man page types
1546706f2543Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1547706f2543Smrg# Not sure if there's any better way than just hardcoding by OS name.
1548706f2543Smrg# Override default settings by setting environment variables
1549706f2543Smrg# Added MAN_SUBSTS in version 1.8
1550706f2543Smrg# Added AC_PROG_SED in version 1.8
1551706f2543Smrg
1552706f2543SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1553706f2543SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1554706f2543SmrgAC_REQUIRE([AC_PROG_SED])
1555706f2543Smrg
1556706f2543Smrgif test x$APP_MAN_SUFFIX = x    ; then
1557706f2543Smrg    APP_MAN_SUFFIX=1
1558706f2543Smrgfi
1559706f2543Smrgif test x$APP_MAN_DIR = x    ; then
1560706f2543Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1561706f2543Smrgfi
1562706f2543Smrg
1563706f2543Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1564706f2543Smrg    LIB_MAN_SUFFIX=3
1565706f2543Smrgfi
1566706f2543Smrgif test x$LIB_MAN_DIR = x    ; then
1567706f2543Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1568706f2543Smrgfi
1569706f2543Smrg
1570706f2543Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1571706f2543Smrg    case $host_os in
1572706f2543Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1573706f2543Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1574706f2543Smrg    esac
1575706f2543Smrgfi
1576706f2543Smrgif test x$FILE_MAN_DIR = x    ; then
1577706f2543Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1578706f2543Smrgfi
1579706f2543Smrg
1580706f2543Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1581706f2543Smrg    case $host_os in
1582706f2543Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1583706f2543Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1584706f2543Smrg    esac
1585706f2543Smrgfi
1586706f2543Smrgif test x$MISC_MAN_DIR = x    ; then
1587706f2543Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1588706f2543Smrgfi
1589706f2543Smrg
1590706f2543Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1591706f2543Smrg    case $host_os in
1592706f2543Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1593706f2543Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1594706f2543Smrg    esac
1595706f2543Smrgfi
1596706f2543Smrgif test x$DRIVER_MAN_DIR = x    ; then
1597706f2543Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1598706f2543Smrgfi
1599706f2543Smrg
1600706f2543Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1601706f2543Smrg    case $host_os in
1602706f2543Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1603706f2543Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1604706f2543Smrg    esac
1605706f2543Smrgfi
1606706f2543Smrgif test x$ADMIN_MAN_DIR = x    ; then
1607706f2543Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1608706f2543Smrgfi
1609706f2543Smrg
1610706f2543Smrg
1611706f2543SmrgAC_SUBST([APP_MAN_SUFFIX])
1612706f2543SmrgAC_SUBST([LIB_MAN_SUFFIX])
1613706f2543SmrgAC_SUBST([FILE_MAN_SUFFIX])
1614706f2543SmrgAC_SUBST([MISC_MAN_SUFFIX])
1615706f2543SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1616706f2543SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1617706f2543SmrgAC_SUBST([APP_MAN_DIR])
1618706f2543SmrgAC_SUBST([LIB_MAN_DIR])
1619706f2543SmrgAC_SUBST([FILE_MAN_DIR])
1620706f2543SmrgAC_SUBST([MISC_MAN_DIR])
1621706f2543SmrgAC_SUBST([DRIVER_MAN_DIR])
1622706f2543SmrgAC_SUBST([ADMIN_MAN_DIR])
1623706f2543Smrg
1624706f2543SmrgXORG_MAN_PAGE="X Version 11"
1625706f2543SmrgAC_SUBST([XORG_MAN_PAGE])
1626706f2543SmrgMAN_SUBSTS="\
1627706f2543Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1628706f2543Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1629706f2543Smrg	-e 's|__xservername__|Xorg|g' \
1630706f2543Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1631706f2543Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1632706f2543Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1633706f2543Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1634706f2543Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1635706f2543Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1636706f2543Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1637706f2543Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1638706f2543Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1639706f2543SmrgAC_SUBST([MAN_SUBSTS])
1640706f2543Smrg
1641706f2543Smrg]) # XORG_MANPAGE_SECTIONS
1642706f2543Smrg
1643706f2543Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1644706f2543Smrg# ------------------------
1645706f2543Smrg# Minimum version: 1.7.0
1646706f2543Smrg#
1647706f2543Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1648706f2543Smrg# provided by xorg-sgml-doctools, if installed.
1649706f2543SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1650706f2543SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1651706f2543SmrgXORG_SGML_PATH=
1652706f2543SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1653706f2543Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1654706f2543Smrg    [m4_ifval([$1],[:],
1655706f2543Smrg        [if test x"$cross_compiling" != x"yes" ; then
1656706f2543Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1657706f2543Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1658706f2543Smrg         fi])
1659706f2543Smrg    ])
1660706f2543Smrg
1661706f2543Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1662706f2543Smrg# the path and the name of the doc stylesheet
1663706f2543Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1664706f2543Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1665706f2543Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1666706f2543Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1667706f2543Smrgelse
1668706f2543Smrg   AC_MSG_RESULT([no])
1669706f2543Smrgfi
1670706f2543Smrg
1671706f2543SmrgAC_SUBST(XORG_SGML_PATH)
1672706f2543SmrgAC_SUBST(STYLESHEET_SRCDIR)
1673706f2543SmrgAC_SUBST(XSL_STYLESHEET)
1674706f2543SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1675706f2543Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1676706f2543Smrg
1677706f2543Smrg# XORG_CHECK_LINUXDOC
1678706f2543Smrg# -------------------
1679706f2543Smrg# Minimum version: 1.0.0
1680706f2543Smrg#
1681706f2543Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1682706f2543Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1683706f2543Smrg# Whether or not the necessary tools and files are found can be checked
1684706f2543Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1685706f2543SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1686706f2543SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1687706f2543SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1688706f2543Smrg
1689706f2543SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1690706f2543Smrg
1691706f2543SmrgAC_MSG_CHECKING([whether to build documentation])
1692706f2543Smrg
1693706f2543Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1694706f2543Smrg   BUILDDOC=yes
1695706f2543Smrgelse
1696706f2543Smrg   BUILDDOC=no
1697706f2543Smrgfi
1698706f2543Smrg
1699706f2543SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1700706f2543Smrg
1701706f2543SmrgAC_MSG_RESULT([$BUILDDOC])
1702706f2543Smrg
1703706f2543SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1704706f2543Smrg
1705706f2543Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1706706f2543Smrg   BUILDPDFDOC=yes
1707706f2543Smrgelse
1708706f2543Smrg   BUILDPDFDOC=no
1709706f2543Smrgfi
1710706f2543Smrg
1711706f2543SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1712706f2543Smrg
1713706f2543SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1714706f2543Smrg
1715706f2543SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1716706f2543SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1717706f2543SmrgMAKE_PDF="$PS2PDF"
1718706f2543SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1719706f2543Smrg
1720706f2543SmrgAC_SUBST(MAKE_TEXT)
1721706f2543SmrgAC_SUBST(MAKE_PS)
1722706f2543SmrgAC_SUBST(MAKE_PDF)
1723706f2543SmrgAC_SUBST(MAKE_HTML)
1724706f2543Smrg]) # XORG_CHECK_LINUXDOC
1725706f2543Smrg
1726706f2543Smrg# XORG_CHECK_DOCBOOK
1727706f2543Smrg# -------------------
1728706f2543Smrg# Minimum version: 1.0.0
1729706f2543Smrg#
1730706f2543Smrg# Checks for the ability to build output formats from SGML DocBook source.
1731706f2543Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1732706f2543Smrg# indicates whether the necessary tools and files are found and, if set,
1733706f2543Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1734706f2543SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1735706f2543SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1736706f2543Smrg
1737706f2543SmrgBUILDTXTDOC=no
1738706f2543SmrgBUILDPDFDOC=no
1739706f2543SmrgBUILDPSDOC=no
1740706f2543SmrgBUILDHTMLDOC=no
1741706f2543Smrg
1742706f2543SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1743706f2543SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1744706f2543SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1745706f2543SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1746706f2543Smrg
1747706f2543SmrgAC_MSG_CHECKING([whether to build text documentation])
1748706f2543Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1749706f2543Smrg   test x$BUILD_TXTDOC != xno; then
1750706f2543Smrg	BUILDTXTDOC=yes
1751706f2543Smrgfi
1752706f2543SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1753706f2543SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1754706f2543Smrg
1755706f2543SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1756706f2543Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1757706f2543Smrg   test x$BUILD_PDFDOC != xno; then
1758706f2543Smrg	BUILDPDFDOC=yes
1759706f2543Smrgfi
1760706f2543SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1761706f2543SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1762706f2543Smrg
1763706f2543SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1764706f2543Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1765706f2543Smrg   test x$BUILD_PSDOC != xno; then
1766706f2543Smrg	BUILDPSDOC=yes
1767706f2543Smrgfi
1768706f2543SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1769706f2543SmrgAC_MSG_RESULT([$BUILDPSDOC])
1770706f2543Smrg
1771706f2543SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1772706f2543Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1773706f2543Smrg   test x$BUILD_HTMLDOC != xno; then
1774706f2543Smrg	BUILDHTMLDOC=yes
1775706f2543Smrgfi
1776706f2543SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1777706f2543SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1778706f2543Smrg
1779706f2543SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1780706f2543SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1781706f2543SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1782706f2543SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1783706f2543Smrg
1784706f2543SmrgAC_SUBST(MAKE_TEXT)
1785706f2543SmrgAC_SUBST(MAKE_PS)
1786706f2543SmrgAC_SUBST(MAKE_PDF)
1787706f2543SmrgAC_SUBST(MAKE_HTML)
1788706f2543Smrg]) # XORG_CHECK_DOCBOOK
1789706f2543Smrg
1790706f2543Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1791706f2543Smrg# ----------------
1792706f2543Smrg# Minimum version: 1.5.0
1793706f2543Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1794706f2543Smrg#
1795706f2543Smrg# Documentation tools are not always available on all platforms and sometimes
1796706f2543Smrg# not at the appropriate level. This macro enables a module to test for the
1797706f2543Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1798706f2543Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1799706f2543Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1800706f2543Smrg# --with-xmlto assumes 'auto'.
1801706f2543Smrg#
1802706f2543Smrg# Interface to module:
1803706f2543Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1804706f2543Smrg# XMLTO:	returns the path of the xmlto program found
1805706f2543Smrg#		returns the path set by the user in the environment
1806706f2543Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1807706f2543Smrg#		'no' user instructs the module not to use xmlto
1808706f2543Smrg#
1809706f2543Smrg# Added in version 1.10.0
1810706f2543Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1811706f2543Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1812706f2543Smrg#
1813706f2543Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1814706f2543Smrg#
1815706f2543SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1816706f2543SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1817706f2543Smrgm4_define([_defopt], m4_default([$2], [auto]))
1818706f2543SmrgAC_ARG_WITH(xmlto,
1819706f2543Smrg	AS_HELP_STRING([--with-xmlto],
1820706f2543Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1821706f2543Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1822706f2543Smrgm4_undefine([_defopt])
1823706f2543Smrg
1824706f2543Smrgif test "x$use_xmlto" = x"auto"; then
1825706f2543Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1826706f2543Smrg   if test "x$XMLTO" = "x"; then
1827706f2543Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1828706f2543Smrg	have_xmlto=no
1829706f2543Smrg   else
1830706f2543Smrg        have_xmlto=yes
1831706f2543Smrg   fi
1832706f2543Smrgelif test "x$use_xmlto" = x"yes" ; then
1833706f2543Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1834706f2543Smrg   if test "x$XMLTO" = "x"; then
1835706f2543Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1836706f2543Smrg   fi
1837706f2543Smrg   have_xmlto=yes
1838706f2543Smrgelif test "x$use_xmlto" = x"no" ; then
1839706f2543Smrg   if test "x$XMLTO" != "x"; then
1840706f2543Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1841706f2543Smrg   fi
1842706f2543Smrg   have_xmlto=no
1843706f2543Smrgelse
1844706f2543Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1845706f2543Smrgfi
1846706f2543Smrg
1847706f2543Smrg# Test for a minimum version of xmlto, if provided.
1848706f2543Smrgm4_ifval([$1],
1849706f2543Smrg[if test "$have_xmlto" = yes; then
1850706f2543Smrg    # scrape the xmlto version
1851706f2543Smrg    AC_MSG_CHECKING([the xmlto version])
1852706f2543Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1853706f2543Smrg    AC_MSG_RESULT([$xmlto_version])
1854706f2543Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1855706f2543Smrg        [if test "x$use_xmlto" = xauto; then
1856706f2543Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1857706f2543Smrg            have_xmlto=no
1858706f2543Smrg        else
1859706f2543Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1860706f2543Smrg        fi])
1861706f2543Smrgfi])
1862706f2543Smrg
1863706f2543Smrg# Test for the ability of xmlto to generate a text target
1864706f2543Smrghave_xmlto_text=no
1865706f2543Smrgcat > conftest.xml << "EOF"
1866706f2543SmrgEOF
1867706f2543SmrgAS_IF([test "$have_xmlto" = yes],
1868706f2543Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1869706f2543Smrg             [have_xmlto_text=yes],
1870706f2543Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1871706f2543Smrgrm -f conftest.xml
1872706f2543SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1873706f2543SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1874706f2543Smrg]) # XORG_WITH_XMLTO
1875706f2543Smrg
1876706f2543Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1877706f2543Smrg# --------------------------------------------
1878706f2543Smrg# Minimum version: 1.12.0
1879706f2543Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1880706f2543Smrg#
1881706f2543Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1882706f2543Smrg# XML-based language used for the transformation of XML documents.
1883706f2543Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1884706f2543Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1885706f2543Smrg# The XSLT processor is often used as a standalone tool for transformations.
1886706f2543Smrg# It should not be assumed that this tool is used only to work with documnetation.
1887706f2543Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1888706f2543Smrg#
1889706f2543Smrg# Interface to module:
1890706f2543Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1891706f2543Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1892706f2543Smrg#		 returns the path set by the user in the environment
1893706f2543Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1894706f2543Smrg#		  'no' user instructs the module not to use xsltproc
1895706f2543Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1896706f2543Smrg#
1897706f2543Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1898706f2543Smrg#
1899706f2543SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1900706f2543SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1901706f2543Smrg# Preserves the interface, should it be implemented later
1902706f2543Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1903706f2543Smrgm4_define([_defopt], m4_default([$2], [auto]))
1904706f2543SmrgAC_ARG_WITH(xsltproc,
1905706f2543Smrg	AS_HELP_STRING([--with-xsltproc],
1906706f2543Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1907706f2543Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1908706f2543Smrgm4_undefine([_defopt])
1909706f2543Smrg
1910706f2543Smrgif test "x$use_xsltproc" = x"auto"; then
1911706f2543Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1912706f2543Smrg   if test "x$XSLTPROC" = "x"; then
1913706f2543Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1914706f2543Smrg	have_xsltproc=no
1915706f2543Smrg   else
1916706f2543Smrg        have_xsltproc=yes
1917706f2543Smrg   fi
1918706f2543Smrgelif test "x$use_xsltproc" = x"yes" ; then
1919706f2543Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1920706f2543Smrg   if test "x$XSLTPROC" = "x"; then
1921706f2543Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1922706f2543Smrg   fi
1923706f2543Smrg   have_xsltproc=yes
1924706f2543Smrgelif test "x$use_xsltproc" = x"no" ; then
1925706f2543Smrg   if test "x$XSLTPROC" != "x"; then
1926706f2543Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1927706f2543Smrg   fi
1928706f2543Smrg   have_xsltproc=no
1929706f2543Smrgelse
1930706f2543Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1931706f2543Smrgfi
1932706f2543Smrg
1933706f2543SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1934706f2543Smrg]) # XORG_WITH_XSLTPROC
1935706f2543Smrg
1936706f2543Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1937706f2543Smrg# ----------------------------------------
1938706f2543Smrg# Minimum version: 1.15.0
1939706f2543Smrg#
1940706f2543Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1941706f2543Smrg# scanning arbitrary text files, extracting information from those text files,
1942706f2543Smrg# and printing reports based on that information.
1943706f2543Smrg#
1944706f2543Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1945706f2543Smrg#
1946706f2543Smrg# Interface to module:
1947706f2543Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1948706f2543Smrg# PERL:	     returns the path of the perl program found
1949706f2543Smrg#	     returns the path set by the user in the environment
1950706f2543Smrg# --with-perl: 'yes' user instructs the module to use perl
1951706f2543Smrg#	       'no' user instructs the module not to use perl
1952706f2543Smrg# have_perl: returns yes if perl found in PATH or no
1953706f2543Smrg#
1954706f2543Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1955706f2543Smrg#
1956706f2543SmrgAC_DEFUN([XORG_WITH_PERL],[
1957706f2543SmrgAC_ARG_VAR([PERL], [Path to perl command])
1958706f2543Smrg# Preserves the interface, should it be implemented later
1959706f2543Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1960706f2543Smrgm4_define([_defopt], m4_default([$2], [auto]))
1961706f2543SmrgAC_ARG_WITH(perl,
1962706f2543Smrg	AS_HELP_STRING([--with-perl],
1963706f2543Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1964706f2543Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1965706f2543Smrgm4_undefine([_defopt])
1966706f2543Smrg
1967706f2543Smrgif test "x$use_perl" = x"auto"; then
1968706f2543Smrg   AC_PATH_PROG([PERL], [perl])
1969706f2543Smrg   if test "x$PERL" = "x"; then
1970706f2543Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1971706f2543Smrg	have_perl=no
1972706f2543Smrg   else
1973706f2543Smrg        have_perl=yes
1974706f2543Smrg   fi
1975706f2543Smrgelif test "x$use_perl" = x"yes" ; then
1976706f2543Smrg   AC_PATH_PROG([PERL], [perl])
1977706f2543Smrg   if test "x$PERL" = "x"; then
1978706f2543Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1979706f2543Smrg   fi
1980706f2543Smrg   have_perl=yes
1981706f2543Smrgelif test "x$use_perl" = x"no" ; then
1982706f2543Smrg   if test "x$PERL" != "x"; then
1983706f2543Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1984706f2543Smrg   fi
1985706f2543Smrg   have_perl=no
1986706f2543Smrgelse
1987706f2543Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1988706f2543Smrgfi
1989706f2543Smrg
1990706f2543SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1991706f2543Smrg]) # XORG_WITH_PERL
1992706f2543Smrg
1993706f2543Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1994706f2543Smrg# ----------------
1995706f2543Smrg# Minimum version: 1.5.0
1996706f2543Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1997706f2543Smrg#
1998706f2543Smrg# Documentation tools are not always available on all platforms and sometimes
1999706f2543Smrg# not at the appropriate level. This macro enables a module to test for the
2000706f2543Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2001706f2543Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
2002706f2543Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2003706f2543Smrg# --with-asciidoc assumes 'auto'.
2004706f2543Smrg#
2005706f2543Smrg# Interface to module:
2006706f2543Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2007706f2543Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2008706f2543Smrg#		 returns the path set by the user in the environment
2009706f2543Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2010706f2543Smrg#		  'no' user instructs the module not to use asciidoc
2011706f2543Smrg#
2012706f2543Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2013706f2543Smrg#
2014706f2543SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2015706f2543SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2016706f2543Smrgm4_define([_defopt], m4_default([$2], [auto]))
2017706f2543SmrgAC_ARG_WITH(asciidoc,
2018706f2543Smrg	AS_HELP_STRING([--with-asciidoc],
2019706f2543Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2020706f2543Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2021706f2543Smrgm4_undefine([_defopt])
2022706f2543Smrg
2023706f2543Smrgif test "x$use_asciidoc" = x"auto"; then
2024706f2543Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2025706f2543Smrg   if test "x$ASCIIDOC" = "x"; then
2026706f2543Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2027706f2543Smrg	have_asciidoc=no
2028706f2543Smrg   else
2029706f2543Smrg        have_asciidoc=yes
2030706f2543Smrg   fi
2031706f2543Smrgelif test "x$use_asciidoc" = x"yes" ; then
2032706f2543Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2033706f2543Smrg   if test "x$ASCIIDOC" = "x"; then
2034706f2543Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2035706f2543Smrg   fi
2036706f2543Smrg   have_asciidoc=yes
2037706f2543Smrgelif test "x$use_asciidoc" = x"no" ; then
2038706f2543Smrg   if test "x$ASCIIDOC" != "x"; then
2039706f2543Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2040706f2543Smrg   fi
2041706f2543Smrg   have_asciidoc=no
2042706f2543Smrgelse
2043706f2543Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2044706f2543Smrgfi
2045706f2543Smrgm4_ifval([$1],
2046706f2543Smrg[if test "$have_asciidoc" = yes; then
2047706f2543Smrg    # scrape the asciidoc version
2048706f2543Smrg    AC_MSG_CHECKING([the asciidoc version])
2049706f2543Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2050706f2543Smrg    AC_MSG_RESULT([$asciidoc_version])
2051706f2543Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2052706f2543Smrg        [if test "x$use_asciidoc" = xauto; then
2053706f2543Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2054706f2543Smrg            have_asciidoc=no
2055706f2543Smrg        else
2056706f2543Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2057706f2543Smrg        fi])
2058706f2543Smrgfi])
2059706f2543SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2060706f2543Smrg]) # XORG_WITH_ASCIIDOC
2061706f2543Smrg
2062706f2543Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2063706f2543Smrg# --------------------------------
2064706f2543Smrg# Minimum version: 1.5.0
2065706f2543Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2066706f2543Smrg#
2067706f2543Smrg# Documentation tools are not always available on all platforms and sometimes
2068706f2543Smrg# not at the appropriate level. This macro enables a module to test for the
2069706f2543Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2070706f2543Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
2071706f2543Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2072706f2543Smrg# --with-doxygen assumes 'auto'.
2073706f2543Smrg#
2074706f2543Smrg# Interface to module:
2075706f2543Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2076706f2543Smrg# DOXYGEN:	 returns the path of the doxygen program found
2077706f2543Smrg#		 returns the path set by the user in the environment
2078706f2543Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2079706f2543Smrg#		  'no' user instructs the module not to use doxygen
2080706f2543Smrg#
2081706f2543Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2082706f2543Smrg#
2083706f2543SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2084706f2543SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2085706f2543Smrgm4_define([_defopt], m4_default([$2], [auto]))
2086706f2543SmrgAC_ARG_WITH(doxygen,
2087706f2543Smrg	AS_HELP_STRING([--with-doxygen],
2088706f2543Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2089706f2543Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2090706f2543Smrgm4_undefine([_defopt])
2091706f2543Smrg
2092706f2543Smrgif test "x$use_doxygen" = x"auto"; then
2093706f2543Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2094706f2543Smrg   if test "x$DOXYGEN" = "x"; then
2095706f2543Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2096706f2543Smrg	have_doxygen=no
2097706f2543Smrg   else
2098706f2543Smrg        have_doxygen=yes
2099706f2543Smrg   fi
2100706f2543Smrgelif test "x$use_doxygen" = x"yes" ; then
2101706f2543Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2102706f2543Smrg   if test "x$DOXYGEN" = "x"; then
2103706f2543Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2104706f2543Smrg   fi
2105706f2543Smrg   have_doxygen=yes
2106706f2543Smrgelif test "x$use_doxygen" = x"no" ; then
2107706f2543Smrg   if test "x$DOXYGEN" != "x"; then
2108706f2543Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2109706f2543Smrg   fi
2110706f2543Smrg   have_doxygen=no
2111706f2543Smrgelse
2112706f2543Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2113706f2543Smrgfi
2114706f2543Smrgm4_ifval([$1],
2115706f2543Smrg[if test "$have_doxygen" = yes; then
2116706f2543Smrg    # scrape the doxygen version
2117706f2543Smrg    AC_MSG_CHECKING([the doxygen version])
2118706f2543Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2119706f2543Smrg    AC_MSG_RESULT([$doxygen_version])
2120706f2543Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2121706f2543Smrg        [if test "x$use_doxygen" = xauto; then
2122706f2543Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2123706f2543Smrg            have_doxygen=no
2124706f2543Smrg        else
2125706f2543Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2126706f2543Smrg        fi])
2127706f2543Smrgfi])
2128706f2543SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2129706f2543Smrg]) # XORG_WITH_DOXYGEN
2130706f2543Smrg
2131706f2543Smrg# XORG_WITH_GROFF([DEFAULT])
2132706f2543Smrg# ----------------
2133706f2543Smrg# Minimum version: 1.6.0
2134706f2543Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2135706f2543Smrg#
2136706f2543Smrg# Documentation tools are not always available on all platforms and sometimes
2137706f2543Smrg# not at the appropriate level. This macro enables a module to test for the
2138706f2543Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2139706f2543Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
2140706f2543Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2141706f2543Smrg# --with-groff assumes 'auto'.
2142706f2543Smrg#
2143706f2543Smrg# Interface to module:
2144706f2543Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2145706f2543Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2146706f2543Smrg# HAVE_GROFF_MS: the -ms macros package
2147706f2543Smrg# GROFF:	 returns the path of the groff program found
2148706f2543Smrg#		 returns the path set by the user in the environment
2149706f2543Smrg# --with-groff:	 'yes' user instructs the module to use groff
2150706f2543Smrg#		 'no' user instructs the module not to use groff
2151706f2543Smrg#
2152706f2543Smrg# Added in version 1.9.0:
2153706f2543Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2154706f2543Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2155706f2543Smrg#		   psselect from the psutils package.
2156706f2543Smrg#		   the ghostcript package. Refer to the grohtml man pages
2157706f2543Smrg#
2158706f2543Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2159706f2543Smrg#
2160706f2543Smrg# OS and distros often splits groff in a basic and full package, the former
2161706f2543Smrg# having the groff program and the later having devices, fonts and macros
2162706f2543Smrg# Checking for the groff executable is not enough.
2163706f2543Smrg#
2164706f2543Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2165706f2543Smrg# unset HAVE_GROFF or GROFF env variables.
2166706f2543Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2167706f2543Smrg#
2168706f2543SmrgAC_DEFUN([XORG_WITH_GROFF],[
2169706f2543SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2170706f2543Smrgm4_define([_defopt], m4_default([$1], [auto]))
2171706f2543SmrgAC_ARG_WITH(groff,
2172706f2543Smrg	AS_HELP_STRING([--with-groff],
2173706f2543Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2174706f2543Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2175706f2543Smrgm4_undefine([_defopt])
2176706f2543Smrg
2177706f2543Smrgif test "x$use_groff" = x"auto"; then
2178706f2543Smrg   AC_PATH_PROG([GROFF], [groff])
2179706f2543Smrg   if test "x$GROFF" = "x"; then
2180706f2543Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2181706f2543Smrg	have_groff=no
2182706f2543Smrg   else
2183706f2543Smrg        have_groff=yes
2184706f2543Smrg   fi
2185706f2543Smrgelif test "x$use_groff" = x"yes" ; then
2186706f2543Smrg   AC_PATH_PROG([GROFF], [groff])
2187706f2543Smrg   if test "x$GROFF" = "x"; then
2188706f2543Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2189706f2543Smrg   fi
2190706f2543Smrg   have_groff=yes
2191706f2543Smrgelif test "x$use_groff" = x"no" ; then
2192706f2543Smrg   if test "x$GROFF" != "x"; then
2193706f2543Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2194706f2543Smrg   fi
2195706f2543Smrg   have_groff=no
2196706f2543Smrgelse
2197706f2543Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2198706f2543Smrgfi
2199706f2543Smrg
2200706f2543Smrg# We have groff, test for the presence of the macro packages
2201706f2543Smrgif test "x$have_groff" = x"yes"; then
2202706f2543Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2203706f2543Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2204706f2543Smrg        groff_ms_works=yes
2205706f2543Smrg    else
2206706f2543Smrg        groff_ms_works=no
2207706f2543Smrg    fi
2208706f2543Smrg    AC_MSG_RESULT([$groff_ms_works])
2209706f2543Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2210706f2543Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2211706f2543Smrg        groff_mm_works=yes
2212706f2543Smrg    else
2213706f2543Smrg        groff_mm_works=no
2214706f2543Smrg    fi
2215706f2543Smrg    AC_MSG_RESULT([$groff_mm_works])
2216706f2543Smrgfi
2217706f2543Smrg
2218706f2543Smrg# We have groff, test for HTML dependencies, one command per package
2219706f2543Smrgif test "x$have_groff" = x"yes"; then
2220706f2543Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2221706f2543Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2222706f2543Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2223706f2543Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2224706f2543Smrg      have_groff_html=yes
2225706f2543Smrg   else
2226706f2543Smrg      have_groff_html=no
2227706f2543Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2228706f2543Smrg   fi
2229706f2543Smrgfi
2230706f2543Smrg
2231706f2543Smrg# Set Automake conditionals for Makefiles
2232706f2543SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2233706f2543SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2234706f2543SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2235706f2543SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2236706f2543Smrg]) # XORG_WITH_GROFF
2237706f2543Smrg
2238706f2543Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2239706f2543Smrg# ---------------------------------------
2240706f2543Smrg# Minimum version: 1.6.0
2241706f2543Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2242706f2543Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2243706f2543Smrg#
2244706f2543Smrg# Documentation tools are not always available on all platforms and sometimes
2245706f2543Smrg# not at the appropriate level. This macro enables a module to test for the
2246706f2543Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2247706f2543Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2248706f2543Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2249706f2543Smrg# --with-fop assumes 'auto'.
2250706f2543Smrg#
2251706f2543Smrg# Interface to module:
2252706f2543Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2253706f2543Smrg# FOP:	 	returns the path of the fop program found
2254706f2543Smrg#		returns the path set by the user in the environment
2255706f2543Smrg# --with-fop: 	'yes' user instructs the module to use fop
2256706f2543Smrg#		'no' user instructs the module not to use fop
2257706f2543Smrg#
2258706f2543Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2259706f2543Smrg#
2260706f2543SmrgAC_DEFUN([XORG_WITH_FOP],[
2261706f2543SmrgAC_ARG_VAR([FOP], [Path to fop command])
2262706f2543Smrgm4_define([_defopt], m4_default([$2], [auto]))
2263706f2543SmrgAC_ARG_WITH(fop,
2264706f2543Smrg	AS_HELP_STRING([--with-fop],
2265706f2543Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2266706f2543Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2267706f2543Smrgm4_undefine([_defopt])
2268706f2543Smrg
2269706f2543Smrgif test "x$use_fop" = x"auto"; then
2270706f2543Smrg   AC_PATH_PROG([FOP], [fop])
2271706f2543Smrg   if test "x$FOP" = "x"; then
2272706f2543Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2273706f2543Smrg	have_fop=no
2274706f2543Smrg   else
2275706f2543Smrg        have_fop=yes
2276706f2543Smrg   fi
2277706f2543Smrgelif test "x$use_fop" = x"yes" ; then
2278706f2543Smrg   AC_PATH_PROG([FOP], [fop])
2279706f2543Smrg   if test "x$FOP" = "x"; then
2280706f2543Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2281706f2543Smrg   fi
2282706f2543Smrg   have_fop=yes
2283706f2543Smrgelif test "x$use_fop" = x"no" ; then
2284706f2543Smrg   if test "x$FOP" != "x"; then
2285706f2543Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2286706f2543Smrg   fi
2287706f2543Smrg   have_fop=no
2288706f2543Smrgelse
2289706f2543Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2290706f2543Smrgfi
2291706f2543Smrg
2292706f2543Smrg# Test for a minimum version of fop, if provided.
2293706f2543Smrgm4_ifval([$1],
2294706f2543Smrg[if test "$have_fop" = yes; then
2295706f2543Smrg    # scrape the fop version
2296706f2543Smrg    AC_MSG_CHECKING([for fop minimum version])
2297706f2543Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2298706f2543Smrg    AC_MSG_RESULT([$fop_version])
2299706f2543Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2300706f2543Smrg        [if test "x$use_fop" = xauto; then
2301706f2543Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2302706f2543Smrg            have_fop=no
2303706f2543Smrg        else
2304706f2543Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2305706f2543Smrg        fi])
2306706f2543Smrgfi])
2307706f2543SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2308706f2543Smrg]) # XORG_WITH_FOP
2309706f2543Smrg
2310706f2543Smrg# XORG_WITH_PS2PDF([DEFAULT])
2311706f2543Smrg# ----------------
2312706f2543Smrg# Minimum version: 1.6.0
2313706f2543Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2314706f2543Smrg#
2315706f2543Smrg# Documentation tools are not always available on all platforms and sometimes
2316706f2543Smrg# not at the appropriate level. This macro enables a module to test for the
2317706f2543Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2318706f2543Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2319706f2543Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2320706f2543Smrg# --with-ps2pdf assumes 'auto'.
2321706f2543Smrg#
2322706f2543Smrg# Interface to module:
2323706f2543Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2324706f2543Smrg# PS2PDF:	returns the path of the ps2pdf program found
2325706f2543Smrg#		returns the path set by the user in the environment
2326706f2543Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2327706f2543Smrg#		 'no' user instructs the module not to use ps2pdf
2328706f2543Smrg#
2329706f2543Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2330706f2543Smrg#
2331706f2543SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2332706f2543SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2333706f2543Smrgm4_define([_defopt], m4_default([$1], [auto]))
2334706f2543SmrgAC_ARG_WITH(ps2pdf,
2335706f2543Smrg	AS_HELP_STRING([--with-ps2pdf],
2336706f2543Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2337706f2543Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2338706f2543Smrgm4_undefine([_defopt])
2339706f2543Smrg
2340706f2543Smrgif test "x$use_ps2pdf" = x"auto"; then
2341706f2543Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2342706f2543Smrg   if test "x$PS2PDF" = "x"; then
2343706f2543Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2344706f2543Smrg	have_ps2pdf=no
2345706f2543Smrg   else
2346706f2543Smrg        have_ps2pdf=yes
2347706f2543Smrg   fi
2348706f2543Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2349706f2543Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2350706f2543Smrg   if test "x$PS2PDF" = "x"; then
2351706f2543Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2352706f2543Smrg   fi
2353706f2543Smrg   have_ps2pdf=yes
2354706f2543Smrgelif test "x$use_ps2pdf" = x"no" ; then
2355706f2543Smrg   if test "x$PS2PDF" != "x"; then
2356706f2543Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2357706f2543Smrg   fi
2358706f2543Smrg   have_ps2pdf=no
2359706f2543Smrgelse
2360706f2543Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2361706f2543Smrgfi
2362706f2543SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2363706f2543Smrg]) # XORG_WITH_PS2PDF
2364706f2543Smrg
2365706f2543Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2366706f2543Smrg# ----------------
2367706f2543Smrg# Minimum version: 1.6.0
2368706f2543Smrg#
2369706f2543Smrg# Documentation tools are not always available on all platforms and sometimes
2370706f2543Smrg# not at the appropriate level. This macro enables a builder to skip all
2371706f2543Smrg# documentation targets except traditional man pages.
2372706f2543Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2373706f2543Smrg# maximum flexibilty in controlling documentation building.
2374706f2543Smrg# Refer to:
2375706f2543Smrg# XORG_WITH_XMLTO         --with-xmlto
2376706f2543Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2377706f2543Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2378706f2543Smrg# XORG_WITH_FOP           --with-fop
2379706f2543Smrg# XORG_WITH_GROFF         --with-groff
2380706f2543Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2381706f2543Smrg#
2382706f2543Smrg# Interface to module:
2383706f2543Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2384706f2543Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2385706f2543Smrg#		 'no' user instructs the module not to generate docs
2386706f2543Smrg# parm1:	specify the default value, yes or no.
2387706f2543Smrg#
2388706f2543SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2389706f2543Smrgm4_define([docs_default], m4_default([$1], [yes]))
2390706f2543SmrgAC_ARG_ENABLE(docs,
2391706f2543Smrg	AS_HELP_STRING([--enable-docs],
2392706f2543Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2393706f2543Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2394706f2543Smrgm4_undefine([docs_default])
2395706f2543SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2396706f2543SmrgAC_MSG_CHECKING([whether to build documentation])
2397706f2543SmrgAC_MSG_RESULT([$build_docs])
2398706f2543Smrg]) # XORG_ENABLE_DOCS
2399706f2543Smrg
2400706f2543Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2401706f2543Smrg# ----------------
2402706f2543Smrg# Minimum version: 1.6.0
2403706f2543Smrg#
2404706f2543Smrg# This macro enables a builder to skip all developer documentation.
2405706f2543Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2406706f2543Smrg# maximum flexibilty in controlling documentation building.
2407706f2543Smrg# Refer to:
2408706f2543Smrg# XORG_WITH_XMLTO         --with-xmlto
2409706f2543Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2410706f2543Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2411706f2543Smrg# XORG_WITH_FOP           --with-fop
2412706f2543Smrg# XORG_WITH_GROFF         --with-groff
2413706f2543Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2414706f2543Smrg#
2415706f2543Smrg# Interface to module:
2416706f2543Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2417706f2543Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2418706f2543Smrg#			'no' user instructs the module not to generate developer docs
2419706f2543Smrg# parm1:		specify the default value, yes or no.
2420706f2543Smrg#
2421706f2543SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2422706f2543Smrgm4_define([devel_default], m4_default([$1], [yes]))
2423706f2543SmrgAC_ARG_ENABLE(devel-docs,
2424706f2543Smrg	AS_HELP_STRING([--enable-devel-docs],
2425706f2543Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2426706f2543Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2427706f2543Smrgm4_undefine([devel_default])
2428706f2543SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2429706f2543SmrgAC_MSG_CHECKING([whether to build developer documentation])
2430706f2543SmrgAC_MSG_RESULT([$build_devel_docs])
2431706f2543Smrg]) # XORG_ENABLE_DEVEL_DOCS
2432706f2543Smrg
2433706f2543Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2434706f2543Smrg# ----------------
2435706f2543Smrg# Minimum version: 1.6.0
2436706f2543Smrg#
2437706f2543Smrg# This macro enables a builder to skip all functional specification targets.
2438706f2543Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2439706f2543Smrg# maximum flexibilty in controlling documentation building.
2440706f2543Smrg# Refer to:
2441706f2543Smrg# XORG_WITH_XMLTO         --with-xmlto
2442706f2543Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2443706f2543Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2444706f2543Smrg# XORG_WITH_FOP           --with-fop
2445706f2543Smrg# XORG_WITH_GROFF         --with-groff
2446706f2543Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2447706f2543Smrg#
2448706f2543Smrg# Interface to module:
2449706f2543Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2450706f2543Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2451706f2543Smrg#			'no' user instructs the module not to generate specs
2452706f2543Smrg# parm1:		specify the default value, yes or no.
2453706f2543Smrg#
2454706f2543SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2455706f2543Smrgm4_define([spec_default], m4_default([$1], [yes]))
2456706f2543SmrgAC_ARG_ENABLE(specs,
2457706f2543Smrg	AS_HELP_STRING([--enable-specs],
2458706f2543Smrg	   [Enable building the specs (default: ]spec_default[)]),
2459706f2543Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2460706f2543Smrgm4_undefine([spec_default])
2461706f2543SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2462706f2543SmrgAC_MSG_CHECKING([whether to build functional specifications])
2463706f2543SmrgAC_MSG_RESULT([$build_specs])
2464706f2543Smrg]) # XORG_ENABLE_SPECS
2465706f2543Smrg
2466706f2543Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2467706f2543Smrg# ----------------------------------------------
2468706f2543Smrg# Minimum version: 1.13.0
2469706f2543Smrg#
2470706f2543Smrg# This macro enables a builder to enable/disable unit testing
2471706f2543Smrg# It makes no assumption about the test cases implementation
2472706f2543Smrg# Test cases may or may not use Automake "Support for test suites"
2473706f2543Smrg# They may or may not use the software utility library GLib
2474706f2543Smrg#
2475706f2543Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2476706f2543Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2477706f2543Smrg# The variable enable_unit_tests is used by other macros in this file.
2478706f2543Smrg#
2479706f2543Smrg# Interface to module:
2480706f2543Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2481706f2543Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2482706f2543Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2483706f2543Smrg#			'no' user instructs the module not to build tests
2484706f2543Smrg# parm1:		specify the default value, yes or no.
2485706f2543Smrg#
2486706f2543SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2487706f2543SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2488706f2543SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2489706f2543SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2490706f2543Smrgm4_define([_defopt], m4_default([$1], [auto]))
2491706f2543SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2492706f2543Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2493706f2543Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2494706f2543Smrgm4_undefine([_defopt])
2495706f2543SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2496706f2543SmrgAC_MSG_CHECKING([whether to build unit test cases])
2497706f2543SmrgAC_MSG_RESULT([$enable_unit_tests])
2498706f2543Smrg]) # XORG_ENABLE_UNIT_TESTS
2499706f2543Smrg
2500706f2543Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2501706f2543Smrg# ----------------------------------------
2502706f2543Smrg# Minimum version: 1.13.0
2503706f2543Smrg#
2504706f2543Smrg# GLib is a library which provides advanced data structures and functions.
2505706f2543Smrg# This macro enables a module to test for the presence of Glib.
2506706f2543Smrg#
2507706f2543Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2508706f2543Smrg# Otherwise the value of $enable_unit_tests is blank.
2509706f2543Smrg#
2510706f2543Smrg# Interface to module:
2511706f2543Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2512706f2543Smrg# with_glib: used in configure.ac to know if GLib has been found
2513706f2543Smrg# --with-glib:	'yes' user instructs the module to use glib
2514706f2543Smrg#		'no' user instructs the module not to use glib
2515706f2543Smrg#
2516706f2543SmrgAC_DEFUN([XORG_WITH_GLIB],[
2517706f2543SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2518706f2543Smrgm4_define([_defopt], m4_default([$2], [auto]))
2519706f2543SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2520706f2543Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2521706f2543Smrg	[with_glib=$withval], [with_glib=]_defopt)
2522706f2543Smrgm4_undefine([_defopt])
2523706f2543Smrg
2524706f2543Smrghave_glib=no
2525706f2543Smrg# Do not probe GLib if user explicitly disabled unit testing
2526706f2543Smrgif test "x$enable_unit_tests" != x"no"; then
2527706f2543Smrg  # Do not probe GLib if user explicitly disabled it
2528706f2543Smrg  if test "x$with_glib" != x"no"; then
2529706f2543Smrg    m4_ifval(
2530706f2543Smrg      [$1],
2531706f2543Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2532706f2543Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2533706f2543Smrg    )
2534706f2543Smrg  fi
2535706f2543Smrgfi
2536706f2543Smrg
2537706f2543Smrg# Not having GLib when unit testing has been explicitly requested is an error
2538706f2543Smrgif test "x$enable_unit_tests" = x"yes"; then
2539706f2543Smrg  if test "x$have_glib" = x"no"; then
2540706f2543Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2541706f2543Smrg  fi
2542706f2543Smrgfi
2543706f2543Smrg
2544706f2543Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2545706f2543Smrgif test "x$enable_unit_tests" = x"no"; then
2546706f2543Smrg  if test "x$with_glib" = x"yes"; then
2547706f2543Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2548706f2543Smrg  fi
2549706f2543Smrgfi
2550706f2543Smrg
2551706f2543Smrg# Not having GLib when it has been explicitly requested is an error
2552706f2543Smrgif test "x$with_glib" = x"yes"; then
2553706f2543Smrg  if test "x$have_glib" = x"no"; then
2554706f2543Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2555706f2543Smrg  fi
2556706f2543Smrgfi
2557706f2543Smrg
2558706f2543SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2559706f2543Smrg]) # XORG_WITH_GLIB
2560706f2543Smrg
2561706f2543Smrg# XORG_LD_WRAP([required|optional])
2562706f2543Smrg# ---------------------------------
2563706f2543Smrg# Minimum version: 1.13.0
2564706f2543Smrg#
2565706f2543Smrg# Check if linker supports -wrap, passed via compiler flags
2566706f2543Smrg#
2567706f2543Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2568706f2543Smrg# Otherwise the value of $enable_unit_tests is blank.
2569706f2543Smrg#
2570706f2543Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2571706f2543Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2572706f2543Smrg# available, an argument of "optional" allows use when some unit tests require
2573706f2543Smrg# ld -wrap and others do not.
2574706f2543Smrg#
2575706f2543SmrgAC_DEFUN([XORG_LD_WRAP],[
2576706f2543SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2577706f2543Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2578706f2543Smrg                      void __wrap_exit(int status) { return; }],
2579706f2543Smrg                     [exit(0);])])
2580706f2543Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2581706f2543Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2582706f2543Smrg  if test "x$have_ld_wrap" = x"no"; then
2583706f2543Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2584706f2543Smrg  fi
2585706f2543Smrgfi
2586706f2543SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2587706f2543Smrg#
2588706f2543Smrg]) # XORG_LD_WRAP
2589706f2543Smrg
2590706f2543Smrg# XORG_CHECK_LINKER_FLAGS
2591706f2543Smrg# -----------------------
2592706f2543Smrg# SYNOPSIS
2593706f2543Smrg#
2594706f2543Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2595706f2543Smrg#
2596706f2543Smrg# DESCRIPTION
2597706f2543Smrg#
2598706f2543Smrg#   Check whether the given linker FLAGS work with the current language's
2599706f2543Smrg#   linker, or whether they give an error.
2600706f2543Smrg#
2601706f2543Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2602706f2543Smrg#   success/failure.
2603706f2543Smrg#
2604706f2543Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2605706f2543Smrg#
2606706f2543Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2607706f2543Smrg#
2608706f2543Smrg# LICENSE
2609706f2543Smrg#
2610706f2543Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2611706f2543Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2612706f2543Smrg#   Copyright (c) 2009 Matteo Frigo
2613706f2543Smrg#
2614706f2543Smrg#   This program is free software: you can redistribute it and/or modify it
2615706f2543Smrg#   under the terms of the GNU General Public License as published by the
2616706f2543Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2617706f2543Smrg#   option) any later version.
2618706f2543Smrg#
2619706f2543Smrg#   This program is distributed in the hope that it will be useful, but
2620706f2543Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2621706f2543Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2622706f2543Smrg#   Public License for more details.
2623706f2543Smrg#
2624706f2543Smrg#   You should have received a copy of the GNU General Public License along
2625706f2543Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2626706f2543Smrg#
2627706f2543Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2628706f2543Smrg#   gives unlimited permission to copy, distribute and modify the configure
2629706f2543Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2630706f2543Smrg#   need not follow the terms of the GNU General Public License when using
2631706f2543Smrg#   or distributing such scripts, even though portions of the text of the
2632706f2543Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2633706f2543Smrg#   all other use of the material that constitutes the Autoconf Macro.
2634706f2543Smrg#
2635706f2543Smrg#   This special exception to the GPL applies to versions of the Autoconf
2636706f2543Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2637706f2543Smrg#   modified version of the Autoconf Macro, you may extend this special
2638706f2543Smrg#   exception to the GPL to apply to your modified version as well.#
2639706f2543SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2640706f2543Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2641706f2543Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2642706f2543SmrgAS_LITERAL_IF([$1],
2643706f2543Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2644706f2543Smrg      ax_save_FLAGS=$LDFLAGS
2645706f2543Smrg      LDFLAGS="$1"
2646706f2543Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2647706f2543Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2648706f2543Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2649706f2543Smrg      LDFLAGS=$ax_save_FLAGS])],
2650706f2543Smrg  [ax_save_FLAGS=$LDFLAGS
2651706f2543Smrg   LDFLAGS="$1"
2652706f2543Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2653706f2543Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2654706f2543Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2655706f2543Smrg   LDFLAGS=$ax_save_FLAGS])
2656706f2543Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2657706f2543SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2658706f2543Smrgif test "x$xorg_check_linker_flags" = xyes; then
2659706f2543Smrg	m4_default([$2], :)
2660706f2543Smrgelse
2661706f2543Smrg	m4_default([$3], :)
2662706f2543Smrgfi
2663706f2543Smrg]) # XORG_CHECK_LINKER_FLAGS
2664706f2543Smrg
2665706f2543Smrg# XORG_MEMORY_CHECK_FLAGS
2666706f2543Smrg# -----------------------
2667706f2543Smrg# Minimum version: 1.16.0
2668706f2543Smrg#
2669706f2543Smrg# This macro attempts to find appropriate memory checking functionality
2670706f2543Smrg# for various platforms which unit testing code may use to catch various
2671706f2543Smrg# forms of memory allocation and access errors in testing.
2672706f2543Smrg#
2673706f2543Smrg# Interface to module:
2674706f2543Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2675706f2543Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2676706f2543Smrg#
2677706f2543Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2678706f2543Smrg#
2679706f2543SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2680706f2543Smrg
2681706f2543SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2682706f2543SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2683706f2543Smrg           [Environment variables to enable memory checking in tests])
2684706f2543Smrg
2685706f2543Smrg# Check for different types of support on different platforms
2686706f2543Smrgcase $host_os in
2687706f2543Smrg    solaris*)
2688706f2543Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2689706f2543Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2690706f2543Smrg        ;;
2691706f2543Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2692706f2543Smrg        # both directly and inverted, so should not be 0 or 255.
2693706f2543Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2694706f2543Smrg        ;;
2695706f2543Smrg    darwin*)
2696706f2543Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2697706f2543Smrg        ;;
2698706f2543Smrg    *bsd*)
2699706f2543Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2700706f2543Smrg        ;;
2701706f2543Smrgesac
2702706f2543Smrg
2703706f2543Smrg# User supplied flags override default flags
2704706f2543Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2705706f2543Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2706706f2543Smrgfi
2707706f2543Smrg
2708706f2543SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2709706f2543Smrg]) # XORG_WITH_LINT
2710706f2543Smrg
2711706f2543Smrg# XORG_CHECK_MALLOC_ZERO
2712706f2543Smrg# ----------------------
2713706f2543Smrg# Minimum version: 1.0.0
2714706f2543Smrg#
2715706f2543Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2716706f2543Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2717706f2543Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2718706f2543SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2719706f2543SmrgAC_ARG_ENABLE(malloc0returnsnull,
2720706f2543Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2721706f2543Smrg		       [malloc(0) returns NULL (default: auto)]),
2722706f2543Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2723706f2543Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2724706f2543Smrg
2725706f2543SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2726706f2543Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2727706f2543Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2728706f2543Smrg#include <stdlib.h>
2729706f2543Smrg],[
2730706f2543Smrg    char *m0, *r0, *c0, *p;
2731706f2543Smrg    m0 = malloc(0);
2732706f2543Smrg    p = malloc(10);
2733706f2543Smrg    r0 = realloc(p,0);
2734706f2543Smrg    c0 = calloc(0,10);
2735706f2543Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2736706f2543Smrg])],
2737706f2543Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2738706f2543Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2739706f2543Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2740706f2543Smrgfi
2741706f2543SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2742706f2543Smrg
2743706f2543Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2744706f2543Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2745706f2543Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2746706f2543Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2747706f2543Smrgelse
2748706f2543Smrg	MALLOC_ZERO_CFLAGS=""
2749706f2543Smrg	XMALLOC_ZERO_CFLAGS=""
2750706f2543Smrg	XTMALLOC_ZERO_CFLAGS=""
2751706f2543Smrgfi
2752706f2543Smrg
2753706f2543SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2754706f2543SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2755706f2543SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2756706f2543Smrg]) # XORG_CHECK_MALLOC_ZERO
2757706f2543Smrg
2758706f2543Smrg# XORG_WITH_LINT()
2759706f2543Smrg# ----------------
2760706f2543Smrg# Minimum version: 1.1.0
2761706f2543Smrg#
2762706f2543Smrg# This macro enables the use of a tool that flags some suspicious and
2763706f2543Smrg# non-portable constructs (likely to be bugs) in C language source code.
2764706f2543Smrg# It will attempt to locate the tool and use appropriate options.
2765706f2543Smrg# There are various lint type tools on different platforms.
2766706f2543Smrg#
2767706f2543Smrg# Interface to module:
2768706f2543Smrg# LINT:		returns the path to the tool found on the platform
2769706f2543Smrg#		or the value set to LINT on the configure cmd line
2770706f2543Smrg#		also an Automake conditional
2771706f2543Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2772706f2543Smrg#
2773706f2543Smrg# --with-lint:	'yes' user instructs the module to use lint
2774706f2543Smrg#		'no' user instructs the module not to use lint (default)
2775706f2543Smrg#
2776706f2543Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2777706f2543Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2778706f2543Smrg#
2779706f2543SmrgAC_DEFUN([XORG_WITH_LINT],[
2780706f2543Smrg
2781706f2543SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2782706f2543SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2783706f2543SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2784706f2543Smrg		[Use a lint-style source code checker (default: disabled)])],
2785706f2543Smrg		[use_lint=$withval], [use_lint=no])
2786706f2543Smrg
2787706f2543Smrg# Obtain platform specific info like program name and options
2788706f2543Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2789706f2543Smrgcase $host_os in
2790706f2543Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2791706f2543Smrg	lint_name=splint
2792706f2543Smrg	lint_options="-badflag"
2793706f2543Smrg	;;
2794706f2543Smrg  *freebsd* | *netbsd*)
2795706f2543Smrg	lint_name=lint
2796706f2543Smrg	lint_options="-u -b"
2797706f2543Smrg	;;
2798706f2543Smrg  *solaris*)
2799706f2543Smrg	lint_name=lint
2800706f2543Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2801706f2543Smrg	;;
2802706f2543Smrgesac
2803706f2543Smrg
2804706f2543Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2805706f2543Smrgif test "x$use_lint" = x"yes" ; then
2806706f2543Smrg   AC_PATH_PROG([LINT], [$lint_name])
2807706f2543Smrg   if test "x$LINT" = "x"; then
2808706f2543Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2809706f2543Smrg   fi
2810706f2543Smrgelif test "x$use_lint" = x"no" ; then
2811706f2543Smrg   if test "x$LINT" != "x"; then
2812706f2543Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2813706f2543Smrg   fi
2814706f2543Smrgelse
2815706f2543Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2816706f2543Smrgfi
2817706f2543Smrg
2818706f2543Smrg# User supplied flags override default flags
2819706f2543Smrgif test "x$LINT_FLAGS" != "x"; then
2820706f2543Smrg   lint_options=$LINT_FLAGS
2821706f2543Smrgfi
2822706f2543Smrg
2823706f2543SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2824706f2543SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2825706f2543Smrg
2826706f2543Smrg]) # XORG_WITH_LINT
2827706f2543Smrg
2828706f2543Smrg# XORG_LINT_LIBRARY(LIBNAME)
2829706f2543Smrg# --------------------------
2830706f2543Smrg# Minimum version: 1.1.0
2831706f2543Smrg#
2832706f2543Smrg# Sets up flags for building lint libraries for checking programs that call
2833706f2543Smrg# functions in the library.
2834706f2543Smrg#
2835706f2543Smrg# Interface to module:
2836706f2543Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2837706f2543Smrg# MAKE_LINT_LIB		- Automake conditional
2838706f2543Smrg#
2839706f2543Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2840706f2543Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2841706f2543Smrg
2842706f2543SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2843706f2543SmrgAC_REQUIRE([XORG_WITH_LINT])
2844706f2543SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2845706f2543Smrg	[Create lint library (default: disabled)])],
2846706f2543Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2847706f2543Smrg
2848706f2543Smrgif test "x$make_lint_lib" = x"yes" ; then
2849706f2543Smrg   LINTLIB=llib-l$1.ln
2850706f2543Smrg   if test "x$LINT" = "x"; then
2851706f2543Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2852706f2543Smrg   fi
2853706f2543Smrgelif test "x$make_lint_lib" != x"no" ; then
2854706f2543Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2855706f2543Smrgfi
2856706f2543Smrg
2857706f2543SmrgAC_SUBST(LINTLIB)
2858706f2543SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2859706f2543Smrg
2860706f2543Smrg]) # XORG_LINT_LIBRARY
2861706f2543Smrg
2862706f2543Smrg# XORG_COMPILER_BRAND
2863706f2543Smrg# -------------------
2864706f2543Smrg# Minimum version: 1.14.0
2865706f2543Smrg#
2866706f2543Smrg# Checks for various brands of compilers and sets flags as appropriate:
2867706f2543Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2868706f2543Smrg#   clang compiler - sets CLANGCC to "yes"
2869706f2543Smrg#   Intel compiler - sets INTELCC to "yes"
2870706f2543Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2871706f2543Smrg#
2872706f2543SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2873706f2543SmrgAC_REQUIRE([AC_PROG_CC_C99])
2874706f2543SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2875706f2543SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2876706f2543SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2877706f2543Smrg]) # XORG_COMPILER_BRAND
2878706f2543Smrg
2879706f2543Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2880706f2543Smrg# ---------------
2881706f2543Smrg# Minimum version: 1.16.0
2882706f2543Smrg#
2883706f2543Smrg# Test if the compiler works when passed the given flag as a command line argument.
2884706f2543Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2885706f2543Smrg# next flag in the list until there are no more options.
2886706f2543Smrg#
2887706f2543Smrg# Note that this does not guarantee that the compiler supports the flag as some
2888706f2543Smrg# compilers will simply ignore arguments that they do not understand, but we do
2889706f2543Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2890706f2543Smrg# -Werror=unused-command-line-argument
2891706f2543Smrg#
2892706f2543SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2893706f2543SmrgAC_REQUIRE([AC_PROG_CC_C99])
2894706f2543Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2895706f2543Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2896706f2543Smrg
2897706f2543Smrgxorg_testset_save_CFLAGS="$CFLAGS"
2898706f2543Smrg
2899706f2543Smrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
2900706f2543Smrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2901706f2543Smrg	AC_MSG_CHECKING([if $CC supports -Werror=unknown-warning-option])
2902706f2543Smrg	AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2903706f2543Smrg	                  [xorg_testset_unknown_warning_option=yes],
2904706f2543Smrg	                  [xorg_testset_unknown_warning_option=no])
2905706f2543Smrg	AC_MSG_RESULT([$xorg_testset_unknown_warning_option])
2906706f2543Smrg	CFLAGS="$xorg_testset_save_CFLAGS"
2907706f2543Smrgfi
2908706f2543Smrg
2909706f2543Smrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
2910706f2543Smrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2911706f2543Smrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2912706f2543Smrg	fi
2913706f2543Smrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2914706f2543Smrg	AC_MSG_CHECKING([if $CC supports -Werror=unused-command-line-argument])
2915706f2543Smrg	AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2916706f2543Smrg	                  [xorg_testset_unused_command_line_argument=yes],
2917706f2543Smrg	                  [xorg_testset_unused_command_line_argument=no])
2918706f2543Smrg	AC_MSG_RESULT([$xorg_testset_unused_command_line_argument])
2919706f2543Smrg	CFLAGS="$xorg_testset_save_CFLAGS"
2920706f2543Smrgfi
2921706f2543Smrg
2922706f2543Smrgfound="no"
2923706f2543Smrgm4_foreach([flag], m4_cdr($@), [
2924706f2543Smrg	if test $found = "no" ; then
2925706f2543Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2926706f2543Smrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2927706f2543Smrg		fi
2928706f2543Smrg
2929706f2543Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2930706f2543Smrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2931706f2543Smrg		fi
2932706f2543Smrg
2933706f2543Smrg		CFLAGS="$CFLAGS ]flag["
2934706f2543Smrg
2935706f2543Smrg		AC_MSG_CHECKING([if $CC supports ]flag[])
2936706f2543Smrg		AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2937706f2543Smrg		                  [supported=yes], [supported=no])
2938706f2543Smrg		AC_MSG_RESULT([$supported])
2939706f2543Smrg		CFLAGS="$xorg_testset_save_CFLAGS"
2940706f2543Smrg
2941706f2543Smrg		if test "$supported" = "yes" ; then
2942706f2543Smrg			$1="$$1 ]flag["
2943706f2543Smrg			found="yes"
2944706f2543Smrg		fi
2945706f2543Smrg	fi
2946706f2543Smrg])
2947706f2543Smrg]) # XORG_TESTSET_CFLAG
2948706f2543Smrg
2949706f2543Smrg# XORG_COMPILER_FLAGS
2950706f2543Smrg# ---------------
2951706f2543Smrg# Minimum version: 1.16.0
2952706f2543Smrg#
2953706f2543Smrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
2954706f2543Smrg# by the selected compiler which do NOT alter the generated code.  These
2955706f2543Smrg# arguments will cause the compiler to print various warnings during
2956706f2543Smrg# compilation AND turn a conservative set of warnings into errors.
2957706f2543Smrg#
2958706f2543Smrg# The set of flags supported by BASE_CFLAGS will grow in future
2959706f2543Smrg# versions of util-macros as options are added to new compilers.
2960706f2543Smrg#
2961706f2543SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2962706f2543SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2963706f2543Smrg
2964706f2543SmrgAC_ARG_ENABLE(selective-werror,
2965706f2543Smrg              AS_HELP_STRING([--disable-selective-werror],
2966706f2543Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2967706f2543Smrg              [SELECTIVE_WERROR=$enableval],
2968706f2543Smrg              [SELECTIVE_WERROR=yes])
2969706f2543Smrg
2970706f2543Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2971706f2543Smrgif test "x$SUNCC" = "xyes"; then
2972706f2543Smrg    BASE_CFLAGS="-v"
2973706f2543Smrgelse
2974706f2543Smrg    BASE_CFLAGS=""
2975706f2543Smrgfi
2976706f2543Smrg
2977706f2543Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2978706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
2979706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
2980706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
2981706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
2982706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
2983706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
2984706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
2985706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
2986706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
2987706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
2988706f2543Smrg
2989706f2543Smrg# This chunk adds additional warnings that could catch undesired effects.
2990706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
2991706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
2992706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
2993706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
2994706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
2995706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
2996706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
2997706f2543Smrg
2998706f2543Smrg# These are currently disabled because they are noisy.  They will be enabled
2999706f2543Smrg# in the future once the codebase is sufficiently modernized to silence
3000706f2543Smrg# them.  For now, I don't want them to drown out the other warnings.
3001706f2543Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
3002706f2543Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
3003706f2543Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
3004706f2543Smrg
3005706f2543Smrg# Turn some warnings into errors, so we don't accidently get successful builds
3006706f2543Smrg# when there are problems that should be fixed.
3007706f2543Smrg
3008706f2543Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3009706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3010706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
3011706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
3012706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
3013706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
3014706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
3015706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3016706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
3017706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
3018706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
3019706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
3020706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3021706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3022706f2543Smrgelse
3023706f2543SmrgAC_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])
3024706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
3025706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
3026706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
3027706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
3028706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
3029706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
3030706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
3031706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
3032706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
3033706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
3034706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
3035706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
3036706f2543SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
3037706f2543Smrgfi
3038706f2543Smrg
3039706f2543SmrgAC_SUBST([BASE_CFLAGS])
3040706f2543Smrg]) # XORG_COMPILER_FLAGS
3041706f2543Smrg
3042706f2543Smrg# XORG_CWARNFLAGS
3043706f2543Smrg# ---------------
3044706f2543Smrg# Minimum version: 1.2.0
3045706f2543Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3046706f2543Smrg#
3047706f2543Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3048706f2543Smrg#
3049706f2543Smrg# This function is deprecated because it defines -fno-strict-aliasing
3050706f2543Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3051706f2543Smrg# is needed, then it should be added explicitly in the module when
3052706f2543Smrg# it is updated to use BASE_CFLAGS.
3053706f2543Smrg#
3054706f2543SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3055706f2543SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3056706f2543SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3057706f2543SmrgCWARNFLAGS="$BASE_CFLAGS"
3058706f2543Smrgif  test "x$GCC" = xyes ; then
3059706f2543Smrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3060706f2543Smrgfi
3061706f2543SmrgAC_SUBST(CWARNFLAGS)
3062706f2543Smrg]) # XORG_CWARNFLAGS
3063706f2543Smrg
3064706f2543Smrg# XORG_STRICT_OPTION
3065706f2543Smrg# -----------------------
3066706f2543Smrg# Minimum version: 1.3.0
3067706f2543Smrg#
3068706f2543Smrg# Add configure option to enable strict compilation flags, such as treating
3069706f2543Smrg# warnings as fatal errors.
3070706f2543Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3071706f2543Smrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
3072706f2543Smrg#
3073706f2543Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3074706f2543Smrg# when strict compilation is unconditionally desired.
3075706f2543SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3076706f2543SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3077706f2543SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3078706f2543Smrg
3079706f2543SmrgAC_ARG_ENABLE(strict-compilation,
3080706f2543Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3081706f2543Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3082706f2543Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3083706f2543Smrg
3084706f2543SmrgSTRICT_CFLAGS=""
3085706f2543SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
3086706f2543SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
3087706f2543Smrg
3088706f2543Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3089706f2543Smrg# activate it with -Werror, so we add it here explicitly.
3090706f2543SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
3091706f2543Smrg
3092706f2543Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3093706f2543Smrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
3094706f2543Smrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
3095706f2543Smrgfi
3096706f2543SmrgAC_SUBST([STRICT_CFLAGS])
3097706f2543SmrgAC_SUBST([BASE_CFLAGS])
3098706f2543SmrgAC_SUBST([CWARNFLAGS])
3099706f2543Smrg]) # XORG_STRICT_OPTION
3100706f2543Smrg
3101706f2543Smrg# XORG_DEFAULT_OPTIONS
3102706f2543Smrg# --------------------
3103706f2543Smrg# Minimum version: 1.3.0
3104706f2543Smrg#
3105706f2543Smrg# Defines default options for X.Org modules.
3106706f2543Smrg#
3107706f2543SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3108706f2543SmrgAC_REQUIRE([AC_PROG_INSTALL])
3109706f2543SmrgXORG_COMPILER_FLAGS
3110706f2543SmrgXORG_CWARNFLAGS
3111706f2543SmrgXORG_STRICT_OPTION
3112706f2543SmrgXORG_RELEASE_VERSION
3113706f2543SmrgXORG_CHANGELOG
3114706f2543SmrgXORG_INSTALL
3115706f2543SmrgXORG_MANPAGE_SECTIONS
3116706f2543Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3117706f2543Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3118706f2543Smrg]) # XORG_DEFAULT_OPTIONS
3119706f2543Smrg
3120706f2543Smrg# XORG_INSTALL()
3121706f2543Smrg# ----------------
3122706f2543Smrg# Minimum version: 1.4.0
3123706f2543Smrg#
3124706f2543Smrg# Defines the variable INSTALL_CMD as the command to copy
3125706f2543Smrg# INSTALL from $prefix/share/util-macros.
3126706f2543Smrg#
3127706f2543SmrgAC_DEFUN([XORG_INSTALL], [
3128706f2543SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3129706f2543Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3130706f2543SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3131706f2543Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3132706f2543Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3133706f2543Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3134706f2543SmrgAC_SUBST([INSTALL_CMD])
3135706f2543Smrg]) # XORG_INSTALL
3136706f2543Smrgdnl Copyright 2005 Red Hat, Inc
3137706f2543Smrgdnl
3138706f2543Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3139706f2543Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3140706f2543Smrgdnl the above copyright notice appear in all copies and that both that
3141706f2543Smrgdnl copyright notice and this permission notice appear in supporting
3142706f2543Smrgdnl documentation.
3143706f2543Smrgdnl
3144706f2543Smrgdnl The above copyright notice and this permission notice shall be included
3145706f2543Smrgdnl in all copies or substantial portions of the Software.
3146706f2543Smrgdnl
3147706f2543Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3148706f2543Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3149706f2543Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3150706f2543Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3151706f2543Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3152706f2543Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3153706f2543Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3154706f2543Smrgdnl
3155706f2543Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3156706f2543Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3157706f2543Smrgdnl other dealings in this Software without prior written authorization
3158706f2543Smrgdnl from the copyright holders.
3159706f2543Smrgdnl
3160706f2543Smrg
3161706f2543Smrg# XORG_RELEASE_VERSION
3162706f2543Smrg# --------------------
3163706f2543Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3164706f2543Smrg 
3165706f2543SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3166706f2543Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3167706f2543Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3168706f2543Smrg		[Major version of this package])
3169706f2543Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3170706f2543Smrg	if test "x$PVM" = "x"; then
3171706f2543Smrg		PVM="0"
3172706f2543Smrg	fi
3173706f2543Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3174706f2543Smrg		[$PVM],
3175706f2543Smrg		[Minor version of this package])
3176706f2543Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3177706f2543Smrg	if test "x$PVP" = "x"; then
3178706f2543Smrg		PVP="0"
3179706f2543Smrg	fi
3180706f2543Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3181706f2543Smrg		[$PVP],
3182706f2543Smrg		[Patch version of this package])
3183706f2543Smrg])
3184706f2543Smrg
3185706f2543Smrg# XORG_CHANGELOG()
3186706f2543Smrg# ----------------
3187706f2543Smrg# Minimum version: 1.2.0
3188706f2543Smrg#
3189706f2543Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3190706f2543Smrg# ChangeLog from git.
3191706f2543Smrg#
3192706f2543Smrg#
3193706f2543SmrgAC_DEFUN([XORG_CHANGELOG], [
3194706f2543SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3195706f2543Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3196706f2543Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3197706f2543Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3198706f2543SmrgAC_SUBST([CHANGELOG_CMD])
3199706f2543Smrg]) # XORG_CHANGELOG
3200706f2543Smrg
3201706f2543Smrgdnl
3202706f2543Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3203706f2543Smrgdnl
3204706f2543Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3205706f2543Smrgdnl copy of this software and associated documentation files (the "Software"),
3206706f2543Smrgdnl to deal in the Software without restriction, including without limitation
3207706f2543Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3208706f2543Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3209706f2543Smrgdnl Software is furnished to do so, subject to the following conditions:
3210706f2543Smrgdnl
3211706f2543Smrgdnl The above copyright notice and this permission notice (including the next
3212706f2543Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3213706f2543Smrgdnl Software.
3214706f2543Smrgdnl
3215706f2543Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3216706f2543Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3217706f2543Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3218706f2543Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3219706f2543Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3220706f2543Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3221706f2543Smrgdnl DEALINGS IN THE SOFTWARE.
3222706f2543Smrgdnl
3223706f2543Smrg
3224706f2543Smrg# XTRANS_TCP_FLAGS()
3225706f2543Smrg# ------------------
3226706f2543Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
3227706f2543SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
3228706f2543Smrg # SVR4 hides these in libraries other than libc
3229706f2543Smrg AC_SEARCH_LIBS(socket, [socket])
3230706f2543Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
3231706f2543Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
3232706f2543Smrg   AC_HAVE_LIBRARY([ws2_32])
3233706f2543Smrg fi
3234706f2543Smrg
3235706f2543Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
3236706f2543Smrg AC_ARG_ENABLE(ipv6, 
3237706f2543Smrg	AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
3238706f2543Smrg	[IPV6CONN=$enableval], 
3239706f2543Smrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
3240706f2543Smrg AC_MSG_CHECKING([if IPv6 support should be built])
3241706f2543Smrg if test "$IPV6CONN" = "yes"; then
3242706f2543Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
3243706f2543Smrg fi
3244706f2543Smrg AC_MSG_RESULT($IPV6CONN)
3245706f2543Smrg
3246706f2543Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
3247706f2543Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len], 
3248706f2543Smrg	AC_DEFINE([BSD44SOCKETS],1,
3249706f2543Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
3250706f2543Smrg#include <sys/types.h>
3251706f2543Smrg#include <sys/socket.h>
3252706f2543Smrg#include <netinet/in.h>
3253706f2543Smrg ])
3254706f2543Smrg
3255706f2543Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
3256706f2543Smrg AC_CHECK_TYPES([socklen_t], [], [], [
3257706f2543SmrgAC_INCLUDES_DEFAULT
3258706f2543Smrg#include <sys/socket.h>])
3259706f2543Smrg 
3260706f2543Smrg]) # XTRANS_TCP_FLAGS
3261706f2543Smrg
3262706f2543Smrg# XTRANS_CONNECTION_FLAGS()
3263706f2543Smrg# -------------------------
3264706f2543Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
3265706f2543Smrg# that use Xtrans functions
3266706f2543SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
3267706f2543Smrg AC_REQUIRE([AC_CANONICAL_HOST])
3268706f2543Smrg AC_REQUIRE([AC_TYPE_SIGNAL])
3269706f2543Smrg [case $host_os in
3270706f2543Smrg	mingw*)	unixdef="no"   ;;
3271706f2543Smrg	*)	unixdef="yes"  ;;
3272706f2543Smrg esac]
3273706f2543Smrg AC_ARG_ENABLE(unix-transport,
3274706f2543Smrg	AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3275706f2543Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
3276706f2543Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
3277706f2543Smrg if test "$UNIXCONN" = "yes"; then
3278706f2543Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
3279706f2543Smrg fi
3280706f2543Smrg AC_MSG_RESULT($UNIXCONN)
3281706f2543Smrg AC_ARG_ENABLE(tcp-transport, 
3282706f2543Smrg	AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3283706f2543Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
3284706f2543Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
3285706f2543Smrg AC_MSG_RESULT($TCPCONN)
3286706f2543Smrg if test "$TCPCONN" = "yes"; then
3287706f2543Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
3288706f2543Smrg	XTRANS_TCP_FLAGS
3289706f2543Smrg fi
3290706f2543Smrg [case $host_os in
3291706f2543Smrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
3292706f2543Smrg	*)			localdef="no"  ;;
3293706f2543Smrg esac]
3294706f2543Smrg AC_ARG_ENABLE(local-transport,
3295706f2543Smrg	AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
3296706f2543Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
3297706f2543Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
3298706f2543Smrg AC_MSG_RESULT($LOCALCONN)
3299706f2543Smrg if test "$LOCALCONN" = "yes"; then
3300706f2543Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
3301706f2543Smrg fi
3302706f2543Smrg 
3303706f2543Smrg]) # XTRANS_CONNECTION_FLAGS
3304706f2543Smrg
3305706f2543Smrg
3306706f2543Smrg# XTRANS_SECURE_RPC_FLAGS()
3307706f2543Smrg# -------------------------
3308706f2543Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
3309706f2543Smrg# so that any necessary networking libraries are already found
3310706f2543SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
3311706f2543Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
3312706f2543Smrg AC_ARG_ENABLE(secure-rpc, 
3313706f2543Smrg	AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
3314706f2543Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
3315706f2543Smrg
3316706f2543Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
3317706f2543Smrg	FOUND_SECURE_RPC="no"
3318706f2543Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
3319706f2543Smrg			[FOUND_SECURE_RPC="yes"])
3320706f2543Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
3321706f2543Smrg		if test "x$SECURE_RPC" = "xyes" ; then
3322706f2543Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
3323706f2543Smrg		fi	
3324706f2543Smrg		SECURE_RPC="no"
3325706f2543Smrg	else
3326706f2543Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
3327706f2543Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
3328706f2543Smrg		SECURE_RPC="yes"
3329706f2543Smrg	fi
3330706f2543Smrg fi
3331706f2543Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
3332706f2543Smrg if test "x$SECURE_RPC" = "xyes" ; then
3333706f2543Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
3334706f2543Smrg fi
3335706f2543Smrg AC_MSG_RESULT($SECURE_RPC)
3336706f2543Smrg]) # XTRANS_SECURE_RPC_FLAGS
3337706f2543Smrg
3338706f2543Smrg
3339