aclocal.m4 revision 5977a007
15977a007Smrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
28108eb18Smrg
31a650d1eSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
45977a007Smrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
55977a007Smrg# Inc.
68108eb18Smrg# This file is free software; the Free Software Foundation
78108eb18Smrg# gives unlimited permission to copy and/or distribute it,
88108eb18Smrg# with or without modifications, as long as this notice is preserved.
98108eb18Smrg
108108eb18Smrg# This program is distributed in the hope that it will be useful,
118108eb18Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
128108eb18Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
138108eb18Smrg# PARTICULAR PURPOSE.
148108eb18Smrg
151a650d1eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
161a650d1eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
171a650d1eSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
181a650d1eSmrg[m4_warning([this file was generated for autoconf 2.68.
191a650d1eSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
201a650d1eSmrgIf you have problems, you may need to regenerate the build system entirely.
211a650d1eSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
228108eb18Smrg
235977a007Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
245977a007Smrg# Foundation, Inc.
251a650d1eSmrg#
261a650d1eSmrg# This file is free software; the Free Software Foundation
271a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
281a650d1eSmrg# with or without modifications, as long as this notice is preserved.
298108eb18Smrg
305977a007Smrg# serial 1
315977a007Smrg
328108eb18Smrg# AM_AUTOMAKE_VERSION(VERSION)
338108eb18Smrg# ----------------------------
348108eb18Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
358108eb18Smrg# generated from the m4 files accompanying Automake X.Y.
361a650d1eSmrg# (This private macro should not be called outside this file.)
371a650d1eSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
381a650d1eSmrg[am__api_version='1.11'
391a650d1eSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
401a650d1eSmrgdnl require some minimum version.  Point them to the right macro.
415977a007Smrgm4_if([$1], [1.11.2], [],
421a650d1eSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
431a650d1eSmrg])
441a650d1eSmrg
451a650d1eSmrg# _AM_AUTOCONF_VERSION(VERSION)
461a650d1eSmrg# -----------------------------
471a650d1eSmrg# aclocal traces this macro to find the Autoconf version.
481a650d1eSmrg# This is a private macro too.  Using m4_define simplifies
491a650d1eSmrg# the logic in aclocal, which can simply ignore this definition.
501a650d1eSmrgm4_define([_AM_AUTOCONF_VERSION], [])
518108eb18Smrg
528108eb18Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
538108eb18Smrg# -------------------------------
541a650d1eSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
551a650d1eSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
568108eb18SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
575977a007Smrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
581a650d1eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
591a650d1eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
601a650d1eSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
618108eb18Smrg
621a650d1eSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
638108eb18Smrg
645977a007Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
658108eb18Smrg#
661a650d1eSmrg# This file is free software; the Free Software Foundation
671a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
681a650d1eSmrg# with or without modifications, as long as this notice is preserved.
698108eb18Smrg
705977a007Smrg# serial 1
715977a007Smrg
728108eb18Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
738108eb18Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
748108eb18Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
758108eb18Smrg#
768108eb18Smrg# Of course, Automake must honor this variable whenever it calls a
778108eb18Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
788108eb18Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
798108eb18Smrg# depending on how configure is run.  This is pretty annoying, since
808108eb18Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
818108eb18Smrg# source directory, any form will work fine, but in subdirectories a
828108eb18Smrg# relative path needs to be adjusted first.
838108eb18Smrg#
848108eb18Smrg# $ac_aux_dir/missing
858108eb18Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
868108eb18Smrg# $top_srcdir/$ac_aux_dir/missing
878108eb18Smrg#    fails if $ac_aux_dir is absolute,
888108eb18Smrg#    fails when called from a subdirectory in a VPATH build with
898108eb18Smrg#          a relative $ac_aux_dir
908108eb18Smrg#
918108eb18Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
928108eb18Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
938108eb18Smrg# harmless because $srcdir is `.', but things will broke when you
948108eb18Smrg# start a VPATH build or use an absolute $srcdir.
958108eb18Smrg#
968108eb18Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
978108eb18Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
988108eb18Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
998108eb18Smrg# and then we would define $MISSING as
1008108eb18Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
1018108eb18Smrg# This will work as long as MISSING is not called from configure, because
1028108eb18Smrg# unfortunately $(top_srcdir) has no meaning in configure.
1038108eb18Smrg# However there are other variables, like CC, which are often used in
1048108eb18Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1058108eb18Smrg#
1068108eb18Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1078108eb18Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1088108eb18Smrg# configured tree to be moved without reconfiguration.
1098108eb18Smrg
1101a650d1eSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1111a650d1eSmrg[dnl Rely on autoconf to set up CDPATH properly.
1121a650d1eSmrgAC_PREREQ([2.50])dnl
1138108eb18Smrg# expand $ac_aux_dir to an absolute path
1148108eb18Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
1158108eb18Smrg])
1168108eb18Smrg
1171a650d1eSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1188108eb18Smrg
1191a650d1eSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1201a650d1eSmrg# Free Software Foundation, Inc.
1211a650d1eSmrg#
1221a650d1eSmrg# This file is free software; the Free Software Foundation
1231a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
1241a650d1eSmrg# with or without modifications, as long as this notice is preserved.
1258108eb18Smrg
1261a650d1eSmrg# serial 9
1278108eb18Smrg
1281a650d1eSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1291a650d1eSmrg# -------------------------------------
1301a650d1eSmrg# Define a conditional.
1311a650d1eSmrgAC_DEFUN([AM_CONDITIONAL],
1321a650d1eSmrg[AC_PREREQ(2.52)dnl
1331a650d1eSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1341a650d1eSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1351a650d1eSmrgAC_SUBST([$1_TRUE])dnl
1361a650d1eSmrgAC_SUBST([$1_FALSE])dnl
1371a650d1eSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1381a650d1eSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1391a650d1eSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1401a650d1eSmrgif $2; then
1411a650d1eSmrg  $1_TRUE=
1421a650d1eSmrg  $1_FALSE='#'
1438108eb18Smrgelse
1441a650d1eSmrg  $1_TRUE='#'
1451a650d1eSmrg  $1_FALSE=
1468108eb18Smrgfi
1471a650d1eSmrgAC_CONFIG_COMMANDS_PRE(
1481a650d1eSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1491a650d1eSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1501a650d1eSmrgUsually this means the macro was only invoked conditionally.]])
1511a650d1eSmrgfi])])
1528108eb18Smrg
1535977a007Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
1545977a007Smrg# 2010, 2011 Free Software Foundation, Inc.
1551a650d1eSmrg#
1561a650d1eSmrg# This file is free software; the Free Software Foundation
1571a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
1581a650d1eSmrg# with or without modifications, as long as this notice is preserved.
1598108eb18Smrg
1605977a007Smrg# serial 12
1618108eb18Smrg
1628108eb18Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1638108eb18Smrg# written in clear, in which case automake, when reading aclocal.m4,
1648108eb18Smrg# will think it sees a *use*, and therefore will trigger all it's
1658108eb18Smrg# C support machinery.  Also note that it means that autoscan, seeing
1668108eb18Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1678108eb18Smrg
1688108eb18Smrg
1698108eb18Smrg# _AM_DEPENDENCIES(NAME)
1708108eb18Smrg# ----------------------
1718108eb18Smrg# See how the compiler implements dependency checking.
1728108eb18Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1738108eb18Smrg# We try a few techniques and use that to set a single cache variable.
1748108eb18Smrg#
1758108eb18Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1768108eb18Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1778108eb18Smrg# dependency, and given that the user is not expected to run this macro,
1788108eb18Smrg# just rely on AC_PROG_CC.
1798108eb18SmrgAC_DEFUN([_AM_DEPENDENCIES],
1808108eb18Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1818108eb18SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1828108eb18SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1838108eb18SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1848108eb18Smrg
1858108eb18Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1868108eb18Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1878108eb18Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1881a650d1eSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1898108eb18Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1908108eb18Smrg                   [depcc="$$1"   am_compiler_list=])
1918108eb18Smrg
1928108eb18SmrgAC_CACHE_CHECK([dependency style of $depcc],
1938108eb18Smrg               [am_cv_$1_dependencies_compiler_type],
1948108eb18Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1958108eb18Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1968108eb18Smrg  # making bogus files that we don't know about and never remove.  For
1978108eb18Smrg  # instance it was reported that on HP-UX the gcc test will end up
1988108eb18Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
1998108eb18Smrg  # in D'.
2005977a007Smrg  rm -rf conftest.dir
2018108eb18Smrg  mkdir conftest.dir
2028108eb18Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2038108eb18Smrg  # using a relative directory.
2048108eb18Smrg  cp "$am_depcomp" conftest.dir
2058108eb18Smrg  cd conftest.dir
2068108eb18Smrg  # We will build objects and dependencies in a subdirectory because
2078108eb18Smrg  # it helps to detect inapplicable dependency modes.  For instance
2088108eb18Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2098108eb18Smrg  # side effect of compilation, but ICC will put the dependencies in
2108108eb18Smrg  # the current directory while Tru64 will put them in the object
2118108eb18Smrg  # directory.
2128108eb18Smrg  mkdir sub
2138108eb18Smrg
2148108eb18Smrg  am_cv_$1_dependencies_compiler_type=none
2158108eb18Smrg  if test "$am_compiler_list" = ""; then
2168108eb18Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2178108eb18Smrg  fi
2181a650d1eSmrg  am__universal=false
2191a650d1eSmrg  m4_case([$1], [CC],
2201a650d1eSmrg    [case " $depcc " in #(
2211a650d1eSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2221a650d1eSmrg     esac],
2231a650d1eSmrg    [CXX],
2241a650d1eSmrg    [case " $depcc " in #(
2251a650d1eSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2261a650d1eSmrg     esac])
2271a650d1eSmrg
2288108eb18Smrg  for depmode in $am_compiler_list; do
2298108eb18Smrg    # Setup a source with many dependencies, because some compilers
2308108eb18Smrg    # like to wrap large dependency lists on column 80 (with \), and
2318108eb18Smrg    # we should not choose a depcomp mode which is confused by this.
2328108eb18Smrg    #
2338108eb18Smrg    # We need to recreate these files for each test, as the compiler may
2348108eb18Smrg    # overwrite some of them when testing with obscure command lines.
2358108eb18Smrg    # This happens at least with the AIX C compiler.
2368108eb18Smrg    : > sub/conftest.c
2378108eb18Smrg    for i in 1 2 3 4 5 6; do
2388108eb18Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2391a650d1eSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2401a650d1eSmrg      # Solaris 8's {/usr,}/bin/sh.
2411a650d1eSmrg      touch sub/conftst$i.h
2428108eb18Smrg    done
2438108eb18Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2448108eb18Smrg
2451a650d1eSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
2461a650d1eSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2471a650d1eSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
2481a650d1eSmrg    # versions had trouble with output in subdirs
2491a650d1eSmrg    am__obj=sub/conftest.${OBJEXT-o}
2501a650d1eSmrg    am__minus_obj="-o $am__obj"
2518108eb18Smrg    case $depmode in
2521a650d1eSmrg    gcc)
2531a650d1eSmrg      # This depmode causes a compiler race in universal mode.
2541a650d1eSmrg      test "$am__universal" = false || continue
2551a650d1eSmrg      ;;
2568108eb18Smrg    nosideeffect)
2578108eb18Smrg      # after this tag, mechanisms are not by side-effect, so they'll
2588108eb18Smrg      # only be used when explicitly requested
2598108eb18Smrg      if test "x$enable_dependency_tracking" = xyes; then
2608108eb18Smrg	continue
2618108eb18Smrg      else
2628108eb18Smrg	break
2638108eb18Smrg      fi
2648108eb18Smrg      ;;
2655977a007Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2661a650d1eSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
2671a650d1eSmrg      # not run yet.  These depmodes are late enough in the game, and
2681a650d1eSmrg      # so weak that their functioning should not be impacted.
2691a650d1eSmrg      am__obj=conftest.${OBJEXT-o}
2701a650d1eSmrg      am__minus_obj=
2711a650d1eSmrg      ;;
2728108eb18Smrg    none) break ;;
2738108eb18Smrg    esac
2748108eb18Smrg    if depmode=$depmode \
2751a650d1eSmrg       source=sub/conftest.c object=$am__obj \
2768108eb18Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2771a650d1eSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2788108eb18Smrg         >/dev/null 2>conftest.err &&
2791a650d1eSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2808108eb18Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2811a650d1eSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2828108eb18Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2838108eb18Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2841a650d1eSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2851a650d1eSmrg      # that says an option was ignored or not supported.
2861a650d1eSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2871a650d1eSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2881a650d1eSmrg      # The diagnosis changed in icc 8.0:
2891a650d1eSmrg      #   icc: Command line remark: option '-MP' not supported
2901a650d1eSmrg      if (grep 'ignoring option' conftest.err ||
2911a650d1eSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2928108eb18Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2938108eb18Smrg        break
2948108eb18Smrg      fi
2958108eb18Smrg    fi
2968108eb18Smrg  done
2978108eb18Smrg
2988108eb18Smrg  cd ..
2998108eb18Smrg  rm -rf conftest.dir
3008108eb18Smrgelse
3018108eb18Smrg  am_cv_$1_dependencies_compiler_type=none
3028108eb18Smrgfi
3038108eb18Smrg])
3048108eb18SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
3058108eb18SmrgAM_CONDITIONAL([am__fastdep$1], [
3068108eb18Smrg  test "x$enable_dependency_tracking" != xno \
3078108eb18Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3088108eb18Smrg])
3098108eb18Smrg
3108108eb18Smrg
3118108eb18Smrg# AM_SET_DEPDIR
3128108eb18Smrg# -------------
3138108eb18Smrg# Choose a directory name for dependency files.
3148108eb18Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3158108eb18SmrgAC_DEFUN([AM_SET_DEPDIR],
3168108eb18Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3178108eb18SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3188108eb18Smrg])
3198108eb18Smrg
3208108eb18Smrg
3218108eb18Smrg# AM_DEP_TRACK
3228108eb18Smrg# ------------
3238108eb18SmrgAC_DEFUN([AM_DEP_TRACK],
3248108eb18Smrg[AC_ARG_ENABLE(dependency-tracking,
3251a650d1eSmrg[  --disable-dependency-tracking  speeds up one-time build
3261a650d1eSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3278108eb18Smrgif test "x$enable_dependency_tracking" != xno; then
3288108eb18Smrg  am_depcomp="$ac_aux_dir/depcomp"
3298108eb18Smrg  AMDEPBACKSLASH='\'
3305977a007Smrg  am__nodep='_no'
3318108eb18Smrgfi
3328108eb18SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3331a650d1eSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3341a650d1eSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3355977a007SmrgAC_SUBST([am__nodep])dnl
3365977a007Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3378108eb18Smrg])
3388108eb18Smrg
3391a650d1eSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3408108eb18Smrg
3411a650d1eSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
3421a650d1eSmrg# Free Software Foundation, Inc.
3431a650d1eSmrg#
3441a650d1eSmrg# This file is free software; the Free Software Foundation
3451a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
3461a650d1eSmrg# with or without modifications, as long as this notice is preserved.
3478108eb18Smrg
3481a650d1eSmrg#serial 5
3498108eb18Smrg
3508108eb18Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3518108eb18Smrg# ------------------------------
3528108eb18SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3531a650d1eSmrg[{
3541a650d1eSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
3551a650d1eSmrg  # are listed without --file.  Let's play safe and only enable the eval
3561a650d1eSmrg  # if we detect the quoting.
3571a650d1eSmrg  case $CONFIG_FILES in
3581a650d1eSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
3591a650d1eSmrg  *)   set x $CONFIG_FILES ;;
3601a650d1eSmrg  esac
3611a650d1eSmrg  shift
3621a650d1eSmrg  for mf
3631a650d1eSmrg  do
3641a650d1eSmrg    # Strip MF so we end up with the name of the file.
3651a650d1eSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3661a650d1eSmrg    # Check whether this is an Automake generated Makefile or not.
3671a650d1eSmrg    # We used to match only the files named `Makefile.in', but
3681a650d1eSmrg    # some people rename them; so instead we look at the file content.
3691a650d1eSmrg    # Grep'ing the first line is not enough: some people post-process
3701a650d1eSmrg    # each Makefile.in and add a new line on top of each file to say so.
3711a650d1eSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
3721a650d1eSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3731a650d1eSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3741a650d1eSmrg      dirpart=`AS_DIRNAME("$mf")`
3751a650d1eSmrg    else
3761a650d1eSmrg      continue
3771a650d1eSmrg    fi
3781a650d1eSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
3791a650d1eSmrg    # from the Makefile without running `make'.
3801a650d1eSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3811a650d1eSmrg    test -z "$DEPDIR" && continue
3821a650d1eSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3831a650d1eSmrg    test -z "am__include" && continue
3841a650d1eSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3851a650d1eSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
3861a650d1eSmrg    U=`sed -n 's/^U = //p' < "$mf"`
3871a650d1eSmrg    # Find all dependency output files, they are included files with
3881a650d1eSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3891a650d1eSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3901a650d1eSmrg    # expansion.
3911a650d1eSmrg    for file in `sed -n "
3921a650d1eSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3931a650d1eSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3941a650d1eSmrg      # Make sure the directory exists.
3951a650d1eSmrg      test -f "$dirpart/$file" && continue
3961a650d1eSmrg      fdir=`AS_DIRNAME(["$file"])`
3971a650d1eSmrg      AS_MKDIR_P([$dirpart/$fdir])
3981a650d1eSmrg      # echo "creating $dirpart/$file"
3991a650d1eSmrg      echo '# dummy' > "$dirpart/$file"
4001a650d1eSmrg    done
4018108eb18Smrg  done
4021a650d1eSmrg}
4038108eb18Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
4048108eb18Smrg
4058108eb18Smrg
4068108eb18Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
4078108eb18Smrg# -----------------------------
4088108eb18Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
4098108eb18Smrg#
4108108eb18Smrg# This code is only required when automatic dependency tracking
4118108eb18Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
4128108eb18Smrg# need in order to bootstrap the dependency handling code.
4138108eb18SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4148108eb18Smrg[AC_CONFIG_COMMANDS([depfiles],
4158108eb18Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4168108eb18Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4178108eb18Smrg])
4188108eb18Smrg
4191a650d1eSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4208108eb18Smrg
4211a650d1eSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4221a650d1eSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4231a650d1eSmrg#
4241a650d1eSmrg# This file is free software; the Free Software Foundation
4251a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
4261a650d1eSmrg# with or without modifications, as long as this notice is preserved.
4271a650d1eSmrg
4281a650d1eSmrg# serial 16
4291a650d1eSmrg
4301a650d1eSmrg# This macro actually does too much.  Some checks are only needed if
4311a650d1eSmrg# your package does certain things.  But this isn't really a big deal.
4321a650d1eSmrg
4331a650d1eSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4341a650d1eSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4351a650d1eSmrg# -----------------------------------------------
4361a650d1eSmrg# The call with PACKAGE and VERSION arguments is the old style
4371a650d1eSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4381a650d1eSmrg# and VERSION should now be passed to AC_INIT and removed from
4391a650d1eSmrg# the call to AM_INIT_AUTOMAKE.
4401a650d1eSmrg# We support both call styles for the transition.  After
4411a650d1eSmrg# the next Automake release, Autoconf can make the AC_INIT
4421a650d1eSmrg# arguments mandatory, and then we can depend on a new Autoconf
4431a650d1eSmrg# release and drop the old call support.
4441a650d1eSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4451a650d1eSmrg[AC_PREREQ([2.62])dnl
4461a650d1eSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4471a650d1eSmrgdnl the ones we care about.
4481a650d1eSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4491a650d1eSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4501a650d1eSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4511a650d1eSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4521a650d1eSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4531a650d1eSmrg  # is not polluted with repeated "-I."
4541a650d1eSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4551a650d1eSmrg  # test to see if srcdir already configured
4561a650d1eSmrg  if test -f $srcdir/config.status; then
4571a650d1eSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4581a650d1eSmrg  fi
4591a650d1eSmrgfi
4601a650d1eSmrg
4611a650d1eSmrg# test whether we have cygpath
4621a650d1eSmrgif test -z "$CYGPATH_W"; then
4631a650d1eSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4641a650d1eSmrg    CYGPATH_W='cygpath -w'
4651a650d1eSmrg  else
4661a650d1eSmrg    CYGPATH_W=echo
4671a650d1eSmrg  fi
4681a650d1eSmrgfi
4691a650d1eSmrgAC_SUBST([CYGPATH_W])
4701a650d1eSmrg
4711a650d1eSmrg# Define the identity of the package.
4721a650d1eSmrgdnl Distinguish between old-style and new-style calls.
4731a650d1eSmrgm4_ifval([$2],
4741a650d1eSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4751a650d1eSmrg AC_SUBST([PACKAGE], [$1])dnl
4761a650d1eSmrg AC_SUBST([VERSION], [$2])],
4771a650d1eSmrg[_AM_SET_OPTIONS([$1])dnl
4781a650d1eSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4791a650d1eSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4801a650d1eSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4811a650d1eSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4821a650d1eSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4831a650d1eSmrg
4841a650d1eSmrg_AM_IF_OPTION([no-define],,
4851a650d1eSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4861a650d1eSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4871a650d1eSmrg
4881a650d1eSmrg# Some tools Automake needs.
4891a650d1eSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4901a650d1eSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4911a650d1eSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4921a650d1eSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4931a650d1eSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4941a650d1eSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4951a650d1eSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
4961a650d1eSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4971a650d1eSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4981a650d1eSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4991a650d1eSmrg# We need awk for the "check" target.  The system "awk" is bad on
5001a650d1eSmrg# some platforms.
5011a650d1eSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5021a650d1eSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5031a650d1eSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5041a650d1eSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5051a650d1eSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5061a650d1eSmrg			     [_AM_PROG_TAR([v7])])])
5071a650d1eSmrg_AM_IF_OPTION([no-dependencies],,
5081a650d1eSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5091a650d1eSmrg		  [_AM_DEPENDENCIES(CC)],
5101a650d1eSmrg		  [define([AC_PROG_CC],
5111a650d1eSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5121a650d1eSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5131a650d1eSmrg		  [_AM_DEPENDENCIES(CXX)],
5141a650d1eSmrg		  [define([AC_PROG_CXX],
5151a650d1eSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5161a650d1eSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5171a650d1eSmrg		  [_AM_DEPENDENCIES(OBJC)],
5181a650d1eSmrg		  [define([AC_PROG_OBJC],
5191a650d1eSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
5201a650d1eSmrg])
5211a650d1eSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
5221a650d1eSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
5231a650d1eSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
5241a650d1eSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
5251a650d1eSmrgAC_CONFIG_COMMANDS_PRE(dnl
5261a650d1eSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5271a650d1eSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5281a650d1eSmrg])
5291a650d1eSmrg
5301a650d1eSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5311a650d1eSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5321a650d1eSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5331a650d1eSmrgm4_define([_AC_COMPILER_EXEEXT],
5341a650d1eSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5351a650d1eSmrg
5361a650d1eSmrg
5371a650d1eSmrg# When config.status generates a header, we must update the stamp-h file.
5381a650d1eSmrg# This file resides in the same directory as the config header
5391a650d1eSmrg# that is generated.  The stamp files are numbered to have different names.
5401a650d1eSmrg
5411a650d1eSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5421a650d1eSmrg# loop where config.status creates the headers, so we can generate
5431a650d1eSmrg# our stamp files there.
5441a650d1eSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5451a650d1eSmrg[# Compute $1's index in $config_headers.
5461a650d1eSmrg_am_arg=$1
5471a650d1eSmrg_am_stamp_count=1
5481a650d1eSmrgfor _am_header in $config_headers :; do
5491a650d1eSmrg  case $_am_header in
5501a650d1eSmrg    $_am_arg | $_am_arg:* )
5511a650d1eSmrg      break ;;
5521a650d1eSmrg    * )
5531a650d1eSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5541a650d1eSmrg  esac
5551a650d1eSmrgdone
5561a650d1eSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5571a650d1eSmrg
5585977a007Smrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
5595977a007Smrg# Inc.
5601a650d1eSmrg#
5611a650d1eSmrg# This file is free software; the Free Software Foundation
5621a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
5631a650d1eSmrg# with or without modifications, as long as this notice is preserved.
5641a650d1eSmrg
5655977a007Smrg# serial 1
5665977a007Smrg
5671a650d1eSmrg# AM_PROG_INSTALL_SH
5681a650d1eSmrg# ------------------
5691a650d1eSmrg# Define $install_sh.
5701a650d1eSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5711a650d1eSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5721a650d1eSmrgif test x"${install_sh}" != xset; then
5731a650d1eSmrg  case $am_aux_dir in
5741a650d1eSmrg  *\ * | *\	*)
5751a650d1eSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5761a650d1eSmrg  *)
5771a650d1eSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5781a650d1eSmrg  esac
5791a650d1eSmrgfi
5801a650d1eSmrgAC_SUBST(install_sh)])
5811a650d1eSmrg
5821a650d1eSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5831a650d1eSmrg#
5841a650d1eSmrg# This file is free software; the Free Software Foundation
5851a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
5861a650d1eSmrg# with or without modifications, as long as this notice is preserved.
5878108eb18Smrg
5888108eb18Smrg# serial 2
5898108eb18Smrg
5901a650d1eSmrg# Check whether the underlying file-system supports filenames
5911a650d1eSmrg# with a leading dot.  For instance MS-DOS doesn't.
5921a650d1eSmrgAC_DEFUN([AM_SET_LEADING_DOT],
5931a650d1eSmrg[rm -rf .tst 2>/dev/null
5941a650d1eSmrgmkdir .tst 2>/dev/null
5951a650d1eSmrgif test -d .tst; then
5961a650d1eSmrg  am__leading_dot=.
5971a650d1eSmrgelse
5981a650d1eSmrg  am__leading_dot=_
5991a650d1eSmrgfi
6001a650d1eSmrgrmdir .tst 2>/dev/null
6011a650d1eSmrgAC_SUBST([am__leading_dot])])
6021a650d1eSmrg
6031a650d1eSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6041a650d1eSmrg# From Jim Meyering
6051a650d1eSmrg
6065977a007Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
6075977a007Smrg# 2011 Free Software Foundation, Inc.
6081a650d1eSmrg#
6091a650d1eSmrg# This file is free software; the Free Software Foundation
6101a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
6111a650d1eSmrg# with or without modifications, as long as this notice is preserved.
6121a650d1eSmrg
6131a650d1eSmrg# serial 5
6141a650d1eSmrg
6151a650d1eSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6161a650d1eSmrg# ----------------------------------
6171a650d1eSmrg# Control maintainer-specific portions of Makefiles.
6181a650d1eSmrg# Default is to disable them, unless `enable' is passed literally.
6191a650d1eSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
6201a650d1eSmrg# can override the default with the --enable/--disable switch.
6211a650d1eSmrgAC_DEFUN([AM_MAINTAINER_MODE],
6221a650d1eSmrg[m4_case(m4_default([$1], [disable]),
6231a650d1eSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
6241a650d1eSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
6251a650d1eSmrg       [m4_define([am_maintainer_other], [enable])
6261a650d1eSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6275977a007SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6281a650d1eSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6291a650d1eSmrg  AC_ARG_ENABLE([maintainer-mode],
6301a650d1eSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
6311a650d1eSmrg			  (and sometimes confusing) to the casual installer],
6321a650d1eSmrg      [USE_MAINTAINER_MODE=$enableval],
6331a650d1eSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6341a650d1eSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6351a650d1eSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6361a650d1eSmrg  MAINT=$MAINTAINER_MODE_TRUE
6371a650d1eSmrg  AC_SUBST([MAINT])dnl
6381a650d1eSmrg]
6391a650d1eSmrg)
6401a650d1eSmrg
6411a650d1eSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
6421a650d1eSmrg
6431a650d1eSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6441a650d1eSmrg
6451a650d1eSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6461a650d1eSmrg#
6471a650d1eSmrg# This file is free software; the Free Software Foundation
6481a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
6491a650d1eSmrg# with or without modifications, as long as this notice is preserved.
6501a650d1eSmrg
6511a650d1eSmrg# serial 4
6521a650d1eSmrg
6538108eb18Smrg# AM_MAKE_INCLUDE()
6548108eb18Smrg# -----------------
6558108eb18Smrg# Check to see how make treats includes.
6568108eb18SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6578108eb18Smrg[am_make=${MAKE-make}
6588108eb18Smrgcat > confinc << 'END'
6598108eb18Smrgam__doit:
6601a650d1eSmrg	@echo this is the am__doit target
6618108eb18Smrg.PHONY: am__doit
6628108eb18SmrgEND
6638108eb18Smrg# If we don't find an include directive, just comment out the code.
6648108eb18SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6658108eb18Smrgam__include="#"
6668108eb18Smrgam__quote=
6678108eb18Smrg_am_result=none
6688108eb18Smrg# First try GNU make style include.
6698108eb18Smrgecho "include confinc" > confmf
6701a650d1eSmrg# Ignore all kinds of additional output from `make'.
6711a650d1eSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6721a650d1eSmrg*the\ am__doit\ target*)
6731a650d1eSmrg  am__include=include
6741a650d1eSmrg  am__quote=
6751a650d1eSmrg  _am_result=GNU
6761a650d1eSmrg  ;;
6771a650d1eSmrgesac
6788108eb18Smrg# Now try BSD make style include.
6798108eb18Smrgif test "$am__include" = "#"; then
6808108eb18Smrg   echo '.include "confinc"' > confmf
6811a650d1eSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6821a650d1eSmrg   *the\ am__doit\ target*)
6831a650d1eSmrg     am__include=.include
6841a650d1eSmrg     am__quote="\""
6851a650d1eSmrg     _am_result=BSD
6861a650d1eSmrg     ;;
6871a650d1eSmrg   esac
6888108eb18Smrgfi
6898108eb18SmrgAC_SUBST([am__include])
6908108eb18SmrgAC_SUBST([am__quote])
6918108eb18SmrgAC_MSG_RESULT([$_am_result])
6928108eb18Smrgrm -f confinc confmf
6938108eb18Smrg])
6948108eb18Smrg
6951a650d1eSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6968108eb18Smrg
6971a650d1eSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
6981a650d1eSmrg# Free Software Foundation, Inc.
6991a650d1eSmrg#
7001a650d1eSmrg# This file is free software; the Free Software Foundation
7011a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
7021a650d1eSmrg# with or without modifications, as long as this notice is preserved.
7038108eb18Smrg
7041a650d1eSmrg# serial 6
7058108eb18Smrg
7061a650d1eSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7071a650d1eSmrg# ------------------------------
7081a650d1eSmrgAC_DEFUN([AM_MISSING_PROG],
7091a650d1eSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7101a650d1eSmrg$1=${$1-"${am_missing_run}$2"}
7111a650d1eSmrgAC_SUBST($1)])
7128108eb18Smrg
7138108eb18Smrg
7141a650d1eSmrg# AM_MISSING_HAS_RUN
7151a650d1eSmrg# ------------------
7161a650d1eSmrg# Define MISSING if not defined so far and test if it supports --run.
7171a650d1eSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
7181a650d1eSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7191a650d1eSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7201a650d1eSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7211a650d1eSmrgif test x"${MISSING+set}" != xset; then
7221a650d1eSmrg  case $am_aux_dir in
7231a650d1eSmrg  *\ * | *\	*)
7241a650d1eSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7251a650d1eSmrg  *)
7261a650d1eSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7271a650d1eSmrg  esac
7281a650d1eSmrgfi
7291a650d1eSmrg# Use eval to expand $SHELL
7301a650d1eSmrgif eval "$MISSING --run true"; then
7311a650d1eSmrg  am_missing_run="$MISSING --run "
7328108eb18Smrgelse
7331a650d1eSmrg  am_missing_run=
7341a650d1eSmrg  AC_MSG_WARN([`missing' script is too old or missing])
7358108eb18Smrgfi
7361a650d1eSmrg])
7378108eb18Smrg
7385977a007Smrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
7395977a007Smrg# Inc.
7401a650d1eSmrg#
7411a650d1eSmrg# This file is free software; the Free Software Foundation
7421a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
7431a650d1eSmrg# with or without modifications, as long as this notice is preserved.
7448108eb18Smrg
7455977a007Smrg# serial 1
7465977a007Smrg
7471a650d1eSmrg# AM_PROG_MKDIR_P
7481a650d1eSmrg# ---------------
7491a650d1eSmrg# Check for `mkdir -p'.
7501a650d1eSmrgAC_DEFUN([AM_PROG_MKDIR_P],
7511a650d1eSmrg[AC_PREREQ([2.60])dnl
7521a650d1eSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
7531a650d1eSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
7541a650d1eSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
7551a650d1eSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
7561a650d1eSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
7571a650d1eSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
7581a650d1eSmrgdnl adjustment using top_builddir (which is defined more often than
7591a650d1eSmrgdnl MKDIR_P).
7601a650d1eSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
7611a650d1eSmrgcase $mkdir_p in
7621a650d1eSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
7631a650d1eSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
7641a650d1eSmrgesac
7651a650d1eSmrg])
7668108eb18Smrg
7671a650d1eSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7688108eb18Smrg
7695977a007Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
7705977a007Smrg# Foundation, Inc.
7711a650d1eSmrg#
7721a650d1eSmrg# This file is free software; the Free Software Foundation
7731a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
7741a650d1eSmrg# with or without modifications, as long as this notice is preserved.
7758108eb18Smrg
7765977a007Smrg# serial 5
7778108eb18Smrg
7781a650d1eSmrg# _AM_MANGLE_OPTION(NAME)
7791a650d1eSmrg# -----------------------
7801a650d1eSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7811a650d1eSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7828108eb18Smrg
7831a650d1eSmrg# _AM_SET_OPTION(NAME)
7845977a007Smrg# --------------------
7851a650d1eSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7861a650d1eSmrgAC_DEFUN([_AM_SET_OPTION],
7871a650d1eSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
7888108eb18Smrg
7891a650d1eSmrg# _AM_SET_OPTIONS(OPTIONS)
7905977a007Smrg# ------------------------
7911a650d1eSmrg# OPTIONS is a space-separated list of Automake options.
7921a650d1eSmrgAC_DEFUN([_AM_SET_OPTIONS],
7931a650d1eSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7948108eb18Smrg
7951a650d1eSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7961a650d1eSmrg# -------------------------------------------
7971a650d1eSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7981a650d1eSmrgAC_DEFUN([_AM_IF_OPTION],
7991a650d1eSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
8008108eb18Smrg
8011a650d1eSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8028108eb18Smrg
8031a650d1eSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
8041a650d1eSmrg# Free Software Foundation, Inc.
8058108eb18Smrg#
8061a650d1eSmrg# This file is free software; the Free Software Foundation
8071a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
8081a650d1eSmrg# with or without modifications, as long as this notice is preserved.
8098108eb18Smrg
8101a650d1eSmrg# serial 5
8118108eb18Smrg
8121a650d1eSmrg# AM_SANITY_CHECK
8131a650d1eSmrg# ---------------
8141a650d1eSmrgAC_DEFUN([AM_SANITY_CHECK],
8151a650d1eSmrg[AC_MSG_CHECKING([whether build environment is sane])
8161a650d1eSmrg# Just in case
8171a650d1eSmrgsleep 1
8181a650d1eSmrgecho timestamp > conftest.file
8191a650d1eSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8201a650d1eSmrg# name.  Accept space and tab only in the latter.
8211a650d1eSmrgam_lf='
8221a650d1eSmrg'
8231a650d1eSmrgcase `pwd` in
8241a650d1eSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8251a650d1eSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8261a650d1eSmrgesac
8271a650d1eSmrgcase $srcdir in
8281a650d1eSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8291a650d1eSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8301a650d1eSmrgesac
8318108eb18Smrg
8321a650d1eSmrg# Do `set' in a subshell so we don't clobber the current shell's
8331a650d1eSmrg# arguments.  Must try -L first in case configure is actually a
8341a650d1eSmrg# symlink; some systems play weird games with the mod time of symlinks
8351a650d1eSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8361a650d1eSmrg# directory).
8371a650d1eSmrgif (
8381a650d1eSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8391a650d1eSmrg   if test "$[*]" = "X"; then
8401a650d1eSmrg      # -L didn't work.
8411a650d1eSmrg      set X `ls -t "$srcdir/configure" conftest.file`
8421a650d1eSmrg   fi
8431a650d1eSmrg   rm -f conftest.file
8441a650d1eSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
8451a650d1eSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
8461a650d1eSmrg
8471a650d1eSmrg      # If neither matched, then we have a broken ls.  This can happen
8481a650d1eSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
8491a650d1eSmrg      # broken ls alias from the environment.  This has actually
8501a650d1eSmrg      # happened.  Such a system could not be considered "sane".
8511a650d1eSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8521a650d1eSmrgalias in your environment])
8531a650d1eSmrg   fi
8548108eb18Smrg
8551a650d1eSmrg   test "$[2]" = conftest.file
8561a650d1eSmrg   )
8571a650d1eSmrgthen
8581a650d1eSmrg   # Ok.
8591a650d1eSmrg   :
8608108eb18Smrgelse
8611a650d1eSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8621a650d1eSmrgCheck your system clock])
8631a650d1eSmrgfi
8641a650d1eSmrgAC_MSG_RESULT(yes)])
8658108eb18Smrg
8661a650d1eSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
8671a650d1eSmrg#
8681a650d1eSmrg# This file is free software; the Free Software Foundation
8691a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
8701a650d1eSmrg# with or without modifications, as long as this notice is preserved.
8718108eb18Smrg
8721a650d1eSmrg# serial 1
8738108eb18Smrg
8741a650d1eSmrg# AM_SILENT_RULES([DEFAULT])
8751a650d1eSmrg# --------------------------
8761a650d1eSmrg# Enable less verbose build rules; with the default set to DEFAULT
8771a650d1eSmrg# (`yes' being less verbose, `no' or empty being verbose).
8781a650d1eSmrgAC_DEFUN([AM_SILENT_RULES],
8791a650d1eSmrg[AC_ARG_ENABLE([silent-rules],
8801a650d1eSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
8811a650d1eSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
8821a650d1eSmrgcase $enable_silent_rules in
8831a650d1eSmrgyes) AM_DEFAULT_VERBOSITY=0;;
8841a650d1eSmrgno)  AM_DEFAULT_VERBOSITY=1;;
8851a650d1eSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8861a650d1eSmrgesac
8871a650d1eSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8881a650d1eSmrgAM_BACKSLASH='\'
8891a650d1eSmrgAC_SUBST([AM_BACKSLASH])dnl
8901a650d1eSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8911a650d1eSmrg])
8921a650d1eSmrg
8935977a007Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
8948108eb18Smrg#
8951a650d1eSmrg# This file is free software; the Free Software Foundation
8961a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
8971a650d1eSmrg# with or without modifications, as long as this notice is preserved.
8981a650d1eSmrg
8995977a007Smrg# serial 1
9005977a007Smrg
9011a650d1eSmrg# AM_PROG_INSTALL_STRIP
9021a650d1eSmrg# ---------------------
9031a650d1eSmrg# One issue with vendor `install' (even GNU) is that you can't
9041a650d1eSmrg# specify the program used to strip binaries.  This is especially
9051a650d1eSmrg# annoying in cross-compiling environments, where the build's strip
9061a650d1eSmrg# is unlikely to handle the host's binaries.
9071a650d1eSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9081a650d1eSmrg# always use install-sh in `make install-strip', and initialize
9091a650d1eSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9101a650d1eSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9111a650d1eSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9121a650d1eSmrg# Installed binaries are usually stripped using `strip' when the user
9131a650d1eSmrg# run `make install-strip'.  However `strip' might not be the right
9141a650d1eSmrg# tool to use in cross-compilation environments, therefore Automake
9151a650d1eSmrg# will honor the `STRIP' environment variable to overrule this program.
9161a650d1eSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
9171a650d1eSmrgif test "$cross_compiling" != no; then
9181a650d1eSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9191a650d1eSmrgfi
9201a650d1eSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9211a650d1eSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
9221a650d1eSmrg
9235977a007Smrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
9248108eb18Smrg#
9251a650d1eSmrg# This file is free software; the Free Software Foundation
9261a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
9271a650d1eSmrg# with or without modifications, as long as this notice is preserved.
9288108eb18Smrg
9295977a007Smrg# serial 3
9308108eb18Smrg
9311a650d1eSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
9321a650d1eSmrg# ---------------------------
9331a650d1eSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9341a650d1eSmrg# This macro is traced by Automake.
9351a650d1eSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9368108eb18Smrg
9371a650d1eSmrg# AM_SUBST_NOTMAKE(VARIABLE)
9385977a007Smrg# --------------------------
9391a650d1eSmrg# Public sister of _AM_SUBST_NOTMAKE.
9401a650d1eSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9418108eb18Smrg
9421a650d1eSmrg# Check how to create a tarball.                            -*- Autoconf -*-
9438108eb18Smrg
9441a650d1eSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
9451a650d1eSmrg#
9461a650d1eSmrg# This file is free software; the Free Software Foundation
9471a650d1eSmrg# gives unlimited permission to copy and/or distribute it,
9481a650d1eSmrg# with or without modifications, as long as this notice is preserved.
9498108eb18Smrg
9501a650d1eSmrg# serial 2
9518108eb18Smrg
9521a650d1eSmrg# _AM_PROG_TAR(FORMAT)
9531a650d1eSmrg# --------------------
9541a650d1eSmrg# Check how to create a tarball in format FORMAT.
9551a650d1eSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
9561a650d1eSmrg#
9571a650d1eSmrg# Substitute a variable $(am__tar) that is a command
9581a650d1eSmrg# writing to stdout a FORMAT-tarball containing the directory
9591a650d1eSmrg# $tardir.
9601a650d1eSmrg#     tardir=directory && $(am__tar) > result.tar
9611a650d1eSmrg#
9621a650d1eSmrg# Substitute a variable $(am__untar) that extract such
9631a650d1eSmrg# a tarball read from stdin.
9641a650d1eSmrg#     $(am__untar) < result.tar
9651a650d1eSmrgAC_DEFUN([_AM_PROG_TAR],
9661a650d1eSmrg[# Always define AMTAR for backward compatibility.
9671a650d1eSmrgAM_MISSING_PROG([AMTAR], [tar])
9681a650d1eSmrgm4_if([$1], [v7],
9691a650d1eSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
9701a650d1eSmrg     [m4_case([$1], [ustar],, [pax],,
9711a650d1eSmrg              [m4_fatal([Unknown tar format])])
9721a650d1eSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
9731a650d1eSmrg# Loop over all known methods to create a tar archive until one works.
9741a650d1eSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
9751a650d1eSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
9761a650d1eSmrg# Do not fold the above two line into one, because Tru64 sh and
9771a650d1eSmrg# Solaris sh will not grok spaces in the rhs of `-'.
9781a650d1eSmrgfor _am_tool in $_am_tools
9791a650d1eSmrgdo
9801a650d1eSmrg  case $_am_tool in
9811a650d1eSmrg  gnutar)
9821a650d1eSmrg    for _am_tar in tar gnutar gtar;
9831a650d1eSmrg    do
9841a650d1eSmrg      AM_RUN_LOG([$_am_tar --version]) && break
9851a650d1eSmrg    done
9861a650d1eSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
9871a650d1eSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
9881a650d1eSmrg    am__untar="$_am_tar -xf -"
9891a650d1eSmrg    ;;
9901a650d1eSmrg  plaintar)
9911a650d1eSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
9921a650d1eSmrg    # ustar tarball either.
9931a650d1eSmrg    (tar --version) >/dev/null 2>&1 && continue
9941a650d1eSmrg    am__tar='tar chf - "$$tardir"'
9951a650d1eSmrg    am__tar_='tar chf - "$tardir"'
9961a650d1eSmrg    am__untar='tar xf -'
9971a650d1eSmrg    ;;
9981a650d1eSmrg  pax)
9991a650d1eSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
10001a650d1eSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
10011a650d1eSmrg    am__untar='pax -r'
10021a650d1eSmrg    ;;
10031a650d1eSmrg  cpio)
10041a650d1eSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
10051a650d1eSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
10061a650d1eSmrg    am__untar='cpio -i -H $1 -d'
10071a650d1eSmrg    ;;
10081a650d1eSmrg  none)
10091a650d1eSmrg    am__tar=false
10101a650d1eSmrg    am__tar_=false
10111a650d1eSmrg    am__untar=false
10121a650d1eSmrg    ;;
10131a650d1eSmrg  esac
10148108eb18Smrg
10151a650d1eSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
10161a650d1eSmrg  # and am__untar set.
10171a650d1eSmrg  test -n "${am_cv_prog_tar_$1}" && break
10188108eb18Smrg
10191a650d1eSmrg  # tar/untar a dummy directory, and stop if the command works
10201a650d1eSmrg  rm -rf conftest.dir
10211a650d1eSmrg  mkdir conftest.dir
10221a650d1eSmrg  echo GrepMe > conftest.dir/file
10231a650d1eSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
10241a650d1eSmrg  rm -rf conftest.dir
10251a650d1eSmrg  if test -s conftest.tar; then
10261a650d1eSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
10271a650d1eSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
10281a650d1eSmrg  fi
10291a650d1eSmrgdone
10301a650d1eSmrgrm -rf conftest.dir
10318108eb18Smrg
10321a650d1eSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
10331a650d1eSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
10341a650d1eSmrgAC_SUBST([am__tar])
10351a650d1eSmrgAC_SUBST([am__untar])
10361a650d1eSmrg]) # _AM_PROG_TAR
10378108eb18Smrg
10385977a007Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
10395977a007Smrg# 
10405977a007Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
10415977a007Smrg#
10425977a007Smrg# This program is free software; you can redistribute it and/or modify
10435977a007Smrg# it under the terms of the GNU General Public License as published by
10445977a007Smrg# the Free Software Foundation; either version 2 of the License, or
10455977a007Smrg# (at your option) any later version.
10465977a007Smrg#
10475977a007Smrg# This program is distributed in the hope that it will be useful, but
10485977a007Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
10495977a007Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10505977a007Smrg# General Public License for more details.
10515977a007Smrg#
10525977a007Smrg# You should have received a copy of the GNU General Public License
10535977a007Smrg# along with this program; if not, write to the Free Software
10545977a007Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
10555977a007Smrg#
10565977a007Smrg# As a special exception to the GNU General Public License, if you
10575977a007Smrg# distribute this file as part of a program that contains a
10585977a007Smrg# configuration script generated by Autoconf, you may include it under
10595977a007Smrg# the same distribution terms that you use for the rest of that program.
10605977a007Smrg
10615977a007Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
10625977a007Smrg# ----------------------------------
10635977a007SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
10645977a007Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
10655977a007Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
10665977a007SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
10675977a007Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
10685977a007Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
10695977a007Smrgfi
10705977a007Smrgif test -n "$PKG_CONFIG"; then
10715977a007Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
10725977a007Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
10735977a007Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
10745977a007Smrg		AC_MSG_RESULT([yes])
10755977a007Smrg	else
10765977a007Smrg		AC_MSG_RESULT([no])
10775977a007Smrg		PKG_CONFIG=""
10785977a007Smrg	fi
10795977a007Smrg		
10805977a007Smrgfi[]dnl
10815977a007Smrg])# PKG_PROG_PKG_CONFIG
10825977a007Smrg
10835977a007Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10845977a007Smrg#
10855977a007Smrg# Check to see whether a particular set of modules exists.  Similar
10865977a007Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
10875977a007Smrg#
10885977a007Smrg#
10895977a007Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
10905977a007Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
10915977a007Smrg# PKG_CHECK_EXISTS manually
10925977a007Smrg# --------------------------------------------------------------
10935977a007SmrgAC_DEFUN([PKG_CHECK_EXISTS],
10945977a007Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10955977a007Smrgif test -n "$PKG_CONFIG" && \
10965977a007Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
10975977a007Smrg  m4_ifval([$2], [$2], [:])
10985977a007Smrgm4_ifvaln([$3], [else
10995977a007Smrg  $3])dnl
11005977a007Smrgfi])
11015977a007Smrg
11025977a007Smrg
11035977a007Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
11045977a007Smrg# ---------------------------------------------
11055977a007Smrgm4_define([_PKG_CONFIG],
11065977a007Smrg[if test -n "$$1"; then
11075977a007Smrg    pkg_cv_[]$1="$$1"
11085977a007Smrg elif test -n "$PKG_CONFIG"; then
11095977a007Smrg    PKG_CHECK_EXISTS([$3],
11105977a007Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
11115977a007Smrg		     [pkg_failed=yes])
11125977a007Smrg else
11135977a007Smrg    pkg_failed=untried
11145977a007Smrgfi[]dnl
11155977a007Smrg])# _PKG_CONFIG
11165977a007Smrg
11175977a007Smrg# _PKG_SHORT_ERRORS_SUPPORTED
11185977a007Smrg# -----------------------------
11195977a007SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
11205977a007Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11215977a007Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
11225977a007Smrg        _pkg_short_errors_supported=yes
11235977a007Smrgelse
11245977a007Smrg        _pkg_short_errors_supported=no
11255977a007Smrgfi[]dnl
11265977a007Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
11275977a007Smrg
11285977a007Smrg
11295977a007Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
11305977a007Smrg# [ACTION-IF-NOT-FOUND])
11315977a007Smrg#
11325977a007Smrg#
11335977a007Smrg# Note that if there is a possibility the first call to
11345977a007Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
11355977a007Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
11365977a007Smrg#
11375977a007Smrg#
11385977a007Smrg# --------------------------------------------------------------
11395977a007SmrgAC_DEFUN([PKG_CHECK_MODULES],
11405977a007Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11415977a007SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
11425977a007SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
11435977a007Smrg
11445977a007Smrgpkg_failed=no
11455977a007SmrgAC_MSG_CHECKING([for $1])
11465977a007Smrg
11475977a007Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
11485977a007Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
11495977a007Smrg
11505977a007Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
11515977a007Smrgand $1[]_LIBS to avoid the need to call pkg-config.
11525977a007SmrgSee the pkg-config man page for more details.])
11535977a007Smrg
11545977a007Smrgif test $pkg_failed = yes; then
11555977a007Smrg        _PKG_SHORT_ERRORS_SUPPORTED
11565977a007Smrg        if test $_pkg_short_errors_supported = yes; then
11575977a007Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
11585977a007Smrg        else 
11595977a007Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
11605977a007Smrg        fi
11615977a007Smrg	# Put the nasty error message in config.log where it belongs
11625977a007Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
11635977a007Smrg
11645977a007Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
11655977a007Smrg[Package requirements ($2) were not met:
11665977a007Smrg
11675977a007Smrg$$1_PKG_ERRORS
11685977a007Smrg
11695977a007SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
11705977a007Smrginstalled software in a non-standard prefix.
11715977a007Smrg
11725977a007Smrg_PKG_TEXT
11735977a007Smrg])],
11745977a007Smrg		[AC_MSG_RESULT([no])
11755977a007Smrg                $4])
11765977a007Smrgelif test $pkg_failed = untried; then
11775977a007Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
11785977a007Smrg[The pkg-config script could not be found or is too old.  Make sure it
11795977a007Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
11805977a007Smrgpath to pkg-config.
11815977a007Smrg
11825977a007Smrg_PKG_TEXT
11835977a007Smrg
11845977a007SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
11855977a007Smrg		[$4])
11865977a007Smrgelse
11875977a007Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
11885977a007Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
11895977a007Smrg        AC_MSG_RESULT([yes])
11905977a007Smrg	ifelse([$3], , :, [$3])
11915977a007Smrgfi[]dnl
11925977a007Smrg])# PKG_CHECK_MODULES
11935977a007Smrg
11941a650d1eSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
11958108eb18Smrgdnl
11961a650d1eSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
11978108eb18Smrgdnl 
11981a650d1eSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
11991a650d1eSmrgdnl copy of this software and associated documentation files (the "Software"),
12001a650d1eSmrgdnl to deal in the Software without restriction, including without limitation
12011a650d1eSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
12021a650d1eSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
12031a650d1eSmrgdnl Software is furnished to do so, subject to the following conditions:
12041a650d1eSmrgdnl
12051a650d1eSmrgdnl The above copyright notice and this permission notice (including the next
12061a650d1eSmrgdnl paragraph) shall be included in all copies or substantial portions of the
12071a650d1eSmrgdnl Software.
12081a650d1eSmrgdnl
12091a650d1eSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12101a650d1eSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12111a650d1eSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
12121a650d1eSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12131a650d1eSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
12141a650d1eSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
12151a650d1eSmrgdnl DEALINGS IN THE SOFTWARE.
12161a650d1eSmrg
12171a650d1eSmrg# XORG_MACROS_VERSION(required-version)
12181a650d1eSmrg# -------------------------------------
12191a650d1eSmrg# Minimum version: 1.1.0
12201a650d1eSmrg#
12211a650d1eSmrg# If you're using a macro added in Version 1.1 or newer, include this in
12221a650d1eSmrg# your configure.ac with the minimum required version, such as:
12231a650d1eSmrg# XORG_MACROS_VERSION(1.1)
12241a650d1eSmrg#
12251a650d1eSmrg# To ensure that this macro is defined, also add:
12261a650d1eSmrg# m4_ifndef([XORG_MACROS_VERSION],
12271a650d1eSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
12281a650d1eSmrg#
12291a650d1eSmrg#
12301a650d1eSmrg# See the "minimum version" comment for each macro you use to see what 
12311a650d1eSmrg# version you require.
12321a650d1eSmrgm4_defun([XORG_MACROS_VERSION],[
12335977a007Smrgm4_define([vers_have], [1.17])
12341a650d1eSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
12351a650d1eSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
12361a650d1eSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
12371a650d1eSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
12381a650d1eSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
12391a650d1eSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
12401a650d1eSmrgm4_undefine([vers_have])
12411a650d1eSmrgm4_undefine([maj_have])
12421a650d1eSmrgm4_undefine([maj_needed])
12431a650d1eSmrg]) # XORG_MACROS_VERSION
12448108eb18Smrg
12458108eb18Smrg# XORG_PROG_RAWCPP()
12468108eb18Smrg# ------------------
12471a650d1eSmrg# Minimum version: 1.0.0
12481a650d1eSmrg#
12498108eb18Smrg# Find cpp program and necessary flags for use in pre-processing text files
12508108eb18Smrg# such as man pages and config files
12518108eb18SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
12528108eb18SmrgAC_REQUIRE([AC_PROG_CPP])
12538108eb18SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
12548108eb18Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
12558108eb18Smrg
12568108eb18Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
12578108eb18Smrg# which is not the best choice for supporting other OS'es, but covers most
12588108eb18Smrg# of the ones we need for now.
12598108eb18SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
12605977a007SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
12618108eb18Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12628108eb18Smrg	AC_MSG_RESULT([no])
12638108eb18Smrgelse
12648108eb18Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12658108eb18Smrg		RAWCPPFLAGS=-undef
12668108eb18Smrg		AC_MSG_RESULT([yes])
12671a650d1eSmrg	# under Cygwin unix is still defined even with -undef
12681a650d1eSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12691a650d1eSmrg		RAWCPPFLAGS="-undef -ansi"
12701a650d1eSmrg		AC_MSG_RESULT([yes, with -ansi])
12718108eb18Smrg	else
12728108eb18Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
12738108eb18Smrg	fi
12748108eb18Smrgfi
12758108eb18Smrgrm -f conftest.$ac_ext
12768108eb18Smrg
12778108eb18SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
12785977a007SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
12798108eb18Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12808108eb18Smrg	AC_MSG_RESULT([no])
12818108eb18Smrgelse
12828108eb18Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12838108eb18Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
12848108eb18Smrg		AC_MSG_RESULT([yes])
12858108eb18Smrg	else
12868108eb18Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
12878108eb18Smrg	fi
12888108eb18Smrgfi
12898108eb18Smrgrm -f conftest.$ac_ext
12908108eb18SmrgAC_SUBST(RAWCPPFLAGS)
12918108eb18Smrg]) # XORG_PROG_RAWCPP
12928108eb18Smrg
12938108eb18Smrg# XORG_MANPAGE_SECTIONS()
12948108eb18Smrg# -----------------------
12951a650d1eSmrg# Minimum version: 1.0.0
12961a650d1eSmrg#
12978108eb18Smrg# Determine which sections man pages go in for the different man page types
12988108eb18Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
12998108eb18Smrg# Not sure if there's any better way than just hardcoding by OS name.
13008108eb18Smrg# Override default settings by setting environment variables
13011a650d1eSmrg# Added MAN_SUBSTS in version 1.8
13021a650d1eSmrg# Added AC_PROG_SED in version 1.8
13038108eb18Smrg
13048108eb18SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
13058108eb18SmrgAC_REQUIRE([AC_CANONICAL_HOST])
13061a650d1eSmrgAC_REQUIRE([AC_PROG_SED])
13078108eb18Smrg
13088108eb18Smrgif test x$APP_MAN_SUFFIX = x    ; then
13091a650d1eSmrg    APP_MAN_SUFFIX=1
13108108eb18Smrgfi
13118108eb18Smrgif test x$APP_MAN_DIR = x    ; then
13121a650d1eSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
13138108eb18Smrgfi
13148108eb18Smrg
13158108eb18Smrgif test x$LIB_MAN_SUFFIX = x    ; then
13161a650d1eSmrg    LIB_MAN_SUFFIX=3
13178108eb18Smrgfi
13188108eb18Smrgif test x$LIB_MAN_DIR = x    ; then
13191a650d1eSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13208108eb18Smrgfi
13218108eb18Smrg
13228108eb18Smrgif test x$FILE_MAN_SUFFIX = x    ; then
13238108eb18Smrg    case $host_os in
13248108eb18Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
13258108eb18Smrg	*)		FILE_MAN_SUFFIX=5  ;;
13268108eb18Smrg    esac
13278108eb18Smrgfi
13288108eb18Smrgif test x$FILE_MAN_DIR = x    ; then
13291a650d1eSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
13308108eb18Smrgfi
13318108eb18Smrg
13328108eb18Smrgif test x$MISC_MAN_SUFFIX = x    ; then
13338108eb18Smrg    case $host_os in
13348108eb18Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
13358108eb18Smrg	*)		MISC_MAN_SUFFIX=7  ;;
13368108eb18Smrg    esac
13378108eb18Smrgfi
13388108eb18Smrgif test x$MISC_MAN_DIR = x    ; then
13391a650d1eSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
13408108eb18Smrgfi
13418108eb18Smrg
13428108eb18Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
13438108eb18Smrg    case $host_os in
13448108eb18Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
13458108eb18Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
13468108eb18Smrg    esac
13478108eb18Smrgfi
13488108eb18Smrgif test x$DRIVER_MAN_DIR = x    ; then
13491a650d1eSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13508108eb18Smrgfi
13518108eb18Smrg
13528108eb18Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
13538108eb18Smrg    case $host_os in
13548108eb18Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
13558108eb18Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
13568108eb18Smrg    esac
13578108eb18Smrgfi
13588108eb18Smrgif test x$ADMIN_MAN_DIR = x    ; then
13598108eb18Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13608108eb18Smrgfi
13618108eb18Smrg
13628108eb18Smrg
13638108eb18SmrgAC_SUBST([APP_MAN_SUFFIX])
13648108eb18SmrgAC_SUBST([LIB_MAN_SUFFIX])
13658108eb18SmrgAC_SUBST([FILE_MAN_SUFFIX])
13668108eb18SmrgAC_SUBST([MISC_MAN_SUFFIX])
13678108eb18SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
13688108eb18SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
13698108eb18SmrgAC_SUBST([APP_MAN_DIR])
13708108eb18SmrgAC_SUBST([LIB_MAN_DIR])
13718108eb18SmrgAC_SUBST([FILE_MAN_DIR])
13728108eb18SmrgAC_SUBST([MISC_MAN_DIR])
13738108eb18SmrgAC_SUBST([DRIVER_MAN_DIR])
13748108eb18SmrgAC_SUBST([ADMIN_MAN_DIR])
13751a650d1eSmrg
13761a650d1eSmrgXORG_MAN_PAGE="X Version 11"
13771a650d1eSmrgAC_SUBST([XORG_MAN_PAGE])
13781a650d1eSmrgMAN_SUBSTS="\
13791a650d1eSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13801a650d1eSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13811a650d1eSmrg	-e 's|__xservername__|Xorg|g' \
13821a650d1eSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
13831a650d1eSmrg	-e 's|__projectroot__|\$(prefix)|g' \
13841a650d1eSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
13851a650d1eSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
13861a650d1eSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
13871a650d1eSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
13881a650d1eSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
13891a650d1eSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
13901a650d1eSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
13911a650d1eSmrgAC_SUBST([MAN_SUBSTS])
13921a650d1eSmrg
13938108eb18Smrg]) # XORG_MANPAGE_SECTIONS
13948108eb18Smrg
13951a650d1eSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
13961a650d1eSmrg# ------------------------
13971a650d1eSmrg# Minimum version: 1.7.0
13981a650d1eSmrg#
13991a650d1eSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
14001a650d1eSmrg# provided by xorg-sgml-doctools, if installed.
14011a650d1eSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
14021a650d1eSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
14031a650d1eSmrgXORG_SGML_PATH=
14041a650d1eSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
14051a650d1eSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
14061a650d1eSmrg    [m4_ifval([$1],[:],
14071a650d1eSmrg        [if test x"$cross_compiling" != x"yes" ; then
14081a650d1eSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
14091a650d1eSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
14101a650d1eSmrg         fi])
14111a650d1eSmrg    ])
14121a650d1eSmrg
14131a650d1eSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
14141a650d1eSmrg# the path and the name of the doc stylesheet
14151a650d1eSmrgif test "x$XORG_SGML_PATH" != "x" ; then
14161a650d1eSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
14171a650d1eSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
14181a650d1eSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
14191a650d1eSmrgelse
14201a650d1eSmrg   AC_MSG_RESULT([no])
14211a650d1eSmrgfi
14221a650d1eSmrg
14231a650d1eSmrgAC_SUBST(XORG_SGML_PATH)
14241a650d1eSmrgAC_SUBST(STYLESHEET_SRCDIR)
14251a650d1eSmrgAC_SUBST(XSL_STYLESHEET)
14261a650d1eSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
14271a650d1eSmrg]) # XORG_CHECK_SGML_DOCTOOLS
14281a650d1eSmrg
14298108eb18Smrg# XORG_CHECK_LINUXDOC
14308108eb18Smrg# -------------------
14311a650d1eSmrg# Minimum version: 1.0.0
14321a650d1eSmrg#
14338108eb18Smrg# Defines the variable MAKE_TEXT if the necessary tools and
14348108eb18Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
14358108eb18Smrg# Whether or not the necessary tools and files are found can be checked
14368108eb18Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
14378108eb18SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
14381a650d1eSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14391a650d1eSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
14408108eb18Smrg
14418108eb18SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
14428108eb18Smrg
14431a650d1eSmrgAC_MSG_CHECKING([whether to build documentation])
14441a650d1eSmrg
14451a650d1eSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
14461a650d1eSmrg   BUILDDOC=yes
14471a650d1eSmrgelse
14481a650d1eSmrg   BUILDDOC=no
14491a650d1eSmrgfi
14501a650d1eSmrg
14511a650d1eSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
14521a650d1eSmrg
14531a650d1eSmrgAC_MSG_RESULT([$BUILDDOC])
14541a650d1eSmrg
14551a650d1eSmrgAC_MSG_CHECKING([whether to build pdf documentation])
14561a650d1eSmrg
14571a650d1eSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
14581a650d1eSmrg   BUILDPDFDOC=yes
14591a650d1eSmrgelse
14601a650d1eSmrg   BUILDPDFDOC=no
14611a650d1eSmrgfi
14621a650d1eSmrg
14631a650d1eSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
14641a650d1eSmrg
14651a650d1eSmrgAC_MSG_RESULT([$BUILDPDFDOC])
14661a650d1eSmrg
14671a650d1eSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
14681a650d1eSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
14691a650d1eSmrgMAKE_PDF="$PS2PDF"
14701a650d1eSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
14711a650d1eSmrg
14721a650d1eSmrgAC_SUBST(MAKE_TEXT)
14731a650d1eSmrgAC_SUBST(MAKE_PS)
14741a650d1eSmrgAC_SUBST(MAKE_PDF)
14751a650d1eSmrgAC_SUBST(MAKE_HTML)
14761a650d1eSmrg]) # XORG_CHECK_LINUXDOC
14771a650d1eSmrg
14781a650d1eSmrg# XORG_CHECK_DOCBOOK
14791a650d1eSmrg# -------------------
14801a650d1eSmrg# Minimum version: 1.0.0
14811a650d1eSmrg#
14821a650d1eSmrg# Checks for the ability to build output formats from SGML DocBook source.
14831a650d1eSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
14841a650d1eSmrg# indicates whether the necessary tools and files are found and, if set,
14851a650d1eSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
14861a650d1eSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
14871a650d1eSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14881a650d1eSmrg
14891a650d1eSmrgBUILDTXTDOC=no
14901a650d1eSmrgBUILDPDFDOC=no
14911a650d1eSmrgBUILDPSDOC=no
14921a650d1eSmrgBUILDHTMLDOC=no
14931a650d1eSmrg
14941a650d1eSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
14951a650d1eSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
14961a650d1eSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
14971a650d1eSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
14981a650d1eSmrg
14991a650d1eSmrgAC_MSG_CHECKING([whether to build text documentation])
15001a650d1eSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
15011a650d1eSmrg   test x$BUILD_TXTDOC != xno; then
15021a650d1eSmrg	BUILDTXTDOC=yes
15031a650d1eSmrgfi
15041a650d1eSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
15051a650d1eSmrgAC_MSG_RESULT([$BUILDTXTDOC])
15061a650d1eSmrg
15071a650d1eSmrgAC_MSG_CHECKING([whether to build PDF documentation])
15081a650d1eSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
15091a650d1eSmrg   test x$BUILD_PDFDOC != xno; then
15101a650d1eSmrg	BUILDPDFDOC=yes
15111a650d1eSmrgfi
15121a650d1eSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
15131a650d1eSmrgAC_MSG_RESULT([$BUILDPDFDOC])
15141a650d1eSmrg
15151a650d1eSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
15161a650d1eSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
15171a650d1eSmrg   test x$BUILD_PSDOC != xno; then
15181a650d1eSmrg	BUILDPSDOC=yes
15191a650d1eSmrgfi
15201a650d1eSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
15211a650d1eSmrgAC_MSG_RESULT([$BUILDPSDOC])
15221a650d1eSmrg
15231a650d1eSmrgAC_MSG_CHECKING([whether to build HTML documentation])
15241a650d1eSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
15251a650d1eSmrg   test x$BUILD_HTMLDOC != xno; then
15261a650d1eSmrg	BUILDHTMLDOC=yes
15271a650d1eSmrgfi
15281a650d1eSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
15291a650d1eSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
15301a650d1eSmrg
15311a650d1eSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
15321a650d1eSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
15331a650d1eSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
15341a650d1eSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
15351a650d1eSmrg
15361a650d1eSmrgAC_SUBST(MAKE_TEXT)
15371a650d1eSmrgAC_SUBST(MAKE_PS)
15381a650d1eSmrgAC_SUBST(MAKE_PDF)
15391a650d1eSmrgAC_SUBST(MAKE_HTML)
15401a650d1eSmrg]) # XORG_CHECK_DOCBOOK
15411a650d1eSmrg
15425977a007Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
15431a650d1eSmrg# ----------------
15441a650d1eSmrg# Minimum version: 1.5.0
15455977a007Smrg# Minimum version for optional DEFAULT argument: 1.11.0
15461a650d1eSmrg#
15471a650d1eSmrg# Documentation tools are not always available on all platforms and sometimes
15481a650d1eSmrg# not at the appropriate level. This macro enables a module to test for the
15491a650d1eSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
15501a650d1eSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
15515977a007Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
15525977a007Smrg# --with-xmlto assumes 'auto'.
15531a650d1eSmrg#
15541a650d1eSmrg# Interface to module:
15551a650d1eSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
15561a650d1eSmrg# XMLTO:	returns the path of the xmlto program found
15571a650d1eSmrg#		returns the path set by the user in the environment
15581a650d1eSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
15591a650d1eSmrg#		'no' user instructs the module not to use xmlto
15601a650d1eSmrg#
15611a650d1eSmrg# Added in version 1.10.0
15621a650d1eSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
15631a650d1eSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
15641a650d1eSmrg#
15651a650d1eSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
15661a650d1eSmrg#
15671a650d1eSmrgAC_DEFUN([XORG_WITH_XMLTO],[
15681a650d1eSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
15695977a007Smrgm4_define([_defopt], m4_default([$2], [auto]))
15701a650d1eSmrgAC_ARG_WITH(xmlto,
15711a650d1eSmrg	AS_HELP_STRING([--with-xmlto],
15725977a007Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
15735977a007Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
15745977a007Smrgm4_undefine([_defopt])
15751a650d1eSmrg
15761a650d1eSmrgif test "x$use_xmlto" = x"auto"; then
15771a650d1eSmrg   AC_PATH_PROG([XMLTO], [xmlto])
15781a650d1eSmrg   if test "x$XMLTO" = "x"; then
15791a650d1eSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
15801a650d1eSmrg	have_xmlto=no
15811a650d1eSmrg   else
15821a650d1eSmrg        have_xmlto=yes
15831a650d1eSmrg   fi
15841a650d1eSmrgelif test "x$use_xmlto" = x"yes" ; then
15851a650d1eSmrg   AC_PATH_PROG([XMLTO], [xmlto])
15861a650d1eSmrg   if test "x$XMLTO" = "x"; then
15871a650d1eSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
15881a650d1eSmrg   fi
15891a650d1eSmrg   have_xmlto=yes
15901a650d1eSmrgelif test "x$use_xmlto" = x"no" ; then
15911a650d1eSmrg   if test "x$XMLTO" != "x"; then
15921a650d1eSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
15931a650d1eSmrg   fi
15941a650d1eSmrg   have_xmlto=no
15951a650d1eSmrgelse
15961a650d1eSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
15971a650d1eSmrgfi
15981a650d1eSmrg
15991a650d1eSmrg# Test for a minimum version of xmlto, if provided.
16001a650d1eSmrgm4_ifval([$1],
16011a650d1eSmrg[if test "$have_xmlto" = yes; then
16021a650d1eSmrg    # scrape the xmlto version
16031a650d1eSmrg    AC_MSG_CHECKING([the xmlto version])
16041a650d1eSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
16051a650d1eSmrg    AC_MSG_RESULT([$xmlto_version])
16061a650d1eSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
16071a650d1eSmrg        [if test "x$use_xmlto" = xauto; then
16081a650d1eSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
16091a650d1eSmrg            have_xmlto=no
16101a650d1eSmrg        else
16111a650d1eSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
16121a650d1eSmrg        fi])
16131a650d1eSmrgfi])
16141a650d1eSmrg
16151a650d1eSmrg# Test for the ability of xmlto to generate a text target
16161a650d1eSmrghave_xmlto_text=no
16171a650d1eSmrgcat > conftest.xml << "EOF"
16181a650d1eSmrgEOF
16191a650d1eSmrgAS_IF([test "$have_xmlto" = yes],
16201a650d1eSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
16211a650d1eSmrg             [have_xmlto_text=yes],
16221a650d1eSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
16231a650d1eSmrgrm -f conftest.xml
16241a650d1eSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
16251a650d1eSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
16261a650d1eSmrg]) # XORG_WITH_XMLTO
16271a650d1eSmrg
16285977a007Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
16295977a007Smrg# --------------------------------------------
16305977a007Smrg# Minimum version: 1.12.0
16315977a007Smrg# Minimum version for optional DEFAULT argument: 1.12.0
16325977a007Smrg#
16335977a007Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
16345977a007Smrg# XML-based language used for the transformation of XML documents.
16355977a007Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
16365977a007Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
16375977a007Smrg# The XSLT processor is often used as a standalone tool for transformations.
16385977a007Smrg# It should not be assumed that this tool is used only to work with documnetation.
16395977a007Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
16405977a007Smrg#
16415977a007Smrg# Interface to module:
16425977a007Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
16435977a007Smrg# XSLTPROC:	 returns the path of the xsltproc program found
16445977a007Smrg#		 returns the path set by the user in the environment
16455977a007Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
16465977a007Smrg#		  'no' user instructs the module not to use xsltproc
16475977a007Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
16485977a007Smrg#
16495977a007Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
16505977a007Smrg#
16515977a007SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
16525977a007SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
16535977a007Smrg# Preserves the interface, should it be implemented later
16545977a007Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
16555977a007Smrgm4_define([_defopt], m4_default([$2], [auto]))
16565977a007SmrgAC_ARG_WITH(xsltproc,
16575977a007Smrg	AS_HELP_STRING([--with-xsltproc],
16585977a007Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
16595977a007Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
16605977a007Smrgm4_undefine([_defopt])
16615977a007Smrg
16625977a007Smrgif test "x$use_xsltproc" = x"auto"; then
16635977a007Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16645977a007Smrg   if test "x$XSLTPROC" = "x"; then
16655977a007Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
16665977a007Smrg	have_xsltproc=no
16675977a007Smrg   else
16685977a007Smrg        have_xsltproc=yes
16695977a007Smrg   fi
16705977a007Smrgelif test "x$use_xsltproc" = x"yes" ; then
16715977a007Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16725977a007Smrg   if test "x$XSLTPROC" = "x"; then
16735977a007Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
16745977a007Smrg   fi
16755977a007Smrg   have_xsltproc=yes
16765977a007Smrgelif test "x$use_xsltproc" = x"no" ; then
16775977a007Smrg   if test "x$XSLTPROC" != "x"; then
16785977a007Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
16795977a007Smrg   fi
16805977a007Smrg   have_xsltproc=no
16815977a007Smrgelse
16825977a007Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
16835977a007Smrgfi
16845977a007Smrg
16855977a007SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
16865977a007Smrg]) # XORG_WITH_XSLTPROC
16875977a007Smrg
16885977a007Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
16895977a007Smrg# ----------------------------------------
16905977a007Smrg# Minimum version: 1.15.0
16915977a007Smrg#
16925977a007Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
16935977a007Smrg# scanning arbitrary text files, extracting information from those text files,
16945977a007Smrg# and printing reports based on that information.
16955977a007Smrg#
16965977a007Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
16975977a007Smrg#
16985977a007Smrg# Interface to module:
16995977a007Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
17005977a007Smrg# PERL:	     returns the path of the perl program found
17015977a007Smrg#	     returns the path set by the user in the environment
17025977a007Smrg# --with-perl: 'yes' user instructs the module to use perl
17035977a007Smrg#	       'no' user instructs the module not to use perl
17045977a007Smrg# have_perl: returns yes if perl found in PATH or no
17055977a007Smrg#
17065977a007Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
17075977a007Smrg#
17085977a007SmrgAC_DEFUN([XORG_WITH_PERL],[
17095977a007SmrgAC_ARG_VAR([PERL], [Path to perl command])
17105977a007Smrg# Preserves the interface, should it be implemented later
17115977a007Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
17125977a007Smrgm4_define([_defopt], m4_default([$2], [auto]))
17135977a007SmrgAC_ARG_WITH(perl,
17145977a007Smrg	AS_HELP_STRING([--with-perl],
17155977a007Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
17165977a007Smrg	   [use_perl=$withval], [use_perl=]_defopt)
17175977a007Smrgm4_undefine([_defopt])
17185977a007Smrg
17195977a007Smrgif test "x$use_perl" = x"auto"; then
17205977a007Smrg   AC_PATH_PROG([PERL], [perl])
17215977a007Smrg   if test "x$PERL" = "x"; then
17225977a007Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
17235977a007Smrg	have_perl=no
17245977a007Smrg   else
17255977a007Smrg        have_perl=yes
17265977a007Smrg   fi
17275977a007Smrgelif test "x$use_perl" = x"yes" ; then
17285977a007Smrg   AC_PATH_PROG([PERL], [perl])
17295977a007Smrg   if test "x$PERL" = "x"; then
17305977a007Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
17315977a007Smrg   fi
17325977a007Smrg   have_perl=yes
17335977a007Smrgelif test "x$use_perl" = x"no" ; then
17345977a007Smrg   if test "x$PERL" != "x"; then
17355977a007Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
17365977a007Smrg   fi
17375977a007Smrg   have_perl=no
17385977a007Smrgelse
17395977a007Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
17405977a007Smrgfi
17415977a007Smrg
17425977a007SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
17435977a007Smrg]) # XORG_WITH_PERL
17445977a007Smrg
17455977a007Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
17461a650d1eSmrg# ----------------
17471a650d1eSmrg# Minimum version: 1.5.0
17485977a007Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17491a650d1eSmrg#
17501a650d1eSmrg# Documentation tools are not always available on all platforms and sometimes
17511a650d1eSmrg# not at the appropriate level. This macro enables a module to test for the
17521a650d1eSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17531a650d1eSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
17545977a007Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
17555977a007Smrg# --with-asciidoc assumes 'auto'.
17561a650d1eSmrg#
17571a650d1eSmrg# Interface to module:
17581a650d1eSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
17591a650d1eSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
17601a650d1eSmrg#		 returns the path set by the user in the environment
17611a650d1eSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
17621a650d1eSmrg#		  'no' user instructs the module not to use asciidoc
17631a650d1eSmrg#
17641a650d1eSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
17651a650d1eSmrg#
17661a650d1eSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
17671a650d1eSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
17685977a007Smrgm4_define([_defopt], m4_default([$2], [auto]))
17691a650d1eSmrgAC_ARG_WITH(asciidoc,
17701a650d1eSmrg	AS_HELP_STRING([--with-asciidoc],
17715977a007Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
17725977a007Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
17735977a007Smrgm4_undefine([_defopt])
17741a650d1eSmrg
17751a650d1eSmrgif test "x$use_asciidoc" = x"auto"; then
17761a650d1eSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17771a650d1eSmrg   if test "x$ASCIIDOC" = "x"; then
17781a650d1eSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
17791a650d1eSmrg	have_asciidoc=no
17801a650d1eSmrg   else
17811a650d1eSmrg        have_asciidoc=yes
17821a650d1eSmrg   fi
17831a650d1eSmrgelif test "x$use_asciidoc" = x"yes" ; then
17841a650d1eSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17851a650d1eSmrg   if test "x$ASCIIDOC" = "x"; then
17861a650d1eSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
17871a650d1eSmrg   fi
17881a650d1eSmrg   have_asciidoc=yes
17891a650d1eSmrgelif test "x$use_asciidoc" = x"no" ; then
17901a650d1eSmrg   if test "x$ASCIIDOC" != "x"; then
17911a650d1eSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
17921a650d1eSmrg   fi
17931a650d1eSmrg   have_asciidoc=no
17941a650d1eSmrgelse
17951a650d1eSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
17961a650d1eSmrgfi
17971a650d1eSmrgm4_ifval([$1],
17981a650d1eSmrg[if test "$have_asciidoc" = yes; then
17991a650d1eSmrg    # scrape the asciidoc version
18001a650d1eSmrg    AC_MSG_CHECKING([the asciidoc version])
18011a650d1eSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
18021a650d1eSmrg    AC_MSG_RESULT([$asciidoc_version])
18031a650d1eSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
18041a650d1eSmrg        [if test "x$use_asciidoc" = xauto; then
18051a650d1eSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
18061a650d1eSmrg            have_asciidoc=no
18071a650d1eSmrg        else
18081a650d1eSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
18091a650d1eSmrg        fi])
18101a650d1eSmrgfi])
18111a650d1eSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
18121a650d1eSmrg]) # XORG_WITH_ASCIIDOC
18131a650d1eSmrg
18145977a007Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
18151a650d1eSmrg# --------------------------------
18161a650d1eSmrg# Minimum version: 1.5.0
18175977a007Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18181a650d1eSmrg#
18191a650d1eSmrg# Documentation tools are not always available on all platforms and sometimes
18201a650d1eSmrg# not at the appropriate level. This macro enables a module to test for the
18211a650d1eSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18221a650d1eSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
18235977a007Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
18245977a007Smrg# --with-doxygen assumes 'auto'.
18251a650d1eSmrg#
18261a650d1eSmrg# Interface to module:
18271a650d1eSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
18281a650d1eSmrg# DOXYGEN:	 returns the path of the doxygen program found
18291a650d1eSmrg#		 returns the path set by the user in the environment
18301a650d1eSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
18311a650d1eSmrg#		  'no' user instructs the module not to use doxygen
18321a650d1eSmrg#
18331a650d1eSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
18341a650d1eSmrg#
18351a650d1eSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
18361a650d1eSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
18375977a007Smrgm4_define([_defopt], m4_default([$2], [auto]))
18381a650d1eSmrgAC_ARG_WITH(doxygen,
18391a650d1eSmrg	AS_HELP_STRING([--with-doxygen],
18405977a007Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
18415977a007Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
18425977a007Smrgm4_undefine([_defopt])
18431a650d1eSmrg
18441a650d1eSmrgif test "x$use_doxygen" = x"auto"; then
18451a650d1eSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18461a650d1eSmrg   if test "x$DOXYGEN" = "x"; then
18471a650d1eSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
18481a650d1eSmrg	have_doxygen=no
18491a650d1eSmrg   else
18501a650d1eSmrg        have_doxygen=yes
18511a650d1eSmrg   fi
18521a650d1eSmrgelif test "x$use_doxygen" = x"yes" ; then
18531a650d1eSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18541a650d1eSmrg   if test "x$DOXYGEN" = "x"; then
18551a650d1eSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
18561a650d1eSmrg   fi
18571a650d1eSmrg   have_doxygen=yes
18581a650d1eSmrgelif test "x$use_doxygen" = x"no" ; then
18591a650d1eSmrg   if test "x$DOXYGEN" != "x"; then
18601a650d1eSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
18611a650d1eSmrg   fi
18621a650d1eSmrg   have_doxygen=no
18631a650d1eSmrgelse
18641a650d1eSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
18651a650d1eSmrgfi
18661a650d1eSmrgm4_ifval([$1],
18671a650d1eSmrg[if test "$have_doxygen" = yes; then
18681a650d1eSmrg    # scrape the doxygen version
18691a650d1eSmrg    AC_MSG_CHECKING([the doxygen version])
18701a650d1eSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
18711a650d1eSmrg    AC_MSG_RESULT([$doxygen_version])
18721a650d1eSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
18731a650d1eSmrg        [if test "x$use_doxygen" = xauto; then
18741a650d1eSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
18751a650d1eSmrg            have_doxygen=no
18761a650d1eSmrg        else
18771a650d1eSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
18781a650d1eSmrg        fi])
18791a650d1eSmrgfi])
18801a650d1eSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
18811a650d1eSmrg]) # XORG_WITH_DOXYGEN
18828108eb18Smrg
18835977a007Smrg# XORG_WITH_GROFF([DEFAULT])
18841a650d1eSmrg# ----------------
18851a650d1eSmrg# Minimum version: 1.6.0
18865977a007Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18871a650d1eSmrg#
18881a650d1eSmrg# Documentation tools are not always available on all platforms and sometimes
18891a650d1eSmrg# not at the appropriate level. This macro enables a module to test for the
18901a650d1eSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18911a650d1eSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
18925977a007Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
18935977a007Smrg# --with-groff assumes 'auto'.
18941a650d1eSmrg#
18951a650d1eSmrg# Interface to module:
18961a650d1eSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
18971a650d1eSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
18981a650d1eSmrg# HAVE_GROFF_MS: the -ms macros package
18991a650d1eSmrg# GROFF:	 returns the path of the groff program found
19001a650d1eSmrg#		 returns the path set by the user in the environment
19011a650d1eSmrg# --with-groff:	 'yes' user instructs the module to use groff
19021a650d1eSmrg#		 'no' user instructs the module not to use groff
19031a650d1eSmrg#
19041a650d1eSmrg# Added in version 1.9.0:
19051a650d1eSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
19061a650d1eSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
19071a650d1eSmrg#		   psselect from the psutils package.
19081a650d1eSmrg#		   the ghostcript package. Refer to the grohtml man pages
19091a650d1eSmrg#
19101a650d1eSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
19111a650d1eSmrg#
19121a650d1eSmrg# OS and distros often splits groff in a basic and full package, the former
19131a650d1eSmrg# having the groff program and the later having devices, fonts and macros
19141a650d1eSmrg# Checking for the groff executable is not enough.
19151a650d1eSmrg#
19161a650d1eSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
19171a650d1eSmrg# unset HAVE_GROFF or GROFF env variables.
19181a650d1eSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
19191a650d1eSmrg#
19201a650d1eSmrgAC_DEFUN([XORG_WITH_GROFF],[
19211a650d1eSmrgAC_ARG_VAR([GROFF], [Path to groff command])
19225977a007Smrgm4_define([_defopt], m4_default([$1], [auto]))
19231a650d1eSmrgAC_ARG_WITH(groff,
19241a650d1eSmrg	AS_HELP_STRING([--with-groff],
19255977a007Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
19265977a007Smrg	   [use_groff=$withval], [use_groff=]_defopt)
19275977a007Smrgm4_undefine([_defopt])
19281a650d1eSmrg
19291a650d1eSmrgif test "x$use_groff" = x"auto"; then
19301a650d1eSmrg   AC_PATH_PROG([GROFF], [groff])
19311a650d1eSmrg   if test "x$GROFF" = "x"; then
19321a650d1eSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
19331a650d1eSmrg	have_groff=no
19341a650d1eSmrg   else
19351a650d1eSmrg        have_groff=yes
19361a650d1eSmrg   fi
19371a650d1eSmrgelif test "x$use_groff" = x"yes" ; then
19381a650d1eSmrg   AC_PATH_PROG([GROFF], [groff])
19391a650d1eSmrg   if test "x$GROFF" = "x"; then
19401a650d1eSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
19411a650d1eSmrg   fi
19421a650d1eSmrg   have_groff=yes
19431a650d1eSmrgelif test "x$use_groff" = x"no" ; then
19441a650d1eSmrg   if test "x$GROFF" != "x"; then
19451a650d1eSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
19461a650d1eSmrg   fi
19471a650d1eSmrg   have_groff=no
19488108eb18Smrgelse
19491a650d1eSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19508108eb18Smrgfi
19518108eb18Smrg
19521a650d1eSmrg# We have groff, test for the presence of the macro packages
19531a650d1eSmrgif test "x$have_groff" = x"yes"; then
19541a650d1eSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
19551a650d1eSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
19561a650d1eSmrg        groff_ms_works=yes
19571a650d1eSmrg    else
19581a650d1eSmrg        groff_ms_works=no
19591a650d1eSmrg    fi
19601a650d1eSmrg    AC_MSG_RESULT([$groff_ms_works])
19611a650d1eSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
19621a650d1eSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
19631a650d1eSmrg        groff_mm_works=yes
19641a650d1eSmrg    else
19651a650d1eSmrg        groff_mm_works=no
19661a650d1eSmrg    fi
19671a650d1eSmrg    AC_MSG_RESULT([$groff_mm_works])
19681a650d1eSmrgfi
19698108eb18Smrg
19701a650d1eSmrg# We have groff, test for HTML dependencies, one command per package
19711a650d1eSmrgif test "x$have_groff" = x"yes"; then
19721a650d1eSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
19731a650d1eSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
19741a650d1eSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
19751a650d1eSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
19761a650d1eSmrg      have_groff_html=yes
19771a650d1eSmrg   else
19781a650d1eSmrg      have_groff_html=no
19791a650d1eSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
19801a650d1eSmrg   fi
19811a650d1eSmrgfi
19828108eb18Smrg
19831a650d1eSmrg# Set Automake conditionals for Makefiles
19841a650d1eSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
19851a650d1eSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
19861a650d1eSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
19871a650d1eSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
19881a650d1eSmrg]) # XORG_WITH_GROFF
19898108eb18Smrg
19905977a007Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
19915977a007Smrg# ---------------------------------------
19921a650d1eSmrg# Minimum version: 1.6.0
19935977a007Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19945977a007Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
19951a650d1eSmrg#
19961a650d1eSmrg# Documentation tools are not always available on all platforms and sometimes
19971a650d1eSmrg# not at the appropriate level. This macro enables a module to test for the
19981a650d1eSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
19991a650d1eSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
20005977a007Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
20015977a007Smrg# --with-fop assumes 'auto'.
20021a650d1eSmrg#
20031a650d1eSmrg# Interface to module:
20041a650d1eSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
20051a650d1eSmrg# FOP:	 	returns the path of the fop program found
20061a650d1eSmrg#		returns the path set by the user in the environment
20071a650d1eSmrg# --with-fop: 	'yes' user instructs the module to use fop
20081a650d1eSmrg#		'no' user instructs the module not to use fop
20091a650d1eSmrg#
20101a650d1eSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
20111a650d1eSmrg#
20121a650d1eSmrgAC_DEFUN([XORG_WITH_FOP],[
20131a650d1eSmrgAC_ARG_VAR([FOP], [Path to fop command])
20145977a007Smrgm4_define([_defopt], m4_default([$2], [auto]))
20151a650d1eSmrgAC_ARG_WITH(fop,
20161a650d1eSmrg	AS_HELP_STRING([--with-fop],
20175977a007Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
20185977a007Smrg	   [use_fop=$withval], [use_fop=]_defopt)
20195977a007Smrgm4_undefine([_defopt])
20201a650d1eSmrg
20211a650d1eSmrgif test "x$use_fop" = x"auto"; then
20221a650d1eSmrg   AC_PATH_PROG([FOP], [fop])
20231a650d1eSmrg   if test "x$FOP" = "x"; then
20241a650d1eSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
20251a650d1eSmrg	have_fop=no
20261a650d1eSmrg   else
20271a650d1eSmrg        have_fop=yes
20281a650d1eSmrg   fi
20291a650d1eSmrgelif test "x$use_fop" = x"yes" ; then
20301a650d1eSmrg   AC_PATH_PROG([FOP], [fop])
20311a650d1eSmrg   if test "x$FOP" = "x"; then
20321a650d1eSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
20331a650d1eSmrg   fi
20341a650d1eSmrg   have_fop=yes
20351a650d1eSmrgelif test "x$use_fop" = x"no" ; then
20361a650d1eSmrg   if test "x$FOP" != "x"; then
20371a650d1eSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
20381a650d1eSmrg   fi
20391a650d1eSmrg   have_fop=no
20408108eb18Smrgelse
20411a650d1eSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20428108eb18Smrgfi
20435977a007Smrg
20445977a007Smrg# Test for a minimum version of fop, if provided.
20455977a007Smrgm4_ifval([$1],
20465977a007Smrg[if test "$have_fop" = yes; then
20475977a007Smrg    # scrape the fop version
20485977a007Smrg    AC_MSG_CHECKING([for fop minimum version])
20495977a007Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
20505977a007Smrg    AC_MSG_RESULT([$fop_version])
20515977a007Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
20525977a007Smrg        [if test "x$use_fop" = xauto; then
20535977a007Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
20545977a007Smrg            have_fop=no
20555977a007Smrg        else
20565977a007Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
20575977a007Smrg        fi])
20585977a007Smrgfi])
20591a650d1eSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
20601a650d1eSmrg]) # XORG_WITH_FOP
20618108eb18Smrg
20625977a007Smrg# XORG_WITH_PS2PDF([DEFAULT])
20631a650d1eSmrg# ----------------
20641a650d1eSmrg# Minimum version: 1.6.0
20655977a007Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20661a650d1eSmrg#
20671a650d1eSmrg# Documentation tools are not always available on all platforms and sometimes
20681a650d1eSmrg# not at the appropriate level. This macro enables a module to test for the
20691a650d1eSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20701a650d1eSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
20715977a007Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
20725977a007Smrg# --with-ps2pdf assumes 'auto'.
20731a650d1eSmrg#
20741a650d1eSmrg# Interface to module:
20751a650d1eSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
20761a650d1eSmrg# PS2PDF:	returns the path of the ps2pdf program found
20771a650d1eSmrg#		returns the path set by the user in the environment
20781a650d1eSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
20791a650d1eSmrg#		 'no' user instructs the module not to use ps2pdf
20801a650d1eSmrg#
20811a650d1eSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
20821a650d1eSmrg#
20831a650d1eSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
20841a650d1eSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
20855977a007Smrgm4_define([_defopt], m4_default([$1], [auto]))
20861a650d1eSmrgAC_ARG_WITH(ps2pdf,
20871a650d1eSmrg	AS_HELP_STRING([--with-ps2pdf],
20885977a007Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
20895977a007Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
20905977a007Smrgm4_undefine([_defopt])
20911a650d1eSmrg
20921a650d1eSmrgif test "x$use_ps2pdf" = x"auto"; then
20931a650d1eSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
20941a650d1eSmrg   if test "x$PS2PDF" = "x"; then
20951a650d1eSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
20961a650d1eSmrg	have_ps2pdf=no
20971a650d1eSmrg   else
20981a650d1eSmrg        have_ps2pdf=yes
20991a650d1eSmrg   fi
21001a650d1eSmrgelif test "x$use_ps2pdf" = x"yes" ; then
21011a650d1eSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
21021a650d1eSmrg   if test "x$PS2PDF" = "x"; then
21031a650d1eSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
21041a650d1eSmrg   fi
21051a650d1eSmrg   have_ps2pdf=yes
21061a650d1eSmrgelif test "x$use_ps2pdf" = x"no" ; then
21071a650d1eSmrg   if test "x$PS2PDF" != "x"; then
21081a650d1eSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
21091a650d1eSmrg   fi
21101a650d1eSmrg   have_ps2pdf=no
21111a650d1eSmrgelse
21121a650d1eSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
21131a650d1eSmrgfi
21141a650d1eSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
21151a650d1eSmrg]) # XORG_WITH_PS2PDF
21168108eb18Smrg
21171a650d1eSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
21181a650d1eSmrg# ----------------
21191a650d1eSmrg# Minimum version: 1.6.0
21201a650d1eSmrg#
21211a650d1eSmrg# Documentation tools are not always available on all platforms and sometimes
21221a650d1eSmrg# not at the appropriate level. This macro enables a builder to skip all
21231a650d1eSmrg# documentation targets except traditional man pages.
21241a650d1eSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21251a650d1eSmrg# maximum flexibilty in controlling documentation building.
21261a650d1eSmrg# Refer to:
21271a650d1eSmrg# XORG_WITH_XMLTO         --with-xmlto
21281a650d1eSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21291a650d1eSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21301a650d1eSmrg# XORG_WITH_FOP           --with-fop
21311a650d1eSmrg# XORG_WITH_GROFF         --with-groff
21321a650d1eSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21331a650d1eSmrg#
21341a650d1eSmrg# Interface to module:
21351a650d1eSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
21361a650d1eSmrg# --enable-docs: 'yes' user instructs the module to generate docs
21371a650d1eSmrg#		 'no' user instructs the module not to generate docs
21381a650d1eSmrg# parm1:	specify the default value, yes or no.
21391a650d1eSmrg#
21401a650d1eSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
21415977a007Smrgm4_define([docs_default], m4_default([$1], [yes]))
21421a650d1eSmrgAC_ARG_ENABLE(docs,
21431a650d1eSmrg	AS_HELP_STRING([--enable-docs],
21445977a007Smrg	   [Enable building the documentation (default: ]docs_default[)]),
21455977a007Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
21465977a007Smrgm4_undefine([docs_default])
21471a650d1eSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
21481a650d1eSmrgAC_MSG_CHECKING([whether to build documentation])
21491a650d1eSmrgAC_MSG_RESULT([$build_docs])
21501a650d1eSmrg]) # XORG_ENABLE_DOCS
21511a650d1eSmrg
21521a650d1eSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
21531a650d1eSmrg# ----------------
21541a650d1eSmrg# Minimum version: 1.6.0
21551a650d1eSmrg#
21561a650d1eSmrg# This macro enables a builder to skip all developer documentation.
21571a650d1eSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21581a650d1eSmrg# maximum flexibilty in controlling documentation building.
21591a650d1eSmrg# Refer to:
21601a650d1eSmrg# XORG_WITH_XMLTO         --with-xmlto
21611a650d1eSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21621a650d1eSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21631a650d1eSmrg# XORG_WITH_FOP           --with-fop
21641a650d1eSmrg# XORG_WITH_GROFF         --with-groff
21651a650d1eSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21661a650d1eSmrg#
21671a650d1eSmrg# Interface to module:
21681a650d1eSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
21691a650d1eSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
21701a650d1eSmrg#			'no' user instructs the module not to generate developer docs
21711a650d1eSmrg# parm1:		specify the default value, yes or no.
21721a650d1eSmrg#
21731a650d1eSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
21745977a007Smrgm4_define([devel_default], m4_default([$1], [yes]))
21751a650d1eSmrgAC_ARG_ENABLE(devel-docs,
21761a650d1eSmrg	AS_HELP_STRING([--enable-devel-docs],
21775977a007Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
21785977a007Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
21795977a007Smrgm4_undefine([devel_default])
21801a650d1eSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
21811a650d1eSmrgAC_MSG_CHECKING([whether to build developer documentation])
21821a650d1eSmrgAC_MSG_RESULT([$build_devel_docs])
21831a650d1eSmrg]) # XORG_ENABLE_DEVEL_DOCS
21841a650d1eSmrg
21851a650d1eSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
21861a650d1eSmrg# ----------------
21871a650d1eSmrg# Minimum version: 1.6.0
21881a650d1eSmrg#
21891a650d1eSmrg# This macro enables a builder to skip all functional specification targets.
21901a650d1eSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21911a650d1eSmrg# maximum flexibilty in controlling documentation building.
21921a650d1eSmrg# Refer to:
21931a650d1eSmrg# XORG_WITH_XMLTO         --with-xmlto
21941a650d1eSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21951a650d1eSmrg# XORG_WITH_DOXYGEN       --with-doxygen
21961a650d1eSmrg# XORG_WITH_FOP           --with-fop
21971a650d1eSmrg# XORG_WITH_GROFF         --with-groff
21981a650d1eSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21991a650d1eSmrg#
22001a650d1eSmrg# Interface to module:
22011a650d1eSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
22021a650d1eSmrg# --enable-specs:	'yes' user instructs the module to generate specs
22031a650d1eSmrg#			'no' user instructs the module not to generate specs
22041a650d1eSmrg# parm1:		specify the default value, yes or no.
22051a650d1eSmrg#
22061a650d1eSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
22075977a007Smrgm4_define([spec_default], m4_default([$1], [yes]))
22081a650d1eSmrgAC_ARG_ENABLE(specs,
22091a650d1eSmrg	AS_HELP_STRING([--enable-specs],
22105977a007Smrg	   [Enable building the specs (default: ]spec_default[)]),
22115977a007Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
22125977a007Smrgm4_undefine([spec_default])
22131a650d1eSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
22141a650d1eSmrgAC_MSG_CHECKING([whether to build functional specifications])
22151a650d1eSmrgAC_MSG_RESULT([$build_specs])
22161a650d1eSmrg]) # XORG_ENABLE_SPECS
22178108eb18Smrg
22185977a007Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
22195977a007Smrg# ----------------------------------------------
22205977a007Smrg# Minimum version: 1.13.0
22215977a007Smrg#
22225977a007Smrg# This macro enables a builder to enable/disable unit testing
22235977a007Smrg# It makes no assumption about the test cases implementation
22245977a007Smrg# Test cases may or may not use Automake "Support for test suites"
22255977a007Smrg# They may or may not use the software utility library GLib
22265977a007Smrg#
22275977a007Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
22285977a007Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
22295977a007Smrg# The variable enable_unit_tests is used by other macros in this file.
22305977a007Smrg#
22315977a007Smrg# Interface to module:
22325977a007Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
22335977a007Smrg# enable_unit_tests:    used in configure.ac for additional configuration
22345977a007Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
22355977a007Smrg#			'no' user instructs the module not to build tests
22365977a007Smrg# parm1:		specify the default value, yes or no.
22375977a007Smrg#
22385977a007SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
22395977a007SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
22405977a007SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
22415977a007SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22425977a007Smrgm4_define([_defopt], m4_default([$1], [auto]))
22435977a007SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
22445977a007Smrg	[Enable building unit test cases (default: ]_defopt[)]),
22455977a007Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
22465977a007Smrgm4_undefine([_defopt])
22475977a007SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
22485977a007SmrgAC_MSG_CHECKING([whether to build unit test cases])
22495977a007SmrgAC_MSG_RESULT([$enable_unit_tests])
22505977a007Smrg]) # XORG_ENABLE_UNIT_TESTS
22515977a007Smrg
22525977a007Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
22535977a007Smrg# ------------------------------------------------------
22545977a007Smrg# Minimum version: 1.17.0
22555977a007Smrg#
22565977a007Smrg# This macro enables a builder to enable/disable integration testing
22575977a007Smrg# It makes no assumption about the test cases' implementation
22585977a007Smrg# Test cases may or may not use Automake "Support for test suites"
22595977a007Smrg#
22605977a007Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
22615977a007Smrg# usually requires less dependencies and may be built and run under less
22625977a007Smrg# stringent environments than integration tests.
22635977a007Smrg#
22645977a007Smrg# Interface to module:
22655977a007Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
22665977a007Smrg# enable_integration_tests:   used in configure.ac for additional configuration
22675977a007Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
22685977a007Smrg#                             'no' user instructs the module not to build tests
22695977a007Smrg# parm1:                      specify the default value, yes or no.
22705977a007Smrg#
22715977a007SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
22725977a007SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22735977a007Smrgm4_define([_defopt], m4_default([$1], [auto]))
22745977a007SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
22755977a007Smrg	[Enable building integration test cases (default: ]_defopt[)]),
22765977a007Smrg	[enable_integration_tests=$enableval],
22775977a007Smrg	[enable_integration_tests=]_defopt)
22785977a007Smrgm4_undefine([_defopt])
22795977a007SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
22805977a007Smrg	[test "x$enable_integration_tests" != xno])
22815977a007SmrgAC_MSG_CHECKING([whether to build unit test cases])
22825977a007SmrgAC_MSG_RESULT([$enable_integration_tests])
22835977a007Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
22845977a007Smrg
22855977a007Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
22865977a007Smrg# ----------------------------------------
22875977a007Smrg# Minimum version: 1.13.0
22885977a007Smrg#
22895977a007Smrg# GLib is a library which provides advanced data structures and functions.
22905977a007Smrg# This macro enables a module to test for the presence of Glib.
22915977a007Smrg#
22925977a007Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
22935977a007Smrg# Otherwise the value of $enable_unit_tests is blank.
22945977a007Smrg#
22955977a007Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
22965977a007Smrg# test support usually requires less dependencies and may be built and run under
22975977a007Smrg# less stringent environments than integration tests.
22985977a007Smrg#
22995977a007Smrg# Interface to module:
23005977a007Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
23015977a007Smrg# with_glib: used in configure.ac to know if GLib has been found
23025977a007Smrg# --with-glib:	'yes' user instructs the module to use glib
23035977a007Smrg#		'no' user instructs the module not to use glib
23045977a007Smrg#
23055977a007SmrgAC_DEFUN([XORG_WITH_GLIB],[
23065977a007SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
23075977a007Smrgm4_define([_defopt], m4_default([$2], [auto]))
23085977a007SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
23095977a007Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
23105977a007Smrg	[with_glib=$withval], [with_glib=]_defopt)
23115977a007Smrgm4_undefine([_defopt])
23125977a007Smrg
23135977a007Smrghave_glib=no
23145977a007Smrg# Do not probe GLib if user explicitly disabled unit testing
23155977a007Smrgif test "x$enable_unit_tests" != x"no"; then
23165977a007Smrg  # Do not probe GLib if user explicitly disabled it
23175977a007Smrg  if test "x$with_glib" != x"no"; then
23185977a007Smrg    m4_ifval(
23195977a007Smrg      [$1],
23205977a007Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
23215977a007Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
23225977a007Smrg    )
23235977a007Smrg  fi
23245977a007Smrgfi
23255977a007Smrg
23265977a007Smrg# Not having GLib when unit testing has been explicitly requested is an error
23275977a007Smrgif test "x$enable_unit_tests" = x"yes"; then
23285977a007Smrg  if test "x$have_glib" = x"no"; then
23295977a007Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23305977a007Smrg  fi
23315977a007Smrgfi
23325977a007Smrg
23335977a007Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
23345977a007Smrgif test "x$enable_unit_tests" = x"no"; then
23355977a007Smrg  if test "x$with_glib" = x"yes"; then
23365977a007Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23375977a007Smrg  fi
23385977a007Smrgfi
23395977a007Smrg
23405977a007Smrg# Not having GLib when it has been explicitly requested is an error
23415977a007Smrgif test "x$with_glib" = x"yes"; then
23425977a007Smrg  if test "x$have_glib" = x"no"; then
23435977a007Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
23445977a007Smrg  fi
23455977a007Smrgfi
23465977a007Smrg
23475977a007SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
23485977a007Smrg]) # XORG_WITH_GLIB
23495977a007Smrg
23505977a007Smrg# XORG_LD_WRAP([required|optional])
23515977a007Smrg# ---------------------------------
23525977a007Smrg# Minimum version: 1.13.0
23535977a007Smrg#
23545977a007Smrg# Check if linker supports -wrap, passed via compiler flags
23555977a007Smrg#
23565977a007Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
23575977a007Smrg# Otherwise the value of $enable_unit_tests is blank.
23585977a007Smrg#
23595977a007Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
23605977a007Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
23615977a007Smrg# available, an argument of "optional" allows use when some unit tests require
23625977a007Smrg# ld -wrap and others do not.
23635977a007Smrg#
23645977a007SmrgAC_DEFUN([XORG_LD_WRAP],[
23655977a007SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
23665977a007Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
23675977a007Smrg                      void __wrap_exit(int status) { return; }],
23685977a007Smrg                     [exit(0);])])
23695977a007Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
23705977a007Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
23715977a007Smrg  if test "x$have_ld_wrap" = x"no"; then
23725977a007Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
23735977a007Smrg  fi
23745977a007Smrgfi
23755977a007SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
23765977a007Smrg#
23775977a007Smrg]) # XORG_LD_WRAP
23785977a007Smrg
23795977a007Smrg# XORG_CHECK_LINKER_FLAGS
23805977a007Smrg# -----------------------
23815977a007Smrg# SYNOPSIS
23825977a007Smrg#
23835977a007Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
23845977a007Smrg#
23855977a007Smrg# DESCRIPTION
23865977a007Smrg#
23875977a007Smrg#   Check whether the given linker FLAGS work with the current language's
23885977a007Smrg#   linker, or whether they give an error.
23895977a007Smrg#
23905977a007Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
23915977a007Smrg#   success/failure.
23925977a007Smrg#
23935977a007Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
23945977a007Smrg#
23955977a007Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
23965977a007Smrg#
23975977a007Smrg# LICENSE
23985977a007Smrg#
23995977a007Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
24005977a007Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
24015977a007Smrg#   Copyright (c) 2009 Matteo Frigo
24025977a007Smrg#
24035977a007Smrg#   This program is free software: you can redistribute it and/or modify it
24045977a007Smrg#   under the terms of the GNU General Public License as published by the
24055977a007Smrg#   Free Software Foundation, either version 3 of the License, or (at your
24065977a007Smrg#   option) any later version.
24075977a007Smrg#
24085977a007Smrg#   This program is distributed in the hope that it will be useful, but
24095977a007Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
24105977a007Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
24115977a007Smrg#   Public License for more details.
24125977a007Smrg#
24135977a007Smrg#   You should have received a copy of the GNU General Public License along
24145977a007Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
24155977a007Smrg#
24165977a007Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
24175977a007Smrg#   gives unlimited permission to copy, distribute and modify the configure
24185977a007Smrg#   scripts that are the output of Autoconf when processing the Macro. You
24195977a007Smrg#   need not follow the terms of the GNU General Public License when using
24205977a007Smrg#   or distributing such scripts, even though portions of the text of the
24215977a007Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
24225977a007Smrg#   all other use of the material that constitutes the Autoconf Macro.
24235977a007Smrg#
24245977a007Smrg#   This special exception to the GPL applies to versions of the Autoconf
24255977a007Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
24265977a007Smrg#   modified version of the Autoconf Macro, you may extend this special
24275977a007Smrg#   exception to the GPL to apply to your modified version as well.#
24285977a007SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
24295977a007Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
24305977a007Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
24315977a007SmrgAS_LITERAL_IF([$1],
24325977a007Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
24335977a007Smrg      ax_save_FLAGS=$LDFLAGS
24345977a007Smrg      LDFLAGS="$1"
24355977a007Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
24365977a007Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24375977a007Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24385977a007Smrg      LDFLAGS=$ax_save_FLAGS])],
24395977a007Smrg  [ax_save_FLAGS=$LDFLAGS
24405977a007Smrg   LDFLAGS="$1"
24415977a007Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
24425977a007Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24435977a007Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24445977a007Smrg   LDFLAGS=$ax_save_FLAGS])
24455977a007Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
24465977a007SmrgAC_MSG_RESULT($xorg_check_linker_flags)
24475977a007Smrgif test "x$xorg_check_linker_flags" = xyes; then
24485977a007Smrg	m4_default([$2], :)
24495977a007Smrgelse
24505977a007Smrg	m4_default([$3], :)
24515977a007Smrgfi
24525977a007Smrg]) # XORG_CHECK_LINKER_FLAGS
24535977a007Smrg
24545977a007Smrg# XORG_MEMORY_CHECK_FLAGS
24555977a007Smrg# -----------------------
24565977a007Smrg# Minimum version: 1.16.0
24575977a007Smrg#
24585977a007Smrg# This macro attempts to find appropriate memory checking functionality
24595977a007Smrg# for various platforms which unit testing code may use to catch various
24605977a007Smrg# forms of memory allocation and access errors in testing.
24615977a007Smrg#
24625977a007Smrg# Interface to module:
24635977a007Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
24645977a007Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
24655977a007Smrg#
24665977a007Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
24675977a007Smrg#
24685977a007SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
24695977a007Smrg
24705977a007SmrgAC_REQUIRE([AC_CANONICAL_HOST])
24715977a007SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
24725977a007Smrg           [Environment variables to enable memory checking in tests])
24735977a007Smrg
24745977a007Smrg# Check for different types of support on different platforms
24755977a007Smrgcase $host_os in
24765977a007Smrg    solaris*)
24775977a007Smrg        AC_CHECK_LIB([umem], [umem_alloc],
24785977a007Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
24795977a007Smrg        ;;
24805977a007Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
24815977a007Smrg        # both directly and inverted, so should not be 0 or 255.
24825977a007Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
24835977a007Smrg        ;;
24845977a007Smrg    darwin*)
24855977a007Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
24865977a007Smrg        ;;
24875977a007Smrg    *bsd*)
24885977a007Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
24895977a007Smrg        ;;
24905977a007Smrgesac
24915977a007Smrg
24925977a007Smrg# User supplied flags override default flags
24935977a007Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
24945977a007Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
24955977a007Smrgfi
24965977a007Smrg
24975977a007SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
24985977a007Smrg]) # XORG_WITH_LINT
24995977a007Smrg
25008108eb18Smrg# XORG_CHECK_MALLOC_ZERO
25018108eb18Smrg# ----------------------
25021a650d1eSmrg# Minimum version: 1.0.0
25031a650d1eSmrg#
25048108eb18Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
25058108eb18Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
25068108eb18Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
25078108eb18SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
25088108eb18SmrgAC_ARG_ENABLE(malloc0returnsnull,
25091a650d1eSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
25108108eb18Smrg		       [malloc(0) returns NULL (default: auto)]),
25118108eb18Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
25128108eb18Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
25138108eb18Smrg
25148108eb18SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
25158108eb18Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
25165977a007Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
25175977a007Smrg#include <stdlib.h>
25185977a007Smrg],[
25198108eb18Smrg    char *m0, *r0, *c0, *p;
25208108eb18Smrg    m0 = malloc(0);
25218108eb18Smrg    p = malloc(10);
25228108eb18Smrg    r0 = realloc(p,0);
25235977a007Smrg    c0 = calloc(0,10);
25245977a007Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
25255977a007Smrg])],
25268108eb18Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
25271a650d1eSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
25281a650d1eSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
25298108eb18Smrgfi
25308108eb18SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
25318108eb18Smrg
25328108eb18Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
25338108eb18Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
25348108eb18Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
25358108eb18Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
25368108eb18Smrgelse
25378108eb18Smrg	MALLOC_ZERO_CFLAGS=""
25388108eb18Smrg	XMALLOC_ZERO_CFLAGS=""
25398108eb18Smrg	XTMALLOC_ZERO_CFLAGS=""
25408108eb18Smrgfi
25418108eb18Smrg
25428108eb18SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
25438108eb18SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
25448108eb18SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
25458108eb18Smrg]) # XORG_CHECK_MALLOC_ZERO
25468108eb18Smrg
25471a650d1eSmrg# XORG_WITH_LINT()
25481a650d1eSmrg# ----------------
25491a650d1eSmrg# Minimum version: 1.1.0
25501a650d1eSmrg#
25511a650d1eSmrg# This macro enables the use of a tool that flags some suspicious and
25521a650d1eSmrg# non-portable constructs (likely to be bugs) in C language source code.
25531a650d1eSmrg# It will attempt to locate the tool and use appropriate options.
25541a650d1eSmrg# There are various lint type tools on different platforms.
25551a650d1eSmrg#
25561a650d1eSmrg# Interface to module:
25571a650d1eSmrg# LINT:		returns the path to the tool found on the platform
25581a650d1eSmrg#		or the value set to LINT on the configure cmd line
25591a650d1eSmrg#		also an Automake conditional
25601a650d1eSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
25611a650d1eSmrg#
25621a650d1eSmrg# --with-lint:	'yes' user instructs the module to use lint
25631a650d1eSmrg#		'no' user instructs the module not to use lint (default)
25641a650d1eSmrg#
25651a650d1eSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
25661a650d1eSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
25671a650d1eSmrg#
25681a650d1eSmrgAC_DEFUN([XORG_WITH_LINT],[
25691a650d1eSmrg
25701a650d1eSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
25711a650d1eSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
25721a650d1eSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
25731a650d1eSmrg		[Use a lint-style source code checker (default: disabled)])],
25741a650d1eSmrg		[use_lint=$withval], [use_lint=no])
25751a650d1eSmrg
25761a650d1eSmrg# Obtain platform specific info like program name and options
25771a650d1eSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
25781a650d1eSmrgcase $host_os in
25791a650d1eSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
25801a650d1eSmrg	lint_name=splint
25811a650d1eSmrg	lint_options="-badflag"
25821a650d1eSmrg	;;
25831a650d1eSmrg  *freebsd* | *netbsd*)
25841a650d1eSmrg	lint_name=lint
25851a650d1eSmrg	lint_options="-u -b"
25861a650d1eSmrg	;;
25871a650d1eSmrg  *solaris*)
25881a650d1eSmrg	lint_name=lint
25891a650d1eSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
25901a650d1eSmrg	;;
25911a650d1eSmrgesac
25921a650d1eSmrg
25931a650d1eSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
25941a650d1eSmrgif test "x$use_lint" = x"yes" ; then
25951a650d1eSmrg   AC_PATH_PROG([LINT], [$lint_name])
25961a650d1eSmrg   if test "x$LINT" = "x"; then
25971a650d1eSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
25981a650d1eSmrg   fi
25991a650d1eSmrgelif test "x$use_lint" = x"no" ; then
26001a650d1eSmrg   if test "x$LINT" != "x"; then
26011a650d1eSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
26021a650d1eSmrg   fi
26031a650d1eSmrgelse
26041a650d1eSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
26051a650d1eSmrgfi
26061a650d1eSmrg
26071a650d1eSmrg# User supplied flags override default flags
26081a650d1eSmrgif test "x$LINT_FLAGS" != "x"; then
26091a650d1eSmrg   lint_options=$LINT_FLAGS
26101a650d1eSmrgfi
26111a650d1eSmrg
26121a650d1eSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
26131a650d1eSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
26141a650d1eSmrg
26151a650d1eSmrg]) # XORG_WITH_LINT
26161a650d1eSmrg
26171a650d1eSmrg# XORG_LINT_LIBRARY(LIBNAME)
26181a650d1eSmrg# --------------------------
26191a650d1eSmrg# Minimum version: 1.1.0
26201a650d1eSmrg#
26211a650d1eSmrg# Sets up flags for building lint libraries for checking programs that call
26221a650d1eSmrg# functions in the library.
26231a650d1eSmrg#
26241a650d1eSmrg# Interface to module:
26251a650d1eSmrg# LINTLIB		- Automake variable with the name of lint library file to make
26261a650d1eSmrg# MAKE_LINT_LIB		- Automake conditional
26271a650d1eSmrg#
26281a650d1eSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
26291a650d1eSmrg#			  - 'no' user instructs the module not to create a lint library (default)
26301a650d1eSmrg
26311a650d1eSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
26321a650d1eSmrgAC_REQUIRE([XORG_WITH_LINT])
26331a650d1eSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
26341a650d1eSmrg	[Create lint library (default: disabled)])],
26351a650d1eSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
26361a650d1eSmrg
26371a650d1eSmrgif test "x$make_lint_lib" = x"yes" ; then
26381a650d1eSmrg   LINTLIB=llib-l$1.ln
26391a650d1eSmrg   if test "x$LINT" = "x"; then
26401a650d1eSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
26411a650d1eSmrg   fi
26421a650d1eSmrgelif test "x$make_lint_lib" != x"no" ; then
26431a650d1eSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
26441a650d1eSmrgfi
26451a650d1eSmrg
26461a650d1eSmrgAC_SUBST(LINTLIB)
26471a650d1eSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
26481a650d1eSmrg
26491a650d1eSmrg]) # XORG_LINT_LIBRARY
26501a650d1eSmrg
26515977a007Smrg# XORG_COMPILER_BRAND
26525977a007Smrg# -------------------
26535977a007Smrg# Minimum version: 1.14.0
26545977a007Smrg#
26555977a007Smrg# Checks for various brands of compilers and sets flags as appropriate:
26565977a007Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
26575977a007Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
26585977a007Smrg#   clang compiler - sets CLANGCC to "yes"
26595977a007Smrg#   Intel compiler - sets INTELCC to "yes"
26605977a007Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
26615977a007Smrg#
26625977a007SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
26635977a007SmrgAC_LANG_CASE(
26645977a007Smrg	[C], [
26655977a007Smrg		AC_REQUIRE([AC_PROG_CC_C99])
26665977a007Smrg	],
26675977a007Smrg	[C++], [
26685977a007Smrg		AC_REQUIRE([AC_PROG_CXX])
26695977a007Smrg	]
26705977a007Smrg)
26715977a007SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
26725977a007SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
26735977a007SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
26745977a007Smrg]) # XORG_COMPILER_BRAND
26755977a007Smrg
26765977a007Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
26775977a007Smrg# ---------------
26785977a007Smrg# Minimum version: 1.16.0
26795977a007Smrg#
26805977a007Smrg# Test if the compiler works when passed the given flag as a command line argument.
26815977a007Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
26825977a007Smrg# next flag in the list until there are no more options.
26835977a007Smrg#
26845977a007Smrg# Note that this does not guarantee that the compiler supports the flag as some
26855977a007Smrg# compilers will simply ignore arguments that they do not understand, but we do
26865977a007Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
26875977a007Smrg# -Werror=unused-command-line-argument
26885977a007Smrg#
26895977a007SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
26905977a007Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26915977a007Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26925977a007Smrg
26935977a007SmrgAC_LANG_COMPILER_REQUIRE
26945977a007Smrg
26955977a007SmrgAC_LANG_CASE(
26965977a007Smrg	[C], [
26975977a007Smrg		AC_REQUIRE([AC_PROG_CC_C99])
26985977a007Smrg		define([PREFIX], [C])
26995977a007Smrg		define([CACHE_PREFIX], [cc])
27005977a007Smrg		define([COMPILER], [$CC])
27015977a007Smrg	],
27025977a007Smrg	[C++], [
27035977a007Smrg		define([PREFIX], [CXX])
27045977a007Smrg		define([CACHE_PREFIX], [cxx])
27055977a007Smrg		define([COMPILER], [$CXX])
27065977a007Smrg	]
27075977a007Smrg)
27085977a007Smrg
27095977a007Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
27105977a007Smrg
27115977a007Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
27125977a007Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27135977a007Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
27145977a007Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
27155977a007Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27165977a007Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
27175977a007Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
27185977a007Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
27195977a007Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27205977a007Smrgfi
27215977a007Smrg
27225977a007Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
27235977a007Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
27245977a007Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27255977a007Smrg	fi
27265977a007Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27275977a007Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
27285977a007Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
27295977a007Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27305977a007Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
27315977a007Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
27325977a007Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
27335977a007Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27345977a007Smrgfi
27355977a007Smrg
27365977a007Smrgfound="no"
27375977a007Smrgm4_foreach([flag], m4_cdr($@), [
27385977a007Smrg	if test $found = "no" ; then
27395977a007Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
27405977a007Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27415977a007Smrg		fi
27425977a007Smrg
27435977a007Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
27445977a007Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27455977a007Smrg		fi
27465977a007Smrg
27475977a007Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
27485977a007Smrg
27495977a007Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
27505977a007Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
27515977a007Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
27525977a007Smrg		AC_CACHE_VAL($cacheid,
27535977a007Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
27545977a007Smrg					     [eval $cacheid=yes],
27555977a007Smrg					     [eval $cacheid=no])])
27565977a007Smrg
27575977a007Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27585977a007Smrg
27595977a007Smrg		eval supported=\$$cacheid
27605977a007Smrg		AC_MSG_RESULT([$supported])
27615977a007Smrg		if test "$supported" = "yes" ; then
27625977a007Smrg			$1="$$1 ]flag["
27635977a007Smrg			found="yes"
27645977a007Smrg		fi
27655977a007Smrg	fi
27665977a007Smrg])
27675977a007Smrg]) # XORG_TESTSET_CFLAG
27685977a007Smrg
27695977a007Smrg# XORG_COMPILER_FLAGS
27705977a007Smrg# ---------------
27715977a007Smrg# Minimum version: 1.16.0
27725977a007Smrg#
27735977a007Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
27745977a007Smrg# arguments supported by the selected compiler which do NOT alter the generated
27755977a007Smrg# code.  These arguments will cause the compiler to print various warnings
27765977a007Smrg# during compilation AND turn a conservative set of warnings into errors.
27775977a007Smrg#
27785977a007Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
27795977a007Smrg# future versions of util-macros as options are added to new compilers.
27805977a007Smrg#
27815977a007SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
27825977a007SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
27835977a007Smrg
27845977a007SmrgAC_ARG_ENABLE(selective-werror,
27855977a007Smrg              AS_HELP_STRING([--disable-selective-werror],
27865977a007Smrg                             [Turn off selective compiler errors. (default: enabled)]),
27875977a007Smrg              [SELECTIVE_WERROR=$enableval],
27885977a007Smrg              [SELECTIVE_WERROR=yes])
27895977a007Smrg
27905977a007SmrgAC_LANG_CASE(
27915977a007Smrg        [C], [
27925977a007Smrg                define([PREFIX], [C])
27935977a007Smrg        ],
27945977a007Smrg        [C++], [
27955977a007Smrg                define([PREFIX], [CXX])
27965977a007Smrg        ]
27975977a007Smrg)
27985977a007Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
27995977a007Smrgif test "x$SUNCC" = "xyes"; then
28005977a007Smrg    [BASE_]PREFIX[FLAGS]="-v"
28015977a007Smrgelse
28025977a007Smrg    [BASE_]PREFIX[FLAGS]=""
28035977a007Smrgfi
28045977a007Smrg
28055977a007Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
28065977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
28075977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
28085977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
28095977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
28105977a007Smrg
28115977a007SmrgAC_LANG_CASE(
28125977a007Smrg	[C], [
28135977a007Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
28145977a007Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
28155977a007Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
28165977a007Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
28175977a007Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
28185977a007Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
28195977a007Smrg	]
28205977a007Smrg)
28215977a007Smrg
28225977a007Smrg# This chunk adds additional warnings that could catch undesired effects.
28235977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
28245977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
28255977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
28265977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
28275977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
28285977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
28295977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
28305977a007Smrg
28315977a007Smrg# These are currently disabled because they are noisy.  They will be enabled
28325977a007Smrg# in the future once the codebase is sufficiently modernized to silence
28335977a007Smrg# them.  For now, I don't want them to drown out the other warnings.
28345977a007Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
28355977a007Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
28365977a007Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
28375977a007Smrg
28385977a007Smrg# Turn some warnings into errors, so we don't accidently get successful builds
28395977a007Smrg# when there are problems that should be fixed.
28405977a007Smrg
28415977a007Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
28425977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
28435977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
28445977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
28455977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
28465977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
28475977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
28485977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
28495977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
28505977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
28515977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
28525977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
28535977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
28545977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
28555977a007Smrgelse
28565977a007SmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
28575977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
28585977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
28595977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
28605977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
28615977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
28625977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
28635977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
28645977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
28655977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
28665977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
28675977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
28685977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
28695977a007SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
28705977a007Smrgfi
28715977a007Smrg
28725977a007SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
28735977a007Smrg]) # XORG_COMPILER_FLAGS
28745977a007Smrg
28751a650d1eSmrg# XORG_CWARNFLAGS
28761a650d1eSmrg# ---------------
28771a650d1eSmrg# Minimum version: 1.2.0
28785977a007Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
28791a650d1eSmrg#
28801a650d1eSmrg# Defines CWARNFLAGS to enable C compiler warnings.
28811a650d1eSmrg#
28825977a007Smrg# This function is deprecated because it defines -fno-strict-aliasing
28835977a007Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
28845977a007Smrg# is needed, then it should be added explicitly in the module when
28855977a007Smrg# it is updated to use BASE_CFLAGS.
28865977a007Smrg#
28871a650d1eSmrgAC_DEFUN([XORG_CWARNFLAGS], [
28885977a007SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
28895977a007SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
28905977a007SmrgAC_LANG_CASE(
28915977a007Smrg	[C], [
28925977a007Smrg		CWARNFLAGS="$BASE_CFLAGS"
28935977a007Smrg		if  test "x$GCC" = xyes ; then
28945977a007Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
28955977a007Smrg		fi
28965977a007Smrg		AC_SUBST(CWARNFLAGS)
28975977a007Smrg	]
28985977a007Smrg)
28991a650d1eSmrg]) # XORG_CWARNFLAGS
29001a650d1eSmrg
29011a650d1eSmrg# XORG_STRICT_OPTION
29021a650d1eSmrg# -----------------------
29031a650d1eSmrg# Minimum version: 1.3.0
29041a650d1eSmrg#
29055977a007Smrg# Add configure option to enable strict compilation flags, such as treating
29065977a007Smrg# warnings as fatal errors.
29075977a007Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
29085977a007Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
29095977a007Smrg#
29105977a007Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
29115977a007Smrg# when strict compilation is unconditionally desired.
29121a650d1eSmrgAC_DEFUN([XORG_STRICT_OPTION], [
29131a650d1eSmrgAC_REQUIRE([XORG_CWARNFLAGS])
29145977a007SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
29151a650d1eSmrg
29161a650d1eSmrgAC_ARG_ENABLE(strict-compilation,
29171a650d1eSmrg			  AS_HELP_STRING([--enable-strict-compilation],
29181a650d1eSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
29191a650d1eSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
29205977a007Smrg
29215977a007SmrgAC_LANG_CASE(
29225977a007Smrg        [C], [
29235977a007Smrg                define([PREFIX], [C])
29245977a007Smrg        ],
29255977a007Smrg        [C++], [
29265977a007Smrg                define([PREFIX], [CXX])
29275977a007Smrg        ]
29285977a007Smrg)
29295977a007Smrg
29305977a007Smrg[STRICT_]PREFIX[FLAGS]=""
29315977a007SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
29325977a007SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
29335977a007Smrg
29345977a007Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
29355977a007Smrg# activate it with -Werror, so we add it here explicitly.
29365977a007SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
29375977a007Smrg
29381a650d1eSmrgif test "x$STRICT_COMPILE" = "xyes"; then
29395977a007Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
29405977a007Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
29411a650d1eSmrgfi
29425977a007SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
29435977a007SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
29445977a007SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
29451a650d1eSmrg]) # XORG_STRICT_OPTION
29461a650d1eSmrg
29471a650d1eSmrg# XORG_DEFAULT_OPTIONS
29481a650d1eSmrg# --------------------
29491a650d1eSmrg# Minimum version: 1.3.0
29501a650d1eSmrg#
29511a650d1eSmrg# Defines default options for X.Org modules.
29521a650d1eSmrg#
29531a650d1eSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
29541a650d1eSmrgAC_REQUIRE([AC_PROG_INSTALL])
29555977a007SmrgXORG_COMPILER_FLAGS
29561a650d1eSmrgXORG_CWARNFLAGS
29571a650d1eSmrgXORG_STRICT_OPTION
29581a650d1eSmrgXORG_RELEASE_VERSION
29591a650d1eSmrgXORG_CHANGELOG
29601a650d1eSmrgXORG_INSTALL
29611a650d1eSmrgXORG_MANPAGE_SECTIONS
29621a650d1eSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
29631a650d1eSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
29641a650d1eSmrg]) # XORG_DEFAULT_OPTIONS
29651a650d1eSmrg
29661a650d1eSmrg# XORG_INSTALL()
29671a650d1eSmrg# ----------------
29681a650d1eSmrg# Minimum version: 1.4.0
29691a650d1eSmrg#
29701a650d1eSmrg# Defines the variable INSTALL_CMD as the command to copy
29711a650d1eSmrg# INSTALL from $prefix/share/util-macros.
29721a650d1eSmrg#
29731a650d1eSmrgAC_DEFUN([XORG_INSTALL], [
29741a650d1eSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
29751a650d1eSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
29761a650d1eSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
29771a650d1eSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
29781a650d1eSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
29791a650d1eSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
29801a650d1eSmrgAC_SUBST([INSTALL_CMD])
29811a650d1eSmrg]) # XORG_INSTALL
29828108eb18Smrgdnl Copyright 2005 Red Hat, Inc
29838108eb18Smrgdnl
29848108eb18Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
29858108eb18Smrgdnl documentation for any purpose is hereby granted without fee, provided that
29868108eb18Smrgdnl the above copyright notice appear in all copies and that both that
29878108eb18Smrgdnl copyright notice and this permission notice appear in supporting
29888108eb18Smrgdnl documentation.
29898108eb18Smrgdnl
29908108eb18Smrgdnl The above copyright notice and this permission notice shall be included
29918108eb18Smrgdnl in all copies or substantial portions of the Software.
29928108eb18Smrgdnl
29938108eb18Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
29948108eb18Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29958108eb18Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29968108eb18Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
29978108eb18Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29988108eb18Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29998108eb18Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
30008108eb18Smrgdnl
30018108eb18Smrgdnl Except as contained in this notice, the name of the copyright holders shall
30028108eb18Smrgdnl not be used in advertising or otherwise to promote the sale, use or
30038108eb18Smrgdnl other dealings in this Software without prior written authorization
30048108eb18Smrgdnl from the copyright holders.
30058108eb18Smrgdnl
30068108eb18Smrg
30078108eb18Smrg# XORG_RELEASE_VERSION
30088108eb18Smrg# --------------------
30091a650d1eSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
30108108eb18Smrg 
30118108eb18SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
30121a650d1eSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
30131a650d1eSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
30141a650d1eSmrg		[Major version of this package])
30151a650d1eSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
30161a650d1eSmrg	if test "x$PVM" = "x"; then
30171a650d1eSmrg		PVM="0"
30188108eb18Smrg	fi
30191a650d1eSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
30201a650d1eSmrg		[$PVM],
30211a650d1eSmrg		[Minor version of this package])
30221a650d1eSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
30231a650d1eSmrg	if test "x$PVP" = "x"; then
30241a650d1eSmrg		PVP="0"
30251a650d1eSmrg	fi
30261a650d1eSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
30271a650d1eSmrg		[$PVP],
30281a650d1eSmrg		[Patch version of this package])
30298108eb18Smrg])
30308108eb18Smrg
30311a650d1eSmrg# XORG_CHANGELOG()
30321a650d1eSmrg# ----------------
30331a650d1eSmrg# Minimum version: 1.2.0
30341a650d1eSmrg#
30351a650d1eSmrg# Defines the variable CHANGELOG_CMD as the command to generate
30361a650d1eSmrg# ChangeLog from git.
30371a650d1eSmrg#
30381a650d1eSmrg#
30391a650d1eSmrgAC_DEFUN([XORG_CHANGELOG], [
30401a650d1eSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
30411a650d1eSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
30421a650d1eSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
30431a650d1eSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
30441a650d1eSmrgAC_SUBST([CHANGELOG_CMD])
30451a650d1eSmrg]) # XORG_CHANGELOG
30461a650d1eSmrg
3047