aclocal.m4 revision 1c80d5b0
11c80d5b0Smrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
21c80d5b0Smrg
31c80d5b0Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
411d341caSmrg
511d341caSmrg# This file is free software; the Free Software Foundation
611d341caSmrg# gives unlimited permission to copy and/or distribute it,
711d341caSmrg# with or without modifications, as long as this notice is preserved.
811d341caSmrg
911d341caSmrg# This program is distributed in the hope that it will be useful,
1011d341caSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1111d341caSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1211d341caSmrg# PARTICULAR PURPOSE.
1311d341caSmrg
141c80d5b0Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
154c61c93dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
164c61c93dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17d7ffce2aSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18d7ffce2aSmrg[m4_warning([this file was generated for autoconf 2.68.
194c61c93dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
204c61c93dSmrgIf you have problems, you may need to regenerate the build system entirely.
211c80d5b0SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2211d341caSmrg
231c80d5b0Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
2411d341caSmrg#
2511d341caSmrg# This file is free software; the Free Software Foundation
2611d341caSmrg# gives unlimited permission to copy and/or distribute it,
2711d341caSmrg# with or without modifications, as long as this notice is preserved.
2811d341caSmrg
2911d341caSmrg# AM_AUTOMAKE_VERSION(VERSION)
3011d341caSmrg# ----------------------------
3111d341caSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3211d341caSmrg# generated from the m4 files accompanying Automake X.Y.
334c61c93dSmrg# (This private macro should not be called outside this file.)
344c61c93dSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
351c80d5b0Smrg[am__api_version='1.14'
364c61c93dSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
374c61c93dSmrgdnl require some minimum version.  Point them to the right macro.
381c80d5b0Smrgm4_if([$1], [1.14], [],
394c61c93dSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
404c61c93dSmrg])
414c61c93dSmrg
424c61c93dSmrg# _AM_AUTOCONF_VERSION(VERSION)
434c61c93dSmrg# -----------------------------
444c61c93dSmrg# aclocal traces this macro to find the Autoconf version.
454c61c93dSmrg# This is a private macro too.  Using m4_define simplifies
464c61c93dSmrg# the logic in aclocal, which can simply ignore this definition.
474c61c93dSmrgm4_define([_AM_AUTOCONF_VERSION], [])
4811d341caSmrg
4911d341caSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5011d341caSmrg# -------------------------------
514c61c93dSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
524c61c93dSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5311d341caSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
541c80d5b0Smrg[AM_AUTOMAKE_VERSION([1.14])dnl
554c61c93dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
564c61c93dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
574c61c93dSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5811d341caSmrg
5911d341caSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6011d341caSmrg
611c80d5b0Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6211d341caSmrg#
6311d341caSmrg# This file is free software; the Free Software Foundation
6411d341caSmrg# gives unlimited permission to copy and/or distribute it,
6511d341caSmrg# with or without modifications, as long as this notice is preserved.
6611d341caSmrg
6711d341caSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
681c80d5b0Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
691c80d5b0Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7011d341caSmrg#
7111d341caSmrg# Of course, Automake must honor this variable whenever it calls a
7211d341caSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7311d341caSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7411d341caSmrg# depending on how configure is run.  This is pretty annoying, since
7511d341caSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7611d341caSmrg# source directory, any form will work fine, but in subdirectories a
7711d341caSmrg# relative path needs to be adjusted first.
7811d341caSmrg#
7911d341caSmrg# $ac_aux_dir/missing
8011d341caSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8111d341caSmrg# $top_srcdir/$ac_aux_dir/missing
8211d341caSmrg#    fails if $ac_aux_dir is absolute,
8311d341caSmrg#    fails when called from a subdirectory in a VPATH build with
8411d341caSmrg#          a relative $ac_aux_dir
8511d341caSmrg#
8611d341caSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8711d341caSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
881c80d5b0Smrg# harmless because $srcdir is '.', but things will broke when you
8911d341caSmrg# start a VPATH build or use an absolute $srcdir.
9011d341caSmrg#
9111d341caSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9211d341caSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9311d341caSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9411d341caSmrg# and then we would define $MISSING as
9511d341caSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9611d341caSmrg# This will work as long as MISSING is not called from configure, because
9711d341caSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9811d341caSmrg# However there are other variables, like CC, which are often used in
9911d341caSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10011d341caSmrg#
10111d341caSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10211d341caSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10311d341caSmrg# configured tree to be moved without reconfiguration.
10411d341caSmrg
10511d341caSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10611d341caSmrg[dnl Rely on autoconf to set up CDPATH properly.
10711d341caSmrgAC_PREREQ([2.50])dnl
10811d341caSmrg# expand $ac_aux_dir to an absolute path
10911d341caSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
11011d341caSmrg])
11111d341caSmrg
11211d341caSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11311d341caSmrg
1141c80d5b0Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
11511d341caSmrg#
11611d341caSmrg# This file is free software; the Free Software Foundation
11711d341caSmrg# gives unlimited permission to copy and/or distribute it,
11811d341caSmrg# with or without modifications, as long as this notice is preserved.
11911d341caSmrg
12011d341caSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12111d341caSmrg# -------------------------------------
12211d341caSmrg# Define a conditional.
12311d341caSmrgAC_DEFUN([AM_CONDITIONAL],
1241c80d5b0Smrg[AC_PREREQ([2.52])dnl
1251c80d5b0Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1261c80d5b0Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1274c61c93dSmrgAC_SUBST([$1_TRUE])dnl
1284c61c93dSmrgAC_SUBST([$1_FALSE])dnl
1294c61c93dSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1304c61c93dSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1314c61c93dSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13211d341caSmrgif $2; then
13311d341caSmrg  $1_TRUE=
13411d341caSmrg  $1_FALSE='#'
13511d341caSmrgelse
13611d341caSmrg  $1_TRUE='#'
13711d341caSmrg  $1_FALSE=
13811d341caSmrgfi
13911d341caSmrgAC_CONFIG_COMMANDS_PRE(
14011d341caSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14111d341caSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14211d341caSmrgUsually this means the macro was only invoked conditionally.]])
14311d341caSmrgfi])])
14411d341caSmrg
1451c80d5b0Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1464c61c93dSmrg#
1474c61c93dSmrg# This file is free software; the Free Software Foundation
1484c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
1494c61c93dSmrg# with or without modifications, as long as this notice is preserved.
1504c61c93dSmrg
1514c61c93dSmrg
1521c80d5b0Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1534c61c93dSmrg# written in clear, in which case automake, when reading aclocal.m4,
1544c61c93dSmrg# will think it sees a *use*, and therefore will trigger all it's
1554c61c93dSmrg# C support machinery.  Also note that it means that autoscan, seeing
1564c61c93dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15711d341caSmrg
1584c61c93dSmrg
1594c61c93dSmrg# _AM_DEPENDENCIES(NAME)
1604c61c93dSmrg# ----------------------
1614c61c93dSmrg# See how the compiler implements dependency checking.
1621c80d5b0Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1634c61c93dSmrg# We try a few techniques and use that to set a single cache variable.
1644c61c93dSmrg#
1654c61c93dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1664c61c93dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1674c61c93dSmrg# dependency, and given that the user is not expected to run this macro,
1684c61c93dSmrg# just rely on AC_PROG_CC.
1694c61c93dSmrgAC_DEFUN([_AM_DEPENDENCIES],
1704c61c93dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1714c61c93dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1724c61c93dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1734c61c93dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1744c61c93dSmrg
1751c80d5b0Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1761c80d5b0Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1771c80d5b0Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1781c80d5b0Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1791c80d5b0Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1801c80d5b0Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1811c80d5b0Smrg                    [depcc="$$1"   am_compiler_list=])
1824c61c93dSmrg
1834c61c93dSmrgAC_CACHE_CHECK([dependency style of $depcc],
1844c61c93dSmrg               [am_cv_$1_dependencies_compiler_type],
1854c61c93dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1864c61c93dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1874c61c93dSmrg  # making bogus files that we don't know about and never remove.  For
1884c61c93dSmrg  # instance it was reported that on HP-UX the gcc test will end up
1891c80d5b0Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1901c80d5b0Smrg  # in D".
1911c80d5b0Smrg  rm -rf conftest.dir
1924c61c93dSmrg  mkdir conftest.dir
1934c61c93dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1944c61c93dSmrg  # using a relative directory.
1954c61c93dSmrg  cp "$am_depcomp" conftest.dir
1964c61c93dSmrg  cd conftest.dir
1974c61c93dSmrg  # We will build objects and dependencies in a subdirectory because
1984c61c93dSmrg  # it helps to detect inapplicable dependency modes.  For instance
1994c61c93dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2004c61c93dSmrg  # side effect of compilation, but ICC will put the dependencies in
2014c61c93dSmrg  # the current directory while Tru64 will put them in the object
2024c61c93dSmrg  # directory.
2034c61c93dSmrg  mkdir sub
2044c61c93dSmrg
2054c61c93dSmrg  am_cv_$1_dependencies_compiler_type=none
2064c61c93dSmrg  if test "$am_compiler_list" = ""; then
2074c61c93dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2084c61c93dSmrg  fi
2094c61c93dSmrg  am__universal=false
2104c61c93dSmrg  m4_case([$1], [CC],
2114c61c93dSmrg    [case " $depcc " in #(
2124c61c93dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2134c61c93dSmrg     esac],
2144c61c93dSmrg    [CXX],
2154c61c93dSmrg    [case " $depcc " in #(
2164c61c93dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2174c61c93dSmrg     esac])
2184c61c93dSmrg
2194c61c93dSmrg  for depmode in $am_compiler_list; do
2204c61c93dSmrg    # Setup a source with many dependencies, because some compilers
2214c61c93dSmrg    # like to wrap large dependency lists on column 80 (with \), and
2224c61c93dSmrg    # we should not choose a depcomp mode which is confused by this.
2234c61c93dSmrg    #
2244c61c93dSmrg    # We need to recreate these files for each test, as the compiler may
2254c61c93dSmrg    # overwrite some of them when testing with obscure command lines.
2264c61c93dSmrg    # This happens at least with the AIX C compiler.
2274c61c93dSmrg    : > sub/conftest.c
2284c61c93dSmrg    for i in 1 2 3 4 5 6; do
2294c61c93dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2301c80d5b0Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2311c80d5b0Smrg      # Solaris 10 /bin/sh.
2321c80d5b0Smrg      echo '/* dummy */' > sub/conftst$i.h
2334c61c93dSmrg    done
2344c61c93dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2354c61c93dSmrg
2361c80d5b0Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2374c61c93dSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2381c80d5b0Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2391c80d5b0Smrg    # versions had trouble with output in subdirs.
2404c61c93dSmrg    am__obj=sub/conftest.${OBJEXT-o}
2414c61c93dSmrg    am__minus_obj="-o $am__obj"
2424c61c93dSmrg    case $depmode in
2434c61c93dSmrg    gcc)
2444c61c93dSmrg      # This depmode causes a compiler race in universal mode.
2454c61c93dSmrg      test "$am__universal" = false || continue
2464c61c93dSmrg      ;;
2474c61c93dSmrg    nosideeffect)
2481c80d5b0Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2491c80d5b0Smrg      # only be used when explicitly requested.
2504c61c93dSmrg      if test "x$enable_dependency_tracking" = xyes; then
2514c61c93dSmrg	continue
2524c61c93dSmrg      else
2534c61c93dSmrg	break
2544c61c93dSmrg      fi
2554c61c93dSmrg      ;;
2561c80d5b0Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2571c80d5b0Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2584c61c93dSmrg      # not run yet.  These depmodes are late enough in the game, and
2594c61c93dSmrg      # so weak that their functioning should not be impacted.
2604c61c93dSmrg      am__obj=conftest.${OBJEXT-o}
2614c61c93dSmrg      am__minus_obj=
2624c61c93dSmrg      ;;
2634c61c93dSmrg    none) break ;;
2644c61c93dSmrg    esac
2654c61c93dSmrg    if depmode=$depmode \
2664c61c93dSmrg       source=sub/conftest.c object=$am__obj \
2674c61c93dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2684c61c93dSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2694c61c93dSmrg         >/dev/null 2>conftest.err &&
2704c61c93dSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2714c61c93dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2724c61c93dSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2734c61c93dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2744c61c93dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2754c61c93dSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2764c61c93dSmrg      # that says an option was ignored or not supported.
2774c61c93dSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2784c61c93dSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2794c61c93dSmrg      # The diagnosis changed in icc 8.0:
2804c61c93dSmrg      #   icc: Command line remark: option '-MP' not supported
2814c61c93dSmrg      if (grep 'ignoring option' conftest.err ||
2824c61c93dSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2834c61c93dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2844c61c93dSmrg        break
2854c61c93dSmrg      fi
2864c61c93dSmrg    fi
2874c61c93dSmrg  done
2884c61c93dSmrg
2894c61c93dSmrg  cd ..
2904c61c93dSmrg  rm -rf conftest.dir
2914c61c93dSmrgelse
2924c61c93dSmrg  am_cv_$1_dependencies_compiler_type=none
2934c61c93dSmrgfi
2944c61c93dSmrg])
2954c61c93dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2964c61c93dSmrgAM_CONDITIONAL([am__fastdep$1], [
2974c61c93dSmrg  test "x$enable_dependency_tracking" != xno \
2984c61c93dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2994c61c93dSmrg])
3004c61c93dSmrg
3014c61c93dSmrg
3024c61c93dSmrg# AM_SET_DEPDIR
3034c61c93dSmrg# -------------
3044c61c93dSmrg# Choose a directory name for dependency files.
3051c80d5b0Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3064c61c93dSmrgAC_DEFUN([AM_SET_DEPDIR],
3074c61c93dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3084c61c93dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3094c61c93dSmrg])
3104c61c93dSmrg
3114c61c93dSmrg
3124c61c93dSmrg# AM_DEP_TRACK
3134c61c93dSmrg# ------------
3144c61c93dSmrgAC_DEFUN([AM_DEP_TRACK],
3151c80d5b0Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3161c80d5b0SmrgAS_HELP_STRING(
3171c80d5b0Smrg  [--enable-dependency-tracking],
3181c80d5b0Smrg  [do not reject slow dependency extractors])
3191c80d5b0SmrgAS_HELP_STRING(
3201c80d5b0Smrg  [--disable-dependency-tracking],
3211c80d5b0Smrg  [speeds up one-time build])])
3224c61c93dSmrgif test "x$enable_dependency_tracking" != xno; then
3234c61c93dSmrg  am_depcomp="$ac_aux_dir/depcomp"
3244c61c93dSmrg  AMDEPBACKSLASH='\'
3251c80d5b0Smrg  am__nodep='_no'
3264c61c93dSmrgfi
3274c61c93dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3284c61c93dSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3294c61c93dSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3301c80d5b0SmrgAC_SUBST([am__nodep])dnl
3311c80d5b0Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3324c61c93dSmrg])
3334c61c93dSmrg
3344c61c93dSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3354c61c93dSmrg
3361c80d5b0Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
33711d341caSmrg#
33811d341caSmrg# This file is free software; the Free Software Foundation
33911d341caSmrg# gives unlimited permission to copy and/or distribute it,
34011d341caSmrg# with or without modifications, as long as this notice is preserved.
34111d341caSmrg
3424c61c93dSmrg
3434c61c93dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3444c61c93dSmrg# ------------------------------
3454c61c93dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3464c61c93dSmrg[{
3471c80d5b0Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3484c61c93dSmrg  # are listed without --file.  Let's play safe and only enable the eval
3494c61c93dSmrg  # if we detect the quoting.
3504c61c93dSmrg  case $CONFIG_FILES in
3514c61c93dSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3524c61c93dSmrg  *)   set x $CONFIG_FILES ;;
3534c61c93dSmrg  esac
3544c61c93dSmrg  shift
3554c61c93dSmrg  for mf
3564c61c93dSmrg  do
3574c61c93dSmrg    # Strip MF so we end up with the name of the file.
3584c61c93dSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3594c61c93dSmrg    # Check whether this is an Automake generated Makefile or not.
3601c80d5b0Smrg    # We used to match only the files named 'Makefile.in', but
3614c61c93dSmrg    # some people rename them; so instead we look at the file content.
3624c61c93dSmrg    # Grep'ing the first line is not enough: some people post-process
3634c61c93dSmrg    # each Makefile.in and add a new line on top of each file to say so.
3644c61c93dSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3654c61c93dSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3664c61c93dSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3674c61c93dSmrg      dirpart=`AS_DIRNAME("$mf")`
3684c61c93dSmrg    else
3694c61c93dSmrg      continue
3704c61c93dSmrg    fi
3714c61c93dSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3721c80d5b0Smrg    # from the Makefile without running 'make'.
3734c61c93dSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3744c61c93dSmrg    test -z "$DEPDIR" && continue
3754c61c93dSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3761c80d5b0Smrg    test -z "$am__include" && continue
3774c61c93dSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3784c61c93dSmrg    # Find all dependency output files, they are included files with
3794c61c93dSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3804c61c93dSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3814c61c93dSmrg    # expansion.
3824c61c93dSmrg    for file in `sed -n "
3834c61c93dSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3841c80d5b0Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3854c61c93dSmrg      # Make sure the directory exists.
3864c61c93dSmrg      test -f "$dirpart/$file" && continue
3874c61c93dSmrg      fdir=`AS_DIRNAME(["$file"])`
3884c61c93dSmrg      AS_MKDIR_P([$dirpart/$fdir])
3894c61c93dSmrg      # echo "creating $dirpart/$file"
3904c61c93dSmrg      echo '# dummy' > "$dirpart/$file"
3914c61c93dSmrg    done
3924c61c93dSmrg  done
3934c61c93dSmrg}
3944c61c93dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3954c61c93dSmrg
3964c61c93dSmrg
3974c61c93dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3984c61c93dSmrg# -----------------------------
3994c61c93dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
4004c61c93dSmrg#
4014c61c93dSmrg# This code is only required when automatic dependency tracking
4021c80d5b0Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
4034c61c93dSmrg# need in order to bootstrap the dependency handling code.
4044c61c93dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4054c61c93dSmrg[AC_CONFIG_COMMANDS([depfiles],
4064c61c93dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4074c61c93dSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4084c61c93dSmrg])
4094c61c93dSmrg
4104c61c93dSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4114c61c93dSmrg
4121c80d5b0Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4134c61c93dSmrg#
4144c61c93dSmrg# This file is free software; the Free Software Foundation
4154c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
4164c61c93dSmrg# with or without modifications, as long as this notice is preserved.
4174c61c93dSmrg
41811d341caSmrg# This macro actually does too much.  Some checks are only needed if
41911d341caSmrg# your package does certain things.  But this isn't really a big deal.
42011d341caSmrg
4211c80d5b0Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4221c80d5b0Smrgm4_define([AC_PROG_CC],
4231c80d5b0Smrgm4_defn([AC_PROG_CC])
4241c80d5b0Smrg[_AM_PROG_CC_C_O
4251c80d5b0Smrg])
4261c80d5b0Smrg
42711d341caSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42811d341caSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42911d341caSmrg# -----------------------------------------------
43011d341caSmrg# The call with PACKAGE and VERSION arguments is the old style
43111d341caSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
43211d341caSmrg# and VERSION should now be passed to AC_INIT and removed from
43311d341caSmrg# the call to AM_INIT_AUTOMAKE.
43411d341caSmrg# We support both call styles for the transition.  After
43511d341caSmrg# the next Automake release, Autoconf can make the AC_INIT
43611d341caSmrg# arguments mandatory, and then we can depend on a new Autoconf
43711d341caSmrg# release and drop the old call support.
43811d341caSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4391c80d5b0Smrg[AC_PREREQ([2.65])dnl
44011d341caSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44111d341caSmrgdnl the ones we care about.
44211d341caSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44311d341caSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44411d341caSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4454c61c93dSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4464c61c93dSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4474c61c93dSmrg  # is not polluted with repeated "-I."
4484c61c93dSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4494c61c93dSmrg  # test to see if srcdir already configured
4504c61c93dSmrg  if test -f $srcdir/config.status; then
4514c61c93dSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4524c61c93dSmrg  fi
45311d341caSmrgfi
45411d341caSmrg
45511d341caSmrg# test whether we have cygpath
45611d341caSmrgif test -z "$CYGPATH_W"; then
45711d341caSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45811d341caSmrg    CYGPATH_W='cygpath -w'
45911d341caSmrg  else
46011d341caSmrg    CYGPATH_W=echo
46111d341caSmrg  fi
46211d341caSmrgfi
46311d341caSmrgAC_SUBST([CYGPATH_W])
46411d341caSmrg
46511d341caSmrg# Define the identity of the package.
46611d341caSmrgdnl Distinguish between old-style and new-style calls.
46711d341caSmrgm4_ifval([$2],
4681c80d5b0Smrg[AC_DIAGNOSE([obsolete],
4691c80d5b0Smrg             [$0: two- and three-arguments forms are deprecated.])
4701c80d5b0Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47111d341caSmrg AC_SUBST([PACKAGE], [$1])dnl
47211d341caSmrg AC_SUBST([VERSION], [$2])],
47311d341caSmrg[_AM_SET_OPTIONS([$1])dnl
4744c61c93dSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4751c80d5b0Smrgm4_if(
4761c80d5b0Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4771c80d5b0Smrg  [ok:ok],,
4784c61c93dSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47911d341caSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
48011d341caSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
48111d341caSmrg
48211d341caSmrg_AM_IF_OPTION([no-define],,
4831c80d5b0Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4841c80d5b0Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48511d341caSmrg
48611d341caSmrg# Some tools Automake needs.
48711d341caSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48811d341caSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4891c80d5b0SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4901c80d5b0SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4911c80d5b0SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4921c80d5b0SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4931c80d5b0SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4944c61c93dSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4954c61c93dSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4961c80d5b0SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4971c80d5b0Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4981c80d5b0Smrg# dies out for good.  For more background, see:
4991c80d5b0Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
5001c80d5b0Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5011c80d5b0SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
50211d341caSmrg# We need awk for the "check" target.  The system "awk" is bad on
50311d341caSmrg# some platforms.
50411d341caSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50511d341caSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50611d341caSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50711d341caSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5084c61c93dSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5094c61c93dSmrg			     [_AM_PROG_TAR([v7])])])
51011d341caSmrg_AM_IF_OPTION([no-dependencies],,
51111d341caSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5121c80d5b0Smrg		  [_AM_DEPENDENCIES([CC])],
5131c80d5b0Smrg		  [m4_define([AC_PROG_CC],
5141c80d5b0Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51511d341caSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5161c80d5b0Smrg		  [_AM_DEPENDENCIES([CXX])],
5171c80d5b0Smrg		  [m4_define([AC_PROG_CXX],
5181c80d5b0Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5194c61c93dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5201c80d5b0Smrg		  [_AM_DEPENDENCIES([OBJC])],
5211c80d5b0Smrg		  [m4_define([AC_PROG_OBJC],
5221c80d5b0Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5231c80d5b0SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5241c80d5b0Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5251c80d5b0Smrg		  [m4_define([AC_PROG_OBJCXX],
5261c80d5b0Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52711d341caSmrg])
5281c80d5b0SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5291c80d5b0Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5301c80d5b0Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5311c80d5b0Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5324c61c93dSmrgAC_CONFIG_COMMANDS_PRE(dnl
5334c61c93dSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5344c61c93dSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
53511d341caSmrg
5361c80d5b0Smrg# POSIX will say in a future version that running "rm -f" with no argument
5371c80d5b0Smrg# is OK; and we want to be able to make that assumption in our Makefile
5381c80d5b0Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5391c80d5b0Smrg# actually supported "in the wild" to an acceptable degree.
5401c80d5b0Smrg# See automake bug#10828.
5411c80d5b0Smrg# To make any issue more visible, cause the running configure to be aborted
5421c80d5b0Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5431c80d5b0Smrg# user can still override this though.
5441c80d5b0Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5451c80d5b0Smrg  cat >&2 <<'END'
5461c80d5b0SmrgOops!
5471c80d5b0Smrg
5481c80d5b0SmrgYour 'rm' program seems unable to run without file operands specified
5491c80d5b0Smrgon the command line, even when the '-f' option is present.  This is contrary
5501c80d5b0Smrgto the behaviour of most rm programs out there, and not conforming with
5511c80d5b0Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5521c80d5b0Smrg
5531c80d5b0SmrgPlease tell bug-automake@gnu.org about your system, including the value
5541c80d5b0Smrgof your $PATH and any error possibly output before this message.  This
5551c80d5b0Smrgcan help us improve future automake versions.
5561c80d5b0Smrg
5571c80d5b0SmrgEND
5581c80d5b0Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5591c80d5b0Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5601c80d5b0Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5611c80d5b0Smrg    echo >&2
5621c80d5b0Smrg  else
5631c80d5b0Smrg    cat >&2 <<'END'
5641c80d5b0SmrgAborting the configuration process, to ensure you take notice of the issue.
5651c80d5b0Smrg
5661c80d5b0SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5671c80d5b0Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5681c80d5b0Smrg
5691c80d5b0SmrgIf you want to complete the configuration process using your problematic
5701c80d5b0Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5711c80d5b0Smrgto "yes", and re-run configure.
5721c80d5b0Smrg
5731c80d5b0SmrgEND
5741c80d5b0Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5751c80d5b0Smrg  fi
5761c80d5b0Smrgfi])
5771c80d5b0Smrg
5781c80d5b0Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5794c61c93dSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5804c61c93dSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5814c61c93dSmrgm4_define([_AC_COMPILER_EXEEXT],
5824c61c93dSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5834c61c93dSmrg
58411d341caSmrg# When config.status generates a header, we must update the stamp-h file.
58511d341caSmrg# This file resides in the same directory as the config header
58611d341caSmrg# that is generated.  The stamp files are numbered to have different names.
58711d341caSmrg
58811d341caSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
58911d341caSmrg# loop where config.status creates the headers, so we can generate
59011d341caSmrg# our stamp files there.
59111d341caSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
59211d341caSmrg[# Compute $1's index in $config_headers.
5934c61c93dSmrg_am_arg=$1
59411d341caSmrg_am_stamp_count=1
59511d341caSmrgfor _am_header in $config_headers :; do
59611d341caSmrg  case $_am_header in
5974c61c93dSmrg    $_am_arg | $_am_arg:* )
59811d341caSmrg      break ;;
59911d341caSmrg    * )
60011d341caSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
60111d341caSmrg  esac
60211d341caSmrgdone
6034c61c93dSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
60411d341caSmrg
6051c80d5b0Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
60611d341caSmrg#
60711d341caSmrg# This file is free software; the Free Software Foundation
60811d341caSmrg# gives unlimited permission to copy and/or distribute it,
60911d341caSmrg# with or without modifications, as long as this notice is preserved.
61011d341caSmrg
61111d341caSmrg# AM_PROG_INSTALL_SH
61211d341caSmrg# ------------------
61311d341caSmrg# Define $install_sh.
61411d341caSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
61511d341caSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6164c61c93dSmrgif test x"${install_sh}" != xset; then
6174c61c93dSmrg  case $am_aux_dir in
6184c61c93dSmrg  *\ * | *\	*)
6194c61c93dSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6204c61c93dSmrg  *)
6214c61c93dSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6224c61c93dSmrg  esac
6234c61c93dSmrgfi
6241c80d5b0SmrgAC_SUBST([install_sh])])
62511d341caSmrg
6261c80d5b0Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
62711d341caSmrg#
62811d341caSmrg# This file is free software; the Free Software Foundation
62911d341caSmrg# gives unlimited permission to copy and/or distribute it,
63011d341caSmrg# with or without modifications, as long as this notice is preserved.
63111d341caSmrg
63211d341caSmrg# Check whether the underlying file-system supports filenames
63311d341caSmrg# with a leading dot.  For instance MS-DOS doesn't.
63411d341caSmrgAC_DEFUN([AM_SET_LEADING_DOT],
63511d341caSmrg[rm -rf .tst 2>/dev/null
63611d341caSmrgmkdir .tst 2>/dev/null
63711d341caSmrgif test -d .tst; then
63811d341caSmrg  am__leading_dot=.
63911d341caSmrgelse
64011d341caSmrg  am__leading_dot=_
64111d341caSmrgfi
64211d341caSmrgrmdir .tst 2>/dev/null
64311d341caSmrgAC_SUBST([am__leading_dot])])
64411d341caSmrg
64511d341caSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
64611d341caSmrg# From Jim Meyering
64711d341caSmrg
6481c80d5b0Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
64911d341caSmrg#
65011d341caSmrg# This file is free software; the Free Software Foundation
65111d341caSmrg# gives unlimited permission to copy and/or distribute it,
65211d341caSmrg# with or without modifications, as long as this notice is preserved.
65311d341caSmrg
6544c61c93dSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6554c61c93dSmrg# ----------------------------------
6564c61c93dSmrg# Control maintainer-specific portions of Makefiles.
6571c80d5b0Smrg# Default is to disable them, unless 'enable' is passed literally.
6581c80d5b0Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
6594c61c93dSmrg# can override the default with the --enable/--disable switch.
66011d341caSmrgAC_DEFUN([AM_MAINTAINER_MODE],
6614c61c93dSmrg[m4_case(m4_default([$1], [disable]),
6624c61c93dSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
6634c61c93dSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
6644c61c93dSmrg       [m4_define([am_maintainer_other], [enable])
6654c61c93dSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6661c80d5b0SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6674c61c93dSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6684c61c93dSmrg  AC_ARG_ENABLE([maintainer-mode],
6691c80d5b0Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
6701c80d5b0Smrg      am_maintainer_other[ make rules and dependencies not useful
6711c80d5b0Smrg      (and sometimes confusing) to the casual installer])],
6721c80d5b0Smrg    [USE_MAINTAINER_MODE=$enableval],
6731c80d5b0Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
67411d341caSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6754c61c93dSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
67611d341caSmrg  MAINT=$MAINTAINER_MODE_TRUE
6774c61c93dSmrg  AC_SUBST([MAINT])dnl
67811d341caSmrg]
67911d341caSmrg)
68011d341caSmrg
6814c61c93dSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6824c61c93dSmrg
6831c80d5b0Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6844c61c93dSmrg#
6854c61c93dSmrg# This file is free software; the Free Software Foundation
6864c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
6874c61c93dSmrg# with or without modifications, as long as this notice is preserved.
6884c61c93dSmrg
6894c61c93dSmrg# AM_MAKE_INCLUDE()
6904c61c93dSmrg# -----------------
6914c61c93dSmrg# Check to see how make treats includes.
6924c61c93dSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6934c61c93dSmrg[am_make=${MAKE-make}
6944c61c93dSmrgcat > confinc << 'END'
6954c61c93dSmrgam__doit:
6964c61c93dSmrg	@echo this is the am__doit target
6974c61c93dSmrg.PHONY: am__doit
6984c61c93dSmrgEND
6994c61c93dSmrg# If we don't find an include directive, just comment out the code.
7004c61c93dSmrgAC_MSG_CHECKING([for style of include used by $am_make])
7014c61c93dSmrgam__include="#"
7024c61c93dSmrgam__quote=
7034c61c93dSmrg_am_result=none
7044c61c93dSmrg# First try GNU make style include.
7054c61c93dSmrgecho "include confinc" > confmf
7061c80d5b0Smrg# Ignore all kinds of additional output from 'make'.
7074c61c93dSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
7084c61c93dSmrg*the\ am__doit\ target*)
7094c61c93dSmrg  am__include=include
7104c61c93dSmrg  am__quote=
7114c61c93dSmrg  _am_result=GNU
7124c61c93dSmrg  ;;
7134c61c93dSmrgesac
7144c61c93dSmrg# Now try BSD make style include.
7154c61c93dSmrgif test "$am__include" = "#"; then
7164c61c93dSmrg   echo '.include "confinc"' > confmf
7174c61c93dSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
7184c61c93dSmrg   *the\ am__doit\ target*)
7194c61c93dSmrg     am__include=.include
7204c61c93dSmrg     am__quote="\""
7214c61c93dSmrg     _am_result=BSD
7224c61c93dSmrg     ;;
7234c61c93dSmrg   esac
7244c61c93dSmrgfi
7254c61c93dSmrgAC_SUBST([am__include])
7264c61c93dSmrgAC_SUBST([am__quote])
7274c61c93dSmrgAC_MSG_RESULT([$_am_result])
7284c61c93dSmrgrm -f confinc confmf
7294c61c93dSmrg])
7304c61c93dSmrg
73111d341caSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
73211d341caSmrg
7331c80d5b0Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
73411d341caSmrg#
73511d341caSmrg# This file is free software; the Free Software Foundation
73611d341caSmrg# gives unlimited permission to copy and/or distribute it,
73711d341caSmrg# with or without modifications, as long as this notice is preserved.
73811d341caSmrg
73911d341caSmrg# AM_MISSING_PROG(NAME, PROGRAM)
74011d341caSmrg# ------------------------------
74111d341caSmrgAC_DEFUN([AM_MISSING_PROG],
74211d341caSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
74311d341caSmrg$1=${$1-"${am_missing_run}$2"}
74411d341caSmrgAC_SUBST($1)])
74511d341caSmrg
74611d341caSmrg# AM_MISSING_HAS_RUN
74711d341caSmrg# ------------------
7481c80d5b0Smrg# Define MISSING if not defined so far and test if it is modern enough.
7491c80d5b0Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
75011d341caSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
75111d341caSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7524c61c93dSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7534c61c93dSmrgif test x"${MISSING+set}" != xset; then
7544c61c93dSmrg  case $am_aux_dir in
7554c61c93dSmrg  *\ * | *\	*)
7564c61c93dSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7574c61c93dSmrg  *)
7584c61c93dSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7594c61c93dSmrg  esac
7604c61c93dSmrgfi
76111d341caSmrg# Use eval to expand $SHELL
7621c80d5b0Smrgif eval "$MISSING --is-lightweight"; then
7631c80d5b0Smrg  am_missing_run="$MISSING "
76411d341caSmrgelse
76511d341caSmrg  am_missing_run=
7661c80d5b0Smrg  AC_MSG_WARN(['missing' script is too old or missing])
76711d341caSmrgfi
76811d341caSmrg])
76911d341caSmrg
77011d341caSmrg# Helper functions for option handling.                     -*- Autoconf -*-
77111d341caSmrg
7721c80d5b0Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
77311d341caSmrg#
77411d341caSmrg# This file is free software; the Free Software Foundation
77511d341caSmrg# gives unlimited permission to copy and/or distribute it,
77611d341caSmrg# with or without modifications, as long as this notice is preserved.
77711d341caSmrg
77811d341caSmrg# _AM_MANGLE_OPTION(NAME)
77911d341caSmrg# -----------------------
78011d341caSmrgAC_DEFUN([_AM_MANGLE_OPTION],
78111d341caSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
78211d341caSmrg
78311d341caSmrg# _AM_SET_OPTION(NAME)
7841c80d5b0Smrg# --------------------
78511d341caSmrg# Set option NAME.  Presently that only means defining a flag for this option.
78611d341caSmrgAC_DEFUN([_AM_SET_OPTION],
7871c80d5b0Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
78811d341caSmrg
78911d341caSmrg# _AM_SET_OPTIONS(OPTIONS)
7901c80d5b0Smrg# ------------------------
79111d341caSmrg# OPTIONS is a space-separated list of Automake options.
79211d341caSmrgAC_DEFUN([_AM_SET_OPTIONS],
7934c61c93dSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
79411d341caSmrg
79511d341caSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
79611d341caSmrg# -------------------------------------------
79711d341caSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
79811d341caSmrgAC_DEFUN([_AM_IF_OPTION],
79911d341caSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
80011d341caSmrg
8011c80d5b0Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
8021c80d5b0Smrg#
8031c80d5b0Smrg# This file is free software; the Free Software Foundation
8041c80d5b0Smrg# gives unlimited permission to copy and/or distribute it,
8051c80d5b0Smrg# with or without modifications, as long as this notice is preserved.
8061c80d5b0Smrg
8071c80d5b0Smrg# _AM_PROG_CC_C_O
8081c80d5b0Smrg# ---------------
8091c80d5b0Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
8101c80d5b0Smrg# to automatically call this.
8111c80d5b0SmrgAC_DEFUN([_AM_PROG_CC_C_O],
8121c80d5b0Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
8131c80d5b0SmrgAC_REQUIRE_AUX_FILE([compile])dnl
8141c80d5b0SmrgAC_LANG_PUSH([C])dnl
8151c80d5b0SmrgAC_CACHE_CHECK(
8161c80d5b0Smrg  [whether $CC understands -c and -o together],
8171c80d5b0Smrg  [am_cv_prog_cc_c_o],
8181c80d5b0Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
8191c80d5b0Smrg  # Make sure it works both with $CC and with simple cc.
8201c80d5b0Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
8211c80d5b0Smrg  # compilers refuse to overwrite an existing .o file with -o,
8221c80d5b0Smrg  # though they will create one.
8231c80d5b0Smrg  am_cv_prog_cc_c_o=yes
8241c80d5b0Smrg  for am_i in 1 2; do
8251c80d5b0Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
8261c80d5b0Smrg         && test -f conftest2.$ac_objext; then
8271c80d5b0Smrg      : OK
8281c80d5b0Smrg    else
8291c80d5b0Smrg      am_cv_prog_cc_c_o=no
8301c80d5b0Smrg      break
8311c80d5b0Smrg    fi
8321c80d5b0Smrg  done
8331c80d5b0Smrg  rm -f core conftest*
8341c80d5b0Smrg  unset am_i])
8351c80d5b0Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8361c80d5b0Smrg   # Losing compiler, so override with the script.
8371c80d5b0Smrg   # FIXME: It is wrong to rewrite CC.
8381c80d5b0Smrg   # But if we don't then we get into trouble of one sort or another.
8391c80d5b0Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8401c80d5b0Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8411c80d5b0Smrg   CC="$am_aux_dir/compile $CC"
8421c80d5b0Smrgfi
8431c80d5b0SmrgAC_LANG_POP([C])])
84411d341caSmrg
8451c80d5b0Smrg# For backward compatibility.
8461c80d5b0SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8471c80d5b0Smrg
8481c80d5b0Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
84911d341caSmrg#
85011d341caSmrg# This file is free software; the Free Software Foundation
85111d341caSmrg# gives unlimited permission to copy and/or distribute it,
85211d341caSmrg# with or without modifications, as long as this notice is preserved.
85311d341caSmrg
8541c80d5b0Smrg# AM_RUN_LOG(COMMAND)
8551c80d5b0Smrg# -------------------
8561c80d5b0Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8571c80d5b0Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8581c80d5b0SmrgAC_DEFUN([AM_RUN_LOG],
8591c80d5b0Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8601c80d5b0Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8611c80d5b0Smrg   ac_status=$?
8621c80d5b0Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8631c80d5b0Smrg   (exit $ac_status); }])
8641c80d5b0Smrg
8651c80d5b0Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8661c80d5b0Smrg
8671c80d5b0Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
8681c80d5b0Smrg#
8691c80d5b0Smrg# This file is free software; the Free Software Foundation
8701c80d5b0Smrg# gives unlimited permission to copy and/or distribute it,
8711c80d5b0Smrg# with or without modifications, as long as this notice is preserved.
87211d341caSmrg
87311d341caSmrg# AM_SANITY_CHECK
87411d341caSmrg# ---------------
87511d341caSmrgAC_DEFUN([AM_SANITY_CHECK],
87611d341caSmrg[AC_MSG_CHECKING([whether build environment is sane])
8774c61c93dSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8784c61c93dSmrg# name.  Accept space and tab only in the latter.
8794c61c93dSmrgam_lf='
8804c61c93dSmrg'
8814c61c93dSmrgcase `pwd` in
8824c61c93dSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8834c61c93dSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8844c61c93dSmrgesac
8854c61c93dSmrgcase $srcdir in
8864c61c93dSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8871c80d5b0Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8884c61c93dSmrgesac
8894c61c93dSmrg
8901c80d5b0Smrg# Do 'set' in a subshell so we don't clobber the current shell's
89111d341caSmrg# arguments.  Must try -L first in case configure is actually a
89211d341caSmrg# symlink; some systems play weird games with the mod time of symlinks
89311d341caSmrg# (eg FreeBSD returns the mod time of the symlink's containing
89411d341caSmrg# directory).
89511d341caSmrgif (
8961c80d5b0Smrg   am_has_slept=no
8971c80d5b0Smrg   for am_try in 1 2; do
8981c80d5b0Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8991c80d5b0Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9001c80d5b0Smrg     if test "$[*]" = "X"; then
9011c80d5b0Smrg	# -L didn't work.
9021c80d5b0Smrg	set X `ls -t "$srcdir/configure" conftest.file`
9031c80d5b0Smrg     fi
9041c80d5b0Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
9051c80d5b0Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
9061c80d5b0Smrg
9071c80d5b0Smrg	# If neither matched, then we have a broken ls.  This can happen
9081c80d5b0Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
9091c80d5b0Smrg	# broken ls alias from the environment.  This has actually
9101c80d5b0Smrg	# happened.  Such a system could not be considered "sane".
9111c80d5b0Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
9121c80d5b0Smrg  alias in your environment])
9131c80d5b0Smrg     fi
9141c80d5b0Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
9151c80d5b0Smrg       break
9161c80d5b0Smrg     fi
9171c80d5b0Smrg     # Just in case.
9181c80d5b0Smrg     sleep 1
9191c80d5b0Smrg     am_has_slept=yes
9201c80d5b0Smrg   done
92111d341caSmrg   test "$[2]" = conftest.file
92211d341caSmrg   )
92311d341caSmrgthen
92411d341caSmrg   # Ok.
92511d341caSmrg   :
92611d341caSmrgelse
92711d341caSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
92811d341caSmrgCheck your system clock])
92911d341caSmrgfi
9301c80d5b0SmrgAC_MSG_RESULT([yes])
9311c80d5b0Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
9321c80d5b0Smrg# generated files are strictly newer.
9331c80d5b0Smrgam_sleep_pid=
9341c80d5b0Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9351c80d5b0Smrg  ( sleep 1 ) &
9361c80d5b0Smrg  am_sleep_pid=$!
9371c80d5b0Smrgfi
9381c80d5b0SmrgAC_CONFIG_COMMANDS_PRE(
9391c80d5b0Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9401c80d5b0Smrg   if test -n "$am_sleep_pid"; then
9411c80d5b0Smrg     # Hide warnings about reused PIDs.
9421c80d5b0Smrg     wait $am_sleep_pid 2>/dev/null
9431c80d5b0Smrg   fi
9441c80d5b0Smrg   AC_MSG_RESULT([done])])
9451c80d5b0Smrgrm -f conftest.file
9461c80d5b0Smrg])
94711d341caSmrg
9481c80d5b0Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
9494c61c93dSmrg#
9504c61c93dSmrg# This file is free software; the Free Software Foundation
9514c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
9524c61c93dSmrg# with or without modifications, as long as this notice is preserved.
9534c61c93dSmrg
9544c61c93dSmrg# AM_SILENT_RULES([DEFAULT])
9554c61c93dSmrg# --------------------------
9564c61c93dSmrg# Enable less verbose build rules; with the default set to DEFAULT
9571c80d5b0Smrg# ("yes" being less verbose, "no" or empty being verbose).
9584c61c93dSmrgAC_DEFUN([AM_SILENT_RULES],
9591c80d5b0Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9601c80d5b0SmrgAS_HELP_STRING(
9611c80d5b0Smrg  [--enable-silent-rules],
9621c80d5b0Smrg  [less verbose build output (undo: "make V=1")])
9631c80d5b0SmrgAS_HELP_STRING(
9641c80d5b0Smrg  [--disable-silent-rules],
9651c80d5b0Smrg  [verbose build output (undo: "make V=0")])dnl
9661c80d5b0Smrg])
9671c80d5b0Smrgcase $enable_silent_rules in @%:@ (((
9681c80d5b0Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9691c80d5b0Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9701c80d5b0Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9714c61c93dSmrgesac
9721c80d5b0Smrgdnl
9731c80d5b0Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9741c80d5b0Smrgdnl do not support nested variable expansions.
9751c80d5b0Smrgdnl See automake bug#9928 and bug#10237.
9761c80d5b0Smrgam_make=${MAKE-make}
9771c80d5b0SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9781c80d5b0Smrg   [am_cv_make_support_nested_variables],
9791c80d5b0Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9801c80d5b0SmrgBAR0=false
9811c80d5b0SmrgBAR1=true
9821c80d5b0SmrgV=1
9831c80d5b0Smrgam__doit:
9841c80d5b0Smrg	@$(TRUE)
9851c80d5b0Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9861c80d5b0Smrg  am_cv_make_support_nested_variables=yes
9871c80d5b0Smrgelse
9881c80d5b0Smrg  am_cv_make_support_nested_variables=no
9891c80d5b0Smrgfi])
9901c80d5b0Smrgif test $am_cv_make_support_nested_variables = yes; then
9911c80d5b0Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9921c80d5b0Smrg  AM_V='$(V)'
9931c80d5b0Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9941c80d5b0Smrgelse
9951c80d5b0Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9961c80d5b0Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9971c80d5b0Smrgfi
9981c80d5b0SmrgAC_SUBST([AM_V])dnl
9991c80d5b0SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10001c80d5b0SmrgAC_SUBST([AM_DEFAULT_V])dnl
10011c80d5b0SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10024c61c93dSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10034c61c93dSmrgAM_BACKSLASH='\'
10044c61c93dSmrgAC_SUBST([AM_BACKSLASH])dnl
10054c61c93dSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10064c61c93dSmrg])
10074c61c93dSmrg
10081c80d5b0Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
100911d341caSmrg#
101011d341caSmrg# This file is free software; the Free Software Foundation
101111d341caSmrg# gives unlimited permission to copy and/or distribute it,
101211d341caSmrg# with or without modifications, as long as this notice is preserved.
101311d341caSmrg
101411d341caSmrg# AM_PROG_INSTALL_STRIP
101511d341caSmrg# ---------------------
10161c80d5b0Smrg# One issue with vendor 'install' (even GNU) is that you can't
101711d341caSmrg# specify the program used to strip binaries.  This is especially
101811d341caSmrg# annoying in cross-compiling environments, where the build's strip
101911d341caSmrg# is unlikely to handle the host's binaries.
102011d341caSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
10211c80d5b0Smrg# always use install-sh in "make install-strip", and initialize
102211d341caSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
102311d341caSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
102411d341caSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
10251c80d5b0Smrg# Installed binaries are usually stripped using 'strip' when the user
10261c80d5b0Smrg# run "make install-strip".  However 'strip' might not be the right
102711d341caSmrg# tool to use in cross-compilation environments, therefore Automake
10281c80d5b0Smrg# will honor the 'STRIP' environment variable to overrule this program.
10291c80d5b0Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
103011d341caSmrgif test "$cross_compiling" != no; then
103111d341caSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
103211d341caSmrgfi
10334c61c93dSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
103411d341caSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
103511d341caSmrg
10361c80d5b0Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
10374c61c93dSmrg#
10384c61c93dSmrg# This file is free software; the Free Software Foundation
10394c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
10404c61c93dSmrg# with or without modifications, as long as this notice is preserved.
10414c61c93dSmrg
10424c61c93dSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10434c61c93dSmrg# ---------------------------
10444c61c93dSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10454c61c93dSmrg# This macro is traced by Automake.
10464c61c93dSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10474c61c93dSmrg
10484c61c93dSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10491c80d5b0Smrg# --------------------------
10504c61c93dSmrg# Public sister of _AM_SUBST_NOTMAKE.
10514c61c93dSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10524c61c93dSmrg
105311d341caSmrg# Check how to create a tarball.                            -*- Autoconf -*-
105411d341caSmrg
10551c80d5b0Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
105611d341caSmrg#
105711d341caSmrg# This file is free software; the Free Software Foundation
105811d341caSmrg# gives unlimited permission to copy and/or distribute it,
105911d341caSmrg# with or without modifications, as long as this notice is preserved.
106011d341caSmrg
106111d341caSmrg# _AM_PROG_TAR(FORMAT)
106211d341caSmrg# --------------------
106311d341caSmrg# Check how to create a tarball in format FORMAT.
10641c80d5b0Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
106511d341caSmrg#
106611d341caSmrg# Substitute a variable $(am__tar) that is a command
106711d341caSmrg# writing to stdout a FORMAT-tarball containing the directory
106811d341caSmrg# $tardir.
106911d341caSmrg#     tardir=directory && $(am__tar) > result.tar
107011d341caSmrg#
107111d341caSmrg# Substitute a variable $(am__untar) that extract such
107211d341caSmrg# a tarball read from stdin.
107311d341caSmrg#     $(am__untar) < result.tar
10741c80d5b0Smrg#
107511d341caSmrgAC_DEFUN([_AM_PROG_TAR],
10761c80d5b0Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10771c80d5b0Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10781c80d5b0SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10791c80d5b0Smrg
10801c80d5b0Smrg# We'll loop over all known methods to create a tar archive until one works.
108111d341caSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
108211d341caSmrg
10831c80d5b0Smrgm4_if([$1], [v7],
10841c80d5b0Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10851c80d5b0Smrg
10861c80d5b0Smrg  [m4_case([$1],
10871c80d5b0Smrg    [ustar],
10881c80d5b0Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10891c80d5b0Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10901c80d5b0Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10911c80d5b0Smrg      # and bug#13588).
10921c80d5b0Smrg      am_max_uid=2097151 # 2^21 - 1
10931c80d5b0Smrg      am_max_gid=$am_max_uid
10941c80d5b0Smrg      # The $UID and $GID variables are not portable, so we need to resort
10951c80d5b0Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10961c80d5b0Smrg      # below are definitely unexpected, so allow the users to see them
10971c80d5b0Smrg      # (that is, avoid stderr redirection).
10981c80d5b0Smrg      am_uid=`id -u || echo unknown`
10991c80d5b0Smrg      am_gid=`id -g || echo unknown`
11001c80d5b0Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11011c80d5b0Smrg      if test $am_uid -le $am_max_uid; then
11021c80d5b0Smrg         AC_MSG_RESULT([yes])
11031c80d5b0Smrg      else
11041c80d5b0Smrg         AC_MSG_RESULT([no])
11051c80d5b0Smrg         _am_tools=none
11061c80d5b0Smrg      fi
11071c80d5b0Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
11081c80d5b0Smrg      if test $am_gid -le $am_max_gid; then
11091c80d5b0Smrg         AC_MSG_RESULT([yes])
11101c80d5b0Smrg      else
11111c80d5b0Smrg        AC_MSG_RESULT([no])
11121c80d5b0Smrg        _am_tools=none
11131c80d5b0Smrg      fi],
11141c80d5b0Smrg
11151c80d5b0Smrg  [pax],
11161c80d5b0Smrg    [],
11171c80d5b0Smrg
11181c80d5b0Smrg  [m4_fatal([Unknown tar format])])
11191c80d5b0Smrg
11201c80d5b0Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
11211c80d5b0Smrg
11221c80d5b0Smrg  # Go ahead even if we have the value already cached.  We do so because we
11231c80d5b0Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
11241c80d5b0Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
11251c80d5b0Smrg
11261c80d5b0Smrg  for _am_tool in $_am_tools; do
11271c80d5b0Smrg    case $_am_tool in
11281c80d5b0Smrg    gnutar)
11291c80d5b0Smrg      for _am_tar in tar gnutar gtar; do
11301c80d5b0Smrg        AM_RUN_LOG([$_am_tar --version]) && break
11311c80d5b0Smrg      done
11321c80d5b0Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11331c80d5b0Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11341c80d5b0Smrg      am__untar="$_am_tar -xf -"
11351c80d5b0Smrg      ;;
11361c80d5b0Smrg    plaintar)
11371c80d5b0Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11381c80d5b0Smrg      # ustar tarball either.
11391c80d5b0Smrg      (tar --version) >/dev/null 2>&1 && continue
11401c80d5b0Smrg      am__tar='tar chf - "$$tardir"'
11411c80d5b0Smrg      am__tar_='tar chf - "$tardir"'
11421c80d5b0Smrg      am__untar='tar xf -'
11431c80d5b0Smrg      ;;
11441c80d5b0Smrg    pax)
11451c80d5b0Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11461c80d5b0Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11471c80d5b0Smrg      am__untar='pax -r'
11481c80d5b0Smrg      ;;
11491c80d5b0Smrg    cpio)
11501c80d5b0Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11511c80d5b0Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11521c80d5b0Smrg      am__untar='cpio -i -H $1 -d'
11531c80d5b0Smrg      ;;
11541c80d5b0Smrg    none)
11551c80d5b0Smrg      am__tar=false
11561c80d5b0Smrg      am__tar_=false
11571c80d5b0Smrg      am__untar=false
11581c80d5b0Smrg      ;;
11591c80d5b0Smrg    esac
116011d341caSmrg
11611c80d5b0Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11621c80d5b0Smrg    # and am__untar set.
11631c80d5b0Smrg    test -n "${am_cv_prog_tar_$1}" && break
11641c80d5b0Smrg
11651c80d5b0Smrg    # tar/untar a dummy directory, and stop if the command works.
11661c80d5b0Smrg    rm -rf conftest.dir
11671c80d5b0Smrg    mkdir conftest.dir
11681c80d5b0Smrg    echo GrepMe > conftest.dir/file
11691c80d5b0Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11701c80d5b0Smrg    rm -rf conftest.dir
11711c80d5b0Smrg    if test -s conftest.tar; then
11721c80d5b0Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11731c80d5b0Smrg      AM_RUN_LOG([cat conftest.dir/file])
11741c80d5b0Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11751c80d5b0Smrg    fi
11761c80d5b0Smrg  done
117711d341caSmrg  rm -rf conftest.dir
117811d341caSmrg
11791c80d5b0Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11801c80d5b0Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11811c80d5b0Smrg
118211d341caSmrgAC_SUBST([am__tar])
118311d341caSmrgAC_SUBST([am__untar])
118411d341caSmrg]) # _AM_PROG_TAR
118511d341caSmrg
11861c80d5b0Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
11871c80d5b0Smrg# 
11881c80d5b0Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1189d7ffce2aSmrg#
11901c80d5b0Smrg# This program is free software; you can redistribute it and/or modify
11911c80d5b0Smrg# it under the terms of the GNU General Public License as published by
11921c80d5b0Smrg# the Free Software Foundation; either version 2 of the License, or
11931c80d5b0Smrg# (at your option) any later version.
1194d7ffce2aSmrg#
11951c80d5b0Smrg# This program is distributed in the hope that it will be useful, but
11961c80d5b0Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
11971c80d5b0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11981c80d5b0Smrg# General Public License for more details.
1199d7ffce2aSmrg#
12001c80d5b0Smrg# You should have received a copy of the GNU General Public License
12011c80d5b0Smrg# along with this program; if not, write to the Free Software
12021c80d5b0Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1203d7ffce2aSmrg#
12041c80d5b0Smrg# As a special exception to the GNU General Public License, if you
12051c80d5b0Smrg# distribute this file as part of a program that contains a
12061c80d5b0Smrg# configuration script generated by Autoconf, you may include it under
12071c80d5b0Smrg# the same distribution terms that you use for the rest of that program.
1208d7ffce2aSmrg
12091c80d5b0Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1210d7ffce2aSmrg# ----------------------------------
12111c80d5b0SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12121c80d5b0Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12131c80d5b0Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
12141c80d5b0SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
12151c80d5b0Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12161c80d5b0Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12171c80d5b0Smrgfi
12181c80d5b0Smrgif test -n "$PKG_CONFIG"; then
12191c80d5b0Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12201c80d5b0Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12211c80d5b0Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12221c80d5b0Smrg		AC_MSG_RESULT([yes])
12231c80d5b0Smrg	else
12241c80d5b0Smrg		AC_MSG_RESULT([no])
12251c80d5b0Smrg		PKG_CONFIG=""
12261c80d5b0Smrg	fi
12271c80d5b0Smrg		
12281c80d5b0Smrgfi[]dnl
12291c80d5b0Smrg])# PKG_PROG_PKG_CONFIG
1230d7ffce2aSmrg
12311c80d5b0Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12321c80d5b0Smrg#
12331c80d5b0Smrg# Check to see whether a particular set of modules exists.  Similar
12341c80d5b0Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12351c80d5b0Smrg#
12361c80d5b0Smrg#
12371c80d5b0Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12381c80d5b0Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
12391c80d5b0Smrg# PKG_CHECK_EXISTS manually
12401c80d5b0Smrg# --------------------------------------------------------------
12411c80d5b0SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12421c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12431c80d5b0Smrgif test -n "$PKG_CONFIG" && \
12441c80d5b0Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12451c80d5b0Smrg  m4_ifval([$2], [$2], [:])
12461c80d5b0Smrgm4_ifvaln([$3], [else
12471c80d5b0Smrg  $3])dnl
12481c80d5b0Smrgfi])
12491c80d5b0Smrg
12501c80d5b0Smrg
12511c80d5b0Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12521c80d5b0Smrg# ---------------------------------------------
12531c80d5b0Smrgm4_define([_PKG_CONFIG],
12541c80d5b0Smrg[if test -n "$$1"; then
12551c80d5b0Smrg    pkg_cv_[]$1="$$1"
12561c80d5b0Smrg elif test -n "$PKG_CONFIG"; then
12571c80d5b0Smrg    PKG_CHECK_EXISTS([$3],
12581c80d5b0Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
12591c80d5b0Smrg		     [pkg_failed=yes])
12601c80d5b0Smrg else
12611c80d5b0Smrg    pkg_failed=untried
12621c80d5b0Smrgfi[]dnl
12631c80d5b0Smrg])# _PKG_CONFIG
12641c80d5b0Smrg
12651c80d5b0Smrg# _PKG_SHORT_ERRORS_SUPPORTED
12661c80d5b0Smrg# -----------------------------
12671c80d5b0SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12681c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12691c80d5b0Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12701c80d5b0Smrg        _pkg_short_errors_supported=yes
12711c80d5b0Smrgelse
12721c80d5b0Smrg        _pkg_short_errors_supported=no
12731c80d5b0Smrgfi[]dnl
12741c80d5b0Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
12751c80d5b0Smrg
12761c80d5b0Smrg
12771c80d5b0Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12781c80d5b0Smrg# [ACTION-IF-NOT-FOUND])
12791c80d5b0Smrg#
12801c80d5b0Smrg#
12811c80d5b0Smrg# Note that if there is a possibility the first call to
12821c80d5b0Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12831c80d5b0Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12841c80d5b0Smrg#
12851c80d5b0Smrg#
12861c80d5b0Smrg# --------------------------------------------------------------
12871c80d5b0SmrgAC_DEFUN([PKG_CHECK_MODULES],
12881c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12891c80d5b0SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12901c80d5b0SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12911c80d5b0Smrg
12921c80d5b0Smrgpkg_failed=no
12931c80d5b0SmrgAC_MSG_CHECKING([for $1])
12941c80d5b0Smrg
12951c80d5b0Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12961c80d5b0Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12971c80d5b0Smrg
12981c80d5b0Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12991c80d5b0Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13001c80d5b0SmrgSee the pkg-config man page for more details.])
13011c80d5b0Smrg
13021c80d5b0Smrgif test $pkg_failed = yes; then
13031c80d5b0Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13041c80d5b0Smrg        if test $_pkg_short_errors_supported = yes; then
13051c80d5b0Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
13061c80d5b0Smrg        else 
13071c80d5b0Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
13081c80d5b0Smrg        fi
13091c80d5b0Smrg	# Put the nasty error message in config.log where it belongs
13101c80d5b0Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13111c80d5b0Smrg
13121c80d5b0Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
13131c80d5b0Smrg[Package requirements ($2) were not met:
13141c80d5b0Smrg
13151c80d5b0Smrg$$1_PKG_ERRORS
13161c80d5b0Smrg
13171c80d5b0SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13181c80d5b0Smrginstalled software in a non-standard prefix.
13191c80d5b0Smrg
13201c80d5b0Smrg_PKG_TEXT
13211c80d5b0Smrg])],
13221c80d5b0Smrg		[AC_MSG_RESULT([no])
13231c80d5b0Smrg                $4])
13241c80d5b0Smrgelif test $pkg_failed = untried; then
13251c80d5b0Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
13261c80d5b0Smrg[The pkg-config script could not be found or is too old.  Make sure it
13271c80d5b0Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13281c80d5b0Smrgpath to pkg-config.
13291c80d5b0Smrg
13301c80d5b0Smrg_PKG_TEXT
13311c80d5b0Smrg
13321c80d5b0SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13331c80d5b0Smrg		[$4])
13341c80d5b0Smrgelse
13351c80d5b0Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13361c80d5b0Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13371c80d5b0Smrg        AC_MSG_RESULT([yes])
13381c80d5b0Smrg	ifelse([$3], , :, [$3])
13391c80d5b0Smrgfi[]dnl
13401c80d5b0Smrg])# PKG_CHECK_MODULES
13411c80d5b0Smrg
13421c80d5b0Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
13431c80d5b0Smrgdnl
13441c80d5b0Smrgdnl This file comes from X.Org's font-util 1.3.0
13451c80d5b0Smrgdnl
13461c80d5b0Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
13471c80d5b0Smrgdnl
13481c80d5b0Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13491c80d5b0Smrgdnl copy of this software and associated documentation files (the "Software"),
13501c80d5b0Smrgdnl to deal in the Software without restriction, including without limitation
13511c80d5b0Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13521c80d5b0Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
13531c80d5b0Smrgdnl Software is furnished to do so, subject to the following conditions:
13541c80d5b0Smrgdnl
13551c80d5b0Smrgdnl The above copyright notice and this permission notice (including the next
13561c80d5b0Smrgdnl paragraph) shall be included in all copies or substantial portions of the
13571c80d5b0Smrgdnl Software.
13581c80d5b0Smrgdnl
13591c80d5b0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13601c80d5b0Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13611c80d5b0Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13621c80d5b0Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13631c80d5b0Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13641c80d5b0Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13651c80d5b0Smrgdnl DEALINGS IN THE SOFTWARE.
13661c80d5b0Smrgdnl
13671c80d5b0Smrgdnl --------------------------------------------------------------------
13681c80d5b0Smrgdnl
13691c80d5b0Smrgdnl Copyright 2005 Red Hat, Inc
13701c80d5b0Smrgdnl
13711c80d5b0Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
13721c80d5b0Smrgdnl documentation for any purpose is hereby granted without fee, provided that
13731c80d5b0Smrgdnl the above copyright notice appear in all copies and that both that
13741c80d5b0Smrgdnl copyright notice and this permission notice appear in supporting
13751c80d5b0Smrgdnl documentation.
13761c80d5b0Smrgdnl
13771c80d5b0Smrgdnl The above copyright notice and this permission notice shall be included
13781c80d5b0Smrgdnl in all copies or substantial portions of the Software.
13791c80d5b0Smrgdnl
13801c80d5b0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13811c80d5b0Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
13821c80d5b0Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
13831c80d5b0Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
13841c80d5b0Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
13851c80d5b0Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
13861c80d5b0Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
13871c80d5b0Smrgdnl
13881c80d5b0Smrgdnl Except as contained in this notice, the name of the copyright holders shall
13891c80d5b0Smrgdnl not be used in advertising or otherwise to promote the sale, use or
13901c80d5b0Smrgdnl other dealings in this Software without prior written authorization
13911c80d5b0Smrgdnl from the copyright holders.
13921c80d5b0Smrg
13931c80d5b0Smrg# XORG_FONT_MACROS_VERSION(required-version)
13941c80d5b0Smrg# ------------------------------------------
13951c80d5b0Smrg# Minimum version: 1.1.0
13961c80d5b0Smrg#
13971c80d5b0Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13981c80d5b0Smrg# your configure.ac with the minimum required version, such as:
13991c80d5b0Smrg# XORG_FONT_MACROS_VERSION(1.1)
14001c80d5b0Smrg#
14011c80d5b0Smrg# To ensure that this macro is defined, also add:
14021c80d5b0Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
14031c80d5b0Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
14041c80d5b0Smrg#
14051c80d5b0Smrg#
14061c80d5b0Smrg# See the "minimum version" comment for each macro you use to see what
14071c80d5b0Smrg# version you require.
14081c80d5b0Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
14091c80d5b0Smrgm4_define([vers_have], [1.3.0])
14101c80d5b0Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14111c80d5b0Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14121c80d5b0Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14131c80d5b0Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
14141c80d5b0Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14151c80d5b0Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
14161c80d5b0Smrgm4_undefine([vers_have])
14171c80d5b0Smrgm4_undefine([maj_have])
14181c80d5b0Smrgm4_undefine([maj_needed])
14191c80d5b0Smrg]) # XORG_FONT_MACROS_VERSION
14201c80d5b0Smrg
14211c80d5b0Smrg# XORG_FONT_CHECK_{maps}()
14221c80d5b0Smrg# ------------------------
14231c80d5b0Smrg# Minimum version: 1.0.0
14241c80d5b0Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
14251c80d5b0Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
14261c80d5b0Smrg
14271c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
14281c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
14291c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
14301c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
14311c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
14321c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
14331c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
14341c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
14351c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
14361c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
14371c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
14381c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
14391c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
14401c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
14411c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
14421c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
14431c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
14441c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
14451c80d5b0Smrg
14461c80d5b0Smrg# XORG_FONT_CHECK_ENCODING(encoding)
14471c80d5b0Smrg# ----------------------------------
14481c80d5b0Smrg# Minimum version: 1.1.0
14491c80d5b0Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
14501c80d5b0Smrg# It replaced individual copies of this code in the above macros in 1.1.
14511c80d5b0Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
14521c80d5b0Smrg# calls if this is not true in the future.
14531c80d5b0Smrg
14541c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
14551c80d5b0Smrg	AC_ARG_ENABLE(m4_tolower($1),
14561c80d5b0Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
14571c80d5b0Smrg				[Build $1 fonts (default: yes)]),
14581c80d5b0Smrg		[AS_TR_SH($1)=$enableval])
14591c80d5b0Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
14601c80d5b0Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
14611c80d5b0Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
14621c80d5b0Smrg]) # XORG_FONT_CHECK_ENCODING
14631c80d5b0Smrg
14641c80d5b0Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
14651c80d5b0Smrg# -----------------------------------------------------
14661c80d5b0Smrg# Minimum version: 1.1.0
1467d7ffce2aSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1468d7ffce2aSmrg# Add a shorthand --enable/disable-all-encodings option.
1469d7ffce2aSmrg
1470d7ffce2aSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1471d7ffce2aSmrg	AC_ARG_ENABLE([all-encodings],
1472d7ffce2aSmrg		AS_HELP_STRING([--disable-all-encodings],
1473d7ffce2aSmrg				[Disable building of all font encodings]),
1474d7ffce2aSmrg		[m4_foreach_w([enc], [$1], [
1475d7ffce2aSmrg			AS_TR_SH(enc)=$enableval
1476d7ffce2aSmrg		])],
1477d7ffce2aSmrg		[m4_foreach_w([enc], [$1], [
1478d7ffce2aSmrg			AS_TR_SH(enc)=yes
1479d7ffce2aSmrg		])])
1480d7ffce2aSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1481d7ffce2aSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
1482d7ffce2aSmrg
1483d7ffce2aSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1484d7ffce2aSmrg# ------------------------------------------
1485d7ffce2aSmrg# Minimum version: 1.1.0
1486d7ffce2aSmrg#
1487d7ffce2aSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1488d7ffce2aSmrg#
1489d7ffce2aSmrg
1490d7ffce2aSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1491d7ffce2aSmrg	AC_PATH_PROG($1, $2)
1492d7ffce2aSmrg	if test x"$$1" = x; then
1493d7ffce2aSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1494d7ffce2aSmrg	fi
1495d7ffce2aSmrg])
1496d7ffce2aSmrg
1497d7ffce2aSmrg
1498d7ffce2aSmrg# XORG_FONT_FCCACHE()
1499d7ffce2aSmrg# -------------------
1500d7ffce2aSmrg# Minimum version: 1.1.0
1501d7ffce2aSmrg#
1502d7ffce2aSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1503d7ffce2aSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
15041c80d5b0Smrg# to run fc-cache if found and not installing to $DESTDIR and not
15051c80d5b0Smrg# cross-compiling
1506d7ffce2aSmrg#
1507d7ffce2aSmrg# fc-cache is optional, not required, and should be skipped when making
15081c80d5b0Smrg# packages (installing to $DESTDIR) or cross-compiling
1509d7ffce2aSmrg#
1510d7ffce2aSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1511d7ffce2aSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
1512d7ffce2aSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
15131c80d5b0Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1514d7ffce2aSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
1515d7ffce2aSmrg	else
1516d7ffce2aSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1517d7ffce2aSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1518d7ffce2aSmrg	fi
1519d7ffce2aSmrg	AC_SUBST([RUN_FCCACHE])
1520d7ffce2aSmrg])
1521d7ffce2aSmrg
15221c80d5b0Smrg# XORG_FONT_MKFONTDIR()
15231c80d5b0Smrg# -------------------
15241c80d5b0Smrg# Minimum version: 1.3.0
15251c80d5b0Smrg#
15261c80d5b0Smrg# Set MKFONTDIR to path to mkfontdir.
15271c80d5b0Smrg#
15281c80d5b0Smrg# If cross-compiling, and if mkdir is not found, use a shell command
15291c80d5b0Smrg# which warns mkfontdir needs to be run on the target
15301c80d5b0Smrg#
15311c80d5b0Smrg# If not cross-compiling, mkfontdir must be found
15321c80d5b0Smrg#
15331c80d5b0SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
15341c80d5b0Smrg	if test x"$cross_compiling" != x"no" ; then
15351c80d5b0Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
15361c80d5b0Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
15371c80d5b0Smrg
15381c80d5b0Smrg		if test x"$MKFONTDIR" = x; then
15391c80d5b0Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
15401c80d5b0Smrg		fi
15411c80d5b0Smrg	else
15421c80d5b0Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
15431c80d5b0Smrg	fi
15441c80d5b0Smrg
15451c80d5b0Smrg	AC_SUBST([MKFONTDIR])
15461c80d5b0Smrg])
1547d7ffce2aSmrg
1548d7ffce2aSmrg# XORG_FONT_COMMON_UTILS()
1549d7ffce2aSmrg# ------------------------
1550d7ffce2aSmrg# Minimum version: 1.1.0
1551d7ffce2aSmrg#
1552d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1553d7ffce2aSmrg
1554d7ffce2aSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1555d7ffce2aSmrg	XORG_FONT_FCCACHE
15561c80d5b0Smrg	XORG_FONT_MKFONTDIR
1557d7ffce2aSmrg])
1558d7ffce2aSmrg
1559d7ffce2aSmrg# XORG_FONT_SCALED_UTILS()
1560d7ffce2aSmrg# ------------------------
1561d7ffce2aSmrg# Minimum version: 1.1.0
1562d7ffce2aSmrg#
1563d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1564d7ffce2aSmrg# (TrueType, OpenType, Type1)
1565d7ffce2aSmrg
1566d7ffce2aSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1567d7ffce2aSmrg	XORG_FONT_COMMON_UTILS
1568d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1569d7ffce2aSmrg])
1570d7ffce2aSmrg
1571d7ffce2aSmrg# XORG_FONT_BDF_UTILS()
1572d7ffce2aSmrg# ---------------------
1573d7ffce2aSmrg# Minimum version: 1.1.0
1574d7ffce2aSmrg#
1575d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1576d7ffce2aSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1577d7ffce2aSmrg# PCF output files created by bdftopcf
1578d7ffce2aSmrg
1579d7ffce2aSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1580d7ffce2aSmrg	XORG_FONT_COMMON_UTILS
1581d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1582d7ffce2aSmrg	XORG_FONT_CHECK_COMPRESSION
1583d7ffce2aSmrg])
1584d7ffce2aSmrg
1585d7ffce2aSmrg# XORG_FONT_CHECK_COMPRESSION()
1586d7ffce2aSmrg# -----------------------------
1587d7ffce2aSmrg# Minimum version: 1.1.0
1588d7ffce2aSmrg#
1589d7ffce2aSmrg# Offer a --with-compression flag to control what compression method is
1590d7ffce2aSmrg# used for pcf font files.   Offers all the methods currently supported
1591d7ffce2aSmrg# by libXfont, including no compression.
1592d7ffce2aSmrg
1593d7ffce2aSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1594d7ffce2aSmrg	AC_MSG_CHECKING([font compression method])
1595d7ffce2aSmrg	AC_ARG_WITH(compression,
1596d7ffce2aSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1597d7ffce2aSmrg			 [compression method to use on pcf fonts])],
1598d7ffce2aSmrg         [compression="$withval"], [compression="yes"])
1599d7ffce2aSmrg	if test x"$compression" = "xyes" ; then
1600d7ffce2aSmrg		compression="gzip"
1601d7ffce2aSmrg	fi
1602d7ffce2aSmrg	AC_MSG_RESULT([${compression}])
1603d7ffce2aSmrg	case ${compression} in
1604d7ffce2aSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1605d7ffce2aSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
1606d7ffce2aSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1607d7ffce2aSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1608d7ffce2aSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1609d7ffce2aSmrg	esac
1610d7ffce2aSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1611d7ffce2aSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1612d7ffce2aSmrg	fi
1613d7ffce2aSmrg	AC_SUBST([COMPRESS_SUFFIX])
1614d7ffce2aSmrg])
1615d7ffce2aSmrg
1616d7ffce2aSmrg# XORG_FONT_UCS2ANY()
1617d7ffce2aSmrg# -------------------
1618d7ffce2aSmrg# Minimum version: 1.1.0
1619d7ffce2aSmrg#
1620d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1621d7ffce2aSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1622d7ffce2aSmrg# Also call pkg-config to find the directory with the encoding files needed
1623d7ffce2aSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1624d7ffce2aSmrg
1625d7ffce2aSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
1626d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1627d7ffce2aSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1628d7ffce2aSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
1629d7ffce2aSmrg	MAPFILES_PATH=`pkg-config --variable=mapdir fontutil`
1630d7ffce2aSmrg	AC_SUBST(MAPFILES_PATH)
1631d7ffce2aSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1632d7ffce2aSmrg])
1633d7ffce2aSmrg
1634d7ffce2aSmrg
1635d7ffce2aSmrg
1636d7ffce2aSmrg# XORG_FONT_FC_CONFDIR()
1637d7ffce2aSmrg# --------------------
1638d7ffce2aSmrg# Minimum version: 1.2.0
1639d7ffce2aSmrg#
1640d7ffce2aSmrg# Sets FC_CONFDIR to the fontconfig config directory
1641d7ffce2aSmrg# (which should be --with-confdir=... when building fontconfig)
1642d7ffce2aSmrg# found from:
1643d7ffce2aSmrg#	--with-fc-confdir=...
1644d7ffce2aSmrg#	pkg-config --variable=confdir fontconfig
1645d7ffce2aSmrg#	${sysconfdir}/fonts
1646d7ffce2aSmrg
1647d7ffce2aSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1648d7ffce2aSmrg	dnl Ensure $PKG_CONFIG is set first
1649d7ffce2aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1650d7ffce2aSmrg
1651d7ffce2aSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1652d7ffce2aSmrg	AC_ARG_WITH(fc-confdir,
1653d7ffce2aSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1654d7ffce2aSmrg			   [Path to fontconfig's configuration directory]),
1655d7ffce2aSmrg		    [FC_CONFDIR="$withval"])
1656d7ffce2aSmrg	# if --with-fc-confdir was not specified
1657d7ffce2aSmrg	if test "x${FC_CONFDIR}" = "x"; then
1658d7ffce2aSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1659d7ffce2aSmrg	fi
1660d7ffce2aSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1661d7ffce2aSmrg	if test "x${FC_CONFDIR}" = "x"; then
1662d7ffce2aSmrg		FC_CONFDIR="${sysconfdir}/fonts"
1663d7ffce2aSmrg	fi
1664d7ffce2aSmrg	AC_SUBST(FC_CONFDIR)
1665d7ffce2aSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
1666d7ffce2aSmrg])
1667d7ffce2aSmrg
1668d7ffce2aSmrg
1669d7ffce2aSmrg
1670d7ffce2aSmrg# XORG_FONTROOTDIR()
1671d7ffce2aSmrg# --------------------
1672d7ffce2aSmrg# Minimum version: 1.1.0
1673d7ffce2aSmrg#
1674d7ffce2aSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1675d7ffce2aSmrg# found from:
1676d7ffce2aSmrg#	--with-fontrootdir
1677d7ffce2aSmrg#	pkg-config --variable=fontrootdir fontutil
1678d7ffce2aSmrg#	${datadir}/fonts/X11
1679d7ffce2aSmrg
1680d7ffce2aSmrgAC_DEFUN([XORG_FONTROOTDIR],[
1681d7ffce2aSmrg	dnl Ensure $PKG_CONFIG is set first
1682d7ffce2aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1683d7ffce2aSmrg
1684d7ffce2aSmrg	AC_MSG_CHECKING([for root directory for font files])
1685d7ffce2aSmrg	AC_ARG_WITH(fontrootdir,
1686d7ffce2aSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1687d7ffce2aSmrg			   [Path to root directory for font files]),
1688d7ffce2aSmrg		    [FONTROOTDIR="$withval"])
1689d7ffce2aSmrg	# if --with-fontrootdir not specified...
1690d7ffce2aSmrg	if test "x${FONTROOTDIR}" = "x"; then
1691d7ffce2aSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1692d7ffce2aSmrg	fi
1693d7ffce2aSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1694d7ffce2aSmrg	if test "x${FONTROOTDIR}" = "x"; then
1695d7ffce2aSmrg		FONTROOTDIR="${datadir}/fonts/X11"
1696d7ffce2aSmrg	fi
1697d7ffce2aSmrg	AC_SUBST(FONTROOTDIR)
1698d7ffce2aSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
1699d7ffce2aSmrg])
1700d7ffce2aSmrg
1701d7ffce2aSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
1702d7ffce2aSmrg# ---------------------------------------
1703d7ffce2aSmrg# Minimum version: 1.1.0
1704d7ffce2aSmrg#
1705d7ffce2aSmrg# Offer a --with-<flag> flag to control directory for font installation
1706d7ffce2aSmrg# Default is the specified <subdir> of the font root directory.
1707d7ffce2aSmrg# Sets <variable> to the selected directory
1708d7ffce2aSmrg
1709d7ffce2aSmrgAC_DEFUN([XORG_FONTSUBDIR],[
1710d7ffce2aSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
1711d7ffce2aSmrg
1712d7ffce2aSmrg	AC_MSG_CHECKING([for directory for $3 files])
1713d7ffce2aSmrg	AC_ARG_WITH($2,
1714d7ffce2aSmrg		    [AS_HELP_STRING([--with-$2=DIR],
1715d7ffce2aSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1716d7ffce2aSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1717d7ffce2aSmrg	AC_SUBST($1)
1718d7ffce2aSmrg	AC_MSG_RESULT([${$1}])
1719d7ffce2aSmrg]) # XORG_FONTSUBDIR
1720d7ffce2aSmrg
1721d7ffce2aSmrg# XORG_FONTDIR(subdir)
1722d7ffce2aSmrg# --------------------
1723d7ffce2aSmrg# Minimum version: 1.1.0
1724d7ffce2aSmrg#
1725d7ffce2aSmrg# Offer a --with-fontdir flag to control directory for font installation
1726d7ffce2aSmrg# Default is the specified subdir of the font root directory.
1727d7ffce2aSmrg# Sets FONTDIR to the selected directory
1728d7ffce2aSmrg
1729d7ffce2aSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1730d7ffce2aSmrg
1731d7ffce2aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
17324c61c93dSmrgdnl
1733d7ffce2aSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1734d7ffce2aSmrgdnl 
1735d7ffce2aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1736d7ffce2aSmrgdnl copy of this software and associated documentation files (the "Software"),
1737d7ffce2aSmrgdnl to deal in the Software without restriction, including without limitation
1738d7ffce2aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1739d7ffce2aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1740d7ffce2aSmrgdnl Software is furnished to do so, subject to the following conditions:
1741d7ffce2aSmrgdnl
1742d7ffce2aSmrgdnl The above copyright notice and this permission notice (including the next
1743d7ffce2aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1744d7ffce2aSmrgdnl Software.
1745d7ffce2aSmrgdnl
1746d7ffce2aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1747d7ffce2aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1748d7ffce2aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1749d7ffce2aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1750d7ffce2aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1751d7ffce2aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1752d7ffce2aSmrgdnl DEALINGS IN THE SOFTWARE.
17534c61c93dSmrg
17544c61c93dSmrg# XORG_MACROS_VERSION(required-version)
17554c61c93dSmrg# -------------------------------------
17564c61c93dSmrg# Minimum version: 1.1.0
17574c61c93dSmrg#
17584c61c93dSmrg# If you're using a macro added in Version 1.1 or newer, include this in
17594c61c93dSmrg# your configure.ac with the minimum required version, such as:
17604c61c93dSmrg# XORG_MACROS_VERSION(1.1)
17614c61c93dSmrg#
17624c61c93dSmrg# To ensure that this macro is defined, also add:
17634c61c93dSmrg# m4_ifndef([XORG_MACROS_VERSION],
17644c61c93dSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
17654c61c93dSmrg#
17664c61c93dSmrg#
17674c61c93dSmrg# See the "minimum version" comment for each macro you use to see what 
17684c61c93dSmrg# version you require.
17694c61c93dSmrgm4_defun([XORG_MACROS_VERSION],[
17701c80d5b0Smrgm4_define([vers_have], [1.17])
17714c61c93dSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
17724c61c93dSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
17734c61c93dSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
17744c61c93dSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
17754c61c93dSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
17764c61c93dSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
17774c61c93dSmrgm4_undefine([vers_have])
17784c61c93dSmrgm4_undefine([maj_have])
17794c61c93dSmrgm4_undefine([maj_needed])
17804c61c93dSmrg]) # XORG_MACROS_VERSION
17814c61c93dSmrg
17824c61c93dSmrg# XORG_PROG_RAWCPP()
17834c61c93dSmrg# ------------------
17844c61c93dSmrg# Minimum version: 1.0.0
17854c61c93dSmrg#
17864c61c93dSmrg# Find cpp program and necessary flags for use in pre-processing text files
17874c61c93dSmrg# such as man pages and config files
17884c61c93dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
17894c61c93dSmrgAC_REQUIRE([AC_PROG_CPP])
17904c61c93dSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
17914c61c93dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
17924c61c93dSmrg
17934c61c93dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
17944c61c93dSmrg# which is not the best choice for supporting other OS'es, but covers most
17954c61c93dSmrg# of the ones we need for now.
17964c61c93dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
17971c80d5b0SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
17984c61c93dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
17994c61c93dSmrg	AC_MSG_RESULT([no])
18004c61c93dSmrgelse
18014c61c93dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
18024c61c93dSmrg		RAWCPPFLAGS=-undef
18034c61c93dSmrg		AC_MSG_RESULT([yes])
18044c61c93dSmrg	# under Cygwin unix is still defined even with -undef
18054c61c93dSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
18064c61c93dSmrg		RAWCPPFLAGS="-undef -ansi"
18074c61c93dSmrg		AC_MSG_RESULT([yes, with -ansi])
18084c61c93dSmrg	else
18094c61c93dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
18104c61c93dSmrg	fi
18114c61c93dSmrgfi
18124c61c93dSmrgrm -f conftest.$ac_ext
18134c61c93dSmrg
18144c61c93dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
18151c80d5b0SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
18164c61c93dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
18174c61c93dSmrg	AC_MSG_RESULT([no])
18184c61c93dSmrgelse
18194c61c93dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
18204c61c93dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
18214c61c93dSmrg		AC_MSG_RESULT([yes])
18224c61c93dSmrg	else
18234c61c93dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
18244c61c93dSmrg	fi
18254c61c93dSmrgfi
18264c61c93dSmrgrm -f conftest.$ac_ext
18274c61c93dSmrgAC_SUBST(RAWCPPFLAGS)
18284c61c93dSmrg]) # XORG_PROG_RAWCPP
18294c61c93dSmrg
18304c61c93dSmrg# XORG_MANPAGE_SECTIONS()
18314c61c93dSmrg# -----------------------
18324c61c93dSmrg# Minimum version: 1.0.0
18334c61c93dSmrg#
18344c61c93dSmrg# Determine which sections man pages go in for the different man page types
18354c61c93dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
18364c61c93dSmrg# Not sure if there's any better way than just hardcoding by OS name.
18374c61c93dSmrg# Override default settings by setting environment variables
1838d7ffce2aSmrg# Added MAN_SUBSTS in version 1.8
1839d7ffce2aSmrg# Added AC_PROG_SED in version 1.8
18404c61c93dSmrg
18414c61c93dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
18424c61c93dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1843d7ffce2aSmrgAC_REQUIRE([AC_PROG_SED])
18444c61c93dSmrg
18454c61c93dSmrgif test x$APP_MAN_SUFFIX = x    ; then
18464c61c93dSmrg    APP_MAN_SUFFIX=1
18474c61c93dSmrgfi
18484c61c93dSmrgif test x$APP_MAN_DIR = x    ; then
18494c61c93dSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
18504c61c93dSmrgfi
18514c61c93dSmrg
18524c61c93dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
18534c61c93dSmrg    LIB_MAN_SUFFIX=3
18544c61c93dSmrgfi
18554c61c93dSmrgif test x$LIB_MAN_DIR = x    ; then
18564c61c93dSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
18574c61c93dSmrgfi
18584c61c93dSmrg
18594c61c93dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
18604c61c93dSmrg    case $host_os in
18614c61c93dSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
18624c61c93dSmrg	*)		FILE_MAN_SUFFIX=5  ;;
18634c61c93dSmrg    esac
18644c61c93dSmrgfi
18654c61c93dSmrgif test x$FILE_MAN_DIR = x    ; then
18664c61c93dSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
18674c61c93dSmrgfi
18684c61c93dSmrg
18694c61c93dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
18704c61c93dSmrg    case $host_os in
18714c61c93dSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
18724c61c93dSmrg	*)		MISC_MAN_SUFFIX=7  ;;
18734c61c93dSmrg    esac
18744c61c93dSmrgfi
18754c61c93dSmrgif test x$MISC_MAN_DIR = x    ; then
18764c61c93dSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
18774c61c93dSmrgfi
18784c61c93dSmrg
18794c61c93dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
18804c61c93dSmrg    case $host_os in
18814c61c93dSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
18824c61c93dSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
18834c61c93dSmrg    esac
18844c61c93dSmrgfi
18854c61c93dSmrgif test x$DRIVER_MAN_DIR = x    ; then
18864c61c93dSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
18874c61c93dSmrgfi
18884c61c93dSmrg
18894c61c93dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
18904c61c93dSmrg    case $host_os in
18914c61c93dSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
18924c61c93dSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
18934c61c93dSmrg    esac
18944c61c93dSmrgfi
18954c61c93dSmrgif test x$ADMIN_MAN_DIR = x    ; then
18964c61c93dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
18974c61c93dSmrgfi
18984c61c93dSmrg
18994c61c93dSmrg
19004c61c93dSmrgAC_SUBST([APP_MAN_SUFFIX])
19014c61c93dSmrgAC_SUBST([LIB_MAN_SUFFIX])
19024c61c93dSmrgAC_SUBST([FILE_MAN_SUFFIX])
19034c61c93dSmrgAC_SUBST([MISC_MAN_SUFFIX])
19044c61c93dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
19054c61c93dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
19064c61c93dSmrgAC_SUBST([APP_MAN_DIR])
19074c61c93dSmrgAC_SUBST([LIB_MAN_DIR])
19084c61c93dSmrgAC_SUBST([FILE_MAN_DIR])
19094c61c93dSmrgAC_SUBST([MISC_MAN_DIR])
19104c61c93dSmrgAC_SUBST([DRIVER_MAN_DIR])
19114c61c93dSmrgAC_SUBST([ADMIN_MAN_DIR])
1912d7ffce2aSmrg
1913d7ffce2aSmrgXORG_MAN_PAGE="X Version 11"
1914d7ffce2aSmrgAC_SUBST([XORG_MAN_PAGE])
1915d7ffce2aSmrgMAN_SUBSTS="\
1916d7ffce2aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1917d7ffce2aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1918d7ffce2aSmrg	-e 's|__xservername__|Xorg|g' \
1919d7ffce2aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1920d7ffce2aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1921d7ffce2aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1922d7ffce2aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1923d7ffce2aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1924d7ffce2aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1925d7ffce2aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1926d7ffce2aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1927d7ffce2aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1928d7ffce2aSmrgAC_SUBST([MAN_SUBSTS])
1929d7ffce2aSmrg
19304c61c93dSmrg]) # XORG_MANPAGE_SECTIONS
19314c61c93dSmrg
1932d7ffce2aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1933d7ffce2aSmrg# ------------------------
1934d7ffce2aSmrg# Minimum version: 1.7.0
1935d7ffce2aSmrg#
1936d7ffce2aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1937d7ffce2aSmrg# provided by xorg-sgml-doctools, if installed.
1938d7ffce2aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1939d7ffce2aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1940d7ffce2aSmrgXORG_SGML_PATH=
1941d7ffce2aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1942d7ffce2aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1943d7ffce2aSmrg    [m4_ifval([$1],[:],
1944d7ffce2aSmrg        [if test x"$cross_compiling" != x"yes" ; then
1945d7ffce2aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1946d7ffce2aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1947d7ffce2aSmrg         fi])
1948d7ffce2aSmrg    ])
1949d7ffce2aSmrg
1950d7ffce2aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1951d7ffce2aSmrg# the path and the name of the doc stylesheet
1952d7ffce2aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1953d7ffce2aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1954d7ffce2aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1955d7ffce2aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1956d7ffce2aSmrgelse
1957d7ffce2aSmrg   AC_MSG_RESULT([no])
1958d7ffce2aSmrgfi
1959d7ffce2aSmrg
1960d7ffce2aSmrgAC_SUBST(XORG_SGML_PATH)
1961d7ffce2aSmrgAC_SUBST(STYLESHEET_SRCDIR)
1962d7ffce2aSmrgAC_SUBST(XSL_STYLESHEET)
1963d7ffce2aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1964d7ffce2aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1965d7ffce2aSmrg
19664c61c93dSmrg# XORG_CHECK_LINUXDOC
19674c61c93dSmrg# -------------------
19684c61c93dSmrg# Minimum version: 1.0.0
19694c61c93dSmrg#
19704c61c93dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
19714c61c93dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
19724c61c93dSmrg# Whether or not the necessary tools and files are found can be checked
19734c61c93dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
19744c61c93dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1975d7ffce2aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1976d7ffce2aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
19774c61c93dSmrg
19784c61c93dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
19794c61c93dSmrg
1980d7ffce2aSmrgAC_MSG_CHECKING([whether to build documentation])
19814c61c93dSmrg
1982d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
19834c61c93dSmrg   BUILDDOC=yes
19844c61c93dSmrgelse
19854c61c93dSmrg   BUILDDOC=no
19864c61c93dSmrgfi
19874c61c93dSmrg
19884c61c93dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
19894c61c93dSmrg
19904c61c93dSmrgAC_MSG_RESULT([$BUILDDOC])
19914c61c93dSmrg
1992d7ffce2aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
19934c61c93dSmrg
1994d7ffce2aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
19954c61c93dSmrg   BUILDPDFDOC=yes
19964c61c93dSmrgelse
19974c61c93dSmrg   BUILDPDFDOC=no
19984c61c93dSmrgfi
19994c61c93dSmrg
20004c61c93dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
20014c61c93dSmrg
20024c61c93dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
20034c61c93dSmrg
2004d7ffce2aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
20054c61c93dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
20064c61c93dSmrgMAKE_PDF="$PS2PDF"
20074c61c93dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
20084c61c93dSmrg
20094c61c93dSmrgAC_SUBST(MAKE_TEXT)
20104c61c93dSmrgAC_SUBST(MAKE_PS)
20114c61c93dSmrgAC_SUBST(MAKE_PDF)
20124c61c93dSmrgAC_SUBST(MAKE_HTML)
20134c61c93dSmrg]) # XORG_CHECK_LINUXDOC
20144c61c93dSmrg
20154c61c93dSmrg# XORG_CHECK_DOCBOOK
20164c61c93dSmrg# -------------------
20174c61c93dSmrg# Minimum version: 1.0.0
20184c61c93dSmrg#
20194c61c93dSmrg# Checks for the ability to build output formats from SGML DocBook source.
20204c61c93dSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
20214c61c93dSmrg# indicates whether the necessary tools and files are found and, if set,
20224c61c93dSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
20234c61c93dSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
2024d7ffce2aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
2025d7ffce2aSmrg
20264c61c93dSmrgBUILDTXTDOC=no
20274c61c93dSmrgBUILDPDFDOC=no
20284c61c93dSmrgBUILDPSDOC=no
20294c61c93dSmrgBUILDHTMLDOC=no
20304c61c93dSmrg
20314c61c93dSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
20324c61c93dSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
20334c61c93dSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
20344c61c93dSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
20354c61c93dSmrg
2036d7ffce2aSmrgAC_MSG_CHECKING([whether to build text documentation])
2037d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
20384c61c93dSmrg   test x$BUILD_TXTDOC != xno; then
20394c61c93dSmrg	BUILDTXTDOC=yes
20404c61c93dSmrgfi
20414c61c93dSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
20424c61c93dSmrgAC_MSG_RESULT([$BUILDTXTDOC])
20434c61c93dSmrg
2044d7ffce2aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
2045d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
20464c61c93dSmrg   test x$BUILD_PDFDOC != xno; then
20474c61c93dSmrg	BUILDPDFDOC=yes
20484c61c93dSmrgfi
20494c61c93dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
20504c61c93dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
20514c61c93dSmrg
2052d7ffce2aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
2053d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
20544c61c93dSmrg   test x$BUILD_PSDOC != xno; then
20554c61c93dSmrg	BUILDPSDOC=yes
20564c61c93dSmrgfi
20574c61c93dSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
20584c61c93dSmrgAC_MSG_RESULT([$BUILDPSDOC])
20594c61c93dSmrg
2060d7ffce2aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
2061d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
20624c61c93dSmrg   test x$BUILD_HTMLDOC != xno; then
20634c61c93dSmrg	BUILDHTMLDOC=yes
20644c61c93dSmrgfi
20654c61c93dSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
20664c61c93dSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
20674c61c93dSmrg
20684c61c93dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
20694c61c93dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
20704c61c93dSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
20714c61c93dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
20724c61c93dSmrg
20734c61c93dSmrgAC_SUBST(MAKE_TEXT)
20744c61c93dSmrgAC_SUBST(MAKE_PS)
20754c61c93dSmrgAC_SUBST(MAKE_PDF)
20764c61c93dSmrgAC_SUBST(MAKE_HTML)
20774c61c93dSmrg]) # XORG_CHECK_DOCBOOK
20784c61c93dSmrg
2079d7ffce2aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
2080d7ffce2aSmrg# ----------------
2081d7ffce2aSmrg# Minimum version: 1.5.0
2082d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2083d7ffce2aSmrg#
2084d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2085d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2086d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2087d7ffce2aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
2088d7ffce2aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
2089d7ffce2aSmrg# --with-xmlto assumes 'auto'.
2090d7ffce2aSmrg#
2091d7ffce2aSmrg# Interface to module:
2092d7ffce2aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
2093d7ffce2aSmrg# XMLTO:	returns the path of the xmlto program found
2094d7ffce2aSmrg#		returns the path set by the user in the environment
2095d7ffce2aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
2096d7ffce2aSmrg#		'no' user instructs the module not to use xmlto
2097d7ffce2aSmrg#
2098d7ffce2aSmrg# Added in version 1.10.0
2099d7ffce2aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
2100d7ffce2aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
2101d7ffce2aSmrg#
2102d7ffce2aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
2103d7ffce2aSmrg#
2104d7ffce2aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
2105d7ffce2aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
2106d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2107d7ffce2aSmrgAC_ARG_WITH(xmlto,
2108d7ffce2aSmrg	AS_HELP_STRING([--with-xmlto],
2109d7ffce2aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
2110d7ffce2aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
2111d7ffce2aSmrgm4_undefine([_defopt])
2112d7ffce2aSmrg
2113d7ffce2aSmrgif test "x$use_xmlto" = x"auto"; then
2114d7ffce2aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
2115d7ffce2aSmrg   if test "x$XMLTO" = "x"; then
2116d7ffce2aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
2117d7ffce2aSmrg	have_xmlto=no
2118d7ffce2aSmrg   else
2119d7ffce2aSmrg        have_xmlto=yes
2120d7ffce2aSmrg   fi
2121d7ffce2aSmrgelif test "x$use_xmlto" = x"yes" ; then
2122d7ffce2aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
2123d7ffce2aSmrg   if test "x$XMLTO" = "x"; then
2124d7ffce2aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
2125d7ffce2aSmrg   fi
2126d7ffce2aSmrg   have_xmlto=yes
2127d7ffce2aSmrgelif test "x$use_xmlto" = x"no" ; then
2128d7ffce2aSmrg   if test "x$XMLTO" != "x"; then
2129d7ffce2aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
2130d7ffce2aSmrg   fi
2131d7ffce2aSmrg   have_xmlto=no
2132d7ffce2aSmrgelse
2133d7ffce2aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2134d7ffce2aSmrgfi
2135d7ffce2aSmrg
2136d7ffce2aSmrg# Test for a minimum version of xmlto, if provided.
2137d7ffce2aSmrgm4_ifval([$1],
2138d7ffce2aSmrg[if test "$have_xmlto" = yes; then
2139d7ffce2aSmrg    # scrape the xmlto version
2140d7ffce2aSmrg    AC_MSG_CHECKING([the xmlto version])
2141d7ffce2aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2142d7ffce2aSmrg    AC_MSG_RESULT([$xmlto_version])
2143d7ffce2aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2144d7ffce2aSmrg        [if test "x$use_xmlto" = xauto; then
2145d7ffce2aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2146d7ffce2aSmrg            have_xmlto=no
2147d7ffce2aSmrg        else
2148d7ffce2aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2149d7ffce2aSmrg        fi])
2150d7ffce2aSmrgfi])
2151d7ffce2aSmrg
2152d7ffce2aSmrg# Test for the ability of xmlto to generate a text target
2153d7ffce2aSmrghave_xmlto_text=no
2154d7ffce2aSmrgcat > conftest.xml << "EOF"
2155d7ffce2aSmrgEOF
2156d7ffce2aSmrgAS_IF([test "$have_xmlto" = yes],
2157d7ffce2aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2158d7ffce2aSmrg             [have_xmlto_text=yes],
2159d7ffce2aSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
2160d7ffce2aSmrgrm -f conftest.xml
2161d7ffce2aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2162d7ffce2aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2163d7ffce2aSmrg]) # XORG_WITH_XMLTO
2164d7ffce2aSmrg
21651c80d5b0Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
21661c80d5b0Smrg# --------------------------------------------
21671c80d5b0Smrg# Minimum version: 1.12.0
21681c80d5b0Smrg# Minimum version for optional DEFAULT argument: 1.12.0
2169d7ffce2aSmrg#
21701c80d5b0Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
21711c80d5b0Smrg# XML-based language used for the transformation of XML documents.
21721c80d5b0Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
21731c80d5b0Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
21741c80d5b0Smrg# The XSLT processor is often used as a standalone tool for transformations.
21751c80d5b0Smrg# It should not be assumed that this tool is used only to work with documnetation.
21761c80d5b0Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2177d7ffce2aSmrg#
2178d7ffce2aSmrg# Interface to module:
21791c80d5b0Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
21801c80d5b0Smrg# XSLTPROC:	 returns the path of the xsltproc program found
21811c80d5b0Smrg#		 returns the path set by the user in the environment
21821c80d5b0Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
21831c80d5b0Smrg#		  'no' user instructs the module not to use xsltproc
21841c80d5b0Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
21851c80d5b0Smrg#
21861c80d5b0Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
21871c80d5b0Smrg#
21881c80d5b0SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
21891c80d5b0SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
21901c80d5b0Smrg# Preserves the interface, should it be implemented later
21911c80d5b0Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
21921c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
21931c80d5b0SmrgAC_ARG_WITH(xsltproc,
21941c80d5b0Smrg	AS_HELP_STRING([--with-xsltproc],
21951c80d5b0Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
21961c80d5b0Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
21971c80d5b0Smrgm4_undefine([_defopt])
21981c80d5b0Smrg
21991c80d5b0Smrgif test "x$use_xsltproc" = x"auto"; then
22001c80d5b0Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
22011c80d5b0Smrg   if test "x$XSLTPROC" = "x"; then
22021c80d5b0Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
22031c80d5b0Smrg	have_xsltproc=no
22041c80d5b0Smrg   else
22051c80d5b0Smrg        have_xsltproc=yes
22061c80d5b0Smrg   fi
22071c80d5b0Smrgelif test "x$use_xsltproc" = x"yes" ; then
22081c80d5b0Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
22091c80d5b0Smrg   if test "x$XSLTPROC" = "x"; then
22101c80d5b0Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
22111c80d5b0Smrg   fi
22121c80d5b0Smrg   have_xsltproc=yes
22131c80d5b0Smrgelif test "x$use_xsltproc" = x"no" ; then
22141c80d5b0Smrg   if test "x$XSLTPROC" != "x"; then
22151c80d5b0Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
22161c80d5b0Smrg   fi
22171c80d5b0Smrg   have_xsltproc=no
22181c80d5b0Smrgelse
22191c80d5b0Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
22201c80d5b0Smrgfi
22211c80d5b0Smrg
22221c80d5b0SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
22231c80d5b0Smrg]) # XORG_WITH_XSLTPROC
22241c80d5b0Smrg
22251c80d5b0Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
22261c80d5b0Smrg# ----------------------------------------
22271c80d5b0Smrg# Minimum version: 1.15.0
22281c80d5b0Smrg#
22291c80d5b0Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
22301c80d5b0Smrg# scanning arbitrary text files, extracting information from those text files,
22311c80d5b0Smrg# and printing reports based on that information.
22321c80d5b0Smrg#
22331c80d5b0Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
22341c80d5b0Smrg#
22351c80d5b0Smrg# Interface to module:
22361c80d5b0Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
22371c80d5b0Smrg# PERL:	     returns the path of the perl program found
22381c80d5b0Smrg#	     returns the path set by the user in the environment
22391c80d5b0Smrg# --with-perl: 'yes' user instructs the module to use perl
22401c80d5b0Smrg#	       'no' user instructs the module not to use perl
22411c80d5b0Smrg# have_perl: returns yes if perl found in PATH or no
22421c80d5b0Smrg#
22431c80d5b0Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
22441c80d5b0Smrg#
22451c80d5b0SmrgAC_DEFUN([XORG_WITH_PERL],[
22461c80d5b0SmrgAC_ARG_VAR([PERL], [Path to perl command])
22471c80d5b0Smrg# Preserves the interface, should it be implemented later
22481c80d5b0Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
22491c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
22501c80d5b0SmrgAC_ARG_WITH(perl,
22511c80d5b0Smrg	AS_HELP_STRING([--with-perl],
22521c80d5b0Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
22531c80d5b0Smrg	   [use_perl=$withval], [use_perl=]_defopt)
22541c80d5b0Smrgm4_undefine([_defopt])
22551c80d5b0Smrg
22561c80d5b0Smrgif test "x$use_perl" = x"auto"; then
22571c80d5b0Smrg   AC_PATH_PROG([PERL], [perl])
22581c80d5b0Smrg   if test "x$PERL" = "x"; then
22591c80d5b0Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
22601c80d5b0Smrg	have_perl=no
22611c80d5b0Smrg   else
22621c80d5b0Smrg        have_perl=yes
22631c80d5b0Smrg   fi
22641c80d5b0Smrgelif test "x$use_perl" = x"yes" ; then
22651c80d5b0Smrg   AC_PATH_PROG([PERL], [perl])
22661c80d5b0Smrg   if test "x$PERL" = "x"; then
22671c80d5b0Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
22681c80d5b0Smrg   fi
22691c80d5b0Smrg   have_perl=yes
22701c80d5b0Smrgelif test "x$use_perl" = x"no" ; then
22711c80d5b0Smrg   if test "x$PERL" != "x"; then
22721c80d5b0Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
22731c80d5b0Smrg   fi
22741c80d5b0Smrg   have_perl=no
22751c80d5b0Smrgelse
22761c80d5b0Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
22771c80d5b0Smrgfi
22781c80d5b0Smrg
22791c80d5b0SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
22801c80d5b0Smrg]) # XORG_WITH_PERL
22811c80d5b0Smrg
22821c80d5b0Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
22831c80d5b0Smrg# ----------------
22841c80d5b0Smrg# Minimum version: 1.5.0
22851c80d5b0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22861c80d5b0Smrg#
22871c80d5b0Smrg# Documentation tools are not always available on all platforms and sometimes
22881c80d5b0Smrg# not at the appropriate level. This macro enables a module to test for the
22891c80d5b0Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22901c80d5b0Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
22911c80d5b0Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
22921c80d5b0Smrg# --with-asciidoc assumes 'auto'.
22931c80d5b0Smrg#
22941c80d5b0Smrg# Interface to module:
22951c80d5b0Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2296d7ffce2aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2297d7ffce2aSmrg#		 returns the path set by the user in the environment
2298d7ffce2aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2299d7ffce2aSmrg#		  'no' user instructs the module not to use asciidoc
2300d7ffce2aSmrg#
2301d7ffce2aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2302d7ffce2aSmrg#
2303d7ffce2aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2304d7ffce2aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2305d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2306d7ffce2aSmrgAC_ARG_WITH(asciidoc,
2307d7ffce2aSmrg	AS_HELP_STRING([--with-asciidoc],
2308d7ffce2aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2309d7ffce2aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2310d7ffce2aSmrgm4_undefine([_defopt])
2311d7ffce2aSmrg
2312d7ffce2aSmrgif test "x$use_asciidoc" = x"auto"; then
2313d7ffce2aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2314d7ffce2aSmrg   if test "x$ASCIIDOC" = "x"; then
2315d7ffce2aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2316d7ffce2aSmrg	have_asciidoc=no
2317d7ffce2aSmrg   else
2318d7ffce2aSmrg        have_asciidoc=yes
2319d7ffce2aSmrg   fi
2320d7ffce2aSmrgelif test "x$use_asciidoc" = x"yes" ; then
2321d7ffce2aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2322d7ffce2aSmrg   if test "x$ASCIIDOC" = "x"; then
2323d7ffce2aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2324d7ffce2aSmrg   fi
2325d7ffce2aSmrg   have_asciidoc=yes
2326d7ffce2aSmrgelif test "x$use_asciidoc" = x"no" ; then
2327d7ffce2aSmrg   if test "x$ASCIIDOC" != "x"; then
2328d7ffce2aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2329d7ffce2aSmrg   fi
2330d7ffce2aSmrg   have_asciidoc=no
2331d7ffce2aSmrgelse
2332d7ffce2aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2333d7ffce2aSmrgfi
2334d7ffce2aSmrgm4_ifval([$1],
2335d7ffce2aSmrg[if test "$have_asciidoc" = yes; then
2336d7ffce2aSmrg    # scrape the asciidoc version
2337d7ffce2aSmrg    AC_MSG_CHECKING([the asciidoc version])
2338d7ffce2aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2339d7ffce2aSmrg    AC_MSG_RESULT([$asciidoc_version])
2340d7ffce2aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2341d7ffce2aSmrg        [if test "x$use_asciidoc" = xauto; then
2342d7ffce2aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2343d7ffce2aSmrg            have_asciidoc=no
2344d7ffce2aSmrg        else
2345d7ffce2aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2346d7ffce2aSmrg        fi])
2347d7ffce2aSmrgfi])
2348d7ffce2aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2349d7ffce2aSmrg]) # XORG_WITH_ASCIIDOC
2350d7ffce2aSmrg
2351d7ffce2aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2352d7ffce2aSmrg# --------------------------------
2353d7ffce2aSmrg# Minimum version: 1.5.0
2354d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2355d7ffce2aSmrg#
2356d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2357d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2358d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2359d7ffce2aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
2360d7ffce2aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2361d7ffce2aSmrg# --with-doxygen assumes 'auto'.
2362d7ffce2aSmrg#
2363d7ffce2aSmrg# Interface to module:
2364d7ffce2aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2365d7ffce2aSmrg# DOXYGEN:	 returns the path of the doxygen program found
2366d7ffce2aSmrg#		 returns the path set by the user in the environment
2367d7ffce2aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2368d7ffce2aSmrg#		  'no' user instructs the module not to use doxygen
2369d7ffce2aSmrg#
2370d7ffce2aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2371d7ffce2aSmrg#
2372d7ffce2aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2373d7ffce2aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2374d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2375d7ffce2aSmrgAC_ARG_WITH(doxygen,
2376d7ffce2aSmrg	AS_HELP_STRING([--with-doxygen],
2377d7ffce2aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2378d7ffce2aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2379d7ffce2aSmrgm4_undefine([_defopt])
2380d7ffce2aSmrg
2381d7ffce2aSmrgif test "x$use_doxygen" = x"auto"; then
2382d7ffce2aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2383d7ffce2aSmrg   if test "x$DOXYGEN" = "x"; then
2384d7ffce2aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2385d7ffce2aSmrg	have_doxygen=no
2386d7ffce2aSmrg   else
2387d7ffce2aSmrg        have_doxygen=yes
2388d7ffce2aSmrg   fi
2389d7ffce2aSmrgelif test "x$use_doxygen" = x"yes" ; then
2390d7ffce2aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2391d7ffce2aSmrg   if test "x$DOXYGEN" = "x"; then
2392d7ffce2aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2393d7ffce2aSmrg   fi
2394d7ffce2aSmrg   have_doxygen=yes
2395d7ffce2aSmrgelif test "x$use_doxygen" = x"no" ; then
2396d7ffce2aSmrg   if test "x$DOXYGEN" != "x"; then
2397d7ffce2aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2398d7ffce2aSmrg   fi
2399d7ffce2aSmrg   have_doxygen=no
2400d7ffce2aSmrgelse
2401d7ffce2aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2402d7ffce2aSmrgfi
2403d7ffce2aSmrgm4_ifval([$1],
2404d7ffce2aSmrg[if test "$have_doxygen" = yes; then
2405d7ffce2aSmrg    # scrape the doxygen version
2406d7ffce2aSmrg    AC_MSG_CHECKING([the doxygen version])
2407d7ffce2aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2408d7ffce2aSmrg    AC_MSG_RESULT([$doxygen_version])
2409d7ffce2aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2410d7ffce2aSmrg        [if test "x$use_doxygen" = xauto; then
2411d7ffce2aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2412d7ffce2aSmrg            have_doxygen=no
2413d7ffce2aSmrg        else
2414d7ffce2aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2415d7ffce2aSmrg        fi])
2416d7ffce2aSmrgfi])
2417d7ffce2aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2418d7ffce2aSmrg]) # XORG_WITH_DOXYGEN
2419d7ffce2aSmrg
2420d7ffce2aSmrg# XORG_WITH_GROFF([DEFAULT])
2421d7ffce2aSmrg# ----------------
2422d7ffce2aSmrg# Minimum version: 1.6.0
2423d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2424d7ffce2aSmrg#
2425d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2426d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2427d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2428d7ffce2aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2429d7ffce2aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2430d7ffce2aSmrg# --with-groff assumes 'auto'.
2431d7ffce2aSmrg#
2432d7ffce2aSmrg# Interface to module:
2433d7ffce2aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2434d7ffce2aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2435d7ffce2aSmrg# HAVE_GROFF_MS: the -ms macros package
2436d7ffce2aSmrg# GROFF:	 returns the path of the groff program found
2437d7ffce2aSmrg#		 returns the path set by the user in the environment
2438d7ffce2aSmrg# --with-groff:	 'yes' user instructs the module to use groff
2439d7ffce2aSmrg#		 'no' user instructs the module not to use groff
2440d7ffce2aSmrg#
2441d7ffce2aSmrg# Added in version 1.9.0:
2442d7ffce2aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2443d7ffce2aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2444d7ffce2aSmrg#		   psselect from the psutils package.
2445d7ffce2aSmrg#		   the ghostcript package. Refer to the grohtml man pages
2446d7ffce2aSmrg#
2447d7ffce2aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2448d7ffce2aSmrg#
2449d7ffce2aSmrg# OS and distros often splits groff in a basic and full package, the former
2450d7ffce2aSmrg# having the groff program and the later having devices, fonts and macros
2451d7ffce2aSmrg# Checking for the groff executable is not enough.
2452d7ffce2aSmrg#
2453d7ffce2aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2454d7ffce2aSmrg# unset HAVE_GROFF or GROFF env variables.
2455d7ffce2aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2456d7ffce2aSmrg#
2457d7ffce2aSmrgAC_DEFUN([XORG_WITH_GROFF],[
2458d7ffce2aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2459d7ffce2aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2460d7ffce2aSmrgAC_ARG_WITH(groff,
2461d7ffce2aSmrg	AS_HELP_STRING([--with-groff],
2462d7ffce2aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2463d7ffce2aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2464d7ffce2aSmrgm4_undefine([_defopt])
2465d7ffce2aSmrg
2466d7ffce2aSmrgif test "x$use_groff" = x"auto"; then
2467d7ffce2aSmrg   AC_PATH_PROG([GROFF], [groff])
2468d7ffce2aSmrg   if test "x$GROFF" = "x"; then
2469d7ffce2aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2470d7ffce2aSmrg	have_groff=no
2471d7ffce2aSmrg   else
2472d7ffce2aSmrg        have_groff=yes
2473d7ffce2aSmrg   fi
2474d7ffce2aSmrgelif test "x$use_groff" = x"yes" ; then
2475d7ffce2aSmrg   AC_PATH_PROG([GROFF], [groff])
2476d7ffce2aSmrg   if test "x$GROFF" = "x"; then
2477d7ffce2aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2478d7ffce2aSmrg   fi
2479d7ffce2aSmrg   have_groff=yes
2480d7ffce2aSmrgelif test "x$use_groff" = x"no" ; then
2481d7ffce2aSmrg   if test "x$GROFF" != "x"; then
2482d7ffce2aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2483d7ffce2aSmrg   fi
2484d7ffce2aSmrg   have_groff=no
2485d7ffce2aSmrgelse
2486d7ffce2aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2487d7ffce2aSmrgfi
2488d7ffce2aSmrg
2489d7ffce2aSmrg# We have groff, test for the presence of the macro packages
2490d7ffce2aSmrgif test "x$have_groff" = x"yes"; then
2491d7ffce2aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2492d7ffce2aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2493d7ffce2aSmrg        groff_ms_works=yes
2494d7ffce2aSmrg    else
2495d7ffce2aSmrg        groff_ms_works=no
2496d7ffce2aSmrg    fi
2497d7ffce2aSmrg    AC_MSG_RESULT([$groff_ms_works])
2498d7ffce2aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2499d7ffce2aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2500d7ffce2aSmrg        groff_mm_works=yes
2501d7ffce2aSmrg    else
2502d7ffce2aSmrg        groff_mm_works=no
2503d7ffce2aSmrg    fi
2504d7ffce2aSmrg    AC_MSG_RESULT([$groff_mm_works])
2505d7ffce2aSmrgfi
2506d7ffce2aSmrg
2507d7ffce2aSmrg# We have groff, test for HTML dependencies, one command per package
2508d7ffce2aSmrgif test "x$have_groff" = x"yes"; then
2509d7ffce2aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2510d7ffce2aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2511d7ffce2aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2512d7ffce2aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2513d7ffce2aSmrg      have_groff_html=yes
2514d7ffce2aSmrg   else
2515d7ffce2aSmrg      have_groff_html=no
2516d7ffce2aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2517d7ffce2aSmrg   fi
2518d7ffce2aSmrgfi
2519d7ffce2aSmrg
2520d7ffce2aSmrg# Set Automake conditionals for Makefiles
2521d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2522d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2523d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2524d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2525d7ffce2aSmrg]) # XORG_WITH_GROFF
2526d7ffce2aSmrg
25271c80d5b0Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
25281c80d5b0Smrg# ---------------------------------------
2529d7ffce2aSmrg# Minimum version: 1.6.0
2530d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
25311c80d5b0Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2532d7ffce2aSmrg#
2533d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2534d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2535d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2536d7ffce2aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2537d7ffce2aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2538d7ffce2aSmrg# --with-fop assumes 'auto'.
2539d7ffce2aSmrg#
2540d7ffce2aSmrg# Interface to module:
2541d7ffce2aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2542d7ffce2aSmrg# FOP:	 	returns the path of the fop program found
2543d7ffce2aSmrg#		returns the path set by the user in the environment
2544d7ffce2aSmrg# --with-fop: 	'yes' user instructs the module to use fop
2545d7ffce2aSmrg#		'no' user instructs the module not to use fop
2546d7ffce2aSmrg#
2547d7ffce2aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2548d7ffce2aSmrg#
2549d7ffce2aSmrgAC_DEFUN([XORG_WITH_FOP],[
2550d7ffce2aSmrgAC_ARG_VAR([FOP], [Path to fop command])
25511c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
2552d7ffce2aSmrgAC_ARG_WITH(fop,
2553d7ffce2aSmrg	AS_HELP_STRING([--with-fop],
2554d7ffce2aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2555d7ffce2aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2556d7ffce2aSmrgm4_undefine([_defopt])
2557d7ffce2aSmrg
2558d7ffce2aSmrgif test "x$use_fop" = x"auto"; then
2559d7ffce2aSmrg   AC_PATH_PROG([FOP], [fop])
2560d7ffce2aSmrg   if test "x$FOP" = "x"; then
2561d7ffce2aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2562d7ffce2aSmrg	have_fop=no
2563d7ffce2aSmrg   else
2564d7ffce2aSmrg        have_fop=yes
2565d7ffce2aSmrg   fi
2566d7ffce2aSmrgelif test "x$use_fop" = x"yes" ; then
2567d7ffce2aSmrg   AC_PATH_PROG([FOP], [fop])
2568d7ffce2aSmrg   if test "x$FOP" = "x"; then
2569d7ffce2aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2570d7ffce2aSmrg   fi
2571d7ffce2aSmrg   have_fop=yes
2572d7ffce2aSmrgelif test "x$use_fop" = x"no" ; then
2573d7ffce2aSmrg   if test "x$FOP" != "x"; then
2574d7ffce2aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2575d7ffce2aSmrg   fi
2576d7ffce2aSmrg   have_fop=no
2577d7ffce2aSmrgelse
2578d7ffce2aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2579d7ffce2aSmrgfi
25801c80d5b0Smrg
25811c80d5b0Smrg# Test for a minimum version of fop, if provided.
25821c80d5b0Smrgm4_ifval([$1],
25831c80d5b0Smrg[if test "$have_fop" = yes; then
25841c80d5b0Smrg    # scrape the fop version
25851c80d5b0Smrg    AC_MSG_CHECKING([for fop minimum version])
25861c80d5b0Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
25871c80d5b0Smrg    AC_MSG_RESULT([$fop_version])
25881c80d5b0Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
25891c80d5b0Smrg        [if test "x$use_fop" = xauto; then
25901c80d5b0Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
25911c80d5b0Smrg            have_fop=no
25921c80d5b0Smrg        else
25931c80d5b0Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
25941c80d5b0Smrg        fi])
25951c80d5b0Smrgfi])
2596d7ffce2aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2597d7ffce2aSmrg]) # XORG_WITH_FOP
2598d7ffce2aSmrg
2599d7ffce2aSmrg# XORG_WITH_PS2PDF([DEFAULT])
2600d7ffce2aSmrg# ----------------
2601d7ffce2aSmrg# Minimum version: 1.6.0
2602d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2603d7ffce2aSmrg#
2604d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2605d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2606d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2607d7ffce2aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2608d7ffce2aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2609d7ffce2aSmrg# --with-ps2pdf assumes 'auto'.
2610d7ffce2aSmrg#
2611d7ffce2aSmrg# Interface to module:
2612d7ffce2aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2613d7ffce2aSmrg# PS2PDF:	returns the path of the ps2pdf program found
2614d7ffce2aSmrg#		returns the path set by the user in the environment
2615d7ffce2aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2616d7ffce2aSmrg#		 'no' user instructs the module not to use ps2pdf
2617d7ffce2aSmrg#
2618d7ffce2aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2619d7ffce2aSmrg#
2620d7ffce2aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2621d7ffce2aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2622d7ffce2aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2623d7ffce2aSmrgAC_ARG_WITH(ps2pdf,
2624d7ffce2aSmrg	AS_HELP_STRING([--with-ps2pdf],
2625d7ffce2aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2626d7ffce2aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2627d7ffce2aSmrgm4_undefine([_defopt])
2628d7ffce2aSmrg
2629d7ffce2aSmrgif test "x$use_ps2pdf" = x"auto"; then
2630d7ffce2aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2631d7ffce2aSmrg   if test "x$PS2PDF" = "x"; then
2632d7ffce2aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2633d7ffce2aSmrg	have_ps2pdf=no
2634d7ffce2aSmrg   else
2635d7ffce2aSmrg        have_ps2pdf=yes
2636d7ffce2aSmrg   fi
2637d7ffce2aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2638d7ffce2aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2639d7ffce2aSmrg   if test "x$PS2PDF" = "x"; then
2640d7ffce2aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2641d7ffce2aSmrg   fi
2642d7ffce2aSmrg   have_ps2pdf=yes
2643d7ffce2aSmrgelif test "x$use_ps2pdf" = x"no" ; then
2644d7ffce2aSmrg   if test "x$PS2PDF" != "x"; then
2645d7ffce2aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2646d7ffce2aSmrg   fi
2647d7ffce2aSmrg   have_ps2pdf=no
2648d7ffce2aSmrgelse
2649d7ffce2aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2650d7ffce2aSmrgfi
2651d7ffce2aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2652d7ffce2aSmrg]) # XORG_WITH_PS2PDF
2653d7ffce2aSmrg
2654d7ffce2aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2655d7ffce2aSmrg# ----------------
2656d7ffce2aSmrg# Minimum version: 1.6.0
2657d7ffce2aSmrg#
2658d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2659d7ffce2aSmrg# not at the appropriate level. This macro enables a builder to skip all
2660d7ffce2aSmrg# documentation targets except traditional man pages.
2661d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2662d7ffce2aSmrg# maximum flexibilty in controlling documentation building.
2663d7ffce2aSmrg# Refer to:
2664d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2665d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2666d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2667d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2668d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2669d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2670d7ffce2aSmrg#
2671d7ffce2aSmrg# Interface to module:
2672d7ffce2aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2673d7ffce2aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2674d7ffce2aSmrg#		 'no' user instructs the module not to generate docs
2675d7ffce2aSmrg# parm1:	specify the default value, yes or no.
2676d7ffce2aSmrg#
2677d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2678d7ffce2aSmrgm4_define([docs_default], m4_default([$1], [yes]))
2679d7ffce2aSmrgAC_ARG_ENABLE(docs,
2680d7ffce2aSmrg	AS_HELP_STRING([--enable-docs],
2681d7ffce2aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2682d7ffce2aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2683d7ffce2aSmrgm4_undefine([docs_default])
2684d7ffce2aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2685d7ffce2aSmrgAC_MSG_CHECKING([whether to build documentation])
2686d7ffce2aSmrgAC_MSG_RESULT([$build_docs])
2687d7ffce2aSmrg]) # XORG_ENABLE_DOCS
2688d7ffce2aSmrg
2689d7ffce2aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2690d7ffce2aSmrg# ----------------
2691d7ffce2aSmrg# Minimum version: 1.6.0
2692d7ffce2aSmrg#
2693d7ffce2aSmrg# This macro enables a builder to skip all developer documentation.
2694d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2695d7ffce2aSmrg# maximum flexibilty in controlling documentation building.
2696d7ffce2aSmrg# Refer to:
2697d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2698d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2699d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2700d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2701d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2702d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2703d7ffce2aSmrg#
2704d7ffce2aSmrg# Interface to module:
2705d7ffce2aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2706d7ffce2aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2707d7ffce2aSmrg#			'no' user instructs the module not to generate developer docs
2708d7ffce2aSmrg# parm1:		specify the default value, yes or no.
2709d7ffce2aSmrg#
2710d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2711d7ffce2aSmrgm4_define([devel_default], m4_default([$1], [yes]))
2712d7ffce2aSmrgAC_ARG_ENABLE(devel-docs,
2713d7ffce2aSmrg	AS_HELP_STRING([--enable-devel-docs],
2714d7ffce2aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2715d7ffce2aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2716d7ffce2aSmrgm4_undefine([devel_default])
2717d7ffce2aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2718d7ffce2aSmrgAC_MSG_CHECKING([whether to build developer documentation])
2719d7ffce2aSmrgAC_MSG_RESULT([$build_devel_docs])
2720d7ffce2aSmrg]) # XORG_ENABLE_DEVEL_DOCS
2721d7ffce2aSmrg
2722d7ffce2aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2723d7ffce2aSmrg# ----------------
2724d7ffce2aSmrg# Minimum version: 1.6.0
2725d7ffce2aSmrg#
2726d7ffce2aSmrg# This macro enables a builder to skip all functional specification targets.
2727d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2728d7ffce2aSmrg# maximum flexibilty in controlling documentation building.
2729d7ffce2aSmrg# Refer to:
2730d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2731d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2732d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2733d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2734d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2735d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2736d7ffce2aSmrg#
2737d7ffce2aSmrg# Interface to module:
2738d7ffce2aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2739d7ffce2aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2740d7ffce2aSmrg#			'no' user instructs the module not to generate specs
2741d7ffce2aSmrg# parm1:		specify the default value, yes or no.
2742d7ffce2aSmrg#
2743d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2744d7ffce2aSmrgm4_define([spec_default], m4_default([$1], [yes]))
2745d7ffce2aSmrgAC_ARG_ENABLE(specs,
2746d7ffce2aSmrg	AS_HELP_STRING([--enable-specs],
2747d7ffce2aSmrg	   [Enable building the specs (default: ]spec_default[)]),
2748d7ffce2aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2749d7ffce2aSmrgm4_undefine([spec_default])
2750d7ffce2aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2751d7ffce2aSmrgAC_MSG_CHECKING([whether to build functional specifications])
2752d7ffce2aSmrgAC_MSG_RESULT([$build_specs])
2753d7ffce2aSmrg]) # XORG_ENABLE_SPECS
2754d7ffce2aSmrg
27551c80d5b0Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
27561c80d5b0Smrg# ----------------------------------------------
27571c80d5b0Smrg# Minimum version: 1.13.0
27581c80d5b0Smrg#
27591c80d5b0Smrg# This macro enables a builder to enable/disable unit testing
27601c80d5b0Smrg# It makes no assumption about the test cases implementation
27611c80d5b0Smrg# Test cases may or may not use Automake "Support for test suites"
27621c80d5b0Smrg# They may or may not use the software utility library GLib
27631c80d5b0Smrg#
27641c80d5b0Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
27651c80d5b0Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
27661c80d5b0Smrg# The variable enable_unit_tests is used by other macros in this file.
27671c80d5b0Smrg#
27681c80d5b0Smrg# Interface to module:
27691c80d5b0Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
27701c80d5b0Smrg# enable_unit_tests:    used in configure.ac for additional configuration
27711c80d5b0Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
27721c80d5b0Smrg#			'no' user instructs the module not to build tests
27731c80d5b0Smrg# parm1:		specify the default value, yes or no.
27741c80d5b0Smrg#
27751c80d5b0SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
27761c80d5b0SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
27771c80d5b0SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
27781c80d5b0SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
27791c80d5b0Smrgm4_define([_defopt], m4_default([$1], [auto]))
27801c80d5b0SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
27811c80d5b0Smrg	[Enable building unit test cases (default: ]_defopt[)]),
27821c80d5b0Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
27831c80d5b0Smrgm4_undefine([_defopt])
27841c80d5b0SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
27851c80d5b0SmrgAC_MSG_CHECKING([whether to build unit test cases])
27861c80d5b0SmrgAC_MSG_RESULT([$enable_unit_tests])
27871c80d5b0Smrg]) # XORG_ENABLE_UNIT_TESTS
27881c80d5b0Smrg
27891c80d5b0Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
27901c80d5b0Smrg# ------------------------------------------------------
27911c80d5b0Smrg# Minimum version: 1.17.0
27921c80d5b0Smrg#
27931c80d5b0Smrg# This macro enables a builder to enable/disable integration testing
27941c80d5b0Smrg# It makes no assumption about the test cases' implementation
27951c80d5b0Smrg# Test cases may or may not use Automake "Support for test suites"
27961c80d5b0Smrg#
27971c80d5b0Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
27981c80d5b0Smrg# usually requires less dependencies and may be built and run under less
27991c80d5b0Smrg# stringent environments than integration tests.
28001c80d5b0Smrg#
28011c80d5b0Smrg# Interface to module:
28021c80d5b0Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
28031c80d5b0Smrg# enable_integration_tests:   used in configure.ac for additional configuration
28041c80d5b0Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
28051c80d5b0Smrg#                             'no' user instructs the module not to build tests
28061c80d5b0Smrg# parm1:                      specify the default value, yes or no.
28071c80d5b0Smrg#
28081c80d5b0SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
28091c80d5b0SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
28101c80d5b0Smrgm4_define([_defopt], m4_default([$1], [auto]))
28111c80d5b0SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
28121c80d5b0Smrg	[Enable building integration test cases (default: ]_defopt[)]),
28131c80d5b0Smrg	[enable_integration_tests=$enableval],
28141c80d5b0Smrg	[enable_integration_tests=]_defopt)
28151c80d5b0Smrgm4_undefine([_defopt])
28161c80d5b0SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
28171c80d5b0Smrg	[test "x$enable_integration_tests" != xno])
28181c80d5b0SmrgAC_MSG_CHECKING([whether to build unit test cases])
28191c80d5b0SmrgAC_MSG_RESULT([$enable_integration_tests])
28201c80d5b0Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
28211c80d5b0Smrg
28221c80d5b0Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
28231c80d5b0Smrg# ----------------------------------------
28241c80d5b0Smrg# Minimum version: 1.13.0
28251c80d5b0Smrg#
28261c80d5b0Smrg# GLib is a library which provides advanced data structures and functions.
28271c80d5b0Smrg# This macro enables a module to test for the presence of Glib.
28281c80d5b0Smrg#
28291c80d5b0Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
28301c80d5b0Smrg# Otherwise the value of $enable_unit_tests is blank.
28311c80d5b0Smrg#
28321c80d5b0Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
28331c80d5b0Smrg# test support usually requires less dependencies and may be built and run under
28341c80d5b0Smrg# less stringent environments than integration tests.
28351c80d5b0Smrg#
28361c80d5b0Smrg# Interface to module:
28371c80d5b0Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
28381c80d5b0Smrg# with_glib: used in configure.ac to know if GLib has been found
28391c80d5b0Smrg# --with-glib:	'yes' user instructs the module to use glib
28401c80d5b0Smrg#		'no' user instructs the module not to use glib
28411c80d5b0Smrg#
28421c80d5b0SmrgAC_DEFUN([XORG_WITH_GLIB],[
28431c80d5b0SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
28441c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
28451c80d5b0SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
28461c80d5b0Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
28471c80d5b0Smrg	[with_glib=$withval], [with_glib=]_defopt)
28481c80d5b0Smrgm4_undefine([_defopt])
28491c80d5b0Smrg
28501c80d5b0Smrghave_glib=no
28511c80d5b0Smrg# Do not probe GLib if user explicitly disabled unit testing
28521c80d5b0Smrgif test "x$enable_unit_tests" != x"no"; then
28531c80d5b0Smrg  # Do not probe GLib if user explicitly disabled it
28541c80d5b0Smrg  if test "x$with_glib" != x"no"; then
28551c80d5b0Smrg    m4_ifval(
28561c80d5b0Smrg      [$1],
28571c80d5b0Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
28581c80d5b0Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
28591c80d5b0Smrg    )
28601c80d5b0Smrg  fi
28611c80d5b0Smrgfi
28621c80d5b0Smrg
28631c80d5b0Smrg# Not having GLib when unit testing has been explicitly requested is an error
28641c80d5b0Smrgif test "x$enable_unit_tests" = x"yes"; then
28651c80d5b0Smrg  if test "x$have_glib" = x"no"; then
28661c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
28671c80d5b0Smrg  fi
28681c80d5b0Smrgfi
28691c80d5b0Smrg
28701c80d5b0Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
28711c80d5b0Smrgif test "x$enable_unit_tests" = x"no"; then
28721c80d5b0Smrg  if test "x$with_glib" = x"yes"; then
28731c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
28741c80d5b0Smrg  fi
28751c80d5b0Smrgfi
28761c80d5b0Smrg
28771c80d5b0Smrg# Not having GLib when it has been explicitly requested is an error
28781c80d5b0Smrgif test "x$with_glib" = x"yes"; then
28791c80d5b0Smrg  if test "x$have_glib" = x"no"; then
28801c80d5b0Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
28811c80d5b0Smrg  fi
28821c80d5b0Smrgfi
28831c80d5b0Smrg
28841c80d5b0SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
28851c80d5b0Smrg]) # XORG_WITH_GLIB
28861c80d5b0Smrg
28871c80d5b0Smrg# XORG_LD_WRAP([required|optional])
28881c80d5b0Smrg# ---------------------------------
28891c80d5b0Smrg# Minimum version: 1.13.0
28901c80d5b0Smrg#
28911c80d5b0Smrg# Check if linker supports -wrap, passed via compiler flags
28921c80d5b0Smrg#
28931c80d5b0Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
28941c80d5b0Smrg# Otherwise the value of $enable_unit_tests is blank.
28951c80d5b0Smrg#
28961c80d5b0Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
28971c80d5b0Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
28981c80d5b0Smrg# available, an argument of "optional" allows use when some unit tests require
28991c80d5b0Smrg# ld -wrap and others do not.
29001c80d5b0Smrg#
29011c80d5b0SmrgAC_DEFUN([XORG_LD_WRAP],[
29021c80d5b0SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
29031c80d5b0Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
29041c80d5b0Smrg                      void __wrap_exit(int status) { return; }],
29051c80d5b0Smrg                     [exit(0);])])
29061c80d5b0Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
29071c80d5b0Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
29081c80d5b0Smrg  if test "x$have_ld_wrap" = x"no"; then
29091c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
29101c80d5b0Smrg  fi
29111c80d5b0Smrgfi
29121c80d5b0SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
29131c80d5b0Smrg#
29141c80d5b0Smrg]) # XORG_LD_WRAP
29151c80d5b0Smrg
29161c80d5b0Smrg# XORG_CHECK_LINKER_FLAGS
29171c80d5b0Smrg# -----------------------
29181c80d5b0Smrg# SYNOPSIS
29191c80d5b0Smrg#
29201c80d5b0Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
29211c80d5b0Smrg#
29221c80d5b0Smrg# DESCRIPTION
29231c80d5b0Smrg#
29241c80d5b0Smrg#   Check whether the given linker FLAGS work with the current language's
29251c80d5b0Smrg#   linker, or whether they give an error.
29261c80d5b0Smrg#
29271c80d5b0Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
29281c80d5b0Smrg#   success/failure.
29291c80d5b0Smrg#
29301c80d5b0Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
29311c80d5b0Smrg#
29321c80d5b0Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
29331c80d5b0Smrg#
29341c80d5b0Smrg# LICENSE
29351c80d5b0Smrg#
29361c80d5b0Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
29371c80d5b0Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
29381c80d5b0Smrg#   Copyright (c) 2009 Matteo Frigo
29391c80d5b0Smrg#
29401c80d5b0Smrg#   This program is free software: you can redistribute it and/or modify it
29411c80d5b0Smrg#   under the terms of the GNU General Public License as published by the
29421c80d5b0Smrg#   Free Software Foundation, either version 3 of the License, or (at your
29431c80d5b0Smrg#   option) any later version.
29441c80d5b0Smrg#
29451c80d5b0Smrg#   This program is distributed in the hope that it will be useful, but
29461c80d5b0Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
29471c80d5b0Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
29481c80d5b0Smrg#   Public License for more details.
29491c80d5b0Smrg#
29501c80d5b0Smrg#   You should have received a copy of the GNU General Public License along
29511c80d5b0Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
29521c80d5b0Smrg#
29531c80d5b0Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
29541c80d5b0Smrg#   gives unlimited permission to copy, distribute and modify the configure
29551c80d5b0Smrg#   scripts that are the output of Autoconf when processing the Macro. You
29561c80d5b0Smrg#   need not follow the terms of the GNU General Public License when using
29571c80d5b0Smrg#   or distributing such scripts, even though portions of the text of the
29581c80d5b0Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
29591c80d5b0Smrg#   all other use of the material that constitutes the Autoconf Macro.
29601c80d5b0Smrg#
29611c80d5b0Smrg#   This special exception to the GPL applies to versions of the Autoconf
29621c80d5b0Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
29631c80d5b0Smrg#   modified version of the Autoconf Macro, you may extend this special
29641c80d5b0Smrg#   exception to the GPL to apply to your modified version as well.#
29651c80d5b0SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
29661c80d5b0Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
29671c80d5b0Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
29681c80d5b0SmrgAS_LITERAL_IF([$1],
29691c80d5b0Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
29701c80d5b0Smrg      ax_save_FLAGS=$LDFLAGS
29711c80d5b0Smrg      LDFLAGS="$1"
29721c80d5b0Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
29731c80d5b0Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
29741c80d5b0Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
29751c80d5b0Smrg      LDFLAGS=$ax_save_FLAGS])],
29761c80d5b0Smrg  [ax_save_FLAGS=$LDFLAGS
29771c80d5b0Smrg   LDFLAGS="$1"
29781c80d5b0Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
29791c80d5b0Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
29801c80d5b0Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
29811c80d5b0Smrg   LDFLAGS=$ax_save_FLAGS])
29821c80d5b0Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
29831c80d5b0SmrgAC_MSG_RESULT($xorg_check_linker_flags)
29841c80d5b0Smrgif test "x$xorg_check_linker_flags" = xyes; then
29851c80d5b0Smrg	m4_default([$2], :)
29861c80d5b0Smrgelse
29871c80d5b0Smrg	m4_default([$3], :)
29881c80d5b0Smrgfi
29891c80d5b0Smrg]) # XORG_CHECK_LINKER_FLAGS
29901c80d5b0Smrg
29911c80d5b0Smrg# XORG_MEMORY_CHECK_FLAGS
29921c80d5b0Smrg# -----------------------
29931c80d5b0Smrg# Minimum version: 1.16.0
29941c80d5b0Smrg#
29951c80d5b0Smrg# This macro attempts to find appropriate memory checking functionality
29961c80d5b0Smrg# for various platforms which unit testing code may use to catch various
29971c80d5b0Smrg# forms of memory allocation and access errors in testing.
29981c80d5b0Smrg#
29991c80d5b0Smrg# Interface to module:
30001c80d5b0Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
30011c80d5b0Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
30021c80d5b0Smrg#
30031c80d5b0Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
30041c80d5b0Smrg#
30051c80d5b0SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
30061c80d5b0Smrg
30071c80d5b0SmrgAC_REQUIRE([AC_CANONICAL_HOST])
30081c80d5b0SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
30091c80d5b0Smrg           [Environment variables to enable memory checking in tests])
30101c80d5b0Smrg
30111c80d5b0Smrg# Check for different types of support on different platforms
30121c80d5b0Smrgcase $host_os in
30131c80d5b0Smrg    solaris*)
30141c80d5b0Smrg        AC_CHECK_LIB([umem], [umem_alloc],
30151c80d5b0Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
30161c80d5b0Smrg        ;;
30171c80d5b0Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
30181c80d5b0Smrg        # both directly and inverted, so should not be 0 or 255.
30191c80d5b0Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
30201c80d5b0Smrg        ;;
30211c80d5b0Smrg    darwin*)
30221c80d5b0Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
30231c80d5b0Smrg        ;;
30241c80d5b0Smrg    *bsd*)
30251c80d5b0Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
30261c80d5b0Smrg        ;;
30271c80d5b0Smrgesac
30281c80d5b0Smrg
30291c80d5b0Smrg# User supplied flags override default flags
30301c80d5b0Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
30311c80d5b0Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
30321c80d5b0Smrgfi
30331c80d5b0Smrg
30341c80d5b0SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
30351c80d5b0Smrg]) # XORG_WITH_LINT
30361c80d5b0Smrg
30374c61c93dSmrg# XORG_CHECK_MALLOC_ZERO
30384c61c93dSmrg# ----------------------
30394c61c93dSmrg# Minimum version: 1.0.0
30404c61c93dSmrg#
30414c61c93dSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
30424c61c93dSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
30434c61c93dSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
30444c61c93dSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
30454c61c93dSmrgAC_ARG_ENABLE(malloc0returnsnull,
30464c61c93dSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
30474c61c93dSmrg		       [malloc(0) returns NULL (default: auto)]),
30484c61c93dSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
30494c61c93dSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
30504c61c93dSmrg
30514c61c93dSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
30524c61c93dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
3053d7ffce2aSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
3054d7ffce2aSmrg#include <stdlib.h>
3055d7ffce2aSmrg],[
30564c61c93dSmrg    char *m0, *r0, *c0, *p;
30574c61c93dSmrg    m0 = malloc(0);
30584c61c93dSmrg    p = malloc(10);
30594c61c93dSmrg    r0 = realloc(p,0);
3060d7ffce2aSmrg    c0 = calloc(0,10);
3061d7ffce2aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
3062d7ffce2aSmrg])],
30634c61c93dSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
3064d7ffce2aSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
3065d7ffce2aSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
30664c61c93dSmrgfi
30674c61c93dSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
30684c61c93dSmrg
30694c61c93dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
30704c61c93dSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
30714c61c93dSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
30724c61c93dSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
30734c61c93dSmrgelse
30744c61c93dSmrg	MALLOC_ZERO_CFLAGS=""
30754c61c93dSmrg	XMALLOC_ZERO_CFLAGS=""
30764c61c93dSmrg	XTMALLOC_ZERO_CFLAGS=""
30774c61c93dSmrgfi
30784c61c93dSmrg
30794c61c93dSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
30804c61c93dSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
30814c61c93dSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
30824c61c93dSmrg]) # XORG_CHECK_MALLOC_ZERO
30834c61c93dSmrg
30844c61c93dSmrg# XORG_WITH_LINT()
30854c61c93dSmrg# ----------------
30864c61c93dSmrg# Minimum version: 1.1.0
30874c61c93dSmrg#
3088d7ffce2aSmrg# This macro enables the use of a tool that flags some suspicious and
3089d7ffce2aSmrg# non-portable constructs (likely to be bugs) in C language source code.
3090d7ffce2aSmrg# It will attempt to locate the tool and use appropriate options.
3091d7ffce2aSmrg# There are various lint type tools on different platforms.
3092d7ffce2aSmrg#
3093d7ffce2aSmrg# Interface to module:
3094d7ffce2aSmrg# LINT:		returns the path to the tool found on the platform
3095d7ffce2aSmrg#		or the value set to LINT on the configure cmd line
3096d7ffce2aSmrg#		also an Automake conditional
3097d7ffce2aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
3098d7ffce2aSmrg#
3099d7ffce2aSmrg# --with-lint:	'yes' user instructs the module to use lint
3100d7ffce2aSmrg#		'no' user instructs the module not to use lint (default)
3101d7ffce2aSmrg#
3102d7ffce2aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3103d7ffce2aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
31044c61c93dSmrg#
31054c61c93dSmrgAC_DEFUN([XORG_WITH_LINT],[
31064c61c93dSmrg
3107d7ffce2aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3108d7ffce2aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
31094c61c93dSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
31104c61c93dSmrg		[Use a lint-style source code checker (default: disabled)])],
31114c61c93dSmrg		[use_lint=$withval], [use_lint=no])
3112d7ffce2aSmrg
3113d7ffce2aSmrg# Obtain platform specific info like program name and options
3114d7ffce2aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3115d7ffce2aSmrgcase $host_os in
3116d7ffce2aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3117d7ffce2aSmrg	lint_name=splint
3118d7ffce2aSmrg	lint_options="-badflag"
3119d7ffce2aSmrg	;;
3120d7ffce2aSmrg  *freebsd* | *netbsd*)
3121d7ffce2aSmrg	lint_name=lint
3122d7ffce2aSmrg	lint_options="-u -b"
3123d7ffce2aSmrg	;;
3124d7ffce2aSmrg  *solaris*)
3125d7ffce2aSmrg	lint_name=lint
3126d7ffce2aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3127d7ffce2aSmrg	;;
3128d7ffce2aSmrgesac
3129d7ffce2aSmrg
3130d7ffce2aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3131d7ffce2aSmrgif test "x$use_lint" = x"yes" ; then
3132d7ffce2aSmrg   AC_PATH_PROG([LINT], [$lint_name])
3133d7ffce2aSmrg   if test "x$LINT" = "x"; then
3134d7ffce2aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3135d7ffce2aSmrg   fi
3136d7ffce2aSmrgelif test "x$use_lint" = x"no" ; then
3137d7ffce2aSmrg   if test "x$LINT" != "x"; then
3138d7ffce2aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3139d7ffce2aSmrg   fi
31404c61c93dSmrgelse
3141d7ffce2aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
31424c61c93dSmrgfi
3143d7ffce2aSmrg
3144d7ffce2aSmrg# User supplied flags override default flags
3145d7ffce2aSmrgif test "x$LINT_FLAGS" != "x"; then
3146d7ffce2aSmrg   lint_options=$LINT_FLAGS
31474c61c93dSmrgfi
31484c61c93dSmrg
3149d7ffce2aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3150d7ffce2aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
31514c61c93dSmrg
31524c61c93dSmrg]) # XORG_WITH_LINT
31534c61c93dSmrg
31544c61c93dSmrg# XORG_LINT_LIBRARY(LIBNAME)
31554c61c93dSmrg# --------------------------
31564c61c93dSmrg# Minimum version: 1.1.0
31574c61c93dSmrg#
31584c61c93dSmrg# Sets up flags for building lint libraries for checking programs that call
31594c61c93dSmrg# functions in the library.
31604c61c93dSmrg#
3161d7ffce2aSmrg# Interface to module:
3162d7ffce2aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
3163d7ffce2aSmrg# MAKE_LINT_LIB		- Automake conditional
3164d7ffce2aSmrg#
3165d7ffce2aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3166d7ffce2aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
31674c61c93dSmrg
31684c61c93dSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
31694c61c93dSmrgAC_REQUIRE([XORG_WITH_LINT])
31704c61c93dSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
31714c61c93dSmrg	[Create lint library (default: disabled)])],
31724c61c93dSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3173d7ffce2aSmrg
3174d7ffce2aSmrgif test "x$make_lint_lib" = x"yes" ; then
3175d7ffce2aSmrg   LINTLIB=llib-l$1.ln
3176d7ffce2aSmrg   if test "x$LINT" = "x"; then
3177d7ffce2aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3178d7ffce2aSmrg   fi
3179d7ffce2aSmrgelif test "x$make_lint_lib" != x"no" ; then
3180d7ffce2aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
31814c61c93dSmrgfi
3182d7ffce2aSmrg
31834c61c93dSmrgAC_SUBST(LINTLIB)
31844c61c93dSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
31854c61c93dSmrg
31864c61c93dSmrg]) # XORG_LINT_LIBRARY
31874c61c93dSmrg
31881c80d5b0Smrg# XORG_COMPILER_BRAND
31891c80d5b0Smrg# -------------------
31901c80d5b0Smrg# Minimum version: 1.14.0
31911c80d5b0Smrg#
31921c80d5b0Smrg# Checks for various brands of compilers and sets flags as appropriate:
31931c80d5b0Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
31941c80d5b0Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
31951c80d5b0Smrg#   clang compiler - sets CLANGCC to "yes"
31961c80d5b0Smrg#   Intel compiler - sets INTELCC to "yes"
31971c80d5b0Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
31981c80d5b0Smrg#
31991c80d5b0SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
32001c80d5b0SmrgAC_LANG_CASE(
32011c80d5b0Smrg	[C], [
32021c80d5b0Smrg		AC_REQUIRE([AC_PROG_CC_C99])
32031c80d5b0Smrg	],
32041c80d5b0Smrg	[C++], [
32051c80d5b0Smrg		AC_REQUIRE([AC_PROG_CXX])
32061c80d5b0Smrg	]
32071c80d5b0Smrg)
32081c80d5b0SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
32091c80d5b0SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
32101c80d5b0SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
32111c80d5b0Smrg]) # XORG_COMPILER_BRAND
32121c80d5b0Smrg
32131c80d5b0Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
32141c80d5b0Smrg# ---------------
32151c80d5b0Smrg# Minimum version: 1.16.0
32161c80d5b0Smrg#
32171c80d5b0Smrg# Test if the compiler works when passed the given flag as a command line argument.
32181c80d5b0Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
32191c80d5b0Smrg# next flag in the list until there are no more options.
32201c80d5b0Smrg#
32211c80d5b0Smrg# Note that this does not guarantee that the compiler supports the flag as some
32221c80d5b0Smrg# compilers will simply ignore arguments that they do not understand, but we do
32231c80d5b0Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
32241c80d5b0Smrg# -Werror=unused-command-line-argument
32251c80d5b0Smrg#
32261c80d5b0SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
32271c80d5b0Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
32281c80d5b0Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
32291c80d5b0Smrg
32301c80d5b0SmrgAC_LANG_COMPILER_REQUIRE
32311c80d5b0Smrg
32321c80d5b0SmrgAC_LANG_CASE(
32331c80d5b0Smrg	[C], [
32341c80d5b0Smrg		AC_REQUIRE([AC_PROG_CC_C99])
32351c80d5b0Smrg		define([PREFIX], [C])
32361c80d5b0Smrg		define([CACHE_PREFIX], [cc])
32371c80d5b0Smrg		define([COMPILER], [$CC])
32381c80d5b0Smrg	],
32391c80d5b0Smrg	[C++], [
32401c80d5b0Smrg		define([PREFIX], [CXX])
32411c80d5b0Smrg		define([CACHE_PREFIX], [cxx])
32421c80d5b0Smrg		define([COMPILER], [$CXX])
32431c80d5b0Smrg	]
32441c80d5b0Smrg)
32451c80d5b0Smrg
32461c80d5b0Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
32471c80d5b0Smrg
32481c80d5b0Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
32491c80d5b0Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
32501c80d5b0Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
32511c80d5b0Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
32521c80d5b0Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
32531c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
32541c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
32551c80d5b0Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
32561c80d5b0Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
32571c80d5b0Smrgfi
32581c80d5b0Smrg
32591c80d5b0Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
32601c80d5b0Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
32611c80d5b0Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
32621c80d5b0Smrg	fi
32631c80d5b0Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
32641c80d5b0Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
32651c80d5b0Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
32661c80d5b0Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
32671c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
32681c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
32691c80d5b0Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
32701c80d5b0Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
32711c80d5b0Smrgfi
32721c80d5b0Smrg
32731c80d5b0Smrgfound="no"
32741c80d5b0Smrgm4_foreach([flag], m4_cdr($@), [
32751c80d5b0Smrg	if test $found = "no" ; then
32761c80d5b0Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
32771c80d5b0Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
32781c80d5b0Smrg		fi
32791c80d5b0Smrg
32801c80d5b0Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
32811c80d5b0Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
32821c80d5b0Smrg		fi
32831c80d5b0Smrg
32841c80d5b0Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
32851c80d5b0Smrg
32861c80d5b0Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
32871c80d5b0Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
32881c80d5b0Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
32891c80d5b0Smrg		AC_CACHE_VAL($cacheid,
32901c80d5b0Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
32911c80d5b0Smrg					     [eval $cacheid=yes],
32921c80d5b0Smrg					     [eval $cacheid=no])])
32931c80d5b0Smrg
32941c80d5b0Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
32951c80d5b0Smrg
32961c80d5b0Smrg		eval supported=\$$cacheid
32971c80d5b0Smrg		AC_MSG_RESULT([$supported])
32981c80d5b0Smrg		if test "$supported" = "yes" ; then
32991c80d5b0Smrg			$1="$$1 ]flag["
33001c80d5b0Smrg			found="yes"
33011c80d5b0Smrg		fi
33021c80d5b0Smrg	fi
33031c80d5b0Smrg])
33041c80d5b0Smrg]) # XORG_TESTSET_CFLAG
33051c80d5b0Smrg
33061c80d5b0Smrg# XORG_COMPILER_FLAGS
33071c80d5b0Smrg# ---------------
33081c80d5b0Smrg# Minimum version: 1.16.0
33091c80d5b0Smrg#
33101c80d5b0Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
33111c80d5b0Smrg# arguments supported by the selected compiler which do NOT alter the generated
33121c80d5b0Smrg# code.  These arguments will cause the compiler to print various warnings
33131c80d5b0Smrg# during compilation AND turn a conservative set of warnings into errors.
33141c80d5b0Smrg#
33151c80d5b0Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
33161c80d5b0Smrg# future versions of util-macros as options are added to new compilers.
33171c80d5b0Smrg#
33181c80d5b0SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
33191c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
33201c80d5b0Smrg
33211c80d5b0SmrgAC_ARG_ENABLE(selective-werror,
33221c80d5b0Smrg              AS_HELP_STRING([--disable-selective-werror],
33231c80d5b0Smrg                             [Turn off selective compiler errors. (default: enabled)]),
33241c80d5b0Smrg              [SELECTIVE_WERROR=$enableval],
33251c80d5b0Smrg              [SELECTIVE_WERROR=yes])
33261c80d5b0Smrg
33271c80d5b0SmrgAC_LANG_CASE(
33281c80d5b0Smrg        [C], [
33291c80d5b0Smrg                define([PREFIX], [C])
33301c80d5b0Smrg        ],
33311c80d5b0Smrg        [C++], [
33321c80d5b0Smrg                define([PREFIX], [CXX])
33331c80d5b0Smrg        ]
33341c80d5b0Smrg)
33351c80d5b0Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
33361c80d5b0Smrgif test "x$SUNCC" = "xyes"; then
33371c80d5b0Smrg    [BASE_]PREFIX[FLAGS]="-v"
33381c80d5b0Smrgelse
33391c80d5b0Smrg    [BASE_]PREFIX[FLAGS]=""
33401c80d5b0Smrgfi
33411c80d5b0Smrg
33421c80d5b0Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
33431c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
33441c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
33451c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
33461c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
33471c80d5b0Smrg
33481c80d5b0SmrgAC_LANG_CASE(
33491c80d5b0Smrg	[C], [
33501c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
33511c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
33521c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
33531c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
33541c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
33551c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
33561c80d5b0Smrg	]
33571c80d5b0Smrg)
33581c80d5b0Smrg
33591c80d5b0Smrg# This chunk adds additional warnings that could catch undesired effects.
33601c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
33611c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
33621c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
33631c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
33641c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
33651c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
33661c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
33671c80d5b0Smrg
33681c80d5b0Smrg# These are currently disabled because they are noisy.  They will be enabled
33691c80d5b0Smrg# in the future once the codebase is sufficiently modernized to silence
33701c80d5b0Smrg# them.  For now, I don't want them to drown out the other warnings.
33711c80d5b0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
33721c80d5b0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
33731c80d5b0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
33741c80d5b0Smrg
33751c80d5b0Smrg# Turn some warnings into errors, so we don't accidently get successful builds
33761c80d5b0Smrg# when there are problems that should be fixed.
33771c80d5b0Smrg
33781c80d5b0Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
33791c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
33801c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
33811c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
33821c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
33831c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
33841c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
33851c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
33861c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
33871c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
33881c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
33891c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
33901c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
33911c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
33921c80d5b0Smrgelse
33931c80d5b0SmrgAC_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])
33941c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
33951c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
33961c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
33971c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
33981c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
33991c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
34001c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
34011c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
34021c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
34031c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
34041c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
34051c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
34061c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
34071c80d5b0Smrgfi
34081c80d5b0Smrg
34091c80d5b0SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
34101c80d5b0Smrg]) # XORG_COMPILER_FLAGS
34111c80d5b0Smrg
34124c61c93dSmrg# XORG_CWARNFLAGS
34134c61c93dSmrg# ---------------
34144c61c93dSmrg# Minimum version: 1.2.0
34151c80d5b0Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
34164c61c93dSmrg#
34174c61c93dSmrg# Defines CWARNFLAGS to enable C compiler warnings.
34184c61c93dSmrg#
34191c80d5b0Smrg# This function is deprecated because it defines -fno-strict-aliasing
34201c80d5b0Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
34211c80d5b0Smrg# is needed, then it should be added explicitly in the module when
34221c80d5b0Smrg# it is updated to use BASE_CFLAGS.
34231c80d5b0Smrg#
34244c61c93dSmrgAC_DEFUN([XORG_CWARNFLAGS], [
34251c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
34261c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
34271c80d5b0SmrgAC_LANG_CASE(
34281c80d5b0Smrg	[C], [
34291c80d5b0Smrg		CWARNFLAGS="$BASE_CFLAGS"
34301c80d5b0Smrg		if  test "x$GCC" = xyes ; then
34311c80d5b0Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
34321c80d5b0Smrg		fi
34331c80d5b0Smrg		AC_SUBST(CWARNFLAGS)
34341c80d5b0Smrg	]
34351c80d5b0Smrg)
34364c61c93dSmrg]) # XORG_CWARNFLAGS
34374c61c93dSmrg
34384c61c93dSmrg# XORG_STRICT_OPTION
34394c61c93dSmrg# -----------------------
34404c61c93dSmrg# Minimum version: 1.3.0
34414c61c93dSmrg#
34421c80d5b0Smrg# Add configure option to enable strict compilation flags, such as treating
34431c80d5b0Smrg# warnings as fatal errors.
34441c80d5b0Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
34451c80d5b0Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
34461c80d5b0Smrg#
34471c80d5b0Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
34481c80d5b0Smrg# when strict compilation is unconditionally desired.
34494c61c93dSmrgAC_DEFUN([XORG_STRICT_OPTION], [
34504c61c93dSmrgAC_REQUIRE([XORG_CWARNFLAGS])
34511c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
34524c61c93dSmrg
34534c61c93dSmrgAC_ARG_ENABLE(strict-compilation,
34544c61c93dSmrg			  AS_HELP_STRING([--enable-strict-compilation],
34554c61c93dSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
34564c61c93dSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
34571c80d5b0Smrg
34581c80d5b0SmrgAC_LANG_CASE(
34591c80d5b0Smrg        [C], [
34601c80d5b0Smrg                define([PREFIX], [C])
34611c80d5b0Smrg        ],
34621c80d5b0Smrg        [C++], [
34631c80d5b0Smrg                define([PREFIX], [CXX])
34641c80d5b0Smrg        ]
34651c80d5b0Smrg)
34661c80d5b0Smrg
34671c80d5b0Smrg[STRICT_]PREFIX[FLAGS]=""
34681c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
34691c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
34701c80d5b0Smrg
34711c80d5b0Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
34721c80d5b0Smrg# activate it with -Werror, so we add it here explicitly.
34731c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
34741c80d5b0Smrg
34754c61c93dSmrgif test "x$STRICT_COMPILE" = "xyes"; then
34761c80d5b0Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
34771c80d5b0Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
34784c61c93dSmrgfi
34791c80d5b0SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
34801c80d5b0SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
34811c80d5b0SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
34824c61c93dSmrg]) # XORG_STRICT_OPTION
34834c61c93dSmrg
34844c61c93dSmrg# XORG_DEFAULT_OPTIONS
34854c61c93dSmrg# --------------------
34864c61c93dSmrg# Minimum version: 1.3.0
34874c61c93dSmrg#
34884c61c93dSmrg# Defines default options for X.Org modules.
34894c61c93dSmrg#
34904c61c93dSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3491d7ffce2aSmrgAC_REQUIRE([AC_PROG_INSTALL])
34921c80d5b0SmrgXORG_COMPILER_FLAGS
34934c61c93dSmrgXORG_CWARNFLAGS
34944c61c93dSmrgXORG_STRICT_OPTION
34954c61c93dSmrgXORG_RELEASE_VERSION
34964c61c93dSmrgXORG_CHANGELOG
3497d7ffce2aSmrgXORG_INSTALL
34984c61c93dSmrgXORG_MANPAGE_SECTIONS
3499d7ffce2aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3500d7ffce2aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
35014c61c93dSmrg]) # XORG_DEFAULT_OPTIONS
3502d7ffce2aSmrg
3503d7ffce2aSmrg# XORG_INSTALL()
3504d7ffce2aSmrg# ----------------
3505d7ffce2aSmrg# Minimum version: 1.4.0
3506d7ffce2aSmrg#
3507d7ffce2aSmrg# Defines the variable INSTALL_CMD as the command to copy
3508d7ffce2aSmrg# INSTALL from $prefix/share/util-macros.
3509d7ffce2aSmrg#
3510d7ffce2aSmrgAC_DEFUN([XORG_INSTALL], [
3511d7ffce2aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3512d7ffce2aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3513d7ffce2aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3514d7ffce2aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3515d7ffce2aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3516d7ffce2aSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3517d7ffce2aSmrgAC_SUBST([INSTALL_CMD])
3518d7ffce2aSmrg]) # XORG_INSTALL
35194c61c93dSmrgdnl Copyright 2005 Red Hat, Inc
35204c61c93dSmrgdnl
35214c61c93dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
35224c61c93dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
35234c61c93dSmrgdnl the above copyright notice appear in all copies and that both that
35244c61c93dSmrgdnl copyright notice and this permission notice appear in supporting
35254c61c93dSmrgdnl documentation.
35264c61c93dSmrgdnl
35274c61c93dSmrgdnl The above copyright notice and this permission notice shall be included
35284c61c93dSmrgdnl in all copies or substantial portions of the Software.
35294c61c93dSmrgdnl
35304c61c93dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
35314c61c93dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
35324c61c93dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
35334c61c93dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
35344c61c93dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
35354c61c93dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35364c61c93dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
35374c61c93dSmrgdnl
35384c61c93dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
35394c61c93dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
35404c61c93dSmrgdnl other dealings in this Software without prior written authorization
35414c61c93dSmrgdnl from the copyright holders.
35424c61c93dSmrgdnl
35434c61c93dSmrg
35444c61c93dSmrg# XORG_RELEASE_VERSION
35454c61c93dSmrg# --------------------
3546d7ffce2aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
35474c61c93dSmrg 
35484c61c93dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
35494c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
35504c61c93dSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
35514c61c93dSmrg		[Major version of this package])
35524c61c93dSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
35534c61c93dSmrg	if test "x$PVM" = "x"; then
35544c61c93dSmrg		PVM="0"
35554c61c93dSmrg	fi
35564c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
35574c61c93dSmrg		[$PVM],
35584c61c93dSmrg		[Minor version of this package])
35594c61c93dSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
35604c61c93dSmrg	if test "x$PVP" = "x"; then
35614c61c93dSmrg		PVP="0"
35624c61c93dSmrg	fi
35634c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
35644c61c93dSmrg		[$PVP],
35654c61c93dSmrg		[Patch version of this package])
35664c61c93dSmrg])
35674c61c93dSmrg
35684c61c93dSmrg# XORG_CHANGELOG()
35694c61c93dSmrg# ----------------
35704c61c93dSmrg# Minimum version: 1.2.0
35714c61c93dSmrg#
35724c61c93dSmrg# Defines the variable CHANGELOG_CMD as the command to generate
35734c61c93dSmrg# ChangeLog from git.
35744c61c93dSmrg#
35754c61c93dSmrg#
35764c61c93dSmrgAC_DEFUN([XORG_CHANGELOG], [
3577d7ffce2aSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3578d7ffce2aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3579d7ffce2aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
35804c61c93dSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
35814c61c93dSmrgAC_SUBST([CHANGELOG_CMD])
35824c61c93dSmrg]) # XORG_CHANGELOG
35834c61c93dSmrg
3584