aclocal.m4 revision 6d36ef34
16d36ef34Smrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
26d36ef34Smrg
36d36ef34Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
41abf7346Smrg
51abf7346Smrg# This file is free software; the Free Software Foundation
61abf7346Smrg# gives unlimited permission to copy and/or distribute it,
71abf7346Smrg# with or without modifications, as long as this notice is preserved.
81abf7346Smrg
91abf7346Smrg# This program is distributed in the hope that it will be useful,
101abf7346Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111abf7346Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121abf7346Smrg# PARTICULAR PURPOSE.
131abf7346Smrg
146d36ef34Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158b6d6341Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168b6d6341Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1723a8d56dSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1823a8d56dSmrg[m4_warning([this file was generated for autoconf 2.68.
198b6d6341SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208b6d6341SmrgIf you have problems, you may need to regenerate the build system entirely.
216d36ef34SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
221abf7346Smrg
236d36ef34Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
241abf7346Smrg#
258b6d6341Smrg# This file is free software; the Free Software Foundation
268b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
278b6d6341Smrg# with or without modifications, as long as this notice is preserved.
281abf7346Smrg
298b6d6341Smrg# AM_AUTOMAKE_VERSION(VERSION)
308b6d6341Smrg# ----------------------------
318b6d6341Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
328b6d6341Smrg# generated from the m4 files accompanying Automake X.Y.
338b6d6341Smrg# (This private macro should not be called outside this file.)
348b6d6341SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
356d36ef34Smrg[am__api_version='1.14'
368b6d6341Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
378b6d6341Smrgdnl require some minimum version.  Point them to the right macro.
386d36ef34Smrgm4_if([$1], [1.14], [],
398b6d6341Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
408b6d6341Smrg])
411abf7346Smrg
428b6d6341Smrg# _AM_AUTOCONF_VERSION(VERSION)
438b6d6341Smrg# -----------------------------
448b6d6341Smrg# aclocal traces this macro to find the Autoconf version.
458b6d6341Smrg# This is a private macro too.  Using m4_define simplifies
468b6d6341Smrg# the logic in aclocal, which can simply ignore this definition.
478b6d6341Smrgm4_define([_AM_AUTOCONF_VERSION], [])
481abf7346Smrg
498b6d6341Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
508b6d6341Smrg# -------------------------------
518b6d6341Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
528b6d6341Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
538b6d6341SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
546d36ef34Smrg[AM_AUTOMAKE_VERSION([1.14])dnl
558b6d6341Smrgm4_ifndef([AC_AUTOCONF_VERSION],
568b6d6341Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
578b6d6341Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
581abf7346Smrg
598b6d6341Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
601abf7346Smrg
616d36ef34Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
628b6d6341Smrg#
638b6d6341Smrg# This file is free software; the Free Software Foundation
648b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
658b6d6341Smrg# with or without modifications, as long as this notice is preserved.
661abf7346Smrg
678b6d6341Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
686d36ef34Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
696d36ef34Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
701abf7346Smrg#
718b6d6341Smrg# Of course, Automake must honor this variable whenever it calls a
728b6d6341Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
738b6d6341Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
748b6d6341Smrg# depending on how configure is run.  This is pretty annoying, since
758b6d6341Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
768b6d6341Smrg# source directory, any form will work fine, but in subdirectories a
778b6d6341Smrg# relative path needs to be adjusted first.
781abf7346Smrg#
798b6d6341Smrg# $ac_aux_dir/missing
808b6d6341Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
818b6d6341Smrg# $top_srcdir/$ac_aux_dir/missing
828b6d6341Smrg#    fails if $ac_aux_dir is absolute,
838b6d6341Smrg#    fails when called from a subdirectory in a VPATH build with
848b6d6341Smrg#          a relative $ac_aux_dir
851abf7346Smrg#
868b6d6341Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
878b6d6341Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
886d36ef34Smrg# harmless because $srcdir is '.', but things will broke when you
898b6d6341Smrg# start a VPATH build or use an absolute $srcdir.
901abf7346Smrg#
918b6d6341Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
928b6d6341Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
938b6d6341Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
948b6d6341Smrg# and then we would define $MISSING as
958b6d6341Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
968b6d6341Smrg# This will work as long as MISSING is not called from configure, because
978b6d6341Smrg# unfortunately $(top_srcdir) has no meaning in configure.
988b6d6341Smrg# However there are other variables, like CC, which are often used in
998b6d6341Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1008b6d6341Smrg#
1018b6d6341Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1028b6d6341Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1038b6d6341Smrg# configured tree to be moved without reconfiguration.
1041abf7346Smrg
1058b6d6341SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1068b6d6341Smrg[dnl Rely on autoconf to set up CDPATH properly.
1078b6d6341SmrgAC_PREREQ([2.50])dnl
1088b6d6341Smrg# expand $ac_aux_dir to an absolute path
1098b6d6341Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
1108b6d6341Smrg])
1111abf7346Smrg
1128b6d6341Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1131abf7346Smrg
1146d36ef34Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
1158b6d6341Smrg#
1168b6d6341Smrg# This file is free software; the Free Software Foundation
1178b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
1188b6d6341Smrg# with or without modifications, as long as this notice is preserved.
1191abf7346Smrg
1208b6d6341Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1218b6d6341Smrg# -------------------------------------
1228b6d6341Smrg# Define a conditional.
1238b6d6341SmrgAC_DEFUN([AM_CONDITIONAL],
1246d36ef34Smrg[AC_PREREQ([2.52])dnl
1256d36ef34Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1266d36ef34Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1278b6d6341SmrgAC_SUBST([$1_TRUE])dnl
1288b6d6341SmrgAC_SUBST([$1_FALSE])dnl
1298b6d6341Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1308b6d6341Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1318b6d6341Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1328b6d6341Smrgif $2; then
1338b6d6341Smrg  $1_TRUE=
1348b6d6341Smrg  $1_FALSE='#'
1358b6d6341Smrgelse
1368b6d6341Smrg  $1_TRUE='#'
1378b6d6341Smrg  $1_FALSE=
1388b6d6341Smrgfi
1398b6d6341SmrgAC_CONFIG_COMMANDS_PRE(
1408b6d6341Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1418b6d6341Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1428b6d6341SmrgUsually this means the macro was only invoked conditionally.]])
1438b6d6341Smrgfi])])
1441abf7346Smrg
1456d36ef34Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1468b6d6341Smrg#
1478b6d6341Smrg# This file is free software; the Free Software Foundation
1488b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
1498b6d6341Smrg# with or without modifications, as long as this notice is preserved.
1501abf7346Smrg
1511abf7346Smrg
1526d36ef34Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1538b6d6341Smrg# written in clear, in which case automake, when reading aclocal.m4,
1548b6d6341Smrg# will think it sees a *use*, and therefore will trigger all it's
1558b6d6341Smrg# C support machinery.  Also note that it means that autoscan, seeing
1568b6d6341Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1571abf7346Smrg
1581abf7346Smrg
1598b6d6341Smrg# _AM_DEPENDENCIES(NAME)
1608b6d6341Smrg# ----------------------
1618b6d6341Smrg# See how the compiler implements dependency checking.
1626d36ef34Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1638b6d6341Smrg# We try a few techniques and use that to set a single cache variable.
1648b6d6341Smrg#
1658b6d6341Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1668b6d6341Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1678b6d6341Smrg# dependency, and given that the user is not expected to run this macro,
1688b6d6341Smrg# just rely on AC_PROG_CC.
1698b6d6341SmrgAC_DEFUN([_AM_DEPENDENCIES],
1708b6d6341Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1718b6d6341SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1728b6d6341SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1738b6d6341SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1741abf7346Smrg
1756d36ef34Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1766d36ef34Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1776d36ef34Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1786d36ef34Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1796d36ef34Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1806d36ef34Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1816d36ef34Smrg                    [depcc="$$1"   am_compiler_list=])
1821abf7346Smrg
1838b6d6341SmrgAC_CACHE_CHECK([dependency style of $depcc],
1848b6d6341Smrg               [am_cv_$1_dependencies_compiler_type],
1858b6d6341Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1868b6d6341Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1878b6d6341Smrg  # making bogus files that we don't know about and never remove.  For
1888b6d6341Smrg  # instance it was reported that on HP-UX the gcc test will end up
1896d36ef34Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1906d36ef34Smrg  # in D".
1916d36ef34Smrg  rm -rf conftest.dir
1928b6d6341Smrg  mkdir conftest.dir
1938b6d6341Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1948b6d6341Smrg  # using a relative directory.
1958b6d6341Smrg  cp "$am_depcomp" conftest.dir
1968b6d6341Smrg  cd conftest.dir
1978b6d6341Smrg  # We will build objects and dependencies in a subdirectory because
1988b6d6341Smrg  # it helps to detect inapplicable dependency modes.  For instance
1998b6d6341Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2008b6d6341Smrg  # side effect of compilation, but ICC will put the dependencies in
2018b6d6341Smrg  # the current directory while Tru64 will put them in the object
2028b6d6341Smrg  # directory.
2038b6d6341Smrg  mkdir sub
2041abf7346Smrg
2058b6d6341Smrg  am_cv_$1_dependencies_compiler_type=none
2068b6d6341Smrg  if test "$am_compiler_list" = ""; then
2078b6d6341Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2088b6d6341Smrg  fi
2098b6d6341Smrg  am__universal=false
2108b6d6341Smrg  m4_case([$1], [CC],
2118b6d6341Smrg    [case " $depcc " in #(
2128b6d6341Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2138b6d6341Smrg     esac],
2148b6d6341Smrg    [CXX],
2158b6d6341Smrg    [case " $depcc " in #(
2168b6d6341Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2178b6d6341Smrg     esac])
2181abf7346Smrg
2198b6d6341Smrg  for depmode in $am_compiler_list; do
2208b6d6341Smrg    # Setup a source with many dependencies, because some compilers
2218b6d6341Smrg    # like to wrap large dependency lists on column 80 (with \), and
2228b6d6341Smrg    # we should not choose a depcomp mode which is confused by this.
2238b6d6341Smrg    #
2248b6d6341Smrg    # We need to recreate these files for each test, as the compiler may
2258b6d6341Smrg    # overwrite some of them when testing with obscure command lines.
2268b6d6341Smrg    # This happens at least with the AIX C compiler.
2278b6d6341Smrg    : > sub/conftest.c
2288b6d6341Smrg    for i in 1 2 3 4 5 6; do
2298b6d6341Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2306d36ef34Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2316d36ef34Smrg      # Solaris 10 /bin/sh.
2326d36ef34Smrg      echo '/* dummy */' > sub/conftst$i.h
2338b6d6341Smrg    done
2348b6d6341Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2351abf7346Smrg
2366d36ef34Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2378b6d6341Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2386d36ef34Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2396d36ef34Smrg    # versions had trouble with output in subdirs.
2408b6d6341Smrg    am__obj=sub/conftest.${OBJEXT-o}
2418b6d6341Smrg    am__minus_obj="-o $am__obj"
2428b6d6341Smrg    case $depmode in
2438b6d6341Smrg    gcc)
2448b6d6341Smrg      # This depmode causes a compiler race in universal mode.
2458b6d6341Smrg      test "$am__universal" = false || continue
2468b6d6341Smrg      ;;
2478b6d6341Smrg    nosideeffect)
2486d36ef34Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2496d36ef34Smrg      # only be used when explicitly requested.
2508b6d6341Smrg      if test "x$enable_dependency_tracking" = xyes; then
2518b6d6341Smrg	continue
2528b6d6341Smrg      else
2538b6d6341Smrg	break
2548b6d6341Smrg      fi
2558b6d6341Smrg      ;;
2566d36ef34Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2576d36ef34Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2588b6d6341Smrg      # not run yet.  These depmodes are late enough in the game, and
2598b6d6341Smrg      # so weak that their functioning should not be impacted.
2608b6d6341Smrg      am__obj=conftest.${OBJEXT-o}
2618b6d6341Smrg      am__minus_obj=
2628b6d6341Smrg      ;;
2638b6d6341Smrg    none) break ;;
2648b6d6341Smrg    esac
2658b6d6341Smrg    if depmode=$depmode \
2668b6d6341Smrg       source=sub/conftest.c object=$am__obj \
2678b6d6341Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2688b6d6341Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2698b6d6341Smrg         >/dev/null 2>conftest.err &&
2708b6d6341Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2718b6d6341Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2728b6d6341Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2738b6d6341Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2748b6d6341Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2758b6d6341Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2768b6d6341Smrg      # that says an option was ignored or not supported.
2778b6d6341Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2788b6d6341Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2798b6d6341Smrg      # The diagnosis changed in icc 8.0:
2808b6d6341Smrg      #   icc: Command line remark: option '-MP' not supported
2818b6d6341Smrg      if (grep 'ignoring option' conftest.err ||
2828b6d6341Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2838b6d6341Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2848b6d6341Smrg        break
2858b6d6341Smrg      fi
2868b6d6341Smrg    fi
2878b6d6341Smrg  done
2881abf7346Smrg
2898b6d6341Smrg  cd ..
2908b6d6341Smrg  rm -rf conftest.dir
2911abf7346Smrgelse
2928b6d6341Smrg  am_cv_$1_dependencies_compiler_type=none
2931abf7346Smrgfi
2948b6d6341Smrg])
2958b6d6341SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2968b6d6341SmrgAM_CONDITIONAL([am__fastdep$1], [
2978b6d6341Smrg  test "x$enable_dependency_tracking" != xno \
2988b6d6341Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2998b6d6341Smrg])
3001abf7346Smrg
3011abf7346Smrg
3028b6d6341Smrg# AM_SET_DEPDIR
3038b6d6341Smrg# -------------
3048b6d6341Smrg# Choose a directory name for dependency files.
3056d36ef34Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3068b6d6341SmrgAC_DEFUN([AM_SET_DEPDIR],
3078b6d6341Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3088b6d6341SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3098b6d6341Smrg])
3101abf7346Smrg
3111abf7346Smrg
3128b6d6341Smrg# AM_DEP_TRACK
3138b6d6341Smrg# ------------
3148b6d6341SmrgAC_DEFUN([AM_DEP_TRACK],
3156d36ef34Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3166d36ef34SmrgAS_HELP_STRING(
3176d36ef34Smrg  [--enable-dependency-tracking],
3186d36ef34Smrg  [do not reject slow dependency extractors])
3196d36ef34SmrgAS_HELP_STRING(
3206d36ef34Smrg  [--disable-dependency-tracking],
3216d36ef34Smrg  [speeds up one-time build])])
3228b6d6341Smrgif test "x$enable_dependency_tracking" != xno; then
3238b6d6341Smrg  am_depcomp="$ac_aux_dir/depcomp"
3248b6d6341Smrg  AMDEPBACKSLASH='\'
3256d36ef34Smrg  am__nodep='_no'
3261abf7346Smrgfi
3278b6d6341SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3288b6d6341SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3298b6d6341Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3306d36ef34SmrgAC_SUBST([am__nodep])dnl
3316d36ef34Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3328b6d6341Smrg])
3331abf7346Smrg
3348b6d6341Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3351abf7346Smrg
3366d36ef34Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
3371abf7346Smrg#
3388b6d6341Smrg# This file is free software; the Free Software Foundation
3398b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
3408b6d6341Smrg# with or without modifications, as long as this notice is preserved.
3411abf7346Smrg
3421abf7346Smrg
3438b6d6341Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3448b6d6341Smrg# ------------------------------
3458b6d6341SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3468b6d6341Smrg[{
3476d36ef34Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3488b6d6341Smrg  # are listed without --file.  Let's play safe and only enable the eval
3498b6d6341Smrg  # if we detect the quoting.
3508b6d6341Smrg  case $CONFIG_FILES in
3518b6d6341Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3528b6d6341Smrg  *)   set x $CONFIG_FILES ;;
3538b6d6341Smrg  esac
3548b6d6341Smrg  shift
3558b6d6341Smrg  for mf
3568b6d6341Smrg  do
3578b6d6341Smrg    # Strip MF so we end up with the name of the file.
3588b6d6341Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3598b6d6341Smrg    # Check whether this is an Automake generated Makefile or not.
3606d36ef34Smrg    # We used to match only the files named 'Makefile.in', but
3618b6d6341Smrg    # some people rename them; so instead we look at the file content.
3628b6d6341Smrg    # Grep'ing the first line is not enough: some people post-process
3638b6d6341Smrg    # each Makefile.in and add a new line on top of each file to say so.
3648b6d6341Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3658b6d6341Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3668b6d6341Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3678b6d6341Smrg      dirpart=`AS_DIRNAME("$mf")`
3688b6d6341Smrg    else
3698b6d6341Smrg      continue
3708b6d6341Smrg    fi
3718b6d6341Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3726d36ef34Smrg    # from the Makefile without running 'make'.
3738b6d6341Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3748b6d6341Smrg    test -z "$DEPDIR" && continue
3758b6d6341Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3766d36ef34Smrg    test -z "$am__include" && continue
3778b6d6341Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3788b6d6341Smrg    # Find all dependency output files, they are included files with
3798b6d6341Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3808b6d6341Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3818b6d6341Smrg    # expansion.
3828b6d6341Smrg    for file in `sed -n "
3838b6d6341Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3846d36ef34Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3858b6d6341Smrg      # Make sure the directory exists.
3868b6d6341Smrg      test -f "$dirpart/$file" && continue
3878b6d6341Smrg      fdir=`AS_DIRNAME(["$file"])`
3888b6d6341Smrg      AS_MKDIR_P([$dirpart/$fdir])
3898b6d6341Smrg      # echo "creating $dirpart/$file"
3908b6d6341Smrg      echo '# dummy' > "$dirpart/$file"
3918b6d6341Smrg    done
3928b6d6341Smrg  done
3938b6d6341Smrg}
3948b6d6341Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3951abf7346Smrg
3961abf7346Smrg
3978b6d6341Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3988b6d6341Smrg# -----------------------------
3998b6d6341Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
4008b6d6341Smrg#
4018b6d6341Smrg# This code is only required when automatic dependency tracking
4026d36ef34Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4038b6d6341Smrg# need in order to bootstrap the dependency handling code.
4048b6d6341SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4058b6d6341Smrg[AC_CONFIG_COMMANDS([depfiles],
4068b6d6341Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4078b6d6341Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4088b6d6341Smrg])
4091abf7346Smrg
4108b6d6341Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4111abf7346Smrg
4126d36ef34Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4138b6d6341Smrg#
4148b6d6341Smrg# This file is free software; the Free Software Foundation
4158b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
4168b6d6341Smrg# with or without modifications, as long as this notice is preserved.
4171abf7346Smrg
4188b6d6341Smrg# This macro actually does too much.  Some checks are only needed if
4198b6d6341Smrg# your package does certain things.  But this isn't really a big deal.
4201abf7346Smrg
4216d36ef34Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4226d36ef34Smrgm4_define([AC_PROG_CC],
4236d36ef34Smrgm4_defn([AC_PROG_CC])
4246d36ef34Smrg[_AM_PROG_CC_C_O
4256d36ef34Smrg])
4266d36ef34Smrg
4278b6d6341Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4288b6d6341Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4298b6d6341Smrg# -----------------------------------------------
4308b6d6341Smrg# The call with PACKAGE and VERSION arguments is the old style
4318b6d6341Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4328b6d6341Smrg# and VERSION should now be passed to AC_INIT and removed from
4338b6d6341Smrg# the call to AM_INIT_AUTOMAKE.
4348b6d6341Smrg# We support both call styles for the transition.  After
4358b6d6341Smrg# the next Automake release, Autoconf can make the AC_INIT
4368b6d6341Smrg# arguments mandatory, and then we can depend on a new Autoconf
4378b6d6341Smrg# release and drop the old call support.
4388b6d6341SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4396d36ef34Smrg[AC_PREREQ([2.65])dnl
4408b6d6341Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4418b6d6341Smrgdnl the ones we care about.
4428b6d6341Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4438b6d6341SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4448b6d6341SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4458b6d6341Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4468b6d6341Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4478b6d6341Smrg  # is not polluted with repeated "-I."
4488b6d6341Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4498b6d6341Smrg  # test to see if srcdir already configured
4508b6d6341Smrg  if test -f $srcdir/config.status; then
4518b6d6341Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4528b6d6341Smrg  fi
4538b6d6341Smrgfi
4541abf7346Smrg
4558b6d6341Smrg# test whether we have cygpath
4568b6d6341Smrgif test -z "$CYGPATH_W"; then
4578b6d6341Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4588b6d6341Smrg    CYGPATH_W='cygpath -w'
4598b6d6341Smrg  else
4608b6d6341Smrg    CYGPATH_W=echo
4618b6d6341Smrg  fi
4628b6d6341Smrgfi
4638b6d6341SmrgAC_SUBST([CYGPATH_W])
4641abf7346Smrg
4658b6d6341Smrg# Define the identity of the package.
4668b6d6341Smrgdnl Distinguish between old-style and new-style calls.
4678b6d6341Smrgm4_ifval([$2],
4686d36ef34Smrg[AC_DIAGNOSE([obsolete],
4696d36ef34Smrg             [$0: two- and three-arguments forms are deprecated.])
4706d36ef34Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4718b6d6341Smrg AC_SUBST([PACKAGE], [$1])dnl
4728b6d6341Smrg AC_SUBST([VERSION], [$2])],
4738b6d6341Smrg[_AM_SET_OPTIONS([$1])dnl
4748b6d6341Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4756d36ef34Smrgm4_if(
4766d36ef34Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4776d36ef34Smrg  [ok:ok],,
4788b6d6341Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4798b6d6341Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4808b6d6341Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4811abf7346Smrg
4828b6d6341Smrg_AM_IF_OPTION([no-define],,
4836d36ef34Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4846d36ef34Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4851abf7346Smrg
4868b6d6341Smrg# Some tools Automake needs.
4878b6d6341SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4888b6d6341SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4896d36ef34SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4906d36ef34SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4916d36ef34SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4926d36ef34SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4936d36ef34SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4948b6d6341SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4958b6d6341SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4966d36ef34SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4976d36ef34Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4986d36ef34Smrg# dies out for good.  For more background, see:
4996d36ef34Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
5006d36ef34Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5016d36ef34SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5028b6d6341Smrg# We need awk for the "check" target.  The system "awk" is bad on
5038b6d6341Smrg# some platforms.
5048b6d6341SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5058b6d6341SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5068b6d6341SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5078b6d6341Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5088b6d6341Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5098b6d6341Smrg			     [_AM_PROG_TAR([v7])])])
5108b6d6341Smrg_AM_IF_OPTION([no-dependencies],,
5118b6d6341Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5126d36ef34Smrg		  [_AM_DEPENDENCIES([CC])],
5136d36ef34Smrg		  [m4_define([AC_PROG_CC],
5146d36ef34Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5158b6d6341SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5166d36ef34Smrg		  [_AM_DEPENDENCIES([CXX])],
5176d36ef34Smrg		  [m4_define([AC_PROG_CXX],
5186d36ef34Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5198b6d6341SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5206d36ef34Smrg		  [_AM_DEPENDENCIES([OBJC])],
5216d36ef34Smrg		  [m4_define([AC_PROG_OBJC],
5226d36ef34Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5236d36ef34SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5246d36ef34Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5256d36ef34Smrg		  [m4_define([AC_PROG_OBJCXX],
5266d36ef34Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5278b6d6341Smrg])
5286d36ef34SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5296d36ef34Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5306d36ef34Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5316d36ef34Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5328b6d6341SmrgAC_CONFIG_COMMANDS_PRE(dnl
5338b6d6341Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5348b6d6341Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5351abf7346Smrg
5366d36ef34Smrg# POSIX will say in a future version that running "rm -f" with no argument
5376d36ef34Smrg# is OK; and we want to be able to make that assumption in our Makefile
5386d36ef34Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5396d36ef34Smrg# actually supported "in the wild" to an acceptable degree.
5406d36ef34Smrg# See automake bug#10828.
5416d36ef34Smrg# To make any issue more visible, cause the running configure to be aborted
5426d36ef34Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5436d36ef34Smrg# user can still override this though.
5446d36ef34Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5456d36ef34Smrg  cat >&2 <<'END'
5466d36ef34SmrgOops!
5476d36ef34Smrg
5486d36ef34SmrgYour 'rm' program seems unable to run without file operands specified
5496d36ef34Smrgon the command line, even when the '-f' option is present.  This is contrary
5506d36ef34Smrgto the behaviour of most rm programs out there, and not conforming with
5516d36ef34Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5526d36ef34Smrg
5536d36ef34SmrgPlease tell bug-automake@gnu.org about your system, including the value
5546d36ef34Smrgof your $PATH and any error possibly output before this message.  This
5556d36ef34Smrgcan help us improve future automake versions.
5566d36ef34Smrg
5576d36ef34SmrgEND
5586d36ef34Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5596d36ef34Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5606d36ef34Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5616d36ef34Smrg    echo >&2
5626d36ef34Smrg  else
5636d36ef34Smrg    cat >&2 <<'END'
5646d36ef34SmrgAborting the configuration process, to ensure you take notice of the issue.
5656d36ef34Smrg
5666d36ef34SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5676d36ef34Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5686d36ef34Smrg
5696d36ef34SmrgIf you want to complete the configuration process using your problematic
5706d36ef34Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5716d36ef34Smrgto "yes", and re-run configure.
5726d36ef34Smrg
5736d36ef34SmrgEND
5746d36ef34Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5756d36ef34Smrg  fi
5766d36ef34Smrgfi])
5776d36ef34Smrg
5786d36ef34Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5798b6d6341Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5808b6d6341Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5818b6d6341Smrgm4_define([_AC_COMPILER_EXEEXT],
5828b6d6341Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5831abf7346Smrg
5848b6d6341Smrg# When config.status generates a header, we must update the stamp-h file.
5858b6d6341Smrg# This file resides in the same directory as the config header
5868b6d6341Smrg# that is generated.  The stamp files are numbered to have different names.
5871abf7346Smrg
5888b6d6341Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5898b6d6341Smrg# loop where config.status creates the headers, so we can generate
5908b6d6341Smrg# our stamp files there.
5918b6d6341SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5928b6d6341Smrg[# Compute $1's index in $config_headers.
5938b6d6341Smrg_am_arg=$1
5948b6d6341Smrg_am_stamp_count=1
5958b6d6341Smrgfor _am_header in $config_headers :; do
5968b6d6341Smrg  case $_am_header in
5978b6d6341Smrg    $_am_arg | $_am_arg:* )
5988b6d6341Smrg      break ;;
5998b6d6341Smrg    * )
6008b6d6341Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6018b6d6341Smrg  esac
6028b6d6341Smrgdone
6038b6d6341Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6041abf7346Smrg
6056d36ef34Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6061abf7346Smrg#
6078b6d6341Smrg# This file is free software; the Free Software Foundation
6088b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
6098b6d6341Smrg# with or without modifications, as long as this notice is preserved.
6101abf7346Smrg
6118b6d6341Smrg# AM_PROG_INSTALL_SH
6128b6d6341Smrg# ------------------
6138b6d6341Smrg# Define $install_sh.
6148b6d6341SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6158b6d6341Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6168b6d6341Smrgif test x"${install_sh}" != xset; then
6178b6d6341Smrg  case $am_aux_dir in
6188b6d6341Smrg  *\ * | *\	*)
6198b6d6341Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6208b6d6341Smrg  *)
6218b6d6341Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6228b6d6341Smrg  esac
6231abf7346Smrgfi
6246d36ef34SmrgAC_SUBST([install_sh])])
6251abf7346Smrg
6266d36ef34Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
6278b6d6341Smrg#
6288b6d6341Smrg# This file is free software; the Free Software Foundation
6298b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
6308b6d6341Smrg# with or without modifications, as long as this notice is preserved.
6318b6d6341Smrg
6328b6d6341Smrg# Check whether the underlying file-system supports filenames
6338b6d6341Smrg# with a leading dot.  For instance MS-DOS doesn't.
6348b6d6341SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6358b6d6341Smrg[rm -rf .tst 2>/dev/null
6368b6d6341Smrgmkdir .tst 2>/dev/null
6378b6d6341Smrgif test -d .tst; then
6388b6d6341Smrg  am__leading_dot=.
6391abf7346Smrgelse
6408b6d6341Smrg  am__leading_dot=_
6411abf7346Smrgfi
6428b6d6341Smrgrmdir .tst 2>/dev/null
6438b6d6341SmrgAC_SUBST([am__leading_dot])])
6441abf7346Smrg
6458b6d6341Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6468b6d6341Smrg# From Jim Meyering
6471abf7346Smrg
6486d36ef34Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
6491abf7346Smrg#
6508b6d6341Smrg# This file is free software; the Free Software Foundation
6518b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
6528b6d6341Smrg# with or without modifications, as long as this notice is preserved.
6531abf7346Smrg
6548b6d6341Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6558b6d6341Smrg# ----------------------------------
6568b6d6341Smrg# Control maintainer-specific portions of Makefiles.
6576d36ef34Smrg# Default is to disable them, unless 'enable' is passed literally.
6586d36ef34Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
6598b6d6341Smrg# can override the default with the --enable/--disable switch.
6608b6d6341SmrgAC_DEFUN([AM_MAINTAINER_MODE],
6618b6d6341Smrg[m4_case(m4_default([$1], [disable]),
6628b6d6341Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
6638b6d6341Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
6648b6d6341Smrg       [m4_define([am_maintainer_other], [enable])
6658b6d6341Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6666d36ef34SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6678b6d6341Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6688b6d6341Smrg  AC_ARG_ENABLE([maintainer-mode],
6696d36ef34Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
6706d36ef34Smrg      am_maintainer_other[ make rules and dependencies not useful
6716d36ef34Smrg      (and sometimes confusing) to the casual installer])],
6726d36ef34Smrg    [USE_MAINTAINER_MODE=$enableval],
6736d36ef34Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6748b6d6341Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6758b6d6341Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6768b6d6341Smrg  MAINT=$MAINTAINER_MODE_TRUE
6778b6d6341Smrg  AC_SUBST([MAINT])dnl
6788b6d6341Smrg]
6798b6d6341Smrg)
6801abf7346Smrg
6818b6d6341Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6828b6d6341Smrg
6836d36ef34Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6841abf7346Smrg#
6858b6d6341Smrg# This file is free software; the Free Software Foundation
6868b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
6878b6d6341Smrg# with or without modifications, as long as this notice is preserved.
6888b6d6341Smrg
6898b6d6341Smrg# AM_MAKE_INCLUDE()
6908b6d6341Smrg# -----------------
6918b6d6341Smrg# Check to see how make treats includes.
6928b6d6341SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6938b6d6341Smrg[am_make=${MAKE-make}
6948b6d6341Smrgcat > confinc << 'END'
6958b6d6341Smrgam__doit:
6968b6d6341Smrg	@echo this is the am__doit target
6978b6d6341Smrg.PHONY: am__doit
6988b6d6341SmrgEND
6998b6d6341Smrg# If we don't find an include directive, just comment out the code.
7008b6d6341SmrgAC_MSG_CHECKING([for style of include used by $am_make])
7018b6d6341Smrgam__include="#"
7028b6d6341Smrgam__quote=
7038b6d6341Smrg_am_result=none
7048b6d6341Smrg# First try GNU make style include.
7058b6d6341Smrgecho "include confinc" > confmf
7066d36ef34Smrg# Ignore all kinds of additional output from 'make'.
7078b6d6341Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
7088b6d6341Smrg*the\ am__doit\ target*)
7098b6d6341Smrg  am__include=include
7108b6d6341Smrg  am__quote=
7118b6d6341Smrg  _am_result=GNU
7128b6d6341Smrg  ;;
7138b6d6341Smrgesac
7148b6d6341Smrg# Now try BSD make style include.
7158b6d6341Smrgif test "$am__include" = "#"; then
7168b6d6341Smrg   echo '.include "confinc"' > confmf
7178b6d6341Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
7188b6d6341Smrg   *the\ am__doit\ target*)
7198b6d6341Smrg     am__include=.include
7208b6d6341Smrg     am__quote="\""
7218b6d6341Smrg     _am_result=BSD
7228b6d6341Smrg     ;;
7238b6d6341Smrg   esac
7248b6d6341Smrgfi
7258b6d6341SmrgAC_SUBST([am__include])
7268b6d6341SmrgAC_SUBST([am__quote])
7278b6d6341SmrgAC_MSG_RESULT([$_am_result])
7288b6d6341Smrgrm -f confinc confmf
7298b6d6341Smrg])
7308b6d6341Smrg
7318b6d6341Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7328b6d6341Smrg
7336d36ef34Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
7341abf7346Smrg#
7358b6d6341Smrg# This file is free software; the Free Software Foundation
7368b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
7378b6d6341Smrg# with or without modifications, as long as this notice is preserved.
7381abf7346Smrg
7398b6d6341Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7408b6d6341Smrg# ------------------------------
7418b6d6341SmrgAC_DEFUN([AM_MISSING_PROG],
7428b6d6341Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7438b6d6341Smrg$1=${$1-"${am_missing_run}$2"}
7448b6d6341SmrgAC_SUBST($1)])
7451abf7346Smrg
7468b6d6341Smrg# AM_MISSING_HAS_RUN
7478b6d6341Smrg# ------------------
7486d36ef34Smrg# Define MISSING if not defined so far and test if it is modern enough.
7496d36ef34Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7508b6d6341SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7518b6d6341Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7528b6d6341SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7538b6d6341Smrgif test x"${MISSING+set}" != xset; then
7548b6d6341Smrg  case $am_aux_dir in
7558b6d6341Smrg  *\ * | *\	*)
7568b6d6341Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7578b6d6341Smrg  *)
7588b6d6341Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7598b6d6341Smrg  esac
7608b6d6341Smrgfi
7618b6d6341Smrg# Use eval to expand $SHELL
7626d36ef34Smrgif eval "$MISSING --is-lightweight"; then
7636d36ef34Smrg  am_missing_run="$MISSING "
7648b6d6341Smrgelse
7658b6d6341Smrg  am_missing_run=
7666d36ef34Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7678b6d6341Smrgfi
7681abf7346Smrg])
7691abf7346Smrg
7708b6d6341Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7711abf7346Smrg
7726d36ef34Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
7738b6d6341Smrg#
7748b6d6341Smrg# This file is free software; the Free Software Foundation
7758b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
7768b6d6341Smrg# with or without modifications, as long as this notice is preserved.
7771abf7346Smrg
7788b6d6341Smrg# _AM_MANGLE_OPTION(NAME)
7798b6d6341Smrg# -----------------------
7808b6d6341SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7818b6d6341Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7828b6d6341Smrg
7838b6d6341Smrg# _AM_SET_OPTION(NAME)
7846d36ef34Smrg# --------------------
7858b6d6341Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7868b6d6341SmrgAC_DEFUN([_AM_SET_OPTION],
7876d36ef34Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7888b6d6341Smrg
7898b6d6341Smrg# _AM_SET_OPTIONS(OPTIONS)
7906d36ef34Smrg# ------------------------
7918b6d6341Smrg# OPTIONS is a space-separated list of Automake options.
7928b6d6341SmrgAC_DEFUN([_AM_SET_OPTIONS],
7938b6d6341Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7948b6d6341Smrg
7958b6d6341Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7968b6d6341Smrg# -------------------------------------------
7978b6d6341Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7988b6d6341SmrgAC_DEFUN([_AM_IF_OPTION],
7998b6d6341Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
8008b6d6341Smrg
8016d36ef34Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
8026d36ef34Smrg#
8036d36ef34Smrg# This file is free software; the Free Software Foundation
8046d36ef34Smrg# gives unlimited permission to copy and/or distribute it,
8056d36ef34Smrg# with or without modifications, as long as this notice is preserved.
8066d36ef34Smrg
8076d36ef34Smrg# _AM_PROG_CC_C_O
8086d36ef34Smrg# ---------------
8096d36ef34Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
8106d36ef34Smrg# to automatically call this.
8116d36ef34SmrgAC_DEFUN([_AM_PROG_CC_C_O],
8126d36ef34Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
8136d36ef34SmrgAC_REQUIRE_AUX_FILE([compile])dnl
8146d36ef34SmrgAC_LANG_PUSH([C])dnl
8156d36ef34SmrgAC_CACHE_CHECK(
8166d36ef34Smrg  [whether $CC understands -c and -o together],
8176d36ef34Smrg  [am_cv_prog_cc_c_o],
8186d36ef34Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
8196d36ef34Smrg  # Make sure it works both with $CC and with simple cc.
8206d36ef34Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
8216d36ef34Smrg  # compilers refuse to overwrite an existing .o file with -o,
8226d36ef34Smrg  # though they will create one.
8236d36ef34Smrg  am_cv_prog_cc_c_o=yes
8246d36ef34Smrg  for am_i in 1 2; do
8256d36ef34Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
8266d36ef34Smrg         && test -f conftest2.$ac_objext; then
8276d36ef34Smrg      : OK
8286d36ef34Smrg    else
8296d36ef34Smrg      am_cv_prog_cc_c_o=no
8306d36ef34Smrg      break
8316d36ef34Smrg    fi
8326d36ef34Smrg  done
8336d36ef34Smrg  rm -f core conftest*
8346d36ef34Smrg  unset am_i])
8356d36ef34Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8366d36ef34Smrg   # Losing compiler, so override with the script.
8376d36ef34Smrg   # FIXME: It is wrong to rewrite CC.
8386d36ef34Smrg   # But if we don't then we get into trouble of one sort or another.
8396d36ef34Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8406d36ef34Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8416d36ef34Smrg   CC="$am_aux_dir/compile $CC"
8426d36ef34Smrgfi
8436d36ef34SmrgAC_LANG_POP([C])])
8448b6d6341Smrg
8456d36ef34Smrg# For backward compatibility.
8466d36ef34SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8476d36ef34Smrg
8486d36ef34Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
8491abf7346Smrg#
8501abf7346Smrg# This file is free software; the Free Software Foundation
8511abf7346Smrg# gives unlimited permission to copy and/or distribute it,
8521abf7346Smrg# with or without modifications, as long as this notice is preserved.
8531abf7346Smrg
8546d36ef34Smrg# AM_RUN_LOG(COMMAND)
8556d36ef34Smrg# -------------------
8566d36ef34Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8576d36ef34Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8586d36ef34SmrgAC_DEFUN([AM_RUN_LOG],
8596d36ef34Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8606d36ef34Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8616d36ef34Smrg   ac_status=$?
8626d36ef34Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8636d36ef34Smrg   (exit $ac_status); }])
8646d36ef34Smrg
8656d36ef34Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8666d36ef34Smrg
8676d36ef34Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
8686d36ef34Smrg#
8696d36ef34Smrg# This file is free software; the Free Software Foundation
8706d36ef34Smrg# gives unlimited permission to copy and/or distribute it,
8716d36ef34Smrg# with or without modifications, as long as this notice is preserved.
8721abf7346Smrg
8738b6d6341Smrg# AM_SANITY_CHECK
8748b6d6341Smrg# ---------------
8758b6d6341SmrgAC_DEFUN([AM_SANITY_CHECK],
8768b6d6341Smrg[AC_MSG_CHECKING([whether build environment is sane])
8778b6d6341Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8788b6d6341Smrg# name.  Accept space and tab only in the latter.
8798b6d6341Smrgam_lf='
8808b6d6341Smrg'
8818b6d6341Smrgcase `pwd` in
8828b6d6341Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8838b6d6341Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8848b6d6341Smrgesac
8858b6d6341Smrgcase $srcdir in
8868b6d6341Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8876d36ef34Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8888b6d6341Smrgesac
8891abf7346Smrg
8906d36ef34Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8918b6d6341Smrg# arguments.  Must try -L first in case configure is actually a
8928b6d6341Smrg# symlink; some systems play weird games with the mod time of symlinks
8938b6d6341Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8948b6d6341Smrg# directory).
8958b6d6341Smrgif (
8966d36ef34Smrg   am_has_slept=no
8976d36ef34Smrg   for am_try in 1 2; do
8986d36ef34Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8996d36ef34Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9006d36ef34Smrg     if test "$[*]" = "X"; then
9016d36ef34Smrg	# -L didn't work.
9026d36ef34Smrg	set X `ls -t "$srcdir/configure" conftest.file`
9036d36ef34Smrg     fi
9046d36ef34Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
9056d36ef34Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
9066d36ef34Smrg
9076d36ef34Smrg	# If neither matched, then we have a broken ls.  This can happen
9086d36ef34Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
9096d36ef34Smrg	# broken ls alias from the environment.  This has actually
9106d36ef34Smrg	# happened.  Such a system could not be considered "sane".
9116d36ef34Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
9126d36ef34Smrg  alias in your environment])
9136d36ef34Smrg     fi
9146d36ef34Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
9156d36ef34Smrg       break
9166d36ef34Smrg     fi
9176d36ef34Smrg     # Just in case.
9186d36ef34Smrg     sleep 1
9196d36ef34Smrg     am_has_slept=yes
9206d36ef34Smrg   done
9218b6d6341Smrg   test "$[2]" = conftest.file
9228b6d6341Smrg   )
9238b6d6341Smrgthen
9248b6d6341Smrg   # Ok.
9258b6d6341Smrg   :
9268b6d6341Smrgelse
9278b6d6341Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
9288b6d6341SmrgCheck your system clock])
9298b6d6341Smrgfi
9306d36ef34SmrgAC_MSG_RESULT([yes])
9316d36ef34Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
9326d36ef34Smrg# generated files are strictly newer.
9336d36ef34Smrgam_sleep_pid=
9346d36ef34Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9356d36ef34Smrg  ( sleep 1 ) &
9366d36ef34Smrg  am_sleep_pid=$!
9376d36ef34Smrgfi
9386d36ef34SmrgAC_CONFIG_COMMANDS_PRE(
9396d36ef34Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9406d36ef34Smrg   if test -n "$am_sleep_pid"; then
9416d36ef34Smrg     # Hide warnings about reused PIDs.
9426d36ef34Smrg     wait $am_sleep_pid 2>/dev/null
9436d36ef34Smrg   fi
9446d36ef34Smrg   AC_MSG_RESULT([done])])
9456d36ef34Smrgrm -f conftest.file
9466d36ef34Smrg])
9471abf7346Smrg
9486d36ef34Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
9491abf7346Smrg#
9501abf7346Smrg# This file is free software; the Free Software Foundation
9511abf7346Smrg# gives unlimited permission to copy and/or distribute it,
9521abf7346Smrg# with or without modifications, as long as this notice is preserved.
9531abf7346Smrg
9548b6d6341Smrg# AM_SILENT_RULES([DEFAULT])
9558b6d6341Smrg# --------------------------
9568b6d6341Smrg# Enable less verbose build rules; with the default set to DEFAULT
9576d36ef34Smrg# ("yes" being less verbose, "no" or empty being verbose).
9588b6d6341SmrgAC_DEFUN([AM_SILENT_RULES],
9596d36ef34Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9606d36ef34SmrgAS_HELP_STRING(
9616d36ef34Smrg  [--enable-silent-rules],
9626d36ef34Smrg  [less verbose build output (undo: "make V=1")])
9636d36ef34SmrgAS_HELP_STRING(
9646d36ef34Smrg  [--disable-silent-rules],
9656d36ef34Smrg  [verbose build output (undo: "make V=0")])dnl
9666d36ef34Smrg])
9676d36ef34Smrgcase $enable_silent_rules in @%:@ (((
9686d36ef34Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9696d36ef34Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9706d36ef34Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9718b6d6341Smrgesac
9726d36ef34Smrgdnl
9736d36ef34Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9746d36ef34Smrgdnl do not support nested variable expansions.
9756d36ef34Smrgdnl See automake bug#9928 and bug#10237.
9766d36ef34Smrgam_make=${MAKE-make}
9776d36ef34SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9786d36ef34Smrg   [am_cv_make_support_nested_variables],
9796d36ef34Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9806d36ef34SmrgBAR0=false
9816d36ef34SmrgBAR1=true
9826d36ef34SmrgV=1
9836d36ef34Smrgam__doit:
9846d36ef34Smrg	@$(TRUE)
9856d36ef34Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9866d36ef34Smrg  am_cv_make_support_nested_variables=yes
9876d36ef34Smrgelse
9886d36ef34Smrg  am_cv_make_support_nested_variables=no
9896d36ef34Smrgfi])
9906d36ef34Smrgif test $am_cv_make_support_nested_variables = yes; then
9916d36ef34Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9926d36ef34Smrg  AM_V='$(V)'
9936d36ef34Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9946d36ef34Smrgelse
9956d36ef34Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9966d36ef34Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9976d36ef34Smrgfi
9986d36ef34SmrgAC_SUBST([AM_V])dnl
9996d36ef34SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10006d36ef34SmrgAC_SUBST([AM_DEFAULT_V])dnl
10016d36ef34SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10028b6d6341SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10038b6d6341SmrgAM_BACKSLASH='\'
10048b6d6341SmrgAC_SUBST([AM_BACKSLASH])dnl
10058b6d6341Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10068b6d6341Smrg])
10071abf7346Smrg
10086d36ef34Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
10091abf7346Smrg#
10101abf7346Smrg# This file is free software; the Free Software Foundation
10111abf7346Smrg# gives unlimited permission to copy and/or distribute it,
10121abf7346Smrg# with or without modifications, as long as this notice is preserved.
10131abf7346Smrg
10148b6d6341Smrg# AM_PROG_INSTALL_STRIP
10158b6d6341Smrg# ---------------------
10166d36ef34Smrg# One issue with vendor 'install' (even GNU) is that you can't
10178b6d6341Smrg# specify the program used to strip binaries.  This is especially
10188b6d6341Smrg# annoying in cross-compiling environments, where the build's strip
10198b6d6341Smrg# is unlikely to handle the host's binaries.
10208b6d6341Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
10216d36ef34Smrg# always use install-sh in "make install-strip", and initialize
10228b6d6341Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
10238b6d6341SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
10248b6d6341Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
10256d36ef34Smrg# Installed binaries are usually stripped using 'strip' when the user
10266d36ef34Smrg# run "make install-strip".  However 'strip' might not be the right
10278b6d6341Smrg# tool to use in cross-compilation environments, therefore Automake
10286d36ef34Smrg# will honor the 'STRIP' environment variable to overrule this program.
10296d36ef34Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
10308b6d6341Smrgif test "$cross_compiling" != no; then
10318b6d6341Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
10328b6d6341Smrgfi
10338b6d6341SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10348b6d6341SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10351abf7346Smrg
10366d36ef34Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
10371abf7346Smrg#
10388b6d6341Smrg# This file is free software; the Free Software Foundation
10398b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
10408b6d6341Smrg# with or without modifications, as long as this notice is preserved.
10411abf7346Smrg
10428b6d6341Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10438b6d6341Smrg# ---------------------------
10448b6d6341Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10458b6d6341Smrg# This macro is traced by Automake.
10468b6d6341SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10471abf7346Smrg
10488b6d6341Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10496d36ef34Smrg# --------------------------
10508b6d6341Smrg# Public sister of _AM_SUBST_NOTMAKE.
10518b6d6341SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10521abf7346Smrg
10538b6d6341Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10541abf7346Smrg
10556d36ef34Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
10568b6d6341Smrg#
10578b6d6341Smrg# This file is free software; the Free Software Foundation
10588b6d6341Smrg# gives unlimited permission to copy and/or distribute it,
10598b6d6341Smrg# with or without modifications, as long as this notice is preserved.
10601abf7346Smrg
10618b6d6341Smrg# _AM_PROG_TAR(FORMAT)
10628b6d6341Smrg# --------------------
10638b6d6341Smrg# Check how to create a tarball in format FORMAT.
10646d36ef34Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10658b6d6341Smrg#
10668b6d6341Smrg# Substitute a variable $(am__tar) that is a command
10678b6d6341Smrg# writing to stdout a FORMAT-tarball containing the directory
10688b6d6341Smrg# $tardir.
10698b6d6341Smrg#     tardir=directory && $(am__tar) > result.tar
10708b6d6341Smrg#
10718b6d6341Smrg# Substitute a variable $(am__untar) that extract such
10728b6d6341Smrg# a tarball read from stdin.
10738b6d6341Smrg#     $(am__untar) < result.tar
10746d36ef34Smrg#
10758b6d6341SmrgAC_DEFUN([_AM_PROG_TAR],
10766d36ef34Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10776d36ef34Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10786d36ef34SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10796d36ef34Smrg
10806d36ef34Smrg# We'll loop over all known methods to create a tar archive until one works.
10818b6d6341Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10821abf7346Smrg
10836d36ef34Smrgm4_if([$1], [v7],
10846d36ef34Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10856d36ef34Smrg
10866d36ef34Smrg  [m4_case([$1],
10876d36ef34Smrg    [ustar],
10886d36ef34Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10896d36ef34Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10906d36ef34Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10916d36ef34Smrg      # and bug#13588).
10926d36ef34Smrg      am_max_uid=2097151 # 2^21 - 1
10936d36ef34Smrg      am_max_gid=$am_max_uid
10946d36ef34Smrg      # The $UID and $GID variables are not portable, so we need to resort
10956d36ef34Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10966d36ef34Smrg      # below are definitely unexpected, so allow the users to see them
10976d36ef34Smrg      # (that is, avoid stderr redirection).
10986d36ef34Smrg      am_uid=`id -u || echo unknown`
10996d36ef34Smrg      am_gid=`id -g || echo unknown`
11006d36ef34Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11016d36ef34Smrg      if test $am_uid -le $am_max_uid; then
11026d36ef34Smrg         AC_MSG_RESULT([yes])
11036d36ef34Smrg      else
11046d36ef34Smrg         AC_MSG_RESULT([no])
11056d36ef34Smrg         _am_tools=none
11066d36ef34Smrg      fi
11076d36ef34Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
11086d36ef34Smrg      if test $am_gid -le $am_max_gid; then
11096d36ef34Smrg         AC_MSG_RESULT([yes])
11106d36ef34Smrg      else
11116d36ef34Smrg        AC_MSG_RESULT([no])
11126d36ef34Smrg        _am_tools=none
11136d36ef34Smrg      fi],
11146d36ef34Smrg
11156d36ef34Smrg  [pax],
11166d36ef34Smrg    [],
11176d36ef34Smrg
11186d36ef34Smrg  [m4_fatal([Unknown tar format])])
11196d36ef34Smrg
11206d36ef34Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
11216d36ef34Smrg
11226d36ef34Smrg  # Go ahead even if we have the value already cached.  We do so because we
11236d36ef34Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
11246d36ef34Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
11256d36ef34Smrg
11266d36ef34Smrg  for _am_tool in $_am_tools; do
11276d36ef34Smrg    case $_am_tool in
11286d36ef34Smrg    gnutar)
11296d36ef34Smrg      for _am_tar in tar gnutar gtar; do
11306d36ef34Smrg        AM_RUN_LOG([$_am_tar --version]) && break
11316d36ef34Smrg      done
11326d36ef34Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11336d36ef34Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11346d36ef34Smrg      am__untar="$_am_tar -xf -"
11356d36ef34Smrg      ;;
11366d36ef34Smrg    plaintar)
11376d36ef34Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11386d36ef34Smrg      # ustar tarball either.
11396d36ef34Smrg      (tar --version) >/dev/null 2>&1 && continue
11406d36ef34Smrg      am__tar='tar chf - "$$tardir"'
11416d36ef34Smrg      am__tar_='tar chf - "$tardir"'
11426d36ef34Smrg      am__untar='tar xf -'
11436d36ef34Smrg      ;;
11446d36ef34Smrg    pax)
11456d36ef34Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11466d36ef34Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11476d36ef34Smrg      am__untar='pax -r'
11486d36ef34Smrg      ;;
11496d36ef34Smrg    cpio)
11506d36ef34Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11516d36ef34Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11526d36ef34Smrg      am__untar='cpio -i -H $1 -d'
11536d36ef34Smrg      ;;
11546d36ef34Smrg    none)
11556d36ef34Smrg      am__tar=false
11566d36ef34Smrg      am__tar_=false
11576d36ef34Smrg      am__untar=false
11586d36ef34Smrg      ;;
11596d36ef34Smrg    esac
11601abf7346Smrg
11616d36ef34Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11626d36ef34Smrg    # and am__untar set.
11636d36ef34Smrg    test -n "${am_cv_prog_tar_$1}" && break
11646d36ef34Smrg
11656d36ef34Smrg    # tar/untar a dummy directory, and stop if the command works.
11666d36ef34Smrg    rm -rf conftest.dir
11676d36ef34Smrg    mkdir conftest.dir
11686d36ef34Smrg    echo GrepMe > conftest.dir/file
11696d36ef34Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11706d36ef34Smrg    rm -rf conftest.dir
11716d36ef34Smrg    if test -s conftest.tar; then
11726d36ef34Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11736d36ef34Smrg      AM_RUN_LOG([cat conftest.dir/file])
11746d36ef34Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11756d36ef34Smrg    fi
11766d36ef34Smrg  done
11778b6d6341Smrg  rm -rf conftest.dir
11781abf7346Smrg
11796d36ef34Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11806d36ef34Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11816d36ef34Smrg
11828b6d6341SmrgAC_SUBST([am__tar])
11838b6d6341SmrgAC_SUBST([am__untar])
11848b6d6341Smrg]) # _AM_PROG_TAR
11851abf7346Smrg
11866d36ef34Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
11876d36ef34Smrg# 
11886d36ef34Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11896d36ef34Smrg#
11906d36ef34Smrg# This program is free software; you can redistribute it and/or modify
11916d36ef34Smrg# it under the terms of the GNU General Public License as published by
11926d36ef34Smrg# the Free Software Foundation; either version 2 of the License, or
11936d36ef34Smrg# (at your option) any later version.
11946d36ef34Smrg#
11956d36ef34Smrg# This program is distributed in the hope that it will be useful, but
11966d36ef34Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
11976d36ef34Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11986d36ef34Smrg# General Public License for more details.
11996d36ef34Smrg#
12006d36ef34Smrg# You should have received a copy of the GNU General Public License
12016d36ef34Smrg# along with this program; if not, write to the Free Software
12026d36ef34Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
12036d36ef34Smrg#
12046d36ef34Smrg# As a special exception to the GNU General Public License, if you
12056d36ef34Smrg# distribute this file as part of a program that contains a
12066d36ef34Smrg# configuration script generated by Autoconf, you may include it under
12076d36ef34Smrg# the same distribution terms that you use for the rest of that program.
12086d36ef34Smrg
12096d36ef34Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
12106d36ef34Smrg# ----------------------------------
12116d36ef34SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12126d36ef34Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12136d36ef34Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
12146d36ef34SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
12156d36ef34Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12166d36ef34Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12176d36ef34Smrgfi
12186d36ef34Smrgif test -n "$PKG_CONFIG"; then
12196d36ef34Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12206d36ef34Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12216d36ef34Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12226d36ef34Smrg		AC_MSG_RESULT([yes])
12236d36ef34Smrg	else
12246d36ef34Smrg		AC_MSG_RESULT([no])
12256d36ef34Smrg		PKG_CONFIG=""
12266d36ef34Smrg	fi
12276d36ef34Smrg		
12286d36ef34Smrgfi[]dnl
12296d36ef34Smrg])# PKG_PROG_PKG_CONFIG
12306d36ef34Smrg
12316d36ef34Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12326d36ef34Smrg#
12336d36ef34Smrg# Check to see whether a particular set of modules exists.  Similar
12346d36ef34Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12356d36ef34Smrg#
12366d36ef34Smrg#
12376d36ef34Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12386d36ef34Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
12396d36ef34Smrg# PKG_CHECK_EXISTS manually
12406d36ef34Smrg# --------------------------------------------------------------
12416d36ef34SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12426d36ef34Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12436d36ef34Smrgif test -n "$PKG_CONFIG" && \
12446d36ef34Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12456d36ef34Smrg  m4_ifval([$2], [$2], [:])
12466d36ef34Smrgm4_ifvaln([$3], [else
12476d36ef34Smrg  $3])dnl
12486d36ef34Smrgfi])
12496d36ef34Smrg
12506d36ef34Smrg
12516d36ef34Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12526d36ef34Smrg# ---------------------------------------------
12536d36ef34Smrgm4_define([_PKG_CONFIG],
12546d36ef34Smrg[if test -n "$$1"; then
12556d36ef34Smrg    pkg_cv_[]$1="$$1"
12566d36ef34Smrg elif test -n "$PKG_CONFIG"; then
12576d36ef34Smrg    PKG_CHECK_EXISTS([$3],
12586d36ef34Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
12596d36ef34Smrg		     [pkg_failed=yes])
12606d36ef34Smrg else
12616d36ef34Smrg    pkg_failed=untried
12626d36ef34Smrgfi[]dnl
12636d36ef34Smrg])# _PKG_CONFIG
12646d36ef34Smrg
12656d36ef34Smrg# _PKG_SHORT_ERRORS_SUPPORTED
12666d36ef34Smrg# -----------------------------
12676d36ef34SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12686d36ef34Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12696d36ef34Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12706d36ef34Smrg        _pkg_short_errors_supported=yes
12716d36ef34Smrgelse
12726d36ef34Smrg        _pkg_short_errors_supported=no
12736d36ef34Smrgfi[]dnl
12746d36ef34Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
12756d36ef34Smrg
12766d36ef34Smrg
12776d36ef34Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12786d36ef34Smrg# [ACTION-IF-NOT-FOUND])
12796d36ef34Smrg#
12806d36ef34Smrg#
12816d36ef34Smrg# Note that if there is a possibility the first call to
12826d36ef34Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12836d36ef34Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12846d36ef34Smrg#
12856d36ef34Smrg#
12866d36ef34Smrg# --------------------------------------------------------------
12876d36ef34SmrgAC_DEFUN([PKG_CHECK_MODULES],
12886d36ef34Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12896d36ef34SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12906d36ef34SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12916d36ef34Smrg
12926d36ef34Smrgpkg_failed=no
12936d36ef34SmrgAC_MSG_CHECKING([for $1])
12946d36ef34Smrg
12956d36ef34Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12966d36ef34Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12976d36ef34Smrg
12986d36ef34Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12996d36ef34Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13006d36ef34SmrgSee the pkg-config man page for more details.])
13016d36ef34Smrg
13026d36ef34Smrgif test $pkg_failed = yes; then
13036d36ef34Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13046d36ef34Smrg        if test $_pkg_short_errors_supported = yes; then
13056d36ef34Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
13066d36ef34Smrg        else 
13076d36ef34Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
13086d36ef34Smrg        fi
13096d36ef34Smrg	# Put the nasty error message in config.log where it belongs
13106d36ef34Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13116d36ef34Smrg
13126d36ef34Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
13136d36ef34Smrg[Package requirements ($2) were not met:
13146d36ef34Smrg
13156d36ef34Smrg$$1_PKG_ERRORS
13166d36ef34Smrg
13176d36ef34SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13186d36ef34Smrginstalled software in a non-standard prefix.
13196d36ef34Smrg
13206d36ef34Smrg_PKG_TEXT
13216d36ef34Smrg])],
13226d36ef34Smrg		[AC_MSG_RESULT([no])
13236d36ef34Smrg                $4])
13246d36ef34Smrgelif test $pkg_failed = untried; then
13256d36ef34Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
13266d36ef34Smrg[The pkg-config script could not be found or is too old.  Make sure it
13276d36ef34Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13286d36ef34Smrgpath to pkg-config.
13296d36ef34Smrg
13306d36ef34Smrg_PKG_TEXT
13316d36ef34Smrg
13326d36ef34SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13336d36ef34Smrg		[$4])
13346d36ef34Smrgelse
13356d36ef34Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13366d36ef34Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13376d36ef34Smrg        AC_MSG_RESULT([yes])
13386d36ef34Smrg	ifelse([$3], , :, [$3])
13396d36ef34Smrgfi[]dnl
13406d36ef34Smrg])# PKG_CHECK_MODULES
13416d36ef34Smrg
13428b6d6341Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13438b6d6341Smrgdnl
134423a8d56dSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13458b6d6341Smrgdnl 
13468b6d6341Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
134723a8d56dSmrgdnl copy of this software and associated documentation files (the "Software"),
134823a8d56dSmrgdnl to deal in the Software without restriction, including without limitation
134923a8d56dSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
135023a8d56dSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
135123a8d56dSmrgdnl Software is furnished to do so, subject to the following conditions:
13528b6d6341Smrgdnl
135323a8d56dSmrgdnl The above copyright notice and this permission notice (including the next
135423a8d56dSmrgdnl paragraph) shall be included in all copies or substantial portions of the
135523a8d56dSmrgdnl Software.
13568b6d6341Smrgdnl
135723a8d56dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
135823a8d56dSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
135923a8d56dSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
136023a8d56dSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
136123a8d56dSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
136223a8d56dSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
136323a8d56dSmrgdnl DEALINGS IN THE SOFTWARE.
13648b6d6341Smrg
13658b6d6341Smrg# XORG_MACROS_VERSION(required-version)
13668b6d6341Smrg# -------------------------------------
13678b6d6341Smrg# Minimum version: 1.1.0
13681abf7346Smrg#
13698b6d6341Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13708b6d6341Smrg# your configure.ac with the minimum required version, such as:
13718b6d6341Smrg# XORG_MACROS_VERSION(1.1)
13728b6d6341Smrg#
13738b6d6341Smrg# To ensure that this macro is defined, also add:
13748b6d6341Smrg# m4_ifndef([XORG_MACROS_VERSION],
13758b6d6341Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13768b6d6341Smrg#
13778b6d6341Smrg#
13788b6d6341Smrg# See the "minimum version" comment for each macro you use to see what 
13798b6d6341Smrg# version you require.
13808b6d6341Smrgm4_defun([XORG_MACROS_VERSION],[
13816d36ef34Smrgm4_define([vers_have], [1.17])
13828b6d6341Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13838b6d6341Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13848b6d6341Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13858b6d6341Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13868b6d6341Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13878b6d6341Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13888b6d6341Smrgm4_undefine([vers_have])
13898b6d6341Smrgm4_undefine([maj_have])
13908b6d6341Smrgm4_undefine([maj_needed])
13918b6d6341Smrg]) # XORG_MACROS_VERSION
13921abf7346Smrg
13938b6d6341Smrg# XORG_PROG_RAWCPP()
13948b6d6341Smrg# ------------------
13958b6d6341Smrg# Minimum version: 1.0.0
13968b6d6341Smrg#
13978b6d6341Smrg# Find cpp program and necessary flags for use in pre-processing text files
13988b6d6341Smrg# such as man pages and config files
13998b6d6341SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14008b6d6341SmrgAC_REQUIRE([AC_PROG_CPP])
14018b6d6341SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
14028b6d6341Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14031abf7346Smrg
14048b6d6341Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14058b6d6341Smrg# which is not the best choice for supporting other OS'es, but covers most
14068b6d6341Smrg# of the ones we need for now.
14078b6d6341SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14081633cc4bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14098b6d6341Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14108b6d6341Smrg	AC_MSG_RESULT([no])
14118b6d6341Smrgelse
14128b6d6341Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14138b6d6341Smrg		RAWCPPFLAGS=-undef
14148b6d6341Smrg		AC_MSG_RESULT([yes])
14158b6d6341Smrg	# under Cygwin unix is still defined even with -undef
14168b6d6341Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14178b6d6341Smrg		RAWCPPFLAGS="-undef -ansi"
14188b6d6341Smrg		AC_MSG_RESULT([yes, with -ansi])
14198b6d6341Smrg	else
14208b6d6341Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
14218b6d6341Smrg	fi
14228b6d6341Smrgfi
14238b6d6341Smrgrm -f conftest.$ac_ext
14241abf7346Smrg
14258b6d6341SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
14261633cc4bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
14278b6d6341Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14288b6d6341Smrg	AC_MSG_RESULT([no])
14298b6d6341Smrgelse
14308b6d6341Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14318b6d6341Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14328b6d6341Smrg		AC_MSG_RESULT([yes])
14338b6d6341Smrg	else
14348b6d6341Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14358b6d6341Smrg	fi
14368b6d6341Smrgfi
14378b6d6341Smrgrm -f conftest.$ac_ext
14388b6d6341SmrgAC_SUBST(RAWCPPFLAGS)
14398b6d6341Smrg]) # XORG_PROG_RAWCPP
14401abf7346Smrg
14418b6d6341Smrg# XORG_MANPAGE_SECTIONS()
14428b6d6341Smrg# -----------------------
14438b6d6341Smrg# Minimum version: 1.0.0
14441abf7346Smrg#
14458b6d6341Smrg# Determine which sections man pages go in for the different man page types
14468b6d6341Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14478b6d6341Smrg# Not sure if there's any better way than just hardcoding by OS name.
14488b6d6341Smrg# Override default settings by setting environment variables
144923a8d56dSmrg# Added MAN_SUBSTS in version 1.8
145023a8d56dSmrg# Added AC_PROG_SED in version 1.8
14511abf7346Smrg
14528b6d6341SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14538b6d6341SmrgAC_REQUIRE([AC_CANONICAL_HOST])
145423a8d56dSmrgAC_REQUIRE([AC_PROG_SED])
14551abf7346Smrg
14568b6d6341Smrgif test x$APP_MAN_SUFFIX = x    ; then
14578b6d6341Smrg    APP_MAN_SUFFIX=1
14588b6d6341Smrgfi
14598b6d6341Smrgif test x$APP_MAN_DIR = x    ; then
14608b6d6341Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14618b6d6341Smrgfi
14621abf7346Smrg
14638b6d6341Smrgif test x$LIB_MAN_SUFFIX = x    ; then
14648b6d6341Smrg    LIB_MAN_SUFFIX=3
14658b6d6341Smrgfi
14668b6d6341Smrgif test x$LIB_MAN_DIR = x    ; then
14678b6d6341Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14688b6d6341Smrgfi
14691abf7346Smrg
14708b6d6341Smrgif test x$FILE_MAN_SUFFIX = x    ; then
14718b6d6341Smrg    case $host_os in
14728b6d6341Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14738b6d6341Smrg	*)		FILE_MAN_SUFFIX=5  ;;
14748b6d6341Smrg    esac
14758b6d6341Smrgfi
14768b6d6341Smrgif test x$FILE_MAN_DIR = x    ; then
14778b6d6341Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14788b6d6341Smrgfi
14791abf7346Smrg
14808b6d6341Smrgif test x$MISC_MAN_SUFFIX = x    ; then
14818b6d6341Smrg    case $host_os in
14828b6d6341Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14838b6d6341Smrg	*)		MISC_MAN_SUFFIX=7  ;;
14848b6d6341Smrg    esac
14858b6d6341Smrgfi
14868b6d6341Smrgif test x$MISC_MAN_DIR = x    ; then
14878b6d6341Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14888b6d6341Smrgfi
14891abf7346Smrg
14908b6d6341Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14918b6d6341Smrg    case $host_os in
14928b6d6341Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14938b6d6341Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14948b6d6341Smrg    esac
14958b6d6341Smrgfi
14968b6d6341Smrgif test x$DRIVER_MAN_DIR = x    ; then
14978b6d6341Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14988b6d6341Smrgfi
14991abf7346Smrg
15008b6d6341Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15018b6d6341Smrg    case $host_os in
15028b6d6341Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15038b6d6341Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15048b6d6341Smrg    esac
15058b6d6341Smrgfi
15068b6d6341Smrgif test x$ADMIN_MAN_DIR = x    ; then
15078b6d6341Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15088b6d6341Smrgfi
15091abf7346Smrg
15108b6d6341Smrg
15118b6d6341SmrgAC_SUBST([APP_MAN_SUFFIX])
15128b6d6341SmrgAC_SUBST([LIB_MAN_SUFFIX])
15138b6d6341SmrgAC_SUBST([FILE_MAN_SUFFIX])
15148b6d6341SmrgAC_SUBST([MISC_MAN_SUFFIX])
15158b6d6341SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15168b6d6341SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15178b6d6341SmrgAC_SUBST([APP_MAN_DIR])
15188b6d6341SmrgAC_SUBST([LIB_MAN_DIR])
15198b6d6341SmrgAC_SUBST([FILE_MAN_DIR])
15208b6d6341SmrgAC_SUBST([MISC_MAN_DIR])
15218b6d6341SmrgAC_SUBST([DRIVER_MAN_DIR])
15228b6d6341SmrgAC_SUBST([ADMIN_MAN_DIR])
152323a8d56dSmrg
152423a8d56dSmrgXORG_MAN_PAGE="X Version 11"
152523a8d56dSmrgAC_SUBST([XORG_MAN_PAGE])
152623a8d56dSmrgMAN_SUBSTS="\
152723a8d56dSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
152823a8d56dSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
152923a8d56dSmrg	-e 's|__xservername__|Xorg|g' \
153023a8d56dSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
153123a8d56dSmrg	-e 's|__projectroot__|\$(prefix)|g' \
153223a8d56dSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
153323a8d56dSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
153423a8d56dSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
153523a8d56dSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
153623a8d56dSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
153723a8d56dSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
153823a8d56dSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
153923a8d56dSmrgAC_SUBST([MAN_SUBSTS])
154023a8d56dSmrg
15418b6d6341Smrg]) # XORG_MANPAGE_SECTIONS
15428b6d6341Smrg
154323a8d56dSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
154423a8d56dSmrg# ------------------------
154523a8d56dSmrg# Minimum version: 1.7.0
154623a8d56dSmrg#
154723a8d56dSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
154823a8d56dSmrg# provided by xorg-sgml-doctools, if installed.
154923a8d56dSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
155023a8d56dSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
155123a8d56dSmrgXORG_SGML_PATH=
155223a8d56dSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
155323a8d56dSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
155423a8d56dSmrg    [m4_ifval([$1],[:],
155523a8d56dSmrg        [if test x"$cross_compiling" != x"yes" ; then
155623a8d56dSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
155723a8d56dSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
155823a8d56dSmrg         fi])
155923a8d56dSmrg    ])
156023a8d56dSmrg
156123a8d56dSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
156223a8d56dSmrg# the path and the name of the doc stylesheet
156323a8d56dSmrgif test "x$XORG_SGML_PATH" != "x" ; then
156423a8d56dSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
156523a8d56dSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
156623a8d56dSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
156723a8d56dSmrgelse
156823a8d56dSmrg   AC_MSG_RESULT([no])
156923a8d56dSmrgfi
157023a8d56dSmrg
157123a8d56dSmrgAC_SUBST(XORG_SGML_PATH)
157223a8d56dSmrgAC_SUBST(STYLESHEET_SRCDIR)
157323a8d56dSmrgAC_SUBST(XSL_STYLESHEET)
157423a8d56dSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
157523a8d56dSmrg]) # XORG_CHECK_SGML_DOCTOOLS
157623a8d56dSmrg
15778b6d6341Smrg# XORG_CHECK_LINUXDOC
15788b6d6341Smrg# -------------------
15798b6d6341Smrg# Minimum version: 1.0.0
15808b6d6341Smrg#
15818b6d6341Smrg# Defines the variable MAKE_TEXT if the necessary tools and
15828b6d6341Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15838b6d6341Smrg# Whether or not the necessary tools and files are found can be checked
15848b6d6341Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15858b6d6341SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
158623a8d56dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
158723a8d56dSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
15881abf7346Smrg
15898b6d6341SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
15901abf7346Smrg
159123a8d56dSmrgAC_MSG_CHECKING([whether to build documentation])
15921abf7346Smrg
159323a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15948b6d6341Smrg   BUILDDOC=yes
15958b6d6341Smrgelse
15968b6d6341Smrg   BUILDDOC=no
15978b6d6341Smrgfi
15981abf7346Smrg
15998b6d6341SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16001abf7346Smrg
16018b6d6341SmrgAC_MSG_RESULT([$BUILDDOC])
16021abf7346Smrg
160323a8d56dSmrgAC_MSG_CHECKING([whether to build pdf documentation])
16041abf7346Smrg
160523a8d56dSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16068b6d6341Smrg   BUILDPDFDOC=yes
16078b6d6341Smrgelse
16088b6d6341Smrg   BUILDPDFDOC=no
16098b6d6341Smrgfi
16101abf7346Smrg
16118b6d6341SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16121abf7346Smrg
16138b6d6341SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16141abf7346Smrg
161523a8d56dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16168b6d6341SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16178b6d6341SmrgMAKE_PDF="$PS2PDF"
16188b6d6341SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
16191abf7346Smrg
16208b6d6341SmrgAC_SUBST(MAKE_TEXT)
16218b6d6341SmrgAC_SUBST(MAKE_PS)
16228b6d6341SmrgAC_SUBST(MAKE_PDF)
16238b6d6341SmrgAC_SUBST(MAKE_HTML)
16248b6d6341Smrg]) # XORG_CHECK_LINUXDOC
16258b6d6341Smrg
16268b6d6341Smrg# XORG_CHECK_DOCBOOK
16278b6d6341Smrg# -------------------
16288b6d6341Smrg# Minimum version: 1.0.0
16298b6d6341Smrg#
16308b6d6341Smrg# Checks for the ability to build output formats from SGML DocBook source.
16318b6d6341Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16328b6d6341Smrg# indicates whether the necessary tools and files are found and, if set,
16338b6d6341Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16348b6d6341SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
163523a8d56dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
163623a8d56dSmrg
16378b6d6341SmrgBUILDTXTDOC=no
16388b6d6341SmrgBUILDPDFDOC=no
16398b6d6341SmrgBUILDPSDOC=no
16408b6d6341SmrgBUILDHTMLDOC=no
16411abf7346Smrg
16428b6d6341SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16438b6d6341SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16448b6d6341SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16458b6d6341SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16461abf7346Smrg
164723a8d56dSmrgAC_MSG_CHECKING([whether to build text documentation])
164823a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16498b6d6341Smrg   test x$BUILD_TXTDOC != xno; then
16508b6d6341Smrg	BUILDTXTDOC=yes
16518b6d6341Smrgfi
16528b6d6341SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16538b6d6341SmrgAC_MSG_RESULT([$BUILDTXTDOC])
16541abf7346Smrg
165523a8d56dSmrgAC_MSG_CHECKING([whether to build PDF documentation])
165623a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16578b6d6341Smrg   test x$BUILD_PDFDOC != xno; then
16588b6d6341Smrg	BUILDPDFDOC=yes
16598b6d6341Smrgfi
16608b6d6341SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16618b6d6341SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16621abf7346Smrg
166323a8d56dSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
166423a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16658b6d6341Smrg   test x$BUILD_PSDOC != xno; then
16668b6d6341Smrg	BUILDPSDOC=yes
16678b6d6341Smrgfi
16688b6d6341SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16698b6d6341SmrgAC_MSG_RESULT([$BUILDPSDOC])
16701abf7346Smrg
167123a8d56dSmrgAC_MSG_CHECKING([whether to build HTML documentation])
167223a8d56dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16738b6d6341Smrg   test x$BUILD_HTMLDOC != xno; then
16748b6d6341Smrg	BUILDHTMLDOC=yes
16758b6d6341Smrgfi
16768b6d6341SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16778b6d6341SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16781abf7346Smrg
16798b6d6341SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16808b6d6341SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16818b6d6341SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16828b6d6341SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16831abf7346Smrg
16848b6d6341SmrgAC_SUBST(MAKE_TEXT)
16858b6d6341SmrgAC_SUBST(MAKE_PS)
16868b6d6341SmrgAC_SUBST(MAKE_PDF)
16878b6d6341SmrgAC_SUBST(MAKE_HTML)
16888b6d6341Smrg]) # XORG_CHECK_DOCBOOK
16891abf7346Smrg
169023a8d56dSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
169123a8d56dSmrg# ----------------
169223a8d56dSmrg# Minimum version: 1.5.0
169323a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
169423a8d56dSmrg#
169523a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
169623a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
169723a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
169823a8d56dSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
169923a8d56dSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
170023a8d56dSmrg# --with-xmlto assumes 'auto'.
170123a8d56dSmrg#
170223a8d56dSmrg# Interface to module:
170323a8d56dSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
170423a8d56dSmrg# XMLTO:	returns the path of the xmlto program found
170523a8d56dSmrg#		returns the path set by the user in the environment
170623a8d56dSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
170723a8d56dSmrg#		'no' user instructs the module not to use xmlto
170823a8d56dSmrg#
170923a8d56dSmrg# Added in version 1.10.0
171023a8d56dSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
171123a8d56dSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
171223a8d56dSmrg#
171323a8d56dSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
171423a8d56dSmrg#
171523a8d56dSmrgAC_DEFUN([XORG_WITH_XMLTO],[
171623a8d56dSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
171723a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
171823a8d56dSmrgAC_ARG_WITH(xmlto,
171923a8d56dSmrg	AS_HELP_STRING([--with-xmlto],
172023a8d56dSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
172123a8d56dSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
172223a8d56dSmrgm4_undefine([_defopt])
172323a8d56dSmrg
172423a8d56dSmrgif test "x$use_xmlto" = x"auto"; then
172523a8d56dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
172623a8d56dSmrg   if test "x$XMLTO" = "x"; then
172723a8d56dSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
172823a8d56dSmrg	have_xmlto=no
172923a8d56dSmrg   else
173023a8d56dSmrg        have_xmlto=yes
173123a8d56dSmrg   fi
173223a8d56dSmrgelif test "x$use_xmlto" = x"yes" ; then
173323a8d56dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
173423a8d56dSmrg   if test "x$XMLTO" = "x"; then
173523a8d56dSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
173623a8d56dSmrg   fi
173723a8d56dSmrg   have_xmlto=yes
173823a8d56dSmrgelif test "x$use_xmlto" = x"no" ; then
173923a8d56dSmrg   if test "x$XMLTO" != "x"; then
174023a8d56dSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
174123a8d56dSmrg   fi
174223a8d56dSmrg   have_xmlto=no
174323a8d56dSmrgelse
174423a8d56dSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
174523a8d56dSmrgfi
174623a8d56dSmrg
174723a8d56dSmrg# Test for a minimum version of xmlto, if provided.
174823a8d56dSmrgm4_ifval([$1],
174923a8d56dSmrg[if test "$have_xmlto" = yes; then
175023a8d56dSmrg    # scrape the xmlto version
175123a8d56dSmrg    AC_MSG_CHECKING([the xmlto version])
175223a8d56dSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
175323a8d56dSmrg    AC_MSG_RESULT([$xmlto_version])
175423a8d56dSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
175523a8d56dSmrg        [if test "x$use_xmlto" = xauto; then
175623a8d56dSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
175723a8d56dSmrg            have_xmlto=no
175823a8d56dSmrg        else
175923a8d56dSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
176023a8d56dSmrg        fi])
176123a8d56dSmrgfi])
176223a8d56dSmrg
176323a8d56dSmrg# Test for the ability of xmlto to generate a text target
176423a8d56dSmrghave_xmlto_text=no
176523a8d56dSmrgcat > conftest.xml << "EOF"
176623a8d56dSmrgEOF
176723a8d56dSmrgAS_IF([test "$have_xmlto" = yes],
176823a8d56dSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
176923a8d56dSmrg             [have_xmlto_text=yes],
177023a8d56dSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
177123a8d56dSmrgrm -f conftest.xml
177223a8d56dSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
177323a8d56dSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
177423a8d56dSmrg]) # XORG_WITH_XMLTO
177523a8d56dSmrg
17761633cc4bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
17771633cc4bSmrg# --------------------------------------------
17781633cc4bSmrg# Minimum version: 1.12.0
17791633cc4bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
17801633cc4bSmrg#
17811633cc4bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
17821633cc4bSmrg# XML-based language used for the transformation of XML documents.
17831633cc4bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
17841633cc4bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
17851633cc4bSmrg# The XSLT processor is often used as a standalone tool for transformations.
17861633cc4bSmrg# It should not be assumed that this tool is used only to work with documnetation.
17871633cc4bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
17881633cc4bSmrg#
17891633cc4bSmrg# Interface to module:
17901633cc4bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
17911633cc4bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
17921633cc4bSmrg#		 returns the path set by the user in the environment
17931633cc4bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
17941633cc4bSmrg#		  'no' user instructs the module not to use xsltproc
17951633cc4bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
17961633cc4bSmrg#
17971633cc4bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
17981633cc4bSmrg#
17991633cc4bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
18001633cc4bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
18011633cc4bSmrg# Preserves the interface, should it be implemented later
18021633cc4bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
18031633cc4bSmrgm4_define([_defopt], m4_default([$2], [auto]))
18041633cc4bSmrgAC_ARG_WITH(xsltproc,
18051633cc4bSmrg	AS_HELP_STRING([--with-xsltproc],
18061633cc4bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
18071633cc4bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
18081633cc4bSmrgm4_undefine([_defopt])
18091633cc4bSmrg
18101633cc4bSmrgif test "x$use_xsltproc" = x"auto"; then
18111633cc4bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18121633cc4bSmrg   if test "x$XSLTPROC" = "x"; then
18131633cc4bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
18141633cc4bSmrg	have_xsltproc=no
18151633cc4bSmrg   else
18161633cc4bSmrg        have_xsltproc=yes
18171633cc4bSmrg   fi
18181633cc4bSmrgelif test "x$use_xsltproc" = x"yes" ; then
18191633cc4bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18201633cc4bSmrg   if test "x$XSLTPROC" = "x"; then
18211633cc4bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
18221633cc4bSmrg   fi
18231633cc4bSmrg   have_xsltproc=yes
18241633cc4bSmrgelif test "x$use_xsltproc" = x"no" ; then
18251633cc4bSmrg   if test "x$XSLTPROC" != "x"; then
18261633cc4bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
18271633cc4bSmrg   fi
18281633cc4bSmrg   have_xsltproc=no
18291633cc4bSmrgelse
18301633cc4bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18311633cc4bSmrgfi
18321633cc4bSmrg
18331633cc4bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18341633cc4bSmrg]) # XORG_WITH_XSLTPROC
18351633cc4bSmrg
18361633cc4bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18371633cc4bSmrg# ----------------------------------------
18381633cc4bSmrg# Minimum version: 1.15.0
18391633cc4bSmrg#
18401633cc4bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
18411633cc4bSmrg# scanning arbitrary text files, extracting information from those text files,
18421633cc4bSmrg# and printing reports based on that information.
18431633cc4bSmrg#
18441633cc4bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18451633cc4bSmrg#
18461633cc4bSmrg# Interface to module:
18471633cc4bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
18481633cc4bSmrg# PERL:	     returns the path of the perl program found
18491633cc4bSmrg#	     returns the path set by the user in the environment
18501633cc4bSmrg# --with-perl: 'yes' user instructs the module to use perl
18511633cc4bSmrg#	       'no' user instructs the module not to use perl
18521633cc4bSmrg# have_perl: returns yes if perl found in PATH or no
18531633cc4bSmrg#
18541633cc4bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18551633cc4bSmrg#
18561633cc4bSmrgAC_DEFUN([XORG_WITH_PERL],[
18571633cc4bSmrgAC_ARG_VAR([PERL], [Path to perl command])
18581633cc4bSmrg# Preserves the interface, should it be implemented later
18591633cc4bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18601633cc4bSmrgm4_define([_defopt], m4_default([$2], [auto]))
18611633cc4bSmrgAC_ARG_WITH(perl,
18621633cc4bSmrg	AS_HELP_STRING([--with-perl],
18631633cc4bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18641633cc4bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
18651633cc4bSmrgm4_undefine([_defopt])
18661633cc4bSmrg
18671633cc4bSmrgif test "x$use_perl" = x"auto"; then
18681633cc4bSmrg   AC_PATH_PROG([PERL], [perl])
18691633cc4bSmrg   if test "x$PERL" = "x"; then
18701633cc4bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18711633cc4bSmrg	have_perl=no
18721633cc4bSmrg   else
18731633cc4bSmrg        have_perl=yes
18741633cc4bSmrg   fi
18751633cc4bSmrgelif test "x$use_perl" = x"yes" ; then
18761633cc4bSmrg   AC_PATH_PROG([PERL], [perl])
18771633cc4bSmrg   if test "x$PERL" = "x"; then
18781633cc4bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18791633cc4bSmrg   fi
18801633cc4bSmrg   have_perl=yes
18811633cc4bSmrgelif test "x$use_perl" = x"no" ; then
18821633cc4bSmrg   if test "x$PERL" != "x"; then
18831633cc4bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18841633cc4bSmrg   fi
18851633cc4bSmrg   have_perl=no
18861633cc4bSmrgelse
18871633cc4bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18881633cc4bSmrgfi
18891633cc4bSmrg
18901633cc4bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18911633cc4bSmrg]) # XORG_WITH_PERL
18921633cc4bSmrg
189323a8d56dSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
189423a8d56dSmrg# ----------------
189523a8d56dSmrg# Minimum version: 1.5.0
189623a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
189723a8d56dSmrg#
189823a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
189923a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
190023a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
190123a8d56dSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
190223a8d56dSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
190323a8d56dSmrg# --with-asciidoc assumes 'auto'.
190423a8d56dSmrg#
190523a8d56dSmrg# Interface to module:
190623a8d56dSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
190723a8d56dSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
190823a8d56dSmrg#		 returns the path set by the user in the environment
190923a8d56dSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
191023a8d56dSmrg#		  'no' user instructs the module not to use asciidoc
191123a8d56dSmrg#
191223a8d56dSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
191323a8d56dSmrg#
191423a8d56dSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
191523a8d56dSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
191623a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
191723a8d56dSmrgAC_ARG_WITH(asciidoc,
191823a8d56dSmrg	AS_HELP_STRING([--with-asciidoc],
191923a8d56dSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
192023a8d56dSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
192123a8d56dSmrgm4_undefine([_defopt])
192223a8d56dSmrg
192323a8d56dSmrgif test "x$use_asciidoc" = x"auto"; then
192423a8d56dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
192523a8d56dSmrg   if test "x$ASCIIDOC" = "x"; then
192623a8d56dSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
192723a8d56dSmrg	have_asciidoc=no
192823a8d56dSmrg   else
192923a8d56dSmrg        have_asciidoc=yes
193023a8d56dSmrg   fi
193123a8d56dSmrgelif test "x$use_asciidoc" = x"yes" ; then
193223a8d56dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
193323a8d56dSmrg   if test "x$ASCIIDOC" = "x"; then
193423a8d56dSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
193523a8d56dSmrg   fi
193623a8d56dSmrg   have_asciidoc=yes
193723a8d56dSmrgelif test "x$use_asciidoc" = x"no" ; then
193823a8d56dSmrg   if test "x$ASCIIDOC" != "x"; then
193923a8d56dSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
194023a8d56dSmrg   fi
194123a8d56dSmrg   have_asciidoc=no
194223a8d56dSmrgelse
194323a8d56dSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
194423a8d56dSmrgfi
194523a8d56dSmrgm4_ifval([$1],
194623a8d56dSmrg[if test "$have_asciidoc" = yes; then
194723a8d56dSmrg    # scrape the asciidoc version
194823a8d56dSmrg    AC_MSG_CHECKING([the asciidoc version])
194923a8d56dSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
195023a8d56dSmrg    AC_MSG_RESULT([$asciidoc_version])
195123a8d56dSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
195223a8d56dSmrg        [if test "x$use_asciidoc" = xauto; then
195323a8d56dSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
195423a8d56dSmrg            have_asciidoc=no
195523a8d56dSmrg        else
195623a8d56dSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
195723a8d56dSmrg        fi])
195823a8d56dSmrgfi])
195923a8d56dSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
196023a8d56dSmrg]) # XORG_WITH_ASCIIDOC
196123a8d56dSmrg
196223a8d56dSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
196323a8d56dSmrg# --------------------------------
196423a8d56dSmrg# Minimum version: 1.5.0
196523a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
196623a8d56dSmrg#
196723a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
196823a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
196923a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
197023a8d56dSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
197123a8d56dSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
197223a8d56dSmrg# --with-doxygen assumes 'auto'.
197323a8d56dSmrg#
197423a8d56dSmrg# Interface to module:
197523a8d56dSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
197623a8d56dSmrg# DOXYGEN:	 returns the path of the doxygen program found
197723a8d56dSmrg#		 returns the path set by the user in the environment
197823a8d56dSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
197923a8d56dSmrg#		  'no' user instructs the module not to use doxygen
198023a8d56dSmrg#
198123a8d56dSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
198223a8d56dSmrg#
198323a8d56dSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
198423a8d56dSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
198523a8d56dSmrgm4_define([_defopt], m4_default([$2], [auto]))
198623a8d56dSmrgAC_ARG_WITH(doxygen,
198723a8d56dSmrg	AS_HELP_STRING([--with-doxygen],
198823a8d56dSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
198923a8d56dSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
199023a8d56dSmrgm4_undefine([_defopt])
199123a8d56dSmrg
199223a8d56dSmrgif test "x$use_doxygen" = x"auto"; then
199323a8d56dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
199423a8d56dSmrg   if test "x$DOXYGEN" = "x"; then
199523a8d56dSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
199623a8d56dSmrg	have_doxygen=no
199723a8d56dSmrg   else
199823a8d56dSmrg        have_doxygen=yes
199923a8d56dSmrg   fi
200023a8d56dSmrgelif test "x$use_doxygen" = x"yes" ; then
200123a8d56dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
200223a8d56dSmrg   if test "x$DOXYGEN" = "x"; then
200323a8d56dSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
200423a8d56dSmrg   fi
200523a8d56dSmrg   have_doxygen=yes
200623a8d56dSmrgelif test "x$use_doxygen" = x"no" ; then
200723a8d56dSmrg   if test "x$DOXYGEN" != "x"; then
200823a8d56dSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
200923a8d56dSmrg   fi
201023a8d56dSmrg   have_doxygen=no
201123a8d56dSmrgelse
201223a8d56dSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
201323a8d56dSmrgfi
201423a8d56dSmrgm4_ifval([$1],
201523a8d56dSmrg[if test "$have_doxygen" = yes; then
201623a8d56dSmrg    # scrape the doxygen version
201723a8d56dSmrg    AC_MSG_CHECKING([the doxygen version])
201823a8d56dSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
201923a8d56dSmrg    AC_MSG_RESULT([$doxygen_version])
202023a8d56dSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
202123a8d56dSmrg        [if test "x$use_doxygen" = xauto; then
202223a8d56dSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
202323a8d56dSmrg            have_doxygen=no
202423a8d56dSmrg        else
202523a8d56dSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
202623a8d56dSmrg        fi])
202723a8d56dSmrgfi])
202823a8d56dSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
202923a8d56dSmrg]) # XORG_WITH_DOXYGEN
203023a8d56dSmrg
203123a8d56dSmrg# XORG_WITH_GROFF([DEFAULT])
203223a8d56dSmrg# ----------------
203323a8d56dSmrg# Minimum version: 1.6.0
203423a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
203523a8d56dSmrg#
203623a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
203723a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
203823a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
203923a8d56dSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
204023a8d56dSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
204123a8d56dSmrg# --with-groff assumes 'auto'.
204223a8d56dSmrg#
204323a8d56dSmrg# Interface to module:
204423a8d56dSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
204523a8d56dSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
204623a8d56dSmrg# HAVE_GROFF_MS: the -ms macros package
204723a8d56dSmrg# GROFF:	 returns the path of the groff program found
204823a8d56dSmrg#		 returns the path set by the user in the environment
204923a8d56dSmrg# --with-groff:	 'yes' user instructs the module to use groff
205023a8d56dSmrg#		 'no' user instructs the module not to use groff
205123a8d56dSmrg#
205223a8d56dSmrg# Added in version 1.9.0:
205323a8d56dSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
205423a8d56dSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
205523a8d56dSmrg#		   psselect from the psutils package.
205623a8d56dSmrg#		   the ghostcript package. Refer to the grohtml man pages
205723a8d56dSmrg#
205823a8d56dSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
205923a8d56dSmrg#
206023a8d56dSmrg# OS and distros often splits groff in a basic and full package, the former
206123a8d56dSmrg# having the groff program and the later having devices, fonts and macros
206223a8d56dSmrg# Checking for the groff executable is not enough.
206323a8d56dSmrg#
206423a8d56dSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
206523a8d56dSmrg# unset HAVE_GROFF or GROFF env variables.
206623a8d56dSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
206723a8d56dSmrg#
206823a8d56dSmrgAC_DEFUN([XORG_WITH_GROFF],[
206923a8d56dSmrgAC_ARG_VAR([GROFF], [Path to groff command])
207023a8d56dSmrgm4_define([_defopt], m4_default([$1], [auto]))
207123a8d56dSmrgAC_ARG_WITH(groff,
207223a8d56dSmrg	AS_HELP_STRING([--with-groff],
207323a8d56dSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
207423a8d56dSmrg	   [use_groff=$withval], [use_groff=]_defopt)
207523a8d56dSmrgm4_undefine([_defopt])
207623a8d56dSmrg
207723a8d56dSmrgif test "x$use_groff" = x"auto"; then
207823a8d56dSmrg   AC_PATH_PROG([GROFF], [groff])
207923a8d56dSmrg   if test "x$GROFF" = "x"; then
208023a8d56dSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
208123a8d56dSmrg	have_groff=no
208223a8d56dSmrg   else
208323a8d56dSmrg        have_groff=yes
208423a8d56dSmrg   fi
208523a8d56dSmrgelif test "x$use_groff" = x"yes" ; then
208623a8d56dSmrg   AC_PATH_PROG([GROFF], [groff])
208723a8d56dSmrg   if test "x$GROFF" = "x"; then
208823a8d56dSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
208923a8d56dSmrg   fi
209023a8d56dSmrg   have_groff=yes
209123a8d56dSmrgelif test "x$use_groff" = x"no" ; then
209223a8d56dSmrg   if test "x$GROFF" != "x"; then
209323a8d56dSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
209423a8d56dSmrg   fi
209523a8d56dSmrg   have_groff=no
209623a8d56dSmrgelse
209723a8d56dSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
209823a8d56dSmrgfi
209923a8d56dSmrg
210023a8d56dSmrg# We have groff, test for the presence of the macro packages
210123a8d56dSmrgif test "x$have_groff" = x"yes"; then
210223a8d56dSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
210323a8d56dSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
210423a8d56dSmrg        groff_ms_works=yes
210523a8d56dSmrg    else
210623a8d56dSmrg        groff_ms_works=no
210723a8d56dSmrg    fi
210823a8d56dSmrg    AC_MSG_RESULT([$groff_ms_works])
210923a8d56dSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
211023a8d56dSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
211123a8d56dSmrg        groff_mm_works=yes
211223a8d56dSmrg    else
211323a8d56dSmrg        groff_mm_works=no
211423a8d56dSmrg    fi
211523a8d56dSmrg    AC_MSG_RESULT([$groff_mm_works])
211623a8d56dSmrgfi
211723a8d56dSmrg
211823a8d56dSmrg# We have groff, test for HTML dependencies, one command per package
211923a8d56dSmrgif test "x$have_groff" = x"yes"; then
212023a8d56dSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
212123a8d56dSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
212223a8d56dSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
212323a8d56dSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
212423a8d56dSmrg      have_groff_html=yes
212523a8d56dSmrg   else
212623a8d56dSmrg      have_groff_html=no
212723a8d56dSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
212823a8d56dSmrg   fi
212923a8d56dSmrgfi
213023a8d56dSmrg
213123a8d56dSmrg# Set Automake conditionals for Makefiles
213223a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
213323a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
213423a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
213523a8d56dSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
213623a8d56dSmrg]) # XORG_WITH_GROFF
213723a8d56dSmrg
21381633cc4bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21391633cc4bSmrg# ---------------------------------------
214023a8d56dSmrg# Minimum version: 1.6.0
214123a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21421633cc4bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
214323a8d56dSmrg#
214423a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
214523a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
214623a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
214723a8d56dSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
214823a8d56dSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
214923a8d56dSmrg# --with-fop assumes 'auto'.
215023a8d56dSmrg#
215123a8d56dSmrg# Interface to module:
215223a8d56dSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
215323a8d56dSmrg# FOP:	 	returns the path of the fop program found
215423a8d56dSmrg#		returns the path set by the user in the environment
215523a8d56dSmrg# --with-fop: 	'yes' user instructs the module to use fop
215623a8d56dSmrg#		'no' user instructs the module not to use fop
215723a8d56dSmrg#
215823a8d56dSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
215923a8d56dSmrg#
216023a8d56dSmrgAC_DEFUN([XORG_WITH_FOP],[
216123a8d56dSmrgAC_ARG_VAR([FOP], [Path to fop command])
21621633cc4bSmrgm4_define([_defopt], m4_default([$2], [auto]))
216323a8d56dSmrgAC_ARG_WITH(fop,
216423a8d56dSmrg	AS_HELP_STRING([--with-fop],
216523a8d56dSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
216623a8d56dSmrg	   [use_fop=$withval], [use_fop=]_defopt)
216723a8d56dSmrgm4_undefine([_defopt])
216823a8d56dSmrg
216923a8d56dSmrgif test "x$use_fop" = x"auto"; then
217023a8d56dSmrg   AC_PATH_PROG([FOP], [fop])
217123a8d56dSmrg   if test "x$FOP" = "x"; then
217223a8d56dSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
217323a8d56dSmrg	have_fop=no
217423a8d56dSmrg   else
217523a8d56dSmrg        have_fop=yes
217623a8d56dSmrg   fi
217723a8d56dSmrgelif test "x$use_fop" = x"yes" ; then
217823a8d56dSmrg   AC_PATH_PROG([FOP], [fop])
217923a8d56dSmrg   if test "x$FOP" = "x"; then
218023a8d56dSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
218123a8d56dSmrg   fi
218223a8d56dSmrg   have_fop=yes
218323a8d56dSmrgelif test "x$use_fop" = x"no" ; then
218423a8d56dSmrg   if test "x$FOP" != "x"; then
218523a8d56dSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
218623a8d56dSmrg   fi
218723a8d56dSmrg   have_fop=no
218823a8d56dSmrgelse
218923a8d56dSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
219023a8d56dSmrgfi
21911633cc4bSmrg
21921633cc4bSmrg# Test for a minimum version of fop, if provided.
21931633cc4bSmrgm4_ifval([$1],
21941633cc4bSmrg[if test "$have_fop" = yes; then
21951633cc4bSmrg    # scrape the fop version
21961633cc4bSmrg    AC_MSG_CHECKING([for fop minimum version])
21971633cc4bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21981633cc4bSmrg    AC_MSG_RESULT([$fop_version])
21991633cc4bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
22001633cc4bSmrg        [if test "x$use_fop" = xauto; then
22011633cc4bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
22021633cc4bSmrg            have_fop=no
22031633cc4bSmrg        else
22041633cc4bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
22051633cc4bSmrg        fi])
22061633cc4bSmrgfi])
220723a8d56dSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
220823a8d56dSmrg]) # XORG_WITH_FOP
220923a8d56dSmrg
221023a8d56dSmrg# XORG_WITH_PS2PDF([DEFAULT])
221123a8d56dSmrg# ----------------
221223a8d56dSmrg# Minimum version: 1.6.0
221323a8d56dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
221423a8d56dSmrg#
221523a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
221623a8d56dSmrg# not at the appropriate level. This macro enables a module to test for the
221723a8d56dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
221823a8d56dSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
221923a8d56dSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
222023a8d56dSmrg# --with-ps2pdf assumes 'auto'.
222123a8d56dSmrg#
222223a8d56dSmrg# Interface to module:
222323a8d56dSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
222423a8d56dSmrg# PS2PDF:	returns the path of the ps2pdf program found
222523a8d56dSmrg#		returns the path set by the user in the environment
222623a8d56dSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
222723a8d56dSmrg#		 'no' user instructs the module not to use ps2pdf
222823a8d56dSmrg#
222923a8d56dSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
223023a8d56dSmrg#
223123a8d56dSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
223223a8d56dSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
223323a8d56dSmrgm4_define([_defopt], m4_default([$1], [auto]))
223423a8d56dSmrgAC_ARG_WITH(ps2pdf,
223523a8d56dSmrg	AS_HELP_STRING([--with-ps2pdf],
223623a8d56dSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
223723a8d56dSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
223823a8d56dSmrgm4_undefine([_defopt])
223923a8d56dSmrg
224023a8d56dSmrgif test "x$use_ps2pdf" = x"auto"; then
224123a8d56dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
224223a8d56dSmrg   if test "x$PS2PDF" = "x"; then
224323a8d56dSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
224423a8d56dSmrg	have_ps2pdf=no
224523a8d56dSmrg   else
224623a8d56dSmrg        have_ps2pdf=yes
224723a8d56dSmrg   fi
224823a8d56dSmrgelif test "x$use_ps2pdf" = x"yes" ; then
224923a8d56dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
225023a8d56dSmrg   if test "x$PS2PDF" = "x"; then
225123a8d56dSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
225223a8d56dSmrg   fi
225323a8d56dSmrg   have_ps2pdf=yes
225423a8d56dSmrgelif test "x$use_ps2pdf" = x"no" ; then
225523a8d56dSmrg   if test "x$PS2PDF" != "x"; then
225623a8d56dSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
225723a8d56dSmrg   fi
225823a8d56dSmrg   have_ps2pdf=no
225923a8d56dSmrgelse
226023a8d56dSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
226123a8d56dSmrgfi
226223a8d56dSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
226323a8d56dSmrg]) # XORG_WITH_PS2PDF
226423a8d56dSmrg
226523a8d56dSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
226623a8d56dSmrg# ----------------
226723a8d56dSmrg# Minimum version: 1.6.0
226823a8d56dSmrg#
226923a8d56dSmrg# Documentation tools are not always available on all platforms and sometimes
227023a8d56dSmrg# not at the appropriate level. This macro enables a builder to skip all
227123a8d56dSmrg# documentation targets except traditional man pages.
227223a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
227323a8d56dSmrg# maximum flexibilty in controlling documentation building.
227423a8d56dSmrg# Refer to:
227523a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
227623a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
227723a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
227823a8d56dSmrg# XORG_WITH_FOP           --with-fop
227923a8d56dSmrg# XORG_WITH_GROFF         --with-groff
228023a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
228123a8d56dSmrg#
228223a8d56dSmrg# Interface to module:
228323a8d56dSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
228423a8d56dSmrg# --enable-docs: 'yes' user instructs the module to generate docs
228523a8d56dSmrg#		 'no' user instructs the module not to generate docs
228623a8d56dSmrg# parm1:	specify the default value, yes or no.
228723a8d56dSmrg#
228823a8d56dSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
22891633cc4bSmrgm4_define([docs_default], m4_default([$1], [yes]))
229023a8d56dSmrgAC_ARG_ENABLE(docs,
229123a8d56dSmrg	AS_HELP_STRING([--enable-docs],
22921633cc4bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
22931633cc4bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
22941633cc4bSmrgm4_undefine([docs_default])
229523a8d56dSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
229623a8d56dSmrgAC_MSG_CHECKING([whether to build documentation])
229723a8d56dSmrgAC_MSG_RESULT([$build_docs])
229823a8d56dSmrg]) # XORG_ENABLE_DOCS
229923a8d56dSmrg
230023a8d56dSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
230123a8d56dSmrg# ----------------
230223a8d56dSmrg# Minimum version: 1.6.0
230323a8d56dSmrg#
230423a8d56dSmrg# This macro enables a builder to skip all developer documentation.
230523a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
230623a8d56dSmrg# maximum flexibilty in controlling documentation building.
230723a8d56dSmrg# Refer to:
230823a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
230923a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
231023a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
231123a8d56dSmrg# XORG_WITH_FOP           --with-fop
231223a8d56dSmrg# XORG_WITH_GROFF         --with-groff
231323a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
231423a8d56dSmrg#
231523a8d56dSmrg# Interface to module:
231623a8d56dSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
231723a8d56dSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
231823a8d56dSmrg#			'no' user instructs the module not to generate developer docs
231923a8d56dSmrg# parm1:		specify the default value, yes or no.
232023a8d56dSmrg#
232123a8d56dSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
232223a8d56dSmrgm4_define([devel_default], m4_default([$1], [yes]))
232323a8d56dSmrgAC_ARG_ENABLE(devel-docs,
232423a8d56dSmrg	AS_HELP_STRING([--enable-devel-docs],
232523a8d56dSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
232623a8d56dSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
232723a8d56dSmrgm4_undefine([devel_default])
232823a8d56dSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
232923a8d56dSmrgAC_MSG_CHECKING([whether to build developer documentation])
233023a8d56dSmrgAC_MSG_RESULT([$build_devel_docs])
233123a8d56dSmrg]) # XORG_ENABLE_DEVEL_DOCS
233223a8d56dSmrg
233323a8d56dSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
233423a8d56dSmrg# ----------------
233523a8d56dSmrg# Minimum version: 1.6.0
233623a8d56dSmrg#
233723a8d56dSmrg# This macro enables a builder to skip all functional specification targets.
233823a8d56dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
233923a8d56dSmrg# maximum flexibilty in controlling documentation building.
234023a8d56dSmrg# Refer to:
234123a8d56dSmrg# XORG_WITH_XMLTO         --with-xmlto
234223a8d56dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
234323a8d56dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
234423a8d56dSmrg# XORG_WITH_FOP           --with-fop
234523a8d56dSmrg# XORG_WITH_GROFF         --with-groff
234623a8d56dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
234723a8d56dSmrg#
234823a8d56dSmrg# Interface to module:
234923a8d56dSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
235023a8d56dSmrg# --enable-specs:	'yes' user instructs the module to generate specs
235123a8d56dSmrg#			'no' user instructs the module not to generate specs
235223a8d56dSmrg# parm1:		specify the default value, yes or no.
235323a8d56dSmrg#
235423a8d56dSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
235523a8d56dSmrgm4_define([spec_default], m4_default([$1], [yes]))
235623a8d56dSmrgAC_ARG_ENABLE(specs,
235723a8d56dSmrg	AS_HELP_STRING([--enable-specs],
235823a8d56dSmrg	   [Enable building the specs (default: ]spec_default[)]),
235923a8d56dSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
236023a8d56dSmrgm4_undefine([spec_default])
236123a8d56dSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
236223a8d56dSmrgAC_MSG_CHECKING([whether to build functional specifications])
236323a8d56dSmrgAC_MSG_RESULT([$build_specs])
236423a8d56dSmrg]) # XORG_ENABLE_SPECS
236523a8d56dSmrg
23661633cc4bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
23671633cc4bSmrg# ----------------------------------------------
23681633cc4bSmrg# Minimum version: 1.13.0
23691633cc4bSmrg#
23701633cc4bSmrg# This macro enables a builder to enable/disable unit testing
23711633cc4bSmrg# It makes no assumption about the test cases implementation
23721633cc4bSmrg# Test cases may or may not use Automake "Support for test suites"
23731633cc4bSmrg# They may or may not use the software utility library GLib
23741633cc4bSmrg#
23751633cc4bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
23761633cc4bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
23771633cc4bSmrg# The variable enable_unit_tests is used by other macros in this file.
23781633cc4bSmrg#
23791633cc4bSmrg# Interface to module:
23801633cc4bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
23811633cc4bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
23821633cc4bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
23831633cc4bSmrg#			'no' user instructs the module not to build tests
23841633cc4bSmrg# parm1:		specify the default value, yes or no.
23851633cc4bSmrg#
23861633cc4bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
23871633cc4bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
23881633cc4bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
23896d36ef34SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
23901633cc4bSmrgm4_define([_defopt], m4_default([$1], [auto]))
23911633cc4bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
23921633cc4bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
23931633cc4bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
23941633cc4bSmrgm4_undefine([_defopt])
23951633cc4bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
23961633cc4bSmrgAC_MSG_CHECKING([whether to build unit test cases])
23971633cc4bSmrgAC_MSG_RESULT([$enable_unit_tests])
23981633cc4bSmrg]) # XORG_ENABLE_UNIT_TESTS
23991633cc4bSmrg
24006d36ef34Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24016d36ef34Smrg# ------------------------------------------------------
24026d36ef34Smrg# Minimum version: 1.17.0
24036d36ef34Smrg#
24046d36ef34Smrg# This macro enables a builder to enable/disable integration testing
24056d36ef34Smrg# It makes no assumption about the test cases' implementation
24066d36ef34Smrg# Test cases may or may not use Automake "Support for test suites"
24076d36ef34Smrg#
24086d36ef34Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24096d36ef34Smrg# usually requires less dependencies and may be built and run under less
24106d36ef34Smrg# stringent environments than integration tests.
24116d36ef34Smrg#
24126d36ef34Smrg# Interface to module:
24136d36ef34Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24146d36ef34Smrg# enable_integration_tests:   used in configure.ac for additional configuration
24156d36ef34Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24166d36ef34Smrg#                             'no' user instructs the module not to build tests
24176d36ef34Smrg# parm1:                      specify the default value, yes or no.
24186d36ef34Smrg#
24196d36ef34SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24206d36ef34SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24216d36ef34Smrgm4_define([_defopt], m4_default([$1], [auto]))
24226d36ef34SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24236d36ef34Smrg	[Enable building integration test cases (default: ]_defopt[)]),
24246d36ef34Smrg	[enable_integration_tests=$enableval],
24256d36ef34Smrg	[enable_integration_tests=]_defopt)
24266d36ef34Smrgm4_undefine([_defopt])
24276d36ef34SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24286d36ef34Smrg	[test "x$enable_integration_tests" != xno])
24296d36ef34SmrgAC_MSG_CHECKING([whether to build unit test cases])
24306d36ef34SmrgAC_MSG_RESULT([$enable_integration_tests])
24316d36ef34Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
24326d36ef34Smrg
24331633cc4bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24341633cc4bSmrg# ----------------------------------------
24351633cc4bSmrg# Minimum version: 1.13.0
24361633cc4bSmrg#
24371633cc4bSmrg# GLib is a library which provides advanced data structures and functions.
24381633cc4bSmrg# This macro enables a module to test for the presence of Glib.
24391633cc4bSmrg#
24401633cc4bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
24411633cc4bSmrg# Otherwise the value of $enable_unit_tests is blank.
24421633cc4bSmrg#
24436d36ef34Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
24446d36ef34Smrg# test support usually requires less dependencies and may be built and run under
24456d36ef34Smrg# less stringent environments than integration tests.
24466d36ef34Smrg#
24471633cc4bSmrg# Interface to module:
24481633cc4bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
24491633cc4bSmrg# with_glib: used in configure.ac to know if GLib has been found
24501633cc4bSmrg# --with-glib:	'yes' user instructs the module to use glib
24511633cc4bSmrg#		'no' user instructs the module not to use glib
24521633cc4bSmrg#
24531633cc4bSmrgAC_DEFUN([XORG_WITH_GLIB],[
24541633cc4bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
24551633cc4bSmrgm4_define([_defopt], m4_default([$2], [auto]))
24561633cc4bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
24571633cc4bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
24581633cc4bSmrg	[with_glib=$withval], [with_glib=]_defopt)
24591633cc4bSmrgm4_undefine([_defopt])
24601633cc4bSmrg
24611633cc4bSmrghave_glib=no
24621633cc4bSmrg# Do not probe GLib if user explicitly disabled unit testing
24631633cc4bSmrgif test "x$enable_unit_tests" != x"no"; then
24641633cc4bSmrg  # Do not probe GLib if user explicitly disabled it
24651633cc4bSmrg  if test "x$with_glib" != x"no"; then
24661633cc4bSmrg    m4_ifval(
24671633cc4bSmrg      [$1],
24681633cc4bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
24691633cc4bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
24701633cc4bSmrg    )
24711633cc4bSmrg  fi
24721633cc4bSmrgfi
24731633cc4bSmrg
24741633cc4bSmrg# Not having GLib when unit testing has been explicitly requested is an error
24751633cc4bSmrgif test "x$enable_unit_tests" = x"yes"; then
24761633cc4bSmrg  if test "x$have_glib" = x"no"; then
24771633cc4bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24781633cc4bSmrg  fi
24791633cc4bSmrgfi
24801633cc4bSmrg
24811633cc4bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
24821633cc4bSmrgif test "x$enable_unit_tests" = x"no"; then
24831633cc4bSmrg  if test "x$with_glib" = x"yes"; then
24841633cc4bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24851633cc4bSmrg  fi
24861633cc4bSmrgfi
24871633cc4bSmrg
24881633cc4bSmrg# Not having GLib when it has been explicitly requested is an error
24891633cc4bSmrgif test "x$with_glib" = x"yes"; then
24901633cc4bSmrg  if test "x$have_glib" = x"no"; then
24911633cc4bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
24921633cc4bSmrg  fi
24931633cc4bSmrgfi
24941633cc4bSmrg
24951633cc4bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
24961633cc4bSmrg]) # XORG_WITH_GLIB
24971633cc4bSmrg
24986d36ef34Smrg# XORG_LD_WRAP([required|optional])
24996d36ef34Smrg# ---------------------------------
25001633cc4bSmrg# Minimum version: 1.13.0
25011633cc4bSmrg#
25021633cc4bSmrg# Check if linker supports -wrap, passed via compiler flags
25031633cc4bSmrg#
25041633cc4bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25051633cc4bSmrg# Otherwise the value of $enable_unit_tests is blank.
25061633cc4bSmrg#
25076d36ef34Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25086d36ef34Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25096d36ef34Smrg# available, an argument of "optional" allows use when some unit tests require
25106d36ef34Smrg# ld -wrap and others do not.
25116d36ef34Smrg#
25121633cc4bSmrgAC_DEFUN([XORG_LD_WRAP],[
25136d36ef34SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25146d36ef34Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25156d36ef34Smrg                      void __wrap_exit(int status) { return; }],
25166d36ef34Smrg                     [exit(0);])])
25171633cc4bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
25186d36ef34Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25191633cc4bSmrg  if test "x$have_ld_wrap" = x"no"; then
25201633cc4bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25211633cc4bSmrg  fi
25221633cc4bSmrgfi
25231633cc4bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25241633cc4bSmrg#
25251633cc4bSmrg]) # XORG_LD_WRAP
25261633cc4bSmrg
25271633cc4bSmrg# XORG_CHECK_LINKER_FLAGS
25281633cc4bSmrg# -----------------------
25291633cc4bSmrg# SYNOPSIS
25301633cc4bSmrg#
25316d36ef34Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25321633cc4bSmrg#
25331633cc4bSmrg# DESCRIPTION
25341633cc4bSmrg#
25351633cc4bSmrg#   Check whether the given linker FLAGS work with the current language's
25361633cc4bSmrg#   linker, or whether they give an error.
25371633cc4bSmrg#
25381633cc4bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
25391633cc4bSmrg#   success/failure.
25401633cc4bSmrg#
25416d36ef34Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
25426d36ef34Smrg#
25431633cc4bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
25441633cc4bSmrg#
25451633cc4bSmrg# LICENSE
25461633cc4bSmrg#
25471633cc4bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
25481633cc4bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
25491633cc4bSmrg#   Copyright (c) 2009 Matteo Frigo
25501633cc4bSmrg#
25511633cc4bSmrg#   This program is free software: you can redistribute it and/or modify it
25521633cc4bSmrg#   under the terms of the GNU General Public License as published by the
25531633cc4bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
25541633cc4bSmrg#   option) any later version.
25551633cc4bSmrg#
25561633cc4bSmrg#   This program is distributed in the hope that it will be useful, but
25571633cc4bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
25581633cc4bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
25591633cc4bSmrg#   Public License for more details.
25601633cc4bSmrg#
25611633cc4bSmrg#   You should have received a copy of the GNU General Public License along
25621633cc4bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
25631633cc4bSmrg#
25641633cc4bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
25651633cc4bSmrg#   gives unlimited permission to copy, distribute and modify the configure
25661633cc4bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
25671633cc4bSmrg#   need not follow the terms of the GNU General Public License when using
25681633cc4bSmrg#   or distributing such scripts, even though portions of the text of the
25691633cc4bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
25701633cc4bSmrg#   all other use of the material that constitutes the Autoconf Macro.
25711633cc4bSmrg#
25721633cc4bSmrg#   This special exception to the GPL applies to versions of the Autoconf
25731633cc4bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
25741633cc4bSmrg#   modified version of the Autoconf Macro, you may extend this special
25751633cc4bSmrg#   exception to the GPL to apply to your modified version as well.#
25761633cc4bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
25771633cc4bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
25781633cc4bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
25791633cc4bSmrgAS_LITERAL_IF([$1],
25801633cc4bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
25811633cc4bSmrg      ax_save_FLAGS=$LDFLAGS
25821633cc4bSmrg      LDFLAGS="$1"
25836d36ef34Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
25841633cc4bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25851633cc4bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25861633cc4bSmrg      LDFLAGS=$ax_save_FLAGS])],
25871633cc4bSmrg  [ax_save_FLAGS=$LDFLAGS
25881633cc4bSmrg   LDFLAGS="$1"
25891633cc4bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
25901633cc4bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25911633cc4bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25921633cc4bSmrg   LDFLAGS=$ax_save_FLAGS])
25931633cc4bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
25941633cc4bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
25951633cc4bSmrgif test "x$xorg_check_linker_flags" = xyes; then
25961633cc4bSmrg	m4_default([$2], :)
25971633cc4bSmrgelse
25981633cc4bSmrg	m4_default([$3], :)
25991633cc4bSmrgfi
26001633cc4bSmrg]) # XORG_CHECK_LINKER_FLAGS
26011633cc4bSmrg
26026d36ef34Smrg# XORG_MEMORY_CHECK_FLAGS
26036d36ef34Smrg# -----------------------
26046d36ef34Smrg# Minimum version: 1.16.0
26056d36ef34Smrg#
26066d36ef34Smrg# This macro attempts to find appropriate memory checking functionality
26076d36ef34Smrg# for various platforms which unit testing code may use to catch various
26086d36ef34Smrg# forms of memory allocation and access errors in testing.
26096d36ef34Smrg#
26106d36ef34Smrg# Interface to module:
26116d36ef34Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26126d36ef34Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26136d36ef34Smrg#
26146d36ef34Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26156d36ef34Smrg#
26166d36ef34SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26176d36ef34Smrg
26186d36ef34SmrgAC_REQUIRE([AC_CANONICAL_HOST])
26196d36ef34SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26206d36ef34Smrg           [Environment variables to enable memory checking in tests])
26216d36ef34Smrg
26226d36ef34Smrg# Check for different types of support on different platforms
26236d36ef34Smrgcase $host_os in
26246d36ef34Smrg    solaris*)
26256d36ef34Smrg        AC_CHECK_LIB([umem], [umem_alloc],
26266d36ef34Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26276d36ef34Smrg        ;;
26286d36ef34Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26296d36ef34Smrg        # both directly and inverted, so should not be 0 or 255.
26306d36ef34Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
26316d36ef34Smrg        ;;
26326d36ef34Smrg    darwin*)
26336d36ef34Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26346d36ef34Smrg        ;;
26356d36ef34Smrg    *bsd*)
26366d36ef34Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
26376d36ef34Smrg        ;;
26386d36ef34Smrgesac
26396d36ef34Smrg
26406d36ef34Smrg# User supplied flags override default flags
26416d36ef34Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
26426d36ef34Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
26436d36ef34Smrgfi
26446d36ef34Smrg
26456d36ef34SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
26466d36ef34Smrg]) # XORG_WITH_LINT
26476d36ef34Smrg
26488b6d6341Smrg# XORG_CHECK_MALLOC_ZERO
26498b6d6341Smrg# ----------------------
26508b6d6341Smrg# Minimum version: 1.0.0
26518b6d6341Smrg#
26528b6d6341Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26538b6d6341Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26548b6d6341Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26558b6d6341SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26568b6d6341SmrgAC_ARG_ENABLE(malloc0returnsnull,
26578b6d6341Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26588b6d6341Smrg		       [malloc(0) returns NULL (default: auto)]),
26598b6d6341Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26608b6d6341Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
26618b6d6341Smrg
26628b6d6341SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26638b6d6341Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
26641633cc4bSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
26651633cc4bSmrg#include <stdlib.h>
26661633cc4bSmrg],[
26678b6d6341Smrg    char *m0, *r0, *c0, *p;
26688b6d6341Smrg    m0 = malloc(0);
26698b6d6341Smrg    p = malloc(10);
26708b6d6341Smrg    r0 = realloc(p,0);
26711633cc4bSmrg    c0 = calloc(0,10);
26721633cc4bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
26731633cc4bSmrg])],
26748b6d6341Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
267523a8d56dSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
267623a8d56dSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
26771abf7346Smrgfi
26788b6d6341SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
26798b6d6341Smrg
26808b6d6341Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26818b6d6341Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26828b6d6341Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26838b6d6341Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26848b6d6341Smrgelse
26858b6d6341Smrg	MALLOC_ZERO_CFLAGS=""
26868b6d6341Smrg	XMALLOC_ZERO_CFLAGS=""
26878b6d6341Smrg	XTMALLOC_ZERO_CFLAGS=""
26881abf7346Smrgfi
26891abf7346Smrg
26908b6d6341SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
26918b6d6341SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
26928b6d6341SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
26938b6d6341Smrg]) # XORG_CHECK_MALLOC_ZERO
26941abf7346Smrg
26958b6d6341Smrg# XORG_WITH_LINT()
26968b6d6341Smrg# ----------------
26978b6d6341Smrg# Minimum version: 1.1.0
26981abf7346Smrg#
269923a8d56dSmrg# This macro enables the use of a tool that flags some suspicious and
270023a8d56dSmrg# non-portable constructs (likely to be bugs) in C language source code.
270123a8d56dSmrg# It will attempt to locate the tool and use appropriate options.
270223a8d56dSmrg# There are various lint type tools on different platforms.
270323a8d56dSmrg#
270423a8d56dSmrg# Interface to module:
270523a8d56dSmrg# LINT:		returns the path to the tool found on the platform
270623a8d56dSmrg#		or the value set to LINT on the configure cmd line
270723a8d56dSmrg#		also an Automake conditional
270823a8d56dSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
270923a8d56dSmrg#
271023a8d56dSmrg# --with-lint:	'yes' user instructs the module to use lint
271123a8d56dSmrg#		'no' user instructs the module not to use lint (default)
271223a8d56dSmrg#
271323a8d56dSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
271423a8d56dSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27158b6d6341Smrg#
27168b6d6341SmrgAC_DEFUN([XORG_WITH_LINT],[
27171abf7346Smrg
271823a8d56dSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
271923a8d56dSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27208b6d6341SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27218b6d6341Smrg		[Use a lint-style source code checker (default: disabled)])],
27228b6d6341Smrg		[use_lint=$withval], [use_lint=no])
272323a8d56dSmrg
272423a8d56dSmrg# Obtain platform specific info like program name and options
272523a8d56dSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
272623a8d56dSmrgcase $host_os in
272723a8d56dSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
272823a8d56dSmrg	lint_name=splint
272923a8d56dSmrg	lint_options="-badflag"
273023a8d56dSmrg	;;
273123a8d56dSmrg  *freebsd* | *netbsd*)
273223a8d56dSmrg	lint_name=lint
273323a8d56dSmrg	lint_options="-u -b"
273423a8d56dSmrg	;;
273523a8d56dSmrg  *solaris*)
273623a8d56dSmrg	lint_name=lint
273723a8d56dSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
273823a8d56dSmrg	;;
273923a8d56dSmrgesac
274023a8d56dSmrg
274123a8d56dSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
274223a8d56dSmrgif test "x$use_lint" = x"yes" ; then
274323a8d56dSmrg   AC_PATH_PROG([LINT], [$lint_name])
274423a8d56dSmrg   if test "x$LINT" = "x"; then
274523a8d56dSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
274623a8d56dSmrg   fi
274723a8d56dSmrgelif test "x$use_lint" = x"no" ; then
274823a8d56dSmrg   if test "x$LINT" != "x"; then
274923a8d56dSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
275023a8d56dSmrg   fi
27518b6d6341Smrgelse
275223a8d56dSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27538b6d6341Smrgfi
275423a8d56dSmrg
275523a8d56dSmrg# User supplied flags override default flags
275623a8d56dSmrgif test "x$LINT_FLAGS" != "x"; then
275723a8d56dSmrg   lint_options=$LINT_FLAGS
27588b6d6341Smrgfi
27591abf7346Smrg
276023a8d56dSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
276123a8d56dSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27621abf7346Smrg
27638b6d6341Smrg]) # XORG_WITH_LINT
27641abf7346Smrg
27658b6d6341Smrg# XORG_LINT_LIBRARY(LIBNAME)
27668b6d6341Smrg# --------------------------
27678b6d6341Smrg# Minimum version: 1.1.0
27688b6d6341Smrg#
27698b6d6341Smrg# Sets up flags for building lint libraries for checking programs that call
27708b6d6341Smrg# functions in the library.
27718b6d6341Smrg#
277223a8d56dSmrg# Interface to module:
277323a8d56dSmrg# LINTLIB		- Automake variable with the name of lint library file to make
277423a8d56dSmrg# MAKE_LINT_LIB		- Automake conditional
277523a8d56dSmrg#
277623a8d56dSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
277723a8d56dSmrg#			  - 'no' user instructs the module not to create a lint library (default)
27788b6d6341Smrg
27798b6d6341SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27808b6d6341SmrgAC_REQUIRE([XORG_WITH_LINT])
27818b6d6341SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27828b6d6341Smrg	[Create lint library (default: disabled)])],
27838b6d6341Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
278423a8d56dSmrg
278523a8d56dSmrgif test "x$make_lint_lib" = x"yes" ; then
278623a8d56dSmrg   LINTLIB=llib-l$1.ln
278723a8d56dSmrg   if test "x$LINT" = "x"; then
278823a8d56dSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
278923a8d56dSmrg   fi
279023a8d56dSmrgelif test "x$make_lint_lib" != x"no" ; then
279123a8d56dSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
27921abf7346Smrgfi
279323a8d56dSmrg
27948b6d6341SmrgAC_SUBST(LINTLIB)
27958b6d6341SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
27961abf7346Smrg
27978b6d6341Smrg]) # XORG_LINT_LIBRARY
27981abf7346Smrg
27991633cc4bSmrg# XORG_COMPILER_BRAND
28001633cc4bSmrg# -------------------
28011633cc4bSmrg# Minimum version: 1.14.0
28021633cc4bSmrg#
28031633cc4bSmrg# Checks for various brands of compilers and sets flags as appropriate:
28041633cc4bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28056d36ef34Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28061633cc4bSmrg#   clang compiler - sets CLANGCC to "yes"
28071633cc4bSmrg#   Intel compiler - sets INTELCC to "yes"
28081633cc4bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28091633cc4bSmrg#
28101633cc4bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28116d36ef34SmrgAC_LANG_CASE(
28126d36ef34Smrg	[C], [
28136d36ef34Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28146d36ef34Smrg	],
28156d36ef34Smrg	[C++], [
28166d36ef34Smrg		AC_REQUIRE([AC_PROG_CXX])
28176d36ef34Smrg	]
28186d36ef34Smrg)
28191633cc4bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28201633cc4bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28211633cc4bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28221633cc4bSmrg]) # XORG_COMPILER_BRAND
28231633cc4bSmrg
28246d36ef34Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
28256d36ef34Smrg# ---------------
28266d36ef34Smrg# Minimum version: 1.16.0
28276d36ef34Smrg#
28286d36ef34Smrg# Test if the compiler works when passed the given flag as a command line argument.
28296d36ef34Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28306d36ef34Smrg# next flag in the list until there are no more options.
28316d36ef34Smrg#
28326d36ef34Smrg# Note that this does not guarantee that the compiler supports the flag as some
28336d36ef34Smrg# compilers will simply ignore arguments that they do not understand, but we do
28346d36ef34Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
28356d36ef34Smrg# -Werror=unused-command-line-argument
28366d36ef34Smrg#
28376d36ef34SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
28386d36ef34Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28396d36ef34Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28406d36ef34Smrg
28416d36ef34SmrgAC_LANG_COMPILER_REQUIRE
28426d36ef34Smrg
28436d36ef34SmrgAC_LANG_CASE(
28446d36ef34Smrg	[C], [
28456d36ef34Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28466d36ef34Smrg		define([PREFIX], [C])
28476d36ef34Smrg		define([CACHE_PREFIX], [cc])
28486d36ef34Smrg		define([COMPILER], [$CC])
28496d36ef34Smrg	],
28506d36ef34Smrg	[C++], [
28516d36ef34Smrg		define([PREFIX], [CXX])
28526d36ef34Smrg		define([CACHE_PREFIX], [cxx])
28536d36ef34Smrg		define([COMPILER], [$CXX])
28546d36ef34Smrg	]
28556d36ef34Smrg)
28566d36ef34Smrg
28576d36ef34Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
28586d36ef34Smrg
28596d36ef34Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
28606d36ef34Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28616d36ef34Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
28626d36ef34Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
28636d36ef34Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28646d36ef34Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
28656d36ef34Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
28666d36ef34Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
28676d36ef34Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28686d36ef34Smrgfi
28696d36ef34Smrg
28706d36ef34Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
28716d36ef34Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
28726d36ef34Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28736d36ef34Smrg	fi
28746d36ef34Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28756d36ef34Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
28766d36ef34Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
28776d36ef34Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28786d36ef34Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
28796d36ef34Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
28806d36ef34Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
28816d36ef34Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28826d36ef34Smrgfi
28836d36ef34Smrg
28846d36ef34Smrgfound="no"
28856d36ef34Smrgm4_foreach([flag], m4_cdr($@), [
28866d36ef34Smrg	if test $found = "no" ; then
28876d36ef34Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
28886d36ef34Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28896d36ef34Smrg		fi
28906d36ef34Smrg
28916d36ef34Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
28926d36ef34Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28936d36ef34Smrg		fi
28946d36ef34Smrg
28956d36ef34Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
28966d36ef34Smrg
28976d36ef34Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
28986d36ef34Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
28996d36ef34Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29006d36ef34Smrg		AC_CACHE_VAL($cacheid,
29016d36ef34Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29026d36ef34Smrg					     [eval $cacheid=yes],
29036d36ef34Smrg					     [eval $cacheid=no])])
29046d36ef34Smrg
29056d36ef34Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29066d36ef34Smrg
29076d36ef34Smrg		eval supported=\$$cacheid
29086d36ef34Smrg		AC_MSG_RESULT([$supported])
29096d36ef34Smrg		if test "$supported" = "yes" ; then
29106d36ef34Smrg			$1="$$1 ]flag["
29116d36ef34Smrg			found="yes"
29126d36ef34Smrg		fi
29136d36ef34Smrg	fi
29146d36ef34Smrg])
29156d36ef34Smrg]) # XORG_TESTSET_CFLAG
29166d36ef34Smrg
29176d36ef34Smrg# XORG_COMPILER_FLAGS
29186d36ef34Smrg# ---------------
29196d36ef34Smrg# Minimum version: 1.16.0
29206d36ef34Smrg#
29216d36ef34Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29226d36ef34Smrg# arguments supported by the selected compiler which do NOT alter the generated
29236d36ef34Smrg# code.  These arguments will cause the compiler to print various warnings
29246d36ef34Smrg# during compilation AND turn a conservative set of warnings into errors.
29256d36ef34Smrg#
29266d36ef34Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29276d36ef34Smrg# future versions of util-macros as options are added to new compilers.
29286d36ef34Smrg#
29296d36ef34SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29306d36ef34SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
29316d36ef34Smrg
29326d36ef34SmrgAC_ARG_ENABLE(selective-werror,
29336d36ef34Smrg              AS_HELP_STRING([--disable-selective-werror],
29346d36ef34Smrg                             [Turn off selective compiler errors. (default: enabled)]),
29356d36ef34Smrg              [SELECTIVE_WERROR=$enableval],
29366d36ef34Smrg              [SELECTIVE_WERROR=yes])
29376d36ef34Smrg
29386d36ef34SmrgAC_LANG_CASE(
29396d36ef34Smrg        [C], [
29406d36ef34Smrg                define([PREFIX], [C])
29416d36ef34Smrg        ],
29426d36ef34Smrg        [C++], [
29436d36ef34Smrg                define([PREFIX], [CXX])
29446d36ef34Smrg        ]
29456d36ef34Smrg)
29466d36ef34Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
29476d36ef34Smrgif test "x$SUNCC" = "xyes"; then
29486d36ef34Smrg    [BASE_]PREFIX[FLAGS]="-v"
29496d36ef34Smrgelse
29506d36ef34Smrg    [BASE_]PREFIX[FLAGS]=""
29516d36ef34Smrgfi
29526d36ef34Smrg
29536d36ef34Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
29546d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
29556d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
29566d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
29576d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
29586d36ef34Smrg
29596d36ef34SmrgAC_LANG_CASE(
29606d36ef34Smrg	[C], [
29616d36ef34Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
29626d36ef34Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
29636d36ef34Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
29646d36ef34Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
29656d36ef34Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
29666d36ef34Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
29676d36ef34Smrg	]
29686d36ef34Smrg)
29696d36ef34Smrg
29706d36ef34Smrg# This chunk adds additional warnings that could catch undesired effects.
29716d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
29726d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
29736d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
29746d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
29756d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
29766d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
29776d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
29786d36ef34Smrg
29796d36ef34Smrg# These are currently disabled because they are noisy.  They will be enabled
29806d36ef34Smrg# in the future once the codebase is sufficiently modernized to silence
29816d36ef34Smrg# them.  For now, I don't want them to drown out the other warnings.
29826d36ef34Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
29836d36ef34Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
29846d36ef34Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
29856d36ef34Smrg
29866d36ef34Smrg# Turn some warnings into errors, so we don't accidently get successful builds
29876d36ef34Smrg# when there are problems that should be fixed.
29886d36ef34Smrg
29896d36ef34Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
29906d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
29916d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
29926d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
29936d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
29946d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
29956d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
29966d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
29976d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
29986d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
29996d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30006d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30016d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30026d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30036d36ef34Smrgelse
30046d36ef34SmrgAC_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])
30056d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30066d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30076d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30086d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30096d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30106d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30116d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30126d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30136d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30146d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30156d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30166d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30176d36ef34SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30186d36ef34Smrgfi
30196d36ef34Smrg
30206d36ef34SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30216d36ef34Smrg]) # XORG_COMPILER_FLAGS
30226d36ef34Smrg
30238b6d6341Smrg# XORG_CWARNFLAGS
30241abf7346Smrg# ---------------
30258b6d6341Smrg# Minimum version: 1.2.0
30266d36ef34Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30278b6d6341Smrg#
30288b6d6341Smrg# Defines CWARNFLAGS to enable C compiler warnings.
30298b6d6341Smrg#
30306d36ef34Smrg# This function is deprecated because it defines -fno-strict-aliasing
30316d36ef34Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30326d36ef34Smrg# is needed, then it should be added explicitly in the module when
30336d36ef34Smrg# it is updated to use BASE_CFLAGS.
30346d36ef34Smrg#
30358b6d6341SmrgAC_DEFUN([XORG_CWARNFLAGS], [
30366d36ef34SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30371633cc4bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30386d36ef34SmrgAC_LANG_CASE(
30396d36ef34Smrg	[C], [
30406d36ef34Smrg		CWARNFLAGS="$BASE_CFLAGS"
30416d36ef34Smrg		if  test "x$GCC" = xyes ; then
30426d36ef34Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30436d36ef34Smrg		fi
30446d36ef34Smrg		AC_SUBST(CWARNFLAGS)
30456d36ef34Smrg	]
30466d36ef34Smrg)
30478b6d6341Smrg]) # XORG_CWARNFLAGS
30481abf7346Smrg
30498b6d6341Smrg# XORG_STRICT_OPTION
30508b6d6341Smrg# -----------------------
30518b6d6341Smrg# Minimum version: 1.3.0
30528b6d6341Smrg#
30531633cc4bSmrg# Add configure option to enable strict compilation flags, such as treating
30541633cc4bSmrg# warnings as fatal errors.
30551633cc4bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
30566d36ef34Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30571633cc4bSmrg#
30581633cc4bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30591633cc4bSmrg# when strict compilation is unconditionally desired.
30608b6d6341SmrgAC_DEFUN([XORG_STRICT_OPTION], [
30618b6d6341SmrgAC_REQUIRE([XORG_CWARNFLAGS])
30626d36ef34SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30638b6d6341Smrg
30648b6d6341SmrgAC_ARG_ENABLE(strict-compilation,
30658b6d6341Smrg			  AS_HELP_STRING([--enable-strict-compilation],
30668b6d6341Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
30678b6d6341Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
30686d36ef34Smrg
30696d36ef34SmrgAC_LANG_CASE(
30706d36ef34Smrg        [C], [
30716d36ef34Smrg                define([PREFIX], [C])
30726d36ef34Smrg        ],
30736d36ef34Smrg        [C++], [
30746d36ef34Smrg                define([PREFIX], [CXX])
30756d36ef34Smrg        ]
30766d36ef34Smrg)
30776d36ef34Smrg
30786d36ef34Smrg[STRICT_]PREFIX[FLAGS]=""
30796d36ef34SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
30806d36ef34SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
30816d36ef34Smrg
30826d36ef34Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
30836d36ef34Smrg# activate it with -Werror, so we add it here explicitly.
30846d36ef34SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
30856d36ef34Smrg
30868b6d6341Smrgif test "x$STRICT_COMPILE" = "xyes"; then
30876d36ef34Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
30886d36ef34Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30898b6d6341Smrgfi
30906d36ef34SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
30916d36ef34SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30926d36ef34SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
30938b6d6341Smrg]) # XORG_STRICT_OPTION
30941abf7346Smrg
30958b6d6341Smrg# XORG_DEFAULT_OPTIONS
30968b6d6341Smrg# --------------------
30978b6d6341Smrg# Minimum version: 1.3.0
30981abf7346Smrg#
30998b6d6341Smrg# Defines default options for X.Org modules.
31008b6d6341Smrg#
31018b6d6341SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
310223a8d56dSmrgAC_REQUIRE([AC_PROG_INSTALL])
31036d36ef34SmrgXORG_COMPILER_FLAGS
31048b6d6341SmrgXORG_CWARNFLAGS
31058b6d6341SmrgXORG_STRICT_OPTION
31068b6d6341SmrgXORG_RELEASE_VERSION
31078b6d6341SmrgXORG_CHANGELOG
310823a8d56dSmrgXORG_INSTALL
31098b6d6341SmrgXORG_MANPAGE_SECTIONS
311023a8d56dSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
311123a8d56dSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31128b6d6341Smrg]) # XORG_DEFAULT_OPTIONS
311323a8d56dSmrg
311423a8d56dSmrg# XORG_INSTALL()
311523a8d56dSmrg# ----------------
311623a8d56dSmrg# Minimum version: 1.4.0
311723a8d56dSmrg#
311823a8d56dSmrg# Defines the variable INSTALL_CMD as the command to copy
311923a8d56dSmrg# INSTALL from $prefix/share/util-macros.
312023a8d56dSmrg#
312123a8d56dSmrgAC_DEFUN([XORG_INSTALL], [
312223a8d56dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
312323a8d56dSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
312423a8d56dSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
312523a8d56dSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
312623a8d56dSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
312723a8d56dSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
312823a8d56dSmrgAC_SUBST([INSTALL_CMD])
312923a8d56dSmrg]) # XORG_INSTALL
31308b6d6341Smrgdnl Copyright 2005 Red Hat, Inc
31318b6d6341Smrgdnl
31328b6d6341Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31338b6d6341Smrgdnl documentation for any purpose is hereby granted without fee, provided that
31348b6d6341Smrgdnl the above copyright notice appear in all copies and that both that
31358b6d6341Smrgdnl copyright notice and this permission notice appear in supporting
31368b6d6341Smrgdnl documentation.
31378b6d6341Smrgdnl
31388b6d6341Smrgdnl The above copyright notice and this permission notice shall be included
31398b6d6341Smrgdnl in all copies or substantial portions of the Software.
31408b6d6341Smrgdnl
31418b6d6341Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31428b6d6341Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31438b6d6341Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31448b6d6341Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31458b6d6341Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31468b6d6341Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31478b6d6341Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
31488b6d6341Smrgdnl
31498b6d6341Smrgdnl Except as contained in this notice, the name of the copyright holders shall
31508b6d6341Smrgdnl not be used in advertising or otherwise to promote the sale, use or
31518b6d6341Smrgdnl other dealings in this Software without prior written authorization
31528b6d6341Smrgdnl from the copyright holders.
31538b6d6341Smrgdnl
31541abf7346Smrg
31558b6d6341Smrg# XORG_RELEASE_VERSION
31568b6d6341Smrg# --------------------
315723a8d56dSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31588b6d6341Smrg 
31598b6d6341SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31608b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31618b6d6341Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31628b6d6341Smrg		[Major version of this package])
31638b6d6341Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31648b6d6341Smrg	if test "x$PVM" = "x"; then
31658b6d6341Smrg		PVM="0"
31668b6d6341Smrg	fi
31678b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31688b6d6341Smrg		[$PVM],
31698b6d6341Smrg		[Minor version of this package])
31708b6d6341Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31718b6d6341Smrg	if test "x$PVP" = "x"; then
31728b6d6341Smrg		PVP="0"
31738b6d6341Smrg	fi
31748b6d6341Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31758b6d6341Smrg		[$PVP],
31768b6d6341Smrg		[Patch version of this package])
31778b6d6341Smrg])
31781abf7346Smrg
31798b6d6341Smrg# XORG_CHANGELOG()
31808b6d6341Smrg# ----------------
31818b6d6341Smrg# Minimum version: 1.2.0
31828b6d6341Smrg#
31838b6d6341Smrg# Defines the variable CHANGELOG_CMD as the command to generate
31848b6d6341Smrg# ChangeLog from git.
31858b6d6341Smrg#
31868b6d6341Smrg#
31878b6d6341SmrgAC_DEFUN([XORG_CHANGELOG], [
318823a8d56dSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
318923a8d56dSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
319023a8d56dSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31918b6d6341Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31928b6d6341SmrgAC_SUBST([CHANGELOG_CMD])
31938b6d6341Smrg]) # XORG_CHANGELOG
31941abf7346Smrg
3195