aclocal.m4 revision 9ff100ac
19ff100acSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
29ff100acSmrg
39ff100acSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
476910425Smrg
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
149ff100acSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15db17cd6dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16db17cd6dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
179ff100acSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
189ff100acSmrg[m4_warning([this file was generated for autoconf 2.69.
19db17cd6dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20db17cd6dSmrgIf you have problems, you may need to regenerate the build system entirely.
219ff100acSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2276910425Smrg
239ff100acSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2476910425Smrg#
25db17cd6dSmrg# This file is free software; the Free Software Foundation
26db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
27db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
2876910425Smrg
29db17cd6dSmrg# AM_AUTOMAKE_VERSION(VERSION)
30db17cd6dSmrg# ----------------------------
31db17cd6dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32db17cd6dSmrg# generated from the m4 files accompanying Automake X.Y.
33db17cd6dSmrg# (This private macro should not be called outside this file.)
34db17cd6dSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
359ff100acSmrg[am__api_version='1.15'
36db17cd6dSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37db17cd6dSmrgdnl require some minimum version.  Point them to the right macro.
389ff100acSmrgm4_if([$1], [1.15], [],
39db17cd6dSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40db17cd6dSmrg])
4176910425Smrg
42db17cd6dSmrg# _AM_AUTOCONF_VERSION(VERSION)
4376910425Smrg# -----------------------------
44db17cd6dSmrg# aclocal traces this macro to find the Autoconf version.
45db17cd6dSmrg# This is a private macro too.  Using m4_define simplifies
46db17cd6dSmrg# the logic in aclocal, which can simply ignore this definition.
47db17cd6dSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48db17cd6dSmrg
49db17cd6dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50db17cd6dSmrg# -------------------------------
51db17cd6dSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52db17cd6dSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53db17cd6dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
549ff100acSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
55db17cd6dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56db17cd6dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57db17cd6dSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5876910425Smrg
59db17cd6dSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6076910425Smrg
619ff100acSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
62db17cd6dSmrg#
63db17cd6dSmrg# This file is free software; the Free Software Foundation
64db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
65db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
66db17cd6dSmrg
67db17cd6dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
689ff100acSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
699ff100acSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7076910425Smrg#
71db17cd6dSmrg# Of course, Automake must honor this variable whenever it calls a
72db17cd6dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73db17cd6dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74db17cd6dSmrg# depending on how configure is run.  This is pretty annoying, since
75db17cd6dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76db17cd6dSmrg# source directory, any form will work fine, but in subdirectories a
77db17cd6dSmrg# relative path needs to be adjusted first.
7876910425Smrg#
79db17cd6dSmrg# $ac_aux_dir/missing
80db17cd6dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81db17cd6dSmrg# $top_srcdir/$ac_aux_dir/missing
82db17cd6dSmrg#    fails if $ac_aux_dir is absolute,
83db17cd6dSmrg#    fails when called from a subdirectory in a VPATH build with
84db17cd6dSmrg#          a relative $ac_aux_dir
8576910425Smrg#
86db17cd6dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87db17cd6dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
889ff100acSmrg# harmless because $srcdir is '.', but things will broke when you
89db17cd6dSmrg# start a VPATH build or use an absolute $srcdir.
9076910425Smrg#
91db17cd6dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92db17cd6dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93db17cd6dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94db17cd6dSmrg# and then we would define $MISSING as
95db17cd6dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96db17cd6dSmrg# This will work as long as MISSING is not called from configure, because
97db17cd6dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98db17cd6dSmrg# However there are other variables, like CC, which are often used in
99db17cd6dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100db17cd6dSmrg#
101db17cd6dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102db17cd6dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103db17cd6dSmrg# configured tree to be moved without reconfiguration.
10476910425Smrg
105db17cd6dSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1069ff100acSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1079ff100acSmrg# Expand $ac_aux_dir to an absolute path.
1089ff100acSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109db17cd6dSmrg])
11076910425Smrg
111db17cd6dSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11276910425Smrg
1139ff100acSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
114db17cd6dSmrg#
115db17cd6dSmrg# This file is free software; the Free Software Foundation
116db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
117db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
11876910425Smrg
119db17cd6dSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120db17cd6dSmrg# -------------------------------------
121db17cd6dSmrg# Define a conditional.
122db17cd6dSmrgAC_DEFUN([AM_CONDITIONAL],
1239ff100acSmrg[AC_PREREQ([2.52])dnl
1249ff100acSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1259ff100acSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126db17cd6dSmrgAC_SUBST([$1_TRUE])dnl
127db17cd6dSmrgAC_SUBST([$1_FALSE])dnl
128db17cd6dSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129db17cd6dSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130db17cd6dSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131db17cd6dSmrgif $2; then
132db17cd6dSmrg  $1_TRUE=
133db17cd6dSmrg  $1_FALSE='#'
134db17cd6dSmrgelse
135db17cd6dSmrg  $1_TRUE='#'
136db17cd6dSmrg  $1_FALSE=
137db17cd6dSmrgfi
138db17cd6dSmrgAC_CONFIG_COMMANDS_PRE(
139db17cd6dSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140db17cd6dSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141db17cd6dSmrgUsually this means the macro was only invoked conditionally.]])
142db17cd6dSmrgfi])])
14376910425Smrg
1449ff100acSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
145db17cd6dSmrg#
146db17cd6dSmrg# This file is free software; the Free Software Foundation
147db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
148db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
14976910425Smrg
15076910425Smrg
1519ff100acSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152db17cd6dSmrg# written in clear, in which case automake, when reading aclocal.m4,
153db17cd6dSmrg# will think it sees a *use*, and therefore will trigger all it's
154db17cd6dSmrg# C support machinery.  Also note that it means that autoscan, seeing
155db17cd6dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15676910425Smrg
15776910425Smrg
158db17cd6dSmrg# _AM_DEPENDENCIES(NAME)
159db17cd6dSmrg# ----------------------
160db17cd6dSmrg# See how the compiler implements dependency checking.
1619ff100acSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162db17cd6dSmrg# We try a few techniques and use that to set a single cache variable.
163db17cd6dSmrg#
164db17cd6dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165db17cd6dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166db17cd6dSmrg# dependency, and given that the user is not expected to run this macro,
167db17cd6dSmrg# just rely on AC_PROG_CC.
168db17cd6dSmrgAC_DEFUN([_AM_DEPENDENCIES],
169db17cd6dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170db17cd6dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171db17cd6dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172db17cd6dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17376910425Smrg
1749ff100acSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1759ff100acSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1769ff100acSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1779ff100acSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1789ff100acSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1799ff100acSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1809ff100acSmrg                    [depcc="$$1"   am_compiler_list=])
18176910425Smrg
182db17cd6dSmrgAC_CACHE_CHECK([dependency style of $depcc],
183db17cd6dSmrg               [am_cv_$1_dependencies_compiler_type],
184db17cd6dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185db17cd6dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
186db17cd6dSmrg  # making bogus files that we don't know about and never remove.  For
187db17cd6dSmrg  # instance it was reported that on HP-UX the gcc test will end up
1889ff100acSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1899ff100acSmrg  # in D".
1909ff100acSmrg  rm -rf conftest.dir
191db17cd6dSmrg  mkdir conftest.dir
192db17cd6dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193db17cd6dSmrg  # using a relative directory.
194db17cd6dSmrg  cp "$am_depcomp" conftest.dir
195db17cd6dSmrg  cd conftest.dir
196db17cd6dSmrg  # We will build objects and dependencies in a subdirectory because
197db17cd6dSmrg  # it helps to detect inapplicable dependency modes.  For instance
198db17cd6dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199db17cd6dSmrg  # side effect of compilation, but ICC will put the dependencies in
200db17cd6dSmrg  # the current directory while Tru64 will put them in the object
201db17cd6dSmrg  # directory.
202db17cd6dSmrg  mkdir sub
20376910425Smrg
204db17cd6dSmrg  am_cv_$1_dependencies_compiler_type=none
205db17cd6dSmrg  if test "$am_compiler_list" = ""; then
206db17cd6dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207db17cd6dSmrg  fi
208db17cd6dSmrg  am__universal=false
209db17cd6dSmrg  m4_case([$1], [CC],
210db17cd6dSmrg    [case " $depcc " in #(
211db17cd6dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212db17cd6dSmrg     esac],
213db17cd6dSmrg    [CXX],
214db17cd6dSmrg    [case " $depcc " in #(
215db17cd6dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216db17cd6dSmrg     esac])
21776910425Smrg
218db17cd6dSmrg  for depmode in $am_compiler_list; do
219db17cd6dSmrg    # Setup a source with many dependencies, because some compilers
220db17cd6dSmrg    # like to wrap large dependency lists on column 80 (with \), and
221db17cd6dSmrg    # we should not choose a depcomp mode which is confused by this.
222db17cd6dSmrg    #
223db17cd6dSmrg    # We need to recreate these files for each test, as the compiler may
224db17cd6dSmrg    # overwrite some of them when testing with obscure command lines.
225db17cd6dSmrg    # This happens at least with the AIX C compiler.
226db17cd6dSmrg    : > sub/conftest.c
227db17cd6dSmrg    for i in 1 2 3 4 5 6; do
228db17cd6dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2299ff100acSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2309ff100acSmrg      # Solaris 10 /bin/sh.
2319ff100acSmrg      echo '/* dummy */' > sub/conftst$i.h
232db17cd6dSmrg    done
233db17cd6dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234db17cd6dSmrg
2359ff100acSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236db17cd6dSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2379ff100acSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2389ff100acSmrg    # versions had trouble with output in subdirs.
239db17cd6dSmrg    am__obj=sub/conftest.${OBJEXT-o}
240db17cd6dSmrg    am__minus_obj="-o $am__obj"
241db17cd6dSmrg    case $depmode in
242db17cd6dSmrg    gcc)
243db17cd6dSmrg      # This depmode causes a compiler race in universal mode.
244db17cd6dSmrg      test "$am__universal" = false || continue
245db17cd6dSmrg      ;;
246db17cd6dSmrg    nosideeffect)
2479ff100acSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2489ff100acSmrg      # only be used when explicitly requested.
249db17cd6dSmrg      if test "x$enable_dependency_tracking" = xyes; then
250db17cd6dSmrg	continue
251db17cd6dSmrg      else
252db17cd6dSmrg	break
253db17cd6dSmrg      fi
254db17cd6dSmrg      ;;
2559ff100acSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2569ff100acSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257db17cd6dSmrg      # not run yet.  These depmodes are late enough in the game, and
258db17cd6dSmrg      # so weak that their functioning should not be impacted.
259db17cd6dSmrg      am__obj=conftest.${OBJEXT-o}
260db17cd6dSmrg      am__minus_obj=
261db17cd6dSmrg      ;;
262db17cd6dSmrg    none) break ;;
263db17cd6dSmrg    esac
264db17cd6dSmrg    if depmode=$depmode \
265db17cd6dSmrg       source=sub/conftest.c object=$am__obj \
266db17cd6dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267db17cd6dSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268db17cd6dSmrg         >/dev/null 2>conftest.err &&
269db17cd6dSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270db17cd6dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271db17cd6dSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272db17cd6dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273db17cd6dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
274db17cd6dSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275db17cd6dSmrg      # that says an option was ignored or not supported.
276db17cd6dSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277db17cd6dSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278db17cd6dSmrg      # The diagnosis changed in icc 8.0:
279db17cd6dSmrg      #   icc: Command line remark: option '-MP' not supported
280db17cd6dSmrg      if (grep 'ignoring option' conftest.err ||
281db17cd6dSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282db17cd6dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
283db17cd6dSmrg        break
284db17cd6dSmrg      fi
285db17cd6dSmrg    fi
286db17cd6dSmrg  done
287db17cd6dSmrg
288db17cd6dSmrg  cd ..
289db17cd6dSmrg  rm -rf conftest.dir
29076910425Smrgelse
291db17cd6dSmrg  am_cv_$1_dependencies_compiler_type=none
29276910425Smrgfi
293db17cd6dSmrg])
294db17cd6dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295db17cd6dSmrgAM_CONDITIONAL([am__fastdep$1], [
296db17cd6dSmrg  test "x$enable_dependency_tracking" != xno \
297db17cd6dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298db17cd6dSmrg])
29976910425Smrg
30076910425Smrg
301db17cd6dSmrg# AM_SET_DEPDIR
302db17cd6dSmrg# -------------
303db17cd6dSmrg# Choose a directory name for dependency files.
3049ff100acSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305db17cd6dSmrgAC_DEFUN([AM_SET_DEPDIR],
306db17cd6dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307db17cd6dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308db17cd6dSmrg])
30976910425Smrg
31076910425Smrg
311db17cd6dSmrg# AM_DEP_TRACK
312db17cd6dSmrg# ------------
313db17cd6dSmrgAC_DEFUN([AM_DEP_TRACK],
3149ff100acSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3159ff100acSmrgAS_HELP_STRING(
3169ff100acSmrg  [--enable-dependency-tracking],
3179ff100acSmrg  [do not reject slow dependency extractors])
3189ff100acSmrgAS_HELP_STRING(
3199ff100acSmrg  [--disable-dependency-tracking],
3209ff100acSmrg  [speeds up one-time build])])
321db17cd6dSmrgif test "x$enable_dependency_tracking" != xno; then
322db17cd6dSmrg  am_depcomp="$ac_aux_dir/depcomp"
323db17cd6dSmrg  AMDEPBACKSLASH='\'
3249ff100acSmrg  am__nodep='_no'
32576910425Smrgfi
326db17cd6dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327db17cd6dSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328db17cd6dSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3299ff100acSmrgAC_SUBST([am__nodep])dnl
3309ff100acSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331db17cd6dSmrg])
33276910425Smrg
333db17cd6dSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334db17cd6dSmrg
3359ff100acSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
336db17cd6dSmrg#
337db17cd6dSmrg# This file is free software; the Free Software Foundation
338db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
339db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
340db17cd6dSmrg
341db17cd6dSmrg
342db17cd6dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
343db17cd6dSmrg# ------------------------------
344db17cd6dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345db17cd6dSmrg[{
3469ff100acSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
347db17cd6dSmrg  # are listed without --file.  Let's play safe and only enable the eval
348db17cd6dSmrg  # if we detect the quoting.
349db17cd6dSmrg  case $CONFIG_FILES in
350db17cd6dSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
351db17cd6dSmrg  *)   set x $CONFIG_FILES ;;
352db17cd6dSmrg  esac
353db17cd6dSmrg  shift
354db17cd6dSmrg  for mf
355db17cd6dSmrg  do
356db17cd6dSmrg    # Strip MF so we end up with the name of the file.
357db17cd6dSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358db17cd6dSmrg    # Check whether this is an Automake generated Makefile or not.
3599ff100acSmrg    # We used to match only the files named 'Makefile.in', but
360db17cd6dSmrg    # some people rename them; so instead we look at the file content.
361db17cd6dSmrg    # Grep'ing the first line is not enough: some people post-process
362db17cd6dSmrg    # each Makefile.in and add a new line on top of each file to say so.
363db17cd6dSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
364db17cd6dSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
365db17cd6dSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366db17cd6dSmrg      dirpart=`AS_DIRNAME("$mf")`
367db17cd6dSmrg    else
368db17cd6dSmrg      continue
369db17cd6dSmrg    fi
370db17cd6dSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3719ff100acSmrg    # from the Makefile without running 'make'.
372db17cd6dSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373db17cd6dSmrg    test -z "$DEPDIR" && continue
374db17cd6dSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3759ff100acSmrg    test -z "$am__include" && continue
376db17cd6dSmrg    am__quote=`sed -n 's/^am__quote = //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" | \
3839ff100acSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/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
4019ff100acSmrg# 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# Do all the work for Automake.                             -*- Autoconf -*-
410db17cd6dSmrg
4119ff100acSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
412db17cd6dSmrg#
413db17cd6dSmrg# This file is free software; the Free Software Foundation
414db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
415db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
416db17cd6dSmrg
417db17cd6dSmrg# This macro actually does too much.  Some checks are only needed if
418db17cd6dSmrg# your package does certain things.  But this isn't really a big deal.
419db17cd6dSmrg
4209ff100acSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4219ff100acSmrgm4_define([AC_PROG_CC],
4229ff100acSmrgm4_defn([AC_PROG_CC])
4239ff100acSmrg[_AM_PROG_CC_C_O
4249ff100acSmrg])
4259ff100acSmrg
426db17cd6dSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
427db17cd6dSmrg# AM_INIT_AUTOMAKE([OPTIONS])
428db17cd6dSmrg# -----------------------------------------------
429db17cd6dSmrg# The call with PACKAGE and VERSION arguments is the old style
430db17cd6dSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
431db17cd6dSmrg# and VERSION should now be passed to AC_INIT and removed from
432db17cd6dSmrg# the call to AM_INIT_AUTOMAKE.
433db17cd6dSmrg# We support both call styles for the transition.  After
434db17cd6dSmrg# the next Automake release, Autoconf can make the AC_INIT
435db17cd6dSmrg# arguments mandatory, and then we can depend on a new Autoconf
436db17cd6dSmrg# release and drop the old call support.
437db17cd6dSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4389ff100acSmrg[AC_PREREQ([2.65])dnl
439db17cd6dSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
440db17cd6dSmrgdnl the ones we care about.
441db17cd6dSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
442db17cd6dSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
443db17cd6dSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
444db17cd6dSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
445db17cd6dSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
446db17cd6dSmrg  # is not polluted with repeated "-I."
447db17cd6dSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
448db17cd6dSmrg  # test to see if srcdir already configured
449db17cd6dSmrg  if test -f $srcdir/config.status; then
450db17cd6dSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
451db17cd6dSmrg  fi
45276910425Smrgfi
45376910425Smrg
454db17cd6dSmrg# test whether we have cygpath
455db17cd6dSmrgif test -z "$CYGPATH_W"; then
456db17cd6dSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
457db17cd6dSmrg    CYGPATH_W='cygpath -w'
458db17cd6dSmrg  else
459db17cd6dSmrg    CYGPATH_W=echo
460db17cd6dSmrg  fi
46176910425Smrgfi
462db17cd6dSmrgAC_SUBST([CYGPATH_W])
463db17cd6dSmrg
464db17cd6dSmrg# Define the identity of the package.
465db17cd6dSmrgdnl Distinguish between old-style and new-style calls.
466db17cd6dSmrgm4_ifval([$2],
4679ff100acSmrg[AC_DIAGNOSE([obsolete],
4689ff100acSmrg             [$0: two- and three-arguments forms are deprecated.])
4699ff100acSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
470db17cd6dSmrg AC_SUBST([PACKAGE], [$1])dnl
471db17cd6dSmrg AC_SUBST([VERSION], [$2])],
472db17cd6dSmrg[_AM_SET_OPTIONS([$1])dnl
473db17cd6dSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4749ff100acSmrgm4_if(
4759ff100acSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4769ff100acSmrg  [ok:ok],,
477db17cd6dSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
478db17cd6dSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
479db17cd6dSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
480db17cd6dSmrg
481db17cd6dSmrg_AM_IF_OPTION([no-define],,
4829ff100acSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4839ff100acSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
484db17cd6dSmrg
485db17cd6dSmrg# Some tools Automake needs.
486db17cd6dSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
487db17cd6dSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4889ff100acSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4899ff100acSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4909ff100acSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4919ff100acSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4929ff100acSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493db17cd6dSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494db17cd6dSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4959ff100acSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4969ff100acSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4979ff100acSmrg# dies out for good.  For more background, see:
4989ff100acSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4999ff100acSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5009ff100acSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5019ff100acSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
5029ff100acSmrg# system "awk" is bad on 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],
5119ff100acSmrg		  [_AM_DEPENDENCIES([CC])],
5129ff100acSmrg		  [m4_define([AC_PROG_CC],
5139ff100acSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
514db17cd6dSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5159ff100acSmrg		  [_AM_DEPENDENCIES([CXX])],
5169ff100acSmrg		  [m4_define([AC_PROG_CXX],
5179ff100acSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
518db17cd6dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5199ff100acSmrg		  [_AM_DEPENDENCIES([OBJC])],
5209ff100acSmrg		  [m4_define([AC_PROG_OBJC],
5219ff100acSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5229ff100acSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5239ff100acSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
5249ff100acSmrg		  [m4_define([AC_PROG_OBJCXX],
5259ff100acSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
526db17cd6dSmrg])
5279ff100acSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5289ff100acSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
5299ff100acSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5309ff100acSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531db17cd6dSmrgAC_CONFIG_COMMANDS_PRE(dnl
532db17cd6dSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533db17cd6dSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5349ff100acSmrg
5359ff100acSmrg# POSIX will say in a future version that running "rm -f" with no argument
5369ff100acSmrg# is OK; and we want to be able to make that assumption in our Makefile
5379ff100acSmrg# recipes.  So use an aggressive probe to check that the usage we want is
5389ff100acSmrg# actually supported "in the wild" to an acceptable degree.
5399ff100acSmrg# See automake bug#10828.
5409ff100acSmrg# To make any issue more visible, cause the running configure to be aborted
5419ff100acSmrg# by default if the 'rm' program in use doesn't match our expectations; the
5429ff100acSmrg# user can still override this though.
5439ff100acSmrgif rm -f && rm -fr && rm -rf; then : OK; else
5449ff100acSmrg  cat >&2 <<'END'
5459ff100acSmrgOops!
5469ff100acSmrg
5479ff100acSmrgYour 'rm' program seems unable to run without file operands specified
5489ff100acSmrgon the command line, even when the '-f' option is present.  This is contrary
5499ff100acSmrgto the behaviour of most rm programs out there, and not conforming with
5509ff100acSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5519ff100acSmrg
5529ff100acSmrgPlease tell bug-automake@gnu.org about your system, including the value
5539ff100acSmrgof your $PATH and any error possibly output before this message.  This
5549ff100acSmrgcan help us improve future automake versions.
5559ff100acSmrg
5569ff100acSmrgEND
5579ff100acSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5589ff100acSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5599ff100acSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5609ff100acSmrg    echo >&2
5619ff100acSmrg  else
5629ff100acSmrg    cat >&2 <<'END'
5639ff100acSmrgAborting the configuration process, to ensure you take notice of the issue.
5649ff100acSmrg
5659ff100acSmrgYou can download and install GNU coreutils to get an 'rm' implementation
5669ff100acSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5679ff100acSmrg
5689ff100acSmrgIf you want to complete the configuration process using your problematic
5699ff100acSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5709ff100acSmrgto "yes", and re-run configure.
5719ff100acSmrg
5729ff100acSmrgEND
5739ff100acSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5749ff100acSmrg  fi
5759ff100acSmrgfi
5769ff100acSmrgdnl The trailing newline in this macro's definition is deliberate, for
5779ff100acSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5789ff100acSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
579db17cd6dSmrg])
580db17cd6dSmrg
5819ff100acSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582db17cd6dSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583db17cd6dSmrgdnl mangled by Autoconf and run in a shell conditional statement.
584db17cd6dSmrgm4_define([_AC_COMPILER_EXEEXT],
585db17cd6dSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586db17cd6dSmrg
587db17cd6dSmrg# When config.status generates a header, we must update the stamp-h file.
588db17cd6dSmrg# This file resides in the same directory as the config header
589db17cd6dSmrg# that is generated.  The stamp files are numbered to have different names.
590db17cd6dSmrg
591db17cd6dSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
592db17cd6dSmrg# loop where config.status creates the headers, so we can generate
593db17cd6dSmrg# our stamp files there.
594db17cd6dSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
595db17cd6dSmrg[# Compute $1's index in $config_headers.
596db17cd6dSmrg_am_arg=$1
597db17cd6dSmrg_am_stamp_count=1
598db17cd6dSmrgfor _am_header in $config_headers :; do
599db17cd6dSmrg  case $_am_header in
600db17cd6dSmrg    $_am_arg | $_am_arg:* )
601db17cd6dSmrg      break ;;
602db17cd6dSmrg    * )
603db17cd6dSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
604db17cd6dSmrg  esac
605db17cd6dSmrgdone
606db17cd6dSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
607db17cd6dSmrg
6089ff100acSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
609db17cd6dSmrg#
610db17cd6dSmrg# This file is free software; the Free Software Foundation
611db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
612db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
613db17cd6dSmrg
614db17cd6dSmrg# AM_PROG_INSTALL_SH
615db17cd6dSmrg# ------------------
616db17cd6dSmrg# Define $install_sh.
617db17cd6dSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
618db17cd6dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6199ff100acSmrgif test x"${install_sh+set}" != xset; then
620db17cd6dSmrg  case $am_aux_dir in
621db17cd6dSmrg  *\ * | *\	*)
622db17cd6dSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623db17cd6dSmrg  *)
624db17cd6dSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625db17cd6dSmrg  esac
62676910425Smrgfi
6279ff100acSmrgAC_SUBST([install_sh])])
62876910425Smrg
6299ff100acSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
630db17cd6dSmrg#
631db17cd6dSmrg# This file is free software; the Free Software Foundation
632db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
633db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
634db17cd6dSmrg
635db17cd6dSmrg# Check whether the underlying file-system supports filenames
636db17cd6dSmrg# with a leading dot.  For instance MS-DOS doesn't.
637db17cd6dSmrgAC_DEFUN([AM_SET_LEADING_DOT],
638db17cd6dSmrg[rm -rf .tst 2>/dev/null
639db17cd6dSmrgmkdir .tst 2>/dev/null
640db17cd6dSmrgif test -d .tst; then
641db17cd6dSmrg  am__leading_dot=.
642db17cd6dSmrgelse
643db17cd6dSmrg  am__leading_dot=_
64476910425Smrgfi
645db17cd6dSmrgrmdir .tst 2>/dev/null
646db17cd6dSmrgAC_SUBST([am__leading_dot])])
647db17cd6dSmrg
648db17cd6dSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
649db17cd6dSmrg
6509ff100acSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
651db17cd6dSmrg#
652db17cd6dSmrg# This file is free software; the Free Software Foundation
653db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
654db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
655db17cd6dSmrg
656db17cd6dSmrg# AM_MAKE_INCLUDE()
657db17cd6dSmrg# -----------------
658db17cd6dSmrg# Check to see how make treats includes.
659db17cd6dSmrgAC_DEFUN([AM_MAKE_INCLUDE],
660db17cd6dSmrg[am_make=${MAKE-make}
661db17cd6dSmrgcat > confinc << 'END'
662db17cd6dSmrgam__doit:
663db17cd6dSmrg	@echo this is the am__doit target
664db17cd6dSmrg.PHONY: am__doit
665db17cd6dSmrgEND
666db17cd6dSmrg# If we don't find an include directive, just comment out the code.
667db17cd6dSmrgAC_MSG_CHECKING([for style of include used by $am_make])
668db17cd6dSmrgam__include="#"
669db17cd6dSmrgam__quote=
670db17cd6dSmrg_am_result=none
671db17cd6dSmrg# First try GNU make style include.
672db17cd6dSmrgecho "include confinc" > confmf
6739ff100acSmrg# Ignore all kinds of additional output from 'make'.
674db17cd6dSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675db17cd6dSmrg*the\ am__doit\ target*)
676db17cd6dSmrg  am__include=include
677db17cd6dSmrg  am__quote=
678db17cd6dSmrg  _am_result=GNU
679db17cd6dSmrg  ;;
680db17cd6dSmrgesac
681db17cd6dSmrg# Now try BSD make style include.
682db17cd6dSmrgif test "$am__include" = "#"; then
683db17cd6dSmrg   echo '.include "confinc"' > confmf
684db17cd6dSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685db17cd6dSmrg   *the\ am__doit\ target*)
686db17cd6dSmrg     am__include=.include
687db17cd6dSmrg     am__quote="\""
688db17cd6dSmrg     _am_result=BSD
689db17cd6dSmrg     ;;
690db17cd6dSmrg   esac
69176910425Smrgfi
692db17cd6dSmrgAC_SUBST([am__include])
693db17cd6dSmrgAC_SUBST([am__quote])
694db17cd6dSmrgAC_MSG_RESULT([$_am_result])
695db17cd6dSmrgrm -f confinc confmf
696db17cd6dSmrg])
69776910425Smrg
698db17cd6dSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
699db17cd6dSmrg
7009ff100acSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
701db17cd6dSmrg#
702db17cd6dSmrg# This file is free software; the Free Software Foundation
703db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
704db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
705db17cd6dSmrg
706db17cd6dSmrg# AM_MISSING_PROG(NAME, PROGRAM)
707db17cd6dSmrg# ------------------------------
708db17cd6dSmrgAC_DEFUN([AM_MISSING_PROG],
709db17cd6dSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
710db17cd6dSmrg$1=${$1-"${am_missing_run}$2"}
711db17cd6dSmrgAC_SUBST($1)])
712db17cd6dSmrg
713db17cd6dSmrg# AM_MISSING_HAS_RUN
714db17cd6dSmrg# ------------------
7159ff100acSmrg# Define MISSING if not defined so far and test if it is modern enough.
7169ff100acSmrg# If it is, 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
7299ff100acSmrgif eval "$MISSING --is-lightweight"; then
7309ff100acSmrg  am_missing_run="$MISSING "
731db17cd6dSmrgelse
732db17cd6dSmrg  am_missing_run=
7339ff100acSmrg  AC_MSG_WARN(['missing' script is too old or missing])
73476910425Smrgfi
735db17cd6dSmrg])
73676910425Smrg
737db17cd6dSmrg# Helper functions for option handling.                     -*- Autoconf -*-
738db17cd6dSmrg
7399ff100acSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
740db17cd6dSmrg#
741db17cd6dSmrg# This file is free software; the Free Software Foundation
742db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
743db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
744db17cd6dSmrg
745db17cd6dSmrg# _AM_MANGLE_OPTION(NAME)
746db17cd6dSmrg# -----------------------
747db17cd6dSmrgAC_DEFUN([_AM_MANGLE_OPTION],
748db17cd6dSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
749db17cd6dSmrg
750db17cd6dSmrg# _AM_SET_OPTION(NAME)
7519ff100acSmrg# --------------------
752db17cd6dSmrg# Set option NAME.  Presently that only means defining a flag for this option.
753db17cd6dSmrgAC_DEFUN([_AM_SET_OPTION],
7549ff100acSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
755db17cd6dSmrg
756db17cd6dSmrg# _AM_SET_OPTIONS(OPTIONS)
7579ff100acSmrg# ------------------------
758db17cd6dSmrg# OPTIONS is a space-separated list of Automake options.
759db17cd6dSmrgAC_DEFUN([_AM_SET_OPTIONS],
760db17cd6dSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
76176910425Smrg
762db17cd6dSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
763db17cd6dSmrg# -------------------------------------------
764db17cd6dSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
765db17cd6dSmrgAC_DEFUN([_AM_IF_OPTION],
766db17cd6dSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76776910425Smrg
7689ff100acSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
7699ff100acSmrg#
7709ff100acSmrg# This file is free software; the Free Software Foundation
7719ff100acSmrg# gives unlimited permission to copy and/or distribute it,
7729ff100acSmrg# with or without modifications, as long as this notice is preserved.
7739ff100acSmrg
7749ff100acSmrg# _AM_PROG_CC_C_O
7759ff100acSmrg# ---------------
7769ff100acSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7779ff100acSmrg# to automatically call this.
7789ff100acSmrgAC_DEFUN([_AM_PROG_CC_C_O],
7799ff100acSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7809ff100acSmrgAC_REQUIRE_AUX_FILE([compile])dnl
7819ff100acSmrgAC_LANG_PUSH([C])dnl
7829ff100acSmrgAC_CACHE_CHECK(
7839ff100acSmrg  [whether $CC understands -c and -o together],
7849ff100acSmrg  [am_cv_prog_cc_c_o],
7859ff100acSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7869ff100acSmrg  # Make sure it works both with $CC and with simple cc.
7879ff100acSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7889ff100acSmrg  # compilers refuse to overwrite an existing .o file with -o,
7899ff100acSmrg  # though they will create one.
7909ff100acSmrg  am_cv_prog_cc_c_o=yes
7919ff100acSmrg  for am_i in 1 2; do
7929ff100acSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7939ff100acSmrg         && test -f conftest2.$ac_objext; then
7949ff100acSmrg      : OK
7959ff100acSmrg    else
7969ff100acSmrg      am_cv_prog_cc_c_o=no
7979ff100acSmrg      break
7989ff100acSmrg    fi
7999ff100acSmrg  done
8009ff100acSmrg  rm -f core conftest*
8019ff100acSmrg  unset am_i])
8029ff100acSmrgif test "$am_cv_prog_cc_c_o" != yes; then
8039ff100acSmrg   # Losing compiler, so override with the script.
8049ff100acSmrg   # FIXME: It is wrong to rewrite CC.
8059ff100acSmrg   # But if we don't then we get into trouble of one sort or another.
8069ff100acSmrg   # A longer-term fix would be to have automake use am__CC in this case,
8079ff100acSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8089ff100acSmrg   CC="$am_aux_dir/compile $CC"
8099ff100acSmrgfi
8109ff100acSmrgAC_LANG_POP([C])])
8119ff100acSmrg
8129ff100acSmrg# For backward compatibility.
8139ff100acSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81476910425Smrg
8159ff100acSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
816db17cd6dSmrg#
817db17cd6dSmrg# This file is free software; the Free Software Foundation
818db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
819db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
82076910425Smrg
8219ff100acSmrg# AM_RUN_LOG(COMMAND)
8229ff100acSmrg# -------------------
8239ff100acSmrg# Run COMMAND, save the exit status in ac_status, and log it.
8249ff100acSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8259ff100acSmrgAC_DEFUN([AM_RUN_LOG],
8269ff100acSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8279ff100acSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8289ff100acSmrg   ac_status=$?
8299ff100acSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8309ff100acSmrg   (exit $ac_status); }])
8319ff100acSmrg
8329ff100acSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8339ff100acSmrg
8349ff100acSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
8359ff100acSmrg#
8369ff100acSmrg# This file is free software; the Free Software Foundation
8379ff100acSmrg# gives unlimited permission to copy and/or distribute it,
8389ff100acSmrg# with or without modifications, as long as this notice is preserved.
83976910425Smrg
840db17cd6dSmrg# AM_SANITY_CHECK
841db17cd6dSmrg# ---------------
842db17cd6dSmrgAC_DEFUN([AM_SANITY_CHECK],
843db17cd6dSmrg[AC_MSG_CHECKING([whether build environment is sane])
844db17cd6dSmrg# Reject unsafe characters in $srcdir or the absolute working directory
845db17cd6dSmrg# name.  Accept space and tab only in the latter.
846db17cd6dSmrgam_lf='
847db17cd6dSmrg'
848db17cd6dSmrgcase `pwd` in
849db17cd6dSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850db17cd6dSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851db17cd6dSmrgesac
852db17cd6dSmrgcase $srcdir in
853db17cd6dSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8549ff100acSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855db17cd6dSmrgesac
85676910425Smrg
8579ff100acSmrg# Do 'set' in a subshell so we don't clobber the current shell's
858db17cd6dSmrg# arguments.  Must try -L first in case configure is actually a
859db17cd6dSmrg# symlink; some systems play weird games with the mod time of symlinks
860db17cd6dSmrg# (eg FreeBSD returns the mod time of the symlink's containing
861db17cd6dSmrg# directory).
862db17cd6dSmrgif (
8639ff100acSmrg   am_has_slept=no
8649ff100acSmrg   for am_try in 1 2; do
8659ff100acSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8669ff100acSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8679ff100acSmrg     if test "$[*]" = "X"; then
8689ff100acSmrg	# -L didn't work.
8699ff100acSmrg	set X `ls -t "$srcdir/configure" conftest.file`
8709ff100acSmrg     fi
8719ff100acSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8729ff100acSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8739ff100acSmrg
8749ff100acSmrg	# If neither matched, then we have a broken ls.  This can happen
8759ff100acSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8769ff100acSmrg	# broken ls alias from the environment.  This has actually
8779ff100acSmrg	# happened.  Such a system could not be considered "sane".
8789ff100acSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8799ff100acSmrg  alias in your environment])
8809ff100acSmrg     fi
8819ff100acSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8829ff100acSmrg       break
8839ff100acSmrg     fi
8849ff100acSmrg     # Just in case.
8859ff100acSmrg     sleep 1
8869ff100acSmrg     am_has_slept=yes
8879ff100acSmrg   done
888db17cd6dSmrg   test "$[2]" = conftest.file
889db17cd6dSmrg   )
890db17cd6dSmrgthen
891db17cd6dSmrg   # Ok.
892db17cd6dSmrg   :
89376910425Smrgelse
894db17cd6dSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
895db17cd6dSmrgCheck your system clock])
89676910425Smrgfi
8979ff100acSmrgAC_MSG_RESULT([yes])
8989ff100acSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8999ff100acSmrg# generated files are strictly newer.
9009ff100acSmrgam_sleep_pid=
9019ff100acSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9029ff100acSmrg  ( sleep 1 ) &
9039ff100acSmrg  am_sleep_pid=$!
9049ff100acSmrgfi
9059ff100acSmrgAC_CONFIG_COMMANDS_PRE(
9069ff100acSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9079ff100acSmrg   if test -n "$am_sleep_pid"; then
9089ff100acSmrg     # Hide warnings about reused PIDs.
9099ff100acSmrg     wait $am_sleep_pid 2>/dev/null
9109ff100acSmrg   fi
9119ff100acSmrg   AC_MSG_RESULT([done])])
9129ff100acSmrgrm -f conftest.file
9139ff100acSmrg])
91476910425Smrg
9159ff100acSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916db17cd6dSmrg#
917db17cd6dSmrg# This file is free software; the Free Software Foundation
918db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
919db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
92076910425Smrg
921db17cd6dSmrg# AM_SILENT_RULES([DEFAULT])
922db17cd6dSmrg# --------------------------
923db17cd6dSmrg# Enable less verbose build rules; with the default set to DEFAULT
9249ff100acSmrg# ("yes" being less verbose, "no" or empty being verbose).
925db17cd6dSmrgAC_DEFUN([AM_SILENT_RULES],
9269ff100acSmrg[AC_ARG_ENABLE([silent-rules], [dnl
9279ff100acSmrgAS_HELP_STRING(
9289ff100acSmrg  [--enable-silent-rules],
9299ff100acSmrg  [less verbose build output (undo: "make V=1")])
9309ff100acSmrgAS_HELP_STRING(
9319ff100acSmrg  [--disable-silent-rules],
9329ff100acSmrg  [verbose build output (undo: "make V=0")])dnl
9339ff100acSmrg])
9349ff100acSmrgcase $enable_silent_rules in @%:@ (((
9359ff100acSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
9369ff100acSmrg   no) AM_DEFAULT_VERBOSITY=1;;
9379ff100acSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938db17cd6dSmrgesac
9399ff100acSmrgdnl
9409ff100acSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9419ff100acSmrgdnl do not support nested variable expansions.
9429ff100acSmrgdnl See automake bug#9928 and bug#10237.
9439ff100acSmrgam_make=${MAKE-make}
9449ff100acSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9459ff100acSmrg   [am_cv_make_support_nested_variables],
9469ff100acSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9479ff100acSmrgBAR0=false
9489ff100acSmrgBAR1=true
9499ff100acSmrgV=1
9509ff100acSmrgam__doit:
9519ff100acSmrg	@$(TRUE)
9529ff100acSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9539ff100acSmrg  am_cv_make_support_nested_variables=yes
9549ff100acSmrgelse
9559ff100acSmrg  am_cv_make_support_nested_variables=no
9569ff100acSmrgfi])
9579ff100acSmrgif test $am_cv_make_support_nested_variables = yes; then
9589ff100acSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9599ff100acSmrg  AM_V='$(V)'
9609ff100acSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9619ff100acSmrgelse
9629ff100acSmrg  AM_V=$AM_DEFAULT_VERBOSITY
9639ff100acSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9649ff100acSmrgfi
9659ff100acSmrgAC_SUBST([AM_V])dnl
9669ff100acSmrgAM_SUBST_NOTMAKE([AM_V])dnl
9679ff100acSmrgAC_SUBST([AM_DEFAULT_V])dnl
9689ff100acSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969db17cd6dSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970db17cd6dSmrgAM_BACKSLASH='\'
971db17cd6dSmrgAC_SUBST([AM_BACKSLASH])dnl
972db17cd6dSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973db17cd6dSmrg])
97476910425Smrg
9759ff100acSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
976db17cd6dSmrg#
977db17cd6dSmrg# This file is free software; the Free Software Foundation
978db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
979db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
98076910425Smrg
981db17cd6dSmrg# AM_PROG_INSTALL_STRIP
982db17cd6dSmrg# ---------------------
9839ff100acSmrg# One issue with vendor 'install' (even GNU) is that you can't
984db17cd6dSmrg# specify the program used to strip binaries.  This is especially
985db17cd6dSmrg# annoying in cross-compiling environments, where the build's strip
986db17cd6dSmrg# is unlikely to handle the host's binaries.
987db17cd6dSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9889ff100acSmrg# always use install-sh in "make install-strip", and initialize
989db17cd6dSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
990db17cd6dSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
991db17cd6dSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9929ff100acSmrg# Installed binaries are usually stripped using 'strip' when the user
9939ff100acSmrg# run "make install-strip".  However 'strip' might not be the right
994db17cd6dSmrg# tool to use in cross-compilation environments, therefore Automake
9959ff100acSmrg# will honor the 'STRIP' environment variable to overrule this program.
9969ff100acSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
997db17cd6dSmrgif test "$cross_compiling" != no; then
998db17cd6dSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
99976910425Smrgfi
1000db17cd6dSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1001db17cd6dSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100276910425Smrg
10039ff100acSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
1004db17cd6dSmrg#
1005db17cd6dSmrg# This file is free software; the Free Software Foundation
1006db17cd6dSmrg# gives unlimited permission to copy and/or distribute it,
1007db17cd6dSmrg# with or without modifications, as long as this notice is preserved.
100876910425Smrg
1009db17cd6dSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1010db17cd6dSmrg# ---------------------------
1011db17cd6dSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1012db17cd6dSmrg# This macro is traced by Automake.
1013db17cd6dSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101476910425Smrg
1015db17cd6dSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10169ff100acSmrg# --------------------------
1017db17cd6dSmrg# Public sister of _AM_SUBST_NOTMAKE.
1018db17cd6dSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101976910425Smrg
1020db17cd6dSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1021db17cd6dSmrg
10229ff100acSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
102376910425Smrg#
102476910425Smrg# This file is free software; the Free Software Foundation
102576910425Smrg# gives unlimited permission to copy and/or distribute it,
102676910425Smrg# with or without modifications, as long as this notice is preserved.
102776910425Smrg
1028db17cd6dSmrg# _AM_PROG_TAR(FORMAT)
1029db17cd6dSmrg# --------------------
1030db17cd6dSmrg# Check how to create a tarball in format FORMAT.
10319ff100acSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1032db17cd6dSmrg#
1033db17cd6dSmrg# Substitute a variable $(am__tar) that is a command
1034db17cd6dSmrg# writing to stdout a FORMAT-tarball containing the directory
1035db17cd6dSmrg# $tardir.
1036db17cd6dSmrg#     tardir=directory && $(am__tar) > result.tar
1037db17cd6dSmrg#
1038db17cd6dSmrg# Substitute a variable $(am__untar) that extract such
1039db17cd6dSmrg# a tarball read from stdin.
1040db17cd6dSmrg#     $(am__untar) < result.tar
10419ff100acSmrg#
1042db17cd6dSmrgAC_DEFUN([_AM_PROG_TAR],
10439ff100acSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10449ff100acSmrg# in the wild :-(  We should find a proper way to deprecate it ...
10459ff100acSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10469ff100acSmrg
10479ff100acSmrg# We'll loop over all known methods to create a tar archive until one works.
1048db17cd6dSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1049db17cd6dSmrg
10509ff100acSmrgm4_if([$1], [v7],
10519ff100acSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10529ff100acSmrg
10539ff100acSmrg  [m4_case([$1],
10549ff100acSmrg    [ustar],
10559ff100acSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10569ff100acSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10579ff100acSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10589ff100acSmrg      # and bug#13588).
10599ff100acSmrg      am_max_uid=2097151 # 2^21 - 1
10609ff100acSmrg      am_max_gid=$am_max_uid
10619ff100acSmrg      # The $UID and $GID variables are not portable, so we need to resort
10629ff100acSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10639ff100acSmrg      # below are definitely unexpected, so allow the users to see them
10649ff100acSmrg      # (that is, avoid stderr redirection).
10659ff100acSmrg      am_uid=`id -u || echo unknown`
10669ff100acSmrg      am_gid=`id -g || echo unknown`
10679ff100acSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10689ff100acSmrg      if test $am_uid -le $am_max_uid; then
10699ff100acSmrg         AC_MSG_RESULT([yes])
10709ff100acSmrg      else
10719ff100acSmrg         AC_MSG_RESULT([no])
10729ff100acSmrg         _am_tools=none
10739ff100acSmrg      fi
10749ff100acSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10759ff100acSmrg      if test $am_gid -le $am_max_gid; then
10769ff100acSmrg         AC_MSG_RESULT([yes])
10779ff100acSmrg      else
10789ff100acSmrg        AC_MSG_RESULT([no])
10799ff100acSmrg        _am_tools=none
10809ff100acSmrg      fi],
10819ff100acSmrg
10829ff100acSmrg  [pax],
10839ff100acSmrg    [],
10849ff100acSmrg
10859ff100acSmrg  [m4_fatal([Unknown tar format])])
10869ff100acSmrg
10879ff100acSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10889ff100acSmrg
10899ff100acSmrg  # Go ahead even if we have the value already cached.  We do so because we
10909ff100acSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10919ff100acSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10929ff100acSmrg
10939ff100acSmrg  for _am_tool in $_am_tools; do
10949ff100acSmrg    case $_am_tool in
10959ff100acSmrg    gnutar)
10969ff100acSmrg      for _am_tar in tar gnutar gtar; do
10979ff100acSmrg        AM_RUN_LOG([$_am_tar --version]) && break
10989ff100acSmrg      done
10999ff100acSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11009ff100acSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11019ff100acSmrg      am__untar="$_am_tar -xf -"
11029ff100acSmrg      ;;
11039ff100acSmrg    plaintar)
11049ff100acSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11059ff100acSmrg      # ustar tarball either.
11069ff100acSmrg      (tar --version) >/dev/null 2>&1 && continue
11079ff100acSmrg      am__tar='tar chf - "$$tardir"'
11089ff100acSmrg      am__tar_='tar chf - "$tardir"'
11099ff100acSmrg      am__untar='tar xf -'
11109ff100acSmrg      ;;
11119ff100acSmrg    pax)
11129ff100acSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
11139ff100acSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
11149ff100acSmrg      am__untar='pax -r'
11159ff100acSmrg      ;;
11169ff100acSmrg    cpio)
11179ff100acSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11189ff100acSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11199ff100acSmrg      am__untar='cpio -i -H $1 -d'
11209ff100acSmrg      ;;
11219ff100acSmrg    none)
11229ff100acSmrg      am__tar=false
11239ff100acSmrg      am__tar_=false
11249ff100acSmrg      am__untar=false
11259ff100acSmrg      ;;
11269ff100acSmrg    esac
112776910425Smrg
11289ff100acSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
11299ff100acSmrg    # and am__untar set.
11309ff100acSmrg    test -n "${am_cv_prog_tar_$1}" && break
11319ff100acSmrg
11329ff100acSmrg    # tar/untar a dummy directory, and stop if the command works.
11339ff100acSmrg    rm -rf conftest.dir
11349ff100acSmrg    mkdir conftest.dir
11359ff100acSmrg    echo GrepMe > conftest.dir/file
11369ff100acSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11379ff100acSmrg    rm -rf conftest.dir
11389ff100acSmrg    if test -s conftest.tar; then
11399ff100acSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
11409ff100acSmrg      AM_RUN_LOG([cat conftest.dir/file])
11419ff100acSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11429ff100acSmrg    fi
11439ff100acSmrg  done
1144db17cd6dSmrg  rm -rf conftest.dir
114576910425Smrg
11469ff100acSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11479ff100acSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11489ff100acSmrg
1149db17cd6dSmrgAC_SUBST([am__tar])
1150db17cd6dSmrgAC_SUBST([am__untar])
1151db17cd6dSmrg]) # _AM_PROG_TAR
115276910425Smrg
11539ff100acSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
11549ff100acSmrg# 
11559ff100acSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115676910425Smrg#
11579ff100acSmrg# This program is free software; you can redistribute it and/or modify
11589ff100acSmrg# it under the terms of the GNU General Public License as published by
11599ff100acSmrg# the Free Software Foundation; either version 2 of the License, or
11609ff100acSmrg# (at your option) any later version.
116176910425Smrg#
11629ff100acSmrg# This program is distributed in the hope that it will be useful, but
11639ff100acSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
11649ff100acSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11659ff100acSmrg# General Public License for more details.
116676910425Smrg#
11679ff100acSmrg# You should have received a copy of the GNU General Public License
11689ff100acSmrg# along with this program; if not, write to the Free Software
11699ff100acSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
117076910425Smrg#
11719ff100acSmrg# As a special exception to the GNU General Public License, if you
11729ff100acSmrg# distribute this file as part of a program that contains a
11739ff100acSmrg# configuration script generated by Autoconf, you may include it under
11749ff100acSmrg# the same distribution terms that you use for the rest of that program.
117576910425Smrg
11769ff100acSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
11779ff100acSmrg# ----------------------------------
11789ff100acSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
11799ff100acSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
11809ff100acSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
11819ff100acSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
11829ff100acSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
11839ff100acSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
118476910425Smrgfi
11859ff100acSmrgif test -n "$PKG_CONFIG"; then
11869ff100acSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
11879ff100acSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
11889ff100acSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1189db17cd6dSmrg		AC_MSG_RESULT([yes])
1190db17cd6dSmrg	else
11919ff100acSmrg		AC_MSG_RESULT([no])
11929ff100acSmrg		PKG_CONFIG=""
1193db17cd6dSmrg	fi
11949ff100acSmrg		
11959ff100acSmrgfi[]dnl
11969ff100acSmrg])# PKG_PROG_PKG_CONFIG
119776910425Smrg
11989ff100acSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
119976910425Smrg#
12009ff100acSmrg# Check to see whether a particular set of modules exists.  Similar
12019ff100acSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12029ff100acSmrg#
12039ff100acSmrg#
12049ff100acSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12059ff100acSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
12069ff100acSmrg# PKG_CHECK_EXISTS manually
12079ff100acSmrg# --------------------------------------------------------------
12089ff100acSmrgAC_DEFUN([PKG_CHECK_EXISTS],
12099ff100acSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12109ff100acSmrgif test -n "$PKG_CONFIG" && \
12119ff100acSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12129ff100acSmrg  m4_ifval([$2], [$2], [:])
12139ff100acSmrgm4_ifvaln([$3], [else
12149ff100acSmrg  $3])dnl
12159ff100acSmrgfi])
12169ff100acSmrg
12179ff100acSmrg
12189ff100acSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12199ff100acSmrg# ---------------------------------------------
12209ff100acSmrgm4_define([_PKG_CONFIG],
12219ff100acSmrg[if test -n "$$1"; then
12229ff100acSmrg    pkg_cv_[]$1="$$1"
12239ff100acSmrg elif test -n "$PKG_CONFIG"; then
12249ff100acSmrg    PKG_CHECK_EXISTS([$3],
12259ff100acSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
12269ff100acSmrg		     [pkg_failed=yes])
12279ff100acSmrg else
12289ff100acSmrg    pkg_failed=untried
12299ff100acSmrgfi[]dnl
12309ff100acSmrg])# _PKG_CONFIG
12319ff100acSmrg
12329ff100acSmrg# _PKG_SHORT_ERRORS_SUPPORTED
12339ff100acSmrg# -----------------------------
12349ff100acSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12359ff100acSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12369ff100acSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12379ff100acSmrg        _pkg_short_errors_supported=yes
12389ff100acSmrgelse
12399ff100acSmrg        _pkg_short_errors_supported=no
12409ff100acSmrgfi[]dnl
12419ff100acSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
12429ff100acSmrg
12439ff100acSmrg
12449ff100acSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12459ff100acSmrg# [ACTION-IF-NOT-FOUND])
12469ff100acSmrg#
12479ff100acSmrg#
12489ff100acSmrg# Note that if there is a possibility the first call to
12499ff100acSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12509ff100acSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12519ff100acSmrg#
12529ff100acSmrg#
12539ff100acSmrg# --------------------------------------------------------------
12549ff100acSmrgAC_DEFUN([PKG_CHECK_MODULES],
12559ff100acSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12569ff100acSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12579ff100acSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12589ff100acSmrg
12599ff100acSmrgpkg_failed=no
12609ff100acSmrgAC_MSG_CHECKING([for $1])
12619ff100acSmrg
12629ff100acSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12639ff100acSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12649ff100acSmrg
12659ff100acSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12669ff100acSmrgand $1[]_LIBS to avoid the need to call pkg-config.
12679ff100acSmrgSee the pkg-config man page for more details.])
12689ff100acSmrg
12699ff100acSmrgif test $pkg_failed = yes; then
12709ff100acSmrg        _PKG_SHORT_ERRORS_SUPPORTED
12719ff100acSmrg        if test $_pkg_short_errors_supported = yes; then
12729ff100acSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
12739ff100acSmrg        else 
12749ff100acSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
12759ff100acSmrg        fi
12769ff100acSmrg	# Put the nasty error message in config.log where it belongs
12779ff100acSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
12789ff100acSmrg
12799ff100acSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
12809ff100acSmrg[Package requirements ($2) were not met:
12819ff100acSmrg
12829ff100acSmrg$$1_PKG_ERRORS
12839ff100acSmrg
12849ff100acSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
12859ff100acSmrginstalled software in a non-standard prefix.
12869ff100acSmrg
12879ff100acSmrg_PKG_TEXT
12889ff100acSmrg])],
12899ff100acSmrg		[AC_MSG_RESULT([no])
12909ff100acSmrg                $4])
12919ff100acSmrgelif test $pkg_failed = untried; then
12929ff100acSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
12939ff100acSmrg[The pkg-config script could not be found or is too old.  Make sure it
12949ff100acSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
12959ff100acSmrgpath to pkg-config.
12969ff100acSmrg
12979ff100acSmrg_PKG_TEXT
12989ff100acSmrg
12999ff100acSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13009ff100acSmrg		[$4])
13019ff100acSmrgelse
13029ff100acSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13039ff100acSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13049ff100acSmrg        AC_MSG_RESULT([yes])
13059ff100acSmrg	ifelse([$3], , :, [$3])
13069ff100acSmrgfi[]dnl
13079ff100acSmrg])# PKG_CHECK_MODULES
13089ff100acSmrg
13099ff100acSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13109ff100acSmrgdnl
13119ff100acSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13129ff100acSmrgdnl
13139ff100acSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13149ff100acSmrgdnl copy of this software and associated documentation files (the "Software"),
13159ff100acSmrgdnl to deal in the Software without restriction, including without limitation
13169ff100acSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13179ff100acSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
13189ff100acSmrgdnl Software is furnished to do so, subject to the following conditions:
13199ff100acSmrgdnl
13209ff100acSmrgdnl The above copyright notice and this permission notice (including the next
13219ff100acSmrgdnl paragraph) shall be included in all copies or substantial portions of the
13229ff100acSmrgdnl Software.
13239ff100acSmrgdnl
13249ff100acSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13259ff100acSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13269ff100acSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13279ff100acSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13289ff100acSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13299ff100acSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13309ff100acSmrgdnl DEALINGS IN THE SOFTWARE.
13319ff100acSmrg
13329ff100acSmrg# XORG_MACROS_VERSION(required-version)
13339ff100acSmrg# -------------------------------------
13349ff100acSmrg# Minimum version: 1.1.0
13359ff100acSmrg#
13369ff100acSmrg# If you're using a macro added in Version 1.1 or newer, include this in
13379ff100acSmrg# your configure.ac with the minimum required version, such as:
13389ff100acSmrg# XORG_MACROS_VERSION(1.1)
13399ff100acSmrg#
13409ff100acSmrg# To ensure that this macro is defined, also add:
13419ff100acSmrg# m4_ifndef([XORG_MACROS_VERSION],
13429ff100acSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13439ff100acSmrg#
13449ff100acSmrg#
13459ff100acSmrg# See the "minimum version" comment for each macro you use to see what
13469ff100acSmrg# version you require.
13479ff100acSmrgm4_defun([XORG_MACROS_VERSION],[
13489ff100acSmrgm4_define([vers_have], [1.19.0])
13499ff100acSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13509ff100acSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13519ff100acSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13529ff100acSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13539ff100acSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13549ff100acSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13559ff100acSmrgm4_undefine([vers_have])
13569ff100acSmrgm4_undefine([maj_have])
13579ff100acSmrgm4_undefine([maj_needed])
13589ff100acSmrg]) # XORG_MACROS_VERSION
13599ff100acSmrg
13609ff100acSmrg# XORG_PROG_RAWCPP()
13619ff100acSmrg# ------------------
13629ff100acSmrg# Minimum version: 1.0.0
13639ff100acSmrg#
13649ff100acSmrg# Find cpp program and necessary flags for use in pre-processing text files
13659ff100acSmrg# such as man pages and config files
13669ff100acSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
13679ff100acSmrgAC_REQUIRE([AC_PROG_CPP])
13689ff100acSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
13699ff100acSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
13709ff100acSmrg
13719ff100acSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
13729ff100acSmrg# which is not the best choice for supporting other OS'es, but covers most
13739ff100acSmrg# of the ones we need for now.
13749ff100acSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
13759ff100acSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
13769ff100acSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13779ff100acSmrg	AC_MSG_RESULT([no])
13789ff100acSmrgelse
13799ff100acSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13809ff100acSmrg		RAWCPPFLAGS=-undef
13819ff100acSmrg		AC_MSG_RESULT([yes])
13829ff100acSmrg	# under Cygwin unix is still defined even with -undef
13839ff100acSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13849ff100acSmrg		RAWCPPFLAGS="-undef -ansi"
13859ff100acSmrg		AC_MSG_RESULT([yes, with -ansi])
13869ff100acSmrg	else
13879ff100acSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
13889ff100acSmrg	fi
13899ff100acSmrgfi
13909ff100acSmrgrm -f conftest.$ac_ext
13919ff100acSmrg
13929ff100acSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
13939ff100acSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
13949ff100acSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13959ff100acSmrg	AC_MSG_RESULT([no])
13969ff100acSmrgelse
13979ff100acSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13989ff100acSmrg		TRADITIONALCPPFLAGS="-traditional"
13999ff100acSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14009ff100acSmrg		AC_MSG_RESULT([yes])
14019ff100acSmrg	else
14029ff100acSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14039ff100acSmrg	fi
14049ff100acSmrgfi
14059ff100acSmrgrm -f conftest.$ac_ext
14069ff100acSmrgAC_SUBST(RAWCPPFLAGS)
14079ff100acSmrgAC_SUBST(TRADITIONALCPPFLAGS)
14089ff100acSmrg]) # XORG_PROG_RAWCPP
14099ff100acSmrg
14109ff100acSmrg# XORG_MANPAGE_SECTIONS()
14119ff100acSmrg# -----------------------
14129ff100acSmrg# Minimum version: 1.0.0
14139ff100acSmrg#
14149ff100acSmrg# Determine which sections man pages go in for the different man page types
14159ff100acSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14169ff100acSmrg# Not sure if there's any better way than just hardcoding by OS name.
14179ff100acSmrg# Override default settings by setting environment variables
14189ff100acSmrg# Added MAN_SUBSTS in version 1.8
14199ff100acSmrg# Added AC_PROG_SED in version 1.8
14209ff100acSmrg
14219ff100acSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14229ff100acSmrgAC_REQUIRE([AC_CANONICAL_HOST])
14239ff100acSmrgAC_REQUIRE([AC_PROG_SED])
14249ff100acSmrg
14259ff100acSmrgif test x$APP_MAN_SUFFIX = x    ; then
14269ff100acSmrg    APP_MAN_SUFFIX=1
14279ff100acSmrgfi
14289ff100acSmrgif test x$APP_MAN_DIR = x    ; then
14299ff100acSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14309ff100acSmrgfi
143176910425Smrg
1432db17cd6dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1433db17cd6dSmrg    LIB_MAN_SUFFIX=3
1434db17cd6dSmrgfi
1435db17cd6dSmrgif test x$LIB_MAN_DIR = x    ; then
1436db17cd6dSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
143776910425Smrgfi
143876910425Smrg
1439db17cd6dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1440db17cd6dSmrg    case $host_os in
1441db17cd6dSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1442db17cd6dSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1443db17cd6dSmrg    esac
1444db17cd6dSmrgfi
1445db17cd6dSmrgif test x$FILE_MAN_DIR = x    ; then
1446db17cd6dSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1447db17cd6dSmrgfi
144876910425Smrg
1449db17cd6dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1450db17cd6dSmrg    case $host_os in
1451db17cd6dSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1452db17cd6dSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1453db17cd6dSmrg    esac
1454db17cd6dSmrgfi
1455db17cd6dSmrgif test x$MISC_MAN_DIR = x    ; then
1456db17cd6dSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1457db17cd6dSmrgfi
145876910425Smrg
1459db17cd6dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1460db17cd6dSmrg    case $host_os in
1461db17cd6dSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1462db17cd6dSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1463db17cd6dSmrg    esac
1464db17cd6dSmrgfi
1465db17cd6dSmrgif test x$DRIVER_MAN_DIR = x    ; then
1466db17cd6dSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1467db17cd6dSmrgfi
146876910425Smrg
1469db17cd6dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1470db17cd6dSmrg    case $host_os in
1471db17cd6dSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1472db17cd6dSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1473db17cd6dSmrg    esac
1474db17cd6dSmrgfi
1475db17cd6dSmrgif test x$ADMIN_MAN_DIR = x    ; then
1476db17cd6dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
147776910425Smrgfi
147876910425Smrg
147976910425Smrg
1480db17cd6dSmrgAC_SUBST([APP_MAN_SUFFIX])
1481db17cd6dSmrgAC_SUBST([LIB_MAN_SUFFIX])
1482db17cd6dSmrgAC_SUBST([FILE_MAN_SUFFIX])
1483db17cd6dSmrgAC_SUBST([MISC_MAN_SUFFIX])
1484db17cd6dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1485db17cd6dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1486db17cd6dSmrgAC_SUBST([APP_MAN_DIR])
1487db17cd6dSmrgAC_SUBST([LIB_MAN_DIR])
1488db17cd6dSmrgAC_SUBST([FILE_MAN_DIR])
1489db17cd6dSmrgAC_SUBST([MISC_MAN_DIR])
1490db17cd6dSmrgAC_SUBST([DRIVER_MAN_DIR])
1491db17cd6dSmrgAC_SUBST([ADMIN_MAN_DIR])
1492482df631Smrg
1493482df631SmrgXORG_MAN_PAGE="X Version 11"
1494482df631SmrgAC_SUBST([XORG_MAN_PAGE])
1495482df631SmrgMAN_SUBSTS="\
1496482df631Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497482df631Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498482df631Smrg	-e 's|__xservername__|Xorg|g' \
1499482df631Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500482df631Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1501482df631Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502482df631Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503482df631Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504482df631Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505482df631Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506482df631Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507482df631Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508482df631SmrgAC_SUBST([MAN_SUBSTS])
1509482df631Smrg
1510db17cd6dSmrg]) # XORG_MANPAGE_SECTIONS
1511db17cd6dSmrg
1512482df631Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513482df631Smrg# ------------------------
1514482df631Smrg# Minimum version: 1.7.0
1515482df631Smrg#
1516482df631Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517482df631Smrg# provided by xorg-sgml-doctools, if installed.
1518482df631SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519482df631SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520482df631SmrgXORG_SGML_PATH=
1521482df631SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522482df631Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523482df631Smrg    [m4_ifval([$1],[:],
1524482df631Smrg        [if test x"$cross_compiling" != x"yes" ; then
1525482df631Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526482df631Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527482df631Smrg         fi])
1528482df631Smrg    ])
1529482df631Smrg
1530482df631Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531482df631Smrg# the path and the name of the doc stylesheet
1532482df631Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1533482df631Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534482df631Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535482df631Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536482df631Smrgelse
1537482df631Smrg   AC_MSG_RESULT([no])
1538482df631Smrgfi
1539482df631Smrg
1540482df631SmrgAC_SUBST(XORG_SGML_PATH)
1541482df631SmrgAC_SUBST(STYLESHEET_SRCDIR)
1542482df631SmrgAC_SUBST(XSL_STYLESHEET)
1543482df631SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544482df631Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1545482df631Smrg
1546db17cd6dSmrg# XORG_CHECK_LINUXDOC
1547db17cd6dSmrg# -------------------
1548db17cd6dSmrg# Minimum version: 1.0.0
154976910425Smrg#
1550db17cd6dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1551db17cd6dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1552db17cd6dSmrg# Whether or not the necessary tools and files are found can be checked
1553db17cd6dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1554db17cd6dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555482df631SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556482df631SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
155776910425Smrg
1558db17cd6dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
155976910425Smrg
1560482df631SmrgAC_MSG_CHECKING([whether to build documentation])
156176910425Smrg
1562482df631Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1563db17cd6dSmrg   BUILDDOC=yes
1564db17cd6dSmrgelse
1565db17cd6dSmrg   BUILDDOC=no
1566db17cd6dSmrgfi
156776910425Smrg
1568db17cd6dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
156976910425Smrg
1570db17cd6dSmrgAC_MSG_RESULT([$BUILDDOC])
157176910425Smrg
1572482df631SmrgAC_MSG_CHECKING([whether to build pdf documentation])
157376910425Smrg
1574482df631Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1575db17cd6dSmrg   BUILDPDFDOC=yes
1576db17cd6dSmrgelse
1577db17cd6dSmrg   BUILDPDFDOC=no
1578db17cd6dSmrgfi
157976910425Smrg
1580db17cd6dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
158176910425Smrg
1582db17cd6dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
158376910425Smrg
1584482df631SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1585db17cd6dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1586db17cd6dSmrgMAKE_PDF="$PS2PDF"
1587db17cd6dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
158876910425Smrg
1589db17cd6dSmrgAC_SUBST(MAKE_TEXT)
1590db17cd6dSmrgAC_SUBST(MAKE_PS)
1591db17cd6dSmrgAC_SUBST(MAKE_PDF)
1592db17cd6dSmrgAC_SUBST(MAKE_HTML)
1593db17cd6dSmrg]) # XORG_CHECK_LINUXDOC
1594db17cd6dSmrg
1595db17cd6dSmrg# XORG_CHECK_DOCBOOK
1596db17cd6dSmrg# -------------------
1597db17cd6dSmrg# Minimum version: 1.0.0
1598db17cd6dSmrg#
1599db17cd6dSmrg# Checks for the ability to build output formats from SGML DocBook source.
1600db17cd6dSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1601db17cd6dSmrg# indicates whether the necessary tools and files are found and, if set,
1602db17cd6dSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1603db17cd6dSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604482df631SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605482df631Smrg
1606db17cd6dSmrgBUILDTXTDOC=no
1607db17cd6dSmrgBUILDPDFDOC=no
1608db17cd6dSmrgBUILDPSDOC=no
1609db17cd6dSmrgBUILDHTMLDOC=no
1610db17cd6dSmrg
1611db17cd6dSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1612db17cd6dSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1613db17cd6dSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1614db17cd6dSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1615db17cd6dSmrg
1616482df631SmrgAC_MSG_CHECKING([whether to build text documentation])
1617482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1618db17cd6dSmrg   test x$BUILD_TXTDOC != xno; then
1619db17cd6dSmrg	BUILDTXTDOC=yes
1620db17cd6dSmrgfi
1621db17cd6dSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1622db17cd6dSmrgAC_MSG_RESULT([$BUILDTXTDOC])
162376910425Smrg
1624482df631SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1626db17cd6dSmrg   test x$BUILD_PDFDOC != xno; then
1627db17cd6dSmrg	BUILDPDFDOC=yes
162876910425Smrgfi
1629db17cd6dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1630db17cd6dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
163176910425Smrg
1632482df631SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1634db17cd6dSmrg   test x$BUILD_PSDOC != xno; then
1635db17cd6dSmrg	BUILDPSDOC=yes
1636db17cd6dSmrgfi
1637db17cd6dSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1638db17cd6dSmrgAC_MSG_RESULT([$BUILDPSDOC])
163976910425Smrg
1640482df631SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641482df631Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1642db17cd6dSmrg   test x$BUILD_HTMLDOC != xno; then
1643db17cd6dSmrg	BUILDHTMLDOC=yes
1644db17cd6dSmrgfi
1645db17cd6dSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1646db17cd6dSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
164776910425Smrg
1648db17cd6dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1649db17cd6dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1650db17cd6dSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1651db17cd6dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
165276910425Smrg
1653db17cd6dSmrgAC_SUBST(MAKE_TEXT)
1654db17cd6dSmrgAC_SUBST(MAKE_PS)
1655db17cd6dSmrgAC_SUBST(MAKE_PDF)
1656db17cd6dSmrgAC_SUBST(MAKE_HTML)
1657db17cd6dSmrg]) # XORG_CHECK_DOCBOOK
165876910425Smrg
1659482df631Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660482df631Smrg# ----------------
1661482df631Smrg# Minimum version: 1.5.0
1662482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1663482df631Smrg#
1664482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1665482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1666482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667482df631Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668482df631Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669482df631Smrg# --with-xmlto assumes 'auto'.
1670482df631Smrg#
1671482df631Smrg# Interface to module:
1672482df631Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673482df631Smrg# XMLTO:	returns the path of the xmlto program found
1674482df631Smrg#		returns the path set by the user in the environment
1675482df631Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676482df631Smrg#		'no' user instructs the module not to use xmlto
1677482df631Smrg#
1678482df631Smrg# Added in version 1.10.0
1679482df631Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680482df631Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681482df631Smrg#
1682482df631Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683482df631Smrg#
1684482df631SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685482df631SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
1687482df631SmrgAC_ARG_WITH(xmlto,
1688482df631Smrg	AS_HELP_STRING([--with-xmlto],
1689482df631Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690482df631Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691482df631Smrgm4_undefine([_defopt])
1692482df631Smrg
1693482df631Smrgif test "x$use_xmlto" = x"auto"; then
1694482df631Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1695482df631Smrg   if test "x$XMLTO" = "x"; then
1696482df631Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697482df631Smrg	have_xmlto=no
1698482df631Smrg   else
1699482df631Smrg        have_xmlto=yes
1700482df631Smrg   fi
1701482df631Smrgelif test "x$use_xmlto" = x"yes" ; then
1702482df631Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1703482df631Smrg   if test "x$XMLTO" = "x"; then
1704482df631Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705482df631Smrg   fi
1706482df631Smrg   have_xmlto=yes
1707482df631Smrgelif test "x$use_xmlto" = x"no" ; then
1708482df631Smrg   if test "x$XMLTO" != "x"; then
1709482df631Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710482df631Smrg   fi
1711482df631Smrg   have_xmlto=no
1712482df631Smrgelse
1713482df631Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714482df631Smrgfi
1715482df631Smrg
1716482df631Smrg# Test for a minimum version of xmlto, if provided.
1717482df631Smrgm4_ifval([$1],
1718482df631Smrg[if test "$have_xmlto" = yes; then
1719482df631Smrg    # scrape the xmlto version
1720482df631Smrg    AC_MSG_CHECKING([the xmlto version])
1721482df631Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722482df631Smrg    AC_MSG_RESULT([$xmlto_version])
1723482df631Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724482df631Smrg        [if test "x$use_xmlto" = xauto; then
1725482df631Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726482df631Smrg            have_xmlto=no
1727482df631Smrg        else
1728482df631Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729482df631Smrg        fi])
1730482df631Smrgfi])
1731482df631Smrg
1732482df631Smrg# Test for the ability of xmlto to generate a text target
1733482df631Smrghave_xmlto_text=no
1734482df631Smrgcat > conftest.xml << "EOF"
1735482df631SmrgEOF
1736482df631SmrgAS_IF([test "$have_xmlto" = yes],
1737482df631Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738482df631Smrg             [have_xmlto_text=yes],
1739482df631Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740482df631Smrgrm -f conftest.xml
1741482df631SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742482df631SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743482df631Smrg]) # XORG_WITH_XMLTO
1744482df631Smrg
17459ff100acSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
17469ff100acSmrg# --------------------------------------------
17479ff100acSmrg# Minimum version: 1.12.0
17489ff100acSmrg# Minimum version for optional DEFAULT argument: 1.12.0
17499ff100acSmrg#
17509ff100acSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
17519ff100acSmrg# XML-based language used for the transformation of XML documents.
17529ff100acSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
17539ff100acSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
17549ff100acSmrg# The XSLT processor is often used as a standalone tool for transformations.
17559ff100acSmrg# It should not be assumed that this tool is used only to work with documnetation.
17569ff100acSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
17579ff100acSmrg#
17589ff100acSmrg# Interface to module:
17599ff100acSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
17609ff100acSmrg# XSLTPROC:	 returns the path of the xsltproc program found
17619ff100acSmrg#		 returns the path set by the user in the environment
17629ff100acSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
17639ff100acSmrg#		  'no' user instructs the module not to use xsltproc
17649ff100acSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
17659ff100acSmrg#
17669ff100acSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
17679ff100acSmrg#
17689ff100acSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
17699ff100acSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
17709ff100acSmrg# Preserves the interface, should it be implemented later
17719ff100acSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
17729ff100acSmrgm4_define([_defopt], m4_default([$2], [auto]))
17739ff100acSmrgAC_ARG_WITH(xsltproc,
17749ff100acSmrg	AS_HELP_STRING([--with-xsltproc],
17759ff100acSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
17769ff100acSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
17779ff100acSmrgm4_undefine([_defopt])
17789ff100acSmrg
17799ff100acSmrgif test "x$use_xsltproc" = x"auto"; then
17809ff100acSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17819ff100acSmrg   if test "x$XSLTPROC" = "x"; then
17829ff100acSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
17839ff100acSmrg	have_xsltproc=no
17849ff100acSmrg   else
17859ff100acSmrg        have_xsltproc=yes
17869ff100acSmrg   fi
17879ff100acSmrgelif test "x$use_xsltproc" = x"yes" ; then
17889ff100acSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17899ff100acSmrg   if test "x$XSLTPROC" = "x"; then
17909ff100acSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
17919ff100acSmrg   fi
17929ff100acSmrg   have_xsltproc=yes
17939ff100acSmrgelif test "x$use_xsltproc" = x"no" ; then
17949ff100acSmrg   if test "x$XSLTPROC" != "x"; then
17959ff100acSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
17969ff100acSmrg   fi
17979ff100acSmrg   have_xsltproc=no
17989ff100acSmrgelse
17999ff100acSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18009ff100acSmrgfi
18019ff100acSmrg
18029ff100acSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18039ff100acSmrg]) # XORG_WITH_XSLTPROC
18049ff100acSmrg
18059ff100acSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18069ff100acSmrg# ----------------------------------------
18079ff100acSmrg# Minimum version: 1.15.0
18089ff100acSmrg#
18099ff100acSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
18109ff100acSmrg# scanning arbitrary text files, extracting information from those text files,
18119ff100acSmrg# and printing reports based on that information.
18129ff100acSmrg#
18139ff100acSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18149ff100acSmrg#
18159ff100acSmrg# Interface to module:
18169ff100acSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
18179ff100acSmrg# PERL:	     returns the path of the perl program found
18189ff100acSmrg#	     returns the path set by the user in the environment
18199ff100acSmrg# --with-perl: 'yes' user instructs the module to use perl
18209ff100acSmrg#	       'no' user instructs the module not to use perl
18219ff100acSmrg# have_perl: returns yes if perl found in PATH or no
18229ff100acSmrg#
18239ff100acSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18249ff100acSmrg#
18259ff100acSmrgAC_DEFUN([XORG_WITH_PERL],[
18269ff100acSmrgAC_ARG_VAR([PERL], [Path to perl command])
18279ff100acSmrg# Preserves the interface, should it be implemented later
18289ff100acSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18299ff100acSmrgm4_define([_defopt], m4_default([$2], [auto]))
18309ff100acSmrgAC_ARG_WITH(perl,
18319ff100acSmrg	AS_HELP_STRING([--with-perl],
18329ff100acSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18339ff100acSmrg	   [use_perl=$withval], [use_perl=]_defopt)
18349ff100acSmrgm4_undefine([_defopt])
18359ff100acSmrg
18369ff100acSmrgif test "x$use_perl" = x"auto"; then
18379ff100acSmrg   AC_PATH_PROG([PERL], [perl])
18389ff100acSmrg   if test "x$PERL" = "x"; then
18399ff100acSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18409ff100acSmrg	have_perl=no
18419ff100acSmrg   else
18429ff100acSmrg        have_perl=yes
18439ff100acSmrg   fi
18449ff100acSmrgelif test "x$use_perl" = x"yes" ; then
18459ff100acSmrg   AC_PATH_PROG([PERL], [perl])
18469ff100acSmrg   if test "x$PERL" = "x"; then
18479ff100acSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18489ff100acSmrg   fi
18499ff100acSmrg   have_perl=yes
18509ff100acSmrgelif test "x$use_perl" = x"no" ; then
18519ff100acSmrg   if test "x$PERL" != "x"; then
18529ff100acSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18539ff100acSmrg   fi
18549ff100acSmrg   have_perl=no
18559ff100acSmrgelse
18569ff100acSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18579ff100acSmrgfi
18589ff100acSmrg
18599ff100acSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18609ff100acSmrg]) # XORG_WITH_PERL
18619ff100acSmrg
1862482df631Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863482df631Smrg# ----------------
1864482df631Smrg# Minimum version: 1.5.0
1865482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1866482df631Smrg#
1867482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1868482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1869482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870482df631Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871482df631Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872482df631Smrg# --with-asciidoc assumes 'auto'.
1873482df631Smrg#
1874482df631Smrg# Interface to module:
1875482df631Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876482df631Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877482df631Smrg#		 returns the path set by the user in the environment
1878482df631Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879482df631Smrg#		  'no' user instructs the module not to use asciidoc
1880482df631Smrg#
1881482df631Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882482df631Smrg#
1883482df631SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884482df631SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
1886482df631SmrgAC_ARG_WITH(asciidoc,
1887482df631Smrg	AS_HELP_STRING([--with-asciidoc],
1888482df631Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889482df631Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890482df631Smrgm4_undefine([_defopt])
1891482df631Smrg
1892482df631Smrgif test "x$use_asciidoc" = x"auto"; then
1893482df631Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894482df631Smrg   if test "x$ASCIIDOC" = "x"; then
1895482df631Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896482df631Smrg	have_asciidoc=no
1897482df631Smrg   else
1898482df631Smrg        have_asciidoc=yes
1899482df631Smrg   fi
1900482df631Smrgelif test "x$use_asciidoc" = x"yes" ; then
1901482df631Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902482df631Smrg   if test "x$ASCIIDOC" = "x"; then
1903482df631Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904482df631Smrg   fi
1905482df631Smrg   have_asciidoc=yes
1906482df631Smrgelif test "x$use_asciidoc" = x"no" ; then
1907482df631Smrg   if test "x$ASCIIDOC" != "x"; then
1908482df631Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909482df631Smrg   fi
1910482df631Smrg   have_asciidoc=no
1911482df631Smrgelse
1912482df631Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913482df631Smrgfi
1914482df631Smrgm4_ifval([$1],
1915482df631Smrg[if test "$have_asciidoc" = yes; then
1916482df631Smrg    # scrape the asciidoc version
1917482df631Smrg    AC_MSG_CHECKING([the asciidoc version])
1918482df631Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919482df631Smrg    AC_MSG_RESULT([$asciidoc_version])
1920482df631Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921482df631Smrg        [if test "x$use_asciidoc" = xauto; then
1922482df631Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923482df631Smrg            have_asciidoc=no
1924482df631Smrg        else
1925482df631Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926482df631Smrg        fi])
1927482df631Smrgfi])
1928482df631SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929482df631Smrg]) # XORG_WITH_ASCIIDOC
1930482df631Smrg
1931482df631Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
19329ff100acSmrg# -------------------------------------------
1933482df631Smrg# Minimum version: 1.5.0
1934482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19359ff100acSmrg# Minimum version for optional DOT checking: 1.18.0
1936482df631Smrg#
1937482df631Smrg# Documentation tools are not always available on all platforms and sometimes
1938482df631Smrg# not at the appropriate level. This macro enables a module to test for the
1939482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940482df631Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941482df631Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942482df631Smrg# --with-doxygen assumes 'auto'.
1943482df631Smrg#
1944482df631Smrg# Interface to module:
1945482df631Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946482df631Smrg# DOXYGEN:	 returns the path of the doxygen program found
1947482df631Smrg#		 returns the path set by the user in the environment
1948482df631Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949482df631Smrg#		  'no' user instructs the module not to use doxygen
1950482df631Smrg#
1951482df631Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952482df631Smrg#
1953482df631SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954482df631SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
19559ff100acSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956482df631Smrgm4_define([_defopt], m4_default([$2], [auto]))
1957482df631SmrgAC_ARG_WITH(doxygen,
1958482df631Smrg	AS_HELP_STRING([--with-doxygen],
1959482df631Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960482df631Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961482df631Smrgm4_undefine([_defopt])
1962482df631Smrg
1963482df631Smrgif test "x$use_doxygen" = x"auto"; then
1964482df631Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965482df631Smrg   if test "x$DOXYGEN" = "x"; then
1966482df631Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967482df631Smrg	have_doxygen=no
1968482df631Smrg   else
1969482df631Smrg        have_doxygen=yes
1970482df631Smrg   fi
1971482df631Smrgelif test "x$use_doxygen" = x"yes" ; then
1972482df631Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973482df631Smrg   if test "x$DOXYGEN" = "x"; then
1974482df631Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975482df631Smrg   fi
1976482df631Smrg   have_doxygen=yes
1977482df631Smrgelif test "x$use_doxygen" = x"no" ; then
1978482df631Smrg   if test "x$DOXYGEN" != "x"; then
1979482df631Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980482df631Smrg   fi
1981482df631Smrg   have_doxygen=no
1982482df631Smrgelse
1983482df631Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984482df631Smrgfi
1985482df631Smrgm4_ifval([$1],
1986482df631Smrg[if test "$have_doxygen" = yes; then
1987482df631Smrg    # scrape the doxygen version
1988482df631Smrg    AC_MSG_CHECKING([the doxygen version])
1989482df631Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990482df631Smrg    AC_MSG_RESULT([$doxygen_version])
1991482df631Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992482df631Smrg        [if test "x$use_doxygen" = xauto; then
1993482df631Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994482df631Smrg            have_doxygen=no
1995482df631Smrg        else
1996482df631Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997482df631Smrg        fi])
1998482df631Smrgfi])
19999ff100acSmrg
20009ff100acSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
20019ff100acSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
20029ff100acSmrgdnl 	HAVE_DOT = @HAVE_DOT@
20039ff100acSmrgHAVE_DOT=no
20049ff100acSmrgif test "x$have_doxygen" = "xyes"; then
20059ff100acSmrg  AC_PATH_PROG([DOT], [dot])
20069ff100acSmrg    if test "x$DOT" != "x"; then
20079ff100acSmrg      HAVE_DOT=yes
20089ff100acSmrg    fi
20099ff100acSmrgfi
20109ff100acSmrg
20119ff100acSmrgAC_SUBST([HAVE_DOT])
20129ff100acSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013482df631SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014482df631Smrg]) # XORG_WITH_DOXYGEN
2015482df631Smrg
2016482df631Smrg# XORG_WITH_GROFF([DEFAULT])
2017482df631Smrg# ----------------
2018482df631Smrg# Minimum version: 1.6.0
2019482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2020482df631Smrg#
2021482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2022482df631Smrg# not at the appropriate level. This macro enables a module to test for the
2023482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024482df631Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025482df631Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026482df631Smrg# --with-groff assumes 'auto'.
2027482df631Smrg#
2028482df631Smrg# Interface to module:
2029482df631Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030482df631Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031482df631Smrg# HAVE_GROFF_MS: the -ms macros package
2032482df631Smrg# GROFF:	 returns the path of the groff program found
2033482df631Smrg#		 returns the path set by the user in the environment
2034482df631Smrg# --with-groff:	 'yes' user instructs the module to use groff
2035482df631Smrg#		 'no' user instructs the module not to use groff
2036482df631Smrg#
2037482df631Smrg# Added in version 1.9.0:
2038482df631Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039482df631Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040482df631Smrg#		   psselect from the psutils package.
2041482df631Smrg#		   the ghostcript package. Refer to the grohtml man pages
2042482df631Smrg#
2043482df631Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044482df631Smrg#
2045482df631Smrg# OS and distros often splits groff in a basic and full package, the former
2046482df631Smrg# having the groff program and the later having devices, fonts and macros
2047482df631Smrg# Checking for the groff executable is not enough.
2048482df631Smrg#
2049482df631Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050482df631Smrg# unset HAVE_GROFF or GROFF env variables.
2051482df631Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052482df631Smrg#
2053482df631SmrgAC_DEFUN([XORG_WITH_GROFF],[
2054482df631SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055482df631Smrgm4_define([_defopt], m4_default([$1], [auto]))
2056482df631SmrgAC_ARG_WITH(groff,
2057482df631Smrg	AS_HELP_STRING([--with-groff],
2058482df631Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059482df631Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2060482df631Smrgm4_undefine([_defopt])
2061482df631Smrg
2062482df631Smrgif test "x$use_groff" = x"auto"; then
2063482df631Smrg   AC_PATH_PROG([GROFF], [groff])
2064482df631Smrg   if test "x$GROFF" = "x"; then
2065482df631Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066482df631Smrg	have_groff=no
2067482df631Smrg   else
2068482df631Smrg        have_groff=yes
2069482df631Smrg   fi
2070482df631Smrgelif test "x$use_groff" = x"yes" ; then
2071482df631Smrg   AC_PATH_PROG([GROFF], [groff])
2072482df631Smrg   if test "x$GROFF" = "x"; then
2073482df631Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074482df631Smrg   fi
2075482df631Smrg   have_groff=yes
2076482df631Smrgelif test "x$use_groff" = x"no" ; then
2077482df631Smrg   if test "x$GROFF" != "x"; then
2078482df631Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079482df631Smrg   fi
2080482df631Smrg   have_groff=no
2081482df631Smrgelse
2082482df631Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083482df631Smrgfi
2084482df631Smrg
2085482df631Smrg# We have groff, test for the presence of the macro packages
2086482df631Smrgif test "x$have_groff" = x"yes"; then
2087482df631Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088482df631Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089482df631Smrg        groff_ms_works=yes
2090482df631Smrg    else
2091482df631Smrg        groff_ms_works=no
2092482df631Smrg    fi
2093482df631Smrg    AC_MSG_RESULT([$groff_ms_works])
2094482df631Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095482df631Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096482df631Smrg        groff_mm_works=yes
2097482df631Smrg    else
2098482df631Smrg        groff_mm_works=no
2099482df631Smrg    fi
2100482df631Smrg    AC_MSG_RESULT([$groff_mm_works])
2101482df631Smrgfi
2102482df631Smrg
2103482df631Smrg# We have groff, test for HTML dependencies, one command per package
2104482df631Smrgif test "x$have_groff" = x"yes"; then
2105482df631Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106482df631Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107482df631Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108482df631Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109482df631Smrg      have_groff_html=yes
2110482df631Smrg   else
2111482df631Smrg      have_groff_html=no
2112482df631Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113482df631Smrg   fi
2114482df631Smrgfi
2115482df631Smrg
2116482df631Smrg# Set Automake conditionals for Makefiles
2117482df631SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118482df631SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119482df631SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120482df631SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121482df631Smrg]) # XORG_WITH_GROFF
2122482df631Smrg
21239ff100acSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21249ff100acSmrg# ---------------------------------------
2125482df631Smrg# Minimum version: 1.6.0
2126482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21279ff100acSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128482df631Smrg#
2129482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2130482df631Smrg# not at the appropriate level. This macro enables a module to test for the
2131482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132482df631Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133482df631Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134482df631Smrg# --with-fop assumes 'auto'.
2135482df631Smrg#
2136482df631Smrg# Interface to module:
2137482df631Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138482df631Smrg# FOP:	 	returns the path of the fop program found
2139482df631Smrg#		returns the path set by the user in the environment
2140482df631Smrg# --with-fop: 	'yes' user instructs the module to use fop
2141482df631Smrg#		'no' user instructs the module not to use fop
2142482df631Smrg#
2143482df631Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144482df631Smrg#
2145482df631SmrgAC_DEFUN([XORG_WITH_FOP],[
2146482df631SmrgAC_ARG_VAR([FOP], [Path to fop command])
21479ff100acSmrgm4_define([_defopt], m4_default([$2], [auto]))
2148482df631SmrgAC_ARG_WITH(fop,
2149482df631Smrg	AS_HELP_STRING([--with-fop],
2150482df631Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151482df631Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2152482df631Smrgm4_undefine([_defopt])
2153482df631Smrg
2154482df631Smrgif test "x$use_fop" = x"auto"; then
2155482df631Smrg   AC_PATH_PROG([FOP], [fop])
2156482df631Smrg   if test "x$FOP" = "x"; then
2157482df631Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158482df631Smrg	have_fop=no
2159482df631Smrg   else
2160482df631Smrg        have_fop=yes
2161482df631Smrg   fi
2162482df631Smrgelif test "x$use_fop" = x"yes" ; then
2163482df631Smrg   AC_PATH_PROG([FOP], [fop])
2164482df631Smrg   if test "x$FOP" = "x"; then
2165482df631Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166482df631Smrg   fi
2167482df631Smrg   have_fop=yes
2168482df631Smrgelif test "x$use_fop" = x"no" ; then
2169482df631Smrg   if test "x$FOP" != "x"; then
2170482df631Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171482df631Smrg   fi
2172482df631Smrg   have_fop=no
2173482df631Smrgelse
2174482df631Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175482df631Smrgfi
21769ff100acSmrg
21779ff100acSmrg# Test for a minimum version of fop, if provided.
21789ff100acSmrgm4_ifval([$1],
21799ff100acSmrg[if test "$have_fop" = yes; then
21809ff100acSmrg    # scrape the fop version
21819ff100acSmrg    AC_MSG_CHECKING([for fop minimum version])
21829ff100acSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21839ff100acSmrg    AC_MSG_RESULT([$fop_version])
21849ff100acSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
21859ff100acSmrg        [if test "x$use_fop" = xauto; then
21869ff100acSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
21879ff100acSmrg            have_fop=no
21889ff100acSmrg        else
21899ff100acSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
21909ff100acSmrg        fi])
21919ff100acSmrgfi])
2192482df631SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193482df631Smrg]) # XORG_WITH_FOP
2194482df631Smrg
21959ff100acSmrg# XORG_WITH_M4([MIN-VERSION])
21969ff100acSmrg# ---------------------------
21979ff100acSmrg# Minimum version: 1.19.0
21989ff100acSmrg#
21999ff100acSmrg# This macro attempts to locate an m4 macro processor which supports
22009ff100acSmrg# -I option and is only useful for modules relying on M4 in order to
22019ff100acSmrg# expand macros in source code files.
22029ff100acSmrg#
22039ff100acSmrg# Interface to module:
22049ff100acSmrg# M4:	 	returns the path of the m4 program found
22059ff100acSmrg#		returns the path set by the user in the environment
22069ff100acSmrg#
22079ff100acSmrgAC_DEFUN([XORG_WITH_M4], [
22089ff100acSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
22099ff100acSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
22109ff100acSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
22119ff100acSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
22129ff100acSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
22139ff100acSmrg   [$PATH:/usr/gnu/bin])])
22149ff100acSmrg
22159ff100acSmrgAC_SUBST([M4], [$ac_cv_path_M4])
22169ff100acSmrg]) # XORG_WITH_M4
22179ff100acSmrg
2218482df631Smrg# XORG_WITH_PS2PDF([DEFAULT])
2219482df631Smrg# ----------------
2220482df631Smrg# Minimum version: 1.6.0
2221482df631Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2222482df631Smrg#
2223482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2224482df631Smrg# not at the appropriate level. This macro enables a module to test for the
2225482df631Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226482df631Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227482df631Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228482df631Smrg# --with-ps2pdf assumes 'auto'.
2229482df631Smrg#
2230482df631Smrg# Interface to module:
2231482df631Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232482df631Smrg# PS2PDF:	returns the path of the ps2pdf program found
2233482df631Smrg#		returns the path set by the user in the environment
2234482df631Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235482df631Smrg#		 'no' user instructs the module not to use ps2pdf
2236482df631Smrg#
2237482df631Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238482df631Smrg#
2239482df631SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240482df631SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241482df631Smrgm4_define([_defopt], m4_default([$1], [auto]))
2242482df631SmrgAC_ARG_WITH(ps2pdf,
2243482df631Smrg	AS_HELP_STRING([--with-ps2pdf],
2244482df631Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245482df631Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246482df631Smrgm4_undefine([_defopt])
2247482df631Smrg
2248482df631Smrgif test "x$use_ps2pdf" = x"auto"; then
2249482df631Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250482df631Smrg   if test "x$PS2PDF" = "x"; then
2251482df631Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252482df631Smrg	have_ps2pdf=no
2253482df631Smrg   else
2254482df631Smrg        have_ps2pdf=yes
2255482df631Smrg   fi
2256482df631Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2257482df631Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258482df631Smrg   if test "x$PS2PDF" = "x"; then
2259482df631Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260482df631Smrg   fi
2261482df631Smrg   have_ps2pdf=yes
2262482df631Smrgelif test "x$use_ps2pdf" = x"no" ; then
2263482df631Smrg   if test "x$PS2PDF" != "x"; then
2264482df631Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265482df631Smrg   fi
2266482df631Smrg   have_ps2pdf=no
2267482df631Smrgelse
2268482df631Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269482df631Smrgfi
2270482df631SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271482df631Smrg]) # XORG_WITH_PS2PDF
2272482df631Smrg
2273482df631Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274482df631Smrg# ----------------
2275482df631Smrg# Minimum version: 1.6.0
2276482df631Smrg#
2277482df631Smrg# Documentation tools are not always available on all platforms and sometimes
2278482df631Smrg# not at the appropriate level. This macro enables a builder to skip all
2279482df631Smrg# documentation targets except traditional man pages.
2280482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281482df631Smrg# maximum flexibilty in controlling documentation building.
2282482df631Smrg# Refer to:
2283482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
2284482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2286482df631Smrg# XORG_WITH_FOP           --with-fop
2287482df631Smrg# XORG_WITH_GROFF         --with-groff
2288482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289482df631Smrg#
2290482df631Smrg# Interface to module:
2291482df631Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292482df631Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2293482df631Smrg#		 'no' user instructs the module not to generate docs
2294482df631Smrg# parm1:	specify the default value, yes or no.
2295482df631Smrg#
2296482df631SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
22979ff100acSmrgm4_define([docs_default], m4_default([$1], [yes]))
2298482df631SmrgAC_ARG_ENABLE(docs,
2299482df631Smrg	AS_HELP_STRING([--enable-docs],
23009ff100acSmrg	   [Enable building the documentation (default: ]docs_default[)]),
23019ff100acSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
23029ff100acSmrgm4_undefine([docs_default])
2303482df631SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304482df631SmrgAC_MSG_CHECKING([whether to build documentation])
2305482df631SmrgAC_MSG_RESULT([$build_docs])
2306482df631Smrg]) # XORG_ENABLE_DOCS
2307482df631Smrg
2308482df631Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309482df631Smrg# ----------------
2310482df631Smrg# Minimum version: 1.6.0
2311482df631Smrg#
2312482df631Smrg# This macro enables a builder to skip all developer documentation.
2313482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314482df631Smrg# maximum flexibilty in controlling documentation building.
2315482df631Smrg# Refer to:
2316482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
2317482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2319482df631Smrg# XORG_WITH_FOP           --with-fop
2320482df631Smrg# XORG_WITH_GROFF         --with-groff
2321482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322482df631Smrg#
2323482df631Smrg# Interface to module:
2324482df631Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325482df631Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326482df631Smrg#			'no' user instructs the module not to generate developer docs
2327482df631Smrg# parm1:		specify the default value, yes or no.
2328482df631Smrg#
2329482df631SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330482df631Smrgm4_define([devel_default], m4_default([$1], [yes]))
2331482df631SmrgAC_ARG_ENABLE(devel-docs,
2332482df631Smrg	AS_HELP_STRING([--enable-devel-docs],
2333482df631Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334482df631Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335482df631Smrgm4_undefine([devel_default])
2336482df631SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337482df631SmrgAC_MSG_CHECKING([whether to build developer documentation])
2338482df631SmrgAC_MSG_RESULT([$build_devel_docs])
2339482df631Smrg]) # XORG_ENABLE_DEVEL_DOCS
2340482df631Smrg
2341482df631Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342482df631Smrg# ----------------
2343482df631Smrg# Minimum version: 1.6.0
2344482df631Smrg#
2345482df631Smrg# This macro enables a builder to skip all functional specification targets.
2346482df631Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347482df631Smrg# maximum flexibilty in controlling documentation building.
2348482df631Smrg# Refer to:
2349482df631Smrg# XORG_WITH_XMLTO         --with-xmlto
2350482df631Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351482df631Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2352482df631Smrg# XORG_WITH_FOP           --with-fop
2353482df631Smrg# XORG_WITH_GROFF         --with-groff
2354482df631Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355482df631Smrg#
2356482df631Smrg# Interface to module:
2357482df631Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358482df631Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2359482df631Smrg#			'no' user instructs the module not to generate specs
2360482df631Smrg# parm1:		specify the default value, yes or no.
2361482df631Smrg#
2362482df631SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363482df631Smrgm4_define([spec_default], m4_default([$1], [yes]))
2364482df631SmrgAC_ARG_ENABLE(specs,
2365482df631Smrg	AS_HELP_STRING([--enable-specs],
2366482df631Smrg	   [Enable building the specs (default: ]spec_default[)]),
2367482df631Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368482df631Smrgm4_undefine([spec_default])
2369482df631SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370482df631SmrgAC_MSG_CHECKING([whether to build functional specifications])
2371482df631SmrgAC_MSG_RESULT([$build_specs])
2372482df631Smrg]) # XORG_ENABLE_SPECS
2373482df631Smrg
23749ff100acSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
23759ff100acSmrg# ----------------------------------------------
23769ff100acSmrg# Minimum version: 1.13.0
23779ff100acSmrg#
23789ff100acSmrg# This macro enables a builder to enable/disable unit testing
23799ff100acSmrg# It makes no assumption about the test cases implementation
23809ff100acSmrg# Test cases may or may not use Automake "Support for test suites"
23819ff100acSmrg# They may or may not use the software utility library GLib
23829ff100acSmrg#
23839ff100acSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
23849ff100acSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
23859ff100acSmrg# The variable enable_unit_tests is used by other macros in this file.
23869ff100acSmrg#
23879ff100acSmrg# Interface to module:
23889ff100acSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
23899ff100acSmrg# enable_unit_tests:    used in configure.ac for additional configuration
23909ff100acSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
23919ff100acSmrg#			'no' user instructs the module not to build tests
23929ff100acSmrg# parm1:		specify the default value, yes or no.
23939ff100acSmrg#
23949ff100acSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
23959ff100acSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
23969ff100acSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
23979ff100acSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
23989ff100acSmrgm4_define([_defopt], m4_default([$1], [auto]))
23999ff100acSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
24009ff100acSmrg	[Enable building unit test cases (default: ]_defopt[)]),
24019ff100acSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
24029ff100acSmrgm4_undefine([_defopt])
24039ff100acSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
24049ff100acSmrgAC_MSG_CHECKING([whether to build unit test cases])
24059ff100acSmrgAC_MSG_RESULT([$enable_unit_tests])
24069ff100acSmrg]) # XORG_ENABLE_UNIT_TESTS
24079ff100acSmrg
24089ff100acSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24099ff100acSmrg# ------------------------------------------------------
24109ff100acSmrg# Minimum version: 1.17.0
24119ff100acSmrg#
24129ff100acSmrg# This macro enables a builder to enable/disable integration testing
24139ff100acSmrg# It makes no assumption about the test cases' implementation
24149ff100acSmrg# Test cases may or may not use Automake "Support for test suites"
24159ff100acSmrg#
24169ff100acSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24179ff100acSmrg# usually requires less dependencies and may be built and run under less
24189ff100acSmrg# stringent environments than integration tests.
24199ff100acSmrg#
24209ff100acSmrg# Interface to module:
24219ff100acSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24229ff100acSmrg# enable_integration_tests:   used in configure.ac for additional configuration
24239ff100acSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24249ff100acSmrg#                             'no' user instructs the module not to build tests
24259ff100acSmrg# parm1:                      specify the default value, yes or no.
24269ff100acSmrg#
24279ff100acSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24289ff100acSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24299ff100acSmrgm4_define([_defopt], m4_default([$1], [auto]))
24309ff100acSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24319ff100acSmrg	[Enable building integration test cases (default: ]_defopt[)]),
24329ff100acSmrg	[enable_integration_tests=$enableval],
24339ff100acSmrg	[enable_integration_tests=]_defopt)
24349ff100acSmrgm4_undefine([_defopt])
24359ff100acSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24369ff100acSmrg	[test "x$enable_integration_tests" != xno])
24379ff100acSmrgAC_MSG_CHECKING([whether to build unit test cases])
24389ff100acSmrgAC_MSG_RESULT([$enable_integration_tests])
24399ff100acSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
24409ff100acSmrg
24419ff100acSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24429ff100acSmrg# ----------------------------------------
24439ff100acSmrg# Minimum version: 1.13.0
24449ff100acSmrg#
24459ff100acSmrg# GLib is a library which provides advanced data structures and functions.
24469ff100acSmrg# This macro enables a module to test for the presence of Glib.
24479ff100acSmrg#
24489ff100acSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
24499ff100acSmrg# Otherwise the value of $enable_unit_tests is blank.
24509ff100acSmrg#
24519ff100acSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
24529ff100acSmrg# test support usually requires less dependencies and may be built and run under
24539ff100acSmrg# less stringent environments than integration tests.
24549ff100acSmrg#
24559ff100acSmrg# Interface to module:
24569ff100acSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
24579ff100acSmrg# with_glib: used in configure.ac to know if GLib has been found
24589ff100acSmrg# --with-glib:	'yes' user instructs the module to use glib
24599ff100acSmrg#		'no' user instructs the module not to use glib
24609ff100acSmrg#
24619ff100acSmrgAC_DEFUN([XORG_WITH_GLIB],[
24629ff100acSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
24639ff100acSmrgm4_define([_defopt], m4_default([$2], [auto]))
24649ff100acSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
24659ff100acSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
24669ff100acSmrg	[with_glib=$withval], [with_glib=]_defopt)
24679ff100acSmrgm4_undefine([_defopt])
24689ff100acSmrg
24699ff100acSmrghave_glib=no
24709ff100acSmrg# Do not probe GLib if user explicitly disabled unit testing
24719ff100acSmrgif test "x$enable_unit_tests" != x"no"; then
24729ff100acSmrg  # Do not probe GLib if user explicitly disabled it
24739ff100acSmrg  if test "x$with_glib" != x"no"; then
24749ff100acSmrg    m4_ifval(
24759ff100acSmrg      [$1],
24769ff100acSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
24779ff100acSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
24789ff100acSmrg    )
24799ff100acSmrg  fi
24809ff100acSmrgfi
24819ff100acSmrg
24829ff100acSmrg# Not having GLib when unit testing has been explicitly requested is an error
24839ff100acSmrgif test "x$enable_unit_tests" = x"yes"; then
24849ff100acSmrg  if test "x$have_glib" = x"no"; then
24859ff100acSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24869ff100acSmrg  fi
24879ff100acSmrgfi
24889ff100acSmrg
24899ff100acSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
24909ff100acSmrgif test "x$enable_unit_tests" = x"no"; then
24919ff100acSmrg  if test "x$with_glib" = x"yes"; then
24929ff100acSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24939ff100acSmrg  fi
24949ff100acSmrgfi
24959ff100acSmrg
24969ff100acSmrg# Not having GLib when it has been explicitly requested is an error
24979ff100acSmrgif test "x$with_glib" = x"yes"; then
24989ff100acSmrg  if test "x$have_glib" = x"no"; then
24999ff100acSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
25009ff100acSmrg  fi
25019ff100acSmrgfi
25029ff100acSmrg
25039ff100acSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
25049ff100acSmrg]) # XORG_WITH_GLIB
25059ff100acSmrg
25069ff100acSmrg# XORG_LD_WRAP([required|optional])
25079ff100acSmrg# ---------------------------------
25089ff100acSmrg# Minimum version: 1.13.0
25099ff100acSmrg#
25109ff100acSmrg# Check if linker supports -wrap, passed via compiler flags
25119ff100acSmrg#
25129ff100acSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25139ff100acSmrg# Otherwise the value of $enable_unit_tests is blank.
25149ff100acSmrg#
25159ff100acSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25169ff100acSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25179ff100acSmrg# available, an argument of "optional" allows use when some unit tests require
25189ff100acSmrg# ld -wrap and others do not.
25199ff100acSmrg#
25209ff100acSmrgAC_DEFUN([XORG_LD_WRAP],[
25219ff100acSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25229ff100acSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25239ff100acSmrg                      void __wrap_exit(int status) { return; }],
25249ff100acSmrg                     [exit(0);])])
25259ff100acSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
25269ff100acSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25279ff100acSmrg  if test "x$have_ld_wrap" = x"no"; then
25289ff100acSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25299ff100acSmrg  fi
25309ff100acSmrgfi
25319ff100acSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25329ff100acSmrg#
25339ff100acSmrg]) # XORG_LD_WRAP
25349ff100acSmrg
25359ff100acSmrg# XORG_CHECK_LINKER_FLAGS
25369ff100acSmrg# -----------------------
25379ff100acSmrg# SYNOPSIS
25389ff100acSmrg#
25399ff100acSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25409ff100acSmrg#
25419ff100acSmrg# DESCRIPTION
25429ff100acSmrg#
25439ff100acSmrg#   Check whether the given linker FLAGS work with the current language's
25449ff100acSmrg#   linker, or whether they give an error.
25459ff100acSmrg#
25469ff100acSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
25479ff100acSmrg#   success/failure.
25489ff100acSmrg#
25499ff100acSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
25509ff100acSmrg#
25519ff100acSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
25529ff100acSmrg#
25539ff100acSmrg# LICENSE
25549ff100acSmrg#
25559ff100acSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
25569ff100acSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
25579ff100acSmrg#   Copyright (c) 2009 Matteo Frigo
25589ff100acSmrg#
25599ff100acSmrg#   This program is free software: you can redistribute it and/or modify it
25609ff100acSmrg#   under the terms of the GNU General Public License as published by the
25619ff100acSmrg#   Free Software Foundation, either version 3 of the License, or (at your
25629ff100acSmrg#   option) any later version.
25639ff100acSmrg#
25649ff100acSmrg#   This program is distributed in the hope that it will be useful, but
25659ff100acSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
25669ff100acSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
25679ff100acSmrg#   Public License for more details.
25689ff100acSmrg#
25699ff100acSmrg#   You should have received a copy of the GNU General Public License along
25709ff100acSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
25719ff100acSmrg#
25729ff100acSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
25739ff100acSmrg#   gives unlimited permission to copy, distribute and modify the configure
25749ff100acSmrg#   scripts that are the output of Autoconf when processing the Macro. You
25759ff100acSmrg#   need not follow the terms of the GNU General Public License when using
25769ff100acSmrg#   or distributing such scripts, even though portions of the text of the
25779ff100acSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
25789ff100acSmrg#   all other use of the material that constitutes the Autoconf Macro.
25799ff100acSmrg#
25809ff100acSmrg#   This special exception to the GPL applies to versions of the Autoconf
25819ff100acSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
25829ff100acSmrg#   modified version of the Autoconf Macro, you may extend this special
25839ff100acSmrg#   exception to the GPL to apply to your modified version as well.#
25849ff100acSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
25859ff100acSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
25869ff100acSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
25879ff100acSmrgAS_LITERAL_IF([$1],
25889ff100acSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
25899ff100acSmrg      ax_save_FLAGS=$LDFLAGS
25909ff100acSmrg      LDFLAGS="$1"
25919ff100acSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
25929ff100acSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25939ff100acSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25949ff100acSmrg      LDFLAGS=$ax_save_FLAGS])],
25959ff100acSmrg  [ax_save_FLAGS=$LDFLAGS
25969ff100acSmrg   LDFLAGS="$1"
25979ff100acSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
25989ff100acSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25999ff100acSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26009ff100acSmrg   LDFLAGS=$ax_save_FLAGS])
26019ff100acSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
26029ff100acSmrgAC_MSG_RESULT($xorg_check_linker_flags)
26039ff100acSmrgif test "x$xorg_check_linker_flags" = xyes; then
26049ff100acSmrg	m4_default([$2], :)
26059ff100acSmrgelse
26069ff100acSmrg	m4_default([$3], :)
26079ff100acSmrgfi
26089ff100acSmrg]) # XORG_CHECK_LINKER_FLAGS
26099ff100acSmrg
26109ff100acSmrg# XORG_MEMORY_CHECK_FLAGS
26119ff100acSmrg# -----------------------
26129ff100acSmrg# Minimum version: 1.16.0
26139ff100acSmrg#
26149ff100acSmrg# This macro attempts to find appropriate memory checking functionality
26159ff100acSmrg# for various platforms which unit testing code may use to catch various
26169ff100acSmrg# forms of memory allocation and access errors in testing.
26179ff100acSmrg#
26189ff100acSmrg# Interface to module:
26199ff100acSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26209ff100acSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26219ff100acSmrg#
26229ff100acSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26239ff100acSmrg#
26249ff100acSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26259ff100acSmrg
26269ff100acSmrgAC_REQUIRE([AC_CANONICAL_HOST])
26279ff100acSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26289ff100acSmrg           [Environment variables to enable memory checking in tests])
26299ff100acSmrg
26309ff100acSmrg# Check for different types of support on different platforms
26319ff100acSmrgcase $host_os in
26329ff100acSmrg    solaris*)
26339ff100acSmrg        AC_CHECK_LIB([umem], [umem_alloc],
26349ff100acSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26359ff100acSmrg        ;;
26369ff100acSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26379ff100acSmrg        # both directly and inverted, so should not be 0 or 255.
26389ff100acSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
26399ff100acSmrg        ;;
26409ff100acSmrg    darwin*)
26419ff100acSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26429ff100acSmrg        ;;
26439ff100acSmrg    *bsd*)
26449ff100acSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
26459ff100acSmrg        ;;
26469ff100acSmrgesac
26479ff100acSmrg
26489ff100acSmrg# User supplied flags override default flags
26499ff100acSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
26509ff100acSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
26519ff100acSmrgfi
26529ff100acSmrg
26539ff100acSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
26549ff100acSmrg]) # XORG_WITH_LINT
26559ff100acSmrg
2656db17cd6dSmrg# XORG_CHECK_MALLOC_ZERO
2657db17cd6dSmrg# ----------------------
2658db17cd6dSmrg# Minimum version: 1.0.0
2659db17cd6dSmrg#
2660db17cd6dSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2661db17cd6dSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2662db17cd6dSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2663db17cd6dSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2664db17cd6dSmrgAC_ARG_ENABLE(malloc0returnsnull,
2665db17cd6dSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2666db17cd6dSmrg		       [malloc(0) returns NULL (default: auto)]),
2667db17cd6dSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2668db17cd6dSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
266976910425Smrg
2670db17cd6dSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2671db17cd6dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
26729ff100acSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
26739ff100acSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
26749ff100acSmrg#include <stdlib.h>
26759ff100acSmrg],[
2676db17cd6dSmrg    char *m0, *r0, *c0, *p;
2677db17cd6dSmrg    m0 = malloc(0);
2678db17cd6dSmrg    p = malloc(10);
2679db17cd6dSmrg    r0 = realloc(p,0);
26809ff100acSmrg    c0 = calloc(0,10);
26819ff100acSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
26829ff100acSmrg])],
26839ff100acSmrg		[xorg_cv_malloc0_returns_null=yes],
26849ff100acSmrg		[xorg_cv_malloc0_returns_null=no])])
26859ff100acSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2686db17cd6dSmrgfi
2687db17cd6dSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
268876910425Smrg
2689db17cd6dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2690db17cd6dSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2691db17cd6dSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2692db17cd6dSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2693db17cd6dSmrgelse
2694db17cd6dSmrg	MALLOC_ZERO_CFLAGS=""
2695db17cd6dSmrg	XMALLOC_ZERO_CFLAGS=""
2696db17cd6dSmrg	XTMALLOC_ZERO_CFLAGS=""
2697db17cd6dSmrgfi
269876910425Smrg
2699db17cd6dSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2700db17cd6dSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2701db17cd6dSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2702db17cd6dSmrg]) # XORG_CHECK_MALLOC_ZERO
270376910425Smrg
2704db17cd6dSmrg# XORG_WITH_LINT()
2705db17cd6dSmrg# ----------------
2706db17cd6dSmrg# Minimum version: 1.1.0
270776910425Smrg#
2708482df631Smrg# This macro enables the use of a tool that flags some suspicious and
2709482df631Smrg# non-portable constructs (likely to be bugs) in C language source code.
2710482df631Smrg# It will attempt to locate the tool and use appropriate options.
2711482df631Smrg# There are various lint type tools on different platforms.
2712482df631Smrg#
2713482df631Smrg# Interface to module:
2714482df631Smrg# LINT:		returns the path to the tool found on the platform
2715482df631Smrg#		or the value set to LINT on the configure cmd line
2716482df631Smrg#		also an Automake conditional
2717482df631Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718482df631Smrg#
2719482df631Smrg# --with-lint:	'yes' user instructs the module to use lint
2720482df631Smrg#		'no' user instructs the module not to use lint (default)
2721482df631Smrg#
2722482df631Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723482df631Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2724db17cd6dSmrg#
2725db17cd6dSmrgAC_DEFUN([XORG_WITH_LINT],[
2726db17cd6dSmrg
2727482df631SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728482df631SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729db17cd6dSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2730db17cd6dSmrg		[Use a lint-style source code checker (default: disabled)])],
2731db17cd6dSmrg		[use_lint=$withval], [use_lint=no])
2732482df631Smrg
2733482df631Smrg# Obtain platform specific info like program name and options
2734482df631Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735482df631Smrgcase $host_os in
2736482df631Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737482df631Smrg	lint_name=splint
2738482df631Smrg	lint_options="-badflag"
2739482df631Smrg	;;
2740482df631Smrg  *freebsd* | *netbsd*)
2741482df631Smrg	lint_name=lint
2742482df631Smrg	lint_options="-u -b"
2743482df631Smrg	;;
2744482df631Smrg  *solaris*)
2745482df631Smrg	lint_name=lint
2746482df631Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747482df631Smrg	;;
2748482df631Smrgesac
2749482df631Smrg
2750482df631Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751482df631Smrgif test "x$use_lint" = x"yes" ; then
2752482df631Smrg   AC_PATH_PROG([LINT], [$lint_name])
2753482df631Smrg   if test "x$LINT" = "x"; then
2754482df631Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755482df631Smrg   fi
2756482df631Smrgelif test "x$use_lint" = x"no" ; then
2757482df631Smrg   if test "x$LINT" != "x"; then
2758482df631Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759482df631Smrg   fi
276076910425Smrgelse
2761482df631Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2762db17cd6dSmrgfi
2763482df631Smrg
2764482df631Smrg# User supplied flags override default flags
2765482df631Smrgif test "x$LINT_FLAGS" != "x"; then
2766482df631Smrg   lint_options=$LINT_FLAGS
276776910425Smrgfi
276876910425Smrg
2769482df631SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770482df631SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
277176910425Smrg
2772db17cd6dSmrg]) # XORG_WITH_LINT
277376910425Smrg
2774db17cd6dSmrg# XORG_LINT_LIBRARY(LIBNAME)
2775db17cd6dSmrg# --------------------------
2776db17cd6dSmrg# Minimum version: 1.1.0
2777db17cd6dSmrg#
2778db17cd6dSmrg# Sets up flags for building lint libraries for checking programs that call
2779db17cd6dSmrg# functions in the library.
2780db17cd6dSmrg#
2781482df631Smrg# Interface to module:
2782482df631Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2783482df631Smrg# MAKE_LINT_LIB		- Automake conditional
2784482df631Smrg#
2785482df631Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786482df631Smrg#			  - 'no' user instructs the module not to create a lint library (default)
278776910425Smrg
2788db17cd6dSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2789db17cd6dSmrgAC_REQUIRE([XORG_WITH_LINT])
2790db17cd6dSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2791db17cd6dSmrg	[Create lint library (default: disabled)])],
2792db17cd6dSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793482df631Smrg
2794482df631Smrgif test "x$make_lint_lib" = x"yes" ; then
2795482df631Smrg   LINTLIB=llib-l$1.ln
2796482df631Smrg   if test "x$LINT" = "x"; then
2797482df631Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798482df631Smrg   fi
2799482df631Smrgelif test "x$make_lint_lib" != x"no" ; then
2800482df631Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2801db17cd6dSmrgfi
2802482df631Smrg
2803db17cd6dSmrgAC_SUBST(LINTLIB)
2804db17cd6dSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
280576910425Smrg
2806db17cd6dSmrg]) # XORG_LINT_LIBRARY
280776910425Smrg
28089ff100acSmrg# XORG_COMPILER_BRAND
28099ff100acSmrg# -------------------
28109ff100acSmrg# Minimum version: 1.14.0
28119ff100acSmrg#
28129ff100acSmrg# Checks for various brands of compilers and sets flags as appropriate:
28139ff100acSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28149ff100acSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28159ff100acSmrg#   clang compiler - sets CLANGCC to "yes"
28169ff100acSmrg#   Intel compiler - sets INTELCC to "yes"
28179ff100acSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28189ff100acSmrg#
28199ff100acSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28209ff100acSmrgAC_LANG_CASE(
28219ff100acSmrg	[C], [
28229ff100acSmrg		AC_REQUIRE([AC_PROG_CC_C99])
28239ff100acSmrg	],
28249ff100acSmrg	[C++], [
28259ff100acSmrg		AC_REQUIRE([AC_PROG_CXX])
28269ff100acSmrg	]
28279ff100acSmrg)
28289ff100acSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28299ff100acSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28309ff100acSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28319ff100acSmrg]) # XORG_COMPILER_BRAND
28329ff100acSmrg
28339ff100acSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
28349ff100acSmrg# ---------------
28359ff100acSmrg# Minimum version: 1.16.0
28369ff100acSmrg#
28379ff100acSmrg# Test if the compiler works when passed the given flag as a command line argument.
28389ff100acSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28399ff100acSmrg# next flag in the list until there are no more options.
28409ff100acSmrg#
28419ff100acSmrg# Note that this does not guarantee that the compiler supports the flag as some
28429ff100acSmrg# compilers will simply ignore arguments that they do not understand, but we do
28439ff100acSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
28449ff100acSmrg# -Werror=unused-command-line-argument
28459ff100acSmrg#
28469ff100acSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
28479ff100acSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28489ff100acSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28499ff100acSmrg
28509ff100acSmrgAC_LANG_COMPILER_REQUIRE
28519ff100acSmrg
28529ff100acSmrgAC_LANG_CASE(
28539ff100acSmrg	[C], [
28549ff100acSmrg		AC_REQUIRE([AC_PROG_CC_C99])
28559ff100acSmrg		define([PREFIX], [C])
28569ff100acSmrg		define([CACHE_PREFIX], [cc])
28579ff100acSmrg		define([COMPILER], [$CC])
28589ff100acSmrg	],
28599ff100acSmrg	[C++], [
28609ff100acSmrg		define([PREFIX], [CXX])
28619ff100acSmrg		define([CACHE_PREFIX], [cxx])
28629ff100acSmrg		define([COMPILER], [$CXX])
28639ff100acSmrg	]
28649ff100acSmrg)
28659ff100acSmrg
28669ff100acSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
28679ff100acSmrg
28689ff100acSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
28699ff100acSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28709ff100acSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
28719ff100acSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
28729ff100acSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28739ff100acSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
28749ff100acSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
28759ff100acSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
28769ff100acSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28779ff100acSmrgfi
28789ff100acSmrg
28799ff100acSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
28809ff100acSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
28819ff100acSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28829ff100acSmrg	fi
28839ff100acSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28849ff100acSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
28859ff100acSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
28869ff100acSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28879ff100acSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
28889ff100acSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
28899ff100acSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
28909ff100acSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28919ff100acSmrgfi
28929ff100acSmrg
28939ff100acSmrgfound="no"
28949ff100acSmrgm4_foreach([flag], m4_cdr($@), [
28959ff100acSmrg	if test $found = "no" ; then
28969ff100acSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
28979ff100acSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28989ff100acSmrg		fi
28999ff100acSmrg
29009ff100acSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
29019ff100acSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29029ff100acSmrg		fi
29039ff100acSmrg
29049ff100acSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
29059ff100acSmrg
29069ff100acSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
29079ff100acSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
29089ff100acSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29099ff100acSmrg		AC_CACHE_VAL($cacheid,
29109ff100acSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29119ff100acSmrg					     [eval $cacheid=yes],
29129ff100acSmrg					     [eval $cacheid=no])])
29139ff100acSmrg
29149ff100acSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29159ff100acSmrg
29169ff100acSmrg		eval supported=\$$cacheid
29179ff100acSmrg		AC_MSG_RESULT([$supported])
29189ff100acSmrg		if test "$supported" = "yes" ; then
29199ff100acSmrg			$1="$$1 ]flag["
29209ff100acSmrg			found="yes"
29219ff100acSmrg		fi
29229ff100acSmrg	fi
29239ff100acSmrg])
29249ff100acSmrg]) # XORG_TESTSET_CFLAG
29259ff100acSmrg
29269ff100acSmrg# XORG_COMPILER_FLAGS
29279ff100acSmrg# ---------------
29289ff100acSmrg# Minimum version: 1.16.0
29299ff100acSmrg#
29309ff100acSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29319ff100acSmrg# arguments supported by the selected compiler which do NOT alter the generated
29329ff100acSmrg# code.  These arguments will cause the compiler to print various warnings
29339ff100acSmrg# during compilation AND turn a conservative set of warnings into errors.
29349ff100acSmrg#
29359ff100acSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29369ff100acSmrg# future versions of util-macros as options are added to new compilers.
29379ff100acSmrg#
29389ff100acSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29399ff100acSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
29409ff100acSmrg
29419ff100acSmrgAC_ARG_ENABLE(selective-werror,
29429ff100acSmrg              AS_HELP_STRING([--disable-selective-werror],
29439ff100acSmrg                             [Turn off selective compiler errors. (default: enabled)]),
29449ff100acSmrg              [SELECTIVE_WERROR=$enableval],
29459ff100acSmrg              [SELECTIVE_WERROR=yes])
29469ff100acSmrg
29479ff100acSmrgAC_LANG_CASE(
29489ff100acSmrg        [C], [
29499ff100acSmrg                define([PREFIX], [C])
29509ff100acSmrg        ],
29519ff100acSmrg        [C++], [
29529ff100acSmrg                define([PREFIX], [CXX])
29539ff100acSmrg        ]
29549ff100acSmrg)
29559ff100acSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
29569ff100acSmrgif test "x$SUNCC" = "xyes"; then
29579ff100acSmrg    [BASE_]PREFIX[FLAGS]="-v"
29589ff100acSmrgelse
29599ff100acSmrg    [BASE_]PREFIX[FLAGS]=""
29609ff100acSmrgfi
29619ff100acSmrg
29629ff100acSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
29639ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
29649ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
29659ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
29669ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
29679ff100acSmrg
29689ff100acSmrgAC_LANG_CASE(
29699ff100acSmrg	[C], [
29709ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
29719ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
29729ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
29739ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
29749ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
29759ff100acSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
29769ff100acSmrg	]
29779ff100acSmrg)
29789ff100acSmrg
29799ff100acSmrg# This chunk adds additional warnings that could catch undesired effects.
29809ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
29819ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
29829ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
29839ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
29849ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
29859ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
29869ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
29879ff100acSmrg
29889ff100acSmrg# These are currently disabled because they are noisy.  They will be enabled
29899ff100acSmrg# in the future once the codebase is sufficiently modernized to silence
29909ff100acSmrg# them.  For now, I don't want them to drown out the other warnings.
29919ff100acSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
29929ff100acSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
29939ff100acSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
29949ff100acSmrg
29959ff100acSmrg# Turn some warnings into errors, so we don't accidently get successful builds
29969ff100acSmrg# when there are problems that should be fixed.
29979ff100acSmrg
29989ff100acSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
29999ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
30009ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
30019ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
30029ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
30039ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
30049ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
30059ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
30069ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
30079ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
30089ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30099ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30109ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30119ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30129ff100acSmrgelse
30139ff100acSmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
30149ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30159ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30169ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30179ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30189ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30199ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30209ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30219ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30229ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30239ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30249ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30259ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30269ff100acSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30279ff100acSmrgfi
30289ff100acSmrg
30299ff100acSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30309ff100acSmrg]) # XORG_COMPILER_FLAGS
30319ff100acSmrg
3032db17cd6dSmrg# XORG_CWARNFLAGS
3033db17cd6dSmrg# ---------------
3034db17cd6dSmrg# Minimum version: 1.2.0
30359ff100acSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036db17cd6dSmrg#
3037db17cd6dSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3038db17cd6dSmrg#
30399ff100acSmrg# This function is deprecated because it defines -fno-strict-aliasing
30409ff100acSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30419ff100acSmrg# is needed, then it should be added explicitly in the module when
30429ff100acSmrg# it is updated to use BASE_CFLAGS.
30439ff100acSmrg#
3044db17cd6dSmrgAC_DEFUN([XORG_CWARNFLAGS], [
30459ff100acSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30469ff100acSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30479ff100acSmrgAC_LANG_CASE(
30489ff100acSmrg	[C], [
30499ff100acSmrg		CWARNFLAGS="$BASE_CFLAGS"
30509ff100acSmrg		if  test "x$GCC" = xyes ; then
30519ff100acSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30529ff100acSmrg		fi
30539ff100acSmrg		AC_SUBST(CWARNFLAGS)
30549ff100acSmrg	]
30559ff100acSmrg)
3056db17cd6dSmrg]) # XORG_CWARNFLAGS
305776910425Smrg
3058db17cd6dSmrg# XORG_STRICT_OPTION
3059db17cd6dSmrg# -----------------------
3060db17cd6dSmrg# Minimum version: 1.3.0
306176910425Smrg#
30629ff100acSmrg# Add configure option to enable strict compilation flags, such as treating
30639ff100acSmrg# warnings as fatal errors.
30649ff100acSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
30659ff100acSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30669ff100acSmrg#
30679ff100acSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30689ff100acSmrg# when strict compilation is unconditionally desired.
3069db17cd6dSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070db17cd6dSmrgAC_REQUIRE([XORG_CWARNFLAGS])
30719ff100acSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072db17cd6dSmrg
3073db17cd6dSmrgAC_ARG_ENABLE(strict-compilation,
3074db17cd6dSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3075db17cd6dSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076db17cd6dSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
30779ff100acSmrg
30789ff100acSmrgAC_LANG_CASE(
30799ff100acSmrg        [C], [
30809ff100acSmrg                define([PREFIX], [C])
30819ff100acSmrg        ],
30829ff100acSmrg        [C++], [
30839ff100acSmrg                define([PREFIX], [CXX])
30849ff100acSmrg        ]
30859ff100acSmrg)
30869ff100acSmrg
30879ff100acSmrg[STRICT_]PREFIX[FLAGS]=""
30889ff100acSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
30899ff100acSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
30909ff100acSmrg
30919ff100acSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
30929ff100acSmrg# activate it with -Werror, so we add it here explicitly.
30939ff100acSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
30949ff100acSmrg
3095db17cd6dSmrgif test "x$STRICT_COMPILE" = "xyes"; then
30969ff100acSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
30979ff100acSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098db17cd6dSmrgfi
30999ff100acSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
31009ff100acSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31019ff100acSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102db17cd6dSmrg]) # XORG_STRICT_OPTION
310376910425Smrg
3104db17cd6dSmrg# XORG_DEFAULT_OPTIONS
3105db17cd6dSmrg# --------------------
3106db17cd6dSmrg# Minimum version: 1.3.0
3107db17cd6dSmrg#
3108db17cd6dSmrg# Defines default options for X.Org modules.
3109db17cd6dSmrg#
3110db17cd6dSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111482df631SmrgAC_REQUIRE([AC_PROG_INSTALL])
31129ff100acSmrgXORG_COMPILER_FLAGS
3113db17cd6dSmrgXORG_CWARNFLAGS
3114db17cd6dSmrgXORG_STRICT_OPTION
3115db17cd6dSmrgXORG_RELEASE_VERSION
3116db17cd6dSmrgXORG_CHANGELOG
3117482df631SmrgXORG_INSTALL
3118db17cd6dSmrgXORG_MANPAGE_SECTIONS
3119482df631Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120482df631Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121db17cd6dSmrg]) # XORG_DEFAULT_OPTIONS
3122482df631Smrg
3123482df631Smrg# XORG_INSTALL()
3124482df631Smrg# ----------------
3125482df631Smrg# Minimum version: 1.4.0
3126482df631Smrg#
3127482df631Smrg# Defines the variable INSTALL_CMD as the command to copy
3128482df631Smrg# INSTALL from $prefix/share/util-macros.
3129482df631Smrg#
3130482df631SmrgAC_DEFUN([XORG_INSTALL], [
3131482df631SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132482df631Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133482df631SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134482df631Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135482df631Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136482df631Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137482df631SmrgAC_SUBST([INSTALL_CMD])
3138482df631Smrg]) # XORG_INSTALL
3139db17cd6dSmrgdnl Copyright 2005 Red Hat, Inc
3140db17cd6dSmrgdnl
3141db17cd6dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3142db17cd6dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3143db17cd6dSmrgdnl the above copyright notice appear in all copies and that both that
3144db17cd6dSmrgdnl copyright notice and this permission notice appear in supporting
3145db17cd6dSmrgdnl documentation.
3146db17cd6dSmrgdnl
3147db17cd6dSmrgdnl The above copyright notice and this permission notice shall be included
3148db17cd6dSmrgdnl in all copies or substantial portions of the Software.
3149db17cd6dSmrgdnl
3150db17cd6dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3151db17cd6dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3152db17cd6dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3153db17cd6dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3154db17cd6dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3155db17cd6dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3156db17cd6dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3157db17cd6dSmrgdnl
3158db17cd6dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3159db17cd6dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3160db17cd6dSmrgdnl other dealings in this Software without prior written authorization
3161db17cd6dSmrgdnl from the copyright holders.
3162db17cd6dSmrgdnl
316376910425Smrg
3164db17cd6dSmrg# XORG_RELEASE_VERSION
3165db17cd6dSmrg# --------------------
3166482df631Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31679ff100acSmrg
3168db17cd6dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3169db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3170db17cd6dSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3171db17cd6dSmrg		[Major version of this package])
3172db17cd6dSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3173db17cd6dSmrg	if test "x$PVM" = "x"; then
3174db17cd6dSmrg		PVM="0"
3175db17cd6dSmrg	fi
3176db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3177db17cd6dSmrg		[$PVM],
3178db17cd6dSmrg		[Minor version of this package])
3179db17cd6dSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3180db17cd6dSmrg	if test "x$PVP" = "x"; then
3181db17cd6dSmrg		PVP="0"
3182db17cd6dSmrg	fi
3183db17cd6dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3184db17cd6dSmrg		[$PVP],
3185db17cd6dSmrg		[Patch version of this package])
318676910425Smrg])
318776910425Smrg
3188db17cd6dSmrg# XORG_CHANGELOG()
3189db17cd6dSmrg# ----------------
3190db17cd6dSmrg# Minimum version: 1.2.0
3191db17cd6dSmrg#
3192db17cd6dSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3193db17cd6dSmrg# ChangeLog from git.
3194db17cd6dSmrg#
3195db17cd6dSmrg#
3196db17cd6dSmrgAC_DEFUN([XORG_CHANGELOG], [
3197482df631SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198482df631Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199482df631Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200db17cd6dSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201db17cd6dSmrgAC_SUBST([CHANGELOG_CMD])
3202db17cd6dSmrg]) # XORG_CHANGELOG
320376910425Smrg
3204