aclocal.m4 revision 16d7e2f1
116d7e2f1Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
22c7c4e3dSmrg
38650bb69Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
48650bb69Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
52c7c4e3dSmrg# This file is free software; the Free Software Foundation
62c7c4e3dSmrg# gives unlimited permission to copy and/or distribute it,
72c7c4e3dSmrg# with or without modifications, as long as this notice is preserved.
82c7c4e3dSmrg
92c7c4e3dSmrg# This program is distributed in the hope that it will be useful,
102c7c4e3dSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
112c7c4e3dSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
122c7c4e3dSmrg# PARTICULAR PURPOSE.
132c7c4e3dSmrg
148650bb69Smrgm4_ifndef([AC_AUTOCONF_VERSION],
158650bb69Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1616d7e2f1Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1716d7e2f1Smrg[m4_warning([this file was generated for autoconf 2.68.
188650bb69SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
198650bb69SmrgIf you have problems, you may need to regenerate the build system entirely.
208650bb69SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
212c7c4e3dSmrg
228650bb69Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
238650bb69Smrg#
248650bb69Smrg# This file is free software; the Free Software Foundation
258650bb69Smrg# gives unlimited permission to copy and/or distribute it,
268650bb69Smrg# with or without modifications, as long as this notice is preserved.
272c7c4e3dSmrg
282c7c4e3dSmrg# AM_AUTOMAKE_VERSION(VERSION)
292c7c4e3dSmrg# ----------------------------
302c7c4e3dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
312c7c4e3dSmrg# generated from the m4 files accompanying Automake X.Y.
328650bb69Smrg# (This private macro should not be called outside this file.)
338650bb69SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
348650bb69Smrg[am__api_version='1.11'
358650bb69Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
368650bb69Smrgdnl require some minimum version.  Point them to the right macro.
3716d7e2f1Smrgm4_if([$1], [1.11.1], [],
388650bb69Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
398650bb69Smrg])
408650bb69Smrg
418650bb69Smrg# _AM_AUTOCONF_VERSION(VERSION)
428650bb69Smrg# -----------------------------
438650bb69Smrg# aclocal traces this macro to find the Autoconf version.
448650bb69Smrg# This is a private macro too.  Using m4_define simplifies
458650bb69Smrg# the logic in aclocal, which can simply ignore this definition.
468650bb69Smrgm4_define([_AM_AUTOCONF_VERSION], [])
472c7c4e3dSmrg
482c7c4e3dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
492c7c4e3dSmrg# -------------------------------
508650bb69Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
518650bb69Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
522c7c4e3dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5316d7e2f1Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
548650bb69Smrgm4_ifndef([AC_AUTOCONF_VERSION],
558650bb69Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
568650bb69Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
572c7c4e3dSmrg
588650bb69Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
592c7c4e3dSmrg
608650bb69Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
612c7c4e3dSmrg#
628650bb69Smrg# This file is free software; the Free Software Foundation
638650bb69Smrg# gives unlimited permission to copy and/or distribute it,
648650bb69Smrg# with or without modifications, as long as this notice is preserved.
652c7c4e3dSmrg
662c7c4e3dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
672c7c4e3dSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
682c7c4e3dSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
692c7c4e3dSmrg#
702c7c4e3dSmrg# Of course, Automake must honor this variable whenever it calls a
712c7c4e3dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
722c7c4e3dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
732c7c4e3dSmrg# depending on how configure is run.  This is pretty annoying, since
742c7c4e3dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
752c7c4e3dSmrg# source directory, any form will work fine, but in subdirectories a
762c7c4e3dSmrg# relative path needs to be adjusted first.
772c7c4e3dSmrg#
782c7c4e3dSmrg# $ac_aux_dir/missing
792c7c4e3dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
802c7c4e3dSmrg# $top_srcdir/$ac_aux_dir/missing
812c7c4e3dSmrg#    fails if $ac_aux_dir is absolute,
822c7c4e3dSmrg#    fails when called from a subdirectory in a VPATH build with
832c7c4e3dSmrg#          a relative $ac_aux_dir
842c7c4e3dSmrg#
852c7c4e3dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
862c7c4e3dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
872c7c4e3dSmrg# harmless because $srcdir is `.', but things will broke when you
882c7c4e3dSmrg# start a VPATH build or use an absolute $srcdir.
892c7c4e3dSmrg#
902c7c4e3dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
912c7c4e3dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
922c7c4e3dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
932c7c4e3dSmrg# and then we would define $MISSING as
942c7c4e3dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
952c7c4e3dSmrg# This will work as long as MISSING is not called from configure, because
962c7c4e3dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
972c7c4e3dSmrg# However there are other variables, like CC, which are often used in
982c7c4e3dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
992c7c4e3dSmrg#
1002c7c4e3dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1012c7c4e3dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1022c7c4e3dSmrg# configured tree to be moved without reconfiguration.
1032c7c4e3dSmrg
1048650bb69SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1058650bb69Smrg[dnl Rely on autoconf to set up CDPATH properly.
1068650bb69SmrgAC_PREREQ([2.50])dnl
1072c7c4e3dSmrg# expand $ac_aux_dir to an absolute path
1082c7c4e3dSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1092c7c4e3dSmrg])
1102c7c4e3dSmrg
1118650bb69Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1122c7c4e3dSmrg
1138650bb69Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1148650bb69Smrg# Free Software Foundation, Inc.
1158650bb69Smrg#
1168650bb69Smrg# This file is free software; the Free Software Foundation
1178650bb69Smrg# gives unlimited permission to copy and/or distribute it,
1188650bb69Smrg# with or without modifications, as long as this notice is preserved.
1192c7c4e3dSmrg
1208650bb69Smrg# serial 9
1212c7c4e3dSmrg
1228650bb69Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1238650bb69Smrg# -------------------------------------
1248650bb69Smrg# Define a conditional.
1258650bb69SmrgAC_DEFUN([AM_CONDITIONAL],
1268650bb69Smrg[AC_PREREQ(2.52)dnl
1278650bb69Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1288650bb69Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1298650bb69SmrgAC_SUBST([$1_TRUE])dnl
1308650bb69SmrgAC_SUBST([$1_FALSE])dnl
1318650bb69Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1328650bb69Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1338650bb69Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1348650bb69Smrgif $2; then
1358650bb69Smrg  $1_TRUE=
1368650bb69Smrg  $1_FALSE='#'
1372c7c4e3dSmrgelse
1388650bb69Smrg  $1_TRUE='#'
1398650bb69Smrg  $1_FALSE=
1402c7c4e3dSmrgfi
1418650bb69SmrgAC_CONFIG_COMMANDS_PRE(
1428650bb69Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1438650bb69Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1448650bb69SmrgUsually this means the macro was only invoked conditionally.]])
1458650bb69Smrgfi])])
1462c7c4e3dSmrg
1478650bb69Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
1488650bb69Smrg# Free Software Foundation, Inc.
1498650bb69Smrg#
1508650bb69Smrg# This file is free software; the Free Software Foundation
1518650bb69Smrg# gives unlimited permission to copy and/or distribute it,
1528650bb69Smrg# with or without modifications, as long as this notice is preserved.
1532c7c4e3dSmrg
1548650bb69Smrg# serial 10
1552c7c4e3dSmrg
1562c7c4e3dSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1572c7c4e3dSmrg# written in clear, in which case automake, when reading aclocal.m4,
1582c7c4e3dSmrg# will think it sees a *use*, and therefore will trigger all it's
1592c7c4e3dSmrg# C support machinery.  Also note that it means that autoscan, seeing
1602c7c4e3dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1612c7c4e3dSmrg
1622c7c4e3dSmrg
1632c7c4e3dSmrg# _AM_DEPENDENCIES(NAME)
1642c7c4e3dSmrg# ----------------------
1652c7c4e3dSmrg# See how the compiler implements dependency checking.
1662c7c4e3dSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1672c7c4e3dSmrg# We try a few techniques and use that to set a single cache variable.
1682c7c4e3dSmrg#
1692c7c4e3dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1702c7c4e3dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1712c7c4e3dSmrg# dependency, and given that the user is not expected to run this macro,
1722c7c4e3dSmrg# just rely on AC_PROG_CC.
1732c7c4e3dSmrgAC_DEFUN([_AM_DEPENDENCIES],
1742c7c4e3dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1752c7c4e3dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1762c7c4e3dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1772c7c4e3dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1782c7c4e3dSmrg
1792c7c4e3dSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1802c7c4e3dSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1812c7c4e3dSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1828650bb69Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1832c7c4e3dSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1842c7c4e3dSmrg                   [depcc="$$1"   am_compiler_list=])
1852c7c4e3dSmrg
1862c7c4e3dSmrgAC_CACHE_CHECK([dependency style of $depcc],
1872c7c4e3dSmrg               [am_cv_$1_dependencies_compiler_type],
1882c7c4e3dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1892c7c4e3dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1902c7c4e3dSmrg  # making bogus files that we don't know about and never remove.  For
1912c7c4e3dSmrg  # instance it was reported that on HP-UX the gcc test will end up
1922c7c4e3dSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
1932c7c4e3dSmrg  # in D'.
1942c7c4e3dSmrg  mkdir conftest.dir
1952c7c4e3dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1962c7c4e3dSmrg  # using a relative directory.
1972c7c4e3dSmrg  cp "$am_depcomp" conftest.dir
1982c7c4e3dSmrg  cd conftest.dir
1992c7c4e3dSmrg  # We will build objects and dependencies in a subdirectory because
2002c7c4e3dSmrg  # it helps to detect inapplicable dependency modes.  For instance
2012c7c4e3dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2022c7c4e3dSmrg  # side effect of compilation, but ICC will put the dependencies in
2032c7c4e3dSmrg  # the current directory while Tru64 will put them in the object
2042c7c4e3dSmrg  # directory.
2052c7c4e3dSmrg  mkdir sub
2062c7c4e3dSmrg
2072c7c4e3dSmrg  am_cv_$1_dependencies_compiler_type=none
2082c7c4e3dSmrg  if test "$am_compiler_list" = ""; then
2092c7c4e3dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2102c7c4e3dSmrg  fi
2118650bb69Smrg  am__universal=false
2128650bb69Smrg  m4_case([$1], [CC],
2138650bb69Smrg    [case " $depcc " in #(
2148650bb69Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2158650bb69Smrg     esac],
2168650bb69Smrg    [CXX],
2178650bb69Smrg    [case " $depcc " in #(
2188650bb69Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2198650bb69Smrg     esac])
2208650bb69Smrg
2212c7c4e3dSmrg  for depmode in $am_compiler_list; do
2222c7c4e3dSmrg    # Setup a source with many dependencies, because some compilers
2232c7c4e3dSmrg    # like to wrap large dependency lists on column 80 (with \), and
2242c7c4e3dSmrg    # we should not choose a depcomp mode which is confused by this.
2252c7c4e3dSmrg    #
2262c7c4e3dSmrg    # We need to recreate these files for each test, as the compiler may
2272c7c4e3dSmrg    # overwrite some of them when testing with obscure command lines.
2282c7c4e3dSmrg    # This happens at least with the AIX C compiler.
2292c7c4e3dSmrg    : > sub/conftest.c
2302c7c4e3dSmrg    for i in 1 2 3 4 5 6; do
2312c7c4e3dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2328650bb69Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2338650bb69Smrg      # Solaris 8's {/usr,}/bin/sh.
2348650bb69Smrg      touch sub/conftst$i.h
2352c7c4e3dSmrg    done
2362c7c4e3dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2372c7c4e3dSmrg
2388650bb69Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2398650bb69Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2408650bb69Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
2418650bb69Smrg    # versions had trouble with output in subdirs
2428650bb69Smrg    am__obj=sub/conftest.${OBJEXT-o}
2438650bb69Smrg    am__minus_obj="-o $am__obj"
2442c7c4e3dSmrg    case $depmode in
2458650bb69Smrg    gcc)
2468650bb69Smrg      # This depmode causes a compiler race in universal mode.
2478650bb69Smrg      test "$am__universal" = false || continue
2488650bb69Smrg      ;;
2492c7c4e3dSmrg    nosideeffect)
2502c7c4e3dSmrg      # after this tag, mechanisms are not by side-effect, so they'll
2512c7c4e3dSmrg      # only be used when explicitly requested
2522c7c4e3dSmrg      if test "x$enable_dependency_tracking" = xyes; then
2532c7c4e3dSmrg	continue
2542c7c4e3dSmrg      else
2552c7c4e3dSmrg	break
2562c7c4e3dSmrg      fi
2572c7c4e3dSmrg      ;;
2588650bb69Smrg    msvisualcpp | msvcmsys)
2598650bb69Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
2608650bb69Smrg      # not run yet.  These depmodes are late enough in the game, and
2618650bb69Smrg      # so weak that their functioning should not be impacted.
2628650bb69Smrg      am__obj=conftest.${OBJEXT-o}
2638650bb69Smrg      am__minus_obj=
2648650bb69Smrg      ;;
2652c7c4e3dSmrg    none) break ;;
2662c7c4e3dSmrg    esac
2672c7c4e3dSmrg    if depmode=$depmode \
2688650bb69Smrg       source=sub/conftest.c object=$am__obj \
2692c7c4e3dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2708650bb69Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2712c7c4e3dSmrg         >/dev/null 2>conftest.err &&
2728650bb69Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2732c7c4e3dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2748650bb69Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2752c7c4e3dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2762c7c4e3dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2778650bb69Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2788650bb69Smrg      # that says an option was ignored or not supported.
2798650bb69Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2808650bb69Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2818650bb69Smrg      # The diagnosis changed in icc 8.0:
2828650bb69Smrg      #   icc: Command line remark: option '-MP' not supported
2838650bb69Smrg      if (grep 'ignoring option' conftest.err ||
2848650bb69Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2852c7c4e3dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2862c7c4e3dSmrg        break
2872c7c4e3dSmrg      fi
2882c7c4e3dSmrg    fi
2892c7c4e3dSmrg  done
2902c7c4e3dSmrg
2912c7c4e3dSmrg  cd ..
2922c7c4e3dSmrg  rm -rf conftest.dir
2932c7c4e3dSmrgelse
2942c7c4e3dSmrg  am_cv_$1_dependencies_compiler_type=none
2952c7c4e3dSmrgfi
2962c7c4e3dSmrg])
2972c7c4e3dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2982c7c4e3dSmrgAM_CONDITIONAL([am__fastdep$1], [
2992c7c4e3dSmrg  test "x$enable_dependency_tracking" != xno \
3002c7c4e3dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3012c7c4e3dSmrg])
3022c7c4e3dSmrg
3032c7c4e3dSmrg
3042c7c4e3dSmrg# AM_SET_DEPDIR
3052c7c4e3dSmrg# -------------
3062c7c4e3dSmrg# Choose a directory name for dependency files.
3072c7c4e3dSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3082c7c4e3dSmrgAC_DEFUN([AM_SET_DEPDIR],
3092c7c4e3dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3102c7c4e3dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3112c7c4e3dSmrg])
3122c7c4e3dSmrg
3132c7c4e3dSmrg
3142c7c4e3dSmrg# AM_DEP_TRACK
3152c7c4e3dSmrg# ------------
3162c7c4e3dSmrgAC_DEFUN([AM_DEP_TRACK],
3172c7c4e3dSmrg[AC_ARG_ENABLE(dependency-tracking,
3188650bb69Smrg[  --disable-dependency-tracking  speeds up one-time build
3198650bb69Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3202c7c4e3dSmrgif test "x$enable_dependency_tracking" != xno; then
3212c7c4e3dSmrg  am_depcomp="$ac_aux_dir/depcomp"
3222c7c4e3dSmrg  AMDEPBACKSLASH='\'
3232c7c4e3dSmrgfi
3242c7c4e3dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3258650bb69SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3268650bb69Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3272c7c4e3dSmrg])
3282c7c4e3dSmrg
3298650bb69Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3302c7c4e3dSmrg
3318650bb69Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
3328650bb69Smrg# Free Software Foundation, Inc.
3338650bb69Smrg#
3348650bb69Smrg# This file is free software; the Free Software Foundation
3358650bb69Smrg# gives unlimited permission to copy and/or distribute it,
3368650bb69Smrg# with or without modifications, as long as this notice is preserved.
3372c7c4e3dSmrg
3388650bb69Smrg#serial 5
3392c7c4e3dSmrg
3402c7c4e3dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3412c7c4e3dSmrg# ------------------------------
3422c7c4e3dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3438650bb69Smrg[{
3448650bb69Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
3458650bb69Smrg  # are listed without --file.  Let's play safe and only enable the eval
3468650bb69Smrg  # if we detect the quoting.
3478650bb69Smrg  case $CONFIG_FILES in
3488650bb69Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3498650bb69Smrg  *)   set x $CONFIG_FILES ;;
3508650bb69Smrg  esac
3518650bb69Smrg  shift
3528650bb69Smrg  for mf
3538650bb69Smrg  do
3548650bb69Smrg    # Strip MF so we end up with the name of the file.
3558650bb69Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3568650bb69Smrg    # Check whether this is an Automake generated Makefile or not.
3578650bb69Smrg    # We used to match only the files named `Makefile.in', but
3588650bb69Smrg    # some people rename them; so instead we look at the file content.
3598650bb69Smrg    # Grep'ing the first line is not enough: some people post-process
3608650bb69Smrg    # each Makefile.in and add a new line on top of each file to say so.
3618650bb69Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3628650bb69Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3638650bb69Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3648650bb69Smrg      dirpart=`AS_DIRNAME("$mf")`
3658650bb69Smrg    else
3668650bb69Smrg      continue
3678650bb69Smrg    fi
3688650bb69Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3698650bb69Smrg    # from the Makefile without running `make'.
3708650bb69Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3718650bb69Smrg    test -z "$DEPDIR" && continue
3728650bb69Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3738650bb69Smrg    test -z "am__include" && continue
3748650bb69Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3758650bb69Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
3768650bb69Smrg    U=`sed -n 's/^U = //p' < "$mf"`
3778650bb69Smrg    # Find all dependency output files, they are included files with
3788650bb69Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3798650bb69Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3808650bb69Smrg    # expansion.
3818650bb69Smrg    for file in `sed -n "
3828650bb69Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3838650bb69Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3848650bb69Smrg      # Make sure the directory exists.
3858650bb69Smrg      test -f "$dirpart/$file" && continue
3868650bb69Smrg      fdir=`AS_DIRNAME(["$file"])`
3878650bb69Smrg      AS_MKDIR_P([$dirpart/$fdir])
3888650bb69Smrg      # echo "creating $dirpart/$file"
3898650bb69Smrg      echo '# dummy' > "$dirpart/$file"
3908650bb69Smrg    done
3912c7c4e3dSmrg  done
3928650bb69Smrg}
3932c7c4e3dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3942c7c4e3dSmrg
3952c7c4e3dSmrg
3962c7c4e3dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3972c7c4e3dSmrg# -----------------------------
3982c7c4e3dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3992c7c4e3dSmrg#
4002c7c4e3dSmrg# This code is only required when automatic dependency tracking
4012c7c4e3dSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
4022c7c4e3dSmrg# need in order to bootstrap the dependency handling code.
4032c7c4e3dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4042c7c4e3dSmrg[AC_CONFIG_COMMANDS([depfiles],
4052c7c4e3dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4062c7c4e3dSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4072c7c4e3dSmrg])
4082c7c4e3dSmrg
4098650bb69Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4102c7c4e3dSmrg
4118650bb69Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4128650bb69Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4138650bb69Smrg#
4148650bb69Smrg# This file is free software; the Free Software Foundation
4158650bb69Smrg# gives unlimited permission to copy and/or distribute it,
4168650bb69Smrg# with or without modifications, as long as this notice is preserved.
4172c7c4e3dSmrg
4188650bb69Smrg# serial 16
4192c7c4e3dSmrg
4208650bb69Smrg# This macro actually does too much.  Some checks are only needed if
4218650bb69Smrg# your package does certain things.  But this isn't really a big deal.
4228650bb69Smrg
4238650bb69Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4248650bb69Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4258650bb69Smrg# -----------------------------------------------
4268650bb69Smrg# The call with PACKAGE and VERSION arguments is the old style
4278650bb69Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4288650bb69Smrg# and VERSION should now be passed to AC_INIT and removed from
4298650bb69Smrg# the call to AM_INIT_AUTOMAKE.
4308650bb69Smrg# We support both call styles for the transition.  After
4318650bb69Smrg# the next Automake release, Autoconf can make the AC_INIT
4328650bb69Smrg# arguments mandatory, and then we can depend on a new Autoconf
4338650bb69Smrg# release and drop the old call support.
4348650bb69SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4358650bb69Smrg[AC_PREREQ([2.62])dnl
4368650bb69Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4378650bb69Smrgdnl the ones we care about.
4388650bb69Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4398650bb69SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4408650bb69SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4418650bb69Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4428650bb69Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4438650bb69Smrg  # is not polluted with repeated "-I."
4448650bb69Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4458650bb69Smrg  # test to see if srcdir already configured
4468650bb69Smrg  if test -f $srcdir/config.status; then
4478650bb69Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4488650bb69Smrg  fi
4492c7c4e3dSmrgfi
4508650bb69Smrg
4518650bb69Smrg# test whether we have cygpath
4528650bb69Smrgif test -z "$CYGPATH_W"; then
4538650bb69Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4548650bb69Smrg    CYGPATH_W='cygpath -w'
4558650bb69Smrg  else
4568650bb69Smrg    CYGPATH_W=echo
4578650bb69Smrg  fi
4582c7c4e3dSmrgfi
4598650bb69SmrgAC_SUBST([CYGPATH_W])
4602c7c4e3dSmrg
4618650bb69Smrg# Define the identity of the package.
4628650bb69Smrgdnl Distinguish between old-style and new-style calls.
4638650bb69Smrgm4_ifval([$2],
4648650bb69Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4658650bb69Smrg AC_SUBST([PACKAGE], [$1])dnl
4668650bb69Smrg AC_SUBST([VERSION], [$2])],
4678650bb69Smrg[_AM_SET_OPTIONS([$1])dnl
4688650bb69Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4698650bb69Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4708650bb69Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4718650bb69Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4728650bb69Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4732c7c4e3dSmrg
4748650bb69Smrg_AM_IF_OPTION([no-define],,
4758650bb69Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4768650bb69Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4772c7c4e3dSmrg
4788650bb69Smrg# Some tools Automake needs.
4798650bb69SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4808650bb69SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4818650bb69SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4828650bb69SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4838650bb69SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4848650bb69SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4858650bb69SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4868650bb69SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4878650bb69SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4888650bb69SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4898650bb69Smrg# We need awk for the "check" target.  The system "awk" is bad on
4908650bb69Smrg# some platforms.
4918650bb69SmrgAC_REQUIRE([AC_PROG_AWK])dnl
4928650bb69SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
4938650bb69SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
4948650bb69Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4958650bb69Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4968650bb69Smrg			     [_AM_PROG_TAR([v7])])])
4978650bb69Smrg_AM_IF_OPTION([no-dependencies],,
4988650bb69Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
4998650bb69Smrg		  [_AM_DEPENDENCIES(CC)],
5008650bb69Smrg		  [define([AC_PROG_CC],
5018650bb69Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5028650bb69SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5038650bb69Smrg		  [_AM_DEPENDENCIES(CXX)],
5048650bb69Smrg		  [define([AC_PROG_CXX],
5058650bb69Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5068650bb69SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5078650bb69Smrg		  [_AM_DEPENDENCIES(OBJC)],
5088650bb69Smrg		  [define([AC_PROG_OBJC],
5098650bb69Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
5108650bb69Smrg])
5118650bb69Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5128650bb69Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5138650bb69Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5148650bb69Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5158650bb69SmrgAC_CONFIG_COMMANDS_PRE(dnl
5168650bb69Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5178650bb69Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5188650bb69Smrg])
5192c7c4e3dSmrg
5208650bb69Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5218650bb69Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5228650bb69Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5238650bb69Smrgm4_define([_AC_COMPILER_EXEEXT],
5248650bb69Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5252c7c4e3dSmrg
5262c7c4e3dSmrg
5278650bb69Smrg# When config.status generates a header, we must update the stamp-h file.
5288650bb69Smrg# This file resides in the same directory as the config header
5298650bb69Smrg# that is generated.  The stamp files are numbered to have different names.
5308650bb69Smrg
5318650bb69Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5328650bb69Smrg# loop where config.status creates the headers, so we can generate
5338650bb69Smrg# our stamp files there.
5348650bb69SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5358650bb69Smrg[# Compute $1's index in $config_headers.
5368650bb69Smrg_am_arg=$1
5378650bb69Smrg_am_stamp_count=1
5388650bb69Smrgfor _am_header in $config_headers :; do
5398650bb69Smrg  case $_am_header in
5408650bb69Smrg    $_am_arg | $_am_arg:* )
5418650bb69Smrg      break ;;
5428650bb69Smrg    * )
5438650bb69Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5448650bb69Smrg  esac
5458650bb69Smrgdone
5468650bb69Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5472c7c4e3dSmrg
5488650bb69Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
5498650bb69Smrg#
5508650bb69Smrg# This file is free software; the Free Software Foundation
5518650bb69Smrg# gives unlimited permission to copy and/or distribute it,
5528650bb69Smrg# with or without modifications, as long as this notice is preserved.
5532c7c4e3dSmrg
5548650bb69Smrg# AM_PROG_INSTALL_SH
5558650bb69Smrg# ------------------
5568650bb69Smrg# Define $install_sh.
5578650bb69SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5588650bb69Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5598650bb69Smrgif test x"${install_sh}" != xset; then
5608650bb69Smrg  case $am_aux_dir in
5618650bb69Smrg  *\ * | *\	*)
5628650bb69Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5638650bb69Smrg  *)
5648650bb69Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5658650bb69Smrg  esac
5662c7c4e3dSmrgfi
5678650bb69SmrgAC_SUBST(install_sh)])
5682c7c4e3dSmrg
5698650bb69Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5708650bb69Smrg#
5718650bb69Smrg# This file is free software; the Free Software Foundation
5728650bb69Smrg# gives unlimited permission to copy and/or distribute it,
5738650bb69Smrg# with or without modifications, as long as this notice is preserved.
5742c7c4e3dSmrg
5758650bb69Smrg# serial 2
5762c7c4e3dSmrg
5778650bb69Smrg# Check whether the underlying file-system supports filenames
5788650bb69Smrg# with a leading dot.  For instance MS-DOS doesn't.
5798650bb69SmrgAC_DEFUN([AM_SET_LEADING_DOT],
5808650bb69Smrg[rm -rf .tst 2>/dev/null
5818650bb69Smrgmkdir .tst 2>/dev/null
5828650bb69Smrgif test -d .tst; then
5838650bb69Smrg  am__leading_dot=.
5848650bb69Smrgelse
5858650bb69Smrg  am__leading_dot=_
5868650bb69Smrgfi
5878650bb69Smrgrmdir .tst 2>/dev/null
5888650bb69SmrgAC_SUBST([am__leading_dot])])
5892c7c4e3dSmrg
5908650bb69Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
5918650bb69Smrg# From Jim Meyering
5922c7c4e3dSmrg
5938650bb69Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
5948650bb69Smrg# Free Software Foundation, Inc.
5958650bb69Smrg#
5968650bb69Smrg# This file is free software; the Free Software Foundation
5978650bb69Smrg# gives unlimited permission to copy and/or distribute it,
5988650bb69Smrg# with or without modifications, as long as this notice is preserved.
5992c7c4e3dSmrg
6008650bb69Smrg# serial 5
6012c7c4e3dSmrg
6028650bb69Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6038650bb69Smrg# ----------------------------------
6048650bb69Smrg# Control maintainer-specific portions of Makefiles.
6058650bb69Smrg# Default is to disable them, unless `enable' is passed literally.
6068650bb69Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
6078650bb69Smrg# can override the default with the --enable/--disable switch.
6082c7c4e3dSmrgAC_DEFUN([AM_MAINTAINER_MODE],
6098650bb69Smrg[m4_case(m4_default([$1], [disable]),
6108650bb69Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
6118650bb69Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
6128650bb69Smrg       [m4_define([am_maintainer_other], [enable])
6138650bb69Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6148650bb69SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
6158650bb69Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6168650bb69Smrg  AC_ARG_ENABLE([maintainer-mode],
6178650bb69Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
6188650bb69Smrg			  (and sometimes confusing) to the casual installer],
6198650bb69Smrg      [USE_MAINTAINER_MODE=$enableval],
6208650bb69Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6212c7c4e3dSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6228650bb69Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6232c7c4e3dSmrg  MAINT=$MAINTAINER_MODE_TRUE
6248650bb69Smrg  AC_SUBST([MAINT])dnl
6252c7c4e3dSmrg]
6262c7c4e3dSmrg)
6272c7c4e3dSmrg
6282c7c4e3dSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
6292c7c4e3dSmrg
6308650bb69Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6312c7c4e3dSmrg
6328650bb69Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6338650bb69Smrg#
6348650bb69Smrg# This file is free software; the Free Software Foundation
6358650bb69Smrg# gives unlimited permission to copy and/or distribute it,
6368650bb69Smrg# with or without modifications, as long as this notice is preserved.
6372c7c4e3dSmrg
6388650bb69Smrg# serial 4
6392c7c4e3dSmrg
6408650bb69Smrg# AM_MAKE_INCLUDE()
6418650bb69Smrg# -----------------
6428650bb69Smrg# Check to see how make treats includes.
6438650bb69SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6448650bb69Smrg[am_make=${MAKE-make}
6458650bb69Smrgcat > confinc << 'END'
6468650bb69Smrgam__doit:
6478650bb69Smrg	@echo this is the am__doit target
6488650bb69Smrg.PHONY: am__doit
6498650bb69SmrgEND
6508650bb69Smrg# If we don't find an include directive, just comment out the code.
6518650bb69SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6528650bb69Smrgam__include="#"
6538650bb69Smrgam__quote=
6548650bb69Smrg_am_result=none
6558650bb69Smrg# First try GNU make style include.
6568650bb69Smrgecho "include confinc" > confmf
6578650bb69Smrg# Ignore all kinds of additional output from `make'.
6588650bb69Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6598650bb69Smrg*the\ am__doit\ target*)
6608650bb69Smrg  am__include=include
6618650bb69Smrg  am__quote=
6628650bb69Smrg  _am_result=GNU
6638650bb69Smrg  ;;
6648650bb69Smrgesac
6658650bb69Smrg# Now try BSD make style include.
6668650bb69Smrgif test "$am__include" = "#"; then
6678650bb69Smrg   echo '.include "confinc"' > confmf
6688650bb69Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6698650bb69Smrg   *the\ am__doit\ target*)
6708650bb69Smrg     am__include=.include
6718650bb69Smrg     am__quote="\""
6728650bb69Smrg     _am_result=BSD
6738650bb69Smrg     ;;
6748650bb69Smrg   esac
6758650bb69Smrgfi
6768650bb69SmrgAC_SUBST([am__include])
6778650bb69SmrgAC_SUBST([am__quote])
6788650bb69SmrgAC_MSG_RESULT([$_am_result])
6798650bb69Smrgrm -f confinc confmf
6808650bb69Smrg])
6812c7c4e3dSmrg
6828650bb69Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6832c7c4e3dSmrg
6848650bb69Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
6858650bb69Smrg# Free Software Foundation, Inc.
6868650bb69Smrg#
6878650bb69Smrg# This file is free software; the Free Software Foundation
6888650bb69Smrg# gives unlimited permission to copy and/or distribute it,
6898650bb69Smrg# with or without modifications, as long as this notice is preserved.
6902c7c4e3dSmrg
6912c7c4e3dSmrg# serial 6
6922c7c4e3dSmrg
6938650bb69Smrg# AM_MISSING_PROG(NAME, PROGRAM)
6948650bb69Smrg# ------------------------------
6958650bb69SmrgAC_DEFUN([AM_MISSING_PROG],
6968650bb69Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6978650bb69Smrg$1=${$1-"${am_missing_run}$2"}
6988650bb69SmrgAC_SUBST($1)])
6992c7c4e3dSmrg
7002c7c4e3dSmrg
7018650bb69Smrg# AM_MISSING_HAS_RUN
7028650bb69Smrg# ------------------
7038650bb69Smrg# Define MISSING if not defined so far and test if it supports --run.
7048650bb69Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
7058650bb69SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7068650bb69Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7078650bb69SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7088650bb69Smrgif test x"${MISSING+set}" != xset; then
7098650bb69Smrg  case $am_aux_dir in
7108650bb69Smrg  *\ * | *\	*)
7118650bb69Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7128650bb69Smrg  *)
7138650bb69Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7148650bb69Smrg  esac
7152c7c4e3dSmrgfi
7168650bb69Smrg# Use eval to expand $SHELL
7178650bb69Smrgif eval "$MISSING --run true"; then
7188650bb69Smrg  am_missing_run="$MISSING --run "
7198650bb69Smrgelse
7208650bb69Smrg  am_missing_run=
7218650bb69Smrg  AC_MSG_WARN([`missing' script is too old or missing])
7228650bb69Smrgfi
7238650bb69Smrg])
7242c7c4e3dSmrg
7258650bb69Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
7262c7c4e3dSmrg#
7278650bb69Smrg# This file is free software; the Free Software Foundation
7288650bb69Smrg# gives unlimited permission to copy and/or distribute it,
7298650bb69Smrg# with or without modifications, as long as this notice is preserved.
7308650bb69Smrg
7318650bb69Smrg# AM_PROG_MKDIR_P
7328650bb69Smrg# ---------------
7338650bb69Smrg# Check for `mkdir -p'.
7348650bb69SmrgAC_DEFUN([AM_PROG_MKDIR_P],
7358650bb69Smrg[AC_PREREQ([2.60])dnl
7368650bb69SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7378650bb69Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7388650bb69Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
7398650bb69Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7408650bb69Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7418650bb69Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7428650bb69Smrgdnl adjustment using top_builddir (which is defined more often than
7438650bb69Smrgdnl MKDIR_P).
7448650bb69SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7458650bb69Smrgcase $mkdir_p in
7468650bb69Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7478650bb69Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7488650bb69Smrgesac
7498650bb69Smrg])
7508650bb69Smrg
7518650bb69Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7528650bb69Smrg
7538650bb69Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
7542c7c4e3dSmrg#
7558650bb69Smrg# This file is free software; the Free Software Foundation
7568650bb69Smrg# gives unlimited permission to copy and/or distribute it,
7578650bb69Smrg# with or without modifications, as long as this notice is preserved.
7582c7c4e3dSmrg
7598650bb69Smrg# serial 4
7602c7c4e3dSmrg
7618650bb69Smrg# _AM_MANGLE_OPTION(NAME)
7628650bb69Smrg# -----------------------
7638650bb69SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7648650bb69Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7652c7c4e3dSmrg
7668650bb69Smrg# _AM_SET_OPTION(NAME)
7678650bb69Smrg# ------------------------------
7688650bb69Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7698650bb69SmrgAC_DEFUN([_AM_SET_OPTION],
7708650bb69Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
7712c7c4e3dSmrg
7728650bb69Smrg# _AM_SET_OPTIONS(OPTIONS)
7738650bb69Smrg# ----------------------------------
7748650bb69Smrg# OPTIONS is a space-separated list of Automake options.
7758650bb69SmrgAC_DEFUN([_AM_SET_OPTIONS],
7768650bb69Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7772c7c4e3dSmrg
7788650bb69Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7798650bb69Smrg# -------------------------------------------
7808650bb69Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7818650bb69SmrgAC_DEFUN([_AM_IF_OPTION],
7828650bb69Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7838650bb69Smrg
7848650bb69Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7858650bb69Smrg
7868650bb69Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
7878650bb69Smrg# Free Software Foundation, Inc.
7882c7c4e3dSmrg#
7898650bb69Smrg# This file is free software; the Free Software Foundation
7908650bb69Smrg# gives unlimited permission to copy and/or distribute it,
7918650bb69Smrg# with or without modifications, as long as this notice is preserved.
7928650bb69Smrg
7938650bb69Smrg# serial 5
7948650bb69Smrg
7958650bb69Smrg# AM_SANITY_CHECK
7968650bb69Smrg# ---------------
7978650bb69SmrgAC_DEFUN([AM_SANITY_CHECK],
7988650bb69Smrg[AC_MSG_CHECKING([whether build environment is sane])
7998650bb69Smrg# Just in case
8008650bb69Smrgsleep 1
8018650bb69Smrgecho timestamp > conftest.file
8028650bb69Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8038650bb69Smrg# name.  Accept space and tab only in the latter.
8048650bb69Smrgam_lf='
8058650bb69Smrg'
8068650bb69Smrgcase `pwd` in
8078650bb69Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8088650bb69Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8098650bb69Smrgesac
8108650bb69Smrgcase $srcdir in
8118650bb69Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8128650bb69Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8138650bb69Smrgesac
8148650bb69Smrg
8158650bb69Smrg# Do `set' in a subshell so we don't clobber the current shell's
8168650bb69Smrg# arguments.  Must try -L first in case configure is actually a
8178650bb69Smrg# symlink; some systems play weird games with the mod time of symlinks
8188650bb69Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8198650bb69Smrg# directory).
8208650bb69Smrgif (
8218650bb69Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8228650bb69Smrg   if test "$[*]" = "X"; then
8238650bb69Smrg      # -L didn't work.
8248650bb69Smrg      set X `ls -t "$srcdir/configure" conftest.file`
8258650bb69Smrg   fi
8268650bb69Smrg   rm -f conftest.file
8278650bb69Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
8288650bb69Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
8298650bb69Smrg
8308650bb69Smrg      # If neither matched, then we have a broken ls.  This can happen
8318650bb69Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
8328650bb69Smrg      # broken ls alias from the environment.  This has actually
8338650bb69Smrg      # happened.  Such a system could not be considered "sane".
8348650bb69Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8358650bb69Smrgalias in your environment])
8368650bb69Smrg   fi
8378650bb69Smrg
8388650bb69Smrg   test "$[2]" = conftest.file
8398650bb69Smrg   )
8408650bb69Smrgthen
8418650bb69Smrg   # Ok.
8428650bb69Smrg   :
8438650bb69Smrgelse
8448650bb69Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8458650bb69SmrgCheck your system clock])
8468650bb69Smrgfi
8478650bb69SmrgAC_MSG_RESULT(yes)])
8488650bb69Smrg
8498650bb69Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
8502c7c4e3dSmrg#
8518650bb69Smrg# This file is free software; the Free Software Foundation
8528650bb69Smrg# gives unlimited permission to copy and/or distribute it,
8538650bb69Smrg# with or without modifications, as long as this notice is preserved.
8548650bb69Smrg
8558650bb69Smrg# serial 1
8568650bb69Smrg
8578650bb69Smrg# AM_SILENT_RULES([DEFAULT])
8588650bb69Smrg# --------------------------
8598650bb69Smrg# Enable less verbose build rules; with the default set to DEFAULT
8608650bb69Smrg# (`yes' being less verbose, `no' or empty being verbose).
8618650bb69SmrgAC_DEFUN([AM_SILENT_RULES],
8628650bb69Smrg[AC_ARG_ENABLE([silent-rules],
8638650bb69Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8648650bb69Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8658650bb69Smrgcase $enable_silent_rules in
8668650bb69Smrgyes) AM_DEFAULT_VERBOSITY=0;;
8678650bb69Smrgno)  AM_DEFAULT_VERBOSITY=1;;
8688650bb69Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8698650bb69Smrgesac
8708650bb69SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8718650bb69SmrgAM_BACKSLASH='\'
8728650bb69SmrgAC_SUBST([AM_BACKSLASH])dnl
8738650bb69Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8748650bb69Smrg])
8758650bb69Smrg
8768650bb69Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
8772c7c4e3dSmrg#
8788650bb69Smrg# This file is free software; the Free Software Foundation
8798650bb69Smrg# gives unlimited permission to copy and/or distribute it,
8808650bb69Smrg# with or without modifications, as long as this notice is preserved.
8812c7c4e3dSmrg
8828650bb69Smrg# AM_PROG_INSTALL_STRIP
8838650bb69Smrg# ---------------------
8848650bb69Smrg# One issue with vendor `install' (even GNU) is that you can't
8858650bb69Smrg# specify the program used to strip binaries.  This is especially
8868650bb69Smrg# annoying in cross-compiling environments, where the build's strip
8878650bb69Smrg# is unlikely to handle the host's binaries.
8888650bb69Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
8898650bb69Smrg# always use install-sh in `make install-strip', and initialize
8908650bb69Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
8918650bb69SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
8928650bb69Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
8938650bb69Smrg# Installed binaries are usually stripped using `strip' when the user
8948650bb69Smrg# run `make install-strip'.  However `strip' might not be the right
8958650bb69Smrg# tool to use in cross-compilation environments, therefore Automake
8968650bb69Smrg# will honor the `STRIP' environment variable to overrule this program.
8978650bb69Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
8988650bb69Smrgif test "$cross_compiling" != no; then
8998650bb69Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9008650bb69Smrgfi
9018650bb69SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9028650bb69SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
9032c7c4e3dSmrg
9048650bb69Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
9058650bb69Smrg#
9068650bb69Smrg# This file is free software; the Free Software Foundation
9078650bb69Smrg# gives unlimited permission to copy and/or distribute it,
9088650bb69Smrg# with or without modifications, as long as this notice is preserved.
9092c7c4e3dSmrg
9108650bb69Smrg# serial 2
9112c7c4e3dSmrg
9128650bb69Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
9138650bb69Smrg# ---------------------------
9148650bb69Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9158650bb69Smrg# This macro is traced by Automake.
9168650bb69SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9172c7c4e3dSmrg
9188650bb69Smrg# AM_SUBST_NOTMAKE(VARIABLE)
9198650bb69Smrg# ---------------------------
9208650bb69Smrg# Public sister of _AM_SUBST_NOTMAKE.
9218650bb69SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9222c7c4e3dSmrg
9238650bb69Smrg# Check how to create a tarball.                            -*- Autoconf -*-
9242c7c4e3dSmrg
9258650bb69Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
9268650bb69Smrg#
9278650bb69Smrg# This file is free software; the Free Software Foundation
9288650bb69Smrg# gives unlimited permission to copy and/or distribute it,
9298650bb69Smrg# with or without modifications, as long as this notice is preserved.
9302c7c4e3dSmrg
9318650bb69Smrg# serial 2
9322c7c4e3dSmrg
9338650bb69Smrg# _AM_PROG_TAR(FORMAT)
9348650bb69Smrg# --------------------
9358650bb69Smrg# Check how to create a tarball in format FORMAT.
9368650bb69Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
9378650bb69Smrg#
9388650bb69Smrg# Substitute a variable $(am__tar) that is a command
9398650bb69Smrg# writing to stdout a FORMAT-tarball containing the directory
9408650bb69Smrg# $tardir.
9418650bb69Smrg#     tardir=directory && $(am__tar) > result.tar
9428650bb69Smrg#
9438650bb69Smrg# Substitute a variable $(am__untar) that extract such
9448650bb69Smrg# a tarball read from stdin.
9458650bb69Smrg#     $(am__untar) < result.tar
9468650bb69SmrgAC_DEFUN([_AM_PROG_TAR],
9478650bb69Smrg[# Always define AMTAR for backward compatibility.
9488650bb69SmrgAM_MISSING_PROG([AMTAR], [tar])
9498650bb69Smrgm4_if([$1], [v7],
9508650bb69Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
9518650bb69Smrg     [m4_case([$1], [ustar],, [pax],,
9528650bb69Smrg              [m4_fatal([Unknown tar format])])
9538650bb69SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
9548650bb69Smrg# Loop over all known methods to create a tar archive until one works.
9558650bb69Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9568650bb69Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
9578650bb69Smrg# Do not fold the above two line into one, because Tru64 sh and
9588650bb69Smrg# Solaris sh will not grok spaces in the rhs of `-'.
9598650bb69Smrgfor _am_tool in $_am_tools
9608650bb69Smrgdo
9618650bb69Smrg  case $_am_tool in
9628650bb69Smrg  gnutar)
9638650bb69Smrg    for _am_tar in tar gnutar gtar;
9648650bb69Smrg    do
9658650bb69Smrg      AM_RUN_LOG([$_am_tar --version]) && break
9668650bb69Smrg    done
9678650bb69Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
9688650bb69Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
9698650bb69Smrg    am__untar="$_am_tar -xf -"
9708650bb69Smrg    ;;
9718650bb69Smrg  plaintar)
9728650bb69Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
9738650bb69Smrg    # ustar tarball either.
9748650bb69Smrg    (tar --version) >/dev/null 2>&1 && continue
9758650bb69Smrg    am__tar='tar chf - "$$tardir"'
9768650bb69Smrg    am__tar_='tar chf - "$tardir"'
9778650bb69Smrg    am__untar='tar xf -'
9788650bb69Smrg    ;;
9798650bb69Smrg  pax)
9808650bb69Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
9818650bb69Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
9828650bb69Smrg    am__untar='pax -r'
9838650bb69Smrg    ;;
9848650bb69Smrg  cpio)
9858650bb69Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
9868650bb69Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
9878650bb69Smrg    am__untar='cpio -i -H $1 -d'
9888650bb69Smrg    ;;
9898650bb69Smrg  none)
9908650bb69Smrg    am__tar=false
9918650bb69Smrg    am__tar_=false
9928650bb69Smrg    am__untar=false
9938650bb69Smrg    ;;
9948650bb69Smrg  esac
9952c7c4e3dSmrg
9968650bb69Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
9978650bb69Smrg  # and am__untar set.
9988650bb69Smrg  test -n "${am_cv_prog_tar_$1}" && break
9998650bb69Smrg
10008650bb69Smrg  # tar/untar a dummy directory, and stop if the command works
10018650bb69Smrg  rm -rf conftest.dir
10028650bb69Smrg  mkdir conftest.dir
10038650bb69Smrg  echo GrepMe > conftest.dir/file
10048650bb69Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
10058650bb69Smrg  rm -rf conftest.dir
10068650bb69Smrg  if test -s conftest.tar; then
10078650bb69Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
10088650bb69Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
10098650bb69Smrg  fi
10108650bb69Smrgdone
10118650bb69Smrgrm -rf conftest.dir
10122c7c4e3dSmrg
10138650bb69SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
10148650bb69SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
10158650bb69SmrgAC_SUBST([am__tar])
10168650bb69SmrgAC_SUBST([am__untar])
10178650bb69Smrg]) # _AM_PROG_TAR
10188650bb69Smrg
101916d7e2f1Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
102016d7e2f1Smrg# 
102116d7e2f1Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
102216d7e2f1Smrg#
102316d7e2f1Smrg# This program is free software; you can redistribute it and/or modify
102416d7e2f1Smrg# it under the terms of the GNU General Public License as published by
102516d7e2f1Smrg# the Free Software Foundation; either version 2 of the License, or
102616d7e2f1Smrg# (at your option) any later version.
102716d7e2f1Smrg#
102816d7e2f1Smrg# This program is distributed in the hope that it will be useful, but
102916d7e2f1Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
103016d7e2f1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
103116d7e2f1Smrg# General Public License for more details.
103216d7e2f1Smrg#
103316d7e2f1Smrg# You should have received a copy of the GNU General Public License
103416d7e2f1Smrg# along with this program; if not, write to the Free Software
103516d7e2f1Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
103616d7e2f1Smrg#
103716d7e2f1Smrg# As a special exception to the GNU General Public License, if you
103816d7e2f1Smrg# distribute this file as part of a program that contains a
103916d7e2f1Smrg# configuration script generated by Autoconf, you may include it under
104016d7e2f1Smrg# the same distribution terms that you use for the rest of that program.
104116d7e2f1Smrg
104216d7e2f1Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
104316d7e2f1Smrg# ----------------------------------
104416d7e2f1SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
104516d7e2f1Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
104616d7e2f1Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
104716d7e2f1SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
104816d7e2f1Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
104916d7e2f1Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
105016d7e2f1Smrgfi
105116d7e2f1Smrgif test -n "$PKG_CONFIG"; then
105216d7e2f1Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
105316d7e2f1Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
105416d7e2f1Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
105516d7e2f1Smrg		AC_MSG_RESULT([yes])
105616d7e2f1Smrg	else
105716d7e2f1Smrg		AC_MSG_RESULT([no])
105816d7e2f1Smrg		PKG_CONFIG=""
105916d7e2f1Smrg	fi
106016d7e2f1Smrg		
106116d7e2f1Smrgfi[]dnl
106216d7e2f1Smrg])# PKG_PROG_PKG_CONFIG
106316d7e2f1Smrg
106416d7e2f1Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
106516d7e2f1Smrg#
106616d7e2f1Smrg# Check to see whether a particular set of modules exists.  Similar
106716d7e2f1Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
106816d7e2f1Smrg#
106916d7e2f1Smrg#
107016d7e2f1Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
107116d7e2f1Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
107216d7e2f1Smrg# PKG_CHECK_EXISTS manually
107316d7e2f1Smrg# --------------------------------------------------------------
107416d7e2f1SmrgAC_DEFUN([PKG_CHECK_EXISTS],
107516d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
107616d7e2f1Smrgif test -n "$PKG_CONFIG" && \
107716d7e2f1Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
107816d7e2f1Smrg  m4_ifval([$2], [$2], [:])
107916d7e2f1Smrgm4_ifvaln([$3], [else
108016d7e2f1Smrg  $3])dnl
108116d7e2f1Smrgfi])
108216d7e2f1Smrg
108316d7e2f1Smrg
108416d7e2f1Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
108516d7e2f1Smrg# ---------------------------------------------
108616d7e2f1Smrgm4_define([_PKG_CONFIG],
108716d7e2f1Smrg[if test -n "$$1"; then
108816d7e2f1Smrg    pkg_cv_[]$1="$$1"
108916d7e2f1Smrg elif test -n "$PKG_CONFIG"; then
109016d7e2f1Smrg    PKG_CHECK_EXISTS([$3],
109116d7e2f1Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
109216d7e2f1Smrg		     [pkg_failed=yes])
109316d7e2f1Smrg else
109416d7e2f1Smrg    pkg_failed=untried
109516d7e2f1Smrgfi[]dnl
109616d7e2f1Smrg])# _PKG_CONFIG
109716d7e2f1Smrg
109816d7e2f1Smrg# _PKG_SHORT_ERRORS_SUPPORTED
109916d7e2f1Smrg# -----------------------------
110016d7e2f1SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
110116d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110216d7e2f1Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
110316d7e2f1Smrg        _pkg_short_errors_supported=yes
110416d7e2f1Smrgelse
110516d7e2f1Smrg        _pkg_short_errors_supported=no
110616d7e2f1Smrgfi[]dnl
110716d7e2f1Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
110816d7e2f1Smrg
110916d7e2f1Smrg
111016d7e2f1Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
111116d7e2f1Smrg# [ACTION-IF-NOT-FOUND])
111216d7e2f1Smrg#
111316d7e2f1Smrg#
111416d7e2f1Smrg# Note that if there is a possibility the first call to
111516d7e2f1Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
111616d7e2f1Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
111716d7e2f1Smrg#
111816d7e2f1Smrg#
111916d7e2f1Smrg# --------------------------------------------------------------
112016d7e2f1SmrgAC_DEFUN([PKG_CHECK_MODULES],
112116d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
112216d7e2f1SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
112316d7e2f1SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
112416d7e2f1Smrg
112516d7e2f1Smrgpkg_failed=no
112616d7e2f1SmrgAC_MSG_CHECKING([for $1])
112716d7e2f1Smrg
112816d7e2f1Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
112916d7e2f1Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
113016d7e2f1Smrg
113116d7e2f1Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
113216d7e2f1Smrgand $1[]_LIBS to avoid the need to call pkg-config.
113316d7e2f1SmrgSee the pkg-config man page for more details.])
113416d7e2f1Smrg
113516d7e2f1Smrgif test $pkg_failed = yes; then
113616d7e2f1Smrg        _PKG_SHORT_ERRORS_SUPPORTED
113716d7e2f1Smrg        if test $_pkg_short_errors_supported = yes; then
113816d7e2f1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
113916d7e2f1Smrg        else 
114016d7e2f1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
114116d7e2f1Smrg        fi
114216d7e2f1Smrg	# Put the nasty error message in config.log where it belongs
114316d7e2f1Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
114416d7e2f1Smrg
114516d7e2f1Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
114616d7e2f1Smrg[Package requirements ($2) were not met:
114716d7e2f1Smrg
114816d7e2f1Smrg$$1_PKG_ERRORS
114916d7e2f1Smrg
115016d7e2f1SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
115116d7e2f1Smrginstalled software in a non-standard prefix.
115216d7e2f1Smrg
115316d7e2f1Smrg_PKG_TEXT
115416d7e2f1Smrg])],
115516d7e2f1Smrg		[AC_MSG_RESULT([no])
115616d7e2f1Smrg                $4])
115716d7e2f1Smrgelif test $pkg_failed = untried; then
115816d7e2f1Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
115916d7e2f1Smrg[The pkg-config script could not be found or is too old.  Make sure it
116016d7e2f1Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
116116d7e2f1Smrgpath to pkg-config.
116216d7e2f1Smrg
116316d7e2f1Smrg_PKG_TEXT
116416d7e2f1Smrg
116516d7e2f1SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
116616d7e2f1Smrg		[$4])
116716d7e2f1Smrgelse
116816d7e2f1Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
116916d7e2f1Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
117016d7e2f1Smrg        AC_MSG_RESULT([yes])
117116d7e2f1Smrg	ifelse([$3], , :, [$3])
117216d7e2f1Smrgfi[]dnl
117316d7e2f1Smrg])# PKG_CHECK_MODULES
117416d7e2f1Smrg
11758650bb69Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
11762c7c4e3dSmrgdnl
117716d7e2f1Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
11782c7c4e3dSmrgdnl 
11798650bb69Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
118016d7e2f1Smrgdnl copy of this software and associated documentation files (the "Software"),
118116d7e2f1Smrgdnl to deal in the Software without restriction, including without limitation
118216d7e2f1Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
118316d7e2f1Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
118416d7e2f1Smrgdnl Software is furnished to do so, subject to the following conditions:
11858650bb69Smrgdnl
118616d7e2f1Smrgdnl The above copyright notice and this permission notice (including the next
118716d7e2f1Smrgdnl paragraph) shall be included in all copies or substantial portions of the
118816d7e2f1Smrgdnl Software.
11898650bb69Smrgdnl
119016d7e2f1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
119116d7e2f1Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119216d7e2f1Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
119316d7e2f1Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119416d7e2f1Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
119516d7e2f1Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
119616d7e2f1Smrgdnl DEALINGS IN THE SOFTWARE.
11978650bb69Smrg
11988650bb69Smrg# XORG_MACROS_VERSION(required-version)
11998650bb69Smrg# -------------------------------------
12008650bb69Smrg# Minimum version: 1.1.0
12018650bb69Smrg#
12028650bb69Smrg# If you're using a macro added in Version 1.1 or newer, include this in
12038650bb69Smrg# your configure.ac with the minimum required version, such as:
12048650bb69Smrg# XORG_MACROS_VERSION(1.1)
12058650bb69Smrg#
12068650bb69Smrg# To ensure that this macro is defined, also add:
12078650bb69Smrg# m4_ifndef([XORG_MACROS_VERSION],
12088650bb69Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
12098650bb69Smrg#
12108650bb69Smrg#
12118650bb69Smrg# See the "minimum version" comment for each macro you use to see what 
12128650bb69Smrg# version you require.
12138650bb69Smrgm4_defun([XORG_MACROS_VERSION],[
121416d7e2f1Smrgm4_define([vers_have], [1.16.1])
12158650bb69Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
12168650bb69Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
12178650bb69Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
12188650bb69Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
12198650bb69Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
12208650bb69Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
12218650bb69Smrgm4_undefine([vers_have])
12228650bb69Smrgm4_undefine([maj_have])
12238650bb69Smrgm4_undefine([maj_needed])
12248650bb69Smrg]) # XORG_MACROS_VERSION
12252c7c4e3dSmrg
12262c7c4e3dSmrg# XORG_PROG_RAWCPP()
12272c7c4e3dSmrg# ------------------
12288650bb69Smrg# Minimum version: 1.0.0
12298650bb69Smrg#
12302c7c4e3dSmrg# Find cpp program and necessary flags for use in pre-processing text files
12312c7c4e3dSmrg# such as man pages and config files
12322c7c4e3dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
12332c7c4e3dSmrgAC_REQUIRE([AC_PROG_CPP])
12342c7c4e3dSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
12352c7c4e3dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
12362c7c4e3dSmrg
12372c7c4e3dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
12382c7c4e3dSmrg# which is not the best choice for supporting other OS'es, but covers most
12392c7c4e3dSmrg# of the ones we need for now.
12402c7c4e3dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
124116d7e2f1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
12422c7c4e3dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12432c7c4e3dSmrg	AC_MSG_RESULT([no])
12442c7c4e3dSmrgelse
12452c7c4e3dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12462c7c4e3dSmrg		RAWCPPFLAGS=-undef
12472c7c4e3dSmrg		AC_MSG_RESULT([yes])
12488650bb69Smrg	# under Cygwin unix is still defined even with -undef
12498650bb69Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12508650bb69Smrg		RAWCPPFLAGS="-undef -ansi"
12518650bb69Smrg		AC_MSG_RESULT([yes, with -ansi])
12522c7c4e3dSmrg	else
12532c7c4e3dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
12542c7c4e3dSmrg	fi
12552c7c4e3dSmrgfi
12562c7c4e3dSmrgrm -f conftest.$ac_ext
12572c7c4e3dSmrg
12582c7c4e3dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
125916d7e2f1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
12602c7c4e3dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12612c7c4e3dSmrg	AC_MSG_RESULT([no])
12622c7c4e3dSmrgelse
12632c7c4e3dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12642c7c4e3dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
12652c7c4e3dSmrg		AC_MSG_RESULT([yes])
12662c7c4e3dSmrg	else
12672c7c4e3dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
12682c7c4e3dSmrg	fi
12692c7c4e3dSmrgfi
12702c7c4e3dSmrgrm -f conftest.$ac_ext
12712c7c4e3dSmrgAC_SUBST(RAWCPPFLAGS)
12722c7c4e3dSmrg]) # XORG_PROG_RAWCPP
12732c7c4e3dSmrg
12742c7c4e3dSmrg# XORG_MANPAGE_SECTIONS()
12752c7c4e3dSmrg# -----------------------
12768650bb69Smrg# Minimum version: 1.0.0
12778650bb69Smrg#
12782c7c4e3dSmrg# Determine which sections man pages go in for the different man page types
12792c7c4e3dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
12802c7c4e3dSmrg# Not sure if there's any better way than just hardcoding by OS name.
12812c7c4e3dSmrg# Override default settings by setting environment variables
128216d7e2f1Smrg# Added MAN_SUBSTS in version 1.8
128316d7e2f1Smrg# Added AC_PROG_SED in version 1.8
12842c7c4e3dSmrg
12852c7c4e3dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
12862c7c4e3dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
128716d7e2f1SmrgAC_REQUIRE([AC_PROG_SED])
12882c7c4e3dSmrg
12892c7c4e3dSmrgif test x$APP_MAN_SUFFIX = x    ; then
12908650bb69Smrg    APP_MAN_SUFFIX=1
12912c7c4e3dSmrgfi
12922c7c4e3dSmrgif test x$APP_MAN_DIR = x    ; then
12938650bb69Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
12942c7c4e3dSmrgfi
12952c7c4e3dSmrg
12962c7c4e3dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
12978650bb69Smrg    LIB_MAN_SUFFIX=3
12982c7c4e3dSmrgfi
12992c7c4e3dSmrgif test x$LIB_MAN_DIR = x    ; then
13008650bb69Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13012c7c4e3dSmrgfi
13022c7c4e3dSmrg
13032c7c4e3dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
13042c7c4e3dSmrg    case $host_os in
13052c7c4e3dSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
13062c7c4e3dSmrg	*)		FILE_MAN_SUFFIX=5  ;;
13072c7c4e3dSmrg    esac
13082c7c4e3dSmrgfi
13092c7c4e3dSmrgif test x$FILE_MAN_DIR = x    ; then
13108650bb69Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
13112c7c4e3dSmrgfi
13122c7c4e3dSmrg
13132c7c4e3dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
13142c7c4e3dSmrg    case $host_os in
13152c7c4e3dSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
13162c7c4e3dSmrg	*)		MISC_MAN_SUFFIX=7  ;;
13172c7c4e3dSmrg    esac
13182c7c4e3dSmrgfi
13192c7c4e3dSmrgif test x$MISC_MAN_DIR = x    ; then
13208650bb69Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
13212c7c4e3dSmrgfi
13222c7c4e3dSmrg
13232c7c4e3dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
13242c7c4e3dSmrg    case $host_os in
13252c7c4e3dSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
13262c7c4e3dSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
13272c7c4e3dSmrg    esac
13282c7c4e3dSmrgfi
13292c7c4e3dSmrgif test x$DRIVER_MAN_DIR = x    ; then
13308650bb69Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13312c7c4e3dSmrgfi
13322c7c4e3dSmrg
13332c7c4e3dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
13342c7c4e3dSmrg    case $host_os in
13352c7c4e3dSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
13362c7c4e3dSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
13372c7c4e3dSmrg    esac
13382c7c4e3dSmrgfi
13392c7c4e3dSmrgif test x$ADMIN_MAN_DIR = x    ; then
13402c7c4e3dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13412c7c4e3dSmrgfi
13422c7c4e3dSmrg
13432c7c4e3dSmrg
13442c7c4e3dSmrgAC_SUBST([APP_MAN_SUFFIX])
13452c7c4e3dSmrgAC_SUBST([LIB_MAN_SUFFIX])
13462c7c4e3dSmrgAC_SUBST([FILE_MAN_SUFFIX])
13472c7c4e3dSmrgAC_SUBST([MISC_MAN_SUFFIX])
13482c7c4e3dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
13492c7c4e3dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
13502c7c4e3dSmrgAC_SUBST([APP_MAN_DIR])
13512c7c4e3dSmrgAC_SUBST([LIB_MAN_DIR])
13522c7c4e3dSmrgAC_SUBST([FILE_MAN_DIR])
13532c7c4e3dSmrgAC_SUBST([MISC_MAN_DIR])
13542c7c4e3dSmrgAC_SUBST([DRIVER_MAN_DIR])
13552c7c4e3dSmrgAC_SUBST([ADMIN_MAN_DIR])
135616d7e2f1Smrg
135716d7e2f1SmrgXORG_MAN_PAGE="X Version 11"
135816d7e2f1SmrgAC_SUBST([XORG_MAN_PAGE])
135916d7e2f1SmrgMAN_SUBSTS="\
136016d7e2f1Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136116d7e2f1Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136216d7e2f1Smrg	-e 's|__xservername__|Xorg|g' \
136316d7e2f1Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
136416d7e2f1Smrg	-e 's|__projectroot__|\$(prefix)|g' \
136516d7e2f1Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
136616d7e2f1Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
136716d7e2f1Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
136816d7e2f1Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
136916d7e2f1Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
137016d7e2f1Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
137116d7e2f1Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
137216d7e2f1SmrgAC_SUBST([MAN_SUBSTS])
137316d7e2f1Smrg
13742c7c4e3dSmrg]) # XORG_MANPAGE_SECTIONS
13752c7c4e3dSmrg
137616d7e2f1Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
137716d7e2f1Smrg# ------------------------
137816d7e2f1Smrg# Minimum version: 1.7.0
137916d7e2f1Smrg#
138016d7e2f1Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
138116d7e2f1Smrg# provided by xorg-sgml-doctools, if installed.
138216d7e2f1SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
138316d7e2f1SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
138416d7e2f1SmrgXORG_SGML_PATH=
138516d7e2f1SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
138616d7e2f1Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
138716d7e2f1Smrg    [m4_ifval([$1],[:],
138816d7e2f1Smrg        [if test x"$cross_compiling" != x"yes" ; then
138916d7e2f1Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
139016d7e2f1Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
139116d7e2f1Smrg         fi])
139216d7e2f1Smrg    ])
139316d7e2f1Smrg
139416d7e2f1Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
139516d7e2f1Smrg# the path and the name of the doc stylesheet
139616d7e2f1Smrgif test "x$XORG_SGML_PATH" != "x" ; then
139716d7e2f1Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
139816d7e2f1Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
139916d7e2f1Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
140016d7e2f1Smrgelse
140116d7e2f1Smrg   AC_MSG_RESULT([no])
140216d7e2f1Smrgfi
140316d7e2f1Smrg
140416d7e2f1SmrgAC_SUBST(XORG_SGML_PATH)
140516d7e2f1SmrgAC_SUBST(STYLESHEET_SRCDIR)
140616d7e2f1SmrgAC_SUBST(XSL_STYLESHEET)
140716d7e2f1SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
140816d7e2f1Smrg]) # XORG_CHECK_SGML_DOCTOOLS
140916d7e2f1Smrg
14102c7c4e3dSmrg# XORG_CHECK_LINUXDOC
14112c7c4e3dSmrg# -------------------
14128650bb69Smrg# Minimum version: 1.0.0
14138650bb69Smrg#
14142c7c4e3dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
14152c7c4e3dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
14162c7c4e3dSmrg# Whether or not the necessary tools and files are found can be checked
14172c7c4e3dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
14182c7c4e3dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
141916d7e2f1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
142016d7e2f1SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
14212c7c4e3dSmrg
14222c7c4e3dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
14232c7c4e3dSmrg
142416d7e2f1SmrgAC_MSG_CHECKING([whether to build documentation])
14252c7c4e3dSmrg
142616d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
14272c7c4e3dSmrg   BUILDDOC=yes
14282c7c4e3dSmrgelse
14292c7c4e3dSmrg   BUILDDOC=no
14302c7c4e3dSmrgfi
14312c7c4e3dSmrg
14322c7c4e3dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
14332c7c4e3dSmrg
14342c7c4e3dSmrgAC_MSG_RESULT([$BUILDDOC])
14352c7c4e3dSmrg
143616d7e2f1SmrgAC_MSG_CHECKING([whether to build pdf documentation])
14372c7c4e3dSmrg
143816d7e2f1Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
14392c7c4e3dSmrg   BUILDPDFDOC=yes
14402c7c4e3dSmrgelse
14412c7c4e3dSmrg   BUILDPDFDOC=no
14422c7c4e3dSmrgfi
14432c7c4e3dSmrg
14442c7c4e3dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14452c7c4e3dSmrg
14462c7c4e3dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
14472c7c4e3dSmrg
144816d7e2f1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
14498650bb69SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
14502c7c4e3dSmrgMAKE_PDF="$PS2PDF"
14518650bb69SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
14522c7c4e3dSmrg
14532c7c4e3dSmrgAC_SUBST(MAKE_TEXT)
14542c7c4e3dSmrgAC_SUBST(MAKE_PS)
14552c7c4e3dSmrgAC_SUBST(MAKE_PDF)
14562c7c4e3dSmrgAC_SUBST(MAKE_HTML)
14572c7c4e3dSmrg]) # XORG_CHECK_LINUXDOC
14582c7c4e3dSmrg
14598650bb69Smrg# XORG_CHECK_DOCBOOK
14608650bb69Smrg# -------------------
14618650bb69Smrg# Minimum version: 1.0.0
14628650bb69Smrg#
14638650bb69Smrg# Checks for the ability to build output formats from SGML DocBook source.
14648650bb69Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
14658650bb69Smrg# indicates whether the necessary tools and files are found and, if set,
14668650bb69Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
14678650bb69SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
146816d7e2f1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
146916d7e2f1Smrg
14708650bb69SmrgBUILDTXTDOC=no
14718650bb69SmrgBUILDPDFDOC=no
14728650bb69SmrgBUILDPSDOC=no
14738650bb69SmrgBUILDHTMLDOC=no
14748650bb69Smrg
14758650bb69SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
14768650bb69SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
14778650bb69SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
14788650bb69SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
14798650bb69Smrg
148016d7e2f1SmrgAC_MSG_CHECKING([whether to build text documentation])
148116d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
14828650bb69Smrg   test x$BUILD_TXTDOC != xno; then
14838650bb69Smrg	BUILDTXTDOC=yes
14848650bb69Smrgfi
14858650bb69SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
14868650bb69SmrgAC_MSG_RESULT([$BUILDTXTDOC])
14878650bb69Smrg
148816d7e2f1SmrgAC_MSG_CHECKING([whether to build PDF documentation])
148916d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
14908650bb69Smrg   test x$BUILD_PDFDOC != xno; then
14918650bb69Smrg	BUILDPDFDOC=yes
14928650bb69Smrgfi
14938650bb69SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14948650bb69SmrgAC_MSG_RESULT([$BUILDPDFDOC])
14958650bb69Smrg
149616d7e2f1SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
149716d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
14988650bb69Smrg   test x$BUILD_PSDOC != xno; then
14998650bb69Smrg	BUILDPSDOC=yes
15008650bb69Smrgfi
15018650bb69SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
15028650bb69SmrgAC_MSG_RESULT([$BUILDPSDOC])
15038650bb69Smrg
150416d7e2f1SmrgAC_MSG_CHECKING([whether to build HTML documentation])
150516d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
15068650bb69Smrg   test x$BUILD_HTMLDOC != xno; then
15078650bb69Smrg	BUILDHTMLDOC=yes
15088650bb69Smrgfi
15098650bb69SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
15108650bb69SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
15118650bb69Smrg
15128650bb69SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
15138650bb69SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
15148650bb69SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
15158650bb69SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
15168650bb69Smrg
15178650bb69SmrgAC_SUBST(MAKE_TEXT)
15188650bb69SmrgAC_SUBST(MAKE_PS)
15198650bb69SmrgAC_SUBST(MAKE_PDF)
15208650bb69SmrgAC_SUBST(MAKE_HTML)
15218650bb69Smrg]) # XORG_CHECK_DOCBOOK
15228650bb69Smrg
152316d7e2f1Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
152416d7e2f1Smrg# ----------------
152516d7e2f1Smrg# Minimum version: 1.5.0
152616d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
15278650bb69Smrg#
152816d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
152916d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
153016d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
153116d7e2f1Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
153216d7e2f1Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
153316d7e2f1Smrg# --with-xmlto assumes 'auto'.
153416d7e2f1Smrg#
153516d7e2f1Smrg# Interface to module:
153616d7e2f1Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
153716d7e2f1Smrg# XMLTO:	returns the path of the xmlto program found
153816d7e2f1Smrg#		returns the path set by the user in the environment
153916d7e2f1Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
154016d7e2f1Smrg#		'no' user instructs the module not to use xmlto
154116d7e2f1Smrg#
154216d7e2f1Smrg# Added in version 1.10.0
154316d7e2f1Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
154416d7e2f1Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
154516d7e2f1Smrg#
154616d7e2f1Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
154716d7e2f1Smrg#
154816d7e2f1SmrgAC_DEFUN([XORG_WITH_XMLTO],[
154916d7e2f1SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
155016d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
155116d7e2f1SmrgAC_ARG_WITH(xmlto,
155216d7e2f1Smrg	AS_HELP_STRING([--with-xmlto],
155316d7e2f1Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
155416d7e2f1Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
155516d7e2f1Smrgm4_undefine([_defopt])
155616d7e2f1Smrg
155716d7e2f1Smrgif test "x$use_xmlto" = x"auto"; then
155816d7e2f1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
155916d7e2f1Smrg   if test "x$XMLTO" = "x"; then
156016d7e2f1Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
156116d7e2f1Smrg	have_xmlto=no
156216d7e2f1Smrg   else
156316d7e2f1Smrg        have_xmlto=yes
156416d7e2f1Smrg   fi
156516d7e2f1Smrgelif test "x$use_xmlto" = x"yes" ; then
156616d7e2f1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
156716d7e2f1Smrg   if test "x$XMLTO" = "x"; then
156816d7e2f1Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
156916d7e2f1Smrg   fi
157016d7e2f1Smrg   have_xmlto=yes
157116d7e2f1Smrgelif test "x$use_xmlto" = x"no" ; then
157216d7e2f1Smrg   if test "x$XMLTO" != "x"; then
157316d7e2f1Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
157416d7e2f1Smrg   fi
157516d7e2f1Smrg   have_xmlto=no
157616d7e2f1Smrgelse
157716d7e2f1Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
15782c7c4e3dSmrgfi
15792c7c4e3dSmrg
158016d7e2f1Smrg# Test for a minimum version of xmlto, if provided.
158116d7e2f1Smrgm4_ifval([$1],
158216d7e2f1Smrg[if test "$have_xmlto" = yes; then
158316d7e2f1Smrg    # scrape the xmlto version
158416d7e2f1Smrg    AC_MSG_CHECKING([the xmlto version])
158516d7e2f1Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
158616d7e2f1Smrg    AC_MSG_RESULT([$xmlto_version])
158716d7e2f1Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
158816d7e2f1Smrg        [if test "x$use_xmlto" = xauto; then
158916d7e2f1Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
159016d7e2f1Smrg            have_xmlto=no
159116d7e2f1Smrg        else
159216d7e2f1Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
159316d7e2f1Smrg        fi])
159416d7e2f1Smrgfi])
159516d7e2f1Smrg
159616d7e2f1Smrg# Test for the ability of xmlto to generate a text target
159716d7e2f1Smrghave_xmlto_text=no
159816d7e2f1Smrgcat > conftest.xml << "EOF"
159916d7e2f1SmrgEOF
160016d7e2f1SmrgAS_IF([test "$have_xmlto" = yes],
160116d7e2f1Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
160216d7e2f1Smrg             [have_xmlto_text=yes],
160316d7e2f1Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
160416d7e2f1Smrgrm -f conftest.xml
160516d7e2f1SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
160616d7e2f1SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
160716d7e2f1Smrg]) # XORG_WITH_XMLTO
160816d7e2f1Smrg
160916d7e2f1Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
161016d7e2f1Smrg# --------------------------------------------
161116d7e2f1Smrg# Minimum version: 1.12.0
161216d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.12.0
161316d7e2f1Smrg#
161416d7e2f1Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
161516d7e2f1Smrg# XML-based language used for the transformation of XML documents.
161616d7e2f1Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
161716d7e2f1Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
161816d7e2f1Smrg# The XSLT processor is often used as a standalone tool for transformations.
161916d7e2f1Smrg# It should not be assumed that this tool is used only to work with documnetation.
162016d7e2f1Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
162116d7e2f1Smrg#
162216d7e2f1Smrg# Interface to module:
162316d7e2f1Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
162416d7e2f1Smrg# XSLTPROC:	 returns the path of the xsltproc program found
162516d7e2f1Smrg#		 returns the path set by the user in the environment
162616d7e2f1Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
162716d7e2f1Smrg#		  'no' user instructs the module not to use xsltproc
162816d7e2f1Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
162916d7e2f1Smrg#
163016d7e2f1Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
163116d7e2f1Smrg#
163216d7e2f1SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
163316d7e2f1SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
163416d7e2f1Smrg# Preserves the interface, should it be implemented later
163516d7e2f1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
163616d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
163716d7e2f1SmrgAC_ARG_WITH(xsltproc,
163816d7e2f1Smrg	AS_HELP_STRING([--with-xsltproc],
163916d7e2f1Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
164016d7e2f1Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
164116d7e2f1Smrgm4_undefine([_defopt])
164216d7e2f1Smrg
164316d7e2f1Smrgif test "x$use_xsltproc" = x"auto"; then
164416d7e2f1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
164516d7e2f1Smrg   if test "x$XSLTPROC" = "x"; then
164616d7e2f1Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
164716d7e2f1Smrg	have_xsltproc=no
164816d7e2f1Smrg   else
164916d7e2f1Smrg        have_xsltproc=yes
165016d7e2f1Smrg   fi
165116d7e2f1Smrgelif test "x$use_xsltproc" = x"yes" ; then
165216d7e2f1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
165316d7e2f1Smrg   if test "x$XSLTPROC" = "x"; then
165416d7e2f1Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
165516d7e2f1Smrg   fi
165616d7e2f1Smrg   have_xsltproc=yes
165716d7e2f1Smrgelif test "x$use_xsltproc" = x"no" ; then
165816d7e2f1Smrg   if test "x$XSLTPROC" != "x"; then
165916d7e2f1Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
166016d7e2f1Smrg   fi
166116d7e2f1Smrg   have_xsltproc=no
16622c7c4e3dSmrgelse
166316d7e2f1Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
16642c7c4e3dSmrgfi
16652c7c4e3dSmrg
166616d7e2f1SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
166716d7e2f1Smrg]) # XORG_WITH_XSLTPROC
16682c7c4e3dSmrg
166916d7e2f1Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
167016d7e2f1Smrg# ----------------------------------------
167116d7e2f1Smrg# Minimum version: 1.15.0
16728650bb69Smrg#
167316d7e2f1Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
167416d7e2f1Smrg# scanning arbitrary text files, extracting information from those text files,
167516d7e2f1Smrg# and printing reports based on that information.
16768650bb69Smrg#
167716d7e2f1Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
167816d7e2f1Smrg#
167916d7e2f1Smrg# Interface to module:
168016d7e2f1Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
168116d7e2f1Smrg# PERL:	     returns the path of the perl program found
168216d7e2f1Smrg#	     returns the path set by the user in the environment
168316d7e2f1Smrg# --with-perl: 'yes' user instructs the module to use perl
168416d7e2f1Smrg#	       'no' user instructs the module not to use perl
168516d7e2f1Smrg# have_perl: returns yes if perl found in PATH or no
168616d7e2f1Smrg#
168716d7e2f1Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
168816d7e2f1Smrg#
168916d7e2f1SmrgAC_DEFUN([XORG_WITH_PERL],[
169016d7e2f1SmrgAC_ARG_VAR([PERL], [Path to perl command])
169116d7e2f1Smrg# Preserves the interface, should it be implemented later
169216d7e2f1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
169316d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
169416d7e2f1SmrgAC_ARG_WITH(perl,
169516d7e2f1Smrg	AS_HELP_STRING([--with-perl],
169616d7e2f1Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
169716d7e2f1Smrg	   [use_perl=$withval], [use_perl=]_defopt)
169816d7e2f1Smrgm4_undefine([_defopt])
169916d7e2f1Smrg
170016d7e2f1Smrgif test "x$use_perl" = x"auto"; then
170116d7e2f1Smrg   AC_PATH_PROG([PERL], [perl])
170216d7e2f1Smrg   if test "x$PERL" = "x"; then
170316d7e2f1Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
170416d7e2f1Smrg	have_perl=no
170516d7e2f1Smrg   else
170616d7e2f1Smrg        have_perl=yes
170716d7e2f1Smrg   fi
170816d7e2f1Smrgelif test "x$use_perl" = x"yes" ; then
170916d7e2f1Smrg   AC_PATH_PROG([PERL], [perl])
171016d7e2f1Smrg   if test "x$PERL" = "x"; then
171116d7e2f1Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
171216d7e2f1Smrg   fi
171316d7e2f1Smrg   have_perl=yes
171416d7e2f1Smrgelif test "x$use_perl" = x"no" ; then
171516d7e2f1Smrg   if test "x$PERL" != "x"; then
171616d7e2f1Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
171716d7e2f1Smrg   fi
171816d7e2f1Smrg   have_perl=no
17198650bb69Smrgelse
172016d7e2f1Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
17218650bb69Smrgfi
17228650bb69Smrg
172316d7e2f1SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
172416d7e2f1Smrg]) # XORG_WITH_PERL
17258650bb69Smrg
172616d7e2f1Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
172716d7e2f1Smrg# ----------------
172816d7e2f1Smrg# Minimum version: 1.5.0
172916d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17308650bb69Smrg#
173116d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
173216d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
173316d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
173416d7e2f1Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
173516d7e2f1Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
173616d7e2f1Smrg# --with-asciidoc assumes 'auto'.
17378650bb69Smrg#
173816d7e2f1Smrg# Interface to module:
173916d7e2f1Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
174016d7e2f1Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
174116d7e2f1Smrg#		 returns the path set by the user in the environment
174216d7e2f1Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
174316d7e2f1Smrg#		  'no' user instructs the module not to use asciidoc
174416d7e2f1Smrg#
174516d7e2f1Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
174616d7e2f1Smrg#
174716d7e2f1SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
174816d7e2f1SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
174916d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
175016d7e2f1SmrgAC_ARG_WITH(asciidoc,
175116d7e2f1Smrg	AS_HELP_STRING([--with-asciidoc],
175216d7e2f1Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
175316d7e2f1Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
175416d7e2f1Smrgm4_undefine([_defopt])
175516d7e2f1Smrg
175616d7e2f1Smrgif test "x$use_asciidoc" = x"auto"; then
175716d7e2f1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
175816d7e2f1Smrg   if test "x$ASCIIDOC" = "x"; then
175916d7e2f1Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
176016d7e2f1Smrg	have_asciidoc=no
176116d7e2f1Smrg   else
176216d7e2f1Smrg        have_asciidoc=yes
176316d7e2f1Smrg   fi
176416d7e2f1Smrgelif test "x$use_asciidoc" = x"yes" ; then
176516d7e2f1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
176616d7e2f1Smrg   if test "x$ASCIIDOC" = "x"; then
176716d7e2f1Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
176816d7e2f1Smrg   fi
176916d7e2f1Smrg   have_asciidoc=yes
177016d7e2f1Smrgelif test "x$use_asciidoc" = x"no" ; then
177116d7e2f1Smrg   if test "x$ASCIIDOC" != "x"; then
177216d7e2f1Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
177316d7e2f1Smrg   fi
177416d7e2f1Smrg   have_asciidoc=no
177516d7e2f1Smrgelse
177616d7e2f1Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
177716d7e2f1Smrgfi
177816d7e2f1Smrgm4_ifval([$1],
177916d7e2f1Smrg[if test "$have_asciidoc" = yes; then
178016d7e2f1Smrg    # scrape the asciidoc version
178116d7e2f1Smrg    AC_MSG_CHECKING([the asciidoc version])
178216d7e2f1Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
178316d7e2f1Smrg    AC_MSG_RESULT([$asciidoc_version])
178416d7e2f1Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
178516d7e2f1Smrg        [if test "x$use_asciidoc" = xauto; then
178616d7e2f1Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
178716d7e2f1Smrg            have_asciidoc=no
178816d7e2f1Smrg        else
178916d7e2f1Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
179016d7e2f1Smrg        fi])
179116d7e2f1Smrgfi])
179216d7e2f1SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
179316d7e2f1Smrg]) # XORG_WITH_ASCIIDOC
179416d7e2f1Smrg
179516d7e2f1Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
179616d7e2f1Smrg# --------------------------------
179716d7e2f1Smrg# Minimum version: 1.5.0
179816d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179916d7e2f1Smrg#
180016d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
180116d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
180216d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
180316d7e2f1Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
180416d7e2f1Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
180516d7e2f1Smrg# --with-doxygen assumes 'auto'.
180616d7e2f1Smrg#
180716d7e2f1Smrg# Interface to module:
180816d7e2f1Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
180916d7e2f1Smrg# DOXYGEN:	 returns the path of the doxygen program found
181016d7e2f1Smrg#		 returns the path set by the user in the environment
181116d7e2f1Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
181216d7e2f1Smrg#		  'no' user instructs the module not to use doxygen
181316d7e2f1Smrg#
181416d7e2f1Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
181516d7e2f1Smrg#
181616d7e2f1SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
181716d7e2f1SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
181816d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
181916d7e2f1SmrgAC_ARG_WITH(doxygen,
182016d7e2f1Smrg	AS_HELP_STRING([--with-doxygen],
182116d7e2f1Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
182216d7e2f1Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
182316d7e2f1Smrgm4_undefine([_defopt])
182416d7e2f1Smrg
182516d7e2f1Smrgif test "x$use_doxygen" = x"auto"; then
182616d7e2f1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
182716d7e2f1Smrg   if test "x$DOXYGEN" = "x"; then
182816d7e2f1Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
182916d7e2f1Smrg	have_doxygen=no
183016d7e2f1Smrg   else
183116d7e2f1Smrg        have_doxygen=yes
183216d7e2f1Smrg   fi
183316d7e2f1Smrgelif test "x$use_doxygen" = x"yes" ; then
183416d7e2f1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
183516d7e2f1Smrg   if test "x$DOXYGEN" = "x"; then
183616d7e2f1Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
183716d7e2f1Smrg   fi
183816d7e2f1Smrg   have_doxygen=yes
183916d7e2f1Smrgelif test "x$use_doxygen" = x"no" ; then
184016d7e2f1Smrg   if test "x$DOXYGEN" != "x"; then
184116d7e2f1Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
184216d7e2f1Smrg   fi
184316d7e2f1Smrg   have_doxygen=no
184416d7e2f1Smrgelse
184516d7e2f1Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
184616d7e2f1Smrgfi
184716d7e2f1Smrgm4_ifval([$1],
184816d7e2f1Smrg[if test "$have_doxygen" = yes; then
184916d7e2f1Smrg    # scrape the doxygen version
185016d7e2f1Smrg    AC_MSG_CHECKING([the doxygen version])
185116d7e2f1Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
185216d7e2f1Smrg    AC_MSG_RESULT([$doxygen_version])
185316d7e2f1Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
185416d7e2f1Smrg        [if test "x$use_doxygen" = xauto; then
185516d7e2f1Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
185616d7e2f1Smrg            have_doxygen=no
185716d7e2f1Smrg        else
185816d7e2f1Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
185916d7e2f1Smrg        fi])
186016d7e2f1Smrgfi])
186116d7e2f1SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
186216d7e2f1Smrg]) # XORG_WITH_DOXYGEN
186316d7e2f1Smrg
186416d7e2f1Smrg# XORG_WITH_GROFF([DEFAULT])
186516d7e2f1Smrg# ----------------
186616d7e2f1Smrg# Minimum version: 1.6.0
186716d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
186816d7e2f1Smrg#
186916d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
187016d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
187116d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
187216d7e2f1Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
187316d7e2f1Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
187416d7e2f1Smrg# --with-groff assumes 'auto'.
187516d7e2f1Smrg#
187616d7e2f1Smrg# Interface to module:
187716d7e2f1Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
187816d7e2f1Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
187916d7e2f1Smrg# HAVE_GROFF_MS: the -ms macros package
188016d7e2f1Smrg# GROFF:	 returns the path of the groff program found
188116d7e2f1Smrg#		 returns the path set by the user in the environment
188216d7e2f1Smrg# --with-groff:	 'yes' user instructs the module to use groff
188316d7e2f1Smrg#		 'no' user instructs the module not to use groff
188416d7e2f1Smrg#
188516d7e2f1Smrg# Added in version 1.9.0:
188616d7e2f1Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
188716d7e2f1Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
188816d7e2f1Smrg#		   psselect from the psutils package.
188916d7e2f1Smrg#		   the ghostcript package. Refer to the grohtml man pages
189016d7e2f1Smrg#
189116d7e2f1Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
189216d7e2f1Smrg#
189316d7e2f1Smrg# OS and distros often splits groff in a basic and full package, the former
189416d7e2f1Smrg# having the groff program and the later having devices, fonts and macros
189516d7e2f1Smrg# Checking for the groff executable is not enough.
189616d7e2f1Smrg#
189716d7e2f1Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
189816d7e2f1Smrg# unset HAVE_GROFF or GROFF env variables.
189916d7e2f1Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
190016d7e2f1Smrg#
190116d7e2f1SmrgAC_DEFUN([XORG_WITH_GROFF],[
190216d7e2f1SmrgAC_ARG_VAR([GROFF], [Path to groff command])
190316d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
190416d7e2f1SmrgAC_ARG_WITH(groff,
190516d7e2f1Smrg	AS_HELP_STRING([--with-groff],
190616d7e2f1Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
190716d7e2f1Smrg	   [use_groff=$withval], [use_groff=]_defopt)
190816d7e2f1Smrgm4_undefine([_defopt])
190916d7e2f1Smrg
191016d7e2f1Smrgif test "x$use_groff" = x"auto"; then
191116d7e2f1Smrg   AC_PATH_PROG([GROFF], [groff])
191216d7e2f1Smrg   if test "x$GROFF" = "x"; then
191316d7e2f1Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
191416d7e2f1Smrg	have_groff=no
191516d7e2f1Smrg   else
191616d7e2f1Smrg        have_groff=yes
191716d7e2f1Smrg   fi
191816d7e2f1Smrgelif test "x$use_groff" = x"yes" ; then
191916d7e2f1Smrg   AC_PATH_PROG([GROFF], [groff])
192016d7e2f1Smrg   if test "x$GROFF" = "x"; then
192116d7e2f1Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
192216d7e2f1Smrg   fi
192316d7e2f1Smrg   have_groff=yes
192416d7e2f1Smrgelif test "x$use_groff" = x"no" ; then
192516d7e2f1Smrg   if test "x$GROFF" != "x"; then
192616d7e2f1Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
192716d7e2f1Smrg   fi
192816d7e2f1Smrg   have_groff=no
192916d7e2f1Smrgelse
193016d7e2f1Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
193116d7e2f1Smrgfi
193216d7e2f1Smrg
193316d7e2f1Smrg# We have groff, test for the presence of the macro packages
193416d7e2f1Smrgif test "x$have_groff" = x"yes"; then
193516d7e2f1Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
193616d7e2f1Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
193716d7e2f1Smrg        groff_ms_works=yes
193816d7e2f1Smrg    else
193916d7e2f1Smrg        groff_ms_works=no
194016d7e2f1Smrg    fi
194116d7e2f1Smrg    AC_MSG_RESULT([$groff_ms_works])
194216d7e2f1Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
194316d7e2f1Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
194416d7e2f1Smrg        groff_mm_works=yes
194516d7e2f1Smrg    else
194616d7e2f1Smrg        groff_mm_works=no
194716d7e2f1Smrg    fi
194816d7e2f1Smrg    AC_MSG_RESULT([$groff_mm_works])
194916d7e2f1Smrgfi
195016d7e2f1Smrg
195116d7e2f1Smrg# We have groff, test for HTML dependencies, one command per package
195216d7e2f1Smrgif test "x$have_groff" = x"yes"; then
195316d7e2f1Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
195416d7e2f1Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
195516d7e2f1Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
195616d7e2f1Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
195716d7e2f1Smrg      have_groff_html=yes
195816d7e2f1Smrg   else
195916d7e2f1Smrg      have_groff_html=no
196016d7e2f1Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
196116d7e2f1Smrg   fi
196216d7e2f1Smrgfi
196316d7e2f1Smrg
196416d7e2f1Smrg# Set Automake conditionals for Makefiles
196516d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
196616d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
196716d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
196816d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
196916d7e2f1Smrg]) # XORG_WITH_GROFF
197016d7e2f1Smrg
197116d7e2f1Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
197216d7e2f1Smrg# ---------------------------------------
197316d7e2f1Smrg# Minimum version: 1.6.0
197416d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
197516d7e2f1Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
197616d7e2f1Smrg#
197716d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
197816d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
197916d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
198016d7e2f1Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
198116d7e2f1Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
198216d7e2f1Smrg# --with-fop assumes 'auto'.
198316d7e2f1Smrg#
198416d7e2f1Smrg# Interface to module:
198516d7e2f1Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
198616d7e2f1Smrg# FOP:	 	returns the path of the fop program found
198716d7e2f1Smrg#		returns the path set by the user in the environment
198816d7e2f1Smrg# --with-fop: 	'yes' user instructs the module to use fop
198916d7e2f1Smrg#		'no' user instructs the module not to use fop
199016d7e2f1Smrg#
199116d7e2f1Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
199216d7e2f1Smrg#
199316d7e2f1SmrgAC_DEFUN([XORG_WITH_FOP],[
199416d7e2f1SmrgAC_ARG_VAR([FOP], [Path to fop command])
199516d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
199616d7e2f1SmrgAC_ARG_WITH(fop,
199716d7e2f1Smrg	AS_HELP_STRING([--with-fop],
199816d7e2f1Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
199916d7e2f1Smrg	   [use_fop=$withval], [use_fop=]_defopt)
200016d7e2f1Smrgm4_undefine([_defopt])
200116d7e2f1Smrg
200216d7e2f1Smrgif test "x$use_fop" = x"auto"; then
200316d7e2f1Smrg   AC_PATH_PROG([FOP], [fop])
200416d7e2f1Smrg   if test "x$FOP" = "x"; then
200516d7e2f1Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
200616d7e2f1Smrg	have_fop=no
200716d7e2f1Smrg   else
200816d7e2f1Smrg        have_fop=yes
200916d7e2f1Smrg   fi
201016d7e2f1Smrgelif test "x$use_fop" = x"yes" ; then
201116d7e2f1Smrg   AC_PATH_PROG([FOP], [fop])
201216d7e2f1Smrg   if test "x$FOP" = "x"; then
201316d7e2f1Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
201416d7e2f1Smrg   fi
201516d7e2f1Smrg   have_fop=yes
201616d7e2f1Smrgelif test "x$use_fop" = x"no" ; then
201716d7e2f1Smrg   if test "x$FOP" != "x"; then
201816d7e2f1Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
201916d7e2f1Smrg   fi
202016d7e2f1Smrg   have_fop=no
202116d7e2f1Smrgelse
202216d7e2f1Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
202316d7e2f1Smrgfi
202416d7e2f1Smrg
202516d7e2f1Smrg# Test for a minimum version of fop, if provided.
202616d7e2f1Smrgm4_ifval([$1],
202716d7e2f1Smrg[if test "$have_fop" = yes; then
202816d7e2f1Smrg    # scrape the fop version
202916d7e2f1Smrg    AC_MSG_CHECKING([for fop minimum version])
203016d7e2f1Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
203116d7e2f1Smrg    AC_MSG_RESULT([$fop_version])
203216d7e2f1Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
203316d7e2f1Smrg        [if test "x$use_fop" = xauto; then
203416d7e2f1Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
203516d7e2f1Smrg            have_fop=no
203616d7e2f1Smrg        else
203716d7e2f1Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
203816d7e2f1Smrg        fi])
203916d7e2f1Smrgfi])
204016d7e2f1SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
204116d7e2f1Smrg]) # XORG_WITH_FOP
204216d7e2f1Smrg
204316d7e2f1Smrg# XORG_WITH_PS2PDF([DEFAULT])
204416d7e2f1Smrg# ----------------
204516d7e2f1Smrg# Minimum version: 1.6.0
204616d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
204716d7e2f1Smrg#
204816d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
204916d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
205016d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
205116d7e2f1Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
205216d7e2f1Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
205316d7e2f1Smrg# --with-ps2pdf assumes 'auto'.
205416d7e2f1Smrg#
205516d7e2f1Smrg# Interface to module:
205616d7e2f1Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
205716d7e2f1Smrg# PS2PDF:	returns the path of the ps2pdf program found
205816d7e2f1Smrg#		returns the path set by the user in the environment
205916d7e2f1Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
206016d7e2f1Smrg#		 'no' user instructs the module not to use ps2pdf
206116d7e2f1Smrg#
206216d7e2f1Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
206316d7e2f1Smrg#
206416d7e2f1SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
206516d7e2f1SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
206616d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
206716d7e2f1SmrgAC_ARG_WITH(ps2pdf,
206816d7e2f1Smrg	AS_HELP_STRING([--with-ps2pdf],
206916d7e2f1Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
207016d7e2f1Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
207116d7e2f1Smrgm4_undefine([_defopt])
207216d7e2f1Smrg
207316d7e2f1Smrgif test "x$use_ps2pdf" = x"auto"; then
207416d7e2f1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
207516d7e2f1Smrg   if test "x$PS2PDF" = "x"; then
207616d7e2f1Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
207716d7e2f1Smrg	have_ps2pdf=no
207816d7e2f1Smrg   else
207916d7e2f1Smrg        have_ps2pdf=yes
208016d7e2f1Smrg   fi
208116d7e2f1Smrgelif test "x$use_ps2pdf" = x"yes" ; then
208216d7e2f1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
208316d7e2f1Smrg   if test "x$PS2PDF" = "x"; then
208416d7e2f1Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
208516d7e2f1Smrg   fi
208616d7e2f1Smrg   have_ps2pdf=yes
208716d7e2f1Smrgelif test "x$use_ps2pdf" = x"no" ; then
208816d7e2f1Smrg   if test "x$PS2PDF" != "x"; then
208916d7e2f1Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
209016d7e2f1Smrg   fi
209116d7e2f1Smrg   have_ps2pdf=no
209216d7e2f1Smrgelse
209316d7e2f1Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
209416d7e2f1Smrgfi
209516d7e2f1SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
209616d7e2f1Smrg]) # XORG_WITH_PS2PDF
209716d7e2f1Smrg
209816d7e2f1Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
209916d7e2f1Smrg# ----------------
210016d7e2f1Smrg# Minimum version: 1.6.0
210116d7e2f1Smrg#
210216d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
210316d7e2f1Smrg# not at the appropriate level. This macro enables a builder to skip all
210416d7e2f1Smrg# documentation targets except traditional man pages.
210516d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
210616d7e2f1Smrg# maximum flexibilty in controlling documentation building.
210716d7e2f1Smrg# Refer to:
210816d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
210916d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
211016d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
211116d7e2f1Smrg# XORG_WITH_FOP           --with-fop
211216d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
211316d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
211416d7e2f1Smrg#
211516d7e2f1Smrg# Interface to module:
211616d7e2f1Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
211716d7e2f1Smrg# --enable-docs: 'yes' user instructs the module to generate docs
211816d7e2f1Smrg#		 'no' user instructs the module not to generate docs
211916d7e2f1Smrg# parm1:	specify the default value, yes or no.
212016d7e2f1Smrg#
212116d7e2f1SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
212216d7e2f1Smrgm4_define([docs_default], m4_default([$1], [yes]))
212316d7e2f1SmrgAC_ARG_ENABLE(docs,
212416d7e2f1Smrg	AS_HELP_STRING([--enable-docs],
212516d7e2f1Smrg	   [Enable building the documentation (default: ]docs_default[)]),
212616d7e2f1Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
212716d7e2f1Smrgm4_undefine([docs_default])
212816d7e2f1SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
212916d7e2f1SmrgAC_MSG_CHECKING([whether to build documentation])
213016d7e2f1SmrgAC_MSG_RESULT([$build_docs])
213116d7e2f1Smrg]) # XORG_ENABLE_DOCS
213216d7e2f1Smrg
213316d7e2f1Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
213416d7e2f1Smrg# ----------------
213516d7e2f1Smrg# Minimum version: 1.6.0
213616d7e2f1Smrg#
213716d7e2f1Smrg# This macro enables a builder to skip all developer documentation.
213816d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
213916d7e2f1Smrg# maximum flexibilty in controlling documentation building.
214016d7e2f1Smrg# Refer to:
214116d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
214216d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
214316d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
214416d7e2f1Smrg# XORG_WITH_FOP           --with-fop
214516d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
214616d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
214716d7e2f1Smrg#
214816d7e2f1Smrg# Interface to module:
214916d7e2f1Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
215016d7e2f1Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
215116d7e2f1Smrg#			'no' user instructs the module not to generate developer docs
215216d7e2f1Smrg# parm1:		specify the default value, yes or no.
215316d7e2f1Smrg#
215416d7e2f1SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
215516d7e2f1Smrgm4_define([devel_default], m4_default([$1], [yes]))
215616d7e2f1SmrgAC_ARG_ENABLE(devel-docs,
215716d7e2f1Smrg	AS_HELP_STRING([--enable-devel-docs],
215816d7e2f1Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
215916d7e2f1Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
216016d7e2f1Smrgm4_undefine([devel_default])
216116d7e2f1SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
216216d7e2f1SmrgAC_MSG_CHECKING([whether to build developer documentation])
216316d7e2f1SmrgAC_MSG_RESULT([$build_devel_docs])
216416d7e2f1Smrg]) # XORG_ENABLE_DEVEL_DOCS
216516d7e2f1Smrg
216616d7e2f1Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
216716d7e2f1Smrg# ----------------
216816d7e2f1Smrg# Minimum version: 1.6.0
216916d7e2f1Smrg#
217016d7e2f1Smrg# This macro enables a builder to skip all functional specification targets.
217116d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
217216d7e2f1Smrg# maximum flexibilty in controlling documentation building.
217316d7e2f1Smrg# Refer to:
217416d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
217516d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
217616d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
217716d7e2f1Smrg# XORG_WITH_FOP           --with-fop
217816d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
217916d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
218016d7e2f1Smrg#
218116d7e2f1Smrg# Interface to module:
218216d7e2f1Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
218316d7e2f1Smrg# --enable-specs:	'yes' user instructs the module to generate specs
218416d7e2f1Smrg#			'no' user instructs the module not to generate specs
218516d7e2f1Smrg# parm1:		specify the default value, yes or no.
218616d7e2f1Smrg#
218716d7e2f1SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
218816d7e2f1Smrgm4_define([spec_default], m4_default([$1], [yes]))
218916d7e2f1SmrgAC_ARG_ENABLE(specs,
219016d7e2f1Smrg	AS_HELP_STRING([--enable-specs],
219116d7e2f1Smrg	   [Enable building the specs (default: ]spec_default[)]),
219216d7e2f1Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
219316d7e2f1Smrgm4_undefine([spec_default])
219416d7e2f1SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
219516d7e2f1SmrgAC_MSG_CHECKING([whether to build functional specifications])
219616d7e2f1SmrgAC_MSG_RESULT([$build_specs])
219716d7e2f1Smrg]) # XORG_ENABLE_SPECS
219816d7e2f1Smrg
219916d7e2f1Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
220016d7e2f1Smrg# ----------------------------------------------
220116d7e2f1Smrg# Minimum version: 1.13.0
220216d7e2f1Smrg#
220316d7e2f1Smrg# This macro enables a builder to enable/disable unit testing
220416d7e2f1Smrg# It makes no assumption about the test cases implementation
220516d7e2f1Smrg# Test cases may or may not use Automake "Support for test suites"
220616d7e2f1Smrg# They may or may not use the software utility library GLib
220716d7e2f1Smrg#
220816d7e2f1Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
220916d7e2f1Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
221016d7e2f1Smrg# The variable enable_unit_tests is used by other macros in this file.
221116d7e2f1Smrg#
221216d7e2f1Smrg# Interface to module:
221316d7e2f1Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
221416d7e2f1Smrg# enable_unit_tests:    used in configure.ac for additional configuration
221516d7e2f1Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
221616d7e2f1Smrg#			'no' user instructs the module not to build tests
221716d7e2f1Smrg# parm1:		specify the default value, yes or no.
221816d7e2f1Smrg#
221916d7e2f1SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
222016d7e2f1SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
222116d7e2f1SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
222216d7e2f1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
222316d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
222416d7e2f1SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
222516d7e2f1Smrg	[Enable building unit test cases (default: ]_defopt[)]),
222616d7e2f1Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
222716d7e2f1Smrgm4_undefine([_defopt])
222816d7e2f1SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
222916d7e2f1SmrgAC_MSG_CHECKING([whether to build unit test cases])
223016d7e2f1SmrgAC_MSG_RESULT([$enable_unit_tests])
223116d7e2f1Smrg]) # XORG_ENABLE_UNIT_TESTS
223216d7e2f1Smrg
223316d7e2f1Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
223416d7e2f1Smrg# ----------------------------------------
223516d7e2f1Smrg# Minimum version: 1.13.0
223616d7e2f1Smrg#
223716d7e2f1Smrg# GLib is a library which provides advanced data structures and functions.
223816d7e2f1Smrg# This macro enables a module to test for the presence of Glib.
223916d7e2f1Smrg#
224016d7e2f1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
224116d7e2f1Smrg# Otherwise the value of $enable_unit_tests is blank.
224216d7e2f1Smrg#
224316d7e2f1Smrg# Interface to module:
224416d7e2f1Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
224516d7e2f1Smrg# with_glib: used in configure.ac to know if GLib has been found
224616d7e2f1Smrg# --with-glib:	'yes' user instructs the module to use glib
224716d7e2f1Smrg#		'no' user instructs the module not to use glib
224816d7e2f1Smrg#
224916d7e2f1SmrgAC_DEFUN([XORG_WITH_GLIB],[
225016d7e2f1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
225116d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
225216d7e2f1SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
225316d7e2f1Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
225416d7e2f1Smrg	[with_glib=$withval], [with_glib=]_defopt)
225516d7e2f1Smrgm4_undefine([_defopt])
225616d7e2f1Smrg
225716d7e2f1Smrghave_glib=no
225816d7e2f1Smrg# Do not probe GLib if user explicitly disabled unit testing
225916d7e2f1Smrgif test "x$enable_unit_tests" != x"no"; then
226016d7e2f1Smrg  # Do not probe GLib if user explicitly disabled it
226116d7e2f1Smrg  if test "x$with_glib" != x"no"; then
226216d7e2f1Smrg    m4_ifval(
226316d7e2f1Smrg      [$1],
226416d7e2f1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
226516d7e2f1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
226616d7e2f1Smrg    )
226716d7e2f1Smrg  fi
226816d7e2f1Smrgfi
226916d7e2f1Smrg
227016d7e2f1Smrg# Not having GLib when unit testing has been explicitly requested is an error
227116d7e2f1Smrgif test "x$enable_unit_tests" = x"yes"; then
227216d7e2f1Smrg  if test "x$have_glib" = x"no"; then
227316d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
227416d7e2f1Smrg  fi
227516d7e2f1Smrgfi
227616d7e2f1Smrg
227716d7e2f1Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
227816d7e2f1Smrgif test "x$enable_unit_tests" = x"no"; then
227916d7e2f1Smrg  if test "x$with_glib" = x"yes"; then
228016d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
228116d7e2f1Smrg  fi
228216d7e2f1Smrgfi
228316d7e2f1Smrg
228416d7e2f1Smrg# Not having GLib when it has been explicitly requested is an error
228516d7e2f1Smrgif test "x$with_glib" = x"yes"; then
228616d7e2f1Smrg  if test "x$have_glib" = x"no"; then
228716d7e2f1Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
228816d7e2f1Smrg  fi
228916d7e2f1Smrgfi
229016d7e2f1Smrg
229116d7e2f1SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
229216d7e2f1Smrg]) # XORG_WITH_GLIB
229316d7e2f1Smrg
229416d7e2f1Smrg# XORG_LD_WRAP([required|optional])
229516d7e2f1Smrg# ---------------------------------
229616d7e2f1Smrg# Minimum version: 1.13.0
229716d7e2f1Smrg#
229816d7e2f1Smrg# Check if linker supports -wrap, passed via compiler flags
229916d7e2f1Smrg#
230016d7e2f1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
230116d7e2f1Smrg# Otherwise the value of $enable_unit_tests is blank.
230216d7e2f1Smrg#
230316d7e2f1Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
230416d7e2f1Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
230516d7e2f1Smrg# available, an argument of "optional" allows use when some unit tests require
230616d7e2f1Smrg# ld -wrap and others do not.
230716d7e2f1Smrg#
230816d7e2f1SmrgAC_DEFUN([XORG_LD_WRAP],[
230916d7e2f1SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
231016d7e2f1Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
231116d7e2f1Smrg                      void __wrap_exit(int status) { return; }],
231216d7e2f1Smrg                     [exit(0);])])
231316d7e2f1Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
231416d7e2f1Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
231516d7e2f1Smrg  if test "x$have_ld_wrap" = x"no"; then
231616d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
231716d7e2f1Smrg  fi
231816d7e2f1Smrgfi
231916d7e2f1SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
232016d7e2f1Smrg#
232116d7e2f1Smrg]) # XORG_LD_WRAP
232216d7e2f1Smrg
232316d7e2f1Smrg# XORG_CHECK_LINKER_FLAGS
232416d7e2f1Smrg# -----------------------
232516d7e2f1Smrg# SYNOPSIS
232616d7e2f1Smrg#
232716d7e2f1Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
232816d7e2f1Smrg#
232916d7e2f1Smrg# DESCRIPTION
233016d7e2f1Smrg#
233116d7e2f1Smrg#   Check whether the given linker FLAGS work with the current language's
233216d7e2f1Smrg#   linker, or whether they give an error.
233316d7e2f1Smrg#
233416d7e2f1Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
233516d7e2f1Smrg#   success/failure.
233616d7e2f1Smrg#
233716d7e2f1Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
233816d7e2f1Smrg#
233916d7e2f1Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
234016d7e2f1Smrg#
234116d7e2f1Smrg# LICENSE
234216d7e2f1Smrg#
234316d7e2f1Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
234416d7e2f1Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
234516d7e2f1Smrg#   Copyright (c) 2009 Matteo Frigo
234616d7e2f1Smrg#
234716d7e2f1Smrg#   This program is free software: you can redistribute it and/or modify it
234816d7e2f1Smrg#   under the terms of the GNU General Public License as published by the
234916d7e2f1Smrg#   Free Software Foundation, either version 3 of the License, or (at your
235016d7e2f1Smrg#   option) any later version.
235116d7e2f1Smrg#
235216d7e2f1Smrg#   This program is distributed in the hope that it will be useful, but
235316d7e2f1Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
235416d7e2f1Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
235516d7e2f1Smrg#   Public License for more details.
235616d7e2f1Smrg#
235716d7e2f1Smrg#   You should have received a copy of the GNU General Public License along
235816d7e2f1Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
235916d7e2f1Smrg#
236016d7e2f1Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
236116d7e2f1Smrg#   gives unlimited permission to copy, distribute and modify the configure
236216d7e2f1Smrg#   scripts that are the output of Autoconf when processing the Macro. You
236316d7e2f1Smrg#   need not follow the terms of the GNU General Public License when using
236416d7e2f1Smrg#   or distributing such scripts, even though portions of the text of the
236516d7e2f1Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
236616d7e2f1Smrg#   all other use of the material that constitutes the Autoconf Macro.
236716d7e2f1Smrg#
236816d7e2f1Smrg#   This special exception to the GPL applies to versions of the Autoconf
236916d7e2f1Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
237016d7e2f1Smrg#   modified version of the Autoconf Macro, you may extend this special
237116d7e2f1Smrg#   exception to the GPL to apply to your modified version as well.#
237216d7e2f1SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
237316d7e2f1Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
237416d7e2f1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
237516d7e2f1SmrgAS_LITERAL_IF([$1],
237616d7e2f1Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
237716d7e2f1Smrg      ax_save_FLAGS=$LDFLAGS
237816d7e2f1Smrg      LDFLAGS="$1"
237916d7e2f1Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
238016d7e2f1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
238116d7e2f1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
238216d7e2f1Smrg      LDFLAGS=$ax_save_FLAGS])],
238316d7e2f1Smrg  [ax_save_FLAGS=$LDFLAGS
238416d7e2f1Smrg   LDFLAGS="$1"
238516d7e2f1Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
238616d7e2f1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
238716d7e2f1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
238816d7e2f1Smrg   LDFLAGS=$ax_save_FLAGS])
238916d7e2f1Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
239016d7e2f1SmrgAC_MSG_RESULT($xorg_check_linker_flags)
239116d7e2f1Smrgif test "x$xorg_check_linker_flags" = xyes; then
239216d7e2f1Smrg	m4_default([$2], :)
239316d7e2f1Smrgelse
239416d7e2f1Smrg	m4_default([$3], :)
239516d7e2f1Smrgfi
239616d7e2f1Smrg]) # XORG_CHECK_LINKER_FLAGS
239716d7e2f1Smrg
239816d7e2f1Smrg# XORG_MEMORY_CHECK_FLAGS
239916d7e2f1Smrg# -----------------------
240016d7e2f1Smrg# Minimum version: 1.16.0
240116d7e2f1Smrg#
240216d7e2f1Smrg# This macro attempts to find appropriate memory checking functionality
240316d7e2f1Smrg# for various platforms which unit testing code may use to catch various
240416d7e2f1Smrg# forms of memory allocation and access errors in testing.
240516d7e2f1Smrg#
240616d7e2f1Smrg# Interface to module:
240716d7e2f1Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
240816d7e2f1Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
240916d7e2f1Smrg#
241016d7e2f1Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
241116d7e2f1Smrg#
241216d7e2f1SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
241316d7e2f1Smrg
241416d7e2f1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
241516d7e2f1SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
241616d7e2f1Smrg           [Environment variables to enable memory checking in tests])
241716d7e2f1Smrg
241816d7e2f1Smrg# Check for different types of support on different platforms
241916d7e2f1Smrgcase $host_os in
242016d7e2f1Smrg    solaris*)
242116d7e2f1Smrg        AC_CHECK_LIB([umem], [umem_alloc],
242216d7e2f1Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
242316d7e2f1Smrg        ;;
242416d7e2f1Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
242516d7e2f1Smrg        # both directly and inverted, so should not be 0 or 255.
242616d7e2f1Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
242716d7e2f1Smrg        ;;
242816d7e2f1Smrg    darwin*)
242916d7e2f1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
243016d7e2f1Smrg        ;;
243116d7e2f1Smrg    *bsd*)
243216d7e2f1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
243316d7e2f1Smrg        ;;
243416d7e2f1Smrgesac
243516d7e2f1Smrg
243616d7e2f1Smrg# User supplied flags override default flags
243716d7e2f1Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
243816d7e2f1Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
243916d7e2f1Smrgfi
244016d7e2f1Smrg
244116d7e2f1SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
244216d7e2f1Smrg]) # XORG_WITH_LINT
244316d7e2f1Smrg
244416d7e2f1Smrg# XORG_CHECK_MALLOC_ZERO
244516d7e2f1Smrg# ----------------------
244616d7e2f1Smrg# Minimum version: 1.0.0
244716d7e2f1Smrg#
244816d7e2f1Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
244916d7e2f1Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
245016d7e2f1Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
245116d7e2f1SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
245216d7e2f1SmrgAC_ARG_ENABLE(malloc0returnsnull,
245316d7e2f1Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
245416d7e2f1Smrg		       [malloc(0) returns NULL (default: auto)]),
245516d7e2f1Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
245616d7e2f1Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
245716d7e2f1Smrg
245816d7e2f1SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
245916d7e2f1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
246016d7e2f1Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
246116d7e2f1Smrg#include <stdlib.h>
246216d7e2f1Smrg],[
246316d7e2f1Smrg    char *m0, *r0, *c0, *p;
246416d7e2f1Smrg    m0 = malloc(0);
246516d7e2f1Smrg    p = malloc(10);
246616d7e2f1Smrg    r0 = realloc(p,0);
246716d7e2f1Smrg    c0 = calloc(0,10);
246816d7e2f1Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
246916d7e2f1Smrg])],
247016d7e2f1Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
247116d7e2f1Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
247216d7e2f1Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
247316d7e2f1Smrgfi
247416d7e2f1SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
247516d7e2f1Smrg
247616d7e2f1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
247716d7e2f1Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
247816d7e2f1Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
247916d7e2f1Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
248016d7e2f1Smrgelse
248116d7e2f1Smrg	MALLOC_ZERO_CFLAGS=""
248216d7e2f1Smrg	XMALLOC_ZERO_CFLAGS=""
248316d7e2f1Smrg	XTMALLOC_ZERO_CFLAGS=""
248416d7e2f1Smrgfi
248516d7e2f1Smrg
248616d7e2f1SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
248716d7e2f1SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
248816d7e2f1SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
248916d7e2f1Smrg]) # XORG_CHECK_MALLOC_ZERO
249016d7e2f1Smrg
249116d7e2f1Smrg# XORG_WITH_LINT()
249216d7e2f1Smrg# ----------------
249316d7e2f1Smrg# Minimum version: 1.1.0
249416d7e2f1Smrg#
249516d7e2f1Smrg# This macro enables the use of a tool that flags some suspicious and
249616d7e2f1Smrg# non-portable constructs (likely to be bugs) in C language source code.
249716d7e2f1Smrg# It will attempt to locate the tool and use appropriate options.
249816d7e2f1Smrg# There are various lint type tools on different platforms.
249916d7e2f1Smrg#
250016d7e2f1Smrg# Interface to module:
250116d7e2f1Smrg# LINT:		returns the path to the tool found on the platform
250216d7e2f1Smrg#		or the value set to LINT on the configure cmd line
250316d7e2f1Smrg#		also an Automake conditional
250416d7e2f1Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
250516d7e2f1Smrg#
250616d7e2f1Smrg# --with-lint:	'yes' user instructs the module to use lint
250716d7e2f1Smrg#		'no' user instructs the module not to use lint (default)
250816d7e2f1Smrg#
250916d7e2f1Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
251016d7e2f1Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
251116d7e2f1Smrg#
251216d7e2f1SmrgAC_DEFUN([XORG_WITH_LINT],[
251316d7e2f1Smrg
251416d7e2f1SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
251516d7e2f1SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
251616d7e2f1SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
251716d7e2f1Smrg		[Use a lint-style source code checker (default: disabled)])],
251816d7e2f1Smrg		[use_lint=$withval], [use_lint=no])
251916d7e2f1Smrg
252016d7e2f1Smrg# Obtain platform specific info like program name and options
252116d7e2f1Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
252216d7e2f1Smrgcase $host_os in
252316d7e2f1Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
252416d7e2f1Smrg	lint_name=splint
252516d7e2f1Smrg	lint_options="-badflag"
252616d7e2f1Smrg	;;
252716d7e2f1Smrg  *freebsd* | *netbsd*)
252816d7e2f1Smrg	lint_name=lint
252916d7e2f1Smrg	lint_options="-u -b"
253016d7e2f1Smrg	;;
253116d7e2f1Smrg  *solaris*)
253216d7e2f1Smrg	lint_name=lint
253316d7e2f1Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
253416d7e2f1Smrg	;;
253516d7e2f1Smrgesac
253616d7e2f1Smrg
253716d7e2f1Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
253816d7e2f1Smrgif test "x$use_lint" = x"yes" ; then
253916d7e2f1Smrg   AC_PATH_PROG([LINT], [$lint_name])
254016d7e2f1Smrg   if test "x$LINT" = "x"; then
254116d7e2f1Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
254216d7e2f1Smrg   fi
254316d7e2f1Smrgelif test "x$use_lint" = x"no" ; then
254416d7e2f1Smrg   if test "x$LINT" != "x"; then
254516d7e2f1Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
254616d7e2f1Smrg   fi
254716d7e2f1Smrgelse
254816d7e2f1Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
254916d7e2f1Smrgfi
255016d7e2f1Smrg
255116d7e2f1Smrg# User supplied flags override default flags
255216d7e2f1Smrgif test "x$LINT_FLAGS" != "x"; then
255316d7e2f1Smrg   lint_options=$LINT_FLAGS
255416d7e2f1Smrgfi
255516d7e2f1Smrg
255616d7e2f1SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
255716d7e2f1SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
255816d7e2f1Smrg
255916d7e2f1Smrg]) # XORG_WITH_LINT
256016d7e2f1Smrg
256116d7e2f1Smrg# XORG_LINT_LIBRARY(LIBNAME)
256216d7e2f1Smrg# --------------------------
256316d7e2f1Smrg# Minimum version: 1.1.0
256416d7e2f1Smrg#
256516d7e2f1Smrg# Sets up flags for building lint libraries for checking programs that call
256616d7e2f1Smrg# functions in the library.
256716d7e2f1Smrg#
256816d7e2f1Smrg# Interface to module:
256916d7e2f1Smrg# LINTLIB		- Automake variable with the name of lint library file to make
257016d7e2f1Smrg# MAKE_LINT_LIB		- Automake conditional
257116d7e2f1Smrg#
257216d7e2f1Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
257316d7e2f1Smrg#			  - 'no' user instructs the module not to create a lint library (default)
257416d7e2f1Smrg
257516d7e2f1SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
25768650bb69SmrgAC_REQUIRE([XORG_WITH_LINT])
25778650bb69SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
25788650bb69Smrg	[Create lint library (default: disabled)])],
25798650bb69Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
258016d7e2f1Smrg
258116d7e2f1Smrgif test "x$make_lint_lib" = x"yes" ; then
258216d7e2f1Smrg   LINTLIB=llib-l$1.ln
258316d7e2f1Smrg   if test "x$LINT" = "x"; then
258416d7e2f1Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
258516d7e2f1Smrg   fi
258616d7e2f1Smrgelif test "x$make_lint_lib" != x"no" ; then
258716d7e2f1Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
25888650bb69Smrgfi
258916d7e2f1Smrg
25908650bb69SmrgAC_SUBST(LINTLIB)
25918650bb69SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
25928650bb69Smrg
25938650bb69Smrg]) # XORG_LINT_LIBRARY
25948650bb69Smrg
259516d7e2f1Smrg# XORG_COMPILER_BRAND
259616d7e2f1Smrg# -------------------
259716d7e2f1Smrg# Minimum version: 1.14.0
259816d7e2f1Smrg#
259916d7e2f1Smrg# Checks for various brands of compilers and sets flags as appropriate:
260016d7e2f1Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
260116d7e2f1Smrg#   clang compiler - sets CLANGCC to "yes"
260216d7e2f1Smrg#   Intel compiler - sets INTELCC to "yes"
260316d7e2f1Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
260416d7e2f1Smrg#
260516d7e2f1SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
260616d7e2f1SmrgAC_REQUIRE([AC_PROG_CC_C99])
260716d7e2f1SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
260816d7e2f1SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
260916d7e2f1SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
261016d7e2f1Smrg]) # XORG_COMPILER_BRAND
261116d7e2f1Smrg
261216d7e2f1Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
261316d7e2f1Smrg# ---------------
261416d7e2f1Smrg# Minimum version: 1.16.0
261516d7e2f1Smrg#
261616d7e2f1Smrg# Test if the compiler works when passed the given flag as a command line argument.
261716d7e2f1Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
261816d7e2f1Smrg# next flag in the list until there are no more options.
261916d7e2f1Smrg#
262016d7e2f1Smrg# Note that this does not guarantee that the compiler supports the flag as some
262116d7e2f1Smrg# compilers will simply ignore arguments that they do not understand, but we do
262216d7e2f1Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
262316d7e2f1Smrg# -Werror=unused-command-line-argument
262416d7e2f1Smrg#
262516d7e2f1SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
262616d7e2f1SmrgAC_REQUIRE([AC_PROG_CC_C99])
262716d7e2f1Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
262816d7e2f1Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
262916d7e2f1Smrg
263016d7e2f1Smrgxorg_testset_save_CFLAGS="$CFLAGS"
263116d7e2f1Smrg
263216d7e2f1Smrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
263316d7e2f1Smrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
263416d7e2f1Smrg	AC_CACHE_CHECK([if $CC supports -Werror=unknown-warning-option],
263516d7e2f1Smrg			xorg_cv_cc_flag_unknown_warning_option,
263616d7e2f1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
263716d7e2f1Smrg					  [xorg_cv_cc_flag_unknown_warning_option=yes],
263816d7e2f1Smrg					  [xorg_cv_cc_flag_unknown_warning_option=no]))
263916d7e2f1Smrg	xorg_testset_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option
264016d7e2f1Smrg	CFLAGS="$xorg_testset_save_CFLAGS"
264116d7e2f1Smrgfi
264216d7e2f1Smrg
264316d7e2f1Smrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
264416d7e2f1Smrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
264516d7e2f1Smrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
264616d7e2f1Smrg	fi
264716d7e2f1Smrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
264816d7e2f1Smrg	AC_CACHE_CHECK([if $CC supports -Werror=unused-command-line-argument],
264916d7e2f1Smrg			xorg_cv_cc_flag_unused_command_line_argument,
265016d7e2f1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
265116d7e2f1Smrg					  [xorg_cv_cc_flag_unused_command_line_argument=yes],
265216d7e2f1Smrg					  [xorg_cv_cc_flag_unused_command_line_argument=no]))
265316d7e2f1Smrg	xorg_testset_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument
265416d7e2f1Smrg	CFLAGS="$xorg_testset_save_CFLAGS"
265516d7e2f1Smrgfi
265616d7e2f1Smrg
265716d7e2f1Smrgfound="no"
265816d7e2f1Smrgm4_foreach([flag], m4_cdr($@), [
265916d7e2f1Smrg	if test $found = "no" ; then
266016d7e2f1Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
266116d7e2f1Smrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
266216d7e2f1Smrg		fi
266316d7e2f1Smrg
266416d7e2f1Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
266516d7e2f1Smrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
266616d7e2f1Smrg		fi
266716d7e2f1Smrg
266816d7e2f1Smrg		CFLAGS="$CFLAGS ]flag["
266916d7e2f1Smrg
267016d7e2f1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
267116d7e2f1Smrg		AC_MSG_CHECKING([if $CC supports ]flag[])
267216d7e2f1Smrg		cacheid=`AS_ECHO_N([xorg_cv_cc_flag_]flag[])`
267316d7e2f1Smrg		AC_CACHE_VAL(AS_TR_SH($cacheid),
267416d7e2f1Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
267516d7e2f1Smrg					     [eval AS_TR_SH($cacheid)=yes],
267616d7e2f1Smrg					     [eval AS_TR_SH($cacheid)=no])])
267716d7e2f1Smrg
267816d7e2f1Smrg		CFLAGS="$xorg_testset_save_CFLAGS"
267916d7e2f1Smrg
268016d7e2f1Smrg		eval supported=$AS_TR_SH($cacheid)
268116d7e2f1Smrg		AC_MSG_RESULT([$supported])
268216d7e2f1Smrg		if test "$supported" = "yes" ; then
268316d7e2f1Smrg			$1="$$1 ]flag["
268416d7e2f1Smrg			found="yes"
268516d7e2f1Smrg		fi
268616d7e2f1Smrg	fi
268716d7e2f1Smrg])
268816d7e2f1Smrg]) # XORG_TESTSET_CFLAG
268916d7e2f1Smrg
269016d7e2f1Smrg# XORG_COMPILER_FLAGS
269116d7e2f1Smrg# ---------------
269216d7e2f1Smrg# Minimum version: 1.16.0
269316d7e2f1Smrg#
269416d7e2f1Smrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
269516d7e2f1Smrg# by the selected compiler which do NOT alter the generated code.  These
269616d7e2f1Smrg# arguments will cause the compiler to print various warnings during
269716d7e2f1Smrg# compilation AND turn a conservative set of warnings into errors.
269816d7e2f1Smrg#
269916d7e2f1Smrg# The set of flags supported by BASE_CFLAGS will grow in future
270016d7e2f1Smrg# versions of util-macros as options are added to new compilers.
270116d7e2f1Smrg#
270216d7e2f1SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
270316d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
270416d7e2f1Smrg
270516d7e2f1SmrgAC_ARG_ENABLE(selective-werror,
270616d7e2f1Smrg              AS_HELP_STRING([--disable-selective-werror],
270716d7e2f1Smrg                             [Turn off selective compiler errors. (default: enabled)]),
270816d7e2f1Smrg              [SELECTIVE_WERROR=$enableval],
270916d7e2f1Smrg              [SELECTIVE_WERROR=yes])
271016d7e2f1Smrg
271116d7e2f1Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
271216d7e2f1Smrgif test "x$SUNCC" = "xyes"; then
271316d7e2f1Smrg    BASE_CFLAGS="-v"
271416d7e2f1Smrgelse
271516d7e2f1Smrg    BASE_CFLAGS=""
271616d7e2f1Smrgfi
271716d7e2f1Smrg
271816d7e2f1Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
271916d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
272016d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
272116d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
272216d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
272316d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
272416d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
272516d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
272616d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
272716d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
272816d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
272916d7e2f1Smrg
273016d7e2f1Smrg# This chunk adds additional warnings that could catch undesired effects.
273116d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
273216d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
273316d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
273416d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
273516d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
273616d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
273716d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
273816d7e2f1Smrg
273916d7e2f1Smrg# These are currently disabled because they are noisy.  They will be enabled
274016d7e2f1Smrg# in the future once the codebase is sufficiently modernized to silence
274116d7e2f1Smrg# them.  For now, I don't want them to drown out the other warnings.
274216d7e2f1Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
274316d7e2f1Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
274416d7e2f1Smrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
274516d7e2f1Smrg
274616d7e2f1Smrg# Turn some warnings into errors, so we don't accidently get successful builds
274716d7e2f1Smrg# when there are problems that should be fixed.
274816d7e2f1Smrg
274916d7e2f1Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
275016d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
275116d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
275216d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
275316d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
275416d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
275516d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
275616d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
275716d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
275816d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
275916d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
276016d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
276116d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
276216d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
276316d7e2f1Smrgelse
276416d7e2f1SmrgAC_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])
276516d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
276616d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
276716d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
276816d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
276916d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
277016d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
277116d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
277216d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
277316d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
277416d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
277516d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
277616d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
277716d7e2f1SmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
277816d7e2f1Smrgfi
277916d7e2f1Smrg
278016d7e2f1SmrgAC_SUBST([BASE_CFLAGS])
278116d7e2f1Smrg]) # XORG_COMPILER_FLAGS
278216d7e2f1Smrg
27838650bb69Smrg# XORG_CWARNFLAGS
27848650bb69Smrg# ---------------
27858650bb69Smrg# Minimum version: 1.2.0
278616d7e2f1Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
27878650bb69Smrg#
27888650bb69Smrg# Defines CWARNFLAGS to enable C compiler warnings.
27898650bb69Smrg#
279016d7e2f1Smrg# This function is deprecated because it defines -fno-strict-aliasing
279116d7e2f1Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
279216d7e2f1Smrg# is needed, then it should be added explicitly in the module when
279316d7e2f1Smrg# it is updated to use BASE_CFLAGS.
279416d7e2f1Smrg#
27958650bb69SmrgAC_DEFUN([XORG_CWARNFLAGS], [
279616d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
279716d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
279816d7e2f1SmrgCWARNFLAGS="$BASE_CFLAGS"
27998650bb69Smrgif  test "x$GCC" = xyes ; then
280016d7e2f1Smrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
28018650bb69Smrgfi
28028650bb69SmrgAC_SUBST(CWARNFLAGS)
28038650bb69Smrg]) # XORG_CWARNFLAGS
28048650bb69Smrg
28058650bb69Smrg# XORG_STRICT_OPTION
28068650bb69Smrg# -----------------------
28078650bb69Smrg# Minimum version: 1.3.0
28088650bb69Smrg#
280916d7e2f1Smrg# Add configure option to enable strict compilation flags, such as treating
281016d7e2f1Smrg# warnings as fatal errors.
281116d7e2f1Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
281216d7e2f1Smrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
281316d7e2f1Smrg#
281416d7e2f1Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
281516d7e2f1Smrg# when strict compilation is unconditionally desired.
28168650bb69SmrgAC_DEFUN([XORG_STRICT_OPTION], [
28178650bb69SmrgAC_REQUIRE([XORG_CWARNFLAGS])
281816d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
28198650bb69Smrg
28208650bb69SmrgAC_ARG_ENABLE(strict-compilation,
28218650bb69Smrg			  AS_HELP_STRING([--enable-strict-compilation],
28228650bb69Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
28238650bb69Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
282416d7e2f1Smrg
282516d7e2f1SmrgSTRICT_CFLAGS=""
282616d7e2f1SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
282716d7e2f1SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
282816d7e2f1Smrg
282916d7e2f1Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
283016d7e2f1Smrg# activate it with -Werror, so we add it here explicitly.
283116d7e2f1SmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
283216d7e2f1Smrg
28338650bb69Smrgif test "x$STRICT_COMPILE" = "xyes"; then
283416d7e2f1Smrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
283516d7e2f1Smrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
28368650bb69Smrgfi
283716d7e2f1SmrgAC_SUBST([STRICT_CFLAGS])
283816d7e2f1SmrgAC_SUBST([BASE_CFLAGS])
28398650bb69SmrgAC_SUBST([CWARNFLAGS])
28408650bb69Smrg]) # XORG_STRICT_OPTION
28418650bb69Smrg
28428650bb69Smrg# XORG_DEFAULT_OPTIONS
28438650bb69Smrg# --------------------
28448650bb69Smrg# Minimum version: 1.3.0
28458650bb69Smrg#
28468650bb69Smrg# Defines default options for X.Org modules.
28478650bb69Smrg#
28488650bb69SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
284916d7e2f1SmrgAC_REQUIRE([AC_PROG_INSTALL])
285016d7e2f1SmrgXORG_COMPILER_FLAGS
28518650bb69SmrgXORG_CWARNFLAGS
28528650bb69SmrgXORG_STRICT_OPTION
28538650bb69SmrgXORG_RELEASE_VERSION
28548650bb69SmrgXORG_CHANGELOG
285516d7e2f1SmrgXORG_INSTALL
28568650bb69SmrgXORG_MANPAGE_SECTIONS
285716d7e2f1Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
285816d7e2f1Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
28598650bb69Smrg]) # XORG_DEFAULT_OPTIONS
286016d7e2f1Smrg
286116d7e2f1Smrg# XORG_INSTALL()
286216d7e2f1Smrg# ----------------
286316d7e2f1Smrg# Minimum version: 1.4.0
286416d7e2f1Smrg#
286516d7e2f1Smrg# Defines the variable INSTALL_CMD as the command to copy
286616d7e2f1Smrg# INSTALL from $prefix/share/util-macros.
286716d7e2f1Smrg#
286816d7e2f1SmrgAC_DEFUN([XORG_INSTALL], [
286916d7e2f1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
287016d7e2f1Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
287116d7e2f1SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
287216d7e2f1Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
287316d7e2f1Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
287416d7e2f1Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
287516d7e2f1SmrgAC_SUBST([INSTALL_CMD])
287616d7e2f1Smrg]) # XORG_INSTALL
28772c7c4e3dSmrgdnl Copyright 2005 Red Hat, Inc
28782c7c4e3dSmrgdnl
28792c7c4e3dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
28802c7c4e3dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
28812c7c4e3dSmrgdnl the above copyright notice appear in all copies and that both that
28822c7c4e3dSmrgdnl copyright notice and this permission notice appear in supporting
28832c7c4e3dSmrgdnl documentation.
28842c7c4e3dSmrgdnl
28852c7c4e3dSmrgdnl The above copyright notice and this permission notice shall be included
28862c7c4e3dSmrgdnl in all copies or substantial portions of the Software.
28872c7c4e3dSmrgdnl
28882c7c4e3dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
28892c7c4e3dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28902c7c4e3dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28912c7c4e3dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
28922c7c4e3dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28932c7c4e3dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28942c7c4e3dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
28952c7c4e3dSmrgdnl
28962c7c4e3dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
28972c7c4e3dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
28982c7c4e3dSmrgdnl other dealings in this Software without prior written authorization
28992c7c4e3dSmrgdnl from the copyright holders.
29002c7c4e3dSmrgdnl
29012c7c4e3dSmrg
29022c7c4e3dSmrg# XORG_RELEASE_VERSION
29032c7c4e3dSmrg# --------------------
290416d7e2f1Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
29052c7c4e3dSmrg 
29062c7c4e3dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
29078650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
29088650bb69Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
29098650bb69Smrg		[Major version of this package])
29108650bb69Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
29118650bb69Smrg	if test "x$PVM" = "x"; then
29128650bb69Smrg		PVM="0"
29138650bb69Smrg	fi
29148650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
29158650bb69Smrg		[$PVM],
29168650bb69Smrg		[Minor version of this package])
29178650bb69Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
29188650bb69Smrg	if test "x$PVP" = "x"; then
29198650bb69Smrg		PVP="0"
29208650bb69Smrg	fi
29218650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
29228650bb69Smrg		[$PVP],
29238650bb69Smrg		[Patch version of this package])
29242c7c4e3dSmrg])
29252c7c4e3dSmrg
29268650bb69Smrg# XORG_CHANGELOG()
29278650bb69Smrg# ----------------
29288650bb69Smrg# Minimum version: 1.2.0
29298650bb69Smrg#
29308650bb69Smrg# Defines the variable CHANGELOG_CMD as the command to generate
29318650bb69Smrg# ChangeLog from git.
29328650bb69Smrg#
29338650bb69Smrg#
29348650bb69SmrgAC_DEFUN([XORG_CHANGELOG], [
293516d7e2f1SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
293616d7e2f1Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
293716d7e2f1Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
29388650bb69Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
29398650bb69SmrgAC_SUBST([CHANGELOG_CMD])
29408650bb69Smrg]) # XORG_CHANGELOG
29418650bb69Smrg
2942