aclocal.m4 revision 320e696b
129cb5710Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2b3307321Smrg
3afe13c8eSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
45e358ecaSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5b3307321Smrg# This file is free software; the Free Software Foundation
6b3307321Smrg# gives unlimited permission to copy and/or distribute it,
7b3307321Smrg# with or without modifications, as long as this notice is preserved.
8b3307321Smrg
9b3307321Smrg# This program is distributed in the hope that it will be useful,
10b3307321Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b3307321Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b3307321Smrg# PARTICULAR PURPOSE.
13b3307321Smrg
14afe13c8eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
15afe13c8eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1629cb5710Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1729cb5710Smrg[m4_warning([this file was generated for autoconf 2.68.
18afe13c8eSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19afe13c8eSmrgIf you have problems, you may need to regenerate the build system entirely.
20afe13c8eSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21b3307321Smrg
225e358ecaSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23afe13c8eSmrg#
245e358ecaSmrg# This file is free software; the Free Software Foundation
255e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
265e358ecaSmrg# with or without modifications, as long as this notice is preserved.
27b3307321Smrg
285e358ecaSmrg# AM_AUTOMAKE_VERSION(VERSION)
295e358ecaSmrg# ----------------------------
305e358ecaSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
315e358ecaSmrg# generated from the m4 files accompanying Automake X.Y.
325e358ecaSmrg# (This private macro should not be called outside this file.)
335e358ecaSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
345e358ecaSmrg[am__api_version='1.11'
355e358ecaSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
365e358ecaSmrgdnl require some minimum version.  Point them to the right macro.
3729cb5710Smrgm4_if([$1], [1.11.1], [],
385e358ecaSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
395e358ecaSmrg])
40b3307321Smrg
415e358ecaSmrg# _AM_AUTOCONF_VERSION(VERSION)
425e358ecaSmrg# -----------------------------
435e358ecaSmrg# aclocal traces this macro to find the Autoconf version.
445e358ecaSmrg# This is a private macro too.  Using m4_define simplifies
455e358ecaSmrg# the logic in aclocal, which can simply ignore this definition.
465e358ecaSmrgm4_define([_AM_AUTOCONF_VERSION], [])
47b3307321Smrg
485e358ecaSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
495e358ecaSmrg# -------------------------------
505e358ecaSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
515e358ecaSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
525e358ecaSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5329cb5710Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
545e358ecaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
555e358ecaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
565e358ecaSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57b3307321Smrg
585e358ecaSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59b3307321Smrg
605e358ecaSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
615e358ecaSmrg#
625e358ecaSmrg# This file is free software; the Free Software Foundation
635e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
645e358ecaSmrg# with or without modifications, as long as this notice is preserved.
65b3307321Smrg
665e358ecaSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
675e358ecaSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
685e358ecaSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
69afe13c8eSmrg#
705e358ecaSmrg# Of course, Automake must honor this variable whenever it calls a
715e358ecaSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
725e358ecaSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
735e358ecaSmrg# depending on how configure is run.  This is pretty annoying, since
745e358ecaSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
755e358ecaSmrg# source directory, any form will work fine, but in subdirectories a
765e358ecaSmrg# relative path needs to be adjusted first.
77afe13c8eSmrg#
785e358ecaSmrg# $ac_aux_dir/missing
795e358ecaSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
805e358ecaSmrg# $top_srcdir/$ac_aux_dir/missing
815e358ecaSmrg#    fails if $ac_aux_dir is absolute,
825e358ecaSmrg#    fails when called from a subdirectory in a VPATH build with
835e358ecaSmrg#          a relative $ac_aux_dir
84afe13c8eSmrg#
855e358ecaSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
865e358ecaSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
875e358ecaSmrg# harmless because $srcdir is `.', but things will broke when you
885e358ecaSmrg# start a VPATH build or use an absolute $srcdir.
89afe13c8eSmrg#
905e358ecaSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
915e358ecaSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
925e358ecaSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
935e358ecaSmrg# and then we would define $MISSING as
945e358ecaSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
955e358ecaSmrg# This will work as long as MISSING is not called from configure, because
965e358ecaSmrg# unfortunately $(top_srcdir) has no meaning in configure.
975e358ecaSmrg# However there are other variables, like CC, which are often used in
985e358ecaSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
995e358ecaSmrg#
1005e358ecaSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1015e358ecaSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1025e358ecaSmrg# configured tree to be moved without reconfiguration.
103b3307321Smrg
1045e358ecaSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1055e358ecaSmrg[dnl Rely on autoconf to set up CDPATH properly.
1065e358ecaSmrgAC_PREREQ([2.50])dnl
1075e358ecaSmrg# expand $ac_aux_dir to an absolute path
1085e358ecaSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1095e358ecaSmrg])
110b3307321Smrg
1115e358ecaSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112b3307321Smrg
1135e358ecaSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1145e358ecaSmrg# Free Software Foundation, Inc.
1155e358ecaSmrg#
1165e358ecaSmrg# This file is free software; the Free Software Foundation
1175e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
1185e358ecaSmrg# with or without modifications, as long as this notice is preserved.
119b3307321Smrg
1205e358ecaSmrg# serial 9
121b3307321Smrg
1225e358ecaSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1235e358ecaSmrg# -------------------------------------
1245e358ecaSmrg# Define a conditional.
1255e358ecaSmrgAC_DEFUN([AM_CONDITIONAL],
1265e358ecaSmrg[AC_PREREQ(2.52)dnl
1275e358ecaSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1285e358ecaSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1295e358ecaSmrgAC_SUBST([$1_TRUE])dnl
1305e358ecaSmrgAC_SUBST([$1_FALSE])dnl
1315e358ecaSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1325e358ecaSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1335e358ecaSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1345e358ecaSmrgif $2; then
1355e358ecaSmrg  $1_TRUE=
1365e358ecaSmrg  $1_FALSE='#'
1375e358ecaSmrgelse
1385e358ecaSmrg  $1_TRUE='#'
1395e358ecaSmrg  $1_FALSE=
1405e358ecaSmrgfi
1415e358ecaSmrgAC_CONFIG_COMMANDS_PRE(
1425e358ecaSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1435e358ecaSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1445e358ecaSmrgUsually this means the macro was only invoked conditionally.]])
1455e358ecaSmrgfi])])
146b3307321Smrg
1475e358ecaSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
1485e358ecaSmrg# Free Software Foundation, Inc.
1495e358ecaSmrg#
1505e358ecaSmrg# This file is free software; the Free Software Foundation
1515e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
1525e358ecaSmrg# with or without modifications, as long as this notice is preserved.
153b3307321Smrg
1545e358ecaSmrg# serial 10
155b3307321Smrg
1565e358ecaSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1575e358ecaSmrg# written in clear, in which case automake, when reading aclocal.m4,
1585e358ecaSmrg# will think it sees a *use*, and therefore will trigger all it's
1595e358ecaSmrg# C support machinery.  Also note that it means that autoscan, seeing
1605e358ecaSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161b3307321Smrg
162b3307321Smrg
1635e358ecaSmrg# _AM_DEPENDENCIES(NAME)
1645e358ecaSmrg# ----------------------
1655e358ecaSmrg# See how the compiler implements dependency checking.
1665e358ecaSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1675e358ecaSmrg# We try a few techniques and use that to set a single cache variable.
168afe13c8eSmrg#
1695e358ecaSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1705e358ecaSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1715e358ecaSmrg# dependency, and given that the user is not expected to run this macro,
1725e358ecaSmrg# just rely on AC_PROG_CC.
1735e358ecaSmrgAC_DEFUN([_AM_DEPENDENCIES],
1745e358ecaSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1755e358ecaSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1765e358ecaSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1775e358ecaSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178b3307321Smrg
1795e358ecaSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1805e358ecaSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1815e358ecaSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1825e358ecaSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1835e358ecaSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1845e358ecaSmrg                   [depcc="$$1"   am_compiler_list=])
185b3307321Smrg
1865e358ecaSmrgAC_CACHE_CHECK([dependency style of $depcc],
1875e358ecaSmrg               [am_cv_$1_dependencies_compiler_type],
1885e358ecaSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1895e358ecaSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1905e358ecaSmrg  # making bogus files that we don't know about and never remove.  For
1915e358ecaSmrg  # instance it was reported that on HP-UX the gcc test will end up
1925e358ecaSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
1935e358ecaSmrg  # in D'.
1945e358ecaSmrg  mkdir conftest.dir
1955e358ecaSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1965e358ecaSmrg  # using a relative directory.
1975e358ecaSmrg  cp "$am_depcomp" conftest.dir
1985e358ecaSmrg  cd conftest.dir
1995e358ecaSmrg  # We will build objects and dependencies in a subdirectory because
2005e358ecaSmrg  # it helps to detect inapplicable dependency modes.  For instance
2015e358ecaSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2025e358ecaSmrg  # side effect of compilation, but ICC will put the dependencies in
2035e358ecaSmrg  # the current directory while Tru64 will put them in the object
2045e358ecaSmrg  # directory.
2055e358ecaSmrg  mkdir sub
2065e358ecaSmrg
2075e358ecaSmrg  am_cv_$1_dependencies_compiler_type=none
2085e358ecaSmrg  if test "$am_compiler_list" = ""; then
2095e358ecaSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2105e358ecaSmrg  fi
2115e358ecaSmrg  am__universal=false
2125e358ecaSmrg  m4_case([$1], [CC],
2135e358ecaSmrg    [case " $depcc " in #(
2145e358ecaSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2155e358ecaSmrg     esac],
2165e358ecaSmrg    [CXX],
2175e358ecaSmrg    [case " $depcc " in #(
2185e358ecaSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2195e358ecaSmrg     esac])
2205e358ecaSmrg
2215e358ecaSmrg  for depmode in $am_compiler_list; do
2225e358ecaSmrg    # Setup a source with many dependencies, because some compilers
2235e358ecaSmrg    # like to wrap large dependency lists on column 80 (with \), and
2245e358ecaSmrg    # we should not choose a depcomp mode which is confused by this.
2255e358ecaSmrg    #
2265e358ecaSmrg    # We need to recreate these files for each test, as the compiler may
2275e358ecaSmrg    # overwrite some of them when testing with obscure command lines.
2285e358ecaSmrg    # This happens at least with the AIX C compiler.
2295e358ecaSmrg    : > sub/conftest.c
2305e358ecaSmrg    for i in 1 2 3 4 5 6; do
2315e358ecaSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2325e358ecaSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2335e358ecaSmrg      # Solaris 8's {/usr,}/bin/sh.
2345e358ecaSmrg      touch sub/conftst$i.h
2355e358ecaSmrg    done
2365e358ecaSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2375e358ecaSmrg
2385e358ecaSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2395e358ecaSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2405e358ecaSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
2415e358ecaSmrg    # versions had trouble with output in subdirs
2425e358ecaSmrg    am__obj=sub/conftest.${OBJEXT-o}
2435e358ecaSmrg    am__minus_obj="-o $am__obj"
2445e358ecaSmrg    case $depmode in
2455e358ecaSmrg    gcc)
2465e358ecaSmrg      # This depmode causes a compiler race in universal mode.
2475e358ecaSmrg      test "$am__universal" = false || continue
2485e358ecaSmrg      ;;
2495e358ecaSmrg    nosideeffect)
2505e358ecaSmrg      # after this tag, mechanisms are not by side-effect, so they'll
2515e358ecaSmrg      # only be used when explicitly requested
2525e358ecaSmrg      if test "x$enable_dependency_tracking" = xyes; then
2535e358ecaSmrg	continue
2545e358ecaSmrg      else
2555e358ecaSmrg	break
2565e358ecaSmrg      fi
2575e358ecaSmrg      ;;
2585e358ecaSmrg    msvisualcpp | msvcmsys)
2595e358ecaSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
2605e358ecaSmrg      # not run yet.  These depmodes are late enough in the game, and
2615e358ecaSmrg      # so weak that their functioning should not be impacted.
2625e358ecaSmrg      am__obj=conftest.${OBJEXT-o}
2635e358ecaSmrg      am__minus_obj=
2645e358ecaSmrg      ;;
2655e358ecaSmrg    none) break ;;
2665e358ecaSmrg    esac
2675e358ecaSmrg    if depmode=$depmode \
2685e358ecaSmrg       source=sub/conftest.c object=$am__obj \
2695e358ecaSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2705e358ecaSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2715e358ecaSmrg         >/dev/null 2>conftest.err &&
2725e358ecaSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2735e358ecaSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2745e358ecaSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2755e358ecaSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2765e358ecaSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2775e358ecaSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2785e358ecaSmrg      # that says an option was ignored or not supported.
2795e358ecaSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2805e358ecaSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2815e358ecaSmrg      # The diagnosis changed in icc 8.0:
2825e358ecaSmrg      #   icc: Command line remark: option '-MP' not supported
2835e358ecaSmrg      if (grep 'ignoring option' conftest.err ||
2845e358ecaSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2855e358ecaSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2865e358ecaSmrg        break
2875e358ecaSmrg      fi
2885e358ecaSmrg    fi
2895e358ecaSmrg  done
2905e358ecaSmrg
2915e358ecaSmrg  cd ..
2925e358ecaSmrg  rm -rf conftest.dir
293afe13c8eSmrgelse
2945e358ecaSmrg  am_cv_$1_dependencies_compiler_type=none
295afe13c8eSmrgfi
2965e358ecaSmrg])
2975e358ecaSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2985e358ecaSmrgAM_CONDITIONAL([am__fastdep$1], [
2995e358ecaSmrg  test "x$enable_dependency_tracking" != xno \
3005e358ecaSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3015e358ecaSmrg])
302b3307321Smrg
3035e358ecaSmrg
3045e358ecaSmrg# AM_SET_DEPDIR
3055e358ecaSmrg# -------------
3065e358ecaSmrg# Choose a directory name for dependency files.
3075e358ecaSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3085e358ecaSmrgAC_DEFUN([AM_SET_DEPDIR],
3095e358ecaSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3105e358ecaSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3115e358ecaSmrg])
3125e358ecaSmrg
3135e358ecaSmrg
3145e358ecaSmrg# AM_DEP_TRACK
3155e358ecaSmrg# ------------
3165e358ecaSmrgAC_DEFUN([AM_DEP_TRACK],
3175e358ecaSmrg[AC_ARG_ENABLE(dependency-tracking,
3185e358ecaSmrg[  --disable-dependency-tracking  speeds up one-time build
3195e358ecaSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3205e358ecaSmrgif test "x$enable_dependency_tracking" != xno; then
3215e358ecaSmrg  am_depcomp="$ac_aux_dir/depcomp"
3225e358ecaSmrg  AMDEPBACKSLASH='\'
323afe13c8eSmrgfi
3245e358ecaSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3255e358ecaSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3265e358ecaSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3275e358ecaSmrg])
328b3307321Smrg
3295e358ecaSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3305e358ecaSmrg
3315e358ecaSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
3325e358ecaSmrg# Free Software Foundation, Inc.
333b3307321Smrg#
3345e358ecaSmrg# This file is free software; the Free Software Foundation
3355e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
3365e358ecaSmrg# with or without modifications, as long as this notice is preserved.
337b3307321Smrg
3385e358ecaSmrg#serial 5
339b3307321Smrg
3405e358ecaSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3415e358ecaSmrg# ------------------------------
3425e358ecaSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3435e358ecaSmrg[{
3445e358ecaSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
3455e358ecaSmrg  # are listed without --file.  Let's play safe and only enable the eval
3465e358ecaSmrg  # if we detect the quoting.
3475e358ecaSmrg  case $CONFIG_FILES in
3485e358ecaSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3495e358ecaSmrg  *)   set x $CONFIG_FILES ;;
3505e358ecaSmrg  esac
3515e358ecaSmrg  shift
3525e358ecaSmrg  for mf
3535e358ecaSmrg  do
3545e358ecaSmrg    # Strip MF so we end up with the name of the file.
3555e358ecaSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3565e358ecaSmrg    # Check whether this is an Automake generated Makefile or not.
3575e358ecaSmrg    # We used to match only the files named `Makefile.in', but
3585e358ecaSmrg    # some people rename them; so instead we look at the file content.
3595e358ecaSmrg    # Grep'ing the first line is not enough: some people post-process
3605e358ecaSmrg    # each Makefile.in and add a new line on top of each file to say so.
3615e358ecaSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3625e358ecaSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3635e358ecaSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3645e358ecaSmrg      dirpart=`AS_DIRNAME("$mf")`
3655e358ecaSmrg    else
3665e358ecaSmrg      continue
3675e358ecaSmrg    fi
3685e358ecaSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3695e358ecaSmrg    # from the Makefile without running `make'.
3705e358ecaSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3715e358ecaSmrg    test -z "$DEPDIR" && continue
3725e358ecaSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3735e358ecaSmrg    test -z "am__include" && continue
3745e358ecaSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3755e358ecaSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
3765e358ecaSmrg    U=`sed -n 's/^U = //p' < "$mf"`
3775e358ecaSmrg    # Find all dependency output files, they are included files with
3785e358ecaSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3795e358ecaSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3805e358ecaSmrg    # expansion.
3815e358ecaSmrg    for file in `sed -n "
3825e358ecaSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3835e358ecaSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3845e358ecaSmrg      # Make sure the directory exists.
3855e358ecaSmrg      test -f "$dirpart/$file" && continue
3865e358ecaSmrg      fdir=`AS_DIRNAME(["$file"])`
3875e358ecaSmrg      AS_MKDIR_P([$dirpart/$fdir])
3885e358ecaSmrg      # echo "creating $dirpart/$file"
3895e358ecaSmrg      echo '# dummy' > "$dirpart/$file"
3905e358ecaSmrg    done
3915e358ecaSmrg  done
3925e358ecaSmrg}
3935e358ecaSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394b3307321Smrg
395b3307321Smrg
3965e358ecaSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3975e358ecaSmrg# -----------------------------
3985e358ecaSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3995e358ecaSmrg#
4005e358ecaSmrg# This code is only required when automatic dependency tracking
4015e358ecaSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
4025e358ecaSmrg# need in order to bootstrap the dependency handling code.
4035e358ecaSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4045e358ecaSmrg[AC_CONFIG_COMMANDS([depfiles],
4055e358ecaSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4065e358ecaSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4075e358ecaSmrg])
408b3307321Smrg
4095e358ecaSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4105e358ecaSmrg
4115e358ecaSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4125e358ecaSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4135e358ecaSmrg#
4145e358ecaSmrg# This file is free software; the Free Software Foundation
4155e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
4165e358ecaSmrg# with or without modifications, as long as this notice is preserved.
4175e358ecaSmrg
4185e358ecaSmrg# serial 16
4195e358ecaSmrg
4205e358ecaSmrg# This macro actually does too much.  Some checks are only needed if
4215e358ecaSmrg# your package does certain things.  But this isn't really a big deal.
4225e358ecaSmrg
4235e358ecaSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4245e358ecaSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4255e358ecaSmrg# -----------------------------------------------
4265e358ecaSmrg# The call with PACKAGE and VERSION arguments is the old style
4275e358ecaSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4285e358ecaSmrg# and VERSION should now be passed to AC_INIT and removed from
4295e358ecaSmrg# the call to AM_INIT_AUTOMAKE.
4305e358ecaSmrg# We support both call styles for the transition.  After
4315e358ecaSmrg# the next Automake release, Autoconf can make the AC_INIT
4325e358ecaSmrg# arguments mandatory, and then we can depend on a new Autoconf
4335e358ecaSmrg# release and drop the old call support.
4345e358ecaSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4355e358ecaSmrg[AC_PREREQ([2.62])dnl
4365e358ecaSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4375e358ecaSmrgdnl the ones we care about.
4385e358ecaSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4395e358ecaSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4405e358ecaSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4415e358ecaSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4425e358ecaSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4435e358ecaSmrg  # is not polluted with repeated "-I."
4445e358ecaSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4455e358ecaSmrg  # test to see if srcdir already configured
4465e358ecaSmrg  if test -f $srcdir/config.status; then
4475e358ecaSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4485e358ecaSmrg  fi
449afe13c8eSmrgfi
4505e358ecaSmrg
4515e358ecaSmrg# test whether we have cygpath
4525e358ecaSmrgif test -z "$CYGPATH_W"; then
4535e358ecaSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4545e358ecaSmrg    CYGPATH_W='cygpath -w'
4555e358ecaSmrg  else
4565e358ecaSmrg    CYGPATH_W=echo
4575e358ecaSmrg  fi
458b3307321Smrgfi
4595e358ecaSmrgAC_SUBST([CYGPATH_W])
460b3307321Smrg
4615e358ecaSmrg# Define the identity of the package.
4625e358ecaSmrgdnl Distinguish between old-style and new-style calls.
4635e358ecaSmrgm4_ifval([$2],
4645e358ecaSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4655e358ecaSmrg AC_SUBST([PACKAGE], [$1])dnl
4665e358ecaSmrg AC_SUBST([VERSION], [$2])],
4675e358ecaSmrg[_AM_SET_OPTIONS([$1])dnl
4685e358ecaSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4695e358ecaSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4705e358ecaSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4715e358ecaSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4725e358ecaSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473b3307321Smrg
4745e358ecaSmrg_AM_IF_OPTION([no-define],,
4755e358ecaSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4765e358ecaSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477b3307321Smrg
4785e358ecaSmrg# Some tools Automake needs.
4795e358ecaSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4805e358ecaSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4815e358ecaSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4825e358ecaSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4835e358ecaSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4845e358ecaSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4855e358ecaSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4865e358ecaSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4875e358ecaSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4885e358ecaSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4895e358ecaSmrg# We need awk for the "check" target.  The system "awk" is bad on
4905e358ecaSmrg# some platforms.
4915e358ecaSmrgAC_REQUIRE([AC_PROG_AWK])dnl
4925e358ecaSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
4935e358ecaSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
4945e358ecaSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4955e358ecaSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4965e358ecaSmrg			     [_AM_PROG_TAR([v7])])])
4975e358ecaSmrg_AM_IF_OPTION([no-dependencies],,
4985e358ecaSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
4995e358ecaSmrg		  [_AM_DEPENDENCIES(CC)],
5005e358ecaSmrg		  [define([AC_PROG_CC],
5015e358ecaSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5025e358ecaSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5035e358ecaSmrg		  [_AM_DEPENDENCIES(CXX)],
5045e358ecaSmrg		  [define([AC_PROG_CXX],
5055e358ecaSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5065e358ecaSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5075e358ecaSmrg		  [_AM_DEPENDENCIES(OBJC)],
5085e358ecaSmrg		  [define([AC_PROG_OBJC],
5095e358ecaSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
5105e358ecaSmrg])
5115e358ecaSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5125e358ecaSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5135e358ecaSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5145e358ecaSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5155e358ecaSmrgAC_CONFIG_COMMANDS_PRE(dnl
5165e358ecaSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5175e358ecaSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5185e358ecaSmrg])
519b3307321Smrg
5205e358ecaSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5215e358ecaSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5225e358ecaSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5235e358ecaSmrgm4_define([_AC_COMPILER_EXEEXT],
5245e358ecaSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525b3307321Smrg
526b3307321Smrg
5275e358ecaSmrg# When config.status generates a header, we must update the stamp-h file.
5285e358ecaSmrg# This file resides in the same directory as the config header
5295e358ecaSmrg# that is generated.  The stamp files are numbered to have different names.
5305e358ecaSmrg
5315e358ecaSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5325e358ecaSmrg# loop where config.status creates the headers, so we can generate
5335e358ecaSmrg# our stamp files there.
5345e358ecaSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5355e358ecaSmrg[# Compute $1's index in $config_headers.
5365e358ecaSmrg_am_arg=$1
5375e358ecaSmrg_am_stamp_count=1
5385e358ecaSmrgfor _am_header in $config_headers :; do
5395e358ecaSmrg  case $_am_header in
5405e358ecaSmrg    $_am_arg | $_am_arg:* )
5415e358ecaSmrg      break ;;
5425e358ecaSmrg    * )
5435e358ecaSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5445e358ecaSmrg  esac
5455e358ecaSmrgdone
5465e358ecaSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5475e358ecaSmrg
5485e358ecaSmrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
5495e358ecaSmrg#
5505e358ecaSmrg# This file is free software; the Free Software Foundation
5515e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
5525e358ecaSmrg# with or without modifications, as long as this notice is preserved.
553b3307321Smrg
5545e358ecaSmrg# AM_PROG_INSTALL_SH
5555e358ecaSmrg# ------------------
5565e358ecaSmrg# Define $install_sh.
5575e358ecaSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5585e358ecaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5595e358ecaSmrgif test x"${install_sh}" != xset; then
5605e358ecaSmrg  case $am_aux_dir in
5615e358ecaSmrg  *\ * | *\	*)
5625e358ecaSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5635e358ecaSmrg  *)
5645e358ecaSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5655e358ecaSmrg  esac
566afe13c8eSmrgfi
5675e358ecaSmrgAC_SUBST(install_sh)])
568b3307321Smrg
5695e358ecaSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5705e358ecaSmrg#
5715e358ecaSmrg# This file is free software; the Free Software Foundation
5725e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
5735e358ecaSmrg# with or without modifications, as long as this notice is preserved.
574b3307321Smrg
5755e358ecaSmrg# serial 2
576afe13c8eSmrg
5775e358ecaSmrg# Check whether the underlying file-system supports filenames
5785e358ecaSmrg# with a leading dot.  For instance MS-DOS doesn't.
5795e358ecaSmrgAC_DEFUN([AM_SET_LEADING_DOT],
5805e358ecaSmrg[rm -rf .tst 2>/dev/null
5815e358ecaSmrgmkdir .tst 2>/dev/null
5825e358ecaSmrgif test -d .tst; then
5835e358ecaSmrg  am__leading_dot=.
584b3307321Smrgelse
5855e358ecaSmrg  am__leading_dot=_
586b3307321Smrgfi
5875e358ecaSmrgrmdir .tst 2>/dev/null
5885e358ecaSmrgAC_SUBST([am__leading_dot])])
589b3307321Smrg
5905e358ecaSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
5915e358ecaSmrg# From Jim Meyering
592b3307321Smrg
5935e358ecaSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
5945e358ecaSmrg# Free Software Foundation, Inc.
5955e358ecaSmrg#
5965e358ecaSmrg# This file is free software; the Free Software Foundation
5975e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
5985e358ecaSmrg# with or without modifications, as long as this notice is preserved.
599b3307321Smrg
6005e358ecaSmrg# serial 5
601b3307321Smrg
6025e358ecaSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6035e358ecaSmrg# ----------------------------------
6045e358ecaSmrg# Control maintainer-specific portions of Makefiles.
6055e358ecaSmrg# Default is to disable them, unless `enable' is passed literally.
6065e358ecaSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
6075e358ecaSmrg# can override the default with the --enable/--disable switch.
6085e358ecaSmrgAC_DEFUN([AM_MAINTAINER_MODE],
6095e358ecaSmrg[m4_case(m4_default([$1], [disable]),
6105e358ecaSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
6115e358ecaSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
6125e358ecaSmrg       [m4_define([am_maintainer_other], [enable])
6135e358ecaSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6145e358ecaSmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
6155e358ecaSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6165e358ecaSmrg  AC_ARG_ENABLE([maintainer-mode],
6175e358ecaSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
6185e358ecaSmrg			  (and sometimes confusing) to the casual installer],
6195e358ecaSmrg      [USE_MAINTAINER_MODE=$enableval],
6205e358ecaSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6215e358ecaSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6225e358ecaSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6235e358ecaSmrg  MAINT=$MAINTAINER_MODE_TRUE
6245e358ecaSmrg  AC_SUBST([MAINT])dnl
6255e358ecaSmrg]
6265e358ecaSmrg)
627b3307321Smrg
6285e358ecaSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629afe13c8eSmrg
6305e358ecaSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631afe13c8eSmrg
6325e358ecaSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6335e358ecaSmrg#
6345e358ecaSmrg# This file is free software; the Free Software Foundation
6355e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
6365e358ecaSmrg# with or without modifications, as long as this notice is preserved.
637afe13c8eSmrg
6385e358ecaSmrg# serial 4
639b3307321Smrg
6405e358ecaSmrg# AM_MAKE_INCLUDE()
6415e358ecaSmrg# -----------------
6425e358ecaSmrg# Check to see how make treats includes.
6435e358ecaSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6445e358ecaSmrg[am_make=${MAKE-make}
6455e358ecaSmrgcat > confinc << 'END'
6465e358ecaSmrgam__doit:
6475e358ecaSmrg	@echo this is the am__doit target
6485e358ecaSmrg.PHONY: am__doit
6495e358ecaSmrgEND
6505e358ecaSmrg# If we don't find an include directive, just comment out the code.
6515e358ecaSmrgAC_MSG_CHECKING([for style of include used by $am_make])
6525e358ecaSmrgam__include="#"
6535e358ecaSmrgam__quote=
6545e358ecaSmrg_am_result=none
6555e358ecaSmrg# First try GNU make style include.
6565e358ecaSmrgecho "include confinc" > confmf
6575e358ecaSmrg# Ignore all kinds of additional output from `make'.
6585e358ecaSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6595e358ecaSmrg*the\ am__doit\ target*)
6605e358ecaSmrg  am__include=include
6615e358ecaSmrg  am__quote=
6625e358ecaSmrg  _am_result=GNU
6635e358ecaSmrg  ;;
6645e358ecaSmrgesac
6655e358ecaSmrg# Now try BSD make style include.
6665e358ecaSmrgif test "$am__include" = "#"; then
6675e358ecaSmrg   echo '.include "confinc"' > confmf
6685e358ecaSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6695e358ecaSmrg   *the\ am__doit\ target*)
6705e358ecaSmrg     am__include=.include
6715e358ecaSmrg     am__quote="\""
6725e358ecaSmrg     _am_result=BSD
6735e358ecaSmrg     ;;
6745e358ecaSmrg   esac
675afe13c8eSmrgfi
6765e358ecaSmrgAC_SUBST([am__include])
6775e358ecaSmrgAC_SUBST([am__quote])
6785e358ecaSmrgAC_MSG_RESULT([$_am_result])
6795e358ecaSmrgrm -f confinc confmf
6805e358ecaSmrg])
681b3307321Smrg
6825e358ecaSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
683b3307321Smrg
6845e358ecaSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
6855e358ecaSmrg# Free Software Foundation, Inc.
6865e358ecaSmrg#
6875e358ecaSmrg# This file is free software; the Free Software Foundation
6885e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
6895e358ecaSmrg# with or without modifications, as long as this notice is preserved.
690b3307321Smrg
6915e358ecaSmrg# serial 6
692b3307321Smrg
6935e358ecaSmrg# AM_MISSING_PROG(NAME, PROGRAM)
6945e358ecaSmrg# ------------------------------
6955e358ecaSmrgAC_DEFUN([AM_MISSING_PROG],
6965e358ecaSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6975e358ecaSmrg$1=${$1-"${am_missing_run}$2"}
6985e358ecaSmrgAC_SUBST($1)])
699b3307321Smrg
700b3307321Smrg
7015e358ecaSmrg# AM_MISSING_HAS_RUN
7025e358ecaSmrg# ------------------
7035e358ecaSmrg# Define MISSING if not defined so far and test if it supports --run.
7045e358ecaSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
7055e358ecaSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7065e358ecaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7075e358ecaSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7085e358ecaSmrgif test x"${MISSING+set}" != xset; then
7095e358ecaSmrg  case $am_aux_dir in
7105e358ecaSmrg  *\ * | *\	*)
7115e358ecaSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7125e358ecaSmrg  *)
7135e358ecaSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7145e358ecaSmrg  esac
715afe13c8eSmrgfi
7165e358ecaSmrg# Use eval to expand $SHELL
7175e358ecaSmrgif eval "$MISSING --run true"; then
7185e358ecaSmrg  am_missing_run="$MISSING --run "
719afe13c8eSmrgelse
7205e358ecaSmrg  am_missing_run=
7215e358ecaSmrg  AC_MSG_WARN([`missing' script is too old or missing])
722afe13c8eSmrgfi
7235e358ecaSmrg])
724b3307321Smrg
7255e358ecaSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726afe13c8eSmrg#
7275e358ecaSmrg# This file is free software; the Free Software Foundation
7285e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
7295e358ecaSmrg# with or without modifications, as long as this notice is preserved.
730b3307321Smrg
7315e358ecaSmrg# AM_PROG_MKDIR_P
7325e358ecaSmrg# ---------------
7335e358ecaSmrg# Check for `mkdir -p'.
7345e358ecaSmrgAC_DEFUN([AM_PROG_MKDIR_P],
7355e358ecaSmrg[AC_PREREQ([2.60])dnl
7365e358ecaSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7375e358ecaSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7385e358ecaSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
7395e358ecaSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7405e358ecaSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7415e358ecaSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7425e358ecaSmrgdnl adjustment using top_builddir (which is defined more often than
7435e358ecaSmrgdnl MKDIR_P).
7445e358ecaSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7455e358ecaSmrgcase $mkdir_p in
7465e358ecaSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7475e358ecaSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7485e358ecaSmrgesac
7495e358ecaSmrg])
750b3307321Smrg
7515e358ecaSmrg# Helper functions for option handling.                     -*- Autoconf -*-
752b3307321Smrg
7535e358ecaSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754afe13c8eSmrg#
7555e358ecaSmrg# This file is free software; the Free Software Foundation
7565e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
7575e358ecaSmrg# with or without modifications, as long as this notice is preserved.
758b3307321Smrg
7595e358ecaSmrg# serial 4
760b3307321Smrg
7615e358ecaSmrg# _AM_MANGLE_OPTION(NAME)
7625e358ecaSmrg# -----------------------
7635e358ecaSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7645e358ecaSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
765b3307321Smrg
7665e358ecaSmrg# _AM_SET_OPTION(NAME)
7675e358ecaSmrg# ------------------------------
7685e358ecaSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7695e358ecaSmrgAC_DEFUN([_AM_SET_OPTION],
7705e358ecaSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
771b3307321Smrg
7725e358ecaSmrg# _AM_SET_OPTIONS(OPTIONS)
7735e358ecaSmrg# ----------------------------------
7745e358ecaSmrg# OPTIONS is a space-separated list of Automake options.
7755e358ecaSmrgAC_DEFUN([_AM_SET_OPTIONS],
7765e358ecaSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
777b3307321Smrg
7785e358ecaSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7795e358ecaSmrg# -------------------------------------------
7805e358ecaSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7815e358ecaSmrgAC_DEFUN([_AM_IF_OPTION],
7825e358ecaSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7835e358ecaSmrg
7845e358ecaSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7855e358ecaSmrg
7865e358ecaSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
7875e358ecaSmrg# Free Software Foundation, Inc.
788afe13c8eSmrg#
789afe13c8eSmrg# This file is free software; the Free Software Foundation
790afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
791afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
792b3307321Smrg
7935e358ecaSmrg# serial 5
794b3307321Smrg
7955e358ecaSmrg# AM_SANITY_CHECK
7965e358ecaSmrg# ---------------
7975e358ecaSmrgAC_DEFUN([AM_SANITY_CHECK],
7985e358ecaSmrg[AC_MSG_CHECKING([whether build environment is sane])
7995e358ecaSmrg# Just in case
8005e358ecaSmrgsleep 1
8015e358ecaSmrgecho timestamp > conftest.file
8025e358ecaSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8035e358ecaSmrg# name.  Accept space and tab only in the latter.
8045e358ecaSmrgam_lf='
8055e358ecaSmrg'
8065e358ecaSmrgcase `pwd` in
8075e358ecaSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8085e358ecaSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8095e358ecaSmrgesac
8105e358ecaSmrgcase $srcdir in
8115e358ecaSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8125e358ecaSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8135e358ecaSmrgesac
814b3307321Smrg
8155e358ecaSmrg# Do `set' in a subshell so we don't clobber the current shell's
8165e358ecaSmrg# arguments.  Must try -L first in case configure is actually a
8175e358ecaSmrg# symlink; some systems play weird games with the mod time of symlinks
8185e358ecaSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8195e358ecaSmrg# directory).
8205e358ecaSmrgif (
8215e358ecaSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8225e358ecaSmrg   if test "$[*]" = "X"; then
8235e358ecaSmrg      # -L didn't work.
8245e358ecaSmrg      set X `ls -t "$srcdir/configure" conftest.file`
8255e358ecaSmrg   fi
8265e358ecaSmrg   rm -f conftest.file
8275e358ecaSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
8285e358ecaSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
829b3307321Smrg
8305e358ecaSmrg      # If neither matched, then we have a broken ls.  This can happen
8315e358ecaSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
8325e358ecaSmrg      # broken ls alias from the environment.  This has actually
8335e358ecaSmrg      # happened.  Such a system could not be considered "sane".
8345e358ecaSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8355e358ecaSmrgalias in your environment])
8365e358ecaSmrg   fi
837b3307321Smrg
8385e358ecaSmrg   test "$[2]" = conftest.file
8395e358ecaSmrg   )
8405e358ecaSmrgthen
8415e358ecaSmrg   # Ok.
8425e358ecaSmrg   :
8435e358ecaSmrgelse
8445e358ecaSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8455e358ecaSmrgCheck your system clock])
8465e358ecaSmrgfi
8475e358ecaSmrgAC_MSG_RESULT(yes)])
8485e358ecaSmrg
8495e358ecaSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
850afe13c8eSmrg#
851afe13c8eSmrg# This file is free software; the Free Software Foundation
852afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
853afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
854b3307321Smrg
8555e358ecaSmrg# serial 1
856b3307321Smrg
8575e358ecaSmrg# AM_SILENT_RULES([DEFAULT])
8585e358ecaSmrg# --------------------------
8595e358ecaSmrg# Enable less verbose build rules; with the default set to DEFAULT
8605e358ecaSmrg# (`yes' being less verbose, `no' or empty being verbose).
8615e358ecaSmrgAC_DEFUN([AM_SILENT_RULES],
8625e358ecaSmrg[AC_ARG_ENABLE([silent-rules],
8635e358ecaSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8645e358ecaSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8655e358ecaSmrgcase $enable_silent_rules in
8665e358ecaSmrgyes) AM_DEFAULT_VERBOSITY=0;;
8675e358ecaSmrgno)  AM_DEFAULT_VERBOSITY=1;;
8685e358ecaSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8695e358ecaSmrgesac
8705e358ecaSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8715e358ecaSmrgAM_BACKSLASH='\'
8725e358ecaSmrgAC_SUBST([AM_BACKSLASH])dnl
8735e358ecaSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874afe13c8eSmrg])
875afe13c8eSmrg
8765e358ecaSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
8775e358ecaSmrg#
8785e358ecaSmrg# This file is free software; the Free Software Foundation
8795e358ecaSmrg# gives unlimited permission to copy and/or distribute it,
8805e358ecaSmrg# with or without modifications, as long as this notice is preserved.
8815e358ecaSmrg
8825e358ecaSmrg# AM_PROG_INSTALL_STRIP
8835e358ecaSmrg# ---------------------
8845e358ecaSmrg# One issue with vendor `install' (even GNU) is that you can't
8855e358ecaSmrg# specify the program used to strip binaries.  This is especially
8865e358ecaSmrg# annoying in cross-compiling environments, where the build's strip
8875e358ecaSmrg# is unlikely to handle the host's binaries.
8885e358ecaSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
8895e358ecaSmrg# always use install-sh in `make install-strip', and initialize
8905e358ecaSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
8915e358ecaSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
8925e358ecaSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
8935e358ecaSmrg# Installed binaries are usually stripped using `strip' when the user
8945e358ecaSmrg# run `make install-strip'.  However `strip' might not be the right
8955e358ecaSmrg# tool to use in cross-compilation environments, therefore Automake
8965e358ecaSmrg# will honor the `STRIP' environment variable to overrule this program.
8975e358ecaSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
8985e358ecaSmrgif test "$cross_compiling" != no; then
8995e358ecaSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9005e358ecaSmrgfi
9015e358ecaSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9025e358ecaSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903afe13c8eSmrg
9045e358ecaSmrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
905afe13c8eSmrg#
906afe13c8eSmrg# This file is free software; the Free Software Foundation
907afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
908afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
909afe13c8eSmrg
9105e358ecaSmrg# serial 2
911afe13c8eSmrg
9125e358ecaSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
9135e358ecaSmrg# ---------------------------
9145e358ecaSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9155e358ecaSmrg# This macro is traced by Automake.
9165e358ecaSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
917afe13c8eSmrg
9185e358ecaSmrg# AM_SUBST_NOTMAKE(VARIABLE)
9195e358ecaSmrg# ---------------------------
9205e358ecaSmrg# Public sister of _AM_SUBST_NOTMAKE.
9215e358ecaSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9225e358ecaSmrg
9235e358ecaSmrg# Check how to create a tarball.                            -*- Autoconf -*-
9245e358ecaSmrg
9255e358ecaSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
926afe13c8eSmrg#
927afe13c8eSmrg# This file is free software; the Free Software Foundation
928afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
929afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
930b3307321Smrg
9315e358ecaSmrg# serial 2
932b3307321Smrg
9335e358ecaSmrg# _AM_PROG_TAR(FORMAT)
9345e358ecaSmrg# --------------------
9355e358ecaSmrg# Check how to create a tarball in format FORMAT.
9365e358ecaSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
937b3307321Smrg#
9385e358ecaSmrg# Substitute a variable $(am__tar) that is a command
9395e358ecaSmrg# writing to stdout a FORMAT-tarball containing the directory
9405e358ecaSmrg# $tardir.
9415e358ecaSmrg#     tardir=directory && $(am__tar) > result.tar
9425e358ecaSmrg#
9435e358ecaSmrg# Substitute a variable $(am__untar) that extract such
9445e358ecaSmrg# a tarball read from stdin.
9455e358ecaSmrg#     $(am__untar) < result.tar
9465e358ecaSmrgAC_DEFUN([_AM_PROG_TAR],
9475e358ecaSmrg[# Always define AMTAR for backward compatibility.
9485e358ecaSmrgAM_MISSING_PROG([AMTAR], [tar])
9495e358ecaSmrgm4_if([$1], [v7],
9505e358ecaSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
9515e358ecaSmrg     [m4_case([$1], [ustar],, [pax],,
9525e358ecaSmrg              [m4_fatal([Unknown tar format])])
9535e358ecaSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
9545e358ecaSmrg# Loop over all known methods to create a tar archive until one works.
9555e358ecaSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9565e358ecaSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
9575e358ecaSmrg# Do not fold the above two line into one, because Tru64 sh and
9585e358ecaSmrg# Solaris sh will not grok spaces in the rhs of `-'.
9595e358ecaSmrgfor _am_tool in $_am_tools
9605e358ecaSmrgdo
9615e358ecaSmrg  case $_am_tool in
9625e358ecaSmrg  gnutar)
9635e358ecaSmrg    for _am_tar in tar gnutar gtar;
9645e358ecaSmrg    do
9655e358ecaSmrg      AM_RUN_LOG([$_am_tar --version]) && break
9665e358ecaSmrg    done
9675e358ecaSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
9685e358ecaSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
9695e358ecaSmrg    am__untar="$_am_tar -xf -"
9705e358ecaSmrg    ;;
9715e358ecaSmrg  plaintar)
9725e358ecaSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
9735e358ecaSmrg    # ustar tarball either.
9745e358ecaSmrg    (tar --version) >/dev/null 2>&1 && continue
9755e358ecaSmrg    am__tar='tar chf - "$$tardir"'
9765e358ecaSmrg    am__tar_='tar chf - "$tardir"'
9775e358ecaSmrg    am__untar='tar xf -'
9785e358ecaSmrg    ;;
9795e358ecaSmrg  pax)
9805e358ecaSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
9815e358ecaSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
9825e358ecaSmrg    am__untar='pax -r'
9835e358ecaSmrg    ;;
9845e358ecaSmrg  cpio)
9855e358ecaSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
9865e358ecaSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
9875e358ecaSmrg    am__untar='cpio -i -H $1 -d'
9885e358ecaSmrg    ;;
9895e358ecaSmrg  none)
9905e358ecaSmrg    am__tar=false
9915e358ecaSmrg    am__tar_=false
9925e358ecaSmrg    am__untar=false
9935e358ecaSmrg    ;;
9945e358ecaSmrg  esac
995b3307321Smrg
9965e358ecaSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
9975e358ecaSmrg  # and am__untar set.
9985e358ecaSmrg  test -n "${am_cv_prog_tar_$1}" && break
999b3307321Smrg
10005e358ecaSmrg  # tar/untar a dummy directory, and stop if the command works
10015e358ecaSmrg  rm -rf conftest.dir
1002b3307321Smrg  mkdir conftest.dir
10035e358ecaSmrg  echo GrepMe > conftest.dir/file
10045e358ecaSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
10055e358ecaSmrg  rm -rf conftest.dir
10065e358ecaSmrg  if test -s conftest.tar; then
10075e358ecaSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
10085e358ecaSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1009b3307321Smrg  fi
10105e358ecaSmrgdone
10115e358ecaSmrgrm -rf conftest.dir
1012b3307321Smrg
10135e358ecaSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
10145e358ecaSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
10155e358ecaSmrgAC_SUBST([am__tar])
10165e358ecaSmrgAC_SUBST([am__untar])
10175e358ecaSmrg]) # _AM_PROG_TAR
1018b3307321Smrg
1019320e696bSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1020320e696bSmrg# 
1021320e696bSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1022320e696bSmrg#
1023320e696bSmrg# This program is free software; you can redistribute it and/or modify
1024320e696bSmrg# it under the terms of the GNU General Public License as published by
1025320e696bSmrg# the Free Software Foundation; either version 2 of the License, or
1026320e696bSmrg# (at your option) any later version.
1027320e696bSmrg#
1028320e696bSmrg# This program is distributed in the hope that it will be useful, but
1029320e696bSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1030320e696bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1031320e696bSmrg# General Public License for more details.
1032320e696bSmrg#
1033320e696bSmrg# You should have received a copy of the GNU General Public License
1034320e696bSmrg# along with this program; if not, write to the Free Software
1035320e696bSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1036320e696bSmrg#
1037320e696bSmrg# As a special exception to the GNU General Public License, if you
1038320e696bSmrg# distribute this file as part of a program that contains a
1039320e696bSmrg# configuration script generated by Autoconf, you may include it under
1040320e696bSmrg# the same distribution terms that you use for the rest of that program.
1041320e696bSmrg
1042320e696bSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1043320e696bSmrg# ----------------------------------
1044320e696bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1045320e696bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1046320e696bSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1047320e696bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1048320e696bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1049320e696bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1050320e696bSmrgfi
1051320e696bSmrgif test -n "$PKG_CONFIG"; then
1052320e696bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1053320e696bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1054320e696bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1055320e696bSmrg		AC_MSG_RESULT([yes])
1056320e696bSmrg	else
1057320e696bSmrg		AC_MSG_RESULT([no])
1058320e696bSmrg		PKG_CONFIG=""
1059320e696bSmrg	fi
1060320e696bSmrg		
1061320e696bSmrgfi[]dnl
1062320e696bSmrg])# PKG_PROG_PKG_CONFIG
1063320e696bSmrg
1064320e696bSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1065320e696bSmrg#
1066320e696bSmrg# Check to see whether a particular set of modules exists.  Similar
1067320e696bSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1068320e696bSmrg#
1069320e696bSmrg#
1070320e696bSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1071320e696bSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
1072320e696bSmrg# PKG_CHECK_EXISTS manually
1073320e696bSmrg# --------------------------------------------------------------
1074320e696bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1075320e696bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1076320e696bSmrgif test -n "$PKG_CONFIG" && \
1077320e696bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1078320e696bSmrg  m4_ifval([$2], [$2], [:])
1079320e696bSmrgm4_ifvaln([$3], [else
1080320e696bSmrg  $3])dnl
1081320e696bSmrgfi])
1082320e696bSmrg
1083320e696bSmrg
1084320e696bSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1085320e696bSmrg# ---------------------------------------------
1086320e696bSmrgm4_define([_PKG_CONFIG],
1087320e696bSmrg[if test -n "$$1"; then
1088320e696bSmrg    pkg_cv_[]$1="$$1"
1089320e696bSmrg elif test -n "$PKG_CONFIG"; then
1090320e696bSmrg    PKG_CHECK_EXISTS([$3],
1091320e696bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1092320e696bSmrg		     [pkg_failed=yes])
1093320e696bSmrg else
1094320e696bSmrg    pkg_failed=untried
1095320e696bSmrgfi[]dnl
1096320e696bSmrg])# _PKG_CONFIG
1097320e696bSmrg
1098320e696bSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1099320e696bSmrg# -----------------------------
1100320e696bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1101320e696bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1102320e696bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1103320e696bSmrg        _pkg_short_errors_supported=yes
1104320e696bSmrgelse
1105320e696bSmrg        _pkg_short_errors_supported=no
1106320e696bSmrgfi[]dnl
1107320e696bSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1108320e696bSmrg
1109320e696bSmrg
1110320e696bSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1111320e696bSmrg# [ACTION-IF-NOT-FOUND])
1112320e696bSmrg#
1113320e696bSmrg#
1114320e696bSmrg# Note that if there is a possibility the first call to
1115320e696bSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1116320e696bSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1117320e696bSmrg#
1118320e696bSmrg#
1119320e696bSmrg# --------------------------------------------------------------
1120320e696bSmrgAC_DEFUN([PKG_CHECK_MODULES],
1121320e696bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1122320e696bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1123320e696bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1124320e696bSmrg
1125320e696bSmrgpkg_failed=no
1126320e696bSmrgAC_MSG_CHECKING([for $1])
1127320e696bSmrg
1128320e696bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1129320e696bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1130320e696bSmrg
1131320e696bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1132320e696bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1133320e696bSmrgSee the pkg-config man page for more details.])
1134320e696bSmrg
1135320e696bSmrgif test $pkg_failed = yes; then
1136320e696bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1137320e696bSmrg        if test $_pkg_short_errors_supported = yes; then
1138320e696bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1139320e696bSmrg        else 
1140320e696bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1141320e696bSmrg        fi
1142320e696bSmrg	# Put the nasty error message in config.log where it belongs
1143320e696bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1144320e696bSmrg
1145320e696bSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1146320e696bSmrg[Package requirements ($2) were not met:
1147320e696bSmrg
1148320e696bSmrg$$1_PKG_ERRORS
1149320e696bSmrg
1150320e696bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1151320e696bSmrginstalled software in a non-standard prefix.
1152320e696bSmrg
1153320e696bSmrg_PKG_TEXT
1154320e696bSmrg])],
1155320e696bSmrg		[AC_MSG_RESULT([no])
1156320e696bSmrg                $4])
1157320e696bSmrgelif test $pkg_failed = untried; then
1158320e696bSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1159320e696bSmrg[The pkg-config script could not be found or is too old.  Make sure it
1160320e696bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1161320e696bSmrgpath to pkg-config.
1162320e696bSmrg
1163320e696bSmrg_PKG_TEXT
1164320e696bSmrg
1165320e696bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1166320e696bSmrg		[$4])
1167320e696bSmrgelse
1168320e696bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1169320e696bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1170320e696bSmrg        AC_MSG_RESULT([yes])
1171320e696bSmrg	ifelse([$3], , :, [$3])
1172320e696bSmrgfi[]dnl
1173320e696bSmrg])# PKG_CHECK_MODULES
1174320e696bSmrg
11755e358ecaSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
11765e358ecaSmrgdnl
117729cb5710Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
11785e358ecaSmrgdnl 
11795e358ecaSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
118029cb5710Smrgdnl copy of this software and associated documentation files (the "Software"),
118129cb5710Smrgdnl to deal in the Software without restriction, including without limitation
118229cb5710Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
118329cb5710Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
118429cb5710Smrgdnl Software is furnished to do so, subject to the following conditions:
11855e358ecaSmrgdnl
118629cb5710Smrgdnl The above copyright notice and this permission notice (including the next
118729cb5710Smrgdnl paragraph) shall be included in all copies or substantial portions of the
118829cb5710Smrgdnl Software.
11895e358ecaSmrgdnl
119029cb5710Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
119129cb5710Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119229cb5710Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
119329cb5710Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119429cb5710Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
119529cb5710Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
119629cb5710Smrgdnl DEALINGS IN THE SOFTWARE.
1197b3307321Smrg
11985e358ecaSmrg# XORG_MACROS_VERSION(required-version)
11995e358ecaSmrg# -------------------------------------
12005e358ecaSmrg# Minimum version: 1.1.0
12015e358ecaSmrg#
12025e358ecaSmrg# If you're using a macro added in Version 1.1 or newer, include this in
12035e358ecaSmrg# your configure.ac with the minimum required version, such as:
12045e358ecaSmrg# XORG_MACROS_VERSION(1.1)
12055e358ecaSmrg#
12065e358ecaSmrg# To ensure that this macro is defined, also add:
12075e358ecaSmrg# m4_ifndef([XORG_MACROS_VERSION],
12085e358ecaSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
12095e358ecaSmrg#
12105e358ecaSmrg#
12115e358ecaSmrg# See the "minimum version" comment for each macro you use to see what 
12125e358ecaSmrg# version you require.
12135e358ecaSmrgm4_defun([XORG_MACROS_VERSION],[
1214320e696bSmrgm4_define([vers_have], [1.16.1])
12155e358ecaSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
12165e358ecaSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
12175e358ecaSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
12185e358ecaSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
12195e358ecaSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
12205e358ecaSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
12215e358ecaSmrgm4_undefine([vers_have])
12225e358ecaSmrgm4_undefine([maj_have])
12235e358ecaSmrgm4_undefine([maj_needed])
12245e358ecaSmrg]) # XORG_MACROS_VERSION
1225b3307321Smrg
12265e358ecaSmrg# XORG_PROG_RAWCPP()
12275e358ecaSmrg# ------------------
12285e358ecaSmrg# Minimum version: 1.0.0
12295e358ecaSmrg#
12305e358ecaSmrg# Find cpp program and necessary flags for use in pre-processing text files
12315e358ecaSmrg# such as man pages and config files
12325e358ecaSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
12335e358ecaSmrgAC_REQUIRE([AC_PROG_CPP])
12345e358ecaSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
12355e358ecaSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1236b3307321Smrg
12375e358ecaSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
12385e358ecaSmrg# which is not the best choice for supporting other OS'es, but covers most
12395e358ecaSmrg# of the ones we need for now.
12405e358ecaSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1241320e696bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
12425e358ecaSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12435e358ecaSmrg	AC_MSG_RESULT([no])
12445e358ecaSmrgelse
12455e358ecaSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12465e358ecaSmrg		RAWCPPFLAGS=-undef
12475e358ecaSmrg		AC_MSG_RESULT([yes])
12485e358ecaSmrg	# under Cygwin unix is still defined even with -undef
12495e358ecaSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12505e358ecaSmrg		RAWCPPFLAGS="-undef -ansi"
12515e358ecaSmrg		AC_MSG_RESULT([yes, with -ansi])
12525e358ecaSmrg	else
12535e358ecaSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
12545e358ecaSmrg	fi
1255b3307321Smrgfi
12565e358ecaSmrgrm -f conftest.$ac_ext
1257b3307321Smrg
12585e358ecaSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1259320e696bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
12605e358ecaSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12615e358ecaSmrg	AC_MSG_RESULT([no])
12625e358ecaSmrgelse
12635e358ecaSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12645e358ecaSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
12655e358ecaSmrg		AC_MSG_RESULT([yes])
12665e358ecaSmrg	else
12675e358ecaSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
12685e358ecaSmrg	fi
12695e358ecaSmrgfi
12705e358ecaSmrgrm -f conftest.$ac_ext
12715e358ecaSmrgAC_SUBST(RAWCPPFLAGS)
12725e358ecaSmrg]) # XORG_PROG_RAWCPP
1273b3307321Smrg
12745e358ecaSmrg# XORG_MANPAGE_SECTIONS()
12755e358ecaSmrg# -----------------------
12765e358ecaSmrg# Minimum version: 1.0.0
1277afe13c8eSmrg#
12785e358ecaSmrg# Determine which sections man pages go in for the different man page types
12795e358ecaSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
12805e358ecaSmrg# Not sure if there's any better way than just hardcoding by OS name.
12815e358ecaSmrg# Override default settings by setting environment variables
128229cb5710Smrg# Added MAN_SUBSTS in version 1.8
128329cb5710Smrg# Added AC_PROG_SED in version 1.8
1284b3307321Smrg
12855e358ecaSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
12865e358ecaSmrgAC_REQUIRE([AC_CANONICAL_HOST])
128729cb5710SmrgAC_REQUIRE([AC_PROG_SED])
1288b3307321Smrg
12895e358ecaSmrgif test x$APP_MAN_SUFFIX = x    ; then
12905e358ecaSmrg    APP_MAN_SUFFIX=1
12915e358ecaSmrgfi
12925e358ecaSmrgif test x$APP_MAN_DIR = x    ; then
12935e358ecaSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
12945e358ecaSmrgfi
1295b3307321Smrg
12965e358ecaSmrgif test x$LIB_MAN_SUFFIX = x    ; then
12975e358ecaSmrg    LIB_MAN_SUFFIX=3
12985e358ecaSmrgfi
12995e358ecaSmrgif test x$LIB_MAN_DIR = x    ; then
13005e358ecaSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13015e358ecaSmrgfi
1302b3307321Smrg
13035e358ecaSmrgif test x$FILE_MAN_SUFFIX = x    ; then
13045e358ecaSmrg    case $host_os in
13055e358ecaSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
13065e358ecaSmrg	*)		FILE_MAN_SUFFIX=5  ;;
13075e358ecaSmrg    esac
13085e358ecaSmrgfi
13095e358ecaSmrgif test x$FILE_MAN_DIR = x    ; then
13105e358ecaSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
13115e358ecaSmrgfi
1312b3307321Smrg
13135e358ecaSmrgif test x$MISC_MAN_SUFFIX = x    ; then
13145e358ecaSmrg    case $host_os in
13155e358ecaSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
13165e358ecaSmrg	*)		MISC_MAN_SUFFIX=7  ;;
13175e358ecaSmrg    esac
13185e358ecaSmrgfi
13195e358ecaSmrgif test x$MISC_MAN_DIR = x    ; then
13205e358ecaSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
13215e358ecaSmrgfi
1322b3307321Smrg
13235e358ecaSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
13245e358ecaSmrg    case $host_os in
13255e358ecaSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
13265e358ecaSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
13275e358ecaSmrg    esac
13285e358ecaSmrgfi
13295e358ecaSmrgif test x$DRIVER_MAN_DIR = x    ; then
13305e358ecaSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13315e358ecaSmrgfi
1332b3307321Smrg
13335e358ecaSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
13345e358ecaSmrg    case $host_os in
13355e358ecaSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
13365e358ecaSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
13375e358ecaSmrg    esac
13385e358ecaSmrgfi
13395e358ecaSmrgif test x$ADMIN_MAN_DIR = x    ; then
13405e358ecaSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13415e358ecaSmrgfi
1342b3307321Smrg
1343b3307321Smrg
13445e358ecaSmrgAC_SUBST([APP_MAN_SUFFIX])
13455e358ecaSmrgAC_SUBST([LIB_MAN_SUFFIX])
13465e358ecaSmrgAC_SUBST([FILE_MAN_SUFFIX])
13475e358ecaSmrgAC_SUBST([MISC_MAN_SUFFIX])
13485e358ecaSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
13495e358ecaSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
13505e358ecaSmrgAC_SUBST([APP_MAN_DIR])
13515e358ecaSmrgAC_SUBST([LIB_MAN_DIR])
13525e358ecaSmrgAC_SUBST([FILE_MAN_DIR])
13535e358ecaSmrgAC_SUBST([MISC_MAN_DIR])
13545e358ecaSmrgAC_SUBST([DRIVER_MAN_DIR])
13555e358ecaSmrgAC_SUBST([ADMIN_MAN_DIR])
135629cb5710Smrg
135729cb5710SmrgXORG_MAN_PAGE="X Version 11"
135829cb5710SmrgAC_SUBST([XORG_MAN_PAGE])
135929cb5710SmrgMAN_SUBSTS="\
136029cb5710Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136129cb5710Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136229cb5710Smrg	-e 's|__xservername__|Xorg|g' \
136329cb5710Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
136429cb5710Smrg	-e 's|__projectroot__|\$(prefix)|g' \
136529cb5710Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
136629cb5710Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
136729cb5710Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
136829cb5710Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
136929cb5710Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
137029cb5710Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
137129cb5710Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
137229cb5710SmrgAC_SUBST([MAN_SUBSTS])
137329cb5710Smrg
13745e358ecaSmrg]) # XORG_MANPAGE_SECTIONS
13755e358ecaSmrg
137629cb5710Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
137729cb5710Smrg# ------------------------
137829cb5710Smrg# Minimum version: 1.7.0
137929cb5710Smrg#
138029cb5710Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
138129cb5710Smrg# provided by xorg-sgml-doctools, if installed.
138229cb5710SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
138329cb5710SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
138429cb5710SmrgXORG_SGML_PATH=
138529cb5710SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
138629cb5710Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
138729cb5710Smrg    [m4_ifval([$1],[:],
138829cb5710Smrg        [if test x"$cross_compiling" != x"yes" ; then
138929cb5710Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
139029cb5710Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
139129cb5710Smrg         fi])
139229cb5710Smrg    ])
139329cb5710Smrg
139429cb5710Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
139529cb5710Smrg# the path and the name of the doc stylesheet
139629cb5710Smrgif test "x$XORG_SGML_PATH" != "x" ; then
139729cb5710Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
139829cb5710Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
139929cb5710Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
140029cb5710Smrgelse
140129cb5710Smrg   AC_MSG_RESULT([no])
140229cb5710Smrgfi
140329cb5710Smrg
140429cb5710SmrgAC_SUBST(XORG_SGML_PATH)
140529cb5710SmrgAC_SUBST(STYLESHEET_SRCDIR)
140629cb5710SmrgAC_SUBST(XSL_STYLESHEET)
140729cb5710SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
140829cb5710Smrg]) # XORG_CHECK_SGML_DOCTOOLS
140929cb5710Smrg
14105e358ecaSmrg# XORG_CHECK_LINUXDOC
14115e358ecaSmrg# -------------------
14125e358ecaSmrg# Minimum version: 1.0.0
1413afe13c8eSmrg#
14145e358ecaSmrg# Defines the variable MAKE_TEXT if the necessary tools and
14155e358ecaSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
14165e358ecaSmrg# Whether or not the necessary tools and files are found can be checked
14175e358ecaSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
14185e358ecaSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
141929cb5710SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
142029cb5710SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1421afe13c8eSmrg
14225e358ecaSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1423afe13c8eSmrg
142429cb5710SmrgAC_MSG_CHECKING([whether to build documentation])
1425afe13c8eSmrg
142629cb5710Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
14275e358ecaSmrg   BUILDDOC=yes
14285e358ecaSmrgelse
14295e358ecaSmrg   BUILDDOC=no
1430afe13c8eSmrgfi
1431afe13c8eSmrg
14325e358ecaSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1433afe13c8eSmrg
14345e358ecaSmrgAC_MSG_RESULT([$BUILDDOC])
1435afe13c8eSmrg
143629cb5710SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1437afe13c8eSmrg
143829cb5710Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
14395e358ecaSmrg   BUILDPDFDOC=yes
14405e358ecaSmrgelse
14415e358ecaSmrg   BUILDPDFDOC=no
14425e358ecaSmrgfi
1443afe13c8eSmrg
14445e358ecaSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1445afe13c8eSmrg
14465e358ecaSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1447afe13c8eSmrg
144829cb5710SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
14495e358ecaSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
14505e358ecaSmrgMAKE_PDF="$PS2PDF"
14515e358ecaSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1452afe13c8eSmrg
14535e358ecaSmrgAC_SUBST(MAKE_TEXT)
14545e358ecaSmrgAC_SUBST(MAKE_PS)
14555e358ecaSmrgAC_SUBST(MAKE_PDF)
14565e358ecaSmrgAC_SUBST(MAKE_HTML)
14575e358ecaSmrg]) # XORG_CHECK_LINUXDOC
1458afe13c8eSmrg
14595e358ecaSmrg# XORG_CHECK_DOCBOOK
14605e358ecaSmrg# -------------------
14615e358ecaSmrg# Minimum version: 1.0.0
1462afe13c8eSmrg#
14635e358ecaSmrg# Checks for the ability to build output formats from SGML DocBook source.
14645e358ecaSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
14655e358ecaSmrg# indicates whether the necessary tools and files are found and, if set,
14665e358ecaSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
14675e358ecaSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
146829cb5710SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
146929cb5710Smrg
14705e358ecaSmrgBUILDTXTDOC=no
14715e358ecaSmrgBUILDPDFDOC=no
14725e358ecaSmrgBUILDPSDOC=no
14735e358ecaSmrgBUILDHTMLDOC=no
1474b3307321Smrg
14755e358ecaSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
14765e358ecaSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
14775e358ecaSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
14785e358ecaSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1479afe13c8eSmrg
148029cb5710SmrgAC_MSG_CHECKING([whether to build text documentation])
148129cb5710Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
14825e358ecaSmrg   test x$BUILD_TXTDOC != xno; then
14835e358ecaSmrg	BUILDTXTDOC=yes
14845e358ecaSmrgfi
14855e358ecaSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
14865e358ecaSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1487afe13c8eSmrg
148829cb5710SmrgAC_MSG_CHECKING([whether to build PDF documentation])
148929cb5710Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
14905e358ecaSmrg   test x$BUILD_PDFDOC != xno; then
14915e358ecaSmrg	BUILDPDFDOC=yes
14925e358ecaSmrgfi
14935e358ecaSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14945e358ecaSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1495afe13c8eSmrg
149629cb5710SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
149729cb5710Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
14985e358ecaSmrg   test x$BUILD_PSDOC != xno; then
14995e358ecaSmrg	BUILDPSDOC=yes
15005e358ecaSmrgfi
15015e358ecaSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
15025e358ecaSmrgAC_MSG_RESULT([$BUILDPSDOC])
1503afe13c8eSmrg
150429cb5710SmrgAC_MSG_CHECKING([whether to build HTML documentation])
150529cb5710Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
15065e358ecaSmrg   test x$BUILD_HTMLDOC != xno; then
15075e358ecaSmrg	BUILDHTMLDOC=yes
15085e358ecaSmrgfi
15095e358ecaSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
15105e358ecaSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1511afe13c8eSmrg
15125e358ecaSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
15135e358ecaSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
15145e358ecaSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
15155e358ecaSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1516afe13c8eSmrg
15175e358ecaSmrgAC_SUBST(MAKE_TEXT)
15185e358ecaSmrgAC_SUBST(MAKE_PS)
15195e358ecaSmrgAC_SUBST(MAKE_PDF)
15205e358ecaSmrgAC_SUBST(MAKE_HTML)
15215e358ecaSmrg]) # XORG_CHECK_DOCBOOK
1522afe13c8eSmrg
152329cb5710Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
152429cb5710Smrg# ----------------
152529cb5710Smrg# Minimum version: 1.5.0
152629cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
152729cb5710Smrg#
152829cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
152929cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
153029cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
153129cb5710Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
153229cb5710Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
153329cb5710Smrg# --with-xmlto assumes 'auto'.
153429cb5710Smrg#
153529cb5710Smrg# Interface to module:
153629cb5710Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
153729cb5710Smrg# XMLTO:	returns the path of the xmlto program found
153829cb5710Smrg#		returns the path set by the user in the environment
153929cb5710Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
154029cb5710Smrg#		'no' user instructs the module not to use xmlto
154129cb5710Smrg#
154229cb5710Smrg# Added in version 1.10.0
154329cb5710Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
154429cb5710Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
154529cb5710Smrg#
154629cb5710Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
154729cb5710Smrg#
154829cb5710SmrgAC_DEFUN([XORG_WITH_XMLTO],[
154929cb5710SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
155029cb5710Smrgm4_define([_defopt], m4_default([$2], [auto]))
155129cb5710SmrgAC_ARG_WITH(xmlto,
155229cb5710Smrg	AS_HELP_STRING([--with-xmlto],
155329cb5710Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
155429cb5710Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
155529cb5710Smrgm4_undefine([_defopt])
155629cb5710Smrg
155729cb5710Smrgif test "x$use_xmlto" = x"auto"; then
155829cb5710Smrg   AC_PATH_PROG([XMLTO], [xmlto])
155929cb5710Smrg   if test "x$XMLTO" = "x"; then
156029cb5710Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
156129cb5710Smrg	have_xmlto=no
156229cb5710Smrg   else
156329cb5710Smrg        have_xmlto=yes
156429cb5710Smrg   fi
156529cb5710Smrgelif test "x$use_xmlto" = x"yes" ; then
156629cb5710Smrg   AC_PATH_PROG([XMLTO], [xmlto])
156729cb5710Smrg   if test "x$XMLTO" = "x"; then
156829cb5710Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
156929cb5710Smrg   fi
157029cb5710Smrg   have_xmlto=yes
157129cb5710Smrgelif test "x$use_xmlto" = x"no" ; then
157229cb5710Smrg   if test "x$XMLTO" != "x"; then
157329cb5710Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
157429cb5710Smrg   fi
157529cb5710Smrg   have_xmlto=no
157629cb5710Smrgelse
157729cb5710Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
157829cb5710Smrgfi
157929cb5710Smrg
158029cb5710Smrg# Test for a minimum version of xmlto, if provided.
158129cb5710Smrgm4_ifval([$1],
158229cb5710Smrg[if test "$have_xmlto" = yes; then
158329cb5710Smrg    # scrape the xmlto version
158429cb5710Smrg    AC_MSG_CHECKING([the xmlto version])
158529cb5710Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
158629cb5710Smrg    AC_MSG_RESULT([$xmlto_version])
158729cb5710Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
158829cb5710Smrg        [if test "x$use_xmlto" = xauto; then
158929cb5710Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
159029cb5710Smrg            have_xmlto=no
159129cb5710Smrg        else
159229cb5710Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
159329cb5710Smrg        fi])
159429cb5710Smrgfi])
159529cb5710Smrg
159629cb5710Smrg# Test for the ability of xmlto to generate a text target
159729cb5710Smrghave_xmlto_text=no
159829cb5710Smrgcat > conftest.xml << "EOF"
159929cb5710SmrgEOF
160029cb5710SmrgAS_IF([test "$have_xmlto" = yes],
160129cb5710Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
160229cb5710Smrg             [have_xmlto_text=yes],
160329cb5710Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
160429cb5710Smrgrm -f conftest.xml
160529cb5710SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
160629cb5710SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
160729cb5710Smrg]) # XORG_WITH_XMLTO
160829cb5710Smrg
1609320e696bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1610320e696bSmrg# --------------------------------------------
1611320e696bSmrg# Minimum version: 1.12.0
1612320e696bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1613320e696bSmrg#
1614320e696bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1615320e696bSmrg# XML-based language used for the transformation of XML documents.
1616320e696bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1617320e696bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1618320e696bSmrg# The XSLT processor is often used as a standalone tool for transformations.
1619320e696bSmrg# It should not be assumed that this tool is used only to work with documnetation.
1620320e696bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1621320e696bSmrg#
1622320e696bSmrg# Interface to module:
1623320e696bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1624320e696bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1625320e696bSmrg#		 returns the path set by the user in the environment
1626320e696bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1627320e696bSmrg#		  'no' user instructs the module not to use xsltproc
1628320e696bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1629320e696bSmrg#
1630320e696bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1631320e696bSmrg#
1632320e696bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1633320e696bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1634320e696bSmrg# Preserves the interface, should it be implemented later
1635320e696bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1636320e696bSmrgm4_define([_defopt], m4_default([$2], [auto]))
1637320e696bSmrgAC_ARG_WITH(xsltproc,
1638320e696bSmrg	AS_HELP_STRING([--with-xsltproc],
1639320e696bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1640320e696bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1641320e696bSmrgm4_undefine([_defopt])
1642320e696bSmrg
1643320e696bSmrgif test "x$use_xsltproc" = x"auto"; then
1644320e696bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1645320e696bSmrg   if test "x$XSLTPROC" = "x"; then
1646320e696bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1647320e696bSmrg	have_xsltproc=no
1648320e696bSmrg   else
1649320e696bSmrg        have_xsltproc=yes
1650320e696bSmrg   fi
1651320e696bSmrgelif test "x$use_xsltproc" = x"yes" ; then
1652320e696bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1653320e696bSmrg   if test "x$XSLTPROC" = "x"; then
1654320e696bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1655320e696bSmrg   fi
1656320e696bSmrg   have_xsltproc=yes
1657320e696bSmrgelif test "x$use_xsltproc" = x"no" ; then
1658320e696bSmrg   if test "x$XSLTPROC" != "x"; then
1659320e696bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1660320e696bSmrg   fi
1661320e696bSmrg   have_xsltproc=no
1662320e696bSmrgelse
1663320e696bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1664320e696bSmrgfi
1665320e696bSmrg
1666320e696bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1667320e696bSmrg]) # XORG_WITH_XSLTPROC
1668320e696bSmrg
1669320e696bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1670320e696bSmrg# ----------------------------------------
1671320e696bSmrg# Minimum version: 1.15.0
1672320e696bSmrg#
1673320e696bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1674320e696bSmrg# scanning arbitrary text files, extracting information from those text files,
1675320e696bSmrg# and printing reports based on that information.
1676320e696bSmrg#
1677320e696bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1678320e696bSmrg#
1679320e696bSmrg# Interface to module:
1680320e696bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1681320e696bSmrg# PERL:	     returns the path of the perl program found
1682320e696bSmrg#	     returns the path set by the user in the environment
1683320e696bSmrg# --with-perl: 'yes' user instructs the module to use perl
1684320e696bSmrg#	       'no' user instructs the module not to use perl
1685320e696bSmrg# have_perl: returns yes if perl found in PATH or no
1686320e696bSmrg#
1687320e696bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1688320e696bSmrg#
1689320e696bSmrgAC_DEFUN([XORG_WITH_PERL],[
1690320e696bSmrgAC_ARG_VAR([PERL], [Path to perl command])
1691320e696bSmrg# Preserves the interface, should it be implemented later
1692320e696bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1693320e696bSmrgm4_define([_defopt], m4_default([$2], [auto]))
1694320e696bSmrgAC_ARG_WITH(perl,
1695320e696bSmrg	AS_HELP_STRING([--with-perl],
1696320e696bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1697320e696bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1698320e696bSmrgm4_undefine([_defopt])
1699320e696bSmrg
1700320e696bSmrgif test "x$use_perl" = x"auto"; then
1701320e696bSmrg   AC_PATH_PROG([PERL], [perl])
1702320e696bSmrg   if test "x$PERL" = "x"; then
1703320e696bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1704320e696bSmrg	have_perl=no
1705320e696bSmrg   else
1706320e696bSmrg        have_perl=yes
1707320e696bSmrg   fi
1708320e696bSmrgelif test "x$use_perl" = x"yes" ; then
1709320e696bSmrg   AC_PATH_PROG([PERL], [perl])
1710320e696bSmrg   if test "x$PERL" = "x"; then
1711320e696bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1712320e696bSmrg   fi
1713320e696bSmrg   have_perl=yes
1714320e696bSmrgelif test "x$use_perl" = x"no" ; then
1715320e696bSmrg   if test "x$PERL" != "x"; then
1716320e696bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1717320e696bSmrg   fi
1718320e696bSmrg   have_perl=no
1719320e696bSmrgelse
1720320e696bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1721320e696bSmrgfi
1722320e696bSmrg
1723320e696bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1724320e696bSmrg]) # XORG_WITH_PERL
1725320e696bSmrg
172629cb5710Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
172729cb5710Smrg# ----------------
172829cb5710Smrg# Minimum version: 1.5.0
172929cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
173029cb5710Smrg#
173129cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
173229cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
173329cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
173429cb5710Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
173529cb5710Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
173629cb5710Smrg# --with-asciidoc assumes 'auto'.
173729cb5710Smrg#
173829cb5710Smrg# Interface to module:
173929cb5710Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
174029cb5710Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
174129cb5710Smrg#		 returns the path set by the user in the environment
174229cb5710Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
174329cb5710Smrg#		  'no' user instructs the module not to use asciidoc
174429cb5710Smrg#
174529cb5710Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
174629cb5710Smrg#
174729cb5710SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
174829cb5710SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
174929cb5710Smrgm4_define([_defopt], m4_default([$2], [auto]))
175029cb5710SmrgAC_ARG_WITH(asciidoc,
175129cb5710Smrg	AS_HELP_STRING([--with-asciidoc],
175229cb5710Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
175329cb5710Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
175429cb5710Smrgm4_undefine([_defopt])
175529cb5710Smrg
175629cb5710Smrgif test "x$use_asciidoc" = x"auto"; then
175729cb5710Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
175829cb5710Smrg   if test "x$ASCIIDOC" = "x"; then
175929cb5710Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
176029cb5710Smrg	have_asciidoc=no
176129cb5710Smrg   else
176229cb5710Smrg        have_asciidoc=yes
176329cb5710Smrg   fi
176429cb5710Smrgelif test "x$use_asciidoc" = x"yes" ; then
176529cb5710Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
176629cb5710Smrg   if test "x$ASCIIDOC" = "x"; then
176729cb5710Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
176829cb5710Smrg   fi
176929cb5710Smrg   have_asciidoc=yes
177029cb5710Smrgelif test "x$use_asciidoc" = x"no" ; then
177129cb5710Smrg   if test "x$ASCIIDOC" != "x"; then
177229cb5710Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
177329cb5710Smrg   fi
177429cb5710Smrg   have_asciidoc=no
177529cb5710Smrgelse
177629cb5710Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
177729cb5710Smrgfi
177829cb5710Smrgm4_ifval([$1],
177929cb5710Smrg[if test "$have_asciidoc" = yes; then
178029cb5710Smrg    # scrape the asciidoc version
178129cb5710Smrg    AC_MSG_CHECKING([the asciidoc version])
178229cb5710Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
178329cb5710Smrg    AC_MSG_RESULT([$asciidoc_version])
178429cb5710Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
178529cb5710Smrg        [if test "x$use_asciidoc" = xauto; then
178629cb5710Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
178729cb5710Smrg            have_asciidoc=no
178829cb5710Smrg        else
178929cb5710Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
179029cb5710Smrg        fi])
179129cb5710Smrgfi])
179229cb5710SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
179329cb5710Smrg]) # XORG_WITH_ASCIIDOC
179429cb5710Smrg
179529cb5710Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
179629cb5710Smrg# --------------------------------
179729cb5710Smrg# Minimum version: 1.5.0
179829cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179929cb5710Smrg#
180029cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
180129cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
180229cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
180329cb5710Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
180429cb5710Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
180529cb5710Smrg# --with-doxygen assumes 'auto'.
180629cb5710Smrg#
180729cb5710Smrg# Interface to module:
180829cb5710Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
180929cb5710Smrg# DOXYGEN:	 returns the path of the doxygen program found
181029cb5710Smrg#		 returns the path set by the user in the environment
181129cb5710Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
181229cb5710Smrg#		  'no' user instructs the module not to use doxygen
181329cb5710Smrg#
181429cb5710Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
181529cb5710Smrg#
181629cb5710SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
181729cb5710SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
181829cb5710Smrgm4_define([_defopt], m4_default([$2], [auto]))
181929cb5710SmrgAC_ARG_WITH(doxygen,
182029cb5710Smrg	AS_HELP_STRING([--with-doxygen],
182129cb5710Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
182229cb5710Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
182329cb5710Smrgm4_undefine([_defopt])
182429cb5710Smrg
182529cb5710Smrgif test "x$use_doxygen" = x"auto"; then
182629cb5710Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
182729cb5710Smrg   if test "x$DOXYGEN" = "x"; then
182829cb5710Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
182929cb5710Smrg	have_doxygen=no
183029cb5710Smrg   else
183129cb5710Smrg        have_doxygen=yes
183229cb5710Smrg   fi
183329cb5710Smrgelif test "x$use_doxygen" = x"yes" ; then
183429cb5710Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
183529cb5710Smrg   if test "x$DOXYGEN" = "x"; then
183629cb5710Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
183729cb5710Smrg   fi
183829cb5710Smrg   have_doxygen=yes
183929cb5710Smrgelif test "x$use_doxygen" = x"no" ; then
184029cb5710Smrg   if test "x$DOXYGEN" != "x"; then
184129cb5710Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
184229cb5710Smrg   fi
184329cb5710Smrg   have_doxygen=no
184429cb5710Smrgelse
184529cb5710Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
184629cb5710Smrgfi
184729cb5710Smrgm4_ifval([$1],
184829cb5710Smrg[if test "$have_doxygen" = yes; then
184929cb5710Smrg    # scrape the doxygen version
185029cb5710Smrg    AC_MSG_CHECKING([the doxygen version])
185129cb5710Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
185229cb5710Smrg    AC_MSG_RESULT([$doxygen_version])
185329cb5710Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
185429cb5710Smrg        [if test "x$use_doxygen" = xauto; then
185529cb5710Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
185629cb5710Smrg            have_doxygen=no
185729cb5710Smrg        else
185829cb5710Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
185929cb5710Smrg        fi])
186029cb5710Smrgfi])
186129cb5710SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
186229cb5710Smrg]) # XORG_WITH_DOXYGEN
186329cb5710Smrg
186429cb5710Smrg# XORG_WITH_GROFF([DEFAULT])
186529cb5710Smrg# ----------------
186629cb5710Smrg# Minimum version: 1.6.0
186729cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
186829cb5710Smrg#
186929cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
187029cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
187129cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
187229cb5710Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
187329cb5710Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
187429cb5710Smrg# --with-groff assumes 'auto'.
187529cb5710Smrg#
187629cb5710Smrg# Interface to module:
187729cb5710Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
187829cb5710Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
187929cb5710Smrg# HAVE_GROFF_MS: the -ms macros package
188029cb5710Smrg# GROFF:	 returns the path of the groff program found
188129cb5710Smrg#		 returns the path set by the user in the environment
188229cb5710Smrg# --with-groff:	 'yes' user instructs the module to use groff
188329cb5710Smrg#		 'no' user instructs the module not to use groff
188429cb5710Smrg#
188529cb5710Smrg# Added in version 1.9.0:
188629cb5710Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
188729cb5710Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
188829cb5710Smrg#		   psselect from the psutils package.
188929cb5710Smrg#		   the ghostcript package. Refer to the grohtml man pages
189029cb5710Smrg#
189129cb5710Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
189229cb5710Smrg#
189329cb5710Smrg# OS and distros often splits groff in a basic and full package, the former
189429cb5710Smrg# having the groff program and the later having devices, fonts and macros
189529cb5710Smrg# Checking for the groff executable is not enough.
189629cb5710Smrg#
189729cb5710Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
189829cb5710Smrg# unset HAVE_GROFF or GROFF env variables.
189929cb5710Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
190029cb5710Smrg#
190129cb5710SmrgAC_DEFUN([XORG_WITH_GROFF],[
190229cb5710SmrgAC_ARG_VAR([GROFF], [Path to groff command])
190329cb5710Smrgm4_define([_defopt], m4_default([$1], [auto]))
190429cb5710SmrgAC_ARG_WITH(groff,
190529cb5710Smrg	AS_HELP_STRING([--with-groff],
190629cb5710Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
190729cb5710Smrg	   [use_groff=$withval], [use_groff=]_defopt)
190829cb5710Smrgm4_undefine([_defopt])
190929cb5710Smrg
191029cb5710Smrgif test "x$use_groff" = x"auto"; then
191129cb5710Smrg   AC_PATH_PROG([GROFF], [groff])
191229cb5710Smrg   if test "x$GROFF" = "x"; then
191329cb5710Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
191429cb5710Smrg	have_groff=no
191529cb5710Smrg   else
191629cb5710Smrg        have_groff=yes
191729cb5710Smrg   fi
191829cb5710Smrgelif test "x$use_groff" = x"yes" ; then
191929cb5710Smrg   AC_PATH_PROG([GROFF], [groff])
192029cb5710Smrg   if test "x$GROFF" = "x"; then
192129cb5710Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
192229cb5710Smrg   fi
192329cb5710Smrg   have_groff=yes
192429cb5710Smrgelif test "x$use_groff" = x"no" ; then
192529cb5710Smrg   if test "x$GROFF" != "x"; then
192629cb5710Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
192729cb5710Smrg   fi
192829cb5710Smrg   have_groff=no
192929cb5710Smrgelse
193029cb5710Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
193129cb5710Smrgfi
193229cb5710Smrg
193329cb5710Smrg# We have groff, test for the presence of the macro packages
193429cb5710Smrgif test "x$have_groff" = x"yes"; then
193529cb5710Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
193629cb5710Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
193729cb5710Smrg        groff_ms_works=yes
193829cb5710Smrg    else
193929cb5710Smrg        groff_ms_works=no
194029cb5710Smrg    fi
194129cb5710Smrg    AC_MSG_RESULT([$groff_ms_works])
194229cb5710Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
194329cb5710Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
194429cb5710Smrg        groff_mm_works=yes
194529cb5710Smrg    else
194629cb5710Smrg        groff_mm_works=no
194729cb5710Smrg    fi
194829cb5710Smrg    AC_MSG_RESULT([$groff_mm_works])
194929cb5710Smrgfi
195029cb5710Smrg
195129cb5710Smrg# We have groff, test for HTML dependencies, one command per package
195229cb5710Smrgif test "x$have_groff" = x"yes"; then
195329cb5710Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
195429cb5710Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
195529cb5710Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
195629cb5710Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
195729cb5710Smrg      have_groff_html=yes
195829cb5710Smrg   else
195929cb5710Smrg      have_groff_html=no
196029cb5710Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
196129cb5710Smrg   fi
196229cb5710Smrgfi
196329cb5710Smrg
196429cb5710Smrg# Set Automake conditionals for Makefiles
196529cb5710SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
196629cb5710SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
196729cb5710SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
196829cb5710SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
196929cb5710Smrg]) # XORG_WITH_GROFF
197029cb5710Smrg
1971320e696bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1972320e696bSmrg# ---------------------------------------
197329cb5710Smrg# Minimum version: 1.6.0
197429cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1975320e696bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
197629cb5710Smrg#
197729cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
197829cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
197929cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
198029cb5710Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
198129cb5710Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
198229cb5710Smrg# --with-fop assumes 'auto'.
198329cb5710Smrg#
198429cb5710Smrg# Interface to module:
198529cb5710Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
198629cb5710Smrg# FOP:	 	returns the path of the fop program found
198729cb5710Smrg#		returns the path set by the user in the environment
198829cb5710Smrg# --with-fop: 	'yes' user instructs the module to use fop
198929cb5710Smrg#		'no' user instructs the module not to use fop
199029cb5710Smrg#
199129cb5710Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
199229cb5710Smrg#
199329cb5710SmrgAC_DEFUN([XORG_WITH_FOP],[
199429cb5710SmrgAC_ARG_VAR([FOP], [Path to fop command])
1995320e696bSmrgm4_define([_defopt], m4_default([$2], [auto]))
199629cb5710SmrgAC_ARG_WITH(fop,
199729cb5710Smrg	AS_HELP_STRING([--with-fop],
199829cb5710Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
199929cb5710Smrg	   [use_fop=$withval], [use_fop=]_defopt)
200029cb5710Smrgm4_undefine([_defopt])
200129cb5710Smrg
200229cb5710Smrgif test "x$use_fop" = x"auto"; then
200329cb5710Smrg   AC_PATH_PROG([FOP], [fop])
200429cb5710Smrg   if test "x$FOP" = "x"; then
200529cb5710Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
200629cb5710Smrg	have_fop=no
200729cb5710Smrg   else
200829cb5710Smrg        have_fop=yes
200929cb5710Smrg   fi
201029cb5710Smrgelif test "x$use_fop" = x"yes" ; then
201129cb5710Smrg   AC_PATH_PROG([FOP], [fop])
201229cb5710Smrg   if test "x$FOP" = "x"; then
201329cb5710Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
201429cb5710Smrg   fi
201529cb5710Smrg   have_fop=yes
201629cb5710Smrgelif test "x$use_fop" = x"no" ; then
201729cb5710Smrg   if test "x$FOP" != "x"; then
201829cb5710Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
201929cb5710Smrg   fi
202029cb5710Smrg   have_fop=no
202129cb5710Smrgelse
202229cb5710Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
202329cb5710Smrgfi
2024320e696bSmrg
2025320e696bSmrg# Test for a minimum version of fop, if provided.
2026320e696bSmrgm4_ifval([$1],
2027320e696bSmrg[if test "$have_fop" = yes; then
2028320e696bSmrg    # scrape the fop version
2029320e696bSmrg    AC_MSG_CHECKING([for fop minimum version])
2030320e696bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2031320e696bSmrg    AC_MSG_RESULT([$fop_version])
2032320e696bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2033320e696bSmrg        [if test "x$use_fop" = xauto; then
2034320e696bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2035320e696bSmrg            have_fop=no
2036320e696bSmrg        else
2037320e696bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2038320e696bSmrg        fi])
2039320e696bSmrgfi])
204029cb5710SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
204129cb5710Smrg]) # XORG_WITH_FOP
204229cb5710Smrg
204329cb5710Smrg# XORG_WITH_PS2PDF([DEFAULT])
204429cb5710Smrg# ----------------
204529cb5710Smrg# Minimum version: 1.6.0
204629cb5710Smrg# Minimum version for optional DEFAULT argument: 1.11.0
204729cb5710Smrg#
204829cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
204929cb5710Smrg# not at the appropriate level. This macro enables a module to test for the
205029cb5710Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
205129cb5710Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
205229cb5710Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
205329cb5710Smrg# --with-ps2pdf assumes 'auto'.
205429cb5710Smrg#
205529cb5710Smrg# Interface to module:
205629cb5710Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
205729cb5710Smrg# PS2PDF:	returns the path of the ps2pdf program found
205829cb5710Smrg#		returns the path set by the user in the environment
205929cb5710Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
206029cb5710Smrg#		 'no' user instructs the module not to use ps2pdf
206129cb5710Smrg#
206229cb5710Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
206329cb5710Smrg#
206429cb5710SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
206529cb5710SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
206629cb5710Smrgm4_define([_defopt], m4_default([$1], [auto]))
206729cb5710SmrgAC_ARG_WITH(ps2pdf,
206829cb5710Smrg	AS_HELP_STRING([--with-ps2pdf],
206929cb5710Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
207029cb5710Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
207129cb5710Smrgm4_undefine([_defopt])
207229cb5710Smrg
207329cb5710Smrgif test "x$use_ps2pdf" = x"auto"; then
207429cb5710Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
207529cb5710Smrg   if test "x$PS2PDF" = "x"; then
207629cb5710Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
207729cb5710Smrg	have_ps2pdf=no
207829cb5710Smrg   else
207929cb5710Smrg        have_ps2pdf=yes
208029cb5710Smrg   fi
208129cb5710Smrgelif test "x$use_ps2pdf" = x"yes" ; then
208229cb5710Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
208329cb5710Smrg   if test "x$PS2PDF" = "x"; then
208429cb5710Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
208529cb5710Smrg   fi
208629cb5710Smrg   have_ps2pdf=yes
208729cb5710Smrgelif test "x$use_ps2pdf" = x"no" ; then
208829cb5710Smrg   if test "x$PS2PDF" != "x"; then
208929cb5710Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
209029cb5710Smrg   fi
209129cb5710Smrg   have_ps2pdf=no
209229cb5710Smrgelse
209329cb5710Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
209429cb5710Smrgfi
209529cb5710SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
209629cb5710Smrg]) # XORG_WITH_PS2PDF
209729cb5710Smrg
209829cb5710Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
209929cb5710Smrg# ----------------
210029cb5710Smrg# Minimum version: 1.6.0
210129cb5710Smrg#
210229cb5710Smrg# Documentation tools are not always available on all platforms and sometimes
210329cb5710Smrg# not at the appropriate level. This macro enables a builder to skip all
210429cb5710Smrg# documentation targets except traditional man pages.
210529cb5710Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
210629cb5710Smrg# maximum flexibilty in controlling documentation building.
210729cb5710Smrg# Refer to:
210829cb5710Smrg# XORG_WITH_XMLTO         --with-xmlto
210929cb5710Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
211029cb5710Smrg# XORG_WITH_DOXYGEN       --with-doxygen
211129cb5710Smrg# XORG_WITH_FOP           --with-fop
211229cb5710Smrg# XORG_WITH_GROFF         --with-groff
211329cb5710Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
211429cb5710Smrg#
211529cb5710Smrg# Interface to module:
211629cb5710Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
211729cb5710Smrg# --enable-docs: 'yes' user instructs the module to generate docs
211829cb5710Smrg#		 'no' user instructs the module not to generate docs
211929cb5710Smrg# parm1:	specify the default value, yes or no.
212029cb5710Smrg#
212129cb5710SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2122320e696bSmrgm4_define([docs_default], m4_default([$1], [yes]))
212329cb5710SmrgAC_ARG_ENABLE(docs,
212429cb5710Smrg	AS_HELP_STRING([--enable-docs],
2125320e696bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2126320e696bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2127320e696bSmrgm4_undefine([docs_default])
212829cb5710SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
212929cb5710SmrgAC_MSG_CHECKING([whether to build documentation])
213029cb5710SmrgAC_MSG_RESULT([$build_docs])
213129cb5710Smrg]) # XORG_ENABLE_DOCS
213229cb5710Smrg
213329cb5710Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
213429cb5710Smrg# ----------------
213529cb5710Smrg# Minimum version: 1.6.0
213629cb5710Smrg#
213729cb5710Smrg# This macro enables a builder to skip all developer documentation.
213829cb5710Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
213929cb5710Smrg# maximum flexibilty in controlling documentation building.
214029cb5710Smrg# Refer to:
214129cb5710Smrg# XORG_WITH_XMLTO         --with-xmlto
214229cb5710Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
214329cb5710Smrg# XORG_WITH_DOXYGEN       --with-doxygen
214429cb5710Smrg# XORG_WITH_FOP           --with-fop
214529cb5710Smrg# XORG_WITH_GROFF         --with-groff
214629cb5710Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
214729cb5710Smrg#
214829cb5710Smrg# Interface to module:
214929cb5710Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
215029cb5710Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
215129cb5710Smrg#			'no' user instructs the module not to generate developer docs
215229cb5710Smrg# parm1:		specify the default value, yes or no.
215329cb5710Smrg#
215429cb5710SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
215529cb5710Smrgm4_define([devel_default], m4_default([$1], [yes]))
215629cb5710SmrgAC_ARG_ENABLE(devel-docs,
215729cb5710Smrg	AS_HELP_STRING([--enable-devel-docs],
215829cb5710Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
215929cb5710Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
216029cb5710Smrgm4_undefine([devel_default])
216129cb5710SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
216229cb5710SmrgAC_MSG_CHECKING([whether to build developer documentation])
216329cb5710SmrgAC_MSG_RESULT([$build_devel_docs])
216429cb5710Smrg]) # XORG_ENABLE_DEVEL_DOCS
216529cb5710Smrg
216629cb5710Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
216729cb5710Smrg# ----------------
216829cb5710Smrg# Minimum version: 1.6.0
216929cb5710Smrg#
217029cb5710Smrg# This macro enables a builder to skip all functional specification targets.
217129cb5710Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
217229cb5710Smrg# maximum flexibilty in controlling documentation building.
217329cb5710Smrg# Refer to:
217429cb5710Smrg# XORG_WITH_XMLTO         --with-xmlto
217529cb5710Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
217629cb5710Smrg# XORG_WITH_DOXYGEN       --with-doxygen
217729cb5710Smrg# XORG_WITH_FOP           --with-fop
217829cb5710Smrg# XORG_WITH_GROFF         --with-groff
217929cb5710Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
218029cb5710Smrg#
218129cb5710Smrg# Interface to module:
218229cb5710Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
218329cb5710Smrg# --enable-specs:	'yes' user instructs the module to generate specs
218429cb5710Smrg#			'no' user instructs the module not to generate specs
218529cb5710Smrg# parm1:		specify the default value, yes or no.
218629cb5710Smrg#
218729cb5710SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
218829cb5710Smrgm4_define([spec_default], m4_default([$1], [yes]))
218929cb5710SmrgAC_ARG_ENABLE(specs,
219029cb5710Smrg	AS_HELP_STRING([--enable-specs],
219129cb5710Smrg	   [Enable building the specs (default: ]spec_default[)]),
219229cb5710Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
219329cb5710Smrgm4_undefine([spec_default])
219429cb5710SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
219529cb5710SmrgAC_MSG_CHECKING([whether to build functional specifications])
219629cb5710SmrgAC_MSG_RESULT([$build_specs])
219729cb5710Smrg]) # XORG_ENABLE_SPECS
219829cb5710Smrg
2199320e696bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2200320e696bSmrg# ----------------------------------------------
2201320e696bSmrg# Minimum version: 1.13.0
2202320e696bSmrg#
2203320e696bSmrg# This macro enables a builder to enable/disable unit testing
2204320e696bSmrg# It makes no assumption about the test cases implementation
2205320e696bSmrg# Test cases may or may not use Automake "Support for test suites"
2206320e696bSmrg# They may or may not use the software utility library GLib
2207320e696bSmrg#
2208320e696bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2209320e696bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2210320e696bSmrg# The variable enable_unit_tests is used by other macros in this file.
2211320e696bSmrg#
2212320e696bSmrg# Interface to module:
2213320e696bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2214320e696bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2215320e696bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2216320e696bSmrg#			'no' user instructs the module not to build tests
2217320e696bSmrg# parm1:		specify the default value, yes or no.
2218320e696bSmrg#
2219320e696bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2220320e696bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2221320e696bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2222320e696bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2223320e696bSmrgm4_define([_defopt], m4_default([$1], [auto]))
2224320e696bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2225320e696bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2226320e696bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2227320e696bSmrgm4_undefine([_defopt])
2228320e696bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2229320e696bSmrgAC_MSG_CHECKING([whether to build unit test cases])
2230320e696bSmrgAC_MSG_RESULT([$enable_unit_tests])
2231320e696bSmrg]) # XORG_ENABLE_UNIT_TESTS
2232320e696bSmrg
2233320e696bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2234320e696bSmrg# ----------------------------------------
2235320e696bSmrg# Minimum version: 1.13.0
2236320e696bSmrg#
2237320e696bSmrg# GLib is a library which provides advanced data structures and functions.
2238320e696bSmrg# This macro enables a module to test for the presence of Glib.
2239320e696bSmrg#
2240320e696bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2241320e696bSmrg# Otherwise the value of $enable_unit_tests is blank.
2242320e696bSmrg#
2243320e696bSmrg# Interface to module:
2244320e696bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2245320e696bSmrg# with_glib: used in configure.ac to know if GLib has been found
2246320e696bSmrg# --with-glib:	'yes' user instructs the module to use glib
2247320e696bSmrg#		'no' user instructs the module not to use glib
2248320e696bSmrg#
2249320e696bSmrgAC_DEFUN([XORG_WITH_GLIB],[
2250320e696bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2251320e696bSmrgm4_define([_defopt], m4_default([$2], [auto]))
2252320e696bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2253320e696bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2254320e696bSmrg	[with_glib=$withval], [with_glib=]_defopt)
2255320e696bSmrgm4_undefine([_defopt])
2256320e696bSmrg
2257320e696bSmrghave_glib=no
2258320e696bSmrg# Do not probe GLib if user explicitly disabled unit testing
2259320e696bSmrgif test "x$enable_unit_tests" != x"no"; then
2260320e696bSmrg  # Do not probe GLib if user explicitly disabled it
2261320e696bSmrg  if test "x$with_glib" != x"no"; then
2262320e696bSmrg    m4_ifval(
2263320e696bSmrg      [$1],
2264320e696bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2265320e696bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2266320e696bSmrg    )
2267320e696bSmrg  fi
2268320e696bSmrgfi
2269320e696bSmrg
2270320e696bSmrg# Not having GLib when unit testing has been explicitly requested is an error
2271320e696bSmrgif test "x$enable_unit_tests" = x"yes"; then
2272320e696bSmrg  if test "x$have_glib" = x"no"; then
2273320e696bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2274320e696bSmrg  fi
2275320e696bSmrgfi
2276320e696bSmrg
2277320e696bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2278320e696bSmrgif test "x$enable_unit_tests" = x"no"; then
2279320e696bSmrg  if test "x$with_glib" = x"yes"; then
2280320e696bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2281320e696bSmrg  fi
2282320e696bSmrgfi
2283320e696bSmrg
2284320e696bSmrg# Not having GLib when it has been explicitly requested is an error
2285320e696bSmrgif test "x$with_glib" = x"yes"; then
2286320e696bSmrg  if test "x$have_glib" = x"no"; then
2287320e696bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2288320e696bSmrg  fi
2289320e696bSmrgfi
2290320e696bSmrg
2291320e696bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2292320e696bSmrg]) # XORG_WITH_GLIB
2293320e696bSmrg
2294320e696bSmrg# XORG_LD_WRAP([required|optional])
2295320e696bSmrg# ---------------------------------
2296320e696bSmrg# Minimum version: 1.13.0
2297320e696bSmrg#
2298320e696bSmrg# Check if linker supports -wrap, passed via compiler flags
2299320e696bSmrg#
2300320e696bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2301320e696bSmrg# Otherwise the value of $enable_unit_tests is blank.
2302320e696bSmrg#
2303320e696bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2304320e696bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2305320e696bSmrg# available, an argument of "optional" allows use when some unit tests require
2306320e696bSmrg# ld -wrap and others do not.
2307320e696bSmrg#
2308320e696bSmrgAC_DEFUN([XORG_LD_WRAP],[
2309320e696bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2310320e696bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2311320e696bSmrg                      void __wrap_exit(int status) { return; }],
2312320e696bSmrg                     [exit(0);])])
2313320e696bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2314320e696bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2315320e696bSmrg  if test "x$have_ld_wrap" = x"no"; then
2316320e696bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2317320e696bSmrg  fi
2318320e696bSmrgfi
2319320e696bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2320320e696bSmrg#
2321320e696bSmrg]) # XORG_LD_WRAP
2322320e696bSmrg
2323320e696bSmrg# XORG_CHECK_LINKER_FLAGS
2324320e696bSmrg# -----------------------
2325320e696bSmrg# SYNOPSIS
2326320e696bSmrg#
2327320e696bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2328320e696bSmrg#
2329320e696bSmrg# DESCRIPTION
2330320e696bSmrg#
2331320e696bSmrg#   Check whether the given linker FLAGS work with the current language's
2332320e696bSmrg#   linker, or whether they give an error.
2333320e696bSmrg#
2334320e696bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2335320e696bSmrg#   success/failure.
2336320e696bSmrg#
2337320e696bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2338320e696bSmrg#
2339320e696bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2340320e696bSmrg#
2341320e696bSmrg# LICENSE
2342320e696bSmrg#
2343320e696bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2344320e696bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2345320e696bSmrg#   Copyright (c) 2009 Matteo Frigo
2346320e696bSmrg#
2347320e696bSmrg#   This program is free software: you can redistribute it and/or modify it
2348320e696bSmrg#   under the terms of the GNU General Public License as published by the
2349320e696bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2350320e696bSmrg#   option) any later version.
2351320e696bSmrg#
2352320e696bSmrg#   This program is distributed in the hope that it will be useful, but
2353320e696bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2354320e696bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2355320e696bSmrg#   Public License for more details.
2356320e696bSmrg#
2357320e696bSmrg#   You should have received a copy of the GNU General Public License along
2358320e696bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2359320e696bSmrg#
2360320e696bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2361320e696bSmrg#   gives unlimited permission to copy, distribute and modify the configure
2362320e696bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2363320e696bSmrg#   need not follow the terms of the GNU General Public License when using
2364320e696bSmrg#   or distributing such scripts, even though portions of the text of the
2365320e696bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2366320e696bSmrg#   all other use of the material that constitutes the Autoconf Macro.
2367320e696bSmrg#
2368320e696bSmrg#   This special exception to the GPL applies to versions of the Autoconf
2369320e696bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2370320e696bSmrg#   modified version of the Autoconf Macro, you may extend this special
2371320e696bSmrg#   exception to the GPL to apply to your modified version as well.#
2372320e696bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2373320e696bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2374320e696bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2375320e696bSmrgAS_LITERAL_IF([$1],
2376320e696bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2377320e696bSmrg      ax_save_FLAGS=$LDFLAGS
2378320e696bSmrg      LDFLAGS="$1"
2379320e696bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2380320e696bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2381320e696bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2382320e696bSmrg      LDFLAGS=$ax_save_FLAGS])],
2383320e696bSmrg  [ax_save_FLAGS=$LDFLAGS
2384320e696bSmrg   LDFLAGS="$1"
2385320e696bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2386320e696bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2387320e696bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2388320e696bSmrg   LDFLAGS=$ax_save_FLAGS])
2389320e696bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2390320e696bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2391320e696bSmrgif test "x$xorg_check_linker_flags" = xyes; then
2392320e696bSmrg	m4_default([$2], :)
2393320e696bSmrgelse
2394320e696bSmrg	m4_default([$3], :)
2395320e696bSmrgfi
2396320e696bSmrg]) # XORG_CHECK_LINKER_FLAGS
2397320e696bSmrg
2398320e696bSmrg# XORG_MEMORY_CHECK_FLAGS
2399320e696bSmrg# -----------------------
2400320e696bSmrg# Minimum version: 1.16.0
2401320e696bSmrg#
2402320e696bSmrg# This macro attempts to find appropriate memory checking functionality
2403320e696bSmrg# for various platforms which unit testing code may use to catch various
2404320e696bSmrg# forms of memory allocation and access errors in testing.
2405320e696bSmrg#
2406320e696bSmrg# Interface to module:
2407320e696bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2408320e696bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2409320e696bSmrg#
2410320e696bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2411320e696bSmrg#
2412320e696bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2413320e696bSmrg
2414320e696bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2415320e696bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2416320e696bSmrg           [Environment variables to enable memory checking in tests])
2417320e696bSmrg
2418320e696bSmrg# Check for different types of support on different platforms
2419320e696bSmrgcase $host_os in
2420320e696bSmrg    solaris*)
2421320e696bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2422320e696bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2423320e696bSmrg        ;;
2424320e696bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2425320e696bSmrg        # both directly and inverted, so should not be 0 or 255.
2426320e696bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2427320e696bSmrg        ;;
2428320e696bSmrg    darwin*)
2429320e696bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2430320e696bSmrg        ;;
2431320e696bSmrg    *bsd*)
2432320e696bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2433320e696bSmrg        ;;
2434320e696bSmrgesac
2435320e696bSmrg
2436320e696bSmrg# User supplied flags override default flags
2437320e696bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2438320e696bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2439320e696bSmrgfi
2440320e696bSmrg
2441320e696bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2442320e696bSmrg]) # XORG_WITH_LINT
2443320e696bSmrg
24445e358ecaSmrg# XORG_CHECK_MALLOC_ZERO
24455e358ecaSmrg# ----------------------
24465e358ecaSmrg# Minimum version: 1.0.0
2447afe13c8eSmrg#
24485e358ecaSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
24495e358ecaSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
24505e358ecaSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
24515e358ecaSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
24525e358ecaSmrgAC_ARG_ENABLE(malloc0returnsnull,
24535e358ecaSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
24545e358ecaSmrg		       [malloc(0) returns NULL (default: auto)]),
24555e358ecaSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
24565e358ecaSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2457afe13c8eSmrg
24585e358ecaSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
24595e358ecaSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2460320e696bSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2461320e696bSmrg#include <stdlib.h>
2462320e696bSmrg],[
24635e358ecaSmrg    char *m0, *r0, *c0, *p;
24645e358ecaSmrg    m0 = malloc(0);
24655e358ecaSmrg    p = malloc(10);
24665e358ecaSmrg    r0 = realloc(p,0);
2467320e696bSmrg    c0 = calloc(0,10);
2468320e696bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2469320e696bSmrg])],
24705e358ecaSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
247129cb5710Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
247229cb5710Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2473b3307321Smrgfi
24745e358ecaSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
24755e358ecaSmrg
24765e358ecaSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
24775e358ecaSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
24785e358ecaSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
24795e358ecaSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
24805e358ecaSmrgelse
24815e358ecaSmrg	MALLOC_ZERO_CFLAGS=""
24825e358ecaSmrg	XMALLOC_ZERO_CFLAGS=""
24835e358ecaSmrg	XTMALLOC_ZERO_CFLAGS=""
2484b3307321Smrgfi
2485b3307321Smrg
24865e358ecaSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
24875e358ecaSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
24885e358ecaSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
24895e358ecaSmrg]) # XORG_CHECK_MALLOC_ZERO
24905e358ecaSmrg
24915e358ecaSmrg# XORG_WITH_LINT()
24925e358ecaSmrg# ----------------
24935e358ecaSmrg# Minimum version: 1.1.0
24945e358ecaSmrg#
249529cb5710Smrg# This macro enables the use of a tool that flags some suspicious and
249629cb5710Smrg# non-portable constructs (likely to be bugs) in C language source code.
249729cb5710Smrg# It will attempt to locate the tool and use appropriate options.
249829cb5710Smrg# There are various lint type tools on different platforms.
249929cb5710Smrg#
250029cb5710Smrg# Interface to module:
250129cb5710Smrg# LINT:		returns the path to the tool found on the platform
250229cb5710Smrg#		or the value set to LINT on the configure cmd line
250329cb5710Smrg#		also an Automake conditional
250429cb5710Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
250529cb5710Smrg#
250629cb5710Smrg# --with-lint:	'yes' user instructs the module to use lint
250729cb5710Smrg#		'no' user instructs the module not to use lint (default)
250829cb5710Smrg#
250929cb5710Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
251029cb5710Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2511afe13c8eSmrg#
25125e358ecaSmrgAC_DEFUN([XORG_WITH_LINT],[
2513b3307321Smrg
251429cb5710SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
251529cb5710SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
25165e358ecaSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
25175e358ecaSmrg		[Use a lint-style source code checker (default: disabled)])],
25185e358ecaSmrg		[use_lint=$withval], [use_lint=no])
251929cb5710Smrg
252029cb5710Smrg# Obtain platform specific info like program name and options
252129cb5710Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
252229cb5710Smrgcase $host_os in
252329cb5710Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
252429cb5710Smrg	lint_name=splint
252529cb5710Smrg	lint_options="-badflag"
252629cb5710Smrg	;;
252729cb5710Smrg  *freebsd* | *netbsd*)
252829cb5710Smrg	lint_name=lint
252929cb5710Smrg	lint_options="-u -b"
253029cb5710Smrg	;;
253129cb5710Smrg  *solaris*)
253229cb5710Smrg	lint_name=lint
253329cb5710Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
253429cb5710Smrg	;;
253529cb5710Smrgesac
253629cb5710Smrg
253729cb5710Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
253829cb5710Smrgif test "x$use_lint" = x"yes" ; then
253929cb5710Smrg   AC_PATH_PROG([LINT], [$lint_name])
254029cb5710Smrg   if test "x$LINT" = "x"; then
254129cb5710Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
254229cb5710Smrg   fi
254329cb5710Smrgelif test "x$use_lint" = x"no" ; then
254429cb5710Smrg   if test "x$LINT" != "x"; then
254529cb5710Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
254629cb5710Smrg   fi
25475e358ecaSmrgelse
254829cb5710Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
25495e358ecaSmrgfi
255029cb5710Smrg
255129cb5710Smrg# User supplied flags override default flags
255229cb5710Smrgif test "x$LINT_FLAGS" != "x"; then
255329cb5710Smrg   lint_options=$LINT_FLAGS
2554afe13c8eSmrgfi
2555b3307321Smrg
255629cb5710SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
255729cb5710SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2558b3307321Smrg
25595e358ecaSmrg]) # XORG_WITH_LINT
2560b3307321Smrg
25615e358ecaSmrg# XORG_LINT_LIBRARY(LIBNAME)
25625e358ecaSmrg# --------------------------
25635e358ecaSmrg# Minimum version: 1.1.0
25645e358ecaSmrg#
25655e358ecaSmrg# Sets up flags for building lint libraries for checking programs that call
25665e358ecaSmrg# functions in the library.
25675e358ecaSmrg#
256829cb5710Smrg# Interface to module:
256929cb5710Smrg# LINTLIB		- Automake variable with the name of lint library file to make
257029cb5710Smrg# MAKE_LINT_LIB		- Automake conditional
257129cb5710Smrg#
257229cb5710Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
257329cb5710Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2574b3307321Smrg
25755e358ecaSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
25765e358ecaSmrgAC_REQUIRE([XORG_WITH_LINT])
25775e358ecaSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
25785e358ecaSmrg	[Create lint library (default: disabled)])],
25795e358ecaSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
258029cb5710Smrg
258129cb5710Smrgif test "x$make_lint_lib" = x"yes" ; then
258229cb5710Smrg   LINTLIB=llib-l$1.ln
258329cb5710Smrg   if test "x$LINT" = "x"; then
258429cb5710Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
258529cb5710Smrg   fi
258629cb5710Smrgelif test "x$make_lint_lib" != x"no" ; then
258729cb5710Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
25885e358ecaSmrgfi
258929cb5710Smrg
25905e358ecaSmrgAC_SUBST(LINTLIB)
25915e358ecaSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2592afe13c8eSmrg
25935e358ecaSmrg]) # XORG_LINT_LIBRARY
2594b3307321Smrg
2595320e696bSmrg# XORG_COMPILER_BRAND
2596320e696bSmrg# -------------------
2597320e696bSmrg# Minimum version: 1.14.0
2598320e696bSmrg#
2599320e696bSmrg# Checks for various brands of compilers and sets flags as appropriate:
2600320e696bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2601320e696bSmrg#   clang compiler - sets CLANGCC to "yes"
2602320e696bSmrg#   Intel compiler - sets INTELCC to "yes"
2603320e696bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2604320e696bSmrg#
2605320e696bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2606320e696bSmrgAC_REQUIRE([AC_PROG_CC_C99])
2607320e696bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2608320e696bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2609320e696bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2610320e696bSmrg]) # XORG_COMPILER_BRAND
2611320e696bSmrg
2612320e696bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2613320e696bSmrg# ---------------
2614320e696bSmrg# Minimum version: 1.16.0
2615320e696bSmrg#
2616320e696bSmrg# Test if the compiler works when passed the given flag as a command line argument.
2617320e696bSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2618320e696bSmrg# next flag in the list until there are no more options.
2619320e696bSmrg#
2620320e696bSmrg# Note that this does not guarantee that the compiler supports the flag as some
2621320e696bSmrg# compilers will simply ignore arguments that they do not understand, but we do
2622320e696bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2623320e696bSmrg# -Werror=unused-command-line-argument
2624320e696bSmrg#
2625320e696bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2626320e696bSmrgAC_REQUIRE([AC_PROG_CC_C99])
2627320e696bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2628320e696bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2629320e696bSmrg
2630320e696bSmrgxorg_testset_save_CFLAGS="$CFLAGS"
2631320e696bSmrg
2632320e696bSmrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
2633320e696bSmrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2634320e696bSmrg	AC_CACHE_CHECK([if $CC supports -Werror=unknown-warning-option],
2635320e696bSmrg			xorg_cv_cc_flag_unknown_warning_option,
2636320e696bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2637320e696bSmrg					  [xorg_cv_cc_flag_unknown_warning_option=yes],
2638320e696bSmrg					  [xorg_cv_cc_flag_unknown_warning_option=no]))
2639320e696bSmrg	xorg_testset_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option
2640320e696bSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
2641320e696bSmrgfi
2642320e696bSmrg
2643320e696bSmrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
2644320e696bSmrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2645320e696bSmrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2646320e696bSmrg	fi
2647320e696bSmrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2648320e696bSmrg	AC_CACHE_CHECK([if $CC supports -Werror=unused-command-line-argument],
2649320e696bSmrg			xorg_cv_cc_flag_unused_command_line_argument,
2650320e696bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2651320e696bSmrg					  [xorg_cv_cc_flag_unused_command_line_argument=yes],
2652320e696bSmrg					  [xorg_cv_cc_flag_unused_command_line_argument=no]))
2653320e696bSmrg	xorg_testset_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument
2654320e696bSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
2655320e696bSmrgfi
2656320e696bSmrg
2657320e696bSmrgfound="no"
2658320e696bSmrgm4_foreach([flag], m4_cdr($@), [
2659320e696bSmrg	if test $found = "no" ; then
2660320e696bSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2661320e696bSmrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2662320e696bSmrg		fi
2663320e696bSmrg
2664320e696bSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2665320e696bSmrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2666320e696bSmrg		fi
2667320e696bSmrg
2668320e696bSmrg		CFLAGS="$CFLAGS ]flag["
2669320e696bSmrg
2670320e696bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2671320e696bSmrg		AC_MSG_CHECKING([if $CC supports ]flag[])
2672320e696bSmrg		cacheid=`AS_ECHO([xorg_cv_cc_flag_]flag[])`
2673320e696bSmrg		AC_CACHE_VAL(AS_TR_SH($cacheid),
2674320e696bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2675320e696bSmrg					     [eval AS_TR_SH($cacheid)=yes],
2676320e696bSmrg					     [eval AS_TR_SH($cacheid)=no])])
2677320e696bSmrg
2678320e696bSmrg		CFLAGS="$xorg_testset_save_CFLAGS"
2679320e696bSmrg
2680320e696bSmrg		eval supported=$AS_TR_SH($cacheid)
2681320e696bSmrg		AC_MSG_RESULT([$supported])
2682320e696bSmrg		if test "$supported" = "yes" ; then
2683320e696bSmrg			$1="$$1 ]flag["
2684320e696bSmrg			found="yes"
2685320e696bSmrg		fi
2686320e696bSmrg	fi
2687320e696bSmrg])
2688320e696bSmrg]) # XORG_TESTSET_CFLAG
2689320e696bSmrg
2690320e696bSmrg# XORG_COMPILER_FLAGS
2691320e696bSmrg# ---------------
2692320e696bSmrg# Minimum version: 1.16.0
2693320e696bSmrg#
2694320e696bSmrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
2695320e696bSmrg# by the selected compiler which do NOT alter the generated code.  These
2696320e696bSmrg# arguments will cause the compiler to print various warnings during
2697320e696bSmrg# compilation AND turn a conservative set of warnings into errors.
2698320e696bSmrg#
2699320e696bSmrg# The set of flags supported by BASE_CFLAGS will grow in future
2700320e696bSmrg# versions of util-macros as options are added to new compilers.
2701320e696bSmrg#
2702320e696bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2703320e696bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2704320e696bSmrg
2705320e696bSmrgAC_ARG_ENABLE(selective-werror,
2706320e696bSmrg              AS_HELP_STRING([--disable-selective-werror],
2707320e696bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2708320e696bSmrg              [SELECTIVE_WERROR=$enableval],
2709320e696bSmrg              [SELECTIVE_WERROR=yes])
2710320e696bSmrg
2711320e696bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2712320e696bSmrgif test "x$SUNCC" = "xyes"; then
2713320e696bSmrg    BASE_CFLAGS="-v"
2714320e696bSmrgelse
2715320e696bSmrg    BASE_CFLAGS=""
2716320e696bSmrgfi
2717320e696bSmrg
2718320e696bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2719320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
2720320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
2721320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
2722320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
2723320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
2724320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
2725320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
2726320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
2727320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
2728320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
2729320e696bSmrg
2730320e696bSmrg# This chunk adds additional warnings that could catch undesired effects.
2731320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
2732320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
2733320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
2734320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
2735320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
2736320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
2737320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
2738320e696bSmrg
2739320e696bSmrg# These are currently disabled because they are noisy.  They will be enabled
2740320e696bSmrg# in the future once the codebase is sufficiently modernized to silence
2741320e696bSmrg# them.  For now, I don't want them to drown out the other warnings.
2742320e696bSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
2743320e696bSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
2744320e696bSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
2745320e696bSmrg
2746320e696bSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2747320e696bSmrg# when there are problems that should be fixed.
2748320e696bSmrg
2749320e696bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2750320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2751320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
2752320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
2753320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
2754320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
2755320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
2756320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2757320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
2758320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
2759320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
2760320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
2761320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2762320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2763320e696bSmrgelse
2764320e696bSmrgAC_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])
2765320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
2766320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
2767320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
2768320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
2769320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
2770320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
2771320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
2772320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
2773320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
2774320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
2775320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
2776320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
2777320e696bSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
2778320e696bSmrgfi
2779320e696bSmrg
2780320e696bSmrgAC_SUBST([BASE_CFLAGS])
2781320e696bSmrg]) # XORG_COMPILER_FLAGS
2782320e696bSmrg
27835e358ecaSmrg# XORG_CWARNFLAGS
27845e358ecaSmrg# ---------------
27855e358ecaSmrg# Minimum version: 1.2.0
2786320e696bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
27875e358ecaSmrg#
27885e358ecaSmrg# Defines CWARNFLAGS to enable C compiler warnings.
27895e358ecaSmrg#
2790320e696bSmrg# This function is deprecated because it defines -fno-strict-aliasing
2791320e696bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2792320e696bSmrg# is needed, then it should be added explicitly in the module when
2793320e696bSmrg# it is updated to use BASE_CFLAGS.
2794320e696bSmrg#
27955e358ecaSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2796320e696bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2797320e696bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2798320e696bSmrgCWARNFLAGS="$BASE_CFLAGS"
27995e358ecaSmrgif  test "x$GCC" = xyes ; then
2800320e696bSmrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2801b3307321Smrgfi
28025e358ecaSmrgAC_SUBST(CWARNFLAGS)
28035e358ecaSmrg]) # XORG_CWARNFLAGS
2804b3307321Smrg
28055e358ecaSmrg# XORG_STRICT_OPTION
28065e358ecaSmrg# -----------------------
28075e358ecaSmrg# Minimum version: 1.3.0
2808afe13c8eSmrg#
2809320e696bSmrg# Add configure option to enable strict compilation flags, such as treating
2810320e696bSmrg# warnings as fatal errors.
2811320e696bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2812320e696bSmrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
2813320e696bSmrg#
2814320e696bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2815320e696bSmrg# when strict compilation is unconditionally desired.
28165e358ecaSmrgAC_DEFUN([XORG_STRICT_OPTION], [
28175e358ecaSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2818320e696bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
28195e358ecaSmrg
28205e358ecaSmrgAC_ARG_ENABLE(strict-compilation,
28215e358ecaSmrg			  AS_HELP_STRING([--enable-strict-compilation],
28225e358ecaSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
28235e358ecaSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2824320e696bSmrg
2825320e696bSmrgSTRICT_CFLAGS=""
2826320e696bSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
2827320e696bSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
2828320e696bSmrg
2829320e696bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2830320e696bSmrg# activate it with -Werror, so we add it here explicitly.
2831320e696bSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
2832320e696bSmrg
28335e358ecaSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2834320e696bSmrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
2835320e696bSmrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
28365e358ecaSmrgfi
2837320e696bSmrgAC_SUBST([STRICT_CFLAGS])
2838320e696bSmrgAC_SUBST([BASE_CFLAGS])
28395e358ecaSmrgAC_SUBST([CWARNFLAGS])
28405e358ecaSmrg]) # XORG_STRICT_OPTION
2841b3307321Smrg
28425e358ecaSmrg# XORG_DEFAULT_OPTIONS
28435e358ecaSmrg# --------------------
28445e358ecaSmrg# Minimum version: 1.3.0
2845afe13c8eSmrg#
28465e358ecaSmrg# Defines default options for X.Org modules.
28475e358ecaSmrg#
28485e358ecaSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
284929cb5710SmrgAC_REQUIRE([AC_PROG_INSTALL])
2850320e696bSmrgXORG_COMPILER_FLAGS
28515e358ecaSmrgXORG_CWARNFLAGS
28525e358ecaSmrgXORG_STRICT_OPTION
28535e358ecaSmrgXORG_RELEASE_VERSION
28545e358ecaSmrgXORG_CHANGELOG
285529cb5710SmrgXORG_INSTALL
28565e358ecaSmrgXORG_MANPAGE_SECTIONS
285729cb5710Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
285829cb5710Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
28595e358ecaSmrg]) # XORG_DEFAULT_OPTIONS
286029cb5710Smrg
286129cb5710Smrg# XORG_INSTALL()
286229cb5710Smrg# ----------------
286329cb5710Smrg# Minimum version: 1.4.0
286429cb5710Smrg#
286529cb5710Smrg# Defines the variable INSTALL_CMD as the command to copy
286629cb5710Smrg# INSTALL from $prefix/share/util-macros.
286729cb5710Smrg#
286829cb5710SmrgAC_DEFUN([XORG_INSTALL], [
286929cb5710SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
287029cb5710Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
287129cb5710SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
287229cb5710Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
287329cb5710Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
287429cb5710Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
287529cb5710SmrgAC_SUBST([INSTALL_CMD])
287629cb5710Smrg]) # XORG_INSTALL
28775e358ecaSmrgdnl Copyright 2005 Red Hat, Inc
28785e358ecaSmrgdnl
28795e358ecaSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
28805e358ecaSmrgdnl documentation for any purpose is hereby granted without fee, provided that
28815e358ecaSmrgdnl the above copyright notice appear in all copies and that both that
28825e358ecaSmrgdnl copyright notice and this permission notice appear in supporting
28835e358ecaSmrgdnl documentation.
28845e358ecaSmrgdnl
28855e358ecaSmrgdnl The above copyright notice and this permission notice shall be included
28865e358ecaSmrgdnl in all copies or substantial portions of the Software.
28875e358ecaSmrgdnl
28885e358ecaSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
28895e358ecaSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28905e358ecaSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28915e358ecaSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
28925e358ecaSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28935e358ecaSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28945e358ecaSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
28955e358ecaSmrgdnl
28965e358ecaSmrgdnl Except as contained in this notice, the name of the copyright holders shall
28975e358ecaSmrgdnl not be used in advertising or otherwise to promote the sale, use or
28985e358ecaSmrgdnl other dealings in this Software without prior written authorization
28995e358ecaSmrgdnl from the copyright holders.
29005e358ecaSmrgdnl
2901b3307321Smrg
29025e358ecaSmrg# XORG_RELEASE_VERSION
29035e358ecaSmrg# --------------------
290429cb5710Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
29055e358ecaSmrg 
29065e358ecaSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
29075e358ecaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
29085e358ecaSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
29095e358ecaSmrg		[Major version of this package])
29105e358ecaSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
29115e358ecaSmrg	if test "x$PVM" = "x"; then
29125e358ecaSmrg		PVM="0"
29135e358ecaSmrg	fi
29145e358ecaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
29155e358ecaSmrg		[$PVM],
29165e358ecaSmrg		[Minor version of this package])
29175e358ecaSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
29185e358ecaSmrg	if test "x$PVP" = "x"; then
29195e358ecaSmrg		PVP="0"
29205e358ecaSmrg	fi
29215e358ecaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
29225e358ecaSmrg		[$PVP],
29235e358ecaSmrg		[Patch version of this package])
29245e358ecaSmrg])
2925b3307321Smrg
29265e358ecaSmrg# XORG_CHANGELOG()
29275e358ecaSmrg# ----------------
29285e358ecaSmrg# Minimum version: 1.2.0
29295e358ecaSmrg#
29305e358ecaSmrg# Defines the variable CHANGELOG_CMD as the command to generate
29315e358ecaSmrg# ChangeLog from git.
29325e358ecaSmrg#
29335e358ecaSmrg#
29345e358ecaSmrgAC_DEFUN([XORG_CHANGELOG], [
293529cb5710SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
293629cb5710Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
293729cb5710Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
29385e358ecaSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
29395e358ecaSmrgAC_SUBST([CHANGELOG_CMD])
29405e358ecaSmrg]) # XORG_CHANGELOG
2941b3307321Smrg
2942