aclocal.m4 revision 482df631
1482df631Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
276910425Smrg
376910425Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4db17cd6dSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
576910425Smrg# This file is free software; the Free Software Foundation
676910425Smrg# gives unlimited permission to copy and/or distribute it,
776910425Smrg# with or without modifications, as long as this notice is preserved.
876910425Smrg
976910425Smrg# This program is distributed in the hope that it will be useful,
1076910425Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1176910425Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1276910425Smrg# PARTICULAR PURPOSE.
1376910425Smrg
14db17cd6dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
15db17cd6dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16482df631Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17482df631Smrg[m4_warning([this file was generated for autoconf 2.68.
18db17cd6dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19db17cd6dSmrgIf you have problems, you may need to regenerate the build system entirely.
20db17cd6dSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2176910425Smrg
22db17cd6dSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
2376910425Smrg#
24db17cd6dSmrg# This file is free software; the Free Software Foundation
25db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
26db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
2776910425Smrg
28db17cd6dSmrg# AM_AUTOMAKE_VERSION(VERSION)
29db17cd6dSmrg# ----------------------------
30db17cd6dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31db17cd6dSmrg# generated from the m4 files accompanying Automake X.Y.
32db17cd6dSmrg# (This private macro should not be called outside this file.)
33db17cd6dSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34db17cd6dSmrg[am__api_version='1.11'
35db17cd6dSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36db17cd6dSmrgdnl require some minimum version.  Point them to the right macro.
37482df631Smrgm4_if([$1], [1.11.1], [],
38db17cd6dSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39db17cd6dSmrg])
4076910425Smrg
41db17cd6dSmrg# _AM_AUTOCONF_VERSION(VERSION)
4276910425Smrg# -----------------------------
43db17cd6dSmrg# aclocal traces this macro to find the Autoconf version.
44db17cd6dSmrg# This is a private macro too.  Using m4_define simplifies
45db17cd6dSmrg# the logic in aclocal, which can simply ignore this definition.
46db17cd6dSmrgm4_define([_AM_AUTOCONF_VERSION], [])
47db17cd6dSmrg
48db17cd6dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49db17cd6dSmrg# -------------------------------
50db17cd6dSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51db17cd6dSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52db17cd6dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53482df631Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54db17cd6dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
55db17cd6dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56db17cd6dSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5776910425Smrg
58db17cd6dSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
5976910425Smrg
60db17cd6dSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
61db17cd6dSmrg#
62db17cd6dSmrg# This file is free software; the Free Software Foundation
63db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
64db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
65db17cd6dSmrg
66db17cd6dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67db17cd6dSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68db17cd6dSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6976910425Smrg#
70db17cd6dSmrg# Of course, Automake must honor this variable whenever it calls a
71db17cd6dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72db17cd6dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73db17cd6dSmrg# depending on how configure is run.  This is pretty annoying, since
74db17cd6dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75db17cd6dSmrg# source directory, any form will work fine, but in subdirectories a
76db17cd6dSmrg# relative path needs to be adjusted first.
7776910425Smrg#
78db17cd6dSmrg# $ac_aux_dir/missing
79db17cd6dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80db17cd6dSmrg# $top_srcdir/$ac_aux_dir/missing
81db17cd6dSmrg#    fails if $ac_aux_dir is absolute,
82db17cd6dSmrg#    fails when called from a subdirectory in a VPATH build with
83db17cd6dSmrg#          a relative $ac_aux_dir
8476910425Smrg#
85db17cd6dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86db17cd6dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
87db17cd6dSmrg# harmless because $srcdir is `.', but things will broke when you
88db17cd6dSmrg# start a VPATH build or use an absolute $srcdir.
8976910425Smrg#
90db17cd6dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91db17cd6dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92db17cd6dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93db17cd6dSmrg# and then we would define $MISSING as
94db17cd6dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95db17cd6dSmrg# This will work as long as MISSING is not called from configure, because
96db17cd6dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
97db17cd6dSmrg# However there are other variables, like CC, which are often used in
98db17cd6dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99db17cd6dSmrg#
100db17cd6dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
101db17cd6dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
102db17cd6dSmrg# configured tree to be moved without reconfiguration.
10376910425Smrg
104db17cd6dSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105db17cd6dSmrg[dnl Rely on autoconf to set up CDPATH properly.
106db17cd6dSmrgAC_PREREQ([2.50])dnl
107db17cd6dSmrg# expand $ac_aux_dir to an absolute path
108db17cd6dSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
109db17cd6dSmrg])
11076910425Smrg
111db17cd6dSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11276910425Smrg
113db17cd6dSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114db17cd6dSmrg# Free Software Foundation, Inc.
115db17cd6dSmrg#
116db17cd6dSmrg# This file is free software; the Free Software Foundation
117db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
118db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
11976910425Smrg
120db17cd6dSmrg# serial 9
12176910425Smrg
122db17cd6dSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123db17cd6dSmrg# -------------------------------------
124db17cd6dSmrg# Define a conditional.
125db17cd6dSmrgAC_DEFUN([AM_CONDITIONAL],
126db17cd6dSmrg[AC_PREREQ(2.52)dnl
127db17cd6dSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128db17cd6dSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
129db17cd6dSmrgAC_SUBST([$1_TRUE])dnl
130db17cd6dSmrgAC_SUBST([$1_FALSE])dnl
131db17cd6dSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
132db17cd6dSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133db17cd6dSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134db17cd6dSmrgif $2; then
135db17cd6dSmrg  $1_TRUE=
136db17cd6dSmrg  $1_FALSE='#'
137db17cd6dSmrgelse
138db17cd6dSmrg  $1_TRUE='#'
139db17cd6dSmrg  $1_FALSE=
140db17cd6dSmrgfi
141db17cd6dSmrgAC_CONFIG_COMMANDS_PRE(
142db17cd6dSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143db17cd6dSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144db17cd6dSmrgUsually this means the macro was only invoked conditionally.]])
145db17cd6dSmrgfi])])
14676910425Smrg
147db17cd6dSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148db17cd6dSmrg# Free Software Foundation, Inc.
149db17cd6dSmrg#
150db17cd6dSmrg# This file is free software; the Free Software Foundation
151db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
152db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
15376910425Smrg
154db17cd6dSmrg# serial 10
15576910425Smrg
156db17cd6dSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157db17cd6dSmrg# written in clear, in which case automake, when reading aclocal.m4,
158db17cd6dSmrg# will think it sees a *use*, and therefore will trigger all it's
159db17cd6dSmrg# C support machinery.  Also note that it means that autoscan, seeing
160db17cd6dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
16176910425Smrg
16276910425Smrg
163db17cd6dSmrg# _AM_DEPENDENCIES(NAME)
164db17cd6dSmrg# ----------------------
165db17cd6dSmrg# See how the compiler implements dependency checking.
166db17cd6dSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167db17cd6dSmrg# We try a few techniques and use that to set a single cache variable.
168db17cd6dSmrg#
169db17cd6dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170db17cd6dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171db17cd6dSmrg# dependency, and given that the user is not expected to run this macro,
172db17cd6dSmrg# just rely on AC_PROG_CC.
173db17cd6dSmrgAC_DEFUN([_AM_DEPENDENCIES],
174db17cd6dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175db17cd6dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176db17cd6dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177db17cd6dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17876910425Smrg
179db17cd6dSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180db17cd6dSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181db17cd6dSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
182db17cd6dSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183db17cd6dSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184db17cd6dSmrg                   [depcc="$$1"   am_compiler_list=])
18576910425Smrg
186db17cd6dSmrgAC_CACHE_CHECK([dependency style of $depcc],
187db17cd6dSmrg               [am_cv_$1_dependencies_compiler_type],
188db17cd6dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189db17cd6dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
190db17cd6dSmrg  # making bogus files that we don't know about and never remove.  For
191db17cd6dSmrg  # instance it was reported that on HP-UX the gcc test will end up
192db17cd6dSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
193db17cd6dSmrg  # in D'.
194db17cd6dSmrg  mkdir conftest.dir
195db17cd6dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196db17cd6dSmrg  # using a relative directory.
197db17cd6dSmrg  cp "$am_depcomp" conftest.dir
198db17cd6dSmrg  cd conftest.dir
199db17cd6dSmrg  # We will build objects and dependencies in a subdirectory because
200db17cd6dSmrg  # it helps to detect inapplicable dependency modes.  For instance
201db17cd6dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202db17cd6dSmrg  # side effect of compilation, but ICC will put the dependencies in
203db17cd6dSmrg  # the current directory while Tru64 will put them in the object
204db17cd6dSmrg  # directory.
205db17cd6dSmrg  mkdir sub
20676910425Smrg
207db17cd6dSmrg  am_cv_$1_dependencies_compiler_type=none
208db17cd6dSmrg  if test "$am_compiler_list" = ""; then
209db17cd6dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210db17cd6dSmrg  fi
211db17cd6dSmrg  am__universal=false
212db17cd6dSmrg  m4_case([$1], [CC],
213db17cd6dSmrg    [case " $depcc " in #(
214db17cd6dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215db17cd6dSmrg     esac],
216db17cd6dSmrg    [CXX],
217db17cd6dSmrg    [case " $depcc " in #(
218db17cd6dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219db17cd6dSmrg     esac])
22076910425Smrg
221db17cd6dSmrg  for depmode in $am_compiler_list; do
222db17cd6dSmrg    # Setup a source with many dependencies, because some compilers
223db17cd6dSmrg    # like to wrap large dependency lists on column 80 (with \), and
224db17cd6dSmrg    # we should not choose a depcomp mode which is confused by this.
225db17cd6dSmrg    #
226db17cd6dSmrg    # We need to recreate these files for each test, as the compiler may
227db17cd6dSmrg    # overwrite some of them when testing with obscure command lines.
228db17cd6dSmrg    # This happens at least with the AIX C compiler.
229db17cd6dSmrg    : > sub/conftest.c
230db17cd6dSmrg    for i in 1 2 3 4 5 6; do
231db17cd6dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232db17cd6dSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233db17cd6dSmrg      # Solaris 8's {/usr,}/bin/sh.
234db17cd6dSmrg      touch sub/conftst$i.h
235db17cd6dSmrg    done
236db17cd6dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237db17cd6dSmrg
238db17cd6dSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239db17cd6dSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240db17cd6dSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241db17cd6dSmrg    # versions had trouble with output in subdirs
242db17cd6dSmrg    am__obj=sub/conftest.${OBJEXT-o}
243db17cd6dSmrg    am__minus_obj="-o $am__obj"
244db17cd6dSmrg    case $depmode in
245db17cd6dSmrg    gcc)
246db17cd6dSmrg      # This depmode causes a compiler race in universal mode.
247db17cd6dSmrg      test "$am__universal" = false || continue
248db17cd6dSmrg      ;;
249db17cd6dSmrg    nosideeffect)
250db17cd6dSmrg      # after this tag, mechanisms are not by side-effect, so they'll
251db17cd6dSmrg      # only be used when explicitly requested
252db17cd6dSmrg      if test "x$enable_dependency_tracking" = xyes; then
253db17cd6dSmrg	continue
254db17cd6dSmrg      else
255db17cd6dSmrg	break
256db17cd6dSmrg      fi
257db17cd6dSmrg      ;;
258db17cd6dSmrg    msvisualcpp | msvcmsys)
259db17cd6dSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
260db17cd6dSmrg      # not run yet.  These depmodes are late enough in the game, and
261db17cd6dSmrg      # so weak that their functioning should not be impacted.
262db17cd6dSmrg      am__obj=conftest.${OBJEXT-o}
263db17cd6dSmrg      am__minus_obj=
264db17cd6dSmrg      ;;
265db17cd6dSmrg    none) break ;;
266db17cd6dSmrg    esac
267db17cd6dSmrg    if depmode=$depmode \
268db17cd6dSmrg       source=sub/conftest.c object=$am__obj \
269db17cd6dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270db17cd6dSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271db17cd6dSmrg         >/dev/null 2>conftest.err &&
272db17cd6dSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273db17cd6dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274db17cd6dSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275db17cd6dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276db17cd6dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
277db17cd6dSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
278db17cd6dSmrg      # that says an option was ignored or not supported.
279db17cd6dSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280db17cd6dSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281db17cd6dSmrg      # The diagnosis changed in icc 8.0:
282db17cd6dSmrg      #   icc: Command line remark: option '-MP' not supported
283db17cd6dSmrg      if (grep 'ignoring option' conftest.err ||
284db17cd6dSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285db17cd6dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
286db17cd6dSmrg        break
287db17cd6dSmrg      fi
288db17cd6dSmrg    fi
289db17cd6dSmrg  done
290db17cd6dSmrg
291db17cd6dSmrg  cd ..
292db17cd6dSmrg  rm -rf conftest.dir
29376910425Smrgelse
294db17cd6dSmrg  am_cv_$1_dependencies_compiler_type=none
29576910425Smrgfi
296db17cd6dSmrg])
297db17cd6dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298db17cd6dSmrgAM_CONDITIONAL([am__fastdep$1], [
299db17cd6dSmrg  test "x$enable_dependency_tracking" != xno \
300db17cd6dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301db17cd6dSmrg])
30276910425Smrg
30376910425Smrg
304db17cd6dSmrg# AM_SET_DEPDIR
305db17cd6dSmrg# -------------
306db17cd6dSmrg# Choose a directory name for dependency files.
307db17cd6dSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308db17cd6dSmrgAC_DEFUN([AM_SET_DEPDIR],
309db17cd6dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310db17cd6dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311db17cd6dSmrg])
31276910425Smrg
31376910425Smrg
314db17cd6dSmrg# AM_DEP_TRACK
315db17cd6dSmrg# ------------
316db17cd6dSmrgAC_DEFUN([AM_DEP_TRACK],
317db17cd6dSmrg[AC_ARG_ENABLE(dependency-tracking,
318db17cd6dSmrg[  --disable-dependency-tracking  speeds up one-time build
319db17cd6dSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320db17cd6dSmrgif test "x$enable_dependency_tracking" != xno; then
321db17cd6dSmrg  am_depcomp="$ac_aux_dir/depcomp"
322db17cd6dSmrg  AMDEPBACKSLASH='\'
32376910425Smrgfi
324db17cd6dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
325db17cd6dSmrgAC_SUBST([AMDEPBACKSLASH])dnl
326db17cd6dSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327db17cd6dSmrg])
32876910425Smrg
329db17cd6dSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330db17cd6dSmrg
331db17cd6dSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332db17cd6dSmrg# Free Software Foundation, Inc.
333db17cd6dSmrg#
334db17cd6dSmrg# This file is free software; the Free Software Foundation
335db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
336db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
337db17cd6dSmrg
338db17cd6dSmrg#serial 5
339db17cd6dSmrg
340db17cd6dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341db17cd6dSmrg# ------------------------------
342db17cd6dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343db17cd6dSmrg[{
344db17cd6dSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345db17cd6dSmrg  # are listed without --file.  Let's play safe and only enable the eval
346db17cd6dSmrg  # if we detect the quoting.
347db17cd6dSmrg  case $CONFIG_FILES in
348db17cd6dSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
349db17cd6dSmrg  *)   set x $CONFIG_FILES ;;
350db17cd6dSmrg  esac
351db17cd6dSmrg  shift
352db17cd6dSmrg  for mf
353db17cd6dSmrg  do
354db17cd6dSmrg    # Strip MF so we end up with the name of the file.
355db17cd6dSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356db17cd6dSmrg    # Check whether this is an Automake generated Makefile or not.
357db17cd6dSmrg    # We used to match only the files named `Makefile.in', but
358db17cd6dSmrg    # some people rename them; so instead we look at the file content.
359db17cd6dSmrg    # Grep'ing the first line is not enough: some people post-process
360db17cd6dSmrg    # each Makefile.in and add a new line on top of each file to say so.
361db17cd6dSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
362db17cd6dSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
363db17cd6dSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364db17cd6dSmrg      dirpart=`AS_DIRNAME("$mf")`
365db17cd6dSmrg    else
366db17cd6dSmrg      continue
367db17cd6dSmrg    fi
368db17cd6dSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
369db17cd6dSmrg    # from the Makefile without running `make'.
370db17cd6dSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371db17cd6dSmrg    test -z "$DEPDIR" && continue
372db17cd6dSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373db17cd6dSmrg    test -z "am__include" && continue
374db17cd6dSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375db17cd6dSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
376db17cd6dSmrg    U=`sed -n 's/^U = //p' < "$mf"`
377db17cd6dSmrg    # Find all dependency output files, they are included files with
378db17cd6dSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379db17cd6dSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380db17cd6dSmrg    # expansion.
381db17cd6dSmrg    for file in `sed -n "
382db17cd6dSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383db17cd6dSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384db17cd6dSmrg      # Make sure the directory exists.
385db17cd6dSmrg      test -f "$dirpart/$file" && continue
386db17cd6dSmrg      fdir=`AS_DIRNAME(["$file"])`
387db17cd6dSmrg      AS_MKDIR_P([$dirpart/$fdir])
388db17cd6dSmrg      # echo "creating $dirpart/$file"
389db17cd6dSmrg      echo '# dummy' > "$dirpart/$file"
390db17cd6dSmrg    done
391db17cd6dSmrg  done
392db17cd6dSmrg}
393db17cd6dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394db17cd6dSmrg
395db17cd6dSmrg
396db17cd6dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397db17cd6dSmrg# -----------------------------
398db17cd6dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
399db17cd6dSmrg#
400db17cd6dSmrg# This code is only required when automatic dependency tracking
401db17cd6dSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
402db17cd6dSmrg# need in order to bootstrap the dependency handling code.
403db17cd6dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404db17cd6dSmrg[AC_CONFIG_COMMANDS([depfiles],
405db17cd6dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406db17cd6dSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407db17cd6dSmrg])
408db17cd6dSmrg
409db17cd6dSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
410db17cd6dSmrg# Free Software Foundation, Inc.
411db17cd6dSmrg#
412db17cd6dSmrg# This file is free software; the Free Software Foundation
413db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
414db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
415db17cd6dSmrg
416db17cd6dSmrg# serial 8
417db17cd6dSmrg
418db17cd6dSmrg# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
419db17cd6dSmrgAU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
420db17cd6dSmrg
421db17cd6dSmrg# Do all the work for Automake.                             -*- Autoconf -*-
422db17cd6dSmrg
423db17cd6dSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
424db17cd6dSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
425db17cd6dSmrg#
426db17cd6dSmrg# This file is free software; the Free Software Foundation
427db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
428db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
429db17cd6dSmrg
430db17cd6dSmrg# serial 16
431db17cd6dSmrg
432db17cd6dSmrg# This macro actually does too much.  Some checks are only needed if
433db17cd6dSmrg# your package does certain things.  But this isn't really a big deal.
434db17cd6dSmrg
435db17cd6dSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
436db17cd6dSmrg# AM_INIT_AUTOMAKE([OPTIONS])
437db17cd6dSmrg# -----------------------------------------------
438db17cd6dSmrg# The call with PACKAGE and VERSION arguments is the old style
439db17cd6dSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
440db17cd6dSmrg# and VERSION should now be passed to AC_INIT and removed from
441db17cd6dSmrg# the call to AM_INIT_AUTOMAKE.
442db17cd6dSmrg# We support both call styles for the transition.  After
443db17cd6dSmrg# the next Automake release, Autoconf can make the AC_INIT
444db17cd6dSmrg# arguments mandatory, and then we can depend on a new Autoconf
445db17cd6dSmrg# release and drop the old call support.
446db17cd6dSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
447db17cd6dSmrg[AC_PREREQ([2.62])dnl
448db17cd6dSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
449db17cd6dSmrgdnl the ones we care about.
450db17cd6dSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
451db17cd6dSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
452db17cd6dSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
453db17cd6dSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
454db17cd6dSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
455db17cd6dSmrg  # is not polluted with repeated "-I."
456db17cd6dSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
457db17cd6dSmrg  # test to see if srcdir already configured
458db17cd6dSmrg  if test -f $srcdir/config.status; then
459db17cd6dSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
460db17cd6dSmrg  fi
46176910425Smrgfi
46276910425Smrg
463db17cd6dSmrg# test whether we have cygpath
464db17cd6dSmrgif test -z "$CYGPATH_W"; then
465db17cd6dSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
466db17cd6dSmrg    CYGPATH_W='cygpath -w'
467db17cd6dSmrg  else
468db17cd6dSmrg    CYGPATH_W=echo
469db17cd6dSmrg  fi
47076910425Smrgfi
471db17cd6dSmrgAC_SUBST([CYGPATH_W])
472db17cd6dSmrg
473db17cd6dSmrg# Define the identity of the package.
474db17cd6dSmrgdnl Distinguish between old-style and new-style calls.
475db17cd6dSmrgm4_ifval([$2],
476db17cd6dSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
477db17cd6dSmrg AC_SUBST([PACKAGE], [$1])dnl
478db17cd6dSmrg AC_SUBST([VERSION], [$2])],
479db17cd6dSmrg[_AM_SET_OPTIONS([$1])dnl
480db17cd6dSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
481db17cd6dSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
482db17cd6dSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
483db17cd6dSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
484db17cd6dSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
485db17cd6dSmrg
486db17cd6dSmrg_AM_IF_OPTION([no-define],,
487db17cd6dSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
488db17cd6dSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
489db17cd6dSmrg
490db17cd6dSmrg# Some tools Automake needs.
491db17cd6dSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
492db17cd6dSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
493db17cd6dSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
494db17cd6dSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
495db17cd6dSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
496db17cd6dSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
497db17cd6dSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
498db17cd6dSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
499db17cd6dSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
500db17cd6dSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
501db17cd6dSmrg# We need awk for the "check" target.  The system "awk" is bad on
502db17cd6dSmrg# some platforms.
503db17cd6dSmrgAC_REQUIRE([AC_PROG_AWK])dnl
504db17cd6dSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
505db17cd6dSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
506db17cd6dSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507db17cd6dSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508db17cd6dSmrg			     [_AM_PROG_TAR([v7])])])
509db17cd6dSmrg_AM_IF_OPTION([no-dependencies],,
510db17cd6dSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
511db17cd6dSmrg		  [_AM_DEPENDENCIES(CC)],
512db17cd6dSmrg		  [define([AC_PROG_CC],
513db17cd6dSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
514db17cd6dSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
515db17cd6dSmrg		  [_AM_DEPENDENCIES(CXX)],
516db17cd6dSmrg		  [define([AC_PROG_CXX],
517db17cd6dSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
518db17cd6dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
519db17cd6dSmrg		  [_AM_DEPENDENCIES(OBJC)],
520db17cd6dSmrg		  [define([AC_PROG_OBJC],
521db17cd6dSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
522db17cd6dSmrg])
523db17cd6dSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
524db17cd6dSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
525db17cd6dSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
526db17cd6dSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
527db17cd6dSmrgAC_CONFIG_COMMANDS_PRE(dnl
528db17cd6dSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
529db17cd6dSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
530db17cd6dSmrg])
531db17cd6dSmrg
532db17cd6dSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
533db17cd6dSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
534db17cd6dSmrgdnl mangled by Autoconf and run in a shell conditional statement.
535db17cd6dSmrgm4_define([_AC_COMPILER_EXEEXT],
536db17cd6dSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
537db17cd6dSmrg
538db17cd6dSmrg
539db17cd6dSmrg# When config.status generates a header, we must update the stamp-h file.
540db17cd6dSmrg# This file resides in the same directory as the config header
541db17cd6dSmrg# that is generated.  The stamp files are numbered to have different names.
542db17cd6dSmrg
543db17cd6dSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
544db17cd6dSmrg# loop where config.status creates the headers, so we can generate
545db17cd6dSmrg# our stamp files there.
546db17cd6dSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
547db17cd6dSmrg[# Compute $1's index in $config_headers.
548db17cd6dSmrg_am_arg=$1
549db17cd6dSmrg_am_stamp_count=1
550db17cd6dSmrgfor _am_header in $config_headers :; do
551db17cd6dSmrg  case $_am_header in
552db17cd6dSmrg    $_am_arg | $_am_arg:* )
553db17cd6dSmrg      break ;;
554db17cd6dSmrg    * )
555db17cd6dSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
556db17cd6dSmrg  esac
557db17cd6dSmrgdone
558db17cd6dSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
559db17cd6dSmrg
560db17cd6dSmrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
561db17cd6dSmrg#
562db17cd6dSmrg# This file is free software; the Free Software Foundation
563db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
564db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
565db17cd6dSmrg
566db17cd6dSmrg# AM_PROG_INSTALL_SH
567db17cd6dSmrg# ------------------
568db17cd6dSmrg# Define $install_sh.
569db17cd6dSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
570db17cd6dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
571db17cd6dSmrgif test x"${install_sh}" != xset; then
572db17cd6dSmrg  case $am_aux_dir in
573db17cd6dSmrg  *\ * | *\	*)
574db17cd6dSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
575db17cd6dSmrg  *)
576db17cd6dSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
577db17cd6dSmrg  esac
57876910425Smrgfi
579db17cd6dSmrgAC_SUBST(install_sh)])
58076910425Smrg
581db17cd6dSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
582db17cd6dSmrg#
583db17cd6dSmrg# This file is free software; the Free Software Foundation
584db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
585db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
586db17cd6dSmrg
587db17cd6dSmrg# serial 2
588db17cd6dSmrg
589db17cd6dSmrg# Check whether the underlying file-system supports filenames
590db17cd6dSmrg# with a leading dot.  For instance MS-DOS doesn't.
591db17cd6dSmrgAC_DEFUN([AM_SET_LEADING_DOT],
592db17cd6dSmrg[rm -rf .tst 2>/dev/null
593db17cd6dSmrgmkdir .tst 2>/dev/null
594db17cd6dSmrgif test -d .tst; then
595db17cd6dSmrg  am__leading_dot=.
596db17cd6dSmrgelse
597db17cd6dSmrg  am__leading_dot=_
59876910425Smrgfi
599db17cd6dSmrgrmdir .tst 2>/dev/null
600db17cd6dSmrgAC_SUBST([am__leading_dot])])
601db17cd6dSmrg
602db17cd6dSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
603db17cd6dSmrg# From Jim Meyering
604db17cd6dSmrg
605db17cd6dSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
606db17cd6dSmrg# Free Software Foundation, Inc.
607db17cd6dSmrg#
608db17cd6dSmrg# This file is free software; the Free Software Foundation
609db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
610db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
611db17cd6dSmrg
612db17cd6dSmrg# serial 5
613db17cd6dSmrg
614db17cd6dSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
615db17cd6dSmrg# ----------------------------------
616db17cd6dSmrg# Control maintainer-specific portions of Makefiles.
617db17cd6dSmrg# Default is to disable them, unless `enable' is passed literally.
618db17cd6dSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
619db17cd6dSmrg# can override the default with the --enable/--disable switch.
620db17cd6dSmrgAC_DEFUN([AM_MAINTAINER_MODE],
621db17cd6dSmrg[m4_case(m4_default([$1], [disable]),
622db17cd6dSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
623db17cd6dSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
624db17cd6dSmrg       [m4_define([am_maintainer_other], [enable])
625db17cd6dSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
626db17cd6dSmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
627db17cd6dSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
628db17cd6dSmrg  AC_ARG_ENABLE([maintainer-mode],
629db17cd6dSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
630db17cd6dSmrg			  (and sometimes confusing) to the casual installer],
631db17cd6dSmrg      [USE_MAINTAINER_MODE=$enableval],
632db17cd6dSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
633db17cd6dSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
634db17cd6dSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
635db17cd6dSmrg  MAINT=$MAINTAINER_MODE_TRUE
636db17cd6dSmrg  AC_SUBST([MAINT])dnl
637db17cd6dSmrg]
638db17cd6dSmrg)
639db17cd6dSmrg
640db17cd6dSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
641db17cd6dSmrg
642db17cd6dSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
643db17cd6dSmrg
644db17cd6dSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
645db17cd6dSmrg#
646db17cd6dSmrg# This file is free software; the Free Software Foundation
647db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
648db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
649db17cd6dSmrg
650db17cd6dSmrg# serial 4
651db17cd6dSmrg
652db17cd6dSmrg# AM_MAKE_INCLUDE()
653db17cd6dSmrg# -----------------
654db17cd6dSmrg# Check to see how make treats includes.
655db17cd6dSmrgAC_DEFUN([AM_MAKE_INCLUDE],
656db17cd6dSmrg[am_make=${MAKE-make}
657db17cd6dSmrgcat > confinc << 'END'
658db17cd6dSmrgam__doit:
659db17cd6dSmrg	@echo this is the am__doit target
660db17cd6dSmrg.PHONY: am__doit
661db17cd6dSmrgEND
662db17cd6dSmrg# If we don't find an include directive, just comment out the code.
663db17cd6dSmrgAC_MSG_CHECKING([for style of include used by $am_make])
664db17cd6dSmrgam__include="#"
665db17cd6dSmrgam__quote=
666db17cd6dSmrg_am_result=none
667db17cd6dSmrg# First try GNU make style include.
668db17cd6dSmrgecho "include confinc" > confmf
669db17cd6dSmrg# Ignore all kinds of additional output from `make'.
670db17cd6dSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
671db17cd6dSmrg*the\ am__doit\ target*)
672db17cd6dSmrg  am__include=include
673db17cd6dSmrg  am__quote=
674db17cd6dSmrg  _am_result=GNU
675db17cd6dSmrg  ;;
676db17cd6dSmrgesac
677db17cd6dSmrg# Now try BSD make style include.
678db17cd6dSmrgif test "$am__include" = "#"; then
679db17cd6dSmrg   echo '.include "confinc"' > confmf
680db17cd6dSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
681db17cd6dSmrg   *the\ am__doit\ target*)
682db17cd6dSmrg     am__include=.include
683db17cd6dSmrg     am__quote="\""
684db17cd6dSmrg     _am_result=BSD
685db17cd6dSmrg     ;;
686db17cd6dSmrg   esac
68776910425Smrgfi
688db17cd6dSmrgAC_SUBST([am__include])
689db17cd6dSmrgAC_SUBST([am__quote])
690db17cd6dSmrgAC_MSG_RESULT([$_am_result])
691db17cd6dSmrgrm -f confinc confmf
692db17cd6dSmrg])
69376910425Smrg
694db17cd6dSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
695db17cd6dSmrg
696db17cd6dSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
697db17cd6dSmrg# Free Software Foundation, Inc.
698db17cd6dSmrg#
699db17cd6dSmrg# This file is free software; the Free Software Foundation
700db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
701db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
702db17cd6dSmrg
703db17cd6dSmrg# serial 6
704db17cd6dSmrg
705db17cd6dSmrg# AM_MISSING_PROG(NAME, PROGRAM)
706db17cd6dSmrg# ------------------------------
707db17cd6dSmrgAC_DEFUN([AM_MISSING_PROG],
708db17cd6dSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
709db17cd6dSmrg$1=${$1-"${am_missing_run}$2"}
710db17cd6dSmrgAC_SUBST($1)])
711db17cd6dSmrg
712db17cd6dSmrg
713db17cd6dSmrg# AM_MISSING_HAS_RUN
714db17cd6dSmrg# ------------------
715db17cd6dSmrg# Define MISSING if not defined so far and test if it supports --run.
716db17cd6dSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
717db17cd6dSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
718db17cd6dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
719db17cd6dSmrgAC_REQUIRE_AUX_FILE([missing])dnl
720db17cd6dSmrgif test x"${MISSING+set}" != xset; then
721db17cd6dSmrg  case $am_aux_dir in
722db17cd6dSmrg  *\ * | *\	*)
723db17cd6dSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724db17cd6dSmrg  *)
725db17cd6dSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726db17cd6dSmrg  esac
72776910425Smrgfi
728db17cd6dSmrg# Use eval to expand $SHELL
729db17cd6dSmrgif eval "$MISSING --run true"; then
730db17cd6dSmrg  am_missing_run="$MISSING --run "
731db17cd6dSmrgelse
732db17cd6dSmrg  am_missing_run=
733db17cd6dSmrg  AC_MSG_WARN([`missing' script is too old or missing])
73476910425Smrgfi
735db17cd6dSmrg])
73676910425Smrg
737db17cd6dSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
738db17cd6dSmrg#
739db17cd6dSmrg# This file is free software; the Free Software Foundation
740db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
741db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
74276910425Smrg
743db17cd6dSmrg# AM_PROG_MKDIR_P
744db17cd6dSmrg# ---------------
745db17cd6dSmrg# Check for `mkdir -p'.
746db17cd6dSmrgAC_DEFUN([AM_PROG_MKDIR_P],
747db17cd6dSmrg[AC_PREREQ([2.60])dnl
748db17cd6dSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
749db17cd6dSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
750db17cd6dSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
751db17cd6dSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
752db17cd6dSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
753db17cd6dSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
754db17cd6dSmrgdnl adjustment using top_builddir (which is defined more often than
755db17cd6dSmrgdnl MKDIR_P).
756db17cd6dSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
757db17cd6dSmrgcase $mkdir_p in
758db17cd6dSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
759db17cd6dSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
760db17cd6dSmrgesac
761db17cd6dSmrg])
76276910425Smrg
763db17cd6dSmrg# Helper functions for option handling.                     -*- Autoconf -*-
764db17cd6dSmrg
765db17cd6dSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
766db17cd6dSmrg#
767db17cd6dSmrg# This file is free software; the Free Software Foundation
768db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
769db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
770db17cd6dSmrg
771db17cd6dSmrg# serial 4
772db17cd6dSmrg
773db17cd6dSmrg# _AM_MANGLE_OPTION(NAME)
774db17cd6dSmrg# -----------------------
775db17cd6dSmrgAC_DEFUN([_AM_MANGLE_OPTION],
776db17cd6dSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
777db17cd6dSmrg
778db17cd6dSmrg# _AM_SET_OPTION(NAME)
779db17cd6dSmrg# ------------------------------
780db17cd6dSmrg# Set option NAME.  Presently that only means defining a flag for this option.
781db17cd6dSmrgAC_DEFUN([_AM_SET_OPTION],
782db17cd6dSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
783db17cd6dSmrg
784db17cd6dSmrg# _AM_SET_OPTIONS(OPTIONS)
785db17cd6dSmrg# ----------------------------------
786db17cd6dSmrg# OPTIONS is a space-separated list of Automake options.
787db17cd6dSmrgAC_DEFUN([_AM_SET_OPTIONS],
788db17cd6dSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
78976910425Smrg
790db17cd6dSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
791db17cd6dSmrg# -------------------------------------------
792db17cd6dSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
793db17cd6dSmrgAC_DEFUN([_AM_IF_OPTION],
794db17cd6dSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
79576910425Smrg
796db17cd6dSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
79776910425Smrg
798db17cd6dSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
799db17cd6dSmrg# Free Software Foundation, Inc.
800db17cd6dSmrg#
801db17cd6dSmrg# This file is free software; the Free Software Foundation
802db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
803db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
80476910425Smrg
805db17cd6dSmrg# serial 5
80676910425Smrg
807db17cd6dSmrg# AM_SANITY_CHECK
808db17cd6dSmrg# ---------------
809db17cd6dSmrgAC_DEFUN([AM_SANITY_CHECK],
810db17cd6dSmrg[AC_MSG_CHECKING([whether build environment is sane])
811db17cd6dSmrg# Just in case
812db17cd6dSmrgsleep 1
813db17cd6dSmrgecho timestamp > conftest.file
814db17cd6dSmrg# Reject unsafe characters in $srcdir or the absolute working directory
815db17cd6dSmrg# name.  Accept space and tab only in the latter.
816db17cd6dSmrgam_lf='
817db17cd6dSmrg'
818db17cd6dSmrgcase `pwd` in
819db17cd6dSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
820db17cd6dSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
821db17cd6dSmrgesac
822db17cd6dSmrgcase $srcdir in
823db17cd6dSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
824db17cd6dSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
825db17cd6dSmrgesac
82676910425Smrg
827db17cd6dSmrg# Do `set' in a subshell so we don't clobber the current shell's
828db17cd6dSmrg# arguments.  Must try -L first in case configure is actually a
829db17cd6dSmrg# symlink; some systems play weird games with the mod time of symlinks
830db17cd6dSmrg# (eg FreeBSD returns the mod time of the symlink's containing
831db17cd6dSmrg# directory).
832db17cd6dSmrgif (
833db17cd6dSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
834db17cd6dSmrg   if test "$[*]" = "X"; then
835db17cd6dSmrg      # -L didn't work.
836db17cd6dSmrg      set X `ls -t "$srcdir/configure" conftest.file`
837db17cd6dSmrg   fi
838db17cd6dSmrg   rm -f conftest.file
839db17cd6dSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
840db17cd6dSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
84176910425Smrg
842db17cd6dSmrg      # If neither matched, then we have a broken ls.  This can happen
843db17cd6dSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
844db17cd6dSmrg      # broken ls alias from the environment.  This has actually
845db17cd6dSmrg      # happened.  Such a system could not be considered "sane".
846db17cd6dSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
847db17cd6dSmrgalias in your environment])
848db17cd6dSmrg   fi
849db17cd6dSmrg
850db17cd6dSmrg   test "$[2]" = conftest.file
851db17cd6dSmrg   )
852db17cd6dSmrgthen
853db17cd6dSmrg   # Ok.
854db17cd6dSmrg   :
85576910425Smrgelse
856db17cd6dSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
857db17cd6dSmrgCheck your system clock])
85876910425Smrgfi
859db17cd6dSmrgAC_MSG_RESULT(yes)])
86076910425Smrg
861db17cd6dSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
862db17cd6dSmrg#
863db17cd6dSmrg# This file is free software; the Free Software Foundation
864db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
865db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
86676910425Smrg
867db17cd6dSmrg# serial 1
868db17cd6dSmrg
869db17cd6dSmrg# AM_SILENT_RULES([DEFAULT])
870db17cd6dSmrg# --------------------------
871db17cd6dSmrg# Enable less verbose build rules; with the default set to DEFAULT
872db17cd6dSmrg# (`yes' being less verbose, `no' or empty being verbose).
873db17cd6dSmrgAC_DEFUN([AM_SILENT_RULES],
874db17cd6dSmrg[AC_ARG_ENABLE([silent-rules],
875db17cd6dSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
876db17cd6dSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
877db17cd6dSmrgcase $enable_silent_rules in
878db17cd6dSmrgyes) AM_DEFAULT_VERBOSITY=0;;
879db17cd6dSmrgno)  AM_DEFAULT_VERBOSITY=1;;
880db17cd6dSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
881db17cd6dSmrgesac
882db17cd6dSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
883db17cd6dSmrgAM_BACKSLASH='\'
884db17cd6dSmrgAC_SUBST([AM_BACKSLASH])dnl
885db17cd6dSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
886db17cd6dSmrg])
88776910425Smrg
888db17cd6dSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
889db17cd6dSmrg#
890db17cd6dSmrg# This file is free software; the Free Software Foundation
891db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
892db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
89376910425Smrg
894db17cd6dSmrg# AM_PROG_INSTALL_STRIP
895db17cd6dSmrg# ---------------------
896db17cd6dSmrg# One issue with vendor `install' (even GNU) is that you can't
897db17cd6dSmrg# specify the program used to strip binaries.  This is especially
898db17cd6dSmrg# annoying in cross-compiling environments, where the build's strip
899db17cd6dSmrg# is unlikely to handle the host's binaries.
900db17cd6dSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
901db17cd6dSmrg# always use install-sh in `make install-strip', and initialize
902db17cd6dSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
903db17cd6dSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
904db17cd6dSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
905db17cd6dSmrg# Installed binaries are usually stripped using `strip' when the user
906db17cd6dSmrg# run `make install-strip'.  However `strip' might not be the right
907db17cd6dSmrg# tool to use in cross-compilation environments, therefore Automake
908db17cd6dSmrg# will honor the `STRIP' environment variable to overrule this program.
909db17cd6dSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
910db17cd6dSmrgif test "$cross_compiling" != no; then
911db17cd6dSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
91276910425Smrgfi
913db17cd6dSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
914db17cd6dSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
91576910425Smrg
916db17cd6dSmrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
917db17cd6dSmrg#
918db17cd6dSmrg# This file is free software; the Free Software Foundation
919db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
920db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
92176910425Smrg
922db17cd6dSmrg# serial 2
92376910425Smrg
924db17cd6dSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
925db17cd6dSmrg# ---------------------------
926db17cd6dSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
927db17cd6dSmrg# This macro is traced by Automake.
928db17cd6dSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
92976910425Smrg
930db17cd6dSmrg# AM_SUBST_NOTMAKE(VARIABLE)
931db17cd6dSmrg# ---------------------------
932db17cd6dSmrg# Public sister of _AM_SUBST_NOTMAKE.
933db17cd6dSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
93476910425Smrg
935db17cd6dSmrg# Check how to create a tarball.                            -*- Autoconf -*-
936db17cd6dSmrg
937db17cd6dSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
93876910425Smrg#
93976910425Smrg# This file is free software; the Free Software Foundation
94076910425Smrg# gives unlimited permission to copy and/or distribute it,
94176910425Smrg# with or without modifications, as long as this notice is preserved.
94276910425Smrg
943db17cd6dSmrg# serial 2
944db17cd6dSmrg
945db17cd6dSmrg# _AM_PROG_TAR(FORMAT)
946db17cd6dSmrg# --------------------
947db17cd6dSmrg# Check how to create a tarball in format FORMAT.
948db17cd6dSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
949db17cd6dSmrg#
950db17cd6dSmrg# Substitute a variable $(am__tar) that is a command
951db17cd6dSmrg# writing to stdout a FORMAT-tarball containing the directory
952db17cd6dSmrg# $tardir.
953db17cd6dSmrg#     tardir=directory && $(am__tar) > result.tar
954db17cd6dSmrg#
955db17cd6dSmrg# Substitute a variable $(am__untar) that extract such
956db17cd6dSmrg# a tarball read from stdin.
957db17cd6dSmrg#     $(am__untar) < result.tar
958db17cd6dSmrgAC_DEFUN([_AM_PROG_TAR],
959db17cd6dSmrg[# Always define AMTAR for backward compatibility.
960db17cd6dSmrgAM_MISSING_PROG([AMTAR], [tar])
961db17cd6dSmrgm4_if([$1], [v7],
962db17cd6dSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
963db17cd6dSmrg     [m4_case([$1], [ustar],, [pax],,
964db17cd6dSmrg              [m4_fatal([Unknown tar format])])
965db17cd6dSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
966db17cd6dSmrg# Loop over all known methods to create a tar archive until one works.
967db17cd6dSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
968db17cd6dSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
969db17cd6dSmrg# Do not fold the above two line into one, because Tru64 sh and
970db17cd6dSmrg# Solaris sh will not grok spaces in the rhs of `-'.
971db17cd6dSmrgfor _am_tool in $_am_tools
972db17cd6dSmrgdo
973db17cd6dSmrg  case $_am_tool in
974db17cd6dSmrg  gnutar)
975db17cd6dSmrg    for _am_tar in tar gnutar gtar;
976db17cd6dSmrg    do
977db17cd6dSmrg      AM_RUN_LOG([$_am_tar --version]) && break
978db17cd6dSmrg    done
979db17cd6dSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
980db17cd6dSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
981db17cd6dSmrg    am__untar="$_am_tar -xf -"
982db17cd6dSmrg    ;;
983db17cd6dSmrg  plaintar)
984db17cd6dSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
985db17cd6dSmrg    # ustar tarball either.
986db17cd6dSmrg    (tar --version) >/dev/null 2>&1 && continue
987db17cd6dSmrg    am__tar='tar chf - "$$tardir"'
988db17cd6dSmrg    am__tar_='tar chf - "$tardir"'
989db17cd6dSmrg    am__untar='tar xf -'
990db17cd6dSmrg    ;;
991db17cd6dSmrg  pax)
992db17cd6dSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
993db17cd6dSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
994db17cd6dSmrg    am__untar='pax -r'
995db17cd6dSmrg    ;;
996db17cd6dSmrg  cpio)
997db17cd6dSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
998db17cd6dSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
999db17cd6dSmrg    am__untar='cpio -i -H $1 -d'
1000db17cd6dSmrg    ;;
1001db17cd6dSmrg  none)
1002db17cd6dSmrg    am__tar=false
1003db17cd6dSmrg    am__tar_=false
1004db17cd6dSmrg    am__untar=false
1005db17cd6dSmrg    ;;
1006db17cd6dSmrg  esac
1007db17cd6dSmrg
1008db17cd6dSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
1009db17cd6dSmrg  # and am__untar set.
1010db17cd6dSmrg  test -n "${am_cv_prog_tar_$1}" && break
101176910425Smrg
1012db17cd6dSmrg  # tar/untar a dummy directory, and stop if the command works
1013db17cd6dSmrg  rm -rf conftest.dir
1014db17cd6dSmrg  mkdir conftest.dir
1015db17cd6dSmrg  echo GrepMe > conftest.dir/file
1016db17cd6dSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1017db17cd6dSmrg  rm -rf conftest.dir
1018db17cd6dSmrg  if test -s conftest.tar; then
1019db17cd6dSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
1020db17cd6dSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1021db17cd6dSmrg  fi
1022db17cd6dSmrgdone
1023db17cd6dSmrgrm -rf conftest.dir
102476910425Smrg
1025db17cd6dSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1026db17cd6dSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1027db17cd6dSmrgAC_SUBST([am__tar])
1028db17cd6dSmrgAC_SUBST([am__untar])
1029db17cd6dSmrg]) # _AM_PROG_TAR
103076910425Smrg
1031db17cd6dSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1032db17cd6dSmrgdnl
1033482df631Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1034db17cd6dSmrgdnl 
1035db17cd6dSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1036482df631Smrgdnl copy of this software and associated documentation files (the "Software"),
1037482df631Smrgdnl to deal in the Software without restriction, including without limitation
1038482df631Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1039482df631Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1040482df631Smrgdnl Software is furnished to do so, subject to the following conditions:
1041db17cd6dSmrgdnl
1042482df631Smrgdnl The above copyright notice and this permission notice (including the next
1043482df631Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1044482df631Smrgdnl Software.
1045db17cd6dSmrgdnl
1046482df631Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1047482df631Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1048482df631Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1049482df631Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1050482df631Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1051482df631Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1052482df631Smrgdnl DEALINGS IN THE SOFTWARE.
105376910425Smrg
1054db17cd6dSmrg# XORG_MACROS_VERSION(required-version)
1055db17cd6dSmrg# -------------------------------------
1056db17cd6dSmrg# Minimum version: 1.1.0
105776910425Smrg#
1058db17cd6dSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1059db17cd6dSmrg# your configure.ac with the minimum required version, such as:
1060db17cd6dSmrg# XORG_MACROS_VERSION(1.1)
106176910425Smrg#
1062db17cd6dSmrg# To ensure that this macro is defined, also add:
1063db17cd6dSmrg# m4_ifndef([XORG_MACROS_VERSION],
1064db17cd6dSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
106576910425Smrg#
106676910425Smrg#
1067db17cd6dSmrg# See the "minimum version" comment for each macro you use to see what 
1068db17cd6dSmrg# version you require.
1069db17cd6dSmrgm4_defun([XORG_MACROS_VERSION],[
1070482df631Smrgm4_define([vers_have], [1.11.0])
1071db17cd6dSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1072db17cd6dSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1073db17cd6dSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1074db17cd6dSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1075db17cd6dSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1076db17cd6dSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1077db17cd6dSmrgm4_undefine([vers_have])
1078db17cd6dSmrgm4_undefine([maj_have])
1079db17cd6dSmrgm4_undefine([maj_needed])
1080db17cd6dSmrg]) # XORG_MACROS_VERSION
108176910425Smrg
1082db17cd6dSmrg# XORG_PROG_RAWCPP()
1083db17cd6dSmrg# ------------------
1084db17cd6dSmrg# Minimum version: 1.0.0
108576910425Smrg#
1086db17cd6dSmrg# Find cpp program and necessary flags for use in pre-processing text files
1087db17cd6dSmrg# such as man pages and config files
1088db17cd6dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1089db17cd6dSmrgAC_REQUIRE([AC_PROG_CPP])
1090db17cd6dSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1091db17cd6dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
109276910425Smrg
1093db17cd6dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1094db17cd6dSmrg# which is not the best choice for supporting other OS'es, but covers most
1095db17cd6dSmrg# of the ones we need for now.
1096db17cd6dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1097db17cd6dSmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
1098db17cd6dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1099db17cd6dSmrg	AC_MSG_RESULT([no])
110076910425Smrgelse
1101db17cd6dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1102db17cd6dSmrg		RAWCPPFLAGS=-undef
1103db17cd6dSmrg		AC_MSG_RESULT([yes])
1104db17cd6dSmrg	# under Cygwin unix is still defined even with -undef
1105db17cd6dSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1106db17cd6dSmrg		RAWCPPFLAGS="-undef -ansi"
1107db17cd6dSmrg		AC_MSG_RESULT([yes, with -ansi])
1108db17cd6dSmrg	else
1109db17cd6dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1110db17cd6dSmrg	fi
111176910425Smrgfi
1112db17cd6dSmrgrm -f conftest.$ac_ext
111376910425Smrg
1114db17cd6dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1115db17cd6dSmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
1116db17cd6dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1117db17cd6dSmrg	AC_MSG_RESULT([no])
1118db17cd6dSmrgelse
1119db17cd6dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1120db17cd6dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1121db17cd6dSmrg		AC_MSG_RESULT([yes])
1122db17cd6dSmrg	else
1123db17cd6dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1124db17cd6dSmrg	fi
1125db17cd6dSmrgfi
1126db17cd6dSmrgrm -f conftest.$ac_ext
1127db17cd6dSmrgAC_SUBST(RAWCPPFLAGS)
1128db17cd6dSmrg]) # XORG_PROG_RAWCPP
112976910425Smrg
1130db17cd6dSmrg# XORG_MANPAGE_SECTIONS()
1131db17cd6dSmrg# -----------------------
1132db17cd6dSmrg# Minimum version: 1.0.0
113376910425Smrg#
1134db17cd6dSmrg# Determine which sections man pages go in for the different man page types
1135db17cd6dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1136db17cd6dSmrg# Not sure if there's any better way than just hardcoding by OS name.
1137db17cd6dSmrg# Override default settings by setting environment variables
1138482df631Smrg# Added MAN_SUBSTS in version 1.8
1139482df631Smrg# Added AC_PROG_SED in version 1.8
114076910425Smrg
1141db17cd6dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1142db17cd6dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1143482df631SmrgAC_REQUIRE([AC_PROG_SED])
114476910425Smrg
1145db17cd6dSmrgif test x$APP_MAN_SUFFIX = x    ; then
1146db17cd6dSmrg    APP_MAN_SUFFIX=1
1147db17cd6dSmrgfi
1148db17cd6dSmrgif test x$APP_MAN_DIR = x    ; then
1149db17cd6dSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1150db17cd6dSmrgfi
115176910425Smrg
1152db17cd6dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1153db17cd6dSmrg    LIB_MAN_SUFFIX=3
1154db17cd6dSmrgfi
1155db17cd6dSmrgif test x$LIB_MAN_DIR = x    ; then
1156db17cd6dSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
115776910425Smrgfi
115876910425Smrg
1159db17cd6dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1160db17cd6dSmrg    case $host_os in
1161db17cd6dSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1162db17cd6dSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1163db17cd6dSmrg    esac
1164db17cd6dSmrgfi
1165db17cd6dSmrgif test x$FILE_MAN_DIR = x    ; then
1166db17cd6dSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1167db17cd6dSmrgfi
116876910425Smrg
1169db17cd6dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1170db17cd6dSmrg    case $host_os in
1171db17cd6dSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1172db17cd6dSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1173db17cd6dSmrg    esac
1174db17cd6dSmrgfi
1175db17cd6dSmrgif test x$MISC_MAN_DIR = x    ; then
1176db17cd6dSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1177db17cd6dSmrgfi
117876910425Smrg
1179db17cd6dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1180db17cd6dSmrg    case $host_os in
1181db17cd6dSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1182db17cd6dSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1183db17cd6dSmrg    esac
1184db17cd6dSmrgfi
1185db17cd6dSmrgif test x$DRIVER_MAN_DIR = x    ; then
1186db17cd6dSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1187db17cd6dSmrgfi
118876910425Smrg
1189db17cd6dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1190db17cd6dSmrg    case $host_os in
1191db17cd6dSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1192db17cd6dSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1193db17cd6dSmrg    esac
1194db17cd6dSmrgfi
1195db17cd6dSmrgif test x$ADMIN_MAN_DIR = x    ; then
1196db17cd6dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
119776910425Smrgfi
119876910425Smrg
119976910425Smrg
1200db17cd6dSmrgAC_SUBST([APP_MAN_SUFFIX])
1201db17cd6dSmrgAC_SUBST([LIB_MAN_SUFFIX])
1202db17cd6dSmrgAC_SUBST([FILE_MAN_SUFFIX])
1203db17cd6dSmrgAC_SUBST([MISC_MAN_SUFFIX])
1204db17cd6dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1205db17cd6dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1206db17cd6dSmrgAC_SUBST([APP_MAN_DIR])
1207db17cd6dSmrgAC_SUBST([LIB_MAN_DIR])
1208db17cd6dSmrgAC_SUBST([FILE_MAN_DIR])
1209db17cd6dSmrgAC_SUBST([MISC_MAN_DIR])
1210db17cd6dSmrgAC_SUBST([DRIVER_MAN_DIR])
1211db17cd6dSmrgAC_SUBST([ADMIN_MAN_DIR])
1212482df631Smrg
1213482df631SmrgXORG_MAN_PAGE="X Version 11"
1214482df631SmrgAC_SUBST([XORG_MAN_PAGE])
1215482df631SmrgMAN_SUBSTS="\
1216482df631Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1217482df631Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1218482df631Smrg	-e 's|__xservername__|Xorg|g' \
1219482df631Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1220482df631Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1221482df631Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1222482df631Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1223482df631Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1224482df631Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1225482df631Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1226482df631Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1227482df631Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1228482df631SmrgAC_SUBST([MAN_SUBSTS])
1229482df631Smrg
1230db17cd6dSmrg]) # XORG_MANPAGE_SECTIONS
1231db17cd6dSmrg
1232482df631Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1233482df631Smrg# ------------------------
1234482df631Smrg# Minimum version: 1.7.0
1235482df631Smrg#
1236482df631Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1237482df631Smrg# provided by xorg-sgml-doctools, if installed.
1238482df631SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1239482df631SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1240482df631SmrgXORG_SGML_PATH=
1241482df631SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1242482df631Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1243482df631Smrg    [m4_ifval([$1],[:],
1244482df631Smrg        [if test x"$cross_compiling" != x"yes" ; then
1245482df631Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1246482df631Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1247482df631Smrg         fi])
1248482df631Smrg    ])
1249482df631Smrg
1250482df631Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1251482df631Smrg# the path and the name of the doc stylesheet
1252482df631Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1253482df631Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1254482df631Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1255482df631Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1256482df631Smrgelse
1257482df631Smrg   AC_MSG_RESULT([no])
1258482df631Smrgfi
1259482df631Smrg
1260482df631SmrgAC_SUBST(XORG_SGML_PATH)
1261482df631SmrgAC_SUBST(STYLESHEET_SRCDIR)
1262482df631SmrgAC_SUBST(XSL_STYLESHEET)
1263482df631SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1264482df631Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1265482df631Smrg
1266db17cd6dSmrg# XORG_CHECK_LINUXDOC
1267db17cd6dSmrg# -------------------
1268db17cd6dSmrg# Minimum version: 1.0.0
126976910425Smrg#
1270db17cd6dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1271db17cd6dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1272db17cd6dSmrg# Whether or not the necessary tools and files are found can be checked
1273db17cd6dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1274db17cd6dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1275482df631SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1276482df631SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
127776910425Smrg
1278db17cd6dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
127976910425Smrg
1280482df631SmrgAC_MSG_CHECKING([whether to build documentation])
128176910425Smrg
1282482df631Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1283db17cd6dSmrg   BUILDDOC=yes
1284db17cd6dSmrgelse
1285db17cd6dSmrg   BUILDDOC=no
1286db17cd6dSmrgfi
128776910425Smrg
1288db17cd6dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
128976910425Smrg
1290db17cd6dSmrgAC_MSG_RESULT([$BUILDDOC])
129176910425Smrg
1292482df631SmrgAC_MSG_CHECKING([whether to build pdf documentation])
129376910425Smrg
1294482df631Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1295db17cd6dSmrg   BUILDPDFDOC=yes
1296db17cd6dSmrgelse
1297db17cd6dSmrg   BUILDPDFDOC=no
1298db17cd6dSmrgfi
129976910425Smrg
1300db17cd6dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
130176910425Smrg
1302db17cd6dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
130376910425Smrg
1304482df631SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1305db17cd6dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1306db17cd6dSmrgMAKE_PDF="$PS2PDF"
1307db17cd6dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
130876910425Smrg
1309db17cd6dSmrgAC_SUBST(MAKE_TEXT)
1310db17cd6dSmrgAC_SUBST(MAKE_PS)
1311db17cd6dSmrgAC_SUBST(MAKE_PDF)
1312db17cd6dSmrgAC_SUBST(MAKE_HTML)
1313db17cd6dSmrg]) # XORG_CHECK_LINUXDOC
1314db17cd6dSmrg
1315db17cd6dSmrg# XORG_CHECK_DOCBOOK
1316db17cd6dSmrg# -------------------
1317db17cd6dSmrg# Minimum version: 1.0.0
1318db17cd6dSmrg#
1319db17cd6dSmrg# Checks for the ability to build output formats from SGML DocBook source.
1320db17cd6dSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1321db17cd6dSmrg# indicates whether the necessary tools and files are found and, if set,
1322db17cd6dSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1323db17cd6dSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1324482df631SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1325482df631Smrg
1326db17cd6dSmrgBUILDTXTDOC=no
1327db17cd6dSmrgBUILDPDFDOC=no
1328db17cd6dSmrgBUILDPSDOC=no
1329db17cd6dSmrgBUILDHTMLDOC=no
1330db17cd6dSmrg
1331db17cd6dSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1332db17cd6dSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1333db17cd6dSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1334db17cd6dSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1335db17cd6dSmrg
1336482df631SmrgAC_MSG_CHECKING([whether to build text documentation])
1337482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1338db17cd6dSmrg   test x$BUILD_TXTDOC != xno; then
1339db17cd6dSmrg	BUILDTXTDOC=yes
1340db17cd6dSmrgfi
1341db17cd6dSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1342db17cd6dSmrgAC_MSG_RESULT([$BUILDTXTDOC])
134376910425Smrg
1344482df631SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1345482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1346db17cd6dSmrg   test x$BUILD_PDFDOC != xno; then
1347db17cd6dSmrg	BUILDPDFDOC=yes
134876910425Smrgfi
1349db17cd6dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1350db17cd6dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
135176910425Smrg
1352482df631SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1353482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1354db17cd6dSmrg   test x$BUILD_PSDOC != xno; then
1355db17cd6dSmrg	BUILDPSDOC=yes
1356db17cd6dSmrgfi
1357db17cd6dSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1358db17cd6dSmrgAC_MSG_RESULT([$BUILDPSDOC])
135976910425Smrg
1360482df631SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1361482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1362db17cd6dSmrg   test x$BUILD_HTMLDOC != xno; then
1363db17cd6dSmrg	BUILDHTMLDOC=yes
1364db17cd6dSmrgfi
1365db17cd6dSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1366db17cd6dSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
136776910425Smrg
1368db17cd6dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1369db17cd6dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1370db17cd6dSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1371db17cd6dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
137276910425Smrg
1373db17cd6dSmrgAC_SUBST(MAKE_TEXT)
1374db17cd6dSmrgAC_SUBST(MAKE_PS)
1375db17cd6dSmrgAC_SUBST(MAKE_PDF)
1376db17cd6dSmrgAC_SUBST(MAKE_HTML)
1377db17cd6dSmrg]) # XORG_CHECK_DOCBOOK
137876910425Smrg
1379482df631Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1380482df631Smrg# ----------------
1381482df631Smrg# Minimum version: 1.5.0
1382482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1383482df631Smrg#
1384482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1385482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1386482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1387482df631Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1388482df631Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1389482df631Smrg# --with-xmlto assumes 'auto'.
1390482df631Smrg#
1391482df631Smrg# Interface to module:
1392482df631Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1393482df631Smrg# XMLTO:	returns the path of the xmlto program found
1394482df631Smrg#		returns the path set by the user in the environment
1395482df631Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1396482df631Smrg#		'no' user instructs the module not to use xmlto
1397482df631Smrg#
1398482df631Smrg# Added in version 1.10.0
1399482df631Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1400482df631Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1401482df631Smrg#
1402482df631Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1403482df631Smrg#
1404482df631SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1405482df631SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1406482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
1407482df631SmrgAC_ARG_WITH(xmlto,
1408482df631Smrg	AS_HELP_STRING([--with-xmlto],
1409482df631Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1410482df631Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1411482df631Smrgm4_undefine([_defopt])
1412482df631Smrg
1413482df631Smrgif test "x$use_xmlto" = x"auto"; then
1414482df631Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1415482df631Smrg   if test "x$XMLTO" = "x"; then
1416482df631Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1417482df631Smrg	have_xmlto=no
1418482df631Smrg   else
1419482df631Smrg        have_xmlto=yes
1420482df631Smrg   fi
1421482df631Smrgelif test "x$use_xmlto" = x"yes" ; then
1422482df631Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1423482df631Smrg   if test "x$XMLTO" = "x"; then
1424482df631Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1425482df631Smrg   fi
1426482df631Smrg   have_xmlto=yes
1427482df631Smrgelif test "x$use_xmlto" = x"no" ; then
1428482df631Smrg   if test "x$XMLTO" != "x"; then
1429482df631Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1430482df631Smrg   fi
1431482df631Smrg   have_xmlto=no
1432482df631Smrgelse
1433482df631Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1434482df631Smrgfi
1435482df631Smrg
1436482df631Smrg# Test for a minimum version of xmlto, if provided.
1437482df631Smrgm4_ifval([$1],
1438482df631Smrg[if test "$have_xmlto" = yes; then
1439482df631Smrg    # scrape the xmlto version
1440482df631Smrg    AC_MSG_CHECKING([the xmlto version])
1441482df631Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1442482df631Smrg    AC_MSG_RESULT([$xmlto_version])
1443482df631Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1444482df631Smrg        [if test "x$use_xmlto" = xauto; then
1445482df631Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1446482df631Smrg            have_xmlto=no
1447482df631Smrg        else
1448482df631Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1449482df631Smrg        fi])
1450482df631Smrgfi])
1451482df631Smrg
1452482df631Smrg# Test for the ability of xmlto to generate a text target
1453482df631Smrghave_xmlto_text=no
1454482df631Smrgcat > conftest.xml << "EOF"
1455482df631SmrgEOF
1456482df631SmrgAS_IF([test "$have_xmlto" = yes],
1457482df631Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1458482df631Smrg             [have_xmlto_text=yes],
1459482df631Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1460482df631Smrgrm -f conftest.xml
1461482df631SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1462482df631SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1463482df631Smrg]) # XORG_WITH_XMLTO
1464482df631Smrg
1465482df631Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1466482df631Smrg# ----------------
1467482df631Smrg# Minimum version: 1.5.0
1468482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1469482df631Smrg#
1470482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1471482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1472482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1473482df631Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1474482df631Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1475482df631Smrg# --with-asciidoc assumes 'auto'.
1476482df631Smrg#
1477482df631Smrg# Interface to module:
1478482df631Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1479482df631Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1480482df631Smrg#		 returns the path set by the user in the environment
1481482df631Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1482482df631Smrg#		  'no' user instructs the module not to use asciidoc
1483482df631Smrg#
1484482df631Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1485482df631Smrg#
1486482df631SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1487482df631SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1488482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
1489482df631SmrgAC_ARG_WITH(asciidoc,
1490482df631Smrg	AS_HELP_STRING([--with-asciidoc],
1491482df631Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1492482df631Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1493482df631Smrgm4_undefine([_defopt])
1494482df631Smrg
1495482df631Smrgif test "x$use_asciidoc" = x"auto"; then
1496482df631Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1497482df631Smrg   if test "x$ASCIIDOC" = "x"; then
1498482df631Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1499482df631Smrg	have_asciidoc=no
1500482df631Smrg   else
1501482df631Smrg        have_asciidoc=yes
1502482df631Smrg   fi
1503482df631Smrgelif test "x$use_asciidoc" = x"yes" ; then
1504482df631Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1505482df631Smrg   if test "x$ASCIIDOC" = "x"; then
1506482df631Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1507482df631Smrg   fi
1508482df631Smrg   have_asciidoc=yes
1509482df631Smrgelif test "x$use_asciidoc" = x"no" ; then
1510482df631Smrg   if test "x$ASCIIDOC" != "x"; then
1511482df631Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1512482df631Smrg   fi
1513482df631Smrg   have_asciidoc=no
1514482df631Smrgelse
1515482df631Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1516482df631Smrgfi
1517482df631Smrgm4_ifval([$1],
1518482df631Smrg[if test "$have_asciidoc" = yes; then
1519482df631Smrg    # scrape the asciidoc version
1520482df631Smrg    AC_MSG_CHECKING([the asciidoc version])
1521482df631Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1522482df631Smrg    AC_MSG_RESULT([$asciidoc_version])
1523482df631Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1524482df631Smrg        [if test "x$use_asciidoc" = xauto; then
1525482df631Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1526482df631Smrg            have_asciidoc=no
1527482df631Smrg        else
1528482df631Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1529482df631Smrg        fi])
1530482df631Smrgfi])
1531482df631SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1532482df631Smrg]) # XORG_WITH_ASCIIDOC
1533482df631Smrg
1534482df631Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1535482df631Smrg# --------------------------------
1536482df631Smrg# Minimum version: 1.5.0
1537482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1538482df631Smrg#
1539482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1540482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1541482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1542482df631Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1543482df631Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1544482df631Smrg# --with-doxygen assumes 'auto'.
1545482df631Smrg#
1546482df631Smrg# Interface to module:
1547482df631Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1548482df631Smrg# DOXYGEN:	 returns the path of the doxygen program found
1549482df631Smrg#		 returns the path set by the user in the environment
1550482df631Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1551482df631Smrg#		  'no' user instructs the module not to use doxygen
1552482df631Smrg#
1553482df631Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1554482df631Smrg#
1555482df631SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1556482df631SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1557482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
1558482df631SmrgAC_ARG_WITH(doxygen,
1559482df631Smrg	AS_HELP_STRING([--with-doxygen],
1560482df631Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1561482df631Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1562482df631Smrgm4_undefine([_defopt])
1563482df631Smrg
1564482df631Smrgif test "x$use_doxygen" = x"auto"; then
1565482df631Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1566482df631Smrg   if test "x$DOXYGEN" = "x"; then
1567482df631Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1568482df631Smrg	have_doxygen=no
1569482df631Smrg   else
1570482df631Smrg        have_doxygen=yes
1571482df631Smrg   fi
1572482df631Smrgelif test "x$use_doxygen" = x"yes" ; then
1573482df631Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1574482df631Smrg   if test "x$DOXYGEN" = "x"; then
1575482df631Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1576482df631Smrg   fi
1577482df631Smrg   have_doxygen=yes
1578482df631Smrgelif test "x$use_doxygen" = x"no" ; then
1579482df631Smrg   if test "x$DOXYGEN" != "x"; then
1580482df631Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1581482df631Smrg   fi
1582482df631Smrg   have_doxygen=no
1583482df631Smrgelse
1584482df631Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1585482df631Smrgfi
1586482df631Smrgm4_ifval([$1],
1587482df631Smrg[if test "$have_doxygen" = yes; then
1588482df631Smrg    # scrape the doxygen version
1589482df631Smrg    AC_MSG_CHECKING([the doxygen version])
1590482df631Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1591482df631Smrg    AC_MSG_RESULT([$doxygen_version])
1592482df631Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1593482df631Smrg        [if test "x$use_doxygen" = xauto; then
1594482df631Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1595482df631Smrg            have_doxygen=no
1596482df631Smrg        else
1597482df631Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1598482df631Smrg        fi])
1599482df631Smrgfi])
1600482df631SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1601482df631Smrg]) # XORG_WITH_DOXYGEN
1602482df631Smrg
1603482df631Smrg# XORG_WITH_GROFF([DEFAULT])
1604482df631Smrg# ----------------
1605482df631Smrg# Minimum version: 1.6.0
1606482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1607482df631Smrg#
1608482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1609482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1610482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1611482df631Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1612482df631Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1613482df631Smrg# --with-groff assumes 'auto'.
1614482df631Smrg#
1615482df631Smrg# Interface to module:
1616482df631Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1617482df631Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1618482df631Smrg# HAVE_GROFF_MS: the -ms macros package
1619482df631Smrg# GROFF:	 returns the path of the groff program found
1620482df631Smrg#		 returns the path set by the user in the environment
1621482df631Smrg# --with-groff:	 'yes' user instructs the module to use groff
1622482df631Smrg#		 'no' user instructs the module not to use groff
1623482df631Smrg#
1624482df631Smrg# Added in version 1.9.0:
1625482df631Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1626482df631Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1627482df631Smrg#		   psselect from the psutils package.
1628482df631Smrg#		   the ghostcript package. Refer to the grohtml man pages
1629482df631Smrg#
1630482df631Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1631482df631Smrg#
1632482df631Smrg# OS and distros often splits groff in a basic and full package, the former
1633482df631Smrg# having the groff program and the later having devices, fonts and macros
1634482df631Smrg# Checking for the groff executable is not enough.
1635482df631Smrg#
1636482df631Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1637482df631Smrg# unset HAVE_GROFF or GROFF env variables.
1638482df631Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1639482df631Smrg#
1640482df631SmrgAC_DEFUN([XORG_WITH_GROFF],[
1641482df631SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1642482df631Smrgm4_define([_defopt], m4_default([$1], [auto]))
1643482df631SmrgAC_ARG_WITH(groff,
1644482df631Smrg	AS_HELP_STRING([--with-groff],
1645482df631Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1646482df631Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1647482df631Smrgm4_undefine([_defopt])
1648482df631Smrg
1649482df631Smrgif test "x$use_groff" = x"auto"; then
1650482df631Smrg   AC_PATH_PROG([GROFF], [groff])
1651482df631Smrg   if test "x$GROFF" = "x"; then
1652482df631Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1653482df631Smrg	have_groff=no
1654482df631Smrg   else
1655482df631Smrg        have_groff=yes
1656482df631Smrg   fi
1657482df631Smrgelif test "x$use_groff" = x"yes" ; then
1658482df631Smrg   AC_PATH_PROG([GROFF], [groff])
1659482df631Smrg   if test "x$GROFF" = "x"; then
1660482df631Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1661482df631Smrg   fi
1662482df631Smrg   have_groff=yes
1663482df631Smrgelif test "x$use_groff" = x"no" ; then
1664482df631Smrg   if test "x$GROFF" != "x"; then
1665482df631Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1666482df631Smrg   fi
1667482df631Smrg   have_groff=no
1668482df631Smrgelse
1669482df631Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1670482df631Smrgfi
1671482df631Smrg
1672482df631Smrg# We have groff, test for the presence of the macro packages
1673482df631Smrgif test "x$have_groff" = x"yes"; then
1674482df631Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1675482df631Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1676482df631Smrg        groff_ms_works=yes
1677482df631Smrg    else
1678482df631Smrg        groff_ms_works=no
1679482df631Smrg    fi
1680482df631Smrg    AC_MSG_RESULT([$groff_ms_works])
1681482df631Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1682482df631Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1683482df631Smrg        groff_mm_works=yes
1684482df631Smrg    else
1685482df631Smrg        groff_mm_works=no
1686482df631Smrg    fi
1687482df631Smrg    AC_MSG_RESULT([$groff_mm_works])
1688482df631Smrgfi
1689482df631Smrg
1690482df631Smrg# We have groff, test for HTML dependencies, one command per package
1691482df631Smrgif test "x$have_groff" = x"yes"; then
1692482df631Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1693482df631Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1694482df631Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1695482df631Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1696482df631Smrg      have_groff_html=yes
1697482df631Smrg   else
1698482df631Smrg      have_groff_html=no
1699482df631Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1700482df631Smrg   fi
1701482df631Smrgfi
1702482df631Smrg
1703482df631Smrg# Set Automake conditionals for Makefiles
1704482df631SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1705482df631SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1706482df631SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1707482df631SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1708482df631Smrg]) # XORG_WITH_GROFF
1709482df631Smrg
1710482df631Smrg# XORG_WITH_FOP([DEFAULT])
1711482df631Smrg# ----------------
1712482df631Smrg# Minimum version: 1.6.0
1713482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1714482df631Smrg#
1715482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1716482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1717482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1718482df631Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
1719482df631Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
1720482df631Smrg# --with-fop assumes 'auto'.
1721482df631Smrg#
1722482df631Smrg# Interface to module:
1723482df631Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1724482df631Smrg# FOP:	 	returns the path of the fop program found
1725482df631Smrg#		returns the path set by the user in the environment
1726482df631Smrg# --with-fop: 	'yes' user instructs the module to use fop
1727482df631Smrg#		'no' user instructs the module not to use fop
1728482df631Smrg#
1729482df631Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1730482df631Smrg#
1731482df631SmrgAC_DEFUN([XORG_WITH_FOP],[
1732482df631SmrgAC_ARG_VAR([FOP], [Path to fop command])
1733482df631Smrgm4_define([_defopt], m4_default([$1], [auto]))
1734482df631SmrgAC_ARG_WITH(fop,
1735482df631Smrg	AS_HELP_STRING([--with-fop],
1736482df631Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1737482df631Smrg	   [use_fop=$withval], [use_fop=]_defopt)
1738482df631Smrgm4_undefine([_defopt])
1739482df631Smrg
1740482df631Smrgif test "x$use_fop" = x"auto"; then
1741482df631Smrg   AC_PATH_PROG([FOP], [fop])
1742482df631Smrg   if test "x$FOP" = "x"; then
1743482df631Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1744482df631Smrg	have_fop=no
1745482df631Smrg   else
1746482df631Smrg        have_fop=yes
1747482df631Smrg   fi
1748482df631Smrgelif test "x$use_fop" = x"yes" ; then
1749482df631Smrg   AC_PATH_PROG([FOP], [fop])
1750482df631Smrg   if test "x$FOP" = "x"; then
1751482df631Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1752482df631Smrg   fi
1753482df631Smrg   have_fop=yes
1754482df631Smrgelif test "x$use_fop" = x"no" ; then
1755482df631Smrg   if test "x$FOP" != "x"; then
1756482df631Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1757482df631Smrg   fi
1758482df631Smrg   have_fop=no
1759482df631Smrgelse
1760482df631Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1761482df631Smrgfi
1762482df631SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1763482df631Smrg]) # XORG_WITH_FOP
1764482df631Smrg
1765482df631Smrg# XORG_WITH_PS2PDF([DEFAULT])
1766482df631Smrg# ----------------
1767482df631Smrg# Minimum version: 1.6.0
1768482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1769482df631Smrg#
1770482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1771482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1772482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1773482df631Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1774482df631Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1775482df631Smrg# --with-ps2pdf assumes 'auto'.
1776482df631Smrg#
1777482df631Smrg# Interface to module:
1778482df631Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1779482df631Smrg# PS2PDF:	returns the path of the ps2pdf program found
1780482df631Smrg#		returns the path set by the user in the environment
1781482df631Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1782482df631Smrg#		 'no' user instructs the module not to use ps2pdf
1783482df631Smrg#
1784482df631Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1785482df631Smrg#
1786482df631SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1787482df631SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1788482df631Smrgm4_define([_defopt], m4_default([$1], [auto]))
1789482df631SmrgAC_ARG_WITH(ps2pdf,
1790482df631Smrg	AS_HELP_STRING([--with-ps2pdf],
1791482df631Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1792482df631Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1793482df631Smrgm4_undefine([_defopt])
1794482df631Smrg
1795482df631Smrgif test "x$use_ps2pdf" = x"auto"; then
1796482df631Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1797482df631Smrg   if test "x$PS2PDF" = "x"; then
1798482df631Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1799482df631Smrg	have_ps2pdf=no
1800482df631Smrg   else
1801482df631Smrg        have_ps2pdf=yes
1802482df631Smrg   fi
1803482df631Smrgelif test "x$use_ps2pdf" = x"yes" ; then
1804482df631Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1805482df631Smrg   if test "x$PS2PDF" = "x"; then
1806482df631Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1807482df631Smrg   fi
1808482df631Smrg   have_ps2pdf=yes
1809482df631Smrgelif test "x$use_ps2pdf" = x"no" ; then
1810482df631Smrg   if test "x$PS2PDF" != "x"; then
1811482df631Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1812482df631Smrg   fi
1813482df631Smrg   have_ps2pdf=no
1814482df631Smrgelse
1815482df631Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1816482df631Smrgfi
1817482df631SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1818482df631Smrg]) # XORG_WITH_PS2PDF
1819482df631Smrg
1820482df631Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
1821482df631Smrg# ----------------
1822482df631Smrg# Minimum version: 1.6.0
1823482df631Smrg#
1824482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1825482df631Smrg# not at the appropriate level. This macro enables a builder to skip all
1826482df631Smrg# documentation targets except traditional man pages.
1827482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1828482df631Smrg# maximum flexibilty in controlling documentation building.
1829482df631Smrg# Refer to:
1830482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
1831482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1832482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1833482df631Smrg# XORG_WITH_FOP           --with-fop
1834482df631Smrg# XORG_WITH_GROFF         --with-groff
1835482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1836482df631Smrg#
1837482df631Smrg# Interface to module:
1838482df631Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1839482df631Smrg# --enable-docs: 'yes' user instructs the module to generate docs
1840482df631Smrg#		 'no' user instructs the module not to generate docs
1841482df631Smrg# parm1:	specify the default value, yes or no.
1842482df631Smrg#
1843482df631SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1844482df631Smrgm4_define([default], m4_default([$1], [yes]))
1845482df631SmrgAC_ARG_ENABLE(docs,
1846482df631Smrg	AS_HELP_STRING([--enable-docs],
1847482df631Smrg	   [Enable building the documentation (default: ]default[)]),
1848482df631Smrg	   [build_docs=$enableval], [build_docs=]default)
1849482df631Smrgm4_undefine([default])
1850482df631SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1851482df631SmrgAC_MSG_CHECKING([whether to build documentation])
1852482df631SmrgAC_MSG_RESULT([$build_docs])
1853482df631Smrg]) # XORG_ENABLE_DOCS
1854482df631Smrg
1855482df631Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1856482df631Smrg# ----------------
1857482df631Smrg# Minimum version: 1.6.0
1858482df631Smrg#
1859482df631Smrg# This macro enables a builder to skip all developer documentation.
1860482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1861482df631Smrg# maximum flexibilty in controlling documentation building.
1862482df631Smrg# Refer to:
1863482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
1864482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1865482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1866482df631Smrg# XORG_WITH_FOP           --with-fop
1867482df631Smrg# XORG_WITH_GROFF         --with-groff
1868482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1869482df631Smrg#
1870482df631Smrg# Interface to module:
1871482df631Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1872482df631Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1873482df631Smrg#			'no' user instructs the module not to generate developer docs
1874482df631Smrg# parm1:		specify the default value, yes or no.
1875482df631Smrg#
1876482df631SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1877482df631Smrgm4_define([devel_default], m4_default([$1], [yes]))
1878482df631SmrgAC_ARG_ENABLE(devel-docs,
1879482df631Smrg	AS_HELP_STRING([--enable-devel-docs],
1880482df631Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1881482df631Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1882482df631Smrgm4_undefine([devel_default])
1883482df631SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1884482df631SmrgAC_MSG_CHECKING([whether to build developer documentation])
1885482df631SmrgAC_MSG_RESULT([$build_devel_docs])
1886482df631Smrg]) # XORG_ENABLE_DEVEL_DOCS
1887482df631Smrg
1888482df631Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
1889482df631Smrg# ----------------
1890482df631Smrg# Minimum version: 1.6.0
1891482df631Smrg#
1892482df631Smrg# This macro enables a builder to skip all functional specification targets.
1893482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1894482df631Smrg# maximum flexibilty in controlling documentation building.
1895482df631Smrg# Refer to:
1896482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
1897482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1898482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1899482df631Smrg# XORG_WITH_FOP           --with-fop
1900482df631Smrg# XORG_WITH_GROFF         --with-groff
1901482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1902482df631Smrg#
1903482df631Smrg# Interface to module:
1904482df631Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1905482df631Smrg# --enable-specs:	'yes' user instructs the module to generate specs
1906482df631Smrg#			'no' user instructs the module not to generate specs
1907482df631Smrg# parm1:		specify the default value, yes or no.
1908482df631Smrg#
1909482df631SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1910482df631Smrgm4_define([spec_default], m4_default([$1], [yes]))
1911482df631SmrgAC_ARG_ENABLE(specs,
1912482df631Smrg	AS_HELP_STRING([--enable-specs],
1913482df631Smrg	   [Enable building the specs (default: ]spec_default[)]),
1914482df631Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
1915482df631Smrgm4_undefine([spec_default])
1916482df631SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1917482df631SmrgAC_MSG_CHECKING([whether to build functional specifications])
1918482df631SmrgAC_MSG_RESULT([$build_specs])
1919482df631Smrg]) # XORG_ENABLE_SPECS
1920482df631Smrg
1921db17cd6dSmrg# XORG_CHECK_MALLOC_ZERO
1922db17cd6dSmrg# ----------------------
1923db17cd6dSmrg# Minimum version: 1.0.0
1924db17cd6dSmrg#
1925db17cd6dSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1926db17cd6dSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1927db17cd6dSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1928db17cd6dSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1929db17cd6dSmrgAC_ARG_ENABLE(malloc0returnsnull,
1930db17cd6dSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1931db17cd6dSmrg		       [malloc(0) returns NULL (default: auto)]),
1932db17cd6dSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1933db17cd6dSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
193476910425Smrg
1935db17cd6dSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1936db17cd6dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1937db17cd6dSmrg	AC_RUN_IFELSE([
1938db17cd6dSmrgchar *malloc();
1939db17cd6dSmrgchar *realloc();
1940db17cd6dSmrgchar *calloc();
1941db17cd6dSmrgmain() {
1942db17cd6dSmrg    char *m0, *r0, *c0, *p;
1943db17cd6dSmrg    m0 = malloc(0);
1944db17cd6dSmrg    p = malloc(10);
1945db17cd6dSmrg    r0 = realloc(p,0);
1946db17cd6dSmrg    c0 = calloc(0);
1947db17cd6dSmrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
1948db17cd6dSmrg}],
1949db17cd6dSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
1950482df631Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
1951482df631Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
1952db17cd6dSmrgfi
1953db17cd6dSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
195476910425Smrg
1955db17cd6dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1956db17cd6dSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1957db17cd6dSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1958db17cd6dSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1959db17cd6dSmrgelse
1960db17cd6dSmrg	MALLOC_ZERO_CFLAGS=""
1961db17cd6dSmrg	XMALLOC_ZERO_CFLAGS=""
1962db17cd6dSmrg	XTMALLOC_ZERO_CFLAGS=""
1963db17cd6dSmrgfi
196476910425Smrg
1965db17cd6dSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1966db17cd6dSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1967db17cd6dSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1968db17cd6dSmrg]) # XORG_CHECK_MALLOC_ZERO
196976910425Smrg
1970db17cd6dSmrg# XORG_WITH_LINT()
1971db17cd6dSmrg# ----------------
1972db17cd6dSmrg# Minimum version: 1.1.0
197376910425Smrg#
1974482df631Smrg# This macro enables the use of a tool that flags some suspicious and
1975482df631Smrg# non-portable constructs (likely to be bugs) in C language source code.
1976482df631Smrg# It will attempt to locate the tool and use appropriate options.
1977482df631Smrg# There are various lint type tools on different platforms.
1978482df631Smrg#
1979482df631Smrg# Interface to module:
1980482df631Smrg# LINT:		returns the path to the tool found on the platform
1981482df631Smrg#		or the value set to LINT on the configure cmd line
1982482df631Smrg#		also an Automake conditional
1983482df631Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
1984482df631Smrg#
1985482df631Smrg# --with-lint:	'yes' user instructs the module to use lint
1986482df631Smrg#		'no' user instructs the module not to use lint (default)
1987482df631Smrg#
1988482df631Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1989482df631Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1990db17cd6dSmrg#
1991db17cd6dSmrgAC_DEFUN([XORG_WITH_LINT],[
1992db17cd6dSmrg
1993482df631SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1994482df631SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1995db17cd6dSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1996db17cd6dSmrg		[Use a lint-style source code checker (default: disabled)])],
1997db17cd6dSmrg		[use_lint=$withval], [use_lint=no])
1998482df631Smrg
1999482df631Smrg# Obtain platform specific info like program name and options
2000482df631Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2001482df631Smrgcase $host_os in
2002482df631Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2003482df631Smrg	lint_name=splint
2004482df631Smrg	lint_options="-badflag"
2005482df631Smrg	;;
2006482df631Smrg  *freebsd* | *netbsd*)
2007482df631Smrg	lint_name=lint
2008482df631Smrg	lint_options="-u -b"
2009482df631Smrg	;;
2010482df631Smrg  *solaris*)
2011482df631Smrg	lint_name=lint
2012482df631Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2013482df631Smrg	;;
2014482df631Smrgesac
2015482df631Smrg
2016482df631Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2017482df631Smrgif test "x$use_lint" = x"yes" ; then
2018482df631Smrg   AC_PATH_PROG([LINT], [$lint_name])
2019482df631Smrg   if test "x$LINT" = "x"; then
2020482df631Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2021482df631Smrg   fi
2022482df631Smrgelif test "x$use_lint" = x"no" ; then
2023482df631Smrg   if test "x$LINT" != "x"; then
2024482df631Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2025482df631Smrg   fi
202676910425Smrgelse
2027482df631Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2028db17cd6dSmrgfi
2029482df631Smrg
2030482df631Smrg# User supplied flags override default flags
2031482df631Smrgif test "x$LINT_FLAGS" != "x"; then
2032482df631Smrg   lint_options=$LINT_FLAGS
203376910425Smrgfi
203476910425Smrg
2035482df631SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2036482df631SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
203776910425Smrg
2038db17cd6dSmrg]) # XORG_WITH_LINT
203976910425Smrg
2040db17cd6dSmrg# XORG_LINT_LIBRARY(LIBNAME)
2041db17cd6dSmrg# --------------------------
2042db17cd6dSmrg# Minimum version: 1.1.0
2043db17cd6dSmrg#
2044db17cd6dSmrg# Sets up flags for building lint libraries for checking programs that call
2045db17cd6dSmrg# functions in the library.
2046db17cd6dSmrg#
2047482df631Smrg# Interface to module:
2048482df631Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2049482df631Smrg# MAKE_LINT_LIB		- Automake conditional
2050482df631Smrg#
2051482df631Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2052482df631Smrg#			  - 'no' user instructs the module not to create a lint library (default)
205376910425Smrg
2054db17cd6dSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2055db17cd6dSmrgAC_REQUIRE([XORG_WITH_LINT])
2056db17cd6dSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2057db17cd6dSmrg	[Create lint library (default: disabled)])],
2058db17cd6dSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2059482df631Smrg
2060482df631Smrgif test "x$make_lint_lib" = x"yes" ; then
2061482df631Smrg   LINTLIB=llib-l$1.ln
2062482df631Smrg   if test "x$LINT" = "x"; then
2063482df631Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2064482df631Smrg   fi
2065482df631Smrgelif test "x$make_lint_lib" != x"no" ; then
2066482df631Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2067db17cd6dSmrgfi
2068482df631Smrg
2069db17cd6dSmrgAC_SUBST(LINTLIB)
2070db17cd6dSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
207176910425Smrg
2072db17cd6dSmrg]) # XORG_LINT_LIBRARY
207376910425Smrg
2074db17cd6dSmrg# XORG_CWARNFLAGS
2075db17cd6dSmrg# ---------------
2076db17cd6dSmrg# Minimum version: 1.2.0
2077db17cd6dSmrg#
2078db17cd6dSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2079db17cd6dSmrg#
2080db17cd6dSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2081482df631SmrgAC_REQUIRE([AC_PROG_CC_C99])
2082db17cd6dSmrgif  test "x$GCC" = xyes ; then
2083db17cd6dSmrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
2084db17cd6dSmrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
2085482df631Smrg-Wbad-function-cast -Wformat=2"
2086db17cd6dSmrg    case `$CC -dumpversion` in
2087db17cd6dSmrg    3.4.* | 4.*)
2088db17cd6dSmrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
2089db17cd6dSmrg	;;
2090db17cd6dSmrg    esac
2091db17cd6dSmrgelse
2092db17cd6dSmrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2093db17cd6dSmrg    if test "x$SUNCC" = "xyes"; then
2094db17cd6dSmrg	CWARNFLAGS="-v"
2095db17cd6dSmrg    fi
2096db17cd6dSmrgfi
2097db17cd6dSmrgAC_SUBST(CWARNFLAGS)
2098db17cd6dSmrg]) # XORG_CWARNFLAGS
209976910425Smrg
2100db17cd6dSmrg# XORG_STRICT_OPTION
2101db17cd6dSmrg# -----------------------
2102db17cd6dSmrg# Minimum version: 1.3.0
210376910425Smrg#
2104db17cd6dSmrg# Add configure option to enable strict compilation
2105db17cd6dSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2106482df631Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
2107db17cd6dSmrgAC_REQUIRE([AC_PROG_CC_C99])
2108db17cd6dSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2109db17cd6dSmrg
2110db17cd6dSmrgAC_ARG_ENABLE(strict-compilation,
2111db17cd6dSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2112db17cd6dSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2113db17cd6dSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2114db17cd6dSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2115db17cd6dSmrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2116db17cd6dSmrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2117db17cd6dSmrg	if test "x$GCC" = xyes ; then
2118db17cd6dSmrg		STRICT_CFLAGS="-pedantic -Werror"
2119db17cd6dSmrg	elif test "x$SUNCC" = "xyes"; then
2120db17cd6dSmrg		STRICT_CFLAGS="-errwarn"
2121db17cd6dSmrg    elif test "x$INTELCC" = "xyes"; then
2122db17cd6dSmrg		STRICT_CFLAGS="-Werror"
2123db17cd6dSmrg	fi
2124db17cd6dSmrgfi
2125db17cd6dSmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2126db17cd6dSmrgAC_SUBST([CWARNFLAGS])
2127db17cd6dSmrg]) # XORG_STRICT_OPTION
212876910425Smrg
2129db17cd6dSmrg# XORG_DEFAULT_OPTIONS
2130db17cd6dSmrg# --------------------
2131db17cd6dSmrg# Minimum version: 1.3.0
2132db17cd6dSmrg#
2133db17cd6dSmrg# Defines default options for X.Org modules.
2134db17cd6dSmrg#
2135db17cd6dSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2136482df631SmrgAC_REQUIRE([AC_PROG_INSTALL])
2137db17cd6dSmrgXORG_CWARNFLAGS
2138db17cd6dSmrgXORG_STRICT_OPTION
2139db17cd6dSmrgXORG_RELEASE_VERSION
2140db17cd6dSmrgXORG_CHANGELOG
2141482df631SmrgXORG_INSTALL
2142db17cd6dSmrgXORG_MANPAGE_SECTIONS
2143482df631Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2144482df631Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2145db17cd6dSmrg]) # XORG_DEFAULT_OPTIONS
2146482df631Smrg
2147482df631Smrg# XORG_INSTALL()
2148482df631Smrg# ----------------
2149482df631Smrg# Minimum version: 1.4.0
2150482df631Smrg#
2151482df631Smrg# Defines the variable INSTALL_CMD as the command to copy
2152482df631Smrg# INSTALL from $prefix/share/util-macros.
2153482df631Smrg#
2154482df631SmrgAC_DEFUN([XORG_INSTALL], [
2155482df631SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2156482df631Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2157482df631SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2158482df631Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2159482df631Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2160482df631Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2161482df631SmrgAC_SUBST([INSTALL_CMD])
2162482df631Smrg]) # XORG_INSTALL
2163db17cd6dSmrgdnl Copyright 2005 Red Hat, Inc
2164db17cd6dSmrgdnl
2165db17cd6dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2166db17cd6dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2167db17cd6dSmrgdnl the above copyright notice appear in all copies and that both that
2168db17cd6dSmrgdnl copyright notice and this permission notice appear in supporting
2169db17cd6dSmrgdnl documentation.
2170db17cd6dSmrgdnl
2171db17cd6dSmrgdnl The above copyright notice and this permission notice shall be included
2172db17cd6dSmrgdnl in all copies or substantial portions of the Software.
2173db17cd6dSmrgdnl
2174db17cd6dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2175db17cd6dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2176db17cd6dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2177db17cd6dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2178db17cd6dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2179db17cd6dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2180db17cd6dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2181db17cd6dSmrgdnl
2182db17cd6dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2183db17cd6dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2184db17cd6dSmrgdnl other dealings in this Software without prior written authorization
2185db17cd6dSmrgdnl from the copyright holders.
2186db17cd6dSmrgdnl
218776910425Smrg
2188db17cd6dSmrg# XORG_RELEASE_VERSION
2189db17cd6dSmrg# --------------------
2190482df631Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2191db17cd6dSmrg 
2192db17cd6dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2193db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2194db17cd6dSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2195db17cd6dSmrg		[Major version of this package])
2196db17cd6dSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2197db17cd6dSmrg	if test "x$PVM" = "x"; then
2198db17cd6dSmrg		PVM="0"
2199db17cd6dSmrg	fi
2200db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2201db17cd6dSmrg		[$PVM],
2202db17cd6dSmrg		[Minor version of this package])
2203db17cd6dSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2204db17cd6dSmrg	if test "x$PVP" = "x"; then
2205db17cd6dSmrg		PVP="0"
2206db17cd6dSmrg	fi
2207db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2208db17cd6dSmrg		[$PVP],
2209db17cd6dSmrg		[Patch version of this package])
221076910425Smrg])
221176910425Smrg
2212db17cd6dSmrg# XORG_CHANGELOG()
2213db17cd6dSmrg# ----------------
2214db17cd6dSmrg# Minimum version: 1.2.0
2215db17cd6dSmrg#
2216db17cd6dSmrg# Defines the variable CHANGELOG_CMD as the command to generate
2217db17cd6dSmrg# ChangeLog from git.
2218db17cd6dSmrg#
2219db17cd6dSmrg#
2220db17cd6dSmrgAC_DEFUN([XORG_CHANGELOG], [
2221482df631SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2222482df631Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2223482df631Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2224db17cd6dSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2225db17cd6dSmrgAC_SUBST([CHANGELOG_CMD])
2226db17cd6dSmrg]) # XORG_CHANGELOG
222776910425Smrg
2228db17cd6dSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2229db17cd6dSmrg# 
2230db17cd6dSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
223176910425Smrg#
2232db17cd6dSmrg# This program is free software; you can redistribute it and/or modify
2233db17cd6dSmrg# it under the terms of the GNU General Public License as published by
2234db17cd6dSmrg# the Free Software Foundation; either version 2 of the License, or
2235db17cd6dSmrg# (at your option) any later version.
2236db17cd6dSmrg#
2237db17cd6dSmrg# This program is distributed in the hope that it will be useful, but
2238db17cd6dSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
2239db17cd6dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2240db17cd6dSmrg# General Public License for more details.
2241db17cd6dSmrg#
2242db17cd6dSmrg# You should have received a copy of the GNU General Public License
2243db17cd6dSmrg# along with this program; if not, write to the Free Software
2244db17cd6dSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2245db17cd6dSmrg#
2246db17cd6dSmrg# As a special exception to the GNU General Public License, if you
2247db17cd6dSmrg# distribute this file as part of a program that contains a
2248db17cd6dSmrg# configuration script generated by Autoconf, you may include it under
2249db17cd6dSmrg# the same distribution terms that you use for the rest of that program.
225076910425Smrg
2251db17cd6dSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2252db17cd6dSmrg# ----------------------------------
2253db17cd6dSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
2254db17cd6dSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2255db17cd6dSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2256db17cd6dSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2257db17cd6dSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2258db17cd6dSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2259db17cd6dSmrgfi
2260db17cd6dSmrgif test -n "$PKG_CONFIG"; then
2261db17cd6dSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
2262db17cd6dSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2263db17cd6dSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2264db17cd6dSmrg		AC_MSG_RESULT([yes])
2265db17cd6dSmrg	else
2266db17cd6dSmrg		AC_MSG_RESULT([no])
2267db17cd6dSmrg		PKG_CONFIG=""
2268db17cd6dSmrg	fi
2269db17cd6dSmrg		
2270db17cd6dSmrgfi[]dnl
2271db17cd6dSmrg])# PKG_PROG_PKG_CONFIG
227276910425Smrg
2273db17cd6dSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2274db17cd6dSmrg#
2275db17cd6dSmrg# Check to see whether a particular set of modules exists.  Similar
2276db17cd6dSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2277db17cd6dSmrg#
2278db17cd6dSmrg#
2279db17cd6dSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2280db17cd6dSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
2281db17cd6dSmrg# PKG_CHECK_EXISTS manually
2282db17cd6dSmrg# --------------------------------------------------------------
2283db17cd6dSmrgAC_DEFUN([PKG_CHECK_EXISTS],
2284db17cd6dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2285db17cd6dSmrgif test -n "$PKG_CONFIG" && \
2286db17cd6dSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2287db17cd6dSmrg  m4_ifval([$2], [$2], [:])
2288db17cd6dSmrgm4_ifvaln([$3], [else
2289db17cd6dSmrg  $3])dnl
2290db17cd6dSmrgfi])
229176910425Smrg
229276910425Smrg
2293db17cd6dSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2294db17cd6dSmrg# ---------------------------------------------
2295db17cd6dSmrgm4_define([_PKG_CONFIG],
2296db17cd6dSmrg[if test -n "$$1"; then
2297db17cd6dSmrg    pkg_cv_[]$1="$$1"
2298db17cd6dSmrg elif test -n "$PKG_CONFIG"; then
2299db17cd6dSmrg    PKG_CHECK_EXISTS([$3],
2300db17cd6dSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2301db17cd6dSmrg		     [pkg_failed=yes])
2302db17cd6dSmrg else
2303db17cd6dSmrg    pkg_failed=untried
2304db17cd6dSmrgfi[]dnl
2305db17cd6dSmrg])# _PKG_CONFIG
2306db17cd6dSmrg
2307db17cd6dSmrg# _PKG_SHORT_ERRORS_SUPPORTED
2308db17cd6dSmrg# -----------------------------
2309db17cd6dSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2310db17cd6dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2311db17cd6dSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2312db17cd6dSmrg        _pkg_short_errors_supported=yes
231376910425Smrgelse
2314db17cd6dSmrg        _pkg_short_errors_supported=no
2315db17cd6dSmrgfi[]dnl
2316db17cd6dSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
231776910425Smrg
231876910425Smrg
2319db17cd6dSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2320db17cd6dSmrg# [ACTION-IF-NOT-FOUND])
232176910425Smrg#
232276910425Smrg#
2323db17cd6dSmrg# Note that if there is a possibility the first call to
2324db17cd6dSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
2325db17cd6dSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
232676910425Smrg#
232776910425Smrg#
2328db17cd6dSmrg# --------------------------------------------------------------
2329db17cd6dSmrgAC_DEFUN([PKG_CHECK_MODULES],
2330db17cd6dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2331db17cd6dSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2332db17cd6dSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
233376910425Smrg
2334db17cd6dSmrgpkg_failed=no
2335db17cd6dSmrgAC_MSG_CHECKING([for $1])
233676910425Smrg
2337db17cd6dSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2338db17cd6dSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
233976910425Smrg
2340db17cd6dSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2341db17cd6dSmrgand $1[]_LIBS to avoid the need to call pkg-config.
2342db17cd6dSmrgSee the pkg-config man page for more details.])
234376910425Smrg
2344db17cd6dSmrgif test $pkg_failed = yes; then
2345db17cd6dSmrg        _PKG_SHORT_ERRORS_SUPPORTED
2346db17cd6dSmrg        if test $_pkg_short_errors_supported = yes; then
2347db17cd6dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2348db17cd6dSmrg        else 
2349db17cd6dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2350db17cd6dSmrg        fi
2351db17cd6dSmrg	# Put the nasty error message in config.log where it belongs
2352db17cd6dSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
235376910425Smrg
2354db17cd6dSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
2355db17cd6dSmrg[Package requirements ($2) were not met:
235676910425Smrg
2357db17cd6dSmrg$$1_PKG_ERRORS
235876910425Smrg
2359db17cd6dSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
2360db17cd6dSmrginstalled software in a non-standard prefix.
236176910425Smrg
2362db17cd6dSmrg_PKG_TEXT
2363db17cd6dSmrg])],
2364db17cd6dSmrg		[AC_MSG_RESULT([no])
2365db17cd6dSmrg                $4])
2366db17cd6dSmrgelif test $pkg_failed = untried; then
2367db17cd6dSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
2368db17cd6dSmrg[The pkg-config script could not be found or is too old.  Make sure it
2369db17cd6dSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2370db17cd6dSmrgpath to pkg-config.
237176910425Smrg
2372db17cd6dSmrg_PKG_TEXT
237376910425Smrg
2374db17cd6dSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2375db17cd6dSmrg		[$4])
237676910425Smrgelse
2377db17cd6dSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2378db17cd6dSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2379db17cd6dSmrg        AC_MSG_RESULT([yes])
2380db17cd6dSmrg	ifelse([$3], , :, [$3])
2381db17cd6dSmrgfi[]dnl
2382db17cd6dSmrg])# PKG_CHECK_MODULES
238376910425Smrg
2384