aclocal.m4 revision 1633cc4b
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# Do all the work for Automake.                             -*- Autoconf -*-
4101abf7346Smrg
4118b6d6341Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4128b6d6341Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4138b6d6341Smrg#
4148b6d6341Smrg# This file is free software; the Free Software Foundation
4158b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
4168b6d6341Smrg# with or without modifications, as long as this notice is preserved.
4171abf7346Smrg
4188b6d6341Smrg# serial 16
4191abf7346Smrg
4208b6d6341Smrg# This macro actually does too much.  Some checks are only needed if
4218b6d6341Smrg# your package does certain things.  But this isn't really a big deal.
4221abf7346Smrg
4238b6d6341Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4248b6d6341Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4258b6d6341Smrg# -----------------------------------------------
4268b6d6341Smrg# The call with PACKAGE and VERSION arguments is the old style
4278b6d6341Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4288b6d6341Smrg# and VERSION should now be passed to AC_INIT and removed from
4298b6d6341Smrg# the call to AM_INIT_AUTOMAKE.
4308b6d6341Smrg# We support both call styles for the transition.  After
4318b6d6341Smrg# the next Automake release, Autoconf can make the AC_INIT
4328b6d6341Smrg# arguments mandatory, and then we can depend on a new Autoconf
4338b6d6341Smrg# release and drop the old call support.
4348b6d6341SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4358b6d6341Smrg[AC_PREREQ([2.62])dnl
4368b6d6341Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4378b6d6341Smrgdnl the ones we care about.
4388b6d6341Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4398b6d6341SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4408b6d6341SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4418b6d6341Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4428b6d6341Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4438b6d6341Smrg  # is not polluted with repeated "-I."
4448b6d6341Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4458b6d6341Smrg  # test to see if srcdir already configured
4468b6d6341Smrg  if test -f $srcdir/config.status; then
4478b6d6341Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4488b6d6341Smrg  fi
4498b6d6341Smrgfi
4501abf7346Smrg
4518b6d6341Smrg# test whether we have cygpath
4528b6d6341Smrgif test -z "$CYGPATH_W"; then
4538b6d6341Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4548b6d6341Smrg    CYGPATH_W='cygpath -w'
4558b6d6341Smrg  else
4568b6d6341Smrg    CYGPATH_W=echo
4578b6d6341Smrg  fi
4588b6d6341Smrgfi
4598b6d6341SmrgAC_SUBST([CYGPATH_W])
4601abf7346Smrg
4618b6d6341Smrg# Define the identity of the package.
4628b6d6341Smrgdnl Distinguish between old-style and new-style calls.
4638b6d6341Smrgm4_ifval([$2],
4648b6d6341Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4658b6d6341Smrg AC_SUBST([PACKAGE], [$1])dnl
4668b6d6341Smrg AC_SUBST([VERSION], [$2])],
4678b6d6341Smrg[_AM_SET_OPTIONS([$1])dnl
4688b6d6341Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4698b6d6341Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4708b6d6341Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4718b6d6341Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4728b6d6341Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4731abf7346Smrg
4748b6d6341Smrg_AM_IF_OPTION([no-define],,
4758b6d6341Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4768b6d6341Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4771abf7346Smrg
4788b6d6341Smrg# Some tools Automake needs.
4798b6d6341SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4808b6d6341SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4818b6d6341SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4828b6d6341SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4838b6d6341SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4848b6d6341SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4858b6d6341SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4868b6d6341SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4878b6d6341SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4888b6d6341SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4898b6d6341Smrg# We need awk for the "check" target.  The system "awk" is bad on
4908b6d6341Smrg# some platforms.
4918b6d6341SmrgAC_REQUIRE([AC_PROG_AWK])dnl
4928b6d6341SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
4938b6d6341SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
4948b6d6341Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4958b6d6341Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4968b6d6341Smrg			     [_AM_PROG_TAR([v7])])])
4978b6d6341Smrg_AM_IF_OPTION([no-dependencies],,
4988b6d6341Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
4998b6d6341Smrg		  [_AM_DEPENDENCIES(CC)],
5008b6d6341Smrg		  [define([AC_PROG_CC],
5018b6d6341Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5028b6d6341SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5038b6d6341Smrg		  [_AM_DEPENDENCIES(CXX)],
5048b6d6341Smrg		  [define([AC_PROG_CXX],
5058b6d6341Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5068b6d6341SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5078b6d6341Smrg		  [_AM_DEPENDENCIES(OBJC)],
5088b6d6341Smrg		  [define([AC_PROG_OBJC],
5098b6d6341Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
5108b6d6341Smrg])
5118b6d6341Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5128b6d6341Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5138b6d6341Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5148b6d6341Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5158b6d6341SmrgAC_CONFIG_COMMANDS_PRE(dnl
5168b6d6341Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5178b6d6341Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5188b6d6341Smrg])
5191abf7346Smrg
5208b6d6341Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5218b6d6341Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5228b6d6341Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5238b6d6341Smrgm4_define([_AC_COMPILER_EXEEXT],
5248b6d6341Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5251abf7346Smrg
5261abf7346Smrg
5278b6d6341Smrg# When config.status generates a header, we must update the stamp-h file.
5288b6d6341Smrg# This file resides in the same directory as the config header
5298b6d6341Smrg# that is generated.  The stamp files are numbered to have different names.
5301abf7346Smrg
5318b6d6341Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5328b6d6341Smrg# loop where config.status creates the headers, so we can generate
5338b6d6341Smrg# our stamp files there.
5348b6d6341SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5358b6d6341Smrg[# Compute $1's index in $config_headers.
5368b6d6341Smrg_am_arg=$1
5378b6d6341Smrg_am_stamp_count=1
5388b6d6341Smrgfor _am_header in $config_headers :; do
5398b6d6341Smrg  case $_am_header in
5408b6d6341Smrg    $_am_arg | $_am_arg:* )
5418b6d6341Smrg      break ;;
5428b6d6341Smrg    * )
5438b6d6341Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5448b6d6341Smrg  esac
5458b6d6341Smrgdone
5468b6d6341Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5471abf7346Smrg
5488b6d6341Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
5491abf7346Smrg#
5508b6d6341Smrg# This file is free software; the Free Software Foundation
5518b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
5528b6d6341Smrg# with or without modifications, as long as this notice is preserved.
5531abf7346Smrg
5548b6d6341Smrg# AM_PROG_INSTALL_SH
5558b6d6341Smrg# ------------------
5568b6d6341Smrg# Define $install_sh.
5578b6d6341SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5588b6d6341Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5598b6d6341Smrgif test x"${install_sh}" != xset; then
5608b6d6341Smrg  case $am_aux_dir in
5618b6d6341Smrg  *\ * | *\	*)
5628b6d6341Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5638b6d6341Smrg  *)
5648b6d6341Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5658b6d6341Smrg  esac
5661abf7346Smrgfi
5678b6d6341SmrgAC_SUBST(install_sh)])
5681abf7346Smrg
5698b6d6341Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5708b6d6341Smrg#
5718b6d6341Smrg# This file is free software; the Free Software Foundation
5728b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
5738b6d6341Smrg# with or without modifications, as long as this notice is preserved.
5748b6d6341Smrg
5758b6d6341Smrg# serial 2
5768b6d6341Smrg
5778b6d6341Smrg# Check whether the underlying file-system supports filenames
5788b6d6341Smrg# with a leading dot.  For instance MS-DOS doesn't.
5798b6d6341SmrgAC_DEFUN([AM_SET_LEADING_DOT],
5808b6d6341Smrg[rm -rf .tst 2>/dev/null
5818b6d6341Smrgmkdir .tst 2>/dev/null
5828b6d6341Smrgif test -d .tst; then
5838b6d6341Smrg  am__leading_dot=.
5841abf7346Smrgelse
5858b6d6341Smrg  am__leading_dot=_
5861abf7346Smrgfi
5878b6d6341Smrgrmdir .tst 2>/dev/null
5888b6d6341SmrgAC_SUBST([am__leading_dot])])
5891abf7346Smrg
5908b6d6341Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
5918b6d6341Smrg# From Jim Meyering
5921abf7346Smrg
5938b6d6341Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
5948b6d6341Smrg# Free Software Foundation, Inc.
5951abf7346Smrg#
5968b6d6341Smrg# This file is free software; the Free Software Foundation
5978b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
5988b6d6341Smrg# with or without modifications, as long as this notice is preserved.
5991abf7346Smrg
6008b6d6341Smrg# serial 5
6011abf7346Smrg
6028b6d6341Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6038b6d6341Smrg# ----------------------------------
6048b6d6341Smrg# Control maintainer-specific portions of Makefiles.
6058b6d6341Smrg# Default is to disable them, unless `enable' is passed literally.
6068b6d6341Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
6078b6d6341Smrg# can override the default with the --enable/--disable switch.
6088b6d6341SmrgAC_DEFUN([AM_MAINTAINER_MODE],
6098b6d6341Smrg[m4_case(m4_default([$1], [disable]),
6108b6d6341Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
6118b6d6341Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
6128b6d6341Smrg       [m4_define([am_maintainer_other], [enable])
6138b6d6341Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6148b6d6341SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
6158b6d6341Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6168b6d6341Smrg  AC_ARG_ENABLE([maintainer-mode],
6178b6d6341Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
6188b6d6341Smrg			  (and sometimes confusing) to the casual installer],
6198b6d6341Smrg      [USE_MAINTAINER_MODE=$enableval],
6208b6d6341Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6218b6d6341Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6228b6d6341Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6238b6d6341Smrg  MAINT=$MAINTAINER_MODE_TRUE
6248b6d6341Smrg  AC_SUBST([MAINT])dnl
6258b6d6341Smrg]
6268b6d6341Smrg)
6271abf7346Smrg
6288b6d6341SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
6291abf7346Smrg
6308b6d6341Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6318b6d6341Smrg
6328b6d6341Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6331abf7346Smrg#
6348b6d6341Smrg# This file is free software; the Free Software Foundation
6358b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
6368b6d6341Smrg# with or without modifications, as long as this notice is preserved.
6378b6d6341Smrg
6388b6d6341Smrg# serial 4
6398b6d6341Smrg
6408b6d6341Smrg# AM_MAKE_INCLUDE()
6418b6d6341Smrg# -----------------
6428b6d6341Smrg# Check to see how make treats includes.
6438b6d6341SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6448b6d6341Smrg[am_make=${MAKE-make}
6458b6d6341Smrgcat > confinc << 'END'
6468b6d6341Smrgam__doit:
6478b6d6341Smrg	@echo this is the am__doit target
6488b6d6341Smrg.PHONY: am__doit
6498b6d6341SmrgEND
6508b6d6341Smrg# If we don't find an include directive, just comment out the code.
6518b6d6341SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6528b6d6341Smrgam__include="#"
6538b6d6341Smrgam__quote=
6548b6d6341Smrg_am_result=none
6558b6d6341Smrg# First try GNU make style include.
6568b6d6341Smrgecho "include confinc" > confmf
6578b6d6341Smrg# Ignore all kinds of additional output from `make'.
6588b6d6341Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6598b6d6341Smrg*the\ am__doit\ target*)
6608b6d6341Smrg  am__include=include
6618b6d6341Smrg  am__quote=
6628b6d6341Smrg  _am_result=GNU
6638b6d6341Smrg  ;;
6648b6d6341Smrgesac
6658b6d6341Smrg# Now try BSD make style include.
6668b6d6341Smrgif test "$am__include" = "#"; then
6678b6d6341Smrg   echo '.include "confinc"' > confmf
6688b6d6341Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6698b6d6341Smrg   *the\ am__doit\ target*)
6708b6d6341Smrg     am__include=.include
6718b6d6341Smrg     am__quote="\""
6728b6d6341Smrg     _am_result=BSD
6738b6d6341Smrg     ;;
6748b6d6341Smrg   esac
6758b6d6341Smrgfi
6768b6d6341SmrgAC_SUBST([am__include])
6778b6d6341SmrgAC_SUBST([am__quote])
6788b6d6341SmrgAC_MSG_RESULT([$_am_result])
6798b6d6341Smrgrm -f confinc confmf
6808b6d6341Smrg])
6818b6d6341Smrg
6828b6d6341Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6838b6d6341Smrg
6848b6d6341Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
6858b6d6341Smrg# Free Software Foundation, Inc.
6861abf7346Smrg#
6878b6d6341Smrg# This file is free software; the Free Software Foundation
6888b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
6898b6d6341Smrg# with or without modifications, as long as this notice is preserved.
6901abf7346Smrg
6918b6d6341Smrg# serial 6
6921abf7346Smrg
6938b6d6341Smrg# AM_MISSING_PROG(NAME, PROGRAM)
6948b6d6341Smrg# ------------------------------
6958b6d6341SmrgAC_DEFUN([AM_MISSING_PROG],
6968b6d6341Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6978b6d6341Smrg$1=${$1-"${am_missing_run}$2"}
6988b6d6341SmrgAC_SUBST($1)])
6991abf7346Smrg
7001abf7346Smrg
7018b6d6341Smrg# AM_MISSING_HAS_RUN
7028b6d6341Smrg# ------------------
7038b6d6341Smrg# Define MISSING if not defined so far and test if it supports --run.
7048b6d6341Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
7058b6d6341SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7068b6d6341Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7078b6d6341SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7088b6d6341Smrgif test x"${MISSING+set}" != xset; then
7098b6d6341Smrg  case $am_aux_dir in
7108b6d6341Smrg  *\ * | *\	*)
7118b6d6341Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7128b6d6341Smrg  *)
7138b6d6341Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7148b6d6341Smrg  esac
7158b6d6341Smrgfi
7168b6d6341Smrg# Use eval to expand $SHELL
7178b6d6341Smrgif eval "$MISSING --run true"; then
7188b6d6341Smrg  am_missing_run="$MISSING --run "
7198b6d6341Smrgelse
7208b6d6341Smrg  am_missing_run=
7218b6d6341Smrg  AC_MSG_WARN([`missing' script is too old or missing])
7228b6d6341Smrgfi
7231abf7346Smrg])
7241abf7346Smrg
7258b6d6341Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
7261abf7346Smrg#
7271abf7346Smrg# This file is free software; the Free Software Foundation
7281abf7346Smrg# gives unlimited permission to copy and/or distribute it,
7291abf7346Smrg# with or without modifications, as long as this notice is preserved.
7301abf7346Smrg
7318b6d6341Smrg# AM_PROG_MKDIR_P
7328b6d6341Smrg# ---------------
7338b6d6341Smrg# Check for `mkdir -p'.
7348b6d6341SmrgAC_DEFUN([AM_PROG_MKDIR_P],
7358b6d6341Smrg[AC_PREREQ([2.60])dnl
7368b6d6341SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7378b6d6341Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7388b6d6341Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
7398b6d6341Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7408b6d6341Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7418b6d6341Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7428b6d6341Smrgdnl adjustment using top_builddir (which is defined more often than
7438b6d6341Smrgdnl MKDIR_P).
7448b6d6341SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7458b6d6341Smrgcase $mkdir_p in
7468b6d6341Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7478b6d6341Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7488b6d6341Smrgesac
7491abf7346Smrg])
7501abf7346Smrg
7518b6d6341Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7521abf7346Smrg
7538b6d6341Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
7548b6d6341Smrg#
7558b6d6341Smrg# This file is free software; the Free Software Foundation
7568b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
7578b6d6341Smrg# with or without modifications, as long as this notice is preserved.
7581abf7346Smrg
7598b6d6341Smrg# serial 4
7601abf7346Smrg
7618b6d6341Smrg# _AM_MANGLE_OPTION(NAME)
7628b6d6341Smrg# -----------------------
7638b6d6341SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7648b6d6341Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7658b6d6341Smrg
7668b6d6341Smrg# _AM_SET_OPTION(NAME)
7678b6d6341Smrg# ------------------------------
7688b6d6341Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7698b6d6341SmrgAC_DEFUN([_AM_SET_OPTION],
7708b6d6341Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
7718b6d6341Smrg
7728b6d6341Smrg# _AM_SET_OPTIONS(OPTIONS)
7738b6d6341Smrg# ----------------------------------
7748b6d6341Smrg# OPTIONS is a space-separated list of Automake options.
7758b6d6341SmrgAC_DEFUN([_AM_SET_OPTIONS],
7768b6d6341Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7778b6d6341Smrg
7788b6d6341Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7798b6d6341Smrg# -------------------------------------------
7808b6d6341Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7818b6d6341SmrgAC_DEFUN([_AM_IF_OPTION],
7828b6d6341Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7838b6d6341Smrg
7848b6d6341Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7858b6d6341Smrg
7868b6d6341Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
7878b6d6341Smrg# Free Software Foundation, Inc.
7881abf7346Smrg#
7891abf7346Smrg# This file is free software; the Free Software Foundation
7901abf7346Smrg# gives unlimited permission to copy and/or distribute it,
7911abf7346Smrg# with or without modifications, as long as this notice is preserved.
7921abf7346Smrg
7938b6d6341Smrg# serial 5
7941abf7346Smrg
7958b6d6341Smrg# AM_SANITY_CHECK
7968b6d6341Smrg# ---------------
7978b6d6341SmrgAC_DEFUN([AM_SANITY_CHECK],
7988b6d6341Smrg[AC_MSG_CHECKING([whether build environment is sane])
7998b6d6341Smrg# Just in case
8008b6d6341Smrgsleep 1
8018b6d6341Smrgecho timestamp > conftest.file
8028b6d6341Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8038b6d6341Smrg# name.  Accept space and tab only in the latter.
8048b6d6341Smrgam_lf='
8058b6d6341Smrg'
8068b6d6341Smrgcase `pwd` in
8078b6d6341Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8088b6d6341Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8098b6d6341Smrgesac
8108b6d6341Smrgcase $srcdir in
8118b6d6341Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8128b6d6341Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8138b6d6341Smrgesac
8141abf7346Smrg
8158b6d6341Smrg# Do `set' in a subshell so we don't clobber the current shell's
8168b6d6341Smrg# arguments.  Must try -L first in case configure is actually a
8178b6d6341Smrg# symlink; some systems play weird games with the mod time of symlinks
8188b6d6341Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8198b6d6341Smrg# directory).
8208b6d6341Smrgif (
8218b6d6341Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8228b6d6341Smrg   if test "$[*]" = "X"; then
8238b6d6341Smrg      # -L didn't work.
8248b6d6341Smrg      set X `ls -t "$srcdir/configure" conftest.file`
8258b6d6341Smrg   fi
8268b6d6341Smrg   rm -f conftest.file
8278b6d6341Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
8288b6d6341Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
8298b6d6341Smrg
8308b6d6341Smrg      # If neither matched, then we have a broken ls.  This can happen
8318b6d6341Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
8328b6d6341Smrg      # broken ls alias from the environment.  This has actually
8338b6d6341Smrg      # happened.  Such a system could not be considered "sane".
8348b6d6341Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8358b6d6341Smrgalias in your environment])
8368b6d6341Smrg   fi
8378b6d6341Smrg
8388b6d6341Smrg   test "$[2]" = conftest.file
8398b6d6341Smrg   )
8408b6d6341Smrgthen
8418b6d6341Smrg   # Ok.
8428b6d6341Smrg   :
8438b6d6341Smrgelse
8448b6d6341Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8458b6d6341SmrgCheck your system clock])
8468b6d6341Smrgfi
8478b6d6341SmrgAC_MSG_RESULT(yes)])
8481abf7346Smrg
8498b6d6341Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
8501abf7346Smrg#
8511abf7346Smrg# This file is free software; the Free Software Foundation
8521abf7346Smrg# gives unlimited permission to copy and/or distribute it,
8531abf7346Smrg# with or without modifications, as long as this notice is preserved.
8541abf7346Smrg
8558b6d6341Smrg# serial 1
8561abf7346Smrg
8578b6d6341Smrg# AM_SILENT_RULES([DEFAULT])
8588b6d6341Smrg# --------------------------
8598b6d6341Smrg# Enable less verbose build rules; with the default set to DEFAULT
8608b6d6341Smrg# (`yes' being less verbose, `no' or empty being verbose).
8618b6d6341SmrgAC_DEFUN([AM_SILENT_RULES],
8628b6d6341Smrg[AC_ARG_ENABLE([silent-rules],
8638b6d6341Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8648b6d6341Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8658b6d6341Smrgcase $enable_silent_rules in
8668b6d6341Smrgyes) AM_DEFAULT_VERBOSITY=0;;
8678b6d6341Smrgno)  AM_DEFAULT_VERBOSITY=1;;
8688b6d6341Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8698b6d6341Smrgesac
8708b6d6341SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8718b6d6341SmrgAM_BACKSLASH='\'
8728b6d6341SmrgAC_SUBST([AM_BACKSLASH])dnl
8738b6d6341Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8748b6d6341Smrg])
8751abf7346Smrg
8768b6d6341Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
8771abf7346Smrg#
8781abf7346Smrg# This file is free software; the Free Software Foundation
8791abf7346Smrg# gives unlimited permission to copy and/or distribute it,
8801abf7346Smrg# with or without modifications, as long as this notice is preserved.
8811abf7346Smrg
8828b6d6341Smrg# AM_PROG_INSTALL_STRIP
8838b6d6341Smrg# ---------------------
8848b6d6341Smrg# One issue with vendor `install' (even GNU) is that you can't
8858b6d6341Smrg# specify the program used to strip binaries.  This is especially
8868b6d6341Smrg# annoying in cross-compiling environments, where the build's strip
8878b6d6341Smrg# is unlikely to handle the host's binaries.
8888b6d6341Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
8898b6d6341Smrg# always use install-sh in `make install-strip', and initialize
8908b6d6341Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
8918b6d6341SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
8928b6d6341Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
8938b6d6341Smrg# Installed binaries are usually stripped using `strip' when the user
8948b6d6341Smrg# run `make install-strip'.  However `strip' might not be the right
8958b6d6341Smrg# tool to use in cross-compilation environments, therefore Automake
8968b6d6341Smrg# will honor the `STRIP' environment variable to overrule this program.
8978b6d6341Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
8988b6d6341Smrgif test "$cross_compiling" != no; then
8998b6d6341Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9008b6d6341Smrgfi
9018b6d6341SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9028b6d6341SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
9031abf7346Smrg
9048b6d6341Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
9051abf7346Smrg#
9068b6d6341Smrg# This file is free software; the Free Software Foundation
9078b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
9088b6d6341Smrg# with or without modifications, as long as this notice is preserved.
9091abf7346Smrg
9108b6d6341Smrg# serial 2
9111abf7346Smrg
9128b6d6341Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
9138b6d6341Smrg# ---------------------------
9148b6d6341Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9158b6d6341Smrg# This macro is traced by Automake.
9168b6d6341SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9171abf7346Smrg
9188b6d6341Smrg# AM_SUBST_NOTMAKE(VARIABLE)
9198b6d6341Smrg# ---------------------------
9208b6d6341Smrg# Public sister of _AM_SUBST_NOTMAKE.
9218b6d6341SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9221abf7346Smrg
9238b6d6341Smrg# Check how to create a tarball.                            -*- Autoconf -*-
9241abf7346Smrg
9258b6d6341Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
9268b6d6341Smrg#
9278b6d6341Smrg# This file is free software; the Free Software Foundation
9288b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
9298b6d6341Smrg# with or without modifications, as long as this notice is preserved.
9301abf7346Smrg
9318b6d6341Smrg# serial 2
9321abf7346Smrg
9338b6d6341Smrg# _AM_PROG_TAR(FORMAT)
9348b6d6341Smrg# --------------------
9358b6d6341Smrg# Check how to create a tarball in format FORMAT.
9368b6d6341Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
9378b6d6341Smrg#
9388b6d6341Smrg# Substitute a variable $(am__tar) that is a command
9398b6d6341Smrg# writing to stdout a FORMAT-tarball containing the directory
9408b6d6341Smrg# $tardir.
9418b6d6341Smrg#     tardir=directory && $(am__tar) > result.tar
9428b6d6341Smrg#
9438b6d6341Smrg# Substitute a variable $(am__untar) that extract such
9448b6d6341Smrg# a tarball read from stdin.
9458b6d6341Smrg#     $(am__untar) < result.tar
9468b6d6341SmrgAC_DEFUN([_AM_PROG_TAR],
9478b6d6341Smrg[# Always define AMTAR for backward compatibility.
9488b6d6341SmrgAM_MISSING_PROG([AMTAR], [tar])
9498b6d6341Smrgm4_if([$1], [v7],
9508b6d6341Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
9518b6d6341Smrg     [m4_case([$1], [ustar],, [pax],,
9528b6d6341Smrg              [m4_fatal([Unknown tar format])])
9538b6d6341SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
9548b6d6341Smrg# Loop over all known methods to create a tar archive until one works.
9558b6d6341Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9568b6d6341Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
9578b6d6341Smrg# Do not fold the above two line into one, because Tru64 sh and
9588b6d6341Smrg# Solaris sh will not grok spaces in the rhs of `-'.
9598b6d6341Smrgfor _am_tool in $_am_tools
9608b6d6341Smrgdo
9618b6d6341Smrg  case $_am_tool in
9628b6d6341Smrg  gnutar)
9638b6d6341Smrg    for _am_tar in tar gnutar gtar;
9648b6d6341Smrg    do
9658b6d6341Smrg      AM_RUN_LOG([$_am_tar --version]) && break
9668b6d6341Smrg    done
9678b6d6341Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
9688b6d6341Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
9698b6d6341Smrg    am__untar="$_am_tar -xf -"
9708b6d6341Smrg    ;;
9718b6d6341Smrg  plaintar)
9728b6d6341Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
9738b6d6341Smrg    # ustar tarball either.
9748b6d6341Smrg    (tar --version) >/dev/null 2>&1 && continue
9758b6d6341Smrg    am__tar='tar chf - "$$tardir"'
9768b6d6341Smrg    am__tar_='tar chf - "$tardir"'
9778b6d6341Smrg    am__untar='tar xf -'
9788b6d6341Smrg    ;;
9798b6d6341Smrg  pax)
9808b6d6341Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
9818b6d6341Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
9828b6d6341Smrg    am__untar='pax -r'
9838b6d6341Smrg    ;;
9848b6d6341Smrg  cpio)
9858b6d6341Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
9868b6d6341Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
9878b6d6341Smrg    am__untar='cpio -i -H $1 -d'
9888b6d6341Smrg    ;;
9898b6d6341Smrg  none)
9908b6d6341Smrg    am__tar=false
9918b6d6341Smrg    am__tar_=false
9928b6d6341Smrg    am__untar=false
9938b6d6341Smrg    ;;
9948b6d6341Smrg  esac
9951abf7346Smrg
9968b6d6341Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
9978b6d6341Smrg  # and am__untar set.
9988b6d6341Smrg  test -n "${am_cv_prog_tar_$1}" && break
9991abf7346Smrg
10008b6d6341Smrg  # tar/untar a dummy directory, and stop if the command works
10018b6d6341Smrg  rm -rf conftest.dir
10028b6d6341Smrg  mkdir conftest.dir
10038b6d6341Smrg  echo GrepMe > conftest.dir/file
10048b6d6341Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
10058b6d6341Smrg  rm -rf conftest.dir
10068b6d6341Smrg  if test -s conftest.tar; then
10078b6d6341Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
10088b6d6341Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
10098b6d6341Smrg  fi
10108b6d6341Smrgdone
10118b6d6341Smrgrm -rf conftest.dir
10121abf7346Smrg
10138b6d6341SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
10148b6d6341SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
10158b6d6341SmrgAC_SUBST([am__tar])
10168b6d6341SmrgAC_SUBST([am__untar])
10178b6d6341Smrg]) # _AM_PROG_TAR
10181abf7346Smrg
10198b6d6341Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
10208b6d6341Smrgdnl
102123a8d56dSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
10228b6d6341Smrgdnl 
10238b6d6341Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
102423a8d56dSmrgdnl copy of this software and associated documentation files (the "Software"),
102523a8d56dSmrgdnl to deal in the Software without restriction, including without limitation
102623a8d56dSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
102723a8d56dSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
102823a8d56dSmrgdnl Software is furnished to do so, subject to the following conditions:
10298b6d6341Smrgdnl
103023a8d56dSmrgdnl The above copyright notice and this permission notice (including the next
103123a8d56dSmrgdnl paragraph) shall be included in all copies or substantial portions of the
103223a8d56dSmrgdnl Software.
10338b6d6341Smrgdnl
103423a8d56dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
103523a8d56dSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
103623a8d56dSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
103723a8d56dSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
103823a8d56dSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
103923a8d56dSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
104023a8d56dSmrgdnl DEALINGS IN THE SOFTWARE.
10418b6d6341Smrg
10428b6d6341Smrg# XORG_MACROS_VERSION(required-version)
10438b6d6341Smrg# -------------------------------------
10448b6d6341Smrg# Minimum version: 1.1.0
10451abf7346Smrg#
10468b6d6341Smrg# If you're using a macro added in Version 1.1 or newer, include this in
10478b6d6341Smrg# your configure.ac with the minimum required version, such as:
10488b6d6341Smrg# XORG_MACROS_VERSION(1.1)
10498b6d6341Smrg#
10508b6d6341Smrg# To ensure that this macro is defined, also add:
10518b6d6341Smrg# m4_ifndef([XORG_MACROS_VERSION],
10528b6d6341Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
10538b6d6341Smrg#
10548b6d6341Smrg#
10558b6d6341Smrg# See the "minimum version" comment for each macro you use to see what 
10568b6d6341Smrg# version you require.
10578b6d6341Smrgm4_defun([XORG_MACROS_VERSION],[
10581633cc4bSmrgm4_define([vers_have], [1.15.0])
10598b6d6341Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
10608b6d6341Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
10618b6d6341Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
10628b6d6341Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
10638b6d6341Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
10648b6d6341Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
10658b6d6341Smrgm4_undefine([vers_have])
10668b6d6341Smrgm4_undefine([maj_have])
10678b6d6341Smrgm4_undefine([maj_needed])
10688b6d6341Smrg]) # XORG_MACROS_VERSION
10691abf7346Smrg
10708b6d6341Smrg# XORG_PROG_RAWCPP()
10718b6d6341Smrg# ------------------
10728b6d6341Smrg# Minimum version: 1.0.0
10738b6d6341Smrg#
10748b6d6341Smrg# Find cpp program and necessary flags for use in pre-processing text files
10758b6d6341Smrg# such as man pages and config files
10768b6d6341SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
10778b6d6341SmrgAC_REQUIRE([AC_PROG_CPP])
10788b6d6341SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
10798b6d6341Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
10801abf7346Smrg
10818b6d6341Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
10828b6d6341Smrg# which is not the best choice for supporting other OS'es, but covers most
10838b6d6341Smrg# of the ones we need for now.
10848b6d6341SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
10851633cc4bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
10868b6d6341Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
10878b6d6341Smrg	AC_MSG_RESULT([no])
10888b6d6341Smrgelse
10898b6d6341Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
10908b6d6341Smrg		RAWCPPFLAGS=-undef
10918b6d6341Smrg		AC_MSG_RESULT([yes])
10928b6d6341Smrg	# under Cygwin unix is still defined even with -undef
10938b6d6341Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
10948b6d6341Smrg		RAWCPPFLAGS="-undef -ansi"
10958b6d6341Smrg		AC_MSG_RESULT([yes, with -ansi])
10968b6d6341Smrg	else
10978b6d6341Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
10988b6d6341Smrg	fi
10998b6d6341Smrgfi
11008b6d6341Smrgrm -f conftest.$ac_ext
11011abf7346Smrg
11028b6d6341SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
11031633cc4bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
11048b6d6341Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
11058b6d6341Smrg	AC_MSG_RESULT([no])
11068b6d6341Smrgelse
11078b6d6341Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
11088b6d6341Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
11098b6d6341Smrg		AC_MSG_RESULT([yes])
11108b6d6341Smrg	else
11118b6d6341Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
11128b6d6341Smrg	fi
11138b6d6341Smrgfi
11148b6d6341Smrgrm -f conftest.$ac_ext
11158b6d6341SmrgAC_SUBST(RAWCPPFLAGS)
11168b6d6341Smrg]) # XORG_PROG_RAWCPP
11171abf7346Smrg
11188b6d6341Smrg# XORG_MANPAGE_SECTIONS()
11198b6d6341Smrg# -----------------------
11208b6d6341Smrg# Minimum version: 1.0.0
11211abf7346Smrg#
11228b6d6341Smrg# Determine which sections man pages go in for the different man page types
11238b6d6341Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
11248b6d6341Smrg# Not sure if there's any better way than just hardcoding by OS name.
11258b6d6341Smrg# Override default settings by setting environment variables
112623a8d56dSmrg# Added MAN_SUBSTS in version 1.8
112723a8d56dSmrg# Added AC_PROG_SED in version 1.8
11281abf7346Smrg
11298b6d6341SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
11308b6d6341SmrgAC_REQUIRE([AC_CANONICAL_HOST])
113123a8d56dSmrgAC_REQUIRE([AC_PROG_SED])
11321abf7346Smrg
11338b6d6341Smrgif test x$APP_MAN_SUFFIX = x    ; then
11348b6d6341Smrg    APP_MAN_SUFFIX=1
11358b6d6341Smrgfi
11368b6d6341Smrgif test x$APP_MAN_DIR = x    ; then
11378b6d6341Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
11388b6d6341Smrgfi
11391abf7346Smrg
11408b6d6341Smrgif test x$LIB_MAN_SUFFIX = x    ; then
11418b6d6341Smrg    LIB_MAN_SUFFIX=3
11428b6d6341Smrgfi
11438b6d6341Smrgif test x$LIB_MAN_DIR = x    ; then
11448b6d6341Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
11458b6d6341Smrgfi
11461abf7346Smrg
11478b6d6341Smrgif test x$FILE_MAN_SUFFIX = x    ; then
11488b6d6341Smrg    case $host_os in
11498b6d6341Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
11508b6d6341Smrg	*)		FILE_MAN_SUFFIX=5  ;;
11518b6d6341Smrg    esac
11528b6d6341Smrgfi
11538b6d6341Smrgif test x$FILE_MAN_DIR = x    ; then
11548b6d6341Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
11558b6d6341Smrgfi
11561abf7346Smrg
11578b6d6341Smrgif test x$MISC_MAN_SUFFIX = x    ; then
11588b6d6341Smrg    case $host_os in
11598b6d6341Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
11608b6d6341Smrg	*)		MISC_MAN_SUFFIX=7  ;;
11618b6d6341Smrg    esac
11628b6d6341Smrgfi
11638b6d6341Smrgif test x$MISC_MAN_DIR = x    ; then
11648b6d6341Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
11658b6d6341Smrgfi
11661abf7346Smrg
11678b6d6341Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
11688b6d6341Smrg    case $host_os in
11698b6d6341Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
11708b6d6341Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
11718b6d6341Smrg    esac
11728b6d6341Smrgfi
11738b6d6341Smrgif test x$DRIVER_MAN_DIR = x    ; then
11748b6d6341Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
11758b6d6341Smrgfi
11761abf7346Smrg
11778b6d6341Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
11788b6d6341Smrg    case $host_os in
11798b6d6341Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
11808b6d6341Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
11818b6d6341Smrg    esac
11828b6d6341Smrgfi
11838b6d6341Smrgif test x$ADMIN_MAN_DIR = x    ; then
11848b6d6341Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
11858b6d6341Smrgfi
11861abf7346Smrg
11878b6d6341Smrg
11888b6d6341SmrgAC_SUBST([APP_MAN_SUFFIX])
11898b6d6341SmrgAC_SUBST([LIB_MAN_SUFFIX])
11908b6d6341SmrgAC_SUBST([FILE_MAN_SUFFIX])
11918b6d6341SmrgAC_SUBST([MISC_MAN_SUFFIX])
11928b6d6341SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
11938b6d6341SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
11948b6d6341SmrgAC_SUBST([APP_MAN_DIR])
11958b6d6341SmrgAC_SUBST([LIB_MAN_DIR])
11968b6d6341SmrgAC_SUBST([FILE_MAN_DIR])
11978b6d6341SmrgAC_SUBST([MISC_MAN_DIR])
11988b6d6341SmrgAC_SUBST([DRIVER_MAN_DIR])
11998b6d6341SmrgAC_SUBST([ADMIN_MAN_DIR])
120023a8d56dSmrg
120123a8d56dSmrgXORG_MAN_PAGE="X Version 11"
120223a8d56dSmrgAC_SUBST([XORG_MAN_PAGE])
120323a8d56dSmrgMAN_SUBSTS="\
120423a8d56dSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
120523a8d56dSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
120623a8d56dSmrg	-e 's|__xservername__|Xorg|g' \
120723a8d56dSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
120823a8d56dSmrg	-e 's|__projectroot__|\$(prefix)|g' \
120923a8d56dSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
121023a8d56dSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
121123a8d56dSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
121223a8d56dSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
121323a8d56dSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
121423a8d56dSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
121523a8d56dSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
121623a8d56dSmrgAC_SUBST([MAN_SUBSTS])
121723a8d56dSmrg
12188b6d6341Smrg]) # XORG_MANPAGE_SECTIONS
12198b6d6341Smrg
122023a8d56dSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
122123a8d56dSmrg# ------------------------
122223a8d56dSmrg# Minimum version: 1.7.0
122323a8d56dSmrg#
122423a8d56dSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
122523a8d56dSmrg# provided by xorg-sgml-doctools, if installed.
122623a8d56dSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
122723a8d56dSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
122823a8d56dSmrgXORG_SGML_PATH=
122923a8d56dSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
123023a8d56dSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
123123a8d56dSmrg    [m4_ifval([$1],[:],
123223a8d56dSmrg        [if test x"$cross_compiling" != x"yes" ; then
123323a8d56dSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
123423a8d56dSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
123523a8d56dSmrg         fi])
123623a8d56dSmrg    ])
123723a8d56dSmrg
123823a8d56dSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
123923a8d56dSmrg# the path and the name of the doc stylesheet
124023a8d56dSmrgif test "x$XORG_SGML_PATH" != "x" ; then
124123a8d56dSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
124223a8d56dSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
124323a8d56dSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
124423a8d56dSmrgelse
124523a8d56dSmrg   AC_MSG_RESULT([no])
124623a8d56dSmrgfi
124723a8d56dSmrg
124823a8d56dSmrgAC_SUBST(XORG_SGML_PATH)
124923a8d56dSmrgAC_SUBST(STYLESHEET_SRCDIR)
125023a8d56dSmrgAC_SUBST(XSL_STYLESHEET)
125123a8d56dSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
125223a8d56dSmrg]) # XORG_CHECK_SGML_DOCTOOLS
125323a8d56dSmrg
12548b6d6341Smrg# XORG_CHECK_LINUXDOC
12558b6d6341Smrg# -------------------
12568b6d6341Smrg# Minimum version: 1.0.0
12578b6d6341Smrg#
12588b6d6341Smrg# Defines the variable MAKE_TEXT if the necessary tools and
12598b6d6341Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
12608b6d6341Smrg# Whether or not the necessary tools and files are found can be checked
12618b6d6341Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
12628b6d6341SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
126323a8d56dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
126423a8d56dSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
12651abf7346Smrg
12668b6d6341SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
12671abf7346Smrg
126823a8d56dSmrgAC_MSG_CHECKING([whether to build documentation])
12691abf7346Smrg
127023a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
12718b6d6341Smrg   BUILDDOC=yes
12728b6d6341Smrgelse
12738b6d6341Smrg   BUILDDOC=no
12748b6d6341Smrgfi
12751abf7346Smrg
12768b6d6341SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
12771abf7346Smrg
12788b6d6341SmrgAC_MSG_RESULT([$BUILDDOC])
12791abf7346Smrg
128023a8d56dSmrgAC_MSG_CHECKING([whether to build pdf documentation])
12811abf7346Smrg
128223a8d56dSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
12838b6d6341Smrg   BUILDPDFDOC=yes
12848b6d6341Smrgelse
12858b6d6341Smrg   BUILDPDFDOC=no
12868b6d6341Smrgfi
12871abf7346Smrg
12888b6d6341SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
12891abf7346Smrg
12908b6d6341SmrgAC_MSG_RESULT([$BUILDPDFDOC])
12911abf7346Smrg
129223a8d56dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
12938b6d6341SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
12948b6d6341SmrgMAKE_PDF="$PS2PDF"
12958b6d6341SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
12961abf7346Smrg
12978b6d6341SmrgAC_SUBST(MAKE_TEXT)
12988b6d6341SmrgAC_SUBST(MAKE_PS)
12998b6d6341SmrgAC_SUBST(MAKE_PDF)
13008b6d6341SmrgAC_SUBST(MAKE_HTML)
13018b6d6341Smrg]) # XORG_CHECK_LINUXDOC
13028b6d6341Smrg
13038b6d6341Smrg# XORG_CHECK_DOCBOOK
13048b6d6341Smrg# -------------------
13058b6d6341Smrg# Minimum version: 1.0.0
13068b6d6341Smrg#
13078b6d6341Smrg# Checks for the ability to build output formats from SGML DocBook source.
13088b6d6341Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
13098b6d6341Smrg# indicates whether the necessary tools and files are found and, if set,
13108b6d6341Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
13118b6d6341SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
131223a8d56dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
131323a8d56dSmrg
13148b6d6341SmrgBUILDTXTDOC=no
13158b6d6341SmrgBUILDPDFDOC=no
13168b6d6341SmrgBUILDPSDOC=no
13178b6d6341SmrgBUILDHTMLDOC=no
13181abf7346Smrg
13198b6d6341SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
13208b6d6341SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
13218b6d6341SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
13228b6d6341SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
13231abf7346Smrg
132423a8d56dSmrgAC_MSG_CHECKING([whether to build text documentation])
132523a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
13268b6d6341Smrg   test x$BUILD_TXTDOC != xno; then
13278b6d6341Smrg	BUILDTXTDOC=yes
13288b6d6341Smrgfi
13298b6d6341SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
13308b6d6341SmrgAC_MSG_RESULT([$BUILDTXTDOC])
13311abf7346Smrg
133223a8d56dSmrgAC_MSG_CHECKING([whether to build PDF documentation])
133323a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
13348b6d6341Smrg   test x$BUILD_PDFDOC != xno; then
13358b6d6341Smrg	BUILDPDFDOC=yes
13368b6d6341Smrgfi
13378b6d6341SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
13388b6d6341SmrgAC_MSG_RESULT([$BUILDPDFDOC])
13391abf7346Smrg
134023a8d56dSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
134123a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
13428b6d6341Smrg   test x$BUILD_PSDOC != xno; then
13438b6d6341Smrg	BUILDPSDOC=yes
13448b6d6341Smrgfi
13458b6d6341SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
13468b6d6341SmrgAC_MSG_RESULT([$BUILDPSDOC])
13471abf7346Smrg
134823a8d56dSmrgAC_MSG_CHECKING([whether to build HTML documentation])
134923a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
13508b6d6341Smrg   test x$BUILD_HTMLDOC != xno; then
13518b6d6341Smrg	BUILDHTMLDOC=yes
13528b6d6341Smrgfi
13538b6d6341SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
13548b6d6341SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
13551abf7346Smrg
13568b6d6341SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
13578b6d6341SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
13588b6d6341SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
13598b6d6341SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
13601abf7346Smrg
13618b6d6341SmrgAC_SUBST(MAKE_TEXT)
13628b6d6341SmrgAC_SUBST(MAKE_PS)
13638b6d6341SmrgAC_SUBST(MAKE_PDF)
13648b6d6341SmrgAC_SUBST(MAKE_HTML)
13658b6d6341Smrg]) # XORG_CHECK_DOCBOOK
13661abf7346Smrg
136723a8d56dSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
136823a8d56dSmrg# ----------------
136923a8d56dSmrg# Minimum version: 1.5.0
137023a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
137123a8d56dSmrg#
137223a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
137323a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
137423a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
137523a8d56dSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
137623a8d56dSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
137723a8d56dSmrg# --with-xmlto assumes 'auto'.
137823a8d56dSmrg#
137923a8d56dSmrg# Interface to module:
138023a8d56dSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
138123a8d56dSmrg# XMLTO:	returns the path of the xmlto program found
138223a8d56dSmrg#		returns the path set by the user in the environment
138323a8d56dSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
138423a8d56dSmrg#		'no' user instructs the module not to use xmlto
138523a8d56dSmrg#
138623a8d56dSmrg# Added in version 1.10.0
138723a8d56dSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
138823a8d56dSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
138923a8d56dSmrg#
139023a8d56dSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
139123a8d56dSmrg#
139223a8d56dSmrgAC_DEFUN([XORG_WITH_XMLTO],[
139323a8d56dSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
139423a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
139523a8d56dSmrgAC_ARG_WITH(xmlto,
139623a8d56dSmrg	AS_HELP_STRING([--with-xmlto],
139723a8d56dSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
139823a8d56dSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
139923a8d56dSmrgm4_undefine([_defopt])
140023a8d56dSmrg
140123a8d56dSmrgif test "x$use_xmlto" = x"auto"; then
140223a8d56dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
140323a8d56dSmrg   if test "x$XMLTO" = "x"; then
140423a8d56dSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
140523a8d56dSmrg	have_xmlto=no
140623a8d56dSmrg   else
140723a8d56dSmrg        have_xmlto=yes
140823a8d56dSmrg   fi
140923a8d56dSmrgelif test "x$use_xmlto" = x"yes" ; then
141023a8d56dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
141123a8d56dSmrg   if test "x$XMLTO" = "x"; then
141223a8d56dSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
141323a8d56dSmrg   fi
141423a8d56dSmrg   have_xmlto=yes
141523a8d56dSmrgelif test "x$use_xmlto" = x"no" ; then
141623a8d56dSmrg   if test "x$XMLTO" != "x"; then
141723a8d56dSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
141823a8d56dSmrg   fi
141923a8d56dSmrg   have_xmlto=no
142023a8d56dSmrgelse
142123a8d56dSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
142223a8d56dSmrgfi
142323a8d56dSmrg
142423a8d56dSmrg# Test for a minimum version of xmlto, if provided.
142523a8d56dSmrgm4_ifval([$1],
142623a8d56dSmrg[if test "$have_xmlto" = yes; then
142723a8d56dSmrg    # scrape the xmlto version
142823a8d56dSmrg    AC_MSG_CHECKING([the xmlto version])
142923a8d56dSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
143023a8d56dSmrg    AC_MSG_RESULT([$xmlto_version])
143123a8d56dSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
143223a8d56dSmrg        [if test "x$use_xmlto" = xauto; then
143323a8d56dSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
143423a8d56dSmrg            have_xmlto=no
143523a8d56dSmrg        else
143623a8d56dSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
143723a8d56dSmrg        fi])
143823a8d56dSmrgfi])
143923a8d56dSmrg
144023a8d56dSmrg# Test for the ability of xmlto to generate a text target
144123a8d56dSmrghave_xmlto_text=no
144223a8d56dSmrgcat > conftest.xml << "EOF"
144323a8d56dSmrgEOF
144423a8d56dSmrgAS_IF([test "$have_xmlto" = yes],
144523a8d56dSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
144623a8d56dSmrg             [have_xmlto_text=yes],
144723a8d56dSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
144823a8d56dSmrgrm -f conftest.xml
144923a8d56dSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
145023a8d56dSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
145123a8d56dSmrg]) # XORG_WITH_XMLTO
145223a8d56dSmrg
14531633cc4bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
14541633cc4bSmrg# --------------------------------------------
14551633cc4bSmrg# Minimum version: 1.12.0
14561633cc4bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
14571633cc4bSmrg#
14581633cc4bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
14591633cc4bSmrg# XML-based language used for the transformation of XML documents.
14601633cc4bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
14611633cc4bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
14621633cc4bSmrg# The XSLT processor is often used as a standalone tool for transformations.
14631633cc4bSmrg# It should not be assumed that this tool is used only to work with documnetation.
14641633cc4bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
14651633cc4bSmrg#
14661633cc4bSmrg# Interface to module:
14671633cc4bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
14681633cc4bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
14691633cc4bSmrg#		 returns the path set by the user in the environment
14701633cc4bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
14711633cc4bSmrg#		  'no' user instructs the module not to use xsltproc
14721633cc4bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
14731633cc4bSmrg#
14741633cc4bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
14751633cc4bSmrg#
14761633cc4bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
14771633cc4bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
14781633cc4bSmrg# Preserves the interface, should it be implemented later
14791633cc4bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
14801633cc4bSmrgm4_define([_defopt], m4_default([$2], [auto]))
14811633cc4bSmrgAC_ARG_WITH(xsltproc,
14821633cc4bSmrg	AS_HELP_STRING([--with-xsltproc],
14831633cc4bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
14841633cc4bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
14851633cc4bSmrgm4_undefine([_defopt])
14861633cc4bSmrg
14871633cc4bSmrgif test "x$use_xsltproc" = x"auto"; then
14881633cc4bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
14891633cc4bSmrg   if test "x$XSLTPROC" = "x"; then
14901633cc4bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
14911633cc4bSmrg	have_xsltproc=no
14921633cc4bSmrg   else
14931633cc4bSmrg        have_xsltproc=yes
14941633cc4bSmrg   fi
14951633cc4bSmrgelif test "x$use_xsltproc" = x"yes" ; then
14961633cc4bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
14971633cc4bSmrg   if test "x$XSLTPROC" = "x"; then
14981633cc4bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
14991633cc4bSmrg   fi
15001633cc4bSmrg   have_xsltproc=yes
15011633cc4bSmrgelif test "x$use_xsltproc" = x"no" ; then
15021633cc4bSmrg   if test "x$XSLTPROC" != "x"; then
15031633cc4bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
15041633cc4bSmrg   fi
15051633cc4bSmrg   have_xsltproc=no
15061633cc4bSmrgelse
15071633cc4bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
15081633cc4bSmrgfi
15091633cc4bSmrg
15101633cc4bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
15111633cc4bSmrg]) # XORG_WITH_XSLTPROC
15121633cc4bSmrg
15131633cc4bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
15141633cc4bSmrg# ----------------------------------------
15151633cc4bSmrg# Minimum version: 1.15.0
15161633cc4bSmrg#
15171633cc4bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
15181633cc4bSmrg# scanning arbitrary text files, extracting information from those text files,
15191633cc4bSmrg# and printing reports based on that information.
15201633cc4bSmrg#
15211633cc4bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
15221633cc4bSmrg#
15231633cc4bSmrg# Interface to module:
15241633cc4bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
15251633cc4bSmrg# PERL:	     returns the path of the perl program found
15261633cc4bSmrg#	     returns the path set by the user in the environment
15271633cc4bSmrg# --with-perl: 'yes' user instructs the module to use perl
15281633cc4bSmrg#	       'no' user instructs the module not to use perl
15291633cc4bSmrg# have_perl: returns yes if perl found in PATH or no
15301633cc4bSmrg#
15311633cc4bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
15321633cc4bSmrg#
15331633cc4bSmrgAC_DEFUN([XORG_WITH_PERL],[
15341633cc4bSmrgAC_ARG_VAR([PERL], [Path to perl command])
15351633cc4bSmrg# Preserves the interface, should it be implemented later
15361633cc4bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
15371633cc4bSmrgm4_define([_defopt], m4_default([$2], [auto]))
15381633cc4bSmrgAC_ARG_WITH(perl,
15391633cc4bSmrg	AS_HELP_STRING([--with-perl],
15401633cc4bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
15411633cc4bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
15421633cc4bSmrgm4_undefine([_defopt])
15431633cc4bSmrg
15441633cc4bSmrgif test "x$use_perl" = x"auto"; then
15451633cc4bSmrg   AC_PATH_PROG([PERL], [perl])
15461633cc4bSmrg   if test "x$PERL" = "x"; then
15471633cc4bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
15481633cc4bSmrg	have_perl=no
15491633cc4bSmrg   else
15501633cc4bSmrg        have_perl=yes
15511633cc4bSmrg   fi
15521633cc4bSmrgelif test "x$use_perl" = x"yes" ; then
15531633cc4bSmrg   AC_PATH_PROG([PERL], [perl])
15541633cc4bSmrg   if test "x$PERL" = "x"; then
15551633cc4bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
15561633cc4bSmrg   fi
15571633cc4bSmrg   have_perl=yes
15581633cc4bSmrgelif test "x$use_perl" = x"no" ; then
15591633cc4bSmrg   if test "x$PERL" != "x"; then
15601633cc4bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
15611633cc4bSmrg   fi
15621633cc4bSmrg   have_perl=no
15631633cc4bSmrgelse
15641633cc4bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
15651633cc4bSmrgfi
15661633cc4bSmrg
15671633cc4bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
15681633cc4bSmrg]) # XORG_WITH_PERL
15691633cc4bSmrg
157023a8d56dSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
157123a8d56dSmrg# ----------------
157223a8d56dSmrg# Minimum version: 1.5.0
157323a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
157423a8d56dSmrg#
157523a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
157623a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
157723a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
157823a8d56dSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
157923a8d56dSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
158023a8d56dSmrg# --with-asciidoc assumes 'auto'.
158123a8d56dSmrg#
158223a8d56dSmrg# Interface to module:
158323a8d56dSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
158423a8d56dSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
158523a8d56dSmrg#		 returns the path set by the user in the environment
158623a8d56dSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
158723a8d56dSmrg#		  'no' user instructs the module not to use asciidoc
158823a8d56dSmrg#
158923a8d56dSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
159023a8d56dSmrg#
159123a8d56dSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
159223a8d56dSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
159323a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
159423a8d56dSmrgAC_ARG_WITH(asciidoc,
159523a8d56dSmrg	AS_HELP_STRING([--with-asciidoc],
159623a8d56dSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
159723a8d56dSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
159823a8d56dSmrgm4_undefine([_defopt])
159923a8d56dSmrg
160023a8d56dSmrgif test "x$use_asciidoc" = x"auto"; then
160123a8d56dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
160223a8d56dSmrg   if test "x$ASCIIDOC" = "x"; then
160323a8d56dSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
160423a8d56dSmrg	have_asciidoc=no
160523a8d56dSmrg   else
160623a8d56dSmrg        have_asciidoc=yes
160723a8d56dSmrg   fi
160823a8d56dSmrgelif test "x$use_asciidoc" = x"yes" ; then
160923a8d56dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
161023a8d56dSmrg   if test "x$ASCIIDOC" = "x"; then
161123a8d56dSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
161223a8d56dSmrg   fi
161323a8d56dSmrg   have_asciidoc=yes
161423a8d56dSmrgelif test "x$use_asciidoc" = x"no" ; then
161523a8d56dSmrg   if test "x$ASCIIDOC" != "x"; then
161623a8d56dSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
161723a8d56dSmrg   fi
161823a8d56dSmrg   have_asciidoc=no
161923a8d56dSmrgelse
162023a8d56dSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
162123a8d56dSmrgfi
162223a8d56dSmrgm4_ifval([$1],
162323a8d56dSmrg[if test "$have_asciidoc" = yes; then
162423a8d56dSmrg    # scrape the asciidoc version
162523a8d56dSmrg    AC_MSG_CHECKING([the asciidoc version])
162623a8d56dSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
162723a8d56dSmrg    AC_MSG_RESULT([$asciidoc_version])
162823a8d56dSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
162923a8d56dSmrg        [if test "x$use_asciidoc" = xauto; then
163023a8d56dSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
163123a8d56dSmrg            have_asciidoc=no
163223a8d56dSmrg        else
163323a8d56dSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
163423a8d56dSmrg        fi])
163523a8d56dSmrgfi])
163623a8d56dSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
163723a8d56dSmrg]) # XORG_WITH_ASCIIDOC
163823a8d56dSmrg
163923a8d56dSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
164023a8d56dSmrg# --------------------------------
164123a8d56dSmrg# Minimum version: 1.5.0
164223a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
164323a8d56dSmrg#
164423a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
164523a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
164623a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
164723a8d56dSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
164823a8d56dSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
164923a8d56dSmrg# --with-doxygen assumes 'auto'.
165023a8d56dSmrg#
165123a8d56dSmrg# Interface to module:
165223a8d56dSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
165323a8d56dSmrg# DOXYGEN:	 returns the path of the doxygen program found
165423a8d56dSmrg#		 returns the path set by the user in the environment
165523a8d56dSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
165623a8d56dSmrg#		  'no' user instructs the module not to use doxygen
165723a8d56dSmrg#
165823a8d56dSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
165923a8d56dSmrg#
166023a8d56dSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
166123a8d56dSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
166223a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
166323a8d56dSmrgAC_ARG_WITH(doxygen,
166423a8d56dSmrg	AS_HELP_STRING([--with-doxygen],
166523a8d56dSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
166623a8d56dSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
166723a8d56dSmrgm4_undefine([_defopt])
166823a8d56dSmrg
166923a8d56dSmrgif test "x$use_doxygen" = x"auto"; then
167023a8d56dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
167123a8d56dSmrg   if test "x$DOXYGEN" = "x"; then
167223a8d56dSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
167323a8d56dSmrg	have_doxygen=no
167423a8d56dSmrg   else
167523a8d56dSmrg        have_doxygen=yes
167623a8d56dSmrg   fi
167723a8d56dSmrgelif test "x$use_doxygen" = x"yes" ; then
167823a8d56dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
167923a8d56dSmrg   if test "x$DOXYGEN" = "x"; then
168023a8d56dSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
168123a8d56dSmrg   fi
168223a8d56dSmrg   have_doxygen=yes
168323a8d56dSmrgelif test "x$use_doxygen" = x"no" ; then
168423a8d56dSmrg   if test "x$DOXYGEN" != "x"; then
168523a8d56dSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
168623a8d56dSmrg   fi
168723a8d56dSmrg   have_doxygen=no
168823a8d56dSmrgelse
168923a8d56dSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
169023a8d56dSmrgfi
169123a8d56dSmrgm4_ifval([$1],
169223a8d56dSmrg[if test "$have_doxygen" = yes; then
169323a8d56dSmrg    # scrape the doxygen version
169423a8d56dSmrg    AC_MSG_CHECKING([the doxygen version])
169523a8d56dSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
169623a8d56dSmrg    AC_MSG_RESULT([$doxygen_version])
169723a8d56dSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
169823a8d56dSmrg        [if test "x$use_doxygen" = xauto; then
169923a8d56dSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
170023a8d56dSmrg            have_doxygen=no
170123a8d56dSmrg        else
170223a8d56dSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
170323a8d56dSmrg        fi])
170423a8d56dSmrgfi])
170523a8d56dSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
170623a8d56dSmrg]) # XORG_WITH_DOXYGEN
170723a8d56dSmrg
170823a8d56dSmrg# XORG_WITH_GROFF([DEFAULT])
170923a8d56dSmrg# ----------------
171023a8d56dSmrg# Minimum version: 1.6.0
171123a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
171223a8d56dSmrg#
171323a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
171423a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
171523a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
171623a8d56dSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
171723a8d56dSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
171823a8d56dSmrg# --with-groff assumes 'auto'.
171923a8d56dSmrg#
172023a8d56dSmrg# Interface to module:
172123a8d56dSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
172223a8d56dSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
172323a8d56dSmrg# HAVE_GROFF_MS: the -ms macros package
172423a8d56dSmrg# GROFF:	 returns the path of the groff program found
172523a8d56dSmrg#		 returns the path set by the user in the environment
172623a8d56dSmrg# --with-groff:	 'yes' user instructs the module to use groff
172723a8d56dSmrg#		 'no' user instructs the module not to use groff
172823a8d56dSmrg#
172923a8d56dSmrg# Added in version 1.9.0:
173023a8d56dSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
173123a8d56dSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
173223a8d56dSmrg#		   psselect from the psutils package.
173323a8d56dSmrg#		   the ghostcript package. Refer to the grohtml man pages
173423a8d56dSmrg#
173523a8d56dSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
173623a8d56dSmrg#
173723a8d56dSmrg# OS and distros often splits groff in a basic and full package, the former
173823a8d56dSmrg# having the groff program and the later having devices, fonts and macros
173923a8d56dSmrg# Checking for the groff executable is not enough.
174023a8d56dSmrg#
174123a8d56dSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
174223a8d56dSmrg# unset HAVE_GROFF or GROFF env variables.
174323a8d56dSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
174423a8d56dSmrg#
174523a8d56dSmrgAC_DEFUN([XORG_WITH_GROFF],[
174623a8d56dSmrgAC_ARG_VAR([GROFF], [Path to groff command])
174723a8d56dSmrgm4_define([_defopt], m4_default([$1], [auto]))
174823a8d56dSmrgAC_ARG_WITH(groff,
174923a8d56dSmrg	AS_HELP_STRING([--with-groff],
175023a8d56dSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
175123a8d56dSmrg	   [use_groff=$withval], [use_groff=]_defopt)
175223a8d56dSmrgm4_undefine([_defopt])
175323a8d56dSmrg
175423a8d56dSmrgif test "x$use_groff" = x"auto"; then
175523a8d56dSmrg   AC_PATH_PROG([GROFF], [groff])
175623a8d56dSmrg   if test "x$GROFF" = "x"; then
175723a8d56dSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
175823a8d56dSmrg	have_groff=no
175923a8d56dSmrg   else
176023a8d56dSmrg        have_groff=yes
176123a8d56dSmrg   fi
176223a8d56dSmrgelif test "x$use_groff" = x"yes" ; then
176323a8d56dSmrg   AC_PATH_PROG([GROFF], [groff])
176423a8d56dSmrg   if test "x$GROFF" = "x"; then
176523a8d56dSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
176623a8d56dSmrg   fi
176723a8d56dSmrg   have_groff=yes
176823a8d56dSmrgelif test "x$use_groff" = x"no" ; then
176923a8d56dSmrg   if test "x$GROFF" != "x"; then
177023a8d56dSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
177123a8d56dSmrg   fi
177223a8d56dSmrg   have_groff=no
177323a8d56dSmrgelse
177423a8d56dSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
177523a8d56dSmrgfi
177623a8d56dSmrg
177723a8d56dSmrg# We have groff, test for the presence of the macro packages
177823a8d56dSmrgif test "x$have_groff" = x"yes"; then
177923a8d56dSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
178023a8d56dSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
178123a8d56dSmrg        groff_ms_works=yes
178223a8d56dSmrg    else
178323a8d56dSmrg        groff_ms_works=no
178423a8d56dSmrg    fi
178523a8d56dSmrg    AC_MSG_RESULT([$groff_ms_works])
178623a8d56dSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
178723a8d56dSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
178823a8d56dSmrg        groff_mm_works=yes
178923a8d56dSmrg    else
179023a8d56dSmrg        groff_mm_works=no
179123a8d56dSmrg    fi
179223a8d56dSmrg    AC_MSG_RESULT([$groff_mm_works])
179323a8d56dSmrgfi
179423a8d56dSmrg
179523a8d56dSmrg# We have groff, test for HTML dependencies, one command per package
179623a8d56dSmrgif test "x$have_groff" = x"yes"; then
179723a8d56dSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
179823a8d56dSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
179923a8d56dSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
180023a8d56dSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
180123a8d56dSmrg      have_groff_html=yes
180223a8d56dSmrg   else
180323a8d56dSmrg      have_groff_html=no
180423a8d56dSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
180523a8d56dSmrg   fi
180623a8d56dSmrgfi
180723a8d56dSmrg
180823a8d56dSmrg# Set Automake conditionals for Makefiles
180923a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
181023a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
181123a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
181223a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
181323a8d56dSmrg]) # XORG_WITH_GROFF
181423a8d56dSmrg
18151633cc4bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
18161633cc4bSmrg# ---------------------------------------
181723a8d56dSmrg# Minimum version: 1.6.0
181823a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18191633cc4bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
182023a8d56dSmrg#
182123a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
182223a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
182323a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
182423a8d56dSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
182523a8d56dSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
182623a8d56dSmrg# --with-fop assumes 'auto'.
182723a8d56dSmrg#
182823a8d56dSmrg# Interface to module:
182923a8d56dSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
183023a8d56dSmrg# FOP:	 	returns the path of the fop program found
183123a8d56dSmrg#		returns the path set by the user in the environment
183223a8d56dSmrg# --with-fop: 	'yes' user instructs the module to use fop
183323a8d56dSmrg#		'no' user instructs the module not to use fop
183423a8d56dSmrg#
183523a8d56dSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
183623a8d56dSmrg#
183723a8d56dSmrgAC_DEFUN([XORG_WITH_FOP],[
183823a8d56dSmrgAC_ARG_VAR([FOP], [Path to fop command])
18391633cc4bSmrgm4_define([_defopt], m4_default([$2], [auto]))
184023a8d56dSmrgAC_ARG_WITH(fop,
184123a8d56dSmrg	AS_HELP_STRING([--with-fop],
184223a8d56dSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
184323a8d56dSmrg	   [use_fop=$withval], [use_fop=]_defopt)
184423a8d56dSmrgm4_undefine([_defopt])
184523a8d56dSmrg
184623a8d56dSmrgif test "x$use_fop" = x"auto"; then
184723a8d56dSmrg   AC_PATH_PROG([FOP], [fop])
184823a8d56dSmrg   if test "x$FOP" = "x"; then
184923a8d56dSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
185023a8d56dSmrg	have_fop=no
185123a8d56dSmrg   else
185223a8d56dSmrg        have_fop=yes
185323a8d56dSmrg   fi
185423a8d56dSmrgelif test "x$use_fop" = x"yes" ; then
185523a8d56dSmrg   AC_PATH_PROG([FOP], [fop])
185623a8d56dSmrg   if test "x$FOP" = "x"; then
185723a8d56dSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
185823a8d56dSmrg   fi
185923a8d56dSmrg   have_fop=yes
186023a8d56dSmrgelif test "x$use_fop" = x"no" ; then
186123a8d56dSmrg   if test "x$FOP" != "x"; then
186223a8d56dSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
186323a8d56dSmrg   fi
186423a8d56dSmrg   have_fop=no
186523a8d56dSmrgelse
186623a8d56dSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
186723a8d56dSmrgfi
18681633cc4bSmrg
18691633cc4bSmrg# Test for a minimum version of fop, if provided.
18701633cc4bSmrgm4_ifval([$1],
18711633cc4bSmrg[if test "$have_fop" = yes; then
18721633cc4bSmrg    # scrape the fop version
18731633cc4bSmrg    AC_MSG_CHECKING([for fop minimum version])
18741633cc4bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
18751633cc4bSmrg    AC_MSG_RESULT([$fop_version])
18761633cc4bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
18771633cc4bSmrg        [if test "x$use_fop" = xauto; then
18781633cc4bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
18791633cc4bSmrg            have_fop=no
18801633cc4bSmrg        else
18811633cc4bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
18821633cc4bSmrg        fi])
18831633cc4bSmrgfi])
188423a8d56dSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
188523a8d56dSmrg]) # XORG_WITH_FOP
188623a8d56dSmrg
188723a8d56dSmrg# XORG_WITH_PS2PDF([DEFAULT])
188823a8d56dSmrg# ----------------
188923a8d56dSmrg# Minimum version: 1.6.0
189023a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
189123a8d56dSmrg#
189223a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
189323a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
189423a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
189523a8d56dSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
189623a8d56dSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
189723a8d56dSmrg# --with-ps2pdf assumes 'auto'.
189823a8d56dSmrg#
189923a8d56dSmrg# Interface to module:
190023a8d56dSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
190123a8d56dSmrg# PS2PDF:	returns the path of the ps2pdf program found
190223a8d56dSmrg#		returns the path set by the user in the environment
190323a8d56dSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
190423a8d56dSmrg#		 'no' user instructs the module not to use ps2pdf
190523a8d56dSmrg#
190623a8d56dSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
190723a8d56dSmrg#
190823a8d56dSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
190923a8d56dSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
191023a8d56dSmrgm4_define([_defopt], m4_default([$1], [auto]))
191123a8d56dSmrgAC_ARG_WITH(ps2pdf,
191223a8d56dSmrg	AS_HELP_STRING([--with-ps2pdf],
191323a8d56dSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
191423a8d56dSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
191523a8d56dSmrgm4_undefine([_defopt])
191623a8d56dSmrg
191723a8d56dSmrgif test "x$use_ps2pdf" = x"auto"; then
191823a8d56dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
191923a8d56dSmrg   if test "x$PS2PDF" = "x"; then
192023a8d56dSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
192123a8d56dSmrg	have_ps2pdf=no
192223a8d56dSmrg   else
192323a8d56dSmrg        have_ps2pdf=yes
192423a8d56dSmrg   fi
192523a8d56dSmrgelif test "x$use_ps2pdf" = x"yes" ; then
192623a8d56dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
192723a8d56dSmrg   if test "x$PS2PDF" = "x"; then
192823a8d56dSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
192923a8d56dSmrg   fi
193023a8d56dSmrg   have_ps2pdf=yes
193123a8d56dSmrgelif test "x$use_ps2pdf" = x"no" ; then
193223a8d56dSmrg   if test "x$PS2PDF" != "x"; then
193323a8d56dSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
193423a8d56dSmrg   fi
193523a8d56dSmrg   have_ps2pdf=no
193623a8d56dSmrgelse
193723a8d56dSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
193823a8d56dSmrgfi
193923a8d56dSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
194023a8d56dSmrg]) # XORG_WITH_PS2PDF
194123a8d56dSmrg
194223a8d56dSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
194323a8d56dSmrg# ----------------
194423a8d56dSmrg# Minimum version: 1.6.0
194523a8d56dSmrg#
194623a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
194723a8d56dSmrg# not at the appropriate level. This macro enables a builder to skip all
194823a8d56dSmrg# documentation targets except traditional man pages.
194923a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
195023a8d56dSmrg# maximum flexibilty in controlling documentation building.
195123a8d56dSmrg# Refer to:
195223a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
195323a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
195423a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
195523a8d56dSmrg# XORG_WITH_FOP           --with-fop
195623a8d56dSmrg# XORG_WITH_GROFF         --with-groff
195723a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
195823a8d56dSmrg#
195923a8d56dSmrg# Interface to module:
196023a8d56dSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
196123a8d56dSmrg# --enable-docs: 'yes' user instructs the module to generate docs
196223a8d56dSmrg#		 'no' user instructs the module not to generate docs
196323a8d56dSmrg# parm1:	specify the default value, yes or no.
196423a8d56dSmrg#
196523a8d56dSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
19661633cc4bSmrgm4_define([docs_default], m4_default([$1], [yes]))
196723a8d56dSmrgAC_ARG_ENABLE(docs,
196823a8d56dSmrg	AS_HELP_STRING([--enable-docs],
19691633cc4bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
19701633cc4bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
19711633cc4bSmrgm4_undefine([docs_default])
197223a8d56dSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
197323a8d56dSmrgAC_MSG_CHECKING([whether to build documentation])
197423a8d56dSmrgAC_MSG_RESULT([$build_docs])
197523a8d56dSmrg]) # XORG_ENABLE_DOCS
197623a8d56dSmrg
197723a8d56dSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
197823a8d56dSmrg# ----------------
197923a8d56dSmrg# Minimum version: 1.6.0
198023a8d56dSmrg#
198123a8d56dSmrg# This macro enables a builder to skip all developer documentation.
198223a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
198323a8d56dSmrg# maximum flexibilty in controlling documentation building.
198423a8d56dSmrg# Refer to:
198523a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
198623a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
198723a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
198823a8d56dSmrg# XORG_WITH_FOP           --with-fop
198923a8d56dSmrg# XORG_WITH_GROFF         --with-groff
199023a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
199123a8d56dSmrg#
199223a8d56dSmrg# Interface to module:
199323a8d56dSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
199423a8d56dSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
199523a8d56dSmrg#			'no' user instructs the module not to generate developer docs
199623a8d56dSmrg# parm1:		specify the default value, yes or no.
199723a8d56dSmrg#
199823a8d56dSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
199923a8d56dSmrgm4_define([devel_default], m4_default([$1], [yes]))
200023a8d56dSmrgAC_ARG_ENABLE(devel-docs,
200123a8d56dSmrg	AS_HELP_STRING([--enable-devel-docs],
200223a8d56dSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
200323a8d56dSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
200423a8d56dSmrgm4_undefine([devel_default])
200523a8d56dSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
200623a8d56dSmrgAC_MSG_CHECKING([whether to build developer documentation])
200723a8d56dSmrgAC_MSG_RESULT([$build_devel_docs])
200823a8d56dSmrg]) # XORG_ENABLE_DEVEL_DOCS
200923a8d56dSmrg
201023a8d56dSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
201123a8d56dSmrg# ----------------
201223a8d56dSmrg# Minimum version: 1.6.0
201323a8d56dSmrg#
201423a8d56dSmrg# This macro enables a builder to skip all functional specification targets.
201523a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
201623a8d56dSmrg# maximum flexibilty in controlling documentation building.
201723a8d56dSmrg# Refer to:
201823a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
201923a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
202023a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
202123a8d56dSmrg# XORG_WITH_FOP           --with-fop
202223a8d56dSmrg# XORG_WITH_GROFF         --with-groff
202323a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
202423a8d56dSmrg#
202523a8d56dSmrg# Interface to module:
202623a8d56dSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
202723a8d56dSmrg# --enable-specs:	'yes' user instructs the module to generate specs
202823a8d56dSmrg#			'no' user instructs the module not to generate specs
202923a8d56dSmrg# parm1:		specify the default value, yes or no.
203023a8d56dSmrg#
203123a8d56dSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
203223a8d56dSmrgm4_define([spec_default], m4_default([$1], [yes]))
203323a8d56dSmrgAC_ARG_ENABLE(specs,
203423a8d56dSmrg	AS_HELP_STRING([--enable-specs],
203523a8d56dSmrg	   [Enable building the specs (default: ]spec_default[)]),
203623a8d56dSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
203723a8d56dSmrgm4_undefine([spec_default])
203823a8d56dSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
203923a8d56dSmrgAC_MSG_CHECKING([whether to build functional specifications])
204023a8d56dSmrgAC_MSG_RESULT([$build_specs])
204123a8d56dSmrg]) # XORG_ENABLE_SPECS
204223a8d56dSmrg
20431633cc4bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
20441633cc4bSmrg# ----------------------------------------------
20451633cc4bSmrg# Minimum version: 1.13.0
20461633cc4bSmrg#
20471633cc4bSmrg# This macro enables a builder to enable/disable unit testing
20481633cc4bSmrg# It makes no assumption about the test cases implementation
20491633cc4bSmrg# Test cases may or may not use Automake "Support for test suites"
20501633cc4bSmrg# They may or may not use the software utility library GLib
20511633cc4bSmrg#
20521633cc4bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
20531633cc4bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
20541633cc4bSmrg# The variable enable_unit_tests is used by other macros in this file.
20551633cc4bSmrg#
20561633cc4bSmrg# Interface to module:
20571633cc4bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
20581633cc4bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
20591633cc4bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
20601633cc4bSmrg#			'no' user instructs the module not to build tests
20611633cc4bSmrg# parm1:		specify the default value, yes or no.
20621633cc4bSmrg#
20631633cc4bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
20641633cc4bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
20651633cc4bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
20661633cc4bSmrgm4_define([_defopt], m4_default([$1], [auto]))
20671633cc4bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
20681633cc4bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
20691633cc4bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
20701633cc4bSmrgm4_undefine([_defopt])
20711633cc4bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
20721633cc4bSmrgAC_MSG_CHECKING([whether to build unit test cases])
20731633cc4bSmrgAC_MSG_RESULT([$enable_unit_tests])
20741633cc4bSmrg]) # XORG_ENABLE_UNIT_TESTS
20751633cc4bSmrg
20761633cc4bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
20771633cc4bSmrg# ----------------------------------------
20781633cc4bSmrg# Minimum version: 1.13.0
20791633cc4bSmrg#
20801633cc4bSmrg# GLib is a library which provides advanced data structures and functions.
20811633cc4bSmrg# This macro enables a module to test for the presence of Glib.
20821633cc4bSmrg#
20831633cc4bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
20841633cc4bSmrg# Otherwise the value of $enable_unit_tests is blank.
20851633cc4bSmrg#
20861633cc4bSmrg# Interface to module:
20871633cc4bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
20881633cc4bSmrg# with_glib: used in configure.ac to know if GLib has been found
20891633cc4bSmrg# --with-glib:	'yes' user instructs the module to use glib
20901633cc4bSmrg#		'no' user instructs the module not to use glib
20911633cc4bSmrg#
20921633cc4bSmrgAC_DEFUN([XORG_WITH_GLIB],[
20931633cc4bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
20941633cc4bSmrgm4_define([_defopt], m4_default([$2], [auto]))
20951633cc4bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
20961633cc4bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
20971633cc4bSmrg	[with_glib=$withval], [with_glib=]_defopt)
20981633cc4bSmrgm4_undefine([_defopt])
20991633cc4bSmrg
21001633cc4bSmrghave_glib=no
21011633cc4bSmrg# Do not probe GLib if user explicitly disabled unit testing
21021633cc4bSmrgif test "x$enable_unit_tests" != x"no"; then
21031633cc4bSmrg  # Do not probe GLib if user explicitly disabled it
21041633cc4bSmrg  if test "x$with_glib" != x"no"; then
21051633cc4bSmrg    m4_ifval(
21061633cc4bSmrg      [$1],
21071633cc4bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
21081633cc4bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
21091633cc4bSmrg    )
21101633cc4bSmrg  fi
21111633cc4bSmrgfi
21121633cc4bSmrg
21131633cc4bSmrg# Not having GLib when unit testing has been explicitly requested is an error
21141633cc4bSmrgif test "x$enable_unit_tests" = x"yes"; then
21151633cc4bSmrg  if test "x$have_glib" = x"no"; then
21161633cc4bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
21171633cc4bSmrg  fi
21181633cc4bSmrgfi
21191633cc4bSmrg
21201633cc4bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
21211633cc4bSmrgif test "x$enable_unit_tests" = x"no"; then
21221633cc4bSmrg  if test "x$with_glib" = x"yes"; then
21231633cc4bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
21241633cc4bSmrg  fi
21251633cc4bSmrgfi
21261633cc4bSmrg
21271633cc4bSmrg# Not having GLib when it has been explicitly requested is an error
21281633cc4bSmrgif test "x$with_glib" = x"yes"; then
21291633cc4bSmrg  if test "x$have_glib" = x"no"; then
21301633cc4bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
21311633cc4bSmrg  fi
21321633cc4bSmrgfi
21331633cc4bSmrg
21341633cc4bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
21351633cc4bSmrg]) # XORG_WITH_GLIB
21361633cc4bSmrg
21371633cc4bSmrg# XORG_LD_WRAP
21381633cc4bSmrg# ------------
21391633cc4bSmrg# Minimum version: 1.13.0
21401633cc4bSmrg#
21411633cc4bSmrg# Check if linker supports -wrap, passed via compiler flags
21421633cc4bSmrg#
21431633cc4bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
21441633cc4bSmrg# Otherwise the value of $enable_unit_tests is blank.
21451633cc4bSmrg#
21461633cc4bSmrgAC_DEFUN([XORG_LD_WRAP],[
21471633cc4bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
21481633cc4bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
21491633cc4bSmrgif test "x$enable_unit_tests" = x"yes"; then
21501633cc4bSmrg  if test "x$have_ld_wrap" = x"no"; then
21511633cc4bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
21521633cc4bSmrg  fi
21531633cc4bSmrgfi
21541633cc4bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
21551633cc4bSmrg#
21561633cc4bSmrg]) # XORG_LD_WRAP
21571633cc4bSmrg
21581633cc4bSmrg# XORG_CHECK_LINKER_FLAGS
21591633cc4bSmrg# -----------------------
21601633cc4bSmrg# SYNOPSIS
21611633cc4bSmrg#
21621633cc4bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
21631633cc4bSmrg#
21641633cc4bSmrg# DESCRIPTION
21651633cc4bSmrg#
21661633cc4bSmrg#   Check whether the given linker FLAGS work with the current language's
21671633cc4bSmrg#   linker, or whether they give an error.
21681633cc4bSmrg#
21691633cc4bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
21701633cc4bSmrg#   success/failure.
21711633cc4bSmrg#
21721633cc4bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
21731633cc4bSmrg#
21741633cc4bSmrg# LICENSE
21751633cc4bSmrg#
21761633cc4bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
21771633cc4bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
21781633cc4bSmrg#   Copyright (c) 2009 Matteo Frigo
21791633cc4bSmrg#
21801633cc4bSmrg#   This program is free software: you can redistribute it and/or modify it
21811633cc4bSmrg#   under the terms of the GNU General Public License as published by the
21821633cc4bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
21831633cc4bSmrg#   option) any later version.
21841633cc4bSmrg#
21851633cc4bSmrg#   This program is distributed in the hope that it will be useful, but
21861633cc4bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
21871633cc4bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
21881633cc4bSmrg#   Public License for more details.
21891633cc4bSmrg#
21901633cc4bSmrg#   You should have received a copy of the GNU General Public License along
21911633cc4bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
21921633cc4bSmrg#
21931633cc4bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
21941633cc4bSmrg#   gives unlimited permission to copy, distribute and modify the configure
21951633cc4bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
21961633cc4bSmrg#   need not follow the terms of the GNU General Public License when using
21971633cc4bSmrg#   or distributing such scripts, even though portions of the text of the
21981633cc4bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
21991633cc4bSmrg#   all other use of the material that constitutes the Autoconf Macro.
22001633cc4bSmrg#
22011633cc4bSmrg#   This special exception to the GPL applies to versions of the Autoconf
22021633cc4bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
22031633cc4bSmrg#   modified version of the Autoconf Macro, you may extend this special
22041633cc4bSmrg#   exception to the GPL to apply to your modified version as well.#
22051633cc4bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
22061633cc4bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
22071633cc4bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
22081633cc4bSmrgAS_LITERAL_IF([$1],
22091633cc4bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
22101633cc4bSmrg      ax_save_FLAGS=$LDFLAGS
22111633cc4bSmrg      LDFLAGS="$1"
22121633cc4bSmrg      AC_LINK_IFELSE([AC_LANG_PROGRAM()],
22131633cc4bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
22141633cc4bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
22151633cc4bSmrg      LDFLAGS=$ax_save_FLAGS])],
22161633cc4bSmrg  [ax_save_FLAGS=$LDFLAGS
22171633cc4bSmrg   LDFLAGS="$1"
22181633cc4bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
22191633cc4bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
22201633cc4bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
22211633cc4bSmrg   LDFLAGS=$ax_save_FLAGS])
22221633cc4bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
22231633cc4bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
22241633cc4bSmrgif test "x$xorg_check_linker_flags" = xyes; then
22251633cc4bSmrg	m4_default([$2], :)
22261633cc4bSmrgelse
22271633cc4bSmrg	m4_default([$3], :)
22281633cc4bSmrgfi
22291633cc4bSmrg]) # XORG_CHECK_LINKER_FLAGS
22301633cc4bSmrg
22318b6d6341Smrg# XORG_CHECK_MALLOC_ZERO
22328b6d6341Smrg# ----------------------
22338b6d6341Smrg# Minimum version: 1.0.0
22348b6d6341Smrg#
22358b6d6341Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
22368b6d6341Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
22378b6d6341Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
22388b6d6341SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
22398b6d6341SmrgAC_ARG_ENABLE(malloc0returnsnull,
22408b6d6341Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
22418b6d6341Smrg		       [malloc(0) returns NULL (default: auto)]),
22428b6d6341Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
22438b6d6341Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
22448b6d6341Smrg
22458b6d6341SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
22468b6d6341Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
22471633cc4bSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
22481633cc4bSmrg#include <stdlib.h>
22491633cc4bSmrg],[
22508b6d6341Smrg    char *m0, *r0, *c0, *p;
22518b6d6341Smrg    m0 = malloc(0);
22528b6d6341Smrg    p = malloc(10);
22538b6d6341Smrg    r0 = realloc(p,0);
22541633cc4bSmrg    c0 = calloc(0,10);
22551633cc4bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
22561633cc4bSmrg])],
22578b6d6341Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
225823a8d56dSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
225923a8d56dSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
22601abf7346Smrgfi
22618b6d6341SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
22628b6d6341Smrg
22638b6d6341Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
22648b6d6341Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
22658b6d6341Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
22668b6d6341Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
22678b6d6341Smrgelse
22688b6d6341Smrg	MALLOC_ZERO_CFLAGS=""
22698b6d6341Smrg	XMALLOC_ZERO_CFLAGS=""
22708b6d6341Smrg	XTMALLOC_ZERO_CFLAGS=""
22711abf7346Smrgfi
22721abf7346Smrg
22738b6d6341SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
22748b6d6341SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
22758b6d6341SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
22768b6d6341Smrg]) # XORG_CHECK_MALLOC_ZERO
22771abf7346Smrg
22788b6d6341Smrg# XORG_WITH_LINT()
22798b6d6341Smrg# ----------------
22808b6d6341Smrg# Minimum version: 1.1.0
22811abf7346Smrg#
228223a8d56dSmrg# This macro enables the use of a tool that flags some suspicious and
228323a8d56dSmrg# non-portable constructs (likely to be bugs) in C language source code.
228423a8d56dSmrg# It will attempt to locate the tool and use appropriate options.
228523a8d56dSmrg# There are various lint type tools on different platforms.
228623a8d56dSmrg#
228723a8d56dSmrg# Interface to module:
228823a8d56dSmrg# LINT:		returns the path to the tool found on the platform
228923a8d56dSmrg#		or the value set to LINT on the configure cmd line
229023a8d56dSmrg#		also an Automake conditional
229123a8d56dSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
229223a8d56dSmrg#
229323a8d56dSmrg# --with-lint:	'yes' user instructs the module to use lint
229423a8d56dSmrg#		'no' user instructs the module not to use lint (default)
229523a8d56dSmrg#
229623a8d56dSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
229723a8d56dSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
22988b6d6341Smrg#
22998b6d6341SmrgAC_DEFUN([XORG_WITH_LINT],[
23001abf7346Smrg
230123a8d56dSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
230223a8d56dSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
23038b6d6341SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
23048b6d6341Smrg		[Use a lint-style source code checker (default: disabled)])],
23058b6d6341Smrg		[use_lint=$withval], [use_lint=no])
230623a8d56dSmrg
230723a8d56dSmrg# Obtain platform specific info like program name and options
230823a8d56dSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
230923a8d56dSmrgcase $host_os in
231023a8d56dSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
231123a8d56dSmrg	lint_name=splint
231223a8d56dSmrg	lint_options="-badflag"
231323a8d56dSmrg	;;
231423a8d56dSmrg  *freebsd* | *netbsd*)
231523a8d56dSmrg	lint_name=lint
231623a8d56dSmrg	lint_options="-u -b"
231723a8d56dSmrg	;;
231823a8d56dSmrg  *solaris*)
231923a8d56dSmrg	lint_name=lint
232023a8d56dSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
232123a8d56dSmrg	;;
232223a8d56dSmrgesac
232323a8d56dSmrg
232423a8d56dSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
232523a8d56dSmrgif test "x$use_lint" = x"yes" ; then
232623a8d56dSmrg   AC_PATH_PROG([LINT], [$lint_name])
232723a8d56dSmrg   if test "x$LINT" = "x"; then
232823a8d56dSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
232923a8d56dSmrg   fi
233023a8d56dSmrgelif test "x$use_lint" = x"no" ; then
233123a8d56dSmrg   if test "x$LINT" != "x"; then
233223a8d56dSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
233323a8d56dSmrg   fi
23348b6d6341Smrgelse
233523a8d56dSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
23368b6d6341Smrgfi
233723a8d56dSmrg
233823a8d56dSmrg# User supplied flags override default flags
233923a8d56dSmrgif test "x$LINT_FLAGS" != "x"; then
234023a8d56dSmrg   lint_options=$LINT_FLAGS
23418b6d6341Smrgfi
23421abf7346Smrg
234323a8d56dSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
234423a8d56dSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
23451abf7346Smrg
23468b6d6341Smrg]) # XORG_WITH_LINT
23471abf7346Smrg
23488b6d6341Smrg# XORG_LINT_LIBRARY(LIBNAME)
23498b6d6341Smrg# --------------------------
23508b6d6341Smrg# Minimum version: 1.1.0
23518b6d6341Smrg#
23528b6d6341Smrg# Sets up flags for building lint libraries for checking programs that call
23538b6d6341Smrg# functions in the library.
23548b6d6341Smrg#
235523a8d56dSmrg# Interface to module:
235623a8d56dSmrg# LINTLIB		- Automake variable with the name of lint library file to make
235723a8d56dSmrg# MAKE_LINT_LIB		- Automake conditional
235823a8d56dSmrg#
235923a8d56dSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
236023a8d56dSmrg#			  - 'no' user instructs the module not to create a lint library (default)
23618b6d6341Smrg
23628b6d6341SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
23638b6d6341SmrgAC_REQUIRE([XORG_WITH_LINT])
23648b6d6341SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
23658b6d6341Smrg	[Create lint library (default: disabled)])],
23668b6d6341Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
236723a8d56dSmrg
236823a8d56dSmrgif test "x$make_lint_lib" = x"yes" ; then
236923a8d56dSmrg   LINTLIB=llib-l$1.ln
237023a8d56dSmrg   if test "x$LINT" = "x"; then
237123a8d56dSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
237223a8d56dSmrg   fi
237323a8d56dSmrgelif test "x$make_lint_lib" != x"no" ; then
237423a8d56dSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
23751abf7346Smrgfi
237623a8d56dSmrg
23778b6d6341SmrgAC_SUBST(LINTLIB)
23788b6d6341SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
23791abf7346Smrg
23808b6d6341Smrg]) # XORG_LINT_LIBRARY
23811abf7346Smrg
23821633cc4bSmrg# XORG_COMPILER_BRAND
23831633cc4bSmrg# -------------------
23841633cc4bSmrg# Minimum version: 1.14.0
23851633cc4bSmrg#
23861633cc4bSmrg# Checks for various brands of compilers and sets flags as appropriate:
23871633cc4bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
23881633cc4bSmrg#   clang compiler - sets CLANGCC to "yes"
23891633cc4bSmrg#   Intel compiler - sets INTELCC to "yes"
23901633cc4bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
23911633cc4bSmrg#
23921633cc4bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
23931633cc4bSmrgAC_REQUIRE([AC_PROG_CC_C99])
23941633cc4bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
23951633cc4bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
23961633cc4bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
23971633cc4bSmrg]) # XORG_COMPILER_BRAND
23981633cc4bSmrg
23998b6d6341Smrg# XORG_CWARNFLAGS
24001abf7346Smrg# ---------------
24018b6d6341Smrg# Minimum version: 1.2.0
24028b6d6341Smrg#
24038b6d6341Smrg# Defines CWARNFLAGS to enable C compiler warnings.
24048b6d6341Smrg#
24058b6d6341SmrgAC_DEFUN([XORG_CWARNFLAGS], [
240623a8d56dSmrgAC_REQUIRE([AC_PROG_CC_C99])
24071633cc4bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
24088b6d6341Smrgif  test "x$GCC" = xyes ; then
24098b6d6341Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
24108b6d6341Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
241123a8d56dSmrg-Wbad-function-cast -Wformat=2"
24128b6d6341Smrg    case `$CC -dumpversion` in
24138b6d6341Smrg    3.4.* | 4.*)
24148b6d6341Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
24158b6d6341Smrg	;;
24168b6d6341Smrg    esac
24178b6d6341Smrgelse
24188b6d6341Smrg    if test "x$SUNCC" = "xyes"; then
24198b6d6341Smrg	CWARNFLAGS="-v"
24208b6d6341Smrg    fi
24218b6d6341Smrgfi
24228b6d6341SmrgAC_SUBST(CWARNFLAGS)
24238b6d6341Smrg]) # XORG_CWARNFLAGS
24241abf7346Smrg
24258b6d6341Smrg# XORG_STRICT_OPTION
24268b6d6341Smrg# -----------------------
24278b6d6341Smrg# Minimum version: 1.3.0
24288b6d6341Smrg#
24291633cc4bSmrg# Add configure option to enable strict compilation flags, such as treating
24301633cc4bSmrg# warnings as fatal errors.
24311633cc4bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
24321633cc4bSmrg# $CWARNFLAGS.
24331633cc4bSmrg#
24341633cc4bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
24351633cc4bSmrg# when strict compilation is unconditionally desired.
24368b6d6341SmrgAC_DEFUN([XORG_STRICT_OPTION], [
243723a8d56dSmrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
24388b6d6341SmrgAC_REQUIRE([AC_PROG_CC_C99])
24391633cc4bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
24408b6d6341SmrgAC_REQUIRE([XORG_CWARNFLAGS])
24418b6d6341Smrg
24428b6d6341SmrgAC_ARG_ENABLE(strict-compilation,
24438b6d6341Smrg			  AS_HELP_STRING([--enable-strict-compilation],
24448b6d6341Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
24458b6d6341Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
24461633cc4bSmrgif test "x$GCC" = xyes ; then
24471633cc4bSmrg    STRICT_CFLAGS="-pedantic -Werror"
24481633cc4bSmrg    # Add -Werror=attributes if supported (gcc 4.2 & later)
24491633cc4bSmrg    AC_MSG_CHECKING([if $CC supports -Werror=attributes])
24501633cc4bSmrg    save_CFLAGS="$CFLAGS"
24511633cc4bSmrg    CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes"
24521633cc4bSmrg    AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
24531633cc4bSmrg		      [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes"
24541633cc4bSmrg		       AC_MSG_RESULT([yes])],
24551633cc4bSmrg		      [AC_MSG_RESULT([no])])
24561633cc4bSmrg    CFLAGS="$save_CFLAGS"
24571633cc4bSmrgelif test "x$SUNCC" = "xyes"; then
24581633cc4bSmrg    STRICT_CFLAGS="-errwarn"
24591633cc4bSmrgelif test "x$INTELCC" = "xyes"; then
24601633cc4bSmrg    STRICT_CFLAGS="-Werror"
24611633cc4bSmrgfi
24628b6d6341Smrgif test "x$STRICT_COMPILE" = "xyes"; then
24631633cc4bSmrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
24648b6d6341Smrgfi
24651633cc4bSmrgAC_SUBST([STRICT_CFLAGS])
24668b6d6341SmrgAC_SUBST([CWARNFLAGS])
24678b6d6341Smrg]) # XORG_STRICT_OPTION
24681abf7346Smrg
24698b6d6341Smrg# XORG_DEFAULT_OPTIONS
24708b6d6341Smrg# --------------------
24718b6d6341Smrg# Minimum version: 1.3.0
24721abf7346Smrg#
24738b6d6341Smrg# Defines default options for X.Org modules.
24748b6d6341Smrg#
24758b6d6341SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
247623a8d56dSmrgAC_REQUIRE([AC_PROG_INSTALL])
24778b6d6341SmrgXORG_CWARNFLAGS
24788b6d6341SmrgXORG_STRICT_OPTION
24798b6d6341SmrgXORG_RELEASE_VERSION
24808b6d6341SmrgXORG_CHANGELOG
248123a8d56dSmrgXORG_INSTALL
24828b6d6341SmrgXORG_MANPAGE_SECTIONS
248323a8d56dSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
248423a8d56dSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
24858b6d6341Smrg]) # XORG_DEFAULT_OPTIONS
248623a8d56dSmrg
248723a8d56dSmrg# XORG_INSTALL()
248823a8d56dSmrg# ----------------
248923a8d56dSmrg# Minimum version: 1.4.0
249023a8d56dSmrg#
249123a8d56dSmrg# Defines the variable INSTALL_CMD as the command to copy
249223a8d56dSmrg# INSTALL from $prefix/share/util-macros.
249323a8d56dSmrg#
249423a8d56dSmrgAC_DEFUN([XORG_INSTALL], [
249523a8d56dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
249623a8d56dSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
249723a8d56dSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
249823a8d56dSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
249923a8d56dSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
250023a8d56dSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
250123a8d56dSmrgAC_SUBST([INSTALL_CMD])
250223a8d56dSmrg]) # XORG_INSTALL
25038b6d6341Smrgdnl Copyright 2005 Red Hat, Inc
25048b6d6341Smrgdnl
25058b6d6341Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
25068b6d6341Smrgdnl documentation for any purpose is hereby granted without fee, provided that
25078b6d6341Smrgdnl the above copyright notice appear in all copies and that both that
25088b6d6341Smrgdnl copyright notice and this permission notice appear in supporting
25098b6d6341Smrgdnl documentation.
25108b6d6341Smrgdnl
25118b6d6341Smrgdnl The above copyright notice and this permission notice shall be included
25128b6d6341Smrgdnl in all copies or substantial portions of the Software.
25138b6d6341Smrgdnl
25148b6d6341Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25158b6d6341Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25168b6d6341Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25178b6d6341Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
25188b6d6341Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25198b6d6341Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25208b6d6341Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
25218b6d6341Smrgdnl
25228b6d6341Smrgdnl Except as contained in this notice, the name of the copyright holders shall
25238b6d6341Smrgdnl not be used in advertising or otherwise to promote the sale, use or
25248b6d6341Smrgdnl other dealings in this Software without prior written authorization
25258b6d6341Smrgdnl from the copyright holders.
25268b6d6341Smrgdnl
25271abf7346Smrg
25288b6d6341Smrg# XORG_RELEASE_VERSION
25298b6d6341Smrg# --------------------
253023a8d56dSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
25318b6d6341Smrg 
25328b6d6341SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
25338b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
25348b6d6341Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
25358b6d6341Smrg		[Major version of this package])
25368b6d6341Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
25378b6d6341Smrg	if test "x$PVM" = "x"; then
25388b6d6341Smrg		PVM="0"
25398b6d6341Smrg	fi
25408b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
25418b6d6341Smrg		[$PVM],
25428b6d6341Smrg		[Minor version of this package])
25438b6d6341Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
25448b6d6341Smrg	if test "x$PVP" = "x"; then
25458b6d6341Smrg		PVP="0"
25468b6d6341Smrg	fi
25478b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
25488b6d6341Smrg		[$PVP],
25498b6d6341Smrg		[Patch version of this package])
25508b6d6341Smrg])
25511abf7346Smrg
25528b6d6341Smrg# XORG_CHANGELOG()
25538b6d6341Smrg# ----------------
25548b6d6341Smrg# Minimum version: 1.2.0
25558b6d6341Smrg#
25568b6d6341Smrg# Defines the variable CHANGELOG_CMD as the command to generate
25578b6d6341Smrg# ChangeLog from git.
25588b6d6341Smrg#
25598b6d6341Smrg#
25608b6d6341SmrgAC_DEFUN([XORG_CHANGELOG], [
256123a8d56dSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
256223a8d56dSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
256323a8d56dSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
25648b6d6341Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
25658b6d6341SmrgAC_SUBST([CHANGELOG_CMD])
25668b6d6341Smrg]) # XORG_CHANGELOG
25671abf7346Smrg
25688b6d6341Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
25698b6d6341Smrg# 
25708b6d6341Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
25718b6d6341Smrg#
25728b6d6341Smrg# This program is free software; you can redistribute it and/or modify
25738b6d6341Smrg# it under the terms of the GNU General Public License as published by
25748b6d6341Smrg# the Free Software Foundation; either version 2 of the License, or
25758b6d6341Smrg# (at your option) any later version.
25768b6d6341Smrg#
25778b6d6341Smrg# This program is distributed in the hope that it will be useful, but
25788b6d6341Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
25798b6d6341Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25808b6d6341Smrg# General Public License for more details.
25818b6d6341Smrg#
25828b6d6341Smrg# You should have received a copy of the GNU General Public License
25838b6d6341Smrg# along with this program; if not, write to the Free Software
25848b6d6341Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25858b6d6341Smrg#
25868b6d6341Smrg# As a special exception to the GNU General Public License, if you
25878b6d6341Smrg# distribute this file as part of a program that contains a
25888b6d6341Smrg# configuration script generated by Autoconf, you may include it under
25898b6d6341Smrg# the same distribution terms that you use for the rest of that program.
25901abf7346Smrg
25918b6d6341Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
25921abf7346Smrg# ----------------------------------
25938b6d6341SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
25948b6d6341Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
25958b6d6341Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
25968b6d6341SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
25978b6d6341Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
25988b6d6341Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
25998b6d6341Smrgfi
26008b6d6341Smrgif test -n "$PKG_CONFIG"; then
26018b6d6341Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
26028b6d6341Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
26038b6d6341Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
26048b6d6341Smrg		AC_MSG_RESULT([yes])
26058b6d6341Smrg	else
26068b6d6341Smrg		AC_MSG_RESULT([no])
26078b6d6341Smrg		PKG_CONFIG=""
26088b6d6341Smrg	fi
26098b6d6341Smrg		
26108b6d6341Smrgfi[]dnl
26118b6d6341Smrg])# PKG_PROG_PKG_CONFIG
26121abf7346Smrg
26138b6d6341Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
26141abf7346Smrg#
26158b6d6341Smrg# Check to see whether a particular set of modules exists.  Similar
26168b6d6341Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
26178b6d6341Smrg#
26188b6d6341Smrg#
26198b6d6341Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
26208b6d6341Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
26218b6d6341Smrg# PKG_CHECK_EXISTS manually
26228b6d6341Smrg# --------------------------------------------------------------
26238b6d6341SmrgAC_DEFUN([PKG_CHECK_EXISTS],
26248b6d6341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
26258b6d6341Smrgif test -n "$PKG_CONFIG" && \
26268b6d6341Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
26278b6d6341Smrg  m4_ifval([$2], [$2], [:])
26288b6d6341Smrgm4_ifvaln([$3], [else
26298b6d6341Smrg  $3])dnl
26308b6d6341Smrgfi])
26311abf7346Smrg
26321abf7346Smrg
26338b6d6341Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
26348b6d6341Smrg# ---------------------------------------------
26358b6d6341Smrgm4_define([_PKG_CONFIG],
26368b6d6341Smrg[if test -n "$$1"; then
26378b6d6341Smrg    pkg_cv_[]$1="$$1"
26388b6d6341Smrg elif test -n "$PKG_CONFIG"; then
26398b6d6341Smrg    PKG_CHECK_EXISTS([$3],
26408b6d6341Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
26418b6d6341Smrg		     [pkg_failed=yes])
26428b6d6341Smrg else
26438b6d6341Smrg    pkg_failed=untried
26448b6d6341Smrgfi[]dnl
26458b6d6341Smrg])# _PKG_CONFIG
26461abf7346Smrg
26478b6d6341Smrg# _PKG_SHORT_ERRORS_SUPPORTED
26488b6d6341Smrg# -----------------------------
26498b6d6341SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
26508b6d6341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
26518b6d6341Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
26528b6d6341Smrg        _pkg_short_errors_supported=yes
26531abf7346Smrgelse
26548b6d6341Smrg        _pkg_short_errors_supported=no
26558b6d6341Smrgfi[]dnl
26568b6d6341Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
26571abf7346Smrg
26588b6d6341Smrg
26598b6d6341Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
26608b6d6341Smrg# [ACTION-IF-NOT-FOUND])
26611abf7346Smrg#
26628b6d6341Smrg#
26638b6d6341Smrg# Note that if there is a possibility the first call to
26648b6d6341Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
26658b6d6341Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
26668b6d6341Smrg#
26678b6d6341Smrg#
26688b6d6341Smrg# --------------------------------------------------------------
26698b6d6341SmrgAC_DEFUN([PKG_CHECK_MODULES],
26708b6d6341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
26718b6d6341SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
26728b6d6341SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
26731abf7346Smrg
26748b6d6341Smrgpkg_failed=no
26758b6d6341SmrgAC_MSG_CHECKING([for $1])
26761abf7346Smrg
26778b6d6341Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
26788b6d6341Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
26791abf7346Smrg
26808b6d6341Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
26818b6d6341Smrgand $1[]_LIBS to avoid the need to call pkg-config.
26828b6d6341SmrgSee the pkg-config man page for more details.])
26831abf7346Smrg
26848b6d6341Smrgif test $pkg_failed = yes; then
26858b6d6341Smrg        _PKG_SHORT_ERRORS_SUPPORTED
26868b6d6341Smrg        if test $_pkg_short_errors_supported = yes; then
26878b6d6341Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
26888b6d6341Smrg        else 
26898b6d6341Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
26908b6d6341Smrg        fi
26918b6d6341Smrg	# Put the nasty error message in config.log where it belongs
26928b6d6341Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
26931abf7346Smrg
26948b6d6341Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
26958b6d6341Smrg[Package requirements ($2) were not met:
26961abf7346Smrg
26978b6d6341Smrg$$1_PKG_ERRORS
26981abf7346Smrg
26998b6d6341SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
27008b6d6341Smrginstalled software in a non-standard prefix.
27011abf7346Smrg
27028b6d6341Smrg_PKG_TEXT
27038b6d6341Smrg])],
27048b6d6341Smrg		[AC_MSG_RESULT([no])
27058b6d6341Smrg                $4])
27068b6d6341Smrgelif test $pkg_failed = untried; then
27078b6d6341Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
27088b6d6341Smrg[The pkg-config script could not be found or is too old.  Make sure it
27098b6d6341Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
27108b6d6341Smrgpath to pkg-config.
27111abf7346Smrg
27128b6d6341Smrg_PKG_TEXT
27131abf7346Smrg
27148b6d6341SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
27158b6d6341Smrg		[$4])
27168b6d6341Smrgelse
27178b6d6341Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
27188b6d6341Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
27198b6d6341Smrg        AC_MSG_RESULT([yes])
27208b6d6341Smrg	ifelse([$3], , :, [$3])
27218b6d6341Smrgfi[]dnl
27228b6d6341Smrg])# PKG_CHECK_MODULES
27231abf7346Smrg
2724