aclocal.m4 revision 40a76396
140a76396Smrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
240a76396Smrg
340a76396Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4a0195d5fSmrg
5a0195d5fSmrg# This file is free software; the Free Software Foundation
6a0195d5fSmrg# gives unlimited permission to copy and/or distribute it,
7a0195d5fSmrg# with or without modifications, as long as this notice is preserved.
8a0195d5fSmrg
9a0195d5fSmrg# This program is distributed in the hope that it will be useful,
10a0195d5fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a0195d5fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a0195d5fSmrg# PARTICULAR PURPOSE.
13a0195d5fSmrg
1440a76396Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15a0195d5fSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16a0195d5fSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
172ab73d9fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
182ab73d9fSmrg[m4_warning([this file was generated for autoconf 2.68.
19a0195d5fSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20a0195d5fSmrgIf you have problems, you may need to regenerate the build system entirely.
2140a76396SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a0195d5fSmrg
2340a76396Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
24a0195d5fSmrg#
256600fe5bSmrg# This file is free software; the Free Software Foundation
266600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
276600fe5bSmrg# with or without modifications, as long as this notice is preserved.
28a0195d5fSmrg
296600fe5bSmrg# AM_AUTOMAKE_VERSION(VERSION)
306600fe5bSmrg# ----------------------------
316600fe5bSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
326600fe5bSmrg# generated from the m4 files accompanying Automake X.Y.
336600fe5bSmrg# (This private macro should not be called outside this file.)
346600fe5bSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3540a76396Smrg[am__api_version='1.14'
366600fe5bSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
376600fe5bSmrgdnl require some minimum version.  Point them to the right macro.
3840a76396Smrgm4_if([$1], [1.14], [],
396600fe5bSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
406600fe5bSmrg])
41a0195d5fSmrg
426600fe5bSmrg# _AM_AUTOCONF_VERSION(VERSION)
436600fe5bSmrg# -----------------------------
446600fe5bSmrg# aclocal traces this macro to find the Autoconf version.
456600fe5bSmrg# This is a private macro too.  Using m4_define simplifies
466600fe5bSmrg# the logic in aclocal, which can simply ignore this definition.
476600fe5bSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48a0195d5fSmrg
496600fe5bSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
506600fe5bSmrg# -------------------------------
516600fe5bSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
526600fe5bSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
536600fe5bSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5440a76396Smrg[AM_AUTOMAKE_VERSION([1.14])dnl
556600fe5bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
566600fe5bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
576600fe5bSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58a0195d5fSmrg
596600fe5bSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60a0195d5fSmrg
6140a76396Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
626600fe5bSmrg#
636600fe5bSmrg# This file is free software; the Free Software Foundation
646600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
656600fe5bSmrg# with or without modifications, as long as this notice is preserved.
66a0195d5fSmrg
676600fe5bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6840a76396Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6940a76396Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70a0195d5fSmrg#
716600fe5bSmrg# Of course, Automake must honor this variable whenever it calls a
726600fe5bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
736600fe5bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
746600fe5bSmrg# depending on how configure is run.  This is pretty annoying, since
756600fe5bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
766600fe5bSmrg# source directory, any form will work fine, but in subdirectories a
776600fe5bSmrg# relative path needs to be adjusted first.
78a0195d5fSmrg#
796600fe5bSmrg# $ac_aux_dir/missing
806600fe5bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
816600fe5bSmrg# $top_srcdir/$ac_aux_dir/missing
826600fe5bSmrg#    fails if $ac_aux_dir is absolute,
836600fe5bSmrg#    fails when called from a subdirectory in a VPATH build with
846600fe5bSmrg#          a relative $ac_aux_dir
85a0195d5fSmrg#
866600fe5bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
876600fe5bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8840a76396Smrg# harmless because $srcdir is '.', but things will broke when you
896600fe5bSmrg# start a VPATH build or use an absolute $srcdir.
90a0195d5fSmrg#
916600fe5bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
926600fe5bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
936600fe5bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
946600fe5bSmrg# and then we would define $MISSING as
956600fe5bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
966600fe5bSmrg# This will work as long as MISSING is not called from configure, because
976600fe5bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
986600fe5bSmrg# However there are other variables, like CC, which are often used in
996600fe5bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1006600fe5bSmrg#
1016600fe5bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1026600fe5bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1036600fe5bSmrg# configured tree to be moved without reconfiguration.
104a0195d5fSmrg
1056600fe5bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1066600fe5bSmrg[dnl Rely on autoconf to set up CDPATH properly.
1076600fe5bSmrgAC_PREREQ([2.50])dnl
1086600fe5bSmrg# expand $ac_aux_dir to an absolute path
1096600fe5bSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1106600fe5bSmrg])
111a0195d5fSmrg
1126600fe5bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113a0195d5fSmrg
11440a76396Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
1156600fe5bSmrg#
1166600fe5bSmrg# This file is free software; the Free Software Foundation
1176600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
1186600fe5bSmrg# with or without modifications, as long as this notice is preserved.
119a0195d5fSmrg
1206600fe5bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1216600fe5bSmrg# -------------------------------------
1226600fe5bSmrg# Define a conditional.
1236600fe5bSmrgAC_DEFUN([AM_CONDITIONAL],
12440a76396Smrg[AC_PREREQ([2.52])dnl
12540a76396Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12640a76396Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1276600fe5bSmrgAC_SUBST([$1_TRUE])dnl
1286600fe5bSmrgAC_SUBST([$1_FALSE])dnl
1296600fe5bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1306600fe5bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1316600fe5bSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1326600fe5bSmrgif $2; then
1336600fe5bSmrg  $1_TRUE=
1346600fe5bSmrg  $1_FALSE='#'
1356600fe5bSmrgelse
1366600fe5bSmrg  $1_TRUE='#'
1376600fe5bSmrg  $1_FALSE=
1386600fe5bSmrgfi
1396600fe5bSmrgAC_CONFIG_COMMANDS_PRE(
1406600fe5bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1416600fe5bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1426600fe5bSmrgUsually this means the macro was only invoked conditionally.]])
1436600fe5bSmrgfi])])
144a0195d5fSmrg
14540a76396Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1466600fe5bSmrg#
1476600fe5bSmrg# This file is free software; the Free Software Foundation
1486600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
1496600fe5bSmrg# with or without modifications, as long as this notice is preserved.
150a0195d5fSmrg
151a0195d5fSmrg
15240a76396Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1536600fe5bSmrg# written in clear, in which case automake, when reading aclocal.m4,
1546600fe5bSmrg# will think it sees a *use*, and therefore will trigger all it's
1556600fe5bSmrg# C support machinery.  Also note that it means that autoscan, seeing
1566600fe5bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157a0195d5fSmrg
158a0195d5fSmrg
1596600fe5bSmrg# _AM_DEPENDENCIES(NAME)
1606600fe5bSmrg# ----------------------
1616600fe5bSmrg# See how the compiler implements dependency checking.
16240a76396Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1636600fe5bSmrg# We try a few techniques and use that to set a single cache variable.
164a0195d5fSmrg#
1656600fe5bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1666600fe5bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1676600fe5bSmrg# dependency, and given that the user is not expected to run this macro,
1686600fe5bSmrg# just rely on AC_PROG_CC.
1696600fe5bSmrgAC_DEFUN([_AM_DEPENDENCIES],
1706600fe5bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1716600fe5bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1726600fe5bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1736600fe5bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174a0195d5fSmrg
17540a76396Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17640a76396Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17740a76396Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17840a76396Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17940a76396Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
18040a76396Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18140a76396Smrg                    [depcc="$$1"   am_compiler_list=])
182a0195d5fSmrg
1836600fe5bSmrgAC_CACHE_CHECK([dependency style of $depcc],
1846600fe5bSmrg               [am_cv_$1_dependencies_compiler_type],
1856600fe5bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1866600fe5bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1876600fe5bSmrg  # making bogus files that we don't know about and never remove.  For
1886600fe5bSmrg  # instance it was reported that on HP-UX the gcc test will end up
18940a76396Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
19040a76396Smrg  # in D".
19140a76396Smrg  rm -rf conftest.dir
1926600fe5bSmrg  mkdir conftest.dir
1936600fe5bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1946600fe5bSmrg  # using a relative directory.
1956600fe5bSmrg  cp "$am_depcomp" conftest.dir
1966600fe5bSmrg  cd conftest.dir
1976600fe5bSmrg  # We will build objects and dependencies in a subdirectory because
1986600fe5bSmrg  # it helps to detect inapplicable dependency modes.  For instance
1996600fe5bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2006600fe5bSmrg  # side effect of compilation, but ICC will put the dependencies in
2016600fe5bSmrg  # the current directory while Tru64 will put them in the object
2026600fe5bSmrg  # directory.
2036600fe5bSmrg  mkdir sub
2046600fe5bSmrg
2056600fe5bSmrg  am_cv_$1_dependencies_compiler_type=none
2066600fe5bSmrg  if test "$am_compiler_list" = ""; then
2076600fe5bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2086600fe5bSmrg  fi
2096600fe5bSmrg  am__universal=false
2106600fe5bSmrg  m4_case([$1], [CC],
2116600fe5bSmrg    [case " $depcc " in #(
2126600fe5bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2136600fe5bSmrg     esac],
2146600fe5bSmrg    [CXX],
2156600fe5bSmrg    [case " $depcc " in #(
2166600fe5bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2176600fe5bSmrg     esac])
2186600fe5bSmrg
2196600fe5bSmrg  for depmode in $am_compiler_list; do
2206600fe5bSmrg    # Setup a source with many dependencies, because some compilers
2216600fe5bSmrg    # like to wrap large dependency lists on column 80 (with \), and
2226600fe5bSmrg    # we should not choose a depcomp mode which is confused by this.
2236600fe5bSmrg    #
2246600fe5bSmrg    # We need to recreate these files for each test, as the compiler may
2256600fe5bSmrg    # overwrite some of them when testing with obscure command lines.
2266600fe5bSmrg    # This happens at least with the AIX C compiler.
2276600fe5bSmrg    : > sub/conftest.c
2286600fe5bSmrg    for i in 1 2 3 4 5 6; do
2296600fe5bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23040a76396Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23140a76396Smrg      # Solaris 10 /bin/sh.
23240a76396Smrg      echo '/* dummy */' > sub/conftst$i.h
2336600fe5bSmrg    done
2346600fe5bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2356600fe5bSmrg
23640a76396Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2376600fe5bSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23840a76396Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23940a76396Smrg    # versions had trouble with output in subdirs.
2406600fe5bSmrg    am__obj=sub/conftest.${OBJEXT-o}
2416600fe5bSmrg    am__minus_obj="-o $am__obj"
2426600fe5bSmrg    case $depmode in
2436600fe5bSmrg    gcc)
2446600fe5bSmrg      # This depmode causes a compiler race in universal mode.
2456600fe5bSmrg      test "$am__universal" = false || continue
2466600fe5bSmrg      ;;
2476600fe5bSmrg    nosideeffect)
24840a76396Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24940a76396Smrg      # only be used when explicitly requested.
2506600fe5bSmrg      if test "x$enable_dependency_tracking" = xyes; then
2516600fe5bSmrg	continue
2526600fe5bSmrg      else
2536600fe5bSmrg	break
2546600fe5bSmrg      fi
2556600fe5bSmrg      ;;
25640a76396Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25740a76396Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2586600fe5bSmrg      # not run yet.  These depmodes are late enough in the game, and
2596600fe5bSmrg      # so weak that their functioning should not be impacted.
2606600fe5bSmrg      am__obj=conftest.${OBJEXT-o}
2616600fe5bSmrg      am__minus_obj=
2626600fe5bSmrg      ;;
2636600fe5bSmrg    none) break ;;
2646600fe5bSmrg    esac
2656600fe5bSmrg    if depmode=$depmode \
2666600fe5bSmrg       source=sub/conftest.c object=$am__obj \
2676600fe5bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2686600fe5bSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2696600fe5bSmrg         >/dev/null 2>conftest.err &&
2706600fe5bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2716600fe5bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2726600fe5bSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2736600fe5bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2746600fe5bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2756600fe5bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2766600fe5bSmrg      # that says an option was ignored or not supported.
2776600fe5bSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2786600fe5bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2796600fe5bSmrg      # The diagnosis changed in icc 8.0:
2806600fe5bSmrg      #   icc: Command line remark: option '-MP' not supported
2816600fe5bSmrg      if (grep 'ignoring option' conftest.err ||
2826600fe5bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2836600fe5bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2846600fe5bSmrg        break
2856600fe5bSmrg      fi
2866600fe5bSmrg    fi
2876600fe5bSmrg  done
2886600fe5bSmrg
2896600fe5bSmrg  cd ..
2906600fe5bSmrg  rm -rf conftest.dir
291a0195d5fSmrgelse
2926600fe5bSmrg  am_cv_$1_dependencies_compiler_type=none
293a0195d5fSmrgfi
2946600fe5bSmrg])
2956600fe5bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2966600fe5bSmrgAM_CONDITIONAL([am__fastdep$1], [
2976600fe5bSmrg  test "x$enable_dependency_tracking" != xno \
2986600fe5bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2996600fe5bSmrg])
300a0195d5fSmrg
3016600fe5bSmrg
3026600fe5bSmrg# AM_SET_DEPDIR
3036600fe5bSmrg# -------------
3046600fe5bSmrg# Choose a directory name for dependency files.
30540a76396Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3066600fe5bSmrgAC_DEFUN([AM_SET_DEPDIR],
3076600fe5bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3086600fe5bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3096600fe5bSmrg])
3106600fe5bSmrg
3116600fe5bSmrg
3126600fe5bSmrg# AM_DEP_TRACK
3136600fe5bSmrg# ------------
3146600fe5bSmrgAC_DEFUN([AM_DEP_TRACK],
31540a76396Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31640a76396SmrgAS_HELP_STRING(
31740a76396Smrg  [--enable-dependency-tracking],
31840a76396Smrg  [do not reject slow dependency extractors])
31940a76396SmrgAS_HELP_STRING(
32040a76396Smrg  [--disable-dependency-tracking],
32140a76396Smrg  [speeds up one-time build])])
3226600fe5bSmrgif test "x$enable_dependency_tracking" != xno; then
3236600fe5bSmrg  am_depcomp="$ac_aux_dir/depcomp"
3246600fe5bSmrg  AMDEPBACKSLASH='\'
32540a76396Smrg  am__nodep='_no'
326a0195d5fSmrgfi
3276600fe5bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3286600fe5bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3296600fe5bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33040a76396SmrgAC_SUBST([am__nodep])dnl
33140a76396Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3326600fe5bSmrg])
333a0195d5fSmrg
3346600fe5bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3356600fe5bSmrg
33640a76396Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
337a0195d5fSmrg#
3386600fe5bSmrg# This file is free software; the Free Software Foundation
3396600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
3406600fe5bSmrg# with or without modifications, as long as this notice is preserved.
341a0195d5fSmrg
342a0195d5fSmrg
3436600fe5bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3446600fe5bSmrg# ------------------------------
3456600fe5bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3466600fe5bSmrg[{
34740a76396Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3486600fe5bSmrg  # are listed without --file.  Let's play safe and only enable the eval
3496600fe5bSmrg  # if we detect the quoting.
3506600fe5bSmrg  case $CONFIG_FILES in
3516600fe5bSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3526600fe5bSmrg  *)   set x $CONFIG_FILES ;;
3536600fe5bSmrg  esac
3546600fe5bSmrg  shift
3556600fe5bSmrg  for mf
3566600fe5bSmrg  do
3576600fe5bSmrg    # Strip MF so we end up with the name of the file.
3586600fe5bSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3596600fe5bSmrg    # Check whether this is an Automake generated Makefile or not.
36040a76396Smrg    # We used to match only the files named 'Makefile.in', but
3616600fe5bSmrg    # some people rename them; so instead we look at the file content.
3626600fe5bSmrg    # Grep'ing the first line is not enough: some people post-process
3636600fe5bSmrg    # each Makefile.in and add a new line on top of each file to say so.
3646600fe5bSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3656600fe5bSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3666600fe5bSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3676600fe5bSmrg      dirpart=`AS_DIRNAME("$mf")`
3686600fe5bSmrg    else
3696600fe5bSmrg      continue
3706600fe5bSmrg    fi
3716600fe5bSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
37240a76396Smrg    # from the Makefile without running 'make'.
3736600fe5bSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3746600fe5bSmrg    test -z "$DEPDIR" && continue
3756600fe5bSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37640a76396Smrg    test -z "$am__include" && continue
3776600fe5bSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3786600fe5bSmrg    # Find all dependency output files, they are included files with
3796600fe5bSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3806600fe5bSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3816600fe5bSmrg    # expansion.
3826600fe5bSmrg    for file in `sed -n "
3836600fe5bSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38440a76396Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3856600fe5bSmrg      # Make sure the directory exists.
3866600fe5bSmrg      test -f "$dirpart/$file" && continue
3876600fe5bSmrg      fdir=`AS_DIRNAME(["$file"])`
3886600fe5bSmrg      AS_MKDIR_P([$dirpart/$fdir])
3896600fe5bSmrg      # echo "creating $dirpart/$file"
3906600fe5bSmrg      echo '# dummy' > "$dirpart/$file"
3916600fe5bSmrg    done
3926600fe5bSmrg  done
3936600fe5bSmrg}
3946600fe5bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395a0195d5fSmrg
396a0195d5fSmrg
3976600fe5bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3986600fe5bSmrg# -----------------------------
3996600fe5bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
4006600fe5bSmrg#
4016600fe5bSmrg# This code is only required when automatic dependency tracking
40240a76396Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4036600fe5bSmrg# need in order to bootstrap the dependency handling code.
4046600fe5bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4056600fe5bSmrg[AC_CONFIG_COMMANDS([depfiles],
4066600fe5bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4076600fe5bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4086600fe5bSmrg])
409a0195d5fSmrg
4106600fe5bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4116600fe5bSmrg
41240a76396Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4136600fe5bSmrg#
4146600fe5bSmrg# This file is free software; the Free Software Foundation
4156600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
4166600fe5bSmrg# with or without modifications, as long as this notice is preserved.
4176600fe5bSmrg
4186600fe5bSmrg# This macro actually does too much.  Some checks are only needed if
4196600fe5bSmrg# your package does certain things.  But this isn't really a big deal.
4206600fe5bSmrg
42140a76396Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42240a76396Smrgm4_define([AC_PROG_CC],
42340a76396Smrgm4_defn([AC_PROG_CC])
42440a76396Smrg[_AM_PROG_CC_C_O
42540a76396Smrg])
42640a76396Smrg
4276600fe5bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4286600fe5bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4296600fe5bSmrg# -----------------------------------------------
4306600fe5bSmrg# The call with PACKAGE and VERSION arguments is the old style
4316600fe5bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4326600fe5bSmrg# and VERSION should now be passed to AC_INIT and removed from
4336600fe5bSmrg# the call to AM_INIT_AUTOMAKE.
4346600fe5bSmrg# We support both call styles for the transition.  After
4356600fe5bSmrg# the next Automake release, Autoconf can make the AC_INIT
4366600fe5bSmrg# arguments mandatory, and then we can depend on a new Autoconf
4376600fe5bSmrg# release and drop the old call support.
4386600fe5bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43940a76396Smrg[AC_PREREQ([2.65])dnl
4406600fe5bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4416600fe5bSmrgdnl the ones we care about.
4426600fe5bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4436600fe5bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4446600fe5bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4456600fe5bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4466600fe5bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4476600fe5bSmrg  # is not polluted with repeated "-I."
4486600fe5bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4496600fe5bSmrg  # test to see if srcdir already configured
4506600fe5bSmrg  if test -f $srcdir/config.status; then
4516600fe5bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4526600fe5bSmrg  fi
453a0195d5fSmrgfi
4546600fe5bSmrg
4556600fe5bSmrg# test whether we have cygpath
4566600fe5bSmrgif test -z "$CYGPATH_W"; then
4576600fe5bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4586600fe5bSmrg    CYGPATH_W='cygpath -w'
4596600fe5bSmrg  else
4606600fe5bSmrg    CYGPATH_W=echo
4616600fe5bSmrg  fi
462a0195d5fSmrgfi
4636600fe5bSmrgAC_SUBST([CYGPATH_W])
464a0195d5fSmrg
4656600fe5bSmrg# Define the identity of the package.
4666600fe5bSmrgdnl Distinguish between old-style and new-style calls.
4676600fe5bSmrgm4_ifval([$2],
46840a76396Smrg[AC_DIAGNOSE([obsolete],
46940a76396Smrg             [$0: two- and three-arguments forms are deprecated.])
47040a76396Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4716600fe5bSmrg AC_SUBST([PACKAGE], [$1])dnl
4726600fe5bSmrg AC_SUBST([VERSION], [$2])],
4736600fe5bSmrg[_AM_SET_OPTIONS([$1])dnl
4746600fe5bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47540a76396Smrgm4_if(
47640a76396Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47740a76396Smrg  [ok:ok],,
4786600fe5bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4796600fe5bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4806600fe5bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
481a0195d5fSmrg
4826600fe5bSmrg_AM_IF_OPTION([no-define],,
48340a76396Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
48440a76396Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
485a0195d5fSmrg
4866600fe5bSmrg# Some tools Automake needs.
4876600fe5bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4886600fe5bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48940a76396SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
49040a76396SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
49140a76396SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
49240a76396SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
49340a76396SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4946600fe5bSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4956600fe5bSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49640a76396SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49740a76396Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49840a76396Smrg# dies out for good.  For more background, see:
49940a76396Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
50040a76396Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
50140a76396SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5026600fe5bSmrg# We need awk for the "check" target.  The system "awk" is bad on
5036600fe5bSmrg# some platforms.
5046600fe5bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5056600fe5bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5066600fe5bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5076600fe5bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5086600fe5bSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5096600fe5bSmrg			     [_AM_PROG_TAR([v7])])])
5106600fe5bSmrg_AM_IF_OPTION([no-dependencies],,
5116600fe5bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51240a76396Smrg		  [_AM_DEPENDENCIES([CC])],
51340a76396Smrg		  [m4_define([AC_PROG_CC],
51440a76396Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5156600fe5bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51640a76396Smrg		  [_AM_DEPENDENCIES([CXX])],
51740a76396Smrg		  [m4_define([AC_PROG_CXX],
51840a76396Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5196600fe5bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
52040a76396Smrg		  [_AM_DEPENDENCIES([OBJC])],
52140a76396Smrg		  [m4_define([AC_PROG_OBJC],
52240a76396Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
52340a76396SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
52440a76396Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52540a76396Smrg		  [m4_define([AC_PROG_OBJCXX],
52640a76396Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5276600fe5bSmrg])
52840a76396SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52940a76396Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53040a76396Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
53140a76396Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5326600fe5bSmrgAC_CONFIG_COMMANDS_PRE(dnl
5336600fe5bSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5346600fe5bSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
535a0195d5fSmrg
53640a76396Smrg# POSIX will say in a future version that running "rm -f" with no argument
53740a76396Smrg# is OK; and we want to be able to make that assumption in our Makefile
53840a76396Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53940a76396Smrg# actually supported "in the wild" to an acceptable degree.
54040a76396Smrg# See automake bug#10828.
54140a76396Smrg# To make any issue more visible, cause the running configure to be aborted
54240a76396Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54340a76396Smrg# user can still override this though.
54440a76396Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54540a76396Smrg  cat >&2 <<'END'
54640a76396SmrgOops!
54740a76396Smrg
54840a76396SmrgYour 'rm' program seems unable to run without file operands specified
54940a76396Smrgon the command line, even when the '-f' option is present.  This is contrary
55040a76396Smrgto the behaviour of most rm programs out there, and not conforming with
55140a76396Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55240a76396Smrg
55340a76396SmrgPlease tell bug-automake@gnu.org about your system, including the value
55440a76396Smrgof your $PATH and any error possibly output before this message.  This
55540a76396Smrgcan help us improve future automake versions.
55640a76396Smrg
55740a76396SmrgEND
55840a76396Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55940a76396Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56040a76396Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56140a76396Smrg    echo >&2
56240a76396Smrg  else
56340a76396Smrg    cat >&2 <<'END'
56440a76396SmrgAborting the configuration process, to ensure you take notice of the issue.
56540a76396Smrg
56640a76396SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56740a76396Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56840a76396Smrg
56940a76396SmrgIf you want to complete the configuration process using your problematic
57040a76396Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57140a76396Smrgto "yes", and re-run configure.
57240a76396Smrg
57340a76396SmrgEND
57440a76396Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57540a76396Smrg  fi
57640a76396Smrgfi])
57740a76396Smrg
57840a76396Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5796600fe5bSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5806600fe5bSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5816600fe5bSmrgm4_define([_AC_COMPILER_EXEEXT],
5826600fe5bSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
583a0195d5fSmrg
5846600fe5bSmrg# When config.status generates a header, we must update the stamp-h file.
5856600fe5bSmrg# This file resides in the same directory as the config header
5866600fe5bSmrg# that is generated.  The stamp files are numbered to have different names.
5876600fe5bSmrg
5886600fe5bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5896600fe5bSmrg# loop where config.status creates the headers, so we can generate
5906600fe5bSmrg# our stamp files there.
5916600fe5bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5926600fe5bSmrg[# Compute $1's index in $config_headers.
5936600fe5bSmrg_am_arg=$1
5946600fe5bSmrg_am_stamp_count=1
5956600fe5bSmrgfor _am_header in $config_headers :; do
5966600fe5bSmrg  case $_am_header in
5976600fe5bSmrg    $_am_arg | $_am_arg:* )
5986600fe5bSmrg      break ;;
5996600fe5bSmrg    * )
6006600fe5bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6016600fe5bSmrg  esac
6026600fe5bSmrgdone
6036600fe5bSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6046600fe5bSmrg
60540a76396Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6066600fe5bSmrg#
6076600fe5bSmrg# This file is free software; the Free Software Foundation
6086600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
6096600fe5bSmrg# with or without modifications, as long as this notice is preserved.
610a0195d5fSmrg
6116600fe5bSmrg# AM_PROG_INSTALL_SH
6126600fe5bSmrg# ------------------
6136600fe5bSmrg# Define $install_sh.
6146600fe5bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6156600fe5bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6166600fe5bSmrgif test x"${install_sh}" != xset; then
6176600fe5bSmrg  case $am_aux_dir in
6186600fe5bSmrg  *\ * | *\	*)
6196600fe5bSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6206600fe5bSmrg  *)
6216600fe5bSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6226600fe5bSmrg  esac
623a0195d5fSmrgfi
62440a76396SmrgAC_SUBST([install_sh])])
625a0195d5fSmrg
62640a76396Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
6276600fe5bSmrg#
6286600fe5bSmrg# This file is free software; the Free Software Foundation
6296600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
6306600fe5bSmrg# with or without modifications, as long as this notice is preserved.
631a0195d5fSmrg
6326600fe5bSmrg# Check whether the underlying file-system supports filenames
6336600fe5bSmrg# with a leading dot.  For instance MS-DOS doesn't.
6346600fe5bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6356600fe5bSmrg[rm -rf .tst 2>/dev/null
6366600fe5bSmrgmkdir .tst 2>/dev/null
6376600fe5bSmrgif test -d .tst; then
6386600fe5bSmrg  am__leading_dot=.
639a0195d5fSmrgelse
6406600fe5bSmrg  am__leading_dot=_
641a0195d5fSmrgfi
6426600fe5bSmrgrmdir .tst 2>/dev/null
6436600fe5bSmrgAC_SUBST([am__leading_dot])])
644a0195d5fSmrg
6456600fe5bSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6466600fe5bSmrg# From Jim Meyering
647a0195d5fSmrg
64840a76396Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
6496600fe5bSmrg#
6506600fe5bSmrg# This file is free software; the Free Software Foundation
6516600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
6526600fe5bSmrg# with or without modifications, as long as this notice is preserved.
653a0195d5fSmrg
6546600fe5bSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6556600fe5bSmrg# ----------------------------------
6566600fe5bSmrg# Control maintainer-specific portions of Makefiles.
65740a76396Smrg# Default is to disable them, unless 'enable' is passed literally.
65840a76396Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
6596600fe5bSmrg# can override the default with the --enable/--disable switch.
6606600fe5bSmrgAC_DEFUN([AM_MAINTAINER_MODE],
6616600fe5bSmrg[m4_case(m4_default([$1], [disable]),
6626600fe5bSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
6636600fe5bSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
6646600fe5bSmrg       [m4_define([am_maintainer_other], [enable])
6656600fe5bSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
66640a76396SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6676600fe5bSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6686600fe5bSmrg  AC_ARG_ENABLE([maintainer-mode],
66940a76396Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
67040a76396Smrg      am_maintainer_other[ make rules and dependencies not useful
67140a76396Smrg      (and sometimes confusing) to the casual installer])],
67240a76396Smrg    [USE_MAINTAINER_MODE=$enableval],
67340a76396Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6746600fe5bSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6756600fe5bSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6766600fe5bSmrg  MAINT=$MAINTAINER_MODE_TRUE
6776600fe5bSmrg  AC_SUBST([MAINT])dnl
6786600fe5bSmrg]
6796600fe5bSmrg)
680a0195d5fSmrg
6816600fe5bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
682a0195d5fSmrg
68340a76396Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6846600fe5bSmrg#
6856600fe5bSmrg# This file is free software; the Free Software Foundation
6866600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
6876600fe5bSmrg# with or without modifications, as long as this notice is preserved.
688a0195d5fSmrg
6896600fe5bSmrg# AM_MAKE_INCLUDE()
6906600fe5bSmrg# -----------------
6916600fe5bSmrg# Check to see how make treats includes.
6926600fe5bSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6936600fe5bSmrg[am_make=${MAKE-make}
6946600fe5bSmrgcat > confinc << 'END'
6956600fe5bSmrgam__doit:
6966600fe5bSmrg	@echo this is the am__doit target
6976600fe5bSmrg.PHONY: am__doit
6986600fe5bSmrgEND
6996600fe5bSmrg# If we don't find an include directive, just comment out the code.
7006600fe5bSmrgAC_MSG_CHECKING([for style of include used by $am_make])
7016600fe5bSmrgam__include="#"
7026600fe5bSmrgam__quote=
7036600fe5bSmrg_am_result=none
7046600fe5bSmrg# First try GNU make style include.
7056600fe5bSmrgecho "include confinc" > confmf
70640a76396Smrg# Ignore all kinds of additional output from 'make'.
7076600fe5bSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
7086600fe5bSmrg*the\ am__doit\ target*)
7096600fe5bSmrg  am__include=include
7106600fe5bSmrg  am__quote=
7116600fe5bSmrg  _am_result=GNU
7126600fe5bSmrg  ;;
7136600fe5bSmrgesac
7146600fe5bSmrg# Now try BSD make style include.
7156600fe5bSmrgif test "$am__include" = "#"; then
7166600fe5bSmrg   echo '.include "confinc"' > confmf
7176600fe5bSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
7186600fe5bSmrg   *the\ am__doit\ target*)
7196600fe5bSmrg     am__include=.include
7206600fe5bSmrg     am__quote="\""
7216600fe5bSmrg     _am_result=BSD
7226600fe5bSmrg     ;;
7236600fe5bSmrg   esac
724a0195d5fSmrgfi
7256600fe5bSmrgAC_SUBST([am__include])
7266600fe5bSmrgAC_SUBST([am__quote])
7276600fe5bSmrgAC_MSG_RESULT([$_am_result])
7286600fe5bSmrgrm -f confinc confmf
7296600fe5bSmrg])
730a0195d5fSmrg
7316600fe5bSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
732a0195d5fSmrg
73340a76396Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
7346600fe5bSmrg#
7356600fe5bSmrg# This file is free software; the Free Software Foundation
7366600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
7376600fe5bSmrg# with or without modifications, as long as this notice is preserved.
738a0195d5fSmrg
7396600fe5bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7406600fe5bSmrg# ------------------------------
7416600fe5bSmrgAC_DEFUN([AM_MISSING_PROG],
7426600fe5bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7436600fe5bSmrg$1=${$1-"${am_missing_run}$2"}
7446600fe5bSmrgAC_SUBST($1)])
745a0195d5fSmrg
7466600fe5bSmrg# AM_MISSING_HAS_RUN
7476600fe5bSmrg# ------------------
74840a76396Smrg# Define MISSING if not defined so far and test if it is modern enough.
74940a76396Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7506600fe5bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7516600fe5bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7526600fe5bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7536600fe5bSmrgif test x"${MISSING+set}" != xset; then
7546600fe5bSmrg  case $am_aux_dir in
7556600fe5bSmrg  *\ * | *\	*)
7566600fe5bSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7576600fe5bSmrg  *)
7586600fe5bSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7596600fe5bSmrg  esac
760a0195d5fSmrgfi
7616600fe5bSmrg# Use eval to expand $SHELL
76240a76396Smrgif eval "$MISSING --is-lightweight"; then
76340a76396Smrg  am_missing_run="$MISSING "
764a0195d5fSmrgelse
7656600fe5bSmrg  am_missing_run=
76640a76396Smrg  AC_MSG_WARN(['missing' script is too old or missing])
767a0195d5fSmrgfi
7686600fe5bSmrg])
769a0195d5fSmrg
7706600fe5bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
771a0195d5fSmrg
77240a76396Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
773a0195d5fSmrg#
7746600fe5bSmrg# This file is free software; the Free Software Foundation
7756600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
7766600fe5bSmrg# with or without modifications, as long as this notice is preserved.
777a0195d5fSmrg
7786600fe5bSmrg# _AM_MANGLE_OPTION(NAME)
7796600fe5bSmrg# -----------------------
7806600fe5bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7816600fe5bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782a0195d5fSmrg
7836600fe5bSmrg# _AM_SET_OPTION(NAME)
78440a76396Smrg# --------------------
7856600fe5bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7866600fe5bSmrgAC_DEFUN([_AM_SET_OPTION],
78740a76396Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
788a0195d5fSmrg
7896600fe5bSmrg# _AM_SET_OPTIONS(OPTIONS)
79040a76396Smrg# ------------------------
7916600fe5bSmrg# OPTIONS is a space-separated list of Automake options.
7926600fe5bSmrgAC_DEFUN([_AM_SET_OPTIONS],
7936600fe5bSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7946600fe5bSmrg
7956600fe5bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7966600fe5bSmrg# -------------------------------------------
7976600fe5bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7986600fe5bSmrgAC_DEFUN([_AM_IF_OPTION],
7996600fe5bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
8006600fe5bSmrg
80140a76396Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
80240a76396Smrg#
80340a76396Smrg# This file is free software; the Free Software Foundation
80440a76396Smrg# gives unlimited permission to copy and/or distribute it,
80540a76396Smrg# with or without modifications, as long as this notice is preserved.
80640a76396Smrg
80740a76396Smrg# _AM_PROG_CC_C_O
80840a76396Smrg# ---------------
80940a76396Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
81040a76396Smrg# to automatically call this.
81140a76396SmrgAC_DEFUN([_AM_PROG_CC_C_O],
81240a76396Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
81340a76396SmrgAC_REQUIRE_AUX_FILE([compile])dnl
81440a76396SmrgAC_LANG_PUSH([C])dnl
81540a76396SmrgAC_CACHE_CHECK(
81640a76396Smrg  [whether $CC understands -c and -o together],
81740a76396Smrg  [am_cv_prog_cc_c_o],
81840a76396Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
81940a76396Smrg  # Make sure it works both with $CC and with simple cc.
82040a76396Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
82140a76396Smrg  # compilers refuse to overwrite an existing .o file with -o,
82240a76396Smrg  # though they will create one.
82340a76396Smrg  am_cv_prog_cc_c_o=yes
82440a76396Smrg  for am_i in 1 2; do
82540a76396Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
82640a76396Smrg         && test -f conftest2.$ac_objext; then
82740a76396Smrg      : OK
82840a76396Smrg    else
82940a76396Smrg      am_cv_prog_cc_c_o=no
83040a76396Smrg      break
83140a76396Smrg    fi
83240a76396Smrg  done
83340a76396Smrg  rm -f core conftest*
83440a76396Smrg  unset am_i])
83540a76396Smrgif test "$am_cv_prog_cc_c_o" != yes; then
83640a76396Smrg   # Losing compiler, so override with the script.
83740a76396Smrg   # FIXME: It is wrong to rewrite CC.
83840a76396Smrg   # But if we don't then we get into trouble of one sort or another.
83940a76396Smrg   # A longer-term fix would be to have automake use am__CC in this case,
84040a76396Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
84140a76396Smrg   CC="$am_aux_dir/compile $CC"
84240a76396Smrgfi
84340a76396SmrgAC_LANG_POP([C])])
844a0195d5fSmrg
84540a76396Smrg# For backward compatibility.
84640a76396SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
84740a76396Smrg
84840a76396Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
849a0195d5fSmrg#
850a0195d5fSmrg# This file is free software; the Free Software Foundation
851a0195d5fSmrg# gives unlimited permission to copy and/or distribute it,
852a0195d5fSmrg# with or without modifications, as long as this notice is preserved.
853a0195d5fSmrg
85440a76396Smrg# AM_RUN_LOG(COMMAND)
85540a76396Smrg# -------------------
85640a76396Smrg# Run COMMAND, save the exit status in ac_status, and log it.
85740a76396Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
85840a76396SmrgAC_DEFUN([AM_RUN_LOG],
85940a76396Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
86040a76396Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
86140a76396Smrg   ac_status=$?
86240a76396Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
86340a76396Smrg   (exit $ac_status); }])
86440a76396Smrg
86540a76396Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
86640a76396Smrg
86740a76396Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
86840a76396Smrg#
86940a76396Smrg# This file is free software; the Free Software Foundation
87040a76396Smrg# gives unlimited permission to copy and/or distribute it,
87140a76396Smrg# with or without modifications, as long as this notice is preserved.
872a0195d5fSmrg
8736600fe5bSmrg# AM_SANITY_CHECK
8746600fe5bSmrg# ---------------
8756600fe5bSmrgAC_DEFUN([AM_SANITY_CHECK],
8766600fe5bSmrg[AC_MSG_CHECKING([whether build environment is sane])
8776600fe5bSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8786600fe5bSmrg# name.  Accept space and tab only in the latter.
8796600fe5bSmrgam_lf='
8806600fe5bSmrg'
8816600fe5bSmrgcase `pwd` in
8826600fe5bSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8836600fe5bSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8846600fe5bSmrgesac
8856600fe5bSmrgcase $srcdir in
8866600fe5bSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
88740a76396Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8886600fe5bSmrgesac
889a0195d5fSmrg
89040a76396Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8916600fe5bSmrg# arguments.  Must try -L first in case configure is actually a
8926600fe5bSmrg# symlink; some systems play weird games with the mod time of symlinks
8936600fe5bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8946600fe5bSmrg# directory).
8956600fe5bSmrgif (
89640a76396Smrg   am_has_slept=no
89740a76396Smrg   for am_try in 1 2; do
89840a76396Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
89940a76396Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
90040a76396Smrg     if test "$[*]" = "X"; then
90140a76396Smrg	# -L didn't work.
90240a76396Smrg	set X `ls -t "$srcdir/configure" conftest.file`
90340a76396Smrg     fi
90440a76396Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
90540a76396Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
90640a76396Smrg
90740a76396Smrg	# If neither matched, then we have a broken ls.  This can happen
90840a76396Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
90940a76396Smrg	# broken ls alias from the environment.  This has actually
91040a76396Smrg	# happened.  Such a system could not be considered "sane".
91140a76396Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
91240a76396Smrg  alias in your environment])
91340a76396Smrg     fi
91440a76396Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
91540a76396Smrg       break
91640a76396Smrg     fi
91740a76396Smrg     # Just in case.
91840a76396Smrg     sleep 1
91940a76396Smrg     am_has_slept=yes
92040a76396Smrg   done
9216600fe5bSmrg   test "$[2]" = conftest.file
9226600fe5bSmrg   )
9236600fe5bSmrgthen
9246600fe5bSmrg   # Ok.
9256600fe5bSmrg   :
9266600fe5bSmrgelse
9276600fe5bSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
9286600fe5bSmrgCheck your system clock])
9296600fe5bSmrgfi
93040a76396SmrgAC_MSG_RESULT([yes])
93140a76396Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
93240a76396Smrg# generated files are strictly newer.
93340a76396Smrgam_sleep_pid=
93440a76396Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
93540a76396Smrg  ( sleep 1 ) &
93640a76396Smrg  am_sleep_pid=$!
93740a76396Smrgfi
93840a76396SmrgAC_CONFIG_COMMANDS_PRE(
93940a76396Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
94040a76396Smrg   if test -n "$am_sleep_pid"; then
94140a76396Smrg     # Hide warnings about reused PIDs.
94240a76396Smrg     wait $am_sleep_pid 2>/dev/null
94340a76396Smrg   fi
94440a76396Smrg   AC_MSG_RESULT([done])])
94540a76396Smrgrm -f conftest.file
94640a76396Smrg])
9476600fe5bSmrg
94840a76396Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
949a0195d5fSmrg#
950a0195d5fSmrg# This file is free software; the Free Software Foundation
951a0195d5fSmrg# gives unlimited permission to copy and/or distribute it,
952a0195d5fSmrg# with or without modifications, as long as this notice is preserved.
953a0195d5fSmrg
9546600fe5bSmrg# AM_SILENT_RULES([DEFAULT])
9556600fe5bSmrg# --------------------------
9566600fe5bSmrg# Enable less verbose build rules; with the default set to DEFAULT
95740a76396Smrg# ("yes" being less verbose, "no" or empty being verbose).
9586600fe5bSmrgAC_DEFUN([AM_SILENT_RULES],
95940a76396Smrg[AC_ARG_ENABLE([silent-rules], [dnl
96040a76396SmrgAS_HELP_STRING(
96140a76396Smrg  [--enable-silent-rules],
96240a76396Smrg  [less verbose build output (undo: "make V=1")])
96340a76396SmrgAS_HELP_STRING(
96440a76396Smrg  [--disable-silent-rules],
96540a76396Smrg  [verbose build output (undo: "make V=0")])dnl
96640a76396Smrg])
96740a76396Smrgcase $enable_silent_rules in @%:@ (((
96840a76396Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
96940a76396Smrg   no) AM_DEFAULT_VERBOSITY=1;;
97040a76396Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9716600fe5bSmrgesac
97240a76396Smrgdnl
97340a76396Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
97440a76396Smrgdnl do not support nested variable expansions.
97540a76396Smrgdnl See automake bug#9928 and bug#10237.
97640a76396Smrgam_make=${MAKE-make}
97740a76396SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
97840a76396Smrg   [am_cv_make_support_nested_variables],
97940a76396Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
98040a76396SmrgBAR0=false
98140a76396SmrgBAR1=true
98240a76396SmrgV=1
98340a76396Smrgam__doit:
98440a76396Smrg	@$(TRUE)
98540a76396Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
98640a76396Smrg  am_cv_make_support_nested_variables=yes
98740a76396Smrgelse
98840a76396Smrg  am_cv_make_support_nested_variables=no
98940a76396Smrgfi])
99040a76396Smrgif test $am_cv_make_support_nested_variables = yes; then
99140a76396Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
99240a76396Smrg  AM_V='$(V)'
99340a76396Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
99440a76396Smrgelse
99540a76396Smrg  AM_V=$AM_DEFAULT_VERBOSITY
99640a76396Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
99740a76396Smrgfi
99840a76396SmrgAC_SUBST([AM_V])dnl
99940a76396SmrgAM_SUBST_NOTMAKE([AM_V])dnl
100040a76396SmrgAC_SUBST([AM_DEFAULT_V])dnl
100140a76396SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10026600fe5bSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10036600fe5bSmrgAM_BACKSLASH='\'
10046600fe5bSmrgAC_SUBST([AM_BACKSLASH])dnl
10056600fe5bSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1006a0195d5fSmrg])
1007a0195d5fSmrg
100840a76396Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
10096600fe5bSmrg#
10106600fe5bSmrg# This file is free software; the Free Software Foundation
10116600fe5bSmrg# gives unlimited permission to copy and/or distribute it,
10126600fe5bSmrg# with or without modifications, as long as this notice is preserved.
10136600fe5bSmrg
10146600fe5bSmrg# AM_PROG_INSTALL_STRIP
10156600fe5bSmrg# ---------------------
101640a76396Smrg# One issue with vendor 'install' (even GNU) is that you can't
10176600fe5bSmrg# specify the program used to strip binaries.  This is especially
10186600fe5bSmrg# annoying in cross-compiling environments, where the build's strip
10196600fe5bSmrg# is unlikely to handle the host's binaries.
10206600fe5bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
102140a76396Smrg# always use install-sh in "make install-strip", and initialize
10226600fe5bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
10236600fe5bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
10246600fe5bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
102540a76396Smrg# Installed binaries are usually stripped using 'strip' when the user
102640a76396Smrg# run "make install-strip".  However 'strip' might not be the right
10276600fe5bSmrg# tool to use in cross-compilation environments, therefore Automake
102840a76396Smrg# will honor the 'STRIP' environment variable to overrule this program.
102940a76396Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
10306600fe5bSmrgif test "$cross_compiling" != no; then
10316600fe5bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
10326600fe5bSmrgfi
10336600fe5bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10346600fe5bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1035a0195d5fSmrg
103640a76396Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1037a0195d5fSmrg#
1038a0195d5fSmrg# This file is free software; the Free Software Foundation
1039a0195d5fSmrg# gives unlimited permission to copy and/or distribute it,
1040a0195d5fSmrg# with or without modifications, as long as this notice is preserved.
1041a0195d5fSmrg
10426600fe5bSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10436600fe5bSmrg# ---------------------------
10446600fe5bSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10456600fe5bSmrg# This macro is traced by Automake.
10466600fe5bSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1047a0195d5fSmrg
10486600fe5bSmrg# AM_SUBST_NOTMAKE(VARIABLE)
104940a76396Smrg# --------------------------
10506600fe5bSmrg# Public sister of _AM_SUBST_NOTMAKE.
10516600fe5bSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10526600fe5bSmrg
10536600fe5bSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10546600fe5bSmrg
105540a76396Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
1056a0195d5fSmrg#
1057a0195d5fSmrg# This file is free software; the Free Software Foundation
1058a0195d5fSmrg# gives unlimited permission to copy and/or distribute it,
1059a0195d5fSmrg# with or without modifications, as long as this notice is preserved.
1060a0195d5fSmrg
10616600fe5bSmrg# _AM_PROG_TAR(FORMAT)
10626600fe5bSmrg# --------------------
10636600fe5bSmrg# Check how to create a tarball in format FORMAT.
106440a76396Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1065a0195d5fSmrg#
10666600fe5bSmrg# Substitute a variable $(am__tar) that is a command
10676600fe5bSmrg# writing to stdout a FORMAT-tarball containing the directory
10686600fe5bSmrg# $tardir.
10696600fe5bSmrg#     tardir=directory && $(am__tar) > result.tar
10706600fe5bSmrg#
10716600fe5bSmrg# Substitute a variable $(am__untar) that extract such
10726600fe5bSmrg# a tarball read from stdin.
10736600fe5bSmrg#     $(am__untar) < result.tar
107440a76396Smrg#
10756600fe5bSmrgAC_DEFUN([_AM_PROG_TAR],
107640a76396Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
107740a76396Smrg# in the wild :-(  We should find a proper way to deprecate it ...
107840a76396SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
107940a76396Smrg
108040a76396Smrg# We'll loop over all known methods to create a tar archive until one works.
10816600fe5bSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1082a0195d5fSmrg
108340a76396Smrgm4_if([$1], [v7],
108440a76396Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
108540a76396Smrg
108640a76396Smrg  [m4_case([$1],
108740a76396Smrg    [ustar],
108840a76396Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
108940a76396Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
109040a76396Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
109140a76396Smrg      # and bug#13588).
109240a76396Smrg      am_max_uid=2097151 # 2^21 - 1
109340a76396Smrg      am_max_gid=$am_max_uid
109440a76396Smrg      # The $UID and $GID variables are not portable, so we need to resort
109540a76396Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
109640a76396Smrg      # below are definitely unexpected, so allow the users to see them
109740a76396Smrg      # (that is, avoid stderr redirection).
109840a76396Smrg      am_uid=`id -u || echo unknown`
109940a76396Smrg      am_gid=`id -g || echo unknown`
110040a76396Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
110140a76396Smrg      if test $am_uid -le $am_max_uid; then
110240a76396Smrg         AC_MSG_RESULT([yes])
110340a76396Smrg      else
110440a76396Smrg         AC_MSG_RESULT([no])
110540a76396Smrg         _am_tools=none
110640a76396Smrg      fi
110740a76396Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
110840a76396Smrg      if test $am_gid -le $am_max_gid; then
110940a76396Smrg         AC_MSG_RESULT([yes])
111040a76396Smrg      else
111140a76396Smrg        AC_MSG_RESULT([no])
111240a76396Smrg        _am_tools=none
111340a76396Smrg      fi],
111440a76396Smrg
111540a76396Smrg  [pax],
111640a76396Smrg    [],
111740a76396Smrg
111840a76396Smrg  [m4_fatal([Unknown tar format])])
111940a76396Smrg
112040a76396Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
112140a76396Smrg
112240a76396Smrg  # Go ahead even if we have the value already cached.  We do so because we
112340a76396Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
112440a76396Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
112540a76396Smrg
112640a76396Smrg  for _am_tool in $_am_tools; do
112740a76396Smrg    case $_am_tool in
112840a76396Smrg    gnutar)
112940a76396Smrg      for _am_tar in tar gnutar gtar; do
113040a76396Smrg        AM_RUN_LOG([$_am_tar --version]) && break
113140a76396Smrg      done
113240a76396Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
113340a76396Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
113440a76396Smrg      am__untar="$_am_tar -xf -"
113540a76396Smrg      ;;
113640a76396Smrg    plaintar)
113740a76396Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
113840a76396Smrg      # ustar tarball either.
113940a76396Smrg      (tar --version) >/dev/null 2>&1 && continue
114040a76396Smrg      am__tar='tar chf - "$$tardir"'
114140a76396Smrg      am__tar_='tar chf - "$tardir"'
114240a76396Smrg      am__untar='tar xf -'
114340a76396Smrg      ;;
114440a76396Smrg    pax)
114540a76396Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
114640a76396Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
114740a76396Smrg      am__untar='pax -r'
114840a76396Smrg      ;;
114940a76396Smrg    cpio)
115040a76396Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
115140a76396Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
115240a76396Smrg      am__untar='cpio -i -H $1 -d'
115340a76396Smrg      ;;
115440a76396Smrg    none)
115540a76396Smrg      am__tar=false
115640a76396Smrg      am__tar_=false
115740a76396Smrg      am__untar=false
115840a76396Smrg      ;;
115940a76396Smrg    esac
1160a0195d5fSmrg
116140a76396Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
116240a76396Smrg    # and am__untar set.
116340a76396Smrg    test -n "${am_cv_prog_tar_$1}" && break
116440a76396Smrg
116540a76396Smrg    # tar/untar a dummy directory, and stop if the command works.
116640a76396Smrg    rm -rf conftest.dir
116740a76396Smrg    mkdir conftest.dir
116840a76396Smrg    echo GrepMe > conftest.dir/file
116940a76396Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
117040a76396Smrg    rm -rf conftest.dir
117140a76396Smrg    if test -s conftest.tar; then
117240a76396Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
117340a76396Smrg      AM_RUN_LOG([cat conftest.dir/file])
117440a76396Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
117540a76396Smrg    fi
117640a76396Smrg  done
11776600fe5bSmrg  rm -rf conftest.dir
11786600fe5bSmrg
117940a76396Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
118040a76396Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
118140a76396Smrg
11826600fe5bSmrgAC_SUBST([am__tar])
11836600fe5bSmrgAC_SUBST([am__untar])
11846600fe5bSmrg]) # _AM_PROG_TAR
11856600fe5bSmrg
118640a76396Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
118740a76396Smrg# 
118840a76396Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
118940a76396Smrg#
119040a76396Smrg# This program is free software; you can redistribute it and/or modify
119140a76396Smrg# it under the terms of the GNU General Public License as published by
119240a76396Smrg# the Free Software Foundation; either version 2 of the License, or
119340a76396Smrg# (at your option) any later version.
119440a76396Smrg#
119540a76396Smrg# This program is distributed in the hope that it will be useful, but
119640a76396Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
119740a76396Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
119840a76396Smrg# General Public License for more details.
119940a76396Smrg#
120040a76396Smrg# You should have received a copy of the GNU General Public License
120140a76396Smrg# along with this program; if not, write to the Free Software
120240a76396Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
120340a76396Smrg#
120440a76396Smrg# As a special exception to the GNU General Public License, if you
120540a76396Smrg# distribute this file as part of a program that contains a
120640a76396Smrg# configuration script generated by Autoconf, you may include it under
120740a76396Smrg# the same distribution terms that you use for the rest of that program.
120840a76396Smrg
120940a76396Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
121040a76396Smrg# ----------------------------------
121140a76396SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
121240a76396Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121340a76396Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
121440a76396SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
121540a76396Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121640a76396Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
121740a76396Smrgfi
121840a76396Smrgif test -n "$PKG_CONFIG"; then
121940a76396Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122040a76396Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122140a76396Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122240a76396Smrg		AC_MSG_RESULT([yes])
122340a76396Smrg	else
122440a76396Smrg		AC_MSG_RESULT([no])
122540a76396Smrg		PKG_CONFIG=""
122640a76396Smrg	fi
122740a76396Smrg		
122840a76396Smrgfi[]dnl
122940a76396Smrg])# PKG_PROG_PKG_CONFIG
123040a76396Smrg
123140a76396Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123240a76396Smrg#
123340a76396Smrg# Check to see whether a particular set of modules exists.  Similar
123440a76396Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
123540a76396Smrg#
123640a76396Smrg#
123740a76396Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
123840a76396Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
123940a76396Smrg# PKG_CHECK_EXISTS manually
124040a76396Smrg# --------------------------------------------------------------
124140a76396SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124240a76396Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124340a76396Smrgif test -n "$PKG_CONFIG" && \
124440a76396Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124540a76396Smrg  m4_ifval([$2], [$2], [:])
124640a76396Smrgm4_ifvaln([$3], [else
124740a76396Smrg  $3])dnl
124840a76396Smrgfi])
124940a76396Smrg
125040a76396Smrg
125140a76396Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125240a76396Smrg# ---------------------------------------------
125340a76396Smrgm4_define([_PKG_CONFIG],
125440a76396Smrg[if test -n "$$1"; then
125540a76396Smrg    pkg_cv_[]$1="$$1"
125640a76396Smrg elif test -n "$PKG_CONFIG"; then
125740a76396Smrg    PKG_CHECK_EXISTS([$3],
125840a76396Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
125940a76396Smrg		     [pkg_failed=yes])
126040a76396Smrg else
126140a76396Smrg    pkg_failed=untried
126240a76396Smrgfi[]dnl
126340a76396Smrg])# _PKG_CONFIG
126440a76396Smrg
126540a76396Smrg# _PKG_SHORT_ERRORS_SUPPORTED
126640a76396Smrg# -----------------------------
126740a76396SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
126840a76396Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
126940a76396Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127040a76396Smrg        _pkg_short_errors_supported=yes
127140a76396Smrgelse
127240a76396Smrg        _pkg_short_errors_supported=no
127340a76396Smrgfi[]dnl
127440a76396Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
127540a76396Smrg
127640a76396Smrg
127740a76396Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
127840a76396Smrg# [ACTION-IF-NOT-FOUND])
127940a76396Smrg#
128040a76396Smrg#
128140a76396Smrg# Note that if there is a possibility the first call to
128240a76396Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
128340a76396Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128440a76396Smrg#
128540a76396Smrg#
128640a76396Smrg# --------------------------------------------------------------
128740a76396SmrgAC_DEFUN([PKG_CHECK_MODULES],
128840a76396Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
128940a76396SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129040a76396SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129140a76396Smrg
129240a76396Smrgpkg_failed=no
129340a76396SmrgAC_MSG_CHECKING([for $1])
129440a76396Smrg
129540a76396Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129640a76396Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129740a76396Smrg
129840a76396Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
129940a76396Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130040a76396SmrgSee the pkg-config man page for more details.])
130140a76396Smrg
130240a76396Smrgif test $pkg_failed = yes; then
130340a76396Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130440a76396Smrg        if test $_pkg_short_errors_supported = yes; then
130540a76396Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
130640a76396Smrg        else 
130740a76396Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
130840a76396Smrg        fi
130940a76396Smrg	# Put the nasty error message in config.log where it belongs
131040a76396Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131140a76396Smrg
131240a76396Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
131340a76396Smrg[Package requirements ($2) were not met:
131440a76396Smrg
131540a76396Smrg$$1_PKG_ERRORS
131640a76396Smrg
131740a76396SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
131840a76396Smrginstalled software in a non-standard prefix.
131940a76396Smrg
132040a76396Smrg_PKG_TEXT
132140a76396Smrg])],
132240a76396Smrg		[AC_MSG_RESULT([no])
132340a76396Smrg                $4])
132440a76396Smrgelif test $pkg_failed = untried; then
132540a76396Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
132640a76396Smrg[The pkg-config script could not be found or is too old.  Make sure it
132740a76396Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
132840a76396Smrgpath to pkg-config.
132940a76396Smrg
133040a76396Smrg_PKG_TEXT
133140a76396Smrg
133240a76396SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
133340a76396Smrg		[$4])
133440a76396Smrgelse
133540a76396Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133640a76396Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133740a76396Smrg        AC_MSG_RESULT([yes])
133840a76396Smrg	ifelse([$3], , :, [$3])
133940a76396Smrgfi[]dnl
134040a76396Smrg])# PKG_CHECK_MODULES
134140a76396Smrg
13426600fe5bSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13436600fe5bSmrgdnl
13442ab73d9fSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13456600fe5bSmrgdnl 
13466600fe5bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13476f5dd5c2Smrgdnl copy of this software and associated documentation files (the "Software"),
13486f5dd5c2Smrgdnl to deal in the Software without restriction, including without limitation
13496f5dd5c2Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13506f5dd5c2Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
13516f5dd5c2Smrgdnl Software is furnished to do so, subject to the following conditions:
13526600fe5bSmrgdnl
13536f5dd5c2Smrgdnl The above copyright notice and this permission notice (including the next
13546f5dd5c2Smrgdnl paragraph) shall be included in all copies or substantial portions of the
13556f5dd5c2Smrgdnl Software.
13566600fe5bSmrgdnl
13576f5dd5c2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13586f5dd5c2Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13596f5dd5c2Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13606f5dd5c2Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13616f5dd5c2Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13626f5dd5c2Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13636f5dd5c2Smrgdnl DEALINGS IN THE SOFTWARE.
13646600fe5bSmrg
13656600fe5bSmrg# XORG_MACROS_VERSION(required-version)
13666600fe5bSmrg# -------------------------------------
13676600fe5bSmrg# Minimum version: 1.1.0
13686600fe5bSmrg#
13696600fe5bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
13706600fe5bSmrg# your configure.ac with the minimum required version, such as:
13716600fe5bSmrg# XORG_MACROS_VERSION(1.1)
13726600fe5bSmrg#
13736600fe5bSmrg# To ensure that this macro is defined, also add:
13746600fe5bSmrg# m4_ifndef([XORG_MACROS_VERSION],
13756600fe5bSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13766600fe5bSmrg#
13776600fe5bSmrg#
13786600fe5bSmrg# See the "minimum version" comment for each macro you use to see what 
13796600fe5bSmrg# version you require.
13806600fe5bSmrgm4_defun([XORG_MACROS_VERSION],[
138140a76396Smrgm4_define([vers_have], [1.17])
13826600fe5bSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13836600fe5bSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13846600fe5bSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13856600fe5bSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13866600fe5bSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13876600fe5bSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13886600fe5bSmrgm4_undefine([vers_have])
13896600fe5bSmrgm4_undefine([maj_have])
13906600fe5bSmrgm4_undefine([maj_needed])
13916600fe5bSmrg]) # XORG_MACROS_VERSION
13926600fe5bSmrg
13936600fe5bSmrg# XORG_PROG_RAWCPP()
13946600fe5bSmrg# ------------------
13956600fe5bSmrg# Minimum version: 1.0.0
13966600fe5bSmrg#
13976600fe5bSmrg# Find cpp program and necessary flags for use in pre-processing text files
13986600fe5bSmrg# such as man pages and config files
13996600fe5bSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14006600fe5bSmrgAC_REQUIRE([AC_PROG_CPP])
14016600fe5bSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
14026600fe5bSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1403a0195d5fSmrg
14046600fe5bSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14056600fe5bSmrg# which is not the best choice for supporting other OS'es, but covers most
14066600fe5bSmrg# of the ones we need for now.
14076600fe5bSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1408ff6cf368SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14096600fe5bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14106600fe5bSmrg	AC_MSG_RESULT([no])
14116600fe5bSmrgelse
14126600fe5bSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14136600fe5bSmrg		RAWCPPFLAGS=-undef
14146600fe5bSmrg		AC_MSG_RESULT([yes])
14156600fe5bSmrg	# under Cygwin unix is still defined even with -undef
14166600fe5bSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14176600fe5bSmrg		RAWCPPFLAGS="-undef -ansi"
14186600fe5bSmrg		AC_MSG_RESULT([yes, with -ansi])
14196600fe5bSmrg	else
14206600fe5bSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
14216600fe5bSmrg	fi
14226600fe5bSmrgfi
14236600fe5bSmrgrm -f conftest.$ac_ext
1424a0195d5fSmrg
14256600fe5bSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1426ff6cf368SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
14276600fe5bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14286600fe5bSmrg	AC_MSG_RESULT([no])
1429a0195d5fSmrgelse
14306600fe5bSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14316600fe5bSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14326600fe5bSmrg		AC_MSG_RESULT([yes])
14336600fe5bSmrg	else
14346600fe5bSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14356600fe5bSmrg	fi
1436a0195d5fSmrgfi
14376600fe5bSmrgrm -f conftest.$ac_ext
14386600fe5bSmrgAC_SUBST(RAWCPPFLAGS)
14396600fe5bSmrg]) # XORG_PROG_RAWCPP
1440a0195d5fSmrg
14416600fe5bSmrg# XORG_MANPAGE_SECTIONS()
14426600fe5bSmrg# -----------------------
14436600fe5bSmrg# Minimum version: 1.0.0
14446600fe5bSmrg#
14456600fe5bSmrg# Determine which sections man pages go in for the different man page types
14466600fe5bSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14476600fe5bSmrg# Not sure if there's any better way than just hardcoding by OS name.
14486600fe5bSmrg# Override default settings by setting environment variables
14496f5dd5c2Smrg# Added MAN_SUBSTS in version 1.8
14506f5dd5c2Smrg# Added AC_PROG_SED in version 1.8
1451a0195d5fSmrg
14526600fe5bSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14536600fe5bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
14546f5dd5c2SmrgAC_REQUIRE([AC_PROG_SED])
1455a0195d5fSmrg
14566600fe5bSmrgif test x$APP_MAN_SUFFIX = x    ; then
14576600fe5bSmrg    APP_MAN_SUFFIX=1
14586600fe5bSmrgfi
14596600fe5bSmrgif test x$APP_MAN_DIR = x    ; then
14606600fe5bSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
14616600fe5bSmrgfi
1462a0195d5fSmrg
14636600fe5bSmrgif test x$LIB_MAN_SUFFIX = x    ; then
14646600fe5bSmrg    LIB_MAN_SUFFIX=3
14656600fe5bSmrgfi
14666600fe5bSmrgif test x$LIB_MAN_DIR = x    ; then
14676600fe5bSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1468a0195d5fSmrgfi
1469a0195d5fSmrg
14706600fe5bSmrgif test x$FILE_MAN_SUFFIX = x    ; then
14716600fe5bSmrg    case $host_os in
14726600fe5bSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
14736600fe5bSmrg	*)		FILE_MAN_SUFFIX=5  ;;
14746600fe5bSmrg    esac
14756600fe5bSmrgfi
14766600fe5bSmrgif test x$FILE_MAN_DIR = x    ; then
14776600fe5bSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
14786600fe5bSmrgfi
1479a0195d5fSmrg
14806600fe5bSmrgif test x$MISC_MAN_SUFFIX = x    ; then
14816600fe5bSmrg    case $host_os in
14826600fe5bSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
14836600fe5bSmrg	*)		MISC_MAN_SUFFIX=7  ;;
14846600fe5bSmrg    esac
14856600fe5bSmrgfi
14866600fe5bSmrgif test x$MISC_MAN_DIR = x    ; then
14876600fe5bSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
14886600fe5bSmrgfi
1489a0195d5fSmrg
14906600fe5bSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
14916600fe5bSmrg    case $host_os in
14926600fe5bSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
14936600fe5bSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
14946600fe5bSmrg    esac
14956600fe5bSmrgfi
14966600fe5bSmrgif test x$DRIVER_MAN_DIR = x    ; then
14976600fe5bSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
14986600fe5bSmrgfi
1499a0195d5fSmrg
15006600fe5bSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15016600fe5bSmrg    case $host_os in
15026600fe5bSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15036600fe5bSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15046600fe5bSmrg    esac
15056600fe5bSmrgfi
15066600fe5bSmrgif test x$ADMIN_MAN_DIR = x    ; then
15076600fe5bSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15086600fe5bSmrgfi
1509a0195d5fSmrg
1510a0195d5fSmrg
15116600fe5bSmrgAC_SUBST([APP_MAN_SUFFIX])
15126600fe5bSmrgAC_SUBST([LIB_MAN_SUFFIX])
15136600fe5bSmrgAC_SUBST([FILE_MAN_SUFFIX])
15146600fe5bSmrgAC_SUBST([MISC_MAN_SUFFIX])
15156600fe5bSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15166600fe5bSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15176600fe5bSmrgAC_SUBST([APP_MAN_DIR])
15186600fe5bSmrgAC_SUBST([LIB_MAN_DIR])
15196600fe5bSmrgAC_SUBST([FILE_MAN_DIR])
15206600fe5bSmrgAC_SUBST([MISC_MAN_DIR])
15216600fe5bSmrgAC_SUBST([DRIVER_MAN_DIR])
15226600fe5bSmrgAC_SUBST([ADMIN_MAN_DIR])
15236f5dd5c2Smrg
15246f5dd5c2SmrgXORG_MAN_PAGE="X Version 11"
15256f5dd5c2SmrgAC_SUBST([XORG_MAN_PAGE])
15266f5dd5c2SmrgMAN_SUBSTS="\
15276f5dd5c2Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15286f5dd5c2Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15296f5dd5c2Smrg	-e 's|__xservername__|Xorg|g' \
15306f5dd5c2Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
15316f5dd5c2Smrg	-e 's|__projectroot__|\$(prefix)|g' \
15322ab73d9fSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
15336f5dd5c2Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
15346f5dd5c2Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
15356f5dd5c2Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
15366f5dd5c2Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
15376f5dd5c2Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
15386f5dd5c2Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
15396f5dd5c2SmrgAC_SUBST([MAN_SUBSTS])
15406f5dd5c2Smrg
15416600fe5bSmrg]) # XORG_MANPAGE_SECTIONS
1542a0195d5fSmrg
15436f5dd5c2Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
15446f5dd5c2Smrg# ------------------------
15456f5dd5c2Smrg# Minimum version: 1.7.0
15466f5dd5c2Smrg#
15476f5dd5c2Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
15486f5dd5c2Smrg# provided by xorg-sgml-doctools, if installed.
15496f5dd5c2SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
15506f5dd5c2SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
15516f5dd5c2SmrgXORG_SGML_PATH=
15526f5dd5c2SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
15536f5dd5c2Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
15546f5dd5c2Smrg    [m4_ifval([$1],[:],
15556f5dd5c2Smrg        [if test x"$cross_compiling" != x"yes" ; then
15566f5dd5c2Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
15576f5dd5c2Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
15586f5dd5c2Smrg         fi])
15596f5dd5c2Smrg    ])
15606f5dd5c2Smrg
15616f5dd5c2Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
15626f5dd5c2Smrg# the path and the name of the doc stylesheet
15636f5dd5c2Smrgif test "x$XORG_SGML_PATH" != "x" ; then
15646f5dd5c2Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
15656f5dd5c2Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
15666f5dd5c2Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
15676f5dd5c2Smrgelse
15686f5dd5c2Smrg   AC_MSG_RESULT([no])
15696f5dd5c2Smrgfi
15706f5dd5c2Smrg
15716f5dd5c2SmrgAC_SUBST(XORG_SGML_PATH)
15726f5dd5c2SmrgAC_SUBST(STYLESHEET_SRCDIR)
15736f5dd5c2SmrgAC_SUBST(XSL_STYLESHEET)
15746f5dd5c2SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
15756f5dd5c2Smrg]) # XORG_CHECK_SGML_DOCTOOLS
15766f5dd5c2Smrg
15776600fe5bSmrg# XORG_CHECK_LINUXDOC
15786600fe5bSmrg# -------------------
15796600fe5bSmrg# Minimum version: 1.0.0
1580a0195d5fSmrg#
15816600fe5bSmrg# Defines the variable MAKE_TEXT if the necessary tools and
15826600fe5bSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
15836600fe5bSmrg# Whether or not the necessary tools and files are found can be checked
15846600fe5bSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
15856600fe5bSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
15866f5dd5c2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
15876f5dd5c2SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1588a0195d5fSmrg
15896600fe5bSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1590a0195d5fSmrg
15916f5dd5c2SmrgAC_MSG_CHECKING([whether to build documentation])
1592a0195d5fSmrg
15936f5dd5c2Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15946600fe5bSmrg   BUILDDOC=yes
15956600fe5bSmrgelse
15966600fe5bSmrg   BUILDDOC=no
1597a0195d5fSmrgfi
1598a0195d5fSmrg
15996600fe5bSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1600a0195d5fSmrg
16016600fe5bSmrgAC_MSG_RESULT([$BUILDDOC])
1602a0195d5fSmrg
16036f5dd5c2SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1604a0195d5fSmrg
16056f5dd5c2Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16066600fe5bSmrg   BUILDPDFDOC=yes
16076600fe5bSmrgelse
16086600fe5bSmrg   BUILDPDFDOC=no
16096600fe5bSmrgfi
1610a0195d5fSmrg
16116600fe5bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1612a0195d5fSmrg
16136600fe5bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1614a0195d5fSmrg
16156f5dd5c2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16166600fe5bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16176600fe5bSmrgMAKE_PDF="$PS2PDF"
16186600fe5bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1619a0195d5fSmrg
16206600fe5bSmrgAC_SUBST(MAKE_TEXT)
16216600fe5bSmrgAC_SUBST(MAKE_PS)
16226600fe5bSmrgAC_SUBST(MAKE_PDF)
16236600fe5bSmrgAC_SUBST(MAKE_HTML)
16246600fe5bSmrg]) # XORG_CHECK_LINUXDOC
16256600fe5bSmrg
16266600fe5bSmrg# XORG_CHECK_DOCBOOK
16276600fe5bSmrg# -------------------
16286600fe5bSmrg# Minimum version: 1.0.0
1629a0195d5fSmrg#
16306600fe5bSmrg# Checks for the ability to build output formats from SGML DocBook source.
16316600fe5bSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16326600fe5bSmrg# indicates whether the necessary tools and files are found and, if set,
16336600fe5bSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16346600fe5bSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
16356f5dd5c2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16366f5dd5c2Smrg
16376600fe5bSmrgBUILDTXTDOC=no
16386600fe5bSmrgBUILDPDFDOC=no
16396600fe5bSmrgBUILDPSDOC=no
16406600fe5bSmrgBUILDHTMLDOC=no
1641a0195d5fSmrg
16426600fe5bSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16436600fe5bSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16446600fe5bSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16456600fe5bSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1646a0195d5fSmrg
16476f5dd5c2SmrgAC_MSG_CHECKING([whether to build text documentation])
16486f5dd5c2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16496600fe5bSmrg   test x$BUILD_TXTDOC != xno; then
16506600fe5bSmrg	BUILDTXTDOC=yes
16516600fe5bSmrgfi
16526600fe5bSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16536600fe5bSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1654a0195d5fSmrg
16556f5dd5c2SmrgAC_MSG_CHECKING([whether to build PDF documentation])
16566f5dd5c2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16576600fe5bSmrg   test x$BUILD_PDFDOC != xno; then
16586600fe5bSmrg	BUILDPDFDOC=yes
1659a0195d5fSmrgfi
16606600fe5bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16616600fe5bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1662a0195d5fSmrg
16636f5dd5c2SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
16646f5dd5c2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16656600fe5bSmrg   test x$BUILD_PSDOC != xno; then
16666600fe5bSmrg	BUILDPSDOC=yes
16676600fe5bSmrgfi
16686600fe5bSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16696600fe5bSmrgAC_MSG_RESULT([$BUILDPSDOC])
1670a0195d5fSmrg
16716f5dd5c2SmrgAC_MSG_CHECKING([whether to build HTML documentation])
16726f5dd5c2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16736600fe5bSmrg   test x$BUILD_HTMLDOC != xno; then
16746600fe5bSmrg	BUILDHTMLDOC=yes
16756600fe5bSmrgfi
16766600fe5bSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16776600fe5bSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1678a0195d5fSmrg
16796600fe5bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16806600fe5bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16816600fe5bSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16826600fe5bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1683a0195d5fSmrg
16846600fe5bSmrgAC_SUBST(MAKE_TEXT)
16856600fe5bSmrgAC_SUBST(MAKE_PS)
16866600fe5bSmrgAC_SUBST(MAKE_PDF)
16876600fe5bSmrgAC_SUBST(MAKE_HTML)
16886600fe5bSmrg]) # XORG_CHECK_DOCBOOK
1689a0195d5fSmrg
16902ab73d9fSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
16916f5dd5c2Smrg# ----------------
16926f5dd5c2Smrg# Minimum version: 1.5.0
16932ab73d9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
16946f5dd5c2Smrg#
16956f5dd5c2Smrg# Documentation tools are not always available on all platforms and sometimes
16966f5dd5c2Smrg# not at the appropriate level. This macro enables a module to test for the
16976f5dd5c2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
16986f5dd5c2Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
16992ab73d9fSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17002ab73d9fSmrg# --with-xmlto assumes 'auto'.
17016f5dd5c2Smrg#
17026f5dd5c2Smrg# Interface to module:
17036f5dd5c2Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
17046f5dd5c2Smrg# XMLTO:	returns the path of the xmlto program found
17056f5dd5c2Smrg#		returns the path set by the user in the environment
17066f5dd5c2Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
17076f5dd5c2Smrg#		'no' user instructs the module not to use xmlto
17086f5dd5c2Smrg#
17096f5dd5c2Smrg# Added in version 1.10.0
17106f5dd5c2Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
17116f5dd5c2Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
17126f5dd5c2Smrg#
17136f5dd5c2Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
17146f5dd5c2Smrg#
17156f5dd5c2SmrgAC_DEFUN([XORG_WITH_XMLTO],[
17166f5dd5c2SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
17172ab73d9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
17186f5dd5c2SmrgAC_ARG_WITH(xmlto,
17196f5dd5c2Smrg	AS_HELP_STRING([--with-xmlto],
17202ab73d9fSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
17212ab73d9fSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
17222ab73d9fSmrgm4_undefine([_defopt])
17236f5dd5c2Smrg
17246f5dd5c2Smrgif test "x$use_xmlto" = x"auto"; then
17256f5dd5c2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
17266f5dd5c2Smrg   if test "x$XMLTO" = "x"; then
17276f5dd5c2Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
17286f5dd5c2Smrg	have_xmlto=no
17296f5dd5c2Smrg   else
17306f5dd5c2Smrg        have_xmlto=yes
17316f5dd5c2Smrg   fi
17326f5dd5c2Smrgelif test "x$use_xmlto" = x"yes" ; then
17336f5dd5c2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
17346f5dd5c2Smrg   if test "x$XMLTO" = "x"; then
17356f5dd5c2Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
17366f5dd5c2Smrg   fi
17376f5dd5c2Smrg   have_xmlto=yes
17386f5dd5c2Smrgelif test "x$use_xmlto" = x"no" ; then
17396f5dd5c2Smrg   if test "x$XMLTO" != "x"; then
17406f5dd5c2Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
17416f5dd5c2Smrg   fi
17426f5dd5c2Smrg   have_xmlto=no
17436f5dd5c2Smrgelse
17446f5dd5c2Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
17456f5dd5c2Smrgfi
17466f5dd5c2Smrg
17476f5dd5c2Smrg# Test for a minimum version of xmlto, if provided.
17486f5dd5c2Smrgm4_ifval([$1],
17496f5dd5c2Smrg[if test "$have_xmlto" = yes; then
17506f5dd5c2Smrg    # scrape the xmlto version
17516f5dd5c2Smrg    AC_MSG_CHECKING([the xmlto version])
17526f5dd5c2Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
17536f5dd5c2Smrg    AC_MSG_RESULT([$xmlto_version])
17546f5dd5c2Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
17556f5dd5c2Smrg        [if test "x$use_xmlto" = xauto; then
17566f5dd5c2Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
17576f5dd5c2Smrg            have_xmlto=no
17586f5dd5c2Smrg        else
17596f5dd5c2Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
17606f5dd5c2Smrg        fi])
17616f5dd5c2Smrgfi])
17626f5dd5c2Smrg
17636f5dd5c2Smrg# Test for the ability of xmlto to generate a text target
17646f5dd5c2Smrghave_xmlto_text=no
17656f5dd5c2Smrgcat > conftest.xml << "EOF"
17666f5dd5c2SmrgEOF
17676f5dd5c2SmrgAS_IF([test "$have_xmlto" = yes],
17686f5dd5c2Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
17696f5dd5c2Smrg             [have_xmlto_text=yes],
17706f5dd5c2Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
17716f5dd5c2Smrgrm -f conftest.xml
17726f5dd5c2SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
17736f5dd5c2SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
17746f5dd5c2Smrg]) # XORG_WITH_XMLTO
17756f5dd5c2Smrg
1776ff6cf368Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1777ff6cf368Smrg# --------------------------------------------
1778ff6cf368Smrg# Minimum version: 1.12.0
1779ff6cf368Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1780ff6cf368Smrg#
1781ff6cf368Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1782ff6cf368Smrg# XML-based language used for the transformation of XML documents.
1783ff6cf368Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1784ff6cf368Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1785ff6cf368Smrg# The XSLT processor is often used as a standalone tool for transformations.
1786ff6cf368Smrg# It should not be assumed that this tool is used only to work with documnetation.
1787ff6cf368Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1788ff6cf368Smrg#
1789ff6cf368Smrg# Interface to module:
1790ff6cf368Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1791ff6cf368Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1792ff6cf368Smrg#		 returns the path set by the user in the environment
1793ff6cf368Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1794ff6cf368Smrg#		  'no' user instructs the module not to use xsltproc
1795ff6cf368Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1796ff6cf368Smrg#
1797ff6cf368Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1798ff6cf368Smrg#
1799ff6cf368SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1800ff6cf368SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1801ff6cf368Smrg# Preserves the interface, should it be implemented later
1802ff6cf368Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1803ff6cf368Smrgm4_define([_defopt], m4_default([$2], [auto]))
1804ff6cf368SmrgAC_ARG_WITH(xsltproc,
1805ff6cf368Smrg	AS_HELP_STRING([--with-xsltproc],
1806ff6cf368Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1807ff6cf368Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1808ff6cf368Smrgm4_undefine([_defopt])
1809ff6cf368Smrg
1810ff6cf368Smrgif test "x$use_xsltproc" = x"auto"; then
1811ff6cf368Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1812ff6cf368Smrg   if test "x$XSLTPROC" = "x"; then
1813ff6cf368Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1814ff6cf368Smrg	have_xsltproc=no
1815ff6cf368Smrg   else
1816ff6cf368Smrg        have_xsltproc=yes
1817ff6cf368Smrg   fi
1818ff6cf368Smrgelif test "x$use_xsltproc" = x"yes" ; then
1819ff6cf368Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1820ff6cf368Smrg   if test "x$XSLTPROC" = "x"; then
1821ff6cf368Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1822ff6cf368Smrg   fi
1823ff6cf368Smrg   have_xsltproc=yes
1824ff6cf368Smrgelif test "x$use_xsltproc" = x"no" ; then
1825ff6cf368Smrg   if test "x$XSLTPROC" != "x"; then
1826ff6cf368Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1827ff6cf368Smrg   fi
1828ff6cf368Smrg   have_xsltproc=no
1829ff6cf368Smrgelse
1830ff6cf368Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1831ff6cf368Smrgfi
1832ff6cf368Smrg
1833ff6cf368SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1834ff6cf368Smrg]) # XORG_WITH_XSLTPROC
1835ff6cf368Smrg
1836ff6cf368Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1837ff6cf368Smrg# ----------------------------------------
1838ff6cf368Smrg# Minimum version: 1.15.0
1839ff6cf368Smrg#
1840ff6cf368Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1841ff6cf368Smrg# scanning arbitrary text files, extracting information from those text files,
1842ff6cf368Smrg# and printing reports based on that information.
1843ff6cf368Smrg#
1844ff6cf368Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1845ff6cf368Smrg#
1846ff6cf368Smrg# Interface to module:
1847ff6cf368Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1848ff6cf368Smrg# PERL:	     returns the path of the perl program found
1849ff6cf368Smrg#	     returns the path set by the user in the environment
1850ff6cf368Smrg# --with-perl: 'yes' user instructs the module to use perl
1851ff6cf368Smrg#	       'no' user instructs the module not to use perl
1852ff6cf368Smrg# have_perl: returns yes if perl found in PATH or no
1853ff6cf368Smrg#
1854ff6cf368Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1855ff6cf368Smrg#
1856ff6cf368SmrgAC_DEFUN([XORG_WITH_PERL],[
1857ff6cf368SmrgAC_ARG_VAR([PERL], [Path to perl command])
1858ff6cf368Smrg# Preserves the interface, should it be implemented later
1859ff6cf368Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1860ff6cf368Smrgm4_define([_defopt], m4_default([$2], [auto]))
1861ff6cf368SmrgAC_ARG_WITH(perl,
1862ff6cf368Smrg	AS_HELP_STRING([--with-perl],
1863ff6cf368Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1864ff6cf368Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1865ff6cf368Smrgm4_undefine([_defopt])
1866ff6cf368Smrg
1867ff6cf368Smrgif test "x$use_perl" = x"auto"; then
1868ff6cf368Smrg   AC_PATH_PROG([PERL], [perl])
1869ff6cf368Smrg   if test "x$PERL" = "x"; then
1870ff6cf368Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1871ff6cf368Smrg	have_perl=no
1872ff6cf368Smrg   else
1873ff6cf368Smrg        have_perl=yes
1874ff6cf368Smrg   fi
1875ff6cf368Smrgelif test "x$use_perl" = x"yes" ; then
1876ff6cf368Smrg   AC_PATH_PROG([PERL], [perl])
1877ff6cf368Smrg   if test "x$PERL" = "x"; then
1878ff6cf368Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1879ff6cf368Smrg   fi
1880ff6cf368Smrg   have_perl=yes
1881ff6cf368Smrgelif test "x$use_perl" = x"no" ; then
1882ff6cf368Smrg   if test "x$PERL" != "x"; then
1883ff6cf368Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1884ff6cf368Smrg   fi
1885ff6cf368Smrg   have_perl=no
1886ff6cf368Smrgelse
1887ff6cf368Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1888ff6cf368Smrgfi
1889ff6cf368Smrg
1890ff6cf368SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1891ff6cf368Smrg]) # XORG_WITH_PERL
1892ff6cf368Smrg
18932ab73d9fSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
18946f5dd5c2Smrg# ----------------
18956f5dd5c2Smrg# Minimum version: 1.5.0
18962ab73d9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
18976f5dd5c2Smrg#
18986f5dd5c2Smrg# Documentation tools are not always available on all platforms and sometimes
18996f5dd5c2Smrg# not at the appropriate level. This macro enables a module to test for the
19006f5dd5c2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19016f5dd5c2Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
19022ab73d9fSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
19032ab73d9fSmrg# --with-asciidoc assumes 'auto'.
19046f5dd5c2Smrg#
19056f5dd5c2Smrg# Interface to module:
19066f5dd5c2Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
19076f5dd5c2Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
19086f5dd5c2Smrg#		 returns the path set by the user in the environment
19096f5dd5c2Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
19106f5dd5c2Smrg#		  'no' user instructs the module not to use asciidoc
19116f5dd5c2Smrg#
19126f5dd5c2Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
19136f5dd5c2Smrg#
19146f5dd5c2SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
19156f5dd5c2SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
19162ab73d9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
19176f5dd5c2SmrgAC_ARG_WITH(asciidoc,
19186f5dd5c2Smrg	AS_HELP_STRING([--with-asciidoc],
19192ab73d9fSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
19202ab73d9fSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
19212ab73d9fSmrgm4_undefine([_defopt])
19226f5dd5c2Smrg
19236f5dd5c2Smrgif test "x$use_asciidoc" = x"auto"; then
19246f5dd5c2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19256f5dd5c2Smrg   if test "x$ASCIIDOC" = "x"; then
19266f5dd5c2Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
19276f5dd5c2Smrg	have_asciidoc=no
19286f5dd5c2Smrg   else
19296f5dd5c2Smrg        have_asciidoc=yes
19306f5dd5c2Smrg   fi
19316f5dd5c2Smrgelif test "x$use_asciidoc" = x"yes" ; then
19326f5dd5c2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19336f5dd5c2Smrg   if test "x$ASCIIDOC" = "x"; then
19346f5dd5c2Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
19356f5dd5c2Smrg   fi
19366f5dd5c2Smrg   have_asciidoc=yes
19376f5dd5c2Smrgelif test "x$use_asciidoc" = x"no" ; then
19386f5dd5c2Smrg   if test "x$ASCIIDOC" != "x"; then
19396f5dd5c2Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
19406f5dd5c2Smrg   fi
19416f5dd5c2Smrg   have_asciidoc=no
19426f5dd5c2Smrgelse
19436f5dd5c2Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
19446f5dd5c2Smrgfi
19456f5dd5c2Smrgm4_ifval([$1],
19466f5dd5c2Smrg[if test "$have_asciidoc" = yes; then
19476f5dd5c2Smrg    # scrape the asciidoc version
19486f5dd5c2Smrg    AC_MSG_CHECKING([the asciidoc version])
19496f5dd5c2Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
19506f5dd5c2Smrg    AC_MSG_RESULT([$asciidoc_version])
19516f5dd5c2Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
19526f5dd5c2Smrg        [if test "x$use_asciidoc" = xauto; then
19536f5dd5c2Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
19546f5dd5c2Smrg            have_asciidoc=no
19556f5dd5c2Smrg        else
19566f5dd5c2Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
19576f5dd5c2Smrg        fi])
19586f5dd5c2Smrgfi])
19596f5dd5c2SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
19606f5dd5c2Smrg]) # XORG_WITH_ASCIIDOC
19616f5dd5c2Smrg
19622ab73d9fSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
19636f5dd5c2Smrg# --------------------------------
19646f5dd5c2Smrg# Minimum version: 1.5.0
19652ab73d9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19666f5dd5c2Smrg#
19676f5dd5c2Smrg# Documentation tools are not always available on all platforms and sometimes
19686f5dd5c2Smrg# not at the appropriate level. This macro enables a module to test for the
19696f5dd5c2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19706f5dd5c2Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
19712ab73d9fSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
19722ab73d9fSmrg# --with-doxygen assumes 'auto'.
19736f5dd5c2Smrg#
19746f5dd5c2Smrg# Interface to module:
19756f5dd5c2Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
19766f5dd5c2Smrg# DOXYGEN:	 returns the path of the doxygen program found
19776f5dd5c2Smrg#		 returns the path set by the user in the environment
19786f5dd5c2Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
19796f5dd5c2Smrg#		  'no' user instructs the module not to use doxygen
19806f5dd5c2Smrg#
19816f5dd5c2Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
19826f5dd5c2Smrg#
19836f5dd5c2SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
19846f5dd5c2SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
19852ab73d9fSmrgm4_define([_defopt], m4_default([$2], [auto]))
19866f5dd5c2SmrgAC_ARG_WITH(doxygen,
19876f5dd5c2Smrg	AS_HELP_STRING([--with-doxygen],
19882ab73d9fSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
19892ab73d9fSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
19902ab73d9fSmrgm4_undefine([_defopt])
19916f5dd5c2Smrg
19926f5dd5c2Smrgif test "x$use_doxygen" = x"auto"; then
19936f5dd5c2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
19946f5dd5c2Smrg   if test "x$DOXYGEN" = "x"; then
19956f5dd5c2Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
19966f5dd5c2Smrg	have_doxygen=no
19976f5dd5c2Smrg   else
19986f5dd5c2Smrg        have_doxygen=yes
19996f5dd5c2Smrg   fi
20006f5dd5c2Smrgelif test "x$use_doxygen" = x"yes" ; then
20016f5dd5c2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
20026f5dd5c2Smrg   if test "x$DOXYGEN" = "x"; then
20036f5dd5c2Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
20046f5dd5c2Smrg   fi
20056f5dd5c2Smrg   have_doxygen=yes
20066f5dd5c2Smrgelif test "x$use_doxygen" = x"no" ; then
20076f5dd5c2Smrg   if test "x$DOXYGEN" != "x"; then
20086f5dd5c2Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
20096f5dd5c2Smrg   fi
20106f5dd5c2Smrg   have_doxygen=no
20116f5dd5c2Smrgelse
20126f5dd5c2Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
20136f5dd5c2Smrgfi
20146f5dd5c2Smrgm4_ifval([$1],
20156f5dd5c2Smrg[if test "$have_doxygen" = yes; then
20166f5dd5c2Smrg    # scrape the doxygen version
20176f5dd5c2Smrg    AC_MSG_CHECKING([the doxygen version])
20186f5dd5c2Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
20196f5dd5c2Smrg    AC_MSG_RESULT([$doxygen_version])
20206f5dd5c2Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
20216f5dd5c2Smrg        [if test "x$use_doxygen" = xauto; then
20226f5dd5c2Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
20236f5dd5c2Smrg            have_doxygen=no
20246f5dd5c2Smrg        else
20256f5dd5c2Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
20266f5dd5c2Smrg        fi])
20276f5dd5c2Smrgfi])
20286f5dd5c2SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
20296f5dd5c2Smrg]) # XORG_WITH_DOXYGEN
20306f5dd5c2Smrg
20312ab73d9fSmrg# XORG_WITH_GROFF([DEFAULT])
20326f5dd5c2Smrg# ----------------
20336f5dd5c2Smrg# Minimum version: 1.6.0
20342ab73d9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20356f5dd5c2Smrg#
20366f5dd5c2Smrg# Documentation tools are not always available on all platforms and sometimes
20376f5dd5c2Smrg# not at the appropriate level. This macro enables a module to test for the
20386f5dd5c2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20396f5dd5c2Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
20402ab73d9fSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
20412ab73d9fSmrg# --with-groff assumes 'auto'.
20426f5dd5c2Smrg#
20436f5dd5c2Smrg# Interface to module:
20446f5dd5c2Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
20456f5dd5c2Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
20466f5dd5c2Smrg# HAVE_GROFF_MS: the -ms macros package
20476f5dd5c2Smrg# GROFF:	 returns the path of the groff program found
20486f5dd5c2Smrg#		 returns the path set by the user in the environment
20496f5dd5c2Smrg# --with-groff:	 'yes' user instructs the module to use groff
20506f5dd5c2Smrg#		 'no' user instructs the module not to use groff
20516f5dd5c2Smrg#
20526f5dd5c2Smrg# Added in version 1.9.0:
20536f5dd5c2Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
20546f5dd5c2Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
20556f5dd5c2Smrg#		   psselect from the psutils package.
20566f5dd5c2Smrg#		   the ghostcript package. Refer to the grohtml man pages
20576f5dd5c2Smrg#
20586f5dd5c2Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
20596f5dd5c2Smrg#
20606f5dd5c2Smrg# OS and distros often splits groff in a basic and full package, the former
20616f5dd5c2Smrg# having the groff program and the later having devices, fonts and macros
20626f5dd5c2Smrg# Checking for the groff executable is not enough.
20636f5dd5c2Smrg#
20646f5dd5c2Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
20656f5dd5c2Smrg# unset HAVE_GROFF or GROFF env variables.
20666f5dd5c2Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
20676f5dd5c2Smrg#
20686f5dd5c2SmrgAC_DEFUN([XORG_WITH_GROFF],[
20696f5dd5c2SmrgAC_ARG_VAR([GROFF], [Path to groff command])
20702ab73d9fSmrgm4_define([_defopt], m4_default([$1], [auto]))
20716f5dd5c2SmrgAC_ARG_WITH(groff,
20726f5dd5c2Smrg	AS_HELP_STRING([--with-groff],
20732ab73d9fSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
20742ab73d9fSmrg	   [use_groff=$withval], [use_groff=]_defopt)
20752ab73d9fSmrgm4_undefine([_defopt])
20766f5dd5c2Smrg
20776f5dd5c2Smrgif test "x$use_groff" = x"auto"; then
20786f5dd5c2Smrg   AC_PATH_PROG([GROFF], [groff])
20796f5dd5c2Smrg   if test "x$GROFF" = "x"; then
20806f5dd5c2Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
20816f5dd5c2Smrg	have_groff=no
20826f5dd5c2Smrg   else
20836f5dd5c2Smrg        have_groff=yes
20846f5dd5c2Smrg   fi
20856f5dd5c2Smrgelif test "x$use_groff" = x"yes" ; then
20866f5dd5c2Smrg   AC_PATH_PROG([GROFF], [groff])
20876f5dd5c2Smrg   if test "x$GROFF" = "x"; then
20886f5dd5c2Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
20896f5dd5c2Smrg   fi
20906f5dd5c2Smrg   have_groff=yes
20916f5dd5c2Smrgelif test "x$use_groff" = x"no" ; then
20926f5dd5c2Smrg   if test "x$GROFF" != "x"; then
20936f5dd5c2Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
20946f5dd5c2Smrg   fi
20956f5dd5c2Smrg   have_groff=no
20966f5dd5c2Smrgelse
20976f5dd5c2Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
20986f5dd5c2Smrgfi
20996f5dd5c2Smrg
21006f5dd5c2Smrg# We have groff, test for the presence of the macro packages
21016f5dd5c2Smrgif test "x$have_groff" = x"yes"; then
21026f5dd5c2Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
21036f5dd5c2Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
21046f5dd5c2Smrg        groff_ms_works=yes
21056f5dd5c2Smrg    else
21066f5dd5c2Smrg        groff_ms_works=no
21076f5dd5c2Smrg    fi
21086f5dd5c2Smrg    AC_MSG_RESULT([$groff_ms_works])
21096f5dd5c2Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
21106f5dd5c2Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
21116f5dd5c2Smrg        groff_mm_works=yes
21126f5dd5c2Smrg    else
21136f5dd5c2Smrg        groff_mm_works=no
21146f5dd5c2Smrg    fi
21156f5dd5c2Smrg    AC_MSG_RESULT([$groff_mm_works])
21166f5dd5c2Smrgfi
21176f5dd5c2Smrg
21186f5dd5c2Smrg# We have groff, test for HTML dependencies, one command per package
21196f5dd5c2Smrgif test "x$have_groff" = x"yes"; then
21206f5dd5c2Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
21216f5dd5c2Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
21226f5dd5c2Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
21236f5dd5c2Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
21246f5dd5c2Smrg      have_groff_html=yes
21256f5dd5c2Smrg   else
21266f5dd5c2Smrg      have_groff_html=no
21276f5dd5c2Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
21286f5dd5c2Smrg   fi
21296f5dd5c2Smrgfi
21306f5dd5c2Smrg
21316f5dd5c2Smrg# Set Automake conditionals for Makefiles
21326f5dd5c2SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
21336f5dd5c2SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
21346f5dd5c2SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
21356f5dd5c2SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
21366f5dd5c2Smrg]) # XORG_WITH_GROFF
21376f5dd5c2Smrg
2138ff6cf368Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2139ff6cf368Smrg# ---------------------------------------
21406f5dd5c2Smrg# Minimum version: 1.6.0
21412ab73d9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2142ff6cf368Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
21436f5dd5c2Smrg#
21446f5dd5c2Smrg# Documentation tools are not always available on all platforms and sometimes
21456f5dd5c2Smrg# not at the appropriate level. This macro enables a module to test for the
21466f5dd5c2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21476f5dd5c2Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
21482ab73d9fSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
21492ab73d9fSmrg# --with-fop assumes 'auto'.
21506f5dd5c2Smrg#
21516f5dd5c2Smrg# Interface to module:
21526f5dd5c2Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
21536f5dd5c2Smrg# FOP:	 	returns the path of the fop program found
21546f5dd5c2Smrg#		returns the path set by the user in the environment
21556f5dd5c2Smrg# --with-fop: 	'yes' user instructs the module to use fop
21566f5dd5c2Smrg#		'no' user instructs the module not to use fop
21576f5dd5c2Smrg#
21586f5dd5c2Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
21596f5dd5c2Smrg#
21606f5dd5c2SmrgAC_DEFUN([XORG_WITH_FOP],[
21616f5dd5c2SmrgAC_ARG_VAR([FOP], [Path to fop command])
2162ff6cf368Smrgm4_define([_defopt], m4_default([$2], [auto]))
21636f5dd5c2SmrgAC_ARG_WITH(fop,
21646f5dd5c2Smrg	AS_HELP_STRING([--with-fop],
21652ab73d9fSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
21662ab73d9fSmrg	   [use_fop=$withval], [use_fop=]_defopt)
21672ab73d9fSmrgm4_undefine([_defopt])
21686f5dd5c2Smrg
21696f5dd5c2Smrgif test "x$use_fop" = x"auto"; then
21706f5dd5c2Smrg   AC_PATH_PROG([FOP], [fop])
21716f5dd5c2Smrg   if test "x$FOP" = "x"; then
21726f5dd5c2Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
21736f5dd5c2Smrg	have_fop=no
21746f5dd5c2Smrg   else
21756f5dd5c2Smrg        have_fop=yes
21766f5dd5c2Smrg   fi
21776f5dd5c2Smrgelif test "x$use_fop" = x"yes" ; then
21786f5dd5c2Smrg   AC_PATH_PROG([FOP], [fop])
21796f5dd5c2Smrg   if test "x$FOP" = "x"; then
21806f5dd5c2Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
21816f5dd5c2Smrg   fi
21826f5dd5c2Smrg   have_fop=yes
21836f5dd5c2Smrgelif test "x$use_fop" = x"no" ; then
21846f5dd5c2Smrg   if test "x$FOP" != "x"; then
21856f5dd5c2Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
21866f5dd5c2Smrg   fi
21876f5dd5c2Smrg   have_fop=no
21886f5dd5c2Smrgelse
21896f5dd5c2Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
21906f5dd5c2Smrgfi
2191ff6cf368Smrg
2192ff6cf368Smrg# Test for a minimum version of fop, if provided.
2193ff6cf368Smrgm4_ifval([$1],
2194ff6cf368Smrg[if test "$have_fop" = yes; then
2195ff6cf368Smrg    # scrape the fop version
2196ff6cf368Smrg    AC_MSG_CHECKING([for fop minimum version])
2197ff6cf368Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2198ff6cf368Smrg    AC_MSG_RESULT([$fop_version])
2199ff6cf368Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2200ff6cf368Smrg        [if test "x$use_fop" = xauto; then
2201ff6cf368Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2202ff6cf368Smrg            have_fop=no
2203ff6cf368Smrg        else
2204ff6cf368Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2205ff6cf368Smrg        fi])
2206ff6cf368Smrgfi])
22076f5dd5c2SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
22086f5dd5c2Smrg]) # XORG_WITH_FOP
22096f5dd5c2Smrg
22102ab73d9fSmrg# XORG_WITH_PS2PDF([DEFAULT])
22116f5dd5c2Smrg# ----------------
22126f5dd5c2Smrg# Minimum version: 1.6.0
22132ab73d9fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22146f5dd5c2Smrg#
22156f5dd5c2Smrg# Documentation tools are not always available on all platforms and sometimes
22166f5dd5c2Smrg# not at the appropriate level. This macro enables a module to test for the
22176f5dd5c2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22186f5dd5c2Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
22192ab73d9fSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
22202ab73d9fSmrg# --with-ps2pdf assumes 'auto'.
22216f5dd5c2Smrg#
22226f5dd5c2Smrg# Interface to module:
22236f5dd5c2Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
22246f5dd5c2Smrg# PS2PDF:	returns the path of the ps2pdf program found
22256f5dd5c2Smrg#		returns the path set by the user in the environment
22266f5dd5c2Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
22276f5dd5c2Smrg#		 'no' user instructs the module not to use ps2pdf
22286f5dd5c2Smrg#
22296f5dd5c2Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
22306f5dd5c2Smrg#
22316f5dd5c2SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
22326f5dd5c2SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
22332ab73d9fSmrgm4_define([_defopt], m4_default([$1], [auto]))
22346f5dd5c2SmrgAC_ARG_WITH(ps2pdf,
22356f5dd5c2Smrg	AS_HELP_STRING([--with-ps2pdf],
22362ab73d9fSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
22372ab73d9fSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
22382ab73d9fSmrgm4_undefine([_defopt])
22396f5dd5c2Smrg
22406f5dd5c2Smrgif test "x$use_ps2pdf" = x"auto"; then
22416f5dd5c2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22426f5dd5c2Smrg   if test "x$PS2PDF" = "x"; then
22436f5dd5c2Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
22446f5dd5c2Smrg	have_ps2pdf=no
22456f5dd5c2Smrg   else
22466f5dd5c2Smrg        have_ps2pdf=yes
22476f5dd5c2Smrg   fi
22486f5dd5c2Smrgelif test "x$use_ps2pdf" = x"yes" ; then
22496f5dd5c2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22506f5dd5c2Smrg   if test "x$PS2PDF" = "x"; then
22516f5dd5c2Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
22526f5dd5c2Smrg   fi
22536f5dd5c2Smrg   have_ps2pdf=yes
22546f5dd5c2Smrgelif test "x$use_ps2pdf" = x"no" ; then
22556f5dd5c2Smrg   if test "x$PS2PDF" != "x"; then
22566f5dd5c2Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
22576f5dd5c2Smrg   fi
22586f5dd5c2Smrg   have_ps2pdf=no
22596f5dd5c2Smrgelse
22606f5dd5c2Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
22616f5dd5c2Smrgfi
22626f5dd5c2SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
22636f5dd5c2Smrg]) # XORG_WITH_PS2PDF
22646f5dd5c2Smrg
22656f5dd5c2Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
22666f5dd5c2Smrg# ----------------
22676f5dd5c2Smrg# Minimum version: 1.6.0
22686f5dd5c2Smrg#
22696f5dd5c2Smrg# Documentation tools are not always available on all platforms and sometimes
22706f5dd5c2Smrg# not at the appropriate level. This macro enables a builder to skip all
22716f5dd5c2Smrg# documentation targets except traditional man pages.
22726f5dd5c2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
22736f5dd5c2Smrg# maximum flexibilty in controlling documentation building.
22746f5dd5c2Smrg# Refer to:
22756f5dd5c2Smrg# XORG_WITH_XMLTO         --with-xmlto
22766f5dd5c2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
22776f5dd5c2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
22786f5dd5c2Smrg# XORG_WITH_FOP           --with-fop
22796f5dd5c2Smrg# XORG_WITH_GROFF         --with-groff
22806f5dd5c2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
22816f5dd5c2Smrg#
22826f5dd5c2Smrg# Interface to module:
22836f5dd5c2Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
22846f5dd5c2Smrg# --enable-docs: 'yes' user instructs the module to generate docs
22856f5dd5c2Smrg#		 'no' user instructs the module not to generate docs
22866f5dd5c2Smrg# parm1:	specify the default value, yes or no.
22876f5dd5c2Smrg#
22886f5dd5c2SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2289ff6cf368Smrgm4_define([docs_default], m4_default([$1], [yes]))
22906f5dd5c2SmrgAC_ARG_ENABLE(docs,
22916f5dd5c2Smrg	AS_HELP_STRING([--enable-docs],
2292ff6cf368Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2293ff6cf368Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2294ff6cf368Smrgm4_undefine([docs_default])
22956f5dd5c2SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
22966f5dd5c2SmrgAC_MSG_CHECKING([whether to build documentation])
22976f5dd5c2SmrgAC_MSG_RESULT([$build_docs])
22986f5dd5c2Smrg]) # XORG_ENABLE_DOCS
22996f5dd5c2Smrg
23006f5dd5c2Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
23016f5dd5c2Smrg# ----------------
23026f5dd5c2Smrg# Minimum version: 1.6.0
23036f5dd5c2Smrg#
23046f5dd5c2Smrg# This macro enables a builder to skip all developer documentation.
23056f5dd5c2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23066f5dd5c2Smrg# maximum flexibilty in controlling documentation building.
23076f5dd5c2Smrg# Refer to:
23086f5dd5c2Smrg# XORG_WITH_XMLTO         --with-xmlto
23096f5dd5c2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23106f5dd5c2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23116f5dd5c2Smrg# XORG_WITH_FOP           --with-fop
23126f5dd5c2Smrg# XORG_WITH_GROFF         --with-groff
23136f5dd5c2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23146f5dd5c2Smrg#
23156f5dd5c2Smrg# Interface to module:
23166f5dd5c2Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
23176f5dd5c2Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
23186f5dd5c2Smrg#			'no' user instructs the module not to generate developer docs
23196f5dd5c2Smrg# parm1:		specify the default value, yes or no.
23206f5dd5c2Smrg#
23216f5dd5c2SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
23222ab73d9fSmrgm4_define([devel_default], m4_default([$1], [yes]))
23236f5dd5c2SmrgAC_ARG_ENABLE(devel-docs,
23246f5dd5c2Smrg	AS_HELP_STRING([--enable-devel-docs],
23252ab73d9fSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
23262ab73d9fSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
23272ab73d9fSmrgm4_undefine([devel_default])
23286f5dd5c2SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
23296f5dd5c2SmrgAC_MSG_CHECKING([whether to build developer documentation])
23306f5dd5c2SmrgAC_MSG_RESULT([$build_devel_docs])
23316f5dd5c2Smrg]) # XORG_ENABLE_DEVEL_DOCS
23326f5dd5c2Smrg
23336f5dd5c2Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
23346f5dd5c2Smrg# ----------------
23356f5dd5c2Smrg# Minimum version: 1.6.0
23366f5dd5c2Smrg#
23376f5dd5c2Smrg# This macro enables a builder to skip all functional specification targets.
23386f5dd5c2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23396f5dd5c2Smrg# maximum flexibilty in controlling documentation building.
23406f5dd5c2Smrg# Refer to:
23416f5dd5c2Smrg# XORG_WITH_XMLTO         --with-xmlto
23426f5dd5c2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23436f5dd5c2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23446f5dd5c2Smrg# XORG_WITH_FOP           --with-fop
23456f5dd5c2Smrg# XORG_WITH_GROFF         --with-groff
23466f5dd5c2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23476f5dd5c2Smrg#
23486f5dd5c2Smrg# Interface to module:
23496f5dd5c2Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
23506f5dd5c2Smrg# --enable-specs:	'yes' user instructs the module to generate specs
23516f5dd5c2Smrg#			'no' user instructs the module not to generate specs
23526f5dd5c2Smrg# parm1:		specify the default value, yes or no.
23536f5dd5c2Smrg#
23546f5dd5c2SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
23552ab73d9fSmrgm4_define([spec_default], m4_default([$1], [yes]))
23566f5dd5c2SmrgAC_ARG_ENABLE(specs,
23576f5dd5c2Smrg	AS_HELP_STRING([--enable-specs],
23582ab73d9fSmrg	   [Enable building the specs (default: ]spec_default[)]),
23592ab73d9fSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
23602ab73d9fSmrgm4_undefine([spec_default])
23616f5dd5c2SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
23626f5dd5c2SmrgAC_MSG_CHECKING([whether to build functional specifications])
23636f5dd5c2SmrgAC_MSG_RESULT([$build_specs])
23646f5dd5c2Smrg]) # XORG_ENABLE_SPECS
23656f5dd5c2Smrg
2366ff6cf368Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2367ff6cf368Smrg# ----------------------------------------------
2368ff6cf368Smrg# Minimum version: 1.13.0
2369ff6cf368Smrg#
2370ff6cf368Smrg# This macro enables a builder to enable/disable unit testing
2371ff6cf368Smrg# It makes no assumption about the test cases implementation
2372ff6cf368Smrg# Test cases may or may not use Automake "Support for test suites"
2373ff6cf368Smrg# They may or may not use the software utility library GLib
2374ff6cf368Smrg#
2375ff6cf368Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2376ff6cf368Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2377ff6cf368Smrg# The variable enable_unit_tests is used by other macros in this file.
2378ff6cf368Smrg#
2379ff6cf368Smrg# Interface to module:
2380ff6cf368Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2381ff6cf368Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2382ff6cf368Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2383ff6cf368Smrg#			'no' user instructs the module not to build tests
2384ff6cf368Smrg# parm1:		specify the default value, yes or no.
2385ff6cf368Smrg#
2386ff6cf368SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2387ff6cf368SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2388ff6cf368SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
238940a76396SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2390ff6cf368Smrgm4_define([_defopt], m4_default([$1], [auto]))
2391ff6cf368SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2392ff6cf368Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2393ff6cf368Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2394ff6cf368Smrgm4_undefine([_defopt])
2395ff6cf368SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2396ff6cf368SmrgAC_MSG_CHECKING([whether to build unit test cases])
2397ff6cf368SmrgAC_MSG_RESULT([$enable_unit_tests])
2398ff6cf368Smrg]) # XORG_ENABLE_UNIT_TESTS
2399ff6cf368Smrg
240040a76396Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
240140a76396Smrg# ------------------------------------------------------
240240a76396Smrg# Minimum version: 1.17.0
240340a76396Smrg#
240440a76396Smrg# This macro enables a builder to enable/disable integration testing
240540a76396Smrg# It makes no assumption about the test cases' implementation
240640a76396Smrg# Test cases may or may not use Automake "Support for test suites"
240740a76396Smrg#
240840a76396Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
240940a76396Smrg# usually requires less dependencies and may be built and run under less
241040a76396Smrg# stringent environments than integration tests.
241140a76396Smrg#
241240a76396Smrg# Interface to module:
241340a76396Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
241440a76396Smrg# enable_integration_tests:   used in configure.ac for additional configuration
241540a76396Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
241640a76396Smrg#                             'no' user instructs the module not to build tests
241740a76396Smrg# parm1:                      specify the default value, yes or no.
241840a76396Smrg#
241940a76396SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
242040a76396SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
242140a76396Smrgm4_define([_defopt], m4_default([$1], [auto]))
242240a76396SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
242340a76396Smrg	[Enable building integration test cases (default: ]_defopt[)]),
242440a76396Smrg	[enable_integration_tests=$enableval],
242540a76396Smrg	[enable_integration_tests=]_defopt)
242640a76396Smrgm4_undefine([_defopt])
242740a76396SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
242840a76396Smrg	[test "x$enable_integration_tests" != xno])
242940a76396SmrgAC_MSG_CHECKING([whether to build unit test cases])
243040a76396SmrgAC_MSG_RESULT([$enable_integration_tests])
243140a76396Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
243240a76396Smrg
2433ff6cf368Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2434ff6cf368Smrg# ----------------------------------------
2435ff6cf368Smrg# Minimum version: 1.13.0
2436ff6cf368Smrg#
2437ff6cf368Smrg# GLib is a library which provides advanced data structures and functions.
2438ff6cf368Smrg# This macro enables a module to test for the presence of Glib.
2439ff6cf368Smrg#
2440ff6cf368Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2441ff6cf368Smrg# Otherwise the value of $enable_unit_tests is blank.
2442ff6cf368Smrg#
244340a76396Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
244440a76396Smrg# test support usually requires less dependencies and may be built and run under
244540a76396Smrg# less stringent environments than integration tests.
244640a76396Smrg#
2447ff6cf368Smrg# Interface to module:
2448ff6cf368Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2449ff6cf368Smrg# with_glib: used in configure.ac to know if GLib has been found
2450ff6cf368Smrg# --with-glib:	'yes' user instructs the module to use glib
2451ff6cf368Smrg#		'no' user instructs the module not to use glib
2452ff6cf368Smrg#
2453ff6cf368SmrgAC_DEFUN([XORG_WITH_GLIB],[
2454ff6cf368SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2455ff6cf368Smrgm4_define([_defopt], m4_default([$2], [auto]))
2456ff6cf368SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2457ff6cf368Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2458ff6cf368Smrg	[with_glib=$withval], [with_glib=]_defopt)
2459ff6cf368Smrgm4_undefine([_defopt])
2460ff6cf368Smrg
2461ff6cf368Smrghave_glib=no
2462ff6cf368Smrg# Do not probe GLib if user explicitly disabled unit testing
2463ff6cf368Smrgif test "x$enable_unit_tests" != x"no"; then
2464ff6cf368Smrg  # Do not probe GLib if user explicitly disabled it
2465ff6cf368Smrg  if test "x$with_glib" != x"no"; then
2466ff6cf368Smrg    m4_ifval(
2467ff6cf368Smrg      [$1],
2468ff6cf368Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2469ff6cf368Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2470ff6cf368Smrg    )
2471ff6cf368Smrg  fi
2472ff6cf368Smrgfi
2473ff6cf368Smrg
2474ff6cf368Smrg# Not having GLib when unit testing has been explicitly requested is an error
2475ff6cf368Smrgif test "x$enable_unit_tests" = x"yes"; then
2476ff6cf368Smrg  if test "x$have_glib" = x"no"; then
2477ff6cf368Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2478ff6cf368Smrg  fi
2479ff6cf368Smrgfi
2480ff6cf368Smrg
2481ff6cf368Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2482ff6cf368Smrgif test "x$enable_unit_tests" = x"no"; then
2483ff6cf368Smrg  if test "x$with_glib" = x"yes"; then
2484ff6cf368Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2485ff6cf368Smrg  fi
2486ff6cf368Smrgfi
2487ff6cf368Smrg
2488ff6cf368Smrg# Not having GLib when it has been explicitly requested is an error
2489ff6cf368Smrgif test "x$with_glib" = x"yes"; then
2490ff6cf368Smrg  if test "x$have_glib" = x"no"; then
2491ff6cf368Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2492ff6cf368Smrg  fi
2493ff6cf368Smrgfi
2494ff6cf368Smrg
2495ff6cf368SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2496ff6cf368Smrg]) # XORG_WITH_GLIB
2497ff6cf368Smrg
249840a76396Smrg# XORG_LD_WRAP([required|optional])
249940a76396Smrg# ---------------------------------
2500ff6cf368Smrg# Minimum version: 1.13.0
2501ff6cf368Smrg#
2502ff6cf368Smrg# Check if linker supports -wrap, passed via compiler flags
2503ff6cf368Smrg#
2504ff6cf368Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2505ff6cf368Smrg# Otherwise the value of $enable_unit_tests is blank.
2506ff6cf368Smrg#
250740a76396Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
250840a76396Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
250940a76396Smrg# available, an argument of "optional" allows use when some unit tests require
251040a76396Smrg# ld -wrap and others do not.
251140a76396Smrg#
2512ff6cf368SmrgAC_DEFUN([XORG_LD_WRAP],[
251340a76396SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
251440a76396Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
251540a76396Smrg                      void __wrap_exit(int status) { return; }],
251640a76396Smrg                     [exit(0);])])
2517ff6cf368Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
251840a76396Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2519ff6cf368Smrg  if test "x$have_ld_wrap" = x"no"; then
2520ff6cf368Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2521ff6cf368Smrg  fi
2522ff6cf368Smrgfi
2523ff6cf368SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2524ff6cf368Smrg#
2525ff6cf368Smrg]) # XORG_LD_WRAP
2526ff6cf368Smrg
2527ff6cf368Smrg# XORG_CHECK_LINKER_FLAGS
2528ff6cf368Smrg# -----------------------
2529ff6cf368Smrg# SYNOPSIS
2530ff6cf368Smrg#
253140a76396Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2532ff6cf368Smrg#
2533ff6cf368Smrg# DESCRIPTION
2534ff6cf368Smrg#
2535ff6cf368Smrg#   Check whether the given linker FLAGS work with the current language's
2536ff6cf368Smrg#   linker, or whether they give an error.
2537ff6cf368Smrg#
2538ff6cf368Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2539ff6cf368Smrg#   success/failure.
2540ff6cf368Smrg#
254140a76396Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
254240a76396Smrg#
2543ff6cf368Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2544ff6cf368Smrg#
2545ff6cf368Smrg# LICENSE
2546ff6cf368Smrg#
2547ff6cf368Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2548ff6cf368Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2549ff6cf368Smrg#   Copyright (c) 2009 Matteo Frigo
2550ff6cf368Smrg#
2551ff6cf368Smrg#   This program is free software: you can redistribute it and/or modify it
2552ff6cf368Smrg#   under the terms of the GNU General Public License as published by the
2553ff6cf368Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2554ff6cf368Smrg#   option) any later version.
2555ff6cf368Smrg#
2556ff6cf368Smrg#   This program is distributed in the hope that it will be useful, but
2557ff6cf368Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2558ff6cf368Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2559ff6cf368Smrg#   Public License for more details.
2560ff6cf368Smrg#
2561ff6cf368Smrg#   You should have received a copy of the GNU General Public License along
2562ff6cf368Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2563ff6cf368Smrg#
2564ff6cf368Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2565ff6cf368Smrg#   gives unlimited permission to copy, distribute and modify the configure
2566ff6cf368Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2567ff6cf368Smrg#   need not follow the terms of the GNU General Public License when using
2568ff6cf368Smrg#   or distributing such scripts, even though portions of the text of the
2569ff6cf368Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2570ff6cf368Smrg#   all other use of the material that constitutes the Autoconf Macro.
2571ff6cf368Smrg#
2572ff6cf368Smrg#   This special exception to the GPL applies to versions of the Autoconf
2573ff6cf368Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2574ff6cf368Smrg#   modified version of the Autoconf Macro, you may extend this special
2575ff6cf368Smrg#   exception to the GPL to apply to your modified version as well.#
2576ff6cf368SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2577ff6cf368Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2578ff6cf368Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2579ff6cf368SmrgAS_LITERAL_IF([$1],
2580ff6cf368Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2581ff6cf368Smrg      ax_save_FLAGS=$LDFLAGS
2582ff6cf368Smrg      LDFLAGS="$1"
258340a76396Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2584ff6cf368Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2585ff6cf368Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2586ff6cf368Smrg      LDFLAGS=$ax_save_FLAGS])],
2587ff6cf368Smrg  [ax_save_FLAGS=$LDFLAGS
2588ff6cf368Smrg   LDFLAGS="$1"
2589ff6cf368Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2590ff6cf368Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2591ff6cf368Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2592ff6cf368Smrg   LDFLAGS=$ax_save_FLAGS])
2593ff6cf368Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2594ff6cf368SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2595ff6cf368Smrgif test "x$xorg_check_linker_flags" = xyes; then
2596ff6cf368Smrg	m4_default([$2], :)
2597ff6cf368Smrgelse
2598ff6cf368Smrg	m4_default([$3], :)
2599ff6cf368Smrgfi
2600ff6cf368Smrg]) # XORG_CHECK_LINKER_FLAGS
2601ff6cf368Smrg
260240a76396Smrg# XORG_MEMORY_CHECK_FLAGS
260340a76396Smrg# -----------------------
260440a76396Smrg# Minimum version: 1.16.0
260540a76396Smrg#
260640a76396Smrg# This macro attempts to find appropriate memory checking functionality
260740a76396Smrg# for various platforms which unit testing code may use to catch various
260840a76396Smrg# forms of memory allocation and access errors in testing.
260940a76396Smrg#
261040a76396Smrg# Interface to module:
261140a76396Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
261240a76396Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
261340a76396Smrg#
261440a76396Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
261540a76396Smrg#
261640a76396SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
261740a76396Smrg
261840a76396SmrgAC_REQUIRE([AC_CANONICAL_HOST])
261940a76396SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
262040a76396Smrg           [Environment variables to enable memory checking in tests])
262140a76396Smrg
262240a76396Smrg# Check for different types of support on different platforms
262340a76396Smrgcase $host_os in
262440a76396Smrg    solaris*)
262540a76396Smrg        AC_CHECK_LIB([umem], [umem_alloc],
262640a76396Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
262740a76396Smrg        ;;
262840a76396Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
262940a76396Smrg        # both directly and inverted, so should not be 0 or 255.
263040a76396Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
263140a76396Smrg        ;;
263240a76396Smrg    darwin*)
263340a76396Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
263440a76396Smrg        ;;
263540a76396Smrg    *bsd*)
263640a76396Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
263740a76396Smrg        ;;
263840a76396Smrgesac
263940a76396Smrg
264040a76396Smrg# User supplied flags override default flags
264140a76396Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
264240a76396Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
264340a76396Smrgfi
264440a76396Smrg
264540a76396SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
264640a76396Smrg]) # XORG_WITH_LINT
264740a76396Smrg
26486600fe5bSmrg# XORG_CHECK_MALLOC_ZERO
26496600fe5bSmrg# ----------------------
26506600fe5bSmrg# Minimum version: 1.0.0
26516600fe5bSmrg#
26526600fe5bSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
26536600fe5bSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
26546600fe5bSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
26556600fe5bSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
26566600fe5bSmrgAC_ARG_ENABLE(malloc0returnsnull,
26576600fe5bSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
26586600fe5bSmrg		       [malloc(0) returns NULL (default: auto)]),
26596600fe5bSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
26606600fe5bSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2661a0195d5fSmrg
26626600fe5bSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
26636600fe5bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2664ff6cf368Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2665ff6cf368Smrg#include <stdlib.h>
2666ff6cf368Smrg],[
26676600fe5bSmrg    char *m0, *r0, *c0, *p;
26686600fe5bSmrg    m0 = malloc(0);
26696600fe5bSmrg    p = malloc(10);
26706600fe5bSmrg    r0 = realloc(p,0);
2671ff6cf368Smrg    c0 = calloc(0,10);
2672ff6cf368Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2673ff6cf368Smrg])],
26746600fe5bSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
26756f5dd5c2Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
26766f5dd5c2Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
26776600fe5bSmrgfi
26786600fe5bSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2679a0195d5fSmrg
26806600fe5bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
26816600fe5bSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
26826600fe5bSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
26836600fe5bSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
26846600fe5bSmrgelse
26856600fe5bSmrg	MALLOC_ZERO_CFLAGS=""
26866600fe5bSmrg	XMALLOC_ZERO_CFLAGS=""
26876600fe5bSmrg	XTMALLOC_ZERO_CFLAGS=""
26886600fe5bSmrgfi
2689a0195d5fSmrg
26906600fe5bSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
26916600fe5bSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
26926600fe5bSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
26936600fe5bSmrg]) # XORG_CHECK_MALLOC_ZERO
2694a0195d5fSmrg
26956600fe5bSmrg# XORG_WITH_LINT()
26966600fe5bSmrg# ----------------
26976600fe5bSmrg# Minimum version: 1.1.0
26986600fe5bSmrg#
26996f5dd5c2Smrg# This macro enables the use of a tool that flags some suspicious and
27006f5dd5c2Smrg# non-portable constructs (likely to be bugs) in C language source code.
27016f5dd5c2Smrg# It will attempt to locate the tool and use appropriate options.
27026f5dd5c2Smrg# There are various lint type tools on different platforms.
27036f5dd5c2Smrg#
27046f5dd5c2Smrg# Interface to module:
27056f5dd5c2Smrg# LINT:		returns the path to the tool found on the platform
27066f5dd5c2Smrg#		or the value set to LINT on the configure cmd line
27076f5dd5c2Smrg#		also an Automake conditional
27086f5dd5c2Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
27096f5dd5c2Smrg#
27106f5dd5c2Smrg# --with-lint:	'yes' user instructs the module to use lint
27116f5dd5c2Smrg#		'no' user instructs the module not to use lint (default)
27126f5dd5c2Smrg#
27136f5dd5c2Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
27146f5dd5c2Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27156600fe5bSmrg#
27166600fe5bSmrgAC_DEFUN([XORG_WITH_LINT],[
27176600fe5bSmrg
27186f5dd5c2SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
27196f5dd5c2SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27206600fe5bSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27216600fe5bSmrg		[Use a lint-style source code checker (default: disabled)])],
27226600fe5bSmrg		[use_lint=$withval], [use_lint=no])
27236f5dd5c2Smrg
27246f5dd5c2Smrg# Obtain platform specific info like program name and options
27256f5dd5c2Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
27266f5dd5c2Smrgcase $host_os in
27276f5dd5c2Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
27286f5dd5c2Smrg	lint_name=splint
27296f5dd5c2Smrg	lint_options="-badflag"
27306f5dd5c2Smrg	;;
27316f5dd5c2Smrg  *freebsd* | *netbsd*)
27326f5dd5c2Smrg	lint_name=lint
27336f5dd5c2Smrg	lint_options="-u -b"
27346f5dd5c2Smrg	;;
27356f5dd5c2Smrg  *solaris*)
27366f5dd5c2Smrg	lint_name=lint
27376f5dd5c2Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
27386f5dd5c2Smrg	;;
27396f5dd5c2Smrgesac
27406f5dd5c2Smrg
27416f5dd5c2Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
27426f5dd5c2Smrgif test "x$use_lint" = x"yes" ; then
27436f5dd5c2Smrg   AC_PATH_PROG([LINT], [$lint_name])
27446f5dd5c2Smrg   if test "x$LINT" = "x"; then
27456f5dd5c2Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
27466f5dd5c2Smrg   fi
27476f5dd5c2Smrgelif test "x$use_lint" = x"no" ; then
27486f5dd5c2Smrg   if test "x$LINT" != "x"; then
27496f5dd5c2Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
27506f5dd5c2Smrg   fi
27516600fe5bSmrgelse
27526f5dd5c2Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2753a0195d5fSmrgfi
27546f5dd5c2Smrg
27556f5dd5c2Smrg# User supplied flags override default flags
27566f5dd5c2Smrgif test "x$LINT_FLAGS" != "x"; then
27576f5dd5c2Smrg   lint_options=$LINT_FLAGS
2758a0195d5fSmrgfi
2759a0195d5fSmrg
27606f5dd5c2SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
27616f5dd5c2SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2762a0195d5fSmrg
27636600fe5bSmrg]) # XORG_WITH_LINT
2764a0195d5fSmrg
27656600fe5bSmrg# XORG_LINT_LIBRARY(LIBNAME)
27666600fe5bSmrg# --------------------------
27676600fe5bSmrg# Minimum version: 1.1.0
27686600fe5bSmrg#
27696600fe5bSmrg# Sets up flags for building lint libraries for checking programs that call
27706600fe5bSmrg# functions in the library.
27716600fe5bSmrg#
27726f5dd5c2Smrg# Interface to module:
27736f5dd5c2Smrg# LINTLIB		- Automake variable with the name of lint library file to make
27746f5dd5c2Smrg# MAKE_LINT_LIB		- Automake conditional
27756f5dd5c2Smrg#
27766f5dd5c2Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
27776f5dd5c2Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2778a0195d5fSmrg
27796600fe5bSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27806600fe5bSmrgAC_REQUIRE([XORG_WITH_LINT])
27816600fe5bSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27826600fe5bSmrg	[Create lint library (default: disabled)])],
27836600fe5bSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
27846f5dd5c2Smrg
27856f5dd5c2Smrgif test "x$make_lint_lib" = x"yes" ; then
27866f5dd5c2Smrg   LINTLIB=llib-l$1.ln
27876f5dd5c2Smrg   if test "x$LINT" = "x"; then
27886f5dd5c2Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
27896f5dd5c2Smrg   fi
27906f5dd5c2Smrgelif test "x$make_lint_lib" != x"no" ; then
27916f5dd5c2Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
27926600fe5bSmrgfi
27936f5dd5c2Smrg
27946600fe5bSmrgAC_SUBST(LINTLIB)
27956600fe5bSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2796a0195d5fSmrg
27976600fe5bSmrg]) # XORG_LINT_LIBRARY
2798a0195d5fSmrg
2799ff6cf368Smrg# XORG_COMPILER_BRAND
2800ff6cf368Smrg# -------------------
2801ff6cf368Smrg# Minimum version: 1.14.0
2802ff6cf368Smrg#
2803ff6cf368Smrg# Checks for various brands of compilers and sets flags as appropriate:
2804ff6cf368Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
280540a76396Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2806ff6cf368Smrg#   clang compiler - sets CLANGCC to "yes"
2807ff6cf368Smrg#   Intel compiler - sets INTELCC to "yes"
2808ff6cf368Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2809ff6cf368Smrg#
2810ff6cf368SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
281140a76396SmrgAC_LANG_CASE(
281240a76396Smrg	[C], [
281340a76396Smrg		AC_REQUIRE([AC_PROG_CC_C99])
281440a76396Smrg	],
281540a76396Smrg	[C++], [
281640a76396Smrg		AC_REQUIRE([AC_PROG_CXX])
281740a76396Smrg	]
281840a76396Smrg)
2819ff6cf368SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2820ff6cf368SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2821ff6cf368SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2822ff6cf368Smrg]) # XORG_COMPILER_BRAND
2823ff6cf368Smrg
282440a76396Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
282540a76396Smrg# ---------------
282640a76396Smrg# Minimum version: 1.16.0
282740a76396Smrg#
282840a76396Smrg# Test if the compiler works when passed the given flag as a command line argument.
282940a76396Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
283040a76396Smrg# next flag in the list until there are no more options.
283140a76396Smrg#
283240a76396Smrg# Note that this does not guarantee that the compiler supports the flag as some
283340a76396Smrg# compilers will simply ignore arguments that they do not understand, but we do
283440a76396Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
283540a76396Smrg# -Werror=unused-command-line-argument
283640a76396Smrg#
283740a76396SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
283840a76396Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
283940a76396Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
284040a76396Smrg
284140a76396SmrgAC_LANG_COMPILER_REQUIRE
284240a76396Smrg
284340a76396SmrgAC_LANG_CASE(
284440a76396Smrg	[C], [
284540a76396Smrg		AC_REQUIRE([AC_PROG_CC_C99])
284640a76396Smrg		define([PREFIX], [C])
284740a76396Smrg		define([CACHE_PREFIX], [cc])
284840a76396Smrg		define([COMPILER], [$CC])
284940a76396Smrg	],
285040a76396Smrg	[C++], [
285140a76396Smrg		define([PREFIX], [CXX])
285240a76396Smrg		define([CACHE_PREFIX], [cxx])
285340a76396Smrg		define([COMPILER], [$CXX])
285440a76396Smrg	]
285540a76396Smrg)
285640a76396Smrg
285740a76396Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
285840a76396Smrg
285940a76396Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
286040a76396Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
286140a76396Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
286240a76396Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
286340a76396Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
286440a76396Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
286540a76396Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
286640a76396Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
286740a76396Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
286840a76396Smrgfi
286940a76396Smrg
287040a76396Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
287140a76396Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
287240a76396Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
287340a76396Smrg	fi
287440a76396Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
287540a76396Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
287640a76396Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
287740a76396Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
287840a76396Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
287940a76396Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
288040a76396Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
288140a76396Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
288240a76396Smrgfi
288340a76396Smrg
288440a76396Smrgfound="no"
288540a76396Smrgm4_foreach([flag], m4_cdr($@), [
288640a76396Smrg	if test $found = "no" ; then
288740a76396Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
288840a76396Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
288940a76396Smrg		fi
289040a76396Smrg
289140a76396Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
289240a76396Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
289340a76396Smrg		fi
289440a76396Smrg
289540a76396Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
289640a76396Smrg
289740a76396Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
289840a76396Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
289940a76396Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
290040a76396Smrg		AC_CACHE_VAL($cacheid,
290140a76396Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
290240a76396Smrg					     [eval $cacheid=yes],
290340a76396Smrg					     [eval $cacheid=no])])
290440a76396Smrg
290540a76396Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
290640a76396Smrg
290740a76396Smrg		eval supported=\$$cacheid
290840a76396Smrg		AC_MSG_RESULT([$supported])
290940a76396Smrg		if test "$supported" = "yes" ; then
291040a76396Smrg			$1="$$1 ]flag["
291140a76396Smrg			found="yes"
291240a76396Smrg		fi
291340a76396Smrg	fi
291440a76396Smrg])
291540a76396Smrg]) # XORG_TESTSET_CFLAG
291640a76396Smrg
291740a76396Smrg# XORG_COMPILER_FLAGS
291840a76396Smrg# ---------------
291940a76396Smrg# Minimum version: 1.16.0
292040a76396Smrg#
292140a76396Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
292240a76396Smrg# arguments supported by the selected compiler which do NOT alter the generated
292340a76396Smrg# code.  These arguments will cause the compiler to print various warnings
292440a76396Smrg# during compilation AND turn a conservative set of warnings into errors.
292540a76396Smrg#
292640a76396Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
292740a76396Smrg# future versions of util-macros as options are added to new compilers.
292840a76396Smrg#
292940a76396SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
293040a76396SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
293140a76396Smrg
293240a76396SmrgAC_ARG_ENABLE(selective-werror,
293340a76396Smrg              AS_HELP_STRING([--disable-selective-werror],
293440a76396Smrg                             [Turn off selective compiler errors. (default: enabled)]),
293540a76396Smrg              [SELECTIVE_WERROR=$enableval],
293640a76396Smrg              [SELECTIVE_WERROR=yes])
293740a76396Smrg
293840a76396SmrgAC_LANG_CASE(
293940a76396Smrg        [C], [
294040a76396Smrg                define([PREFIX], [C])
294140a76396Smrg        ],
294240a76396Smrg        [C++], [
294340a76396Smrg                define([PREFIX], [CXX])
294440a76396Smrg        ]
294540a76396Smrg)
294640a76396Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
294740a76396Smrgif test "x$SUNCC" = "xyes"; then
294840a76396Smrg    [BASE_]PREFIX[FLAGS]="-v"
294940a76396Smrgelse
295040a76396Smrg    [BASE_]PREFIX[FLAGS]=""
295140a76396Smrgfi
295240a76396Smrg
295340a76396Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
295440a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
295540a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
295640a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
295740a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
295840a76396Smrg
295940a76396SmrgAC_LANG_CASE(
296040a76396Smrg	[C], [
296140a76396Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
296240a76396Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
296340a76396Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
296440a76396Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
296540a76396Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
296640a76396Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
296740a76396Smrg	]
296840a76396Smrg)
296940a76396Smrg
297040a76396Smrg# This chunk adds additional warnings that could catch undesired effects.
297140a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
297240a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
297340a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
297440a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
297540a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
297640a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
297740a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
297840a76396Smrg
297940a76396Smrg# These are currently disabled because they are noisy.  They will be enabled
298040a76396Smrg# in the future once the codebase is sufficiently modernized to silence
298140a76396Smrg# them.  For now, I don't want them to drown out the other warnings.
298240a76396Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
298340a76396Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
298440a76396Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
298540a76396Smrg
298640a76396Smrg# Turn some warnings into errors, so we don't accidently get successful builds
298740a76396Smrg# when there are problems that should be fixed.
298840a76396Smrg
298940a76396Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
299040a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
299140a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
299240a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
299340a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
299440a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
299540a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
299640a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
299740a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
299840a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
299940a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
300040a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
300140a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
300240a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
300340a76396Smrgelse
300440a76396SmrgAC_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])
300540a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
300640a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
300740a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
300840a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
300940a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
301040a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
301140a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
301240a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
301340a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
301440a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
301540a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
301640a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
301740a76396SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
301840a76396Smrgfi
301940a76396Smrg
302040a76396SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
302140a76396Smrg]) # XORG_COMPILER_FLAGS
302240a76396Smrg
30236600fe5bSmrg# XORG_CWARNFLAGS
30246600fe5bSmrg# ---------------
30256600fe5bSmrg# Minimum version: 1.2.0
302640a76396Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30276600fe5bSmrg#
30286600fe5bSmrg# Defines CWARNFLAGS to enable C compiler warnings.
30296600fe5bSmrg#
303040a76396Smrg# This function is deprecated because it defines -fno-strict-aliasing
303140a76396Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
303240a76396Smrg# is needed, then it should be added explicitly in the module when
303340a76396Smrg# it is updated to use BASE_CFLAGS.
303440a76396Smrg#
30356600fe5bSmrgAC_DEFUN([XORG_CWARNFLAGS], [
303640a76396SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3037ff6cf368SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
303840a76396SmrgAC_LANG_CASE(
303940a76396Smrg	[C], [
304040a76396Smrg		CWARNFLAGS="$BASE_CFLAGS"
304140a76396Smrg		if  test "x$GCC" = xyes ; then
304240a76396Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
304340a76396Smrg		fi
304440a76396Smrg		AC_SUBST(CWARNFLAGS)
304540a76396Smrg	]
304640a76396Smrg)
30476600fe5bSmrg]) # XORG_CWARNFLAGS
3048a0195d5fSmrg
30496600fe5bSmrg# XORG_STRICT_OPTION
30506600fe5bSmrg# -----------------------
30516600fe5bSmrg# Minimum version: 1.3.0
3052a0195d5fSmrg#
3053ff6cf368Smrg# Add configure option to enable strict compilation flags, such as treating
3054ff6cf368Smrg# warnings as fatal errors.
3055ff6cf368Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
305640a76396Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3057ff6cf368Smrg#
3058ff6cf368Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3059ff6cf368Smrg# when strict compilation is unconditionally desired.
30606600fe5bSmrgAC_DEFUN([XORG_STRICT_OPTION], [
30616600fe5bSmrgAC_REQUIRE([XORG_CWARNFLAGS])
306240a76396SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30636600fe5bSmrg
30646600fe5bSmrgAC_ARG_ENABLE(strict-compilation,
30656600fe5bSmrg			  AS_HELP_STRING([--enable-strict-compilation],
30666600fe5bSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
30676600fe5bSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
306840a76396Smrg
306940a76396SmrgAC_LANG_CASE(
307040a76396Smrg        [C], [
307140a76396Smrg                define([PREFIX], [C])
307240a76396Smrg        ],
307340a76396Smrg        [C++], [
307440a76396Smrg                define([PREFIX], [CXX])
307540a76396Smrg        ]
307640a76396Smrg)
307740a76396Smrg
307840a76396Smrg[STRICT_]PREFIX[FLAGS]=""
307940a76396SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
308040a76396SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
308140a76396Smrg
308240a76396Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
308340a76396Smrg# activate it with -Werror, so we add it here explicitly.
308440a76396SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
308540a76396Smrg
30866600fe5bSmrgif test "x$STRICT_COMPILE" = "xyes"; then
308740a76396Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
308840a76396Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30896600fe5bSmrgfi
309040a76396SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
309140a76396SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
309240a76396SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
30936600fe5bSmrg]) # XORG_STRICT_OPTION
3094a0195d5fSmrg
30956600fe5bSmrg# XORG_DEFAULT_OPTIONS
30966600fe5bSmrg# --------------------
30976600fe5bSmrg# Minimum version: 1.3.0
3098a0195d5fSmrg#
30996600fe5bSmrg# Defines default options for X.Org modules.
31006600fe5bSmrg#
31016600fe5bSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
31026f5dd5c2SmrgAC_REQUIRE([AC_PROG_INSTALL])
310340a76396SmrgXORG_COMPILER_FLAGS
31046600fe5bSmrgXORG_CWARNFLAGS
31056600fe5bSmrgXORG_STRICT_OPTION
31066600fe5bSmrgXORG_RELEASE_VERSION
31076600fe5bSmrgXORG_CHANGELOG
31086f5dd5c2SmrgXORG_INSTALL
31096600fe5bSmrgXORG_MANPAGE_SECTIONS
31106f5dd5c2Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
31116f5dd5c2Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31126600fe5bSmrg]) # XORG_DEFAULT_OPTIONS
31136f5dd5c2Smrg
31146f5dd5c2Smrg# XORG_INSTALL()
31156f5dd5c2Smrg# ----------------
31166f5dd5c2Smrg# Minimum version: 1.4.0
31176f5dd5c2Smrg#
31186f5dd5c2Smrg# Defines the variable INSTALL_CMD as the command to copy
31196f5dd5c2Smrg# INSTALL from $prefix/share/util-macros.
31206f5dd5c2Smrg#
31216f5dd5c2SmrgAC_DEFUN([XORG_INSTALL], [
31226f5dd5c2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
31236f5dd5c2Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
31246f5dd5c2SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
31256f5dd5c2Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
31266f5dd5c2Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
31276f5dd5c2Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
31286f5dd5c2SmrgAC_SUBST([INSTALL_CMD])
31296f5dd5c2Smrg]) # XORG_INSTALL
31306600fe5bSmrgdnl Copyright 2005 Red Hat, Inc
31316600fe5bSmrgdnl
31326600fe5bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31336600fe5bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
31346600fe5bSmrgdnl the above copyright notice appear in all copies and that both that
31356600fe5bSmrgdnl copyright notice and this permission notice appear in supporting
31366600fe5bSmrgdnl documentation.
31376600fe5bSmrgdnl
31386600fe5bSmrgdnl The above copyright notice and this permission notice shall be included
31396600fe5bSmrgdnl in all copies or substantial portions of the Software.
31406600fe5bSmrgdnl
31416600fe5bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31426600fe5bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31436600fe5bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31446600fe5bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31456600fe5bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31466600fe5bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31476600fe5bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
31486600fe5bSmrgdnl
31496600fe5bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
31506600fe5bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
31516600fe5bSmrgdnl other dealings in this Software without prior written authorization
31526600fe5bSmrgdnl from the copyright holders.
31536600fe5bSmrgdnl
3154a0195d5fSmrg
31556600fe5bSmrg# XORG_RELEASE_VERSION
31566600fe5bSmrg# --------------------
31576f5dd5c2Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31586600fe5bSmrg 
31596600fe5bSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31606600fe5bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31616600fe5bSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31626600fe5bSmrg		[Major version of this package])
31636600fe5bSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31646600fe5bSmrg	if test "x$PVM" = "x"; then
31656600fe5bSmrg		PVM="0"
31666600fe5bSmrg	fi
31676600fe5bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31686600fe5bSmrg		[$PVM],
31696600fe5bSmrg		[Minor version of this package])
31706600fe5bSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31716600fe5bSmrg	if test "x$PVP" = "x"; then
31726600fe5bSmrg		PVP="0"
31736600fe5bSmrg	fi
31746600fe5bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31756600fe5bSmrg		[$PVP],
31766600fe5bSmrg		[Patch version of this package])
31776600fe5bSmrg])
3178a0195d5fSmrg
31796600fe5bSmrg# XORG_CHANGELOG()
31806600fe5bSmrg# ----------------
31816600fe5bSmrg# Minimum version: 1.2.0
31826600fe5bSmrg#
31836600fe5bSmrg# Defines the variable CHANGELOG_CMD as the command to generate
31846600fe5bSmrg# ChangeLog from git.
31856600fe5bSmrg#
31866600fe5bSmrg#
31876600fe5bSmrgAC_DEFUN([XORG_CHANGELOG], [
31886f5dd5c2SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
31896f5dd5c2Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
31906f5dd5c2Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31916600fe5bSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31926600fe5bSmrgAC_SUBST([CHANGELOG_CMD])
31936600fe5bSmrg]) # XORG_CHANGELOG
3194a0195d5fSmrg
3195