aclocal.m4 revision 1d8c7986
183e5f723Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2f46a6179Smrg
3f46a6179Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
434345a63Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5f46a6179Smrg# This file is free software; the Free Software Foundation
6f46a6179Smrg# gives unlimited permission to copy and/or distribute it,
7f46a6179Smrg# with or without modifications, as long as this notice is preserved.
8f46a6179Smrg
9f46a6179Smrg# This program is distributed in the hope that it will be useful,
10f46a6179Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11f46a6179Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12f46a6179Smrg# PARTICULAR PURPOSE.
13f46a6179Smrg
14f46a6179Smrgm4_ifndef([AC_AUTOCONF_VERSION],
15f46a6179Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16690143ccSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17690143ccSmrg[m4_warning([this file was generated for autoconf 2.68.
18f46a6179SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19f46a6179SmrgIf you have problems, you may need to regenerate the build system entirely.
20f46a6179SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21f46a6179Smrg
221d8c7986Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
2307d2e718Smrg#
241d8c7986Smrg# This file is free software; the Free Software Foundation
251d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
261d8c7986Smrg# with or without modifications, as long as this notice is preserved.
2707d2e718Smrg
281d8c7986Smrg# AM_AUTOMAKE_VERSION(VERSION)
291d8c7986Smrg# ----------------------------
301d8c7986Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
311d8c7986Smrg# generated from the m4 files accompanying Automake X.Y.
321d8c7986Smrg# (This private macro should not be called outside this file.)
331d8c7986SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
341d8c7986Smrg[am__api_version='1.11'
351d8c7986Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
361d8c7986Smrgdnl require some minimum version.  Point them to the right macro.
371d8c7986Smrgm4_if([$1], [1.11.1], [],
381d8c7986Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
391d8c7986Smrg])
4007d2e718Smrg
411d8c7986Smrg# _AM_AUTOCONF_VERSION(VERSION)
421d8c7986Smrg# -----------------------------
431d8c7986Smrg# aclocal traces this macro to find the Autoconf version.
441d8c7986Smrg# This is a private macro too.  Using m4_define simplifies
451d8c7986Smrg# the logic in aclocal, which can simply ignore this definition.
461d8c7986Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4707d2e718Smrg
481d8c7986Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
491d8c7986Smrg# -------------------------------
501d8c7986Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
511d8c7986Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
521d8c7986SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
531d8c7986Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
541d8c7986Smrgm4_ifndef([AC_AUTOCONF_VERSION],
551d8c7986Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
561d8c7986Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5707d2e718Smrg
581d8c7986Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
5907d2e718Smrg
601d8c7986Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
611d8c7986Smrg#
621d8c7986Smrg# This file is free software; the Free Software Foundation
631d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
641d8c7986Smrg# with or without modifications, as long as this notice is preserved.
6507d2e718Smrg
661d8c7986Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
671d8c7986Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
681d8c7986Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6907d2e718Smrg#
701d8c7986Smrg# Of course, Automake must honor this variable whenever it calls a
711d8c7986Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
721d8c7986Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
731d8c7986Smrg# depending on how configure is run.  This is pretty annoying, since
741d8c7986Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
751d8c7986Smrg# source directory, any form will work fine, but in subdirectories a
761d8c7986Smrg# relative path needs to be adjusted first.
7707d2e718Smrg#
781d8c7986Smrg# $ac_aux_dir/missing
791d8c7986Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
801d8c7986Smrg# $top_srcdir/$ac_aux_dir/missing
811d8c7986Smrg#    fails if $ac_aux_dir is absolute,
821d8c7986Smrg#    fails when called from a subdirectory in a VPATH build with
831d8c7986Smrg#          a relative $ac_aux_dir
8407d2e718Smrg#
851d8c7986Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
861d8c7986Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
871d8c7986Smrg# harmless because $srcdir is `.', but things will broke when you
881d8c7986Smrg# start a VPATH build or use an absolute $srcdir.
8907d2e718Smrg#
901d8c7986Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
911d8c7986Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
921d8c7986Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
931d8c7986Smrg# and then we would define $MISSING as
941d8c7986Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
951d8c7986Smrg# This will work as long as MISSING is not called from configure, because
961d8c7986Smrg# unfortunately $(top_srcdir) has no meaning in configure.
971d8c7986Smrg# However there are other variables, like CC, which are often used in
981d8c7986Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
991d8c7986Smrg#
1001d8c7986Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1011d8c7986Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1021d8c7986Smrg# configured tree to be moved without reconfiguration.
10307d2e718Smrg
1041d8c7986SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1051d8c7986Smrg[dnl Rely on autoconf to set up CDPATH properly.
1061d8c7986SmrgAC_PREREQ([2.50])dnl
1071d8c7986Smrg# expand $ac_aux_dir to an absolute path
1081d8c7986Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
1091d8c7986Smrg])
11007d2e718Smrg
1111d8c7986Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11207d2e718Smrg
1131d8c7986Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1141d8c7986Smrg# Free Software Foundation, Inc.
1151d8c7986Smrg#
1161d8c7986Smrg# This file is free software; the Free Software Foundation
1171d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
1181d8c7986Smrg# with or without modifications, as long as this notice is preserved.
11907d2e718Smrg
1201d8c7986Smrg# serial 9
12107d2e718Smrg
1221d8c7986Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1231d8c7986Smrg# -------------------------------------
1241d8c7986Smrg# Define a conditional.
1251d8c7986SmrgAC_DEFUN([AM_CONDITIONAL],
1261d8c7986Smrg[AC_PREREQ(2.52)dnl
1271d8c7986Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1281d8c7986Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1291d8c7986SmrgAC_SUBST([$1_TRUE])dnl
1301d8c7986SmrgAC_SUBST([$1_FALSE])dnl
1311d8c7986Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1321d8c7986Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1331d8c7986Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1341d8c7986Smrgif $2; then
1351d8c7986Smrg  $1_TRUE=
1361d8c7986Smrg  $1_FALSE='#'
1371d8c7986Smrgelse
1381d8c7986Smrg  $1_TRUE='#'
1391d8c7986Smrg  $1_FALSE=
1401d8c7986Smrgfi
1411d8c7986SmrgAC_CONFIG_COMMANDS_PRE(
1421d8c7986Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1431d8c7986Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1441d8c7986SmrgUsually this means the macro was only invoked conditionally.]])
1451d8c7986Smrgfi])])
14607d2e718Smrg
1471d8c7986Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
1481d8c7986Smrg# Free Software Foundation, Inc.
1491d8c7986Smrg#
1501d8c7986Smrg# This file is free software; the Free Software Foundation
1511d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
1521d8c7986Smrg# with or without modifications, as long as this notice is preserved.
15307d2e718Smrg
1541d8c7986Smrg# serial 10
15507d2e718Smrg
1561d8c7986Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1571d8c7986Smrg# written in clear, in which case automake, when reading aclocal.m4,
1581d8c7986Smrg# will think it sees a *use*, and therefore will trigger all it's
1591d8c7986Smrg# C support machinery.  Also note that it means that autoscan, seeing
1601d8c7986Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
16107d2e718Smrg
16207d2e718Smrg
1631d8c7986Smrg# _AM_DEPENDENCIES(NAME)
1641d8c7986Smrg# ----------------------
1651d8c7986Smrg# See how the compiler implements dependency checking.
1661d8c7986Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1671d8c7986Smrg# We try a few techniques and use that to set a single cache variable.
1681d8c7986Smrg#
1691d8c7986Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1701d8c7986Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1711d8c7986Smrg# dependency, and given that the user is not expected to run this macro,
1721d8c7986Smrg# just rely on AC_PROG_CC.
1731d8c7986SmrgAC_DEFUN([_AM_DEPENDENCIES],
1741d8c7986Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1751d8c7986SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1761d8c7986SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1771d8c7986SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17807d2e718Smrg
1791d8c7986Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1801d8c7986Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1811d8c7986Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1821d8c7986Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1831d8c7986Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1841d8c7986Smrg                   [depcc="$$1"   am_compiler_list=])
1855fac8b10Smrg
1861d8c7986SmrgAC_CACHE_CHECK([dependency style of $depcc],
1871d8c7986Smrg               [am_cv_$1_dependencies_compiler_type],
1881d8c7986Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1891d8c7986Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1901d8c7986Smrg  # making bogus files that we don't know about and never remove.  For
1911d8c7986Smrg  # instance it was reported that on HP-UX the gcc test will end up
1921d8c7986Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
1931d8c7986Smrg  # in D'.
1941d8c7986Smrg  mkdir conftest.dir
1951d8c7986Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1961d8c7986Smrg  # using a relative directory.
1971d8c7986Smrg  cp "$am_depcomp" conftest.dir
1981d8c7986Smrg  cd conftest.dir
1991d8c7986Smrg  # We will build objects and dependencies in a subdirectory because
2001d8c7986Smrg  # it helps to detect inapplicable dependency modes.  For instance
2011d8c7986Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2021d8c7986Smrg  # side effect of compilation, but ICC will put the dependencies in
2031d8c7986Smrg  # the current directory while Tru64 will put them in the object
2041d8c7986Smrg  # directory.
2051d8c7986Smrg  mkdir sub
206f46a6179Smrg
2071d8c7986Smrg  am_cv_$1_dependencies_compiler_type=none
2081d8c7986Smrg  if test "$am_compiler_list" = ""; then
2091d8c7986Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2101d8c7986Smrg  fi
2111d8c7986Smrg  am__universal=false
2121d8c7986Smrg  m4_case([$1], [CC],
2131d8c7986Smrg    [case " $depcc " in #(
2141d8c7986Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2151d8c7986Smrg     esac],
2161d8c7986Smrg    [CXX],
2171d8c7986Smrg    [case " $depcc " in #(
2181d8c7986Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2191d8c7986Smrg     esac])
220f46a6179Smrg
2211d8c7986Smrg  for depmode in $am_compiler_list; do
2221d8c7986Smrg    # Setup a source with many dependencies, because some compilers
2231d8c7986Smrg    # like to wrap large dependency lists on column 80 (with \), and
2241d8c7986Smrg    # we should not choose a depcomp mode which is confused by this.
2251d8c7986Smrg    #
2261d8c7986Smrg    # We need to recreate these files for each test, as the compiler may
2271d8c7986Smrg    # overwrite some of them when testing with obscure command lines.
2281d8c7986Smrg    # This happens at least with the AIX C compiler.
2291d8c7986Smrg    : > sub/conftest.c
2301d8c7986Smrg    for i in 1 2 3 4 5 6; do
2311d8c7986Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2321d8c7986Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2331d8c7986Smrg      # Solaris 8's {/usr,}/bin/sh.
2341d8c7986Smrg      touch sub/conftst$i.h
2351d8c7986Smrg    done
2361d8c7986Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237f46a6179Smrg
2381d8c7986Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2391d8c7986Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2401d8c7986Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
2411d8c7986Smrg    # versions had trouble with output in subdirs
2421d8c7986Smrg    am__obj=sub/conftest.${OBJEXT-o}
2431d8c7986Smrg    am__minus_obj="-o $am__obj"
2441d8c7986Smrg    case $depmode in
2451d8c7986Smrg    gcc)
2461d8c7986Smrg      # This depmode causes a compiler race in universal mode.
2471d8c7986Smrg      test "$am__universal" = false || continue
2481d8c7986Smrg      ;;
2491d8c7986Smrg    nosideeffect)
2501d8c7986Smrg      # after this tag, mechanisms are not by side-effect, so they'll
2511d8c7986Smrg      # only be used when explicitly requested
2521d8c7986Smrg      if test "x$enable_dependency_tracking" = xyes; then
2531d8c7986Smrg	continue
2541d8c7986Smrg      else
2551d8c7986Smrg	break
2561d8c7986Smrg      fi
2571d8c7986Smrg      ;;
2581d8c7986Smrg    msvisualcpp | msvcmsys)
2591d8c7986Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
2601d8c7986Smrg      # not run yet.  These depmodes are late enough in the game, and
2611d8c7986Smrg      # so weak that their functioning should not be impacted.
2621d8c7986Smrg      am__obj=conftest.${OBJEXT-o}
2631d8c7986Smrg      am__minus_obj=
2641d8c7986Smrg      ;;
2651d8c7986Smrg    none) break ;;
2661d8c7986Smrg    esac
2671d8c7986Smrg    if depmode=$depmode \
2681d8c7986Smrg       source=sub/conftest.c object=$am__obj \
2691d8c7986Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2701d8c7986Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2711d8c7986Smrg         >/dev/null 2>conftest.err &&
2721d8c7986Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2731d8c7986Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2741d8c7986Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2751d8c7986Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2761d8c7986Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2771d8c7986Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2781d8c7986Smrg      # that says an option was ignored or not supported.
2791d8c7986Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2801d8c7986Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2811d8c7986Smrg      # The diagnosis changed in icc 8.0:
2821d8c7986Smrg      #   icc: Command line remark: option '-MP' not supported
2831d8c7986Smrg      if (grep 'ignoring option' conftest.err ||
2841d8c7986Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2851d8c7986Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2861d8c7986Smrg        break
2871d8c7986Smrg      fi
2881d8c7986Smrg    fi
2891d8c7986Smrg  done
2901d8c7986Smrg
2911d8c7986Smrg  cd ..
2921d8c7986Smrg  rm -rf conftest.dir
2935fac8b10Smrgelse
2941d8c7986Smrg  am_cv_$1_dependencies_compiler_type=none
295f46a6179Smrgfi
2961d8c7986Smrg])
2971d8c7986SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2981d8c7986SmrgAM_CONDITIONAL([am__fastdep$1], [
2991d8c7986Smrg  test "x$enable_dependency_tracking" != xno \
3001d8c7986Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3011d8c7986Smrg])
302f46a6179Smrg
303f46a6179Smrg
3041d8c7986Smrg# AM_SET_DEPDIR
3051d8c7986Smrg# -------------
3061d8c7986Smrg# Choose a directory name for dependency files.
3071d8c7986Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3081d8c7986SmrgAC_DEFUN([AM_SET_DEPDIR],
3091d8c7986Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3101d8c7986SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3111d8c7986Smrg])
312f46a6179Smrg
313f46a6179Smrg
3141d8c7986Smrg# AM_DEP_TRACK
3151d8c7986Smrg# ------------
3161d8c7986SmrgAC_DEFUN([AM_DEP_TRACK],
3171d8c7986Smrg[AC_ARG_ENABLE(dependency-tracking,
3181d8c7986Smrg[  --disable-dependency-tracking  speeds up one-time build
3191d8c7986Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3201d8c7986Smrgif test "x$enable_dependency_tracking" != xno; then
3211d8c7986Smrg  am_depcomp="$ac_aux_dir/depcomp"
3221d8c7986Smrg  AMDEPBACKSLASH='\'
323690143ccSmrgfi
3241d8c7986SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3251d8c7986SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3261d8c7986Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3271d8c7986Smrg])
328f46a6179Smrg
3291d8c7986Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330f46a6179Smrg
3311d8c7986Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
3321d8c7986Smrg# Free Software Foundation, Inc.
3331d8c7986Smrg#
3341d8c7986Smrg# This file is free software; the Free Software Foundation
3351d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
3361d8c7986Smrg# with or without modifications, as long as this notice is preserved.
337f46a6179Smrg
3381d8c7986Smrg#serial 5
339f46a6179Smrg
3401d8c7986Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3411d8c7986Smrg# ------------------------------
3421d8c7986SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3431d8c7986Smrg[{
3441d8c7986Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
3451d8c7986Smrg  # are listed without --file.  Let's play safe and only enable the eval
3461d8c7986Smrg  # if we detect the quoting.
3471d8c7986Smrg  case $CONFIG_FILES in
3481d8c7986Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3491d8c7986Smrg  *)   set x $CONFIG_FILES ;;
3501d8c7986Smrg  esac
3511d8c7986Smrg  shift
3521d8c7986Smrg  for mf
3531d8c7986Smrg  do
3541d8c7986Smrg    # Strip MF so we end up with the name of the file.
3551d8c7986Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3561d8c7986Smrg    # Check whether this is an Automake generated Makefile or not.
3571d8c7986Smrg    # We used to match only the files named `Makefile.in', but
3581d8c7986Smrg    # some people rename them; so instead we look at the file content.
3591d8c7986Smrg    # Grep'ing the first line is not enough: some people post-process
3601d8c7986Smrg    # each Makefile.in and add a new line on top of each file to say so.
3611d8c7986Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3621d8c7986Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3631d8c7986Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3641d8c7986Smrg      dirpart=`AS_DIRNAME("$mf")`
3651d8c7986Smrg    else
3661d8c7986Smrg      continue
3671d8c7986Smrg    fi
3681d8c7986Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3691d8c7986Smrg    # from the Makefile without running `make'.
3701d8c7986Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3711d8c7986Smrg    test -z "$DEPDIR" && continue
3721d8c7986Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3731d8c7986Smrg    test -z "am__include" && continue
3741d8c7986Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3751d8c7986Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
3761d8c7986Smrg    U=`sed -n 's/^U = //p' < "$mf"`
3771d8c7986Smrg    # Find all dependency output files, they are included files with
3781d8c7986Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3791d8c7986Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3801d8c7986Smrg    # expansion.
3811d8c7986Smrg    for file in `sed -n "
3821d8c7986Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3831d8c7986Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3841d8c7986Smrg      # Make sure the directory exists.
3851d8c7986Smrg      test -f "$dirpart/$file" && continue
3861d8c7986Smrg      fdir=`AS_DIRNAME(["$file"])`
3871d8c7986Smrg      AS_MKDIR_P([$dirpart/$fdir])
3881d8c7986Smrg      # echo "creating $dirpart/$file"
3891d8c7986Smrg      echo '# dummy' > "$dirpart/$file"
3901d8c7986Smrg    done
3911d8c7986Smrg  done
3921d8c7986Smrg}
3931d8c7986Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394690143ccSmrg
395690143ccSmrg
3961d8c7986Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3971d8c7986Smrg# -----------------------------
3981d8c7986Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
399690143ccSmrg#
4001d8c7986Smrg# This code is only required when automatic dependency tracking
4011d8c7986Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
4021d8c7986Smrg# need in order to bootstrap the dependency handling code.
4031d8c7986SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4041d8c7986Smrg[AC_CONFIG_COMMANDS([depfiles],
4051d8c7986Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4061d8c7986Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4071d8c7986Smrg])
408f46a6179Smrg
4091d8c7986Smrg# Do all the work for Automake.                             -*- Autoconf -*-
410f46a6179Smrg
4111d8c7986Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4121d8c7986Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
413690143ccSmrg#
4141d8c7986Smrg# This file is free software; the Free Software Foundation
4151d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
4161d8c7986Smrg# with or without modifications, as long as this notice is preserved.
417690143ccSmrg
4181d8c7986Smrg# serial 16
419f46a6179Smrg
4201d8c7986Smrg# This macro actually does too much.  Some checks are only needed if
4211d8c7986Smrg# your package does certain things.  But this isn't really a big deal.
422f46a6179Smrg
4231d8c7986Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4241d8c7986Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4251d8c7986Smrg# -----------------------------------------------
4261d8c7986Smrg# The call with PACKAGE and VERSION arguments is the old style
4271d8c7986Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4281d8c7986Smrg# and VERSION should now be passed to AC_INIT and removed from
4291d8c7986Smrg# the call to AM_INIT_AUTOMAKE.
4301d8c7986Smrg# We support both call styles for the transition.  After
4311d8c7986Smrg# the next Automake release, Autoconf can make the AC_INIT
4321d8c7986Smrg# arguments mandatory, and then we can depend on a new Autoconf
4331d8c7986Smrg# release and drop the old call support.
4341d8c7986SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4351d8c7986Smrg[AC_PREREQ([2.62])dnl
4361d8c7986Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4371d8c7986Smrgdnl the ones we care about.
4381d8c7986Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4391d8c7986SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4401d8c7986SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4411d8c7986Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4421d8c7986Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4431d8c7986Smrg  # is not polluted with repeated "-I."
4441d8c7986Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4451d8c7986Smrg  # test to see if srcdir already configured
4461d8c7986Smrg  if test -f $srcdir/config.status; then
4471d8c7986Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4481d8c7986Smrg  fi
44934345a63Smrgfi
450f46a6179Smrg
4511d8c7986Smrg# test whether we have cygpath
4521d8c7986Smrgif test -z "$CYGPATH_W"; then
4531d8c7986Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4541d8c7986Smrg    CYGPATH_W='cygpath -w'
4551d8c7986Smrg  else
4561d8c7986Smrg    CYGPATH_W=echo
4571d8c7986Smrg  fi
458690143ccSmrgfi
4591d8c7986SmrgAC_SUBST([CYGPATH_W])
460f46a6179Smrg
4611d8c7986Smrg# Define the identity of the package.
4621d8c7986Smrgdnl Distinguish between old-style and new-style calls.
4631d8c7986Smrgm4_ifval([$2],
4641d8c7986Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4651d8c7986Smrg AC_SUBST([PACKAGE], [$1])dnl
4661d8c7986Smrg AC_SUBST([VERSION], [$2])],
4671d8c7986Smrg[_AM_SET_OPTIONS([$1])dnl
4681d8c7986Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4691d8c7986Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4701d8c7986Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4711d8c7986Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4721d8c7986Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473f46a6179Smrg
4741d8c7986Smrg_AM_IF_OPTION([no-define],,
4751d8c7986Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4761d8c7986Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477f46a6179Smrg
4781d8c7986Smrg# Some tools Automake needs.
4791d8c7986SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4801d8c7986SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4811d8c7986SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4821d8c7986SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4831d8c7986SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4841d8c7986SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4851d8c7986SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4861d8c7986SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4871d8c7986SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4881d8c7986SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4891d8c7986Smrg# We need awk for the "check" target.  The system "awk" is bad on
4901d8c7986Smrg# some platforms.
4911d8c7986SmrgAC_REQUIRE([AC_PROG_AWK])dnl
4921d8c7986SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
4931d8c7986SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
4941d8c7986Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4951d8c7986Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4961d8c7986Smrg			     [_AM_PROG_TAR([v7])])])
4971d8c7986Smrg_AM_IF_OPTION([no-dependencies],,
4981d8c7986Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
4991d8c7986Smrg		  [_AM_DEPENDENCIES(CC)],
5001d8c7986Smrg		  [define([AC_PROG_CC],
5011d8c7986Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5021d8c7986SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5031d8c7986Smrg		  [_AM_DEPENDENCIES(CXX)],
5041d8c7986Smrg		  [define([AC_PROG_CXX],
5051d8c7986Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5061d8c7986SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5071d8c7986Smrg		  [_AM_DEPENDENCIES(OBJC)],
5081d8c7986Smrg		  [define([AC_PROG_OBJC],
5091d8c7986Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
5101d8c7986Smrg])
5111d8c7986Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5121d8c7986Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5131d8c7986Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5141d8c7986Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5151d8c7986SmrgAC_CONFIG_COMMANDS_PRE(dnl
5161d8c7986Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5171d8c7986Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5181d8c7986Smrg])
519f46a6179Smrg
5201d8c7986Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5211d8c7986Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5221d8c7986Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5231d8c7986Smrgm4_define([_AC_COMPILER_EXEEXT],
5241d8c7986Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525f46a6179Smrg
526f46a6179Smrg
5271d8c7986Smrg# When config.status generates a header, we must update the stamp-h file.
5281d8c7986Smrg# This file resides in the same directory as the config header
5291d8c7986Smrg# that is generated.  The stamp files are numbered to have different names.
530f46a6179Smrg
5311d8c7986Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5321d8c7986Smrg# loop where config.status creates the headers, so we can generate
5331d8c7986Smrg# our stamp files there.
5341d8c7986SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5351d8c7986Smrg[# Compute $1's index in $config_headers.
5361d8c7986Smrg_am_arg=$1
5371d8c7986Smrg_am_stamp_count=1
5381d8c7986Smrgfor _am_header in $config_headers :; do
5391d8c7986Smrg  case $_am_header in
5401d8c7986Smrg    $_am_arg | $_am_arg:* )
5411d8c7986Smrg      break ;;
5421d8c7986Smrg    * )
5431d8c7986Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5441d8c7986Smrg  esac
5451d8c7986Smrgdone
5461d8c7986Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5475fac8b10Smrg
5481d8c7986Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
5491d8c7986Smrg#
5501d8c7986Smrg# This file is free software; the Free Software Foundation
5511d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
5521d8c7986Smrg# with or without modifications, as long as this notice is preserved.
553f46a6179Smrg
5541d8c7986Smrg# AM_PROG_INSTALL_SH
5551d8c7986Smrg# ------------------
5561d8c7986Smrg# Define $install_sh.
5571d8c7986SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5581d8c7986Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5591d8c7986Smrgif test x"${install_sh}" != xset; then
5601d8c7986Smrg  case $am_aux_dir in
5611d8c7986Smrg  *\ * | *\	*)
5621d8c7986Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5631d8c7986Smrg  *)
5641d8c7986Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5651d8c7986Smrg  esac
566690143ccSmrgfi
5671d8c7986SmrgAC_SUBST(install_sh)])
5685fac8b10Smrg
5691d8c7986Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
570690143ccSmrg#
5711d8c7986Smrg# This file is free software; the Free Software Foundation
5721d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
5731d8c7986Smrg# with or without modifications, as long as this notice is preserved.
574f46a6179Smrg
5751d8c7986Smrg# serial 2
5761d8c7986Smrg
5771d8c7986Smrg# Check whether the underlying file-system supports filenames
5781d8c7986Smrg# with a leading dot.  For instance MS-DOS doesn't.
5791d8c7986SmrgAC_DEFUN([AM_SET_LEADING_DOT],
5801d8c7986Smrg[rm -rf .tst 2>/dev/null
5811d8c7986Smrgmkdir .tst 2>/dev/null
5821d8c7986Smrgif test -d .tst; then
5831d8c7986Smrg  am__leading_dot=.
584690143ccSmrgelse
5851d8c7986Smrg  am__leading_dot=_
5865fac8b10Smrgfi
5871d8c7986Smrgrmdir .tst 2>/dev/null
5881d8c7986SmrgAC_SUBST([am__leading_dot])])
589f46a6179Smrg
5901d8c7986Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
5911d8c7986Smrg# From Jim Meyering
592f46a6179Smrg
5931d8c7986Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
5941d8c7986Smrg# Free Software Foundation, Inc.
595690143ccSmrg#
5961d8c7986Smrg# This file is free software; the Free Software Foundation
5971d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
5981d8c7986Smrg# with or without modifications, as long as this notice is preserved.
599690143ccSmrg
6001d8c7986Smrg# serial 5
601f46a6179Smrg
6021d8c7986Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6031d8c7986Smrg# ----------------------------------
6041d8c7986Smrg# Control maintainer-specific portions of Makefiles.
6051d8c7986Smrg# Default is to disable them, unless `enable' is passed literally.
6061d8c7986Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
6071d8c7986Smrg# can override the default with the --enable/--disable switch.
6081d8c7986SmrgAC_DEFUN([AM_MAINTAINER_MODE],
6091d8c7986Smrg[m4_case(m4_default([$1], [disable]),
6101d8c7986Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
6111d8c7986Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
6121d8c7986Smrg       [m4_define([am_maintainer_other], [enable])
6131d8c7986Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6141d8c7986SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
6151d8c7986Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6161d8c7986Smrg  AC_ARG_ENABLE([maintainer-mode],
6171d8c7986Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
6181d8c7986Smrg			  (and sometimes confusing) to the casual installer],
6191d8c7986Smrg      [USE_MAINTAINER_MODE=$enableval],
6201d8c7986Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6211d8c7986Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6221d8c7986Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6231d8c7986Smrg  MAINT=$MAINTAINER_MODE_TRUE
6241d8c7986Smrg  AC_SUBST([MAINT])dnl
6251d8c7986Smrg]
6261d8c7986Smrg)
627f46a6179Smrg
6281d8c7986SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
6295fac8b10Smrg
6301d8c7986Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6315fac8b10Smrg
6321d8c7986Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
633690143ccSmrg#
6341d8c7986Smrg# This file is free software; the Free Software Foundation
6351d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
6361d8c7986Smrg# with or without modifications, as long as this notice is preserved.
6371d8c7986Smrg
6381d8c7986Smrg# serial 4
6391d8c7986Smrg
6401d8c7986Smrg# AM_MAKE_INCLUDE()
6411d8c7986Smrg# -----------------
6421d8c7986Smrg# Check to see how make treats includes.
6431d8c7986SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6441d8c7986Smrg[am_make=${MAKE-make}
6451d8c7986Smrgcat > confinc << 'END'
6461d8c7986Smrgam__doit:
6471d8c7986Smrg	@echo this is the am__doit target
6481d8c7986Smrg.PHONY: am__doit
6491d8c7986SmrgEND
6501d8c7986Smrg# If we don't find an include directive, just comment out the code.
6511d8c7986SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6521d8c7986Smrgam__include="#"
6531d8c7986Smrgam__quote=
6541d8c7986Smrg_am_result=none
6551d8c7986Smrg# First try GNU make style include.
6561d8c7986Smrgecho "include confinc" > confmf
6571d8c7986Smrg# Ignore all kinds of additional output from `make'.
6581d8c7986Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6591d8c7986Smrg*the\ am__doit\ target*)
6601d8c7986Smrg  am__include=include
6611d8c7986Smrg  am__quote=
6621d8c7986Smrg  _am_result=GNU
6631d8c7986Smrg  ;;
6641d8c7986Smrgesac
6651d8c7986Smrg# Now try BSD make style include.
6661d8c7986Smrgif test "$am__include" = "#"; then
6671d8c7986Smrg   echo '.include "confinc"' > confmf
6681d8c7986Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6691d8c7986Smrg   *the\ am__doit\ target*)
6701d8c7986Smrg     am__include=.include
6711d8c7986Smrg     am__quote="\""
6721d8c7986Smrg     _am_result=BSD
6731d8c7986Smrg     ;;
6741d8c7986Smrg   esac
6751d8c7986Smrgfi
6761d8c7986SmrgAC_SUBST([am__include])
6771d8c7986SmrgAC_SUBST([am__quote])
6781d8c7986SmrgAC_MSG_RESULT([$_am_result])
6791d8c7986Smrgrm -f confinc confmf
6801d8c7986Smrg])
6811d8c7986Smrg
6821d8c7986Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6831d8c7986Smrg
6841d8c7986Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
6851d8c7986Smrg# Free Software Foundation, Inc.
686690143ccSmrg#
6871d8c7986Smrg# This file is free software; the Free Software Foundation
6881d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
6891d8c7986Smrg# with or without modifications, as long as this notice is preserved.
6905fac8b10Smrg
6911d8c7986Smrg# serial 6
6921d8c7986Smrg
6931d8c7986Smrg# AM_MISSING_PROG(NAME, PROGRAM)
6941d8c7986Smrg# ------------------------------
6951d8c7986SmrgAC_DEFUN([AM_MISSING_PROG],
6961d8c7986Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6971d8c7986Smrg$1=${$1-"${am_missing_run}$2"}
6981d8c7986SmrgAC_SUBST($1)])
6991d8c7986Smrg
7001d8c7986Smrg
7011d8c7986Smrg# AM_MISSING_HAS_RUN
7021d8c7986Smrg# ------------------
7031d8c7986Smrg# Define MISSING if not defined so far and test if it supports --run.
7041d8c7986Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
7051d8c7986SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7061d8c7986Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7071d8c7986SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7081d8c7986Smrgif test x"${MISSING+set}" != xset; then
7091d8c7986Smrg  case $am_aux_dir in
7101d8c7986Smrg  *\ * | *\	*)
7111d8c7986Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7121d8c7986Smrg  *)
7131d8c7986Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7141d8c7986Smrg  esac
7151d8c7986Smrgfi
7161d8c7986Smrg# Use eval to expand $SHELL
7171d8c7986Smrgif eval "$MISSING --run true"; then
7181d8c7986Smrg  am_missing_run="$MISSING --run "
719690143ccSmrgelse
7201d8c7986Smrg  am_missing_run=
7211d8c7986Smrg  AC_MSG_WARN([`missing' script is too old or missing])
722690143ccSmrgfi
7231d8c7986Smrg])
7245fac8b10Smrg
7251d8c7986Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726690143ccSmrg#
7271d8c7986Smrg# This file is free software; the Free Software Foundation
7281d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
7291d8c7986Smrg# with or without modifications, as long as this notice is preserved.
7305fac8b10Smrg
7311d8c7986Smrg# AM_PROG_MKDIR_P
7321d8c7986Smrg# ---------------
7331d8c7986Smrg# Check for `mkdir -p'.
7341d8c7986SmrgAC_DEFUN([AM_PROG_MKDIR_P],
7351d8c7986Smrg[AC_PREREQ([2.60])dnl
7361d8c7986SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7371d8c7986Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7381d8c7986Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
7391d8c7986Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7401d8c7986Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7411d8c7986Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7421d8c7986Smrgdnl adjustment using top_builddir (which is defined more often than
7431d8c7986Smrgdnl MKDIR_P).
7441d8c7986SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7451d8c7986Smrgcase $mkdir_p in
7461d8c7986Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7471d8c7986Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7481d8c7986Smrgesac
7491d8c7986Smrg])
750f46a6179Smrg
7511d8c7986Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7521d8c7986Smrg
7531d8c7986Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754690143ccSmrg#
7551d8c7986Smrg# This file is free software; the Free Software Foundation
7561d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
7571d8c7986Smrg# with or without modifications, as long as this notice is preserved.
7581d8c7986Smrg
7591d8c7986Smrg# serial 4
7601d8c7986Smrg
7611d8c7986Smrg# _AM_MANGLE_OPTION(NAME)
7621d8c7986Smrg# -----------------------
7631d8c7986SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7641d8c7986Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7651d8c7986Smrg
7661d8c7986Smrg# _AM_SET_OPTION(NAME)
7671d8c7986Smrg# ------------------------------
7681d8c7986Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7691d8c7986SmrgAC_DEFUN([_AM_SET_OPTION],
7701d8c7986Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
7711d8c7986Smrg
7721d8c7986Smrg# _AM_SET_OPTIONS(OPTIONS)
7731d8c7986Smrg# ----------------------------------
7741d8c7986Smrg# OPTIONS is a space-separated list of Automake options.
7751d8c7986SmrgAC_DEFUN([_AM_SET_OPTIONS],
7761d8c7986Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7771d8c7986Smrg
7781d8c7986Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7791d8c7986Smrg# -------------------------------------------
7801d8c7986Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7811d8c7986SmrgAC_DEFUN([_AM_IF_OPTION],
7821d8c7986Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7831d8c7986Smrg
7841d8c7986Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7851d8c7986Smrg
7861d8c7986Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
7871d8c7986Smrg# Free Software Foundation, Inc.
788690143ccSmrg#
7891d8c7986Smrg# This file is free software; the Free Software Foundation
7901d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
7911d8c7986Smrg# with or without modifications, as long as this notice is preserved.
7925fac8b10Smrg
7931d8c7986Smrg# serial 5
7941d8c7986Smrg
7951d8c7986Smrg# AM_SANITY_CHECK
7961d8c7986Smrg# ---------------
7971d8c7986SmrgAC_DEFUN([AM_SANITY_CHECK],
7981d8c7986Smrg[AC_MSG_CHECKING([whether build environment is sane])
7991d8c7986Smrg# Just in case
8001d8c7986Smrgsleep 1
8011d8c7986Smrgecho timestamp > conftest.file
8021d8c7986Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8031d8c7986Smrg# name.  Accept space and tab only in the latter.
8041d8c7986Smrgam_lf='
8051d8c7986Smrg'
8061d8c7986Smrgcase `pwd` in
8071d8c7986Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8081d8c7986Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8091d8c7986Smrgesac
8101d8c7986Smrgcase $srcdir in
8111d8c7986Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8121d8c7986Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8131d8c7986Smrgesac
8141d8c7986Smrg
8151d8c7986Smrg# Do `set' in a subshell so we don't clobber the current shell's
8161d8c7986Smrg# arguments.  Must try -L first in case configure is actually a
8171d8c7986Smrg# symlink; some systems play weird games with the mod time of symlinks
8181d8c7986Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8191d8c7986Smrg# directory).
8201d8c7986Smrgif (
8211d8c7986Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8221d8c7986Smrg   if test "$[*]" = "X"; then
8231d8c7986Smrg      # -L didn't work.
8241d8c7986Smrg      set X `ls -t "$srcdir/configure" conftest.file`
825690143ccSmrg   fi
8261d8c7986Smrg   rm -f conftest.file
8271d8c7986Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
8281d8c7986Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
8291d8c7986Smrg
8301d8c7986Smrg      # If neither matched, then we have a broken ls.  This can happen
8311d8c7986Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
8321d8c7986Smrg      # broken ls alias from the environment.  This has actually
8331d8c7986Smrg      # happened.  Such a system could not be considered "sane".
8341d8c7986Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8351d8c7986Smrgalias in your environment])
836690143ccSmrg   fi
837f46a6179Smrg
8381d8c7986Smrg   test "$[2]" = conftest.file
8391d8c7986Smrg   )
8401d8c7986Smrgthen
8411d8c7986Smrg   # Ok.
8421d8c7986Smrg   :
8431d8c7986Smrgelse
8441d8c7986Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8451d8c7986SmrgCheck your system clock])
846690143ccSmrgfi
8471d8c7986SmrgAC_MSG_RESULT(yes)])
848f46a6179Smrg
8491d8c7986Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
8501d8c7986Smrg#
8511d8c7986Smrg# This file is free software; the Free Software Foundation
8521d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
8531d8c7986Smrg# with or without modifications, as long as this notice is preserved.
854f46a6179Smrg
8551d8c7986Smrg# serial 1
856f46a6179Smrg
8571d8c7986Smrg# AM_SILENT_RULES([DEFAULT])
8581d8c7986Smrg# --------------------------
8591d8c7986Smrg# Enable less verbose build rules; with the default set to DEFAULT
8601d8c7986Smrg# (`yes' being less verbose, `no' or empty being verbose).
8611d8c7986SmrgAC_DEFUN([AM_SILENT_RULES],
8621d8c7986Smrg[AC_ARG_ENABLE([silent-rules],
8631d8c7986Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8641d8c7986Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8651d8c7986Smrgcase $enable_silent_rules in
8661d8c7986Smrgyes) AM_DEFAULT_VERBOSITY=0;;
8671d8c7986Smrgno)  AM_DEFAULT_VERBOSITY=1;;
8681d8c7986Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8691d8c7986Smrgesac
8701d8c7986SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8711d8c7986SmrgAM_BACKSLASH='\'
8721d8c7986SmrgAC_SUBST([AM_BACKSLASH])dnl
8731d8c7986Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8741d8c7986Smrg])
8751d8c7986Smrg
8761d8c7986Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
877690143ccSmrg#
8781d8c7986Smrg# This file is free software; the Free Software Foundation
8791d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
8801d8c7986Smrg# with or without modifications, as long as this notice is preserved.
881f46a6179Smrg
8821d8c7986Smrg# AM_PROG_INSTALL_STRIP
8831d8c7986Smrg# ---------------------
8841d8c7986Smrg# One issue with vendor `install' (even GNU) is that you can't
8851d8c7986Smrg# specify the program used to strip binaries.  This is especially
8861d8c7986Smrg# annoying in cross-compiling environments, where the build's strip
8871d8c7986Smrg# is unlikely to handle the host's binaries.
8881d8c7986Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
8891d8c7986Smrg# always use install-sh in `make install-strip', and initialize
8901d8c7986Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
8911d8c7986SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
8921d8c7986Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
8931d8c7986Smrg# Installed binaries are usually stripped using `strip' when the user
8941d8c7986Smrg# run `make install-strip'.  However `strip' might not be the right
8951d8c7986Smrg# tool to use in cross-compilation environments, therefore Automake
8961d8c7986Smrg# will honor the `STRIP' environment variable to overrule this program.
8971d8c7986Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
8981d8c7986Smrgif test "$cross_compiling" != no; then
8991d8c7986Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9005fac8b10Smrgfi
9011d8c7986SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9021d8c7986SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903f46a6179Smrg
9041d8c7986Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
905690143ccSmrg#
9061d8c7986Smrg# This file is free software; the Free Software Foundation
9071d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
9081d8c7986Smrg# with or without modifications, as long as this notice is preserved.
909f46a6179Smrg
9101d8c7986Smrg# serial 2
911f46a6179Smrg
9121d8c7986Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
9131d8c7986Smrg# ---------------------------
9141d8c7986Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9151d8c7986Smrg# This macro is traced by Automake.
9161d8c7986SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
917f46a6179Smrg
9181d8c7986Smrg# AM_SUBST_NOTMAKE(VARIABLE)
9191d8c7986Smrg# ---------------------------
9201d8c7986Smrg# Public sister of _AM_SUBST_NOTMAKE.
9211d8c7986SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922f46a6179Smrg
9231d8c7986Smrg# Check how to create a tarball.                            -*- Autoconf -*-
9241d8c7986Smrg
9251d8c7986Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
926690143ccSmrg#
9271d8c7986Smrg# This file is free software; the Free Software Foundation
9281d8c7986Smrg# gives unlimited permission to copy and/or distribute it,
9291d8c7986Smrg# with or without modifications, as long as this notice is preserved.
9301d8c7986Smrg
9311d8c7986Smrg# serial 2
9321d8c7986Smrg
9331d8c7986Smrg# _AM_PROG_TAR(FORMAT)
9341d8c7986Smrg# --------------------
9351d8c7986Smrg# Check how to create a tarball in format FORMAT.
9361d8c7986Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
937690143ccSmrg#
9381d8c7986Smrg# Substitute a variable $(am__tar) that is a command
9391d8c7986Smrg# writing to stdout a FORMAT-tarball containing the directory
9401d8c7986Smrg# $tardir.
9411d8c7986Smrg#     tardir=directory && $(am__tar) > result.tar
942690143ccSmrg#
9431d8c7986Smrg# Substitute a variable $(am__untar) that extract such
9441d8c7986Smrg# a tarball read from stdin.
9451d8c7986Smrg#     $(am__untar) < result.tar
9461d8c7986SmrgAC_DEFUN([_AM_PROG_TAR],
9471d8c7986Smrg[# Always define AMTAR for backward compatibility.
9481d8c7986SmrgAM_MISSING_PROG([AMTAR], [tar])
9491d8c7986Smrgm4_if([$1], [v7],
9501d8c7986Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
9511d8c7986Smrg     [m4_case([$1], [ustar],, [pax],,
9521d8c7986Smrg              [m4_fatal([Unknown tar format])])
9531d8c7986SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
9541d8c7986Smrg# Loop over all known methods to create a tar archive until one works.
9551d8c7986Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9561d8c7986Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
9571d8c7986Smrg# Do not fold the above two line into one, because Tru64 sh and
9581d8c7986Smrg# Solaris sh will not grok spaces in the rhs of `-'.
9591d8c7986Smrgfor _am_tool in $_am_tools
9601d8c7986Smrgdo
9611d8c7986Smrg  case $_am_tool in
9621d8c7986Smrg  gnutar)
9631d8c7986Smrg    for _am_tar in tar gnutar gtar;
9641d8c7986Smrg    do
9651d8c7986Smrg      AM_RUN_LOG([$_am_tar --version]) && break
9661d8c7986Smrg    done
9671d8c7986Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
9681d8c7986Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
9691d8c7986Smrg    am__untar="$_am_tar -xf -"
9701d8c7986Smrg    ;;
9711d8c7986Smrg  plaintar)
9721d8c7986Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
9731d8c7986Smrg    # ustar tarball either.
9741d8c7986Smrg    (tar --version) >/dev/null 2>&1 && continue
9751d8c7986Smrg    am__tar='tar chf - "$$tardir"'
9761d8c7986Smrg    am__tar_='tar chf - "$tardir"'
9771d8c7986Smrg    am__untar='tar xf -'
9781d8c7986Smrg    ;;
9791d8c7986Smrg  pax)
9801d8c7986Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
9811d8c7986Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
9821d8c7986Smrg    am__untar='pax -r'
9831d8c7986Smrg    ;;
9841d8c7986Smrg  cpio)
9851d8c7986Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
9861d8c7986Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
9871d8c7986Smrg    am__untar='cpio -i -H $1 -d'
9881d8c7986Smrg    ;;
9891d8c7986Smrg  none)
9901d8c7986Smrg    am__tar=false
9911d8c7986Smrg    am__tar_=false
9921d8c7986Smrg    am__untar=false
9931d8c7986Smrg    ;;
9941d8c7986Smrg  esac
99534345a63Smrg
9961d8c7986Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
9971d8c7986Smrg  # and am__untar set.
9981d8c7986Smrg  test -n "${am_cv_prog_tar_$1}" && break
9991d8c7986Smrg
10001d8c7986Smrg  # tar/untar a dummy directory, and stop if the command works
10011d8c7986Smrg  rm -rf conftest.dir
10021d8c7986Smrg  mkdir conftest.dir
10031d8c7986Smrg  echo GrepMe > conftest.dir/file
10041d8c7986Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
10051d8c7986Smrg  rm -rf conftest.dir
10061d8c7986Smrg  if test -s conftest.tar; then
10071d8c7986Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
10081d8c7986Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
10091d8c7986Smrg  fi
10101d8c7986Smrgdone
10111d8c7986Smrgrm -rf conftest.dir
10121d8c7986Smrg
10131d8c7986SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
10141d8c7986SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
10151d8c7986SmrgAC_SUBST([am__tar])
10161d8c7986SmrgAC_SUBST([am__untar])
10171d8c7986Smrg]) # _AM_PROG_TAR
10181d8c7986Smrg
10191d8c7986Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
10201d8c7986Smrg# 
10211d8c7986Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1022690143ccSmrg#
10231d8c7986Smrg# This program is free software; you can redistribute it and/or modify
10241d8c7986Smrg# it under the terms of the GNU General Public License as published by
10251d8c7986Smrg# the Free Software Foundation; either version 2 of the License, or
10261d8c7986Smrg# (at your option) any later version.
1027690143ccSmrg#
10281d8c7986Smrg# This program is distributed in the hope that it will be useful, but
10291d8c7986Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
10301d8c7986Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10311d8c7986Smrg# General Public License for more details.
1032690143ccSmrg#
10331d8c7986Smrg# You should have received a copy of the GNU General Public License
10341d8c7986Smrg# along with this program; if not, write to the Free Software
10351d8c7986Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1036690143ccSmrg#
10371d8c7986Smrg# As a special exception to the GNU General Public License, if you
10381d8c7986Smrg# distribute this file as part of a program that contains a
10391d8c7986Smrg# configuration script generated by Autoconf, you may include it under
10401d8c7986Smrg# the same distribution terms that you use for the rest of that program.
1041690143ccSmrg
10421d8c7986Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
10431d8c7986Smrg# ----------------------------------
10441d8c7986SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
10451d8c7986Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
10461d8c7986Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
10471d8c7986SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
10481d8c7986Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
10491d8c7986Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
10501d8c7986Smrgfi
10511d8c7986Smrgif test -n "$PKG_CONFIG"; then
10521d8c7986Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
10531d8c7986Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
10541d8c7986Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
10551d8c7986Smrg		AC_MSG_RESULT([yes])
10561d8c7986Smrg	else
10571d8c7986Smrg		AC_MSG_RESULT([no])
10581d8c7986Smrg		PKG_CONFIG=""
10591d8c7986Smrg	fi
10601d8c7986Smrg		
10611d8c7986Smrgfi[]dnl
10621d8c7986Smrg])# PKG_PROG_PKG_CONFIG
10631d8c7986Smrg
10641d8c7986Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1065690143ccSmrg#
10661d8c7986Smrg# Check to see whether a particular set of modules exists.  Similar
10671d8c7986Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1068690143ccSmrg#
1069690143ccSmrg#
10701d8c7986Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
10711d8c7986Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
10721d8c7986Smrg# PKG_CHECK_EXISTS manually
10731d8c7986Smrg# --------------------------------------------------------------
10741d8c7986SmrgAC_DEFUN([PKG_CHECK_EXISTS],
10751d8c7986Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10761d8c7986Smrgif test -n "$PKG_CONFIG" && \
10771d8c7986Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
10781d8c7986Smrg  m4_ifval([$2], [$2], [:])
10791d8c7986Smrgm4_ifvaln([$3], [else
10801d8c7986Smrg  $3])dnl
10811d8c7986Smrgfi])
1082f46a6179Smrg
1083f46a6179Smrg
10841d8c7986Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
10851d8c7986Smrg# ---------------------------------------------
10861d8c7986Smrgm4_define([_PKG_CONFIG],
10871d8c7986Smrg[if test -n "$$1"; then
10881d8c7986Smrg    pkg_cv_[]$1="$$1"
10891d8c7986Smrg elif test -n "$PKG_CONFIG"; then
10901d8c7986Smrg    PKG_CHECK_EXISTS([$3],
10911d8c7986Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
10921d8c7986Smrg		     [pkg_failed=yes])
10931d8c7986Smrg else
10941d8c7986Smrg    pkg_failed=untried
10951d8c7986Smrgfi[]dnl
10961d8c7986Smrg])# _PKG_CONFIG
1097f46a6179Smrg
10981d8c7986Smrg# _PKG_SHORT_ERRORS_SUPPORTED
10991d8c7986Smrg# -----------------------------
11001d8c7986SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
11011d8c7986Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11021d8c7986Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
11031d8c7986Smrg        _pkg_short_errors_supported=yes
11041d8c7986Smrgelse
11051d8c7986Smrg        _pkg_short_errors_supported=no
11061d8c7986Smrgfi[]dnl
11071d8c7986Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1108690143ccSmrg
1109690143ccSmrg
11101d8c7986Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
11111d8c7986Smrg# [ACTION-IF-NOT-FOUND])
1112f46a6179Smrg#
11135fac8b10Smrg#
11141d8c7986Smrg# Note that if there is a possibility the first call to
11151d8c7986Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
11161d8c7986Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
11175fac8b10Smrg#
11185fac8b10Smrg#
11191d8c7986Smrg# --------------------------------------------------------------
11201d8c7986SmrgAC_DEFUN([PKG_CHECK_MODULES],
11211d8c7986Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11221d8c7986SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
11231d8c7986SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
11245fac8b10Smrg
11251d8c7986Smrgpkg_failed=no
11261d8c7986SmrgAC_MSG_CHECKING([for $1])
11275fac8b10Smrg
11281d8c7986Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
11291d8c7986Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1130f46a6179Smrg
11311d8c7986Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
11321d8c7986Smrgand $1[]_LIBS to avoid the need to call pkg-config.
11331d8c7986SmrgSee the pkg-config man page for more details.])
1134f46a6179Smrg
11351d8c7986Smrgif test $pkg_failed = yes; then
11361d8c7986Smrg        _PKG_SHORT_ERRORS_SUPPORTED
11371d8c7986Smrg        if test $_pkg_short_errors_supported = yes; then
11381d8c7986Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
11391d8c7986Smrg        else 
11401d8c7986Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
11411d8c7986Smrg        fi
11421d8c7986Smrg	# Put the nasty error message in config.log where it belongs
11431d8c7986Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1144690143ccSmrg
11451d8c7986Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
11461d8c7986Smrg[Package requirements ($2) were not met:
1147f46a6179Smrg
11481d8c7986Smrg$$1_PKG_ERRORS
1149f46a6179Smrg
11501d8c7986SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
11511d8c7986Smrginstalled software in a non-standard prefix.
1152f46a6179Smrg
11531d8c7986Smrg_PKG_TEXT
11541d8c7986Smrg])],
11551d8c7986Smrg		[AC_MSG_RESULT([no])
11561d8c7986Smrg                $4])
11571d8c7986Smrgelif test $pkg_failed = untried; then
11581d8c7986Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
11591d8c7986Smrg[The pkg-config script could not be found or is too old.  Make sure it
11601d8c7986Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
11611d8c7986Smrgpath to pkg-config.
1162f46a6179Smrg
11631d8c7986Smrg_PKG_TEXT
1164f46a6179Smrg
11651d8c7986SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
11661d8c7986Smrg		[$4])
11671d8c7986Smrgelse
11681d8c7986Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
11691d8c7986Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
11701d8c7986Smrg        AC_MSG_RESULT([yes])
11711d8c7986Smrg	ifelse([$3], , :, [$3])
11721d8c7986Smrgfi[]dnl
11731d8c7986Smrg])# PKG_CHECK_MODULES
1174f46a6179Smrg
11751d8c7986Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
11761d8c7986Smrgdnl
11771d8c7986Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
11781d8c7986Smrgdnl 
11791d8c7986Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
11801d8c7986Smrgdnl copy of this software and associated documentation files (the "Software"),
11811d8c7986Smrgdnl to deal in the Software without restriction, including without limitation
11821d8c7986Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
11831d8c7986Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
11841d8c7986Smrgdnl Software is furnished to do so, subject to the following conditions:
11851d8c7986Smrgdnl
11861d8c7986Smrgdnl The above copyright notice and this permission notice (including the next
11871d8c7986Smrgdnl paragraph) shall be included in all copies or substantial portions of the
11881d8c7986Smrgdnl Software.
11891d8c7986Smrgdnl
11901d8c7986Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11911d8c7986Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11921d8c7986Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
11931d8c7986Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11941d8c7986Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
11951d8c7986Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
11961d8c7986Smrgdnl DEALINGS IN THE SOFTWARE.
1197f46a6179Smrg
11981d8c7986Smrg# XORG_MACROS_VERSION(required-version)
11991d8c7986Smrg# -------------------------------------
1200690143ccSmrg# Minimum version: 1.1.0
1201690143ccSmrg#
12021d8c7986Smrg# If you're using a macro added in Version 1.1 or newer, include this in
12031d8c7986Smrg# your configure.ac with the minimum required version, such as:
12041d8c7986Smrg# XORG_MACROS_VERSION(1.1)
1205690143ccSmrg#
12061d8c7986Smrg# To ensure that this macro is defined, also add:
12071d8c7986Smrg# m4_ifndef([XORG_MACROS_VERSION],
12081d8c7986Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1209690143ccSmrg#
1210690143ccSmrg#
12111d8c7986Smrg# See the "minimum version" comment for each macro you use to see what 
12121d8c7986Smrg# version you require.
12131d8c7986Smrgm4_defun([XORG_MACROS_VERSION],[
12141d8c7986Smrgm4_define([vers_have], [1.17])
12151d8c7986Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
12161d8c7986Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
12171d8c7986Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
12181d8c7986Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
12191d8c7986Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
12201d8c7986Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
12211d8c7986Smrgm4_undefine([vers_have])
12221d8c7986Smrgm4_undefine([maj_have])
12231d8c7986Smrgm4_undefine([maj_needed])
12241d8c7986Smrg]) # XORG_MACROS_VERSION
122583e5f723Smrg
12261d8c7986Smrg# XORG_PROG_RAWCPP()
12271d8c7986Smrg# ------------------
12281d8c7986Smrg# Minimum version: 1.0.0
1229690143ccSmrg#
12301d8c7986Smrg# Find cpp program and necessary flags for use in pre-processing text files
12311d8c7986Smrg# such as man pages and config files
12321d8c7986SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
12331d8c7986SmrgAC_REQUIRE([AC_PROG_CPP])
12341d8c7986SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
12351d8c7986Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
12361d8c7986Smrg
12371d8c7986Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
12381d8c7986Smrg# which is not the best choice for supporting other OS'es, but covers most
12391d8c7986Smrg# of the ones we need for now.
12401d8c7986SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
12411d8c7986SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
12421d8c7986Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12431d8c7986Smrg	AC_MSG_RESULT([no])
124483e5f723Smrgelse
12451d8c7986Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12461d8c7986Smrg		RAWCPPFLAGS=-undef
12471d8c7986Smrg		AC_MSG_RESULT([yes])
12481d8c7986Smrg	# under Cygwin unix is still defined even with -undef
12491d8c7986Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12501d8c7986Smrg		RAWCPPFLAGS="-undef -ansi"
12511d8c7986Smrg		AC_MSG_RESULT([yes, with -ansi])
12521d8c7986Smrg	else
12531d8c7986Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
12541d8c7986Smrg	fi
125583e5f723Smrgfi
12561d8c7986Smrgrm -f conftest.$ac_ext
125783e5f723Smrg
12581d8c7986SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
12591d8c7986SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
12601d8c7986Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12611d8c7986Smrg	AC_MSG_RESULT([no])
12621d8c7986Smrgelse
12631d8c7986Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12641d8c7986Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
12651d8c7986Smrg		AC_MSG_RESULT([yes])
12661d8c7986Smrg	else
12671d8c7986Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
12681d8c7986Smrg	fi
12691d8c7986Smrgfi
12701d8c7986Smrgrm -f conftest.$ac_ext
12711d8c7986SmrgAC_SUBST(RAWCPPFLAGS)
12721d8c7986Smrg]) # XORG_PROG_RAWCPP
12731d8c7986Smrg
12741d8c7986Smrg# XORG_MANPAGE_SECTIONS()
1275690143ccSmrg# -----------------------
12761d8c7986Smrg# Minimum version: 1.0.0
1277690143ccSmrg#
12781d8c7986Smrg# Determine which sections man pages go in for the different man page types
12791d8c7986Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
12801d8c7986Smrg# Not sure if there's any better way than just hardcoding by OS name.
12811d8c7986Smrg# Override default settings by setting environment variables
12821d8c7986Smrg# Added MAN_SUBSTS in version 1.8
12831d8c7986Smrg# Added AC_PROG_SED in version 1.8
1284f46a6179Smrg
12851d8c7986SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
12861d8c7986SmrgAC_REQUIRE([AC_CANONICAL_HOST])
12871d8c7986SmrgAC_REQUIRE([AC_PROG_SED])
12881d8c7986Smrg
12891d8c7986Smrgif test x$APP_MAN_SUFFIX = x    ; then
12901d8c7986Smrg    APP_MAN_SUFFIX=1
12915fac8b10Smrgfi
12921d8c7986Smrgif test x$APP_MAN_DIR = x    ; then
12931d8c7986Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1294690143ccSmrgfi
1295f46a6179Smrg
12961d8c7986Smrgif test x$LIB_MAN_SUFFIX = x    ; then
12971d8c7986Smrg    LIB_MAN_SUFFIX=3
12981d8c7986Smrgfi
12991d8c7986Smrgif test x$LIB_MAN_DIR = x    ; then
13001d8c7986Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13011d8c7986Smrgfi
130283e5f723Smrg
13031d8c7986Smrgif test x$FILE_MAN_SUFFIX = x    ; then
13041d8c7986Smrg    case $host_os in
13051d8c7986Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
13061d8c7986Smrg	*)		FILE_MAN_SUFFIX=5  ;;
13071d8c7986Smrg    esac
13081d8c7986Smrgfi
13091d8c7986Smrgif test x$FILE_MAN_DIR = x    ; then
13101d8c7986Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
13111d8c7986Smrgfi
1312f46a6179Smrg
13131d8c7986Smrgif test x$MISC_MAN_SUFFIX = x    ; then
13141d8c7986Smrg    case $host_os in
13151d8c7986Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
13161d8c7986Smrg	*)		MISC_MAN_SUFFIX=7  ;;
13171d8c7986Smrg    esac
13181d8c7986Smrgfi
13191d8c7986Smrgif test x$MISC_MAN_DIR = x    ; then
13201d8c7986Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
13211d8c7986Smrgfi
1322f46a6179Smrg
13231d8c7986Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
13241d8c7986Smrg    case $host_os in
13251d8c7986Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
13261d8c7986Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
13271d8c7986Smrg    esac
13281d8c7986Smrgfi
13291d8c7986Smrgif test x$DRIVER_MAN_DIR = x    ; then
13301d8c7986Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13311d8c7986Smrgfi
1332f46a6179Smrg
13331d8c7986Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
13341d8c7986Smrg    case $host_os in
13351d8c7986Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
13361d8c7986Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
13371d8c7986Smrg    esac
13381d8c7986Smrgfi
13391d8c7986Smrgif test x$ADMIN_MAN_DIR = x    ; then
13401d8c7986Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13411d8c7986Smrgfi
1342f46a6179Smrg
1343f46a6179Smrg
13441d8c7986SmrgAC_SUBST([APP_MAN_SUFFIX])
13451d8c7986SmrgAC_SUBST([LIB_MAN_SUFFIX])
13461d8c7986SmrgAC_SUBST([FILE_MAN_SUFFIX])
13471d8c7986SmrgAC_SUBST([MISC_MAN_SUFFIX])
13481d8c7986SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
13491d8c7986SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
13501d8c7986SmrgAC_SUBST([APP_MAN_DIR])
13511d8c7986SmrgAC_SUBST([LIB_MAN_DIR])
13521d8c7986SmrgAC_SUBST([FILE_MAN_DIR])
13531d8c7986SmrgAC_SUBST([MISC_MAN_DIR])
13541d8c7986SmrgAC_SUBST([DRIVER_MAN_DIR])
13551d8c7986SmrgAC_SUBST([ADMIN_MAN_DIR])
1356f46a6179Smrg
13571d8c7986SmrgXORG_MAN_PAGE="X Version 11"
13581d8c7986SmrgAC_SUBST([XORG_MAN_PAGE])
13591d8c7986SmrgMAN_SUBSTS="\
13601d8c7986Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13611d8c7986Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13621d8c7986Smrg	-e 's|__xservername__|Xorg|g' \
13631d8c7986Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
13641d8c7986Smrg	-e 's|__projectroot__|\$(prefix)|g' \
13651d8c7986Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
13661d8c7986Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
13671d8c7986Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
13681d8c7986Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
13691d8c7986Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
13701d8c7986Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
13711d8c7986Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
13721d8c7986SmrgAC_SUBST([MAN_SUBSTS])
1373f46a6179Smrg
13741d8c7986Smrg]) # XORG_MANPAGE_SECTIONS
137534345a63Smrg
13761d8c7986Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
13771d8c7986Smrg# ------------------------
13781d8c7986Smrg# Minimum version: 1.7.0
137983e5f723Smrg#
13801d8c7986Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
13811d8c7986Smrg# provided by xorg-sgml-doctools, if installed.
13821d8c7986SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
13831d8c7986SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
13841d8c7986SmrgXORG_SGML_PATH=
13851d8c7986SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
13861d8c7986Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
13871d8c7986Smrg    [m4_ifval([$1],[:],
13881d8c7986Smrg        [if test x"$cross_compiling" != x"yes" ; then
13891d8c7986Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
13901d8c7986Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
13911d8c7986Smrg         fi])
13921d8c7986Smrg    ])
1393690143ccSmrg
13941d8c7986Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
13951d8c7986Smrg# the path and the name of the doc stylesheet
13961d8c7986Smrgif test "x$XORG_SGML_PATH" != "x" ; then
13971d8c7986Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
13981d8c7986Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
13991d8c7986Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
14001d8c7986Smrgelse
14011d8c7986Smrg   AC_MSG_RESULT([no])
14021d8c7986Smrgfi
14031d8c7986Smrg
14041d8c7986SmrgAC_SUBST(XORG_SGML_PATH)
14051d8c7986SmrgAC_SUBST(STYLESHEET_SRCDIR)
14061d8c7986SmrgAC_SUBST(XSL_STYLESHEET)
14071d8c7986SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
14081d8c7986Smrg]) # XORG_CHECK_SGML_DOCTOOLS
14091d8c7986Smrg
14101d8c7986Smrg# XORG_CHECK_LINUXDOC
14111d8c7986Smrg# -------------------
14121d8c7986Smrg# Minimum version: 1.0.0
1413690143ccSmrg#
14141d8c7986Smrg# Defines the variable MAKE_TEXT if the necessary tools and
14151d8c7986Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
14161d8c7986Smrg# Whether or not the necessary tools and files are found can be checked
14171d8c7986Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
14181d8c7986SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
14191d8c7986SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14201d8c7986SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1421690143ccSmrg
14221d8c7986SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1423690143ccSmrg
14241d8c7986SmrgAC_MSG_CHECKING([whether to build documentation])
1425690143ccSmrg
14261d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
14271d8c7986Smrg   BUILDDOC=yes
14281d8c7986Smrgelse
14291d8c7986Smrg   BUILDDOC=no
14301d8c7986Smrgfi
1431690143ccSmrg
14321d8c7986SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1433690143ccSmrg
14341d8c7986SmrgAC_MSG_RESULT([$BUILDDOC])
14351d8c7986Smrg
14361d8c7986SmrgAC_MSG_CHECKING([whether to build pdf documentation])
14371d8c7986Smrg
14381d8c7986Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
14391d8c7986Smrg   BUILDPDFDOC=yes
144083e5f723Smrgelse
14411d8c7986Smrg   BUILDPDFDOC=no
144283e5f723Smrgfi
144383e5f723Smrg
14441d8c7986SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
144583e5f723Smrg
14461d8c7986SmrgAC_MSG_RESULT([$BUILDPDFDOC])
144783e5f723Smrg
14481d8c7986SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
14491d8c7986SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
14501d8c7986SmrgMAKE_PDF="$PS2PDF"
14511d8c7986SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1452690143ccSmrg
14531d8c7986SmrgAC_SUBST(MAKE_TEXT)
14541d8c7986SmrgAC_SUBST(MAKE_PS)
14551d8c7986SmrgAC_SUBST(MAKE_PDF)
14561d8c7986SmrgAC_SUBST(MAKE_HTML)
14571d8c7986Smrg]) # XORG_CHECK_LINUXDOC
1458690143ccSmrg
14591d8c7986Smrg# XORG_CHECK_DOCBOOK
14601d8c7986Smrg# -------------------
14611d8c7986Smrg# Minimum version: 1.0.0
146283e5f723Smrg#
14631d8c7986Smrg# Checks for the ability to build output formats from SGML DocBook source.
14641d8c7986Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
14651d8c7986Smrg# indicates whether the necessary tools and files are found and, if set,
14661d8c7986Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
14671d8c7986SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
14681d8c7986SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1469690143ccSmrg
14701d8c7986SmrgBUILDTXTDOC=no
14711d8c7986SmrgBUILDPDFDOC=no
14721d8c7986SmrgBUILDPSDOC=no
14731d8c7986SmrgBUILDHTMLDOC=no
1474690143ccSmrg
14751d8c7986SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
14761d8c7986SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
14771d8c7986SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
14781d8c7986SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1479690143ccSmrg
14801d8c7986SmrgAC_MSG_CHECKING([whether to build text documentation])
14811d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
14821d8c7986Smrg   test x$BUILD_TXTDOC != xno; then
14831d8c7986Smrg	BUILDTXTDOC=yes
1484690143ccSmrgfi
14851d8c7986SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
14861d8c7986SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1487690143ccSmrg
14881d8c7986SmrgAC_MSG_CHECKING([whether to build PDF documentation])
14891d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
14901d8c7986Smrg   test x$BUILD_PDFDOC != xno; then
14911d8c7986Smrg	BUILDPDFDOC=yes
14921d8c7986Smrgfi
14931d8c7986SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14941d8c7986SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1495690143ccSmrg
14961d8c7986SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
14971d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
14981d8c7986Smrg   test x$BUILD_PSDOC != xno; then
14991d8c7986Smrg	BUILDPSDOC=yes
15001d8c7986Smrgfi
15011d8c7986SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
15021d8c7986SmrgAC_MSG_RESULT([$BUILDPSDOC])
1503690143ccSmrg
15041d8c7986SmrgAC_MSG_CHECKING([whether to build HTML documentation])
15051d8c7986Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
15061d8c7986Smrg   test x$BUILD_HTMLDOC != xno; then
15071d8c7986Smrg	BUILDHTMLDOC=yes
1508690143ccSmrgfi
15091d8c7986SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
15101d8c7986SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1511690143ccSmrg
15121d8c7986SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
15131d8c7986SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
15141d8c7986SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
15151d8c7986SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1516690143ccSmrg
15171d8c7986SmrgAC_SUBST(MAKE_TEXT)
15181d8c7986SmrgAC_SUBST(MAKE_PS)
15191d8c7986SmrgAC_SUBST(MAKE_PDF)
15201d8c7986SmrgAC_SUBST(MAKE_HTML)
15211d8c7986Smrg]) # XORG_CHECK_DOCBOOK
15221d8c7986Smrg
15231d8c7986Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
15241d8c7986Smrg# ----------------
15251d8c7986Smrg# Minimum version: 1.5.0
15261d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
152783e5f723Smrg#
15281d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
15291d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
15301d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
15311d8c7986Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
15321d8c7986Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
15331d8c7986Smrg# --with-xmlto assumes 'auto'.
15341d8c7986Smrg#
15351d8c7986Smrg# Interface to module:
15361d8c7986Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
15371d8c7986Smrg# XMLTO:	returns the path of the xmlto program found
15381d8c7986Smrg#		returns the path set by the user in the environment
15391d8c7986Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
15401d8c7986Smrg#		'no' user instructs the module not to use xmlto
15411d8c7986Smrg#
15421d8c7986Smrg# Added in version 1.10.0
15431d8c7986Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
15441d8c7986Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
15451d8c7986Smrg#
15461d8c7986Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
15471d8c7986Smrg#
15481d8c7986SmrgAC_DEFUN([XORG_WITH_XMLTO],[
15491d8c7986SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
15501d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
15511d8c7986SmrgAC_ARG_WITH(xmlto,
15521d8c7986Smrg	AS_HELP_STRING([--with-xmlto],
15531d8c7986Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
15541d8c7986Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
15551d8c7986Smrgm4_undefine([_defopt])
1556690143ccSmrg
15571d8c7986Smrgif test "x$use_xmlto" = x"auto"; then
15581d8c7986Smrg   AC_PATH_PROG([XMLTO], [xmlto])
15591d8c7986Smrg   if test "x$XMLTO" = "x"; then
15601d8c7986Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
15611d8c7986Smrg	have_xmlto=no
15621d8c7986Smrg   else
15631d8c7986Smrg        have_xmlto=yes
15641d8c7986Smrg   fi
15651d8c7986Smrgelif test "x$use_xmlto" = x"yes" ; then
15661d8c7986Smrg   AC_PATH_PROG([XMLTO], [xmlto])
15671d8c7986Smrg   if test "x$XMLTO" = "x"; then
15681d8c7986Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
15691d8c7986Smrg   fi
15701d8c7986Smrg   have_xmlto=yes
15711d8c7986Smrgelif test "x$use_xmlto" = x"no" ; then
15721d8c7986Smrg   if test "x$XMLTO" != "x"; then
15731d8c7986Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
15741d8c7986Smrg   fi
15751d8c7986Smrg   have_xmlto=no
15761d8c7986Smrgelse
15771d8c7986Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
15781d8c7986Smrgfi
1579690143ccSmrg
15801d8c7986Smrg# Test for a minimum version of xmlto, if provided.
15811d8c7986Smrgm4_ifval([$1],
15821d8c7986Smrg[if test "$have_xmlto" = yes; then
15831d8c7986Smrg    # scrape the xmlto version
15841d8c7986Smrg    AC_MSG_CHECKING([the xmlto version])
15851d8c7986Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
15861d8c7986Smrg    AC_MSG_RESULT([$xmlto_version])
15871d8c7986Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
15881d8c7986Smrg        [if test "x$use_xmlto" = xauto; then
15891d8c7986Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
15901d8c7986Smrg            have_xmlto=no
15911d8c7986Smrg        else
15921d8c7986Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
15931d8c7986Smrg        fi])
15941d8c7986Smrgfi])
15951d8c7986Smrg
15961d8c7986Smrg# Test for the ability of xmlto to generate a text target
15971d8c7986Smrghave_xmlto_text=no
15981d8c7986Smrgcat > conftest.xml << "EOF"
15991d8c7986SmrgEOF
16001d8c7986SmrgAS_IF([test "$have_xmlto" = yes],
16011d8c7986Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
16021d8c7986Smrg             [have_xmlto_text=yes],
16031d8c7986Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
16041d8c7986Smrgrm -f conftest.xml
16051d8c7986SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
16061d8c7986SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
16071d8c7986Smrg]) # XORG_WITH_XMLTO
16081d8c7986Smrg
16091d8c7986Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
16101d8c7986Smrg# --------------------------------------------
16111d8c7986Smrg# Minimum version: 1.12.0
16121d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.12.0
16131d8c7986Smrg#
16141d8c7986Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
16151d8c7986Smrg# XML-based language used for the transformation of XML documents.
16161d8c7986Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
16171d8c7986Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
16181d8c7986Smrg# The XSLT processor is often used as a standalone tool for transformations.
16191d8c7986Smrg# It should not be assumed that this tool is used only to work with documnetation.
16201d8c7986Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
16211d8c7986Smrg#
16221d8c7986Smrg# Interface to module:
16231d8c7986Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
16241d8c7986Smrg# XSLTPROC:	 returns the path of the xsltproc program found
16251d8c7986Smrg#		 returns the path set by the user in the environment
16261d8c7986Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
16271d8c7986Smrg#		  'no' user instructs the module not to use xsltproc
16281d8c7986Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
16291d8c7986Smrg#
16301d8c7986Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
16311d8c7986Smrg#
16321d8c7986SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
16331d8c7986SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
16341d8c7986Smrg# Preserves the interface, should it be implemented later
16351d8c7986Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
16361d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
16371d8c7986SmrgAC_ARG_WITH(xsltproc,
16381d8c7986Smrg	AS_HELP_STRING([--with-xsltproc],
16391d8c7986Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
16401d8c7986Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
16411d8c7986Smrgm4_undefine([_defopt])
16421d8c7986Smrg
16431d8c7986Smrgif test "x$use_xsltproc" = x"auto"; then
16441d8c7986Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16451d8c7986Smrg   if test "x$XSLTPROC" = "x"; then
16461d8c7986Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
16471d8c7986Smrg	have_xsltproc=no
16481d8c7986Smrg   else
16491d8c7986Smrg        have_xsltproc=yes
16501d8c7986Smrg   fi
16511d8c7986Smrgelif test "x$use_xsltproc" = x"yes" ; then
16521d8c7986Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16531d8c7986Smrg   if test "x$XSLTPROC" = "x"; then
16541d8c7986Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
16551d8c7986Smrg   fi
16561d8c7986Smrg   have_xsltproc=yes
16571d8c7986Smrgelif test "x$use_xsltproc" = x"no" ; then
16581d8c7986Smrg   if test "x$XSLTPROC" != "x"; then
16591d8c7986Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
16601d8c7986Smrg   fi
16611d8c7986Smrg   have_xsltproc=no
16621d8c7986Smrgelse
16631d8c7986Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
16641d8c7986Smrgfi
16651d8c7986Smrg
16661d8c7986SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
16671d8c7986Smrg]) # XORG_WITH_XSLTPROC
16681d8c7986Smrg
16691d8c7986Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
16701d8c7986Smrg# ----------------------------------------
16711d8c7986Smrg# Minimum version: 1.15.0
16721d8c7986Smrg#
16731d8c7986Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
16741d8c7986Smrg# scanning arbitrary text files, extracting information from those text files,
16751d8c7986Smrg# and printing reports based on that information.
16761d8c7986Smrg#
16771d8c7986Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
16781d8c7986Smrg#
16791d8c7986Smrg# Interface to module:
16801d8c7986Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
16811d8c7986Smrg# PERL:	     returns the path of the perl program found
16821d8c7986Smrg#	     returns the path set by the user in the environment
16831d8c7986Smrg# --with-perl: 'yes' user instructs the module to use perl
16841d8c7986Smrg#	       'no' user instructs the module not to use perl
16851d8c7986Smrg# have_perl: returns yes if perl found in PATH or no
16861d8c7986Smrg#
16871d8c7986Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
16881d8c7986Smrg#
16891d8c7986SmrgAC_DEFUN([XORG_WITH_PERL],[
16901d8c7986SmrgAC_ARG_VAR([PERL], [Path to perl command])
16911d8c7986Smrg# Preserves the interface, should it be implemented later
16921d8c7986Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
16931d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
16941d8c7986SmrgAC_ARG_WITH(perl,
16951d8c7986Smrg	AS_HELP_STRING([--with-perl],
16961d8c7986Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
16971d8c7986Smrg	   [use_perl=$withval], [use_perl=]_defopt)
16981d8c7986Smrgm4_undefine([_defopt])
16991d8c7986Smrg
17001d8c7986Smrgif test "x$use_perl" = x"auto"; then
17011d8c7986Smrg   AC_PATH_PROG([PERL], [perl])
17021d8c7986Smrg   if test "x$PERL" = "x"; then
17031d8c7986Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
17041d8c7986Smrg	have_perl=no
17051d8c7986Smrg   else
17061d8c7986Smrg        have_perl=yes
17071d8c7986Smrg   fi
17081d8c7986Smrgelif test "x$use_perl" = x"yes" ; then
17091d8c7986Smrg   AC_PATH_PROG([PERL], [perl])
17101d8c7986Smrg   if test "x$PERL" = "x"; then
17111d8c7986Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
17121d8c7986Smrg   fi
17131d8c7986Smrg   have_perl=yes
17141d8c7986Smrgelif test "x$use_perl" = x"no" ; then
17151d8c7986Smrg   if test "x$PERL" != "x"; then
17161d8c7986Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
17171d8c7986Smrg   fi
17181d8c7986Smrg   have_perl=no
17191d8c7986Smrgelse
17201d8c7986Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
17211d8c7986Smrgfi
17221d8c7986Smrg
17231d8c7986SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
17241d8c7986Smrg]) # XORG_WITH_PERL
17251d8c7986Smrg
17261d8c7986Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
17271d8c7986Smrg# ----------------
17281d8c7986Smrg# Minimum version: 1.5.0
17291d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17301d8c7986Smrg#
17311d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
17321d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
17331d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17341d8c7986Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
17351d8c7986Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
17361d8c7986Smrg# --with-asciidoc assumes 'auto'.
17371d8c7986Smrg#
17381d8c7986Smrg# Interface to module:
17391d8c7986Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
17401d8c7986Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
17411d8c7986Smrg#		 returns the path set by the user in the environment
17421d8c7986Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
17431d8c7986Smrg#		  'no' user instructs the module not to use asciidoc
17441d8c7986Smrg#
17451d8c7986Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
17461d8c7986Smrg#
17471d8c7986SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
17481d8c7986SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
17491d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
17501d8c7986SmrgAC_ARG_WITH(asciidoc,
17511d8c7986Smrg	AS_HELP_STRING([--with-asciidoc],
17521d8c7986Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
17531d8c7986Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
17541d8c7986Smrgm4_undefine([_defopt])
17551d8c7986Smrg
17561d8c7986Smrgif test "x$use_asciidoc" = x"auto"; then
17571d8c7986Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17581d8c7986Smrg   if test "x$ASCIIDOC" = "x"; then
17591d8c7986Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
17601d8c7986Smrg	have_asciidoc=no
17611d8c7986Smrg   else
17621d8c7986Smrg        have_asciidoc=yes
17631d8c7986Smrg   fi
17641d8c7986Smrgelif test "x$use_asciidoc" = x"yes" ; then
17651d8c7986Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17661d8c7986Smrg   if test "x$ASCIIDOC" = "x"; then
17671d8c7986Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
17681d8c7986Smrg   fi
17691d8c7986Smrg   have_asciidoc=yes
17701d8c7986Smrgelif test "x$use_asciidoc" = x"no" ; then
17711d8c7986Smrg   if test "x$ASCIIDOC" != "x"; then
17721d8c7986Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
17731d8c7986Smrg   fi
17741d8c7986Smrg   have_asciidoc=no
17751d8c7986Smrgelse
17761d8c7986Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
17771d8c7986Smrgfi
17781d8c7986Smrgm4_ifval([$1],
17791d8c7986Smrg[if test "$have_asciidoc" = yes; then
17801d8c7986Smrg    # scrape the asciidoc version
17811d8c7986Smrg    AC_MSG_CHECKING([the asciidoc version])
17821d8c7986Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
17831d8c7986Smrg    AC_MSG_RESULT([$asciidoc_version])
17841d8c7986Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
17851d8c7986Smrg        [if test "x$use_asciidoc" = xauto; then
17861d8c7986Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
17871d8c7986Smrg            have_asciidoc=no
17881d8c7986Smrg        else
17891d8c7986Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
17901d8c7986Smrg        fi])
17911d8c7986Smrgfi])
17921d8c7986SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
17931d8c7986Smrg]) # XORG_WITH_ASCIIDOC
17941d8c7986Smrg
17951d8c7986Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
17961d8c7986Smrg# --------------------------------
17971d8c7986Smrg# Minimum version: 1.5.0
17981d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17991d8c7986Smrg#
18001d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
18011d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
18021d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
18031d8c7986Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
18041d8c7986Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
18051d8c7986Smrg# --with-doxygen assumes 'auto'.
18061d8c7986Smrg#
18071d8c7986Smrg# Interface to module:
18081d8c7986Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
18091d8c7986Smrg# DOXYGEN:	 returns the path of the doxygen program found
18101d8c7986Smrg#		 returns the path set by the user in the environment
18111d8c7986Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
18121d8c7986Smrg#		  'no' user instructs the module not to use doxygen
18131d8c7986Smrg#
18141d8c7986Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
18151d8c7986Smrg#
18161d8c7986SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
18171d8c7986SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
18181d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
18191d8c7986SmrgAC_ARG_WITH(doxygen,
18201d8c7986Smrg	AS_HELP_STRING([--with-doxygen],
18211d8c7986Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
18221d8c7986Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
18231d8c7986Smrgm4_undefine([_defopt])
18241d8c7986Smrg
18251d8c7986Smrgif test "x$use_doxygen" = x"auto"; then
18261d8c7986Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18271d8c7986Smrg   if test "x$DOXYGEN" = "x"; then
18281d8c7986Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
18291d8c7986Smrg	have_doxygen=no
18301d8c7986Smrg   else
18311d8c7986Smrg        have_doxygen=yes
18321d8c7986Smrg   fi
18331d8c7986Smrgelif test "x$use_doxygen" = x"yes" ; then
18341d8c7986Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18351d8c7986Smrg   if test "x$DOXYGEN" = "x"; then
18361d8c7986Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
18371d8c7986Smrg   fi
18381d8c7986Smrg   have_doxygen=yes
18391d8c7986Smrgelif test "x$use_doxygen" = x"no" ; then
18401d8c7986Smrg   if test "x$DOXYGEN" != "x"; then
18411d8c7986Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
18421d8c7986Smrg   fi
18431d8c7986Smrg   have_doxygen=no
18441d8c7986Smrgelse
18451d8c7986Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
18461d8c7986Smrgfi
18471d8c7986Smrgm4_ifval([$1],
18481d8c7986Smrg[if test "$have_doxygen" = yes; then
18491d8c7986Smrg    # scrape the doxygen version
18501d8c7986Smrg    AC_MSG_CHECKING([the doxygen version])
18511d8c7986Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
18521d8c7986Smrg    AC_MSG_RESULT([$doxygen_version])
18531d8c7986Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
18541d8c7986Smrg        [if test "x$use_doxygen" = xauto; then
18551d8c7986Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
18561d8c7986Smrg            have_doxygen=no
18571d8c7986Smrg        else
18581d8c7986Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
18591d8c7986Smrg        fi])
18601d8c7986Smrgfi])
18611d8c7986SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
18621d8c7986Smrg]) # XORG_WITH_DOXYGEN
18631d8c7986Smrg
18641d8c7986Smrg# XORG_WITH_GROFF([DEFAULT])
18651d8c7986Smrg# ----------------
18661d8c7986Smrg# Minimum version: 1.6.0
18671d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18681d8c7986Smrg#
18691d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
18701d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
18711d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
18721d8c7986Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
18731d8c7986Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
18741d8c7986Smrg# --with-groff assumes 'auto'.
18751d8c7986Smrg#
18761d8c7986Smrg# Interface to module:
18771d8c7986Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
18781d8c7986Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
18791d8c7986Smrg# HAVE_GROFF_MS: the -ms macros package
18801d8c7986Smrg# GROFF:	 returns the path of the groff program found
18811d8c7986Smrg#		 returns the path set by the user in the environment
18821d8c7986Smrg# --with-groff:	 'yes' user instructs the module to use groff
18831d8c7986Smrg#		 'no' user instructs the module not to use groff
18841d8c7986Smrg#
18851d8c7986Smrg# Added in version 1.9.0:
18861d8c7986Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
18871d8c7986Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
18881d8c7986Smrg#		   psselect from the psutils package.
18891d8c7986Smrg#		   the ghostcript package. Refer to the grohtml man pages
18901d8c7986Smrg#
18911d8c7986Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
18921d8c7986Smrg#
18931d8c7986Smrg# OS and distros often splits groff in a basic and full package, the former
18941d8c7986Smrg# having the groff program and the later having devices, fonts and macros
18951d8c7986Smrg# Checking for the groff executable is not enough.
18961d8c7986Smrg#
18971d8c7986Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
18981d8c7986Smrg# unset HAVE_GROFF or GROFF env variables.
18991d8c7986Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
19001d8c7986Smrg#
19011d8c7986SmrgAC_DEFUN([XORG_WITH_GROFF],[
19021d8c7986SmrgAC_ARG_VAR([GROFF], [Path to groff command])
19031d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
19041d8c7986SmrgAC_ARG_WITH(groff,
19051d8c7986Smrg	AS_HELP_STRING([--with-groff],
19061d8c7986Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
19071d8c7986Smrg	   [use_groff=$withval], [use_groff=]_defopt)
19081d8c7986Smrgm4_undefine([_defopt])
19091d8c7986Smrg
19101d8c7986Smrgif test "x$use_groff" = x"auto"; then
19111d8c7986Smrg   AC_PATH_PROG([GROFF], [groff])
19121d8c7986Smrg   if test "x$GROFF" = "x"; then
19131d8c7986Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
19141d8c7986Smrg	have_groff=no
19151d8c7986Smrg   else
19161d8c7986Smrg        have_groff=yes
19171d8c7986Smrg   fi
19181d8c7986Smrgelif test "x$use_groff" = x"yes" ; then
19191d8c7986Smrg   AC_PATH_PROG([GROFF], [groff])
19201d8c7986Smrg   if test "x$GROFF" = "x"; then
19211d8c7986Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
19221d8c7986Smrg   fi
19231d8c7986Smrg   have_groff=yes
19241d8c7986Smrgelif test "x$use_groff" = x"no" ; then
19251d8c7986Smrg   if test "x$GROFF" != "x"; then
19261d8c7986Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
19271d8c7986Smrg   fi
19281d8c7986Smrg   have_groff=no
19291d8c7986Smrgelse
19301d8c7986Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19311d8c7986Smrgfi
19321d8c7986Smrg
19331d8c7986Smrg# We have groff, test for the presence of the macro packages
19341d8c7986Smrgif test "x$have_groff" = x"yes"; then
19351d8c7986Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
19361d8c7986Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
19371d8c7986Smrg        groff_ms_works=yes
19381d8c7986Smrg    else
19391d8c7986Smrg        groff_ms_works=no
19401d8c7986Smrg    fi
19411d8c7986Smrg    AC_MSG_RESULT([$groff_ms_works])
19421d8c7986Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
19431d8c7986Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
19441d8c7986Smrg        groff_mm_works=yes
1945690143ccSmrg    else
19461d8c7986Smrg        groff_mm_works=no
1947690143ccSmrg    fi
19481d8c7986Smrg    AC_MSG_RESULT([$groff_mm_works])
19491d8c7986Smrgfi
1950690143ccSmrg
19511d8c7986Smrg# We have groff, test for HTML dependencies, one command per package
19521d8c7986Smrgif test "x$have_groff" = x"yes"; then
19531d8c7986Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
19541d8c7986Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
19551d8c7986Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
19561d8c7986Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
19571d8c7986Smrg      have_groff_html=yes
19581d8c7986Smrg   else
19591d8c7986Smrg      have_groff_html=no
19601d8c7986Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
19611d8c7986Smrg   fi
19621d8c7986Smrgfi
1963690143ccSmrg
19641d8c7986Smrg# Set Automake conditionals for Makefiles
19651d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
19661d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
19671d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
19681d8c7986SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
19691d8c7986Smrg]) # XORG_WITH_GROFF
19701d8c7986Smrg
19711d8c7986Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
19721d8c7986Smrg# ---------------------------------------
19731d8c7986Smrg# Minimum version: 1.6.0
19741d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19751d8c7986Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
19761d8c7986Smrg#
19771d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
19781d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
19791d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19801d8c7986Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
19811d8c7986Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
19821d8c7986Smrg# --with-fop assumes 'auto'.
19831d8c7986Smrg#
19841d8c7986Smrg# Interface to module:
19851d8c7986Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
19861d8c7986Smrg# FOP:	 	returns the path of the fop program found
19871d8c7986Smrg#		returns the path set by the user in the environment
19881d8c7986Smrg# --with-fop: 	'yes' user instructs the module to use fop
19891d8c7986Smrg#		'no' user instructs the module not to use fop
19901d8c7986Smrg#
19911d8c7986Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
19921d8c7986Smrg#
19931d8c7986SmrgAC_DEFUN([XORG_WITH_FOP],[
19941d8c7986SmrgAC_ARG_VAR([FOP], [Path to fop command])
19951d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
19961d8c7986SmrgAC_ARG_WITH(fop,
19971d8c7986Smrg	AS_HELP_STRING([--with-fop],
19981d8c7986Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
19991d8c7986Smrg	   [use_fop=$withval], [use_fop=]_defopt)
20001d8c7986Smrgm4_undefine([_defopt])
20011d8c7986Smrg
20021d8c7986Smrgif test "x$use_fop" = x"auto"; then
20031d8c7986Smrg   AC_PATH_PROG([FOP], [fop])
20041d8c7986Smrg   if test "x$FOP" = "x"; then
20051d8c7986Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
20061d8c7986Smrg	have_fop=no
20071d8c7986Smrg   else
20081d8c7986Smrg        have_fop=yes
20091d8c7986Smrg   fi
20101d8c7986Smrgelif test "x$use_fop" = x"yes" ; then
20111d8c7986Smrg   AC_PATH_PROG([FOP], [fop])
20121d8c7986Smrg   if test "x$FOP" = "x"; then
20131d8c7986Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
20141d8c7986Smrg   fi
20151d8c7986Smrg   have_fop=yes
20161d8c7986Smrgelif test "x$use_fop" = x"no" ; then
20171d8c7986Smrg   if test "x$FOP" != "x"; then
20181d8c7986Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
20191d8c7986Smrg   fi
20201d8c7986Smrg   have_fop=no
20211d8c7986Smrgelse
20221d8c7986Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20231d8c7986Smrgfi
20241d8c7986Smrg
20251d8c7986Smrg# Test for a minimum version of fop, if provided.
20261d8c7986Smrgm4_ifval([$1],
20271d8c7986Smrg[if test "$have_fop" = yes; then
20281d8c7986Smrg    # scrape the fop version
20291d8c7986Smrg    AC_MSG_CHECKING([for fop minimum version])
20301d8c7986Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
20311d8c7986Smrg    AC_MSG_RESULT([$fop_version])
20321d8c7986Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
20331d8c7986Smrg        [if test "x$use_fop" = xauto; then
20341d8c7986Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
20351d8c7986Smrg            have_fop=no
20361d8c7986Smrg        else
20371d8c7986Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
20381d8c7986Smrg        fi])
20391d8c7986Smrgfi])
20401d8c7986SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
20411d8c7986Smrg]) # XORG_WITH_FOP
20421d8c7986Smrg
20431d8c7986Smrg# XORG_WITH_PS2PDF([DEFAULT])
20441d8c7986Smrg# ----------------
20451d8c7986Smrg# Minimum version: 1.6.0
20461d8c7986Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20471d8c7986Smrg#
20481d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
20491d8c7986Smrg# not at the appropriate level. This macro enables a module to test for the
20501d8c7986Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20511d8c7986Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
20521d8c7986Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
20531d8c7986Smrg# --with-ps2pdf assumes 'auto'.
20541d8c7986Smrg#
20551d8c7986Smrg# Interface to module:
20561d8c7986Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
20571d8c7986Smrg# PS2PDF:	returns the path of the ps2pdf program found
20581d8c7986Smrg#		returns the path set by the user in the environment
20591d8c7986Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
20601d8c7986Smrg#		 'no' user instructs the module not to use ps2pdf
20611d8c7986Smrg#
20621d8c7986Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
20631d8c7986Smrg#
20641d8c7986SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
20651d8c7986SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
20661d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
20671d8c7986SmrgAC_ARG_WITH(ps2pdf,
20681d8c7986Smrg	AS_HELP_STRING([--with-ps2pdf],
20691d8c7986Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
20701d8c7986Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
20711d8c7986Smrgm4_undefine([_defopt])
20721d8c7986Smrg
20731d8c7986Smrgif test "x$use_ps2pdf" = x"auto"; then
20741d8c7986Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
20751d8c7986Smrg   if test "x$PS2PDF" = "x"; then
20761d8c7986Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
20771d8c7986Smrg	have_ps2pdf=no
20781d8c7986Smrg   else
20791d8c7986Smrg        have_ps2pdf=yes
20801d8c7986Smrg   fi
20811d8c7986Smrgelif test "x$use_ps2pdf" = x"yes" ; then
20821d8c7986Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
20831d8c7986Smrg   if test "x$PS2PDF" = "x"; then
20841d8c7986Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
20851d8c7986Smrg   fi
20861d8c7986Smrg   have_ps2pdf=yes
20871d8c7986Smrgelif test "x$use_ps2pdf" = x"no" ; then
20881d8c7986Smrg   if test "x$PS2PDF" != "x"; then
20891d8c7986Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
20901d8c7986Smrg   fi
20911d8c7986Smrg   have_ps2pdf=no
20921d8c7986Smrgelse
20931d8c7986Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
20941d8c7986Smrgfi
20951d8c7986SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
20961d8c7986Smrg]) # XORG_WITH_PS2PDF
20971d8c7986Smrg
20981d8c7986Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
20991d8c7986Smrg# ----------------
21001d8c7986Smrg# Minimum version: 1.6.0
21011d8c7986Smrg#
21021d8c7986Smrg# Documentation tools are not always available on all platforms and sometimes
21031d8c7986Smrg# not at the appropriate level. This macro enables a builder to skip all
21041d8c7986Smrg# documentation targets except traditional man pages.
21051d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21061d8c7986Smrg# maximum flexibilty in controlling documentation building.
21071d8c7986Smrg# Refer to:
21081d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
21091d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21101d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21111d8c7986Smrg# XORG_WITH_FOP           --with-fop
21121d8c7986Smrg# XORG_WITH_GROFF         --with-groff
21131d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21141d8c7986Smrg#
21151d8c7986Smrg# Interface to module:
21161d8c7986Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
21171d8c7986Smrg# --enable-docs: 'yes' user instructs the module to generate docs
21181d8c7986Smrg#		 'no' user instructs the module not to generate docs
21191d8c7986Smrg# parm1:	specify the default value, yes or no.
21201d8c7986Smrg#
21211d8c7986SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
21221d8c7986Smrgm4_define([docs_default], m4_default([$1], [yes]))
21231d8c7986SmrgAC_ARG_ENABLE(docs,
21241d8c7986Smrg	AS_HELP_STRING([--enable-docs],
21251d8c7986Smrg	   [Enable building the documentation (default: ]docs_default[)]),
21261d8c7986Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
21271d8c7986Smrgm4_undefine([docs_default])
21281d8c7986SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
21291d8c7986SmrgAC_MSG_CHECKING([whether to build documentation])
21301d8c7986SmrgAC_MSG_RESULT([$build_docs])
21311d8c7986Smrg]) # XORG_ENABLE_DOCS
21321d8c7986Smrg
21331d8c7986Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
21341d8c7986Smrg# ----------------
21351d8c7986Smrg# Minimum version: 1.6.0
21361d8c7986Smrg#
21371d8c7986Smrg# This macro enables a builder to skip all developer documentation.
21381d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21391d8c7986Smrg# maximum flexibilty in controlling documentation building.
21401d8c7986Smrg# Refer to:
21411d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
21421d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21431d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21441d8c7986Smrg# XORG_WITH_FOP           --with-fop
21451d8c7986Smrg# XORG_WITH_GROFF         --with-groff
21461d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21471d8c7986Smrg#
21481d8c7986Smrg# Interface to module:
21491d8c7986Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
21501d8c7986Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
21511d8c7986Smrg#			'no' user instructs the module not to generate developer docs
21521d8c7986Smrg# parm1:		specify the default value, yes or no.
21531d8c7986Smrg#
21541d8c7986SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
21551d8c7986Smrgm4_define([devel_default], m4_default([$1], [yes]))
21561d8c7986SmrgAC_ARG_ENABLE(devel-docs,
21571d8c7986Smrg	AS_HELP_STRING([--enable-devel-docs],
21581d8c7986Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
21591d8c7986Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
21601d8c7986Smrgm4_undefine([devel_default])
21611d8c7986SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
21621d8c7986SmrgAC_MSG_CHECKING([whether to build developer documentation])
21631d8c7986SmrgAC_MSG_RESULT([$build_devel_docs])
21641d8c7986Smrg]) # XORG_ENABLE_DEVEL_DOCS
21651d8c7986Smrg
21661d8c7986Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
21671d8c7986Smrg# ----------------
21681d8c7986Smrg# Minimum version: 1.6.0
21691d8c7986Smrg#
21701d8c7986Smrg# This macro enables a builder to skip all functional specification targets.
21711d8c7986Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21721d8c7986Smrg# maximum flexibilty in controlling documentation building.
21731d8c7986Smrg# Refer to:
21741d8c7986Smrg# XORG_WITH_XMLTO         --with-xmlto
21751d8c7986Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21761d8c7986Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21771d8c7986Smrg# XORG_WITH_FOP           --with-fop
21781d8c7986Smrg# XORG_WITH_GROFF         --with-groff
21791d8c7986Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21801d8c7986Smrg#
21811d8c7986Smrg# Interface to module:
21821d8c7986Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
21831d8c7986Smrg# --enable-specs:	'yes' user instructs the module to generate specs
21841d8c7986Smrg#			'no' user instructs the module not to generate specs
21851d8c7986Smrg# parm1:		specify the default value, yes or no.
218683e5f723Smrg#
21871d8c7986SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
21881d8c7986Smrgm4_define([spec_default], m4_default([$1], [yes]))
21891d8c7986SmrgAC_ARG_ENABLE(specs,
21901d8c7986Smrg	AS_HELP_STRING([--enable-specs],
21911d8c7986Smrg	   [Enable building the specs (default: ]spec_default[)]),
21921d8c7986Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
21931d8c7986Smrgm4_undefine([spec_default])
21941d8c7986SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
21951d8c7986SmrgAC_MSG_CHECKING([whether to build functional specifications])
21961d8c7986SmrgAC_MSG_RESULT([$build_specs])
21971d8c7986Smrg]) # XORG_ENABLE_SPECS
2198690143ccSmrg
21991d8c7986Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
22001d8c7986Smrg# ----------------------------------------------
22011d8c7986Smrg# Minimum version: 1.13.0
220283e5f723Smrg#
22031d8c7986Smrg# This macro enables a builder to enable/disable unit testing
22041d8c7986Smrg# It makes no assumption about the test cases implementation
22051d8c7986Smrg# Test cases may or may not use Automake "Support for test suites"
22061d8c7986Smrg# They may or may not use the software utility library GLib
22071d8c7986Smrg#
22081d8c7986Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
22091d8c7986Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
22101d8c7986Smrg# The variable enable_unit_tests is used by other macros in this file.
22111d8c7986Smrg#
22121d8c7986Smrg# Interface to module:
22131d8c7986Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
22141d8c7986Smrg# enable_unit_tests:    used in configure.ac for additional configuration
22151d8c7986Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
22161d8c7986Smrg#			'no' user instructs the module not to build tests
22171d8c7986Smrg# parm1:		specify the default value, yes or no.
22181d8c7986Smrg#
22191d8c7986SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
22201d8c7986SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
22211d8c7986SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
22221d8c7986SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22231d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
22241d8c7986SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
22251d8c7986Smrg	[Enable building unit test cases (default: ]_defopt[)]),
22261d8c7986Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
22271d8c7986Smrgm4_undefine([_defopt])
22281d8c7986SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
22291d8c7986SmrgAC_MSG_CHECKING([whether to build unit test cases])
22301d8c7986SmrgAC_MSG_RESULT([$enable_unit_tests])
22311d8c7986Smrg]) # XORG_ENABLE_UNIT_TESTS
223283e5f723Smrg
22331d8c7986Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
22341d8c7986Smrg# ------------------------------------------------------
22351d8c7986Smrg# Minimum version: 1.17.0
22361d8c7986Smrg#
22371d8c7986Smrg# This macro enables a builder to enable/disable integration testing
22381d8c7986Smrg# It makes no assumption about the test cases' implementation
22391d8c7986Smrg# Test cases may or may not use Automake "Support for test suites"
22401d8c7986Smrg#
22411d8c7986Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
22421d8c7986Smrg# usually requires less dependencies and may be built and run under less
22431d8c7986Smrg# stringent environments than integration tests.
22441d8c7986Smrg#
22451d8c7986Smrg# Interface to module:
22461d8c7986Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
22471d8c7986Smrg# enable_integration_tests:   used in configure.ac for additional configuration
22481d8c7986Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
22491d8c7986Smrg#                             'no' user instructs the module not to build tests
22501d8c7986Smrg# parm1:                      specify the default value, yes or no.
22511d8c7986Smrg#
22521d8c7986SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
22531d8c7986SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22541d8c7986Smrgm4_define([_defopt], m4_default([$1], [auto]))
22551d8c7986SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
22561d8c7986Smrg	[Enable building integration test cases (default: ]_defopt[)]),
22571d8c7986Smrg	[enable_integration_tests=$enableval],
22581d8c7986Smrg	[enable_integration_tests=]_defopt)
22591d8c7986Smrgm4_undefine([_defopt])
22601d8c7986SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
22611d8c7986Smrg	[test "x$enable_integration_tests" != xno])
22621d8c7986SmrgAC_MSG_CHECKING([whether to build unit test cases])
22631d8c7986SmrgAC_MSG_RESULT([$enable_integration_tests])
22641d8c7986Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2265690143ccSmrg
22661d8c7986Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
22671d8c7986Smrg# ----------------------------------------
22681d8c7986Smrg# Minimum version: 1.13.0
22691d8c7986Smrg#
22701d8c7986Smrg# GLib is a library which provides advanced data structures and functions.
22711d8c7986Smrg# This macro enables a module to test for the presence of Glib.
22721d8c7986Smrg#
22731d8c7986Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
22741d8c7986Smrg# Otherwise the value of $enable_unit_tests is blank.
22751d8c7986Smrg#
22761d8c7986Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
22771d8c7986Smrg# test support usually requires less dependencies and may be built and run under
22781d8c7986Smrg# less stringent environments than integration tests.
22791d8c7986Smrg#
22801d8c7986Smrg# Interface to module:
22811d8c7986Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
22821d8c7986Smrg# with_glib: used in configure.ac to know if GLib has been found
22831d8c7986Smrg# --with-glib:	'yes' user instructs the module to use glib
22841d8c7986Smrg#		'no' user instructs the module not to use glib
22851d8c7986Smrg#
22861d8c7986SmrgAC_DEFUN([XORG_WITH_GLIB],[
22871d8c7986SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22881d8c7986Smrgm4_define([_defopt], m4_default([$2], [auto]))
22891d8c7986SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
22901d8c7986Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
22911d8c7986Smrg	[with_glib=$withval], [with_glib=]_defopt)
22921d8c7986Smrgm4_undefine([_defopt])
2293690143ccSmrg
22941d8c7986Smrghave_glib=no
22951d8c7986Smrg# Do not probe GLib if user explicitly disabled unit testing
22961d8c7986Smrgif test "x$enable_unit_tests" != x"no"; then
22971d8c7986Smrg  # Do not probe GLib if user explicitly disabled it
22981d8c7986Smrg  if test "x$with_glib" != x"no"; then
22991d8c7986Smrg    m4_ifval(
23001d8c7986Smrg      [$1],
23011d8c7986Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
23021d8c7986Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
23031d8c7986Smrg    )
2304690143ccSmrg  fi
230583e5f723Smrgfi
230683e5f723Smrg
23071d8c7986Smrg# Not having GLib when unit testing has been explicitly requested is an error
23081d8c7986Smrgif test "x$enable_unit_tests" = x"yes"; then
23091d8c7986Smrg  if test "x$have_glib" = x"no"; then
23101d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2311690143ccSmrg  fi
2312690143ccSmrgfi
2313690143ccSmrg
23141d8c7986Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
23151d8c7986Smrgif test "x$enable_unit_tests" = x"no"; then
23161d8c7986Smrg  if test "x$with_glib" = x"yes"; then
23171d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23181d8c7986Smrg  fi
23191d8c7986Smrgfi
232083e5f723Smrg
23211d8c7986Smrg# Not having GLib when it has been explicitly requested is an error
23221d8c7986Smrgif test "x$with_glib" = x"yes"; then
23231d8c7986Smrg  if test "x$have_glib" = x"no"; then
23241d8c7986Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
23251d8c7986Smrg  fi
232683e5f723Smrgfi
232783e5f723Smrg
23281d8c7986SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
23291d8c7986Smrg]) # XORG_WITH_GLIB
23301d8c7986Smrg
23311d8c7986Smrg# XORG_LD_WRAP([required|optional])
23321d8c7986Smrg# ---------------------------------
23331d8c7986Smrg# Minimum version: 1.13.0
233483e5f723Smrg#
23351d8c7986Smrg# Check if linker supports -wrap, passed via compiler flags
23361d8c7986Smrg#
23371d8c7986Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
23381d8c7986Smrg# Otherwise the value of $enable_unit_tests is blank.
23391d8c7986Smrg#
23401d8c7986Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
23411d8c7986Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
23421d8c7986Smrg# available, an argument of "optional" allows use when some unit tests require
23431d8c7986Smrg# ld -wrap and others do not.
23441d8c7986Smrg#
23451d8c7986SmrgAC_DEFUN([XORG_LD_WRAP],[
23461d8c7986SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
23471d8c7986Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
23481d8c7986Smrg                      void __wrap_exit(int status) { return; }],
23491d8c7986Smrg                     [exit(0);])])
23501d8c7986Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
23511d8c7986Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
23521d8c7986Smrg  if test "x$have_ld_wrap" = x"no"; then
23531d8c7986Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
23541d8c7986Smrg  fi
23551d8c7986Smrgfi
23561d8c7986SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
23571d8c7986Smrg#
23581d8c7986Smrg]) # XORG_LD_WRAP
2359690143ccSmrg
23601d8c7986Smrg# XORG_CHECK_LINKER_FLAGS
23611d8c7986Smrg# -----------------------
23621d8c7986Smrg# SYNOPSIS
23631d8c7986Smrg#
23641d8c7986Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
23651d8c7986Smrg#
23661d8c7986Smrg# DESCRIPTION
23671d8c7986Smrg#
23681d8c7986Smrg#   Check whether the given linker FLAGS work with the current language's
23691d8c7986Smrg#   linker, or whether they give an error.
23701d8c7986Smrg#
23711d8c7986Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
23721d8c7986Smrg#   success/failure.
23731d8c7986Smrg#
23741d8c7986Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
23751d8c7986Smrg#
23761d8c7986Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
23771d8c7986Smrg#
23781d8c7986Smrg# LICENSE
23791d8c7986Smrg#
23801d8c7986Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
23811d8c7986Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
23821d8c7986Smrg#   Copyright (c) 2009 Matteo Frigo
23831d8c7986Smrg#
23841d8c7986Smrg#   This program is free software: you can redistribute it and/or modify it
23851d8c7986Smrg#   under the terms of the GNU General Public License as published by the
23861d8c7986Smrg#   Free Software Foundation, either version 3 of the License, or (at your
23871d8c7986Smrg#   option) any later version.
23881d8c7986Smrg#
23891d8c7986Smrg#   This program is distributed in the hope that it will be useful, but
23901d8c7986Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
23911d8c7986Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
23921d8c7986Smrg#   Public License for more details.
23931d8c7986Smrg#
23941d8c7986Smrg#   You should have received a copy of the GNU General Public License along
23951d8c7986Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
23961d8c7986Smrg#
23971d8c7986Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
23981d8c7986Smrg#   gives unlimited permission to copy, distribute and modify the configure
23991d8c7986Smrg#   scripts that are the output of Autoconf when processing the Macro. You
24001d8c7986Smrg#   need not follow the terms of the GNU General Public License when using
24011d8c7986Smrg#   or distributing such scripts, even though portions of the text of the
24021d8c7986Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
24031d8c7986Smrg#   all other use of the material that constitutes the Autoconf Macro.
24041d8c7986Smrg#
24051d8c7986Smrg#   This special exception to the GPL applies to versions of the Autoconf
24061d8c7986Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
24071d8c7986Smrg#   modified version of the Autoconf Macro, you may extend this special
24081d8c7986Smrg#   exception to the GPL to apply to your modified version as well.#
24091d8c7986SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
24101d8c7986Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
24111d8c7986Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
24121d8c7986SmrgAS_LITERAL_IF([$1],
24131d8c7986Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
24141d8c7986Smrg      ax_save_FLAGS=$LDFLAGS
24151d8c7986Smrg      LDFLAGS="$1"
24161d8c7986Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
24171d8c7986Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24181d8c7986Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24191d8c7986Smrg      LDFLAGS=$ax_save_FLAGS])],
24201d8c7986Smrg  [ax_save_FLAGS=$LDFLAGS
24211d8c7986Smrg   LDFLAGS="$1"
24221d8c7986Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
24231d8c7986Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24241d8c7986Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24251d8c7986Smrg   LDFLAGS=$ax_save_FLAGS])
24261d8c7986Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
24271d8c7986SmrgAC_MSG_RESULT($xorg_check_linker_flags)
24281d8c7986Smrgif test "x$xorg_check_linker_flags" = xyes; then
24291d8c7986Smrg	m4_default([$2], :)
243083e5f723Smrgelse
24311d8c7986Smrg	m4_default([$3], :)
243283e5f723Smrgfi
24331d8c7986Smrg]) # XORG_CHECK_LINKER_FLAGS
243483e5f723Smrg
24351d8c7986Smrg# XORG_MEMORY_CHECK_FLAGS
24361d8c7986Smrg# -----------------------
24371d8c7986Smrg# Minimum version: 1.16.0
2438690143ccSmrg#
24391d8c7986Smrg# This macro attempts to find appropriate memory checking functionality
24401d8c7986Smrg# for various platforms which unit testing code may use to catch various
24411d8c7986Smrg# forms of memory allocation and access errors in testing.
24421d8c7986Smrg#
24431d8c7986Smrg# Interface to module:
24441d8c7986Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
24451d8c7986Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
24461d8c7986Smrg#
24471d8c7986Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
24481d8c7986Smrg#
24491d8c7986SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
245083e5f723Smrg
24511d8c7986SmrgAC_REQUIRE([AC_CANONICAL_HOST])
24521d8c7986SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
24531d8c7986Smrg           [Environment variables to enable memory checking in tests])
2454690143ccSmrg
24551d8c7986Smrg# Check for different types of support on different platforms
24561d8c7986Smrgcase $host_os in
24571d8c7986Smrg    solaris*)
24581d8c7986Smrg        AC_CHECK_LIB([umem], [umem_alloc],
24591d8c7986Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
24601d8c7986Smrg        ;;
24611d8c7986Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
24621d8c7986Smrg        # both directly and inverted, so should not be 0 or 255.
24631d8c7986Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
24641d8c7986Smrg        ;;
24651d8c7986Smrg    darwin*)
24661d8c7986Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
24671d8c7986Smrg        ;;
24681d8c7986Smrg    *bsd*)
24691d8c7986Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
24701d8c7986Smrg        ;;
24711d8c7986Smrgesac
2472690143ccSmrg
24731d8c7986Smrg# User supplied flags override default flags
24741d8c7986Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
24751d8c7986Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
24761d8c7986Smrgfi
247783e5f723Smrg
24781d8c7986SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
24791d8c7986Smrg]) # XORG_WITH_LINT
2480690143ccSmrg
24811d8c7986Smrg# XORG_CHECK_MALLOC_ZERO
24821d8c7986Smrg# ----------------------
24831d8c7986Smrg# Minimum version: 1.0.0
248483e5f723Smrg#
24851d8c7986Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
24861d8c7986Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
24871d8c7986Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
24881d8c7986SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
24891d8c7986SmrgAC_ARG_ENABLE(malloc0returnsnull,
24901d8c7986Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
24911d8c7986Smrg		       [malloc(0) returns NULL (default: auto)]),
24921d8c7986Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
24931d8c7986Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
249483e5f723Smrg
24951d8c7986SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
24961d8c7986Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
24971d8c7986Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
24981d8c7986Smrg#include <stdlib.h>
24991d8c7986Smrg],[
25001d8c7986Smrg    char *m0, *r0, *c0, *p;
25011d8c7986Smrg    m0 = malloc(0);
25021d8c7986Smrg    p = malloc(10);
25031d8c7986Smrg    r0 = realloc(p,0);
25041d8c7986Smrg    c0 = calloc(0,10);
25051d8c7986Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
25061d8c7986Smrg])],
25071d8c7986Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
25081d8c7986Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
25091d8c7986Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
25101d8c7986Smrgfi
25111d8c7986SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2512690143ccSmrg
25131d8c7986Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
25141d8c7986Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
25151d8c7986Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
25161d8c7986Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
25171d8c7986Smrgelse
25181d8c7986Smrg	MALLOC_ZERO_CFLAGS=""
25191d8c7986Smrg	XMALLOC_ZERO_CFLAGS=""
25201d8c7986Smrg	XTMALLOC_ZERO_CFLAGS=""
252183e5f723Smrgfi
252283e5f723Smrg
25231d8c7986SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
25241d8c7986SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
25251d8c7986SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
25261d8c7986Smrg]) # XORG_CHECK_MALLOC_ZERO
2527690143ccSmrg
25281d8c7986Smrg# XORG_WITH_LINT()
25291d8c7986Smrg# ----------------
25301d8c7986Smrg# Minimum version: 1.1.0
25311d8c7986Smrg#
25321d8c7986Smrg# This macro enables the use of a tool that flags some suspicious and
25331d8c7986Smrg# non-portable constructs (likely to be bugs) in C language source code.
25341d8c7986Smrg# It will attempt to locate the tool and use appropriate options.
25351d8c7986Smrg# There are various lint type tools on different platforms.
25361d8c7986Smrg#
25371d8c7986Smrg# Interface to module:
25381d8c7986Smrg# LINT:		returns the path to the tool found on the platform
25391d8c7986Smrg#		or the value set to LINT on the configure cmd line
25401d8c7986Smrg#		also an Automake conditional
25411d8c7986Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
25421d8c7986Smrg#
25431d8c7986Smrg# --with-lint:	'yes' user instructs the module to use lint
25441d8c7986Smrg#		'no' user instructs the module not to use lint (default)
25451d8c7986Smrg#
25461d8c7986Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
25471d8c7986Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
254883e5f723Smrg#
25491d8c7986SmrgAC_DEFUN([XORG_WITH_LINT],[
2550690143ccSmrg
25511d8c7986SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
25521d8c7986SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
25531d8c7986SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
25541d8c7986Smrg		[Use a lint-style source code checker (default: disabled)])],
25551d8c7986Smrg		[use_lint=$withval], [use_lint=no])
2556690143ccSmrg
25571d8c7986Smrg# Obtain platform specific info like program name and options
25581d8c7986Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
25591d8c7986Smrgcase $host_os in
25601d8c7986Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
25611d8c7986Smrg	lint_name=splint
25621d8c7986Smrg	lint_options="-badflag"
25631d8c7986Smrg	;;
25641d8c7986Smrg  *freebsd* | *netbsd*)
25651d8c7986Smrg	lint_name=lint
25661d8c7986Smrg	lint_options="-u -b"
25671d8c7986Smrg	;;
25681d8c7986Smrg  *solaris*)
25691d8c7986Smrg	lint_name=lint
25701d8c7986Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
25711d8c7986Smrg	;;
25721d8c7986Smrgesac
2573690143ccSmrg
25741d8c7986Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
25751d8c7986Smrgif test "x$use_lint" = x"yes" ; then
25761d8c7986Smrg   AC_PATH_PROG([LINT], [$lint_name])
25771d8c7986Smrg   if test "x$LINT" = "x"; then
25781d8c7986Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
25791d8c7986Smrg   fi
25801d8c7986Smrgelif test "x$use_lint" = x"no" ; then
25811d8c7986Smrg   if test "x$LINT" != "x"; then
25821d8c7986Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
25831d8c7986Smrg   fi
258483e5f723Smrgelse
25851d8c7986Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
258683e5f723Smrgfi
258783e5f723Smrg
25881d8c7986Smrg# User supplied flags override default flags
25891d8c7986Smrgif test "x$LINT_FLAGS" != "x"; then
25901d8c7986Smrg   lint_options=$LINT_FLAGS
25911d8c7986Smrgfi
259283e5f723Smrg
25931d8c7986SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
25941d8c7986SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2595690143ccSmrg
25961d8c7986Smrg]) # XORG_WITH_LINT
259783e5f723Smrg
25981d8c7986Smrg# XORG_LINT_LIBRARY(LIBNAME)
25991d8c7986Smrg# --------------------------
26001d8c7986Smrg# Minimum version: 1.1.0
260183e5f723Smrg#
26021d8c7986Smrg# Sets up flags for building lint libraries for checking programs that call
26031d8c7986Smrg# functions in the library.
26041d8c7986Smrg#
26051d8c7986Smrg# Interface to module:
26061d8c7986Smrg# LINTLIB		- Automake variable with the name of lint library file to make
26071d8c7986Smrg# MAKE_LINT_LIB		- Automake conditional
26081d8c7986Smrg#
26091d8c7986Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
26101d8c7986Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2611f46a6179Smrg
26121d8c7986SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
26131d8c7986SmrgAC_REQUIRE([XORG_WITH_LINT])
26141d8c7986SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
26151d8c7986Smrg	[Create lint library (default: disabled)])],
26161d8c7986Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2617f46a6179Smrg
26181d8c7986Smrgif test "x$make_lint_lib" = x"yes" ; then
26191d8c7986Smrg   LINTLIB=llib-l$1.ln
26201d8c7986Smrg   if test "x$LINT" = "x"; then
26211d8c7986Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
26221d8c7986Smrg   fi
26231d8c7986Smrgelif test "x$make_lint_lib" != x"no" ; then
26241d8c7986Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
26251d8c7986Smrgfi
26265fac8b10Smrg
26271d8c7986SmrgAC_SUBST(LINTLIB)
26281d8c7986SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2629690143ccSmrg
26301d8c7986Smrg]) # XORG_LINT_LIBRARY
2631690143ccSmrg
26321d8c7986Smrg# XORG_COMPILER_BRAND
26331d8c7986Smrg# -------------------
26341d8c7986Smrg# Minimum version: 1.14.0
26355fac8b10Smrg#
26361d8c7986Smrg# Checks for various brands of compilers and sets flags as appropriate:
26371d8c7986Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
26381d8c7986Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
26391d8c7986Smrg#   clang compiler - sets CLANGCC to "yes"
26401d8c7986Smrg#   Intel compiler - sets INTELCC to "yes"
26411d8c7986Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
26421d8c7986Smrg#
26431d8c7986SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
26441d8c7986SmrgAC_LANG_CASE(
26451d8c7986Smrg	[C], [
26461d8c7986Smrg		AC_REQUIRE([AC_PROG_CC_C99])
26471d8c7986Smrg	],
26481d8c7986Smrg	[C++], [
26491d8c7986Smrg		AC_REQUIRE([AC_PROG_CXX])
26501d8c7986Smrg	]
26511d8c7986Smrg)
26521d8c7986SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
26531d8c7986SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
26541d8c7986SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
26551d8c7986Smrg]) # XORG_COMPILER_BRAND
265683e5f723Smrg
26571d8c7986Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2658690143ccSmrg# ---------------
26591d8c7986Smrg# Minimum version: 1.16.0
26601d8c7986Smrg#
26611d8c7986Smrg# Test if the compiler works when passed the given flag as a command line argument.
26621d8c7986Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
26631d8c7986Smrg# next flag in the list until there are no more options.
26641d8c7986Smrg#
26651d8c7986Smrg# Note that this does not guarantee that the compiler supports the flag as some
26661d8c7986Smrg# compilers will simply ignore arguments that they do not understand, but we do
26671d8c7986Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
26681d8c7986Smrg# -Werror=unused-command-line-argument
26691d8c7986Smrg#
26701d8c7986SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
26711d8c7986Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26721d8c7986Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26731d8c7986Smrg
26741d8c7986SmrgAC_LANG_COMPILER_REQUIRE
26751d8c7986Smrg
26761d8c7986SmrgAC_LANG_CASE(
26771d8c7986Smrg	[C], [
26781d8c7986Smrg		AC_REQUIRE([AC_PROG_CC_C99])
26791d8c7986Smrg		define([PREFIX], [C])
26801d8c7986Smrg		define([CACHE_PREFIX], [cc])
26811d8c7986Smrg		define([COMPILER], [$CC])
26821d8c7986Smrg	],
26831d8c7986Smrg	[C++], [
26841d8c7986Smrg		define([PREFIX], [CXX])
26851d8c7986Smrg		define([CACHE_PREFIX], [cxx])
26861d8c7986Smrg		define([COMPILER], [$CXX])
26871d8c7986Smrg	]
26881d8c7986Smrg)
268983e5f723Smrg
26901d8c7986Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
26911d8c7986Smrg
26921d8c7986Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
26931d8c7986Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
26941d8c7986Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
26951d8c7986Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
26961d8c7986Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
26971d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
26981d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
26991d8c7986Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
27001d8c7986Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2701f46a6179Smrgfi
2702f46a6179Smrg
27031d8c7986Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
27041d8c7986Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
27051d8c7986Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27061d8c7986Smrg	fi
27071d8c7986Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27081d8c7986Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
27091d8c7986Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
27101d8c7986Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27111d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
27121d8c7986Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
27131d8c7986Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
27141d8c7986Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27151d8c7986Smrgfi
271634345a63Smrg
27171d8c7986Smrgfound="no"
27181d8c7986Smrgm4_foreach([flag], m4_cdr($@), [
27191d8c7986Smrg	if test $found = "no" ; then
27201d8c7986Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
27211d8c7986Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27221d8c7986Smrg		fi
27231d8c7986Smrg
27241d8c7986Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
27251d8c7986Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27261d8c7986Smrg		fi
27271d8c7986Smrg
27281d8c7986Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
27291d8c7986Smrg
27301d8c7986Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
27311d8c7986Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
27321d8c7986Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
27331d8c7986Smrg		AC_CACHE_VAL($cacheid,
27341d8c7986Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
27351d8c7986Smrg					     [eval $cacheid=yes],
27361d8c7986Smrg					     [eval $cacheid=no])])
27371d8c7986Smrg
27381d8c7986Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27391d8c7986Smrg
27401d8c7986Smrg		eval supported=\$$cacheid
27411d8c7986Smrg		AC_MSG_RESULT([$supported])
27421d8c7986Smrg		if test "$supported" = "yes" ; then
27431d8c7986Smrg			$1="$$1 ]flag["
27441d8c7986Smrg			found="yes"
27451d8c7986Smrg		fi
27461d8c7986Smrg	fi
2747690143ccSmrg])
27481d8c7986Smrg]) # XORG_TESTSET_CFLAG
2749690143ccSmrg
27501d8c7986Smrg# XORG_COMPILER_FLAGS
27511d8c7986Smrg# ---------------
27521d8c7986Smrg# Minimum version: 1.16.0
275383e5f723Smrg#
27541d8c7986Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
27551d8c7986Smrg# arguments supported by the selected compiler which do NOT alter the generated
27561d8c7986Smrg# code.  These arguments will cause the compiler to print various warnings
27571d8c7986Smrg# during compilation AND turn a conservative set of warnings into errors.
27581d8c7986Smrg#
27591d8c7986Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
27601d8c7986Smrg# future versions of util-macros as options are added to new compilers.
27611d8c7986Smrg#
27621d8c7986SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
27631d8c7986SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2764690143ccSmrg
27651d8c7986SmrgAC_ARG_ENABLE(selective-werror,
27661d8c7986Smrg              AS_HELP_STRING([--disable-selective-werror],
27671d8c7986Smrg                             [Turn off selective compiler errors. (default: enabled)]),
27681d8c7986Smrg              [SELECTIVE_WERROR=$enableval],
27691d8c7986Smrg              [SELECTIVE_WERROR=yes])
27701d8c7986Smrg
27711d8c7986SmrgAC_LANG_CASE(
27721d8c7986Smrg        [C], [
27731d8c7986Smrg                define([PREFIX], [C])
27741d8c7986Smrg        ],
27751d8c7986Smrg        [C++], [
27761d8c7986Smrg                define([PREFIX], [CXX])
27771d8c7986Smrg        ]
27781d8c7986Smrg)
27791d8c7986Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
27801d8c7986Smrgif test "x$SUNCC" = "xyes"; then
27811d8c7986Smrg    [BASE_]PREFIX[FLAGS]="-v"
27821d8c7986Smrgelse
27831d8c7986Smrg    [BASE_]PREFIX[FLAGS]=""
2784690143ccSmrgfi
2785f46a6179Smrg
27861d8c7986Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
27871d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
27881d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
27891d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
27901d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
27911d8c7986Smrg
27921d8c7986SmrgAC_LANG_CASE(
27931d8c7986Smrg	[C], [
27941d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
27951d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
27961d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
27971d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
27981d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
27991d8c7986Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
28001d8c7986Smrg	]
28011d8c7986Smrg)
28021d8c7986Smrg
28031d8c7986Smrg# This chunk adds additional warnings that could catch undesired effects.
28041d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
28051d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
28061d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
28071d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
28081d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
28091d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
28101d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
28111d8c7986Smrg
28121d8c7986Smrg# These are currently disabled because they are noisy.  They will be enabled
28131d8c7986Smrg# in the future once the codebase is sufficiently modernized to silence
28141d8c7986Smrg# them.  For now, I don't want them to drown out the other warnings.
28151d8c7986Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
28161d8c7986Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
28171d8c7986Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
28181d8c7986Smrg
28191d8c7986Smrg# Turn some warnings into errors, so we don't accidently get successful builds
28201d8c7986Smrg# when there are problems that should be fixed.
28211d8c7986Smrg
28221d8c7986Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
28231d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
28241d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
28251d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
28261d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
28271d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
28281d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
28291d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
28301d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
28311d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
28321d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
28331d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
28341d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
28351d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
28361d8c7986Smrgelse
28371d8c7986SmrgAC_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])
28381d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
28391d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
28401d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
28411d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
28421d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
28431d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
28441d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
28451d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
28461d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
28471d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
28481d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
28491d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
28501d8c7986SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
28511d8c7986Smrgfi
28521d8c7986Smrg
28531d8c7986SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
28541d8c7986Smrg]) # XORG_COMPILER_FLAGS
28551d8c7986Smrg
28561d8c7986Smrg# XORG_CWARNFLAGS
28571d8c7986Smrg# ---------------
28581d8c7986Smrg# Minimum version: 1.2.0
28591d8c7986Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2860690143ccSmrg#
28611d8c7986Smrg# Defines CWARNFLAGS to enable C compiler warnings.
28621d8c7986Smrg#
28631d8c7986Smrg# This function is deprecated because it defines -fno-strict-aliasing
28641d8c7986Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
28651d8c7986Smrg# is needed, then it should be added explicitly in the module when
28661d8c7986Smrg# it is updated to use BASE_CFLAGS.
28671d8c7986Smrg#
28681d8c7986SmrgAC_DEFUN([XORG_CWARNFLAGS], [
28691d8c7986SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
28701d8c7986SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
28711d8c7986SmrgAC_LANG_CASE(
28721d8c7986Smrg	[C], [
28731d8c7986Smrg		CWARNFLAGS="$BASE_CFLAGS"
28741d8c7986Smrg		if  test "x$GCC" = xyes ; then
28751d8c7986Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
28761d8c7986Smrg		fi
28771d8c7986Smrg		AC_SUBST(CWARNFLAGS)
28781d8c7986Smrg	]
28791d8c7986Smrg)
28801d8c7986Smrg]) # XORG_CWARNFLAGS
288183e5f723Smrg
28821d8c7986Smrg# XORG_STRICT_OPTION
28831d8c7986Smrg# -----------------------
28841d8c7986Smrg# Minimum version: 1.3.0
28851d8c7986Smrg#
28861d8c7986Smrg# Add configure option to enable strict compilation flags, such as treating
28871d8c7986Smrg# warnings as fatal errors.
28881d8c7986Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
28891d8c7986Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
28901d8c7986Smrg#
28911d8c7986Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
28921d8c7986Smrg# when strict compilation is unconditionally desired.
28931d8c7986SmrgAC_DEFUN([XORG_STRICT_OPTION], [
28941d8c7986SmrgAC_REQUIRE([XORG_CWARNFLAGS])
28951d8c7986SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
289683e5f723Smrg
28971d8c7986SmrgAC_ARG_ENABLE(strict-compilation,
28981d8c7986Smrg			  AS_HELP_STRING([--enable-strict-compilation],
28991d8c7986Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
29001d8c7986Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
290134345a63Smrg
29021d8c7986SmrgAC_LANG_CASE(
29031d8c7986Smrg        [C], [
29041d8c7986Smrg                define([PREFIX], [C])
29051d8c7986Smrg        ],
29061d8c7986Smrg        [C++], [
29071d8c7986Smrg                define([PREFIX], [CXX])
29081d8c7986Smrg        ]
29091d8c7986Smrg)
2910f46a6179Smrg
29111d8c7986Smrg[STRICT_]PREFIX[FLAGS]=""
29121d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
29131d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2914f46a6179Smrg
29151d8c7986Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
29161d8c7986Smrg# activate it with -Werror, so we add it here explicitly.
29171d8c7986SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
29185fac8b10Smrg
29191d8c7986Smrgif test "x$STRICT_COMPILE" = "xyes"; then
29201d8c7986Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
29211d8c7986Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
29221d8c7986Smrgfi
29231d8c7986SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
29241d8c7986SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
29251d8c7986SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
29261d8c7986Smrg]) # XORG_STRICT_OPTION
2927f46a6179Smrg
29281d8c7986Smrg# XORG_DEFAULT_OPTIONS
2929f46a6179Smrg# --------------------
29301d8c7986Smrg# Minimum version: 1.3.0
2931f46a6179Smrg#
29321d8c7986Smrg# Defines default options for X.Org modules.
2933f46a6179Smrg#
29341d8c7986SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
29351d8c7986SmrgAC_REQUIRE([AC_PROG_INSTALL])
29361d8c7986SmrgXORG_COMPILER_FLAGS
29371d8c7986SmrgXORG_CWARNFLAGS
29381d8c7986SmrgXORG_STRICT_OPTION
29391d8c7986SmrgXORG_RELEASE_VERSION
29401d8c7986SmrgXORG_CHANGELOG
29411d8c7986SmrgXORG_INSTALL
29421d8c7986SmrgXORG_MANPAGE_SECTIONS
29431d8c7986Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
29441d8c7986Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
29451d8c7986Smrg]) # XORG_DEFAULT_OPTIONS
294683e5f723Smrg
29471d8c7986Smrg# XORG_INSTALL()
29481d8c7986Smrg# ----------------
29491d8c7986Smrg# Minimum version: 1.4.0
29501d8c7986Smrg#
29511d8c7986Smrg# Defines the variable INSTALL_CMD as the command to copy
29521d8c7986Smrg# INSTALL from $prefix/share/util-macros.
29531d8c7986Smrg#
29541d8c7986SmrgAC_DEFUN([XORG_INSTALL], [
29551d8c7986SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
29561d8c7986Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
29571d8c7986SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
29581d8c7986Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
29591d8c7986Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
29601d8c7986Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
29611d8c7986SmrgAC_SUBST([INSTALL_CMD])
29621d8c7986Smrg]) # XORG_INSTALL
29631d8c7986Smrgdnl Copyright 2005 Red Hat, Inc
29641d8c7986Smrgdnl
29651d8c7986Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
29661d8c7986Smrgdnl documentation for any purpose is hereby granted without fee, provided that
29671d8c7986Smrgdnl the above copyright notice appear in all copies and that both that
29681d8c7986Smrgdnl copyright notice and this permission notice appear in supporting
29691d8c7986Smrgdnl documentation.
29701d8c7986Smrgdnl
29711d8c7986Smrgdnl The above copyright notice and this permission notice shall be included
29721d8c7986Smrgdnl in all copies or substantial portions of the Software.
29731d8c7986Smrgdnl
29741d8c7986Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
29751d8c7986Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29761d8c7986Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29771d8c7986Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
29781d8c7986Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29791d8c7986Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29801d8c7986Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
29811d8c7986Smrgdnl
29821d8c7986Smrgdnl Except as contained in this notice, the name of the copyright holders shall
29831d8c7986Smrgdnl not be used in advertising or otherwise to promote the sale, use or
29841d8c7986Smrgdnl other dealings in this Software without prior written authorization
29851d8c7986Smrgdnl from the copyright holders.
29861d8c7986Smrgdnl
2987f46a6179Smrg
29881d8c7986Smrg# XORG_RELEASE_VERSION
29891d8c7986Smrg# --------------------
29901d8c7986Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
29911d8c7986Smrg 
29921d8c7986SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
29931d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
29941d8c7986Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
29951d8c7986Smrg		[Major version of this package])
29961d8c7986Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
29971d8c7986Smrg	if test "x$PVM" = "x"; then
29981d8c7986Smrg		PVM="0"
29991d8c7986Smrg	fi
30001d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
30011d8c7986Smrg		[$PVM],
30021d8c7986Smrg		[Minor version of this package])
30031d8c7986Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
30041d8c7986Smrg	if test "x$PVP" = "x"; then
30051d8c7986Smrg		PVP="0"
30061d8c7986Smrg	fi
30071d8c7986Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
30081d8c7986Smrg		[$PVP],
30091d8c7986Smrg		[Patch version of this package])
30101d8c7986Smrg])
3011f46a6179Smrg
30121d8c7986Smrg# XORG_CHANGELOG()
30131d8c7986Smrg# ----------------
30141d8c7986Smrg# Minimum version: 1.2.0
30151d8c7986Smrg#
30161d8c7986Smrg# Defines the variable CHANGELOG_CMD as the command to generate
30171d8c7986Smrg# ChangeLog from git.
30181d8c7986Smrg#
30191d8c7986Smrg#
30201d8c7986SmrgAC_DEFUN([XORG_CHANGELOG], [
30211d8c7986SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
30221d8c7986Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
30231d8c7986Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
30241d8c7986Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
30251d8c7986SmrgAC_SUBST([CHANGELOG_CMD])
30261d8c7986Smrg]) # XORG_CHANGELOG
3027f46a6179Smrg
3028