aclocal.m4 revision 2f167a42
12f167a42Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
22f167a42Smrg
32f167a42Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
40e20ee16Smrg
50e20ee16Smrg# This file is free software; the Free Software Foundation
60e20ee16Smrg# gives unlimited permission to copy and/or distribute it,
70e20ee16Smrg# with or without modifications, as long as this notice is preserved.
80e20ee16Smrg
90e20ee16Smrg# This program is distributed in the hope that it will be useful,
100e20ee16Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
110e20ee16Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
120e20ee16Smrg# PARTICULAR PURPOSE.
130e20ee16Smrg
142f167a42Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
153e6697d4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
163e6697d4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
172f167a42Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
182f167a42Smrg[m4_warning([this file was generated for autoconf 2.69.
193e6697d4SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
203e6697d4SmrgIf you have problems, you may need to regenerate the build system entirely.
212f167a42SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
220e20ee16Smrg
232f167a42Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
243e6697d4Smrg#
253e6697d4Smrg# This file is free software; the Free Software Foundation
263e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
273e6697d4Smrg# with or without modifications, as long as this notice is preserved.
280e20ee16Smrg
290e20ee16Smrg# AM_AUTOMAKE_VERSION(VERSION)
300e20ee16Smrg# ----------------------------
310e20ee16Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
320e20ee16Smrg# generated from the m4 files accompanying Automake X.Y.
333e6697d4Smrg# (This private macro should not be called outside this file.)
343e6697d4SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
352f167a42Smrg[am__api_version='1.15'
363e6697d4Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
373e6697d4Smrgdnl require some minimum version.  Point them to the right macro.
382f167a42Smrgm4_if([$1], [1.15], [],
393e6697d4Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
403e6697d4Smrg])
413e6697d4Smrg
423e6697d4Smrg# _AM_AUTOCONF_VERSION(VERSION)
433e6697d4Smrg# -----------------------------
443e6697d4Smrg# aclocal traces this macro to find the Autoconf version.
453e6697d4Smrg# This is a private macro too.  Using m4_define simplifies
463e6697d4Smrg# the logic in aclocal, which can simply ignore this definition.
473e6697d4Smrgm4_define([_AM_AUTOCONF_VERSION], [])
480e20ee16Smrg
490e20ee16Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
500e20ee16Smrg# -------------------------------
513e6697d4Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
523e6697d4Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
530e20ee16SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
542f167a42Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
553e6697d4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
563e6697d4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
573e6697d4Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
580e20ee16Smrg
593e6697d4Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
600e20ee16Smrg
612f167a42Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
620e20ee16Smrg#
633e6697d4Smrg# This file is free software; the Free Software Foundation
643e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
653e6697d4Smrg# with or without modifications, as long as this notice is preserved.
660e20ee16Smrg
670e20ee16Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
682f167a42Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
692f167a42Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
700e20ee16Smrg#
710e20ee16Smrg# Of course, Automake must honor this variable whenever it calls a
720e20ee16Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
730e20ee16Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
740e20ee16Smrg# depending on how configure is run.  This is pretty annoying, since
750e20ee16Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
760e20ee16Smrg# source directory, any form will work fine, but in subdirectories a
770e20ee16Smrg# relative path needs to be adjusted first.
780e20ee16Smrg#
790e20ee16Smrg# $ac_aux_dir/missing
800e20ee16Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
810e20ee16Smrg# $top_srcdir/$ac_aux_dir/missing
820e20ee16Smrg#    fails if $ac_aux_dir is absolute,
830e20ee16Smrg#    fails when called from a subdirectory in a VPATH build with
840e20ee16Smrg#          a relative $ac_aux_dir
850e20ee16Smrg#
860e20ee16Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
870e20ee16Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
882f167a42Smrg# harmless because $srcdir is '.', but things will broke when you
890e20ee16Smrg# start a VPATH build or use an absolute $srcdir.
900e20ee16Smrg#
910e20ee16Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
920e20ee16Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
930e20ee16Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
940e20ee16Smrg# and then we would define $MISSING as
950e20ee16Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
960e20ee16Smrg# This will work as long as MISSING is not called from configure, because
970e20ee16Smrg# unfortunately $(top_srcdir) has no meaning in configure.
980e20ee16Smrg# However there are other variables, like CC, which are often used in
990e20ee16Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1000e20ee16Smrg#
1010e20ee16Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1020e20ee16Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1030e20ee16Smrg# configured tree to be moved without reconfiguration.
1040e20ee16Smrg
1053e6697d4SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1062f167a42Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1072f167a42Smrg# Expand $ac_aux_dir to an absolute path.
1082f167a42Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1090e20ee16Smrg])
1100e20ee16Smrg
1113e6697d4Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1120e20ee16Smrg
1132f167a42Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
1143e6697d4Smrg#
1153e6697d4Smrg# This file is free software; the Free Software Foundation
1163e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
1173e6697d4Smrg# with or without modifications, as long as this notice is preserved.
1180e20ee16Smrg
1193e6697d4Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1203e6697d4Smrg# -------------------------------------
1213e6697d4Smrg# Define a conditional.
1223e6697d4SmrgAC_DEFUN([AM_CONDITIONAL],
1232f167a42Smrg[AC_PREREQ([2.52])dnl
1242f167a42Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1252f167a42Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1263e6697d4SmrgAC_SUBST([$1_TRUE])dnl
1273e6697d4SmrgAC_SUBST([$1_FALSE])dnl
1283e6697d4Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1293e6697d4Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1303e6697d4Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1313e6697d4Smrgif $2; then
1323e6697d4Smrg  $1_TRUE=
1333e6697d4Smrg  $1_FALSE='#'
1340e20ee16Smrgelse
1353e6697d4Smrg  $1_TRUE='#'
1363e6697d4Smrg  $1_FALSE=
1370e20ee16Smrgfi
1383e6697d4SmrgAC_CONFIG_COMMANDS_PRE(
1393e6697d4Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1403e6697d4Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1413e6697d4SmrgUsually this means the macro was only invoked conditionally.]])
1423e6697d4Smrgfi])])
1430e20ee16Smrg
1442f167a42Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
1453e6697d4Smrg#
1463e6697d4Smrg# This file is free software; the Free Software Foundation
1473e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
1483e6697d4Smrg# with or without modifications, as long as this notice is preserved.
1490e20ee16Smrg
1500e20ee16Smrg
1512f167a42Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1520e20ee16Smrg# written in clear, in which case automake, when reading aclocal.m4,
1530e20ee16Smrg# will think it sees a *use*, and therefore will trigger all it's
1540e20ee16Smrg# C support machinery.  Also note that it means that autoscan, seeing
1550e20ee16Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1560e20ee16Smrg
1570e20ee16Smrg
1580e20ee16Smrg# _AM_DEPENDENCIES(NAME)
1590e20ee16Smrg# ----------------------
1600e20ee16Smrg# See how the compiler implements dependency checking.
1612f167a42Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1620e20ee16Smrg# We try a few techniques and use that to set a single cache variable.
1630e20ee16Smrg#
1640e20ee16Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1650e20ee16Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1660e20ee16Smrg# dependency, and given that the user is not expected to run this macro,
1670e20ee16Smrg# just rely on AC_PROG_CC.
1680e20ee16SmrgAC_DEFUN([_AM_DEPENDENCIES],
1690e20ee16Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1700e20ee16SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1710e20ee16SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1720e20ee16SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1730e20ee16Smrg
1742f167a42Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1752f167a42Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1762f167a42Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1772f167a42Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1782f167a42Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1792f167a42Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1802f167a42Smrg                    [depcc="$$1"   am_compiler_list=])
1810e20ee16Smrg
1820e20ee16SmrgAC_CACHE_CHECK([dependency style of $depcc],
1830e20ee16Smrg               [am_cv_$1_dependencies_compiler_type],
1840e20ee16Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1850e20ee16Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1860e20ee16Smrg  # making bogus files that we don't know about and never remove.  For
1870e20ee16Smrg  # instance it was reported that on HP-UX the gcc test will end up
1882f167a42Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1892f167a42Smrg  # in D".
1902f167a42Smrg  rm -rf conftest.dir
1910e20ee16Smrg  mkdir conftest.dir
1920e20ee16Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1930e20ee16Smrg  # using a relative directory.
1940e20ee16Smrg  cp "$am_depcomp" conftest.dir
1950e20ee16Smrg  cd conftest.dir
1960e20ee16Smrg  # We will build objects and dependencies in a subdirectory because
1970e20ee16Smrg  # it helps to detect inapplicable dependency modes.  For instance
1980e20ee16Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1990e20ee16Smrg  # side effect of compilation, but ICC will put the dependencies in
2000e20ee16Smrg  # the current directory while Tru64 will put them in the object
2010e20ee16Smrg  # directory.
2020e20ee16Smrg  mkdir sub
2030e20ee16Smrg
2040e20ee16Smrg  am_cv_$1_dependencies_compiler_type=none
2050e20ee16Smrg  if test "$am_compiler_list" = ""; then
2060e20ee16Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2070e20ee16Smrg  fi
2083e6697d4Smrg  am__universal=false
2093e6697d4Smrg  m4_case([$1], [CC],
2103e6697d4Smrg    [case " $depcc " in #(
2113e6697d4Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2123e6697d4Smrg     esac],
2133e6697d4Smrg    [CXX],
2143e6697d4Smrg    [case " $depcc " in #(
2153e6697d4Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2163e6697d4Smrg     esac])
2173e6697d4Smrg
2180e20ee16Smrg  for depmode in $am_compiler_list; do
2190e20ee16Smrg    # Setup a source with many dependencies, because some compilers
2200e20ee16Smrg    # like to wrap large dependency lists on column 80 (with \), and
2210e20ee16Smrg    # we should not choose a depcomp mode which is confused by this.
2220e20ee16Smrg    #
2230e20ee16Smrg    # We need to recreate these files for each test, as the compiler may
2240e20ee16Smrg    # overwrite some of them when testing with obscure command lines.
2250e20ee16Smrg    # This happens at least with the AIX C compiler.
2260e20ee16Smrg    : > sub/conftest.c
2270e20ee16Smrg    for i in 1 2 3 4 5 6; do
2280e20ee16Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2292f167a42Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2302f167a42Smrg      # Solaris 10 /bin/sh.
2312f167a42Smrg      echo '/* dummy */' > sub/conftst$i.h
2320e20ee16Smrg    done
2330e20ee16Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2340e20ee16Smrg
2352f167a42Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2363e6697d4Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2372f167a42Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2382f167a42Smrg    # versions had trouble with output in subdirs.
2393e6697d4Smrg    am__obj=sub/conftest.${OBJEXT-o}
2403e6697d4Smrg    am__minus_obj="-o $am__obj"
2410e20ee16Smrg    case $depmode in
2423e6697d4Smrg    gcc)
2433e6697d4Smrg      # This depmode causes a compiler race in universal mode.
2443e6697d4Smrg      test "$am__universal" = false || continue
2453e6697d4Smrg      ;;
2460e20ee16Smrg    nosideeffect)
2472f167a42Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2482f167a42Smrg      # only be used when explicitly requested.
2490e20ee16Smrg      if test "x$enable_dependency_tracking" = xyes; then
2500e20ee16Smrg	continue
2510e20ee16Smrg      else
2520e20ee16Smrg	break
2530e20ee16Smrg      fi
2540e20ee16Smrg      ;;
2552f167a42Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2562f167a42Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2573e6697d4Smrg      # not run yet.  These depmodes are late enough in the game, and
2583e6697d4Smrg      # so weak that their functioning should not be impacted.
2593e6697d4Smrg      am__obj=conftest.${OBJEXT-o}
2603e6697d4Smrg      am__minus_obj=
2613e6697d4Smrg      ;;
2620e20ee16Smrg    none) break ;;
2630e20ee16Smrg    esac
2640e20ee16Smrg    if depmode=$depmode \
2653e6697d4Smrg       source=sub/conftest.c object=$am__obj \
2660e20ee16Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2673e6697d4Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2680e20ee16Smrg         >/dev/null 2>conftest.err &&
2693e6697d4Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2700e20ee16Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2713e6697d4Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2720e20ee16Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2730e20ee16Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2743e6697d4Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2753e6697d4Smrg      # that says an option was ignored or not supported.
2763e6697d4Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2773e6697d4Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2783e6697d4Smrg      # The diagnosis changed in icc 8.0:
2793e6697d4Smrg      #   icc: Command line remark: option '-MP' not supported
2803e6697d4Smrg      if (grep 'ignoring option' conftest.err ||
2813e6697d4Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2820e20ee16Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2830e20ee16Smrg        break
2840e20ee16Smrg      fi
2850e20ee16Smrg    fi
2860e20ee16Smrg  done
2870e20ee16Smrg
2880e20ee16Smrg  cd ..
2890e20ee16Smrg  rm -rf conftest.dir
2900e20ee16Smrgelse
2910e20ee16Smrg  am_cv_$1_dependencies_compiler_type=none
2920e20ee16Smrgfi
2930e20ee16Smrg])
2940e20ee16SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2950e20ee16SmrgAM_CONDITIONAL([am__fastdep$1], [
2960e20ee16Smrg  test "x$enable_dependency_tracking" != xno \
2970e20ee16Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2980e20ee16Smrg])
2990e20ee16Smrg
3000e20ee16Smrg
3010e20ee16Smrg# AM_SET_DEPDIR
3020e20ee16Smrg# -------------
3030e20ee16Smrg# Choose a directory name for dependency files.
3042f167a42Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3050e20ee16SmrgAC_DEFUN([AM_SET_DEPDIR],
3060e20ee16Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3070e20ee16SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3080e20ee16Smrg])
3090e20ee16Smrg
3100e20ee16Smrg
3110e20ee16Smrg# AM_DEP_TRACK
3120e20ee16Smrg# ------------
3130e20ee16SmrgAC_DEFUN([AM_DEP_TRACK],
3142f167a42Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3152f167a42SmrgAS_HELP_STRING(
3162f167a42Smrg  [--enable-dependency-tracking],
3172f167a42Smrg  [do not reject slow dependency extractors])
3182f167a42SmrgAS_HELP_STRING(
3192f167a42Smrg  [--disable-dependency-tracking],
3202f167a42Smrg  [speeds up one-time build])])
3210e20ee16Smrgif test "x$enable_dependency_tracking" != xno; then
3220e20ee16Smrg  am_depcomp="$ac_aux_dir/depcomp"
3230e20ee16Smrg  AMDEPBACKSLASH='\'
3242f167a42Smrg  am__nodep='_no'
3250e20ee16Smrgfi
3260e20ee16SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3273e6697d4SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3283e6697d4Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3292f167a42SmrgAC_SUBST([am__nodep])dnl
3302f167a42Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3310e20ee16Smrg])
3320e20ee16Smrg
3333e6697d4Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3340e20ee16Smrg
3352f167a42Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
3363e6697d4Smrg#
3373e6697d4Smrg# This file is free software; the Free Software Foundation
3383e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
3393e6697d4Smrg# with or without modifications, as long as this notice is preserved.
3400e20ee16Smrg
3410e20ee16Smrg
3420e20ee16Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3430e20ee16Smrg# ------------------------------
3440e20ee16SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3453e6697d4Smrg[{
3462f167a42Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3473e6697d4Smrg  # are listed without --file.  Let's play safe and only enable the eval
3483e6697d4Smrg  # if we detect the quoting.
3493e6697d4Smrg  case $CONFIG_FILES in
3503e6697d4Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3513e6697d4Smrg  *)   set x $CONFIG_FILES ;;
3523e6697d4Smrg  esac
3533e6697d4Smrg  shift
3543e6697d4Smrg  for mf
3553e6697d4Smrg  do
3563e6697d4Smrg    # Strip MF so we end up with the name of the file.
3573e6697d4Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3583e6697d4Smrg    # Check whether this is an Automake generated Makefile or not.
3592f167a42Smrg    # We used to match only the files named 'Makefile.in', but
3603e6697d4Smrg    # some people rename them; so instead we look at the file content.
3613e6697d4Smrg    # Grep'ing the first line is not enough: some people post-process
3623e6697d4Smrg    # each Makefile.in and add a new line on top of each file to say so.
3633e6697d4Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3643e6697d4Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3653e6697d4Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3663e6697d4Smrg      dirpart=`AS_DIRNAME("$mf")`
3673e6697d4Smrg    else
3683e6697d4Smrg      continue
3693e6697d4Smrg    fi
3703e6697d4Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3712f167a42Smrg    # from the Makefile without running 'make'.
3723e6697d4Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3733e6697d4Smrg    test -z "$DEPDIR" && continue
3743e6697d4Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3752f167a42Smrg    test -z "$am__include" && continue
3763e6697d4Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3773e6697d4Smrg    # Find all dependency output files, they are included files with
3783e6697d4Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3793e6697d4Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3803e6697d4Smrg    # expansion.
3813e6697d4Smrg    for file in `sed -n "
3823e6697d4Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3832f167a42Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3843e6697d4Smrg      # Make sure the directory exists.
3853e6697d4Smrg      test -f "$dirpart/$file" && continue
3863e6697d4Smrg      fdir=`AS_DIRNAME(["$file"])`
3873e6697d4Smrg      AS_MKDIR_P([$dirpart/$fdir])
3883e6697d4Smrg      # echo "creating $dirpart/$file"
3893e6697d4Smrg      echo '# dummy' > "$dirpart/$file"
3903e6697d4Smrg    done
3910e20ee16Smrg  done
3923e6697d4Smrg}
3930e20ee16Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3940e20ee16Smrg
3950e20ee16Smrg
3960e20ee16Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3970e20ee16Smrg# -----------------------------
3980e20ee16Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3990e20ee16Smrg#
4000e20ee16Smrg# This code is only required when automatic dependency tracking
4012f167a42Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4020e20ee16Smrg# need in order to bootstrap the dependency handling code.
4030e20ee16SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4040e20ee16Smrg[AC_CONFIG_COMMANDS([depfiles],
4050e20ee16Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4060e20ee16Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4070e20ee16Smrg])
4080e20ee16Smrg
4093e6697d4Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4100e20ee16Smrg
4112f167a42Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4123e6697d4Smrg#
4133e6697d4Smrg# This file is free software; the Free Software Foundation
4143e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
4153e6697d4Smrg# with or without modifications, as long as this notice is preserved.
4160e20ee16Smrg
4173e6697d4Smrg# This macro actually does too much.  Some checks are only needed if
4183e6697d4Smrg# your package does certain things.  But this isn't really a big deal.
4193e6697d4Smrg
4202f167a42Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4212f167a42Smrgm4_define([AC_PROG_CC],
4222f167a42Smrgm4_defn([AC_PROG_CC])
4232f167a42Smrg[_AM_PROG_CC_C_O
4242f167a42Smrg])
4252f167a42Smrg
4263e6697d4Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4273e6697d4Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4283e6697d4Smrg# -----------------------------------------------
4293e6697d4Smrg# The call with PACKAGE and VERSION arguments is the old style
4303e6697d4Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4313e6697d4Smrg# and VERSION should now be passed to AC_INIT and removed from
4323e6697d4Smrg# the call to AM_INIT_AUTOMAKE.
4333e6697d4Smrg# We support both call styles for the transition.  After
4343e6697d4Smrg# the next Automake release, Autoconf can make the AC_INIT
4353e6697d4Smrg# arguments mandatory, and then we can depend on a new Autoconf
4363e6697d4Smrg# release and drop the old call support.
4373e6697d4SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4382f167a42Smrg[AC_PREREQ([2.65])dnl
4393e6697d4Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4403e6697d4Smrgdnl the ones we care about.
4413e6697d4Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4423e6697d4SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4433e6697d4SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4443e6697d4Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4453e6697d4Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4463e6697d4Smrg  # is not polluted with repeated "-I."
4473e6697d4Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4483e6697d4Smrg  # test to see if srcdir already configured
4493e6697d4Smrg  if test -f $srcdir/config.status; then
4503e6697d4Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4513e6697d4Smrg  fi
4520e20ee16Smrgfi
4533e6697d4Smrg
4543e6697d4Smrg# test whether we have cygpath
4553e6697d4Smrgif test -z "$CYGPATH_W"; then
4563e6697d4Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4573e6697d4Smrg    CYGPATH_W='cygpath -w'
4583e6697d4Smrg  else
4593e6697d4Smrg    CYGPATH_W=echo
4603e6697d4Smrg  fi
4610e20ee16Smrgfi
4623e6697d4SmrgAC_SUBST([CYGPATH_W])
4630e20ee16Smrg
4643e6697d4Smrg# Define the identity of the package.
4653e6697d4Smrgdnl Distinguish between old-style and new-style calls.
4663e6697d4Smrgm4_ifval([$2],
4672f167a42Smrg[AC_DIAGNOSE([obsolete],
4682f167a42Smrg             [$0: two- and three-arguments forms are deprecated.])
4692f167a42Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4703e6697d4Smrg AC_SUBST([PACKAGE], [$1])dnl
4713e6697d4Smrg AC_SUBST([VERSION], [$2])],
4723e6697d4Smrg[_AM_SET_OPTIONS([$1])dnl
4733e6697d4Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4742f167a42Smrgm4_if(
4752f167a42Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4762f167a42Smrg  [ok:ok],,
4773e6697d4Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4783e6697d4Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4793e6697d4Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4800e20ee16Smrg
4813e6697d4Smrg_AM_IF_OPTION([no-define],,
4822f167a42Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4832f167a42Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4840e20ee16Smrg
4853e6697d4Smrg# Some tools Automake needs.
4863e6697d4SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4873e6697d4SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4882f167a42SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4892f167a42SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4902f167a42SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4912f167a42SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4922f167a42SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4933e6697d4SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4943e6697d4SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4952f167a42SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4962f167a42Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4972f167a42Smrg# dies out for good.  For more background, see:
4982f167a42Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4992f167a42Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5002f167a42SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5012f167a42Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
5022f167a42Smrg# system "awk" is bad on some platforms.
5033e6697d4SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5043e6697d4SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5053e6697d4SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5063e6697d4Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5073e6697d4Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5083e6697d4Smrg			     [_AM_PROG_TAR([v7])])])
5093e6697d4Smrg_AM_IF_OPTION([no-dependencies],,
5103e6697d4Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5112f167a42Smrg		  [_AM_DEPENDENCIES([CC])],
5122f167a42Smrg		  [m4_define([AC_PROG_CC],
5132f167a42Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5143e6697d4SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5152f167a42Smrg		  [_AM_DEPENDENCIES([CXX])],
5162f167a42Smrg		  [m4_define([AC_PROG_CXX],
5172f167a42Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5183e6697d4SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5192f167a42Smrg		  [_AM_DEPENDENCIES([OBJC])],
5202f167a42Smrg		  [m4_define([AC_PROG_OBJC],
5212f167a42Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5222f167a42SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5232f167a42Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5242f167a42Smrg		  [m4_define([AC_PROG_OBJCXX],
5252f167a42Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5263e6697d4Smrg])
5272f167a42SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5282f167a42Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5292f167a42Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5302f167a42Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5313e6697d4SmrgAC_CONFIG_COMMANDS_PRE(dnl
5323e6697d4Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5333e6697d4Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5342f167a42Smrg
5352f167a42Smrg# POSIX will say in a future version that running "rm -f" with no argument
5362f167a42Smrg# is OK; and we want to be able to make that assumption in our Makefile
5372f167a42Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5382f167a42Smrg# actually supported "in the wild" to an acceptable degree.
5392f167a42Smrg# See automake bug#10828.
5402f167a42Smrg# To make any issue more visible, cause the running configure to be aborted
5412f167a42Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5422f167a42Smrg# user can still override this though.
5432f167a42Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5442f167a42Smrg  cat >&2 <<'END'
5452f167a42SmrgOops!
5462f167a42Smrg
5472f167a42SmrgYour 'rm' program seems unable to run without file operands specified
5482f167a42Smrgon the command line, even when the '-f' option is present.  This is contrary
5492f167a42Smrgto the behaviour of most rm programs out there, and not conforming with
5502f167a42Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5512f167a42Smrg
5522f167a42SmrgPlease tell bug-automake@gnu.org about your system, including the value
5532f167a42Smrgof your $PATH and any error possibly output before this message.  This
5542f167a42Smrgcan help us improve future automake versions.
5552f167a42Smrg
5562f167a42SmrgEND
5572f167a42Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5582f167a42Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5592f167a42Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5602f167a42Smrg    echo >&2
5612f167a42Smrg  else
5622f167a42Smrg    cat >&2 <<'END'
5632f167a42SmrgAborting the configuration process, to ensure you take notice of the issue.
5642f167a42Smrg
5652f167a42SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5662f167a42Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5672f167a42Smrg
5682f167a42SmrgIf you want to complete the configuration process using your problematic
5692f167a42Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5702f167a42Smrgto "yes", and re-run configure.
5712f167a42Smrg
5722f167a42SmrgEND
5732f167a42Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5742f167a42Smrg  fi
5752f167a42Smrgfi
5762f167a42Smrgdnl The trailing newline in this macro's definition is deliberate, for
5772f167a42Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5782f167a42Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5793e6697d4Smrg])
5800e20ee16Smrg
5812f167a42Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5823e6697d4Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5833e6697d4Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5843e6697d4Smrgm4_define([_AC_COMPILER_EXEEXT],
5853e6697d4Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5860e20ee16Smrg
5873e6697d4Smrg# When config.status generates a header, we must update the stamp-h file.
5883e6697d4Smrg# This file resides in the same directory as the config header
5893e6697d4Smrg# that is generated.  The stamp files are numbered to have different names.
5903e6697d4Smrg
5913e6697d4Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5923e6697d4Smrg# loop where config.status creates the headers, so we can generate
5933e6697d4Smrg# our stamp files there.
5943e6697d4SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5953e6697d4Smrg[# Compute $1's index in $config_headers.
5963e6697d4Smrg_am_arg=$1
5973e6697d4Smrg_am_stamp_count=1
5983e6697d4Smrgfor _am_header in $config_headers :; do
5993e6697d4Smrg  case $_am_header in
6003e6697d4Smrg    $_am_arg | $_am_arg:* )
6013e6697d4Smrg      break ;;
6023e6697d4Smrg    * )
6033e6697d4Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6043e6697d4Smrg  esac
6053e6697d4Smrgdone
6063e6697d4Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6070e20ee16Smrg
6082f167a42Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6093e6697d4Smrg#
6103e6697d4Smrg# This file is free software; the Free Software Foundation
6113e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
6123e6697d4Smrg# with or without modifications, as long as this notice is preserved.
6130e20ee16Smrg
6143e6697d4Smrg# AM_PROG_INSTALL_SH
6153e6697d4Smrg# ------------------
6163e6697d4Smrg# Define $install_sh.
6173e6697d4SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6183e6697d4Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6192f167a42Smrgif test x"${install_sh+set}" != xset; then
6203e6697d4Smrg  case $am_aux_dir in
6213e6697d4Smrg  *\ * | *\	*)
6223e6697d4Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6233e6697d4Smrg  *)
6243e6697d4Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6253e6697d4Smrg  esac
6260e20ee16Smrgfi
6272f167a42SmrgAC_SUBST([install_sh])])
6280e20ee16Smrg
6292f167a42Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
6303e6697d4Smrg#
6313e6697d4Smrg# This file is free software; the Free Software Foundation
6323e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
6333e6697d4Smrg# with or without modifications, as long as this notice is preserved.
6340e20ee16Smrg
6353e6697d4Smrg# Check whether the underlying file-system supports filenames
6363e6697d4Smrg# with a leading dot.  For instance MS-DOS doesn't.
6373e6697d4SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6383e6697d4Smrg[rm -rf .tst 2>/dev/null
6393e6697d4Smrgmkdir .tst 2>/dev/null
6403e6697d4Smrgif test -d .tst; then
6413e6697d4Smrg  am__leading_dot=.
6423e6697d4Smrgelse
6433e6697d4Smrg  am__leading_dot=_
6443e6697d4Smrgfi
6453e6697d4Smrgrmdir .tst 2>/dev/null
6463e6697d4SmrgAC_SUBST([am__leading_dot])])
6470e20ee16Smrg
6483e6697d4Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6490e20ee16Smrg
6502f167a42Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6513e6697d4Smrg#
6523e6697d4Smrg# This file is free software; the Free Software Foundation
6533e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
6543e6697d4Smrg# with or without modifications, as long as this notice is preserved.
6550e20ee16Smrg
6563e6697d4Smrg# AM_MAKE_INCLUDE()
6573e6697d4Smrg# -----------------
6583e6697d4Smrg# Check to see how make treats includes.
6593e6697d4SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6603e6697d4Smrg[am_make=${MAKE-make}
6613e6697d4Smrgcat > confinc << 'END'
6623e6697d4Smrgam__doit:
6633e6697d4Smrg	@echo this is the am__doit target
6643e6697d4Smrg.PHONY: am__doit
6653e6697d4SmrgEND
6663e6697d4Smrg# If we don't find an include directive, just comment out the code.
6673e6697d4SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6683e6697d4Smrgam__include="#"
6693e6697d4Smrgam__quote=
6703e6697d4Smrg_am_result=none
6713e6697d4Smrg# First try GNU make style include.
6723e6697d4Smrgecho "include confinc" > confmf
6732f167a42Smrg# Ignore all kinds of additional output from 'make'.
6743e6697d4Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6753e6697d4Smrg*the\ am__doit\ target*)
6763e6697d4Smrg  am__include=include
6773e6697d4Smrg  am__quote=
6783e6697d4Smrg  _am_result=GNU
6793e6697d4Smrg  ;;
6803e6697d4Smrgesac
6813e6697d4Smrg# Now try BSD make style include.
6823e6697d4Smrgif test "$am__include" = "#"; then
6833e6697d4Smrg   echo '.include "confinc"' > confmf
6843e6697d4Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6853e6697d4Smrg   *the\ am__doit\ target*)
6863e6697d4Smrg     am__include=.include
6873e6697d4Smrg     am__quote="\""
6883e6697d4Smrg     _am_result=BSD
6893e6697d4Smrg     ;;
6903e6697d4Smrg   esac
6913e6697d4Smrgfi
6923e6697d4SmrgAC_SUBST([am__include])
6933e6697d4SmrgAC_SUBST([am__quote])
6943e6697d4SmrgAC_MSG_RESULT([$_am_result])
6953e6697d4Smrgrm -f confinc confmf
6963e6697d4Smrg])
6970e20ee16Smrg
6983e6697d4Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6990e20ee16Smrg
7002f167a42Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
7013e6697d4Smrg#
7023e6697d4Smrg# This file is free software; the Free Software Foundation
7033e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
7043e6697d4Smrg# with or without modifications, as long as this notice is preserved.
7050e20ee16Smrg
7063e6697d4Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7073e6697d4Smrg# ------------------------------
7083e6697d4SmrgAC_DEFUN([AM_MISSING_PROG],
7093e6697d4Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7103e6697d4Smrg$1=${$1-"${am_missing_run}$2"}
7113e6697d4SmrgAC_SUBST($1)])
7120e20ee16Smrg
7133e6697d4Smrg# AM_MISSING_HAS_RUN
7143e6697d4Smrg# ------------------
7152f167a42Smrg# Define MISSING if not defined so far and test if it is modern enough.
7162f167a42Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7173e6697d4SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7183e6697d4Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7193e6697d4SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7203e6697d4Smrgif test x"${MISSING+set}" != xset; then
7213e6697d4Smrg  case $am_aux_dir in
7223e6697d4Smrg  *\ * | *\	*)
7233e6697d4Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7243e6697d4Smrg  *)
7253e6697d4Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7263e6697d4Smrg  esac
7270e20ee16Smrgfi
7283e6697d4Smrg# Use eval to expand $SHELL
7292f167a42Smrgif eval "$MISSING --is-lightweight"; then
7302f167a42Smrg  am_missing_run="$MISSING "
7313e6697d4Smrgelse
7323e6697d4Smrg  am_missing_run=
7332f167a42Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7343e6697d4Smrgfi
7353e6697d4Smrg])
7360e20ee16Smrg
7373e6697d4Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7383e6697d4Smrg
7392f167a42Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
7400e20ee16Smrg#
7413e6697d4Smrg# This file is free software; the Free Software Foundation
7423e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
7433e6697d4Smrg# with or without modifications, as long as this notice is preserved.
7440e20ee16Smrg
7453e6697d4Smrg# _AM_MANGLE_OPTION(NAME)
7463e6697d4Smrg# -----------------------
7473e6697d4SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7483e6697d4Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7490e20ee16Smrg
7503e6697d4Smrg# _AM_SET_OPTION(NAME)
7512f167a42Smrg# --------------------
7523e6697d4Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7533e6697d4SmrgAC_DEFUN([_AM_SET_OPTION],
7542f167a42Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7550e20ee16Smrg
7563e6697d4Smrg# _AM_SET_OPTIONS(OPTIONS)
7572f167a42Smrg# ------------------------
7583e6697d4Smrg# OPTIONS is a space-separated list of Automake options.
7593e6697d4SmrgAC_DEFUN([_AM_SET_OPTIONS],
7603e6697d4Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7610e20ee16Smrg
7623e6697d4Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7633e6697d4Smrg# -------------------------------------------
7643e6697d4Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7653e6697d4SmrgAC_DEFUN([_AM_IF_OPTION],
7663e6697d4Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7673e6697d4Smrg
7682f167a42Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
7692f167a42Smrg#
7702f167a42Smrg# This file is free software; the Free Software Foundation
7712f167a42Smrg# gives unlimited permission to copy and/or distribute it,
7722f167a42Smrg# with or without modifications, as long as this notice is preserved.
7732f167a42Smrg
7742f167a42Smrg# _AM_PROG_CC_C_O
7752f167a42Smrg# ---------------
7762f167a42Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7772f167a42Smrg# to automatically call this.
7782f167a42SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7792f167a42Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7802f167a42SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7812f167a42SmrgAC_LANG_PUSH([C])dnl
7822f167a42SmrgAC_CACHE_CHECK(
7832f167a42Smrg  [whether $CC understands -c and -o together],
7842f167a42Smrg  [am_cv_prog_cc_c_o],
7852f167a42Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7862f167a42Smrg  # Make sure it works both with $CC and with simple cc.
7872f167a42Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7882f167a42Smrg  # compilers refuse to overwrite an existing .o file with -o,
7892f167a42Smrg  # though they will create one.
7902f167a42Smrg  am_cv_prog_cc_c_o=yes
7912f167a42Smrg  for am_i in 1 2; do
7922f167a42Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7932f167a42Smrg         && test -f conftest2.$ac_objext; then
7942f167a42Smrg      : OK
7952f167a42Smrg    else
7962f167a42Smrg      am_cv_prog_cc_c_o=no
7972f167a42Smrg      break
7982f167a42Smrg    fi
7992f167a42Smrg  done
8002f167a42Smrg  rm -f core conftest*
8012f167a42Smrg  unset am_i])
8022f167a42Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8032f167a42Smrg   # Losing compiler, so override with the script.
8042f167a42Smrg   # FIXME: It is wrong to rewrite CC.
8052f167a42Smrg   # But if we don't then we get into trouble of one sort or another.
8062f167a42Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8072f167a42Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8082f167a42Smrg   CC="$am_aux_dir/compile $CC"
8092f167a42Smrgfi
8102f167a42SmrgAC_LANG_POP([C])])
8113e6697d4Smrg
8122f167a42Smrg# For backward compatibility.
8132f167a42SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8142f167a42Smrg
8152f167a42Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
8160e20ee16Smrg#
8173e6697d4Smrg# This file is free software; the Free Software Foundation
8183e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
8193e6697d4Smrg# with or without modifications, as long as this notice is preserved.
8203e6697d4Smrg
8212f167a42Smrg# AM_RUN_LOG(COMMAND)
8222f167a42Smrg# -------------------
8232f167a42Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8242f167a42Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8252f167a42SmrgAC_DEFUN([AM_RUN_LOG],
8262f167a42Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8272f167a42Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8282f167a42Smrg   ac_status=$?
8292f167a42Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8302f167a42Smrg   (exit $ac_status); }])
8312f167a42Smrg
8322f167a42Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8332f167a42Smrg
8342f167a42Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
8352f167a42Smrg#
8362f167a42Smrg# This file is free software; the Free Software Foundation
8372f167a42Smrg# gives unlimited permission to copy and/or distribute it,
8382f167a42Smrg# with or without modifications, as long as this notice is preserved.
8393e6697d4Smrg
8403e6697d4Smrg# AM_SANITY_CHECK
8413e6697d4Smrg# ---------------
8423e6697d4SmrgAC_DEFUN([AM_SANITY_CHECK],
8433e6697d4Smrg[AC_MSG_CHECKING([whether build environment is sane])
8443e6697d4Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8453e6697d4Smrg# name.  Accept space and tab only in the latter.
8463e6697d4Smrgam_lf='
8473e6697d4Smrg'
8483e6697d4Smrgcase `pwd` in
8493e6697d4Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8503e6697d4Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8513e6697d4Smrgesac
8523e6697d4Smrgcase $srcdir in
8533e6697d4Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8542f167a42Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8553e6697d4Smrgesac
8563e6697d4Smrg
8572f167a42Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8583e6697d4Smrg# arguments.  Must try -L first in case configure is actually a
8593e6697d4Smrg# symlink; some systems play weird games with the mod time of symlinks
8603e6697d4Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8613e6697d4Smrg# directory).
8623e6697d4Smrgif (
8632f167a42Smrg   am_has_slept=no
8642f167a42Smrg   for am_try in 1 2; do
8652f167a42Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8662f167a42Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8672f167a42Smrg     if test "$[*]" = "X"; then
8682f167a42Smrg	# -L didn't work.
8692f167a42Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8702f167a42Smrg     fi
8712f167a42Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8722f167a42Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8732f167a42Smrg
8742f167a42Smrg	# If neither matched, then we have a broken ls.  This can happen
8752f167a42Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8762f167a42Smrg	# broken ls alias from the environment.  This has actually
8772f167a42Smrg	# happened.  Such a system could not be considered "sane".
8782f167a42Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8792f167a42Smrg  alias in your environment])
8802f167a42Smrg     fi
8812f167a42Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8822f167a42Smrg       break
8832f167a42Smrg     fi
8842f167a42Smrg     # Just in case.
8852f167a42Smrg     sleep 1
8862f167a42Smrg     am_has_slept=yes
8872f167a42Smrg   done
8883e6697d4Smrg   test "$[2]" = conftest.file
8893e6697d4Smrg   )
8903e6697d4Smrgthen
8913e6697d4Smrg   # Ok.
8923e6697d4Smrg   :
8933e6697d4Smrgelse
8943e6697d4Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8953e6697d4SmrgCheck your system clock])
8963e6697d4Smrgfi
8972f167a42SmrgAC_MSG_RESULT([yes])
8982f167a42Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8992f167a42Smrg# generated files are strictly newer.
9002f167a42Smrgam_sleep_pid=
9012f167a42Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9022f167a42Smrg  ( sleep 1 ) &
9032f167a42Smrg  am_sleep_pid=$!
9042f167a42Smrgfi
9052f167a42SmrgAC_CONFIG_COMMANDS_PRE(
9062f167a42Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9072f167a42Smrg   if test -n "$am_sleep_pid"; then
9082f167a42Smrg     # Hide warnings about reused PIDs.
9092f167a42Smrg     wait $am_sleep_pid 2>/dev/null
9102f167a42Smrg   fi
9112f167a42Smrg   AC_MSG_RESULT([done])])
9122f167a42Smrgrm -f conftest.file
9132f167a42Smrg])
9143e6697d4Smrg
9152f167a42Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
9160e20ee16Smrg#
9173e6697d4Smrg# This file is free software; the Free Software Foundation
9183e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
9193e6697d4Smrg# with or without modifications, as long as this notice is preserved.
9203e6697d4Smrg
9213e6697d4Smrg# AM_SILENT_RULES([DEFAULT])
9223e6697d4Smrg# --------------------------
9233e6697d4Smrg# Enable less verbose build rules; with the default set to DEFAULT
9242f167a42Smrg# ("yes" being less verbose, "no" or empty being verbose).
9253e6697d4SmrgAC_DEFUN([AM_SILENT_RULES],
9262f167a42Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9272f167a42SmrgAS_HELP_STRING(
9282f167a42Smrg  [--enable-silent-rules],
9292f167a42Smrg  [less verbose build output (undo: "make V=1")])
9302f167a42SmrgAS_HELP_STRING(
9312f167a42Smrg  [--disable-silent-rules],
9322f167a42Smrg  [verbose build output (undo: "make V=0")])dnl
9332f167a42Smrg])
9342f167a42Smrgcase $enable_silent_rules in @%:@ (((
9352f167a42Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9362f167a42Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9372f167a42Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9383e6697d4Smrgesac
9392f167a42Smrgdnl
9402f167a42Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9412f167a42Smrgdnl do not support nested variable expansions.
9422f167a42Smrgdnl See automake bug#9928 and bug#10237.
9432f167a42Smrgam_make=${MAKE-make}
9442f167a42SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9452f167a42Smrg   [am_cv_make_support_nested_variables],
9462f167a42Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9472f167a42SmrgBAR0=false
9482f167a42SmrgBAR1=true
9492f167a42SmrgV=1
9502f167a42Smrgam__doit:
9512f167a42Smrg	@$(TRUE)
9522f167a42Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9532f167a42Smrg  am_cv_make_support_nested_variables=yes
9542f167a42Smrgelse
9552f167a42Smrg  am_cv_make_support_nested_variables=no
9562f167a42Smrgfi])
9572f167a42Smrgif test $am_cv_make_support_nested_variables = yes; then
9582f167a42Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9592f167a42Smrg  AM_V='$(V)'
9602f167a42Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9612f167a42Smrgelse
9622f167a42Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9632f167a42Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9642f167a42Smrgfi
9652f167a42SmrgAC_SUBST([AM_V])dnl
9662f167a42SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9672f167a42SmrgAC_SUBST([AM_DEFAULT_V])dnl
9682f167a42SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9693e6697d4SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9703e6697d4SmrgAM_BACKSLASH='\'
9713e6697d4SmrgAC_SUBST([AM_BACKSLASH])dnl
9723e6697d4Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9733e6697d4Smrg])
9743e6697d4Smrg
9752f167a42Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
9760e20ee16Smrg#
9773e6697d4Smrg# This file is free software; the Free Software Foundation
9783e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
9793e6697d4Smrg# with or without modifications, as long as this notice is preserved.
9800e20ee16Smrg
9813e6697d4Smrg# AM_PROG_INSTALL_STRIP
9823e6697d4Smrg# ---------------------
9832f167a42Smrg# One issue with vendor 'install' (even GNU) is that you can't
9843e6697d4Smrg# specify the program used to strip binaries.  This is especially
9853e6697d4Smrg# annoying in cross-compiling environments, where the build's strip
9863e6697d4Smrg# is unlikely to handle the host's binaries.
9873e6697d4Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9882f167a42Smrg# always use install-sh in "make install-strip", and initialize
9893e6697d4Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9903e6697d4SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9913e6697d4Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9922f167a42Smrg# Installed binaries are usually stripped using 'strip' when the user
9932f167a42Smrg# run "make install-strip".  However 'strip' might not be the right
9943e6697d4Smrg# tool to use in cross-compilation environments, therefore Automake
9952f167a42Smrg# will honor the 'STRIP' environment variable to overrule this program.
9962f167a42Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9973e6697d4Smrgif test "$cross_compiling" != no; then
9983e6697d4Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9993e6697d4Smrgfi
10003e6697d4SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10013e6697d4SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10020e20ee16Smrg
10032f167a42Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
10043e6697d4Smrg#
10053e6697d4Smrg# This file is free software; the Free Software Foundation
10063e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
10073e6697d4Smrg# with or without modifications, as long as this notice is preserved.
10080e20ee16Smrg
10093e6697d4Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10103e6697d4Smrg# ---------------------------
10113e6697d4Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10123e6697d4Smrg# This macro is traced by Automake.
10133e6697d4SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10140e20ee16Smrg
10153e6697d4Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10162f167a42Smrg# --------------------------
10173e6697d4Smrg# Public sister of _AM_SUBST_NOTMAKE.
10183e6697d4SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10190e20ee16Smrg
10203e6697d4Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10210e20ee16Smrg
10222f167a42Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
10233e6697d4Smrg#
10243e6697d4Smrg# This file is free software; the Free Software Foundation
10253e6697d4Smrg# gives unlimited permission to copy and/or distribute it,
10263e6697d4Smrg# with or without modifications, as long as this notice is preserved.
10270e20ee16Smrg
10283e6697d4Smrg# _AM_PROG_TAR(FORMAT)
10293e6697d4Smrg# --------------------
10303e6697d4Smrg# Check how to create a tarball in format FORMAT.
10312f167a42Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10323e6697d4Smrg#
10333e6697d4Smrg# Substitute a variable $(am__tar) that is a command
10343e6697d4Smrg# writing to stdout a FORMAT-tarball containing the directory
10353e6697d4Smrg# $tardir.
10363e6697d4Smrg#     tardir=directory && $(am__tar) > result.tar
10373e6697d4Smrg#
10383e6697d4Smrg# Substitute a variable $(am__untar) that extract such
10393e6697d4Smrg# a tarball read from stdin.
10403e6697d4Smrg#     $(am__untar) < result.tar
10412f167a42Smrg#
10423e6697d4SmrgAC_DEFUN([_AM_PROG_TAR],
10432f167a42Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10442f167a42Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10452f167a42SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10462f167a42Smrg
10472f167a42Smrg# We'll loop over all known methods to create a tar archive until one works.
10483e6697d4Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10490e20ee16Smrg
10502f167a42Smrgm4_if([$1], [v7],
10512f167a42Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10522f167a42Smrg
10532f167a42Smrg  [m4_case([$1],
10542f167a42Smrg    [ustar],
10552f167a42Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10562f167a42Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10572f167a42Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10582f167a42Smrg      # and bug#13588).
10592f167a42Smrg      am_max_uid=2097151 # 2^21 - 1
10602f167a42Smrg      am_max_gid=$am_max_uid
10612f167a42Smrg      # The $UID and $GID variables are not portable, so we need to resort
10622f167a42Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10632f167a42Smrg      # below are definitely unexpected, so allow the users to see them
10642f167a42Smrg      # (that is, avoid stderr redirection).
10652f167a42Smrg      am_uid=`id -u || echo unknown`
10662f167a42Smrg      am_gid=`id -g || echo unknown`
10672f167a42Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10682f167a42Smrg      if test $am_uid -le $am_max_uid; then
10692f167a42Smrg         AC_MSG_RESULT([yes])
10702f167a42Smrg      else
10712f167a42Smrg         AC_MSG_RESULT([no])
10722f167a42Smrg         _am_tools=none
10732f167a42Smrg      fi
10742f167a42Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10752f167a42Smrg      if test $am_gid -le $am_max_gid; then
10762f167a42Smrg         AC_MSG_RESULT([yes])
10772f167a42Smrg      else
10782f167a42Smrg        AC_MSG_RESULT([no])
10792f167a42Smrg        _am_tools=none
10802f167a42Smrg      fi],
10812f167a42Smrg
10822f167a42Smrg  [pax],
10832f167a42Smrg    [],
10842f167a42Smrg
10852f167a42Smrg  [m4_fatal([Unknown tar format])])
10862f167a42Smrg
10872f167a42Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10882f167a42Smrg
10892f167a42Smrg  # Go ahead even if we have the value already cached.  We do so because we
10902f167a42Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10912f167a42Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10922f167a42Smrg
10932f167a42Smrg  for _am_tool in $_am_tools; do
10942f167a42Smrg    case $_am_tool in
10952f167a42Smrg    gnutar)
10962f167a42Smrg      for _am_tar in tar gnutar gtar; do
10972f167a42Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10982f167a42Smrg      done
10992f167a42Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11002f167a42Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11012f167a42Smrg      am__untar="$_am_tar -xf -"
11022f167a42Smrg      ;;
11032f167a42Smrg    plaintar)
11042f167a42Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11052f167a42Smrg      # ustar tarball either.
11062f167a42Smrg      (tar --version) >/dev/null 2>&1 && continue
11072f167a42Smrg      am__tar='tar chf - "$$tardir"'
11082f167a42Smrg      am__tar_='tar chf - "$tardir"'
11092f167a42Smrg      am__untar='tar xf -'
11102f167a42Smrg      ;;
11112f167a42Smrg    pax)
11122f167a42Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11132f167a42Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11142f167a42Smrg      am__untar='pax -r'
11152f167a42Smrg      ;;
11162f167a42Smrg    cpio)
11172f167a42Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11182f167a42Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11192f167a42Smrg      am__untar='cpio -i -H $1 -d'
11202f167a42Smrg      ;;
11212f167a42Smrg    none)
11222f167a42Smrg      am__tar=false
11232f167a42Smrg      am__tar_=false
11242f167a42Smrg      am__untar=false
11252f167a42Smrg      ;;
11262f167a42Smrg    esac
11273e6697d4Smrg
11282f167a42Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11292f167a42Smrg    # and am__untar set.
11302f167a42Smrg    test -n "${am_cv_prog_tar_$1}" && break
11312f167a42Smrg
11322f167a42Smrg    # tar/untar a dummy directory, and stop if the command works.
11332f167a42Smrg    rm -rf conftest.dir
11342f167a42Smrg    mkdir conftest.dir
11352f167a42Smrg    echo GrepMe > conftest.dir/file
11362f167a42Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11372f167a42Smrg    rm -rf conftest.dir
11382f167a42Smrg    if test -s conftest.tar; then
11392f167a42Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11402f167a42Smrg      AM_RUN_LOG([cat conftest.dir/file])
11412f167a42Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11422f167a42Smrg    fi
11432f167a42Smrg  done
11443e6697d4Smrg  rm -rf conftest.dir
11450e20ee16Smrg
11462f167a42Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11472f167a42Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11482f167a42Smrg
11493e6697d4SmrgAC_SUBST([am__tar])
11503e6697d4SmrgAC_SUBST([am__untar])
11513e6697d4Smrg]) # _AM_PROG_TAR
11523e6697d4Smrg
11532f167a42Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
11542f167a42Smrg# 
11552f167a42Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11563e6697d4Smrg#
11572f167a42Smrg# This program is free software; you can redistribute it and/or modify
11582f167a42Smrg# it under the terms of the GNU General Public License as published by
11592f167a42Smrg# the Free Software Foundation; either version 2 of the License, or
11602f167a42Smrg# (at your option) any later version.
11613e6697d4Smrg#
11622f167a42Smrg# This program is distributed in the hope that it will be useful, but
11632f167a42Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
11642f167a42Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11652f167a42Smrg# General Public License for more details.
11663e6697d4Smrg#
11672f167a42Smrg# You should have received a copy of the GNU General Public License
11682f167a42Smrg# along with this program; if not, write to the Free Software
11692f167a42Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11703e6697d4Smrg#
11712f167a42Smrg# As a special exception to the GNU General Public License, if you
11722f167a42Smrg# distribute this file as part of a program that contains a
11732f167a42Smrg# configuration script generated by Autoconf, you may include it under
11742f167a42Smrg# the same distribution terms that you use for the rest of that program.
11750e20ee16Smrg
11762f167a42Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
11772f167a42Smrg# ----------------------------------
11782f167a42SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
11792f167a42Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
11802f167a42Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
11812f167a42SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
11822f167a42Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
11832f167a42Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
11840e20ee16Smrgfi
11852f167a42Smrgif test -n "$PKG_CONFIG"; then
11862f167a42Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
11872f167a42Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
11882f167a42Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
11890e20ee16Smrg		AC_MSG_RESULT([yes])
11900e20ee16Smrg	else
11912f167a42Smrg		AC_MSG_RESULT([no])
11922f167a42Smrg		PKG_CONFIG=""
11930e20ee16Smrg	fi
11942f167a42Smrg		
11952f167a42Smrgfi[]dnl
11962f167a42Smrg])# PKG_PROG_PKG_CONFIG
11970e20ee16Smrg
11982f167a42Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
11993e6697d4Smrg#
12002f167a42Smrg# Check to see whether a particular set of modules exists.  Similar
12012f167a42Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12022f167a42Smrg#
12032f167a42Smrg#
12042f167a42Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12052f167a42Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
12062f167a42Smrg# PKG_CHECK_EXISTS manually
12072f167a42Smrg# --------------------------------------------------------------
12082f167a42SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12092f167a42Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12102f167a42Smrgif test -n "$PKG_CONFIG" && \
12112f167a42Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12122f167a42Smrg  m4_ifval([$2], [$2], [:])
12132f167a42Smrgm4_ifvaln([$3], [else
12142f167a42Smrg  $3])dnl
12152f167a42Smrgfi])
12160e20ee16Smrg
12172f167a42Smrg
12182f167a42Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12192f167a42Smrg# ---------------------------------------------
12202f167a42Smrgm4_define([_PKG_CONFIG],
12212f167a42Smrg[if test -n "$$1"; then
12222f167a42Smrg    pkg_cv_[]$1="$$1"
12232f167a42Smrg elif test -n "$PKG_CONFIG"; then
12242f167a42Smrg    PKG_CHECK_EXISTS([$3],
12252f167a42Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
12262f167a42Smrg		     [pkg_failed=yes])
12272f167a42Smrg else
12282f167a42Smrg    pkg_failed=untried
12292f167a42Smrgfi[]dnl
12302f167a42Smrg])# _PKG_CONFIG
12312f167a42Smrg
12322f167a42Smrg# _PKG_SHORT_ERRORS_SUPPORTED
12332f167a42Smrg# -----------------------------
12342f167a42SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12352f167a42Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12362f167a42Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12372f167a42Smrg        _pkg_short_errors_supported=yes
12382f167a42Smrgelse
12392f167a42Smrg        _pkg_short_errors_supported=no
12402f167a42Smrgfi[]dnl
12412f167a42Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
12422f167a42Smrg
12432f167a42Smrg
12442f167a42Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12452f167a42Smrg# [ACTION-IF-NOT-FOUND])
12462f167a42Smrg#
12472f167a42Smrg#
12482f167a42Smrg# Note that if there is a possibility the first call to
12492f167a42Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12502f167a42Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12512f167a42Smrg#
12522f167a42Smrg#
12532f167a42Smrg# --------------------------------------------------------------
12542f167a42SmrgAC_DEFUN([PKG_CHECK_MODULES],
12552f167a42Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12562f167a42SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12572f167a42SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12582f167a42Smrg
12592f167a42Smrgpkg_failed=no
12602f167a42SmrgAC_MSG_CHECKING([for $1])
12612f167a42Smrg
12622f167a42Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12632f167a42Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12642f167a42Smrg
12652f167a42Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12662f167a42Smrgand $1[]_LIBS to avoid the need to call pkg-config.
12672f167a42SmrgSee the pkg-config man page for more details.])
12682f167a42Smrg
12692f167a42Smrgif test $pkg_failed = yes; then
12702f167a42Smrg        _PKG_SHORT_ERRORS_SUPPORTED
12712f167a42Smrg        if test $_pkg_short_errors_supported = yes; then
12722f167a42Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
12732f167a42Smrg        else 
12742f167a42Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
12752f167a42Smrg        fi
12762f167a42Smrg	# Put the nasty error message in config.log where it belongs
12772f167a42Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
12782f167a42Smrg
12792f167a42Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
12802f167a42Smrg[Package requirements ($2) were not met:
12812f167a42Smrg
12822f167a42Smrg$$1_PKG_ERRORS
12832f167a42Smrg
12842f167a42SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
12852f167a42Smrginstalled software in a non-standard prefix.
12862f167a42Smrg
12872f167a42Smrg_PKG_TEXT
12882f167a42Smrg])],
12892f167a42Smrg		[AC_MSG_RESULT([no])
12902f167a42Smrg                $4])
12912f167a42Smrgelif test $pkg_failed = untried; then
12922f167a42Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
12932f167a42Smrg[The pkg-config script could not be found or is too old.  Make sure it
12942f167a42Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
12952f167a42Smrgpath to pkg-config.
12962f167a42Smrg
12972f167a42Smrg_PKG_TEXT
12982f167a42Smrg
12992f167a42SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13002f167a42Smrg		[$4])
13012f167a42Smrgelse
13022f167a42Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13032f167a42Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13042f167a42Smrg        AC_MSG_RESULT([yes])
13052f167a42Smrg	ifelse([$3], , :, [$3])
13062f167a42Smrgfi[]dnl
13072f167a42Smrg])# PKG_CHECK_MODULES
13082f167a42Smrg
13092f167a42Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13102f167a42Smrgdnl
13112f167a42Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13122f167a42Smrgdnl
13132f167a42Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13142f167a42Smrgdnl copy of this software and associated documentation files (the "Software"),
13152f167a42Smrgdnl to deal in the Software without restriction, including without limitation
13162f167a42Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13172f167a42Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
13182f167a42Smrgdnl Software is furnished to do so, subject to the following conditions:
13192f167a42Smrgdnl
13202f167a42Smrgdnl The above copyright notice and this permission notice (including the next
13212f167a42Smrgdnl paragraph) shall be included in all copies or substantial portions of the
13222f167a42Smrgdnl Software.
13232f167a42Smrgdnl
13242f167a42Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13252f167a42Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13262f167a42Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13272f167a42Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13282f167a42Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13292f167a42Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13302f167a42Smrgdnl DEALINGS IN THE SOFTWARE.
13312f167a42Smrg
13322f167a42Smrg# XORG_MACROS_VERSION(required-version)
13332f167a42Smrg# -------------------------------------
13342f167a42Smrg# Minimum version: 1.1.0
13352f167a42Smrg#
13362f167a42Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13372f167a42Smrg# your configure.ac with the minimum required version, such as:
13382f167a42Smrg# XORG_MACROS_VERSION(1.1)
13392f167a42Smrg#
13402f167a42Smrg# To ensure that this macro is defined, also add:
13412f167a42Smrg# m4_ifndef([XORG_MACROS_VERSION],
13422f167a42Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13432f167a42Smrg#
13442f167a42Smrg#
13452f167a42Smrg# See the "minimum version" comment for each macro you use to see what
13462f167a42Smrg# version you require.
13472f167a42Smrgm4_defun([XORG_MACROS_VERSION],[
13482f167a42Smrgm4_define([vers_have], [1.19.0])
13492f167a42Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13502f167a42Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13512f167a42Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13522f167a42Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13532f167a42Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13542f167a42Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13552f167a42Smrgm4_undefine([vers_have])
13562f167a42Smrgm4_undefine([maj_have])
13572f167a42Smrgm4_undefine([maj_needed])
13582f167a42Smrg]) # XORG_MACROS_VERSION
13592f167a42Smrg
13602f167a42Smrg# XORG_PROG_RAWCPP()
13612f167a42Smrg# ------------------
13622f167a42Smrg# Minimum version: 1.0.0
13632f167a42Smrg#
13642f167a42Smrg# Find cpp program and necessary flags for use in pre-processing text files
13652f167a42Smrg# such as man pages and config files
13662f167a42SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
13672f167a42SmrgAC_REQUIRE([AC_PROG_CPP])
13682f167a42SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
13692f167a42Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
13702f167a42Smrg
13712f167a42Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
13722f167a42Smrg# which is not the best choice for supporting other OS'es, but covers most
13732f167a42Smrg# of the ones we need for now.
13742f167a42SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
13752f167a42SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
13762f167a42Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13772f167a42Smrg	AC_MSG_RESULT([no])
13782f167a42Smrgelse
13792f167a42Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13802f167a42Smrg		RAWCPPFLAGS=-undef
13812f167a42Smrg		AC_MSG_RESULT([yes])
13822f167a42Smrg	# under Cygwin unix is still defined even with -undef
13832f167a42Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13842f167a42Smrg		RAWCPPFLAGS="-undef -ansi"
13852f167a42Smrg		AC_MSG_RESULT([yes, with -ansi])
13862f167a42Smrg	else
13872f167a42Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
13882f167a42Smrg	fi
13892f167a42Smrgfi
13902f167a42Smrgrm -f conftest.$ac_ext
13912f167a42Smrg
13922f167a42SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
13932f167a42SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
13942f167a42Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13952f167a42Smrg	AC_MSG_RESULT([no])
13962f167a42Smrgelse
13972f167a42Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
13982f167a42Smrg		TRADITIONALCPPFLAGS="-traditional"
13992f167a42Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14002f167a42Smrg		AC_MSG_RESULT([yes])
14012f167a42Smrg	else
14022f167a42Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14032f167a42Smrg	fi
14042f167a42Smrgfi
14052f167a42Smrgrm -f conftest.$ac_ext
14062f167a42SmrgAC_SUBST(RAWCPPFLAGS)
14072f167a42SmrgAC_SUBST(TRADITIONALCPPFLAGS)
14082f167a42Smrg]) # XORG_PROG_RAWCPP
14092f167a42Smrg
14102f167a42Smrg# XORG_MANPAGE_SECTIONS()
14112f167a42Smrg# -----------------------
14122f167a42Smrg# Minimum version: 1.0.0
14132f167a42Smrg#
14142f167a42Smrg# Determine which sections man pages go in for the different man page types
14152f167a42Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14162f167a42Smrg# Not sure if there's any better way than just hardcoding by OS name.
14172f167a42Smrg# Override default settings by setting environment variables
14182f167a42Smrg# Added MAN_SUBSTS in version 1.8
14192f167a42Smrg# Added AC_PROG_SED in version 1.8
14202f167a42Smrg
14212f167a42SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14222f167a42SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423c75e344aSmrgAC_REQUIRE([AC_PROG_SED])
14240e20ee16Smrg
14250e20ee16Smrgif test x$APP_MAN_SUFFIX = x    ; then
14263e6697d4Smrg    APP_MAN_SUFFIX=1
14270e20ee16Smrgfi
14280e20ee16Smrgif test x$APP_MAN_DIR = x    ; then
14293e6697d4Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14300e20ee16Smrgfi
14310e20ee16Smrg
14320e20ee16Smrgif test x$LIB_MAN_SUFFIX = x    ; then
14333e6697d4Smrg    LIB_MAN_SUFFIX=3
14340e20ee16Smrgfi
14350e20ee16Smrgif test x$LIB_MAN_DIR = x    ; then
14363e6697d4Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14370e20ee16Smrgfi
14380e20ee16Smrg
14390e20ee16Smrgif test x$FILE_MAN_SUFFIX = x    ; then
14400e20ee16Smrg    case $host_os in
14410e20ee16Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14420e20ee16Smrg	*)		FILE_MAN_SUFFIX=5  ;;
14430e20ee16Smrg    esac
14440e20ee16Smrgfi
14450e20ee16Smrgif test x$FILE_MAN_DIR = x    ; then
14463e6697d4Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14470e20ee16Smrgfi
14480e20ee16Smrg
14490e20ee16Smrgif test x$MISC_MAN_SUFFIX = x    ; then
14500e20ee16Smrg    case $host_os in
14510e20ee16Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14520e20ee16Smrg	*)		MISC_MAN_SUFFIX=7  ;;
14530e20ee16Smrg    esac
14540e20ee16Smrgfi
14550e20ee16Smrgif test x$MISC_MAN_DIR = x    ; then
14563e6697d4Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14570e20ee16Smrgfi
14580e20ee16Smrg
14590e20ee16Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14600e20ee16Smrg    case $host_os in
14610e20ee16Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14620e20ee16Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14630e20ee16Smrg    esac
14640e20ee16Smrgfi
14650e20ee16Smrgif test x$DRIVER_MAN_DIR = x    ; then
14663e6697d4Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14670e20ee16Smrgfi
14680e20ee16Smrg
14690e20ee16Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
14700e20ee16Smrg    case $host_os in
14710e20ee16Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
14720e20ee16Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
14730e20ee16Smrg    esac
14740e20ee16Smrgfi
14750e20ee16Smrgif test x$ADMIN_MAN_DIR = x    ; then
14760e20ee16Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
14770e20ee16Smrgfi
14780e20ee16Smrg
14790e20ee16Smrg
14800e20ee16SmrgAC_SUBST([APP_MAN_SUFFIX])
14810e20ee16SmrgAC_SUBST([LIB_MAN_SUFFIX])
14820e20ee16SmrgAC_SUBST([FILE_MAN_SUFFIX])
14830e20ee16SmrgAC_SUBST([MISC_MAN_SUFFIX])
14840e20ee16SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
14850e20ee16SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
14860e20ee16SmrgAC_SUBST([APP_MAN_DIR])
14870e20ee16SmrgAC_SUBST([LIB_MAN_DIR])
14880e20ee16SmrgAC_SUBST([FILE_MAN_DIR])
14890e20ee16SmrgAC_SUBST([MISC_MAN_DIR])
14900e20ee16SmrgAC_SUBST([DRIVER_MAN_DIR])
14910e20ee16SmrgAC_SUBST([ADMIN_MAN_DIR])
1492c75e344aSmrg
1493c75e344aSmrgXORG_MAN_PAGE="X Version 11"
1494c75e344aSmrgAC_SUBST([XORG_MAN_PAGE])
1495c75e344aSmrgMAN_SUBSTS="\
1496c75e344aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497c75e344aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498c75e344aSmrg	-e 's|__xservername__|Xorg|g' \
1499c75e344aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500c75e344aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1501c75e344aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502c75e344aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503c75e344aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504c75e344aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505c75e344aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506c75e344aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507c75e344aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508c75e344aSmrgAC_SUBST([MAN_SUBSTS])
1509c75e344aSmrg
15100e20ee16Smrg]) # XORG_MANPAGE_SECTIONS
15110e20ee16Smrg
1512c75e344aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513c75e344aSmrg# ------------------------
1514c75e344aSmrg# Minimum version: 1.7.0
1515c75e344aSmrg#
1516c75e344aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517c75e344aSmrg# provided by xorg-sgml-doctools, if installed.
1518c75e344aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519c75e344aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520c75e344aSmrgXORG_SGML_PATH=
1521c75e344aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522c75e344aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523c75e344aSmrg    [m4_ifval([$1],[:],
1524c75e344aSmrg        [if test x"$cross_compiling" != x"yes" ; then
1525c75e344aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526c75e344aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527c75e344aSmrg         fi])
1528c75e344aSmrg    ])
1529c75e344aSmrg
1530c75e344aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531c75e344aSmrg# the path and the name of the doc stylesheet
1532c75e344aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1533c75e344aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534c75e344aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535c75e344aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536c75e344aSmrgelse
1537c75e344aSmrg   AC_MSG_RESULT([no])
1538c75e344aSmrgfi
1539c75e344aSmrg
1540c75e344aSmrgAC_SUBST(XORG_SGML_PATH)
1541c75e344aSmrgAC_SUBST(STYLESHEET_SRCDIR)
1542c75e344aSmrgAC_SUBST(XSL_STYLESHEET)
1543c75e344aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544c75e344aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1545c75e344aSmrg
15460e20ee16Smrg# XORG_CHECK_LINUXDOC
15470e20ee16Smrg# -------------------
15483e6697d4Smrg# Minimum version: 1.0.0
15493e6697d4Smrg#
15500e20ee16Smrg# Defines the variable MAKE_TEXT if the necessary tools and
15510e20ee16Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15520e20ee16Smrg# Whether or not the necessary tools and files are found can be checked
15530e20ee16Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15540e20ee16SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555c75e344aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556c75e344aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
15570e20ee16Smrg
15580e20ee16SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
15590e20ee16Smrg
1560c75e344aSmrgAC_MSG_CHECKING([whether to build documentation])
15610e20ee16Smrg
1562c75e344aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15630e20ee16Smrg   BUILDDOC=yes
15640e20ee16Smrgelse
15650e20ee16Smrg   BUILDDOC=no
15660e20ee16Smrgfi
15670e20ee16Smrg
15680e20ee16SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
15690e20ee16Smrg
15700e20ee16SmrgAC_MSG_RESULT([$BUILDDOC])
15710e20ee16Smrg
1572c75e344aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
15730e20ee16Smrg
1574c75e344aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
15750e20ee16Smrg   BUILDPDFDOC=yes
15760e20ee16Smrgelse
15770e20ee16Smrg   BUILDPDFDOC=no
15780e20ee16Smrgfi
15790e20ee16Smrg
15800e20ee16SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15810e20ee16Smrg
15820e20ee16SmrgAC_MSG_RESULT([$BUILDPDFDOC])
15830e20ee16Smrg
1584c75e344aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
15853e6697d4SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
15860e20ee16SmrgMAKE_PDF="$PS2PDF"
15873e6697d4SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
15880e20ee16Smrg
15890e20ee16SmrgAC_SUBST(MAKE_TEXT)
15900e20ee16SmrgAC_SUBST(MAKE_PS)
15910e20ee16SmrgAC_SUBST(MAKE_PDF)
15920e20ee16SmrgAC_SUBST(MAKE_HTML)
15930e20ee16Smrg]) # XORG_CHECK_LINUXDOC
15940e20ee16Smrg
15953e6697d4Smrg# XORG_CHECK_DOCBOOK
15963e6697d4Smrg# -------------------
15973e6697d4Smrg# Minimum version: 1.0.0
15983e6697d4Smrg#
15993e6697d4Smrg# Checks for the ability to build output formats from SGML DocBook source.
16003e6697d4Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16013e6697d4Smrg# indicates whether the necessary tools and files are found and, if set,
16023e6697d4Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16033e6697d4SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604c75e344aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605c75e344aSmrg
16063e6697d4SmrgBUILDTXTDOC=no
16073e6697d4SmrgBUILDPDFDOC=no
16083e6697d4SmrgBUILDPSDOC=no
16093e6697d4SmrgBUILDHTMLDOC=no
16103e6697d4Smrg
16113e6697d4SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16123e6697d4SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16133e6697d4SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16143e6697d4SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16153e6697d4Smrg
1616c75e344aSmrgAC_MSG_CHECKING([whether to build text documentation])
1617c75e344aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16183e6697d4Smrg   test x$BUILD_TXTDOC != xno; then
16193e6697d4Smrg	BUILDTXTDOC=yes
16203e6697d4Smrgfi
16213e6697d4SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16223e6697d4SmrgAC_MSG_RESULT([$BUILDTXTDOC])
16233e6697d4Smrg
1624c75e344aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625c75e344aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16263e6697d4Smrg   test x$BUILD_PDFDOC != xno; then
16273e6697d4Smrg	BUILDPDFDOC=yes
16283e6697d4Smrgfi
16293e6697d4SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16303e6697d4SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16313e6697d4Smrg
1632c75e344aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633c75e344aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16343e6697d4Smrg   test x$BUILD_PSDOC != xno; then
16353e6697d4Smrg	BUILDPSDOC=yes
16363e6697d4Smrgfi
16373e6697d4SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16383e6697d4SmrgAC_MSG_RESULT([$BUILDPSDOC])
16393e6697d4Smrg
1640c75e344aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641c75e344aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16423e6697d4Smrg   test x$BUILD_HTMLDOC != xno; then
16433e6697d4Smrg	BUILDHTMLDOC=yes
16443e6697d4Smrgfi
16453e6697d4SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16463e6697d4SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16473e6697d4Smrg
16483e6697d4SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16493e6697d4SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16503e6697d4SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16513e6697d4SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16523e6697d4Smrg
16533e6697d4SmrgAC_SUBST(MAKE_TEXT)
16543e6697d4SmrgAC_SUBST(MAKE_PS)
16553e6697d4SmrgAC_SUBST(MAKE_PDF)
16563e6697d4SmrgAC_SUBST(MAKE_HTML)
16573e6697d4Smrg]) # XORG_CHECK_DOCBOOK
16583e6697d4Smrg
1659c75e344aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660c75e344aSmrg# ----------------
1661c75e344aSmrg# Minimum version: 1.5.0
1662c75e344aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1663c75e344aSmrg#
1664c75e344aSmrg# Documentation tools are not always available on all platforms and sometimes
1665c75e344aSmrg# not at the appropriate level. This macro enables a module to test for the
1666c75e344aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667c75e344aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668c75e344aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669c75e344aSmrg# --with-xmlto assumes 'auto'.
1670c75e344aSmrg#
1671c75e344aSmrg# Interface to module:
1672c75e344aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673c75e344aSmrg# XMLTO:	returns the path of the xmlto program found
1674c75e344aSmrg#		returns the path set by the user in the environment
1675c75e344aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676c75e344aSmrg#		'no' user instructs the module not to use xmlto
1677c75e344aSmrg#
1678c75e344aSmrg# Added in version 1.10.0
1679c75e344aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680c75e344aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681c75e344aSmrg#
1682c75e344aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683c75e344aSmrg#
1684c75e344aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685c75e344aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686c75e344aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1687c75e344aSmrgAC_ARG_WITH(xmlto,
1688c75e344aSmrg	AS_HELP_STRING([--with-xmlto],
1689c75e344aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690c75e344aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691c75e344aSmrgm4_undefine([_defopt])
1692c75e344aSmrg
1693c75e344aSmrgif test "x$use_xmlto" = x"auto"; then
1694c75e344aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1695c75e344aSmrg   if test "x$XMLTO" = "x"; then
1696c75e344aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697c75e344aSmrg	have_xmlto=no
1698c75e344aSmrg   else
1699c75e344aSmrg        have_xmlto=yes
1700c75e344aSmrg   fi
1701c75e344aSmrgelif test "x$use_xmlto" = x"yes" ; then
1702c75e344aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1703c75e344aSmrg   if test "x$XMLTO" = "x"; then
1704c75e344aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705c75e344aSmrg   fi
1706c75e344aSmrg   have_xmlto=yes
1707c75e344aSmrgelif test "x$use_xmlto" = x"no" ; then
1708c75e344aSmrg   if test "x$XMLTO" != "x"; then
1709c75e344aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710c75e344aSmrg   fi
1711c75e344aSmrg   have_xmlto=no
1712c75e344aSmrgelse
1713c75e344aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714c75e344aSmrgfi
1715c75e344aSmrg
1716c75e344aSmrg# Test for a minimum version of xmlto, if provided.
1717c75e344aSmrgm4_ifval([$1],
1718c75e344aSmrg[if test "$have_xmlto" = yes; then
1719c75e344aSmrg    # scrape the xmlto version
1720c75e344aSmrg    AC_MSG_CHECKING([the xmlto version])
1721c75e344aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722c75e344aSmrg    AC_MSG_RESULT([$xmlto_version])
1723c75e344aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724c75e344aSmrg        [if test "x$use_xmlto" = xauto; then
1725c75e344aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726c75e344aSmrg            have_xmlto=no
1727c75e344aSmrg        else
1728c75e344aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729c75e344aSmrg        fi])
1730c75e344aSmrgfi])
1731c75e344aSmrg
1732c75e344aSmrg# Test for the ability of xmlto to generate a text target
1733c75e344aSmrghave_xmlto_text=no
1734c75e344aSmrgcat > conftest.xml << "EOF"
1735c75e344aSmrgEOF
1736c75e344aSmrgAS_IF([test "$have_xmlto" = yes],
1737c75e344aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738c75e344aSmrg             [have_xmlto_text=yes],
1739c75e344aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740c75e344aSmrgrm -f conftest.xml
1741c75e344aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742c75e344aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743c75e344aSmrg]) # XORG_WITH_XMLTO
1744c75e344aSmrg
17452f167a42Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
17462f167a42Smrg# --------------------------------------------
17472f167a42Smrg# Minimum version: 1.12.0
17482f167a42Smrg# Minimum version for optional DEFAULT argument: 1.12.0
17492f167a42Smrg#
17502f167a42Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
17512f167a42Smrg# XML-based language used for the transformation of XML documents.
17522f167a42Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
17532f167a42Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
17542f167a42Smrg# The XSLT processor is often used as a standalone tool for transformations.
17552f167a42Smrg# It should not be assumed that this tool is used only to work with documnetation.
17562f167a42Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
17572f167a42Smrg#
17582f167a42Smrg# Interface to module:
17592f167a42Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
17602f167a42Smrg# XSLTPROC:	 returns the path of the xsltproc program found
17612f167a42Smrg#		 returns the path set by the user in the environment
17622f167a42Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
17632f167a42Smrg#		  'no' user instructs the module not to use xsltproc
17642f167a42Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
17652f167a42Smrg#
17662f167a42Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
17672f167a42Smrg#
17682f167a42SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
17692f167a42SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
17702f167a42Smrg# Preserves the interface, should it be implemented later
17712f167a42Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
17722f167a42Smrgm4_define([_defopt], m4_default([$2], [auto]))
17732f167a42SmrgAC_ARG_WITH(xsltproc,
17742f167a42Smrg	AS_HELP_STRING([--with-xsltproc],
17752f167a42Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
17762f167a42Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
17772f167a42Smrgm4_undefine([_defopt])
17782f167a42Smrg
17792f167a42Smrgif test "x$use_xsltproc" = x"auto"; then
17802f167a42Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17812f167a42Smrg   if test "x$XSLTPROC" = "x"; then
17822f167a42Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
17832f167a42Smrg	have_xsltproc=no
17842f167a42Smrg   else
17852f167a42Smrg        have_xsltproc=yes
17862f167a42Smrg   fi
17872f167a42Smrgelif test "x$use_xsltproc" = x"yes" ; then
17882f167a42Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17892f167a42Smrg   if test "x$XSLTPROC" = "x"; then
17902f167a42Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
17912f167a42Smrg   fi
17922f167a42Smrg   have_xsltproc=yes
17932f167a42Smrgelif test "x$use_xsltproc" = x"no" ; then
17942f167a42Smrg   if test "x$XSLTPROC" != "x"; then
17952f167a42Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
17962f167a42Smrg   fi
17972f167a42Smrg   have_xsltproc=no
17982f167a42Smrgelse
17992f167a42Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18002f167a42Smrgfi
18012f167a42Smrg
18022f167a42SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18032f167a42Smrg]) # XORG_WITH_XSLTPROC
18042f167a42Smrg
18052f167a42Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18062f167a42Smrg# ----------------------------------------
18072f167a42Smrg# Minimum version: 1.15.0
18082f167a42Smrg#
18092f167a42Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
18102f167a42Smrg# scanning arbitrary text files, extracting information from those text files,
18112f167a42Smrg# and printing reports based on that information.
18122f167a42Smrg#
18132f167a42Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18142f167a42Smrg#
18152f167a42Smrg# Interface to module:
18162f167a42Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
18172f167a42Smrg# PERL:	     returns the path of the perl program found
18182f167a42Smrg#	     returns the path set by the user in the environment
18192f167a42Smrg# --with-perl: 'yes' user instructs the module to use perl
18202f167a42Smrg#	       'no' user instructs the module not to use perl
18212f167a42Smrg# have_perl: returns yes if perl found in PATH or no
18222f167a42Smrg#
18232f167a42Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18242f167a42Smrg#
18252f167a42SmrgAC_DEFUN([XORG_WITH_PERL],[
18262f167a42SmrgAC_ARG_VAR([PERL], [Path to perl command])
18272f167a42Smrg# Preserves the interface, should it be implemented later
18282f167a42Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18292f167a42Smrgm4_define([_defopt], m4_default([$2], [auto]))
18302f167a42SmrgAC_ARG_WITH(perl,
18312f167a42Smrg	AS_HELP_STRING([--with-perl],
18322f167a42Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18332f167a42Smrg	   [use_perl=$withval], [use_perl=]_defopt)
18342f167a42Smrgm4_undefine([_defopt])
18352f167a42Smrg
18362f167a42Smrgif test "x$use_perl" = x"auto"; then
18372f167a42Smrg   AC_PATH_PROG([PERL], [perl])
18382f167a42Smrg   if test "x$PERL" = "x"; then
18392f167a42Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18402f167a42Smrg	have_perl=no
18412f167a42Smrg   else
18422f167a42Smrg        have_perl=yes
18432f167a42Smrg   fi
18442f167a42Smrgelif test "x$use_perl" = x"yes" ; then
18452f167a42Smrg   AC_PATH_PROG([PERL], [perl])
18462f167a42Smrg   if test "x$PERL" = "x"; then
18472f167a42Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18482f167a42Smrg   fi
18492f167a42Smrg   have_perl=yes
18502f167a42Smrgelif test "x$use_perl" = x"no" ; then
18512f167a42Smrg   if test "x$PERL" != "x"; then
18522f167a42Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18532f167a42Smrg   fi
18542f167a42Smrg   have_perl=no
18552f167a42Smrgelse
18562f167a42Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18572f167a42Smrgfi
18582f167a42Smrg
18592f167a42SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18602f167a42Smrg]) # XORG_WITH_PERL
18612f167a42Smrg
1862c75e344aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863c75e344aSmrg# ----------------
1864c75e344aSmrg# Minimum version: 1.5.0
1865c75e344aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1866c75e344aSmrg#
1867c75e344aSmrg# Documentation tools are not always available on all platforms and sometimes
1868c75e344aSmrg# not at the appropriate level. This macro enables a module to test for the
1869c75e344aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870c75e344aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871c75e344aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872c75e344aSmrg# --with-asciidoc assumes 'auto'.
1873c75e344aSmrg#
1874c75e344aSmrg# Interface to module:
1875c75e344aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876c75e344aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877c75e344aSmrg#		 returns the path set by the user in the environment
1878c75e344aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879c75e344aSmrg#		  'no' user instructs the module not to use asciidoc
1880c75e344aSmrg#
1881c75e344aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882c75e344aSmrg#
1883c75e344aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884c75e344aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885c75e344aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1886c75e344aSmrgAC_ARG_WITH(asciidoc,
1887c75e344aSmrg	AS_HELP_STRING([--with-asciidoc],
1888c75e344aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889c75e344aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890c75e344aSmrgm4_undefine([_defopt])
1891c75e344aSmrg
1892c75e344aSmrgif test "x$use_asciidoc" = x"auto"; then
1893c75e344aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894c75e344aSmrg   if test "x$ASCIIDOC" = "x"; then
1895c75e344aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896c75e344aSmrg	have_asciidoc=no
1897c75e344aSmrg   else
1898c75e344aSmrg        have_asciidoc=yes
1899c75e344aSmrg   fi
1900c75e344aSmrgelif test "x$use_asciidoc" = x"yes" ; then
1901c75e344aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902c75e344aSmrg   if test "x$ASCIIDOC" = "x"; then
1903c75e344aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904c75e344aSmrg   fi
1905c75e344aSmrg   have_asciidoc=yes
1906c75e344aSmrgelif test "x$use_asciidoc" = x"no" ; then
1907c75e344aSmrg   if test "x$ASCIIDOC" != "x"; then
1908c75e344aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909c75e344aSmrg   fi
1910c75e344aSmrg   have_asciidoc=no
1911c75e344aSmrgelse
1912c75e344aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913c75e344aSmrgfi
1914c75e344aSmrgm4_ifval([$1],
1915c75e344aSmrg[if test "$have_asciidoc" = yes; then
1916c75e344aSmrg    # scrape the asciidoc version
1917c75e344aSmrg    AC_MSG_CHECKING([the asciidoc version])
1918c75e344aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919c75e344aSmrg    AC_MSG_RESULT([$asciidoc_version])
1920c75e344aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921c75e344aSmrg        [if test "x$use_asciidoc" = xauto; then
1922c75e344aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923c75e344aSmrg            have_asciidoc=no
1924c75e344aSmrg        else
1925c75e344aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926c75e344aSmrg        fi])
1927c75e344aSmrgfi])
1928c75e344aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929c75e344aSmrg]) # XORG_WITH_ASCIIDOC
1930c75e344aSmrg
1931c75e344aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
19322f167a42Smrg# -------------------------------------------
1933c75e344aSmrg# Minimum version: 1.5.0
1934c75e344aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19352f167a42Smrg# Minimum version for optional DOT checking: 1.18.0
1936c75e344aSmrg#
1937c75e344aSmrg# Documentation tools are not always available on all platforms and sometimes
1938c75e344aSmrg# not at the appropriate level. This macro enables a module to test for the
1939c75e344aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940c75e344aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941c75e344aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942c75e344aSmrg# --with-doxygen assumes 'auto'.
1943c75e344aSmrg#
1944c75e344aSmrg# Interface to module:
1945c75e344aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946c75e344aSmrg# DOXYGEN:	 returns the path of the doxygen program found
1947c75e344aSmrg#		 returns the path set by the user in the environment
1948c75e344aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949c75e344aSmrg#		  'no' user instructs the module not to use doxygen
1950c75e344aSmrg#
1951c75e344aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952c75e344aSmrg#
1953c75e344aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954c75e344aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
19552f167a42SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956c75e344aSmrgm4_define([_defopt], m4_default([$2], [auto]))
1957c75e344aSmrgAC_ARG_WITH(doxygen,
1958c75e344aSmrg	AS_HELP_STRING([--with-doxygen],
1959c75e344aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960c75e344aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961c75e344aSmrgm4_undefine([_defopt])
1962c75e344aSmrg
1963c75e344aSmrgif test "x$use_doxygen" = x"auto"; then
1964c75e344aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965c75e344aSmrg   if test "x$DOXYGEN" = "x"; then
1966c75e344aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967c75e344aSmrg	have_doxygen=no
1968c75e344aSmrg   else
1969c75e344aSmrg        have_doxygen=yes
1970c75e344aSmrg   fi
1971c75e344aSmrgelif test "x$use_doxygen" = x"yes" ; then
1972c75e344aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973c75e344aSmrg   if test "x$DOXYGEN" = "x"; then
1974c75e344aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975c75e344aSmrg   fi
1976c75e344aSmrg   have_doxygen=yes
1977c75e344aSmrgelif test "x$use_doxygen" = x"no" ; then
1978c75e344aSmrg   if test "x$DOXYGEN" != "x"; then
1979c75e344aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980c75e344aSmrg   fi
1981c75e344aSmrg   have_doxygen=no
1982c75e344aSmrgelse
1983c75e344aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984c75e344aSmrgfi
1985c75e344aSmrgm4_ifval([$1],
1986c75e344aSmrg[if test "$have_doxygen" = yes; then
1987c75e344aSmrg    # scrape the doxygen version
1988c75e344aSmrg    AC_MSG_CHECKING([the doxygen version])
1989c75e344aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990c75e344aSmrg    AC_MSG_RESULT([$doxygen_version])
1991c75e344aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992c75e344aSmrg        [if test "x$use_doxygen" = xauto; then
1993c75e344aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994c75e344aSmrg            have_doxygen=no
1995c75e344aSmrg        else
1996c75e344aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997c75e344aSmrg        fi])
1998c75e344aSmrgfi])
19992f167a42Smrg
20002f167a42Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
20012f167a42Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
20022f167a42Smrgdnl 	HAVE_DOT = @HAVE_DOT@
20032f167a42SmrgHAVE_DOT=no
20042f167a42Smrgif test "x$have_doxygen" = "xyes"; then
20052f167a42Smrg  AC_PATH_PROG([DOT], [dot])
20062f167a42Smrg    if test "x$DOT" != "x"; then
20072f167a42Smrg      HAVE_DOT=yes
20082f167a42Smrg    fi
20092f167a42Smrgfi
20102f167a42Smrg
20112f167a42SmrgAC_SUBST([HAVE_DOT])
20122f167a42SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013c75e344aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014c75e344aSmrg]) # XORG_WITH_DOXYGEN
2015c75e344aSmrg
2016c75e344aSmrg# XORG_WITH_GROFF([DEFAULT])
2017c75e344aSmrg# ----------------
2018c75e344aSmrg# Minimum version: 1.6.0
2019c75e344aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2020c75e344aSmrg#
2021c75e344aSmrg# Documentation tools are not always available on all platforms and sometimes
2022c75e344aSmrg# not at the appropriate level. This macro enables a module to test for the
2023c75e344aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024c75e344aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025c75e344aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026c75e344aSmrg# --with-groff assumes 'auto'.
2027c75e344aSmrg#
2028c75e344aSmrg# Interface to module:
2029c75e344aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030c75e344aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031c75e344aSmrg# HAVE_GROFF_MS: the -ms macros package
2032c75e344aSmrg# GROFF:	 returns the path of the groff program found
2033c75e344aSmrg#		 returns the path set by the user in the environment
2034c75e344aSmrg# --with-groff:	 'yes' user instructs the module to use groff
2035c75e344aSmrg#		 'no' user instructs the module not to use groff
2036c75e344aSmrg#
2037c75e344aSmrg# Added in version 1.9.0:
2038c75e344aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039c75e344aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040c75e344aSmrg#		   psselect from the psutils package.
2041c75e344aSmrg#		   the ghostcript package. Refer to the grohtml man pages
2042c75e344aSmrg#
2043c75e344aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044c75e344aSmrg#
2045c75e344aSmrg# OS and distros often splits groff in a basic and full package, the former
2046c75e344aSmrg# having the groff program and the later having devices, fonts and macros
2047c75e344aSmrg# Checking for the groff executable is not enough.
2048c75e344aSmrg#
2049c75e344aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050c75e344aSmrg# unset HAVE_GROFF or GROFF env variables.
2051c75e344aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052c75e344aSmrg#
2053c75e344aSmrgAC_DEFUN([XORG_WITH_GROFF],[
2054c75e344aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055c75e344aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2056c75e344aSmrgAC_ARG_WITH(groff,
2057c75e344aSmrg	AS_HELP_STRING([--with-groff],
2058c75e344aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059c75e344aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2060c75e344aSmrgm4_undefine([_defopt])
2061c75e344aSmrg
2062c75e344aSmrgif test "x$use_groff" = x"auto"; then
2063c75e344aSmrg   AC_PATH_PROG([GROFF], [groff])
2064c75e344aSmrg   if test "x$GROFF" = "x"; then
2065c75e344aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066c75e344aSmrg	have_groff=no
2067c75e344aSmrg   else
2068c75e344aSmrg        have_groff=yes
2069c75e344aSmrg   fi
2070c75e344aSmrgelif test "x$use_groff" = x"yes" ; then
2071c75e344aSmrg   AC_PATH_PROG([GROFF], [groff])
2072c75e344aSmrg   if test "x$GROFF" = "x"; then
2073c75e344aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074c75e344aSmrg   fi
2075c75e344aSmrg   have_groff=yes
2076c75e344aSmrgelif test "x$use_groff" = x"no" ; then
2077c75e344aSmrg   if test "x$GROFF" != "x"; then
2078c75e344aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079c75e344aSmrg   fi
2080c75e344aSmrg   have_groff=no
2081c75e344aSmrgelse
2082c75e344aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083c75e344aSmrgfi
2084c75e344aSmrg
2085c75e344aSmrg# We have groff, test for the presence of the macro packages
2086c75e344aSmrgif test "x$have_groff" = x"yes"; then
2087c75e344aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088c75e344aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089c75e344aSmrg        groff_ms_works=yes
2090c75e344aSmrg    else
2091c75e344aSmrg        groff_ms_works=no
2092c75e344aSmrg    fi
2093c75e344aSmrg    AC_MSG_RESULT([$groff_ms_works])
2094c75e344aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095c75e344aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096c75e344aSmrg        groff_mm_works=yes
2097c75e344aSmrg    else
2098c75e344aSmrg        groff_mm_works=no
2099c75e344aSmrg    fi
2100c75e344aSmrg    AC_MSG_RESULT([$groff_mm_works])
2101c75e344aSmrgfi
2102c75e344aSmrg
2103c75e344aSmrg# We have groff, test for HTML dependencies, one command per package
2104c75e344aSmrgif test "x$have_groff" = x"yes"; then
2105c75e344aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106c75e344aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107c75e344aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108c75e344aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109c75e344aSmrg      have_groff_html=yes
2110c75e344aSmrg   else
2111c75e344aSmrg      have_groff_html=no
2112c75e344aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113c75e344aSmrg   fi
2114c75e344aSmrgfi
2115c75e344aSmrg
2116c75e344aSmrg# Set Automake conditionals for Makefiles
2117c75e344aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118c75e344aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119c75e344aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120c75e344aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121c75e344aSmrg]) # XORG_WITH_GROFF
2122c75e344aSmrg
21232f167a42Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21242f167a42Smrg# ---------------------------------------
2125c75e344aSmrg# Minimum version: 1.6.0
2126c75e344aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21272f167a42Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128c75e344aSmrg#
2129c75e344aSmrg# Documentation tools are not always available on all platforms and sometimes
2130c75e344aSmrg# not at the appropriate level. This macro enables a module to test for the
2131c75e344aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132c75e344aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133c75e344aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134c75e344aSmrg# --with-fop assumes 'auto'.
2135c75e344aSmrg#
2136c75e344aSmrg# Interface to module:
2137c75e344aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138c75e344aSmrg# FOP:	 	returns the path of the fop program found
2139c75e344aSmrg#		returns the path set by the user in the environment
2140c75e344aSmrg# --with-fop: 	'yes' user instructs the module to use fop
2141c75e344aSmrg#		'no' user instructs the module not to use fop
2142c75e344aSmrg#
2143c75e344aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144c75e344aSmrg#
2145c75e344aSmrgAC_DEFUN([XORG_WITH_FOP],[
2146c75e344aSmrgAC_ARG_VAR([FOP], [Path to fop command])
21472f167a42Smrgm4_define([_defopt], m4_default([$2], [auto]))
2148c75e344aSmrgAC_ARG_WITH(fop,
2149c75e344aSmrg	AS_HELP_STRING([--with-fop],
2150c75e344aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151c75e344aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2152c75e344aSmrgm4_undefine([_defopt])
2153c75e344aSmrg
2154c75e344aSmrgif test "x$use_fop" = x"auto"; then
2155c75e344aSmrg   AC_PATH_PROG([FOP], [fop])
2156c75e344aSmrg   if test "x$FOP" = "x"; then
2157c75e344aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158c75e344aSmrg	have_fop=no
2159c75e344aSmrg   else
2160c75e344aSmrg        have_fop=yes
2161c75e344aSmrg   fi
2162c75e344aSmrgelif test "x$use_fop" = x"yes" ; then
2163c75e344aSmrg   AC_PATH_PROG([FOP], [fop])
2164c75e344aSmrg   if test "x$FOP" = "x"; then
2165c75e344aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166c75e344aSmrg   fi
2167c75e344aSmrg   have_fop=yes
2168c75e344aSmrgelif test "x$use_fop" = x"no" ; then
2169c75e344aSmrg   if test "x$FOP" != "x"; then
2170c75e344aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171c75e344aSmrg   fi
2172c75e344aSmrg   have_fop=no
2173c75e344aSmrgelse
2174c75e344aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175c75e344aSmrgfi
21762f167a42Smrg
21772f167a42Smrg# Test for a minimum version of fop, if provided.
21782f167a42Smrgm4_ifval([$1],
21792f167a42Smrg[if test "$have_fop" = yes; then
21802f167a42Smrg    # scrape the fop version
21812f167a42Smrg    AC_MSG_CHECKING([for fop minimum version])
21822f167a42Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21832f167a42Smrg    AC_MSG_RESULT([$fop_version])
21842f167a42Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
21852f167a42Smrg        [if test "x$use_fop" = xauto; then
21862f167a42Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
21872f167a42Smrg            have_fop=no
21882f167a42Smrg        else
21892f167a42Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
21902f167a42Smrg        fi])
21912f167a42Smrgfi])
2192c75e344aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193c75e344aSmrg]) # XORG_WITH_FOP
2194c75e344aSmrg
21952f167a42Smrg# XORG_WITH_M4([MIN-VERSION])
21962f167a42Smrg# ---------------------------
21972f167a42Smrg# Minimum version: 1.19.0
21982f167a42Smrg#
21992f167a42Smrg# This macro attempts to locate an m4 macro processor which supports
22002f167a42Smrg# -I option and is only useful for modules relying on M4 in order to
22012f167a42Smrg# expand macros in source code files.
22022f167a42Smrg#
22032f167a42Smrg# Interface to module:
22042f167a42Smrg# M4:	 	returns the path of the m4 program found
22052f167a42Smrg#		returns the path set by the user in the environment
22062f167a42Smrg#
22072f167a42SmrgAC_DEFUN([XORG_WITH_M4], [
22082f167a42SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
22092f167a42Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
22102f167a42Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
22112f167a42Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
22122f167a42Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
22132f167a42Smrg   [$PATH:/usr/gnu/bin])])
22142f167a42Smrg
22152f167a42SmrgAC_SUBST([M4], [$ac_cv_path_M4])
22162f167a42Smrg]) # XORG_WITH_M4
22172f167a42Smrg
2218c75e344aSmrg# XORG_WITH_PS2PDF([DEFAULT])
2219c75e344aSmrg# ----------------
2220c75e344aSmrg# Minimum version: 1.6.0
2221c75e344aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2222c75e344aSmrg#
2223c75e344aSmrg# Documentation tools are not always available on all platforms and sometimes
2224c75e344aSmrg# not at the appropriate level. This macro enables a module to test for the
2225c75e344aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226c75e344aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227c75e344aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228c75e344aSmrg# --with-ps2pdf assumes 'auto'.
2229c75e344aSmrg#
2230c75e344aSmrg# Interface to module:
2231c75e344aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232c75e344aSmrg# PS2PDF:	returns the path of the ps2pdf program found
2233c75e344aSmrg#		returns the path set by the user in the environment
2234c75e344aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235c75e344aSmrg#		 'no' user instructs the module not to use ps2pdf
2236c75e344aSmrg#
2237c75e344aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238c75e344aSmrg#
2239c75e344aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240c75e344aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241c75e344aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2242c75e344aSmrgAC_ARG_WITH(ps2pdf,
2243c75e344aSmrg	AS_HELP_STRING([--with-ps2pdf],
2244c75e344aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245c75e344aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246c75e344aSmrgm4_undefine([_defopt])
2247c75e344aSmrg
2248c75e344aSmrgif test "x$use_ps2pdf" = x"auto"; then
2249c75e344aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250c75e344aSmrg   if test "x$PS2PDF" = "x"; then
2251c75e344aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252c75e344aSmrg	have_ps2pdf=no
2253c75e344aSmrg   else
2254c75e344aSmrg        have_ps2pdf=yes
2255c75e344aSmrg   fi
2256c75e344aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2257c75e344aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258c75e344aSmrg   if test "x$PS2PDF" = "x"; then
2259c75e344aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260c75e344aSmrg   fi
2261c75e344aSmrg   have_ps2pdf=yes
2262c75e344aSmrgelif test "x$use_ps2pdf" = x"no" ; then
2263c75e344aSmrg   if test "x$PS2PDF" != "x"; then
2264c75e344aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265c75e344aSmrg   fi
2266c75e344aSmrg   have_ps2pdf=no
2267c75e344aSmrgelse
2268c75e344aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269c75e344aSmrgfi
2270c75e344aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271c75e344aSmrg]) # XORG_WITH_PS2PDF
2272c75e344aSmrg
2273c75e344aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274c75e344aSmrg# ----------------
2275c75e344aSmrg# Minimum version: 1.6.0
2276c75e344aSmrg#
2277c75e344aSmrg# Documentation tools are not always available on all platforms and sometimes
2278c75e344aSmrg# not at the appropriate level. This macro enables a builder to skip all
2279c75e344aSmrg# documentation targets except traditional man pages.
2280c75e344aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281c75e344aSmrg# maximum flexibilty in controlling documentation building.
2282c75e344aSmrg# Refer to:
2283c75e344aSmrg# XORG_WITH_XMLTO         --with-xmlto
2284c75e344aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285c75e344aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2286c75e344aSmrg# XORG_WITH_FOP           --with-fop
2287c75e344aSmrg# XORG_WITH_GROFF         --with-groff
2288c75e344aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289c75e344aSmrg#
2290c75e344aSmrg# Interface to module:
2291c75e344aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292c75e344aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2293c75e344aSmrg#		 'no' user instructs the module not to generate docs
2294c75e344aSmrg# parm1:	specify the default value, yes or no.
2295c75e344aSmrg#
2296c75e344aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2297c75e344aSmrgm4_define([docs_default], m4_default([$1], [yes]))
2298c75e344aSmrgAC_ARG_ENABLE(docs,
2299c75e344aSmrg	AS_HELP_STRING([--enable-docs],
2300c75e344aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2301c75e344aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2302c75e344aSmrgm4_undefine([docs_default])
2303c75e344aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304c75e344aSmrgAC_MSG_CHECKING([whether to build documentation])
2305c75e344aSmrgAC_MSG_RESULT([$build_docs])
2306c75e344aSmrg]) # XORG_ENABLE_DOCS
2307c75e344aSmrg
2308c75e344aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309c75e344aSmrg# ----------------
2310c75e344aSmrg# Minimum version: 1.6.0
2311c75e344aSmrg#
2312c75e344aSmrg# This macro enables a builder to skip all developer documentation.
2313c75e344aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314c75e344aSmrg# maximum flexibilty in controlling documentation building.
2315c75e344aSmrg# Refer to:
2316c75e344aSmrg# XORG_WITH_XMLTO         --with-xmlto
2317c75e344aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318c75e344aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2319c75e344aSmrg# XORG_WITH_FOP           --with-fop
2320c75e344aSmrg# XORG_WITH_GROFF         --with-groff
2321c75e344aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322c75e344aSmrg#
2323c75e344aSmrg# Interface to module:
2324c75e344aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325c75e344aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326c75e344aSmrg#			'no' user instructs the module not to generate developer docs
2327c75e344aSmrg# parm1:		specify the default value, yes or no.
2328c75e344aSmrg#
2329c75e344aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330c75e344aSmrgm4_define([devel_default], m4_default([$1], [yes]))
2331c75e344aSmrgAC_ARG_ENABLE(devel-docs,
2332c75e344aSmrg	AS_HELP_STRING([--enable-devel-docs],
2333c75e344aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334c75e344aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335c75e344aSmrgm4_undefine([devel_default])
2336c75e344aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337c75e344aSmrgAC_MSG_CHECKING([whether to build developer documentation])
2338c75e344aSmrgAC_MSG_RESULT([$build_devel_docs])
2339c75e344aSmrg]) # XORG_ENABLE_DEVEL_DOCS
2340c75e344aSmrg
2341c75e344aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342c75e344aSmrg# ----------------
2343c75e344aSmrg# Minimum version: 1.6.0
2344c75e344aSmrg#
2345c75e344aSmrg# This macro enables a builder to skip all functional specification targets.
2346c75e344aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347c75e344aSmrg# maximum flexibilty in controlling documentation building.
2348c75e344aSmrg# Refer to:
2349c75e344aSmrg# XORG_WITH_XMLTO         --with-xmlto
2350c75e344aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351c75e344aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2352c75e344aSmrg# XORG_WITH_FOP           --with-fop
2353c75e344aSmrg# XORG_WITH_GROFF         --with-groff
2354c75e344aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355c75e344aSmrg#
2356c75e344aSmrg# Interface to module:
2357c75e344aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358c75e344aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2359c75e344aSmrg#			'no' user instructs the module not to generate specs
2360c75e344aSmrg# parm1:		specify the default value, yes or no.
2361c75e344aSmrg#
2362c75e344aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363c75e344aSmrgm4_define([spec_default], m4_default([$1], [yes]))
2364c75e344aSmrgAC_ARG_ENABLE(specs,
2365c75e344aSmrg	AS_HELP_STRING([--enable-specs],
2366c75e344aSmrg	   [Enable building the specs (default: ]spec_default[)]),
2367c75e344aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368c75e344aSmrgm4_undefine([spec_default])
2369c75e344aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370c75e344aSmrgAC_MSG_CHECKING([whether to build functional specifications])
2371c75e344aSmrgAC_MSG_RESULT([$build_specs])
2372c75e344aSmrg]) # XORG_ENABLE_SPECS
2373c75e344aSmrg
23742f167a42Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
23752f167a42Smrg# ----------------------------------------------
23762f167a42Smrg# Minimum version: 1.13.0
23773e6697d4Smrg#
23782f167a42Smrg# This macro enables a builder to enable/disable unit testing
23792f167a42Smrg# It makes no assumption about the test cases implementation
23802f167a42Smrg# Test cases may or may not use Automake "Support for test suites"
23812f167a42Smrg# They may or may not use the software utility library GLib
23822f167a42Smrg#
23832f167a42Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
23842f167a42Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
23852f167a42Smrg# The variable enable_unit_tests is used by other macros in this file.
23862f167a42Smrg#
23872f167a42Smrg# Interface to module:
23882f167a42Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
23892f167a42Smrg# enable_unit_tests:    used in configure.ac for additional configuration
23902f167a42Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
23912f167a42Smrg#			'no' user instructs the module not to build tests
23922f167a42Smrg# parm1:		specify the default value, yes or no.
23932f167a42Smrg#
23942f167a42SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
23952f167a42SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
23962f167a42SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
23972f167a42SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
23982f167a42Smrgm4_define([_defopt], m4_default([$1], [auto]))
23992f167a42SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
24002f167a42Smrg	[Enable building unit test cases (default: ]_defopt[)]),
24012f167a42Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
24022f167a42Smrgm4_undefine([_defopt])
24032f167a42SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
24042f167a42SmrgAC_MSG_CHECKING([whether to build unit test cases])
24052f167a42SmrgAC_MSG_RESULT([$enable_unit_tests])
24062f167a42Smrg]) # XORG_ENABLE_UNIT_TESTS
24072f167a42Smrg
24082f167a42Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24092f167a42Smrg# ------------------------------------------------------
24102f167a42Smrg# Minimum version: 1.17.0
24112f167a42Smrg#
24122f167a42Smrg# This macro enables a builder to enable/disable integration testing
24132f167a42Smrg# It makes no assumption about the test cases' implementation
24142f167a42Smrg# Test cases may or may not use Automake "Support for test suites"
24152f167a42Smrg#
24162f167a42Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24172f167a42Smrg# usually requires less dependencies and may be built and run under less
24182f167a42Smrg# stringent environments than integration tests.
24192f167a42Smrg#
24202f167a42Smrg# Interface to module:
24212f167a42Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24222f167a42Smrg# enable_integration_tests:   used in configure.ac for additional configuration
24232f167a42Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24242f167a42Smrg#                             'no' user instructs the module not to build tests
24252f167a42Smrg# parm1:                      specify the default value, yes or no.
24262f167a42Smrg#
24272f167a42SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24282f167a42SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24292f167a42Smrgm4_define([_defopt], m4_default([$1], [auto]))
24302f167a42SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24312f167a42Smrg	[Enable building integration test cases (default: ]_defopt[)]),
24322f167a42Smrg	[enable_integration_tests=$enableval],
24332f167a42Smrg	[enable_integration_tests=]_defopt)
24342f167a42Smrgm4_undefine([_defopt])
24352f167a42SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24362f167a42Smrg	[test "x$enable_integration_tests" != xno])
24372f167a42SmrgAC_MSG_CHECKING([whether to build unit test cases])
24382f167a42SmrgAC_MSG_RESULT([$enable_integration_tests])
24392f167a42Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
24402f167a42Smrg
24412f167a42Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24422f167a42Smrg# ----------------------------------------
24432f167a42Smrg# Minimum version: 1.13.0
24442f167a42Smrg#
24452f167a42Smrg# GLib is a library which provides advanced data structures and functions.
24462f167a42Smrg# This macro enables a module to test for the presence of Glib.
24472f167a42Smrg#
24482f167a42Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
24492f167a42Smrg# Otherwise the value of $enable_unit_tests is blank.
24502f167a42Smrg#
24512f167a42Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
24522f167a42Smrg# test support usually requires less dependencies and may be built and run under
24532f167a42Smrg# less stringent environments than integration tests.
24542f167a42Smrg#
24552f167a42Smrg# Interface to module:
24562f167a42Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
24572f167a42Smrg# with_glib: used in configure.ac to know if GLib has been found
24582f167a42Smrg# --with-glib:	'yes' user instructs the module to use glib
24592f167a42Smrg#		'no' user instructs the module not to use glib
24602f167a42Smrg#
24612f167a42SmrgAC_DEFUN([XORG_WITH_GLIB],[
24622f167a42SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
24632f167a42Smrgm4_define([_defopt], m4_default([$2], [auto]))
24642f167a42SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
24652f167a42Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
24662f167a42Smrg	[with_glib=$withval], [with_glib=]_defopt)
24672f167a42Smrgm4_undefine([_defopt])
24682f167a42Smrg
24692f167a42Smrghave_glib=no
24702f167a42Smrg# Do not probe GLib if user explicitly disabled unit testing
24712f167a42Smrgif test "x$enable_unit_tests" != x"no"; then
24722f167a42Smrg  # Do not probe GLib if user explicitly disabled it
24732f167a42Smrg  if test "x$with_glib" != x"no"; then
24742f167a42Smrg    m4_ifval(
24752f167a42Smrg      [$1],
24762f167a42Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
24772f167a42Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
24782f167a42Smrg    )
24792f167a42Smrg  fi
24802f167a42Smrgfi
24812f167a42Smrg
24822f167a42Smrg# Not having GLib when unit testing has been explicitly requested is an error
24832f167a42Smrgif test "x$enable_unit_tests" = x"yes"; then
24842f167a42Smrg  if test "x$have_glib" = x"no"; then
24852f167a42Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24862f167a42Smrg  fi
24872f167a42Smrgfi
24882f167a42Smrg
24892f167a42Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
24902f167a42Smrgif test "x$enable_unit_tests" = x"no"; then
24912f167a42Smrg  if test "x$with_glib" = x"yes"; then
24922f167a42Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24932f167a42Smrg  fi
24942f167a42Smrgfi
24952f167a42Smrg
24962f167a42Smrg# Not having GLib when it has been explicitly requested is an error
24972f167a42Smrgif test "x$with_glib" = x"yes"; then
24982f167a42Smrg  if test "x$have_glib" = x"no"; then
24992f167a42Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
25002f167a42Smrg  fi
25012f167a42Smrgfi
25022f167a42Smrg
25032f167a42SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
25042f167a42Smrg]) # XORG_WITH_GLIB
25052f167a42Smrg
25062f167a42Smrg# XORG_LD_WRAP([required|optional])
25072f167a42Smrg# ---------------------------------
25082f167a42Smrg# Minimum version: 1.13.0
25092f167a42Smrg#
25102f167a42Smrg# Check if linker supports -wrap, passed via compiler flags
25112f167a42Smrg#
25122f167a42Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25132f167a42Smrg# Otherwise the value of $enable_unit_tests is blank.
25142f167a42Smrg#
25152f167a42Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25162f167a42Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25172f167a42Smrg# available, an argument of "optional" allows use when some unit tests require
25182f167a42Smrg# ld -wrap and others do not.
25192f167a42Smrg#
25202f167a42SmrgAC_DEFUN([XORG_LD_WRAP],[
25212f167a42SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25222f167a42Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25232f167a42Smrg                      void __wrap_exit(int status) { return; }],
25242f167a42Smrg                     [exit(0);])])
25252f167a42Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
25262f167a42Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25272f167a42Smrg  if test "x$have_ld_wrap" = x"no"; then
25282f167a42Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25292f167a42Smrg  fi
25302f167a42Smrgfi
25312f167a42SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25322f167a42Smrg#
25332f167a42Smrg]) # XORG_LD_WRAP
25342f167a42Smrg
25352f167a42Smrg# XORG_CHECK_LINKER_FLAGS
25362f167a42Smrg# -----------------------
25372f167a42Smrg# SYNOPSIS
25382f167a42Smrg#
25392f167a42Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25402f167a42Smrg#
25412f167a42Smrg# DESCRIPTION
25422f167a42Smrg#
25432f167a42Smrg#   Check whether the given linker FLAGS work with the current language's
25442f167a42Smrg#   linker, or whether they give an error.
25452f167a42Smrg#
25462f167a42Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
25472f167a42Smrg#   success/failure.
25482f167a42Smrg#
25492f167a42Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
25502f167a42Smrg#
25512f167a42Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
25522f167a42Smrg#
25532f167a42Smrg# LICENSE
25542f167a42Smrg#
25552f167a42Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
25562f167a42Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
25572f167a42Smrg#   Copyright (c) 2009 Matteo Frigo
25582f167a42Smrg#
25592f167a42Smrg#   This program is free software: you can redistribute it and/or modify it
25602f167a42Smrg#   under the terms of the GNU General Public License as published by the
25612f167a42Smrg#   Free Software Foundation, either version 3 of the License, or (at your
25622f167a42Smrg#   option) any later version.
25632f167a42Smrg#
25642f167a42Smrg#   This program is distributed in the hope that it will be useful, but
25652f167a42Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
25662f167a42Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
25672f167a42Smrg#   Public License for more details.
25682f167a42Smrg#
25692f167a42Smrg#   You should have received a copy of the GNU General Public License along
25702f167a42Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
25712f167a42Smrg#
25722f167a42Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
25732f167a42Smrg#   gives unlimited permission to copy, distribute and modify the configure
25742f167a42Smrg#   scripts that are the output of Autoconf when processing the Macro. You
25752f167a42Smrg#   need not follow the terms of the GNU General Public License when using
25762f167a42Smrg#   or distributing such scripts, even though portions of the text of the
25772f167a42Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
25782f167a42Smrg#   all other use of the material that constitutes the Autoconf Macro.
25792f167a42Smrg#
25802f167a42Smrg#   This special exception to the GPL applies to versions of the Autoconf
25812f167a42Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
25822f167a42Smrg#   modified version of the Autoconf Macro, you may extend this special
25832f167a42Smrg#   exception to the GPL to apply to your modified version as well.#
25842f167a42SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
25852f167a42Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
25862f167a42Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
25872f167a42SmrgAS_LITERAL_IF([$1],
25882f167a42Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
25892f167a42Smrg      ax_save_FLAGS=$LDFLAGS
25902f167a42Smrg      LDFLAGS="$1"
25912f167a42Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
25922f167a42Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25932f167a42Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25942f167a42Smrg      LDFLAGS=$ax_save_FLAGS])],
25952f167a42Smrg  [ax_save_FLAGS=$LDFLAGS
25962f167a42Smrg   LDFLAGS="$1"
25972f167a42Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
25982f167a42Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25992f167a42Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26002f167a42Smrg   LDFLAGS=$ax_save_FLAGS])
26012f167a42Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
26022f167a42SmrgAC_MSG_RESULT($xorg_check_linker_flags)
26032f167a42Smrgif test "x$xorg_check_linker_flags" = xyes; then
26042f167a42Smrg	m4_default([$2], :)
26052f167a42Smrgelse
26062f167a42Smrg	m4_default([$3], :)
26072f167a42Smrgfi
26082f167a42Smrg]) # XORG_CHECK_LINKER_FLAGS
26092f167a42Smrg
26102f167a42Smrg# XORG_MEMORY_CHECK_FLAGS
26112f167a42Smrg# -----------------------
26122f167a42Smrg# Minimum version: 1.16.0
26132f167a42Smrg#
26142f167a42Smrg# This macro attempts to find appropriate memory checking functionality
26152f167a42Smrg# for various platforms which unit testing code may use to catch various
26162f167a42Smrg# forms of memory allocation and access errors in testing.
26172f167a42Smrg#
26182f167a42Smrg# Interface to module:
26192f167a42Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26202f167a42Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26212f167a42Smrg#
26222f167a42Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26232f167a42Smrg#
26242f167a42SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26252f167a42Smrg
26262f167a42SmrgAC_REQUIRE([AC_CANONICAL_HOST])
26272f167a42SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26282f167a42Smrg           [Environment variables to enable memory checking in tests])
26292f167a42Smrg
26302f167a42Smrg# Check for different types of support on different platforms
26312f167a42Smrgcase $host_os in
26322f167a42Smrg    solaris*)
26332f167a42Smrg        AC_CHECK_LIB([umem], [umem_alloc],
26342f167a42Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26352f167a42Smrg        ;;
26362f167a42Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26372f167a42Smrg        # both directly and inverted, so should not be 0 or 255.
26382f167a42Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
26392f167a42Smrg        ;;
26402f167a42Smrg    darwin*)
26412f167a42Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26422f167a42Smrg        ;;
26432f167a42Smrg    *bsd*)
26442f167a42Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
26452f167a42Smrg        ;;
26462f167a42Smrgesac
26472f167a42Smrg
26482f167a42Smrg# User supplied flags override default flags
26492f167a42Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
26502f167a42Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
26512f167a42Smrgfi
26522f167a42Smrg
26532f167a42SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
26542f167a42Smrg]) # XORG_WITH_LINT
26552f167a42Smrg
26562f167a42Smrg# XORG_CHECK_MALLOC_ZERO
26572f167a42Smrg# ----------------------
26582f167a42Smrg# Minimum version: 1.0.0
26592f167a42Smrg#
26602f167a42Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26610e20ee16Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26620e20ee16Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26630e20ee16SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26640e20ee16SmrgAC_ARG_ENABLE(malloc0returnsnull,
26653e6697d4Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26660e20ee16Smrg		       [malloc(0) returns NULL (default: auto)]),
26670e20ee16Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26680e20ee16Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26690e20ee16Smrg
26700e20ee16SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26710e20ee16Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
26722f167a42SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
26732f167a42Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2674c75e344aSmrg#include <stdlib.h>
2675c75e344aSmrg],[
26760e20ee16Smrg    char *m0, *r0, *c0, *p;
26770e20ee16Smrg    m0 = malloc(0);
26780e20ee16Smrg    p = malloc(10);
26790e20ee16Smrg    r0 = realloc(p,0);
2680c75e344aSmrg    c0 = calloc(0,10);
2681c75e344aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2682c75e344aSmrg])],
26832f167a42Smrg		[xorg_cv_malloc0_returns_null=yes],
26842f167a42Smrg		[xorg_cv_malloc0_returns_null=no])])
26852f167a42SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
26860e20ee16Smrgfi
26870e20ee16SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26880e20ee16Smrg
26890e20ee16Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26900e20ee16Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26910e20ee16Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26920e20ee16Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26930e20ee16Smrgelse
26940e20ee16Smrg	MALLOC_ZERO_CFLAGS=""
26950e20ee16Smrg	XMALLOC_ZERO_CFLAGS=""
26960e20ee16Smrg	XTMALLOC_ZERO_CFLAGS=""
26970e20ee16Smrgfi
26980e20ee16Smrg
26990e20ee16SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
27000e20ee16SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
27010e20ee16SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
27020e20ee16Smrg]) # XORG_CHECK_MALLOC_ZERO
27030e20ee16Smrg
27043e6697d4Smrg# XORG_WITH_LINT()
27053e6697d4Smrg# ----------------
27063e6697d4Smrg# Minimum version: 1.1.0
27073e6697d4Smrg#
2708c75e344aSmrg# This macro enables the use of a tool that flags some suspicious and
2709c75e344aSmrg# non-portable constructs (likely to be bugs) in C language source code.
2710c75e344aSmrg# It will attempt to locate the tool and use appropriate options.
2711c75e344aSmrg# There are various lint type tools on different platforms.
2712c75e344aSmrg#
2713c75e344aSmrg# Interface to module:
2714c75e344aSmrg# LINT:		returns the path to the tool found on the platform
2715c75e344aSmrg#		or the value set to LINT on the configure cmd line
2716c75e344aSmrg#		also an Automake conditional
2717c75e344aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718c75e344aSmrg#
2719c75e344aSmrg# --with-lint:	'yes' user instructs the module to use lint
2720c75e344aSmrg#		'no' user instructs the module not to use lint (default)
2721c75e344aSmrg#
2722c75e344aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723c75e344aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27243e6697d4Smrg#
27253e6697d4SmrgAC_DEFUN([XORG_WITH_LINT],[
27263e6697d4Smrg
2727c75e344aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728c75e344aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27293e6697d4SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27303e6697d4Smrg		[Use a lint-style source code checker (default: disabled)])],
27313e6697d4Smrg		[use_lint=$withval], [use_lint=no])
2732c75e344aSmrg
2733c75e344aSmrg# Obtain platform specific info like program name and options
2734c75e344aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735c75e344aSmrgcase $host_os in
2736c75e344aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737c75e344aSmrg	lint_name=splint
2738c75e344aSmrg	lint_options="-badflag"
2739c75e344aSmrg	;;
2740c75e344aSmrg  *freebsd* | *netbsd*)
2741c75e344aSmrg	lint_name=lint
2742c75e344aSmrg	lint_options="-u -b"
2743c75e344aSmrg	;;
2744c75e344aSmrg  *solaris*)
2745c75e344aSmrg	lint_name=lint
2746c75e344aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747c75e344aSmrg	;;
2748c75e344aSmrgesac
2749c75e344aSmrg
2750c75e344aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751c75e344aSmrgif test "x$use_lint" = x"yes" ; then
2752c75e344aSmrg   AC_PATH_PROG([LINT], [$lint_name])
2753c75e344aSmrg   if test "x$LINT" = "x"; then
2754c75e344aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755c75e344aSmrg   fi
2756c75e344aSmrgelif test "x$use_lint" = x"no" ; then
2757c75e344aSmrg   if test "x$LINT" != "x"; then
2758c75e344aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759c75e344aSmrg   fi
27603e6697d4Smrgelse
2761c75e344aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27623e6697d4Smrgfi
2763c75e344aSmrg
2764c75e344aSmrg# User supplied flags override default flags
2765c75e344aSmrgif test "x$LINT_FLAGS" != "x"; then
2766c75e344aSmrg   lint_options=$LINT_FLAGS
27673e6697d4Smrgfi
27683e6697d4Smrg
2769c75e344aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770c75e344aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27713e6697d4Smrg
27723e6697d4Smrg]) # XORG_WITH_LINT
27733e6697d4Smrg
27743e6697d4Smrg# XORG_LINT_LIBRARY(LIBNAME)
27753e6697d4Smrg# --------------------------
27763e6697d4Smrg# Minimum version: 1.1.0
27773e6697d4Smrg#
27783e6697d4Smrg# Sets up flags for building lint libraries for checking programs that call
27793e6697d4Smrg# functions in the library.
27803e6697d4Smrg#
2781c75e344aSmrg# Interface to module:
2782c75e344aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2783c75e344aSmrg# MAKE_LINT_LIB		- Automake conditional
2784c75e344aSmrg#
2785c75e344aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786c75e344aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
27873e6697d4Smrg
27883e6697d4SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27893e6697d4SmrgAC_REQUIRE([XORG_WITH_LINT])
27903e6697d4SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27913e6697d4Smrg	[Create lint library (default: disabled)])],
27923e6697d4Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793c75e344aSmrg
2794c75e344aSmrgif test "x$make_lint_lib" = x"yes" ; then
2795c75e344aSmrg   LINTLIB=llib-l$1.ln
2796c75e344aSmrg   if test "x$LINT" = "x"; then
2797c75e344aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798c75e344aSmrg   fi
2799c75e344aSmrgelif test "x$make_lint_lib" != x"no" ; then
2800c75e344aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
28013e6697d4Smrgfi
2802c75e344aSmrg
28033e6697d4SmrgAC_SUBST(LINTLIB)
28043e6697d4SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
28053e6697d4Smrg
28063e6697d4Smrg]) # XORG_LINT_LIBRARY
28073e6697d4Smrg
28082f167a42Smrg# XORG_COMPILER_BRAND
28092f167a42Smrg# -------------------
28102f167a42Smrg# Minimum version: 1.14.0
28112f167a42Smrg#
28122f167a42Smrg# Checks for various brands of compilers and sets flags as appropriate:
28132f167a42Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28142f167a42Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28152f167a42Smrg#   clang compiler - sets CLANGCC to "yes"
28162f167a42Smrg#   Intel compiler - sets INTELCC to "yes"
28172f167a42Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28182f167a42Smrg#
28192f167a42SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28202f167a42SmrgAC_LANG_CASE(
28212f167a42Smrg	[C], [
28222f167a42Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28232f167a42Smrg	],
28242f167a42Smrg	[C++], [
28252f167a42Smrg		AC_REQUIRE([AC_PROG_CXX])
28262f167a42Smrg	]
28272f167a42Smrg)
28282f167a42SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28292f167a42SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28302f167a42SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28312f167a42Smrg]) # XORG_COMPILER_BRAND
28322f167a42Smrg
28332f167a42Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
28342f167a42Smrg# ---------------
28352f167a42Smrg# Minimum version: 1.16.0
28362f167a42Smrg#
28372f167a42Smrg# Test if the compiler works when passed the given flag as a command line argument.
28382f167a42Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28392f167a42Smrg# next flag in the list until there are no more options.
28402f167a42Smrg#
28412f167a42Smrg# Note that this does not guarantee that the compiler supports the flag as some
28422f167a42Smrg# compilers will simply ignore arguments that they do not understand, but we do
28432f167a42Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
28442f167a42Smrg# -Werror=unused-command-line-argument
28452f167a42Smrg#
28462f167a42SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
28472f167a42Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28482f167a42Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28492f167a42Smrg
28502f167a42SmrgAC_LANG_COMPILER_REQUIRE
28512f167a42Smrg
28522f167a42SmrgAC_LANG_CASE(
28532f167a42Smrg	[C], [
28542f167a42Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28552f167a42Smrg		define([PREFIX], [C])
28562f167a42Smrg		define([CACHE_PREFIX], [cc])
28572f167a42Smrg		define([COMPILER], [$CC])
28582f167a42Smrg	],
28592f167a42Smrg	[C++], [
28602f167a42Smrg		define([PREFIX], [CXX])
28612f167a42Smrg		define([CACHE_PREFIX], [cxx])
28622f167a42Smrg		define([COMPILER], [$CXX])
28632f167a42Smrg	]
28642f167a42Smrg)
28652f167a42Smrg
28662f167a42Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
28672f167a42Smrg
28682f167a42Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
28692f167a42Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28702f167a42Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
28712f167a42Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
28722f167a42Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28732f167a42Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
28742f167a42Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
28752f167a42Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
28762f167a42Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28772f167a42Smrgfi
28782f167a42Smrg
28792f167a42Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
28802f167a42Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
28812f167a42Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28822f167a42Smrg	fi
28832f167a42Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28842f167a42Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
28852f167a42Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
28862f167a42Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28872f167a42Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
28882f167a42Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
28892f167a42Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
28902f167a42Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28912f167a42Smrgfi
28922f167a42Smrg
28932f167a42Smrgfound="no"
28942f167a42Smrgm4_foreach([flag], m4_cdr($@), [
28952f167a42Smrg	if test $found = "no" ; then
28962f167a42Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
28972f167a42Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28982f167a42Smrg		fi
28992f167a42Smrg
29002f167a42Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
29012f167a42Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29022f167a42Smrg		fi
29032f167a42Smrg
29042f167a42Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
29052f167a42Smrg
29062f167a42Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
29072f167a42Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
29082f167a42Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29092f167a42Smrg		AC_CACHE_VAL($cacheid,
29102f167a42Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29112f167a42Smrg					     [eval $cacheid=yes],
29122f167a42Smrg					     [eval $cacheid=no])])
29132f167a42Smrg
29142f167a42Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29152f167a42Smrg
29162f167a42Smrg		eval supported=\$$cacheid
29172f167a42Smrg		AC_MSG_RESULT([$supported])
29182f167a42Smrg		if test "$supported" = "yes" ; then
29192f167a42Smrg			$1="$$1 ]flag["
29202f167a42Smrg			found="yes"
29212f167a42Smrg		fi
29222f167a42Smrg	fi
29232f167a42Smrg])
29242f167a42Smrg]) # XORG_TESTSET_CFLAG
29252f167a42Smrg
29262f167a42Smrg# XORG_COMPILER_FLAGS
29272f167a42Smrg# ---------------
29282f167a42Smrg# Minimum version: 1.16.0
29292f167a42Smrg#
29302f167a42Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29312f167a42Smrg# arguments supported by the selected compiler which do NOT alter the generated
29322f167a42Smrg# code.  These arguments will cause the compiler to print various warnings
29332f167a42Smrg# during compilation AND turn a conservative set of warnings into errors.
29342f167a42Smrg#
29352f167a42Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29362f167a42Smrg# future versions of util-macros as options are added to new compilers.
29372f167a42Smrg#
29382f167a42SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29392f167a42SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
29402f167a42Smrg
29412f167a42SmrgAC_ARG_ENABLE(selective-werror,
29422f167a42Smrg              AS_HELP_STRING([--disable-selective-werror],
29432f167a42Smrg                             [Turn off selective compiler errors. (default: enabled)]),
29442f167a42Smrg              [SELECTIVE_WERROR=$enableval],
29452f167a42Smrg              [SELECTIVE_WERROR=yes])
29462f167a42Smrg
29472f167a42SmrgAC_LANG_CASE(
29482f167a42Smrg        [C], [
29492f167a42Smrg                define([PREFIX], [C])
29502f167a42Smrg        ],
29512f167a42Smrg        [C++], [
29522f167a42Smrg                define([PREFIX], [CXX])
29532f167a42Smrg        ]
29542f167a42Smrg)
29552f167a42Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
29562f167a42Smrgif test "x$SUNCC" = "xyes"; then
29572f167a42Smrg    [BASE_]PREFIX[FLAGS]="-v"
29582f167a42Smrgelse
29592f167a42Smrg    [BASE_]PREFIX[FLAGS]=""
29602f167a42Smrgfi
29612f167a42Smrg
29622f167a42Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
29632f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
29642f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
29652f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
29662f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
29672f167a42Smrg
29682f167a42SmrgAC_LANG_CASE(
29692f167a42Smrg	[C], [
29702f167a42Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
29712f167a42Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
29722f167a42Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
29732f167a42Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
29742f167a42Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
29752f167a42Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
29762f167a42Smrg	]
29772f167a42Smrg)
29782f167a42Smrg
29792f167a42Smrg# This chunk adds additional warnings that could catch undesired effects.
29802f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
29812f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
29822f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
29832f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
29842f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
29852f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
29862f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
29872f167a42Smrg
29882f167a42Smrg# These are currently disabled because they are noisy.  They will be enabled
29892f167a42Smrg# in the future once the codebase is sufficiently modernized to silence
29902f167a42Smrg# them.  For now, I don't want them to drown out the other warnings.
29912f167a42Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
29922f167a42Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
29932f167a42Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
29942f167a42Smrg
29952f167a42Smrg# Turn some warnings into errors, so we don't accidently get successful builds
29962f167a42Smrg# when there are problems that should be fixed.
29972f167a42Smrg
29982f167a42Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
29992f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
30002f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
30012f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
30022f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
30032f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
30042f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
30052f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
30062f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
30072f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
30082f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30092f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30102f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30112f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30122f167a42Smrgelse
30132f167a42SmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
30142f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30152f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30162f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30172f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30182f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30192f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30202f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30212f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30222f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30232f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30242f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30252f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30262f167a42SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30272f167a42Smrgfi
30282f167a42Smrg
30292f167a42SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30302f167a42Smrg]) # XORG_COMPILER_FLAGS
30312f167a42Smrg
30323e6697d4Smrg# XORG_CWARNFLAGS
30333e6697d4Smrg# ---------------
30343e6697d4Smrg# Minimum version: 1.2.0
30352f167a42Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30363e6697d4Smrg#
30373e6697d4Smrg# Defines CWARNFLAGS to enable C compiler warnings.
30383e6697d4Smrg#
30392f167a42Smrg# This function is deprecated because it defines -fno-strict-aliasing
30402f167a42Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30412f167a42Smrg# is needed, then it should be added explicitly in the module when
30422f167a42Smrg# it is updated to use BASE_CFLAGS.
30432f167a42Smrg#
30443e6697d4SmrgAC_DEFUN([XORG_CWARNFLAGS], [
30452f167a42SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30462f167a42SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30472f167a42SmrgAC_LANG_CASE(
30482f167a42Smrg	[C], [
30492f167a42Smrg		CWARNFLAGS="$BASE_CFLAGS"
30502f167a42Smrg		if  test "x$GCC" = xyes ; then
30512f167a42Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30522f167a42Smrg		fi
30532f167a42Smrg		AC_SUBST(CWARNFLAGS)
30542f167a42Smrg	]
30552f167a42Smrg)
30563e6697d4Smrg]) # XORG_CWARNFLAGS
30573e6697d4Smrg
30583e6697d4Smrg# XORG_STRICT_OPTION
30593e6697d4Smrg# -----------------------
30603e6697d4Smrg# Minimum version: 1.3.0
30613e6697d4Smrg#
30622f167a42Smrg# Add configure option to enable strict compilation flags, such as treating
30632f167a42Smrg# warnings as fatal errors.
30642f167a42Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
30652f167a42Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30662f167a42Smrg#
30672f167a42Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30682f167a42Smrg# when strict compilation is unconditionally desired.
30693e6697d4SmrgAC_DEFUN([XORG_STRICT_OPTION], [
30703e6697d4SmrgAC_REQUIRE([XORG_CWARNFLAGS])
30712f167a42SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30723e6697d4Smrg
30733e6697d4SmrgAC_ARG_ENABLE(strict-compilation,
30743e6697d4Smrg			  AS_HELP_STRING([--enable-strict-compilation],
30753e6697d4Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
30763e6697d4Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
30772f167a42Smrg
30782f167a42SmrgAC_LANG_CASE(
30792f167a42Smrg        [C], [
30802f167a42Smrg                define([PREFIX], [C])
30812f167a42Smrg        ],
30822f167a42Smrg        [C++], [
30832f167a42Smrg                define([PREFIX], [CXX])
30842f167a42Smrg        ]
30852f167a42Smrg)
30862f167a42Smrg
30872f167a42Smrg[STRICT_]PREFIX[FLAGS]=""
30882f167a42SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
30892f167a42SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
30902f167a42Smrg
30912f167a42Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
30922f167a42Smrg# activate it with -Werror, so we add it here explicitly.
30932f167a42SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
30942f167a42Smrg
30953e6697d4Smrgif test "x$STRICT_COMPILE" = "xyes"; then
30962f167a42Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
30972f167a42Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30983e6697d4Smrgfi
30992f167a42SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
31002f167a42SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31012f167a42SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
31023e6697d4Smrg]) # XORG_STRICT_OPTION
31033e6697d4Smrg
31043e6697d4Smrg# XORG_DEFAULT_OPTIONS
31053e6697d4Smrg# --------------------
31063e6697d4Smrg# Minimum version: 1.3.0
31073e6697d4Smrg#
31083e6697d4Smrg# Defines default options for X.Org modules.
31093e6697d4Smrg#
31103e6697d4SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111c75e344aSmrgAC_REQUIRE([AC_PROG_INSTALL])
31122f167a42SmrgXORG_COMPILER_FLAGS
31133e6697d4SmrgXORG_CWARNFLAGS
31143e6697d4SmrgXORG_STRICT_OPTION
31153e6697d4SmrgXORG_RELEASE_VERSION
31163e6697d4SmrgXORG_CHANGELOG
3117c75e344aSmrgXORG_INSTALL
31183e6697d4SmrgXORG_MANPAGE_SECTIONS
3119c75e344aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120c75e344aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31213e6697d4Smrg]) # XORG_DEFAULT_OPTIONS
3122c75e344aSmrg
3123c75e344aSmrg# XORG_INSTALL()
3124c75e344aSmrg# ----------------
3125c75e344aSmrg# Minimum version: 1.4.0
3126c75e344aSmrg#
3127c75e344aSmrg# Defines the variable INSTALL_CMD as the command to copy
3128c75e344aSmrg# INSTALL from $prefix/share/util-macros.
3129c75e344aSmrg#
3130c75e344aSmrgAC_DEFUN([XORG_INSTALL], [
3131c75e344aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132c75e344aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133c75e344aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134c75e344aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135c75e344aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136c75e344aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137c75e344aSmrgAC_SUBST([INSTALL_CMD])
3138c75e344aSmrg]) # XORG_INSTALL
31390e20ee16Smrgdnl Copyright 2005 Red Hat, Inc
31400e20ee16Smrgdnl
31410e20ee16Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31420e20ee16Smrgdnl documentation for any purpose is hereby granted without fee, provided that
31430e20ee16Smrgdnl the above copyright notice appear in all copies and that both that
31440e20ee16Smrgdnl copyright notice and this permission notice appear in supporting
31450e20ee16Smrgdnl documentation.
31460e20ee16Smrgdnl
31470e20ee16Smrgdnl The above copyright notice and this permission notice shall be included
31480e20ee16Smrgdnl in all copies or substantial portions of the Software.
31490e20ee16Smrgdnl
31500e20ee16Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31510e20ee16Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31520e20ee16Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31530e20ee16Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31540e20ee16Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31550e20ee16Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31560e20ee16Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
31570e20ee16Smrgdnl
31580e20ee16Smrgdnl Except as contained in this notice, the name of the copyright holders shall
31590e20ee16Smrgdnl not be used in advertising or otherwise to promote the sale, use or
31600e20ee16Smrgdnl other dealings in this Software without prior written authorization
31610e20ee16Smrgdnl from the copyright holders.
31620e20ee16Smrgdnl
31630e20ee16Smrg
31640e20ee16Smrg# XORG_RELEASE_VERSION
31650e20ee16Smrg# --------------------
3166c75e344aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31672f167a42Smrg
31680e20ee16SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31693e6697d4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31703e6697d4Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31713e6697d4Smrg		[Major version of this package])
31723e6697d4Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31733e6697d4Smrg	if test "x$PVM" = "x"; then
31743e6697d4Smrg		PVM="0"
31753e6697d4Smrg	fi
31763e6697d4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31773e6697d4Smrg		[$PVM],
31783e6697d4Smrg		[Minor version of this package])
31793e6697d4Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31803e6697d4Smrg	if test "x$PVP" = "x"; then
31813e6697d4Smrg		PVP="0"
31823e6697d4Smrg	fi
31833e6697d4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31843e6697d4Smrg		[$PVP],
31853e6697d4Smrg		[Patch version of this package])
31860e20ee16Smrg])
31870e20ee16Smrg
31883e6697d4Smrg# XORG_CHANGELOG()
31893e6697d4Smrg# ----------------
31903e6697d4Smrg# Minimum version: 1.2.0
31913e6697d4Smrg#
31923e6697d4Smrg# Defines the variable CHANGELOG_CMD as the command to generate
31933e6697d4Smrg# ChangeLog from git.
31943e6697d4Smrg#
31953e6697d4Smrg#
31963e6697d4SmrgAC_DEFUN([XORG_CHANGELOG], [
3197c75e344aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198c75e344aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199c75e344aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
32003e6697d4Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
32013e6697d4SmrgAC_SUBST([CHANGELOG_CMD])
32023e6697d4Smrg]) # XORG_CHANGELOG
32033e6697d4Smrg
3204