aclocal.m4 revision df58931a
1df58931aSmrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
2df58931aSmrg
3df58931aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
44fb28925Smrg
54fb28925Smrg# This file is free software; the Free Software Foundation
64fb28925Smrg# gives unlimited permission to copy and/or distribute it,
74fb28925Smrg# with or without modifications, as long as this notice is preserved.
84fb28925Smrg
94fb28925Smrg# This program is distributed in the hope that it will be useful,
104fb28925Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
114fb28925Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
124fb28925Smrg# PARTICULAR PURPOSE.
134fb28925Smrg
14df58931aSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b66d1acbSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b66d1acbSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17df58931aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18df58931aSmrg[m4_warning([this file was generated for autoconf 2.68.
19b66d1acbSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b66d1acbSmrgIf you have problems, you may need to regenerate the build system entirely.
21df58931aSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
224fb28925Smrg
23df58931aSmrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24b66d1acbSmrg#
25b66d1acbSmrg# This file is free software; the Free Software Foundation
26b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
27b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
284fb28925Smrg
294fb28925Smrg# AM_AUTOMAKE_VERSION(VERSION)
304fb28925Smrg# ----------------------------
314fb28925Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
324fb28925Smrg# generated from the m4 files accompanying Automake X.Y.
33b66d1acbSmrg# (This private macro should not be called outside this file.)
34b66d1acbSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35df58931aSmrg[am__api_version='1.14'
36b66d1acbSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37b66d1acbSmrgdnl require some minimum version.  Point them to the right macro.
38df58931aSmrgm4_if([$1], [1.14], [],
39b66d1acbSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40b66d1acbSmrg])
41b66d1acbSmrg
42b66d1acbSmrg# _AM_AUTOCONF_VERSION(VERSION)
43b66d1acbSmrg# -----------------------------
44b66d1acbSmrg# aclocal traces this macro to find the Autoconf version.
45b66d1acbSmrg# This is a private macro too.  Using m4_define simplifies
46b66d1acbSmrg# the logic in aclocal, which can simply ignore this definition.
47b66d1acbSmrgm4_define([_AM_AUTOCONF_VERSION], [])
484fb28925Smrg
494fb28925Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
504fb28925Smrg# -------------------------------
51b66d1acbSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52b66d1acbSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
534fb28925SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54df58931aSmrg[AM_AUTOMAKE_VERSION([1.14])dnl
55b66d1acbSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56b66d1acbSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57b66d1acbSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
584fb28925Smrg
59b66d1acbSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
604fb28925Smrg
61df58931aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
624fb28925Smrg#
63b66d1acbSmrg# This file is free software; the Free Software Foundation
64b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
65b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
664fb28925Smrg
674fb28925Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68df58931aSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69df58931aSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
704fb28925Smrg#
714fb28925Smrg# Of course, Automake must honor this variable whenever it calls a
724fb28925Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
734fb28925Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
744fb28925Smrg# depending on how configure is run.  This is pretty annoying, since
754fb28925Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
764fb28925Smrg# source directory, any form will work fine, but in subdirectories a
774fb28925Smrg# relative path needs to be adjusted first.
784fb28925Smrg#
794fb28925Smrg# $ac_aux_dir/missing
804fb28925Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
814fb28925Smrg# $top_srcdir/$ac_aux_dir/missing
824fb28925Smrg#    fails if $ac_aux_dir is absolute,
834fb28925Smrg#    fails when called from a subdirectory in a VPATH build with
844fb28925Smrg#          a relative $ac_aux_dir
854fb28925Smrg#
864fb28925Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
874fb28925Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88df58931aSmrg# harmless because $srcdir is '.', but things will broke when you
894fb28925Smrg# start a VPATH build or use an absolute $srcdir.
904fb28925Smrg#
914fb28925Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
924fb28925Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
934fb28925Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
944fb28925Smrg# and then we would define $MISSING as
954fb28925Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
964fb28925Smrg# This will work as long as MISSING is not called from configure, because
974fb28925Smrg# unfortunately $(top_srcdir) has no meaning in configure.
984fb28925Smrg# However there are other variables, like CC, which are often used in
994fb28925Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1004fb28925Smrg#
1014fb28925Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1024fb28925Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1034fb28925Smrg# configured tree to be moved without reconfiguration.
1044fb28925Smrg
105b66d1acbSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106b66d1acbSmrg[dnl Rely on autoconf to set up CDPATH properly.
107b66d1acbSmrgAC_PREREQ([2.50])dnl
1084fb28925Smrg# expand $ac_aux_dir to an absolute path
1094fb28925Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
1104fb28925Smrg])
1114fb28925Smrg
112b66d1acbSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1134fb28925Smrg
114df58931aSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
115b66d1acbSmrg#
116b66d1acbSmrg# This file is free software; the Free Software Foundation
117b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
118b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
1194fb28925Smrg
120b66d1acbSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
121b66d1acbSmrg# -------------------------------------
122b66d1acbSmrg# Define a conditional.
123b66d1acbSmrgAC_DEFUN([AM_CONDITIONAL],
124df58931aSmrg[AC_PREREQ([2.52])dnl
125df58931aSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
126df58931aSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
127b66d1acbSmrgAC_SUBST([$1_TRUE])dnl
128b66d1acbSmrgAC_SUBST([$1_FALSE])dnl
129b66d1acbSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
130b66d1acbSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
131b66d1acbSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
132b66d1acbSmrgif $2; then
133b66d1acbSmrg  $1_TRUE=
134b66d1acbSmrg  $1_FALSE='#'
1354fb28925Smrgelse
136b66d1acbSmrg  $1_TRUE='#'
137b66d1acbSmrg  $1_FALSE=
1384fb28925Smrgfi
139b66d1acbSmrgAC_CONFIG_COMMANDS_PRE(
140b66d1acbSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
141b66d1acbSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
142b66d1acbSmrgUsually this means the macro was only invoked conditionally.]])
143b66d1acbSmrgfi])])
1444fb28925Smrg
145df58931aSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
146b66d1acbSmrg#
147b66d1acbSmrg# This file is free software; the Free Software Foundation
148b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
149b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
1504fb28925Smrg
1514fb28925Smrg
152df58931aSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1534fb28925Smrg# written in clear, in which case automake, when reading aclocal.m4,
1544fb28925Smrg# will think it sees a *use*, and therefore will trigger all it's
1554fb28925Smrg# C support machinery.  Also note that it means that autoscan, seeing
1564fb28925Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1574fb28925Smrg
1584fb28925Smrg
1594fb28925Smrg# _AM_DEPENDENCIES(NAME)
1604fb28925Smrg# ----------------------
1614fb28925Smrg# See how the compiler implements dependency checking.
162df58931aSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1634fb28925Smrg# We try a few techniques and use that to set a single cache variable.
1644fb28925Smrg#
1654fb28925Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1664fb28925Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1674fb28925Smrg# dependency, and given that the user is not expected to run this macro,
1684fb28925Smrg# just rely on AC_PROG_CC.
1694fb28925SmrgAC_DEFUN([_AM_DEPENDENCIES],
1704fb28925Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1714fb28925SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1724fb28925SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1734fb28925SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1744fb28925Smrg
175df58931aSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
176df58931aSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
177df58931aSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
178df58931aSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
179df58931aSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
180df58931aSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
181df58931aSmrg                    [depcc="$$1"   am_compiler_list=])
1824fb28925Smrg
1834fb28925SmrgAC_CACHE_CHECK([dependency style of $depcc],
1844fb28925Smrg               [am_cv_$1_dependencies_compiler_type],
1854fb28925Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1864fb28925Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1874fb28925Smrg  # making bogus files that we don't know about and never remove.  For
1884fb28925Smrg  # instance it was reported that on HP-UX the gcc test will end up
189df58931aSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
190df58931aSmrg  # in D".
191df58931aSmrg  rm -rf conftest.dir
1924fb28925Smrg  mkdir conftest.dir
1934fb28925Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1944fb28925Smrg  # using a relative directory.
1954fb28925Smrg  cp "$am_depcomp" conftest.dir
1964fb28925Smrg  cd conftest.dir
1974fb28925Smrg  # We will build objects and dependencies in a subdirectory because
1984fb28925Smrg  # it helps to detect inapplicable dependency modes.  For instance
1994fb28925Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2004fb28925Smrg  # side effect of compilation, but ICC will put the dependencies in
2014fb28925Smrg  # the current directory while Tru64 will put them in the object
2024fb28925Smrg  # directory.
2034fb28925Smrg  mkdir sub
2044fb28925Smrg
2054fb28925Smrg  am_cv_$1_dependencies_compiler_type=none
2064fb28925Smrg  if test "$am_compiler_list" = ""; then
2074fb28925Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2084fb28925Smrg  fi
209b66d1acbSmrg  am__universal=false
210b66d1acbSmrg  m4_case([$1], [CC],
211b66d1acbSmrg    [case " $depcc " in #(
212b66d1acbSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
213b66d1acbSmrg     esac],
214b66d1acbSmrg    [CXX],
215b66d1acbSmrg    [case " $depcc " in #(
216b66d1acbSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
217b66d1acbSmrg     esac])
218b66d1acbSmrg
2194fb28925Smrg  for depmode in $am_compiler_list; do
2204fb28925Smrg    # Setup a source with many dependencies, because some compilers
2214fb28925Smrg    # like to wrap large dependency lists on column 80 (with \), and
2224fb28925Smrg    # we should not choose a depcomp mode which is confused by this.
2234fb28925Smrg    #
2244fb28925Smrg    # We need to recreate these files for each test, as the compiler may
2254fb28925Smrg    # overwrite some of them when testing with obscure command lines.
2264fb28925Smrg    # This happens at least with the AIX C compiler.
2274fb28925Smrg    : > sub/conftest.c
2284fb28925Smrg    for i in 1 2 3 4 5 6; do
2294fb28925Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
230df58931aSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
231df58931aSmrg      # Solaris 10 /bin/sh.
232df58931aSmrg      echo '/* dummy */' > sub/conftst$i.h
2334fb28925Smrg    done
2344fb28925Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2354fb28925Smrg
236df58931aSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
237b66d1acbSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
238df58931aSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
239df58931aSmrg    # versions had trouble with output in subdirs.
240b66d1acbSmrg    am__obj=sub/conftest.${OBJEXT-o}
241b66d1acbSmrg    am__minus_obj="-o $am__obj"
2424fb28925Smrg    case $depmode in
243b66d1acbSmrg    gcc)
244b66d1acbSmrg      # This depmode causes a compiler race in universal mode.
245b66d1acbSmrg      test "$am__universal" = false || continue
246b66d1acbSmrg      ;;
2474fb28925Smrg    nosideeffect)
248df58931aSmrg      # After this tag, mechanisms are not by side-effect, so they'll
249df58931aSmrg      # only be used when explicitly requested.
2504fb28925Smrg      if test "x$enable_dependency_tracking" = xyes; then
2514fb28925Smrg	continue
2524fb28925Smrg      else
2534fb28925Smrg	break
2544fb28925Smrg      fi
2554fb28925Smrg      ;;
256df58931aSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
257df58931aSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
258b66d1acbSmrg      # not run yet.  These depmodes are late enough in the game, and
259b66d1acbSmrg      # so weak that their functioning should not be impacted.
260b66d1acbSmrg      am__obj=conftest.${OBJEXT-o}
261b66d1acbSmrg      am__minus_obj=
262b66d1acbSmrg      ;;
2634fb28925Smrg    none) break ;;
2644fb28925Smrg    esac
2654fb28925Smrg    if depmode=$depmode \
266b66d1acbSmrg       source=sub/conftest.c object=$am__obj \
2674fb28925Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
268b66d1acbSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2694fb28925Smrg         >/dev/null 2>conftest.err &&
270b66d1acbSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2714fb28925Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
272b66d1acbSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2734fb28925Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2744fb28925Smrg      # icc doesn't choke on unknown options, it will just issue warnings
275b66d1acbSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
276b66d1acbSmrg      # that says an option was ignored or not supported.
277b66d1acbSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
278b66d1acbSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
279b66d1acbSmrg      # The diagnosis changed in icc 8.0:
280b66d1acbSmrg      #   icc: Command line remark: option '-MP' not supported
281b66d1acbSmrg      if (grep 'ignoring option' conftest.err ||
282b66d1acbSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2834fb28925Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2844fb28925Smrg        break
2854fb28925Smrg      fi
2864fb28925Smrg    fi
2874fb28925Smrg  done
2884fb28925Smrg
2894fb28925Smrg  cd ..
2904fb28925Smrg  rm -rf conftest.dir
2914fb28925Smrgelse
2924fb28925Smrg  am_cv_$1_dependencies_compiler_type=none
2934fb28925Smrgfi
2944fb28925Smrg])
2954fb28925SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2964fb28925SmrgAM_CONDITIONAL([am__fastdep$1], [
2974fb28925Smrg  test "x$enable_dependency_tracking" != xno \
2984fb28925Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2994fb28925Smrg])
3004fb28925Smrg
3014fb28925Smrg
3024fb28925Smrg# AM_SET_DEPDIR
3034fb28925Smrg# -------------
3044fb28925Smrg# Choose a directory name for dependency files.
305df58931aSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3064fb28925SmrgAC_DEFUN([AM_SET_DEPDIR],
3074fb28925Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3084fb28925SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3094fb28925Smrg])
3104fb28925Smrg
3114fb28925Smrg
3124fb28925Smrg# AM_DEP_TRACK
3134fb28925Smrg# ------------
3144fb28925SmrgAC_DEFUN([AM_DEP_TRACK],
315df58931aSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
316df58931aSmrgAS_HELP_STRING(
317df58931aSmrg  [--enable-dependency-tracking],
318df58931aSmrg  [do not reject slow dependency extractors])
319df58931aSmrgAS_HELP_STRING(
320df58931aSmrg  [--disable-dependency-tracking],
321df58931aSmrg  [speeds up one-time build])])
3224fb28925Smrgif test "x$enable_dependency_tracking" != xno; then
3234fb28925Smrg  am_depcomp="$ac_aux_dir/depcomp"
3244fb28925Smrg  AMDEPBACKSLASH='\'
325df58931aSmrg  am__nodep='_no'
3264fb28925Smrgfi
3274fb28925SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
328b66d1acbSmrgAC_SUBST([AMDEPBACKSLASH])dnl
329b66d1acbSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
330df58931aSmrgAC_SUBST([am__nodep])dnl
331df58931aSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3324fb28925Smrg])
3334fb28925Smrg
334b66d1acbSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3354fb28925Smrg
336df58931aSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337b66d1acbSmrg#
338b66d1acbSmrg# This file is free software; the Free Software Foundation
339b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
340b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
3414fb28925Smrg
3424fb28925Smrg
3434fb28925Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3444fb28925Smrg# ------------------------------
3454fb28925SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
346b66d1acbSmrg[{
347df58931aSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
348b66d1acbSmrg  # are listed without --file.  Let's play safe and only enable the eval
349b66d1acbSmrg  # if we detect the quoting.
350b66d1acbSmrg  case $CONFIG_FILES in
351b66d1acbSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
352b66d1acbSmrg  *)   set x $CONFIG_FILES ;;
353b66d1acbSmrg  esac
354b66d1acbSmrg  shift
355b66d1acbSmrg  for mf
356b66d1acbSmrg  do
357b66d1acbSmrg    # Strip MF so we end up with the name of the file.
358b66d1acbSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
359b66d1acbSmrg    # Check whether this is an Automake generated Makefile or not.
360df58931aSmrg    # We used to match only the files named 'Makefile.in', but
361b66d1acbSmrg    # some people rename them; so instead we look at the file content.
362b66d1acbSmrg    # Grep'ing the first line is not enough: some people post-process
363b66d1acbSmrg    # each Makefile.in and add a new line on top of each file to say so.
364b66d1acbSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
365b66d1acbSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
366b66d1acbSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
367b66d1acbSmrg      dirpart=`AS_DIRNAME("$mf")`
368b66d1acbSmrg    else
369b66d1acbSmrg      continue
370b66d1acbSmrg    fi
371b66d1acbSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
372df58931aSmrg    # from the Makefile without running 'make'.
373b66d1acbSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
374b66d1acbSmrg    test -z "$DEPDIR" && continue
375b66d1acbSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
376df58931aSmrg    test -z "$am__include" && continue
377b66d1acbSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
378b66d1acbSmrg    # Find all dependency output files, they are included files with
379b66d1acbSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
380b66d1acbSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
381b66d1acbSmrg    # expansion.
382b66d1acbSmrg    for file in `sed -n "
383b66d1acbSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
384df58931aSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
385b66d1acbSmrg      # Make sure the directory exists.
386b66d1acbSmrg      test -f "$dirpart/$file" && continue
387b66d1acbSmrg      fdir=`AS_DIRNAME(["$file"])`
388b66d1acbSmrg      AS_MKDIR_P([$dirpart/$fdir])
389b66d1acbSmrg      # echo "creating $dirpart/$file"
390b66d1acbSmrg      echo '# dummy' > "$dirpart/$file"
391b66d1acbSmrg    done
3924fb28925Smrg  done
393b66d1acbSmrg}
3944fb28925Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3954fb28925Smrg
3964fb28925Smrg
3974fb28925Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3984fb28925Smrg# -----------------------------
3994fb28925Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
4004fb28925Smrg#
4014fb28925Smrg# This code is only required when automatic dependency tracking
402df58931aSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
4034fb28925Smrg# need in order to bootstrap the dependency handling code.
4044fb28925SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4054fb28925Smrg[AC_CONFIG_COMMANDS([depfiles],
4064fb28925Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4074fb28925Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4084fb28925Smrg])
4094fb28925Smrg
410b66d1acbSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4114fb28925Smrg
412df58931aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
413b66d1acbSmrg#
414b66d1acbSmrg# This file is free software; the Free Software Foundation
415b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
416b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
4174fb28925Smrg
418b66d1acbSmrg# This macro actually does too much.  Some checks are only needed if
419b66d1acbSmrg# your package does certain things.  But this isn't really a big deal.
420b66d1acbSmrg
421df58931aSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
422df58931aSmrgm4_define([AC_PROG_CC],
423df58931aSmrgm4_defn([AC_PROG_CC])
424df58931aSmrg[_AM_PROG_CC_C_O
425df58931aSmrg])
426df58931aSmrg
427b66d1acbSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
428b66d1acbSmrg# AM_INIT_AUTOMAKE([OPTIONS])
429b66d1acbSmrg# -----------------------------------------------
430b66d1acbSmrg# The call with PACKAGE and VERSION arguments is the old style
431b66d1acbSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
432b66d1acbSmrg# and VERSION should now be passed to AC_INIT and removed from
433b66d1acbSmrg# the call to AM_INIT_AUTOMAKE.
434b66d1acbSmrg# We support both call styles for the transition.  After
435b66d1acbSmrg# the next Automake release, Autoconf can make the AC_INIT
436b66d1acbSmrg# arguments mandatory, and then we can depend on a new Autoconf
437b66d1acbSmrg# release and drop the old call support.
438b66d1acbSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
439df58931aSmrg[AC_PREREQ([2.65])dnl
440b66d1acbSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
441b66d1acbSmrgdnl the ones we care about.
442b66d1acbSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
443b66d1acbSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
444b66d1acbSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
445b66d1acbSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
446b66d1acbSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
447b66d1acbSmrg  # is not polluted with repeated "-I."
448b66d1acbSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
449b66d1acbSmrg  # test to see if srcdir already configured
450b66d1acbSmrg  if test -f $srcdir/config.status; then
451b66d1acbSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
452b66d1acbSmrg  fi
4534fb28925Smrgfi
454b66d1acbSmrg
455b66d1acbSmrg# test whether we have cygpath
456b66d1acbSmrgif test -z "$CYGPATH_W"; then
457b66d1acbSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
458b66d1acbSmrg    CYGPATH_W='cygpath -w'
459b66d1acbSmrg  else
460b66d1acbSmrg    CYGPATH_W=echo
461b66d1acbSmrg  fi
4624fb28925Smrgfi
463b66d1acbSmrgAC_SUBST([CYGPATH_W])
4644fb28925Smrg
465b66d1acbSmrg# Define the identity of the package.
466b66d1acbSmrgdnl Distinguish between old-style and new-style calls.
467b66d1acbSmrgm4_ifval([$2],
468df58931aSmrg[AC_DIAGNOSE([obsolete],
469df58931aSmrg             [$0: two- and three-arguments forms are deprecated.])
470df58931aSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
471b66d1acbSmrg AC_SUBST([PACKAGE], [$1])dnl
472b66d1acbSmrg AC_SUBST([VERSION], [$2])],
473b66d1acbSmrg[_AM_SET_OPTIONS([$1])dnl
474b66d1acbSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
475df58931aSmrgm4_if(
476df58931aSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
477df58931aSmrg  [ok:ok],,
478b66d1acbSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
479b66d1acbSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
480b66d1acbSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4814fb28925Smrg
482b66d1acbSmrg_AM_IF_OPTION([no-define],,
483df58931aSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
484df58931aSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4854fb28925Smrg
486b66d1acbSmrg# Some tools Automake needs.
487b66d1acbSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
488b66d1acbSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
489df58931aSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
490df58931aSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
491df58931aSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
492df58931aSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
493df58931aSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
494b66d1acbSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
495b66d1acbSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
496df58931aSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
497df58931aSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
498df58931aSmrg# dies out for good.  For more background, see:
499df58931aSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
500df58931aSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
501df58931aSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
502b66d1acbSmrg# We need awk for the "check" target.  The system "awk" is bad on
503b66d1acbSmrg# some platforms.
504b66d1acbSmrgAC_REQUIRE([AC_PROG_AWK])dnl
505b66d1acbSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
506b66d1acbSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
507b66d1acbSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
508b66d1acbSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
509b66d1acbSmrg			     [_AM_PROG_TAR([v7])])])
510b66d1acbSmrg_AM_IF_OPTION([no-dependencies],,
511b66d1acbSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
512df58931aSmrg		  [_AM_DEPENDENCIES([CC])],
513df58931aSmrg		  [m4_define([AC_PROG_CC],
514df58931aSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
515b66d1acbSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
516df58931aSmrg		  [_AM_DEPENDENCIES([CXX])],
517df58931aSmrg		  [m4_define([AC_PROG_CXX],
518df58931aSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
519b66d1acbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
520df58931aSmrg		  [_AM_DEPENDENCIES([OBJC])],
521df58931aSmrg		  [m4_define([AC_PROG_OBJC],
522df58931aSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
523df58931aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
524df58931aSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
525df58931aSmrg		  [m4_define([AC_PROG_OBJCXX],
526df58931aSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
527b66d1acbSmrg])
528df58931aSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
529df58931aSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
530df58931aSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
531df58931aSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
532b66d1acbSmrgAC_CONFIG_COMMANDS_PRE(dnl
533b66d1acbSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
534b66d1acbSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5354fb28925Smrg
536df58931aSmrg# POSIX will say in a future version that running "rm -f" with no argument
537df58931aSmrg# is OK; and we want to be able to make that assumption in our Makefile
538df58931aSmrg# recipes.  So use an aggressive probe to check that the usage we want is
539df58931aSmrg# actually supported "in the wild" to an acceptable degree.
540df58931aSmrg# See automake bug#10828.
541df58931aSmrg# To make any issue more visible, cause the running configure to be aborted
542df58931aSmrg# by default if the 'rm' program in use doesn't match our expectations; the
543df58931aSmrg# user can still override this though.
544df58931aSmrgif rm -f && rm -fr && rm -rf; then : OK; else
545df58931aSmrg  cat >&2 <<'END'
546df58931aSmrgOops!
547df58931aSmrg
548df58931aSmrgYour 'rm' program seems unable to run without file operands specified
549df58931aSmrgon the command line, even when the '-f' option is present.  This is contrary
550df58931aSmrgto the behaviour of most rm programs out there, and not conforming with
551df58931aSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
552df58931aSmrg
553df58931aSmrgPlease tell bug-automake@gnu.org about your system, including the value
554df58931aSmrgof your $PATH and any error possibly output before this message.  This
555df58931aSmrgcan help us improve future automake versions.
556df58931aSmrg
557df58931aSmrgEND
558df58931aSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
559df58931aSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
560df58931aSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
561df58931aSmrg    echo >&2
562df58931aSmrg  else
563df58931aSmrg    cat >&2 <<'END'
564df58931aSmrgAborting the configuration process, to ensure you take notice of the issue.
565df58931aSmrg
566df58931aSmrgYou can download and install GNU coreutils to get an 'rm' implementation
567df58931aSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
568df58931aSmrg
569df58931aSmrgIf you want to complete the configuration process using your problematic
570df58931aSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
571df58931aSmrgto "yes", and re-run configure.
572df58931aSmrg
573df58931aSmrgEND
574df58931aSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
575df58931aSmrg  fi
576df58931aSmrgfi])
577df58931aSmrg
578df58931aSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
579b66d1acbSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
580b66d1acbSmrgdnl mangled by Autoconf and run in a shell conditional statement.
581b66d1acbSmrgm4_define([_AC_COMPILER_EXEEXT],
582b66d1acbSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5834fb28925Smrg
584b66d1acbSmrg# When config.status generates a header, we must update the stamp-h file.
585b66d1acbSmrg# This file resides in the same directory as the config header
586b66d1acbSmrg# that is generated.  The stamp files are numbered to have different names.
587b66d1acbSmrg
588b66d1acbSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
589b66d1acbSmrg# loop where config.status creates the headers, so we can generate
590b66d1acbSmrg# our stamp files there.
591b66d1acbSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
592b66d1acbSmrg[# Compute $1's index in $config_headers.
593b66d1acbSmrg_am_arg=$1
594b66d1acbSmrg_am_stamp_count=1
595b66d1acbSmrgfor _am_header in $config_headers :; do
596b66d1acbSmrg  case $_am_header in
597b66d1acbSmrg    $_am_arg | $_am_arg:* )
598b66d1acbSmrg      break ;;
599b66d1acbSmrg    * )
600b66d1acbSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
601b66d1acbSmrg  esac
602b66d1acbSmrgdone
603b66d1acbSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6044fb28925Smrg
605df58931aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
606b66d1acbSmrg#
607b66d1acbSmrg# This file is free software; the Free Software Foundation
608b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
609b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
6104fb28925Smrg
611b66d1acbSmrg# AM_PROG_INSTALL_SH
612b66d1acbSmrg# ------------------
613b66d1acbSmrg# Define $install_sh.
614b66d1acbSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
615b66d1acbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
616b66d1acbSmrgif test x"${install_sh}" != xset; then
617b66d1acbSmrg  case $am_aux_dir in
618b66d1acbSmrg  *\ * | *\	*)
619b66d1acbSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
620b66d1acbSmrg  *)
621b66d1acbSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
622b66d1acbSmrg  esac
6234fb28925Smrgfi
624df58931aSmrgAC_SUBST([install_sh])])
6254fb28925Smrg
626df58931aSmrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
627b66d1acbSmrg#
628b66d1acbSmrg# This file is free software; the Free Software Foundation
629b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
630b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
6314fb28925Smrg
632b66d1acbSmrg# Check whether the underlying file-system supports filenames
633b66d1acbSmrg# with a leading dot.  For instance MS-DOS doesn't.
634b66d1acbSmrgAC_DEFUN([AM_SET_LEADING_DOT],
635b66d1acbSmrg[rm -rf .tst 2>/dev/null
636b66d1acbSmrgmkdir .tst 2>/dev/null
637b66d1acbSmrgif test -d .tst; then
638b66d1acbSmrg  am__leading_dot=.
639b66d1acbSmrgelse
640b66d1acbSmrg  am__leading_dot=_
641b66d1acbSmrgfi
642b66d1acbSmrgrmdir .tst 2>/dev/null
643b66d1acbSmrgAC_SUBST([am__leading_dot])])
6444fb28925Smrg
645b66d1acbSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
646b66d1acbSmrg# From Jim Meyering
6474fb28925Smrg
648df58931aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
649b66d1acbSmrg#
650b66d1acbSmrg# This file is free software; the Free Software Foundation
651b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
652b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
6534fb28925Smrg
654b66d1acbSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
655b66d1acbSmrg# ----------------------------------
656b66d1acbSmrg# Control maintainer-specific portions of Makefiles.
657df58931aSmrg# Default is to disable them, unless 'enable' is passed literally.
658df58931aSmrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
659b66d1acbSmrg# can override the default with the --enable/--disable switch.
6604fb28925SmrgAC_DEFUN([AM_MAINTAINER_MODE],
661b66d1acbSmrg[m4_case(m4_default([$1], [disable]),
662b66d1acbSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
663b66d1acbSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
664b66d1acbSmrg       [m4_define([am_maintainer_other], [enable])
665b66d1acbSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
666df58931aSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
667b66d1acbSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
668b66d1acbSmrg  AC_ARG_ENABLE([maintainer-mode],
669df58931aSmrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
670df58931aSmrg      am_maintainer_other[ make rules and dependencies not useful
671df58931aSmrg      (and sometimes confusing) to the casual installer])],
672df58931aSmrg    [USE_MAINTAINER_MODE=$enableval],
673df58931aSmrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6744fb28925Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
675b66d1acbSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6764fb28925Smrg  MAINT=$MAINTAINER_MODE_TRUE
677b66d1acbSmrg  AC_SUBST([MAINT])dnl
6784fb28925Smrg]
6794fb28925Smrg)
6804fb28925Smrg
681b66d1acbSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6824fb28925Smrg
683df58931aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
684b66d1acbSmrg#
685b66d1acbSmrg# This file is free software; the Free Software Foundation
686b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
687b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
6884fb28925Smrg
689b66d1acbSmrg# AM_MAKE_INCLUDE()
690b66d1acbSmrg# -----------------
691b66d1acbSmrg# Check to see how make treats includes.
692b66d1acbSmrgAC_DEFUN([AM_MAKE_INCLUDE],
693b66d1acbSmrg[am_make=${MAKE-make}
694b66d1acbSmrgcat > confinc << 'END'
695b66d1acbSmrgam__doit:
696b66d1acbSmrg	@echo this is the am__doit target
697b66d1acbSmrg.PHONY: am__doit
698b66d1acbSmrgEND
699b66d1acbSmrg# If we don't find an include directive, just comment out the code.
700b66d1acbSmrgAC_MSG_CHECKING([for style of include used by $am_make])
701b66d1acbSmrgam__include="#"
702b66d1acbSmrgam__quote=
703b66d1acbSmrg_am_result=none
704b66d1acbSmrg# First try GNU make style include.
705b66d1acbSmrgecho "include confinc" > confmf
706df58931aSmrg# Ignore all kinds of additional output from 'make'.
707b66d1acbSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
708b66d1acbSmrg*the\ am__doit\ target*)
709b66d1acbSmrg  am__include=include
710b66d1acbSmrg  am__quote=
711b66d1acbSmrg  _am_result=GNU
712b66d1acbSmrg  ;;
713b66d1acbSmrgesac
714b66d1acbSmrg# Now try BSD make style include.
715b66d1acbSmrgif test "$am__include" = "#"; then
716b66d1acbSmrg   echo '.include "confinc"' > confmf
717b66d1acbSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
718b66d1acbSmrg   *the\ am__doit\ target*)
719b66d1acbSmrg     am__include=.include
720b66d1acbSmrg     am__quote="\""
721b66d1acbSmrg     _am_result=BSD
722b66d1acbSmrg     ;;
723b66d1acbSmrg   esac
724b66d1acbSmrgfi
725b66d1acbSmrgAC_SUBST([am__include])
726b66d1acbSmrgAC_SUBST([am__quote])
727b66d1acbSmrgAC_MSG_RESULT([$_am_result])
728b66d1acbSmrgrm -f confinc confmf
729b66d1acbSmrg])
7304fb28925Smrg
731b66d1acbSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7324fb28925Smrg
733df58931aSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
734b66d1acbSmrg#
735b66d1acbSmrg# This file is free software; the Free Software Foundation
736b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
737b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
7384fb28925Smrg
739b66d1acbSmrg# AM_MISSING_PROG(NAME, PROGRAM)
740b66d1acbSmrg# ------------------------------
741b66d1acbSmrgAC_DEFUN([AM_MISSING_PROG],
742b66d1acbSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
743b66d1acbSmrg$1=${$1-"${am_missing_run}$2"}
744b66d1acbSmrgAC_SUBST($1)])
7454fb28925Smrg
746b66d1acbSmrg# AM_MISSING_HAS_RUN
747b66d1acbSmrg# ------------------
748df58931aSmrg# Define MISSING if not defined so far and test if it is modern enough.
749df58931aSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
750b66d1acbSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
751b66d1acbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
752b66d1acbSmrgAC_REQUIRE_AUX_FILE([missing])dnl
753b66d1acbSmrgif test x"${MISSING+set}" != xset; then
754b66d1acbSmrg  case $am_aux_dir in
755b66d1acbSmrg  *\ * | *\	*)
756b66d1acbSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
757b66d1acbSmrg  *)
758b66d1acbSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
759b66d1acbSmrg  esac
7604fb28925Smrgfi
761b66d1acbSmrg# Use eval to expand $SHELL
762df58931aSmrgif eval "$MISSING --is-lightweight"; then
763df58931aSmrg  am_missing_run="$MISSING "
764b66d1acbSmrgelse
765b66d1acbSmrg  am_missing_run=
766df58931aSmrg  AC_MSG_WARN(['missing' script is too old or missing])
767b66d1acbSmrgfi
768b66d1acbSmrg])
7694fb28925Smrg
770b66d1acbSmrg# Helper functions for option handling.                     -*- Autoconf -*-
771b66d1acbSmrg
772df58931aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
7734fb28925Smrg#
774b66d1acbSmrg# This file is free software; the Free Software Foundation
775b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
776b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
7774fb28925Smrg
778b66d1acbSmrg# _AM_MANGLE_OPTION(NAME)
779b66d1acbSmrg# -----------------------
780b66d1acbSmrgAC_DEFUN([_AM_MANGLE_OPTION],
781b66d1acbSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7824fb28925Smrg
783b66d1acbSmrg# _AM_SET_OPTION(NAME)
784df58931aSmrg# --------------------
785b66d1acbSmrg# Set option NAME.  Presently that only means defining a flag for this option.
786b66d1acbSmrgAC_DEFUN([_AM_SET_OPTION],
787df58931aSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7884fb28925Smrg
789b66d1acbSmrg# _AM_SET_OPTIONS(OPTIONS)
790df58931aSmrg# ------------------------
791b66d1acbSmrg# OPTIONS is a space-separated list of Automake options.
792b66d1acbSmrgAC_DEFUN([_AM_SET_OPTIONS],
793b66d1acbSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7944fb28925Smrg
795b66d1acbSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
796b66d1acbSmrg# -------------------------------------------
797b66d1acbSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
798b66d1acbSmrgAC_DEFUN([_AM_IF_OPTION],
799b66d1acbSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800b66d1acbSmrg
801df58931aSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
802df58931aSmrg#
803df58931aSmrg# This file is free software; the Free Software Foundation
804df58931aSmrg# gives unlimited permission to copy and/or distribute it,
805df58931aSmrg# with or without modifications, as long as this notice is preserved.
806df58931aSmrg
807df58931aSmrg# _AM_PROG_CC_C_O
808df58931aSmrg# ---------------
809df58931aSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
810df58931aSmrg# to automatically call this.
811df58931aSmrgAC_DEFUN([_AM_PROG_CC_C_O],
812df58931aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
813df58931aSmrgAC_REQUIRE_AUX_FILE([compile])dnl
814df58931aSmrgAC_LANG_PUSH([C])dnl
815df58931aSmrgAC_CACHE_CHECK(
816df58931aSmrg  [whether $CC understands -c and -o together],
817df58931aSmrg  [am_cv_prog_cc_c_o],
818df58931aSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
819df58931aSmrg  # Make sure it works both with $CC and with simple cc.
820df58931aSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
821df58931aSmrg  # compilers refuse to overwrite an existing .o file with -o,
822df58931aSmrg  # though they will create one.
823df58931aSmrg  am_cv_prog_cc_c_o=yes
824df58931aSmrg  for am_i in 1 2; do
825df58931aSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
826df58931aSmrg         && test -f conftest2.$ac_objext; then
827df58931aSmrg      : OK
828df58931aSmrg    else
829df58931aSmrg      am_cv_prog_cc_c_o=no
830df58931aSmrg      break
831df58931aSmrg    fi
832df58931aSmrg  done
833df58931aSmrg  rm -f core conftest*
834df58931aSmrg  unset am_i])
835df58931aSmrgif test "$am_cv_prog_cc_c_o" != yes; then
836df58931aSmrg   # Losing compiler, so override with the script.
837df58931aSmrg   # FIXME: It is wrong to rewrite CC.
838df58931aSmrg   # But if we don't then we get into trouble of one sort or another.
839df58931aSmrg   # A longer-term fix would be to have automake use am__CC in this case,
840df58931aSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
841df58931aSmrg   CC="$am_aux_dir/compile $CC"
842df58931aSmrgfi
843df58931aSmrgAC_LANG_POP([C])])
844b66d1acbSmrg
845df58931aSmrg# For backward compatibility.
846df58931aSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
847df58931aSmrg
848df58931aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
8494fb28925Smrg#
850b66d1acbSmrg# This file is free software; the Free Software Foundation
851b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
852b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
853b66d1acbSmrg
854df58931aSmrg# AM_RUN_LOG(COMMAND)
855df58931aSmrg# -------------------
856df58931aSmrg# Run COMMAND, save the exit status in ac_status, and log it.
857df58931aSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
858df58931aSmrgAC_DEFUN([AM_RUN_LOG],
859df58931aSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
860df58931aSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
861df58931aSmrg   ac_status=$?
862df58931aSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
863df58931aSmrg   (exit $ac_status); }])
864df58931aSmrg
865df58931aSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
866df58931aSmrg
867df58931aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
868df58931aSmrg#
869df58931aSmrg# This file is free software; the Free Software Foundation
870df58931aSmrg# gives unlimited permission to copy and/or distribute it,
871df58931aSmrg# with or without modifications, as long as this notice is preserved.
872b66d1acbSmrg
873b66d1acbSmrg# AM_SANITY_CHECK
874b66d1acbSmrg# ---------------
875b66d1acbSmrgAC_DEFUN([AM_SANITY_CHECK],
876b66d1acbSmrg[AC_MSG_CHECKING([whether build environment is sane])
877b66d1acbSmrg# Reject unsafe characters in $srcdir or the absolute working directory
878b66d1acbSmrg# name.  Accept space and tab only in the latter.
879b66d1acbSmrgam_lf='
880b66d1acbSmrg'
881b66d1acbSmrgcase `pwd` in
882b66d1acbSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
883b66d1acbSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
884b66d1acbSmrgesac
885b66d1acbSmrgcase $srcdir in
886b66d1acbSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
887df58931aSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
888b66d1acbSmrgesac
889b66d1acbSmrg
890df58931aSmrg# Do 'set' in a subshell so we don't clobber the current shell's
891b66d1acbSmrg# arguments.  Must try -L first in case configure is actually a
892b66d1acbSmrg# symlink; some systems play weird games with the mod time of symlinks
893b66d1acbSmrg# (eg FreeBSD returns the mod time of the symlink's containing
894b66d1acbSmrg# directory).
895b66d1acbSmrgif (
896df58931aSmrg   am_has_slept=no
897df58931aSmrg   for am_try in 1 2; do
898df58931aSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
899df58931aSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
900df58931aSmrg     if test "$[*]" = "X"; then
901df58931aSmrg	# -L didn't work.
902df58931aSmrg	set X `ls -t "$srcdir/configure" conftest.file`
903df58931aSmrg     fi
904df58931aSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
905df58931aSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
906df58931aSmrg
907df58931aSmrg	# If neither matched, then we have a broken ls.  This can happen
908df58931aSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
909df58931aSmrg	# broken ls alias from the environment.  This has actually
910df58931aSmrg	# happened.  Such a system could not be considered "sane".
911df58931aSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
912df58931aSmrg  alias in your environment])
913df58931aSmrg     fi
914df58931aSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
915df58931aSmrg       break
916df58931aSmrg     fi
917df58931aSmrg     # Just in case.
918df58931aSmrg     sleep 1
919df58931aSmrg     am_has_slept=yes
920df58931aSmrg   done
921b66d1acbSmrg   test "$[2]" = conftest.file
922b66d1acbSmrg   )
923b66d1acbSmrgthen
924b66d1acbSmrg   # Ok.
925b66d1acbSmrg   :
926b66d1acbSmrgelse
927b66d1acbSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
928b66d1acbSmrgCheck your system clock])
929b66d1acbSmrgfi
930df58931aSmrgAC_MSG_RESULT([yes])
931df58931aSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
932df58931aSmrg# generated files are strictly newer.
933df58931aSmrgam_sleep_pid=
934df58931aSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
935df58931aSmrg  ( sleep 1 ) &
936df58931aSmrg  am_sleep_pid=$!
937df58931aSmrgfi
938df58931aSmrgAC_CONFIG_COMMANDS_PRE(
939df58931aSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
940df58931aSmrg   if test -n "$am_sleep_pid"; then
941df58931aSmrg     # Hide warnings about reused PIDs.
942df58931aSmrg     wait $am_sleep_pid 2>/dev/null
943df58931aSmrg   fi
944df58931aSmrg   AC_MSG_RESULT([done])])
945df58931aSmrgrm -f conftest.file
946df58931aSmrg])
947b66d1acbSmrg
948df58931aSmrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
9494fb28925Smrg#
950b66d1acbSmrg# This file is free software; the Free Software Foundation
951b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
952b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
953b66d1acbSmrg
954b66d1acbSmrg# AM_SILENT_RULES([DEFAULT])
955b66d1acbSmrg# --------------------------
956b66d1acbSmrg# Enable less verbose build rules; with the default set to DEFAULT
957df58931aSmrg# ("yes" being less verbose, "no" or empty being verbose).
958b66d1acbSmrgAC_DEFUN([AM_SILENT_RULES],
959df58931aSmrg[AC_ARG_ENABLE([silent-rules], [dnl
960df58931aSmrgAS_HELP_STRING(
961df58931aSmrg  [--enable-silent-rules],
962df58931aSmrg  [less verbose build output (undo: "make V=1")])
963df58931aSmrgAS_HELP_STRING(
964df58931aSmrg  [--disable-silent-rules],
965df58931aSmrg  [verbose build output (undo: "make V=0")])dnl
966df58931aSmrg])
967df58931aSmrgcase $enable_silent_rules in @%:@ (((
968df58931aSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
969df58931aSmrg   no) AM_DEFAULT_VERBOSITY=1;;
970df58931aSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
971b66d1acbSmrgesac
972df58931aSmrgdnl
973df58931aSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
974df58931aSmrgdnl do not support nested variable expansions.
975df58931aSmrgdnl See automake bug#9928 and bug#10237.
976df58931aSmrgam_make=${MAKE-make}
977df58931aSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
978df58931aSmrg   [am_cv_make_support_nested_variables],
979df58931aSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
980df58931aSmrgBAR0=false
981df58931aSmrgBAR1=true
982df58931aSmrgV=1
983df58931aSmrgam__doit:
984df58931aSmrg	@$(TRUE)
985df58931aSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
986df58931aSmrg  am_cv_make_support_nested_variables=yes
987df58931aSmrgelse
988df58931aSmrg  am_cv_make_support_nested_variables=no
989df58931aSmrgfi])
990df58931aSmrgif test $am_cv_make_support_nested_variables = yes; then
991df58931aSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
992df58931aSmrg  AM_V='$(V)'
993df58931aSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
994df58931aSmrgelse
995df58931aSmrg  AM_V=$AM_DEFAULT_VERBOSITY
996df58931aSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
997df58931aSmrgfi
998df58931aSmrgAC_SUBST([AM_V])dnl
999df58931aSmrgAM_SUBST_NOTMAKE([AM_V])dnl
1000df58931aSmrgAC_SUBST([AM_DEFAULT_V])dnl
1001df58931aSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1002b66d1acbSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1003b66d1acbSmrgAM_BACKSLASH='\'
1004b66d1acbSmrgAC_SUBST([AM_BACKSLASH])dnl
1005b66d1acbSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1006b66d1acbSmrg])
1007b66d1acbSmrg
1008df58931aSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
10094fb28925Smrg#
1010b66d1acbSmrg# This file is free software; the Free Software Foundation
1011b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
1012b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
10134fb28925Smrg
1014b66d1acbSmrg# AM_PROG_INSTALL_STRIP
1015b66d1acbSmrg# ---------------------
1016df58931aSmrg# One issue with vendor 'install' (even GNU) is that you can't
1017b66d1acbSmrg# specify the program used to strip binaries.  This is especially
1018b66d1acbSmrg# annoying in cross-compiling environments, where the build's strip
1019b66d1acbSmrg# is unlikely to handle the host's binaries.
1020b66d1acbSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1021df58931aSmrg# always use install-sh in "make install-strip", and initialize
1022b66d1acbSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
1023b66d1acbSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1024b66d1acbSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1025df58931aSmrg# Installed binaries are usually stripped using 'strip' when the user
1026df58931aSmrg# run "make install-strip".  However 'strip' might not be the right
1027b66d1acbSmrg# tool to use in cross-compilation environments, therefore Automake
1028df58931aSmrg# will honor the 'STRIP' environment variable to overrule this program.
1029df58931aSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1030b66d1acbSmrgif test "$cross_compiling" != no; then
1031b66d1acbSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
1032b66d1acbSmrgfi
1033b66d1acbSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1034b66d1acbSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10354fb28925Smrg
1036df58931aSmrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1037b66d1acbSmrg#
1038b66d1acbSmrg# This file is free software; the Free Software Foundation
1039b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
1040b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
10414fb28925Smrg
1042b66d1acbSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1043b66d1acbSmrg# ---------------------------
1044b66d1acbSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1045b66d1acbSmrg# This macro is traced by Automake.
1046b66d1acbSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10474fb28925Smrg
1048b66d1acbSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1049df58931aSmrg# --------------------------
1050b66d1acbSmrg# Public sister of _AM_SUBST_NOTMAKE.
1051b66d1acbSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10524fb28925Smrg
1053b66d1acbSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10544fb28925Smrg
1055df58931aSmrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
1056b66d1acbSmrg#
1057b66d1acbSmrg# This file is free software; the Free Software Foundation
1058b66d1acbSmrg# gives unlimited permission to copy and/or distribute it,
1059b66d1acbSmrg# with or without modifications, as long as this notice is preserved.
10604fb28925Smrg
1061b66d1acbSmrg# _AM_PROG_TAR(FORMAT)
1062b66d1acbSmrg# --------------------
1063b66d1acbSmrg# Check how to create a tarball in format FORMAT.
1064df58931aSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1065b66d1acbSmrg#
1066b66d1acbSmrg# Substitute a variable $(am__tar) that is a command
1067b66d1acbSmrg# writing to stdout a FORMAT-tarball containing the directory
1068b66d1acbSmrg# $tardir.
1069b66d1acbSmrg#     tardir=directory && $(am__tar) > result.tar
1070b66d1acbSmrg#
1071b66d1acbSmrg# Substitute a variable $(am__untar) that extract such
1072b66d1acbSmrg# a tarball read from stdin.
1073b66d1acbSmrg#     $(am__untar) < result.tar
1074df58931aSmrg#
1075b66d1acbSmrgAC_DEFUN([_AM_PROG_TAR],
1076df58931aSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1077df58931aSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1078df58931aSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1079df58931aSmrg
1080df58931aSmrg# We'll loop over all known methods to create a tar archive until one works.
1081b66d1acbSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10824fb28925Smrg
1083df58931aSmrgm4_if([$1], [v7],
1084df58931aSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1085df58931aSmrg
1086df58931aSmrg  [m4_case([$1],
1087df58931aSmrg    [ustar],
1088df58931aSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1089df58931aSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1090df58931aSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1091df58931aSmrg      # and bug#13588).
1092df58931aSmrg      am_max_uid=2097151 # 2^21 - 1
1093df58931aSmrg      am_max_gid=$am_max_uid
1094df58931aSmrg      # The $UID and $GID variables are not portable, so we need to resort
1095df58931aSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1096df58931aSmrg      # below are definitely unexpected, so allow the users to see them
1097df58931aSmrg      # (that is, avoid stderr redirection).
1098df58931aSmrg      am_uid=`id -u || echo unknown`
1099df58931aSmrg      am_gid=`id -g || echo unknown`
1100df58931aSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1101df58931aSmrg      if test $am_uid -le $am_max_uid; then
1102df58931aSmrg         AC_MSG_RESULT([yes])
1103df58931aSmrg      else
1104df58931aSmrg         AC_MSG_RESULT([no])
1105df58931aSmrg         _am_tools=none
1106df58931aSmrg      fi
1107df58931aSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1108df58931aSmrg      if test $am_gid -le $am_max_gid; then
1109df58931aSmrg         AC_MSG_RESULT([yes])
1110df58931aSmrg      else
1111df58931aSmrg        AC_MSG_RESULT([no])
1112df58931aSmrg        _am_tools=none
1113df58931aSmrg      fi],
1114df58931aSmrg
1115df58931aSmrg  [pax],
1116df58931aSmrg    [],
1117df58931aSmrg
1118df58931aSmrg  [m4_fatal([Unknown tar format])])
1119df58931aSmrg
1120df58931aSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1121df58931aSmrg
1122df58931aSmrg  # Go ahead even if we have the value already cached.  We do so because we
1123df58931aSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1124df58931aSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1125df58931aSmrg
1126df58931aSmrg  for _am_tool in $_am_tools; do
1127df58931aSmrg    case $_am_tool in
1128df58931aSmrg    gnutar)
1129df58931aSmrg      for _am_tar in tar gnutar gtar; do
1130df58931aSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1131df58931aSmrg      done
1132df58931aSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1133df58931aSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1134df58931aSmrg      am__untar="$_am_tar -xf -"
1135df58931aSmrg      ;;
1136df58931aSmrg    plaintar)
1137df58931aSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1138df58931aSmrg      # ustar tarball either.
1139df58931aSmrg      (tar --version) >/dev/null 2>&1 && continue
1140df58931aSmrg      am__tar='tar chf - "$$tardir"'
1141df58931aSmrg      am__tar_='tar chf - "$tardir"'
1142df58931aSmrg      am__untar='tar xf -'
1143df58931aSmrg      ;;
1144df58931aSmrg    pax)
1145df58931aSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1146df58931aSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1147df58931aSmrg      am__untar='pax -r'
1148df58931aSmrg      ;;
1149df58931aSmrg    cpio)
1150df58931aSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1151df58931aSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1152df58931aSmrg      am__untar='cpio -i -H $1 -d'
1153df58931aSmrg      ;;
1154df58931aSmrg    none)
1155df58931aSmrg      am__tar=false
1156df58931aSmrg      am__tar_=false
1157df58931aSmrg      am__untar=false
1158df58931aSmrg      ;;
1159df58931aSmrg    esac
1160b66d1acbSmrg
1161df58931aSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1162df58931aSmrg    # and am__untar set.
1163df58931aSmrg    test -n "${am_cv_prog_tar_$1}" && break
1164df58931aSmrg
1165df58931aSmrg    # tar/untar a dummy directory, and stop if the command works.
1166df58931aSmrg    rm -rf conftest.dir
1167df58931aSmrg    mkdir conftest.dir
1168df58931aSmrg    echo GrepMe > conftest.dir/file
1169df58931aSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1170df58931aSmrg    rm -rf conftest.dir
1171df58931aSmrg    if test -s conftest.tar; then
1172df58931aSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1173df58931aSmrg      AM_RUN_LOG([cat conftest.dir/file])
1174df58931aSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1175df58931aSmrg    fi
1176df58931aSmrg  done
1177b66d1acbSmrg  rm -rf conftest.dir
11784fb28925Smrg
1179df58931aSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1180df58931aSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1181df58931aSmrg
1182b66d1acbSmrgAC_SUBST([am__tar])
1183b66d1acbSmrgAC_SUBST([am__untar])
1184b66d1acbSmrg]) # _AM_PROG_TAR
1185b66d1acbSmrg
1186df58931aSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1187df58931aSmrg# 
1188df58931aSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1189b66d1acbSmrg#
1190df58931aSmrg# This program is free software; you can redistribute it and/or modify
1191df58931aSmrg# it under the terms of the GNU General Public License as published by
1192df58931aSmrg# the Free Software Foundation; either version 2 of the License, or
1193df58931aSmrg# (at your option) any later version.
1194b66d1acbSmrg#
1195df58931aSmrg# This program is distributed in the hope that it will be useful, but
1196df58931aSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1197df58931aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1198df58931aSmrg# General Public License for more details.
1199b66d1acbSmrg#
1200df58931aSmrg# You should have received a copy of the GNU General Public License
1201df58931aSmrg# along with this program; if not, write to the Free Software
1202df58931aSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1203b66d1acbSmrg#
1204df58931aSmrg# As a special exception to the GNU General Public License, if you
1205df58931aSmrg# distribute this file as part of a program that contains a
1206df58931aSmrg# configuration script generated by Autoconf, you may include it under
1207df58931aSmrg# the same distribution terms that you use for the rest of that program.
12084fb28925Smrg
1209df58931aSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1210df58931aSmrg# ----------------------------------
1211df58931aSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1212df58931aSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1213df58931aSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1214df58931aSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1215df58931aSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1216df58931aSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12174fb28925Smrgfi
1218df58931aSmrgif test -n "$PKG_CONFIG"; then
1219df58931aSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1220df58931aSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1221df58931aSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12224fb28925Smrg		AC_MSG_RESULT([yes])
12234fb28925Smrg	else
1224df58931aSmrg		AC_MSG_RESULT([no])
1225df58931aSmrg		PKG_CONFIG=""
12264fb28925Smrg	fi
1227df58931aSmrg		
1228df58931aSmrgfi[]dnl
1229df58931aSmrg])# PKG_PROG_PKG_CONFIG
12304fb28925Smrg
1231df58931aSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232b66d1acbSmrg#
1233df58931aSmrg# Check to see whether a particular set of modules exists.  Similar
1234df58931aSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1235df58931aSmrg#
1236df58931aSmrg#
1237df58931aSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1238df58931aSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1239df58931aSmrg# PKG_CHECK_EXISTS manually
1240df58931aSmrg# --------------------------------------------------------------
1241df58931aSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1242df58931aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1243df58931aSmrgif test -n "$PKG_CONFIG" && \
1244df58931aSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1245df58931aSmrg  m4_ifval([$2], [$2], [:])
1246df58931aSmrgm4_ifvaln([$3], [else
1247df58931aSmrg  $3])dnl
1248df58931aSmrgfi])
12494fb28925Smrg
12504fb28925Smrg
1251df58931aSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252df58931aSmrg# ---------------------------------------------
1253df58931aSmrgm4_define([_PKG_CONFIG],
1254df58931aSmrg[if test -n "$$1"; then
1255df58931aSmrg    pkg_cv_[]$1="$$1"
1256df58931aSmrg elif test -n "$PKG_CONFIG"; then
1257df58931aSmrg    PKG_CHECK_EXISTS([$3],
1258df58931aSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1259df58931aSmrg		     [pkg_failed=yes])
1260df58931aSmrg else
1261df58931aSmrg    pkg_failed=untried
1262df58931aSmrgfi[]dnl
1263df58931aSmrg])# _PKG_CONFIG
1264df58931aSmrg
1265df58931aSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1266df58931aSmrg# -----------------------------
1267df58931aSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1268df58931aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1269df58931aSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1270df58931aSmrg        _pkg_short_errors_supported=yes
1271df58931aSmrgelse
1272df58931aSmrg        _pkg_short_errors_supported=no
1273df58931aSmrgfi[]dnl
1274df58931aSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1275df58931aSmrg
1276df58931aSmrg
1277df58931aSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1278df58931aSmrg# [ACTION-IF-NOT-FOUND])
1279df58931aSmrg#
1280df58931aSmrg#
1281df58931aSmrg# Note that if there is a possibility the first call to
1282df58931aSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1283df58931aSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1284df58931aSmrg#
1285df58931aSmrg#
1286df58931aSmrg# --------------------------------------------------------------
1287df58931aSmrgAC_DEFUN([PKG_CHECK_MODULES],
1288df58931aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1289df58931aSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1290df58931aSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1291df58931aSmrg
1292df58931aSmrgpkg_failed=no
1293df58931aSmrgAC_MSG_CHECKING([for $1])
1294df58931aSmrg
1295df58931aSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1296df58931aSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1297df58931aSmrg
1298df58931aSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1299df58931aSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1300df58931aSmrgSee the pkg-config man page for more details.])
1301df58931aSmrg
1302df58931aSmrgif test $pkg_failed = yes; then
1303df58931aSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1304df58931aSmrg        if test $_pkg_short_errors_supported = yes; then
1305df58931aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1306df58931aSmrg        else 
1307df58931aSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1308df58931aSmrg        fi
1309df58931aSmrg	# Put the nasty error message in config.log where it belongs
1310df58931aSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1311df58931aSmrg
1312df58931aSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1313df58931aSmrg[Package requirements ($2) were not met:
1314df58931aSmrg
1315df58931aSmrg$$1_PKG_ERRORS
1316df58931aSmrg
1317df58931aSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1318df58931aSmrginstalled software in a non-standard prefix.
1319df58931aSmrg
1320df58931aSmrg_PKG_TEXT
1321df58931aSmrg])],
1322df58931aSmrg		[AC_MSG_RESULT([no])
1323df58931aSmrg                $4])
1324df58931aSmrgelif test $pkg_failed = untried; then
1325df58931aSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1326df58931aSmrg[The pkg-config script could not be found or is too old.  Make sure it
1327df58931aSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1328df58931aSmrgpath to pkg-config.
1329df58931aSmrg
1330df58931aSmrg_PKG_TEXT
1331df58931aSmrg
1332df58931aSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1333df58931aSmrg		[$4])
1334df58931aSmrgelse
1335df58931aSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1336df58931aSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1337df58931aSmrg        AC_MSG_RESULT([yes])
1338df58931aSmrg	ifelse([$3], , :, [$3])
1339df58931aSmrgfi[]dnl
1340df58931aSmrg])# PKG_CHECK_MODULES
1341df58931aSmrg
1342df58931aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1343df58931aSmrgdnl
1344df58931aSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1345df58931aSmrgdnl
1346df58931aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1347df58931aSmrgdnl copy of this software and associated documentation files (the "Software"),
1348df58931aSmrgdnl to deal in the Software without restriction, including without limitation
1349df58931aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1350df58931aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1351df58931aSmrgdnl Software is furnished to do so, subject to the following conditions:
1352df58931aSmrgdnl
1353df58931aSmrgdnl The above copyright notice and this permission notice (including the next
1354df58931aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1355df58931aSmrgdnl Software.
1356df58931aSmrgdnl
1357df58931aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1358df58931aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1359df58931aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1360df58931aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1361df58931aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1362df58931aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1363df58931aSmrgdnl DEALINGS IN THE SOFTWARE.
1364df58931aSmrg
1365df58931aSmrg# XORG_MACROS_VERSION(required-version)
1366df58931aSmrg# -------------------------------------
1367df58931aSmrg# Minimum version: 1.1.0
1368df58931aSmrg#
1369df58931aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1370df58931aSmrg# your configure.ac with the minimum required version, such as:
1371df58931aSmrg# XORG_MACROS_VERSION(1.1)
1372df58931aSmrg#
1373df58931aSmrg# To ensure that this macro is defined, also add:
1374df58931aSmrg# m4_ifndef([XORG_MACROS_VERSION],
1375df58931aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1376df58931aSmrg#
1377df58931aSmrg#
1378df58931aSmrg# See the "minimum version" comment for each macro you use to see what
1379df58931aSmrg# version you require.
1380df58931aSmrgm4_defun([XORG_MACROS_VERSION],[
1381df58931aSmrgm4_define([vers_have], [1.17.1])
1382df58931aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1383df58931aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1384df58931aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1385df58931aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1386df58931aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1387df58931aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1388df58931aSmrgm4_undefine([vers_have])
1389df58931aSmrgm4_undefine([maj_have])
1390df58931aSmrgm4_undefine([maj_needed])
1391df58931aSmrg]) # XORG_MACROS_VERSION
1392df58931aSmrg
1393df58931aSmrg# XORG_PROG_RAWCPP()
1394df58931aSmrg# ------------------
1395df58931aSmrg# Minimum version: 1.0.0
1396df58931aSmrg#
1397df58931aSmrg# Find cpp program and necessary flags for use in pre-processing text files
1398df58931aSmrg# such as man pages and config files
1399df58931aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1400df58931aSmrgAC_REQUIRE([AC_PROG_CPP])
1401df58931aSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
1402df58931aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1403df58931aSmrg
1404df58931aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1405df58931aSmrg# which is not the best choice for supporting other OS'es, but covers most
1406df58931aSmrg# of the ones we need for now.
1407df58931aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1408df58931aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1409df58931aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1410df58931aSmrg	AC_MSG_RESULT([no])
1411df58931aSmrgelse
1412df58931aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1413df58931aSmrg		RAWCPPFLAGS=-undef
1414df58931aSmrg		AC_MSG_RESULT([yes])
1415df58931aSmrg	# under Cygwin unix is still defined even with -undef
1416df58931aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1417df58931aSmrg		RAWCPPFLAGS="-undef -ansi"
1418df58931aSmrg		AC_MSG_RESULT([yes, with -ansi])
1419df58931aSmrg	else
1420df58931aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1421df58931aSmrg	fi
1422df58931aSmrgfi
1423df58931aSmrgrm -f conftest.$ac_ext
1424df58931aSmrg
1425df58931aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1426df58931aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1427df58931aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1428df58931aSmrg	AC_MSG_RESULT([no])
1429df58931aSmrgelse
1430df58931aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1431df58931aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1432df58931aSmrg		AC_MSG_RESULT([yes])
1433df58931aSmrg	else
1434df58931aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1435df58931aSmrg	fi
1436df58931aSmrgfi
1437df58931aSmrgrm -f conftest.$ac_ext
1438df58931aSmrgAC_SUBST(RAWCPPFLAGS)
1439df58931aSmrg]) # XORG_PROG_RAWCPP
1440df58931aSmrg
1441df58931aSmrg# XORG_MANPAGE_SECTIONS()
1442df58931aSmrg# -----------------------
1443df58931aSmrg# Minimum version: 1.0.0
1444df58931aSmrg#
1445df58931aSmrg# Determine which sections man pages go in for the different man page types
1446df58931aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1447df58931aSmrg# Not sure if there's any better way than just hardcoding by OS name.
1448df58931aSmrg# Override default settings by setting environment variables
1449df58931aSmrg# Added MAN_SUBSTS in version 1.8
1450df58931aSmrg# Added AC_PROG_SED in version 1.8
1451df58931aSmrg
1452df58931aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1453df58931aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1454df58931aSmrgAC_REQUIRE([AC_PROG_SED])
1455df58931aSmrg
1456df58931aSmrgif test x$APP_MAN_SUFFIX = x    ; then
1457df58931aSmrg    APP_MAN_SUFFIX=1
1458df58931aSmrgfi
1459df58931aSmrgif test x$APP_MAN_DIR = x    ; then
1460df58931aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1461df58931aSmrgfi
1462df58931aSmrg
1463df58931aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1464df58931aSmrg    LIB_MAN_SUFFIX=3
1465df58931aSmrgfi
1466df58931aSmrgif test x$LIB_MAN_DIR = x    ; then
1467df58931aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1468df58931aSmrgfi
1469df58931aSmrg
1470df58931aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1471df58931aSmrg    case $host_os in
1472df58931aSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1473df58931aSmrg	*)		FILE_MAN_SUFFIX=5  ;;
14744fb28925Smrg    esac
14754fb28925Smrgfi
14764fb28925Smrgif test x$FILE_MAN_DIR = x    ; then
1477b66d1acbSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14784fb28925Smrgfi
14794fb28925Smrg
14804fb28925Smrgif test x$MISC_MAN_SUFFIX = x    ; then
14814fb28925Smrg    case $host_os in
14824fb28925Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14834fb28925Smrg	*)		MISC_MAN_SUFFIX=7  ;;
14844fb28925Smrg    esac
14854fb28925Smrgfi
14864fb28925Smrgif test x$MISC_MAN_DIR = x    ; then
1487b66d1acbSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14884fb28925Smrgfi
14894fb28925Smrg
14904fb28925Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14914fb28925Smrg    case $host_os in
14924fb28925Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14934fb28925Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14944fb28925Smrg    esac
14954fb28925Smrgfi
14964fb28925Smrgif test x$DRIVER_MAN_DIR = x    ; then
1497b66d1acbSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14984fb28925Smrgfi
14994fb28925Smrg
15004fb28925Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15014fb28925Smrg    case $host_os in
15024fb28925Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15034fb28925Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15044fb28925Smrg    esac
15054fb28925Smrgfi
15064fb28925Smrgif test x$ADMIN_MAN_DIR = x    ; then
15074fb28925Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15084fb28925Smrgfi
15094fb28925Smrg
15104fb28925Smrg
15114fb28925SmrgAC_SUBST([APP_MAN_SUFFIX])
15124fb28925SmrgAC_SUBST([LIB_MAN_SUFFIX])
15134fb28925SmrgAC_SUBST([FILE_MAN_SUFFIX])
15144fb28925SmrgAC_SUBST([MISC_MAN_SUFFIX])
15154fb28925SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15164fb28925SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15174fb28925SmrgAC_SUBST([APP_MAN_DIR])
15184fb28925SmrgAC_SUBST([LIB_MAN_DIR])
15194fb28925SmrgAC_SUBST([FILE_MAN_DIR])
15204fb28925SmrgAC_SUBST([MISC_MAN_DIR])
15214fb28925SmrgAC_SUBST([DRIVER_MAN_DIR])
15224fb28925SmrgAC_SUBST([ADMIN_MAN_DIR])
1523df58931aSmrg
1524df58931aSmrgXORG_MAN_PAGE="X Version 11"
1525df58931aSmrgAC_SUBST([XORG_MAN_PAGE])
1526df58931aSmrgMAN_SUBSTS="\
1527df58931aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1528df58931aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1529df58931aSmrg	-e 's|__xservername__|Xorg|g' \
1530df58931aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1531df58931aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1532df58931aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1533df58931aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1534df58931aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1535df58931aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1536df58931aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1537df58931aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1538df58931aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1539df58931aSmrgAC_SUBST([MAN_SUBSTS])
1540df58931aSmrg
15414fb28925Smrg]) # XORG_MANPAGE_SECTIONS
15424fb28925Smrg
1543df58931aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1544df58931aSmrg# ------------------------
1545df58931aSmrg# Minimum version: 1.7.0
1546df58931aSmrg#
1547df58931aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1548df58931aSmrg# provided by xorg-sgml-doctools, if installed.
1549df58931aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1550df58931aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1551df58931aSmrgXORG_SGML_PATH=
1552df58931aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1553df58931aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1554df58931aSmrg    [m4_ifval([$1],[:],
1555df58931aSmrg        [if test x"$cross_compiling" != x"yes" ; then
1556df58931aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1557df58931aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1558df58931aSmrg         fi])
1559df58931aSmrg    ])
1560df58931aSmrg
1561df58931aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1562df58931aSmrg# the path and the name of the doc stylesheet
1563df58931aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1564df58931aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1565df58931aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1566df58931aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1567df58931aSmrgelse
1568df58931aSmrg   AC_MSG_RESULT([no])
1569df58931aSmrgfi
1570df58931aSmrg
1571df58931aSmrgAC_SUBST(XORG_SGML_PATH)
1572df58931aSmrgAC_SUBST(STYLESHEET_SRCDIR)
1573df58931aSmrgAC_SUBST(XSL_STYLESHEET)
1574df58931aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1575df58931aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1576df58931aSmrg
15774fb28925Smrg# XORG_CHECK_LINUXDOC
15784fb28925Smrg# -------------------
1579b66d1acbSmrg# Minimum version: 1.0.0
1580b66d1acbSmrg#
15814fb28925Smrg# Defines the variable MAKE_TEXT if the necessary tools and
15824fb28925Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15834fb28925Smrg# Whether or not the necessary tools and files are found can be checked
15844fb28925Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15854fb28925SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1586df58931aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1587df58931aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
15884fb28925Smrg
15894fb28925SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
15904fb28925Smrg
1591df58931aSmrgAC_MSG_CHECKING([whether to build documentation])
15924fb28925Smrg
1593df58931aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15944fb28925Smrg   BUILDDOC=yes
15954fb28925Smrgelse
15964fb28925Smrg   BUILDDOC=no
15974fb28925Smrgfi
15984fb28925Smrg
15994fb28925SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16004fb28925Smrg
16014fb28925SmrgAC_MSG_RESULT([$BUILDDOC])
16024fb28925Smrg
1603df58931aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
16044fb28925Smrg
1605df58931aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16064fb28925Smrg   BUILDPDFDOC=yes
16074fb28925Smrgelse
16084fb28925Smrg   BUILDPDFDOC=no
16094fb28925Smrgfi
16104fb28925Smrg
16114fb28925SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16124fb28925Smrg
16134fb28925SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16144fb28925Smrg
1615df58931aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1616b66d1acbSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16174fb28925SmrgMAKE_PDF="$PS2PDF"
1618b66d1acbSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
16194fb28925Smrg
16204fb28925SmrgAC_SUBST(MAKE_TEXT)
16214fb28925SmrgAC_SUBST(MAKE_PS)
16224fb28925SmrgAC_SUBST(MAKE_PDF)
16234fb28925SmrgAC_SUBST(MAKE_HTML)
16244fb28925Smrg]) # XORG_CHECK_LINUXDOC
16254fb28925Smrg
1626b66d1acbSmrg# XORG_CHECK_DOCBOOK
1627b66d1acbSmrg# -------------------
1628b66d1acbSmrg# Minimum version: 1.0.0
1629b66d1acbSmrg#
1630b66d1acbSmrg# Checks for the ability to build output formats from SGML DocBook source.
1631b66d1acbSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1632b66d1acbSmrg# indicates whether the necessary tools and files are found and, if set,
1633b66d1acbSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1634b66d1acbSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1635df58931aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1636df58931aSmrg
1637b66d1acbSmrgBUILDTXTDOC=no
1638b66d1acbSmrgBUILDPDFDOC=no
1639b66d1acbSmrgBUILDPSDOC=no
1640b66d1acbSmrgBUILDHTMLDOC=no
1641b66d1acbSmrg
1642b66d1acbSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1643b66d1acbSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1644b66d1acbSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1645b66d1acbSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1646b66d1acbSmrg
1647df58931aSmrgAC_MSG_CHECKING([whether to build text documentation])
1648df58931aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1649b66d1acbSmrg   test x$BUILD_TXTDOC != xno; then
1650b66d1acbSmrg	BUILDTXTDOC=yes
1651b66d1acbSmrgfi
1652b66d1acbSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1653b66d1acbSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1654b66d1acbSmrg
1655df58931aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1656df58931aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1657b66d1acbSmrg   test x$BUILD_PDFDOC != xno; then
1658b66d1acbSmrg	BUILDPDFDOC=yes
1659b66d1acbSmrgfi
1660b66d1acbSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1661b66d1acbSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1662b66d1acbSmrg
1663df58931aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1664df58931aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1665df58931aSmrg   test x$BUILD_PSDOC != xno; then
1666df58931aSmrg	BUILDPSDOC=yes
1667df58931aSmrgfi
1668df58931aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1669df58931aSmrgAC_MSG_RESULT([$BUILDPSDOC])
1670df58931aSmrg
1671df58931aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1672df58931aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1673df58931aSmrg   test x$BUILD_HTMLDOC != xno; then
1674df58931aSmrg	BUILDHTMLDOC=yes
1675df58931aSmrgfi
1676df58931aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1677df58931aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1678df58931aSmrg
1679df58931aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1680df58931aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1681df58931aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1682df58931aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1683df58931aSmrg
1684df58931aSmrgAC_SUBST(MAKE_TEXT)
1685df58931aSmrgAC_SUBST(MAKE_PS)
1686df58931aSmrgAC_SUBST(MAKE_PDF)
1687df58931aSmrgAC_SUBST(MAKE_HTML)
1688df58931aSmrg]) # XORG_CHECK_DOCBOOK
1689df58931aSmrg
1690df58931aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1691df58931aSmrg# ----------------
1692df58931aSmrg# Minimum version: 1.5.0
1693df58931aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1694df58931aSmrg#
1695df58931aSmrg# Documentation tools are not always available on all platforms and sometimes
1696df58931aSmrg# not at the appropriate level. This macro enables a module to test for the
1697df58931aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1698df58931aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1699df58931aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1700df58931aSmrg# --with-xmlto assumes 'auto'.
1701df58931aSmrg#
1702df58931aSmrg# Interface to module:
1703df58931aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1704df58931aSmrg# XMLTO:	returns the path of the xmlto program found
1705df58931aSmrg#		returns the path set by the user in the environment
1706df58931aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1707df58931aSmrg#		'no' user instructs the module not to use xmlto
1708df58931aSmrg#
1709df58931aSmrg# Added in version 1.10.0
1710df58931aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1711df58931aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1712df58931aSmrg#
1713df58931aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1714df58931aSmrg#
1715df58931aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1716df58931aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1717df58931aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1718df58931aSmrgAC_ARG_WITH(xmlto,
1719df58931aSmrg	AS_HELP_STRING([--with-xmlto],
1720df58931aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1721df58931aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1722df58931aSmrgm4_undefine([_defopt])
1723df58931aSmrg
1724df58931aSmrgif test "x$use_xmlto" = x"auto"; then
1725df58931aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1726df58931aSmrg   if test "x$XMLTO" = "x"; then
1727df58931aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1728df58931aSmrg	have_xmlto=no
1729df58931aSmrg   else
1730df58931aSmrg        have_xmlto=yes
1731df58931aSmrg   fi
1732df58931aSmrgelif test "x$use_xmlto" = x"yes" ; then
1733df58931aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1734df58931aSmrg   if test "x$XMLTO" = "x"; then
1735df58931aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1736df58931aSmrg   fi
1737df58931aSmrg   have_xmlto=yes
1738df58931aSmrgelif test "x$use_xmlto" = x"no" ; then
1739df58931aSmrg   if test "x$XMLTO" != "x"; then
1740df58931aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1741df58931aSmrg   fi
1742df58931aSmrg   have_xmlto=no
1743df58931aSmrgelse
1744df58931aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1745df58931aSmrgfi
1746df58931aSmrg
1747df58931aSmrg# Test for a minimum version of xmlto, if provided.
1748df58931aSmrgm4_ifval([$1],
1749df58931aSmrg[if test "$have_xmlto" = yes; then
1750df58931aSmrg    # scrape the xmlto version
1751df58931aSmrg    AC_MSG_CHECKING([the xmlto version])
1752df58931aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1753df58931aSmrg    AC_MSG_RESULT([$xmlto_version])
1754df58931aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1755df58931aSmrg        [if test "x$use_xmlto" = xauto; then
1756df58931aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1757df58931aSmrg            have_xmlto=no
1758df58931aSmrg        else
1759df58931aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1760df58931aSmrg        fi])
1761df58931aSmrgfi])
1762df58931aSmrg
1763df58931aSmrg# Test for the ability of xmlto to generate a text target
1764df58931aSmrghave_xmlto_text=no
1765df58931aSmrgcat > conftest.xml << "EOF"
1766df58931aSmrgEOF
1767df58931aSmrgAS_IF([test "$have_xmlto" = yes],
1768df58931aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1769df58931aSmrg             [have_xmlto_text=yes],
1770df58931aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1771df58931aSmrgrm -f conftest.xml
1772df58931aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1773df58931aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1774df58931aSmrg]) # XORG_WITH_XMLTO
1775df58931aSmrg
1776df58931aSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1777df58931aSmrg# --------------------------------------------
1778df58931aSmrg# Minimum version: 1.12.0
1779df58931aSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1780df58931aSmrg#
1781df58931aSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1782df58931aSmrg# XML-based language used for the transformation of XML documents.
1783df58931aSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1784df58931aSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1785df58931aSmrg# The XSLT processor is often used as a standalone tool for transformations.
1786df58931aSmrg# It should not be assumed that this tool is used only to work with documnetation.
1787df58931aSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1788df58931aSmrg#
1789df58931aSmrg# Interface to module:
1790df58931aSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1791df58931aSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1792df58931aSmrg#		 returns the path set by the user in the environment
1793df58931aSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1794df58931aSmrg#		  'no' user instructs the module not to use xsltproc
1795df58931aSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1796df58931aSmrg#
1797df58931aSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1798df58931aSmrg#
1799df58931aSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1800df58931aSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1801df58931aSmrg# Preserves the interface, should it be implemented later
1802df58931aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1803df58931aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1804df58931aSmrgAC_ARG_WITH(xsltproc,
1805df58931aSmrg	AS_HELP_STRING([--with-xsltproc],
1806df58931aSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1807df58931aSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1808df58931aSmrgm4_undefine([_defopt])
1809df58931aSmrg
1810df58931aSmrgif test "x$use_xsltproc" = x"auto"; then
1811df58931aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1812df58931aSmrg   if test "x$XSLTPROC" = "x"; then
1813df58931aSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1814df58931aSmrg	have_xsltproc=no
1815df58931aSmrg   else
1816df58931aSmrg        have_xsltproc=yes
1817df58931aSmrg   fi
1818df58931aSmrgelif test "x$use_xsltproc" = x"yes" ; then
1819df58931aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1820df58931aSmrg   if test "x$XSLTPROC" = "x"; then
1821df58931aSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1822df58931aSmrg   fi
1823df58931aSmrg   have_xsltproc=yes
1824df58931aSmrgelif test "x$use_xsltproc" = x"no" ; then
1825df58931aSmrg   if test "x$XSLTPROC" != "x"; then
1826df58931aSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1827df58931aSmrg   fi
1828df58931aSmrg   have_xsltproc=no
1829df58931aSmrgelse
1830df58931aSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1831df58931aSmrgfi
1832df58931aSmrg
1833df58931aSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1834df58931aSmrg]) # XORG_WITH_XSLTPROC
1835df58931aSmrg
1836df58931aSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1837df58931aSmrg# ----------------------------------------
1838df58931aSmrg# Minimum version: 1.15.0
1839df58931aSmrg#
1840df58931aSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1841df58931aSmrg# scanning arbitrary text files, extracting information from those text files,
1842df58931aSmrg# and printing reports based on that information.
1843df58931aSmrg#
1844df58931aSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1845df58931aSmrg#
1846df58931aSmrg# Interface to module:
1847df58931aSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1848df58931aSmrg# PERL:	     returns the path of the perl program found
1849df58931aSmrg#	     returns the path set by the user in the environment
1850df58931aSmrg# --with-perl: 'yes' user instructs the module to use perl
1851df58931aSmrg#	       'no' user instructs the module not to use perl
1852df58931aSmrg# have_perl: returns yes if perl found in PATH or no
1853df58931aSmrg#
1854df58931aSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1855df58931aSmrg#
1856df58931aSmrgAC_DEFUN([XORG_WITH_PERL],[
1857df58931aSmrgAC_ARG_VAR([PERL], [Path to perl command])
1858df58931aSmrg# Preserves the interface, should it be implemented later
1859df58931aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1860df58931aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1861df58931aSmrgAC_ARG_WITH(perl,
1862df58931aSmrg	AS_HELP_STRING([--with-perl],
1863df58931aSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1864df58931aSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1865df58931aSmrgm4_undefine([_defopt])
1866df58931aSmrg
1867df58931aSmrgif test "x$use_perl" = x"auto"; then
1868df58931aSmrg   AC_PATH_PROG([PERL], [perl])
1869df58931aSmrg   if test "x$PERL" = "x"; then
1870df58931aSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1871df58931aSmrg	have_perl=no
1872df58931aSmrg   else
1873df58931aSmrg        have_perl=yes
1874df58931aSmrg   fi
1875df58931aSmrgelif test "x$use_perl" = x"yes" ; then
1876df58931aSmrg   AC_PATH_PROG([PERL], [perl])
1877df58931aSmrg   if test "x$PERL" = "x"; then
1878df58931aSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1879df58931aSmrg   fi
1880df58931aSmrg   have_perl=yes
1881df58931aSmrgelif test "x$use_perl" = x"no" ; then
1882df58931aSmrg   if test "x$PERL" != "x"; then
1883df58931aSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1884df58931aSmrg   fi
1885df58931aSmrg   have_perl=no
1886df58931aSmrgelse
1887df58931aSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1888df58931aSmrgfi
1889df58931aSmrg
1890df58931aSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1891df58931aSmrg]) # XORG_WITH_PERL
1892df58931aSmrg
1893df58931aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1894df58931aSmrg# ----------------
1895df58931aSmrg# Minimum version: 1.5.0
1896df58931aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1897df58931aSmrg#
1898df58931aSmrg# Documentation tools are not always available on all platforms and sometimes
1899df58931aSmrg# not at the appropriate level. This macro enables a module to test for the
1900df58931aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1901df58931aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1902df58931aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1903df58931aSmrg# --with-asciidoc assumes 'auto'.
1904df58931aSmrg#
1905df58931aSmrg# Interface to module:
1906df58931aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1907df58931aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1908df58931aSmrg#		 returns the path set by the user in the environment
1909df58931aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1910df58931aSmrg#		  'no' user instructs the module not to use asciidoc
1911df58931aSmrg#
1912df58931aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1913df58931aSmrg#
1914df58931aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1915df58931aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1916df58931aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1917df58931aSmrgAC_ARG_WITH(asciidoc,
1918df58931aSmrg	AS_HELP_STRING([--with-asciidoc],
1919df58931aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1920df58931aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1921df58931aSmrgm4_undefine([_defopt])
1922df58931aSmrg
1923df58931aSmrgif test "x$use_asciidoc" = x"auto"; then
1924df58931aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1925df58931aSmrg   if test "x$ASCIIDOC" = "x"; then
1926df58931aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1927df58931aSmrg	have_asciidoc=no
1928df58931aSmrg   else
1929df58931aSmrg        have_asciidoc=yes
1930df58931aSmrg   fi
1931df58931aSmrgelif test "x$use_asciidoc" = x"yes" ; then
1932df58931aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1933df58931aSmrg   if test "x$ASCIIDOC" = "x"; then
1934df58931aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1935df58931aSmrg   fi
1936df58931aSmrg   have_asciidoc=yes
1937df58931aSmrgelif test "x$use_asciidoc" = x"no" ; then
1938df58931aSmrg   if test "x$ASCIIDOC" != "x"; then
1939df58931aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1940df58931aSmrg   fi
1941df58931aSmrg   have_asciidoc=no
1942df58931aSmrgelse
1943df58931aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1944df58931aSmrgfi
1945df58931aSmrgm4_ifval([$1],
1946df58931aSmrg[if test "$have_asciidoc" = yes; then
1947df58931aSmrg    # scrape the asciidoc version
1948df58931aSmrg    AC_MSG_CHECKING([the asciidoc version])
1949df58931aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1950df58931aSmrg    AC_MSG_RESULT([$asciidoc_version])
1951df58931aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1952df58931aSmrg        [if test "x$use_asciidoc" = xauto; then
1953df58931aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1954df58931aSmrg            have_asciidoc=no
1955df58931aSmrg        else
1956df58931aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1957df58931aSmrg        fi])
1958df58931aSmrgfi])
1959df58931aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1960df58931aSmrg]) # XORG_WITH_ASCIIDOC
1961df58931aSmrg
1962df58931aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1963df58931aSmrg# --------------------------------
1964df58931aSmrg# Minimum version: 1.5.0
1965df58931aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1966df58931aSmrg#
1967df58931aSmrg# Documentation tools are not always available on all platforms and sometimes
1968df58931aSmrg# not at the appropriate level. This macro enables a module to test for the
1969df58931aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1970df58931aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1971df58931aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1972df58931aSmrg# --with-doxygen assumes 'auto'.
1973df58931aSmrg#
1974df58931aSmrg# Interface to module:
1975df58931aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1976df58931aSmrg# DOXYGEN:	 returns the path of the doxygen program found
1977df58931aSmrg#		 returns the path set by the user in the environment
1978df58931aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1979df58931aSmrg#		  'no' user instructs the module not to use doxygen
1980df58931aSmrg#
1981df58931aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1982df58931aSmrg#
1983df58931aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1984df58931aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1985df58931aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1986df58931aSmrgAC_ARG_WITH(doxygen,
1987df58931aSmrg	AS_HELP_STRING([--with-doxygen],
1988df58931aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1989df58931aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1990df58931aSmrgm4_undefine([_defopt])
1991df58931aSmrg
1992df58931aSmrgif test "x$use_doxygen" = x"auto"; then
1993df58931aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1994df58931aSmrg   if test "x$DOXYGEN" = "x"; then
1995df58931aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1996df58931aSmrg	have_doxygen=no
1997df58931aSmrg   else
1998df58931aSmrg        have_doxygen=yes
1999df58931aSmrg   fi
2000df58931aSmrgelif test "x$use_doxygen" = x"yes" ; then
2001df58931aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2002df58931aSmrg   if test "x$DOXYGEN" = "x"; then
2003df58931aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2004df58931aSmrg   fi
2005df58931aSmrg   have_doxygen=yes
2006df58931aSmrgelif test "x$use_doxygen" = x"no" ; then
2007df58931aSmrg   if test "x$DOXYGEN" != "x"; then
2008df58931aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2009df58931aSmrg   fi
2010df58931aSmrg   have_doxygen=no
2011df58931aSmrgelse
2012df58931aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2013df58931aSmrgfi
2014df58931aSmrgm4_ifval([$1],
2015df58931aSmrg[if test "$have_doxygen" = yes; then
2016df58931aSmrg    # scrape the doxygen version
2017df58931aSmrg    AC_MSG_CHECKING([the doxygen version])
2018df58931aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2019df58931aSmrg    AC_MSG_RESULT([$doxygen_version])
2020df58931aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2021df58931aSmrg        [if test "x$use_doxygen" = xauto; then
2022df58931aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2023df58931aSmrg            have_doxygen=no
2024df58931aSmrg        else
2025df58931aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2026df58931aSmrg        fi])
2027df58931aSmrgfi])
2028df58931aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2029df58931aSmrg]) # XORG_WITH_DOXYGEN
2030df58931aSmrg
2031df58931aSmrg# XORG_WITH_GROFF([DEFAULT])
2032df58931aSmrg# ----------------
2033df58931aSmrg# Minimum version: 1.6.0
2034df58931aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2035df58931aSmrg#
2036df58931aSmrg# Documentation tools are not always available on all platforms and sometimes
2037df58931aSmrg# not at the appropriate level. This macro enables a module to test for the
2038df58931aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2039df58931aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2040df58931aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2041df58931aSmrg# --with-groff assumes 'auto'.
2042df58931aSmrg#
2043df58931aSmrg# Interface to module:
2044df58931aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2045df58931aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2046df58931aSmrg# HAVE_GROFF_MS: the -ms macros package
2047df58931aSmrg# GROFF:	 returns the path of the groff program found
2048df58931aSmrg#		 returns the path set by the user in the environment
2049df58931aSmrg# --with-groff:	 'yes' user instructs the module to use groff
2050df58931aSmrg#		 'no' user instructs the module not to use groff
2051df58931aSmrg#
2052df58931aSmrg# Added in version 1.9.0:
2053df58931aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2054df58931aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2055df58931aSmrg#		   psselect from the psutils package.
2056df58931aSmrg#		   the ghostcript package. Refer to the grohtml man pages
2057df58931aSmrg#
2058df58931aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2059df58931aSmrg#
2060df58931aSmrg# OS and distros often splits groff in a basic and full package, the former
2061df58931aSmrg# having the groff program and the later having devices, fonts and macros
2062df58931aSmrg# Checking for the groff executable is not enough.
2063df58931aSmrg#
2064df58931aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2065df58931aSmrg# unset HAVE_GROFF or GROFF env variables.
2066df58931aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2067df58931aSmrg#
2068df58931aSmrgAC_DEFUN([XORG_WITH_GROFF],[
2069df58931aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2070df58931aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2071df58931aSmrgAC_ARG_WITH(groff,
2072df58931aSmrg	AS_HELP_STRING([--with-groff],
2073df58931aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2074df58931aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2075df58931aSmrgm4_undefine([_defopt])
2076df58931aSmrg
2077df58931aSmrgif test "x$use_groff" = x"auto"; then
2078df58931aSmrg   AC_PATH_PROG([GROFF], [groff])
2079df58931aSmrg   if test "x$GROFF" = "x"; then
2080df58931aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2081df58931aSmrg	have_groff=no
2082df58931aSmrg   else
2083df58931aSmrg        have_groff=yes
2084df58931aSmrg   fi
2085df58931aSmrgelif test "x$use_groff" = x"yes" ; then
2086df58931aSmrg   AC_PATH_PROG([GROFF], [groff])
2087df58931aSmrg   if test "x$GROFF" = "x"; then
2088df58931aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2089df58931aSmrg   fi
2090df58931aSmrg   have_groff=yes
2091df58931aSmrgelif test "x$use_groff" = x"no" ; then
2092df58931aSmrg   if test "x$GROFF" != "x"; then
2093df58931aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2094df58931aSmrg   fi
2095df58931aSmrg   have_groff=no
2096df58931aSmrgelse
2097df58931aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2098df58931aSmrgfi
2099df58931aSmrg
2100df58931aSmrg# We have groff, test for the presence of the macro packages
2101df58931aSmrgif test "x$have_groff" = x"yes"; then
2102df58931aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2103df58931aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2104df58931aSmrg        groff_ms_works=yes
2105df58931aSmrg    else
2106df58931aSmrg        groff_ms_works=no
2107df58931aSmrg    fi
2108df58931aSmrg    AC_MSG_RESULT([$groff_ms_works])
2109df58931aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2110df58931aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2111df58931aSmrg        groff_mm_works=yes
2112df58931aSmrg    else
2113df58931aSmrg        groff_mm_works=no
2114df58931aSmrg    fi
2115df58931aSmrg    AC_MSG_RESULT([$groff_mm_works])
2116df58931aSmrgfi
2117df58931aSmrg
2118df58931aSmrg# We have groff, test for HTML dependencies, one command per package
2119df58931aSmrgif test "x$have_groff" = x"yes"; then
2120df58931aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2121df58931aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2122df58931aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2123df58931aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2124df58931aSmrg      have_groff_html=yes
2125df58931aSmrg   else
2126df58931aSmrg      have_groff_html=no
2127df58931aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2128df58931aSmrg   fi
2129df58931aSmrgfi
2130df58931aSmrg
2131df58931aSmrg# Set Automake conditionals for Makefiles
2132df58931aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2133df58931aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2134df58931aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2135df58931aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2136df58931aSmrg]) # XORG_WITH_GROFF
2137df58931aSmrg
2138df58931aSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2139df58931aSmrg# ---------------------------------------
2140df58931aSmrg# Minimum version: 1.6.0
2141df58931aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2142df58931aSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2143df58931aSmrg#
2144df58931aSmrg# Documentation tools are not always available on all platforms and sometimes
2145df58931aSmrg# not at the appropriate level. This macro enables a module to test for the
2146df58931aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2147df58931aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2148df58931aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2149df58931aSmrg# --with-fop assumes 'auto'.
2150df58931aSmrg#
2151df58931aSmrg# Interface to module:
2152df58931aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2153df58931aSmrg# FOP:	 	returns the path of the fop program found
2154df58931aSmrg#		returns the path set by the user in the environment
2155df58931aSmrg# --with-fop: 	'yes' user instructs the module to use fop
2156df58931aSmrg#		'no' user instructs the module not to use fop
2157df58931aSmrg#
2158df58931aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2159df58931aSmrg#
2160df58931aSmrgAC_DEFUN([XORG_WITH_FOP],[
2161df58931aSmrgAC_ARG_VAR([FOP], [Path to fop command])
2162df58931aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2163df58931aSmrgAC_ARG_WITH(fop,
2164df58931aSmrg	AS_HELP_STRING([--with-fop],
2165df58931aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2166df58931aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2167df58931aSmrgm4_undefine([_defopt])
2168df58931aSmrg
2169df58931aSmrgif test "x$use_fop" = x"auto"; then
2170df58931aSmrg   AC_PATH_PROG([FOP], [fop])
2171df58931aSmrg   if test "x$FOP" = "x"; then
2172df58931aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2173df58931aSmrg	have_fop=no
2174df58931aSmrg   else
2175df58931aSmrg        have_fop=yes
2176df58931aSmrg   fi
2177df58931aSmrgelif test "x$use_fop" = x"yes" ; then
2178df58931aSmrg   AC_PATH_PROG([FOP], [fop])
2179df58931aSmrg   if test "x$FOP" = "x"; then
2180df58931aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2181df58931aSmrg   fi
2182df58931aSmrg   have_fop=yes
2183df58931aSmrgelif test "x$use_fop" = x"no" ; then
2184df58931aSmrg   if test "x$FOP" != "x"; then
2185df58931aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2186df58931aSmrg   fi
2187df58931aSmrg   have_fop=no
2188df58931aSmrgelse
2189df58931aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2190df58931aSmrgfi
2191df58931aSmrg
2192df58931aSmrg# Test for a minimum version of fop, if provided.
2193df58931aSmrgm4_ifval([$1],
2194df58931aSmrg[if test "$have_fop" = yes; then
2195df58931aSmrg    # scrape the fop version
2196df58931aSmrg    AC_MSG_CHECKING([for fop minimum version])
2197df58931aSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2198df58931aSmrg    AC_MSG_RESULT([$fop_version])
2199df58931aSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2200df58931aSmrg        [if test "x$use_fop" = xauto; then
2201df58931aSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2202df58931aSmrg            have_fop=no
2203df58931aSmrg        else
2204df58931aSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2205df58931aSmrg        fi])
2206df58931aSmrgfi])
2207df58931aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2208df58931aSmrg]) # XORG_WITH_FOP
2209df58931aSmrg
2210df58931aSmrg# XORG_WITH_PS2PDF([DEFAULT])
2211df58931aSmrg# ----------------
2212df58931aSmrg# Minimum version: 1.6.0
2213df58931aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2214df58931aSmrg#
2215df58931aSmrg# Documentation tools are not always available on all platforms and sometimes
2216df58931aSmrg# not at the appropriate level. This macro enables a module to test for the
2217df58931aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2218df58931aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2219df58931aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2220df58931aSmrg# --with-ps2pdf assumes 'auto'.
2221df58931aSmrg#
2222df58931aSmrg# Interface to module:
2223df58931aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2224df58931aSmrg# PS2PDF:	returns the path of the ps2pdf program found
2225df58931aSmrg#		returns the path set by the user in the environment
2226df58931aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2227df58931aSmrg#		 'no' user instructs the module not to use ps2pdf
2228df58931aSmrg#
2229df58931aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2230df58931aSmrg#
2231df58931aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2232df58931aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2233df58931aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2234df58931aSmrgAC_ARG_WITH(ps2pdf,
2235df58931aSmrg	AS_HELP_STRING([--with-ps2pdf],
2236df58931aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2237df58931aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2238df58931aSmrgm4_undefine([_defopt])
2239df58931aSmrg
2240df58931aSmrgif test "x$use_ps2pdf" = x"auto"; then
2241df58931aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2242df58931aSmrg   if test "x$PS2PDF" = "x"; then
2243df58931aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2244df58931aSmrg	have_ps2pdf=no
2245df58931aSmrg   else
2246df58931aSmrg        have_ps2pdf=yes
2247df58931aSmrg   fi
2248df58931aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2249df58931aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250df58931aSmrg   if test "x$PS2PDF" = "x"; then
2251df58931aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2252df58931aSmrg   fi
2253df58931aSmrg   have_ps2pdf=yes
2254df58931aSmrgelif test "x$use_ps2pdf" = x"no" ; then
2255df58931aSmrg   if test "x$PS2PDF" != "x"; then
2256df58931aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2257df58931aSmrg   fi
2258df58931aSmrg   have_ps2pdf=no
2259df58931aSmrgelse
2260df58931aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2261df58931aSmrgfi
2262df58931aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2263df58931aSmrg]) # XORG_WITH_PS2PDF
2264df58931aSmrg
2265df58931aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2266df58931aSmrg# ----------------
2267df58931aSmrg# Minimum version: 1.6.0
2268df58931aSmrg#
2269df58931aSmrg# Documentation tools are not always available on all platforms and sometimes
2270df58931aSmrg# not at the appropriate level. This macro enables a builder to skip all
2271df58931aSmrg# documentation targets except traditional man pages.
2272df58931aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2273df58931aSmrg# maximum flexibilty in controlling documentation building.
2274df58931aSmrg# Refer to:
2275df58931aSmrg# XORG_WITH_XMLTO         --with-xmlto
2276df58931aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2277df58931aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2278df58931aSmrg# XORG_WITH_FOP           --with-fop
2279df58931aSmrg# XORG_WITH_GROFF         --with-groff
2280df58931aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2281df58931aSmrg#
2282df58931aSmrg# Interface to module:
2283df58931aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2284df58931aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2285df58931aSmrg#		 'no' user instructs the module not to generate docs
2286df58931aSmrg# parm1:	specify the default value, yes or no.
2287df58931aSmrg#
2288df58931aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2289df58931aSmrgm4_define([docs_default], m4_default([$1], [yes]))
2290df58931aSmrgAC_ARG_ENABLE(docs,
2291df58931aSmrg	AS_HELP_STRING([--enable-docs],
2292df58931aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2293df58931aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2294df58931aSmrgm4_undefine([docs_default])
2295df58931aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2296df58931aSmrgAC_MSG_CHECKING([whether to build documentation])
2297df58931aSmrgAC_MSG_RESULT([$build_docs])
2298df58931aSmrg]) # XORG_ENABLE_DOCS
2299df58931aSmrg
2300df58931aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2301df58931aSmrg# ----------------
2302df58931aSmrg# Minimum version: 1.6.0
2303df58931aSmrg#
2304df58931aSmrg# This macro enables a builder to skip all developer documentation.
2305df58931aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2306df58931aSmrg# maximum flexibilty in controlling documentation building.
2307df58931aSmrg# Refer to:
2308df58931aSmrg# XORG_WITH_XMLTO         --with-xmlto
2309df58931aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2310df58931aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2311df58931aSmrg# XORG_WITH_FOP           --with-fop
2312df58931aSmrg# XORG_WITH_GROFF         --with-groff
2313df58931aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2314df58931aSmrg#
2315df58931aSmrg# Interface to module:
2316df58931aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2317df58931aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2318df58931aSmrg#			'no' user instructs the module not to generate developer docs
2319df58931aSmrg# parm1:		specify the default value, yes or no.
2320df58931aSmrg#
2321df58931aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2322df58931aSmrgm4_define([devel_default], m4_default([$1], [yes]))
2323df58931aSmrgAC_ARG_ENABLE(devel-docs,
2324df58931aSmrg	AS_HELP_STRING([--enable-devel-docs],
2325df58931aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2326df58931aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2327df58931aSmrgm4_undefine([devel_default])
2328df58931aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2329df58931aSmrgAC_MSG_CHECKING([whether to build developer documentation])
2330df58931aSmrgAC_MSG_RESULT([$build_devel_docs])
2331df58931aSmrg]) # XORG_ENABLE_DEVEL_DOCS
2332df58931aSmrg
2333df58931aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2334df58931aSmrg# ----------------
2335df58931aSmrg# Minimum version: 1.6.0
2336df58931aSmrg#
2337df58931aSmrg# This macro enables a builder to skip all functional specification targets.
2338df58931aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2339df58931aSmrg# maximum flexibilty in controlling documentation building.
2340df58931aSmrg# Refer to:
2341df58931aSmrg# XORG_WITH_XMLTO         --with-xmlto
2342df58931aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2343df58931aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2344df58931aSmrg# XORG_WITH_FOP           --with-fop
2345df58931aSmrg# XORG_WITH_GROFF         --with-groff
2346df58931aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2347df58931aSmrg#
2348df58931aSmrg# Interface to module:
2349df58931aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2350df58931aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2351df58931aSmrg#			'no' user instructs the module not to generate specs
2352df58931aSmrg# parm1:		specify the default value, yes or no.
2353df58931aSmrg#
2354df58931aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2355df58931aSmrgm4_define([spec_default], m4_default([$1], [yes]))
2356df58931aSmrgAC_ARG_ENABLE(specs,
2357df58931aSmrg	AS_HELP_STRING([--enable-specs],
2358df58931aSmrg	   [Enable building the specs (default: ]spec_default[)]),
2359df58931aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2360df58931aSmrgm4_undefine([spec_default])
2361df58931aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2362df58931aSmrgAC_MSG_CHECKING([whether to build functional specifications])
2363df58931aSmrgAC_MSG_RESULT([$build_specs])
2364df58931aSmrg]) # XORG_ENABLE_SPECS
2365df58931aSmrg
2366df58931aSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2367df58931aSmrg# ----------------------------------------------
2368df58931aSmrg# Minimum version: 1.13.0
2369df58931aSmrg#
2370df58931aSmrg# This macro enables a builder to enable/disable unit testing
2371df58931aSmrg# It makes no assumption about the test cases implementation
2372df58931aSmrg# Test cases may or may not use Automake "Support for test suites"
2373df58931aSmrg# They may or may not use the software utility library GLib
2374df58931aSmrg#
2375df58931aSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2376df58931aSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2377df58931aSmrg# The variable enable_unit_tests is used by other macros in this file.
2378df58931aSmrg#
2379df58931aSmrg# Interface to module:
2380df58931aSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2381df58931aSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2382df58931aSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2383df58931aSmrg#			'no' user instructs the module not to build tests
2384df58931aSmrg# parm1:		specify the default value, yes or no.
2385df58931aSmrg#
2386df58931aSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2387df58931aSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2388df58931aSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2389df58931aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2390df58931aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2391df58931aSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2392df58931aSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2393df58931aSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2394df58931aSmrgm4_undefine([_defopt])
2395df58931aSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2396df58931aSmrgAC_MSG_CHECKING([whether to build unit test cases])
2397df58931aSmrgAC_MSG_RESULT([$enable_unit_tests])
2398df58931aSmrg]) # XORG_ENABLE_UNIT_TESTS
2399df58931aSmrg
2400df58931aSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2401df58931aSmrg# ------------------------------------------------------
2402df58931aSmrg# Minimum version: 1.17.0
2403df58931aSmrg#
2404df58931aSmrg# This macro enables a builder to enable/disable integration testing
2405df58931aSmrg# It makes no assumption about the test cases' implementation
2406df58931aSmrg# Test cases may or may not use Automake "Support for test suites"
2407df58931aSmrg#
2408df58931aSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2409df58931aSmrg# usually requires less dependencies and may be built and run under less
2410df58931aSmrg# stringent environments than integration tests.
2411df58931aSmrg#
2412df58931aSmrg# Interface to module:
2413df58931aSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2414df58931aSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2415df58931aSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2416df58931aSmrg#                             'no' user instructs the module not to build tests
2417df58931aSmrg# parm1:                      specify the default value, yes or no.
2418df58931aSmrg#
2419df58931aSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2420df58931aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2421df58931aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2422df58931aSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2423df58931aSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2424df58931aSmrg	[enable_integration_tests=$enableval],
2425df58931aSmrg	[enable_integration_tests=]_defopt)
2426df58931aSmrgm4_undefine([_defopt])
2427df58931aSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2428df58931aSmrg	[test "x$enable_integration_tests" != xno])
2429df58931aSmrgAC_MSG_CHECKING([whether to build unit test cases])
2430df58931aSmrgAC_MSG_RESULT([$enable_integration_tests])
2431df58931aSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2432df58931aSmrg
2433df58931aSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2434df58931aSmrg# ----------------------------------------
2435df58931aSmrg# Minimum version: 1.13.0
2436df58931aSmrg#
2437df58931aSmrg# GLib is a library which provides advanced data structures and functions.
2438df58931aSmrg# This macro enables a module to test for the presence of Glib.
2439df58931aSmrg#
2440df58931aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2441df58931aSmrg# Otherwise the value of $enable_unit_tests is blank.
2442df58931aSmrg#
2443df58931aSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2444df58931aSmrg# test support usually requires less dependencies and may be built and run under
2445df58931aSmrg# less stringent environments than integration tests.
2446df58931aSmrg#
2447df58931aSmrg# Interface to module:
2448df58931aSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2449df58931aSmrg# with_glib: used in configure.ac to know if GLib has been found
2450df58931aSmrg# --with-glib:	'yes' user instructs the module to use glib
2451df58931aSmrg#		'no' user instructs the module not to use glib
2452df58931aSmrg#
2453df58931aSmrgAC_DEFUN([XORG_WITH_GLIB],[
2454df58931aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2455df58931aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2456df58931aSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2457df58931aSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2458df58931aSmrg	[with_glib=$withval], [with_glib=]_defopt)
2459df58931aSmrgm4_undefine([_defopt])
2460df58931aSmrg
2461df58931aSmrghave_glib=no
2462df58931aSmrg# Do not probe GLib if user explicitly disabled unit testing
2463df58931aSmrgif test "x$enable_unit_tests" != x"no"; then
2464df58931aSmrg  # Do not probe GLib if user explicitly disabled it
2465df58931aSmrg  if test "x$with_glib" != x"no"; then
2466df58931aSmrg    m4_ifval(
2467df58931aSmrg      [$1],
2468df58931aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2469df58931aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2470df58931aSmrg    )
2471df58931aSmrg  fi
2472df58931aSmrgfi
2473df58931aSmrg
2474df58931aSmrg# Not having GLib when unit testing has been explicitly requested is an error
2475df58931aSmrgif test "x$enable_unit_tests" = x"yes"; then
2476df58931aSmrg  if test "x$have_glib" = x"no"; then
2477df58931aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2478df58931aSmrg  fi
2479df58931aSmrgfi
2480df58931aSmrg
2481df58931aSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2482df58931aSmrgif test "x$enable_unit_tests" = x"no"; then
2483df58931aSmrg  if test "x$with_glib" = x"yes"; then
2484df58931aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2485df58931aSmrg  fi
2486df58931aSmrgfi
2487df58931aSmrg
2488df58931aSmrg# Not having GLib when it has been explicitly requested is an error
2489df58931aSmrgif test "x$with_glib" = x"yes"; then
2490df58931aSmrg  if test "x$have_glib" = x"no"; then
2491df58931aSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2492df58931aSmrg  fi
2493df58931aSmrgfi
2494df58931aSmrg
2495df58931aSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2496df58931aSmrg]) # XORG_WITH_GLIB
2497df58931aSmrg
2498df58931aSmrg# XORG_LD_WRAP([required|optional])
2499df58931aSmrg# ---------------------------------
2500df58931aSmrg# Minimum version: 1.13.0
2501df58931aSmrg#
2502df58931aSmrg# Check if linker supports -wrap, passed via compiler flags
2503df58931aSmrg#
2504df58931aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2505df58931aSmrg# Otherwise the value of $enable_unit_tests is blank.
2506df58931aSmrg#
2507df58931aSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2508df58931aSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2509df58931aSmrg# available, an argument of "optional" allows use when some unit tests require
2510df58931aSmrg# ld -wrap and others do not.
2511df58931aSmrg#
2512df58931aSmrgAC_DEFUN([XORG_LD_WRAP],[
2513df58931aSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2514df58931aSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2515df58931aSmrg                      void __wrap_exit(int status) { return; }],
2516df58931aSmrg                     [exit(0);])])
2517df58931aSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2518df58931aSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2519df58931aSmrg  if test "x$have_ld_wrap" = x"no"; then
2520df58931aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2521df58931aSmrg  fi
2522df58931aSmrgfi
2523df58931aSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2524df58931aSmrg#
2525df58931aSmrg]) # XORG_LD_WRAP
2526df58931aSmrg
2527df58931aSmrg# XORG_CHECK_LINKER_FLAGS
2528df58931aSmrg# -----------------------
2529df58931aSmrg# SYNOPSIS
2530df58931aSmrg#
2531df58931aSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2532df58931aSmrg#
2533df58931aSmrg# DESCRIPTION
2534df58931aSmrg#
2535df58931aSmrg#   Check whether the given linker FLAGS work with the current language's
2536df58931aSmrg#   linker, or whether they give an error.
2537df58931aSmrg#
2538df58931aSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2539df58931aSmrg#   success/failure.
2540df58931aSmrg#
2541df58931aSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2542df58931aSmrg#
2543df58931aSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2544df58931aSmrg#
2545df58931aSmrg# LICENSE
2546df58931aSmrg#
2547df58931aSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2548df58931aSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2549df58931aSmrg#   Copyright (c) 2009 Matteo Frigo
2550df58931aSmrg#
2551df58931aSmrg#   This program is free software: you can redistribute it and/or modify it
2552df58931aSmrg#   under the terms of the GNU General Public License as published by the
2553df58931aSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2554df58931aSmrg#   option) any later version.
2555df58931aSmrg#
2556df58931aSmrg#   This program is distributed in the hope that it will be useful, but
2557df58931aSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2558df58931aSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2559df58931aSmrg#   Public License for more details.
2560df58931aSmrg#
2561df58931aSmrg#   You should have received a copy of the GNU General Public License along
2562df58931aSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2563df58931aSmrg#
2564df58931aSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2565df58931aSmrg#   gives unlimited permission to copy, distribute and modify the configure
2566df58931aSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2567df58931aSmrg#   need not follow the terms of the GNU General Public License when using
2568df58931aSmrg#   or distributing such scripts, even though portions of the text of the
2569df58931aSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2570df58931aSmrg#   all other use of the material that constitutes the Autoconf Macro.
2571df58931aSmrg#
2572df58931aSmrg#   This special exception to the GPL applies to versions of the Autoconf
2573df58931aSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2574df58931aSmrg#   modified version of the Autoconf Macro, you may extend this special
2575df58931aSmrg#   exception to the GPL to apply to your modified version as well.#
2576df58931aSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2577df58931aSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2578df58931aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2579df58931aSmrgAS_LITERAL_IF([$1],
2580df58931aSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2581df58931aSmrg      ax_save_FLAGS=$LDFLAGS
2582df58931aSmrg      LDFLAGS="$1"
2583df58931aSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2584df58931aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2585df58931aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2586df58931aSmrg      LDFLAGS=$ax_save_FLAGS])],
2587df58931aSmrg  [ax_save_FLAGS=$LDFLAGS
2588df58931aSmrg   LDFLAGS="$1"
2589df58931aSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2590df58931aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2591df58931aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2592df58931aSmrg   LDFLAGS=$ax_save_FLAGS])
2593df58931aSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2594df58931aSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2595df58931aSmrgif test "x$xorg_check_linker_flags" = xyes; then
2596df58931aSmrg	m4_default([$2], :)
2597df58931aSmrgelse
2598df58931aSmrg	m4_default([$3], :)
2599df58931aSmrgfi
2600df58931aSmrg]) # XORG_CHECK_LINKER_FLAGS
2601df58931aSmrg
2602df58931aSmrg# XORG_MEMORY_CHECK_FLAGS
2603df58931aSmrg# -----------------------
2604df58931aSmrg# Minimum version: 1.16.0
2605df58931aSmrg#
2606df58931aSmrg# This macro attempts to find appropriate memory checking functionality
2607df58931aSmrg# for various platforms which unit testing code may use to catch various
2608df58931aSmrg# forms of memory allocation and access errors in testing.
2609df58931aSmrg#
2610df58931aSmrg# Interface to module:
2611df58931aSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2612df58931aSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2613df58931aSmrg#
2614df58931aSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2615df58931aSmrg#
2616df58931aSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2617df58931aSmrg
2618df58931aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2619df58931aSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2620df58931aSmrg           [Environment variables to enable memory checking in tests])
2621df58931aSmrg
2622df58931aSmrg# Check for different types of support on different platforms
2623df58931aSmrgcase $host_os in
2624df58931aSmrg    solaris*)
2625df58931aSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2626df58931aSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2627df58931aSmrg        ;;
2628df58931aSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2629df58931aSmrg        # both directly and inverted, so should not be 0 or 255.
2630df58931aSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2631df58931aSmrg        ;;
2632df58931aSmrg    darwin*)
2633df58931aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2634df58931aSmrg        ;;
2635df58931aSmrg    *bsd*)
2636df58931aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2637df58931aSmrg        ;;
2638df58931aSmrgesac
2639b66d1acbSmrg
2640df58931aSmrg# User supplied flags override default flags
2641df58931aSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2642df58931aSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2643b66d1acbSmrgfi
2644b66d1acbSmrg
2645df58931aSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2646df58931aSmrg]) # XORG_WITH_LINT
2647b66d1acbSmrg
26484fb28925Smrg# XORG_CHECK_MALLOC_ZERO
26494fb28925Smrg# ----------------------
2650b66d1acbSmrg# Minimum version: 1.0.0
2651b66d1acbSmrg#
26524fb28925Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26534fb28925Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26544fb28925Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26554fb28925SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26564fb28925SmrgAC_ARG_ENABLE(malloc0returnsnull,
2657b66d1acbSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26584fb28925Smrg		       [malloc(0) returns NULL (default: auto)]),
26594fb28925Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26604fb28925Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26614fb28925Smrg
26624fb28925SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26634fb28925Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2664df58931aSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2665df58931aSmrg#include <stdlib.h>
2666df58931aSmrg],[
26674fb28925Smrg    char *m0, *r0, *c0, *p;
26684fb28925Smrg    m0 = malloc(0);
26694fb28925Smrg    p = malloc(10);
26704fb28925Smrg    r0 = realloc(p,0);
2671df58931aSmrg    c0 = calloc(0,10);
2672df58931aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2673df58931aSmrg])],
26744fb28925Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2675df58931aSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
2676df58931aSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
26774fb28925Smrgfi
26784fb28925SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26794fb28925Smrg
26804fb28925Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26814fb28925Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26824fb28925Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26834fb28925Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26844fb28925Smrgelse
26854fb28925Smrg	MALLOC_ZERO_CFLAGS=""
26864fb28925Smrg	XMALLOC_ZERO_CFLAGS=""
26874fb28925Smrg	XTMALLOC_ZERO_CFLAGS=""
26884fb28925Smrgfi
26894fb28925Smrg
26904fb28925SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
26914fb28925SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
26924fb28925SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
26934fb28925Smrg]) # XORG_CHECK_MALLOC_ZERO
26944fb28925Smrg
2695b66d1acbSmrg# XORG_WITH_LINT()
2696b66d1acbSmrg# ----------------
2697b66d1acbSmrg# Minimum version: 1.1.0
2698b66d1acbSmrg#
2699df58931aSmrg# This macro enables the use of a tool that flags some suspicious and
2700df58931aSmrg# non-portable constructs (likely to be bugs) in C language source code.
2701df58931aSmrg# It will attempt to locate the tool and use appropriate options.
2702df58931aSmrg# There are various lint type tools on different platforms.
2703df58931aSmrg#
2704df58931aSmrg# Interface to module:
2705df58931aSmrg# LINT:		returns the path to the tool found on the platform
2706df58931aSmrg#		or the value set to LINT on the configure cmd line
2707df58931aSmrg#		also an Automake conditional
2708df58931aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2709df58931aSmrg#
2710df58931aSmrg# --with-lint:	'yes' user instructs the module to use lint
2711df58931aSmrg#		'no' user instructs the module not to use lint (default)
2712df58931aSmrg#
2713df58931aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2714df58931aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2715b66d1acbSmrg#
2716b66d1acbSmrgAC_DEFUN([XORG_WITH_LINT],[
2717b66d1acbSmrg
2718df58931aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2719df58931aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2720b66d1acbSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2721b66d1acbSmrg		[Use a lint-style source code checker (default: disabled)])],
2722b66d1acbSmrg		[use_lint=$withval], [use_lint=no])
2723df58931aSmrg
2724df58931aSmrg# Obtain platform specific info like program name and options
2725df58931aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2726df58931aSmrgcase $host_os in
2727df58931aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2728df58931aSmrg	lint_name=splint
2729df58931aSmrg	lint_options="-badflag"
2730df58931aSmrg	;;
2731df58931aSmrg  *freebsd* | *netbsd*)
2732df58931aSmrg	lint_name=lint
2733df58931aSmrg	lint_options="-u -b"
2734df58931aSmrg	;;
2735df58931aSmrg  *solaris*)
2736df58931aSmrg	lint_name=lint
2737df58931aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2738df58931aSmrg	;;
2739df58931aSmrgesac
2740df58931aSmrg
2741df58931aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2742df58931aSmrgif test "x$use_lint" = x"yes" ; then
2743df58931aSmrg   AC_PATH_PROG([LINT], [$lint_name])
2744df58931aSmrg   if test "x$LINT" = "x"; then
2745df58931aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2746df58931aSmrg   fi
2747df58931aSmrgelif test "x$use_lint" = x"no" ; then
2748df58931aSmrg   if test "x$LINT" != "x"; then
2749df58931aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2750df58931aSmrg   fi
2751b66d1acbSmrgelse
2752df58931aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2753df58931aSmrgfi
2754df58931aSmrg
2755df58931aSmrg# User supplied flags override default flags
2756df58931aSmrgif test "x$LINT_FLAGS" != "x"; then
2757df58931aSmrg   lint_options=$LINT_FLAGS
2758b66d1acbSmrgfi
2759b66d1acbSmrg
2760df58931aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2761df58931aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2762b66d1acbSmrg
2763b66d1acbSmrg]) # XORG_WITH_LINT
2764b66d1acbSmrg
2765b66d1acbSmrg# XORG_LINT_LIBRARY(LIBNAME)
2766b66d1acbSmrg# --------------------------
2767b66d1acbSmrg# Minimum version: 1.1.0
2768b66d1acbSmrg#
2769b66d1acbSmrg# Sets up flags for building lint libraries for checking programs that call
2770b66d1acbSmrg# functions in the library.
2771b66d1acbSmrg#
2772df58931aSmrg# Interface to module:
2773df58931aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2774df58931aSmrg# MAKE_LINT_LIB		- Automake conditional
2775df58931aSmrg#
2776df58931aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2777df58931aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2778b66d1acbSmrg
2779b66d1acbSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2780b66d1acbSmrgAC_REQUIRE([XORG_WITH_LINT])
2781b66d1acbSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2782b66d1acbSmrg	[Create lint library (default: disabled)])],
2783b66d1acbSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2784df58931aSmrg
2785df58931aSmrgif test "x$make_lint_lib" = x"yes" ; then
2786df58931aSmrg   LINTLIB=llib-l$1.ln
2787df58931aSmrg   if test "x$LINT" = "x"; then
2788df58931aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2789df58931aSmrg   fi
2790df58931aSmrgelif test "x$make_lint_lib" != x"no" ; then
2791df58931aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2792b66d1acbSmrgfi
2793df58931aSmrg
2794b66d1acbSmrgAC_SUBST(LINTLIB)
2795b66d1acbSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2796b66d1acbSmrg
2797b66d1acbSmrg]) # XORG_LINT_LIBRARY
2798b66d1acbSmrg
2799df58931aSmrg# XORG_COMPILER_BRAND
2800df58931aSmrg# -------------------
2801df58931aSmrg# Minimum version: 1.14.0
2802df58931aSmrg#
2803df58931aSmrg# Checks for various brands of compilers and sets flags as appropriate:
2804df58931aSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2805df58931aSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2806df58931aSmrg#   clang compiler - sets CLANGCC to "yes"
2807df58931aSmrg#   Intel compiler - sets INTELCC to "yes"
2808df58931aSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2809df58931aSmrg#
2810df58931aSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2811df58931aSmrgAC_LANG_CASE(
2812df58931aSmrg	[C], [
2813df58931aSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2814df58931aSmrg	],
2815df58931aSmrg	[C++], [
2816df58931aSmrg		AC_REQUIRE([AC_PROG_CXX])
2817df58931aSmrg	]
2818df58931aSmrg)
2819df58931aSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2820df58931aSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2821df58931aSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2822df58931aSmrg]) # XORG_COMPILER_BRAND
2823df58931aSmrg
2824df58931aSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2825df58931aSmrg# ---------------
2826df58931aSmrg# Minimum version: 1.16.0
2827df58931aSmrg#
2828df58931aSmrg# Test if the compiler works when passed the given flag as a command line argument.
2829df58931aSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2830df58931aSmrg# next flag in the list until there are no more options.
2831df58931aSmrg#
2832df58931aSmrg# Note that this does not guarantee that the compiler supports the flag as some
2833df58931aSmrg# compilers will simply ignore arguments that they do not understand, but we do
2834df58931aSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2835df58931aSmrg# -Werror=unused-command-line-argument
2836df58931aSmrg#
2837df58931aSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2838df58931aSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2839df58931aSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2840df58931aSmrg
2841df58931aSmrgAC_LANG_COMPILER_REQUIRE
2842df58931aSmrg
2843df58931aSmrgAC_LANG_CASE(
2844df58931aSmrg	[C], [
2845df58931aSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2846df58931aSmrg		define([PREFIX], [C])
2847df58931aSmrg		define([CACHE_PREFIX], [cc])
2848df58931aSmrg		define([COMPILER], [$CC])
2849df58931aSmrg	],
2850df58931aSmrg	[C++], [
2851df58931aSmrg		define([PREFIX], [CXX])
2852df58931aSmrg		define([CACHE_PREFIX], [cxx])
2853df58931aSmrg		define([COMPILER], [$CXX])
2854df58931aSmrg	]
2855df58931aSmrg)
2856df58931aSmrg
2857df58931aSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2858df58931aSmrg
2859df58931aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2860df58931aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2861df58931aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2862df58931aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2863df58931aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2864df58931aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2865df58931aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2866df58931aSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2867df58931aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2868df58931aSmrgfi
2869df58931aSmrg
2870df58931aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2871df58931aSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2872df58931aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2873df58931aSmrg	fi
2874df58931aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2875df58931aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2876df58931aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2877df58931aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2878df58931aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2879df58931aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2880df58931aSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2881df58931aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2882df58931aSmrgfi
2883df58931aSmrg
2884df58931aSmrgfound="no"
2885df58931aSmrgm4_foreach([flag], m4_cdr($@), [
2886df58931aSmrg	if test $found = "no" ; then
2887df58931aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2888df58931aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2889df58931aSmrg		fi
2890df58931aSmrg
2891df58931aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2892df58931aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2893df58931aSmrg		fi
2894df58931aSmrg
2895df58931aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2896df58931aSmrg
2897df58931aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2898df58931aSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2899df58931aSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2900df58931aSmrg		AC_CACHE_VAL($cacheid,
2901df58931aSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2902df58931aSmrg					     [eval $cacheid=yes],
2903df58931aSmrg					     [eval $cacheid=no])])
2904df58931aSmrg
2905df58931aSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2906df58931aSmrg
2907df58931aSmrg		eval supported=\$$cacheid
2908df58931aSmrg		AC_MSG_RESULT([$supported])
2909df58931aSmrg		if test "$supported" = "yes" ; then
2910df58931aSmrg			$1="$$1 ]flag["
2911df58931aSmrg			found="yes"
2912df58931aSmrg		fi
2913df58931aSmrg	fi
2914df58931aSmrg])
2915df58931aSmrg]) # XORG_TESTSET_CFLAG
2916df58931aSmrg
2917df58931aSmrg# XORG_COMPILER_FLAGS
2918df58931aSmrg# ---------------
2919df58931aSmrg# Minimum version: 1.16.0
2920df58931aSmrg#
2921df58931aSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2922df58931aSmrg# arguments supported by the selected compiler which do NOT alter the generated
2923df58931aSmrg# code.  These arguments will cause the compiler to print various warnings
2924df58931aSmrg# during compilation AND turn a conservative set of warnings into errors.
2925df58931aSmrg#
2926df58931aSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2927df58931aSmrg# future versions of util-macros as options are added to new compilers.
2928df58931aSmrg#
2929df58931aSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2930df58931aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2931df58931aSmrg
2932df58931aSmrgAC_ARG_ENABLE(selective-werror,
2933df58931aSmrg              AS_HELP_STRING([--disable-selective-werror],
2934df58931aSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2935df58931aSmrg              [SELECTIVE_WERROR=$enableval],
2936df58931aSmrg              [SELECTIVE_WERROR=yes])
2937df58931aSmrg
2938df58931aSmrgAC_LANG_CASE(
2939df58931aSmrg        [C], [
2940df58931aSmrg                define([PREFIX], [C])
2941df58931aSmrg        ],
2942df58931aSmrg        [C++], [
2943df58931aSmrg                define([PREFIX], [CXX])
2944df58931aSmrg        ]
2945df58931aSmrg)
2946df58931aSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2947df58931aSmrgif test "x$SUNCC" = "xyes"; then
2948df58931aSmrg    [BASE_]PREFIX[FLAGS]="-v"
2949df58931aSmrgelse
2950df58931aSmrg    [BASE_]PREFIX[FLAGS]=""
2951df58931aSmrgfi
2952df58931aSmrg
2953df58931aSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2954df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2955df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2956df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2957df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2958df58931aSmrg
2959df58931aSmrgAC_LANG_CASE(
2960df58931aSmrg	[C], [
2961df58931aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2962df58931aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2963df58931aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2964df58931aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2965df58931aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2966df58931aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2967df58931aSmrg	]
2968df58931aSmrg)
2969df58931aSmrg
2970df58931aSmrg# This chunk adds additional warnings that could catch undesired effects.
2971df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2972df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2973df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2974df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2975df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2976df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2977df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2978df58931aSmrg
2979df58931aSmrg# These are currently disabled because they are noisy.  They will be enabled
2980df58931aSmrg# in the future once the codebase is sufficiently modernized to silence
2981df58931aSmrg# them.  For now, I don't want them to drown out the other warnings.
2982df58931aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2983df58931aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2984df58931aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2985df58931aSmrg
2986df58931aSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2987df58931aSmrg# when there are problems that should be fixed.
2988df58931aSmrg
2989df58931aSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2990df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2991df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2992df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2993df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2994df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2995df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2996df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2997df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2998df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2999df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3000df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3001df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3002df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3003df58931aSmrgelse
3004df58931aSmrgAC_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])
3005df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3006df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3007df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3008df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3009df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3010df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3011df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3012df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3013df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3014df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3015df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3016df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3017df58931aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3018df58931aSmrgfi
3019df58931aSmrg
3020df58931aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3021df58931aSmrg]) # XORG_COMPILER_FLAGS
3022df58931aSmrg
3023b66d1acbSmrg# XORG_CWARNFLAGS
3024b66d1acbSmrg# ---------------
3025b66d1acbSmrg# Minimum version: 1.2.0
3026df58931aSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3027b66d1acbSmrg#
3028b66d1acbSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3029b66d1acbSmrg#
3030df58931aSmrg# This function is deprecated because it defines -fno-strict-aliasing
3031df58931aSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3032df58931aSmrg# is needed, then it should be added explicitly in the module when
3033df58931aSmrg# it is updated to use BASE_CFLAGS.
3034df58931aSmrg#
3035b66d1acbSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3036df58931aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3037df58931aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3038df58931aSmrgAC_LANG_CASE(
3039df58931aSmrg	[C], [
3040df58931aSmrg		CWARNFLAGS="$BASE_CFLAGS"
3041df58931aSmrg		if  test "x$GCC" = xyes ; then
3042df58931aSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3043df58931aSmrg		fi
3044df58931aSmrg		AC_SUBST(CWARNFLAGS)
3045df58931aSmrg	]
3046df58931aSmrg)
3047b66d1acbSmrg]) # XORG_CWARNFLAGS
3048b66d1acbSmrg
3049b66d1acbSmrg# XORG_STRICT_OPTION
3050b66d1acbSmrg# -----------------------
3051b66d1acbSmrg# Minimum version: 1.3.0
3052b66d1acbSmrg#
3053df58931aSmrg# Add configure option to enable strict compilation flags, such as treating
3054df58931aSmrg# warnings as fatal errors.
3055df58931aSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3056df58931aSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3057df58931aSmrg#
3058df58931aSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3059df58931aSmrg# when strict compilation is unconditionally desired.
3060b66d1acbSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3061b66d1acbSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3062df58931aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3063b66d1acbSmrg
3064b66d1acbSmrgAC_ARG_ENABLE(strict-compilation,
3065b66d1acbSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3066b66d1acbSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3067b66d1acbSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3068df58931aSmrg
3069df58931aSmrgAC_LANG_CASE(
3070df58931aSmrg        [C], [
3071df58931aSmrg                define([PREFIX], [C])
3072df58931aSmrg        ],
3073df58931aSmrg        [C++], [
3074df58931aSmrg                define([PREFIX], [CXX])
3075df58931aSmrg        ]
3076df58931aSmrg)
3077df58931aSmrg
3078df58931aSmrg[STRICT_]PREFIX[FLAGS]=""
3079df58931aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3080df58931aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3081df58931aSmrg
3082df58931aSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3083df58931aSmrg# activate it with -Werror, so we add it here explicitly.
3084df58931aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3085df58931aSmrg
3086b66d1acbSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3087df58931aSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3088df58931aSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3089b66d1acbSmrgfi
3090df58931aSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3091df58931aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3092df58931aSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3093b66d1acbSmrg]) # XORG_STRICT_OPTION
3094b66d1acbSmrg
3095b66d1acbSmrg# XORG_DEFAULT_OPTIONS
3096b66d1acbSmrg# --------------------
3097b66d1acbSmrg# Minimum version: 1.3.0
3098b66d1acbSmrg#
3099b66d1acbSmrg# Defines default options for X.Org modules.
3100b66d1acbSmrg#
3101b66d1acbSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3102df58931aSmrgAC_REQUIRE([AC_PROG_INSTALL])
3103df58931aSmrgXORG_COMPILER_FLAGS
3104b66d1acbSmrgXORG_CWARNFLAGS
3105b66d1acbSmrgXORG_STRICT_OPTION
3106b66d1acbSmrgXORG_RELEASE_VERSION
3107b66d1acbSmrgXORG_CHANGELOG
3108df58931aSmrgXORG_INSTALL
3109b66d1acbSmrgXORG_MANPAGE_SECTIONS
3110df58931aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3111df58931aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3112b66d1acbSmrg]) # XORG_DEFAULT_OPTIONS
3113df58931aSmrg
3114df58931aSmrg# XORG_INSTALL()
3115df58931aSmrg# ----------------
3116df58931aSmrg# Minimum version: 1.4.0
3117df58931aSmrg#
3118df58931aSmrg# Defines the variable INSTALL_CMD as the command to copy
3119df58931aSmrg# INSTALL from $prefix/share/util-macros.
3120df58931aSmrg#
3121df58931aSmrgAC_DEFUN([XORG_INSTALL], [
3122df58931aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3123df58931aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3124df58931aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3125df58931aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3126df58931aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3127df58931aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3128df58931aSmrgAC_SUBST([INSTALL_CMD])
3129df58931aSmrg]) # XORG_INSTALL
31304fb28925Smrgdnl Copyright 2005 Red Hat, Inc
31314fb28925Smrgdnl
31324fb28925Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31334fb28925Smrgdnl documentation for any purpose is hereby granted without fee, provided that
31344fb28925Smrgdnl the above copyright notice appear in all copies and that both that
31354fb28925Smrgdnl copyright notice and this permission notice appear in supporting
31364fb28925Smrgdnl documentation.
31374fb28925Smrgdnl
31384fb28925Smrgdnl The above copyright notice and this permission notice shall be included
31394fb28925Smrgdnl in all copies or substantial portions of the Software.
31404fb28925Smrgdnl
31414fb28925Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31424fb28925Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31434fb28925Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31444fb28925Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31454fb28925Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31464fb28925Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31474fb28925Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
31484fb28925Smrgdnl
31494fb28925Smrgdnl Except as contained in this notice, the name of the copyright holders shall
31504fb28925Smrgdnl not be used in advertising or otherwise to promote the sale, use or
31514fb28925Smrgdnl other dealings in this Software without prior written authorization
31524fb28925Smrgdnl from the copyright holders.
31534fb28925Smrgdnl
31544fb28925Smrg
31554fb28925Smrg# XORG_RELEASE_VERSION
31564fb28925Smrg# --------------------
3157df58931aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3158df58931aSmrg
31594fb28925SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3160b66d1acbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3161b66d1acbSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3162b66d1acbSmrg		[Major version of this package])
3163b66d1acbSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3164b66d1acbSmrg	if test "x$PVM" = "x"; then
3165b66d1acbSmrg		PVM="0"
3166b66d1acbSmrg	fi
3167b66d1acbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3168b66d1acbSmrg		[$PVM],
3169b66d1acbSmrg		[Minor version of this package])
3170b66d1acbSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3171b66d1acbSmrg	if test "x$PVP" = "x"; then
3172b66d1acbSmrg		PVP="0"
3173b66d1acbSmrg	fi
3174b66d1acbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3175b66d1acbSmrg		[$PVP],
3176b66d1acbSmrg		[Patch version of this package])
31774fb28925Smrg])
31784fb28925Smrg
3179b66d1acbSmrg# XORG_CHANGELOG()
3180b66d1acbSmrg# ----------------
3181b66d1acbSmrg# Minimum version: 1.2.0
3182b66d1acbSmrg#
3183b66d1acbSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3184b66d1acbSmrg# ChangeLog from git.
3185b66d1acbSmrg#
3186b66d1acbSmrg#
3187b66d1acbSmrgAC_DEFUN([XORG_CHANGELOG], [
3188df58931aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3189df58931aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3190df58931aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3191b66d1acbSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3192b66d1acbSmrgAC_SUBST([CHANGELOG_CMD])
3193b66d1acbSmrg]) # XORG_CHANGELOG
3194b66d1acbSmrg
3195