aclocal.m4 revision 663cdc11
1b6f2c9ccSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2ea6ae205Smrg
3ea6ae205Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4e83ac88aSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5ea6ae205Smrg# This file is free software; the Free Software Foundation
6ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
7ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
8ea6ae205Smrg
9ea6ae205Smrg# This program is distributed in the hope that it will be useful,
10ea6ae205Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11ea6ae205Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12ea6ae205Smrg# PARTICULAR PURPOSE.
13ea6ae205Smrg
14e83ac88aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
15e83ac88aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16b6f2c9ccSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17b6f2c9ccSmrg[m4_warning([this file was generated for autoconf 2.68.
18e83ac88aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19e83ac88aSmrgIf you have problems, you may need to regenerate the build system entirely.
20e83ac88aSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21ea6ae205Smrg
22e83ac88aSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23ea6ae205Smrg#
247978d3cdSmrg# This file is free software; the Free Software Foundation
257978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
267978d3cdSmrg# with or without modifications, as long as this notice is preserved.
27ea6ae205Smrg
287978d3cdSmrg# AM_AUTOMAKE_VERSION(VERSION)
297978d3cdSmrg# ----------------------------
307978d3cdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
317978d3cdSmrg# generated from the m4 files accompanying Automake X.Y.
327978d3cdSmrg# (This private macro should not be called outside this file.)
337978d3cdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34e83ac88aSmrg[am__api_version='1.11'
357978d3cdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
367978d3cdSmrgdnl require some minimum version.  Point them to the right macro.
37b6f2c9ccSmrgm4_if([$1], [1.11.1], [],
387978d3cdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
397978d3cdSmrg])
40ea6ae205Smrg
417978d3cdSmrg# _AM_AUTOCONF_VERSION(VERSION)
427978d3cdSmrg# -----------------------------
437978d3cdSmrg# aclocal traces this macro to find the Autoconf version.
447978d3cdSmrg# This is a private macro too.  Using m4_define simplifies
457978d3cdSmrg# the logic in aclocal, which can simply ignore this definition.
467978d3cdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
47ea6ae205Smrg
487978d3cdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
497978d3cdSmrg# -------------------------------
507978d3cdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51e83ac88aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
527978d3cdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53b6f2c9ccSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54e83ac88aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
55e83ac88aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56e83ac88aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57ea6ae205Smrg
587978d3cdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59ea6ae205Smrg
607978d3cdSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
617978d3cdSmrg#
627978d3cdSmrg# This file is free software; the Free Software Foundation
637978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
647978d3cdSmrg# with or without modifications, as long as this notice is preserved.
65ea6ae205Smrg
667978d3cdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
677978d3cdSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
687978d3cdSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
697978d3cdSmrg#
707978d3cdSmrg# Of course, Automake must honor this variable whenever it calls a
717978d3cdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
727978d3cdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
737978d3cdSmrg# depending on how configure is run.  This is pretty annoying, since
747978d3cdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
757978d3cdSmrg# source directory, any form will work fine, but in subdirectories a
767978d3cdSmrg# relative path needs to be adjusted first.
77ea6ae205Smrg#
787978d3cdSmrg# $ac_aux_dir/missing
797978d3cdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
807978d3cdSmrg# $top_srcdir/$ac_aux_dir/missing
817978d3cdSmrg#    fails if $ac_aux_dir is absolute,
827978d3cdSmrg#    fails when called from a subdirectory in a VPATH build with
837978d3cdSmrg#          a relative $ac_aux_dir
84ea6ae205Smrg#
857978d3cdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
867978d3cdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
877978d3cdSmrg# harmless because $srcdir is `.', but things will broke when you
887978d3cdSmrg# start a VPATH build or use an absolute $srcdir.
89ea6ae205Smrg#
907978d3cdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
917978d3cdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
927978d3cdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
937978d3cdSmrg# and then we would define $MISSING as
947978d3cdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
957978d3cdSmrg# This will work as long as MISSING is not called from configure, because
967978d3cdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
977978d3cdSmrg# However there are other variables, like CC, which are often used in
987978d3cdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99ea6ae205Smrg#
1007978d3cdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1017978d3cdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1027978d3cdSmrg# configured tree to be moved without reconfiguration.
103ea6ae205Smrg
1047978d3cdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1057978d3cdSmrg[dnl Rely on autoconf to set up CDPATH properly.
1067978d3cdSmrgAC_PREREQ([2.50])dnl
1077978d3cdSmrg# expand $ac_aux_dir to an absolute path
1087978d3cdSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1097978d3cdSmrg])
110ea6ae205Smrg
1117978d3cdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112ea6ae205Smrg
113e83ac88aSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1147978d3cdSmrg# Free Software Foundation, Inc.
1157978d3cdSmrg#
1167978d3cdSmrg# This file is free software; the Free Software Foundation
1177978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
1187978d3cdSmrg# with or without modifications, as long as this notice is preserved.
119ea6ae205Smrg
120e83ac88aSmrg# serial 9
121ea6ae205Smrg
1227978d3cdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1237978d3cdSmrg# -------------------------------------
1247978d3cdSmrg# Define a conditional.
1257978d3cdSmrgAC_DEFUN([AM_CONDITIONAL],
1267978d3cdSmrg[AC_PREREQ(2.52)dnl
1277978d3cdSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1287978d3cdSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1297978d3cdSmrgAC_SUBST([$1_TRUE])dnl
1307978d3cdSmrgAC_SUBST([$1_FALSE])dnl
1317978d3cdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1327978d3cdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133e83ac88aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1347978d3cdSmrgif $2; then
1357978d3cdSmrg  $1_TRUE=
1367978d3cdSmrg  $1_FALSE='#'
1377978d3cdSmrgelse
1387978d3cdSmrg  $1_TRUE='#'
1397978d3cdSmrg  $1_FALSE=
1407978d3cdSmrgfi
1417978d3cdSmrgAC_CONFIG_COMMANDS_PRE(
1427978d3cdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1437978d3cdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1447978d3cdSmrgUsually this means the macro was only invoked conditionally.]])
1457978d3cdSmrgfi])])
146ea6ae205Smrg
147e83ac88aSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
1487978d3cdSmrg# Free Software Foundation, Inc.
1497978d3cdSmrg#
1507978d3cdSmrg# This file is free software; the Free Software Foundation
1517978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
1527978d3cdSmrg# with or without modifications, as long as this notice is preserved.
153ea6ae205Smrg
154e83ac88aSmrg# serial 10
155ea6ae205Smrg
1567978d3cdSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1577978d3cdSmrg# written in clear, in which case automake, when reading aclocal.m4,
1587978d3cdSmrg# will think it sees a *use*, and therefore will trigger all it's
1597978d3cdSmrg# C support machinery.  Also note that it means that autoscan, seeing
1607978d3cdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161ea6ae205Smrg
162ea6ae205Smrg
1637978d3cdSmrg# _AM_DEPENDENCIES(NAME)
1647978d3cdSmrg# ----------------------
1657978d3cdSmrg# See how the compiler implements dependency checking.
1667978d3cdSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1677978d3cdSmrg# We try a few techniques and use that to set a single cache variable.
1687978d3cdSmrg#
1697978d3cdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1707978d3cdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1717978d3cdSmrg# dependency, and given that the user is not expected to run this macro,
1727978d3cdSmrg# just rely on AC_PROG_CC.
1737978d3cdSmrgAC_DEFUN([_AM_DEPENDENCIES],
1747978d3cdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1757978d3cdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1767978d3cdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1777978d3cdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178ea6ae205Smrg
1797978d3cdSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1807978d3cdSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1817978d3cdSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1827978d3cdSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1837978d3cdSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1847978d3cdSmrg                   [depcc="$$1"   am_compiler_list=])
185ea6ae205Smrg
1867978d3cdSmrgAC_CACHE_CHECK([dependency style of $depcc],
1877978d3cdSmrg               [am_cv_$1_dependencies_compiler_type],
1887978d3cdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1897978d3cdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1907978d3cdSmrg  # making bogus files that we don't know about and never remove.  For
1917978d3cdSmrg  # instance it was reported that on HP-UX the gcc test will end up
1927978d3cdSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
1937978d3cdSmrg  # in D'.
1947978d3cdSmrg  mkdir conftest.dir
1957978d3cdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1967978d3cdSmrg  # using a relative directory.
1977978d3cdSmrg  cp "$am_depcomp" conftest.dir
1987978d3cdSmrg  cd conftest.dir
1997978d3cdSmrg  # We will build objects and dependencies in a subdirectory because
2007978d3cdSmrg  # it helps to detect inapplicable dependency modes.  For instance
2017978d3cdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2027978d3cdSmrg  # side effect of compilation, but ICC will put the dependencies in
2037978d3cdSmrg  # the current directory while Tru64 will put them in the object
2047978d3cdSmrg  # directory.
2057978d3cdSmrg  mkdir sub
206ea6ae205Smrg
2077978d3cdSmrg  am_cv_$1_dependencies_compiler_type=none
2087978d3cdSmrg  if test "$am_compiler_list" = ""; then
2097978d3cdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2107978d3cdSmrg  fi
211e83ac88aSmrg  am__universal=false
212e83ac88aSmrg  m4_case([$1], [CC],
213e83ac88aSmrg    [case " $depcc " in #(
214e83ac88aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215e83ac88aSmrg     esac],
216e83ac88aSmrg    [CXX],
217e83ac88aSmrg    [case " $depcc " in #(
218e83ac88aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219e83ac88aSmrg     esac])
220e83ac88aSmrg
2217978d3cdSmrg  for depmode in $am_compiler_list; do
2227978d3cdSmrg    # Setup a source with many dependencies, because some compilers
2237978d3cdSmrg    # like to wrap large dependency lists on column 80 (with \), and
2247978d3cdSmrg    # we should not choose a depcomp mode which is confused by this.
2257978d3cdSmrg    #
2267978d3cdSmrg    # We need to recreate these files for each test, as the compiler may
2277978d3cdSmrg    # overwrite some of them when testing with obscure command lines.
2287978d3cdSmrg    # This happens at least with the AIX C compiler.
2297978d3cdSmrg    : > sub/conftest.c
2307978d3cdSmrg    for i in 1 2 3 4 5 6; do
2317978d3cdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2327978d3cdSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2337978d3cdSmrg      # Solaris 8's {/usr,}/bin/sh.
2347978d3cdSmrg      touch sub/conftst$i.h
2357978d3cdSmrg    done
2367978d3cdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237ea6ae205Smrg
238e83ac88aSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239e83ac88aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240e83ac88aSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241e83ac88aSmrg    # versions had trouble with output in subdirs
242e83ac88aSmrg    am__obj=sub/conftest.${OBJEXT-o}
243e83ac88aSmrg    am__minus_obj="-o $am__obj"
2447978d3cdSmrg    case $depmode in
245e83ac88aSmrg    gcc)
246e83ac88aSmrg      # This depmode causes a compiler race in universal mode.
247e83ac88aSmrg      test "$am__universal" = false || continue
248e83ac88aSmrg      ;;
2497978d3cdSmrg    nosideeffect)
2507978d3cdSmrg      # after this tag, mechanisms are not by side-effect, so they'll
2517978d3cdSmrg      # only be used when explicitly requested
2527978d3cdSmrg      if test "x$enable_dependency_tracking" = xyes; then
2537978d3cdSmrg	continue
2547978d3cdSmrg      else
2557978d3cdSmrg	break
2567978d3cdSmrg      fi
2577978d3cdSmrg      ;;
258e83ac88aSmrg    msvisualcpp | msvcmsys)
259e83ac88aSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
260e83ac88aSmrg      # not run yet.  These depmodes are late enough in the game, and
261e83ac88aSmrg      # so weak that their functioning should not be impacted.
262e83ac88aSmrg      am__obj=conftest.${OBJEXT-o}
263e83ac88aSmrg      am__minus_obj=
264e83ac88aSmrg      ;;
2657978d3cdSmrg    none) break ;;
266ea6ae205Smrg    esac
2677978d3cdSmrg    if depmode=$depmode \
268e83ac88aSmrg       source=sub/conftest.c object=$am__obj \
2697978d3cdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270e83ac88aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2717978d3cdSmrg         >/dev/null 2>conftest.err &&
2727978d3cdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2737978d3cdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274e83ac88aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2757978d3cdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2767978d3cdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2777978d3cdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2787978d3cdSmrg      # that says an option was ignored or not supported.
2797978d3cdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2807978d3cdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2817978d3cdSmrg      # The diagnosis changed in icc 8.0:
2827978d3cdSmrg      #   icc: Command line remark: option '-MP' not supported
2837978d3cdSmrg      if (grep 'ignoring option' conftest.err ||
2847978d3cdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2857978d3cdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2867978d3cdSmrg        break
2877978d3cdSmrg      fi
2887978d3cdSmrg    fi
2897978d3cdSmrg  done
290ea6ae205Smrg
2917978d3cdSmrg  cd ..
2927978d3cdSmrg  rm -rf conftest.dir
2937978d3cdSmrgelse
2947978d3cdSmrg  am_cv_$1_dependencies_compiler_type=none
295ea6ae205Smrgfi
2967978d3cdSmrg])
2977978d3cdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2987978d3cdSmrgAM_CONDITIONAL([am__fastdep$1], [
2997978d3cdSmrg  test "x$enable_dependency_tracking" != xno \
3007978d3cdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3017978d3cdSmrg])
302ea6ae205Smrg
303ea6ae205Smrg
3047978d3cdSmrg# AM_SET_DEPDIR
3057978d3cdSmrg# -------------
3067978d3cdSmrg# Choose a directory name for dependency files.
3077978d3cdSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3087978d3cdSmrgAC_DEFUN([AM_SET_DEPDIR],
3097978d3cdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3107978d3cdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3117978d3cdSmrg])
312ea6ae205Smrg
313ea6ae205Smrg
3147978d3cdSmrg# AM_DEP_TRACK
3157978d3cdSmrg# ------------
3167978d3cdSmrgAC_DEFUN([AM_DEP_TRACK],
3177978d3cdSmrg[AC_ARG_ENABLE(dependency-tracking,
3187978d3cdSmrg[  --disable-dependency-tracking  speeds up one-time build
3197978d3cdSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3207978d3cdSmrgif test "x$enable_dependency_tracking" != xno; then
3217978d3cdSmrg  am_depcomp="$ac_aux_dir/depcomp"
3227978d3cdSmrg  AMDEPBACKSLASH='\'
323ea6ae205Smrgfi
3247978d3cdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3257978d3cdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3267978d3cdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3277978d3cdSmrg])
328ea6ae205Smrg
3297978d3cdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330ea6ae205Smrg
331e83ac88aSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
3327978d3cdSmrg# Free Software Foundation, Inc.
3337978d3cdSmrg#
3347978d3cdSmrg# This file is free software; the Free Software Foundation
3357978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
3367978d3cdSmrg# with or without modifications, as long as this notice is preserved.
337ea6ae205Smrg
338e83ac88aSmrg#serial 5
339ea6ae205Smrg
3407978d3cdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3417978d3cdSmrg# ------------------------------
3427978d3cdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343e83ac88aSmrg[{
344e83ac88aSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345e83ac88aSmrg  # are listed without --file.  Let's play safe and only enable the eval
346e83ac88aSmrg  # if we detect the quoting.
347e83ac88aSmrg  case $CONFIG_FILES in
348e83ac88aSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
349e83ac88aSmrg  *)   set x $CONFIG_FILES ;;
350e83ac88aSmrg  esac
351e83ac88aSmrg  shift
352e83ac88aSmrg  for mf
353e83ac88aSmrg  do
354e83ac88aSmrg    # Strip MF so we end up with the name of the file.
355e83ac88aSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356e83ac88aSmrg    # Check whether this is an Automake generated Makefile or not.
357e83ac88aSmrg    # We used to match only the files named `Makefile.in', but
358e83ac88aSmrg    # some people rename them; so instead we look at the file content.
359e83ac88aSmrg    # Grep'ing the first line is not enough: some people post-process
360e83ac88aSmrg    # each Makefile.in and add a new line on top of each file to say so.
361e83ac88aSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
362e83ac88aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
363e83ac88aSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364e83ac88aSmrg      dirpart=`AS_DIRNAME("$mf")`
365e83ac88aSmrg    else
366e83ac88aSmrg      continue
367e83ac88aSmrg    fi
368e83ac88aSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
369e83ac88aSmrg    # from the Makefile without running `make'.
370e83ac88aSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371e83ac88aSmrg    test -z "$DEPDIR" && continue
372e83ac88aSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373e83ac88aSmrg    test -z "am__include" && continue
374e83ac88aSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375e83ac88aSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
376e83ac88aSmrg    U=`sed -n 's/^U = //p' < "$mf"`
377e83ac88aSmrg    # Find all dependency output files, they are included files with
378e83ac88aSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379e83ac88aSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380e83ac88aSmrg    # expansion.
381e83ac88aSmrg    for file in `sed -n "
382e83ac88aSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383e83ac88aSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384e83ac88aSmrg      # Make sure the directory exists.
385e83ac88aSmrg      test -f "$dirpart/$file" && continue
386e83ac88aSmrg      fdir=`AS_DIRNAME(["$file"])`
387e83ac88aSmrg      AS_MKDIR_P([$dirpart/$fdir])
388e83ac88aSmrg      # echo "creating $dirpart/$file"
389e83ac88aSmrg      echo '# dummy' > "$dirpart/$file"
390e83ac88aSmrg    done
3917978d3cdSmrg  done
392e83ac88aSmrg}
3937978d3cdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394ea6ae205Smrg
395ea6ae205Smrg
3967978d3cdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3977978d3cdSmrg# -----------------------------
3987978d3cdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3997978d3cdSmrg#
4007978d3cdSmrg# This code is only required when automatic dependency tracking
4017978d3cdSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
4027978d3cdSmrg# need in order to bootstrap the dependency handling code.
4037978d3cdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4047978d3cdSmrg[AC_CONFIG_COMMANDS([depfiles],
4057978d3cdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4067978d3cdSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4077978d3cdSmrg])
408ea6ae205Smrg
4097978d3cdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
410ea6ae205Smrg
4117978d3cdSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412e83ac88aSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
413ea6ae205Smrg#
4147978d3cdSmrg# This file is free software; the Free Software Foundation
4157978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
4167978d3cdSmrg# with or without modifications, as long as this notice is preserved.
417ea6ae205Smrg
418e83ac88aSmrg# serial 16
419ea6ae205Smrg
4207978d3cdSmrg# This macro actually does too much.  Some checks are only needed if
4217978d3cdSmrg# your package does certain things.  But this isn't really a big deal.
422ea6ae205Smrg
4237978d3cdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4247978d3cdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4257978d3cdSmrg# -----------------------------------------------
4267978d3cdSmrg# The call with PACKAGE and VERSION arguments is the old style
4277978d3cdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4287978d3cdSmrg# and VERSION should now be passed to AC_INIT and removed from
4297978d3cdSmrg# the call to AM_INIT_AUTOMAKE.
4307978d3cdSmrg# We support both call styles for the transition.  After
4317978d3cdSmrg# the next Automake release, Autoconf can make the AC_INIT
4327978d3cdSmrg# arguments mandatory, and then we can depend on a new Autoconf
4337978d3cdSmrg# release and drop the old call support.
4347978d3cdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435e83ac88aSmrg[AC_PREREQ([2.62])dnl
4367978d3cdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4377978d3cdSmrgdnl the ones we care about.
4387978d3cdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4397978d3cdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4407978d3cdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4417978d3cdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4427978d3cdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4437978d3cdSmrg  # is not polluted with repeated "-I."
4447978d3cdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4457978d3cdSmrg  # test to see if srcdir already configured
4467978d3cdSmrg  if test -f $srcdir/config.status; then
4477978d3cdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4487978d3cdSmrg  fi
449ea6ae205Smrgfi
450ea6ae205Smrg
4517978d3cdSmrg# test whether we have cygpath
4527978d3cdSmrgif test -z "$CYGPATH_W"; then
4537978d3cdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4547978d3cdSmrg    CYGPATH_W='cygpath -w'
4557978d3cdSmrg  else
4567978d3cdSmrg    CYGPATH_W=echo
4577978d3cdSmrg  fi
458ea6ae205Smrgfi
4597978d3cdSmrgAC_SUBST([CYGPATH_W])
460ea6ae205Smrg
4617978d3cdSmrg# Define the identity of the package.
4627978d3cdSmrgdnl Distinguish between old-style and new-style calls.
4637978d3cdSmrgm4_ifval([$2],
4647978d3cdSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4657978d3cdSmrg AC_SUBST([PACKAGE], [$1])dnl
4667978d3cdSmrg AC_SUBST([VERSION], [$2])],
4677978d3cdSmrg[_AM_SET_OPTIONS([$1])dnl
4687978d3cdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4697978d3cdSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4707978d3cdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4717978d3cdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4727978d3cdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473ea6ae205Smrg
4747978d3cdSmrg_AM_IF_OPTION([no-define],,
4757978d3cdSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4767978d3cdSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477ea6ae205Smrg
4787978d3cdSmrg# Some tools Automake needs.
4797978d3cdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4807978d3cdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4817978d3cdSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4827978d3cdSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4837978d3cdSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4847978d3cdSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4857978d3cdSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486e83ac88aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487e83ac88aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4887978d3cdSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4897978d3cdSmrg# We need awk for the "check" target.  The system "awk" is bad on
4907978d3cdSmrg# some platforms.
4917978d3cdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
4927978d3cdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
4937978d3cdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
4947978d3cdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495e83ac88aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496e83ac88aSmrg			     [_AM_PROG_TAR([v7])])])
4977978d3cdSmrg_AM_IF_OPTION([no-dependencies],,
4987978d3cdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499e83ac88aSmrg		  [_AM_DEPENDENCIES(CC)],
500e83ac88aSmrg		  [define([AC_PROG_CC],
501e83ac88aSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5027978d3cdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503e83ac88aSmrg		  [_AM_DEPENDENCIES(CXX)],
504e83ac88aSmrg		  [define([AC_PROG_CXX],
505e83ac88aSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5067978d3cdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507e83ac88aSmrg		  [_AM_DEPENDENCIES(OBJC)],
508e83ac88aSmrg		  [define([AC_PROG_OBJC],
509e83ac88aSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
5107978d3cdSmrg])
511e83ac88aSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512e83ac88aSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513e83ac88aSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514e83ac88aSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515e83ac88aSmrgAC_CONFIG_COMMANDS_PRE(dnl
516e83ac88aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517e83ac88aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5187978d3cdSmrg])
5197978d3cdSmrg
520e83ac88aSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521e83ac88aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522e83ac88aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
523e83ac88aSmrgm4_define([_AC_COMPILER_EXEEXT],
524e83ac88aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525e83ac88aSmrg
5267978d3cdSmrg
5277978d3cdSmrg# When config.status generates a header, we must update the stamp-h file.
5287978d3cdSmrg# This file resides in the same directory as the config header
5297978d3cdSmrg# that is generated.  The stamp files are numbered to have different names.
5307978d3cdSmrg
5317978d3cdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5327978d3cdSmrg# loop where config.status creates the headers, so we can generate
5337978d3cdSmrg# our stamp files there.
5347978d3cdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5357978d3cdSmrg[# Compute $1's index in $config_headers.
536e83ac88aSmrg_am_arg=$1
5377978d3cdSmrg_am_stamp_count=1
5387978d3cdSmrgfor _am_header in $config_headers :; do
5397978d3cdSmrg  case $_am_header in
540e83ac88aSmrg    $_am_arg | $_am_arg:* )
5417978d3cdSmrg      break ;;
5427978d3cdSmrg    * )
5437978d3cdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5447978d3cdSmrg  esac
5457978d3cdSmrgdone
546e83ac88aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5477978d3cdSmrg
548e83ac88aSmrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
5497978d3cdSmrg#
5507978d3cdSmrg# This file is free software; the Free Software Foundation
5517978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
5527978d3cdSmrg# with or without modifications, as long as this notice is preserved.
553ea6ae205Smrg
5547978d3cdSmrg# AM_PROG_INSTALL_SH
5557978d3cdSmrg# ------------------
5567978d3cdSmrg# Define $install_sh.
5577978d3cdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5587978d3cdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559e83ac88aSmrgif test x"${install_sh}" != xset; then
560e83ac88aSmrg  case $am_aux_dir in
561e83ac88aSmrg  *\ * | *\	*)
562e83ac88aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563e83ac88aSmrg  *)
564e83ac88aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565e83ac88aSmrg  esac
566e83ac88aSmrgfi
5677978d3cdSmrgAC_SUBST(install_sh)])
568ea6ae205Smrg
5697978d3cdSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
570ea6ae205Smrg#
5717978d3cdSmrg# This file is free software; the Free Software Foundation
5727978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
5737978d3cdSmrg# with or without modifications, as long as this notice is preserved.
574ea6ae205Smrg
5757978d3cdSmrg# serial 2
576ea6ae205Smrg
5777978d3cdSmrg# Check whether the underlying file-system supports filenames
5787978d3cdSmrg# with a leading dot.  For instance MS-DOS doesn't.
5797978d3cdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
5807978d3cdSmrg[rm -rf .tst 2>/dev/null
5817978d3cdSmrgmkdir .tst 2>/dev/null
5827978d3cdSmrgif test -d .tst; then
5837978d3cdSmrg  am__leading_dot=.
584ea6ae205Smrgelse
5857978d3cdSmrg  am__leading_dot=_
586ea6ae205Smrgfi
5877978d3cdSmrgrmdir .tst 2>/dev/null
5887978d3cdSmrgAC_SUBST([am__leading_dot])])
589ea6ae205Smrg
5907978d3cdSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
5917978d3cdSmrg# From Jim Meyering
592ea6ae205Smrg
593e83ac88aSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
5947978d3cdSmrg# Free Software Foundation, Inc.
595ea6ae205Smrg#
5967978d3cdSmrg# This file is free software; the Free Software Foundation
5977978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
5987978d3cdSmrg# with or without modifications, as long as this notice is preserved.
599ea6ae205Smrg
600e83ac88aSmrg# serial 5
601ea6ae205Smrg
602e83ac88aSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603e83ac88aSmrg# ----------------------------------
604e83ac88aSmrg# Control maintainer-specific portions of Makefiles.
605e83ac88aSmrg# Default is to disable them, unless `enable' is passed literally.
606e83ac88aSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607e83ac88aSmrg# can override the default with the --enable/--disable switch.
6087978d3cdSmrgAC_DEFUN([AM_MAINTAINER_MODE],
609e83ac88aSmrg[m4_case(m4_default([$1], [disable]),
610e83ac88aSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
611e83ac88aSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
612e83ac88aSmrg       [m4_define([am_maintainer_other], [enable])
613e83ac88aSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614e83ac88aSmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615e83ac88aSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616e83ac88aSmrg  AC_ARG_ENABLE([maintainer-mode],
617e83ac88aSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
6187978d3cdSmrg			  (and sometimes confusing) to the casual installer],
619e83ac88aSmrg      [USE_MAINTAINER_MODE=$enableval],
620e83ac88aSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6217978d3cdSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622e83ac88aSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6237978d3cdSmrg  MAINT=$MAINTAINER_MODE_TRUE
624e83ac88aSmrg  AC_SUBST([MAINT])dnl
6257978d3cdSmrg]
6267978d3cdSmrg)
627ea6ae205Smrg
6287978d3cdSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629ea6ae205Smrg
6307978d3cdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631ea6ae205Smrg
632e83ac88aSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6337978d3cdSmrg#
6347978d3cdSmrg# This file is free software; the Free Software Foundation
6357978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
6367978d3cdSmrg# with or without modifications, as long as this notice is preserved.
637ea6ae205Smrg
638e83ac88aSmrg# serial 4
639ea6ae205Smrg
6407978d3cdSmrg# AM_MAKE_INCLUDE()
6417978d3cdSmrg# -----------------
6427978d3cdSmrg# Check to see how make treats includes.
6437978d3cdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6447978d3cdSmrg[am_make=${MAKE-make}
6457978d3cdSmrgcat > confinc << 'END'
6467978d3cdSmrgam__doit:
647e83ac88aSmrg	@echo this is the am__doit target
6487978d3cdSmrg.PHONY: am__doit
6497978d3cdSmrgEND
6507978d3cdSmrg# If we don't find an include directive, just comment out the code.
6517978d3cdSmrgAC_MSG_CHECKING([for style of include used by $am_make])
6527978d3cdSmrgam__include="#"
6537978d3cdSmrgam__quote=
6547978d3cdSmrg_am_result=none
6557978d3cdSmrg# First try GNU make style include.
6567978d3cdSmrgecho "include confinc" > confmf
657e83ac88aSmrg# Ignore all kinds of additional output from `make'.
658e83ac88aSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659e83ac88aSmrg*the\ am__doit\ target*)
660e83ac88aSmrg  am__include=include
661e83ac88aSmrg  am__quote=
662e83ac88aSmrg  _am_result=GNU
663e83ac88aSmrg  ;;
664e83ac88aSmrgesac
6657978d3cdSmrg# Now try BSD make style include.
6667978d3cdSmrgif test "$am__include" = "#"; then
6677978d3cdSmrg   echo '.include "confinc"' > confmf
668e83ac88aSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669e83ac88aSmrg   *the\ am__doit\ target*)
670e83ac88aSmrg     am__include=.include
671e83ac88aSmrg     am__quote="\""
672e83ac88aSmrg     _am_result=BSD
673e83ac88aSmrg     ;;
674e83ac88aSmrg   esac
6757978d3cdSmrgfi
6767978d3cdSmrgAC_SUBST([am__include])
6777978d3cdSmrgAC_SUBST([am__quote])
6787978d3cdSmrgAC_MSG_RESULT([$_am_result])
6797978d3cdSmrgrm -f confinc confmf
680ea6ae205Smrg])
681ea6ae205Smrg
6827978d3cdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6837978d3cdSmrg
684e83ac88aSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
6857978d3cdSmrg# Free Software Foundation, Inc.
686ea6ae205Smrg#
687ea6ae205Smrg# This file is free software; the Free Software Foundation
688ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
689ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
690ea6ae205Smrg
691e83ac88aSmrg# serial 6
692ea6ae205Smrg
6937978d3cdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
6947978d3cdSmrg# ------------------------------
6957978d3cdSmrgAC_DEFUN([AM_MISSING_PROG],
6967978d3cdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6977978d3cdSmrg$1=${$1-"${am_missing_run}$2"}
6987978d3cdSmrgAC_SUBST($1)])
699ea6ae205Smrg
700ea6ae205Smrg
7017978d3cdSmrg# AM_MISSING_HAS_RUN
7027978d3cdSmrg# ------------------
7037978d3cdSmrg# Define MISSING if not defined so far and test if it supports --run.
7047978d3cdSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
7057978d3cdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7067978d3cdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7077978d3cdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
708e83ac88aSmrgif test x"${MISSING+set}" != xset; then
709e83ac88aSmrg  case $am_aux_dir in
710e83ac88aSmrg  *\ * | *\	*)
711e83ac88aSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712e83ac88aSmrg  *)
713e83ac88aSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714e83ac88aSmrg  esac
715e83ac88aSmrgfi
7167978d3cdSmrg# Use eval to expand $SHELL
7177978d3cdSmrgif eval "$MISSING --run true"; then
7187978d3cdSmrg  am_missing_run="$MISSING --run "
7197978d3cdSmrgelse
7207978d3cdSmrg  am_missing_run=
7217978d3cdSmrg  AC_MSG_WARN([`missing' script is too old or missing])
7227978d3cdSmrgfi
7237978d3cdSmrg])
724ea6ae205Smrg
7257978d3cdSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726ea6ae205Smrg#
727ea6ae205Smrg# This file is free software; the Free Software Foundation
728ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
729ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
730ea6ae205Smrg
7317978d3cdSmrg# AM_PROG_MKDIR_P
7327978d3cdSmrg# ---------------
7337978d3cdSmrg# Check for `mkdir -p'.
7347978d3cdSmrgAC_DEFUN([AM_PROG_MKDIR_P],
7357978d3cdSmrg[AC_PREREQ([2.60])dnl
7367978d3cdSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7377978d3cdSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7387978d3cdSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
7397978d3cdSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7407978d3cdSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7417978d3cdSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7427978d3cdSmrgdnl adjustment using top_builddir (which is defined more often than
7437978d3cdSmrgdnl MKDIR_P).
7447978d3cdSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7457978d3cdSmrgcase $mkdir_p in
7467978d3cdSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7477978d3cdSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7487978d3cdSmrgesac
749ea6ae205Smrg])
750ea6ae205Smrg
7517978d3cdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
752ea6ae205Smrg
753e83ac88aSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754ea6ae205Smrg#
755ea6ae205Smrg# This file is free software; the Free Software Foundation
756ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
757ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
758ea6ae205Smrg
759e83ac88aSmrg# serial 4
760ea6ae205Smrg
7617978d3cdSmrg# _AM_MANGLE_OPTION(NAME)
7627978d3cdSmrg# -----------------------
7637978d3cdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7647978d3cdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
765ea6ae205Smrg
7667978d3cdSmrg# _AM_SET_OPTION(NAME)
7677978d3cdSmrg# ------------------------------
7687978d3cdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7697978d3cdSmrgAC_DEFUN([_AM_SET_OPTION],
7707978d3cdSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
771ea6ae205Smrg
7727978d3cdSmrg# _AM_SET_OPTIONS(OPTIONS)
7737978d3cdSmrg# ----------------------------------
7747978d3cdSmrg# OPTIONS is a space-separated list of Automake options.
7757978d3cdSmrgAC_DEFUN([_AM_SET_OPTIONS],
776e83ac88aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
777ea6ae205Smrg
7787978d3cdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7797978d3cdSmrg# -------------------------------------------
7807978d3cdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7817978d3cdSmrgAC_DEFUN([_AM_IF_OPTION],
7827978d3cdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
783ea6ae205Smrg
7847978d3cdSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
785ea6ae205Smrg
786e83ac88aSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
7877978d3cdSmrg# Free Software Foundation, Inc.
788ea6ae205Smrg#
7897978d3cdSmrg# This file is free software; the Free Software Foundation
7907978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
7917978d3cdSmrg# with or without modifications, as long as this notice is preserved.
792ea6ae205Smrg
793e83ac88aSmrg# serial 5
794ea6ae205Smrg
7957978d3cdSmrg# AM_SANITY_CHECK
7967978d3cdSmrg# ---------------
7977978d3cdSmrgAC_DEFUN([AM_SANITY_CHECK],
7987978d3cdSmrg[AC_MSG_CHECKING([whether build environment is sane])
7997978d3cdSmrg# Just in case
8007978d3cdSmrgsleep 1
8017978d3cdSmrgecho timestamp > conftest.file
802e83ac88aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
803e83ac88aSmrg# name.  Accept space and tab only in the latter.
804e83ac88aSmrgam_lf='
805e83ac88aSmrg'
806e83ac88aSmrgcase `pwd` in
807e83ac88aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808e83ac88aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809e83ac88aSmrgesac
810e83ac88aSmrgcase $srcdir in
811e83ac88aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812e83ac88aSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813e83ac88aSmrgesac
814e83ac88aSmrg
8157978d3cdSmrg# Do `set' in a subshell so we don't clobber the current shell's
8167978d3cdSmrg# arguments.  Must try -L first in case configure is actually a
8177978d3cdSmrg# symlink; some systems play weird games with the mod time of symlinks
8187978d3cdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8197978d3cdSmrg# directory).
8207978d3cdSmrgif (
821e83ac88aSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8227978d3cdSmrg   if test "$[*]" = "X"; then
8237978d3cdSmrg      # -L didn't work.
824e83ac88aSmrg      set X `ls -t "$srcdir/configure" conftest.file`
8257978d3cdSmrg   fi
8267978d3cdSmrg   rm -f conftest.file
8277978d3cdSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
8287978d3cdSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
829ea6ae205Smrg
8307978d3cdSmrg      # If neither matched, then we have a broken ls.  This can happen
8317978d3cdSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
8327978d3cdSmrg      # broken ls alias from the environment.  This has actually
8337978d3cdSmrg      # happened.  Such a system could not be considered "sane".
8347978d3cdSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8357978d3cdSmrgalias in your environment])
8367978d3cdSmrg   fi
837ea6ae205Smrg
8387978d3cdSmrg   test "$[2]" = conftest.file
8397978d3cdSmrg   )
8407978d3cdSmrgthen
8417978d3cdSmrg   # Ok.
8427978d3cdSmrg   :
843ea6ae205Smrgelse
8447978d3cdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8457978d3cdSmrgCheck your system clock])
846ea6ae205Smrgfi
8477978d3cdSmrgAC_MSG_RESULT(yes)])
848ea6ae205Smrg
849e83ac88aSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
850e83ac88aSmrg#
851e83ac88aSmrg# This file is free software; the Free Software Foundation
852e83ac88aSmrg# gives unlimited permission to copy and/or distribute it,
853e83ac88aSmrg# with or without modifications, as long as this notice is preserved.
854e83ac88aSmrg
855e83ac88aSmrg# serial 1
856e83ac88aSmrg
857e83ac88aSmrg# AM_SILENT_RULES([DEFAULT])
858e83ac88aSmrg# --------------------------
859e83ac88aSmrg# Enable less verbose build rules; with the default set to DEFAULT
860e83ac88aSmrg# (`yes' being less verbose, `no' or empty being verbose).
861e83ac88aSmrgAC_DEFUN([AM_SILENT_RULES],
862e83ac88aSmrg[AC_ARG_ENABLE([silent-rules],
863e83ac88aSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864e83ac88aSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865e83ac88aSmrgcase $enable_silent_rules in
866e83ac88aSmrgyes) AM_DEFAULT_VERBOSITY=0;;
867e83ac88aSmrgno)  AM_DEFAULT_VERBOSITY=1;;
868e83ac88aSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
869e83ac88aSmrgesac
870e83ac88aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871e83ac88aSmrgAM_BACKSLASH='\'
872e83ac88aSmrgAC_SUBST([AM_BACKSLASH])dnl
873e83ac88aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874e83ac88aSmrg])
875e83ac88aSmrg
8767978d3cdSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
8777978d3cdSmrg#
8787978d3cdSmrg# This file is free software; the Free Software Foundation
8797978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
8807978d3cdSmrg# with or without modifications, as long as this notice is preserved.
881ea6ae205Smrg
8827978d3cdSmrg# AM_PROG_INSTALL_STRIP
8837978d3cdSmrg# ---------------------
8847978d3cdSmrg# One issue with vendor `install' (even GNU) is that you can't
8857978d3cdSmrg# specify the program used to strip binaries.  This is especially
8867978d3cdSmrg# annoying in cross-compiling environments, where the build's strip
8877978d3cdSmrg# is unlikely to handle the host's binaries.
8887978d3cdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
8897978d3cdSmrg# always use install-sh in `make install-strip', and initialize
8907978d3cdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
8917978d3cdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
8927978d3cdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
8937978d3cdSmrg# Installed binaries are usually stripped using `strip' when the user
8947978d3cdSmrg# run `make install-strip'.  However `strip' might not be the right
8957978d3cdSmrg# tool to use in cross-compilation environments, therefore Automake
8967978d3cdSmrg# will honor the `STRIP' environment variable to overrule this program.
8977978d3cdSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
8987978d3cdSmrgif test "$cross_compiling" != no; then
8997978d3cdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9007978d3cdSmrgfi
9017978d3cdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9027978d3cdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903ea6ae205Smrg
904e83ac88aSmrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
9057978d3cdSmrg#
9067978d3cdSmrg# This file is free software; the Free Software Foundation
9077978d3cdSmrg# gives unlimited permission to copy and/or distribute it,
9087978d3cdSmrg# with or without modifications, as long as this notice is preserved.
909ea6ae205Smrg
910e83ac88aSmrg# serial 2
911e83ac88aSmrg
9127978d3cdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
9137978d3cdSmrg# ---------------------------
914e83ac88aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9157978d3cdSmrg# This macro is traced by Automake.
9167978d3cdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
917ea6ae205Smrg
918e83ac88aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
919e83ac88aSmrg# ---------------------------
920e83ac88aSmrg# Public sister of _AM_SUBST_NOTMAKE.
921e83ac88aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922e83ac88aSmrg
9237978d3cdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
924ea6ae205Smrg
9257978d3cdSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
926ea6ae205Smrg#
927ea6ae205Smrg# This file is free software; the Free Software Foundation
928ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
929ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
930ea6ae205Smrg
9317978d3cdSmrg# serial 2
932ea6ae205Smrg
9337978d3cdSmrg# _AM_PROG_TAR(FORMAT)
9347978d3cdSmrg# --------------------
9357978d3cdSmrg# Check how to create a tarball in format FORMAT.
9367978d3cdSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
9377978d3cdSmrg#
9387978d3cdSmrg# Substitute a variable $(am__tar) that is a command
9397978d3cdSmrg# writing to stdout a FORMAT-tarball containing the directory
9407978d3cdSmrg# $tardir.
9417978d3cdSmrg#     tardir=directory && $(am__tar) > result.tar
9427978d3cdSmrg#
9437978d3cdSmrg# Substitute a variable $(am__untar) that extract such
9447978d3cdSmrg# a tarball read from stdin.
9457978d3cdSmrg#     $(am__untar) < result.tar
9467978d3cdSmrgAC_DEFUN([_AM_PROG_TAR],
9477978d3cdSmrg[# Always define AMTAR for backward compatibility.
9487978d3cdSmrgAM_MISSING_PROG([AMTAR], [tar])
9497978d3cdSmrgm4_if([$1], [v7],
9507978d3cdSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
9517978d3cdSmrg     [m4_case([$1], [ustar],, [pax],,
9527978d3cdSmrg              [m4_fatal([Unknown tar format])])
9537978d3cdSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
9547978d3cdSmrg# Loop over all known methods to create a tar archive until one works.
9557978d3cdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9567978d3cdSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
9577978d3cdSmrg# Do not fold the above two line into one, because Tru64 sh and
9587978d3cdSmrg# Solaris sh will not grok spaces in the rhs of `-'.
9597978d3cdSmrgfor _am_tool in $_am_tools
9607978d3cdSmrgdo
9617978d3cdSmrg  case $_am_tool in
9627978d3cdSmrg  gnutar)
9637978d3cdSmrg    for _am_tar in tar gnutar gtar;
9647978d3cdSmrg    do
9657978d3cdSmrg      AM_RUN_LOG([$_am_tar --version]) && break
9667978d3cdSmrg    done
9677978d3cdSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
9687978d3cdSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
9697978d3cdSmrg    am__untar="$_am_tar -xf -"
9707978d3cdSmrg    ;;
9717978d3cdSmrg  plaintar)
9727978d3cdSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
9737978d3cdSmrg    # ustar tarball either.
9747978d3cdSmrg    (tar --version) >/dev/null 2>&1 && continue
9757978d3cdSmrg    am__tar='tar chf - "$$tardir"'
9767978d3cdSmrg    am__tar_='tar chf - "$tardir"'
9777978d3cdSmrg    am__untar='tar xf -'
9787978d3cdSmrg    ;;
9797978d3cdSmrg  pax)
9807978d3cdSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
9817978d3cdSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
9827978d3cdSmrg    am__untar='pax -r'
9837978d3cdSmrg    ;;
9847978d3cdSmrg  cpio)
9857978d3cdSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
9867978d3cdSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
9877978d3cdSmrg    am__untar='cpio -i -H $1 -d'
9887978d3cdSmrg    ;;
9897978d3cdSmrg  none)
9907978d3cdSmrg    am__tar=false
9917978d3cdSmrg    am__tar_=false
9927978d3cdSmrg    am__untar=false
9937978d3cdSmrg    ;;
9947978d3cdSmrg  esac
9957978d3cdSmrg
9967978d3cdSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
9977978d3cdSmrg  # and am__untar set.
9987978d3cdSmrg  test -n "${am_cv_prog_tar_$1}" && break
9997978d3cdSmrg
10007978d3cdSmrg  # tar/untar a dummy directory, and stop if the command works
10017978d3cdSmrg  rm -rf conftest.dir
10027978d3cdSmrg  mkdir conftest.dir
10037978d3cdSmrg  echo GrepMe > conftest.dir/file
10047978d3cdSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
10057978d3cdSmrg  rm -rf conftest.dir
10067978d3cdSmrg  if test -s conftest.tar; then
10077978d3cdSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
10087978d3cdSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
10097978d3cdSmrg  fi
1010ea6ae205Smrgdone
10117978d3cdSmrgrm -rf conftest.dir
1012ea6ae205Smrg
10137978d3cdSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
10147978d3cdSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
10157978d3cdSmrgAC_SUBST([am__tar])
10167978d3cdSmrgAC_SUBST([am__untar])
10177978d3cdSmrg]) # _AM_PROG_TAR
1018ea6ae205Smrg
1019663cdc11Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1020663cdc11Smrg# 
1021663cdc11Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1022663cdc11Smrg#
1023663cdc11Smrg# This program is free software; you can redistribute it and/or modify
1024663cdc11Smrg# it under the terms of the GNU General Public License as published by
1025663cdc11Smrg# the Free Software Foundation; either version 2 of the License, or
1026663cdc11Smrg# (at your option) any later version.
1027663cdc11Smrg#
1028663cdc11Smrg# This program is distributed in the hope that it will be useful, but
1029663cdc11Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1030663cdc11Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1031663cdc11Smrg# General Public License for more details.
1032663cdc11Smrg#
1033663cdc11Smrg# You should have received a copy of the GNU General Public License
1034663cdc11Smrg# along with this program; if not, write to the Free Software
1035663cdc11Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1036663cdc11Smrg#
1037663cdc11Smrg# As a special exception to the GNU General Public License, if you
1038663cdc11Smrg# distribute this file as part of a program that contains a
1039663cdc11Smrg# configuration script generated by Autoconf, you may include it under
1040663cdc11Smrg# the same distribution terms that you use for the rest of that program.
1041663cdc11Smrg
1042663cdc11Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1043663cdc11Smrg# ----------------------------------
1044663cdc11SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1045663cdc11Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1046663cdc11Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1047663cdc11SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1048663cdc11Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1049663cdc11Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1050663cdc11Smrgfi
1051663cdc11Smrgif test -n "$PKG_CONFIG"; then
1052663cdc11Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1053663cdc11Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1054663cdc11Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1055663cdc11Smrg		AC_MSG_RESULT([yes])
1056663cdc11Smrg	else
1057663cdc11Smrg		AC_MSG_RESULT([no])
1058663cdc11Smrg		PKG_CONFIG=""
1059663cdc11Smrg	fi
1060663cdc11Smrg		
1061663cdc11Smrgfi[]dnl
1062663cdc11Smrg])# PKG_PROG_PKG_CONFIG
1063663cdc11Smrg
1064663cdc11Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1065663cdc11Smrg#
1066663cdc11Smrg# Check to see whether a particular set of modules exists.  Similar
1067663cdc11Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1068663cdc11Smrg#
1069663cdc11Smrg#
1070663cdc11Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1071663cdc11Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1072663cdc11Smrg# PKG_CHECK_EXISTS manually
1073663cdc11Smrg# --------------------------------------------------------------
1074663cdc11SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1075663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1076663cdc11Smrgif test -n "$PKG_CONFIG" && \
1077663cdc11Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1078663cdc11Smrg  m4_ifval([$2], [$2], [:])
1079663cdc11Smrgm4_ifvaln([$3], [else
1080663cdc11Smrg  $3])dnl
1081663cdc11Smrgfi])
1082663cdc11Smrg
1083663cdc11Smrg
1084663cdc11Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1085663cdc11Smrg# ---------------------------------------------
1086663cdc11Smrgm4_define([_PKG_CONFIG],
1087663cdc11Smrg[if test -n "$$1"; then
1088663cdc11Smrg    pkg_cv_[]$1="$$1"
1089663cdc11Smrg elif test -n "$PKG_CONFIG"; then
1090663cdc11Smrg    PKG_CHECK_EXISTS([$3],
1091663cdc11Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1092663cdc11Smrg		     [pkg_failed=yes])
1093663cdc11Smrg else
1094663cdc11Smrg    pkg_failed=untried
1095663cdc11Smrgfi[]dnl
1096663cdc11Smrg])# _PKG_CONFIG
1097663cdc11Smrg
1098663cdc11Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1099663cdc11Smrg# -----------------------------
1100663cdc11SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1101663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1102663cdc11Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1103663cdc11Smrg        _pkg_short_errors_supported=yes
1104663cdc11Smrgelse
1105663cdc11Smrg        _pkg_short_errors_supported=no
1106663cdc11Smrgfi[]dnl
1107663cdc11Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1108663cdc11Smrg
1109663cdc11Smrg
1110663cdc11Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1111663cdc11Smrg# [ACTION-IF-NOT-FOUND])
1112663cdc11Smrg#
1113663cdc11Smrg#
1114663cdc11Smrg# Note that if there is a possibility the first call to
1115663cdc11Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1116663cdc11Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1117663cdc11Smrg#
1118663cdc11Smrg#
1119663cdc11Smrg# --------------------------------------------------------------
1120663cdc11SmrgAC_DEFUN([PKG_CHECK_MODULES],
1121663cdc11Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1122663cdc11SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1123663cdc11SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1124663cdc11Smrg
1125663cdc11Smrgpkg_failed=no
1126663cdc11SmrgAC_MSG_CHECKING([for $1])
1127663cdc11Smrg
1128663cdc11Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1129663cdc11Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1130663cdc11Smrg
1131663cdc11Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1132663cdc11Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1133663cdc11SmrgSee the pkg-config man page for more details.])
1134663cdc11Smrg
1135663cdc11Smrgif test $pkg_failed = yes; then
1136663cdc11Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1137663cdc11Smrg        if test $_pkg_short_errors_supported = yes; then
1138663cdc11Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1139663cdc11Smrg        else 
1140663cdc11Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1141663cdc11Smrg        fi
1142663cdc11Smrg	# Put the nasty error message in config.log where it belongs
1143663cdc11Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1144663cdc11Smrg
1145663cdc11Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1146663cdc11Smrg[Package requirements ($2) were not met:
1147663cdc11Smrg
1148663cdc11Smrg$$1_PKG_ERRORS
1149663cdc11Smrg
1150663cdc11SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1151663cdc11Smrginstalled software in a non-standard prefix.
1152663cdc11Smrg
1153663cdc11Smrg_PKG_TEXT
1154663cdc11Smrg])],
1155663cdc11Smrg		[AC_MSG_RESULT([no])
1156663cdc11Smrg                $4])
1157663cdc11Smrgelif test $pkg_failed = untried; then
1158663cdc11Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1159663cdc11Smrg[The pkg-config script could not be found or is too old.  Make sure it
1160663cdc11Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1161663cdc11Smrgpath to pkg-config.
1162663cdc11Smrg
1163663cdc11Smrg_PKG_TEXT
1164663cdc11Smrg
1165663cdc11SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1166663cdc11Smrg		[$4])
1167663cdc11Smrgelse
1168663cdc11Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1169663cdc11Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1170663cdc11Smrg        AC_MSG_RESULT([yes])
1171663cdc11Smrg	ifelse([$3], , :, [$3])
1172663cdc11Smrgfi[]dnl
1173663cdc11Smrg])# PKG_CHECK_MODULES
1174663cdc11Smrg
11757978d3cdSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
11767978d3cdSmrgdnl
1177b6f2c9ccSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
11787978d3cdSmrgdnl 
11797978d3cdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1180b6f2c9ccSmrgdnl copy of this software and associated documentation files (the "Software"),
1181b6f2c9ccSmrgdnl to deal in the Software without restriction, including without limitation
1182b6f2c9ccSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1183b6f2c9ccSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1184b6f2c9ccSmrgdnl Software is furnished to do so, subject to the following conditions:
11857978d3cdSmrgdnl
1186b6f2c9ccSmrgdnl The above copyright notice and this permission notice (including the next
1187b6f2c9ccSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1188b6f2c9ccSmrgdnl Software.
11897978d3cdSmrgdnl
1190b6f2c9ccSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1191b6f2c9ccSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1192b6f2c9ccSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1193b6f2c9ccSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1194b6f2c9ccSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1195b6f2c9ccSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1196b6f2c9ccSmrgdnl DEALINGS IN THE SOFTWARE.
1197ea6ae205Smrg
11987978d3cdSmrg# XORG_MACROS_VERSION(required-version)
11997978d3cdSmrg# -------------------------------------
12007978d3cdSmrg# Minimum version: 1.1.0
1201ea6ae205Smrg#
12027978d3cdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
12037978d3cdSmrg# your configure.ac with the minimum required version, such as:
12047978d3cdSmrg# XORG_MACROS_VERSION(1.1)
12057978d3cdSmrg#
1206e83ac88aSmrg# To ensure that this macro is defined, also add:
1207e83ac88aSmrg# m4_ifndef([XORG_MACROS_VERSION],
1208e83ac88aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
12097978d3cdSmrg#
12107978d3cdSmrg#
12117978d3cdSmrg# See the "minimum version" comment for each macro you use to see what 
12127978d3cdSmrg# version you require.
1213e83ac88aSmrgm4_defun([XORG_MACROS_VERSION],[
1214663cdc11Smrgm4_define([vers_have], [1.16.1])
1215e83ac88aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1216e83ac88aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1217e83ac88aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1218e83ac88aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1219e83ac88aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1220e83ac88aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1221e83ac88aSmrgm4_undefine([vers_have])
1222e83ac88aSmrgm4_undefine([maj_have])
1223e83ac88aSmrgm4_undefine([maj_needed])
12247978d3cdSmrg]) # XORG_MACROS_VERSION
1225ea6ae205Smrg
12267978d3cdSmrg# XORG_PROG_RAWCPP()
12277978d3cdSmrg# ------------------
12287978d3cdSmrg# Minimum version: 1.0.0
12297978d3cdSmrg#
12307978d3cdSmrg# Find cpp program and necessary flags for use in pre-processing text files
12317978d3cdSmrg# such as man pages and config files
12327978d3cdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
12337978d3cdSmrgAC_REQUIRE([AC_PROG_CPP])
12347978d3cdSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
12357978d3cdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1236ea6ae205Smrg
12377978d3cdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
12387978d3cdSmrg# which is not the best choice for supporting other OS'es, but covers most
12397978d3cdSmrg# of the ones we need for now.
12407978d3cdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1241245f6787SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
12427978d3cdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12437978d3cdSmrg	AC_MSG_RESULT([no])
12447978d3cdSmrgelse
12457978d3cdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12467978d3cdSmrg		RAWCPPFLAGS=-undef
12477978d3cdSmrg		AC_MSG_RESULT([yes])
12487978d3cdSmrg	# under Cygwin unix is still defined even with -undef
12497978d3cdSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12507978d3cdSmrg		RAWCPPFLAGS="-undef -ansi"
12517978d3cdSmrg		AC_MSG_RESULT([yes, with -ansi])
12527978d3cdSmrg	else
12537978d3cdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
12547978d3cdSmrg	fi
12557978d3cdSmrgfi
12567978d3cdSmrgrm -f conftest.$ac_ext
1257ea6ae205Smrg
12587978d3cdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1259245f6787SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
12607978d3cdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12617978d3cdSmrg	AC_MSG_RESULT([no])
12627978d3cdSmrgelse
12637978d3cdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12647978d3cdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
12657978d3cdSmrg		AC_MSG_RESULT([yes])
12667978d3cdSmrg	else
12677978d3cdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
12687978d3cdSmrg	fi
12697978d3cdSmrgfi
12707978d3cdSmrgrm -f conftest.$ac_ext
12717978d3cdSmrgAC_SUBST(RAWCPPFLAGS)
12727978d3cdSmrg]) # XORG_PROG_RAWCPP
1273ea6ae205Smrg
12747978d3cdSmrg# XORG_MANPAGE_SECTIONS()
12757978d3cdSmrg# -----------------------
12767978d3cdSmrg# Minimum version: 1.0.0
1277ea6ae205Smrg#
12787978d3cdSmrg# Determine which sections man pages go in for the different man page types
12797978d3cdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
12807978d3cdSmrg# Not sure if there's any better way than just hardcoding by OS name.
12817978d3cdSmrg# Override default settings by setting environment variables
1282b6f2c9ccSmrg# Added MAN_SUBSTS in version 1.8
1283b6f2c9ccSmrg# Added AC_PROG_SED in version 1.8
1284ea6ae205Smrg
12857978d3cdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
12867978d3cdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1287b6f2c9ccSmrgAC_REQUIRE([AC_PROG_SED])
1288ea6ae205Smrg
12897978d3cdSmrgif test x$APP_MAN_SUFFIX = x    ; then
12907978d3cdSmrg    APP_MAN_SUFFIX=1
12917978d3cdSmrgfi
12927978d3cdSmrgif test x$APP_MAN_DIR = x    ; then
12937978d3cdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1294ea6ae205Smrgfi
1295ea6ae205Smrg
12967978d3cdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
12977978d3cdSmrg    LIB_MAN_SUFFIX=3
12987978d3cdSmrgfi
12997978d3cdSmrgif test x$LIB_MAN_DIR = x    ; then
13007978d3cdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1301ea6ae205Smrgfi
1302ea6ae205Smrg
13037978d3cdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
13047978d3cdSmrg    case $host_os in
13057978d3cdSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
13067978d3cdSmrg	*)		FILE_MAN_SUFFIX=5  ;;
13077978d3cdSmrg    esac
13087978d3cdSmrgfi
13097978d3cdSmrgif test x$FILE_MAN_DIR = x    ; then
13107978d3cdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
13117978d3cdSmrgfi
1312ea6ae205Smrg
13137978d3cdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
13147978d3cdSmrg    case $host_os in
13157978d3cdSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
13167978d3cdSmrg	*)		MISC_MAN_SUFFIX=7  ;;
13177978d3cdSmrg    esac
13187978d3cdSmrgfi
13197978d3cdSmrgif test x$MISC_MAN_DIR = x    ; then
13207978d3cdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
13217978d3cdSmrgfi
1322ea6ae205Smrg
13237978d3cdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
13247978d3cdSmrg    case $host_os in
13257978d3cdSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
13267978d3cdSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
13277978d3cdSmrg    esac
13287978d3cdSmrgfi
13297978d3cdSmrgif test x$DRIVER_MAN_DIR = x    ; then
13307978d3cdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13317978d3cdSmrgfi
1332ea6ae205Smrg
13337978d3cdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
13347978d3cdSmrg    case $host_os in
13357978d3cdSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
13367978d3cdSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
13377978d3cdSmrg    esac
13387978d3cdSmrgfi
13397978d3cdSmrgif test x$ADMIN_MAN_DIR = x    ; then
13407978d3cdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13417978d3cdSmrgfi
1342ea6ae205Smrg
1343ea6ae205Smrg
13447978d3cdSmrgAC_SUBST([APP_MAN_SUFFIX])
13457978d3cdSmrgAC_SUBST([LIB_MAN_SUFFIX])
13467978d3cdSmrgAC_SUBST([FILE_MAN_SUFFIX])
13477978d3cdSmrgAC_SUBST([MISC_MAN_SUFFIX])
13487978d3cdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
13497978d3cdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
13507978d3cdSmrgAC_SUBST([APP_MAN_DIR])
13517978d3cdSmrgAC_SUBST([LIB_MAN_DIR])
13527978d3cdSmrgAC_SUBST([FILE_MAN_DIR])
13537978d3cdSmrgAC_SUBST([MISC_MAN_DIR])
13547978d3cdSmrgAC_SUBST([DRIVER_MAN_DIR])
13557978d3cdSmrgAC_SUBST([ADMIN_MAN_DIR])
1356b6f2c9ccSmrg
1357b6f2c9ccSmrgXORG_MAN_PAGE="X Version 11"
1358b6f2c9ccSmrgAC_SUBST([XORG_MAN_PAGE])
1359b6f2c9ccSmrgMAN_SUBSTS="\
1360b6f2c9ccSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1361b6f2c9ccSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1362b6f2c9ccSmrg	-e 's|__xservername__|Xorg|g' \
1363b6f2c9ccSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1364b6f2c9ccSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1365b6f2c9ccSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1366b6f2c9ccSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1367b6f2c9ccSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1368b6f2c9ccSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1369b6f2c9ccSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1370b6f2c9ccSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1371b6f2c9ccSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1372b6f2c9ccSmrgAC_SUBST([MAN_SUBSTS])
1373b6f2c9ccSmrg
13747978d3cdSmrg]) # XORG_MANPAGE_SECTIONS
1375ea6ae205Smrg
1376b6f2c9ccSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1377b6f2c9ccSmrg# ------------------------
1378b6f2c9ccSmrg# Minimum version: 1.7.0
1379b6f2c9ccSmrg#
1380b6f2c9ccSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1381b6f2c9ccSmrg# provided by xorg-sgml-doctools, if installed.
1382b6f2c9ccSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1383b6f2c9ccSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1384b6f2c9ccSmrgXORG_SGML_PATH=
1385b6f2c9ccSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1386b6f2c9ccSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1387b6f2c9ccSmrg    [m4_ifval([$1],[:],
1388b6f2c9ccSmrg        [if test x"$cross_compiling" != x"yes" ; then
1389b6f2c9ccSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1390b6f2c9ccSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1391b6f2c9ccSmrg         fi])
1392b6f2c9ccSmrg    ])
1393b6f2c9ccSmrg
1394b6f2c9ccSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1395b6f2c9ccSmrg# the path and the name of the doc stylesheet
1396b6f2c9ccSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1397b6f2c9ccSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1398b6f2c9ccSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1399b6f2c9ccSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1400b6f2c9ccSmrgelse
1401b6f2c9ccSmrg   AC_MSG_RESULT([no])
1402b6f2c9ccSmrgfi
1403b6f2c9ccSmrg
1404b6f2c9ccSmrgAC_SUBST(XORG_SGML_PATH)
1405b6f2c9ccSmrgAC_SUBST(STYLESHEET_SRCDIR)
1406b6f2c9ccSmrgAC_SUBST(XSL_STYLESHEET)
1407b6f2c9ccSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1408b6f2c9ccSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1409b6f2c9ccSmrg
14107978d3cdSmrg# XORG_CHECK_LINUXDOC
14117978d3cdSmrg# -------------------
14127978d3cdSmrg# Minimum version: 1.0.0
1413ea6ae205Smrg#
14147978d3cdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
14157978d3cdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
14167978d3cdSmrg# Whether or not the necessary tools and files are found can be checked
14177978d3cdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
14187978d3cdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1419b6f2c9ccSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1420b6f2c9ccSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1421ea6ae205Smrg
14227978d3cdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1423ea6ae205Smrg
1424b6f2c9ccSmrgAC_MSG_CHECKING([whether to build documentation])
1425ea6ae205Smrg
1426b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
14277978d3cdSmrg   BUILDDOC=yes
1428ea6ae205Smrgelse
14297978d3cdSmrg   BUILDDOC=no
1430ea6ae205Smrgfi
1431ea6ae205Smrg
14327978d3cdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1433ea6ae205Smrg
14347978d3cdSmrgAC_MSG_RESULT([$BUILDDOC])
1435ea6ae205Smrg
1436b6f2c9ccSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1437ea6ae205Smrg
1438b6f2c9ccSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
14397978d3cdSmrg   BUILDPDFDOC=yes
14407978d3cdSmrgelse
14417978d3cdSmrg   BUILDPDFDOC=no
14427978d3cdSmrgfi
1443ea6ae205Smrg
14447978d3cdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1445ea6ae205Smrg
14467978d3cdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1447ea6ae205Smrg
1448b6f2c9ccSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
14497978d3cdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
14507978d3cdSmrgMAKE_PDF="$PS2PDF"
14517978d3cdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1452ea6ae205Smrg
14537978d3cdSmrgAC_SUBST(MAKE_TEXT)
14547978d3cdSmrgAC_SUBST(MAKE_PS)
14557978d3cdSmrgAC_SUBST(MAKE_PDF)
14567978d3cdSmrgAC_SUBST(MAKE_HTML)
14577978d3cdSmrg]) # XORG_CHECK_LINUXDOC
1458ea6ae205Smrg
14597978d3cdSmrg# XORG_CHECK_DOCBOOK
14607978d3cdSmrg# -------------------
14617978d3cdSmrg# Minimum version: 1.0.0
14627978d3cdSmrg#
14637978d3cdSmrg# Checks for the ability to build output formats from SGML DocBook source.
14647978d3cdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
14657978d3cdSmrg# indicates whether the necessary tools and files are found and, if set,
14667978d3cdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
14677978d3cdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1468b6f2c9ccSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1469b6f2c9ccSmrg
14707978d3cdSmrgBUILDTXTDOC=no
14717978d3cdSmrgBUILDPDFDOC=no
14727978d3cdSmrgBUILDPSDOC=no
14737978d3cdSmrgBUILDHTMLDOC=no
1474ea6ae205Smrg
14757978d3cdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
14767978d3cdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
14777978d3cdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
14787978d3cdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1479ea6ae205Smrg
1480b6f2c9ccSmrgAC_MSG_CHECKING([whether to build text documentation])
1481b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
14827978d3cdSmrg   test x$BUILD_TXTDOC != xno; then
14837978d3cdSmrg	BUILDTXTDOC=yes
14847978d3cdSmrgfi
14857978d3cdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
14867978d3cdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1487ea6ae205Smrg
1488b6f2c9ccSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1489b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
14907978d3cdSmrg   test x$BUILD_PDFDOC != xno; then
14917978d3cdSmrg	BUILDPDFDOC=yes
14927978d3cdSmrgfi
14937978d3cdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14947978d3cdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1495ea6ae205Smrg
1496b6f2c9ccSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1497b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
14987978d3cdSmrg   test x$BUILD_PSDOC != xno; then
14997978d3cdSmrg	BUILDPSDOC=yes
15007978d3cdSmrgfi
15017978d3cdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
15027978d3cdSmrgAC_MSG_RESULT([$BUILDPSDOC])
1503ea6ae205Smrg
1504b6f2c9ccSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1505b6f2c9ccSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
15067978d3cdSmrg   test x$BUILD_HTMLDOC != xno; then
15077978d3cdSmrg	BUILDHTMLDOC=yes
1508ea6ae205Smrgfi
15097978d3cdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
15107978d3cdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1511ea6ae205Smrg
15127978d3cdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
15137978d3cdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
15147978d3cdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
15157978d3cdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1516ea6ae205Smrg
15177978d3cdSmrgAC_SUBST(MAKE_TEXT)
15187978d3cdSmrgAC_SUBST(MAKE_PS)
15197978d3cdSmrgAC_SUBST(MAKE_PDF)
15207978d3cdSmrgAC_SUBST(MAKE_HTML)
15217978d3cdSmrg]) # XORG_CHECK_DOCBOOK
1522ea6ae205Smrg
1523b6f2c9ccSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1524b6f2c9ccSmrg# ----------------
1525b6f2c9ccSmrg# Minimum version: 1.5.0
1526b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1527b6f2c9ccSmrg#
1528b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1529b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1530b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1531b6f2c9ccSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1532b6f2c9ccSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1533b6f2c9ccSmrg# --with-xmlto assumes 'auto'.
1534b6f2c9ccSmrg#
1535b6f2c9ccSmrg# Interface to module:
1536b6f2c9ccSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1537b6f2c9ccSmrg# XMLTO:	returns the path of the xmlto program found
1538b6f2c9ccSmrg#		returns the path set by the user in the environment
1539b6f2c9ccSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1540b6f2c9ccSmrg#		'no' user instructs the module not to use xmlto
1541b6f2c9ccSmrg#
1542b6f2c9ccSmrg# Added in version 1.10.0
1543b6f2c9ccSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1544b6f2c9ccSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1545b6f2c9ccSmrg#
1546b6f2c9ccSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1547b6f2c9ccSmrg#
1548b6f2c9ccSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1549b6f2c9ccSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1550b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1551b6f2c9ccSmrgAC_ARG_WITH(xmlto,
1552b6f2c9ccSmrg	AS_HELP_STRING([--with-xmlto],
1553b6f2c9ccSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1554b6f2c9ccSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1555b6f2c9ccSmrgm4_undefine([_defopt])
1556b6f2c9ccSmrg
1557b6f2c9ccSmrgif test "x$use_xmlto" = x"auto"; then
1558b6f2c9ccSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1559b6f2c9ccSmrg   if test "x$XMLTO" = "x"; then
1560b6f2c9ccSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1561b6f2c9ccSmrg	have_xmlto=no
1562b6f2c9ccSmrg   else
1563b6f2c9ccSmrg        have_xmlto=yes
1564b6f2c9ccSmrg   fi
1565b6f2c9ccSmrgelif test "x$use_xmlto" = x"yes" ; then
1566b6f2c9ccSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1567b6f2c9ccSmrg   if test "x$XMLTO" = "x"; then
1568b6f2c9ccSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1569b6f2c9ccSmrg   fi
1570b6f2c9ccSmrg   have_xmlto=yes
1571b6f2c9ccSmrgelif test "x$use_xmlto" = x"no" ; then
1572b6f2c9ccSmrg   if test "x$XMLTO" != "x"; then
1573b6f2c9ccSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1574b6f2c9ccSmrg   fi
1575b6f2c9ccSmrg   have_xmlto=no
1576b6f2c9ccSmrgelse
1577b6f2c9ccSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1578b6f2c9ccSmrgfi
1579b6f2c9ccSmrg
1580b6f2c9ccSmrg# Test for a minimum version of xmlto, if provided.
1581b6f2c9ccSmrgm4_ifval([$1],
1582b6f2c9ccSmrg[if test "$have_xmlto" = yes; then
1583b6f2c9ccSmrg    # scrape the xmlto version
1584b6f2c9ccSmrg    AC_MSG_CHECKING([the xmlto version])
1585b6f2c9ccSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1586b6f2c9ccSmrg    AC_MSG_RESULT([$xmlto_version])
1587b6f2c9ccSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1588b6f2c9ccSmrg        [if test "x$use_xmlto" = xauto; then
1589b6f2c9ccSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1590b6f2c9ccSmrg            have_xmlto=no
1591b6f2c9ccSmrg        else
1592b6f2c9ccSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1593b6f2c9ccSmrg        fi])
1594b6f2c9ccSmrgfi])
1595b6f2c9ccSmrg
1596b6f2c9ccSmrg# Test for the ability of xmlto to generate a text target
1597b6f2c9ccSmrghave_xmlto_text=no
1598b6f2c9ccSmrgcat > conftest.xml << "EOF"
1599b6f2c9ccSmrgEOF
1600b6f2c9ccSmrgAS_IF([test "$have_xmlto" = yes],
1601b6f2c9ccSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1602b6f2c9ccSmrg             [have_xmlto_text=yes],
1603b6f2c9ccSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1604b6f2c9ccSmrgrm -f conftest.xml
1605b6f2c9ccSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1606b6f2c9ccSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1607b6f2c9ccSmrg]) # XORG_WITH_XMLTO
1608b6f2c9ccSmrg
1609245f6787Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1610245f6787Smrg# --------------------------------------------
1611245f6787Smrg# Minimum version: 1.12.0
1612245f6787Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1613245f6787Smrg#
1614245f6787Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1615245f6787Smrg# XML-based language used for the transformation of XML documents.
1616245f6787Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1617245f6787Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1618245f6787Smrg# The XSLT processor is often used as a standalone tool for transformations.
1619245f6787Smrg# It should not be assumed that this tool is used only to work with documnetation.
1620245f6787Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1621245f6787Smrg#
1622245f6787Smrg# Interface to module:
1623245f6787Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1624245f6787Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1625245f6787Smrg#		 returns the path set by the user in the environment
1626245f6787Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1627245f6787Smrg#		  'no' user instructs the module not to use xsltproc
1628245f6787Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1629245f6787Smrg#
1630245f6787Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1631245f6787Smrg#
1632245f6787SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1633245f6787SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1634245f6787Smrg# Preserves the interface, should it be implemented later
1635245f6787Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1636245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
1637245f6787SmrgAC_ARG_WITH(xsltproc,
1638245f6787Smrg	AS_HELP_STRING([--with-xsltproc],
1639245f6787Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1640245f6787Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1641245f6787Smrgm4_undefine([_defopt])
1642245f6787Smrg
1643245f6787Smrgif test "x$use_xsltproc" = x"auto"; then
1644245f6787Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1645245f6787Smrg   if test "x$XSLTPROC" = "x"; then
1646245f6787Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1647245f6787Smrg	have_xsltproc=no
1648245f6787Smrg   else
1649245f6787Smrg        have_xsltproc=yes
1650245f6787Smrg   fi
1651245f6787Smrgelif test "x$use_xsltproc" = x"yes" ; then
1652245f6787Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1653245f6787Smrg   if test "x$XSLTPROC" = "x"; then
1654245f6787Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1655245f6787Smrg   fi
1656245f6787Smrg   have_xsltproc=yes
1657245f6787Smrgelif test "x$use_xsltproc" = x"no" ; then
1658245f6787Smrg   if test "x$XSLTPROC" != "x"; then
1659245f6787Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1660245f6787Smrg   fi
1661245f6787Smrg   have_xsltproc=no
1662245f6787Smrgelse
1663245f6787Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1664245f6787Smrgfi
1665245f6787Smrg
1666245f6787SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1667245f6787Smrg]) # XORG_WITH_XSLTPROC
1668245f6787Smrg
1669245f6787Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1670245f6787Smrg# ----------------------------------------
1671245f6787Smrg# Minimum version: 1.15.0
1672245f6787Smrg#
1673245f6787Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1674245f6787Smrg# scanning arbitrary text files, extracting information from those text files,
1675245f6787Smrg# and printing reports based on that information.
1676245f6787Smrg#
1677245f6787Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1678245f6787Smrg#
1679245f6787Smrg# Interface to module:
1680245f6787Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1681245f6787Smrg# PERL:	     returns the path of the perl program found
1682245f6787Smrg#	     returns the path set by the user in the environment
1683245f6787Smrg# --with-perl: 'yes' user instructs the module to use perl
1684245f6787Smrg#	       'no' user instructs the module not to use perl
1685245f6787Smrg# have_perl: returns yes if perl found in PATH or no
1686245f6787Smrg#
1687245f6787Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1688245f6787Smrg#
1689245f6787SmrgAC_DEFUN([XORG_WITH_PERL],[
1690245f6787SmrgAC_ARG_VAR([PERL], [Path to perl command])
1691245f6787Smrg# Preserves the interface, should it be implemented later
1692245f6787Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1693245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
1694245f6787SmrgAC_ARG_WITH(perl,
1695245f6787Smrg	AS_HELP_STRING([--with-perl],
1696245f6787Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1697245f6787Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1698245f6787Smrgm4_undefine([_defopt])
1699245f6787Smrg
1700245f6787Smrgif test "x$use_perl" = x"auto"; then
1701245f6787Smrg   AC_PATH_PROG([PERL], [perl])
1702245f6787Smrg   if test "x$PERL" = "x"; then
1703245f6787Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1704245f6787Smrg	have_perl=no
1705245f6787Smrg   else
1706245f6787Smrg        have_perl=yes
1707245f6787Smrg   fi
1708245f6787Smrgelif test "x$use_perl" = x"yes" ; then
1709245f6787Smrg   AC_PATH_PROG([PERL], [perl])
1710245f6787Smrg   if test "x$PERL" = "x"; then
1711245f6787Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1712245f6787Smrg   fi
1713245f6787Smrg   have_perl=yes
1714245f6787Smrgelif test "x$use_perl" = x"no" ; then
1715245f6787Smrg   if test "x$PERL" != "x"; then
1716245f6787Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1717245f6787Smrg   fi
1718245f6787Smrg   have_perl=no
1719245f6787Smrgelse
1720245f6787Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1721245f6787Smrgfi
1722245f6787Smrg
1723245f6787SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1724245f6787Smrg]) # XORG_WITH_PERL
1725245f6787Smrg
1726b6f2c9ccSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1727b6f2c9ccSmrg# ----------------
1728b6f2c9ccSmrg# Minimum version: 1.5.0
1729b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1730b6f2c9ccSmrg#
1731b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1732b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1733b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1734b6f2c9ccSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1735b6f2c9ccSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1736b6f2c9ccSmrg# --with-asciidoc assumes 'auto'.
1737b6f2c9ccSmrg#
1738b6f2c9ccSmrg# Interface to module:
1739b6f2c9ccSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1740b6f2c9ccSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1741b6f2c9ccSmrg#		 returns the path set by the user in the environment
1742b6f2c9ccSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1743b6f2c9ccSmrg#		  'no' user instructs the module not to use asciidoc
1744b6f2c9ccSmrg#
1745b6f2c9ccSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1746b6f2c9ccSmrg#
1747b6f2c9ccSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1748b6f2c9ccSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1749b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1750b6f2c9ccSmrgAC_ARG_WITH(asciidoc,
1751b6f2c9ccSmrg	AS_HELP_STRING([--with-asciidoc],
1752b6f2c9ccSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1753b6f2c9ccSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1754b6f2c9ccSmrgm4_undefine([_defopt])
1755b6f2c9ccSmrg
1756b6f2c9ccSmrgif test "x$use_asciidoc" = x"auto"; then
1757b6f2c9ccSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1758b6f2c9ccSmrg   if test "x$ASCIIDOC" = "x"; then
1759b6f2c9ccSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1760b6f2c9ccSmrg	have_asciidoc=no
1761b6f2c9ccSmrg   else
1762b6f2c9ccSmrg        have_asciidoc=yes
1763b6f2c9ccSmrg   fi
1764b6f2c9ccSmrgelif test "x$use_asciidoc" = x"yes" ; then
1765b6f2c9ccSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1766b6f2c9ccSmrg   if test "x$ASCIIDOC" = "x"; then
1767b6f2c9ccSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1768b6f2c9ccSmrg   fi
1769b6f2c9ccSmrg   have_asciidoc=yes
1770b6f2c9ccSmrgelif test "x$use_asciidoc" = x"no" ; then
1771b6f2c9ccSmrg   if test "x$ASCIIDOC" != "x"; then
1772b6f2c9ccSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1773b6f2c9ccSmrg   fi
1774b6f2c9ccSmrg   have_asciidoc=no
1775b6f2c9ccSmrgelse
1776b6f2c9ccSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1777b6f2c9ccSmrgfi
1778b6f2c9ccSmrgm4_ifval([$1],
1779b6f2c9ccSmrg[if test "$have_asciidoc" = yes; then
1780b6f2c9ccSmrg    # scrape the asciidoc version
1781b6f2c9ccSmrg    AC_MSG_CHECKING([the asciidoc version])
1782b6f2c9ccSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1783b6f2c9ccSmrg    AC_MSG_RESULT([$asciidoc_version])
1784b6f2c9ccSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1785b6f2c9ccSmrg        [if test "x$use_asciidoc" = xauto; then
1786b6f2c9ccSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1787b6f2c9ccSmrg            have_asciidoc=no
1788b6f2c9ccSmrg        else
1789b6f2c9ccSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1790b6f2c9ccSmrg        fi])
1791b6f2c9ccSmrgfi])
1792b6f2c9ccSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1793b6f2c9ccSmrg]) # XORG_WITH_ASCIIDOC
1794b6f2c9ccSmrg
1795b6f2c9ccSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1796b6f2c9ccSmrg# --------------------------------
1797b6f2c9ccSmrg# Minimum version: 1.5.0
1798b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1799b6f2c9ccSmrg#
1800b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1801b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1802b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1803b6f2c9ccSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1804b6f2c9ccSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1805b6f2c9ccSmrg# --with-doxygen assumes 'auto'.
1806b6f2c9ccSmrg#
1807b6f2c9ccSmrg# Interface to module:
1808b6f2c9ccSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1809b6f2c9ccSmrg# DOXYGEN:	 returns the path of the doxygen program found
1810b6f2c9ccSmrg#		 returns the path set by the user in the environment
1811b6f2c9ccSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1812b6f2c9ccSmrg#		  'no' user instructs the module not to use doxygen
1813b6f2c9ccSmrg#
1814b6f2c9ccSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1815b6f2c9ccSmrg#
1816b6f2c9ccSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1817b6f2c9ccSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1818b6f2c9ccSmrgm4_define([_defopt], m4_default([$2], [auto]))
1819b6f2c9ccSmrgAC_ARG_WITH(doxygen,
1820b6f2c9ccSmrg	AS_HELP_STRING([--with-doxygen],
1821b6f2c9ccSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1822b6f2c9ccSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1823b6f2c9ccSmrgm4_undefine([_defopt])
1824b6f2c9ccSmrg
1825b6f2c9ccSmrgif test "x$use_doxygen" = x"auto"; then
1826b6f2c9ccSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1827b6f2c9ccSmrg   if test "x$DOXYGEN" = "x"; then
1828b6f2c9ccSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1829b6f2c9ccSmrg	have_doxygen=no
1830b6f2c9ccSmrg   else
1831b6f2c9ccSmrg        have_doxygen=yes
1832b6f2c9ccSmrg   fi
1833b6f2c9ccSmrgelif test "x$use_doxygen" = x"yes" ; then
1834b6f2c9ccSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1835b6f2c9ccSmrg   if test "x$DOXYGEN" = "x"; then
1836b6f2c9ccSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1837b6f2c9ccSmrg   fi
1838b6f2c9ccSmrg   have_doxygen=yes
1839b6f2c9ccSmrgelif test "x$use_doxygen" = x"no" ; then
1840b6f2c9ccSmrg   if test "x$DOXYGEN" != "x"; then
1841b6f2c9ccSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1842b6f2c9ccSmrg   fi
1843b6f2c9ccSmrg   have_doxygen=no
1844b6f2c9ccSmrgelse
1845b6f2c9ccSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1846b6f2c9ccSmrgfi
1847b6f2c9ccSmrgm4_ifval([$1],
1848b6f2c9ccSmrg[if test "$have_doxygen" = yes; then
1849b6f2c9ccSmrg    # scrape the doxygen version
1850b6f2c9ccSmrg    AC_MSG_CHECKING([the doxygen version])
1851b6f2c9ccSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1852b6f2c9ccSmrg    AC_MSG_RESULT([$doxygen_version])
1853b6f2c9ccSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1854b6f2c9ccSmrg        [if test "x$use_doxygen" = xauto; then
1855b6f2c9ccSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1856b6f2c9ccSmrg            have_doxygen=no
1857b6f2c9ccSmrg        else
1858b6f2c9ccSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1859b6f2c9ccSmrg        fi])
1860b6f2c9ccSmrgfi])
1861b6f2c9ccSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1862b6f2c9ccSmrg]) # XORG_WITH_DOXYGEN
1863b6f2c9ccSmrg
1864b6f2c9ccSmrg# XORG_WITH_GROFF([DEFAULT])
1865b6f2c9ccSmrg# ----------------
1866b6f2c9ccSmrg# Minimum version: 1.6.0
1867b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1868b6f2c9ccSmrg#
1869b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1870b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1871b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1872b6f2c9ccSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1873b6f2c9ccSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1874b6f2c9ccSmrg# --with-groff assumes 'auto'.
1875b6f2c9ccSmrg#
1876b6f2c9ccSmrg# Interface to module:
1877b6f2c9ccSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1878b6f2c9ccSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1879b6f2c9ccSmrg# HAVE_GROFF_MS: the -ms macros package
1880b6f2c9ccSmrg# GROFF:	 returns the path of the groff program found
1881b6f2c9ccSmrg#		 returns the path set by the user in the environment
1882b6f2c9ccSmrg# --with-groff:	 'yes' user instructs the module to use groff
1883b6f2c9ccSmrg#		 'no' user instructs the module not to use groff
1884b6f2c9ccSmrg#
1885b6f2c9ccSmrg# Added in version 1.9.0:
1886b6f2c9ccSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1887b6f2c9ccSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1888b6f2c9ccSmrg#		   psselect from the psutils package.
1889b6f2c9ccSmrg#		   the ghostcript package. Refer to the grohtml man pages
1890b6f2c9ccSmrg#
1891b6f2c9ccSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1892b6f2c9ccSmrg#
1893b6f2c9ccSmrg# OS and distros often splits groff in a basic and full package, the former
1894b6f2c9ccSmrg# having the groff program and the later having devices, fonts and macros
1895b6f2c9ccSmrg# Checking for the groff executable is not enough.
1896b6f2c9ccSmrg#
1897b6f2c9ccSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1898b6f2c9ccSmrg# unset HAVE_GROFF or GROFF env variables.
1899b6f2c9ccSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1900b6f2c9ccSmrg#
1901b6f2c9ccSmrgAC_DEFUN([XORG_WITH_GROFF],[
1902b6f2c9ccSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1903b6f2c9ccSmrgm4_define([_defopt], m4_default([$1], [auto]))
1904b6f2c9ccSmrgAC_ARG_WITH(groff,
1905b6f2c9ccSmrg	AS_HELP_STRING([--with-groff],
1906b6f2c9ccSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1907b6f2c9ccSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1908b6f2c9ccSmrgm4_undefine([_defopt])
1909b6f2c9ccSmrg
1910b6f2c9ccSmrgif test "x$use_groff" = x"auto"; then
1911b6f2c9ccSmrg   AC_PATH_PROG([GROFF], [groff])
1912b6f2c9ccSmrg   if test "x$GROFF" = "x"; then
1913b6f2c9ccSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1914b6f2c9ccSmrg	have_groff=no
1915b6f2c9ccSmrg   else
1916b6f2c9ccSmrg        have_groff=yes
1917b6f2c9ccSmrg   fi
1918b6f2c9ccSmrgelif test "x$use_groff" = x"yes" ; then
1919b6f2c9ccSmrg   AC_PATH_PROG([GROFF], [groff])
1920b6f2c9ccSmrg   if test "x$GROFF" = "x"; then
1921b6f2c9ccSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1922b6f2c9ccSmrg   fi
1923b6f2c9ccSmrg   have_groff=yes
1924b6f2c9ccSmrgelif test "x$use_groff" = x"no" ; then
1925b6f2c9ccSmrg   if test "x$GROFF" != "x"; then
1926b6f2c9ccSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1927b6f2c9ccSmrg   fi
1928b6f2c9ccSmrg   have_groff=no
1929b6f2c9ccSmrgelse
1930b6f2c9ccSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1931b6f2c9ccSmrgfi
1932b6f2c9ccSmrg
1933b6f2c9ccSmrg# We have groff, test for the presence of the macro packages
1934b6f2c9ccSmrgif test "x$have_groff" = x"yes"; then
1935b6f2c9ccSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1936b6f2c9ccSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1937b6f2c9ccSmrg        groff_ms_works=yes
1938b6f2c9ccSmrg    else
1939b6f2c9ccSmrg        groff_ms_works=no
1940b6f2c9ccSmrg    fi
1941b6f2c9ccSmrg    AC_MSG_RESULT([$groff_ms_works])
1942b6f2c9ccSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1943b6f2c9ccSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1944b6f2c9ccSmrg        groff_mm_works=yes
1945b6f2c9ccSmrg    else
1946b6f2c9ccSmrg        groff_mm_works=no
1947b6f2c9ccSmrg    fi
1948b6f2c9ccSmrg    AC_MSG_RESULT([$groff_mm_works])
1949b6f2c9ccSmrgfi
1950b6f2c9ccSmrg
1951b6f2c9ccSmrg# We have groff, test for HTML dependencies, one command per package
1952b6f2c9ccSmrgif test "x$have_groff" = x"yes"; then
1953b6f2c9ccSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1954b6f2c9ccSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1955b6f2c9ccSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1956b6f2c9ccSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1957b6f2c9ccSmrg      have_groff_html=yes
1958b6f2c9ccSmrg   else
1959b6f2c9ccSmrg      have_groff_html=no
1960b6f2c9ccSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1961b6f2c9ccSmrg   fi
1962b6f2c9ccSmrgfi
1963b6f2c9ccSmrg
1964b6f2c9ccSmrg# Set Automake conditionals for Makefiles
1965b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1966b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1967b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1968b6f2c9ccSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1969b6f2c9ccSmrg]) # XORG_WITH_GROFF
1970b6f2c9ccSmrg
1971245f6787Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1972245f6787Smrg# ---------------------------------------
1973b6f2c9ccSmrg# Minimum version: 1.6.0
1974b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1975245f6787Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1976b6f2c9ccSmrg#
1977b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
1978b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
1979b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1980b6f2c9ccSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
1981b6f2c9ccSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1982b6f2c9ccSmrg# --with-fop assumes 'auto'.
1983b6f2c9ccSmrg#
1984b6f2c9ccSmrg# Interface to module:
1985b6f2c9ccSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1986b6f2c9ccSmrg# FOP:	 	returns the path of the fop program found
1987b6f2c9ccSmrg#		returns the path set by the user in the environment
1988b6f2c9ccSmrg# --with-fop: 	'yes' user instructs the module to use fop
1989b6f2c9ccSmrg#		'no' user instructs the module not to use fop
1990b6f2c9ccSmrg#
1991b6f2c9ccSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1992b6f2c9ccSmrg#
1993b6f2c9ccSmrgAC_DEFUN([XORG_WITH_FOP],[
1994b6f2c9ccSmrgAC_ARG_VAR([FOP], [Path to fop command])
1995245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
1996b6f2c9ccSmrgAC_ARG_WITH(fop,
1997b6f2c9ccSmrg	AS_HELP_STRING([--with-fop],
1998b6f2c9ccSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1999b6f2c9ccSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2000b6f2c9ccSmrgm4_undefine([_defopt])
2001b6f2c9ccSmrg
2002b6f2c9ccSmrgif test "x$use_fop" = x"auto"; then
2003b6f2c9ccSmrg   AC_PATH_PROG([FOP], [fop])
2004b6f2c9ccSmrg   if test "x$FOP" = "x"; then
2005b6f2c9ccSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2006b6f2c9ccSmrg	have_fop=no
2007b6f2c9ccSmrg   else
2008b6f2c9ccSmrg        have_fop=yes
2009b6f2c9ccSmrg   fi
2010b6f2c9ccSmrgelif test "x$use_fop" = x"yes" ; then
2011b6f2c9ccSmrg   AC_PATH_PROG([FOP], [fop])
2012b6f2c9ccSmrg   if test "x$FOP" = "x"; then
2013b6f2c9ccSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2014b6f2c9ccSmrg   fi
2015b6f2c9ccSmrg   have_fop=yes
2016b6f2c9ccSmrgelif test "x$use_fop" = x"no" ; then
2017b6f2c9ccSmrg   if test "x$FOP" != "x"; then
2018b6f2c9ccSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2019b6f2c9ccSmrg   fi
2020b6f2c9ccSmrg   have_fop=no
2021b6f2c9ccSmrgelse
2022b6f2c9ccSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2023b6f2c9ccSmrgfi
2024245f6787Smrg
2025245f6787Smrg# Test for a minimum version of fop, if provided.
2026245f6787Smrgm4_ifval([$1],
2027245f6787Smrg[if test "$have_fop" = yes; then
2028245f6787Smrg    # scrape the fop version
2029245f6787Smrg    AC_MSG_CHECKING([for fop minimum version])
2030245f6787Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2031245f6787Smrg    AC_MSG_RESULT([$fop_version])
2032245f6787Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2033245f6787Smrg        [if test "x$use_fop" = xauto; then
2034245f6787Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2035245f6787Smrg            have_fop=no
2036245f6787Smrg        else
2037245f6787Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2038245f6787Smrg        fi])
2039245f6787Smrgfi])
2040b6f2c9ccSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2041b6f2c9ccSmrg]) # XORG_WITH_FOP
2042b6f2c9ccSmrg
2043b6f2c9ccSmrg# XORG_WITH_PS2PDF([DEFAULT])
2044b6f2c9ccSmrg# ----------------
2045b6f2c9ccSmrg# Minimum version: 1.6.0
2046b6f2c9ccSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2047b6f2c9ccSmrg#
2048b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2049b6f2c9ccSmrg# not at the appropriate level. This macro enables a module to test for the
2050b6f2c9ccSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2051b6f2c9ccSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2052b6f2c9ccSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2053b6f2c9ccSmrg# --with-ps2pdf assumes 'auto'.
2054b6f2c9ccSmrg#
2055b6f2c9ccSmrg# Interface to module:
2056b6f2c9ccSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2057b6f2c9ccSmrg# PS2PDF:	returns the path of the ps2pdf program found
2058b6f2c9ccSmrg#		returns the path set by the user in the environment
2059b6f2c9ccSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2060b6f2c9ccSmrg#		 'no' user instructs the module not to use ps2pdf
2061b6f2c9ccSmrg#
2062b6f2c9ccSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2063b6f2c9ccSmrg#
2064b6f2c9ccSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2065b6f2c9ccSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2066b6f2c9ccSmrgm4_define([_defopt], m4_default([$1], [auto]))
2067b6f2c9ccSmrgAC_ARG_WITH(ps2pdf,
2068b6f2c9ccSmrg	AS_HELP_STRING([--with-ps2pdf],
2069b6f2c9ccSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2070b6f2c9ccSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2071b6f2c9ccSmrgm4_undefine([_defopt])
2072b6f2c9ccSmrg
2073b6f2c9ccSmrgif test "x$use_ps2pdf" = x"auto"; then
2074b6f2c9ccSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2075b6f2c9ccSmrg   if test "x$PS2PDF" = "x"; then
2076b6f2c9ccSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2077b6f2c9ccSmrg	have_ps2pdf=no
2078b6f2c9ccSmrg   else
2079b6f2c9ccSmrg        have_ps2pdf=yes
2080b6f2c9ccSmrg   fi
2081b6f2c9ccSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2082b6f2c9ccSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2083b6f2c9ccSmrg   if test "x$PS2PDF" = "x"; then
2084b6f2c9ccSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2085b6f2c9ccSmrg   fi
2086b6f2c9ccSmrg   have_ps2pdf=yes
2087b6f2c9ccSmrgelif test "x$use_ps2pdf" = x"no" ; then
2088b6f2c9ccSmrg   if test "x$PS2PDF" != "x"; then
2089b6f2c9ccSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2090b6f2c9ccSmrg   fi
2091b6f2c9ccSmrg   have_ps2pdf=no
2092b6f2c9ccSmrgelse
2093b6f2c9ccSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2094b6f2c9ccSmrgfi
2095b6f2c9ccSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2096b6f2c9ccSmrg]) # XORG_WITH_PS2PDF
2097b6f2c9ccSmrg
2098b6f2c9ccSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2099b6f2c9ccSmrg# ----------------
2100b6f2c9ccSmrg# Minimum version: 1.6.0
2101b6f2c9ccSmrg#
2102b6f2c9ccSmrg# Documentation tools are not always available on all platforms and sometimes
2103b6f2c9ccSmrg# not at the appropriate level. This macro enables a builder to skip all
2104b6f2c9ccSmrg# documentation targets except traditional man pages.
2105b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2106b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2107b6f2c9ccSmrg# Refer to:
2108b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2109b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2110b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2111b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2112b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2113b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2114b6f2c9ccSmrg#
2115b6f2c9ccSmrg# Interface to module:
2116b6f2c9ccSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2117b6f2c9ccSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2118b6f2c9ccSmrg#		 'no' user instructs the module not to generate docs
2119b6f2c9ccSmrg# parm1:	specify the default value, yes or no.
2120b6f2c9ccSmrg#
2121b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2122245f6787Smrgm4_define([docs_default], m4_default([$1], [yes]))
2123b6f2c9ccSmrgAC_ARG_ENABLE(docs,
2124b6f2c9ccSmrg	AS_HELP_STRING([--enable-docs],
2125245f6787Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2126245f6787Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2127245f6787Smrgm4_undefine([docs_default])
2128b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2129b6f2c9ccSmrgAC_MSG_CHECKING([whether to build documentation])
2130b6f2c9ccSmrgAC_MSG_RESULT([$build_docs])
2131b6f2c9ccSmrg]) # XORG_ENABLE_DOCS
2132b6f2c9ccSmrg
2133b6f2c9ccSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2134b6f2c9ccSmrg# ----------------
2135b6f2c9ccSmrg# Minimum version: 1.6.0
2136b6f2c9ccSmrg#
2137b6f2c9ccSmrg# This macro enables a builder to skip all developer documentation.
2138b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2139b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2140b6f2c9ccSmrg# Refer to:
2141b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2142b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2143b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2144b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2145b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2146b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2147b6f2c9ccSmrg#
2148b6f2c9ccSmrg# Interface to module:
2149b6f2c9ccSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2150b6f2c9ccSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2151b6f2c9ccSmrg#			'no' user instructs the module not to generate developer docs
2152b6f2c9ccSmrg# parm1:		specify the default value, yes or no.
2153b6f2c9ccSmrg#
2154b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2155b6f2c9ccSmrgm4_define([devel_default], m4_default([$1], [yes]))
2156b6f2c9ccSmrgAC_ARG_ENABLE(devel-docs,
2157b6f2c9ccSmrg	AS_HELP_STRING([--enable-devel-docs],
2158b6f2c9ccSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2159b6f2c9ccSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2160b6f2c9ccSmrgm4_undefine([devel_default])
2161b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2162b6f2c9ccSmrgAC_MSG_CHECKING([whether to build developer documentation])
2163b6f2c9ccSmrgAC_MSG_RESULT([$build_devel_docs])
2164b6f2c9ccSmrg]) # XORG_ENABLE_DEVEL_DOCS
2165b6f2c9ccSmrg
2166b6f2c9ccSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2167b6f2c9ccSmrg# ----------------
2168b6f2c9ccSmrg# Minimum version: 1.6.0
2169b6f2c9ccSmrg#
2170b6f2c9ccSmrg# This macro enables a builder to skip all functional specification targets.
2171b6f2c9ccSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2172b6f2c9ccSmrg# maximum flexibilty in controlling documentation building.
2173b6f2c9ccSmrg# Refer to:
2174b6f2c9ccSmrg# XORG_WITH_XMLTO         --with-xmlto
2175b6f2c9ccSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2176b6f2c9ccSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2177b6f2c9ccSmrg# XORG_WITH_FOP           --with-fop
2178b6f2c9ccSmrg# XORG_WITH_GROFF         --with-groff
2179b6f2c9ccSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2180b6f2c9ccSmrg#
2181b6f2c9ccSmrg# Interface to module:
2182b6f2c9ccSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2183b6f2c9ccSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2184b6f2c9ccSmrg#			'no' user instructs the module not to generate specs
2185b6f2c9ccSmrg# parm1:		specify the default value, yes or no.
2186b6f2c9ccSmrg#
2187b6f2c9ccSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2188b6f2c9ccSmrgm4_define([spec_default], m4_default([$1], [yes]))
2189b6f2c9ccSmrgAC_ARG_ENABLE(specs,
2190b6f2c9ccSmrg	AS_HELP_STRING([--enable-specs],
2191b6f2c9ccSmrg	   [Enable building the specs (default: ]spec_default[)]),
2192b6f2c9ccSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2193b6f2c9ccSmrgm4_undefine([spec_default])
2194b6f2c9ccSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2195b6f2c9ccSmrgAC_MSG_CHECKING([whether to build functional specifications])
2196b6f2c9ccSmrgAC_MSG_RESULT([$build_specs])
2197b6f2c9ccSmrg]) # XORG_ENABLE_SPECS
2198b6f2c9ccSmrg
2199245f6787Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2200245f6787Smrg# ----------------------------------------------
2201245f6787Smrg# Minimum version: 1.13.0
2202245f6787Smrg#
2203245f6787Smrg# This macro enables a builder to enable/disable unit testing
2204245f6787Smrg# It makes no assumption about the test cases implementation
2205245f6787Smrg# Test cases may or may not use Automake "Support for test suites"
2206245f6787Smrg# They may or may not use the software utility library GLib
2207245f6787Smrg#
2208245f6787Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2209245f6787Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2210245f6787Smrg# The variable enable_unit_tests is used by other macros in this file.
2211245f6787Smrg#
2212245f6787Smrg# Interface to module:
2213245f6787Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2214245f6787Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2215245f6787Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2216245f6787Smrg#			'no' user instructs the module not to build tests
2217245f6787Smrg# parm1:		specify the default value, yes or no.
2218245f6787Smrg#
2219245f6787SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2220245f6787SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2221245f6787SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2222663cdc11SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2223245f6787Smrgm4_define([_defopt], m4_default([$1], [auto]))
2224245f6787SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2225245f6787Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2226245f6787Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2227245f6787Smrgm4_undefine([_defopt])
2228245f6787SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2229245f6787SmrgAC_MSG_CHECKING([whether to build unit test cases])
2230245f6787SmrgAC_MSG_RESULT([$enable_unit_tests])
2231245f6787Smrg]) # XORG_ENABLE_UNIT_TESTS
2232245f6787Smrg
2233245f6787Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2234245f6787Smrg# ----------------------------------------
2235245f6787Smrg# Minimum version: 1.13.0
2236245f6787Smrg#
2237245f6787Smrg# GLib is a library which provides advanced data structures and functions.
2238245f6787Smrg# This macro enables a module to test for the presence of Glib.
2239245f6787Smrg#
2240245f6787Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2241245f6787Smrg# Otherwise the value of $enable_unit_tests is blank.
2242245f6787Smrg#
2243245f6787Smrg# Interface to module:
2244245f6787Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2245245f6787Smrg# with_glib: used in configure.ac to know if GLib has been found
2246245f6787Smrg# --with-glib:	'yes' user instructs the module to use glib
2247245f6787Smrg#		'no' user instructs the module not to use glib
2248245f6787Smrg#
2249245f6787SmrgAC_DEFUN([XORG_WITH_GLIB],[
2250245f6787SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2251245f6787Smrgm4_define([_defopt], m4_default([$2], [auto]))
2252245f6787SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2253245f6787Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2254245f6787Smrg	[with_glib=$withval], [with_glib=]_defopt)
2255245f6787Smrgm4_undefine([_defopt])
2256245f6787Smrg
2257245f6787Smrghave_glib=no
2258245f6787Smrg# Do not probe GLib if user explicitly disabled unit testing
2259245f6787Smrgif test "x$enable_unit_tests" != x"no"; then
2260245f6787Smrg  # Do not probe GLib if user explicitly disabled it
2261245f6787Smrg  if test "x$with_glib" != x"no"; then
2262245f6787Smrg    m4_ifval(
2263245f6787Smrg      [$1],
2264245f6787Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2265245f6787Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2266245f6787Smrg    )
2267245f6787Smrg  fi
2268245f6787Smrgfi
2269245f6787Smrg
2270245f6787Smrg# Not having GLib when unit testing has been explicitly requested is an error
2271245f6787Smrgif test "x$enable_unit_tests" = x"yes"; then
2272245f6787Smrg  if test "x$have_glib" = x"no"; then
2273245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2274245f6787Smrg  fi
2275245f6787Smrgfi
2276245f6787Smrg
2277245f6787Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2278245f6787Smrgif test "x$enable_unit_tests" = x"no"; then
2279245f6787Smrg  if test "x$with_glib" = x"yes"; then
2280245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2281245f6787Smrg  fi
2282245f6787Smrgfi
2283245f6787Smrg
2284245f6787Smrg# Not having GLib when it has been explicitly requested is an error
2285245f6787Smrgif test "x$with_glib" = x"yes"; then
2286245f6787Smrg  if test "x$have_glib" = x"no"; then
2287245f6787Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2288245f6787Smrg  fi
2289245f6787Smrgfi
2290245f6787Smrg
2291245f6787SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2292245f6787Smrg]) # XORG_WITH_GLIB
2293245f6787Smrg
2294663cdc11Smrg# XORG_LD_WRAP([required|optional])
2295663cdc11Smrg# ---------------------------------
2296245f6787Smrg# Minimum version: 1.13.0
2297245f6787Smrg#
2298245f6787Smrg# Check if linker supports -wrap, passed via compiler flags
2299245f6787Smrg#
2300245f6787Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2301245f6787Smrg# Otherwise the value of $enable_unit_tests is blank.
2302245f6787Smrg#
2303663cdc11Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2304663cdc11Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2305663cdc11Smrg# available, an argument of "optional" allows use when some unit tests require
2306663cdc11Smrg# ld -wrap and others do not.
2307663cdc11Smrg#
2308245f6787SmrgAC_DEFUN([XORG_LD_WRAP],[
2309663cdc11SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2310663cdc11Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2311663cdc11Smrg                      void __wrap_exit(int status) { return; }],
2312663cdc11Smrg                     [exit(0);])])
2313245f6787Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2314663cdc11Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2315245f6787Smrg  if test "x$have_ld_wrap" = x"no"; then
2316245f6787Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2317245f6787Smrg  fi
2318245f6787Smrgfi
2319245f6787SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2320245f6787Smrg#
2321245f6787Smrg]) # XORG_LD_WRAP
2322245f6787Smrg
2323245f6787Smrg# XORG_CHECK_LINKER_FLAGS
2324245f6787Smrg# -----------------------
2325245f6787Smrg# SYNOPSIS
2326245f6787Smrg#
2327663cdc11Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2328245f6787Smrg#
2329245f6787Smrg# DESCRIPTION
2330245f6787Smrg#
2331245f6787Smrg#   Check whether the given linker FLAGS work with the current language's
2332245f6787Smrg#   linker, or whether they give an error.
2333245f6787Smrg#
2334245f6787Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2335245f6787Smrg#   success/failure.
2336245f6787Smrg#
2337663cdc11Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2338663cdc11Smrg#
2339245f6787Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2340245f6787Smrg#
2341245f6787Smrg# LICENSE
2342245f6787Smrg#
2343245f6787Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2344245f6787Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2345245f6787Smrg#   Copyright (c) 2009 Matteo Frigo
2346245f6787Smrg#
2347245f6787Smrg#   This program is free software: you can redistribute it and/or modify it
2348245f6787Smrg#   under the terms of the GNU General Public License as published by the
2349245f6787Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2350245f6787Smrg#   option) any later version.
2351245f6787Smrg#
2352245f6787Smrg#   This program is distributed in the hope that it will be useful, but
2353245f6787Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2354245f6787Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2355245f6787Smrg#   Public License for more details.
2356245f6787Smrg#
2357245f6787Smrg#   You should have received a copy of the GNU General Public License along
2358245f6787Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2359245f6787Smrg#
2360245f6787Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2361245f6787Smrg#   gives unlimited permission to copy, distribute and modify the configure
2362245f6787Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2363245f6787Smrg#   need not follow the terms of the GNU General Public License when using
2364245f6787Smrg#   or distributing such scripts, even though portions of the text of the
2365245f6787Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2366245f6787Smrg#   all other use of the material that constitutes the Autoconf Macro.
2367245f6787Smrg#
2368245f6787Smrg#   This special exception to the GPL applies to versions of the Autoconf
2369245f6787Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2370245f6787Smrg#   modified version of the Autoconf Macro, you may extend this special
2371245f6787Smrg#   exception to the GPL to apply to your modified version as well.#
2372245f6787SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2373245f6787Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2374245f6787Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2375245f6787SmrgAS_LITERAL_IF([$1],
2376245f6787Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2377245f6787Smrg      ax_save_FLAGS=$LDFLAGS
2378245f6787Smrg      LDFLAGS="$1"
2379663cdc11Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2380245f6787Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2381245f6787Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2382245f6787Smrg      LDFLAGS=$ax_save_FLAGS])],
2383245f6787Smrg  [ax_save_FLAGS=$LDFLAGS
2384245f6787Smrg   LDFLAGS="$1"
2385245f6787Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2386245f6787Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2387245f6787Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2388245f6787Smrg   LDFLAGS=$ax_save_FLAGS])
2389245f6787Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2390245f6787SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2391245f6787Smrgif test "x$xorg_check_linker_flags" = xyes; then
2392245f6787Smrg	m4_default([$2], :)
2393245f6787Smrgelse
2394245f6787Smrg	m4_default([$3], :)
2395245f6787Smrgfi
2396245f6787Smrg]) # XORG_CHECK_LINKER_FLAGS
2397245f6787Smrg
2398663cdc11Smrg# XORG_MEMORY_CHECK_FLAGS
2399663cdc11Smrg# -----------------------
2400663cdc11Smrg# Minimum version: 1.16.0
2401663cdc11Smrg#
2402663cdc11Smrg# This macro attempts to find appropriate memory checking functionality
2403663cdc11Smrg# for various platforms which unit testing code may use to catch various
2404663cdc11Smrg# forms of memory allocation and access errors in testing.
2405663cdc11Smrg#
2406663cdc11Smrg# Interface to module:
2407663cdc11Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2408663cdc11Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2409663cdc11Smrg#
2410663cdc11Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2411663cdc11Smrg#
2412663cdc11SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2413663cdc11Smrg
2414663cdc11SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2415663cdc11SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2416663cdc11Smrg           [Environment variables to enable memory checking in tests])
2417663cdc11Smrg
2418663cdc11Smrg# Check for different types of support on different platforms
2419663cdc11Smrgcase $host_os in
2420663cdc11Smrg    solaris*)
2421663cdc11Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2422663cdc11Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2423663cdc11Smrg        ;;
2424663cdc11Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2425663cdc11Smrg        # both directly and inverted, so should not be 0 or 255.
2426663cdc11Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2427663cdc11Smrg        ;;
2428663cdc11Smrg    darwin*)
2429663cdc11Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2430663cdc11Smrg        ;;
2431663cdc11Smrg    *bsd*)
2432663cdc11Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2433663cdc11Smrg        ;;
2434663cdc11Smrgesac
2435663cdc11Smrg
2436663cdc11Smrg# User supplied flags override default flags
2437663cdc11Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2438663cdc11Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2439663cdc11Smrgfi
2440663cdc11Smrg
2441663cdc11SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2442663cdc11Smrg]) # XORG_WITH_LINT
2443663cdc11Smrg
24447978d3cdSmrg# XORG_CHECK_MALLOC_ZERO
24457978d3cdSmrg# ----------------------
24467978d3cdSmrg# Minimum version: 1.0.0
2447ea6ae205Smrg#
24487978d3cdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
24497978d3cdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
24507978d3cdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
24517978d3cdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
24527978d3cdSmrgAC_ARG_ENABLE(malloc0returnsnull,
2453e83ac88aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
24547978d3cdSmrg		       [malloc(0) returns NULL (default: auto)]),
24557978d3cdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
24567978d3cdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2457ea6ae205Smrg
24587978d3cdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
24597978d3cdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2460245f6787Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2461245f6787Smrg#include <stdlib.h>
2462245f6787Smrg],[
24637978d3cdSmrg    char *m0, *r0, *c0, *p;
24647978d3cdSmrg    m0 = malloc(0);
24657978d3cdSmrg    p = malloc(10);
24667978d3cdSmrg    r0 = realloc(p,0);
2467245f6787Smrg    c0 = calloc(0,10);
2468245f6787Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2469245f6787Smrg])],
24707978d3cdSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2471b6f2c9ccSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
2472b6f2c9ccSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
24737978d3cdSmrgfi
24747978d3cdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2475ea6ae205Smrg
24767978d3cdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
24777978d3cdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
24787978d3cdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
24797978d3cdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
24807978d3cdSmrgelse
24817978d3cdSmrg	MALLOC_ZERO_CFLAGS=""
24827978d3cdSmrg	XMALLOC_ZERO_CFLAGS=""
24837978d3cdSmrg	XTMALLOC_ZERO_CFLAGS=""
24847978d3cdSmrgfi
2485ea6ae205Smrg
24867978d3cdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
24877978d3cdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
24887978d3cdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
24897978d3cdSmrg]) # XORG_CHECK_MALLOC_ZERO
2490ea6ae205Smrg
24917978d3cdSmrg# XORG_WITH_LINT()
24927978d3cdSmrg# ----------------
24937978d3cdSmrg# Minimum version: 1.1.0
24947978d3cdSmrg#
2495b6f2c9ccSmrg# This macro enables the use of a tool that flags some suspicious and
2496b6f2c9ccSmrg# non-portable constructs (likely to be bugs) in C language source code.
2497b6f2c9ccSmrg# It will attempt to locate the tool and use appropriate options.
2498b6f2c9ccSmrg# There are various lint type tools on different platforms.
2499b6f2c9ccSmrg#
2500b6f2c9ccSmrg# Interface to module:
2501b6f2c9ccSmrg# LINT:		returns the path to the tool found on the platform
2502b6f2c9ccSmrg#		or the value set to LINT on the configure cmd line
2503b6f2c9ccSmrg#		also an Automake conditional
2504b6f2c9ccSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2505b6f2c9ccSmrg#
2506b6f2c9ccSmrg# --with-lint:	'yes' user instructs the module to use lint
2507b6f2c9ccSmrg#		'no' user instructs the module not to use lint (default)
2508b6f2c9ccSmrg#
2509b6f2c9ccSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2510b6f2c9ccSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
25117978d3cdSmrg#
25127978d3cdSmrgAC_DEFUN([XORG_WITH_LINT],[
2513ea6ae205Smrg
2514b6f2c9ccSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2515b6f2c9ccSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2516e83ac88aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
25177978d3cdSmrg		[Use a lint-style source code checker (default: disabled)])],
25187978d3cdSmrg		[use_lint=$withval], [use_lint=no])
2519b6f2c9ccSmrg
2520b6f2c9ccSmrg# Obtain platform specific info like program name and options
2521b6f2c9ccSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2522b6f2c9ccSmrgcase $host_os in
2523b6f2c9ccSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2524b6f2c9ccSmrg	lint_name=splint
2525b6f2c9ccSmrg	lint_options="-badflag"
2526b6f2c9ccSmrg	;;
2527b6f2c9ccSmrg  *freebsd* | *netbsd*)
2528b6f2c9ccSmrg	lint_name=lint
2529b6f2c9ccSmrg	lint_options="-u -b"
2530b6f2c9ccSmrg	;;
2531b6f2c9ccSmrg  *solaris*)
2532b6f2c9ccSmrg	lint_name=lint
2533b6f2c9ccSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2534b6f2c9ccSmrg	;;
2535b6f2c9ccSmrgesac
2536b6f2c9ccSmrg
2537b6f2c9ccSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2538b6f2c9ccSmrgif test "x$use_lint" = x"yes" ; then
2539b6f2c9ccSmrg   AC_PATH_PROG([LINT], [$lint_name])
2540b6f2c9ccSmrg   if test "x$LINT" = "x"; then
2541b6f2c9ccSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2542b6f2c9ccSmrg   fi
2543b6f2c9ccSmrgelif test "x$use_lint" = x"no" ; then
2544b6f2c9ccSmrg   if test "x$LINT" != "x"; then
2545b6f2c9ccSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2546b6f2c9ccSmrg   fi
25477978d3cdSmrgelse
2548b6f2c9ccSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
25497978d3cdSmrgfi
2550b6f2c9ccSmrg
2551b6f2c9ccSmrg# User supplied flags override default flags
2552b6f2c9ccSmrgif test "x$LINT_FLAGS" != "x"; then
2553b6f2c9ccSmrg   lint_options=$LINT_FLAGS
25547978d3cdSmrgfi
2555ea6ae205Smrg
2556b6f2c9ccSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2557b6f2c9ccSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2558ea6ae205Smrg
25597978d3cdSmrg]) # XORG_WITH_LINT
25607978d3cdSmrg
25617978d3cdSmrg# XORG_LINT_LIBRARY(LIBNAME)
25627978d3cdSmrg# --------------------------
25637978d3cdSmrg# Minimum version: 1.1.0
25647978d3cdSmrg#
25657978d3cdSmrg# Sets up flags for building lint libraries for checking programs that call
25667978d3cdSmrg# functions in the library.
2567ea6ae205Smrg#
2568b6f2c9ccSmrg# Interface to module:
2569b6f2c9ccSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2570b6f2c9ccSmrg# MAKE_LINT_LIB		- Automake conditional
2571b6f2c9ccSmrg#
2572b6f2c9ccSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2573b6f2c9ccSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2574ea6ae205Smrg
25757978d3cdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
25767978d3cdSmrgAC_REQUIRE([XORG_WITH_LINT])
2577e83ac88aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
25787978d3cdSmrg	[Create lint library (default: disabled)])],
25797978d3cdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2580b6f2c9ccSmrg
2581b6f2c9ccSmrgif test "x$make_lint_lib" = x"yes" ; then
2582b6f2c9ccSmrg   LINTLIB=llib-l$1.ln
2583b6f2c9ccSmrg   if test "x$LINT" = "x"; then
2584b6f2c9ccSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2585b6f2c9ccSmrg   fi
2586b6f2c9ccSmrgelif test "x$make_lint_lib" != x"no" ; then
2587b6f2c9ccSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
25887978d3cdSmrgfi
2589b6f2c9ccSmrg
25907978d3cdSmrgAC_SUBST(LINTLIB)
25917978d3cdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2592ea6ae205Smrg
25937978d3cdSmrg]) # XORG_LINT_LIBRARY
25947978d3cdSmrg
2595245f6787Smrg# XORG_COMPILER_BRAND
2596245f6787Smrg# -------------------
2597245f6787Smrg# Minimum version: 1.14.0
2598245f6787Smrg#
2599245f6787Smrg# Checks for various brands of compilers and sets flags as appropriate:
2600245f6787Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2601245f6787Smrg#   clang compiler - sets CLANGCC to "yes"
2602245f6787Smrg#   Intel compiler - sets INTELCC to "yes"
2603245f6787Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2604245f6787Smrg#
2605245f6787SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2606245f6787SmrgAC_REQUIRE([AC_PROG_CC_C99])
2607245f6787SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2608245f6787SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2609245f6787SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2610245f6787Smrg]) # XORG_COMPILER_BRAND
2611245f6787Smrg
2612663cdc11Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2613663cdc11Smrg# ---------------
2614663cdc11Smrg# Minimum version: 1.16.0
2615663cdc11Smrg#
2616663cdc11Smrg# Test if the compiler works when passed the given flag as a command line argument.
2617663cdc11Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2618663cdc11Smrg# next flag in the list until there are no more options.
2619663cdc11Smrg#
2620663cdc11Smrg# Note that this does not guarantee that the compiler supports the flag as some
2621663cdc11Smrg# compilers will simply ignore arguments that they do not understand, but we do
2622663cdc11Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2623663cdc11Smrg# -Werror=unused-command-line-argument
2624663cdc11Smrg#
2625663cdc11SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2626663cdc11SmrgAC_REQUIRE([AC_PROG_CC_C99])
2627663cdc11Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2628663cdc11Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2629663cdc11Smrg
2630663cdc11Smrgxorg_testset_save_CFLAGS="$CFLAGS"
2631663cdc11Smrg
2632663cdc11Smrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
2633663cdc11Smrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2634663cdc11Smrg	AC_CACHE_CHECK([if $CC supports -Werror=unknown-warning-option],
2635663cdc11Smrg			xorg_cv_cc_flag_unknown_warning_option,
2636663cdc11Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2637663cdc11Smrg					  [xorg_cv_cc_flag_unknown_warning_option=yes],
2638663cdc11Smrg					  [xorg_cv_cc_flag_unknown_warning_option=no]))
2639663cdc11Smrg	xorg_testset_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option
2640663cdc11Smrg	CFLAGS="$xorg_testset_save_CFLAGS"
2641663cdc11Smrgfi
2642663cdc11Smrg
2643663cdc11Smrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
2644663cdc11Smrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2645663cdc11Smrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2646663cdc11Smrg	fi
2647663cdc11Smrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2648663cdc11Smrg	AC_CACHE_CHECK([if $CC supports -Werror=unused-command-line-argument],
2649663cdc11Smrg			xorg_cv_cc_flag_unused_command_line_argument,
2650663cdc11Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2651663cdc11Smrg					  [xorg_cv_cc_flag_unused_command_line_argument=yes],
2652663cdc11Smrg					  [xorg_cv_cc_flag_unused_command_line_argument=no]))
2653663cdc11Smrg	xorg_testset_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument
2654663cdc11Smrg	CFLAGS="$xorg_testset_save_CFLAGS"
2655663cdc11Smrgfi
2656663cdc11Smrg
2657663cdc11Smrgfound="no"
2658663cdc11Smrgm4_foreach([flag], m4_cdr($@), [
2659663cdc11Smrg	if test $found = "no" ; then
2660663cdc11Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2661663cdc11Smrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2662663cdc11Smrg		fi
2663663cdc11Smrg
2664663cdc11Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2665663cdc11Smrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2666663cdc11Smrg		fi
2667663cdc11Smrg
2668663cdc11Smrg		CFLAGS="$CFLAGS ]flag["
2669663cdc11Smrg
2670663cdc11Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2671663cdc11Smrg		AC_MSG_CHECKING([if $CC supports ]flag[])
2672663cdc11Smrg		cacheid=`AS_ECHO_N([xorg_cv_cc_flag_]flag[])`
2673663cdc11Smrg		AC_CACHE_VAL(AS_TR_SH($cacheid),
2674663cdc11Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2675663cdc11Smrg					     [eval AS_TR_SH($cacheid)=yes],
2676663cdc11Smrg					     [eval AS_TR_SH($cacheid)=no])])
2677663cdc11Smrg
2678663cdc11Smrg		CFLAGS="$xorg_testset_save_CFLAGS"
2679663cdc11Smrg
2680663cdc11Smrg		eval supported=$AS_TR_SH($cacheid)
2681663cdc11Smrg		AC_MSG_RESULT([$supported])
2682663cdc11Smrg		if test "$supported" = "yes" ; then
2683663cdc11Smrg			$1="$$1 ]flag["
2684663cdc11Smrg			found="yes"
2685663cdc11Smrg		fi
2686663cdc11Smrg	fi
2687663cdc11Smrg])
2688663cdc11Smrg]) # XORG_TESTSET_CFLAG
2689663cdc11Smrg
2690663cdc11Smrg# XORG_COMPILER_FLAGS
2691663cdc11Smrg# ---------------
2692663cdc11Smrg# Minimum version: 1.16.0
2693663cdc11Smrg#
2694663cdc11Smrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
2695663cdc11Smrg# by the selected compiler which do NOT alter the generated code.  These
2696663cdc11Smrg# arguments will cause the compiler to print various warnings during
2697663cdc11Smrg# compilation AND turn a conservative set of warnings into errors.
2698663cdc11Smrg#
2699663cdc11Smrg# The set of flags supported by BASE_CFLAGS will grow in future
2700663cdc11Smrg# versions of util-macros as options are added to new compilers.
2701663cdc11Smrg#
2702663cdc11SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2703663cdc11SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2704663cdc11Smrg
2705663cdc11SmrgAC_ARG_ENABLE(selective-werror,
2706663cdc11Smrg              AS_HELP_STRING([--disable-selective-werror],
2707663cdc11Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2708663cdc11Smrg              [SELECTIVE_WERROR=$enableval],
2709663cdc11Smrg              [SELECTIVE_WERROR=yes])
2710663cdc11Smrg
2711663cdc11Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2712663cdc11Smrgif test "x$SUNCC" = "xyes"; then
2713663cdc11Smrg    BASE_CFLAGS="-v"
2714663cdc11Smrgelse
2715663cdc11Smrg    BASE_CFLAGS=""
2716663cdc11Smrgfi
2717663cdc11Smrg
2718663cdc11Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2719663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
2720663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
2721663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
2722663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
2723663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
2724663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
2725663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
2726663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
2727663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
2728663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
2729663cdc11Smrg
2730663cdc11Smrg# This chunk adds additional warnings that could catch undesired effects.
2731663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
2732663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
2733663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
2734663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
2735663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
2736663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
2737663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
2738663cdc11Smrg
2739663cdc11Smrg# These are currently disabled because they are noisy.  They will be enabled
2740663cdc11Smrg# in the future once the codebase is sufficiently modernized to silence
2741663cdc11Smrg# them.  For now, I don't want them to drown out the other warnings.
2742663cdc11Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
2743663cdc11Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
2744663cdc11Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
2745663cdc11Smrg
2746663cdc11Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2747663cdc11Smrg# when there are problems that should be fixed.
2748663cdc11Smrg
2749663cdc11Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2750663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2751663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
2752663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
2753663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
2754663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
2755663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
2756663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2757663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
2758663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
2759663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
2760663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
2761663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2762663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2763663cdc11Smrgelse
2764663cdc11SmrgAC_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])
2765663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
2766663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
2767663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
2768663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
2769663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
2770663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
2771663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
2772663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
2773663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
2774663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
2775663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
2776663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
2777663cdc11SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
2778663cdc11Smrgfi
2779663cdc11Smrg
2780663cdc11SmrgAC_SUBST([BASE_CFLAGS])
2781663cdc11Smrg]) # XORG_COMPILER_FLAGS
2782663cdc11Smrg
27837978d3cdSmrg# XORG_CWARNFLAGS
2784ea6ae205Smrg# ---------------
27857978d3cdSmrg# Minimum version: 1.2.0
2786663cdc11Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
27877978d3cdSmrg#
27887978d3cdSmrg# Defines CWARNFLAGS to enable C compiler warnings.
27897978d3cdSmrg#
2790663cdc11Smrg# This function is deprecated because it defines -fno-strict-aliasing
2791663cdc11Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2792663cdc11Smrg# is needed, then it should be added explicitly in the module when
2793663cdc11Smrg# it is updated to use BASE_CFLAGS.
2794663cdc11Smrg#
27957978d3cdSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2796663cdc11SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2797245f6787SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2798663cdc11SmrgCWARNFLAGS="$BASE_CFLAGS"
27997978d3cdSmrgif  test "x$GCC" = xyes ; then
2800663cdc11Smrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
28017978d3cdSmrgfi
28027978d3cdSmrgAC_SUBST(CWARNFLAGS)
28037978d3cdSmrg]) # XORG_CWARNFLAGS
2804e83ac88aSmrg
2805e83ac88aSmrg# XORG_STRICT_OPTION
2806e83ac88aSmrg# -----------------------
2807e83ac88aSmrg# Minimum version: 1.3.0
2808e83ac88aSmrg#
2809245f6787Smrg# Add configure option to enable strict compilation flags, such as treating
2810245f6787Smrg# warnings as fatal errors.
2811245f6787Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2812663cdc11Smrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
2813245f6787Smrg#
2814245f6787Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2815245f6787Smrg# when strict compilation is unconditionally desired.
2816e83ac88aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2817e83ac88aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2818663cdc11SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2819e83ac88aSmrg
2820e83ac88aSmrgAC_ARG_ENABLE(strict-compilation,
2821e83ac88aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2822e83ac88aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2823e83ac88aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2824663cdc11Smrg
2825663cdc11SmrgSTRICT_CFLAGS=""
2826663cdc11SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
2827663cdc11SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
2828663cdc11Smrg
2829663cdc11Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2830663cdc11Smrg# activate it with -Werror, so we add it here explicitly.
2831663cdc11SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
2832663cdc11Smrg
2833e83ac88aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2834663cdc11Smrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
2835245f6787Smrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2836e83ac88aSmrgfi
2837245f6787SmrgAC_SUBST([STRICT_CFLAGS])
2838663cdc11SmrgAC_SUBST([BASE_CFLAGS])
2839e83ac88aSmrgAC_SUBST([CWARNFLAGS])
2840e83ac88aSmrg]) # XORG_STRICT_OPTION
2841e83ac88aSmrg
2842e83ac88aSmrg# XORG_DEFAULT_OPTIONS
2843e83ac88aSmrg# --------------------
2844e83ac88aSmrg# Minimum version: 1.3.0
2845e83ac88aSmrg#
2846e83ac88aSmrg# Defines default options for X.Org modules.
2847e83ac88aSmrg#
2848e83ac88aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2849b6f2c9ccSmrgAC_REQUIRE([AC_PROG_INSTALL])
2850663cdc11SmrgXORG_COMPILER_FLAGS
2851e83ac88aSmrgXORG_CWARNFLAGS
2852e83ac88aSmrgXORG_STRICT_OPTION
2853e83ac88aSmrgXORG_RELEASE_VERSION
2854e83ac88aSmrgXORG_CHANGELOG
2855b6f2c9ccSmrgXORG_INSTALL
2856e83ac88aSmrgXORG_MANPAGE_SECTIONS
2857b6f2c9ccSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2858b6f2c9ccSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2859e83ac88aSmrg]) # XORG_DEFAULT_OPTIONS
2860b6f2c9ccSmrg
2861b6f2c9ccSmrg# XORG_INSTALL()
2862b6f2c9ccSmrg# ----------------
2863b6f2c9ccSmrg# Minimum version: 1.4.0
2864b6f2c9ccSmrg#
2865b6f2c9ccSmrg# Defines the variable INSTALL_CMD as the command to copy
2866b6f2c9ccSmrg# INSTALL from $prefix/share/util-macros.
2867b6f2c9ccSmrg#
2868b6f2c9ccSmrgAC_DEFUN([XORG_INSTALL], [
2869b6f2c9ccSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2870b6f2c9ccSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2871b6f2c9ccSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2872b6f2c9ccSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2873b6f2c9ccSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2874b6f2c9ccSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2875b6f2c9ccSmrgAC_SUBST([INSTALL_CMD])
2876b6f2c9ccSmrg]) # XORG_INSTALL
28777978d3cdSmrgdnl Copyright 2005 Red Hat, Inc
28787978d3cdSmrgdnl
28797978d3cdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
28807978d3cdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
28817978d3cdSmrgdnl the above copyright notice appear in all copies and that both that
28827978d3cdSmrgdnl copyright notice and this permission notice appear in supporting
28837978d3cdSmrgdnl documentation.
28847978d3cdSmrgdnl
28857978d3cdSmrgdnl The above copyright notice and this permission notice shall be included
28867978d3cdSmrgdnl in all copies or substantial portions of the Software.
28877978d3cdSmrgdnl
28887978d3cdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
28897978d3cdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28907978d3cdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28917978d3cdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
28927978d3cdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28937978d3cdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28947978d3cdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
28957978d3cdSmrgdnl
28967978d3cdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
28977978d3cdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
28987978d3cdSmrgdnl other dealings in this Software without prior written authorization
28997978d3cdSmrgdnl from the copyright holders.
29007978d3cdSmrgdnl
2901ea6ae205Smrg
29027978d3cdSmrg# XORG_RELEASE_VERSION
29037978d3cdSmrg# --------------------
2904b6f2c9ccSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
29057978d3cdSmrg 
29067978d3cdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
29077978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
29087978d3cdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
29097978d3cdSmrg		[Major version of this package])
29107978d3cdSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
29117978d3cdSmrg	if test "x$PVM" = "x"; then
29127978d3cdSmrg		PVM="0"
29137978d3cdSmrg	fi
29147978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
29157978d3cdSmrg		[$PVM],
29167978d3cdSmrg		[Minor version of this package])
29177978d3cdSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
29187978d3cdSmrg	if test "x$PVP" = "x"; then
29197978d3cdSmrg		PVP="0"
29207978d3cdSmrg	fi
29217978d3cdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
29227978d3cdSmrg		[$PVP],
29237978d3cdSmrg		[Patch version of this package])
29247978d3cdSmrg])
2925ea6ae205Smrg
29267978d3cdSmrg# XORG_CHANGELOG()
29277978d3cdSmrg# ----------------
29287978d3cdSmrg# Minimum version: 1.2.0
29297978d3cdSmrg#
29307978d3cdSmrg# Defines the variable CHANGELOG_CMD as the command to generate
29317978d3cdSmrg# ChangeLog from git.
29327978d3cdSmrg#
29337978d3cdSmrg#
29347978d3cdSmrgAC_DEFUN([XORG_CHANGELOG], [
2935b6f2c9ccSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2936b6f2c9ccSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2937b6f2c9ccSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
29387978d3cdSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
29397978d3cdSmrgAC_SUBST([CHANGELOG_CMD])
29407978d3cdSmrg]) # XORG_CHANGELOG
2941ea6ae205Smrg
2942