aclocal.m4 revision de7ed6e8
1de7ed6e8Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
292bb16f8Smrg
392bb16f8Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
48255a313Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
592bb16f8Smrg# This file is free software; the Free Software Foundation
692bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
792bb16f8Smrg# with or without modifications, as long as this notice is preserved.
892bb16f8Smrg
992bb16f8Smrg# This program is distributed in the hope that it will be useful,
1092bb16f8Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1192bb16f8Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1292bb16f8Smrg# PARTICULAR PURPOSE.
1392bb16f8Smrg
148255a313Smrgm4_ifndef([AC_AUTOCONF_VERSION],
158255a313Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16de7ed6e8Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17de7ed6e8Smrg[m4_warning([this file was generated for autoconf 2.68.
188255a313SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
198255a313SmrgIf you have problems, you may need to regenerate the build system entirely.
208255a313SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2192bb16f8Smrg
228255a313Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
2392bb16f8Smrg#
2492bb16f8Smrg# This file is free software; the Free Software Foundation
2592bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
2692bb16f8Smrg# with or without modifications, as long as this notice is preserved.
2792bb16f8Smrg
2892bb16f8Smrg# AM_AUTOMAKE_VERSION(VERSION)
2992bb16f8Smrg# ----------------------------
3092bb16f8Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3192bb16f8Smrg# generated from the m4 files accompanying Automake X.Y.
328255a313Smrg# (This private macro should not be called outside this file.)
338255a313SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
348255a313Smrg[am__api_version='1.11'
358255a313Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
368255a313Smrgdnl require some minimum version.  Point them to the right macro.
37de7ed6e8Smrgm4_if([$1], [1.11.1], [],
388255a313Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
398255a313Smrg])
408255a313Smrg
418255a313Smrg# _AM_AUTOCONF_VERSION(VERSION)
428255a313Smrg# -----------------------------
438255a313Smrg# aclocal traces this macro to find the Autoconf version.
448255a313Smrg# This is a private macro too.  Using m4_define simplifies
458255a313Smrg# the logic in aclocal, which can simply ignore this definition.
468255a313Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4792bb16f8Smrg
4892bb16f8Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
4992bb16f8Smrg# -------------------------------
508255a313Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
518255a313Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5292bb16f8SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53de7ed6e8Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
548255a313Smrgm4_ifndef([AC_AUTOCONF_VERSION],
558255a313Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
568255a313Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5792bb16f8Smrg
5892bb16f8Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
5992bb16f8Smrg
6092bb16f8Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
6192bb16f8Smrg#
6292bb16f8Smrg# This file is free software; the Free Software Foundation
6392bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
6492bb16f8Smrg# with or without modifications, as long as this notice is preserved.
6592bb16f8Smrg
6692bb16f8Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6792bb16f8Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
6892bb16f8Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6992bb16f8Smrg#
7092bb16f8Smrg# Of course, Automake must honor this variable whenever it calls a
7192bb16f8Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7292bb16f8Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7392bb16f8Smrg# depending on how configure is run.  This is pretty annoying, since
7492bb16f8Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7592bb16f8Smrg# source directory, any form will work fine, but in subdirectories a
7692bb16f8Smrg# relative path needs to be adjusted first.
7792bb16f8Smrg#
7892bb16f8Smrg# $ac_aux_dir/missing
7992bb16f8Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8092bb16f8Smrg# $top_srcdir/$ac_aux_dir/missing
8192bb16f8Smrg#    fails if $ac_aux_dir is absolute,
8292bb16f8Smrg#    fails when called from a subdirectory in a VPATH build with
8392bb16f8Smrg#          a relative $ac_aux_dir
8492bb16f8Smrg#
8592bb16f8Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8692bb16f8Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8792bb16f8Smrg# harmless because $srcdir is `.', but things will broke when you
8892bb16f8Smrg# start a VPATH build or use an absolute $srcdir.
8992bb16f8Smrg#
9092bb16f8Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9192bb16f8Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9292bb16f8Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9392bb16f8Smrg# and then we would define $MISSING as
9492bb16f8Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9592bb16f8Smrg# This will work as long as MISSING is not called from configure, because
9692bb16f8Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9792bb16f8Smrg# However there are other variables, like CC, which are often used in
9892bb16f8Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
9992bb16f8Smrg#
10092bb16f8Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10192bb16f8Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10292bb16f8Smrg# configured tree to be moved without reconfiguration.
10392bb16f8Smrg
10492bb16f8SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10592bb16f8Smrg[dnl Rely on autoconf to set up CDPATH properly.
10692bb16f8SmrgAC_PREREQ([2.50])dnl
10792bb16f8Smrg# expand $ac_aux_dir to an absolute path
10892bb16f8Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
10992bb16f8Smrg])
11092bb16f8Smrg
11192bb16f8Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11292bb16f8Smrg
1138255a313Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
11492bb16f8Smrg# Free Software Foundation, Inc.
11592bb16f8Smrg#
11692bb16f8Smrg# This file is free software; the Free Software Foundation
11792bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
11892bb16f8Smrg# with or without modifications, as long as this notice is preserved.
11992bb16f8Smrg
1208255a313Smrg# serial 9
12192bb16f8Smrg
12292bb16f8Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12392bb16f8Smrg# -------------------------------------
12492bb16f8Smrg# Define a conditional.
12592bb16f8SmrgAC_DEFUN([AM_CONDITIONAL],
12692bb16f8Smrg[AC_PREREQ(2.52)dnl
12792bb16f8Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12892bb16f8Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1298255a313SmrgAC_SUBST([$1_TRUE])dnl
1308255a313SmrgAC_SUBST([$1_FALSE])dnl
1318255a313Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1328255a313Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1338255a313Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13492bb16f8Smrgif $2; then
13592bb16f8Smrg  $1_TRUE=
13692bb16f8Smrg  $1_FALSE='#'
13792bb16f8Smrgelse
13892bb16f8Smrg  $1_TRUE='#'
13992bb16f8Smrg  $1_FALSE=
14092bb16f8Smrgfi
14192bb16f8SmrgAC_CONFIG_COMMANDS_PRE(
14292bb16f8Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14392bb16f8Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14492bb16f8SmrgUsually this means the macro was only invoked conditionally.]])
14592bb16f8Smrgfi])])
14692bb16f8Smrg
1478255a313Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
1488255a313Smrg# Free Software Foundation, Inc.
1498255a313Smrg#
1508255a313Smrg# This file is free software; the Free Software Foundation
1518255a313Smrg# gives unlimited permission to copy and/or distribute it,
1528255a313Smrg# with or without modifications, as long as this notice is preserved.
1538255a313Smrg
1548255a313Smrg# serial 10
1558255a313Smrg
1568255a313Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1578255a313Smrg# written in clear, in which case automake, when reading aclocal.m4,
1588255a313Smrg# will think it sees a *use*, and therefore will trigger all it's
1598255a313Smrg# C support machinery.  Also note that it means that autoscan, seeing
1608255a313Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1618255a313Smrg
16292bb16f8Smrg
1638255a313Smrg# _AM_DEPENDENCIES(NAME)
1648255a313Smrg# ----------------------
1658255a313Smrg# See how the compiler implements dependency checking.
1668255a313Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1678255a313Smrg# We try a few techniques and use that to set a single cache variable.
1688255a313Smrg#
1698255a313Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1708255a313Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1718255a313Smrg# dependency, and given that the user is not expected to run this macro,
1728255a313Smrg# just rely on AC_PROG_CC.
1738255a313SmrgAC_DEFUN([_AM_DEPENDENCIES],
1748255a313Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1758255a313SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1768255a313SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1778255a313SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1788255a313Smrg
1798255a313Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1808255a313Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1818255a313Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1828255a313Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1838255a313Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1848255a313Smrg                   [depcc="$$1"   am_compiler_list=])
1858255a313Smrg
1868255a313SmrgAC_CACHE_CHECK([dependency style of $depcc],
1878255a313Smrg               [am_cv_$1_dependencies_compiler_type],
1888255a313Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1898255a313Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1908255a313Smrg  # making bogus files that we don't know about and never remove.  For
1918255a313Smrg  # instance it was reported that on HP-UX the gcc test will end up
1928255a313Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
1938255a313Smrg  # in D'.
1948255a313Smrg  mkdir conftest.dir
1958255a313Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1968255a313Smrg  # using a relative directory.
1978255a313Smrg  cp "$am_depcomp" conftest.dir
1988255a313Smrg  cd conftest.dir
1998255a313Smrg  # We will build objects and dependencies in a subdirectory because
2008255a313Smrg  # it helps to detect inapplicable dependency modes.  For instance
2018255a313Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2028255a313Smrg  # side effect of compilation, but ICC will put the dependencies in
2038255a313Smrg  # the current directory while Tru64 will put them in the object
2048255a313Smrg  # directory.
2058255a313Smrg  mkdir sub
2068255a313Smrg
2078255a313Smrg  am_cv_$1_dependencies_compiler_type=none
2088255a313Smrg  if test "$am_compiler_list" = ""; then
2098255a313Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2108255a313Smrg  fi
2118255a313Smrg  am__universal=false
2128255a313Smrg  m4_case([$1], [CC],
2138255a313Smrg    [case " $depcc " in #(
2148255a313Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2158255a313Smrg     esac],
2168255a313Smrg    [CXX],
2178255a313Smrg    [case " $depcc " in #(
2188255a313Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2198255a313Smrg     esac])
2208255a313Smrg
2218255a313Smrg  for depmode in $am_compiler_list; do
2228255a313Smrg    # Setup a source with many dependencies, because some compilers
2238255a313Smrg    # like to wrap large dependency lists on column 80 (with \), and
2248255a313Smrg    # we should not choose a depcomp mode which is confused by this.
2258255a313Smrg    #
2268255a313Smrg    # We need to recreate these files for each test, as the compiler may
2278255a313Smrg    # overwrite some of them when testing with obscure command lines.
2288255a313Smrg    # This happens at least with the AIX C compiler.
2298255a313Smrg    : > sub/conftest.c
2308255a313Smrg    for i in 1 2 3 4 5 6; do
2318255a313Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2328255a313Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2338255a313Smrg      # Solaris 8's {/usr,}/bin/sh.
2348255a313Smrg      touch sub/conftst$i.h
2358255a313Smrg    done
2368255a313Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2378255a313Smrg
2388255a313Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2398255a313Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2408255a313Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
2418255a313Smrg    # versions had trouble with output in subdirs
2428255a313Smrg    am__obj=sub/conftest.${OBJEXT-o}
2438255a313Smrg    am__minus_obj="-o $am__obj"
2448255a313Smrg    case $depmode in
2458255a313Smrg    gcc)
2468255a313Smrg      # This depmode causes a compiler race in universal mode.
2478255a313Smrg      test "$am__universal" = false || continue
2488255a313Smrg      ;;
2498255a313Smrg    nosideeffect)
2508255a313Smrg      # after this tag, mechanisms are not by side-effect, so they'll
2518255a313Smrg      # only be used when explicitly requested
2528255a313Smrg      if test "x$enable_dependency_tracking" = xyes; then
2538255a313Smrg	continue
2548255a313Smrg      else
2558255a313Smrg	break
2568255a313Smrg      fi
2578255a313Smrg      ;;
2588255a313Smrg    msvisualcpp | msvcmsys)
2598255a313Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
2608255a313Smrg      # not run yet.  These depmodes are late enough in the game, and
2618255a313Smrg      # so weak that their functioning should not be impacted.
2628255a313Smrg      am__obj=conftest.${OBJEXT-o}
2638255a313Smrg      am__minus_obj=
2648255a313Smrg      ;;
2658255a313Smrg    none) break ;;
2668255a313Smrg    esac
2678255a313Smrg    if depmode=$depmode \
2688255a313Smrg       source=sub/conftest.c object=$am__obj \
2698255a313Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2708255a313Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2718255a313Smrg         >/dev/null 2>conftest.err &&
2728255a313Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2738255a313Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2748255a313Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2758255a313Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2768255a313Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2778255a313Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2788255a313Smrg      # that says an option was ignored or not supported.
2798255a313Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2808255a313Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2818255a313Smrg      # The diagnosis changed in icc 8.0:
2828255a313Smrg      #   icc: Command line remark: option '-MP' not supported
2838255a313Smrg      if (grep 'ignoring option' conftest.err ||
2848255a313Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2858255a313Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2868255a313Smrg        break
2878255a313Smrg      fi
2888255a313Smrg    fi
2898255a313Smrg  done
2908255a313Smrg
2918255a313Smrg  cd ..
2928255a313Smrg  rm -rf conftest.dir
2938255a313Smrgelse
2948255a313Smrg  am_cv_$1_dependencies_compiler_type=none
2958255a313Smrgfi
2968255a313Smrg])
2978255a313SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2988255a313SmrgAM_CONDITIONAL([am__fastdep$1], [
2998255a313Smrg  test "x$enable_dependency_tracking" != xno \
3008255a313Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3018255a313Smrg])
3028255a313Smrg
3038255a313Smrg
3048255a313Smrg# AM_SET_DEPDIR
3058255a313Smrg# -------------
3068255a313Smrg# Choose a directory name for dependency files.
3078255a313Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3088255a313SmrgAC_DEFUN([AM_SET_DEPDIR],
3098255a313Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3108255a313SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3118255a313Smrg])
3128255a313Smrg
3138255a313Smrg
3148255a313Smrg# AM_DEP_TRACK
3158255a313Smrg# ------------
3168255a313SmrgAC_DEFUN([AM_DEP_TRACK],
3178255a313Smrg[AC_ARG_ENABLE(dependency-tracking,
3188255a313Smrg[  --disable-dependency-tracking  speeds up one-time build
3198255a313Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3208255a313Smrgif test "x$enable_dependency_tracking" != xno; then
3218255a313Smrg  am_depcomp="$ac_aux_dir/depcomp"
3228255a313Smrg  AMDEPBACKSLASH='\'
3238255a313Smrgfi
3248255a313SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3258255a313SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3268255a313Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3278255a313Smrg])
3288255a313Smrg
3298255a313Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3308255a313Smrg
3318255a313Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
33292bb16f8Smrg# Free Software Foundation, Inc.
33392bb16f8Smrg#
33492bb16f8Smrg# This file is free software; the Free Software Foundation
33592bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
33692bb16f8Smrg# with or without modifications, as long as this notice is preserved.
33792bb16f8Smrg
3388255a313Smrg#serial 5
3398255a313Smrg
3408255a313Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3418255a313Smrg# ------------------------------
3428255a313SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3438255a313Smrg[{
3448255a313Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
3458255a313Smrg  # are listed without --file.  Let's play safe and only enable the eval
3468255a313Smrg  # if we detect the quoting.
3478255a313Smrg  case $CONFIG_FILES in
3488255a313Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3498255a313Smrg  *)   set x $CONFIG_FILES ;;
3508255a313Smrg  esac
3518255a313Smrg  shift
3528255a313Smrg  for mf
3538255a313Smrg  do
3548255a313Smrg    # Strip MF so we end up with the name of the file.
3558255a313Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3568255a313Smrg    # Check whether this is an Automake generated Makefile or not.
3578255a313Smrg    # We used to match only the files named `Makefile.in', but
3588255a313Smrg    # some people rename them; so instead we look at the file content.
3598255a313Smrg    # Grep'ing the first line is not enough: some people post-process
3608255a313Smrg    # each Makefile.in and add a new line on top of each file to say so.
3618255a313Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3628255a313Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3638255a313Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3648255a313Smrg      dirpart=`AS_DIRNAME("$mf")`
3658255a313Smrg    else
3668255a313Smrg      continue
3678255a313Smrg    fi
3688255a313Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3698255a313Smrg    # from the Makefile without running `make'.
3708255a313Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3718255a313Smrg    test -z "$DEPDIR" && continue
3728255a313Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3738255a313Smrg    test -z "am__include" && continue
3748255a313Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3758255a313Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
3768255a313Smrg    U=`sed -n 's/^U = //p' < "$mf"`
3778255a313Smrg    # Find all dependency output files, they are included files with
3788255a313Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3798255a313Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3808255a313Smrg    # expansion.
3818255a313Smrg    for file in `sed -n "
3828255a313Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3838255a313Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3848255a313Smrg      # Make sure the directory exists.
3858255a313Smrg      test -f "$dirpart/$file" && continue
3868255a313Smrg      fdir=`AS_DIRNAME(["$file"])`
3878255a313Smrg      AS_MKDIR_P([$dirpart/$fdir])
3888255a313Smrg      # echo "creating $dirpart/$file"
3898255a313Smrg      echo '# dummy' > "$dirpart/$file"
3908255a313Smrg    done
3918255a313Smrg  done
3928255a313Smrg}
3938255a313Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3948255a313Smrg
3958255a313Smrg
3968255a313Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3978255a313Smrg# -----------------------------
3988255a313Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3998255a313Smrg#
4008255a313Smrg# This code is only required when automatic dependency tracking
4018255a313Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
4028255a313Smrg# need in order to bootstrap the dependency handling code.
4038255a313SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4048255a313Smrg[AC_CONFIG_COMMANDS([depfiles],
4058255a313Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4068255a313Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4078255a313Smrg])
4088255a313Smrg
4098255a313Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4108255a313Smrg
4118255a313Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4128255a313Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4138255a313Smrg#
4148255a313Smrg# This file is free software; the Free Software Foundation
4158255a313Smrg# gives unlimited permission to copy and/or distribute it,
4168255a313Smrg# with or without modifications, as long as this notice is preserved.
4178255a313Smrg
4188255a313Smrg# serial 16
41992bb16f8Smrg
42092bb16f8Smrg# This macro actually does too much.  Some checks are only needed if
42192bb16f8Smrg# your package does certain things.  But this isn't really a big deal.
42292bb16f8Smrg
42392bb16f8Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42492bb16f8Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42592bb16f8Smrg# -----------------------------------------------
42692bb16f8Smrg# The call with PACKAGE and VERSION arguments is the old style
42792bb16f8Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42892bb16f8Smrg# and VERSION should now be passed to AC_INIT and removed from
42992bb16f8Smrg# the call to AM_INIT_AUTOMAKE.
43092bb16f8Smrg# We support both call styles for the transition.  After
43192bb16f8Smrg# the next Automake release, Autoconf can make the AC_INIT
43292bb16f8Smrg# arguments mandatory, and then we can depend on a new Autoconf
43392bb16f8Smrg# release and drop the old call support.
43492bb16f8SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4358255a313Smrg[AC_PREREQ([2.62])dnl
43692bb16f8Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43792bb16f8Smrgdnl the ones we care about.
43892bb16f8Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43992bb16f8SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44092bb16f8SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4418255a313Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4428255a313Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4438255a313Smrg  # is not polluted with repeated "-I."
4448255a313Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4458255a313Smrg  # test to see if srcdir already configured
4468255a313Smrg  if test -f $srcdir/config.status; then
4478255a313Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4488255a313Smrg  fi
44992bb16f8Smrgfi
45092bb16f8Smrg
45192bb16f8Smrg# test whether we have cygpath
45292bb16f8Smrgif test -z "$CYGPATH_W"; then
45392bb16f8Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45492bb16f8Smrg    CYGPATH_W='cygpath -w'
45592bb16f8Smrg  else
45692bb16f8Smrg    CYGPATH_W=echo
45792bb16f8Smrg  fi
45892bb16f8Smrgfi
45992bb16f8SmrgAC_SUBST([CYGPATH_W])
46092bb16f8Smrg
46192bb16f8Smrg# Define the identity of the package.
46292bb16f8Smrgdnl Distinguish between old-style and new-style calls.
46392bb16f8Smrgm4_ifval([$2],
46492bb16f8Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46592bb16f8Smrg AC_SUBST([PACKAGE], [$1])dnl
46692bb16f8Smrg AC_SUBST([VERSION], [$2])],
46792bb16f8Smrg[_AM_SET_OPTIONS([$1])dnl
4688255a313Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4698255a313Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4708255a313Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47192bb16f8Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47292bb16f8Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47392bb16f8Smrg
47492bb16f8Smrg_AM_IF_OPTION([no-define],,
47592bb16f8Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
47692bb16f8Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
47792bb16f8Smrg
47892bb16f8Smrg# Some tools Automake needs.
47992bb16f8SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48092bb16f8SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48192bb16f8SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
48292bb16f8SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
48392bb16f8SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
48492bb16f8SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
48592bb16f8SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4868255a313SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4878255a313SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
48892bb16f8SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
48992bb16f8Smrg# We need awk for the "check" target.  The system "awk" is bad on
49092bb16f8Smrg# some platforms.
49192bb16f8SmrgAC_REQUIRE([AC_PROG_AWK])dnl
49292bb16f8SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
49392bb16f8SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
49492bb16f8Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4958255a313Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4968255a313Smrg			     [_AM_PROG_TAR([v7])])])
49792bb16f8Smrg_AM_IF_OPTION([no-dependencies],,
49892bb16f8Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
4998255a313Smrg		  [_AM_DEPENDENCIES(CC)],
5008255a313Smrg		  [define([AC_PROG_CC],
5018255a313Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
50292bb16f8SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5038255a313Smrg		  [_AM_DEPENDENCIES(CXX)],
5048255a313Smrg		  [define([AC_PROG_CXX],
5058255a313Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5068255a313SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5078255a313Smrg		  [_AM_DEPENDENCIES(OBJC)],
5088255a313Smrg		  [define([AC_PROG_OBJC],
5098255a313Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
51092bb16f8Smrg])
5118255a313Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5128255a313Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5138255a313Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5148255a313Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5158255a313SmrgAC_CONFIG_COMMANDS_PRE(dnl
5168255a313Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5178255a313Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
51892bb16f8Smrg])
51992bb16f8Smrg
5208255a313Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5218255a313Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5228255a313Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5238255a313Smrgm4_define([_AC_COMPILER_EXEEXT],
5248255a313Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5258255a313Smrg
52692bb16f8Smrg
52792bb16f8Smrg# When config.status generates a header, we must update the stamp-h file.
52892bb16f8Smrg# This file resides in the same directory as the config header
52992bb16f8Smrg# that is generated.  The stamp files are numbered to have different names.
53092bb16f8Smrg
53192bb16f8Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
53292bb16f8Smrg# loop where config.status creates the headers, so we can generate
53392bb16f8Smrg# our stamp files there.
53492bb16f8SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
53592bb16f8Smrg[# Compute $1's index in $config_headers.
5368255a313Smrg_am_arg=$1
53792bb16f8Smrg_am_stamp_count=1
53892bb16f8Smrgfor _am_header in $config_headers :; do
53992bb16f8Smrg  case $_am_header in
5408255a313Smrg    $_am_arg | $_am_arg:* )
54192bb16f8Smrg      break ;;
54292bb16f8Smrg    * )
54392bb16f8Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
54492bb16f8Smrg  esac
54592bb16f8Smrgdone
5468255a313Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
54792bb16f8Smrg
5488255a313Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
54992bb16f8Smrg#
55092bb16f8Smrg# This file is free software; the Free Software Foundation
55192bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
55292bb16f8Smrg# with or without modifications, as long as this notice is preserved.
55392bb16f8Smrg
55492bb16f8Smrg# AM_PROG_INSTALL_SH
55592bb16f8Smrg# ------------------
55692bb16f8Smrg# Define $install_sh.
55792bb16f8SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
55892bb16f8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5598255a313Smrgif test x"${install_sh}" != xset; then
5608255a313Smrg  case $am_aux_dir in
5618255a313Smrg  *\ * | *\	*)
5628255a313Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5638255a313Smrg  *)
5648255a313Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5658255a313Smrg  esac
5668255a313Smrgfi
56792bb16f8SmrgAC_SUBST(install_sh)])
56892bb16f8Smrg
56992bb16f8Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
57092bb16f8Smrg#
57192bb16f8Smrg# This file is free software; the Free Software Foundation
57292bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
57392bb16f8Smrg# with or without modifications, as long as this notice is preserved.
57492bb16f8Smrg
57592bb16f8Smrg# serial 2
57692bb16f8Smrg
57792bb16f8Smrg# Check whether the underlying file-system supports filenames
57892bb16f8Smrg# with a leading dot.  For instance MS-DOS doesn't.
57992bb16f8SmrgAC_DEFUN([AM_SET_LEADING_DOT],
58092bb16f8Smrg[rm -rf .tst 2>/dev/null
58192bb16f8Smrgmkdir .tst 2>/dev/null
58292bb16f8Smrgif test -d .tst; then
58392bb16f8Smrg  am__leading_dot=.
58492bb16f8Smrgelse
58592bb16f8Smrg  am__leading_dot=_
58692bb16f8Smrgfi
58792bb16f8Smrgrmdir .tst 2>/dev/null
58892bb16f8SmrgAC_SUBST([am__leading_dot])])
58992bb16f8Smrg
590de7ed6e8Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
591de7ed6e8Smrg# From Jim Meyering
592de7ed6e8Smrg
593de7ed6e8Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
594de7ed6e8Smrg# Free Software Foundation, Inc.
595de7ed6e8Smrg#
596de7ed6e8Smrg# This file is free software; the Free Software Foundation
597de7ed6e8Smrg# gives unlimited permission to copy and/or distribute it,
598de7ed6e8Smrg# with or without modifications, as long as this notice is preserved.
599de7ed6e8Smrg
600de7ed6e8Smrg# serial 5
601de7ed6e8Smrg
602de7ed6e8Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603de7ed6e8Smrg# ----------------------------------
604de7ed6e8Smrg# Control maintainer-specific portions of Makefiles.
605de7ed6e8Smrg# Default is to disable them, unless `enable' is passed literally.
606de7ed6e8Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607de7ed6e8Smrg# can override the default with the --enable/--disable switch.
608de7ed6e8SmrgAC_DEFUN([AM_MAINTAINER_MODE],
609de7ed6e8Smrg[m4_case(m4_default([$1], [disable]),
610de7ed6e8Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
611de7ed6e8Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
612de7ed6e8Smrg       [m4_define([am_maintainer_other], [enable])
613de7ed6e8Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614de7ed6e8SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615de7ed6e8Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616de7ed6e8Smrg  AC_ARG_ENABLE([maintainer-mode],
617de7ed6e8Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
618de7ed6e8Smrg			  (and sometimes confusing) to the casual installer],
619de7ed6e8Smrg      [USE_MAINTAINER_MODE=$enableval],
620de7ed6e8Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
621de7ed6e8Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622de7ed6e8Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
623de7ed6e8Smrg  MAINT=$MAINTAINER_MODE_TRUE
624de7ed6e8Smrg  AC_SUBST([MAINT])dnl
625de7ed6e8Smrg]
626de7ed6e8Smrg)
627de7ed6e8Smrg
628de7ed6e8SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629de7ed6e8Smrg
6308255a313Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6318255a313Smrg
6328255a313Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6338255a313Smrg#
6348255a313Smrg# This file is free software; the Free Software Foundation
6358255a313Smrg# gives unlimited permission to copy and/or distribute it,
6368255a313Smrg# with or without modifications, as long as this notice is preserved.
6378255a313Smrg
6388255a313Smrg# serial 4
6398255a313Smrg
6408255a313Smrg# AM_MAKE_INCLUDE()
6418255a313Smrg# -----------------
6428255a313Smrg# Check to see how make treats includes.
6438255a313SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6448255a313Smrg[am_make=${MAKE-make}
6458255a313Smrgcat > confinc << 'END'
6468255a313Smrgam__doit:
6478255a313Smrg	@echo this is the am__doit target
6488255a313Smrg.PHONY: am__doit
6498255a313SmrgEND
6508255a313Smrg# If we don't find an include directive, just comment out the code.
6518255a313SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6528255a313Smrgam__include="#"
6538255a313Smrgam__quote=
6548255a313Smrg_am_result=none
6558255a313Smrg# First try GNU make style include.
6568255a313Smrgecho "include confinc" > confmf
6578255a313Smrg# Ignore all kinds of additional output from `make'.
6588255a313Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6598255a313Smrg*the\ am__doit\ target*)
6608255a313Smrg  am__include=include
6618255a313Smrg  am__quote=
6628255a313Smrg  _am_result=GNU
6638255a313Smrg  ;;
6648255a313Smrgesac
6658255a313Smrg# Now try BSD make style include.
6668255a313Smrgif test "$am__include" = "#"; then
6678255a313Smrg   echo '.include "confinc"' > confmf
6688255a313Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6698255a313Smrg   *the\ am__doit\ target*)
6708255a313Smrg     am__include=.include
6718255a313Smrg     am__quote="\""
6728255a313Smrg     _am_result=BSD
6738255a313Smrg     ;;
6748255a313Smrg   esac
6758255a313Smrgfi
6768255a313SmrgAC_SUBST([am__include])
6778255a313SmrgAC_SUBST([am__quote])
6788255a313SmrgAC_MSG_RESULT([$_am_result])
6798255a313Smrgrm -f confinc confmf
6808255a313Smrg])
6818255a313Smrg
68292bb16f8Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
68392bb16f8Smrg
6848255a313Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
68592bb16f8Smrg# Free Software Foundation, Inc.
68692bb16f8Smrg#
68792bb16f8Smrg# This file is free software; the Free Software Foundation
68892bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
68992bb16f8Smrg# with or without modifications, as long as this notice is preserved.
69092bb16f8Smrg
6918255a313Smrg# serial 6
69292bb16f8Smrg
69392bb16f8Smrg# AM_MISSING_PROG(NAME, PROGRAM)
69492bb16f8Smrg# ------------------------------
69592bb16f8SmrgAC_DEFUN([AM_MISSING_PROG],
69692bb16f8Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69792bb16f8Smrg$1=${$1-"${am_missing_run}$2"}
69892bb16f8SmrgAC_SUBST($1)])
69992bb16f8Smrg
70092bb16f8Smrg
70192bb16f8Smrg# AM_MISSING_HAS_RUN
70292bb16f8Smrg# ------------------
70392bb16f8Smrg# Define MISSING if not defined so far and test if it supports --run.
70492bb16f8Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
70592bb16f8SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70692bb16f8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7078255a313SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7088255a313Smrgif test x"${MISSING+set}" != xset; then
7098255a313Smrg  case $am_aux_dir in
7108255a313Smrg  *\ * | *\	*)
7118255a313Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7128255a313Smrg  *)
7138255a313Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7148255a313Smrg  esac
7158255a313Smrgfi
71692bb16f8Smrg# Use eval to expand $SHELL
71792bb16f8Smrgif eval "$MISSING --run true"; then
71892bb16f8Smrg  am_missing_run="$MISSING --run "
71992bb16f8Smrgelse
72092bb16f8Smrg  am_missing_run=
72192bb16f8Smrg  AC_MSG_WARN([`missing' script is too old or missing])
72292bb16f8Smrgfi
72392bb16f8Smrg])
72492bb16f8Smrg
7258255a313Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
72692bb16f8Smrg#
72792bb16f8Smrg# This file is free software; the Free Software Foundation
72892bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
72992bb16f8Smrg# with or without modifications, as long as this notice is preserved.
73092bb16f8Smrg
73192bb16f8Smrg# AM_PROG_MKDIR_P
73292bb16f8Smrg# ---------------
7338255a313Smrg# Check for `mkdir -p'.
73492bb16f8SmrgAC_DEFUN([AM_PROG_MKDIR_P],
7358255a313Smrg[AC_PREREQ([2.60])dnl
7368255a313SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7378255a313Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7388255a313Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
7398255a313Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7408255a313Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7418255a313Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7428255a313Smrgdnl adjustment using top_builddir (which is defined more often than
7438255a313Smrgdnl MKDIR_P).
7448255a313SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7458255a313Smrgcase $mkdir_p in
7468255a313Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7478255a313Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7488255a313Smrgesac
7498255a313Smrg])
75092bb16f8Smrg
75192bb16f8Smrg# Helper functions for option handling.                     -*- Autoconf -*-
75292bb16f8Smrg
7538255a313Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
75492bb16f8Smrg#
75592bb16f8Smrg# This file is free software; the Free Software Foundation
75692bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
75792bb16f8Smrg# with or without modifications, as long as this notice is preserved.
75892bb16f8Smrg
7598255a313Smrg# serial 4
76092bb16f8Smrg
76192bb16f8Smrg# _AM_MANGLE_OPTION(NAME)
76292bb16f8Smrg# -----------------------
76392bb16f8SmrgAC_DEFUN([_AM_MANGLE_OPTION],
76492bb16f8Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
76592bb16f8Smrg
76692bb16f8Smrg# _AM_SET_OPTION(NAME)
76792bb16f8Smrg# ------------------------------
76892bb16f8Smrg# Set option NAME.  Presently that only means defining a flag for this option.
76992bb16f8SmrgAC_DEFUN([_AM_SET_OPTION],
77092bb16f8Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
77192bb16f8Smrg
77292bb16f8Smrg# _AM_SET_OPTIONS(OPTIONS)
77392bb16f8Smrg# ----------------------------------
77492bb16f8Smrg# OPTIONS is a space-separated list of Automake options.
77592bb16f8SmrgAC_DEFUN([_AM_SET_OPTIONS],
7768255a313Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
77792bb16f8Smrg
77892bb16f8Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
77992bb16f8Smrg# -------------------------------------------
78092bb16f8Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
78192bb16f8SmrgAC_DEFUN([_AM_IF_OPTION],
78292bb16f8Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
78392bb16f8Smrg
78492bb16f8Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
78592bb16f8Smrg
7868255a313Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
78792bb16f8Smrg# Free Software Foundation, Inc.
78892bb16f8Smrg#
78992bb16f8Smrg# This file is free software; the Free Software Foundation
79092bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
79192bb16f8Smrg# with or without modifications, as long as this notice is preserved.
79292bb16f8Smrg
7938255a313Smrg# serial 5
79492bb16f8Smrg
79592bb16f8Smrg# AM_SANITY_CHECK
79692bb16f8Smrg# ---------------
79792bb16f8SmrgAC_DEFUN([AM_SANITY_CHECK],
79892bb16f8Smrg[AC_MSG_CHECKING([whether build environment is sane])
79992bb16f8Smrg# Just in case
80092bb16f8Smrgsleep 1
80192bb16f8Smrgecho timestamp > conftest.file
8028255a313Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8038255a313Smrg# name.  Accept space and tab only in the latter.
8048255a313Smrgam_lf='
8058255a313Smrg'
8068255a313Smrgcase `pwd` in
8078255a313Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8088255a313Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8098255a313Smrgesac
8108255a313Smrgcase $srcdir in
8118255a313Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8128255a313Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8138255a313Smrgesac
8148255a313Smrg
81592bb16f8Smrg# Do `set' in a subshell so we don't clobber the current shell's
81692bb16f8Smrg# arguments.  Must try -L first in case configure is actually a
81792bb16f8Smrg# symlink; some systems play weird games with the mod time of symlinks
81892bb16f8Smrg# (eg FreeBSD returns the mod time of the symlink's containing
81992bb16f8Smrg# directory).
82092bb16f8Smrgif (
8218255a313Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
82292bb16f8Smrg   if test "$[*]" = "X"; then
82392bb16f8Smrg      # -L didn't work.
8248255a313Smrg      set X `ls -t "$srcdir/configure" conftest.file`
82592bb16f8Smrg   fi
82692bb16f8Smrg   rm -f conftest.file
82792bb16f8Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
82892bb16f8Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
82992bb16f8Smrg
83092bb16f8Smrg      # If neither matched, then we have a broken ls.  This can happen
83192bb16f8Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
83292bb16f8Smrg      # broken ls alias from the environment.  This has actually
83392bb16f8Smrg      # happened.  Such a system could not be considered "sane".
83492bb16f8Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
83592bb16f8Smrgalias in your environment])
83692bb16f8Smrg   fi
83792bb16f8Smrg
83892bb16f8Smrg   test "$[2]" = conftest.file
83992bb16f8Smrg   )
84092bb16f8Smrgthen
84192bb16f8Smrg   # Ok.
84292bb16f8Smrg   :
84392bb16f8Smrgelse
84492bb16f8Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
84592bb16f8SmrgCheck your system clock])
84692bb16f8Smrgfi
84792bb16f8SmrgAC_MSG_RESULT(yes)])
84892bb16f8Smrg
8498255a313Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
8508255a313Smrg#
8518255a313Smrg# This file is free software; the Free Software Foundation
8528255a313Smrg# gives unlimited permission to copy and/or distribute it,
8538255a313Smrg# with or without modifications, as long as this notice is preserved.
8548255a313Smrg
8558255a313Smrg# serial 1
8568255a313Smrg
8578255a313Smrg# AM_SILENT_RULES([DEFAULT])
8588255a313Smrg# --------------------------
8598255a313Smrg# Enable less verbose build rules; with the default set to DEFAULT
8608255a313Smrg# (`yes' being less verbose, `no' or empty being verbose).
8618255a313SmrgAC_DEFUN([AM_SILENT_RULES],
8628255a313Smrg[AC_ARG_ENABLE([silent-rules],
8638255a313Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8648255a313Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8658255a313Smrgcase $enable_silent_rules in
8668255a313Smrgyes) AM_DEFAULT_VERBOSITY=0;;
8678255a313Smrgno)  AM_DEFAULT_VERBOSITY=1;;
8688255a313Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8698255a313Smrgesac
8708255a313SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8718255a313SmrgAM_BACKSLASH='\'
8728255a313SmrgAC_SUBST([AM_BACKSLASH])dnl
8738255a313Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8748255a313Smrg])
8758255a313Smrg
87692bb16f8Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
87792bb16f8Smrg#
87892bb16f8Smrg# This file is free software; the Free Software Foundation
87992bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
88092bb16f8Smrg# with or without modifications, as long as this notice is preserved.
88192bb16f8Smrg
88292bb16f8Smrg# AM_PROG_INSTALL_STRIP
88392bb16f8Smrg# ---------------------
88492bb16f8Smrg# One issue with vendor `install' (even GNU) is that you can't
88592bb16f8Smrg# specify the program used to strip binaries.  This is especially
88692bb16f8Smrg# annoying in cross-compiling environments, where the build's strip
88792bb16f8Smrg# is unlikely to handle the host's binaries.
88892bb16f8Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
88992bb16f8Smrg# always use install-sh in `make install-strip', and initialize
89092bb16f8Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
89192bb16f8SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
89292bb16f8Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
89392bb16f8Smrg# Installed binaries are usually stripped using `strip' when the user
89492bb16f8Smrg# run `make install-strip'.  However `strip' might not be the right
89592bb16f8Smrg# tool to use in cross-compilation environments, therefore Automake
89692bb16f8Smrg# will honor the `STRIP' environment variable to overrule this program.
89792bb16f8Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
89892bb16f8Smrgif test "$cross_compiling" != no; then
89992bb16f8Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
90092bb16f8Smrgfi
9018255a313SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
90292bb16f8SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
90392bb16f8Smrg
9048255a313Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
9058255a313Smrg#
9068255a313Smrg# This file is free software; the Free Software Foundation
9078255a313Smrg# gives unlimited permission to copy and/or distribute it,
9088255a313Smrg# with or without modifications, as long as this notice is preserved.
9098255a313Smrg
9108255a313Smrg# serial 2
9118255a313Smrg
9128255a313Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
9138255a313Smrg# ---------------------------
9148255a313Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9158255a313Smrg# This macro is traced by Automake.
9168255a313SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9178255a313Smrg
9188255a313Smrg# AM_SUBST_NOTMAKE(VARIABLE)
9198255a313Smrg# ---------------------------
9208255a313Smrg# Public sister of _AM_SUBST_NOTMAKE.
9218255a313SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9228255a313Smrg
92392bb16f8Smrg# Check how to create a tarball.                            -*- Autoconf -*-
92492bb16f8Smrg
92592bb16f8Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
92692bb16f8Smrg#
92792bb16f8Smrg# This file is free software; the Free Software Foundation
92892bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
92992bb16f8Smrg# with or without modifications, as long as this notice is preserved.
93092bb16f8Smrg
93192bb16f8Smrg# serial 2
93292bb16f8Smrg
93392bb16f8Smrg# _AM_PROG_TAR(FORMAT)
93492bb16f8Smrg# --------------------
93592bb16f8Smrg# Check how to create a tarball in format FORMAT.
93692bb16f8Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
93792bb16f8Smrg#
93892bb16f8Smrg# Substitute a variable $(am__tar) that is a command
93992bb16f8Smrg# writing to stdout a FORMAT-tarball containing the directory
94092bb16f8Smrg# $tardir.
94192bb16f8Smrg#     tardir=directory && $(am__tar) > result.tar
94292bb16f8Smrg#
94392bb16f8Smrg# Substitute a variable $(am__untar) that extract such
94492bb16f8Smrg# a tarball read from stdin.
94592bb16f8Smrg#     $(am__untar) < result.tar
94692bb16f8SmrgAC_DEFUN([_AM_PROG_TAR],
94792bb16f8Smrg[# Always define AMTAR for backward compatibility.
94892bb16f8SmrgAM_MISSING_PROG([AMTAR], [tar])
94992bb16f8Smrgm4_if([$1], [v7],
95092bb16f8Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
95192bb16f8Smrg     [m4_case([$1], [ustar],, [pax],,
95292bb16f8Smrg              [m4_fatal([Unknown tar format])])
95392bb16f8SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
95492bb16f8Smrg# Loop over all known methods to create a tar archive until one works.
95592bb16f8Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
95692bb16f8Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
95792bb16f8Smrg# Do not fold the above two line into one, because Tru64 sh and
95892bb16f8Smrg# Solaris sh will not grok spaces in the rhs of `-'.
95992bb16f8Smrgfor _am_tool in $_am_tools
96092bb16f8Smrgdo
96192bb16f8Smrg  case $_am_tool in
96292bb16f8Smrg  gnutar)
96392bb16f8Smrg    for _am_tar in tar gnutar gtar;
96492bb16f8Smrg    do
96592bb16f8Smrg      AM_RUN_LOG([$_am_tar --version]) && break
96692bb16f8Smrg    done
96792bb16f8Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
96892bb16f8Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
96992bb16f8Smrg    am__untar="$_am_tar -xf -"
97092bb16f8Smrg    ;;
97192bb16f8Smrg  plaintar)
97292bb16f8Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
97392bb16f8Smrg    # ustar tarball either.
97492bb16f8Smrg    (tar --version) >/dev/null 2>&1 && continue
97592bb16f8Smrg    am__tar='tar chf - "$$tardir"'
97692bb16f8Smrg    am__tar_='tar chf - "$tardir"'
97792bb16f8Smrg    am__untar='tar xf -'
97892bb16f8Smrg    ;;
97992bb16f8Smrg  pax)
98092bb16f8Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
98192bb16f8Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
98292bb16f8Smrg    am__untar='pax -r'
98392bb16f8Smrg    ;;
98492bb16f8Smrg  cpio)
98592bb16f8Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
98692bb16f8Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
98792bb16f8Smrg    am__untar='cpio -i -H $1 -d'
98892bb16f8Smrg    ;;
98992bb16f8Smrg  none)
99092bb16f8Smrg    am__tar=false
99192bb16f8Smrg    am__tar_=false
99292bb16f8Smrg    am__untar=false
99392bb16f8Smrg    ;;
99492bb16f8Smrg  esac
99592bb16f8Smrg
99692bb16f8Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
99792bb16f8Smrg  # and am__untar set.
99892bb16f8Smrg  test -n "${am_cv_prog_tar_$1}" && break
99992bb16f8Smrg
100092bb16f8Smrg  # tar/untar a dummy directory, and stop if the command works
100192bb16f8Smrg  rm -rf conftest.dir
100292bb16f8Smrg  mkdir conftest.dir
100392bb16f8Smrg  echo GrepMe > conftest.dir/file
100492bb16f8Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
100592bb16f8Smrg  rm -rf conftest.dir
100692bb16f8Smrg  if test -s conftest.tar; then
100792bb16f8Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
100892bb16f8Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
100992bb16f8Smrg  fi
101092bb16f8Smrgdone
101192bb16f8Smrgrm -rf conftest.dir
101292bb16f8Smrg
101392bb16f8SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
101492bb16f8SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
101592bb16f8SmrgAC_SUBST([am__tar])
101692bb16f8SmrgAC_SUBST([am__untar])
101792bb16f8Smrg]) # _AM_PROG_TAR
101892bb16f8Smrg
10198255a313Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
10208255a313Smrgdnl
1021de7ed6e8Smrgdnl This file comes from X.Org's font-util 1.2.0
1022de7ed6e8Smrgdnl
1023de7ed6e8Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1024de7ed6e8Smrgdnl
1025de7ed6e8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1026de7ed6e8Smrgdnl copy of this software and associated documentation files (the "Software"),
1027de7ed6e8Smrgdnl to deal in the Software without restriction, including without limitation
1028de7ed6e8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1029de7ed6e8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1030de7ed6e8Smrgdnl Software is furnished to do so, subject to the following conditions:
1031de7ed6e8Smrgdnl
1032de7ed6e8Smrgdnl The above copyright notice and this permission notice (including the next
1033de7ed6e8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1034de7ed6e8Smrgdnl Software.
1035de7ed6e8Smrgdnl
1036de7ed6e8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1037de7ed6e8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1038de7ed6e8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1039de7ed6e8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1040de7ed6e8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1041de7ed6e8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1042de7ed6e8Smrgdnl DEALINGS IN THE SOFTWARE.
1043de7ed6e8Smrgdnl
1044de7ed6e8Smrgdnl --------------------------------------------------------------------
10458255a313Smrgdnl
10468255a313Smrgdnl Copyright 2005 Red Hat, Inc
10478255a313Smrgdnl
10488255a313Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
10498255a313Smrgdnl documentation for any purpose is hereby granted without fee, provided that
10508255a313Smrgdnl the above copyright notice appear in all copies and that both that
10518255a313Smrgdnl copyright notice and this permission notice appear in supporting
10528255a313Smrgdnl documentation.
10538255a313Smrgdnl
10548255a313Smrgdnl The above copyright notice and this permission notice shall be included
10558255a313Smrgdnl in all copies or substantial portions of the Software.
10568255a313Smrgdnl
10578255a313Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10588255a313Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10598255a313Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10608255a313Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
10618255a313Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
10628255a313Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
10638255a313Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
10648255a313Smrgdnl
10658255a313Smrgdnl Except as contained in this notice, the name of the copyright holders shall
10668255a313Smrgdnl not be used in advertising or otherwise to promote the sale, use or
10678255a313Smrgdnl other dealings in this Software without prior written authorization
10688255a313Smrgdnl from the copyright holders.
10698255a313Smrg
10708255a313Smrg# XORG_FONT_MACROS_VERSION(required-version)
10718255a313Smrg# ------------------------------------------
10728255a313Smrg# Minimum version: 1.1.0
10738255a313Smrg#
10748255a313Smrg# If you're using a macro added in Version 1.1 or newer, include this in
10758255a313Smrg# your configure.ac with the minimum required version, such as:
10768255a313Smrg# XORG_FONT_MACROS_VERSION(1.1)
10778255a313Smrg#
10788255a313Smrg# To ensure that this macro is defined, also add:
10798255a313Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
10808255a313Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
10818255a313Smrg#
10828255a313Smrg#
10838255a313Smrg# See the "minimum version" comment for each macro you use to see what
10848255a313Smrg# version you require.
10858255a313Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
1086de7ed6e8Smrgm4_define([vers_have], [1.2.0])
10878255a313Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
10888255a313Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
10898255a313Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
10908255a313Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
10918255a313Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
10928255a313Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
10938255a313Smrgm4_undefine([vers_have])
10948255a313Smrgm4_undefine([maj_have])
10958255a313Smrgm4_undefine([maj_needed])
10968255a313Smrg]) # XORG_FONT_MACROS_VERSION
10978255a313Smrg
10988255a313Smrg# XORG_FONT_CHECK_{maps}()
10998255a313Smrg# ------------------------
11008255a313Smrg# Minimum version: 1.0.0
11018255a313Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
11028255a313Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
11038255a313Smrg
11048255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
11058255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11068255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11078255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11088255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11098255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11108255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11118255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11128255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11138255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11148255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11158255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11168255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
11178255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
11188255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
11198255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
11208255a313SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
11218255a313SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
11228255a313Smrg
11238255a313Smrg# XORG_FONT_CHECK_ENCODING(encoding)
11248255a313Smrg# ----------------------------------
11258255a313Smrg# Minimum version: 1.1.0
11268255a313Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
11278255a313Smrg# It replaced individual copies of this code in the above macros in 1.1.
11288255a313Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
11298255a313Smrg# calls if this is not true in the future.
11308255a313Smrg
11318255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
11328255a313Smrg	AC_ARG_ENABLE(m4_tolower($1),
11338255a313Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
11348255a313Smrg				[Build $1 fonts (default: yes)]),
1135de7ed6e8Smrg		[AS_TR_SH($1)=$enableval])
11368255a313Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
11378255a313Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
11388255a313Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
11398255a313Smrg]) # XORG_FONT_CHECK_ENCODING
11408255a313Smrg
11418255a313Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
11428255a313Smrg# -----------------------------------------------------
11438255a313Smrg# Minimum version: 1.1.0
1144de7ed6e8Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1145de7ed6e8Smrg# Add a shorthand --enable/disable-all-encodings option.
11468255a313Smrg
11478255a313SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1148de7ed6e8Smrg	AC_ARG_ENABLE([all-encodings],
1149de7ed6e8Smrg		AS_HELP_STRING([--disable-all-encodings],
1150de7ed6e8Smrg				[Disable building of all font encodings]),
1151de7ed6e8Smrg		[m4_foreach_w([enc], [$1], [
1152de7ed6e8Smrg			AS_TR_SH(enc)=$enableval
1153de7ed6e8Smrg		])],
1154de7ed6e8Smrg		[m4_foreach_w([enc], [$1], [
1155de7ed6e8Smrg			AS_TR_SH(enc)=yes
1156de7ed6e8Smrg		])])
11578255a313Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
11588255a313Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
11598255a313Smrg
11608255a313Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
11618255a313Smrg# ------------------------------------------
11628255a313Smrg# Minimum version: 1.1.0
11638255a313Smrg#
11648255a313Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
11658255a313Smrg#
11668255a313Smrg
11678255a313SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
11688255a313Smrg	AC_PATH_PROG($1, $2)
1169de7ed6e8Smrg	if test x"$$1" = x; then
11708255a313Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
11718255a313Smrg	fi
11728255a313Smrg])
11738255a313Smrg
11748255a313Smrg
11758255a313Smrg# XORG_FONT_FCCACHE()
11768255a313Smrg# -------------------
11778255a313Smrg# Minimum version: 1.1.0
11788255a313Smrg#
11798255a313Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
11808255a313Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
11818255a313Smrg# to run fc-cache if found and not installing to $DESTDIR
11828255a313Smrg#
11838255a313Smrg# fc-cache is optional, not required, and should be skipped when making
11848255a313Smrg# packages (installing to $DESTDIR).
11858255a313Smrg#
11868255a313SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
11878255a313Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
11888255a313Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
11898255a313Smrg	if test x"$FCCACHE" = x ; then
11908255a313Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
11918255a313Smrg	else
11928255a313Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
11938255a313Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
11948255a313Smrg	fi
11958255a313Smrg	AC_SUBST([RUN_FCCACHE])
11968255a313Smrg])
11978255a313Smrg
11988255a313Smrg
11998255a313Smrg# XORG_FONT_COMMON_UTILS()
12008255a313Smrg# ------------------------
12018255a313Smrg# Minimum version: 1.1.0
12028255a313Smrg#
12038255a313Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
12048255a313Smrg
12058255a313SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
12068255a313Smrg	XORG_FONT_FCCACHE
12078255a313Smrg	XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
12088255a313Smrg])
12098255a313Smrg
12108255a313Smrg# XORG_FONT_SCALED_UTILS()
12118255a313Smrg# ------------------------
12128255a313Smrg# Minimum version: 1.1.0
12138255a313Smrg#
12148255a313Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
12158255a313Smrg# (TrueType, OpenType, Type1)
12168255a313Smrg
12178255a313SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
12188255a313Smrg	XORG_FONT_COMMON_UTILS
12198255a313Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
12208255a313Smrg])
12218255a313Smrg
12228255a313Smrg# XORG_FONT_BDF_UTILS()
12238255a313Smrg# ---------------------
12248255a313Smrg# Minimum version: 1.1.0
12258255a313Smrg#
12268255a313Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
12278255a313Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
12288255a313Smrg# PCF output files created by bdftopcf
12298255a313Smrg
12308255a313SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
12318255a313Smrg	XORG_FONT_COMMON_UTILS
12328255a313Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
12338255a313Smrg	XORG_FONT_CHECK_COMPRESSION
12348255a313Smrg])
12358255a313Smrg
12368255a313Smrg# XORG_FONT_CHECK_COMPRESSION()
12378255a313Smrg# -----------------------------
12388255a313Smrg# Minimum version: 1.1.0
12398255a313Smrg#
12408255a313Smrg# Offer a --with-compression flag to control what compression method is
12418255a313Smrg# used for pcf font files.   Offers all the methods currently supported
12428255a313Smrg# by libXfont, including no compression.
12438255a313Smrg
12448255a313SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
12458255a313Smrg	AC_MSG_CHECKING([font compression method])
12468255a313Smrg	AC_ARG_WITH(compression,
12478255a313Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
12488255a313Smrg			 [compression method to use on pcf fonts])],
12498255a313Smrg         [compression="$withval"], [compression="yes"])
12508255a313Smrg	if test x"$compression" = "xyes" ; then
12518255a313Smrg		compression="gzip"
12528255a313Smrg	fi
12538255a313Smrg	AC_MSG_RESULT([${compression}])
12548255a313Smrg	case ${compression} in
12558255a313Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
12568255a313Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
12578255a313Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
12588255a313Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
12598255a313Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
12608255a313Smrg	esac
12618255a313Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
12628255a313Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
12638255a313Smrg	fi
12648255a313Smrg	AC_SUBST([COMPRESS_SUFFIX])
12658255a313Smrg])
12668255a313Smrg
12678255a313Smrg# XORG_FONT_UCS2ANY()
12688255a313Smrg# -------------------
12698255a313Smrg# Minimum version: 1.1.0
12708255a313Smrg#
12718255a313Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
12728255a313Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
12738255a313Smrg# Also call pkg-config to find the directory with the encoding files needed
12748255a313Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
12758255a313Smrg
12768255a313SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
12778255a313Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
12788255a313Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
12798255a313Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
12808255a313Smrg	MAPFILES_PATH=`pkg-config --variable=mapdir fontutil`
12818255a313Smrg	AC_SUBST(MAPFILES_PATH)
12828255a313Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
12838255a313Smrg])
12848255a313Smrg
12858255a313Smrg
12868255a313Smrg
1287de7ed6e8Smrg# XORG_FONT_FC_CONFDIR()
1288de7ed6e8Smrg# --------------------
1289de7ed6e8Smrg# Minimum version: 1.2.0
1290de7ed6e8Smrg#
1291de7ed6e8Smrg# Sets FC_CONFDIR to the fontconfig config directory
1292de7ed6e8Smrg# (which should be --with-confdir=... when building fontconfig)
1293de7ed6e8Smrg# found from:
1294de7ed6e8Smrg#	--with-fc-confdir=...
1295de7ed6e8Smrg#	pkg-config --variable=confdir fontconfig
1296de7ed6e8Smrg#	${sysconfdir}/fonts
1297de7ed6e8Smrg
1298de7ed6e8SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1299de7ed6e8Smrg	dnl Ensure $PKG_CONFIG is set first
1300de7ed6e8Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1301de7ed6e8Smrg
1302de7ed6e8Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1303de7ed6e8Smrg	AC_ARG_WITH(fc-confdir,
1304de7ed6e8Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1305de7ed6e8Smrg			   [Path to fontconfig's configuration directory]),
1306de7ed6e8Smrg		    [FC_CONFDIR="$withval"])
1307de7ed6e8Smrg	# if --with-fc-confdir was not specified
1308de7ed6e8Smrg	if test "x${FC_CONFDIR}" = "x"; then
1309de7ed6e8Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1310de7ed6e8Smrg	fi
1311de7ed6e8Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1312de7ed6e8Smrg	if test "x${FC_CONFDIR}" = "x"; then
1313de7ed6e8Smrg		FC_CONFDIR="${sysconfdir}/fonts"
1314de7ed6e8Smrg	fi
1315de7ed6e8Smrg	AC_SUBST(FC_CONFDIR)
1316de7ed6e8Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
1317de7ed6e8Smrg])
1318de7ed6e8Smrg
1319de7ed6e8Smrg
1320de7ed6e8Smrg
13218255a313Smrg# XORG_FONTROOTDIR()
13228255a313Smrg# --------------------
13238255a313Smrg# Minimum version: 1.1.0
13248255a313Smrg#
13258255a313Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
13268255a313Smrg# found from:
13278255a313Smrg#	--with-fontrootdir
13288255a313Smrg#	pkg-config --variable=fontrootdir fontutil
13298255a313Smrg#	${datadir}/fonts/X11
13308255a313Smrg
13318255a313SmrgAC_DEFUN([XORG_FONTROOTDIR],[
13328255a313Smrg	dnl Ensure $PKG_CONFIG is set first
13338255a313Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13348255a313Smrg
13358255a313Smrg	AC_MSG_CHECKING([for root directory for font files])
13368255a313Smrg	AC_ARG_WITH(fontrootdir,
13378255a313Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
13388255a313Smrg			   [Path to root directory for font files]),
13398255a313Smrg		    [FONTROOTDIR="$withval"])
13408255a313Smrg	# if --with-fontrootdir not specified...
13418255a313Smrg	if test "x${FONTROOTDIR}" = "x"; then
13428255a313Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
13438255a313Smrg	fi
13448255a313Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
13458255a313Smrg	if test "x${FONTROOTDIR}" = "x"; then
13468255a313Smrg		FONTROOTDIR="${datadir}/fonts/X11"
13478255a313Smrg	fi
13488255a313Smrg	AC_SUBST(FONTROOTDIR)
13498255a313Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
13508255a313Smrg])
13518255a313Smrg
13528255a313Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
13538255a313Smrg# ---------------------------------------
13548255a313Smrg# Minimum version: 1.1.0
13558255a313Smrg#
13568255a313Smrg# Offer a --with-<flag> flag to control directory for font installation
13578255a313Smrg# Default is the specified <subdir> of the font root directory.
13588255a313Smrg# Sets <variable> to the selected directory
13598255a313Smrg
13608255a313SmrgAC_DEFUN([XORG_FONTSUBDIR],[
13618255a313Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
13628255a313Smrg
13638255a313Smrg	AC_MSG_CHECKING([for directory for $3 files])
13648255a313Smrg	AC_ARG_WITH($2,
13658255a313Smrg		    [AS_HELP_STRING([--with-$2=DIR],
1366de7ed6e8Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
13678255a313Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
13688255a313Smrg	AC_SUBST($1)
13698255a313Smrg	AC_MSG_RESULT([${$1}])
13708255a313Smrg]) # XORG_FONTSUBDIR
13718255a313Smrg
13728255a313Smrg# XORG_FONTDIR(subdir)
13738255a313Smrg# --------------------
13748255a313Smrg# Minimum version: 1.1.0
13758255a313Smrg#
13768255a313Smrg# Offer a --with-fontdir flag to control directory for font installation
13778255a313Smrg# Default is the specified subdir of the font root directory.
13788255a313Smrg# Sets FONTDIR to the selected directory
13798255a313Smrg
13808255a313SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
13818255a313Smrg
13828255a313Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
13838255a313Smrgdnl
1384de7ed6e8Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
13858255a313Smrgdnl 
13868255a313Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1387de7ed6e8Smrgdnl copy of this software and associated documentation files (the "Software"),
1388de7ed6e8Smrgdnl to deal in the Software without restriction, including without limitation
1389de7ed6e8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1390de7ed6e8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1391de7ed6e8Smrgdnl Software is furnished to do so, subject to the following conditions:
13928255a313Smrgdnl
1393de7ed6e8Smrgdnl The above copyright notice and this permission notice (including the next
1394de7ed6e8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1395de7ed6e8Smrgdnl Software.
13968255a313Smrgdnl
1397de7ed6e8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1398de7ed6e8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1399de7ed6e8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1400de7ed6e8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1401de7ed6e8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1402de7ed6e8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1403de7ed6e8Smrgdnl DEALINGS IN THE SOFTWARE.
14048255a313Smrg
14058255a313Smrg# XORG_MACROS_VERSION(required-version)
14068255a313Smrg# -------------------------------------
14078255a313Smrg# Minimum version: 1.1.0
14088255a313Smrg#
14098255a313Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14108255a313Smrg# your configure.ac with the minimum required version, such as:
14118255a313Smrg# XORG_MACROS_VERSION(1.1)
14128255a313Smrg#
14138255a313Smrg# To ensure that this macro is defined, also add:
14148255a313Smrg# m4_ifndef([XORG_MACROS_VERSION],
14158255a313Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14168255a313Smrg#
14178255a313Smrg#
14188255a313Smrg# See the "minimum version" comment for each macro you use to see what 
14198255a313Smrg# version you require.
14208255a313Smrgm4_defun([XORG_MACROS_VERSION],[
1421de7ed6e8Smrgm4_define([vers_have], [1.11.0])
14228255a313Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14238255a313Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14248255a313Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14258255a313Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14268255a313Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14278255a313Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14288255a313Smrgm4_undefine([vers_have])
14298255a313Smrgm4_undefine([maj_have])
14308255a313Smrgm4_undefine([maj_needed])
14318255a313Smrg]) # XORG_MACROS_VERSION
14328255a313Smrg
14338255a313Smrg# XORG_PROG_RAWCPP()
14348255a313Smrg# ------------------
14358255a313Smrg# Minimum version: 1.0.0
14368255a313Smrg#
14378255a313Smrg# Find cpp program and necessary flags for use in pre-processing text files
14388255a313Smrg# such as man pages and config files
14398255a313SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14408255a313SmrgAC_REQUIRE([AC_PROG_CPP])
14418255a313SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
14428255a313Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14438255a313Smrg
14448255a313Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14458255a313Smrg# which is not the best choice for supporting other OS'es, but covers most
14468255a313Smrg# of the ones we need for now.
14478255a313SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14488255a313SmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
14498255a313Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14508255a313Smrg	AC_MSG_RESULT([no])
14518255a313Smrgelse
14528255a313Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14538255a313Smrg		RAWCPPFLAGS=-undef
14548255a313Smrg		AC_MSG_RESULT([yes])
14558255a313Smrg	# under Cygwin unix is still defined even with -undef
14568255a313Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14578255a313Smrg		RAWCPPFLAGS="-undef -ansi"
14588255a313Smrg		AC_MSG_RESULT([yes, with -ansi])
14598255a313Smrg	else
14608255a313Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
14618255a313Smrg	fi
14628255a313Smrgfi
14638255a313Smrgrm -f conftest.$ac_ext
14648255a313Smrg
14658255a313SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
14668255a313SmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
14678255a313Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14688255a313Smrg	AC_MSG_RESULT([no])
14698255a313Smrgelse
14708255a313Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
14718255a313Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
14728255a313Smrg		AC_MSG_RESULT([yes])
14738255a313Smrg	else
14748255a313Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
14758255a313Smrg	fi
14768255a313Smrgfi
14778255a313Smrgrm -f conftest.$ac_ext
14788255a313SmrgAC_SUBST(RAWCPPFLAGS)
14798255a313Smrg]) # XORG_PROG_RAWCPP
14808255a313Smrg
14818255a313Smrg# XORG_MANPAGE_SECTIONS()
14828255a313Smrg# -----------------------
14838255a313Smrg# Minimum version: 1.0.0
14848255a313Smrg#
14858255a313Smrg# Determine which sections man pages go in for the different man page types
14868255a313Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
14878255a313Smrg# Not sure if there's any better way than just hardcoding by OS name.
14888255a313Smrg# Override default settings by setting environment variables
1489de7ed6e8Smrg# Added MAN_SUBSTS in version 1.8
1490de7ed6e8Smrg# Added AC_PROG_SED in version 1.8
14918255a313Smrg
14928255a313SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14938255a313SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1494de7ed6e8SmrgAC_REQUIRE([AC_PROG_SED])
14958255a313Smrg
14968255a313Smrgif test x$APP_MAN_SUFFIX = x    ; then
14978255a313Smrg    APP_MAN_SUFFIX=1
14988255a313Smrgfi
14998255a313Smrgif test x$APP_MAN_DIR = x    ; then
15008255a313Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15018255a313Smrgfi
15028255a313Smrg
15038255a313Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15048255a313Smrg    LIB_MAN_SUFFIX=3
15058255a313Smrgfi
15068255a313Smrgif test x$LIB_MAN_DIR = x    ; then
15078255a313Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15088255a313Smrgfi
15098255a313Smrg
15108255a313Smrgif test x$FILE_MAN_SUFFIX = x    ; then
15118255a313Smrg    case $host_os in
15128255a313Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
15138255a313Smrg	*)		FILE_MAN_SUFFIX=5  ;;
15148255a313Smrg    esac
15158255a313Smrgfi
15168255a313Smrgif test x$FILE_MAN_DIR = x    ; then
15178255a313Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15188255a313Smrgfi
15198255a313Smrg
15208255a313Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15218255a313Smrg    case $host_os in
15228255a313Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
15238255a313Smrg	*)		MISC_MAN_SUFFIX=7  ;;
15248255a313Smrg    esac
15258255a313Smrgfi
15268255a313Smrgif test x$MISC_MAN_DIR = x    ; then
15278255a313Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15288255a313Smrgfi
15298255a313Smrg
15308255a313Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15318255a313Smrg    case $host_os in
15328255a313Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
15338255a313Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
15348255a313Smrg    esac
15358255a313Smrgfi
15368255a313Smrgif test x$DRIVER_MAN_DIR = x    ; then
15378255a313Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15388255a313Smrgfi
15398255a313Smrg
15408255a313Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15418255a313Smrg    case $host_os in
15428255a313Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
15438255a313Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
15448255a313Smrg    esac
15458255a313Smrgfi
15468255a313Smrgif test x$ADMIN_MAN_DIR = x    ; then
15478255a313Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
15488255a313Smrgfi
15498255a313Smrg
15508255a313Smrg
15518255a313SmrgAC_SUBST([APP_MAN_SUFFIX])
15528255a313SmrgAC_SUBST([LIB_MAN_SUFFIX])
15538255a313SmrgAC_SUBST([FILE_MAN_SUFFIX])
15548255a313SmrgAC_SUBST([MISC_MAN_SUFFIX])
15558255a313SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
15568255a313SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
15578255a313SmrgAC_SUBST([APP_MAN_DIR])
15588255a313SmrgAC_SUBST([LIB_MAN_DIR])
15598255a313SmrgAC_SUBST([FILE_MAN_DIR])
15608255a313SmrgAC_SUBST([MISC_MAN_DIR])
15618255a313SmrgAC_SUBST([DRIVER_MAN_DIR])
15628255a313SmrgAC_SUBST([ADMIN_MAN_DIR])
1563de7ed6e8Smrg
1564de7ed6e8SmrgXORG_MAN_PAGE="X Version 11"
1565de7ed6e8SmrgAC_SUBST([XORG_MAN_PAGE])
1566de7ed6e8SmrgMAN_SUBSTS="\
1567de7ed6e8Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1568de7ed6e8Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1569de7ed6e8Smrg	-e 's|__xservername__|Xorg|g' \
1570de7ed6e8Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1571de7ed6e8Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1572de7ed6e8Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1573de7ed6e8Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1574de7ed6e8Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1575de7ed6e8Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1576de7ed6e8Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1577de7ed6e8Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1578de7ed6e8Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1579de7ed6e8SmrgAC_SUBST([MAN_SUBSTS])
1580de7ed6e8Smrg
15818255a313Smrg]) # XORG_MANPAGE_SECTIONS
15828255a313Smrg
1583de7ed6e8Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1584de7ed6e8Smrg# ------------------------
1585de7ed6e8Smrg# Minimum version: 1.7.0
1586de7ed6e8Smrg#
1587de7ed6e8Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1588de7ed6e8Smrg# provided by xorg-sgml-doctools, if installed.
1589de7ed6e8SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1590de7ed6e8SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1591de7ed6e8SmrgXORG_SGML_PATH=
1592de7ed6e8SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1593de7ed6e8Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1594de7ed6e8Smrg    [m4_ifval([$1],[:],
1595de7ed6e8Smrg        [if test x"$cross_compiling" != x"yes" ; then
1596de7ed6e8Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1597de7ed6e8Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1598de7ed6e8Smrg         fi])
1599de7ed6e8Smrg    ])
1600de7ed6e8Smrg
1601de7ed6e8Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1602de7ed6e8Smrg# the path and the name of the doc stylesheet
1603de7ed6e8Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1604de7ed6e8Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1605de7ed6e8Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1606de7ed6e8Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1607de7ed6e8Smrgelse
1608de7ed6e8Smrg   AC_MSG_RESULT([no])
1609de7ed6e8Smrgfi
1610de7ed6e8Smrg
1611de7ed6e8SmrgAC_SUBST(XORG_SGML_PATH)
1612de7ed6e8SmrgAC_SUBST(STYLESHEET_SRCDIR)
1613de7ed6e8SmrgAC_SUBST(XSL_STYLESHEET)
1614de7ed6e8SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1615de7ed6e8Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1616de7ed6e8Smrg
16178255a313Smrg# XORG_CHECK_LINUXDOC
16188255a313Smrg# -------------------
16198255a313Smrg# Minimum version: 1.0.0
16208255a313Smrg#
16218255a313Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16228255a313Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16238255a313Smrg# Whether or not the necessary tools and files are found can be checked
16248255a313Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16258255a313SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1626de7ed6e8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1627de7ed6e8SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16288255a313Smrg
16298255a313SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16308255a313Smrg
1631de7ed6e8SmrgAC_MSG_CHECKING([whether to build documentation])
16328255a313Smrg
1633de7ed6e8Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16348255a313Smrg   BUILDDOC=yes
16358255a313Smrgelse
16368255a313Smrg   BUILDDOC=no
16378255a313Smrgfi
16388255a313Smrg
16398255a313SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16408255a313Smrg
16418255a313SmrgAC_MSG_RESULT([$BUILDDOC])
16428255a313Smrg
1643de7ed6e8SmrgAC_MSG_CHECKING([whether to build pdf documentation])
16448255a313Smrg
1645de7ed6e8Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16468255a313Smrg   BUILDPDFDOC=yes
16478255a313Smrgelse
16488255a313Smrg   BUILDPDFDOC=no
16498255a313Smrgfi
16508255a313Smrg
16518255a313SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16528255a313Smrg
16538255a313SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16548255a313Smrg
1655de7ed6e8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16568255a313SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16578255a313SmrgMAKE_PDF="$PS2PDF"
16588255a313SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
16598255a313Smrg
16608255a313SmrgAC_SUBST(MAKE_TEXT)
16618255a313SmrgAC_SUBST(MAKE_PS)
16628255a313SmrgAC_SUBST(MAKE_PDF)
16638255a313SmrgAC_SUBST(MAKE_HTML)
16648255a313Smrg]) # XORG_CHECK_LINUXDOC
16658255a313Smrg
16668255a313Smrg# XORG_CHECK_DOCBOOK
16678255a313Smrg# -------------------
16688255a313Smrg# Minimum version: 1.0.0
16698255a313Smrg#
16708255a313Smrg# Checks for the ability to build output formats from SGML DocBook source.
16718255a313Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16728255a313Smrg# indicates whether the necessary tools and files are found and, if set,
16738255a313Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16748255a313SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1675de7ed6e8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1676de7ed6e8Smrg
16778255a313SmrgBUILDTXTDOC=no
16788255a313SmrgBUILDPDFDOC=no
16798255a313SmrgBUILDPSDOC=no
16808255a313SmrgBUILDHTMLDOC=no
16818255a313Smrg
16828255a313SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16838255a313SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16848255a313SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16858255a313SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16868255a313Smrg
1687de7ed6e8SmrgAC_MSG_CHECKING([whether to build text documentation])
1688de7ed6e8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16898255a313Smrg   test x$BUILD_TXTDOC != xno; then
16908255a313Smrg	BUILDTXTDOC=yes
16918255a313Smrgfi
16928255a313SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16938255a313SmrgAC_MSG_RESULT([$BUILDTXTDOC])
16948255a313Smrg
1695de7ed6e8SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1696de7ed6e8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16978255a313Smrg   test x$BUILD_PDFDOC != xno; then
16988255a313Smrg	BUILDPDFDOC=yes
16998255a313Smrgfi
17008255a313SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17018255a313SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17028255a313Smrg
1703de7ed6e8SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1704de7ed6e8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17058255a313Smrg   test x$BUILD_PSDOC != xno; then
17068255a313Smrg	BUILDPSDOC=yes
17078255a313Smrgfi
17088255a313SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17098255a313SmrgAC_MSG_RESULT([$BUILDPSDOC])
17108255a313Smrg
1711de7ed6e8SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1712de7ed6e8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17138255a313Smrg   test x$BUILD_HTMLDOC != xno; then
17148255a313Smrg	BUILDHTMLDOC=yes
17158255a313Smrgfi
17168255a313SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17178255a313SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17188255a313Smrg
17198255a313SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17208255a313SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17218255a313SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17228255a313SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17238255a313Smrg
17248255a313SmrgAC_SUBST(MAKE_TEXT)
17258255a313SmrgAC_SUBST(MAKE_PS)
17268255a313SmrgAC_SUBST(MAKE_PDF)
17278255a313SmrgAC_SUBST(MAKE_HTML)
17288255a313Smrg]) # XORG_CHECK_DOCBOOK
17298255a313Smrg
1730de7ed6e8Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1731de7ed6e8Smrg# ----------------
1732de7ed6e8Smrg# Minimum version: 1.5.0
1733de7ed6e8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1734de7ed6e8Smrg#
1735de7ed6e8Smrg# Documentation tools are not always available on all platforms and sometimes
1736de7ed6e8Smrg# not at the appropriate level. This macro enables a module to test for the
1737de7ed6e8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1738de7ed6e8Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1739de7ed6e8Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1740de7ed6e8Smrg# --with-xmlto assumes 'auto'.
1741de7ed6e8Smrg#
1742de7ed6e8Smrg# Interface to module:
1743de7ed6e8Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1744de7ed6e8Smrg# XMLTO:	returns the path of the xmlto program found
1745de7ed6e8Smrg#		returns the path set by the user in the environment
1746de7ed6e8Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1747de7ed6e8Smrg#		'no' user instructs the module not to use xmlto
1748de7ed6e8Smrg#
1749de7ed6e8Smrg# Added in version 1.10.0
1750de7ed6e8Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1751de7ed6e8Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1752de7ed6e8Smrg#
1753de7ed6e8Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1754de7ed6e8Smrg#
1755de7ed6e8SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1756de7ed6e8SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1757de7ed6e8Smrgm4_define([_defopt], m4_default([$2], [auto]))
1758de7ed6e8SmrgAC_ARG_WITH(xmlto,
1759de7ed6e8Smrg	AS_HELP_STRING([--with-xmlto],
1760de7ed6e8Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1761de7ed6e8Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1762de7ed6e8Smrgm4_undefine([_defopt])
1763de7ed6e8Smrg
1764de7ed6e8Smrgif test "x$use_xmlto" = x"auto"; then
1765de7ed6e8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1766de7ed6e8Smrg   if test "x$XMLTO" = "x"; then
1767de7ed6e8Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1768de7ed6e8Smrg	have_xmlto=no
1769de7ed6e8Smrg   else
1770de7ed6e8Smrg        have_xmlto=yes
1771de7ed6e8Smrg   fi
1772de7ed6e8Smrgelif test "x$use_xmlto" = x"yes" ; then
1773de7ed6e8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1774de7ed6e8Smrg   if test "x$XMLTO" = "x"; then
1775de7ed6e8Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1776de7ed6e8Smrg   fi
1777de7ed6e8Smrg   have_xmlto=yes
1778de7ed6e8Smrgelif test "x$use_xmlto" = x"no" ; then
1779de7ed6e8Smrg   if test "x$XMLTO" != "x"; then
1780de7ed6e8Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1781de7ed6e8Smrg   fi
1782de7ed6e8Smrg   have_xmlto=no
1783de7ed6e8Smrgelse
1784de7ed6e8Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1785de7ed6e8Smrgfi
1786de7ed6e8Smrg
1787de7ed6e8Smrg# Test for a minimum version of xmlto, if provided.
1788de7ed6e8Smrgm4_ifval([$1],
1789de7ed6e8Smrg[if test "$have_xmlto" = yes; then
1790de7ed6e8Smrg    # scrape the xmlto version
1791de7ed6e8Smrg    AC_MSG_CHECKING([the xmlto version])
1792de7ed6e8Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1793de7ed6e8Smrg    AC_MSG_RESULT([$xmlto_version])
1794de7ed6e8Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1795de7ed6e8Smrg        [if test "x$use_xmlto" = xauto; then
1796de7ed6e8Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1797de7ed6e8Smrg            have_xmlto=no
1798de7ed6e8Smrg        else
1799de7ed6e8Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1800de7ed6e8Smrg        fi])
1801de7ed6e8Smrgfi])
1802de7ed6e8Smrg
1803de7ed6e8Smrg# Test for the ability of xmlto to generate a text target
1804de7ed6e8Smrghave_xmlto_text=no
1805de7ed6e8Smrgcat > conftest.xml << "EOF"
1806de7ed6e8SmrgEOF
1807de7ed6e8SmrgAS_IF([test "$have_xmlto" = yes],
1808de7ed6e8Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1809de7ed6e8Smrg             [have_xmlto_text=yes],
1810de7ed6e8Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1811de7ed6e8Smrgrm -f conftest.xml
1812de7ed6e8SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1813de7ed6e8SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1814de7ed6e8Smrg]) # XORG_WITH_XMLTO
1815de7ed6e8Smrg
1816de7ed6e8Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1817de7ed6e8Smrg# ----------------
1818de7ed6e8Smrg# Minimum version: 1.5.0
1819de7ed6e8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1820de7ed6e8Smrg#
1821de7ed6e8Smrg# Documentation tools are not always available on all platforms and sometimes
1822de7ed6e8Smrg# not at the appropriate level. This macro enables a module to test for the
1823de7ed6e8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1824de7ed6e8Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1825de7ed6e8Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1826de7ed6e8Smrg# --with-asciidoc assumes 'auto'.
1827de7ed6e8Smrg#
1828de7ed6e8Smrg# Interface to module:
1829de7ed6e8Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1830de7ed6e8Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1831de7ed6e8Smrg#		 returns the path set by the user in the environment
1832de7ed6e8Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1833de7ed6e8Smrg#		  'no' user instructs the module not to use asciidoc
1834de7ed6e8Smrg#
1835de7ed6e8Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1836de7ed6e8Smrg#
1837de7ed6e8SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1838de7ed6e8SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1839de7ed6e8Smrgm4_define([_defopt], m4_default([$2], [auto]))
1840de7ed6e8SmrgAC_ARG_WITH(asciidoc,
1841de7ed6e8Smrg	AS_HELP_STRING([--with-asciidoc],
1842de7ed6e8Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1843de7ed6e8Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1844de7ed6e8Smrgm4_undefine([_defopt])
1845de7ed6e8Smrg
1846de7ed6e8Smrgif test "x$use_asciidoc" = x"auto"; then
1847de7ed6e8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1848de7ed6e8Smrg   if test "x$ASCIIDOC" = "x"; then
1849de7ed6e8Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1850de7ed6e8Smrg	have_asciidoc=no
1851de7ed6e8Smrg   else
1852de7ed6e8Smrg        have_asciidoc=yes
1853de7ed6e8Smrg   fi
1854de7ed6e8Smrgelif test "x$use_asciidoc" = x"yes" ; then
1855de7ed6e8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1856de7ed6e8Smrg   if test "x$ASCIIDOC" = "x"; then
1857de7ed6e8Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1858de7ed6e8Smrg   fi
1859de7ed6e8Smrg   have_asciidoc=yes
1860de7ed6e8Smrgelif test "x$use_asciidoc" = x"no" ; then
1861de7ed6e8Smrg   if test "x$ASCIIDOC" != "x"; then
1862de7ed6e8Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1863de7ed6e8Smrg   fi
1864de7ed6e8Smrg   have_asciidoc=no
1865de7ed6e8Smrgelse
1866de7ed6e8Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1867de7ed6e8Smrgfi
1868de7ed6e8Smrgm4_ifval([$1],
1869de7ed6e8Smrg[if test "$have_asciidoc" = yes; then
1870de7ed6e8Smrg    # scrape the asciidoc version
1871de7ed6e8Smrg    AC_MSG_CHECKING([the asciidoc version])
1872de7ed6e8Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1873de7ed6e8Smrg    AC_MSG_RESULT([$asciidoc_version])
1874de7ed6e8Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1875de7ed6e8Smrg        [if test "x$use_asciidoc" = xauto; then
1876de7ed6e8Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1877de7ed6e8Smrg            have_asciidoc=no
1878de7ed6e8Smrg        else
1879de7ed6e8Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1880de7ed6e8Smrg        fi])
1881de7ed6e8Smrgfi])
1882de7ed6e8SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1883de7ed6e8Smrg]) # XORG_WITH_ASCIIDOC
1884de7ed6e8Smrg
1885de7ed6e8Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1886de7ed6e8Smrg# --------------------------------
1887de7ed6e8Smrg# Minimum version: 1.5.0
1888de7ed6e8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1889de7ed6e8Smrg#
1890de7ed6e8Smrg# Documentation tools are not always available on all platforms and sometimes
1891de7ed6e8Smrg# not at the appropriate level. This macro enables a module to test for the
1892de7ed6e8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1893de7ed6e8Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1894de7ed6e8Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1895de7ed6e8Smrg# --with-doxygen assumes 'auto'.
1896de7ed6e8Smrg#
1897de7ed6e8Smrg# Interface to module:
1898de7ed6e8Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1899de7ed6e8Smrg# DOXYGEN:	 returns the path of the doxygen program found
1900de7ed6e8Smrg#		 returns the path set by the user in the environment
1901de7ed6e8Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1902de7ed6e8Smrg#		  'no' user instructs the module not to use doxygen
1903de7ed6e8Smrg#
1904de7ed6e8Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1905de7ed6e8Smrg#
1906de7ed6e8SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1907de7ed6e8SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1908de7ed6e8Smrgm4_define([_defopt], m4_default([$2], [auto]))
1909de7ed6e8SmrgAC_ARG_WITH(doxygen,
1910de7ed6e8Smrg	AS_HELP_STRING([--with-doxygen],
1911de7ed6e8Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1912de7ed6e8Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1913de7ed6e8Smrgm4_undefine([_defopt])
1914de7ed6e8Smrg
1915de7ed6e8Smrgif test "x$use_doxygen" = x"auto"; then
1916de7ed6e8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1917de7ed6e8Smrg   if test "x$DOXYGEN" = "x"; then
1918de7ed6e8Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1919de7ed6e8Smrg	have_doxygen=no
1920de7ed6e8Smrg   else
1921de7ed6e8Smrg        have_doxygen=yes
1922de7ed6e8Smrg   fi
1923de7ed6e8Smrgelif test "x$use_doxygen" = x"yes" ; then
1924de7ed6e8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1925de7ed6e8Smrg   if test "x$DOXYGEN" = "x"; then
1926de7ed6e8Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1927de7ed6e8Smrg   fi
1928de7ed6e8Smrg   have_doxygen=yes
1929de7ed6e8Smrgelif test "x$use_doxygen" = x"no" ; then
1930de7ed6e8Smrg   if test "x$DOXYGEN" != "x"; then
1931de7ed6e8Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1932de7ed6e8Smrg   fi
1933de7ed6e8Smrg   have_doxygen=no
1934de7ed6e8Smrgelse
1935de7ed6e8Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1936de7ed6e8Smrgfi
1937de7ed6e8Smrgm4_ifval([$1],
1938de7ed6e8Smrg[if test "$have_doxygen" = yes; then
1939de7ed6e8Smrg    # scrape the doxygen version
1940de7ed6e8Smrg    AC_MSG_CHECKING([the doxygen version])
1941de7ed6e8Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1942de7ed6e8Smrg    AC_MSG_RESULT([$doxygen_version])
1943de7ed6e8Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1944de7ed6e8Smrg        [if test "x$use_doxygen" = xauto; then
1945de7ed6e8Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1946de7ed6e8Smrg            have_doxygen=no
1947de7ed6e8Smrg        else
1948de7ed6e8Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1949de7ed6e8Smrg        fi])
1950de7ed6e8Smrgfi])
1951de7ed6e8SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1952de7ed6e8Smrg]) # XORG_WITH_DOXYGEN
1953de7ed6e8Smrg
1954de7ed6e8Smrg# XORG_WITH_GROFF([DEFAULT])
1955de7ed6e8Smrg# ----------------
1956de7ed6e8Smrg# Minimum version: 1.6.0
1957de7ed6e8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1958de7ed6e8Smrg#
1959de7ed6e8Smrg# Documentation tools are not always available on all platforms and sometimes
1960de7ed6e8Smrg# not at the appropriate level. This macro enables a module to test for the
1961de7ed6e8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1962de7ed6e8Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1963de7ed6e8Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1964de7ed6e8Smrg# --with-groff assumes 'auto'.
1965de7ed6e8Smrg#
1966de7ed6e8Smrg# Interface to module:
1967de7ed6e8Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1968de7ed6e8Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1969de7ed6e8Smrg# HAVE_GROFF_MS: the -ms macros package
1970de7ed6e8Smrg# GROFF:	 returns the path of the groff program found
1971de7ed6e8Smrg#		 returns the path set by the user in the environment
1972de7ed6e8Smrg# --with-groff:	 'yes' user instructs the module to use groff
1973de7ed6e8Smrg#		 'no' user instructs the module not to use groff
1974de7ed6e8Smrg#
1975de7ed6e8Smrg# Added in version 1.9.0:
1976de7ed6e8Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1977de7ed6e8Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1978de7ed6e8Smrg#		   psselect from the psutils package.
1979de7ed6e8Smrg#		   the ghostcript package. Refer to the grohtml man pages
1980de7ed6e8Smrg#
1981de7ed6e8Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1982de7ed6e8Smrg#
1983de7ed6e8Smrg# OS and distros often splits groff in a basic and full package, the former
1984de7ed6e8Smrg# having the groff program and the later having devices, fonts and macros
1985de7ed6e8Smrg# Checking for the groff executable is not enough.
1986de7ed6e8Smrg#
1987de7ed6e8Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1988de7ed6e8Smrg# unset HAVE_GROFF or GROFF env variables.
1989de7ed6e8Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1990de7ed6e8Smrg#
1991de7ed6e8SmrgAC_DEFUN([XORG_WITH_GROFF],[
1992de7ed6e8SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1993de7ed6e8Smrgm4_define([_defopt], m4_default([$1], [auto]))
1994de7ed6e8SmrgAC_ARG_WITH(groff,
1995de7ed6e8Smrg	AS_HELP_STRING([--with-groff],
1996de7ed6e8Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1997de7ed6e8Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1998de7ed6e8Smrgm4_undefine([_defopt])
1999de7ed6e8Smrg
2000de7ed6e8Smrgif test "x$use_groff" = x"auto"; then
2001de7ed6e8Smrg   AC_PATH_PROG([GROFF], [groff])
2002de7ed6e8Smrg   if test "x$GROFF" = "x"; then
2003de7ed6e8Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2004de7ed6e8Smrg	have_groff=no
2005de7ed6e8Smrg   else
2006de7ed6e8Smrg        have_groff=yes
2007de7ed6e8Smrg   fi
2008de7ed6e8Smrgelif test "x$use_groff" = x"yes" ; then
2009de7ed6e8Smrg   AC_PATH_PROG([GROFF], [groff])
2010de7ed6e8Smrg   if test "x$GROFF" = "x"; then
2011de7ed6e8Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2012de7ed6e8Smrg   fi
2013de7ed6e8Smrg   have_groff=yes
2014de7ed6e8Smrgelif test "x$use_groff" = x"no" ; then
2015de7ed6e8Smrg   if test "x$GROFF" != "x"; then
2016de7ed6e8Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2017de7ed6e8Smrg   fi
2018de7ed6e8Smrg   have_groff=no
2019de7ed6e8Smrgelse
2020de7ed6e8Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2021de7ed6e8Smrgfi
2022de7ed6e8Smrg
2023de7ed6e8Smrg# We have groff, test for the presence of the macro packages
2024de7ed6e8Smrgif test "x$have_groff" = x"yes"; then
2025de7ed6e8Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2026de7ed6e8Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2027de7ed6e8Smrg        groff_ms_works=yes
2028de7ed6e8Smrg    else
2029de7ed6e8Smrg        groff_ms_works=no
2030de7ed6e8Smrg    fi
2031de7ed6e8Smrg    AC_MSG_RESULT([$groff_ms_works])
2032de7ed6e8Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2033de7ed6e8Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2034de7ed6e8Smrg        groff_mm_works=yes
2035de7ed6e8Smrg    else
2036de7ed6e8Smrg        groff_mm_works=no
2037de7ed6e8Smrg    fi
2038de7ed6e8Smrg    AC_MSG_RESULT([$groff_mm_works])
2039de7ed6e8Smrgfi
2040de7ed6e8Smrg
2041de7ed6e8Smrg# We have groff, test for HTML dependencies, one command per package
2042de7ed6e8Smrgif test "x$have_groff" = x"yes"; then
2043de7ed6e8Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2044de7ed6e8Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2045de7ed6e8Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2046de7ed6e8Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2047de7ed6e8Smrg      have_groff_html=yes
2048de7ed6e8Smrg   else
2049de7ed6e8Smrg      have_groff_html=no
2050de7ed6e8Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2051de7ed6e8Smrg   fi
2052de7ed6e8Smrgfi
2053de7ed6e8Smrg
2054de7ed6e8Smrg# Set Automake conditionals for Makefiles
2055de7ed6e8SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2056de7ed6e8SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2057de7ed6e8SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2058de7ed6e8SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2059de7ed6e8Smrg]) # XORG_WITH_GROFF
2060de7ed6e8Smrg
2061de7ed6e8Smrg# XORG_WITH_FOP([DEFAULT])
2062de7ed6e8Smrg# ----------------
2063de7ed6e8Smrg# Minimum version: 1.6.0
2064de7ed6e8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2065de7ed6e8Smrg#
2066de7ed6e8Smrg# Documentation tools are not always available on all platforms and sometimes
2067de7ed6e8Smrg# not at the appropriate level. This macro enables a module to test for the
2068de7ed6e8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2069de7ed6e8Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2070de7ed6e8Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2071de7ed6e8Smrg# --with-fop assumes 'auto'.
2072de7ed6e8Smrg#
2073de7ed6e8Smrg# Interface to module:
2074de7ed6e8Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2075de7ed6e8Smrg# FOP:	 	returns the path of the fop program found
2076de7ed6e8Smrg#		returns the path set by the user in the environment
2077de7ed6e8Smrg# --with-fop: 	'yes' user instructs the module to use fop
2078de7ed6e8Smrg#		'no' user instructs the module not to use fop
2079de7ed6e8Smrg#
2080de7ed6e8Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2081de7ed6e8Smrg#
2082de7ed6e8SmrgAC_DEFUN([XORG_WITH_FOP],[
2083de7ed6e8SmrgAC_ARG_VAR([FOP], [Path to fop command])
2084de7ed6e8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2085de7ed6e8SmrgAC_ARG_WITH(fop,
2086de7ed6e8Smrg	AS_HELP_STRING([--with-fop],
2087de7ed6e8Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2088de7ed6e8Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2089de7ed6e8Smrgm4_undefine([_defopt])
2090de7ed6e8Smrg
2091de7ed6e8Smrgif test "x$use_fop" = x"auto"; then
2092de7ed6e8Smrg   AC_PATH_PROG([FOP], [fop])
2093de7ed6e8Smrg   if test "x$FOP" = "x"; then
2094de7ed6e8Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2095de7ed6e8Smrg	have_fop=no
2096de7ed6e8Smrg   else
2097de7ed6e8Smrg        have_fop=yes
2098de7ed6e8Smrg   fi
2099de7ed6e8Smrgelif test "x$use_fop" = x"yes" ; then
2100de7ed6e8Smrg   AC_PATH_PROG([FOP], [fop])
2101de7ed6e8Smrg   if test "x$FOP" = "x"; then
2102de7ed6e8Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2103de7ed6e8Smrg   fi
2104de7ed6e8Smrg   have_fop=yes
2105de7ed6e8Smrgelif test "x$use_fop" = x"no" ; then
2106de7ed6e8Smrg   if test "x$FOP" != "x"; then
2107de7ed6e8Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2108de7ed6e8Smrg   fi
2109de7ed6e8Smrg   have_fop=no
2110de7ed6e8Smrgelse
2111de7ed6e8Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2112de7ed6e8Smrgfi
2113de7ed6e8SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2114de7ed6e8Smrg]) # XORG_WITH_FOP
2115de7ed6e8Smrg
2116de7ed6e8Smrg# XORG_WITH_PS2PDF([DEFAULT])
2117de7ed6e8Smrg# ----------------
2118de7ed6e8Smrg# Minimum version: 1.6.0
2119de7ed6e8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2120de7ed6e8Smrg#
2121de7ed6e8Smrg# Documentation tools are not always available on all platforms and sometimes
2122de7ed6e8Smrg# not at the appropriate level. This macro enables a module to test for the
2123de7ed6e8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2124de7ed6e8Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2125de7ed6e8Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2126de7ed6e8Smrg# --with-ps2pdf assumes 'auto'.
2127de7ed6e8Smrg#
2128de7ed6e8Smrg# Interface to module:
2129de7ed6e8Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2130de7ed6e8Smrg# PS2PDF:	returns the path of the ps2pdf program found
2131de7ed6e8Smrg#		returns the path set by the user in the environment
2132de7ed6e8Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2133de7ed6e8Smrg#		 'no' user instructs the module not to use ps2pdf
2134de7ed6e8Smrg#
2135de7ed6e8Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2136de7ed6e8Smrg#
2137de7ed6e8SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2138de7ed6e8SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2139de7ed6e8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2140de7ed6e8SmrgAC_ARG_WITH(ps2pdf,
2141de7ed6e8Smrg	AS_HELP_STRING([--with-ps2pdf],
2142de7ed6e8Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2143de7ed6e8Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2144de7ed6e8Smrgm4_undefine([_defopt])
2145de7ed6e8Smrg
2146de7ed6e8Smrgif test "x$use_ps2pdf" = x"auto"; then
2147de7ed6e8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2148de7ed6e8Smrg   if test "x$PS2PDF" = "x"; then
2149de7ed6e8Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2150de7ed6e8Smrg	have_ps2pdf=no
2151de7ed6e8Smrg   else
2152de7ed6e8Smrg        have_ps2pdf=yes
2153de7ed6e8Smrg   fi
2154de7ed6e8Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2155de7ed6e8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2156de7ed6e8Smrg   if test "x$PS2PDF" = "x"; then
2157de7ed6e8Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2158de7ed6e8Smrg   fi
2159de7ed6e8Smrg   have_ps2pdf=yes
2160de7ed6e8Smrgelif test "x$use_ps2pdf" = x"no" ; then
2161de7ed6e8Smrg   if test "x$PS2PDF" != "x"; then
2162de7ed6e8Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2163de7ed6e8Smrg   fi
2164de7ed6e8Smrg   have_ps2pdf=no
2165de7ed6e8Smrgelse
2166de7ed6e8Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2167de7ed6e8Smrgfi
2168de7ed6e8SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2169de7ed6e8Smrg]) # XORG_WITH_PS2PDF
2170de7ed6e8Smrg
2171de7ed6e8Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2172de7ed6e8Smrg# ----------------
2173de7ed6e8Smrg# Minimum version: 1.6.0
2174de7ed6e8Smrg#
2175de7ed6e8Smrg# Documentation tools are not always available on all platforms and sometimes
2176de7ed6e8Smrg# not at the appropriate level. This macro enables a builder to skip all
2177de7ed6e8Smrg# documentation targets except traditional man pages.
2178de7ed6e8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2179de7ed6e8Smrg# maximum flexibilty in controlling documentation building.
2180de7ed6e8Smrg# Refer to:
2181de7ed6e8Smrg# XORG_WITH_XMLTO         --with-xmlto
2182de7ed6e8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2183de7ed6e8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2184de7ed6e8Smrg# XORG_WITH_FOP           --with-fop
2185de7ed6e8Smrg# XORG_WITH_GROFF         --with-groff
2186de7ed6e8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2187de7ed6e8Smrg#
2188de7ed6e8Smrg# Interface to module:
2189de7ed6e8Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2190de7ed6e8Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2191de7ed6e8Smrg#		 'no' user instructs the module not to generate docs
2192de7ed6e8Smrg# parm1:	specify the default value, yes or no.
2193de7ed6e8Smrg#
2194de7ed6e8SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2195de7ed6e8Smrgm4_define([default], m4_default([$1], [yes]))
2196de7ed6e8SmrgAC_ARG_ENABLE(docs,
2197de7ed6e8Smrg	AS_HELP_STRING([--enable-docs],
2198de7ed6e8Smrg	   [Enable building the documentation (default: ]default[)]),
2199de7ed6e8Smrg	   [build_docs=$enableval], [build_docs=]default)
2200de7ed6e8Smrgm4_undefine([default])
2201de7ed6e8SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2202de7ed6e8SmrgAC_MSG_CHECKING([whether to build documentation])
2203de7ed6e8SmrgAC_MSG_RESULT([$build_docs])
2204de7ed6e8Smrg]) # XORG_ENABLE_DOCS
2205de7ed6e8Smrg
2206de7ed6e8Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2207de7ed6e8Smrg# ----------------
2208de7ed6e8Smrg# Minimum version: 1.6.0
2209de7ed6e8Smrg#
2210de7ed6e8Smrg# This macro enables a builder to skip all developer documentation.
2211de7ed6e8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2212de7ed6e8Smrg# maximum flexibilty in controlling documentation building.
2213de7ed6e8Smrg# Refer to:
2214de7ed6e8Smrg# XORG_WITH_XMLTO         --with-xmlto
2215de7ed6e8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2216de7ed6e8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2217de7ed6e8Smrg# XORG_WITH_FOP           --with-fop
2218de7ed6e8Smrg# XORG_WITH_GROFF         --with-groff
2219de7ed6e8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2220de7ed6e8Smrg#
2221de7ed6e8Smrg# Interface to module:
2222de7ed6e8Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2223de7ed6e8Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2224de7ed6e8Smrg#			'no' user instructs the module not to generate developer docs
2225de7ed6e8Smrg# parm1:		specify the default value, yes or no.
2226de7ed6e8Smrg#
2227de7ed6e8SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2228de7ed6e8Smrgm4_define([devel_default], m4_default([$1], [yes]))
2229de7ed6e8SmrgAC_ARG_ENABLE(devel-docs,
2230de7ed6e8Smrg	AS_HELP_STRING([--enable-devel-docs],
2231de7ed6e8Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2232de7ed6e8Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2233de7ed6e8Smrgm4_undefine([devel_default])
2234de7ed6e8SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2235de7ed6e8SmrgAC_MSG_CHECKING([whether to build developer documentation])
2236de7ed6e8SmrgAC_MSG_RESULT([$build_devel_docs])
2237de7ed6e8Smrg]) # XORG_ENABLE_DEVEL_DOCS
2238de7ed6e8Smrg
2239de7ed6e8Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2240de7ed6e8Smrg# ----------------
2241de7ed6e8Smrg# Minimum version: 1.6.0
2242de7ed6e8Smrg#
2243de7ed6e8Smrg# This macro enables a builder to skip all functional specification targets.
2244de7ed6e8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2245de7ed6e8Smrg# maximum flexibilty in controlling documentation building.
2246de7ed6e8Smrg# Refer to:
2247de7ed6e8Smrg# XORG_WITH_XMLTO         --with-xmlto
2248de7ed6e8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2249de7ed6e8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2250de7ed6e8Smrg# XORG_WITH_FOP           --with-fop
2251de7ed6e8Smrg# XORG_WITH_GROFF         --with-groff
2252de7ed6e8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2253de7ed6e8Smrg#
2254de7ed6e8Smrg# Interface to module:
2255de7ed6e8Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2256de7ed6e8Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2257de7ed6e8Smrg#			'no' user instructs the module not to generate specs
2258de7ed6e8Smrg# parm1:		specify the default value, yes or no.
2259de7ed6e8Smrg#
2260de7ed6e8SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2261de7ed6e8Smrgm4_define([spec_default], m4_default([$1], [yes]))
2262de7ed6e8SmrgAC_ARG_ENABLE(specs,
2263de7ed6e8Smrg	AS_HELP_STRING([--enable-specs],
2264de7ed6e8Smrg	   [Enable building the specs (default: ]spec_default[)]),
2265de7ed6e8Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2266de7ed6e8Smrgm4_undefine([spec_default])
2267de7ed6e8SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2268de7ed6e8SmrgAC_MSG_CHECKING([whether to build functional specifications])
2269de7ed6e8SmrgAC_MSG_RESULT([$build_specs])
2270de7ed6e8Smrg]) # XORG_ENABLE_SPECS
2271de7ed6e8Smrg
22728255a313Smrg# XORG_CHECK_MALLOC_ZERO
22738255a313Smrg# ----------------------
22748255a313Smrg# Minimum version: 1.0.0
22758255a313Smrg#
22768255a313Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
22778255a313Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
22788255a313Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
22798255a313SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
22808255a313SmrgAC_ARG_ENABLE(malloc0returnsnull,
22818255a313Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
22828255a313Smrg		       [malloc(0) returns NULL (default: auto)]),
22838255a313Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
22848255a313Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
22858255a313Smrg
22868255a313SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
22878255a313Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
22888255a313Smrg	AC_RUN_IFELSE([
22898255a313Smrgchar *malloc();
22908255a313Smrgchar *realloc();
22918255a313Smrgchar *calloc();
22928255a313Smrgmain() {
22938255a313Smrg    char *m0, *r0, *c0, *p;
22948255a313Smrg    m0 = malloc(0);
22958255a313Smrg    p = malloc(10);
22968255a313Smrg    r0 = realloc(p,0);
22978255a313Smrg    c0 = calloc(0);
22988255a313Smrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
22998255a313Smrg}],
23008255a313Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2301de7ed6e8Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2302de7ed6e8Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
23038255a313Smrgfi
23048255a313SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
23058255a313Smrg
23068255a313Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
23078255a313Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
23088255a313Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
23098255a313Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
23108255a313Smrgelse
23118255a313Smrg	MALLOC_ZERO_CFLAGS=""
23128255a313Smrg	XMALLOC_ZERO_CFLAGS=""
23138255a313Smrg	XTMALLOC_ZERO_CFLAGS=""
23148255a313Smrgfi
23158255a313Smrg
23168255a313SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
23178255a313SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
23188255a313SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
23198255a313Smrg]) # XORG_CHECK_MALLOC_ZERO
23208255a313Smrg
23218255a313Smrg# XORG_WITH_LINT()
23228255a313Smrg# ----------------
23238255a313Smrg# Minimum version: 1.1.0
23248255a313Smrg#
2325de7ed6e8Smrg# This macro enables the use of a tool that flags some suspicious and
2326de7ed6e8Smrg# non-portable constructs (likely to be bugs) in C language source code.
2327de7ed6e8Smrg# It will attempt to locate the tool and use appropriate options.
2328de7ed6e8Smrg# There are various lint type tools on different platforms.
2329de7ed6e8Smrg#
2330de7ed6e8Smrg# Interface to module:
2331de7ed6e8Smrg# LINT:		returns the path to the tool found on the platform
2332de7ed6e8Smrg#		or the value set to LINT on the configure cmd line
2333de7ed6e8Smrg#		also an Automake conditional
2334de7ed6e8Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2335de7ed6e8Smrg#
2336de7ed6e8Smrg# --with-lint:	'yes' user instructs the module to use lint
2337de7ed6e8Smrg#		'no' user instructs the module not to use lint (default)
2338de7ed6e8Smrg#
2339de7ed6e8Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2340de7ed6e8Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
23418255a313Smrg#
23428255a313SmrgAC_DEFUN([XORG_WITH_LINT],[
23438255a313Smrg
2344de7ed6e8SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2345de7ed6e8SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
23468255a313SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
23478255a313Smrg		[Use a lint-style source code checker (default: disabled)])],
23488255a313Smrg		[use_lint=$withval], [use_lint=no])
2349de7ed6e8Smrg
2350de7ed6e8Smrg# Obtain platform specific info like program name and options
2351de7ed6e8Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2352de7ed6e8Smrgcase $host_os in
2353de7ed6e8Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2354de7ed6e8Smrg	lint_name=splint
2355de7ed6e8Smrg	lint_options="-badflag"
2356de7ed6e8Smrg	;;
2357de7ed6e8Smrg  *freebsd* | *netbsd*)
2358de7ed6e8Smrg	lint_name=lint
2359de7ed6e8Smrg	lint_options="-u -b"
2360de7ed6e8Smrg	;;
2361de7ed6e8Smrg  *solaris*)
2362de7ed6e8Smrg	lint_name=lint
2363de7ed6e8Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2364de7ed6e8Smrg	;;
2365de7ed6e8Smrgesac
2366de7ed6e8Smrg
2367de7ed6e8Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2368de7ed6e8Smrgif test "x$use_lint" = x"yes" ; then
2369de7ed6e8Smrg   AC_PATH_PROG([LINT], [$lint_name])
2370de7ed6e8Smrg   if test "x$LINT" = "x"; then
2371de7ed6e8Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2372de7ed6e8Smrg   fi
2373de7ed6e8Smrgelif test "x$use_lint" = x"no" ; then
2374de7ed6e8Smrg   if test "x$LINT" != "x"; then
2375de7ed6e8Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2376de7ed6e8Smrg   fi
23778255a313Smrgelse
2378de7ed6e8Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
23798255a313Smrgfi
2380de7ed6e8Smrg
2381de7ed6e8Smrg# User supplied flags override default flags
2382de7ed6e8Smrgif test "x$LINT_FLAGS" != "x"; then
2383de7ed6e8Smrg   lint_options=$LINT_FLAGS
23848255a313Smrgfi
23858255a313Smrg
2386de7ed6e8SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2387de7ed6e8SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
23888255a313Smrg
23898255a313Smrg]) # XORG_WITH_LINT
23908255a313Smrg
23918255a313Smrg# XORG_LINT_LIBRARY(LIBNAME)
23928255a313Smrg# --------------------------
23938255a313Smrg# Minimum version: 1.1.0
23948255a313Smrg#
23958255a313Smrg# Sets up flags for building lint libraries for checking programs that call
23968255a313Smrg# functions in the library.
23978255a313Smrg#
2398de7ed6e8Smrg# Interface to module:
2399de7ed6e8Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2400de7ed6e8Smrg# MAKE_LINT_LIB		- Automake conditional
2401de7ed6e8Smrg#
2402de7ed6e8Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2403de7ed6e8Smrg#			  - 'no' user instructs the module not to create a lint library (default)
24048255a313Smrg
24058255a313SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
24068255a313SmrgAC_REQUIRE([XORG_WITH_LINT])
24078255a313SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
24088255a313Smrg	[Create lint library (default: disabled)])],
24098255a313Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2410de7ed6e8Smrg
2411de7ed6e8Smrgif test "x$make_lint_lib" = x"yes" ; then
2412de7ed6e8Smrg   LINTLIB=llib-l$1.ln
2413de7ed6e8Smrg   if test "x$LINT" = "x"; then
2414de7ed6e8Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2415de7ed6e8Smrg   fi
2416de7ed6e8Smrgelif test "x$make_lint_lib" != x"no" ; then
2417de7ed6e8Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
24188255a313Smrgfi
2419de7ed6e8Smrg
24208255a313SmrgAC_SUBST(LINTLIB)
24218255a313SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
24228255a313Smrg
24238255a313Smrg]) # XORG_LINT_LIBRARY
24248255a313Smrg
24258255a313Smrg# XORG_CWARNFLAGS
24268255a313Smrg# ---------------
24278255a313Smrg# Minimum version: 1.2.0
24288255a313Smrg#
24298255a313Smrg# Defines CWARNFLAGS to enable C compiler warnings.
24308255a313Smrg#
24318255a313SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2432de7ed6e8SmrgAC_REQUIRE([AC_PROG_CC_C99])
24338255a313Smrgif  test "x$GCC" = xyes ; then
24348255a313Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
24358255a313Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
2436de7ed6e8Smrg-Wbad-function-cast -Wformat=2"
24378255a313Smrg    case `$CC -dumpversion` in
24388255a313Smrg    3.4.* | 4.*)
24398255a313Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
24408255a313Smrg	;;
24418255a313Smrg    esac
24428255a313Smrgelse
24438255a313Smrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
24448255a313Smrg    if test "x$SUNCC" = "xyes"; then
24458255a313Smrg	CWARNFLAGS="-v"
24468255a313Smrg    fi
24478255a313Smrgfi
24488255a313SmrgAC_SUBST(CWARNFLAGS)
24498255a313Smrg]) # XORG_CWARNFLAGS
24508255a313Smrg
24518255a313Smrg# XORG_STRICT_OPTION
24528255a313Smrg# -----------------------
24538255a313Smrg# Minimum version: 1.3.0
24548255a313Smrg#
24558255a313Smrg# Add configure option to enable strict compilation
24568255a313SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2457de7ed6e8Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
24588255a313SmrgAC_REQUIRE([AC_PROG_CC_C99])
24598255a313SmrgAC_REQUIRE([XORG_CWARNFLAGS])
24608255a313Smrg
24618255a313SmrgAC_ARG_ENABLE(strict-compilation,
24628255a313Smrg			  AS_HELP_STRING([--enable-strict-compilation],
24638255a313Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
24648255a313Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
24658255a313Smrgif test "x$STRICT_COMPILE" = "xyes"; then
24668255a313Smrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
24678255a313Smrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
24688255a313Smrg	if test "x$GCC" = xyes ; then
24698255a313Smrg		STRICT_CFLAGS="-pedantic -Werror"
24708255a313Smrg	elif test "x$SUNCC" = "xyes"; then
24718255a313Smrg		STRICT_CFLAGS="-errwarn"
24728255a313Smrg    elif test "x$INTELCC" = "xyes"; then
24738255a313Smrg		STRICT_CFLAGS="-Werror"
24748255a313Smrg	fi
24758255a313Smrgfi
24768255a313SmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
24778255a313SmrgAC_SUBST([CWARNFLAGS])
24788255a313Smrg]) # XORG_STRICT_OPTION
24798255a313Smrg
24808255a313Smrg# XORG_DEFAULT_OPTIONS
24818255a313Smrg# --------------------
24828255a313Smrg# Minimum version: 1.3.0
24838255a313Smrg#
24848255a313Smrg# Defines default options for X.Org modules.
24858255a313Smrg#
24868255a313SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2487de7ed6e8SmrgAC_REQUIRE([AC_PROG_INSTALL])
24888255a313SmrgXORG_CWARNFLAGS
24898255a313SmrgXORG_STRICT_OPTION
24908255a313SmrgXORG_RELEASE_VERSION
24918255a313SmrgXORG_CHANGELOG
2492de7ed6e8SmrgXORG_INSTALL
24938255a313SmrgXORG_MANPAGE_SECTIONS
2494de7ed6e8Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2495de7ed6e8Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
24968255a313Smrg]) # XORG_DEFAULT_OPTIONS
2497de7ed6e8Smrg
2498de7ed6e8Smrg# XORG_INSTALL()
2499de7ed6e8Smrg# ----------------
2500de7ed6e8Smrg# Minimum version: 1.4.0
2501de7ed6e8Smrg#
2502de7ed6e8Smrg# Defines the variable INSTALL_CMD as the command to copy
2503de7ed6e8Smrg# INSTALL from $prefix/share/util-macros.
2504de7ed6e8Smrg#
2505de7ed6e8SmrgAC_DEFUN([XORG_INSTALL], [
2506de7ed6e8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2507de7ed6e8Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2508de7ed6e8SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2509de7ed6e8Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2510de7ed6e8Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2511de7ed6e8Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2512de7ed6e8SmrgAC_SUBST([INSTALL_CMD])
2513de7ed6e8Smrg]) # XORG_INSTALL
25148255a313Smrgdnl Copyright 2005 Red Hat, Inc
25158255a313Smrgdnl
25168255a313Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
25178255a313Smrgdnl documentation for any purpose is hereby granted without fee, provided that
25188255a313Smrgdnl the above copyright notice appear in all copies and that both that
25198255a313Smrgdnl copyright notice and this permission notice appear in supporting
25208255a313Smrgdnl documentation.
25218255a313Smrgdnl
25228255a313Smrgdnl The above copyright notice and this permission notice shall be included
25238255a313Smrgdnl in all copies or substantial portions of the Software.
25248255a313Smrgdnl
25258255a313Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25268255a313Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25278255a313Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25288255a313Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
25298255a313Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25308255a313Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25318255a313Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
25328255a313Smrgdnl
25338255a313Smrgdnl Except as contained in this notice, the name of the copyright holders shall
25348255a313Smrgdnl not be used in advertising or otherwise to promote the sale, use or
25358255a313Smrgdnl other dealings in this Software without prior written authorization
25368255a313Smrgdnl from the copyright holders.
25378255a313Smrgdnl
25388255a313Smrg
25398255a313Smrg# XORG_RELEASE_VERSION
25408255a313Smrg# --------------------
2541de7ed6e8Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
25428255a313Smrg 
25438255a313SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
25448255a313Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
25458255a313Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
25468255a313Smrg		[Major version of this package])
25478255a313Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
25488255a313Smrg	if test "x$PVM" = "x"; then
25498255a313Smrg		PVM="0"
25508255a313Smrg	fi
25518255a313Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
25528255a313Smrg		[$PVM],
25538255a313Smrg		[Minor version of this package])
25548255a313Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
25558255a313Smrg	if test "x$PVP" = "x"; then
25568255a313Smrg		PVP="0"
25578255a313Smrg	fi
25588255a313Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
25598255a313Smrg		[$PVP],
25608255a313Smrg		[Patch version of this package])
25618255a313Smrg])
25628255a313Smrg
25638255a313Smrg# XORG_CHANGELOG()
25648255a313Smrg# ----------------
25658255a313Smrg# Minimum version: 1.2.0
25668255a313Smrg#
25678255a313Smrg# Defines the variable CHANGELOG_CMD as the command to generate
25688255a313Smrg# ChangeLog from git.
25698255a313Smrg#
25708255a313Smrg#
25718255a313SmrgAC_DEFUN([XORG_CHANGELOG], [
2572de7ed6e8SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2573de7ed6e8Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2574de7ed6e8Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
25758255a313Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
25768255a313SmrgAC_SUBST([CHANGELOG_CMD])
25778255a313Smrg]) # XORG_CHANGELOG
25788255a313Smrg
25798255a313Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
25808255a313Smrg# 
25818255a313Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
25828255a313Smrg#
25838255a313Smrg# This program is free software; you can redistribute it and/or modify
25848255a313Smrg# it under the terms of the GNU General Public License as published by
25858255a313Smrg# the Free Software Foundation; either version 2 of the License, or
25868255a313Smrg# (at your option) any later version.
25878255a313Smrg#
25888255a313Smrg# This program is distributed in the hope that it will be useful, but
25898255a313Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
25908255a313Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25918255a313Smrg# General Public License for more details.
25928255a313Smrg#
25938255a313Smrg# You should have received a copy of the GNU General Public License
25948255a313Smrg# along with this program; if not, write to the Free Software
25958255a313Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25968255a313Smrg#
25978255a313Smrg# As a special exception to the GNU General Public License, if you
25988255a313Smrg# distribute this file as part of a program that contains a
25998255a313Smrg# configuration script generated by Autoconf, you may include it under
26008255a313Smrg# the same distribution terms that you use for the rest of that program.
26018255a313Smrg
26028255a313Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
26038255a313Smrg# ----------------------------------
26048255a313SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
26058255a313Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
26068255a313Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
26078255a313SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
26088255a313Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
26098255a313Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
26108255a313Smrgfi
26118255a313Smrgif test -n "$PKG_CONFIG"; then
26128255a313Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
26138255a313Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
26148255a313Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
26158255a313Smrg		AC_MSG_RESULT([yes])
26168255a313Smrg	else
26178255a313Smrg		AC_MSG_RESULT([no])
26188255a313Smrg		PKG_CONFIG=""
26198255a313Smrg	fi
26208255a313Smrg		
26218255a313Smrgfi[]dnl
26228255a313Smrg])# PKG_PROG_PKG_CONFIG
26238255a313Smrg
26248255a313Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
26258255a313Smrg#
26268255a313Smrg# Check to see whether a particular set of modules exists.  Similar
26278255a313Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
26288255a313Smrg#
26298255a313Smrg#
26308255a313Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
26318255a313Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
26328255a313Smrg# PKG_CHECK_EXISTS manually
26338255a313Smrg# --------------------------------------------------------------
26348255a313SmrgAC_DEFUN([PKG_CHECK_EXISTS],
26358255a313Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
26368255a313Smrgif test -n "$PKG_CONFIG" && \
26378255a313Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
26388255a313Smrg  m4_ifval([$2], [$2], [:])
26398255a313Smrgm4_ifvaln([$3], [else
26408255a313Smrg  $3])dnl
26418255a313Smrgfi])
26428255a313Smrg
26438255a313Smrg
26448255a313Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
26458255a313Smrg# ---------------------------------------------
26468255a313Smrgm4_define([_PKG_CONFIG],
26478255a313Smrg[if test -n "$$1"; then
26488255a313Smrg    pkg_cv_[]$1="$$1"
26498255a313Smrg elif test -n "$PKG_CONFIG"; then
26508255a313Smrg    PKG_CHECK_EXISTS([$3],
26518255a313Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
26528255a313Smrg		     [pkg_failed=yes])
26538255a313Smrg else
26548255a313Smrg    pkg_failed=untried
26558255a313Smrgfi[]dnl
26568255a313Smrg])# _PKG_CONFIG
26578255a313Smrg
26588255a313Smrg# _PKG_SHORT_ERRORS_SUPPORTED
26598255a313Smrg# -----------------------------
26608255a313SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
26618255a313Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
26628255a313Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
26638255a313Smrg        _pkg_short_errors_supported=yes
26648255a313Smrgelse
26658255a313Smrg        _pkg_short_errors_supported=no
26668255a313Smrgfi[]dnl
26678255a313Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
26688255a313Smrg
26698255a313Smrg
26708255a313Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
26718255a313Smrg# [ACTION-IF-NOT-FOUND])
26728255a313Smrg#
26738255a313Smrg#
26748255a313Smrg# Note that if there is a possibility the first call to
26758255a313Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
26768255a313Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
26778255a313Smrg#
26788255a313Smrg#
26798255a313Smrg# --------------------------------------------------------------
26808255a313SmrgAC_DEFUN([PKG_CHECK_MODULES],
26818255a313Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
26828255a313SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
26838255a313SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
26848255a313Smrg
26858255a313Smrgpkg_failed=no
26868255a313SmrgAC_MSG_CHECKING([for $1])
26878255a313Smrg
26888255a313Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
26898255a313Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
26908255a313Smrg
26918255a313Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
26928255a313Smrgand $1[]_LIBS to avoid the need to call pkg-config.
26938255a313SmrgSee the pkg-config man page for more details.])
26948255a313Smrg
26958255a313Smrgif test $pkg_failed = yes; then
26968255a313Smrg        _PKG_SHORT_ERRORS_SUPPORTED
26978255a313Smrg        if test $_pkg_short_errors_supported = yes; then
26988255a313Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
26998255a313Smrg        else 
27008255a313Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
27018255a313Smrg        fi
27028255a313Smrg	# Put the nasty error message in config.log where it belongs
27038255a313Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
27048255a313Smrg
27058255a313Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
27068255a313Smrg[Package requirements ($2) were not met:
27078255a313Smrg
27088255a313Smrg$$1_PKG_ERRORS
27098255a313Smrg
27108255a313SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
27118255a313Smrginstalled software in a non-standard prefix.
27128255a313Smrg
27138255a313Smrg_PKG_TEXT
27148255a313Smrg])],
27158255a313Smrg		[AC_MSG_RESULT([no])
27168255a313Smrg                $4])
27178255a313Smrgelif test $pkg_failed = untried; then
27188255a313Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
27198255a313Smrg[The pkg-config script could not be found or is too old.  Make sure it
27208255a313Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
27218255a313Smrgpath to pkg-config.
27228255a313Smrg
27238255a313Smrg_PKG_TEXT
27248255a313Smrg
27258255a313SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
27268255a313Smrg		[$4])
27278255a313Smrgelse
27288255a313Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
27298255a313Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
27308255a313Smrg        AC_MSG_RESULT([yes])
27318255a313Smrg	ifelse([$3], , :, [$3])
27328255a313Smrgfi[]dnl
27338255a313Smrg])# PKG_CHECK_MODULES
27348255a313Smrg
2735