aclocal.m4 revision 23a8d56d
123a8d56dSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
21abf7346Smrg
31abf7346Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
48b6d6341Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
51abf7346Smrg# This file is free software; the Free Software Foundation
61abf7346Smrg# gives unlimited permission to copy and/or distribute it,
71abf7346Smrg# with or without modifications, as long as this notice is preserved.
81abf7346Smrg
91abf7346Smrg# This program is distributed in the hope that it will be useful,
101abf7346Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111abf7346Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121abf7346Smrg# PARTICULAR PURPOSE.
131abf7346Smrg
148b6d6341Smrgm4_ifndef([AC_AUTOCONF_VERSION],
158b6d6341Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1623a8d56dSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1723a8d56dSmrg[m4_warning([this file was generated for autoconf 2.68.
188b6d6341SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
198b6d6341SmrgIf you have problems, you may need to regenerate the build system entirely.
208b6d6341SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
211abf7346Smrg
228b6d6341Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
231abf7346Smrg#
248b6d6341Smrg# This file is free software; the Free Software Foundation
258b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
268b6d6341Smrg# with or without modifications, as long as this notice is preserved.
271abf7346Smrg
288b6d6341Smrg# AM_AUTOMAKE_VERSION(VERSION)
298b6d6341Smrg# ----------------------------
308b6d6341Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
318b6d6341Smrg# generated from the m4 files accompanying Automake X.Y.
328b6d6341Smrg# (This private macro should not be called outside this file.)
338b6d6341SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
348b6d6341Smrg[am__api_version='1.11'
358b6d6341Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
368b6d6341Smrgdnl require some minimum version.  Point them to the right macro.
3723a8d56dSmrgm4_if([$1], [1.11.1], [],
388b6d6341Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
398b6d6341Smrg])
401abf7346Smrg
418b6d6341Smrg# _AM_AUTOCONF_VERSION(VERSION)
428b6d6341Smrg# -----------------------------
438b6d6341Smrg# aclocal traces this macro to find the Autoconf version.
448b6d6341Smrg# This is a private macro too.  Using m4_define simplifies
458b6d6341Smrg# the logic in aclocal, which can simply ignore this definition.
468b6d6341Smrgm4_define([_AM_AUTOCONF_VERSION], [])
471abf7346Smrg
488b6d6341Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
498b6d6341Smrg# -------------------------------
508b6d6341Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
518b6d6341Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
528b6d6341SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5323a8d56dSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
548b6d6341Smrgm4_ifndef([AC_AUTOCONF_VERSION],
558b6d6341Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
568b6d6341Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
571abf7346Smrg
588b6d6341Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
591abf7346Smrg
608b6d6341Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
618b6d6341Smrg#
628b6d6341Smrg# This file is free software; the Free Software Foundation
638b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
648b6d6341Smrg# with or without modifications, as long as this notice is preserved.
651abf7346Smrg
668b6d6341Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
678b6d6341Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
688b6d6341Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
691abf7346Smrg#
708b6d6341Smrg# Of course, Automake must honor this variable whenever it calls a
718b6d6341Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
728b6d6341Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
738b6d6341Smrg# depending on how configure is run.  This is pretty annoying, since
748b6d6341Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
758b6d6341Smrg# source directory, any form will work fine, but in subdirectories a
768b6d6341Smrg# relative path needs to be adjusted first.
771abf7346Smrg#
788b6d6341Smrg# $ac_aux_dir/missing
798b6d6341Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
808b6d6341Smrg# $top_srcdir/$ac_aux_dir/missing
818b6d6341Smrg#    fails if $ac_aux_dir is absolute,
828b6d6341Smrg#    fails when called from a subdirectory in a VPATH build with
838b6d6341Smrg#          a relative $ac_aux_dir
841abf7346Smrg#
858b6d6341Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
868b6d6341Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
878b6d6341Smrg# harmless because $srcdir is `.', but things will broke when you
888b6d6341Smrg# start a VPATH build or use an absolute $srcdir.
891abf7346Smrg#
908b6d6341Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
918b6d6341Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
928b6d6341Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
938b6d6341Smrg# and then we would define $MISSING as
948b6d6341Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
958b6d6341Smrg# This will work as long as MISSING is not called from configure, because
968b6d6341Smrg# unfortunately $(top_srcdir) has no meaning in configure.
978b6d6341Smrg# However there are other variables, like CC, which are often used in
988b6d6341Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
998b6d6341Smrg#
1008b6d6341Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1018b6d6341Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1028b6d6341Smrg# configured tree to be moved without reconfiguration.
1031abf7346Smrg
1048b6d6341SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1058b6d6341Smrg[dnl Rely on autoconf to set up CDPATH properly.
1068b6d6341SmrgAC_PREREQ([2.50])dnl
1078b6d6341Smrg# expand $ac_aux_dir to an absolute path
1088b6d6341Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
1098b6d6341Smrg])
1101abf7346Smrg
1118b6d6341Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1121abf7346Smrg
1138b6d6341Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1148b6d6341Smrg# Free Software Foundation, Inc.
1158b6d6341Smrg#
1168b6d6341Smrg# This file is free software; the Free Software Foundation
1178b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
1188b6d6341Smrg# with or without modifications, as long as this notice is preserved.
1191abf7346Smrg
1208b6d6341Smrg# serial 9
1211abf7346Smrg
1228b6d6341Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1238b6d6341Smrg# -------------------------------------
1248b6d6341Smrg# Define a conditional.
1258b6d6341SmrgAC_DEFUN([AM_CONDITIONAL],
1268b6d6341Smrg[AC_PREREQ(2.52)dnl
1278b6d6341Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1288b6d6341Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1298b6d6341SmrgAC_SUBST([$1_TRUE])dnl
1308b6d6341SmrgAC_SUBST([$1_FALSE])dnl
1318b6d6341Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1328b6d6341Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1338b6d6341Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1348b6d6341Smrgif $2; then
1358b6d6341Smrg  $1_TRUE=
1368b6d6341Smrg  $1_FALSE='#'
1378b6d6341Smrgelse
1388b6d6341Smrg  $1_TRUE='#'
1398b6d6341Smrg  $1_FALSE=
1408b6d6341Smrgfi
1418b6d6341SmrgAC_CONFIG_COMMANDS_PRE(
1428b6d6341Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1438b6d6341Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1448b6d6341SmrgUsually this means the macro was only invoked conditionally.]])
1458b6d6341Smrgfi])])
1461abf7346Smrg
1478b6d6341Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
1488b6d6341Smrg# Free Software Foundation, Inc.
1498b6d6341Smrg#
1508b6d6341Smrg# This file is free software; the Free Software Foundation
1518b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
1528b6d6341Smrg# with or without modifications, as long as this notice is preserved.
1531abf7346Smrg
1548b6d6341Smrg# serial 10
1551abf7346Smrg
1568b6d6341Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1578b6d6341Smrg# written in clear, in which case automake, when reading aclocal.m4,
1588b6d6341Smrg# will think it sees a *use*, and therefore will trigger all it's
1598b6d6341Smrg# C support machinery.  Also note that it means that autoscan, seeing
1608b6d6341Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1611abf7346Smrg
1621abf7346Smrg
1638b6d6341Smrg# _AM_DEPENDENCIES(NAME)
1648b6d6341Smrg# ----------------------
1658b6d6341Smrg# See how the compiler implements dependency checking.
1668b6d6341Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1678b6d6341Smrg# We try a few techniques and use that to set a single cache variable.
1688b6d6341Smrg#
1698b6d6341Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1708b6d6341Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1718b6d6341Smrg# dependency, and given that the user is not expected to run this macro,
1728b6d6341Smrg# just rely on AC_PROG_CC.
1738b6d6341SmrgAC_DEFUN([_AM_DEPENDENCIES],
1748b6d6341Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1758b6d6341SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1768b6d6341SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1778b6d6341SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1781abf7346Smrg
1798b6d6341Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1808b6d6341Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1818b6d6341Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1828b6d6341Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1838b6d6341Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1848b6d6341Smrg                   [depcc="$$1"   am_compiler_list=])
1851abf7346Smrg
1868b6d6341SmrgAC_CACHE_CHECK([dependency style of $depcc],
1878b6d6341Smrg               [am_cv_$1_dependencies_compiler_type],
1888b6d6341Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1898b6d6341Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1908b6d6341Smrg  # making bogus files that we don't know about and never remove.  For
1918b6d6341Smrg  # instance it was reported that on HP-UX the gcc test will end up
1928b6d6341Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
1938b6d6341Smrg  # in D'.
1948b6d6341Smrg  mkdir conftest.dir
1958b6d6341Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1968b6d6341Smrg  # using a relative directory.
1978b6d6341Smrg  cp "$am_depcomp" conftest.dir
1988b6d6341Smrg  cd conftest.dir
1998b6d6341Smrg  # We will build objects and dependencies in a subdirectory because
2008b6d6341Smrg  # it helps to detect inapplicable dependency modes.  For instance
2018b6d6341Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2028b6d6341Smrg  # side effect of compilation, but ICC will put the dependencies in
2038b6d6341Smrg  # the current directory while Tru64 will put them in the object
2048b6d6341Smrg  # directory.
2058b6d6341Smrg  mkdir sub
2061abf7346Smrg
2078b6d6341Smrg  am_cv_$1_dependencies_compiler_type=none
2088b6d6341Smrg  if test "$am_compiler_list" = ""; then
2098b6d6341Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2108b6d6341Smrg  fi
2118b6d6341Smrg  am__universal=false
2128b6d6341Smrg  m4_case([$1], [CC],
2138b6d6341Smrg    [case " $depcc " in #(
2148b6d6341Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2158b6d6341Smrg     esac],
2168b6d6341Smrg    [CXX],
2178b6d6341Smrg    [case " $depcc " in #(
2188b6d6341Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2198b6d6341Smrg     esac])
2201abf7346Smrg
2218b6d6341Smrg  for depmode in $am_compiler_list; do
2228b6d6341Smrg    # Setup a source with many dependencies, because some compilers
2238b6d6341Smrg    # like to wrap large dependency lists on column 80 (with \), and
2248b6d6341Smrg    # we should not choose a depcomp mode which is confused by this.
2258b6d6341Smrg    #
2268b6d6341Smrg    # We need to recreate these files for each test, as the compiler may
2278b6d6341Smrg    # overwrite some of them when testing with obscure command lines.
2288b6d6341Smrg    # This happens at least with the AIX C compiler.
2298b6d6341Smrg    : > sub/conftest.c
2308b6d6341Smrg    for i in 1 2 3 4 5 6; do
2318b6d6341Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2328b6d6341Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2338b6d6341Smrg      # Solaris 8's {/usr,}/bin/sh.
2348b6d6341Smrg      touch sub/conftst$i.h
2358b6d6341Smrg    done
2368b6d6341Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2371abf7346Smrg
2388b6d6341Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2398b6d6341Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2408b6d6341Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
2418b6d6341Smrg    # versions had trouble with output in subdirs
2428b6d6341Smrg    am__obj=sub/conftest.${OBJEXT-o}
2438b6d6341Smrg    am__minus_obj="-o $am__obj"
2448b6d6341Smrg    case $depmode in
2458b6d6341Smrg    gcc)
2468b6d6341Smrg      # This depmode causes a compiler race in universal mode.
2478b6d6341Smrg      test "$am__universal" = false || continue
2488b6d6341Smrg      ;;
2498b6d6341Smrg    nosideeffect)
2508b6d6341Smrg      # after this tag, mechanisms are not by side-effect, so they'll
2518b6d6341Smrg      # only be used when explicitly requested
2528b6d6341Smrg      if test "x$enable_dependency_tracking" = xyes; then
2538b6d6341Smrg	continue
2548b6d6341Smrg      else
2558b6d6341Smrg	break
2568b6d6341Smrg      fi
2578b6d6341Smrg      ;;
2588b6d6341Smrg    msvisualcpp | msvcmsys)
2598b6d6341Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
2608b6d6341Smrg      # not run yet.  These depmodes are late enough in the game, and
2618b6d6341Smrg      # so weak that their functioning should not be impacted.
2628b6d6341Smrg      am__obj=conftest.${OBJEXT-o}
2638b6d6341Smrg      am__minus_obj=
2648b6d6341Smrg      ;;
2658b6d6341Smrg    none) break ;;
2668b6d6341Smrg    esac
2678b6d6341Smrg    if depmode=$depmode \
2688b6d6341Smrg       source=sub/conftest.c object=$am__obj \
2698b6d6341Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2708b6d6341Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2718b6d6341Smrg         >/dev/null 2>conftest.err &&
2728b6d6341Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2738b6d6341Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2748b6d6341Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2758b6d6341Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2768b6d6341Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2778b6d6341Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2788b6d6341Smrg      # that says an option was ignored or not supported.
2798b6d6341Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2808b6d6341Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2818b6d6341Smrg      # The diagnosis changed in icc 8.0:
2828b6d6341Smrg      #   icc: Command line remark: option '-MP' not supported
2838b6d6341Smrg      if (grep 'ignoring option' conftest.err ||
2848b6d6341Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2858b6d6341Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2868b6d6341Smrg        break
2878b6d6341Smrg      fi
2888b6d6341Smrg    fi
2898b6d6341Smrg  done
2901abf7346Smrg
2918b6d6341Smrg  cd ..
2928b6d6341Smrg  rm -rf conftest.dir
2931abf7346Smrgelse
2948b6d6341Smrg  am_cv_$1_dependencies_compiler_type=none
2951abf7346Smrgfi
2968b6d6341Smrg])
2978b6d6341SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2988b6d6341SmrgAM_CONDITIONAL([am__fastdep$1], [
2998b6d6341Smrg  test "x$enable_dependency_tracking" != xno \
3008b6d6341Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3018b6d6341Smrg])
3021abf7346Smrg
3031abf7346Smrg
3048b6d6341Smrg# AM_SET_DEPDIR
3058b6d6341Smrg# -------------
3068b6d6341Smrg# Choose a directory name for dependency files.
3078b6d6341Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3088b6d6341SmrgAC_DEFUN([AM_SET_DEPDIR],
3098b6d6341Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3108b6d6341SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3118b6d6341Smrg])
3121abf7346Smrg
3131abf7346Smrg
3148b6d6341Smrg# AM_DEP_TRACK
3158b6d6341Smrg# ------------
3168b6d6341SmrgAC_DEFUN([AM_DEP_TRACK],
3178b6d6341Smrg[AC_ARG_ENABLE(dependency-tracking,
3188b6d6341Smrg[  --disable-dependency-tracking  speeds up one-time build
3198b6d6341Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3208b6d6341Smrgif test "x$enable_dependency_tracking" != xno; then
3218b6d6341Smrg  am_depcomp="$ac_aux_dir/depcomp"
3228b6d6341Smrg  AMDEPBACKSLASH='\'
3231abf7346Smrgfi
3248b6d6341SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3258b6d6341SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3268b6d6341Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3278b6d6341Smrg])
3281abf7346Smrg
3298b6d6341Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3301abf7346Smrg
3318b6d6341Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
3328b6d6341Smrg# Free Software Foundation, Inc.
3331abf7346Smrg#
3348b6d6341Smrg# This file is free software; the Free Software Foundation
3358b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
3368b6d6341Smrg# with or without modifications, as long as this notice is preserved.
3371abf7346Smrg
3388b6d6341Smrg#serial 5
3391abf7346Smrg
3408b6d6341Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3418b6d6341Smrg# ------------------------------
3428b6d6341SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3438b6d6341Smrg[{
3448b6d6341Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
3458b6d6341Smrg  # are listed without --file.  Let's play safe and only enable the eval
3468b6d6341Smrg  # if we detect the quoting.
3478b6d6341Smrg  case $CONFIG_FILES in
3488b6d6341Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3498b6d6341Smrg  *)   set x $CONFIG_FILES ;;
3508b6d6341Smrg  esac
3518b6d6341Smrg  shift
3528b6d6341Smrg  for mf
3538b6d6341Smrg  do
3548b6d6341Smrg    # Strip MF so we end up with the name of the file.
3558b6d6341Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3568b6d6341Smrg    # Check whether this is an Automake generated Makefile or not.
3578b6d6341Smrg    # We used to match only the files named `Makefile.in', but
3588b6d6341Smrg    # some people rename them; so instead we look at the file content.
3598b6d6341Smrg    # Grep'ing the first line is not enough: some people post-process
3608b6d6341Smrg    # each Makefile.in and add a new line on top of each file to say so.
3618b6d6341Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3628b6d6341Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3638b6d6341Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3648b6d6341Smrg      dirpart=`AS_DIRNAME("$mf")`
3658b6d6341Smrg    else
3668b6d6341Smrg      continue
3678b6d6341Smrg    fi
3688b6d6341Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3698b6d6341Smrg    # from the Makefile without running `make'.
3708b6d6341Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3718b6d6341Smrg    test -z "$DEPDIR" && continue
3728b6d6341Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3738b6d6341Smrg    test -z "am__include" && continue
3748b6d6341Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3758b6d6341Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
3768b6d6341Smrg    U=`sed -n 's/^U = //p' < "$mf"`
3778b6d6341Smrg    # Find all dependency output files, they are included files with
3788b6d6341Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3798b6d6341Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3808b6d6341Smrg    # expansion.
3818b6d6341Smrg    for file in `sed -n "
3828b6d6341Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3838b6d6341Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3848b6d6341Smrg      # Make sure the directory exists.
3858b6d6341Smrg      test -f "$dirpart/$file" && continue
3868b6d6341Smrg      fdir=`AS_DIRNAME(["$file"])`
3878b6d6341Smrg      AS_MKDIR_P([$dirpart/$fdir])
3888b6d6341Smrg      # echo "creating $dirpart/$file"
3898b6d6341Smrg      echo '# dummy' > "$dirpart/$file"
3908b6d6341Smrg    done
3918b6d6341Smrg  done
3928b6d6341Smrg}
3938b6d6341Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3941abf7346Smrg
3951abf7346Smrg
3968b6d6341Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3978b6d6341Smrg# -----------------------------
3988b6d6341Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3998b6d6341Smrg#
4008b6d6341Smrg# This code is only required when automatic dependency tracking
4018b6d6341Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
4028b6d6341Smrg# need in order to bootstrap the dependency handling code.
4038b6d6341SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4048b6d6341Smrg[AC_CONFIG_COMMANDS([depfiles],
4058b6d6341Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4068b6d6341Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4078b6d6341Smrg])
4081abf7346Smrg
4098b6d6341Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
4108b6d6341Smrg# Free Software Foundation, Inc.
4118b6d6341Smrg#
4128b6d6341Smrg# This file is free software; the Free Software Foundation
4138b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
4148b6d6341Smrg# with or without modifications, as long as this notice is preserved.
4151abf7346Smrg
4168b6d6341Smrg# serial 8
4171abf7346Smrg
4188b6d6341Smrg# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
4198b6d6341SmrgAU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
4201abf7346Smrg
4218b6d6341Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4221abf7346Smrg
4238b6d6341Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4248b6d6341Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4258b6d6341Smrg#
4268b6d6341Smrg# This file is free software; the Free Software Foundation
4278b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
4288b6d6341Smrg# with or without modifications, as long as this notice is preserved.
4291abf7346Smrg
4308b6d6341Smrg# serial 16
4311abf7346Smrg
4328b6d6341Smrg# This macro actually does too much.  Some checks are only needed if
4338b6d6341Smrg# your package does certain things.  But this isn't really a big deal.
4341abf7346Smrg
4358b6d6341Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4368b6d6341Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4378b6d6341Smrg# -----------------------------------------------
4388b6d6341Smrg# The call with PACKAGE and VERSION arguments is the old style
4398b6d6341Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4408b6d6341Smrg# and VERSION should now be passed to AC_INIT and removed from
4418b6d6341Smrg# the call to AM_INIT_AUTOMAKE.
4428b6d6341Smrg# We support both call styles for the transition.  After
4438b6d6341Smrg# the next Automake release, Autoconf can make the AC_INIT
4448b6d6341Smrg# arguments mandatory, and then we can depend on a new Autoconf
4458b6d6341Smrg# release and drop the old call support.
4468b6d6341SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4478b6d6341Smrg[AC_PREREQ([2.62])dnl
4488b6d6341Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4498b6d6341Smrgdnl the ones we care about.
4508b6d6341Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4518b6d6341SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4528b6d6341SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4538b6d6341Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4548b6d6341Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4558b6d6341Smrg  # is not polluted with repeated "-I."
4568b6d6341Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4578b6d6341Smrg  # test to see if srcdir already configured
4588b6d6341Smrg  if test -f $srcdir/config.status; then
4598b6d6341Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4608b6d6341Smrg  fi
4618b6d6341Smrgfi
4621abf7346Smrg
4638b6d6341Smrg# test whether we have cygpath
4648b6d6341Smrgif test -z "$CYGPATH_W"; then
4658b6d6341Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4668b6d6341Smrg    CYGPATH_W='cygpath -w'
4678b6d6341Smrg  else
4688b6d6341Smrg    CYGPATH_W=echo
4698b6d6341Smrg  fi
4708b6d6341Smrgfi
4718b6d6341SmrgAC_SUBST([CYGPATH_W])
4721abf7346Smrg
4738b6d6341Smrg# Define the identity of the package.
4748b6d6341Smrgdnl Distinguish between old-style and new-style calls.
4758b6d6341Smrgm4_ifval([$2],
4768b6d6341Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4778b6d6341Smrg AC_SUBST([PACKAGE], [$1])dnl
4788b6d6341Smrg AC_SUBST([VERSION], [$2])],
4798b6d6341Smrg[_AM_SET_OPTIONS([$1])dnl
4808b6d6341Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4818b6d6341Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4828b6d6341Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4838b6d6341Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4848b6d6341Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4851abf7346Smrg
4868b6d6341Smrg_AM_IF_OPTION([no-define],,
4878b6d6341Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4888b6d6341Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4891abf7346Smrg
4908b6d6341Smrg# Some tools Automake needs.
4918b6d6341SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4928b6d6341SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4938b6d6341SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4948b6d6341SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4958b6d6341SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4968b6d6341SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4978b6d6341SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4988b6d6341SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4998b6d6341SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
5008b6d6341SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
5018b6d6341Smrg# We need awk for the "check" target.  The system "awk" is bad on
5028b6d6341Smrg# some platforms.
5038b6d6341SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5048b6d6341SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5058b6d6341SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5068b6d6341Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5078b6d6341Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5088b6d6341Smrg			     [_AM_PROG_TAR([v7])])])
5098b6d6341Smrg_AM_IF_OPTION([no-dependencies],,
5108b6d6341Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5118b6d6341Smrg		  [_AM_DEPENDENCIES(CC)],
5128b6d6341Smrg		  [define([AC_PROG_CC],
5138b6d6341Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5148b6d6341SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5158b6d6341Smrg		  [_AM_DEPENDENCIES(CXX)],
5168b6d6341Smrg		  [define([AC_PROG_CXX],
5178b6d6341Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5188b6d6341SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5198b6d6341Smrg		  [_AM_DEPENDENCIES(OBJC)],
5208b6d6341Smrg		  [define([AC_PROG_OBJC],
5218b6d6341Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
5228b6d6341Smrg])
5238b6d6341Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5248b6d6341Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5258b6d6341Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5268b6d6341Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5278b6d6341SmrgAC_CONFIG_COMMANDS_PRE(dnl
5288b6d6341Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5298b6d6341Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5308b6d6341Smrg])
5311abf7346Smrg
5328b6d6341Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5338b6d6341Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5348b6d6341Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5358b6d6341Smrgm4_define([_AC_COMPILER_EXEEXT],
5368b6d6341Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5371abf7346Smrg
5381abf7346Smrg
5398b6d6341Smrg# When config.status generates a header, we must update the stamp-h file.
5408b6d6341Smrg# This file resides in the same directory as the config header
5418b6d6341Smrg# that is generated.  The stamp files are numbered to have different names.
5421abf7346Smrg
5438b6d6341Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5448b6d6341Smrg# loop where config.status creates the headers, so we can generate
5458b6d6341Smrg# our stamp files there.
5468b6d6341SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5478b6d6341Smrg[# Compute $1's index in $config_headers.
5488b6d6341Smrg_am_arg=$1
5498b6d6341Smrg_am_stamp_count=1
5508b6d6341Smrgfor _am_header in $config_headers :; do
5518b6d6341Smrg  case $_am_header in
5528b6d6341Smrg    $_am_arg | $_am_arg:* )
5538b6d6341Smrg      break ;;
5548b6d6341Smrg    * )
5558b6d6341Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5568b6d6341Smrg  esac
5578b6d6341Smrgdone
5588b6d6341Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5591abf7346Smrg
5608b6d6341Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
5611abf7346Smrg#
5628b6d6341Smrg# This file is free software; the Free Software Foundation
5638b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
5648b6d6341Smrg# with or without modifications, as long as this notice is preserved.
5651abf7346Smrg
5668b6d6341Smrg# AM_PROG_INSTALL_SH
5678b6d6341Smrg# ------------------
5688b6d6341Smrg# Define $install_sh.
5698b6d6341SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5708b6d6341Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5718b6d6341Smrgif test x"${install_sh}" != xset; then
5728b6d6341Smrg  case $am_aux_dir in
5738b6d6341Smrg  *\ * | *\	*)
5748b6d6341Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5758b6d6341Smrg  *)
5768b6d6341Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5778b6d6341Smrg  esac
5781abf7346Smrgfi
5798b6d6341SmrgAC_SUBST(install_sh)])
5801abf7346Smrg
5818b6d6341Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5828b6d6341Smrg#
5838b6d6341Smrg# This file is free software; the Free Software Foundation
5848b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
5858b6d6341Smrg# with or without modifications, as long as this notice is preserved.
5868b6d6341Smrg
5878b6d6341Smrg# serial 2
5888b6d6341Smrg
5898b6d6341Smrg# Check whether the underlying file-system supports filenames
5908b6d6341Smrg# with a leading dot.  For instance MS-DOS doesn't.
5918b6d6341SmrgAC_DEFUN([AM_SET_LEADING_DOT],
5928b6d6341Smrg[rm -rf .tst 2>/dev/null
5938b6d6341Smrgmkdir .tst 2>/dev/null
5948b6d6341Smrgif test -d .tst; then
5958b6d6341Smrg  am__leading_dot=.
5961abf7346Smrgelse
5978b6d6341Smrg  am__leading_dot=_
5981abf7346Smrgfi
5998b6d6341Smrgrmdir .tst 2>/dev/null
6008b6d6341SmrgAC_SUBST([am__leading_dot])])
6011abf7346Smrg
6028b6d6341Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6038b6d6341Smrg# From Jim Meyering
6041abf7346Smrg
6058b6d6341Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
6068b6d6341Smrg# Free Software Foundation, Inc.
6071abf7346Smrg#
6088b6d6341Smrg# This file is free software; the Free Software Foundation
6098b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
6108b6d6341Smrg# with or without modifications, as long as this notice is preserved.
6111abf7346Smrg
6128b6d6341Smrg# serial 5
6131abf7346Smrg
6148b6d6341Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6158b6d6341Smrg# ----------------------------------
6168b6d6341Smrg# Control maintainer-specific portions of Makefiles.
6178b6d6341Smrg# Default is to disable them, unless `enable' is passed literally.
6188b6d6341Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
6198b6d6341Smrg# can override the default with the --enable/--disable switch.
6208b6d6341SmrgAC_DEFUN([AM_MAINTAINER_MODE],
6218b6d6341Smrg[m4_case(m4_default([$1], [disable]),
6228b6d6341Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
6238b6d6341Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
6248b6d6341Smrg       [m4_define([am_maintainer_other], [enable])
6258b6d6341Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6268b6d6341SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
6278b6d6341Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6288b6d6341Smrg  AC_ARG_ENABLE([maintainer-mode],
6298b6d6341Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
6308b6d6341Smrg			  (and sometimes confusing) to the casual installer],
6318b6d6341Smrg      [USE_MAINTAINER_MODE=$enableval],
6328b6d6341Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6338b6d6341Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6348b6d6341Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6358b6d6341Smrg  MAINT=$MAINTAINER_MODE_TRUE
6368b6d6341Smrg  AC_SUBST([MAINT])dnl
6378b6d6341Smrg]
6388b6d6341Smrg)
6391abf7346Smrg
6408b6d6341SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
6411abf7346Smrg
6428b6d6341Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6438b6d6341Smrg
6448b6d6341Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6451abf7346Smrg#
6468b6d6341Smrg# This file is free software; the Free Software Foundation
6478b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
6488b6d6341Smrg# with or without modifications, as long as this notice is preserved.
6498b6d6341Smrg
6508b6d6341Smrg# serial 4
6518b6d6341Smrg
6528b6d6341Smrg# AM_MAKE_INCLUDE()
6538b6d6341Smrg# -----------------
6548b6d6341Smrg# Check to see how make treats includes.
6558b6d6341SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6568b6d6341Smrg[am_make=${MAKE-make}
6578b6d6341Smrgcat > confinc << 'END'
6588b6d6341Smrgam__doit:
6598b6d6341Smrg	@echo this is the am__doit target
6608b6d6341Smrg.PHONY: am__doit
6618b6d6341SmrgEND
6628b6d6341Smrg# If we don't find an include directive, just comment out the code.
6638b6d6341SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6648b6d6341Smrgam__include="#"
6658b6d6341Smrgam__quote=
6668b6d6341Smrg_am_result=none
6678b6d6341Smrg# First try GNU make style include.
6688b6d6341Smrgecho "include confinc" > confmf
6698b6d6341Smrg# Ignore all kinds of additional output from `make'.
6708b6d6341Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6718b6d6341Smrg*the\ am__doit\ target*)
6728b6d6341Smrg  am__include=include
6738b6d6341Smrg  am__quote=
6748b6d6341Smrg  _am_result=GNU
6758b6d6341Smrg  ;;
6768b6d6341Smrgesac
6778b6d6341Smrg# Now try BSD make style include.
6788b6d6341Smrgif test "$am__include" = "#"; then
6798b6d6341Smrg   echo '.include "confinc"' > confmf
6808b6d6341Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6818b6d6341Smrg   *the\ am__doit\ target*)
6828b6d6341Smrg     am__include=.include
6838b6d6341Smrg     am__quote="\""
6848b6d6341Smrg     _am_result=BSD
6858b6d6341Smrg     ;;
6868b6d6341Smrg   esac
6878b6d6341Smrgfi
6888b6d6341SmrgAC_SUBST([am__include])
6898b6d6341SmrgAC_SUBST([am__quote])
6908b6d6341SmrgAC_MSG_RESULT([$_am_result])
6918b6d6341Smrgrm -f confinc confmf
6928b6d6341Smrg])
6938b6d6341Smrg
6948b6d6341Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6958b6d6341Smrg
6968b6d6341Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
6978b6d6341Smrg# Free Software Foundation, Inc.
6981abf7346Smrg#
6998b6d6341Smrg# This file is free software; the Free Software Foundation
7008b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
7018b6d6341Smrg# with or without modifications, as long as this notice is preserved.
7021abf7346Smrg
7038b6d6341Smrg# serial 6
7041abf7346Smrg
7058b6d6341Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7068b6d6341Smrg# ------------------------------
7078b6d6341SmrgAC_DEFUN([AM_MISSING_PROG],
7088b6d6341Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7098b6d6341Smrg$1=${$1-"${am_missing_run}$2"}
7108b6d6341SmrgAC_SUBST($1)])
7111abf7346Smrg
7121abf7346Smrg
7138b6d6341Smrg# AM_MISSING_HAS_RUN
7148b6d6341Smrg# ------------------
7158b6d6341Smrg# Define MISSING if not defined so far and test if it supports --run.
7168b6d6341Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
7178b6d6341SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7188b6d6341Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7198b6d6341SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7208b6d6341Smrgif test x"${MISSING+set}" != xset; then
7218b6d6341Smrg  case $am_aux_dir in
7228b6d6341Smrg  *\ * | *\	*)
7238b6d6341Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7248b6d6341Smrg  *)
7258b6d6341Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7268b6d6341Smrg  esac
7278b6d6341Smrgfi
7288b6d6341Smrg# Use eval to expand $SHELL
7298b6d6341Smrgif eval "$MISSING --run true"; then
7308b6d6341Smrg  am_missing_run="$MISSING --run "
7318b6d6341Smrgelse
7328b6d6341Smrg  am_missing_run=
7338b6d6341Smrg  AC_MSG_WARN([`missing' script is too old or missing])
7348b6d6341Smrgfi
7351abf7346Smrg])
7361abf7346Smrg
7378b6d6341Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
7381abf7346Smrg#
7391abf7346Smrg# This file is free software; the Free Software Foundation
7401abf7346Smrg# gives unlimited permission to copy and/or distribute it,
7411abf7346Smrg# with or without modifications, as long as this notice is preserved.
7421abf7346Smrg
7438b6d6341Smrg# AM_PROG_MKDIR_P
7448b6d6341Smrg# ---------------
7458b6d6341Smrg# Check for `mkdir -p'.
7468b6d6341SmrgAC_DEFUN([AM_PROG_MKDIR_P],
7478b6d6341Smrg[AC_PREREQ([2.60])dnl
7488b6d6341SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7498b6d6341Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7508b6d6341Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
7518b6d6341Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7528b6d6341Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7538b6d6341Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7548b6d6341Smrgdnl adjustment using top_builddir (which is defined more often than
7558b6d6341Smrgdnl MKDIR_P).
7568b6d6341SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7578b6d6341Smrgcase $mkdir_p in
7588b6d6341Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7598b6d6341Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7608b6d6341Smrgesac
7611abf7346Smrg])
7621abf7346Smrg
7638b6d6341Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7641abf7346Smrg
7658b6d6341Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
7668b6d6341Smrg#
7678b6d6341Smrg# This file is free software; the Free Software Foundation
7688b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
7698b6d6341Smrg# with or without modifications, as long as this notice is preserved.
7701abf7346Smrg
7718b6d6341Smrg# serial 4
7721abf7346Smrg
7738b6d6341Smrg# _AM_MANGLE_OPTION(NAME)
7748b6d6341Smrg# -----------------------
7758b6d6341SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7768b6d6341Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7778b6d6341Smrg
7788b6d6341Smrg# _AM_SET_OPTION(NAME)
7798b6d6341Smrg# ------------------------------
7808b6d6341Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7818b6d6341SmrgAC_DEFUN([_AM_SET_OPTION],
7828b6d6341Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
7838b6d6341Smrg
7848b6d6341Smrg# _AM_SET_OPTIONS(OPTIONS)
7858b6d6341Smrg# ----------------------------------
7868b6d6341Smrg# OPTIONS is a space-separated list of Automake options.
7878b6d6341SmrgAC_DEFUN([_AM_SET_OPTIONS],
7888b6d6341Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7898b6d6341Smrg
7908b6d6341Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7918b6d6341Smrg# -------------------------------------------
7928b6d6341Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7938b6d6341SmrgAC_DEFUN([_AM_IF_OPTION],
7948b6d6341Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7958b6d6341Smrg
7968b6d6341Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7978b6d6341Smrg
7988b6d6341Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
7998b6d6341Smrg# Free Software Foundation, Inc.
8001abf7346Smrg#
8011abf7346Smrg# This file is free software; the Free Software Foundation
8021abf7346Smrg# gives unlimited permission to copy and/or distribute it,
8031abf7346Smrg# with or without modifications, as long as this notice is preserved.
8041abf7346Smrg
8058b6d6341Smrg# serial 5
8061abf7346Smrg
8078b6d6341Smrg# AM_SANITY_CHECK
8088b6d6341Smrg# ---------------
8098b6d6341SmrgAC_DEFUN([AM_SANITY_CHECK],
8108b6d6341Smrg[AC_MSG_CHECKING([whether build environment is sane])
8118b6d6341Smrg# Just in case
8128b6d6341Smrgsleep 1
8138b6d6341Smrgecho timestamp > conftest.file
8148b6d6341Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8158b6d6341Smrg# name.  Accept space and tab only in the latter.
8168b6d6341Smrgam_lf='
8178b6d6341Smrg'
8188b6d6341Smrgcase `pwd` in
8198b6d6341Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8208b6d6341Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8218b6d6341Smrgesac
8228b6d6341Smrgcase $srcdir in
8238b6d6341Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8248b6d6341Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8258b6d6341Smrgesac
8261abf7346Smrg
8278b6d6341Smrg# Do `set' in a subshell so we don't clobber the current shell's
8288b6d6341Smrg# arguments.  Must try -L first in case configure is actually a
8298b6d6341Smrg# symlink; some systems play weird games with the mod time of symlinks
8308b6d6341Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8318b6d6341Smrg# directory).
8328b6d6341Smrgif (
8338b6d6341Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8348b6d6341Smrg   if test "$[*]" = "X"; then
8358b6d6341Smrg      # -L didn't work.
8368b6d6341Smrg      set X `ls -t "$srcdir/configure" conftest.file`
8378b6d6341Smrg   fi
8388b6d6341Smrg   rm -f conftest.file
8398b6d6341Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
8408b6d6341Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
8418b6d6341Smrg
8428b6d6341Smrg      # If neither matched, then we have a broken ls.  This can happen
8438b6d6341Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
8448b6d6341Smrg      # broken ls alias from the environment.  This has actually
8458b6d6341Smrg      # happened.  Such a system could not be considered "sane".
8468b6d6341Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8478b6d6341Smrgalias in your environment])
8488b6d6341Smrg   fi
8498b6d6341Smrg
8508b6d6341Smrg   test "$[2]" = conftest.file
8518b6d6341Smrg   )
8528b6d6341Smrgthen
8538b6d6341Smrg   # Ok.
8548b6d6341Smrg   :
8558b6d6341Smrgelse
8568b6d6341Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8578b6d6341SmrgCheck your system clock])
8588b6d6341Smrgfi
8598b6d6341SmrgAC_MSG_RESULT(yes)])
8601abf7346Smrg
8618b6d6341Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
8621abf7346Smrg#
8631abf7346Smrg# This file is free software; the Free Software Foundation
8641abf7346Smrg# gives unlimited permission to copy and/or distribute it,
8651abf7346Smrg# with or without modifications, as long as this notice is preserved.
8661abf7346Smrg
8678b6d6341Smrg# serial 1
8681abf7346Smrg
8698b6d6341Smrg# AM_SILENT_RULES([DEFAULT])
8708b6d6341Smrg# --------------------------
8718b6d6341Smrg# Enable less verbose build rules; with the default set to DEFAULT
8728b6d6341Smrg# (`yes' being less verbose, `no' or empty being verbose).
8738b6d6341SmrgAC_DEFUN([AM_SILENT_RULES],
8748b6d6341Smrg[AC_ARG_ENABLE([silent-rules],
8758b6d6341Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8768b6d6341Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8778b6d6341Smrgcase $enable_silent_rules in
8788b6d6341Smrgyes) AM_DEFAULT_VERBOSITY=0;;
8798b6d6341Smrgno)  AM_DEFAULT_VERBOSITY=1;;
8808b6d6341Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8818b6d6341Smrgesac
8828b6d6341SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8838b6d6341SmrgAM_BACKSLASH='\'
8848b6d6341SmrgAC_SUBST([AM_BACKSLASH])dnl
8858b6d6341Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8868b6d6341Smrg])
8871abf7346Smrg
8888b6d6341Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
8891abf7346Smrg#
8901abf7346Smrg# This file is free software; the Free Software Foundation
8911abf7346Smrg# gives unlimited permission to copy and/or distribute it,
8921abf7346Smrg# with or without modifications, as long as this notice is preserved.
8931abf7346Smrg
8948b6d6341Smrg# AM_PROG_INSTALL_STRIP
8958b6d6341Smrg# ---------------------
8968b6d6341Smrg# One issue with vendor `install' (even GNU) is that you can't
8978b6d6341Smrg# specify the program used to strip binaries.  This is especially
8988b6d6341Smrg# annoying in cross-compiling environments, where the build's strip
8998b6d6341Smrg# is unlikely to handle the host's binaries.
9008b6d6341Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9018b6d6341Smrg# always use install-sh in `make install-strip', and initialize
9028b6d6341Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9038b6d6341SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9048b6d6341Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9058b6d6341Smrg# Installed binaries are usually stripped using `strip' when the user
9068b6d6341Smrg# run `make install-strip'.  However `strip' might not be the right
9078b6d6341Smrg# tool to use in cross-compilation environments, therefore Automake
9088b6d6341Smrg# will honor the `STRIP' environment variable to overrule this program.
9098b6d6341Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
9108b6d6341Smrgif test "$cross_compiling" != no; then
9118b6d6341Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9128b6d6341Smrgfi
9138b6d6341SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9148b6d6341SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
9151abf7346Smrg
9168b6d6341Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
9171abf7346Smrg#
9188b6d6341Smrg# This file is free software; the Free Software Foundation
9198b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
9208b6d6341Smrg# with or without modifications, as long as this notice is preserved.
9211abf7346Smrg
9228b6d6341Smrg# serial 2
9231abf7346Smrg
9248b6d6341Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
9258b6d6341Smrg# ---------------------------
9268b6d6341Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9278b6d6341Smrg# This macro is traced by Automake.
9288b6d6341SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9291abf7346Smrg
9308b6d6341Smrg# AM_SUBST_NOTMAKE(VARIABLE)
9318b6d6341Smrg# ---------------------------
9328b6d6341Smrg# Public sister of _AM_SUBST_NOTMAKE.
9338b6d6341SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9341abf7346Smrg
9358b6d6341Smrg# Check how to create a tarball.                            -*- Autoconf -*-
9361abf7346Smrg
9378b6d6341Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
9388b6d6341Smrg#
9398b6d6341Smrg# This file is free software; the Free Software Foundation
9408b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
9418b6d6341Smrg# with or without modifications, as long as this notice is preserved.
9421abf7346Smrg
9438b6d6341Smrg# serial 2
9441abf7346Smrg
9458b6d6341Smrg# _AM_PROG_TAR(FORMAT)
9468b6d6341Smrg# --------------------
9478b6d6341Smrg# Check how to create a tarball in format FORMAT.
9488b6d6341Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
9498b6d6341Smrg#
9508b6d6341Smrg# Substitute a variable $(am__tar) that is a command
9518b6d6341Smrg# writing to stdout a FORMAT-tarball containing the directory
9528b6d6341Smrg# $tardir.
9538b6d6341Smrg#     tardir=directory && $(am__tar) > result.tar
9548b6d6341Smrg#
9558b6d6341Smrg# Substitute a variable $(am__untar) that extract such
9568b6d6341Smrg# a tarball read from stdin.
9578b6d6341Smrg#     $(am__untar) < result.tar
9588b6d6341SmrgAC_DEFUN([_AM_PROG_TAR],
9598b6d6341Smrg[# Always define AMTAR for backward compatibility.
9608b6d6341SmrgAM_MISSING_PROG([AMTAR], [tar])
9618b6d6341Smrgm4_if([$1], [v7],
9628b6d6341Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
9638b6d6341Smrg     [m4_case([$1], [ustar],, [pax],,
9648b6d6341Smrg              [m4_fatal([Unknown tar format])])
9658b6d6341SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
9668b6d6341Smrg# Loop over all known methods to create a tar archive until one works.
9678b6d6341Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9688b6d6341Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
9698b6d6341Smrg# Do not fold the above two line into one, because Tru64 sh and
9708b6d6341Smrg# Solaris sh will not grok spaces in the rhs of `-'.
9718b6d6341Smrgfor _am_tool in $_am_tools
9728b6d6341Smrgdo
9738b6d6341Smrg  case $_am_tool in
9748b6d6341Smrg  gnutar)
9758b6d6341Smrg    for _am_tar in tar gnutar gtar;
9768b6d6341Smrg    do
9778b6d6341Smrg      AM_RUN_LOG([$_am_tar --version]) && break
9788b6d6341Smrg    done
9798b6d6341Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
9808b6d6341Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
9818b6d6341Smrg    am__untar="$_am_tar -xf -"
9828b6d6341Smrg    ;;
9838b6d6341Smrg  plaintar)
9848b6d6341Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
9858b6d6341Smrg    # ustar tarball either.
9868b6d6341Smrg    (tar --version) >/dev/null 2>&1 && continue
9878b6d6341Smrg    am__tar='tar chf - "$$tardir"'
9888b6d6341Smrg    am__tar_='tar chf - "$tardir"'
9898b6d6341Smrg    am__untar='tar xf -'
9908b6d6341Smrg    ;;
9918b6d6341Smrg  pax)
9928b6d6341Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
9938b6d6341Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
9948b6d6341Smrg    am__untar='pax -r'
9958b6d6341Smrg    ;;
9968b6d6341Smrg  cpio)
9978b6d6341Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
9988b6d6341Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
9998b6d6341Smrg    am__untar='cpio -i -H $1 -d'
10008b6d6341Smrg    ;;
10018b6d6341Smrg  none)
10028b6d6341Smrg    am__tar=false
10038b6d6341Smrg    am__tar_=false
10048b6d6341Smrg    am__untar=false
10058b6d6341Smrg    ;;
10068b6d6341Smrg  esac
10071abf7346Smrg
10088b6d6341Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
10098b6d6341Smrg  # and am__untar set.
10108b6d6341Smrg  test -n "${am_cv_prog_tar_$1}" && break
10111abf7346Smrg
10128b6d6341Smrg  # tar/untar a dummy directory, and stop if the command works
10138b6d6341Smrg  rm -rf conftest.dir
10148b6d6341Smrg  mkdir conftest.dir
10158b6d6341Smrg  echo GrepMe > conftest.dir/file
10168b6d6341Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
10178b6d6341Smrg  rm -rf conftest.dir
10188b6d6341Smrg  if test -s conftest.tar; then
10198b6d6341Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
10208b6d6341Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
10218b6d6341Smrg  fi
10228b6d6341Smrgdone
10238b6d6341Smrgrm -rf conftest.dir
10241abf7346Smrg
10258b6d6341SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
10268b6d6341SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
10278b6d6341SmrgAC_SUBST([am__tar])
10288b6d6341SmrgAC_SUBST([am__untar])
10298b6d6341Smrg]) # _AM_PROG_TAR
10301abf7346Smrg
10318b6d6341Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
10328b6d6341Smrgdnl
103323a8d56dSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
10348b6d6341Smrgdnl 
10358b6d6341Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
103623a8d56dSmrgdnl copy of this software and associated documentation files (the "Software"),
103723a8d56dSmrgdnl to deal in the Software without restriction, including without limitation
103823a8d56dSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
103923a8d56dSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
104023a8d56dSmrgdnl Software is furnished to do so, subject to the following conditions:
10418b6d6341Smrgdnl
104223a8d56dSmrgdnl The above copyright notice and this permission notice (including the next
104323a8d56dSmrgdnl paragraph) shall be included in all copies or substantial portions of the
104423a8d56dSmrgdnl Software.
10458b6d6341Smrgdnl
104623a8d56dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104723a8d56dSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104823a8d56dSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
104923a8d56dSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105023a8d56dSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
105123a8d56dSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
105223a8d56dSmrgdnl DEALINGS IN THE SOFTWARE.
10538b6d6341Smrg
10548b6d6341Smrg# XORG_MACROS_VERSION(required-version)
10558b6d6341Smrg# -------------------------------------
10568b6d6341Smrg# Minimum version: 1.1.0
10571abf7346Smrg#
10588b6d6341Smrg# If you're using a macro added in Version 1.1 or newer, include this in
10598b6d6341Smrg# your configure.ac with the minimum required version, such as:
10608b6d6341Smrg# XORG_MACROS_VERSION(1.1)
10618b6d6341Smrg#
10628b6d6341Smrg# To ensure that this macro is defined, also add:
10638b6d6341Smrg# m4_ifndef([XORG_MACROS_VERSION],
10648b6d6341Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
10658b6d6341Smrg#
10668b6d6341Smrg#
10678b6d6341Smrg# See the "minimum version" comment for each macro you use to see what 
10688b6d6341Smrg# version you require.
10698b6d6341Smrgm4_defun([XORG_MACROS_VERSION],[
107023a8d56dSmrgm4_define([vers_have], [1.11.0])
10718b6d6341Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
10728b6d6341Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
10738b6d6341Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
10748b6d6341Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
10758b6d6341Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
10768b6d6341Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
10778b6d6341Smrgm4_undefine([vers_have])
10788b6d6341Smrgm4_undefine([maj_have])
10798b6d6341Smrgm4_undefine([maj_needed])
10808b6d6341Smrg]) # XORG_MACROS_VERSION
10811abf7346Smrg
10828b6d6341Smrg# XORG_PROG_RAWCPP()
10838b6d6341Smrg# ------------------
10848b6d6341Smrg# Minimum version: 1.0.0
10858b6d6341Smrg#
10868b6d6341Smrg# Find cpp program and necessary flags for use in pre-processing text files
10878b6d6341Smrg# such as man pages and config files
10888b6d6341SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
10898b6d6341SmrgAC_REQUIRE([AC_PROG_CPP])
10908b6d6341SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
10918b6d6341Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
10921abf7346Smrg
10938b6d6341Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
10948b6d6341Smrg# which is not the best choice for supporting other OS'es, but covers most
10958b6d6341Smrg# of the ones we need for now.
10968b6d6341SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
10978b6d6341SmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
10988b6d6341Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
10998b6d6341Smrg	AC_MSG_RESULT([no])
11008b6d6341Smrgelse
11018b6d6341Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
11028b6d6341Smrg		RAWCPPFLAGS=-undef
11038b6d6341Smrg		AC_MSG_RESULT([yes])
11048b6d6341Smrg	# under Cygwin unix is still defined even with -undef
11058b6d6341Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
11068b6d6341Smrg		RAWCPPFLAGS="-undef -ansi"
11078b6d6341Smrg		AC_MSG_RESULT([yes, with -ansi])
11088b6d6341Smrg	else
11098b6d6341Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
11108b6d6341Smrg	fi
11118b6d6341Smrgfi
11128b6d6341Smrgrm -f conftest.$ac_ext
11131abf7346Smrg
11148b6d6341SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
11158b6d6341SmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
11168b6d6341Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
11178b6d6341Smrg	AC_MSG_RESULT([no])
11188b6d6341Smrgelse
11198b6d6341Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
11208b6d6341Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
11218b6d6341Smrg		AC_MSG_RESULT([yes])
11228b6d6341Smrg	else
11238b6d6341Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
11248b6d6341Smrg	fi
11258b6d6341Smrgfi
11268b6d6341Smrgrm -f conftest.$ac_ext
11278b6d6341SmrgAC_SUBST(RAWCPPFLAGS)
11288b6d6341Smrg]) # XORG_PROG_RAWCPP
11291abf7346Smrg
11308b6d6341Smrg# XORG_MANPAGE_SECTIONS()
11318b6d6341Smrg# -----------------------
11328b6d6341Smrg# Minimum version: 1.0.0
11331abf7346Smrg#
11348b6d6341Smrg# Determine which sections man pages go in for the different man page types
11358b6d6341Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
11368b6d6341Smrg# Not sure if there's any better way than just hardcoding by OS name.
11378b6d6341Smrg# Override default settings by setting environment variables
113823a8d56dSmrg# Added MAN_SUBSTS in version 1.8
113923a8d56dSmrg# Added AC_PROG_SED in version 1.8
11401abf7346Smrg
11418b6d6341SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
11428b6d6341SmrgAC_REQUIRE([AC_CANONICAL_HOST])
114323a8d56dSmrgAC_REQUIRE([AC_PROG_SED])
11441abf7346Smrg
11458b6d6341Smrgif test x$APP_MAN_SUFFIX = x    ; then
11468b6d6341Smrg    APP_MAN_SUFFIX=1
11478b6d6341Smrgfi
11488b6d6341Smrgif test x$APP_MAN_DIR = x    ; then
11498b6d6341Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
11508b6d6341Smrgfi
11511abf7346Smrg
11528b6d6341Smrgif test x$LIB_MAN_SUFFIX = x    ; then
11538b6d6341Smrg    LIB_MAN_SUFFIX=3
11548b6d6341Smrgfi
11558b6d6341Smrgif test x$LIB_MAN_DIR = x    ; then
11568b6d6341Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
11578b6d6341Smrgfi
11581abf7346Smrg
11598b6d6341Smrgif test x$FILE_MAN_SUFFIX = x    ; then
11608b6d6341Smrg    case $host_os in
11618b6d6341Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
11628b6d6341Smrg	*)		FILE_MAN_SUFFIX=5  ;;
11638b6d6341Smrg    esac
11648b6d6341Smrgfi
11658b6d6341Smrgif test x$FILE_MAN_DIR = x    ; then
11668b6d6341Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
11678b6d6341Smrgfi
11681abf7346Smrg
11698b6d6341Smrgif test x$MISC_MAN_SUFFIX = x    ; then
11708b6d6341Smrg    case $host_os in
11718b6d6341Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
11728b6d6341Smrg	*)		MISC_MAN_SUFFIX=7  ;;
11738b6d6341Smrg    esac
11748b6d6341Smrgfi
11758b6d6341Smrgif test x$MISC_MAN_DIR = x    ; then
11768b6d6341Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
11778b6d6341Smrgfi
11781abf7346Smrg
11798b6d6341Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
11808b6d6341Smrg    case $host_os in
11818b6d6341Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
11828b6d6341Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
11838b6d6341Smrg    esac
11848b6d6341Smrgfi
11858b6d6341Smrgif test x$DRIVER_MAN_DIR = x    ; then
11868b6d6341Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
11878b6d6341Smrgfi
11881abf7346Smrg
11898b6d6341Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
11908b6d6341Smrg    case $host_os in
11918b6d6341Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
11928b6d6341Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
11938b6d6341Smrg    esac
11948b6d6341Smrgfi
11958b6d6341Smrgif test x$ADMIN_MAN_DIR = x    ; then
11968b6d6341Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
11978b6d6341Smrgfi
11981abf7346Smrg
11998b6d6341Smrg
12008b6d6341SmrgAC_SUBST([APP_MAN_SUFFIX])
12018b6d6341SmrgAC_SUBST([LIB_MAN_SUFFIX])
12028b6d6341SmrgAC_SUBST([FILE_MAN_SUFFIX])
12038b6d6341SmrgAC_SUBST([MISC_MAN_SUFFIX])
12048b6d6341SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
12058b6d6341SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
12068b6d6341SmrgAC_SUBST([APP_MAN_DIR])
12078b6d6341SmrgAC_SUBST([LIB_MAN_DIR])
12088b6d6341SmrgAC_SUBST([FILE_MAN_DIR])
12098b6d6341SmrgAC_SUBST([MISC_MAN_DIR])
12108b6d6341SmrgAC_SUBST([DRIVER_MAN_DIR])
12118b6d6341SmrgAC_SUBST([ADMIN_MAN_DIR])
121223a8d56dSmrg
121323a8d56dSmrgXORG_MAN_PAGE="X Version 11"
121423a8d56dSmrgAC_SUBST([XORG_MAN_PAGE])
121523a8d56dSmrgMAN_SUBSTS="\
121623a8d56dSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
121723a8d56dSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
121823a8d56dSmrg	-e 's|__xservername__|Xorg|g' \
121923a8d56dSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
122023a8d56dSmrg	-e 's|__projectroot__|\$(prefix)|g' \
122123a8d56dSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
122223a8d56dSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
122323a8d56dSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
122423a8d56dSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
122523a8d56dSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
122623a8d56dSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
122723a8d56dSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
122823a8d56dSmrgAC_SUBST([MAN_SUBSTS])
122923a8d56dSmrg
12308b6d6341Smrg]) # XORG_MANPAGE_SECTIONS
12318b6d6341Smrg
123223a8d56dSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
123323a8d56dSmrg# ------------------------
123423a8d56dSmrg# Minimum version: 1.7.0
123523a8d56dSmrg#
123623a8d56dSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
123723a8d56dSmrg# provided by xorg-sgml-doctools, if installed.
123823a8d56dSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
123923a8d56dSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
124023a8d56dSmrgXORG_SGML_PATH=
124123a8d56dSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
124223a8d56dSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
124323a8d56dSmrg    [m4_ifval([$1],[:],
124423a8d56dSmrg        [if test x"$cross_compiling" != x"yes" ; then
124523a8d56dSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
124623a8d56dSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
124723a8d56dSmrg         fi])
124823a8d56dSmrg    ])
124923a8d56dSmrg
125023a8d56dSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
125123a8d56dSmrg# the path and the name of the doc stylesheet
125223a8d56dSmrgif test "x$XORG_SGML_PATH" != "x" ; then
125323a8d56dSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
125423a8d56dSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
125523a8d56dSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
125623a8d56dSmrgelse
125723a8d56dSmrg   AC_MSG_RESULT([no])
125823a8d56dSmrgfi
125923a8d56dSmrg
126023a8d56dSmrgAC_SUBST(XORG_SGML_PATH)
126123a8d56dSmrgAC_SUBST(STYLESHEET_SRCDIR)
126223a8d56dSmrgAC_SUBST(XSL_STYLESHEET)
126323a8d56dSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
126423a8d56dSmrg]) # XORG_CHECK_SGML_DOCTOOLS
126523a8d56dSmrg
12668b6d6341Smrg# XORG_CHECK_LINUXDOC
12678b6d6341Smrg# -------------------
12688b6d6341Smrg# Minimum version: 1.0.0
12698b6d6341Smrg#
12708b6d6341Smrg# Defines the variable MAKE_TEXT if the necessary tools and
12718b6d6341Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
12728b6d6341Smrg# Whether or not the necessary tools and files are found can be checked
12738b6d6341Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
12748b6d6341SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
127523a8d56dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
127623a8d56dSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
12771abf7346Smrg
12788b6d6341SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
12791abf7346Smrg
128023a8d56dSmrgAC_MSG_CHECKING([whether to build documentation])
12811abf7346Smrg
128223a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
12838b6d6341Smrg   BUILDDOC=yes
12848b6d6341Smrgelse
12858b6d6341Smrg   BUILDDOC=no
12868b6d6341Smrgfi
12871abf7346Smrg
12888b6d6341SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
12891abf7346Smrg
12908b6d6341SmrgAC_MSG_RESULT([$BUILDDOC])
12911abf7346Smrg
129223a8d56dSmrgAC_MSG_CHECKING([whether to build pdf documentation])
12931abf7346Smrg
129423a8d56dSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
12958b6d6341Smrg   BUILDPDFDOC=yes
12968b6d6341Smrgelse
12978b6d6341Smrg   BUILDPDFDOC=no
12988b6d6341Smrgfi
12991abf7346Smrg
13008b6d6341SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
13011abf7346Smrg
13028b6d6341SmrgAC_MSG_RESULT([$BUILDPDFDOC])
13031abf7346Smrg
130423a8d56dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
13058b6d6341SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
13068b6d6341SmrgMAKE_PDF="$PS2PDF"
13078b6d6341SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
13081abf7346Smrg
13098b6d6341SmrgAC_SUBST(MAKE_TEXT)
13108b6d6341SmrgAC_SUBST(MAKE_PS)
13118b6d6341SmrgAC_SUBST(MAKE_PDF)
13128b6d6341SmrgAC_SUBST(MAKE_HTML)
13138b6d6341Smrg]) # XORG_CHECK_LINUXDOC
13148b6d6341Smrg
13158b6d6341Smrg# XORG_CHECK_DOCBOOK
13168b6d6341Smrg# -------------------
13178b6d6341Smrg# Minimum version: 1.0.0
13188b6d6341Smrg#
13198b6d6341Smrg# Checks for the ability to build output formats from SGML DocBook source.
13208b6d6341Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
13218b6d6341Smrg# indicates whether the necessary tools and files are found and, if set,
13228b6d6341Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
13238b6d6341SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
132423a8d56dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
132523a8d56dSmrg
13268b6d6341SmrgBUILDTXTDOC=no
13278b6d6341SmrgBUILDPDFDOC=no
13288b6d6341SmrgBUILDPSDOC=no
13298b6d6341SmrgBUILDHTMLDOC=no
13301abf7346Smrg
13318b6d6341SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
13328b6d6341SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
13338b6d6341SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
13348b6d6341SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
13351abf7346Smrg
133623a8d56dSmrgAC_MSG_CHECKING([whether to build text documentation])
133723a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
13388b6d6341Smrg   test x$BUILD_TXTDOC != xno; then
13398b6d6341Smrg	BUILDTXTDOC=yes
13408b6d6341Smrgfi
13418b6d6341SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
13428b6d6341SmrgAC_MSG_RESULT([$BUILDTXTDOC])
13431abf7346Smrg
134423a8d56dSmrgAC_MSG_CHECKING([whether to build PDF documentation])
134523a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
13468b6d6341Smrg   test x$BUILD_PDFDOC != xno; then
13478b6d6341Smrg	BUILDPDFDOC=yes
13488b6d6341Smrgfi
13498b6d6341SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
13508b6d6341SmrgAC_MSG_RESULT([$BUILDPDFDOC])
13511abf7346Smrg
135223a8d56dSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
135323a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
13548b6d6341Smrg   test x$BUILD_PSDOC != xno; then
13558b6d6341Smrg	BUILDPSDOC=yes
13568b6d6341Smrgfi
13578b6d6341SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
13588b6d6341SmrgAC_MSG_RESULT([$BUILDPSDOC])
13591abf7346Smrg
136023a8d56dSmrgAC_MSG_CHECKING([whether to build HTML documentation])
136123a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
13628b6d6341Smrg   test x$BUILD_HTMLDOC != xno; then
13638b6d6341Smrg	BUILDHTMLDOC=yes
13648b6d6341Smrgfi
13658b6d6341SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
13668b6d6341SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
13671abf7346Smrg
13688b6d6341SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
13698b6d6341SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
13708b6d6341SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
13718b6d6341SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
13721abf7346Smrg
13738b6d6341SmrgAC_SUBST(MAKE_TEXT)
13748b6d6341SmrgAC_SUBST(MAKE_PS)
13758b6d6341SmrgAC_SUBST(MAKE_PDF)
13768b6d6341SmrgAC_SUBST(MAKE_HTML)
13778b6d6341Smrg]) # XORG_CHECK_DOCBOOK
13781abf7346Smrg
137923a8d56dSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
138023a8d56dSmrg# ----------------
138123a8d56dSmrg# Minimum version: 1.5.0
138223a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
138323a8d56dSmrg#
138423a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
138523a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
138623a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
138723a8d56dSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
138823a8d56dSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
138923a8d56dSmrg# --with-xmlto assumes 'auto'.
139023a8d56dSmrg#
139123a8d56dSmrg# Interface to module:
139223a8d56dSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
139323a8d56dSmrg# XMLTO:	returns the path of the xmlto program found
139423a8d56dSmrg#		returns the path set by the user in the environment
139523a8d56dSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
139623a8d56dSmrg#		'no' user instructs the module not to use xmlto
139723a8d56dSmrg#
139823a8d56dSmrg# Added in version 1.10.0
139923a8d56dSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
140023a8d56dSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
140123a8d56dSmrg#
140223a8d56dSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
140323a8d56dSmrg#
140423a8d56dSmrgAC_DEFUN([XORG_WITH_XMLTO],[
140523a8d56dSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
140623a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
140723a8d56dSmrgAC_ARG_WITH(xmlto,
140823a8d56dSmrg	AS_HELP_STRING([--with-xmlto],
140923a8d56dSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
141023a8d56dSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
141123a8d56dSmrgm4_undefine([_defopt])
141223a8d56dSmrg
141323a8d56dSmrgif test "x$use_xmlto" = x"auto"; then
141423a8d56dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
141523a8d56dSmrg   if test "x$XMLTO" = "x"; then
141623a8d56dSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
141723a8d56dSmrg	have_xmlto=no
141823a8d56dSmrg   else
141923a8d56dSmrg        have_xmlto=yes
142023a8d56dSmrg   fi
142123a8d56dSmrgelif test "x$use_xmlto" = x"yes" ; then
142223a8d56dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
142323a8d56dSmrg   if test "x$XMLTO" = "x"; then
142423a8d56dSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
142523a8d56dSmrg   fi
142623a8d56dSmrg   have_xmlto=yes
142723a8d56dSmrgelif test "x$use_xmlto" = x"no" ; then
142823a8d56dSmrg   if test "x$XMLTO" != "x"; then
142923a8d56dSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
143023a8d56dSmrg   fi
143123a8d56dSmrg   have_xmlto=no
143223a8d56dSmrgelse
143323a8d56dSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
143423a8d56dSmrgfi
143523a8d56dSmrg
143623a8d56dSmrg# Test for a minimum version of xmlto, if provided.
143723a8d56dSmrgm4_ifval([$1],
143823a8d56dSmrg[if test "$have_xmlto" = yes; then
143923a8d56dSmrg    # scrape the xmlto version
144023a8d56dSmrg    AC_MSG_CHECKING([the xmlto version])
144123a8d56dSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
144223a8d56dSmrg    AC_MSG_RESULT([$xmlto_version])
144323a8d56dSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
144423a8d56dSmrg        [if test "x$use_xmlto" = xauto; then
144523a8d56dSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
144623a8d56dSmrg            have_xmlto=no
144723a8d56dSmrg        else
144823a8d56dSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
144923a8d56dSmrg        fi])
145023a8d56dSmrgfi])
145123a8d56dSmrg
145223a8d56dSmrg# Test for the ability of xmlto to generate a text target
145323a8d56dSmrghave_xmlto_text=no
145423a8d56dSmrgcat > conftest.xml << "EOF"
145523a8d56dSmrgEOF
145623a8d56dSmrgAS_IF([test "$have_xmlto" = yes],
145723a8d56dSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
145823a8d56dSmrg             [have_xmlto_text=yes],
145923a8d56dSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
146023a8d56dSmrgrm -f conftest.xml
146123a8d56dSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
146223a8d56dSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
146323a8d56dSmrg]) # XORG_WITH_XMLTO
146423a8d56dSmrg
146523a8d56dSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
146623a8d56dSmrg# ----------------
146723a8d56dSmrg# Minimum version: 1.5.0
146823a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
146923a8d56dSmrg#
147023a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
147123a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
147223a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
147323a8d56dSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
147423a8d56dSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
147523a8d56dSmrg# --with-asciidoc assumes 'auto'.
147623a8d56dSmrg#
147723a8d56dSmrg# Interface to module:
147823a8d56dSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
147923a8d56dSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
148023a8d56dSmrg#		 returns the path set by the user in the environment
148123a8d56dSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
148223a8d56dSmrg#		  'no' user instructs the module not to use asciidoc
148323a8d56dSmrg#
148423a8d56dSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
148523a8d56dSmrg#
148623a8d56dSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
148723a8d56dSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
148823a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
148923a8d56dSmrgAC_ARG_WITH(asciidoc,
149023a8d56dSmrg	AS_HELP_STRING([--with-asciidoc],
149123a8d56dSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
149223a8d56dSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
149323a8d56dSmrgm4_undefine([_defopt])
149423a8d56dSmrg
149523a8d56dSmrgif test "x$use_asciidoc" = x"auto"; then
149623a8d56dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
149723a8d56dSmrg   if test "x$ASCIIDOC" = "x"; then
149823a8d56dSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
149923a8d56dSmrg	have_asciidoc=no
150023a8d56dSmrg   else
150123a8d56dSmrg        have_asciidoc=yes
150223a8d56dSmrg   fi
150323a8d56dSmrgelif test "x$use_asciidoc" = x"yes" ; then
150423a8d56dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
150523a8d56dSmrg   if test "x$ASCIIDOC" = "x"; then
150623a8d56dSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
150723a8d56dSmrg   fi
150823a8d56dSmrg   have_asciidoc=yes
150923a8d56dSmrgelif test "x$use_asciidoc" = x"no" ; then
151023a8d56dSmrg   if test "x$ASCIIDOC" != "x"; then
151123a8d56dSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
151223a8d56dSmrg   fi
151323a8d56dSmrg   have_asciidoc=no
151423a8d56dSmrgelse
151523a8d56dSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
151623a8d56dSmrgfi
151723a8d56dSmrgm4_ifval([$1],
151823a8d56dSmrg[if test "$have_asciidoc" = yes; then
151923a8d56dSmrg    # scrape the asciidoc version
152023a8d56dSmrg    AC_MSG_CHECKING([the asciidoc version])
152123a8d56dSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
152223a8d56dSmrg    AC_MSG_RESULT([$asciidoc_version])
152323a8d56dSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
152423a8d56dSmrg        [if test "x$use_asciidoc" = xauto; then
152523a8d56dSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
152623a8d56dSmrg            have_asciidoc=no
152723a8d56dSmrg        else
152823a8d56dSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
152923a8d56dSmrg        fi])
153023a8d56dSmrgfi])
153123a8d56dSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
153223a8d56dSmrg]) # XORG_WITH_ASCIIDOC
153323a8d56dSmrg
153423a8d56dSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
153523a8d56dSmrg# --------------------------------
153623a8d56dSmrg# Minimum version: 1.5.0
153723a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
153823a8d56dSmrg#
153923a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
154023a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
154123a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
154223a8d56dSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
154323a8d56dSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
154423a8d56dSmrg# --with-doxygen assumes 'auto'.
154523a8d56dSmrg#
154623a8d56dSmrg# Interface to module:
154723a8d56dSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
154823a8d56dSmrg# DOXYGEN:	 returns the path of the doxygen program found
154923a8d56dSmrg#		 returns the path set by the user in the environment
155023a8d56dSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
155123a8d56dSmrg#		  'no' user instructs the module not to use doxygen
155223a8d56dSmrg#
155323a8d56dSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
155423a8d56dSmrg#
155523a8d56dSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
155623a8d56dSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
155723a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
155823a8d56dSmrgAC_ARG_WITH(doxygen,
155923a8d56dSmrg	AS_HELP_STRING([--with-doxygen],
156023a8d56dSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
156123a8d56dSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
156223a8d56dSmrgm4_undefine([_defopt])
156323a8d56dSmrg
156423a8d56dSmrgif test "x$use_doxygen" = x"auto"; then
156523a8d56dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
156623a8d56dSmrg   if test "x$DOXYGEN" = "x"; then
156723a8d56dSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
156823a8d56dSmrg	have_doxygen=no
156923a8d56dSmrg   else
157023a8d56dSmrg        have_doxygen=yes
157123a8d56dSmrg   fi
157223a8d56dSmrgelif test "x$use_doxygen" = x"yes" ; then
157323a8d56dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
157423a8d56dSmrg   if test "x$DOXYGEN" = "x"; then
157523a8d56dSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
157623a8d56dSmrg   fi
157723a8d56dSmrg   have_doxygen=yes
157823a8d56dSmrgelif test "x$use_doxygen" = x"no" ; then
157923a8d56dSmrg   if test "x$DOXYGEN" != "x"; then
158023a8d56dSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
158123a8d56dSmrg   fi
158223a8d56dSmrg   have_doxygen=no
158323a8d56dSmrgelse
158423a8d56dSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
158523a8d56dSmrgfi
158623a8d56dSmrgm4_ifval([$1],
158723a8d56dSmrg[if test "$have_doxygen" = yes; then
158823a8d56dSmrg    # scrape the doxygen version
158923a8d56dSmrg    AC_MSG_CHECKING([the doxygen version])
159023a8d56dSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
159123a8d56dSmrg    AC_MSG_RESULT([$doxygen_version])
159223a8d56dSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
159323a8d56dSmrg        [if test "x$use_doxygen" = xauto; then
159423a8d56dSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
159523a8d56dSmrg            have_doxygen=no
159623a8d56dSmrg        else
159723a8d56dSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
159823a8d56dSmrg        fi])
159923a8d56dSmrgfi])
160023a8d56dSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
160123a8d56dSmrg]) # XORG_WITH_DOXYGEN
160223a8d56dSmrg
160323a8d56dSmrg# XORG_WITH_GROFF([DEFAULT])
160423a8d56dSmrg# ----------------
160523a8d56dSmrg# Minimum version: 1.6.0
160623a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
160723a8d56dSmrg#
160823a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
160923a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
161023a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
161123a8d56dSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
161223a8d56dSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
161323a8d56dSmrg# --with-groff assumes 'auto'.
161423a8d56dSmrg#
161523a8d56dSmrg# Interface to module:
161623a8d56dSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
161723a8d56dSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
161823a8d56dSmrg# HAVE_GROFF_MS: the -ms macros package
161923a8d56dSmrg# GROFF:	 returns the path of the groff program found
162023a8d56dSmrg#		 returns the path set by the user in the environment
162123a8d56dSmrg# --with-groff:	 'yes' user instructs the module to use groff
162223a8d56dSmrg#		 'no' user instructs the module not to use groff
162323a8d56dSmrg#
162423a8d56dSmrg# Added in version 1.9.0:
162523a8d56dSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
162623a8d56dSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
162723a8d56dSmrg#		   psselect from the psutils package.
162823a8d56dSmrg#		   the ghostcript package. Refer to the grohtml man pages
162923a8d56dSmrg#
163023a8d56dSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
163123a8d56dSmrg#
163223a8d56dSmrg# OS and distros often splits groff in a basic and full package, the former
163323a8d56dSmrg# having the groff program and the later having devices, fonts and macros
163423a8d56dSmrg# Checking for the groff executable is not enough.
163523a8d56dSmrg#
163623a8d56dSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
163723a8d56dSmrg# unset HAVE_GROFF or GROFF env variables.
163823a8d56dSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
163923a8d56dSmrg#
164023a8d56dSmrgAC_DEFUN([XORG_WITH_GROFF],[
164123a8d56dSmrgAC_ARG_VAR([GROFF], [Path to groff command])
164223a8d56dSmrgm4_define([_defopt], m4_default([$1], [auto]))
164323a8d56dSmrgAC_ARG_WITH(groff,
164423a8d56dSmrg	AS_HELP_STRING([--with-groff],
164523a8d56dSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
164623a8d56dSmrg	   [use_groff=$withval], [use_groff=]_defopt)
164723a8d56dSmrgm4_undefine([_defopt])
164823a8d56dSmrg
164923a8d56dSmrgif test "x$use_groff" = x"auto"; then
165023a8d56dSmrg   AC_PATH_PROG([GROFF], [groff])
165123a8d56dSmrg   if test "x$GROFF" = "x"; then
165223a8d56dSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
165323a8d56dSmrg	have_groff=no
165423a8d56dSmrg   else
165523a8d56dSmrg        have_groff=yes
165623a8d56dSmrg   fi
165723a8d56dSmrgelif test "x$use_groff" = x"yes" ; then
165823a8d56dSmrg   AC_PATH_PROG([GROFF], [groff])
165923a8d56dSmrg   if test "x$GROFF" = "x"; then
166023a8d56dSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
166123a8d56dSmrg   fi
166223a8d56dSmrg   have_groff=yes
166323a8d56dSmrgelif test "x$use_groff" = x"no" ; then
166423a8d56dSmrg   if test "x$GROFF" != "x"; then
166523a8d56dSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
166623a8d56dSmrg   fi
166723a8d56dSmrg   have_groff=no
166823a8d56dSmrgelse
166923a8d56dSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
167023a8d56dSmrgfi
167123a8d56dSmrg
167223a8d56dSmrg# We have groff, test for the presence of the macro packages
167323a8d56dSmrgif test "x$have_groff" = x"yes"; then
167423a8d56dSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
167523a8d56dSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
167623a8d56dSmrg        groff_ms_works=yes
167723a8d56dSmrg    else
167823a8d56dSmrg        groff_ms_works=no
167923a8d56dSmrg    fi
168023a8d56dSmrg    AC_MSG_RESULT([$groff_ms_works])
168123a8d56dSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
168223a8d56dSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
168323a8d56dSmrg        groff_mm_works=yes
168423a8d56dSmrg    else
168523a8d56dSmrg        groff_mm_works=no
168623a8d56dSmrg    fi
168723a8d56dSmrg    AC_MSG_RESULT([$groff_mm_works])
168823a8d56dSmrgfi
168923a8d56dSmrg
169023a8d56dSmrg# We have groff, test for HTML dependencies, one command per package
169123a8d56dSmrgif test "x$have_groff" = x"yes"; then
169223a8d56dSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
169323a8d56dSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
169423a8d56dSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
169523a8d56dSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
169623a8d56dSmrg      have_groff_html=yes
169723a8d56dSmrg   else
169823a8d56dSmrg      have_groff_html=no
169923a8d56dSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
170023a8d56dSmrg   fi
170123a8d56dSmrgfi
170223a8d56dSmrg
170323a8d56dSmrg# Set Automake conditionals for Makefiles
170423a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
170523a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
170623a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
170723a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
170823a8d56dSmrg]) # XORG_WITH_GROFF
170923a8d56dSmrg
171023a8d56dSmrg# XORG_WITH_FOP([DEFAULT])
171123a8d56dSmrg# ----------------
171223a8d56dSmrg# Minimum version: 1.6.0
171323a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
171423a8d56dSmrg#
171523a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
171623a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
171723a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
171823a8d56dSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
171923a8d56dSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
172023a8d56dSmrg# --with-fop assumes 'auto'.
172123a8d56dSmrg#
172223a8d56dSmrg# Interface to module:
172323a8d56dSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
172423a8d56dSmrg# FOP:	 	returns the path of the fop program found
172523a8d56dSmrg#		returns the path set by the user in the environment
172623a8d56dSmrg# --with-fop: 	'yes' user instructs the module to use fop
172723a8d56dSmrg#		'no' user instructs the module not to use fop
172823a8d56dSmrg#
172923a8d56dSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
173023a8d56dSmrg#
173123a8d56dSmrgAC_DEFUN([XORG_WITH_FOP],[
173223a8d56dSmrgAC_ARG_VAR([FOP], [Path to fop command])
173323a8d56dSmrgm4_define([_defopt], m4_default([$1], [auto]))
173423a8d56dSmrgAC_ARG_WITH(fop,
173523a8d56dSmrg	AS_HELP_STRING([--with-fop],
173623a8d56dSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
173723a8d56dSmrg	   [use_fop=$withval], [use_fop=]_defopt)
173823a8d56dSmrgm4_undefine([_defopt])
173923a8d56dSmrg
174023a8d56dSmrgif test "x$use_fop" = x"auto"; then
174123a8d56dSmrg   AC_PATH_PROG([FOP], [fop])
174223a8d56dSmrg   if test "x$FOP" = "x"; then
174323a8d56dSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
174423a8d56dSmrg	have_fop=no
174523a8d56dSmrg   else
174623a8d56dSmrg        have_fop=yes
174723a8d56dSmrg   fi
174823a8d56dSmrgelif test "x$use_fop" = x"yes" ; then
174923a8d56dSmrg   AC_PATH_PROG([FOP], [fop])
175023a8d56dSmrg   if test "x$FOP" = "x"; then
175123a8d56dSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
175223a8d56dSmrg   fi
175323a8d56dSmrg   have_fop=yes
175423a8d56dSmrgelif test "x$use_fop" = x"no" ; then
175523a8d56dSmrg   if test "x$FOP" != "x"; then
175623a8d56dSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
175723a8d56dSmrg   fi
175823a8d56dSmrg   have_fop=no
175923a8d56dSmrgelse
176023a8d56dSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
176123a8d56dSmrgfi
176223a8d56dSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
176323a8d56dSmrg]) # XORG_WITH_FOP
176423a8d56dSmrg
176523a8d56dSmrg# XORG_WITH_PS2PDF([DEFAULT])
176623a8d56dSmrg# ----------------
176723a8d56dSmrg# Minimum version: 1.6.0
176823a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
176923a8d56dSmrg#
177023a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
177123a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
177223a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
177323a8d56dSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
177423a8d56dSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
177523a8d56dSmrg# --with-ps2pdf assumes 'auto'.
177623a8d56dSmrg#
177723a8d56dSmrg# Interface to module:
177823a8d56dSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
177923a8d56dSmrg# PS2PDF:	returns the path of the ps2pdf program found
178023a8d56dSmrg#		returns the path set by the user in the environment
178123a8d56dSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
178223a8d56dSmrg#		 'no' user instructs the module not to use ps2pdf
178323a8d56dSmrg#
178423a8d56dSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
178523a8d56dSmrg#
178623a8d56dSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
178723a8d56dSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
178823a8d56dSmrgm4_define([_defopt], m4_default([$1], [auto]))
178923a8d56dSmrgAC_ARG_WITH(ps2pdf,
179023a8d56dSmrg	AS_HELP_STRING([--with-ps2pdf],
179123a8d56dSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
179223a8d56dSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
179323a8d56dSmrgm4_undefine([_defopt])
179423a8d56dSmrg
179523a8d56dSmrgif test "x$use_ps2pdf" = x"auto"; then
179623a8d56dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
179723a8d56dSmrg   if test "x$PS2PDF" = "x"; then
179823a8d56dSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
179923a8d56dSmrg	have_ps2pdf=no
180023a8d56dSmrg   else
180123a8d56dSmrg        have_ps2pdf=yes
180223a8d56dSmrg   fi
180323a8d56dSmrgelif test "x$use_ps2pdf" = x"yes" ; then
180423a8d56dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
180523a8d56dSmrg   if test "x$PS2PDF" = "x"; then
180623a8d56dSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
180723a8d56dSmrg   fi
180823a8d56dSmrg   have_ps2pdf=yes
180923a8d56dSmrgelif test "x$use_ps2pdf" = x"no" ; then
181023a8d56dSmrg   if test "x$PS2PDF" != "x"; then
181123a8d56dSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
181223a8d56dSmrg   fi
181323a8d56dSmrg   have_ps2pdf=no
181423a8d56dSmrgelse
181523a8d56dSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
181623a8d56dSmrgfi
181723a8d56dSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
181823a8d56dSmrg]) # XORG_WITH_PS2PDF
181923a8d56dSmrg
182023a8d56dSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
182123a8d56dSmrg# ----------------
182223a8d56dSmrg# Minimum version: 1.6.0
182323a8d56dSmrg#
182423a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
182523a8d56dSmrg# not at the appropriate level. This macro enables a builder to skip all
182623a8d56dSmrg# documentation targets except traditional man pages.
182723a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
182823a8d56dSmrg# maximum flexibilty in controlling documentation building.
182923a8d56dSmrg# Refer to:
183023a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
183123a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
183223a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
183323a8d56dSmrg# XORG_WITH_FOP           --with-fop
183423a8d56dSmrg# XORG_WITH_GROFF         --with-groff
183523a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
183623a8d56dSmrg#
183723a8d56dSmrg# Interface to module:
183823a8d56dSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
183923a8d56dSmrg# --enable-docs: 'yes' user instructs the module to generate docs
184023a8d56dSmrg#		 'no' user instructs the module not to generate docs
184123a8d56dSmrg# parm1:	specify the default value, yes or no.
184223a8d56dSmrg#
184323a8d56dSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
184423a8d56dSmrgm4_define([default], m4_default([$1], [yes]))
184523a8d56dSmrgAC_ARG_ENABLE(docs,
184623a8d56dSmrg	AS_HELP_STRING([--enable-docs],
184723a8d56dSmrg	   [Enable building the documentation (default: ]default[)]),
184823a8d56dSmrg	   [build_docs=$enableval], [build_docs=]default)
184923a8d56dSmrgm4_undefine([default])
185023a8d56dSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
185123a8d56dSmrgAC_MSG_CHECKING([whether to build documentation])
185223a8d56dSmrgAC_MSG_RESULT([$build_docs])
185323a8d56dSmrg]) # XORG_ENABLE_DOCS
185423a8d56dSmrg
185523a8d56dSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
185623a8d56dSmrg# ----------------
185723a8d56dSmrg# Minimum version: 1.6.0
185823a8d56dSmrg#
185923a8d56dSmrg# This macro enables a builder to skip all developer documentation.
186023a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
186123a8d56dSmrg# maximum flexibilty in controlling documentation building.
186223a8d56dSmrg# Refer to:
186323a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
186423a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
186523a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
186623a8d56dSmrg# XORG_WITH_FOP           --with-fop
186723a8d56dSmrg# XORG_WITH_GROFF         --with-groff
186823a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
186923a8d56dSmrg#
187023a8d56dSmrg# Interface to module:
187123a8d56dSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
187223a8d56dSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
187323a8d56dSmrg#			'no' user instructs the module not to generate developer docs
187423a8d56dSmrg# parm1:		specify the default value, yes or no.
187523a8d56dSmrg#
187623a8d56dSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
187723a8d56dSmrgm4_define([devel_default], m4_default([$1], [yes]))
187823a8d56dSmrgAC_ARG_ENABLE(devel-docs,
187923a8d56dSmrg	AS_HELP_STRING([--enable-devel-docs],
188023a8d56dSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
188123a8d56dSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
188223a8d56dSmrgm4_undefine([devel_default])
188323a8d56dSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
188423a8d56dSmrgAC_MSG_CHECKING([whether to build developer documentation])
188523a8d56dSmrgAC_MSG_RESULT([$build_devel_docs])
188623a8d56dSmrg]) # XORG_ENABLE_DEVEL_DOCS
188723a8d56dSmrg
188823a8d56dSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
188923a8d56dSmrg# ----------------
189023a8d56dSmrg# Minimum version: 1.6.0
189123a8d56dSmrg#
189223a8d56dSmrg# This macro enables a builder to skip all functional specification targets.
189323a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
189423a8d56dSmrg# maximum flexibilty in controlling documentation building.
189523a8d56dSmrg# Refer to:
189623a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
189723a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
189823a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
189923a8d56dSmrg# XORG_WITH_FOP           --with-fop
190023a8d56dSmrg# XORG_WITH_GROFF         --with-groff
190123a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
190223a8d56dSmrg#
190323a8d56dSmrg# Interface to module:
190423a8d56dSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
190523a8d56dSmrg# --enable-specs:	'yes' user instructs the module to generate specs
190623a8d56dSmrg#			'no' user instructs the module not to generate specs
190723a8d56dSmrg# parm1:		specify the default value, yes or no.
190823a8d56dSmrg#
190923a8d56dSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
191023a8d56dSmrgm4_define([spec_default], m4_default([$1], [yes]))
191123a8d56dSmrgAC_ARG_ENABLE(specs,
191223a8d56dSmrg	AS_HELP_STRING([--enable-specs],
191323a8d56dSmrg	   [Enable building the specs (default: ]spec_default[)]),
191423a8d56dSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
191523a8d56dSmrgm4_undefine([spec_default])
191623a8d56dSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
191723a8d56dSmrgAC_MSG_CHECKING([whether to build functional specifications])
191823a8d56dSmrgAC_MSG_RESULT([$build_specs])
191923a8d56dSmrg]) # XORG_ENABLE_SPECS
192023a8d56dSmrg
19218b6d6341Smrg# XORG_CHECK_MALLOC_ZERO
19228b6d6341Smrg# ----------------------
19238b6d6341Smrg# Minimum version: 1.0.0
19248b6d6341Smrg#
19258b6d6341Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
19268b6d6341Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
19278b6d6341Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
19288b6d6341SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
19298b6d6341SmrgAC_ARG_ENABLE(malloc0returnsnull,
19308b6d6341Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
19318b6d6341Smrg		       [malloc(0) returns NULL (default: auto)]),
19328b6d6341Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
19338b6d6341Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
19348b6d6341Smrg
19358b6d6341SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
19368b6d6341Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
19378b6d6341Smrg	AC_RUN_IFELSE([
19388b6d6341Smrgchar *malloc();
19398b6d6341Smrgchar *realloc();
19408b6d6341Smrgchar *calloc();
19418b6d6341Smrgmain() {
19428b6d6341Smrg    char *m0, *r0, *c0, *p;
19438b6d6341Smrg    m0 = malloc(0);
19448b6d6341Smrg    p = malloc(10);
19458b6d6341Smrg    r0 = realloc(p,0);
19468b6d6341Smrg    c0 = calloc(0);
19478b6d6341Smrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
19488b6d6341Smrg}],
19498b6d6341Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
195023a8d56dSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
195123a8d56dSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
19521abf7346Smrgfi
19538b6d6341SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
19548b6d6341Smrg
19558b6d6341Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
19568b6d6341Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
19578b6d6341Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
19588b6d6341Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
19598b6d6341Smrgelse
19608b6d6341Smrg	MALLOC_ZERO_CFLAGS=""
19618b6d6341Smrg	XMALLOC_ZERO_CFLAGS=""
19628b6d6341Smrg	XTMALLOC_ZERO_CFLAGS=""
19631abf7346Smrgfi
19641abf7346Smrg
19658b6d6341SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
19668b6d6341SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
19678b6d6341SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
19688b6d6341Smrg]) # XORG_CHECK_MALLOC_ZERO
19691abf7346Smrg
19708b6d6341Smrg# XORG_WITH_LINT()
19718b6d6341Smrg# ----------------
19728b6d6341Smrg# Minimum version: 1.1.0
19731abf7346Smrg#
197423a8d56dSmrg# This macro enables the use of a tool that flags some suspicious and
197523a8d56dSmrg# non-portable constructs (likely to be bugs) in C language source code.
197623a8d56dSmrg# It will attempt to locate the tool and use appropriate options.
197723a8d56dSmrg# There are various lint type tools on different platforms.
197823a8d56dSmrg#
197923a8d56dSmrg# Interface to module:
198023a8d56dSmrg# LINT:		returns the path to the tool found on the platform
198123a8d56dSmrg#		or the value set to LINT on the configure cmd line
198223a8d56dSmrg#		also an Automake conditional
198323a8d56dSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
198423a8d56dSmrg#
198523a8d56dSmrg# --with-lint:	'yes' user instructs the module to use lint
198623a8d56dSmrg#		'no' user instructs the module not to use lint (default)
198723a8d56dSmrg#
198823a8d56dSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
198923a8d56dSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
19908b6d6341Smrg#
19918b6d6341SmrgAC_DEFUN([XORG_WITH_LINT],[
19921abf7346Smrg
199323a8d56dSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
199423a8d56dSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
19958b6d6341SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
19968b6d6341Smrg		[Use a lint-style source code checker (default: disabled)])],
19978b6d6341Smrg		[use_lint=$withval], [use_lint=no])
199823a8d56dSmrg
199923a8d56dSmrg# Obtain platform specific info like program name and options
200023a8d56dSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
200123a8d56dSmrgcase $host_os in
200223a8d56dSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
200323a8d56dSmrg	lint_name=splint
200423a8d56dSmrg	lint_options="-badflag"
200523a8d56dSmrg	;;
200623a8d56dSmrg  *freebsd* | *netbsd*)
200723a8d56dSmrg	lint_name=lint
200823a8d56dSmrg	lint_options="-u -b"
200923a8d56dSmrg	;;
201023a8d56dSmrg  *solaris*)
201123a8d56dSmrg	lint_name=lint
201223a8d56dSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
201323a8d56dSmrg	;;
201423a8d56dSmrgesac
201523a8d56dSmrg
201623a8d56dSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
201723a8d56dSmrgif test "x$use_lint" = x"yes" ; then
201823a8d56dSmrg   AC_PATH_PROG([LINT], [$lint_name])
201923a8d56dSmrg   if test "x$LINT" = "x"; then
202023a8d56dSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
202123a8d56dSmrg   fi
202223a8d56dSmrgelif test "x$use_lint" = x"no" ; then
202323a8d56dSmrg   if test "x$LINT" != "x"; then
202423a8d56dSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
202523a8d56dSmrg   fi
20268b6d6341Smrgelse
202723a8d56dSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
20288b6d6341Smrgfi
202923a8d56dSmrg
203023a8d56dSmrg# User supplied flags override default flags
203123a8d56dSmrgif test "x$LINT_FLAGS" != "x"; then
203223a8d56dSmrg   lint_options=$LINT_FLAGS
20338b6d6341Smrgfi
20341abf7346Smrg
203523a8d56dSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
203623a8d56dSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
20371abf7346Smrg
20388b6d6341Smrg]) # XORG_WITH_LINT
20391abf7346Smrg
20408b6d6341Smrg# XORG_LINT_LIBRARY(LIBNAME)
20418b6d6341Smrg# --------------------------
20428b6d6341Smrg# Minimum version: 1.1.0
20438b6d6341Smrg#
20448b6d6341Smrg# Sets up flags for building lint libraries for checking programs that call
20458b6d6341Smrg# functions in the library.
20468b6d6341Smrg#
204723a8d56dSmrg# Interface to module:
204823a8d56dSmrg# LINTLIB		- Automake variable with the name of lint library file to make
204923a8d56dSmrg# MAKE_LINT_LIB		- Automake conditional
205023a8d56dSmrg#
205123a8d56dSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
205223a8d56dSmrg#			  - 'no' user instructs the module not to create a lint library (default)
20538b6d6341Smrg
20548b6d6341SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
20558b6d6341SmrgAC_REQUIRE([XORG_WITH_LINT])
20568b6d6341SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
20578b6d6341Smrg	[Create lint library (default: disabled)])],
20588b6d6341Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
205923a8d56dSmrg
206023a8d56dSmrgif test "x$make_lint_lib" = x"yes" ; then
206123a8d56dSmrg   LINTLIB=llib-l$1.ln
206223a8d56dSmrg   if test "x$LINT" = "x"; then
206323a8d56dSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
206423a8d56dSmrg   fi
206523a8d56dSmrgelif test "x$make_lint_lib" != x"no" ; then
206623a8d56dSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
20671abf7346Smrgfi
206823a8d56dSmrg
20698b6d6341SmrgAC_SUBST(LINTLIB)
20708b6d6341SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
20711abf7346Smrg
20728b6d6341Smrg]) # XORG_LINT_LIBRARY
20731abf7346Smrg
20748b6d6341Smrg# XORG_CWARNFLAGS
20751abf7346Smrg# ---------------
20768b6d6341Smrg# Minimum version: 1.2.0
20778b6d6341Smrg#
20788b6d6341Smrg# Defines CWARNFLAGS to enable C compiler warnings.
20798b6d6341Smrg#
20808b6d6341SmrgAC_DEFUN([XORG_CWARNFLAGS], [
208123a8d56dSmrgAC_REQUIRE([AC_PROG_CC_C99])
20828b6d6341Smrgif  test "x$GCC" = xyes ; then
20838b6d6341Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
20848b6d6341Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
208523a8d56dSmrg-Wbad-function-cast -Wformat=2"
20868b6d6341Smrg    case `$CC -dumpversion` in
20878b6d6341Smrg    3.4.* | 4.*)
20888b6d6341Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
20898b6d6341Smrg	;;
20908b6d6341Smrg    esac
20918b6d6341Smrgelse
20928b6d6341Smrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
20938b6d6341Smrg    if test "x$SUNCC" = "xyes"; then
20948b6d6341Smrg	CWARNFLAGS="-v"
20958b6d6341Smrg    fi
20968b6d6341Smrgfi
20978b6d6341SmrgAC_SUBST(CWARNFLAGS)
20988b6d6341Smrg]) # XORG_CWARNFLAGS
20991abf7346Smrg
21008b6d6341Smrg# XORG_STRICT_OPTION
21018b6d6341Smrg# -----------------------
21028b6d6341Smrg# Minimum version: 1.3.0
21038b6d6341Smrg#
21048b6d6341Smrg# Add configure option to enable strict compilation
21058b6d6341SmrgAC_DEFUN([XORG_STRICT_OPTION], [
210623a8d56dSmrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
21078b6d6341SmrgAC_REQUIRE([AC_PROG_CC_C99])
21088b6d6341SmrgAC_REQUIRE([XORG_CWARNFLAGS])
21098b6d6341Smrg
21108b6d6341SmrgAC_ARG_ENABLE(strict-compilation,
21118b6d6341Smrg			  AS_HELP_STRING([--enable-strict-compilation],
21128b6d6341Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21138b6d6341Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
21148b6d6341Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21158b6d6341Smrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
21168b6d6341Smrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
21178b6d6341Smrg	if test "x$GCC" = xyes ; then
21188b6d6341Smrg		STRICT_CFLAGS="-pedantic -Werror"
21198b6d6341Smrg	elif test "x$SUNCC" = "xyes"; then
21208b6d6341Smrg		STRICT_CFLAGS="-errwarn"
21218b6d6341Smrg    elif test "x$INTELCC" = "xyes"; then
21228b6d6341Smrg		STRICT_CFLAGS="-Werror"
21238b6d6341Smrg	fi
21248b6d6341Smrgfi
21258b6d6341SmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
21268b6d6341SmrgAC_SUBST([CWARNFLAGS])
21278b6d6341Smrg]) # XORG_STRICT_OPTION
21281abf7346Smrg
21298b6d6341Smrg# XORG_DEFAULT_OPTIONS
21308b6d6341Smrg# --------------------
21318b6d6341Smrg# Minimum version: 1.3.0
21321abf7346Smrg#
21338b6d6341Smrg# Defines default options for X.Org modules.
21348b6d6341Smrg#
21358b6d6341SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
213623a8d56dSmrgAC_REQUIRE([AC_PROG_INSTALL])
21378b6d6341SmrgXORG_CWARNFLAGS
21388b6d6341SmrgXORG_STRICT_OPTION
21398b6d6341SmrgXORG_RELEASE_VERSION
21408b6d6341SmrgXORG_CHANGELOG
214123a8d56dSmrgXORG_INSTALL
21428b6d6341SmrgXORG_MANPAGE_SECTIONS
214323a8d56dSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
214423a8d56dSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21458b6d6341Smrg]) # XORG_DEFAULT_OPTIONS
214623a8d56dSmrg
214723a8d56dSmrg# XORG_INSTALL()
214823a8d56dSmrg# ----------------
214923a8d56dSmrg# Minimum version: 1.4.0
215023a8d56dSmrg#
215123a8d56dSmrg# Defines the variable INSTALL_CMD as the command to copy
215223a8d56dSmrg# INSTALL from $prefix/share/util-macros.
215323a8d56dSmrg#
215423a8d56dSmrgAC_DEFUN([XORG_INSTALL], [
215523a8d56dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
215623a8d56dSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
215723a8d56dSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
215823a8d56dSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
215923a8d56dSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
216023a8d56dSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
216123a8d56dSmrgAC_SUBST([INSTALL_CMD])
216223a8d56dSmrg]) # XORG_INSTALL
21638b6d6341Smrgdnl Copyright 2005 Red Hat, Inc
21648b6d6341Smrgdnl
21658b6d6341Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21668b6d6341Smrgdnl documentation for any purpose is hereby granted without fee, provided that
21678b6d6341Smrgdnl the above copyright notice appear in all copies and that both that
21688b6d6341Smrgdnl copyright notice and this permission notice appear in supporting
21698b6d6341Smrgdnl documentation.
21708b6d6341Smrgdnl
21718b6d6341Smrgdnl The above copyright notice and this permission notice shall be included
21728b6d6341Smrgdnl in all copies or substantial portions of the Software.
21738b6d6341Smrgdnl
21748b6d6341Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21758b6d6341Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21768b6d6341Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21778b6d6341Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21788b6d6341Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21798b6d6341Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21808b6d6341Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
21818b6d6341Smrgdnl
21828b6d6341Smrgdnl Except as contained in this notice, the name of the copyright holders shall
21838b6d6341Smrgdnl not be used in advertising or otherwise to promote the sale, use or
21848b6d6341Smrgdnl other dealings in this Software without prior written authorization
21858b6d6341Smrgdnl from the copyright holders.
21868b6d6341Smrgdnl
21871abf7346Smrg
21888b6d6341Smrg# XORG_RELEASE_VERSION
21898b6d6341Smrg# --------------------
219023a8d56dSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
21918b6d6341Smrg 
21928b6d6341SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21938b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21948b6d6341Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21958b6d6341Smrg		[Major version of this package])
21968b6d6341Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21978b6d6341Smrg	if test "x$PVM" = "x"; then
21988b6d6341Smrg		PVM="0"
21998b6d6341Smrg	fi
22008b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
22018b6d6341Smrg		[$PVM],
22028b6d6341Smrg		[Minor version of this package])
22038b6d6341Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
22048b6d6341Smrg	if test "x$PVP" = "x"; then
22058b6d6341Smrg		PVP="0"
22068b6d6341Smrg	fi
22078b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
22088b6d6341Smrg		[$PVP],
22098b6d6341Smrg		[Patch version of this package])
22108b6d6341Smrg])
22111abf7346Smrg
22128b6d6341Smrg# XORG_CHANGELOG()
22138b6d6341Smrg# ----------------
22148b6d6341Smrg# Minimum version: 1.2.0
22158b6d6341Smrg#
22168b6d6341Smrg# Defines the variable CHANGELOG_CMD as the command to generate
22178b6d6341Smrg# ChangeLog from git.
22188b6d6341Smrg#
22198b6d6341Smrg#
22208b6d6341SmrgAC_DEFUN([XORG_CHANGELOG], [
222123a8d56dSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
222223a8d56dSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
222323a8d56dSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22248b6d6341Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
22258b6d6341SmrgAC_SUBST([CHANGELOG_CMD])
22268b6d6341Smrg]) # XORG_CHANGELOG
22271abf7346Smrg
22288b6d6341Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
22298b6d6341Smrg# 
22308b6d6341Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
22318b6d6341Smrg#
22328b6d6341Smrg# This program is free software; you can redistribute it and/or modify
22338b6d6341Smrg# it under the terms of the GNU General Public License as published by
22348b6d6341Smrg# the Free Software Foundation; either version 2 of the License, or
22358b6d6341Smrg# (at your option) any later version.
22368b6d6341Smrg#
22378b6d6341Smrg# This program is distributed in the hope that it will be useful, but
22388b6d6341Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
22398b6d6341Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22408b6d6341Smrg# General Public License for more details.
22418b6d6341Smrg#
22428b6d6341Smrg# You should have received a copy of the GNU General Public License
22438b6d6341Smrg# along with this program; if not, write to the Free Software
22448b6d6341Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22458b6d6341Smrg#
22468b6d6341Smrg# As a special exception to the GNU General Public License, if you
22478b6d6341Smrg# distribute this file as part of a program that contains a
22488b6d6341Smrg# configuration script generated by Autoconf, you may include it under
22498b6d6341Smrg# the same distribution terms that you use for the rest of that program.
22501abf7346Smrg
22518b6d6341Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
22521abf7346Smrg# ----------------------------------
22538b6d6341SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
22548b6d6341Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
22558b6d6341Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
22568b6d6341SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
22578b6d6341Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
22588b6d6341Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
22598b6d6341Smrgfi
22608b6d6341Smrgif test -n "$PKG_CONFIG"; then
22618b6d6341Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
22628b6d6341Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
22638b6d6341Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
22648b6d6341Smrg		AC_MSG_RESULT([yes])
22658b6d6341Smrg	else
22668b6d6341Smrg		AC_MSG_RESULT([no])
22678b6d6341Smrg		PKG_CONFIG=""
22688b6d6341Smrg	fi
22698b6d6341Smrg		
22708b6d6341Smrgfi[]dnl
22718b6d6341Smrg])# PKG_PROG_PKG_CONFIG
22721abf7346Smrg
22738b6d6341Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
22741abf7346Smrg#
22758b6d6341Smrg# Check to see whether a particular set of modules exists.  Similar
22768b6d6341Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
22778b6d6341Smrg#
22788b6d6341Smrg#
22798b6d6341Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
22808b6d6341Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
22818b6d6341Smrg# PKG_CHECK_EXISTS manually
22828b6d6341Smrg# --------------------------------------------------------------
22838b6d6341SmrgAC_DEFUN([PKG_CHECK_EXISTS],
22848b6d6341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
22858b6d6341Smrgif test -n "$PKG_CONFIG" && \
22868b6d6341Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
22878b6d6341Smrg  m4_ifval([$2], [$2], [:])
22888b6d6341Smrgm4_ifvaln([$3], [else
22898b6d6341Smrg  $3])dnl
22908b6d6341Smrgfi])
22911abf7346Smrg
22921abf7346Smrg
22938b6d6341Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
22948b6d6341Smrg# ---------------------------------------------
22958b6d6341Smrgm4_define([_PKG_CONFIG],
22968b6d6341Smrg[if test -n "$$1"; then
22978b6d6341Smrg    pkg_cv_[]$1="$$1"
22988b6d6341Smrg elif test -n "$PKG_CONFIG"; then
22998b6d6341Smrg    PKG_CHECK_EXISTS([$3],
23008b6d6341Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
23018b6d6341Smrg		     [pkg_failed=yes])
23028b6d6341Smrg else
23038b6d6341Smrg    pkg_failed=untried
23048b6d6341Smrgfi[]dnl
23058b6d6341Smrg])# _PKG_CONFIG
23061abf7346Smrg
23078b6d6341Smrg# _PKG_SHORT_ERRORS_SUPPORTED
23088b6d6341Smrg# -----------------------------
23098b6d6341SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
23108b6d6341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
23118b6d6341Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
23128b6d6341Smrg        _pkg_short_errors_supported=yes
23131abf7346Smrgelse
23148b6d6341Smrg        _pkg_short_errors_supported=no
23158b6d6341Smrgfi[]dnl
23168b6d6341Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
23171abf7346Smrg
23188b6d6341Smrg
23198b6d6341Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
23208b6d6341Smrg# [ACTION-IF-NOT-FOUND])
23211abf7346Smrg#
23228b6d6341Smrg#
23238b6d6341Smrg# Note that if there is a possibility the first call to
23248b6d6341Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
23258b6d6341Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
23268b6d6341Smrg#
23278b6d6341Smrg#
23288b6d6341Smrg# --------------------------------------------------------------
23298b6d6341SmrgAC_DEFUN([PKG_CHECK_MODULES],
23308b6d6341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23318b6d6341SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
23328b6d6341SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
23331abf7346Smrg
23348b6d6341Smrgpkg_failed=no
23358b6d6341SmrgAC_MSG_CHECKING([for $1])
23361abf7346Smrg
23378b6d6341Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
23388b6d6341Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
23391abf7346Smrg
23408b6d6341Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
23418b6d6341Smrgand $1[]_LIBS to avoid the need to call pkg-config.
23428b6d6341SmrgSee the pkg-config man page for more details.])
23431abf7346Smrg
23448b6d6341Smrgif test $pkg_failed = yes; then
23458b6d6341Smrg        _PKG_SHORT_ERRORS_SUPPORTED
23468b6d6341Smrg        if test $_pkg_short_errors_supported = yes; then
23478b6d6341Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
23488b6d6341Smrg        else 
23498b6d6341Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
23508b6d6341Smrg        fi
23518b6d6341Smrg	# Put the nasty error message in config.log where it belongs
23528b6d6341Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
23531abf7346Smrg
23548b6d6341Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
23558b6d6341Smrg[Package requirements ($2) were not met:
23561abf7346Smrg
23578b6d6341Smrg$$1_PKG_ERRORS
23581abf7346Smrg
23598b6d6341SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
23608b6d6341Smrginstalled software in a non-standard prefix.
23611abf7346Smrg
23628b6d6341Smrg_PKG_TEXT
23638b6d6341Smrg])],
23648b6d6341Smrg		[AC_MSG_RESULT([no])
23658b6d6341Smrg                $4])
23668b6d6341Smrgelif test $pkg_failed = untried; then
23678b6d6341Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
23688b6d6341Smrg[The pkg-config script could not be found or is too old.  Make sure it
23698b6d6341Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
23708b6d6341Smrgpath to pkg-config.
23711abf7346Smrg
23728b6d6341Smrg_PKG_TEXT
23731abf7346Smrg
23748b6d6341SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
23758b6d6341Smrg		[$4])
23768b6d6341Smrgelse
23778b6d6341Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
23788b6d6341Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
23798b6d6341Smrg        AC_MSG_RESULT([yes])
23808b6d6341Smrg	ifelse([$3], , :, [$3])
23818b6d6341Smrgfi[]dnl
23828b6d6341Smrg])# PKG_CHECK_MODULES
23831abf7346Smrg
2384