aclocal.m4 revision 49e82ceb
1168023feSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
26ea72052Smrg
3168023feSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4168023feSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
56ea72052Smrg# This file is free software; the Free Software Foundation
66ea72052Smrg# gives unlimited permission to copy and/or distribute it,
76ea72052Smrg# with or without modifications, as long as this notice is preserved.
86ea72052Smrg
96ea72052Smrg# This program is distributed in the hope that it will be useful,
106ea72052Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
116ea72052Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
126ea72052Smrg# PARTICULAR PURPOSE.
136ea72052Smrg
14168023feSmrgm4_ifndef([AC_AUTOCONF_VERSION],
15168023feSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16168023feSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17168023feSmrg[m4_warning([this file was generated for autoconf 2.68.
18168023feSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19168023feSmrgIf you have problems, you may need to regenerate the build system entirely.
20168023feSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
216ea72052Smrg
22168023feSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23168023feSmrg#
24168023feSmrg# This file is free software; the Free Software Foundation
25168023feSmrg# gives unlimited permission to copy and/or distribute it,
26168023feSmrg# with or without modifications, as long as this notice is preserved.
276ea72052Smrg
286ea72052Smrg# AM_AUTOMAKE_VERSION(VERSION)
296ea72052Smrg# ----------------------------
306ea72052Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
316ea72052Smrg# generated from the m4 files accompanying Automake X.Y.
32168023feSmrg# (This private macro should not be called outside this file.)
33168023feSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34168023feSmrg[am__api_version='1.11'
35168023feSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36168023feSmrgdnl require some minimum version.  Point them to the right macro.
37168023feSmrgm4_if([$1], [1.11.1], [],
38168023feSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39168023feSmrg])
40168023feSmrg
41168023feSmrg# _AM_AUTOCONF_VERSION(VERSION)
42168023feSmrg# -----------------------------
43168023feSmrg# aclocal traces this macro to find the Autoconf version.
44168023feSmrg# This is a private macro too.  Using m4_define simplifies
45168023feSmrg# the logic in aclocal, which can simply ignore this definition.
46168023feSmrgm4_define([_AM_AUTOCONF_VERSION], [])
476ea72052Smrg
486ea72052Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
496ea72052Smrg# -------------------------------
50168023feSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51168023feSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
526ea72052SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53168023feSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54168023feSmrgm4_ifndef([AC_AUTOCONF_VERSION],
55168023feSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56168023feSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
576ea72052Smrg
58168023feSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
596ea72052Smrg
60168023feSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
616ea72052Smrg#
62168023feSmrg# This file is free software; the Free Software Foundation
63168023feSmrg# gives unlimited permission to copy and/or distribute it,
64168023feSmrg# with or without modifications, as long as this notice is preserved.
656ea72052Smrg
666ea72052Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
676ea72052Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
686ea72052Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
696ea72052Smrg#
706ea72052Smrg# Of course, Automake must honor this variable whenever it calls a
716ea72052Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
726ea72052Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
736ea72052Smrg# depending on how configure is run.  This is pretty annoying, since
746ea72052Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
756ea72052Smrg# source directory, any form will work fine, but in subdirectories a
766ea72052Smrg# relative path needs to be adjusted first.
776ea72052Smrg#
786ea72052Smrg# $ac_aux_dir/missing
796ea72052Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
806ea72052Smrg# $top_srcdir/$ac_aux_dir/missing
816ea72052Smrg#    fails if $ac_aux_dir is absolute,
826ea72052Smrg#    fails when called from a subdirectory in a VPATH build with
836ea72052Smrg#          a relative $ac_aux_dir
846ea72052Smrg#
856ea72052Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
866ea72052Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
876ea72052Smrg# harmless because $srcdir is `.', but things will broke when you
886ea72052Smrg# start a VPATH build or use an absolute $srcdir.
896ea72052Smrg#
906ea72052Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
916ea72052Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
926ea72052Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
936ea72052Smrg# and then we would define $MISSING as
946ea72052Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
956ea72052Smrg# This will work as long as MISSING is not called from configure, because
966ea72052Smrg# unfortunately $(top_srcdir) has no meaning in configure.
976ea72052Smrg# However there are other variables, like CC, which are often used in
986ea72052Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
996ea72052Smrg#
1006ea72052Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1016ea72052Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1026ea72052Smrg# configured tree to be moved without reconfiguration.
1036ea72052Smrg
104168023feSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105168023feSmrg[dnl Rely on autoconf to set up CDPATH properly.
106168023feSmrgAC_PREREQ([2.50])dnl
1076ea72052Smrg# expand $ac_aux_dir to an absolute path
1086ea72052Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
1096ea72052Smrg])
1106ea72052Smrg
111168023feSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1126ea72052Smrg
113168023feSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114168023feSmrg# Free Software Foundation, Inc.
115168023feSmrg#
116168023feSmrg# This file is free software; the Free Software Foundation
117168023feSmrg# gives unlimited permission to copy and/or distribute it,
118168023feSmrg# with or without modifications, as long as this notice is preserved.
1196ea72052Smrg
120168023feSmrg# serial 9
1216ea72052Smrg
122168023feSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123168023feSmrg# -------------------------------------
124168023feSmrg# Define a conditional.
125168023feSmrgAC_DEFUN([AM_CONDITIONAL],
126168023feSmrg[AC_PREREQ(2.52)dnl
127168023feSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128168023feSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
129168023feSmrgAC_SUBST([$1_TRUE])dnl
130168023feSmrgAC_SUBST([$1_FALSE])dnl
131168023feSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
132168023feSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133168023feSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134168023feSmrgif $2; then
135168023feSmrg  $1_TRUE=
136168023feSmrg  $1_FALSE='#'
1376ea72052Smrgelse
138168023feSmrg  $1_TRUE='#'
139168023feSmrg  $1_FALSE=
1406ea72052Smrgfi
141168023feSmrgAC_CONFIG_COMMANDS_PRE(
142168023feSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143168023feSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144168023feSmrgUsually this means the macro was only invoked conditionally.]])
145168023feSmrgfi])])
1466ea72052Smrg
147168023feSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148168023feSmrg# Free Software Foundation, Inc.
149168023feSmrg#
150168023feSmrg# This file is free software; the Free Software Foundation
151168023feSmrg# gives unlimited permission to copy and/or distribute it,
152168023feSmrg# with or without modifications, as long as this notice is preserved.
1536ea72052Smrg
154168023feSmrg# serial 10
1556ea72052Smrg
1566ea72052Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1576ea72052Smrg# written in clear, in which case automake, when reading aclocal.m4,
1586ea72052Smrg# will think it sees a *use*, and therefore will trigger all it's
1596ea72052Smrg# C support machinery.  Also note that it means that autoscan, seeing
1606ea72052Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1616ea72052Smrg
1626ea72052Smrg
1636ea72052Smrg# _AM_DEPENDENCIES(NAME)
1646ea72052Smrg# ----------------------
1656ea72052Smrg# See how the compiler implements dependency checking.
1666ea72052Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1676ea72052Smrg# We try a few techniques and use that to set a single cache variable.
1686ea72052Smrg#
1696ea72052Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1706ea72052Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1716ea72052Smrg# dependency, and given that the user is not expected to run this macro,
1726ea72052Smrg# just rely on AC_PROG_CC.
1736ea72052SmrgAC_DEFUN([_AM_DEPENDENCIES],
1746ea72052Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1756ea72052SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1766ea72052SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1776ea72052SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1786ea72052Smrg
1796ea72052Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1806ea72052Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1816ea72052Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
182168023feSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1836ea72052Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1846ea72052Smrg                   [depcc="$$1"   am_compiler_list=])
1856ea72052Smrg
1866ea72052SmrgAC_CACHE_CHECK([dependency style of $depcc],
1876ea72052Smrg               [am_cv_$1_dependencies_compiler_type],
1886ea72052Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1896ea72052Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1906ea72052Smrg  # making bogus files that we don't know about and never remove.  For
1916ea72052Smrg  # instance it was reported that on HP-UX the gcc test will end up
1926ea72052Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
1936ea72052Smrg  # in D'.
1946ea72052Smrg  mkdir conftest.dir
1956ea72052Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1966ea72052Smrg  # using a relative directory.
1976ea72052Smrg  cp "$am_depcomp" conftest.dir
1986ea72052Smrg  cd conftest.dir
1996ea72052Smrg  # We will build objects and dependencies in a subdirectory because
2006ea72052Smrg  # it helps to detect inapplicable dependency modes.  For instance
2016ea72052Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2026ea72052Smrg  # side effect of compilation, but ICC will put the dependencies in
2036ea72052Smrg  # the current directory while Tru64 will put them in the object
2046ea72052Smrg  # directory.
2056ea72052Smrg  mkdir sub
2066ea72052Smrg
2076ea72052Smrg  am_cv_$1_dependencies_compiler_type=none
2086ea72052Smrg  if test "$am_compiler_list" = ""; then
2096ea72052Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2106ea72052Smrg  fi
211168023feSmrg  am__universal=false
212168023feSmrg  m4_case([$1], [CC],
213168023feSmrg    [case " $depcc " in #(
214168023feSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215168023feSmrg     esac],
216168023feSmrg    [CXX],
217168023feSmrg    [case " $depcc " in #(
218168023feSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219168023feSmrg     esac])
220168023feSmrg
2216ea72052Smrg  for depmode in $am_compiler_list; do
2226ea72052Smrg    # Setup a source with many dependencies, because some compilers
2236ea72052Smrg    # like to wrap large dependency lists on column 80 (with \), and
2246ea72052Smrg    # we should not choose a depcomp mode which is confused by this.
2256ea72052Smrg    #
2266ea72052Smrg    # We need to recreate these files for each test, as the compiler may
2276ea72052Smrg    # overwrite some of them when testing with obscure command lines.
2286ea72052Smrg    # This happens at least with the AIX C compiler.
2296ea72052Smrg    : > sub/conftest.c
2306ea72052Smrg    for i in 1 2 3 4 5 6; do
2316ea72052Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232168023feSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233168023feSmrg      # Solaris 8's {/usr,}/bin/sh.
234168023feSmrg      touch sub/conftst$i.h
2356ea72052Smrg    done
2366ea72052Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2376ea72052Smrg
238168023feSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239168023feSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240168023feSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241168023feSmrg    # versions had trouble with output in subdirs
242168023feSmrg    am__obj=sub/conftest.${OBJEXT-o}
243168023feSmrg    am__minus_obj="-o $am__obj"
2446ea72052Smrg    case $depmode in
245168023feSmrg    gcc)
246168023feSmrg      # This depmode causes a compiler race in universal mode.
247168023feSmrg      test "$am__universal" = false || continue
248168023feSmrg      ;;
2496ea72052Smrg    nosideeffect)
2506ea72052Smrg      # after this tag, mechanisms are not by side-effect, so they'll
2516ea72052Smrg      # only be used when explicitly requested
2526ea72052Smrg      if test "x$enable_dependency_tracking" = xyes; then
2536ea72052Smrg	continue
2546ea72052Smrg      else
2556ea72052Smrg	break
2566ea72052Smrg      fi
2576ea72052Smrg      ;;
258168023feSmrg    msvisualcpp | msvcmsys)
259168023feSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
260168023feSmrg      # not run yet.  These depmodes are late enough in the game, and
261168023feSmrg      # so weak that their functioning should not be impacted.
262168023feSmrg      am__obj=conftest.${OBJEXT-o}
263168023feSmrg      am__minus_obj=
264168023feSmrg      ;;
2656ea72052Smrg    none) break ;;
2666ea72052Smrg    esac
2676ea72052Smrg    if depmode=$depmode \
268168023feSmrg       source=sub/conftest.c object=$am__obj \
2696ea72052Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270168023feSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2716ea72052Smrg         >/dev/null 2>conftest.err &&
272168023feSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2736ea72052Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274168023feSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2756ea72052Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2766ea72052Smrg      # icc doesn't choke on unknown options, it will just issue warnings
277168023feSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
278168023feSmrg      # that says an option was ignored or not supported.
279168023feSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280168023feSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281168023feSmrg      # The diagnosis changed in icc 8.0:
282168023feSmrg      #   icc: Command line remark: option '-MP' not supported
283168023feSmrg      if (grep 'ignoring option' conftest.err ||
284168023feSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2856ea72052Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2866ea72052Smrg        break
2876ea72052Smrg      fi
2886ea72052Smrg    fi
2896ea72052Smrg  done
2906ea72052Smrg
2916ea72052Smrg  cd ..
2926ea72052Smrg  rm -rf conftest.dir
2936ea72052Smrgelse
2946ea72052Smrg  am_cv_$1_dependencies_compiler_type=none
2956ea72052Smrgfi
2966ea72052Smrg])
2976ea72052SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2986ea72052SmrgAM_CONDITIONAL([am__fastdep$1], [
2996ea72052Smrg  test "x$enable_dependency_tracking" != xno \
3006ea72052Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3016ea72052Smrg])
3026ea72052Smrg
3036ea72052Smrg
3046ea72052Smrg# AM_SET_DEPDIR
3056ea72052Smrg# -------------
3066ea72052Smrg# Choose a directory name for dependency files.
3076ea72052Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3086ea72052SmrgAC_DEFUN([AM_SET_DEPDIR],
3096ea72052Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3106ea72052SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3116ea72052Smrg])
3126ea72052Smrg
3136ea72052Smrg
3146ea72052Smrg# AM_DEP_TRACK
3156ea72052Smrg# ------------
3166ea72052SmrgAC_DEFUN([AM_DEP_TRACK],
3176ea72052Smrg[AC_ARG_ENABLE(dependency-tracking,
318168023feSmrg[  --disable-dependency-tracking  speeds up one-time build
319168023feSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3206ea72052Smrgif test "x$enable_dependency_tracking" != xno; then
3216ea72052Smrg  am_depcomp="$ac_aux_dir/depcomp"
3226ea72052Smrg  AMDEPBACKSLASH='\'
3236ea72052Smrgfi
3246ea72052SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
325168023feSmrgAC_SUBST([AMDEPBACKSLASH])dnl
326168023feSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3276ea72052Smrg])
3286ea72052Smrg
329168023feSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3306ea72052Smrg
331168023feSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332168023feSmrg# Free Software Foundation, Inc.
333168023feSmrg#
334168023feSmrg# This file is free software; the Free Software Foundation
335168023feSmrg# gives unlimited permission to copy and/or distribute it,
336168023feSmrg# with or without modifications, as long as this notice is preserved.
3376ea72052Smrg
338168023feSmrg#serial 5
3396ea72052Smrg
3406ea72052Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3416ea72052Smrg# ------------------------------
3426ea72052SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343168023feSmrg[{
344168023feSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345168023feSmrg  # are listed without --file.  Let's play safe and only enable the eval
346168023feSmrg  # if we detect the quoting.
347168023feSmrg  case $CONFIG_FILES in
348168023feSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
349168023feSmrg  *)   set x $CONFIG_FILES ;;
350168023feSmrg  esac
351168023feSmrg  shift
352168023feSmrg  for mf
353168023feSmrg  do
354168023feSmrg    # Strip MF so we end up with the name of the file.
355168023feSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356168023feSmrg    # Check whether this is an Automake generated Makefile or not.
357168023feSmrg    # We used to match only the files named `Makefile.in', but
358168023feSmrg    # some people rename them; so instead we look at the file content.
359168023feSmrg    # Grep'ing the first line is not enough: some people post-process
360168023feSmrg    # each Makefile.in and add a new line on top of each file to say so.
361168023feSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
362168023feSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
363168023feSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364168023feSmrg      dirpart=`AS_DIRNAME("$mf")`
365168023feSmrg    else
366168023feSmrg      continue
367168023feSmrg    fi
368168023feSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
369168023feSmrg    # from the Makefile without running `make'.
370168023feSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371168023feSmrg    test -z "$DEPDIR" && continue
372168023feSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373168023feSmrg    test -z "am__include" && continue
374168023feSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375168023feSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
376168023feSmrg    U=`sed -n 's/^U = //p' < "$mf"`
377168023feSmrg    # Find all dependency output files, they are included files with
378168023feSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379168023feSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380168023feSmrg    # expansion.
381168023feSmrg    for file in `sed -n "
382168023feSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383168023feSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384168023feSmrg      # Make sure the directory exists.
385168023feSmrg      test -f "$dirpart/$file" && continue
386168023feSmrg      fdir=`AS_DIRNAME(["$file"])`
387168023feSmrg      AS_MKDIR_P([$dirpart/$fdir])
388168023feSmrg      # echo "creating $dirpart/$file"
389168023feSmrg      echo '# dummy' > "$dirpart/$file"
390168023feSmrg    done
3916ea72052Smrg  done
392168023feSmrg}
3936ea72052Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3946ea72052Smrg
3956ea72052Smrg
3966ea72052Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3976ea72052Smrg# -----------------------------
3986ea72052Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3996ea72052Smrg#
4006ea72052Smrg# This code is only required when automatic dependency tracking
4016ea72052Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
4026ea72052Smrg# need in order to bootstrap the dependency handling code.
4036ea72052SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4046ea72052Smrg[AC_CONFIG_COMMANDS([depfiles],
4056ea72052Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4066ea72052Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4076ea72052Smrg])
4086ea72052Smrg
409168023feSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4106ea72052Smrg
411168023feSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412168023feSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
413168023feSmrg#
414168023feSmrg# This file is free software; the Free Software Foundation
415168023feSmrg# gives unlimited permission to copy and/or distribute it,
416168023feSmrg# with or without modifications, as long as this notice is preserved.
417168023feSmrg
418168023feSmrg# serial 16
419168023feSmrg
420168023feSmrg# This macro actually does too much.  Some checks are only needed if
421168023feSmrg# your package does certain things.  But this isn't really a big deal.
422168023feSmrg
423168023feSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
424168023feSmrg# AM_INIT_AUTOMAKE([OPTIONS])
425168023feSmrg# -----------------------------------------------
426168023feSmrg# The call with PACKAGE and VERSION arguments is the old style
427168023feSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
428168023feSmrg# and VERSION should now be passed to AC_INIT and removed from
429168023feSmrg# the call to AM_INIT_AUTOMAKE.
430168023feSmrg# We support both call styles for the transition.  After
431168023feSmrg# the next Automake release, Autoconf can make the AC_INIT
432168023feSmrg# arguments mandatory, and then we can depend on a new Autoconf
433168023feSmrg# release and drop the old call support.
434168023feSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435168023feSmrg[AC_PREREQ([2.62])dnl
436168023feSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
437168023feSmrgdnl the ones we care about.
438168023feSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
439168023feSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
440168023feSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
441168023feSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
442168023feSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
443168023feSmrg  # is not polluted with repeated "-I."
444168023feSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
445168023feSmrg  # test to see if srcdir already configured
446168023feSmrg  if test -f $srcdir/config.status; then
447168023feSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
448168023feSmrg  fi
449168023feSmrgfi
450168023feSmrg
451168023feSmrg# test whether we have cygpath
452168023feSmrgif test -z "$CYGPATH_W"; then
453168023feSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
454168023feSmrg    CYGPATH_W='cygpath -w'
455168023feSmrg  else
456168023feSmrg    CYGPATH_W=echo
457168023feSmrg  fi
458168023feSmrgfi
459168023feSmrgAC_SUBST([CYGPATH_W])
460168023feSmrg
461168023feSmrg# Define the identity of the package.
462168023feSmrgdnl Distinguish between old-style and new-style calls.
463168023feSmrgm4_ifval([$2],
464168023feSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
465168023feSmrg AC_SUBST([PACKAGE], [$1])dnl
466168023feSmrg AC_SUBST([VERSION], [$2])],
467168023feSmrg[_AM_SET_OPTIONS([$1])dnl
468168023feSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469168023feSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
470168023feSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
471168023feSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
472168023feSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473168023feSmrg
474168023feSmrg_AM_IF_OPTION([no-define],,
475168023feSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
476168023feSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477168023feSmrg
478168023feSmrg# Some tools Automake needs.
479168023feSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
480168023feSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
481168023feSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
482168023feSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
483168023feSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
484168023feSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
485168023feSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486168023feSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487168023feSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
488168023feSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
489168023feSmrg# We need awk for the "check" target.  The system "awk" is bad on
490168023feSmrg# some platforms.
491168023feSmrgAC_REQUIRE([AC_PROG_AWK])dnl
492168023feSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
493168023feSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
494168023feSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495168023feSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496168023feSmrg			     [_AM_PROG_TAR([v7])])])
497168023feSmrg_AM_IF_OPTION([no-dependencies],,
498168023feSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499168023feSmrg		  [_AM_DEPENDENCIES(CC)],
500168023feSmrg		  [define([AC_PROG_CC],
501168023feSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
502168023feSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503168023feSmrg		  [_AM_DEPENDENCIES(CXX)],
504168023feSmrg		  [define([AC_PROG_CXX],
505168023feSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
506168023feSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507168023feSmrg		  [_AM_DEPENDENCIES(OBJC)],
508168023feSmrg		  [define([AC_PROG_OBJC],
509168023feSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
510168023feSmrg])
511168023feSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512168023feSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513168023feSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514168023feSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515168023feSmrgAC_CONFIG_COMMANDS_PRE(dnl
516168023feSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517168023feSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
518168023feSmrg])
519168023feSmrg
520168023feSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521168023feSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522168023feSmrgdnl mangled by Autoconf and run in a shell conditional statement.
523168023feSmrgm4_define([_AC_COMPILER_EXEEXT],
524168023feSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525168023feSmrg
526168023feSmrg
527168023feSmrg# When config.status generates a header, we must update the stamp-h file.
528168023feSmrg# This file resides in the same directory as the config header
529168023feSmrg# that is generated.  The stamp files are numbered to have different names.
530168023feSmrg
531168023feSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
532168023feSmrg# loop where config.status creates the headers, so we can generate
533168023feSmrg# our stamp files there.
534168023feSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
535168023feSmrg[# Compute $1's index in $config_headers.
536168023feSmrg_am_arg=$1
537168023feSmrg_am_stamp_count=1
538168023feSmrgfor _am_header in $config_headers :; do
539168023feSmrg  case $_am_header in
540168023feSmrg    $_am_arg | $_am_arg:* )
541168023feSmrg      break ;;
542168023feSmrg    * )
543168023feSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
544168023feSmrg  esac
545168023feSmrgdone
546168023feSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
547168023feSmrg
548168023feSmrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
549168023feSmrg#
550168023feSmrg# This file is free software; the Free Software Foundation
551168023feSmrg# gives unlimited permission to copy and/or distribute it,
552168023feSmrg# with or without modifications, as long as this notice is preserved.
553168023feSmrg
554168023feSmrg# AM_PROG_INSTALL_SH
555168023feSmrg# ------------------
556168023feSmrg# Define $install_sh.
557168023feSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
558168023feSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559168023feSmrgif test x"${install_sh}" != xset; then
560168023feSmrg  case $am_aux_dir in
561168023feSmrg  *\ * | *\	*)
562168023feSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563168023feSmrg  *)
564168023feSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565168023feSmrg  esac
566168023feSmrgfi
567168023feSmrgAC_SUBST(install_sh)])
568168023feSmrg
569168023feSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
570168023feSmrg#
571168023feSmrg# This file is free software; the Free Software Foundation
572168023feSmrg# gives unlimited permission to copy and/or distribute it,
573168023feSmrg# with or without modifications, as long as this notice is preserved.
5746ea72052Smrg
5756ea72052Smrg# serial 2
5766ea72052Smrg
577168023feSmrg# Check whether the underlying file-system supports filenames
578168023feSmrg# with a leading dot.  For instance MS-DOS doesn't.
579168023feSmrgAC_DEFUN([AM_SET_LEADING_DOT],
580168023feSmrg[rm -rf .tst 2>/dev/null
581168023feSmrgmkdir .tst 2>/dev/null
582168023feSmrgif test -d .tst; then
583168023feSmrg  am__leading_dot=.
584168023feSmrgelse
585168023feSmrg  am__leading_dot=_
586168023feSmrgfi
587168023feSmrgrmdir .tst 2>/dev/null
588168023feSmrgAC_SUBST([am__leading_dot])])
589168023feSmrg
590168023feSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
591168023feSmrg# From Jim Meyering
592168023feSmrg
593168023feSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
594168023feSmrg# Free Software Foundation, Inc.
595168023feSmrg#
596168023feSmrg# This file is free software; the Free Software Foundation
597168023feSmrg# gives unlimited permission to copy and/or distribute it,
598168023feSmrg# with or without modifications, as long as this notice is preserved.
599168023feSmrg
600168023feSmrg# serial 5
601168023feSmrg
602168023feSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603168023feSmrg# ----------------------------------
604168023feSmrg# Control maintainer-specific portions of Makefiles.
605168023feSmrg# Default is to disable them, unless `enable' is passed literally.
606168023feSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607168023feSmrg# can override the default with the --enable/--disable switch.
608168023feSmrgAC_DEFUN([AM_MAINTAINER_MODE],
609168023feSmrg[m4_case(m4_default([$1], [disable]),
610168023feSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
611168023feSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
612168023feSmrg       [m4_define([am_maintainer_other], [enable])
613168023feSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614168023feSmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615168023feSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616168023feSmrg  AC_ARG_ENABLE([maintainer-mode],
617168023feSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
618168023feSmrg			  (and sometimes confusing) to the casual installer],
619168023feSmrg      [USE_MAINTAINER_MODE=$enableval],
620168023feSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
621168023feSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622168023feSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
623168023feSmrg  MAINT=$MAINTAINER_MODE_TRUE
624168023feSmrg  AC_SUBST([MAINT])dnl
625168023feSmrg]
626168023feSmrg)
627168023feSmrg
628168023feSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629168023feSmrg
630168023feSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631168023feSmrg
632168023feSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
633168023feSmrg#
634168023feSmrg# This file is free software; the Free Software Foundation
635168023feSmrg# gives unlimited permission to copy and/or distribute it,
636168023feSmrg# with or without modifications, as long as this notice is preserved.
637168023feSmrg
638168023feSmrg# serial 4
639168023feSmrg
6406ea72052Smrg# AM_MAKE_INCLUDE()
6416ea72052Smrg# -----------------
6426ea72052Smrg# Check to see how make treats includes.
6436ea72052SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6446ea72052Smrg[am_make=${MAKE-make}
6456ea72052Smrgcat > confinc << 'END'
6466ea72052Smrgam__doit:
647168023feSmrg	@echo this is the am__doit target
6486ea72052Smrg.PHONY: am__doit
6496ea72052SmrgEND
6506ea72052Smrg# If we don't find an include directive, just comment out the code.
6516ea72052SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6526ea72052Smrgam__include="#"
6536ea72052Smrgam__quote=
6546ea72052Smrg_am_result=none
6556ea72052Smrg# First try GNU make style include.
6566ea72052Smrgecho "include confinc" > confmf
657168023feSmrg# Ignore all kinds of additional output from `make'.
658168023feSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659168023feSmrg*the\ am__doit\ target*)
660168023feSmrg  am__include=include
661168023feSmrg  am__quote=
662168023feSmrg  _am_result=GNU
663168023feSmrg  ;;
664168023feSmrgesac
6656ea72052Smrg# Now try BSD make style include.
6666ea72052Smrgif test "$am__include" = "#"; then
6676ea72052Smrg   echo '.include "confinc"' > confmf
668168023feSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669168023feSmrg   *the\ am__doit\ target*)
670168023feSmrg     am__include=.include
671168023feSmrg     am__quote="\""
672168023feSmrg     _am_result=BSD
673168023feSmrg     ;;
674168023feSmrg   esac
6756ea72052Smrgfi
6766ea72052SmrgAC_SUBST([am__include])
6776ea72052SmrgAC_SUBST([am__quote])
6786ea72052SmrgAC_MSG_RESULT([$_am_result])
6796ea72052Smrgrm -f confinc confmf
6806ea72052Smrg])
6816ea72052Smrg
682168023feSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6836ea72052Smrg
684168023feSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
685168023feSmrg# Free Software Foundation, Inc.
686168023feSmrg#
687168023feSmrg# This file is free software; the Free Software Foundation
688168023feSmrg# gives unlimited permission to copy and/or distribute it,
689168023feSmrg# with or without modifications, as long as this notice is preserved.
6906ea72052Smrg
691168023feSmrg# serial 6
6926ea72052Smrg
693168023feSmrg# AM_MISSING_PROG(NAME, PROGRAM)
694168023feSmrg# ------------------------------
695168023feSmrgAC_DEFUN([AM_MISSING_PROG],
696168023feSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
697168023feSmrg$1=${$1-"${am_missing_run}$2"}
698168023feSmrgAC_SUBST($1)])
6996ea72052Smrg
7006ea72052Smrg
701168023feSmrg# AM_MISSING_HAS_RUN
702168023feSmrg# ------------------
703168023feSmrg# Define MISSING if not defined so far and test if it supports --run.
704168023feSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
705168023feSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
706168023feSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
707168023feSmrgAC_REQUIRE_AUX_FILE([missing])dnl
708168023feSmrgif test x"${MISSING+set}" != xset; then
709168023feSmrg  case $am_aux_dir in
710168023feSmrg  *\ * | *\	*)
711168023feSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712168023feSmrg  *)
713168023feSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714168023feSmrg  esac
715168023feSmrgfi
716168023feSmrg# Use eval to expand $SHELL
717168023feSmrgif eval "$MISSING --run true"; then
718168023feSmrg  am_missing_run="$MISSING --run "
7196ea72052Smrgelse
720168023feSmrg  am_missing_run=
721168023feSmrg  AC_MSG_WARN([`missing' script is too old or missing])
7226ea72052Smrgfi
723168023feSmrg])
7246ea72052Smrg
725168023feSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726168023feSmrg#
727168023feSmrg# This file is free software; the Free Software Foundation
728168023feSmrg# gives unlimited permission to copy and/or distribute it,
729168023feSmrg# with or without modifications, as long as this notice is preserved.
7306ea72052Smrg
731168023feSmrg# AM_PROG_MKDIR_P
732168023feSmrg# ---------------
733168023feSmrg# Check for `mkdir -p'.
734168023feSmrgAC_DEFUN([AM_PROG_MKDIR_P],
735168023feSmrg[AC_PREREQ([2.60])dnl
736168023feSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
737168023feSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
738168023feSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
739168023feSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
740168023feSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
741168023feSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
742168023feSmrgdnl adjustment using top_builddir (which is defined more often than
743168023feSmrgdnl MKDIR_P).
744168023feSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
745168023feSmrgcase $mkdir_p in
746168023feSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
747168023feSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
748168023feSmrgesac
749168023feSmrg])
7506ea72052Smrg
751168023feSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7526ea72052Smrg
753168023feSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754168023feSmrg#
755168023feSmrg# This file is free software; the Free Software Foundation
756168023feSmrg# gives unlimited permission to copy and/or distribute it,
757168023feSmrg# with or without modifications, as long as this notice is preserved.
7586ea72052Smrg
759168023feSmrg# serial 4
7606ea72052Smrg
761168023feSmrg# _AM_MANGLE_OPTION(NAME)
762168023feSmrg# -----------------------
763168023feSmrgAC_DEFUN([_AM_MANGLE_OPTION],
764168023feSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7656ea72052Smrg
766168023feSmrg# _AM_SET_OPTION(NAME)
767168023feSmrg# ------------------------------
768168023feSmrg# Set option NAME.  Presently that only means defining a flag for this option.
769168023feSmrgAC_DEFUN([_AM_SET_OPTION],
770168023feSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
7716ea72052Smrg
772168023feSmrg# _AM_SET_OPTIONS(OPTIONS)
773168023feSmrg# ----------------------------------
774168023feSmrg# OPTIONS is a space-separated list of Automake options.
775168023feSmrgAC_DEFUN([_AM_SET_OPTIONS],
776168023feSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7776ea72052Smrg
778168023feSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
779168023feSmrg# -------------------------------------------
780168023feSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
781168023feSmrgAC_DEFUN([_AM_IF_OPTION],
782168023feSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7836ea72052Smrg
784168023feSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7856ea72052Smrg
786168023feSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
787168023feSmrg# Free Software Foundation, Inc.
7886ea72052Smrg#
789168023feSmrg# This file is free software; the Free Software Foundation
790168023feSmrg# gives unlimited permission to copy and/or distribute it,
791168023feSmrg# with or without modifications, as long as this notice is preserved.
7926ea72052Smrg
793168023feSmrg# serial 5
7946ea72052Smrg
795168023feSmrg# AM_SANITY_CHECK
796168023feSmrg# ---------------
797168023feSmrgAC_DEFUN([AM_SANITY_CHECK],
798168023feSmrg[AC_MSG_CHECKING([whether build environment is sane])
799168023feSmrg# Just in case
800168023feSmrgsleep 1
801168023feSmrgecho timestamp > conftest.file
802168023feSmrg# Reject unsafe characters in $srcdir or the absolute working directory
803168023feSmrg# name.  Accept space and tab only in the latter.
804168023feSmrgam_lf='
805168023feSmrg'
806168023feSmrgcase `pwd` in
807168023feSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808168023feSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809168023feSmrgesac
810168023feSmrgcase $srcdir in
811168023feSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812168023feSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813168023feSmrgesac
814168023feSmrg
815168023feSmrg# Do `set' in a subshell so we don't clobber the current shell's
816168023feSmrg# arguments.  Must try -L first in case configure is actually a
817168023feSmrg# symlink; some systems play weird games with the mod time of symlinks
818168023feSmrg# (eg FreeBSD returns the mod time of the symlink's containing
819168023feSmrg# directory).
820168023feSmrgif (
821168023feSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
822168023feSmrg   if test "$[*]" = "X"; then
823168023feSmrg      # -L didn't work.
824168023feSmrg      set X `ls -t "$srcdir/configure" conftest.file`
825168023feSmrg   fi
826168023feSmrg   rm -f conftest.file
827168023feSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
828168023feSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
8296ea72052Smrg
830168023feSmrg      # If neither matched, then we have a broken ls.  This can happen
831168023feSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
832168023feSmrg      # broken ls alias from the environment.  This has actually
833168023feSmrg      # happened.  Such a system could not be considered "sane".
834168023feSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
835168023feSmrgalias in your environment])
836168023feSmrg   fi
8376ea72052Smrg
838168023feSmrg   test "$[2]" = conftest.file
839168023feSmrg   )
840168023feSmrgthen
841168023feSmrg   # Ok.
842168023feSmrg   :
8436ea72052Smrgelse
844168023feSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
845168023feSmrgCheck your system clock])
846168023feSmrgfi
847168023feSmrgAC_MSG_RESULT(yes)])
8486ea72052Smrg
849168023feSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
850168023feSmrg#
851168023feSmrg# This file is free software; the Free Software Foundation
852168023feSmrg# gives unlimited permission to copy and/or distribute it,
853168023feSmrg# with or without modifications, as long as this notice is preserved.
8546ea72052Smrg
855168023feSmrg# serial 1
8566ea72052Smrg
857168023feSmrg# AM_SILENT_RULES([DEFAULT])
858168023feSmrg# --------------------------
859168023feSmrg# Enable less verbose build rules; with the default set to DEFAULT
860168023feSmrg# (`yes' being less verbose, `no' or empty being verbose).
861168023feSmrgAC_DEFUN([AM_SILENT_RULES],
862168023feSmrg[AC_ARG_ENABLE([silent-rules],
863168023feSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864168023feSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865168023feSmrgcase $enable_silent_rules in
866168023feSmrgyes) AM_DEFAULT_VERBOSITY=0;;
867168023feSmrgno)  AM_DEFAULT_VERBOSITY=1;;
868168023feSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
869168023feSmrgesac
870168023feSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871168023feSmrgAM_BACKSLASH='\'
872168023feSmrgAC_SUBST([AM_BACKSLASH])dnl
873168023feSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874168023feSmrg])
875168023feSmrg
876168023feSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
8776ea72052Smrg#
878168023feSmrg# This file is free software; the Free Software Foundation
879168023feSmrg# gives unlimited permission to copy and/or distribute it,
880168023feSmrg# with or without modifications, as long as this notice is preserved.
881168023feSmrg
882168023feSmrg# AM_PROG_INSTALL_STRIP
883168023feSmrg# ---------------------
884168023feSmrg# One issue with vendor `install' (even GNU) is that you can't
885168023feSmrg# specify the program used to strip binaries.  This is especially
886168023feSmrg# annoying in cross-compiling environments, where the build's strip
887168023feSmrg# is unlikely to handle the host's binaries.
888168023feSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
889168023feSmrg# always use install-sh in `make install-strip', and initialize
890168023feSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
891168023feSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
892168023feSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
893168023feSmrg# Installed binaries are usually stripped using `strip' when the user
894168023feSmrg# run `make install-strip'.  However `strip' might not be the right
895168023feSmrg# tool to use in cross-compilation environments, therefore Automake
896168023feSmrg# will honor the `STRIP' environment variable to overrule this program.
897168023feSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
898168023feSmrgif test "$cross_compiling" != no; then
899168023feSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
900168023feSmrgfi
901168023feSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
902168023feSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903168023feSmrg
904168023feSmrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
9056ea72052Smrg#
906168023feSmrg# This file is free software; the Free Software Foundation
907168023feSmrg# gives unlimited permission to copy and/or distribute it,
908168023feSmrg# with or without modifications, as long as this notice is preserved.
9096ea72052Smrg
910168023feSmrg# serial 2
9116ea72052Smrg
912168023feSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
913168023feSmrg# ---------------------------
914168023feSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
915168023feSmrg# This macro is traced by Automake.
916168023feSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9176ea72052Smrg
918168023feSmrg# AM_SUBST_NOTMAKE(VARIABLE)
919168023feSmrg# ---------------------------
920168023feSmrg# Public sister of _AM_SUBST_NOTMAKE.
921168023feSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9226ea72052Smrg
923168023feSmrg# Check how to create a tarball.                            -*- Autoconf -*-
9246ea72052Smrg
925168023feSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
926168023feSmrg#
927168023feSmrg# This file is free software; the Free Software Foundation
928168023feSmrg# gives unlimited permission to copy and/or distribute it,
929168023feSmrg# with or without modifications, as long as this notice is preserved.
9306ea72052Smrg
931168023feSmrg# serial 2
9326ea72052Smrg
933168023feSmrg# _AM_PROG_TAR(FORMAT)
934168023feSmrg# --------------------
935168023feSmrg# Check how to create a tarball in format FORMAT.
936168023feSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
937168023feSmrg#
938168023feSmrg# Substitute a variable $(am__tar) that is a command
939168023feSmrg# writing to stdout a FORMAT-tarball containing the directory
940168023feSmrg# $tardir.
941168023feSmrg#     tardir=directory && $(am__tar) > result.tar
942168023feSmrg#
943168023feSmrg# Substitute a variable $(am__untar) that extract such
944168023feSmrg# a tarball read from stdin.
945168023feSmrg#     $(am__untar) < result.tar
946168023feSmrgAC_DEFUN([_AM_PROG_TAR],
947168023feSmrg[# Always define AMTAR for backward compatibility.
948168023feSmrgAM_MISSING_PROG([AMTAR], [tar])
949168023feSmrgm4_if([$1], [v7],
950168023feSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
951168023feSmrg     [m4_case([$1], [ustar],, [pax],,
952168023feSmrg              [m4_fatal([Unknown tar format])])
953168023feSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
954168023feSmrg# Loop over all known methods to create a tar archive until one works.
955168023feSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
956168023feSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
957168023feSmrg# Do not fold the above two line into one, because Tru64 sh and
958168023feSmrg# Solaris sh will not grok spaces in the rhs of `-'.
959168023feSmrgfor _am_tool in $_am_tools
960168023feSmrgdo
961168023feSmrg  case $_am_tool in
962168023feSmrg  gnutar)
963168023feSmrg    for _am_tar in tar gnutar gtar;
964168023feSmrg    do
965168023feSmrg      AM_RUN_LOG([$_am_tar --version]) && break
966168023feSmrg    done
967168023feSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
968168023feSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
969168023feSmrg    am__untar="$_am_tar -xf -"
970168023feSmrg    ;;
971168023feSmrg  plaintar)
972168023feSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
973168023feSmrg    # ustar tarball either.
974168023feSmrg    (tar --version) >/dev/null 2>&1 && continue
975168023feSmrg    am__tar='tar chf - "$$tardir"'
976168023feSmrg    am__tar_='tar chf - "$tardir"'
977168023feSmrg    am__untar='tar xf -'
978168023feSmrg    ;;
979168023feSmrg  pax)
980168023feSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
981168023feSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
982168023feSmrg    am__untar='pax -r'
983168023feSmrg    ;;
984168023feSmrg  cpio)
985168023feSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
986168023feSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
987168023feSmrg    am__untar='cpio -i -H $1 -d'
988168023feSmrg    ;;
989168023feSmrg  none)
990168023feSmrg    am__tar=false
991168023feSmrg    am__tar_=false
992168023feSmrg    am__untar=false
993168023feSmrg    ;;
994168023feSmrg  esac
9956ea72052Smrg
996168023feSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
997168023feSmrg  # and am__untar set.
998168023feSmrg  test -n "${am_cv_prog_tar_$1}" && break
9996ea72052Smrg
1000168023feSmrg  # tar/untar a dummy directory, and stop if the command works
1001168023feSmrg  rm -rf conftest.dir
1002168023feSmrg  mkdir conftest.dir
1003168023feSmrg  echo GrepMe > conftest.dir/file
1004168023feSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1005168023feSmrg  rm -rf conftest.dir
1006168023feSmrg  if test -s conftest.tar; then
1007168023feSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
1008168023feSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1009168023feSmrg  fi
1010168023feSmrgdone
1011168023feSmrgrm -rf conftest.dir
10126ea72052Smrg
1013168023feSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1014168023feSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1015168023feSmrgAC_SUBST([am__tar])
1016168023feSmrgAC_SUBST([am__untar])
1017168023feSmrg]) # _AM_PROG_TAR
10186ea72052Smrg
101949e82cebSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
102049e82cebSmrg# 
102149e82cebSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
102249e82cebSmrg#
102349e82cebSmrg# This program is free software; you can redistribute it and/or modify
102449e82cebSmrg# it under the terms of the GNU General Public License as published by
102549e82cebSmrg# the Free Software Foundation; either version 2 of the License, or
102649e82cebSmrg# (at your option) any later version.
102749e82cebSmrg#
102849e82cebSmrg# This program is distributed in the hope that it will be useful, but
102949e82cebSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
103049e82cebSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
103149e82cebSmrg# General Public License for more details.
103249e82cebSmrg#
103349e82cebSmrg# You should have received a copy of the GNU General Public License
103449e82cebSmrg# along with this program; if not, write to the Free Software
103549e82cebSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
103649e82cebSmrg#
103749e82cebSmrg# As a special exception to the GNU General Public License, if you
103849e82cebSmrg# distribute this file as part of a program that contains a
103949e82cebSmrg# configuration script generated by Autoconf, you may include it under
104049e82cebSmrg# the same distribution terms that you use for the rest of that program.
104149e82cebSmrg
104249e82cebSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
104349e82cebSmrg# ----------------------------------
104449e82cebSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
104549e82cebSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
104649e82cebSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
104749e82cebSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
104849e82cebSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
104949e82cebSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
105049e82cebSmrgfi
105149e82cebSmrgif test -n "$PKG_CONFIG"; then
105249e82cebSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
105349e82cebSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
105449e82cebSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
105549e82cebSmrg		AC_MSG_RESULT([yes])
105649e82cebSmrg	else
105749e82cebSmrg		AC_MSG_RESULT([no])
105849e82cebSmrg		PKG_CONFIG=""
105949e82cebSmrg	fi
106049e82cebSmrg		
106149e82cebSmrgfi[]dnl
106249e82cebSmrg])# PKG_PROG_PKG_CONFIG
106349e82cebSmrg
106449e82cebSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
106549e82cebSmrg#
106649e82cebSmrg# Check to see whether a particular set of modules exists.  Similar
106749e82cebSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
106849e82cebSmrg#
106949e82cebSmrg#
107049e82cebSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
107149e82cebSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
107249e82cebSmrg# PKG_CHECK_EXISTS manually
107349e82cebSmrg# --------------------------------------------------------------
107449e82cebSmrgAC_DEFUN([PKG_CHECK_EXISTS],
107549e82cebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
107649e82cebSmrgif test -n "$PKG_CONFIG" && \
107749e82cebSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
107849e82cebSmrg  m4_ifval([$2], [$2], [:])
107949e82cebSmrgm4_ifvaln([$3], [else
108049e82cebSmrg  $3])dnl
108149e82cebSmrgfi])
108249e82cebSmrg
108349e82cebSmrg
108449e82cebSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
108549e82cebSmrg# ---------------------------------------------
108649e82cebSmrgm4_define([_PKG_CONFIG],
108749e82cebSmrg[if test -n "$$1"; then
108849e82cebSmrg    pkg_cv_[]$1="$$1"
108949e82cebSmrg elif test -n "$PKG_CONFIG"; then
109049e82cebSmrg    PKG_CHECK_EXISTS([$3],
109149e82cebSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
109249e82cebSmrg		     [pkg_failed=yes])
109349e82cebSmrg else
109449e82cebSmrg    pkg_failed=untried
109549e82cebSmrgfi[]dnl
109649e82cebSmrg])# _PKG_CONFIG
109749e82cebSmrg
109849e82cebSmrg# _PKG_SHORT_ERRORS_SUPPORTED
109949e82cebSmrg# -----------------------------
110049e82cebSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
110149e82cebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110249e82cebSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
110349e82cebSmrg        _pkg_short_errors_supported=yes
110449e82cebSmrgelse
110549e82cebSmrg        _pkg_short_errors_supported=no
110649e82cebSmrgfi[]dnl
110749e82cebSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
110849e82cebSmrg
110949e82cebSmrg
111049e82cebSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
111149e82cebSmrg# [ACTION-IF-NOT-FOUND])
111249e82cebSmrg#
111349e82cebSmrg#
111449e82cebSmrg# Note that if there is a possibility the first call to
111549e82cebSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
111649e82cebSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
111749e82cebSmrg#
111849e82cebSmrg#
111949e82cebSmrg# --------------------------------------------------------------
112049e82cebSmrgAC_DEFUN([PKG_CHECK_MODULES],
112149e82cebSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
112249e82cebSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
112349e82cebSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
112449e82cebSmrg
112549e82cebSmrgpkg_failed=no
112649e82cebSmrgAC_MSG_CHECKING([for $1])
112749e82cebSmrg
112849e82cebSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
112949e82cebSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
113049e82cebSmrg
113149e82cebSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
113249e82cebSmrgand $1[]_LIBS to avoid the need to call pkg-config.
113349e82cebSmrgSee the pkg-config man page for more details.])
113449e82cebSmrg
113549e82cebSmrgif test $pkg_failed = yes; then
113649e82cebSmrg        _PKG_SHORT_ERRORS_SUPPORTED
113749e82cebSmrg        if test $_pkg_short_errors_supported = yes; then
113849e82cebSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
113949e82cebSmrg        else 
114049e82cebSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
114149e82cebSmrg        fi
114249e82cebSmrg	# Put the nasty error message in config.log where it belongs
114349e82cebSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
114449e82cebSmrg
114549e82cebSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
114649e82cebSmrg[Package requirements ($2) were not met:
114749e82cebSmrg
114849e82cebSmrg$$1_PKG_ERRORS
114949e82cebSmrg
115049e82cebSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
115149e82cebSmrginstalled software in a non-standard prefix.
115249e82cebSmrg
115349e82cebSmrg_PKG_TEXT
115449e82cebSmrg])],
115549e82cebSmrg		[AC_MSG_RESULT([no])
115649e82cebSmrg                $4])
115749e82cebSmrgelif test $pkg_failed = untried; then
115849e82cebSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
115949e82cebSmrg[The pkg-config script could not be found or is too old.  Make sure it
116049e82cebSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
116149e82cebSmrgpath to pkg-config.
116249e82cebSmrg
116349e82cebSmrg_PKG_TEXT
116449e82cebSmrg
116549e82cebSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
116649e82cebSmrg		[$4])
116749e82cebSmrgelse
116849e82cebSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
116949e82cebSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
117049e82cebSmrg        AC_MSG_RESULT([yes])
117149e82cebSmrg	ifelse([$3], , :, [$3])
117249e82cebSmrgfi[]dnl
117349e82cebSmrg])# PKG_CHECK_MODULES
117449e82cebSmrg
1175168023feSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
11766ea72052Smrgdnl
1177168023feSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
11786ea72052Smrgdnl 
1179168023feSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1180168023feSmrgdnl copy of this software and associated documentation files (the "Software"),
1181168023feSmrgdnl to deal in the Software without restriction, including without limitation
1182168023feSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1183168023feSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1184168023feSmrgdnl Software is furnished to do so, subject to the following conditions:
1185168023feSmrgdnl
1186168023feSmrgdnl The above copyright notice and this permission notice (including the next
1187168023feSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1188168023feSmrgdnl Software.
1189168023feSmrgdnl
1190168023feSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1191168023feSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1192168023feSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1193168023feSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1194168023feSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1195168023feSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1196168023feSmrgdnl DEALINGS IN THE SOFTWARE.
1197168023feSmrg
1198168023feSmrg# XORG_MACROS_VERSION(required-version)
1199168023feSmrg# -------------------------------------
1200168023feSmrg# Minimum version: 1.1.0
1201168023feSmrg#
1202168023feSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1203168023feSmrg# your configure.ac with the minimum required version, such as:
1204168023feSmrg# XORG_MACROS_VERSION(1.1)
1205168023feSmrg#
1206168023feSmrg# To ensure that this macro is defined, also add:
1207168023feSmrg# m4_ifndef([XORG_MACROS_VERSION],
1208168023feSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1209168023feSmrg#
1210168023feSmrg#
1211168023feSmrg# See the "minimum version" comment for each macro you use to see what 
1212168023feSmrg# version you require.
1213168023feSmrgm4_defun([XORG_MACROS_VERSION],[
121449e82cebSmrgm4_define([vers_have], [1.16.1])
1215168023feSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1216168023feSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1217168023feSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1218168023feSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1219168023feSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1220168023feSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1221168023feSmrgm4_undefine([vers_have])
1222168023feSmrgm4_undefine([maj_have])
1223168023feSmrgm4_undefine([maj_needed])
1224168023feSmrg]) # XORG_MACROS_VERSION
12256ea72052Smrg
12266ea72052Smrg# XORG_PROG_RAWCPP()
12276ea72052Smrg# ------------------
1228168023feSmrg# Minimum version: 1.0.0
1229168023feSmrg#
12306ea72052Smrg# Find cpp program and necessary flags for use in pre-processing text files
12316ea72052Smrg# such as man pages and config files
12326ea72052SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
12336ea72052SmrgAC_REQUIRE([AC_PROG_CPP])
12346ea72052SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
12356ea72052Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
12366ea72052Smrg
12376ea72052Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
12386ea72052Smrg# which is not the best choice for supporting other OS'es, but covers most
12396ea72052Smrg# of the ones we need for now.
12406ea72052SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
124149e82cebSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
12426ea72052Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12436ea72052Smrg	AC_MSG_RESULT([no])
12446ea72052Smrgelse
12456ea72052Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
12466ea72052Smrg		RAWCPPFLAGS=-undef
12476ea72052Smrg		AC_MSG_RESULT([yes])
1248168023feSmrg	# under Cygwin unix is still defined even with -undef
1249168023feSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1250168023feSmrg		RAWCPPFLAGS="-undef -ansi"
1251168023feSmrg		AC_MSG_RESULT([yes, with -ansi])
12526ea72052Smrg	else
12536ea72052Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
12546ea72052Smrg	fi
12556ea72052Smrgfi
12566ea72052Smrgrm -f conftest.$ac_ext
12576ea72052Smrg
12586ea72052SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
125949e82cebSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
12606ea72052Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12616ea72052Smrg	AC_MSG_RESULT([no])
12626ea72052Smrgelse
12636ea72052Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
12646ea72052Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
12656ea72052Smrg		AC_MSG_RESULT([yes])
12666ea72052Smrg	else
12676ea72052Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
12686ea72052Smrg	fi
12696ea72052Smrgfi
12706ea72052Smrgrm -f conftest.$ac_ext
12716ea72052SmrgAC_SUBST(RAWCPPFLAGS)
12726ea72052Smrg]) # XORG_PROG_RAWCPP
12736ea72052Smrg
12746ea72052Smrg# XORG_MANPAGE_SECTIONS()
12756ea72052Smrg# -----------------------
1276168023feSmrg# Minimum version: 1.0.0
1277168023feSmrg#
12786ea72052Smrg# Determine which sections man pages go in for the different man page types
12796ea72052Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
12806ea72052Smrg# Not sure if there's any better way than just hardcoding by OS name.
12816ea72052Smrg# Override default settings by setting environment variables
1282168023feSmrg# Added MAN_SUBSTS in version 1.8
1283168023feSmrg# Added AC_PROG_SED in version 1.8
12846ea72052Smrg
12856ea72052SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
12866ea72052SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1287168023feSmrgAC_REQUIRE([AC_PROG_SED])
12886ea72052Smrg
12896ea72052Smrgif test x$APP_MAN_SUFFIX = x    ; then
1290168023feSmrg    APP_MAN_SUFFIX=1
12916ea72052Smrgfi
12926ea72052Smrgif test x$APP_MAN_DIR = x    ; then
1293168023feSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
12946ea72052Smrgfi
12956ea72052Smrg
12966ea72052Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1297168023feSmrg    LIB_MAN_SUFFIX=3
12986ea72052Smrgfi
12996ea72052Smrgif test x$LIB_MAN_DIR = x    ; then
1300168023feSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
13016ea72052Smrgfi
13026ea72052Smrg
13036ea72052Smrgif test x$FILE_MAN_SUFFIX = x    ; then
13046ea72052Smrg    case $host_os in
13056ea72052Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
13066ea72052Smrg	*)		FILE_MAN_SUFFIX=5  ;;
13076ea72052Smrg    esac
13086ea72052Smrgfi
13096ea72052Smrgif test x$FILE_MAN_DIR = x    ; then
1310168023feSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
13116ea72052Smrgfi
13126ea72052Smrg
13136ea72052Smrgif test x$MISC_MAN_SUFFIX = x    ; then
13146ea72052Smrg    case $host_os in
13156ea72052Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
13166ea72052Smrg	*)		MISC_MAN_SUFFIX=7  ;;
13176ea72052Smrg    esac
13186ea72052Smrgfi
13196ea72052Smrgif test x$MISC_MAN_DIR = x    ; then
1320168023feSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
13216ea72052Smrgfi
13226ea72052Smrg
13236ea72052Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
13246ea72052Smrg    case $host_os in
13256ea72052Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
13266ea72052Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
13276ea72052Smrg    esac
13286ea72052Smrgfi
13296ea72052Smrgif test x$DRIVER_MAN_DIR = x    ; then
1330168023feSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
13316ea72052Smrgfi
13326ea72052Smrg
13336ea72052Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
13346ea72052Smrg    case $host_os in
13356ea72052Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
13366ea72052Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
13376ea72052Smrg    esac
13386ea72052Smrgfi
13396ea72052Smrgif test x$ADMIN_MAN_DIR = x    ; then
13406ea72052Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
13416ea72052Smrgfi
13426ea72052Smrg
13436ea72052Smrg
13446ea72052SmrgAC_SUBST([APP_MAN_SUFFIX])
13456ea72052SmrgAC_SUBST([LIB_MAN_SUFFIX])
13466ea72052SmrgAC_SUBST([FILE_MAN_SUFFIX])
13476ea72052SmrgAC_SUBST([MISC_MAN_SUFFIX])
13486ea72052SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
13496ea72052SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
13506ea72052SmrgAC_SUBST([APP_MAN_DIR])
13516ea72052SmrgAC_SUBST([LIB_MAN_DIR])
13526ea72052SmrgAC_SUBST([FILE_MAN_DIR])
13536ea72052SmrgAC_SUBST([MISC_MAN_DIR])
13546ea72052SmrgAC_SUBST([DRIVER_MAN_DIR])
13556ea72052SmrgAC_SUBST([ADMIN_MAN_DIR])
1356168023feSmrg
1357168023feSmrgXORG_MAN_PAGE="X Version 11"
1358168023feSmrgAC_SUBST([XORG_MAN_PAGE])
1359168023feSmrgMAN_SUBSTS="\
1360168023feSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1361168023feSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1362168023feSmrg	-e 's|__xservername__|Xorg|g' \
1363168023feSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1364168023feSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1365168023feSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1366168023feSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1367168023feSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1368168023feSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1369168023feSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1370168023feSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1371168023feSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1372168023feSmrgAC_SUBST([MAN_SUBSTS])
1373168023feSmrg
13746ea72052Smrg]) # XORG_MANPAGE_SECTIONS
13756ea72052Smrg
1376168023feSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1377168023feSmrg# ------------------------
1378168023feSmrg# Minimum version: 1.7.0
1379168023feSmrg#
1380168023feSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1381168023feSmrg# provided by xorg-sgml-doctools, if installed.
1382168023feSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1383168023feSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1384168023feSmrgXORG_SGML_PATH=
1385168023feSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1386168023feSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1387168023feSmrg    [m4_ifval([$1],[:],
1388168023feSmrg        [if test x"$cross_compiling" != x"yes" ; then
1389168023feSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1390168023feSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1391168023feSmrg         fi])
1392168023feSmrg    ])
1393168023feSmrg
1394168023feSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1395168023feSmrg# the path and the name of the doc stylesheet
1396168023feSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1397168023feSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1398168023feSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1399168023feSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1400168023feSmrgelse
1401168023feSmrg   AC_MSG_RESULT([no])
1402168023feSmrgfi
1403168023feSmrg
1404168023feSmrgAC_SUBST(XORG_SGML_PATH)
1405168023feSmrgAC_SUBST(STYLESHEET_SRCDIR)
1406168023feSmrgAC_SUBST(XSL_STYLESHEET)
1407168023feSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1408168023feSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1409168023feSmrg
14106ea72052Smrg# XORG_CHECK_LINUXDOC
14116ea72052Smrg# -------------------
1412168023feSmrg# Minimum version: 1.0.0
1413168023feSmrg#
14146ea72052Smrg# Defines the variable MAKE_TEXT if the necessary tools and
14156ea72052Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
14166ea72052Smrg# Whether or not the necessary tools and files are found can be checked
14176ea72052Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
14186ea72052SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1419168023feSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1420168023feSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
14216ea72052Smrg
14226ea72052SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
14236ea72052Smrg
1424168023feSmrgAC_MSG_CHECKING([whether to build documentation])
1425168023feSmrg
1426168023feSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1427168023feSmrg   BUILDDOC=yes
1428168023feSmrgelse
1429168023feSmrg   BUILDDOC=no
1430168023feSmrgfi
1431168023feSmrg
1432168023feSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1433168023feSmrg
1434168023feSmrgAC_MSG_RESULT([$BUILDDOC])
1435168023feSmrg
1436168023feSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1437168023feSmrg
1438168023feSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1439168023feSmrg   BUILDPDFDOC=yes
1440168023feSmrgelse
1441168023feSmrg   BUILDPDFDOC=no
1442168023feSmrgfi
1443168023feSmrg
1444168023feSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1445168023feSmrg
1446168023feSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1447168023feSmrg
1448168023feSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1449168023feSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1450168023feSmrgMAKE_PDF="$PS2PDF"
1451168023feSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1452168023feSmrg
1453168023feSmrgAC_SUBST(MAKE_TEXT)
1454168023feSmrgAC_SUBST(MAKE_PS)
1455168023feSmrgAC_SUBST(MAKE_PDF)
1456168023feSmrgAC_SUBST(MAKE_HTML)
1457168023feSmrg]) # XORG_CHECK_LINUXDOC
1458168023feSmrg
1459168023feSmrg# XORG_CHECK_DOCBOOK
1460168023feSmrg# -------------------
1461168023feSmrg# Minimum version: 1.0.0
1462168023feSmrg#
1463168023feSmrg# Checks for the ability to build output formats from SGML DocBook source.
1464168023feSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1465168023feSmrg# indicates whether the necessary tools and files are found and, if set,
1466168023feSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1467168023feSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1468168023feSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1469168023feSmrg
1470168023feSmrgBUILDTXTDOC=no
1471168023feSmrgBUILDPDFDOC=no
1472168023feSmrgBUILDPSDOC=no
1473168023feSmrgBUILDHTMLDOC=no
1474168023feSmrg
1475168023feSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1476168023feSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1477168023feSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1478168023feSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1479168023feSmrg
1480168023feSmrgAC_MSG_CHECKING([whether to build text documentation])
1481168023feSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1482168023feSmrg   test x$BUILD_TXTDOC != xno; then
1483168023feSmrg	BUILDTXTDOC=yes
1484168023feSmrgfi
1485168023feSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1486168023feSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1487168023feSmrg
1488168023feSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1489168023feSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1490168023feSmrg   test x$BUILD_PDFDOC != xno; then
1491168023feSmrg	BUILDPDFDOC=yes
1492168023feSmrgfi
1493168023feSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1494168023feSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1495168023feSmrg
1496168023feSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1497168023feSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1498168023feSmrg   test x$BUILD_PSDOC != xno; then
1499168023feSmrg	BUILDPSDOC=yes
1500168023feSmrgfi
1501168023feSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1502168023feSmrgAC_MSG_RESULT([$BUILDPSDOC])
1503168023feSmrg
1504168023feSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1505168023feSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1506168023feSmrg   test x$BUILD_HTMLDOC != xno; then
1507168023feSmrg	BUILDHTMLDOC=yes
1508168023feSmrgfi
1509168023feSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1510168023feSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1511168023feSmrg
1512168023feSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1513168023feSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1514168023feSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1515168023feSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1516168023feSmrg
1517168023feSmrgAC_SUBST(MAKE_TEXT)
1518168023feSmrgAC_SUBST(MAKE_PS)
1519168023feSmrgAC_SUBST(MAKE_PDF)
1520168023feSmrgAC_SUBST(MAKE_HTML)
1521168023feSmrg]) # XORG_CHECK_DOCBOOK
1522168023feSmrg
152349e82cebSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1524168023feSmrg# ----------------
1525168023feSmrg# Minimum version: 1.5.0
152649e82cebSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1527168023feSmrg#
1528168023feSmrg# Documentation tools are not always available on all platforms and sometimes
1529168023feSmrg# not at the appropriate level. This macro enables a module to test for the
1530168023feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1531168023feSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
153249e82cebSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
153349e82cebSmrg# --with-xmlto assumes 'auto'.
1534168023feSmrg#
1535168023feSmrg# Interface to module:
1536168023feSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1537168023feSmrg# XMLTO:	returns the path of the xmlto program found
1538168023feSmrg#		returns the path set by the user in the environment
1539168023feSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1540168023feSmrg#		'no' user instructs the module not to use xmlto
1541168023feSmrg#
1542168023feSmrg# Added in version 1.10.0
1543168023feSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1544168023feSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1545168023feSmrg#
1546168023feSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1547168023feSmrg#
1548168023feSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1549168023feSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
155049e82cebSmrgm4_define([_defopt], m4_default([$2], [auto]))
1551168023feSmrgAC_ARG_WITH(xmlto,
1552168023feSmrg	AS_HELP_STRING([--with-xmlto],
155349e82cebSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
155449e82cebSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
155549e82cebSmrgm4_undefine([_defopt])
1556168023feSmrg
1557168023feSmrgif test "x$use_xmlto" = x"auto"; then
1558168023feSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1559168023feSmrg   if test "x$XMLTO" = "x"; then
1560168023feSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1561168023feSmrg	have_xmlto=no
1562168023feSmrg   else
1563168023feSmrg        have_xmlto=yes
1564168023feSmrg   fi
1565168023feSmrgelif test "x$use_xmlto" = x"yes" ; then
1566168023feSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1567168023feSmrg   if test "x$XMLTO" = "x"; then
1568168023feSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1569168023feSmrg   fi
1570168023feSmrg   have_xmlto=yes
1571168023feSmrgelif test "x$use_xmlto" = x"no" ; then
1572168023feSmrg   if test "x$XMLTO" != "x"; then
1573168023feSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1574168023feSmrg   fi
1575168023feSmrg   have_xmlto=no
1576168023feSmrgelse
1577168023feSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1578168023feSmrgfi
1579168023feSmrg
1580168023feSmrg# Test for a minimum version of xmlto, if provided.
1581168023feSmrgm4_ifval([$1],
1582168023feSmrg[if test "$have_xmlto" = yes; then
1583168023feSmrg    # scrape the xmlto version
1584168023feSmrg    AC_MSG_CHECKING([the xmlto version])
1585168023feSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1586168023feSmrg    AC_MSG_RESULT([$xmlto_version])
1587168023feSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1588168023feSmrg        [if test "x$use_xmlto" = xauto; then
1589168023feSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1590168023feSmrg            have_xmlto=no
1591168023feSmrg        else
1592168023feSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1593168023feSmrg        fi])
1594168023feSmrgfi])
1595168023feSmrg
1596168023feSmrg# Test for the ability of xmlto to generate a text target
1597168023feSmrghave_xmlto_text=no
1598168023feSmrgcat > conftest.xml << "EOF"
1599168023feSmrgEOF
1600168023feSmrgAS_IF([test "$have_xmlto" = yes],
1601168023feSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1602168023feSmrg             [have_xmlto_text=yes],
1603168023feSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1604168023feSmrgrm -f conftest.xml
1605168023feSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1606168023feSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1607168023feSmrg]) # XORG_WITH_XMLTO
1608168023feSmrg
160949e82cebSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
161049e82cebSmrg# --------------------------------------------
161149e82cebSmrg# Minimum version: 1.12.0
161249e82cebSmrg# Minimum version for optional DEFAULT argument: 1.12.0
161349e82cebSmrg#
161449e82cebSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
161549e82cebSmrg# XML-based language used for the transformation of XML documents.
161649e82cebSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
161749e82cebSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
161849e82cebSmrg# The XSLT processor is often used as a standalone tool for transformations.
161949e82cebSmrg# It should not be assumed that this tool is used only to work with documnetation.
162049e82cebSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
162149e82cebSmrg#
162249e82cebSmrg# Interface to module:
162349e82cebSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
162449e82cebSmrg# XSLTPROC:	 returns the path of the xsltproc program found
162549e82cebSmrg#		 returns the path set by the user in the environment
162649e82cebSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
162749e82cebSmrg#		  'no' user instructs the module not to use xsltproc
162849e82cebSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
162949e82cebSmrg#
163049e82cebSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
163149e82cebSmrg#
163249e82cebSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
163349e82cebSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
163449e82cebSmrg# Preserves the interface, should it be implemented later
163549e82cebSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
163649e82cebSmrgm4_define([_defopt], m4_default([$2], [auto]))
163749e82cebSmrgAC_ARG_WITH(xsltproc,
163849e82cebSmrg	AS_HELP_STRING([--with-xsltproc],
163949e82cebSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
164049e82cebSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
164149e82cebSmrgm4_undefine([_defopt])
164249e82cebSmrg
164349e82cebSmrgif test "x$use_xsltproc" = x"auto"; then
164449e82cebSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
164549e82cebSmrg   if test "x$XSLTPROC" = "x"; then
164649e82cebSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
164749e82cebSmrg	have_xsltproc=no
164849e82cebSmrg   else
164949e82cebSmrg        have_xsltproc=yes
165049e82cebSmrg   fi
165149e82cebSmrgelif test "x$use_xsltproc" = x"yes" ; then
165249e82cebSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
165349e82cebSmrg   if test "x$XSLTPROC" = "x"; then
165449e82cebSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
165549e82cebSmrg   fi
165649e82cebSmrg   have_xsltproc=yes
165749e82cebSmrgelif test "x$use_xsltproc" = x"no" ; then
165849e82cebSmrg   if test "x$XSLTPROC" != "x"; then
165949e82cebSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
166049e82cebSmrg   fi
166149e82cebSmrg   have_xsltproc=no
166249e82cebSmrgelse
166349e82cebSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
166449e82cebSmrgfi
166549e82cebSmrg
166649e82cebSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
166749e82cebSmrg]) # XORG_WITH_XSLTPROC
166849e82cebSmrg
166949e82cebSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
167049e82cebSmrg# ----------------------------------------
167149e82cebSmrg# Minimum version: 1.15.0
167249e82cebSmrg#
167349e82cebSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
167449e82cebSmrg# scanning arbitrary text files, extracting information from those text files,
167549e82cebSmrg# and printing reports based on that information.
167649e82cebSmrg#
167749e82cebSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
167849e82cebSmrg#
167949e82cebSmrg# Interface to module:
168049e82cebSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
168149e82cebSmrg# PERL:	     returns the path of the perl program found
168249e82cebSmrg#	     returns the path set by the user in the environment
168349e82cebSmrg# --with-perl: 'yes' user instructs the module to use perl
168449e82cebSmrg#	       'no' user instructs the module not to use perl
168549e82cebSmrg# have_perl: returns yes if perl found in PATH or no
168649e82cebSmrg#
168749e82cebSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
168849e82cebSmrg#
168949e82cebSmrgAC_DEFUN([XORG_WITH_PERL],[
169049e82cebSmrgAC_ARG_VAR([PERL], [Path to perl command])
169149e82cebSmrg# Preserves the interface, should it be implemented later
169249e82cebSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
169349e82cebSmrgm4_define([_defopt], m4_default([$2], [auto]))
169449e82cebSmrgAC_ARG_WITH(perl,
169549e82cebSmrg	AS_HELP_STRING([--with-perl],
169649e82cebSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
169749e82cebSmrg	   [use_perl=$withval], [use_perl=]_defopt)
169849e82cebSmrgm4_undefine([_defopt])
169949e82cebSmrg
170049e82cebSmrgif test "x$use_perl" = x"auto"; then
170149e82cebSmrg   AC_PATH_PROG([PERL], [perl])
170249e82cebSmrg   if test "x$PERL" = "x"; then
170349e82cebSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
170449e82cebSmrg	have_perl=no
170549e82cebSmrg   else
170649e82cebSmrg        have_perl=yes
170749e82cebSmrg   fi
170849e82cebSmrgelif test "x$use_perl" = x"yes" ; then
170949e82cebSmrg   AC_PATH_PROG([PERL], [perl])
171049e82cebSmrg   if test "x$PERL" = "x"; then
171149e82cebSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
171249e82cebSmrg   fi
171349e82cebSmrg   have_perl=yes
171449e82cebSmrgelif test "x$use_perl" = x"no" ; then
171549e82cebSmrg   if test "x$PERL" != "x"; then
171649e82cebSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
171749e82cebSmrg   fi
171849e82cebSmrg   have_perl=no
171949e82cebSmrgelse
172049e82cebSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
172149e82cebSmrgfi
172249e82cebSmrg
172349e82cebSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
172449e82cebSmrg]) # XORG_WITH_PERL
172549e82cebSmrg
172649e82cebSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1727168023feSmrg# ----------------
1728168023feSmrg# Minimum version: 1.5.0
172949e82cebSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1730168023feSmrg#
1731168023feSmrg# Documentation tools are not always available on all platforms and sometimes
1732168023feSmrg# not at the appropriate level. This macro enables a module to test for the
1733168023feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1734168023feSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
173549e82cebSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
173649e82cebSmrg# --with-asciidoc assumes 'auto'.
1737168023feSmrg#
1738168023feSmrg# Interface to module:
1739168023feSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1740168023feSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
1741168023feSmrg#		 returns the path set by the user in the environment
1742168023feSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1743168023feSmrg#		  'no' user instructs the module not to use asciidoc
1744168023feSmrg#
1745168023feSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1746168023feSmrg#
1747168023feSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1748168023feSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
174949e82cebSmrgm4_define([_defopt], m4_default([$2], [auto]))
1750168023feSmrgAC_ARG_WITH(asciidoc,
1751168023feSmrg	AS_HELP_STRING([--with-asciidoc],
175249e82cebSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
175349e82cebSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
175449e82cebSmrgm4_undefine([_defopt])
1755168023feSmrg
1756168023feSmrgif test "x$use_asciidoc" = x"auto"; then
1757168023feSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1758168023feSmrg   if test "x$ASCIIDOC" = "x"; then
1759168023feSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1760168023feSmrg	have_asciidoc=no
1761168023feSmrg   else
1762168023feSmrg        have_asciidoc=yes
1763168023feSmrg   fi
1764168023feSmrgelif test "x$use_asciidoc" = x"yes" ; then
1765168023feSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1766168023feSmrg   if test "x$ASCIIDOC" = "x"; then
1767168023feSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1768168023feSmrg   fi
1769168023feSmrg   have_asciidoc=yes
1770168023feSmrgelif test "x$use_asciidoc" = x"no" ; then
1771168023feSmrg   if test "x$ASCIIDOC" != "x"; then
1772168023feSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1773168023feSmrg   fi
1774168023feSmrg   have_asciidoc=no
1775168023feSmrgelse
1776168023feSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1777168023feSmrgfi
1778168023feSmrgm4_ifval([$1],
1779168023feSmrg[if test "$have_asciidoc" = yes; then
1780168023feSmrg    # scrape the asciidoc version
1781168023feSmrg    AC_MSG_CHECKING([the asciidoc version])
1782168023feSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1783168023feSmrg    AC_MSG_RESULT([$asciidoc_version])
1784168023feSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1785168023feSmrg        [if test "x$use_asciidoc" = xauto; then
1786168023feSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1787168023feSmrg            have_asciidoc=no
1788168023feSmrg        else
1789168023feSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1790168023feSmrg        fi])
1791168023feSmrgfi])
1792168023feSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1793168023feSmrg]) # XORG_WITH_ASCIIDOC
1794168023feSmrg
179549e82cebSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1796168023feSmrg# --------------------------------
1797168023feSmrg# Minimum version: 1.5.0
179849e82cebSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1799168023feSmrg#
1800168023feSmrg# Documentation tools are not always available on all platforms and sometimes
1801168023feSmrg# not at the appropriate level. This macro enables a module to test for the
1802168023feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1803168023feSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
180449e82cebSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
180549e82cebSmrg# --with-doxygen assumes 'auto'.
1806168023feSmrg#
1807168023feSmrg# Interface to module:
1808168023feSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1809168023feSmrg# DOXYGEN:	 returns the path of the doxygen program found
1810168023feSmrg#		 returns the path set by the user in the environment
1811168023feSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1812168023feSmrg#		  'no' user instructs the module not to use doxygen
1813168023feSmrg#
1814168023feSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1815168023feSmrg#
1816168023feSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1817168023feSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
181849e82cebSmrgm4_define([_defopt], m4_default([$2], [auto]))
1819168023feSmrgAC_ARG_WITH(doxygen,
1820168023feSmrg	AS_HELP_STRING([--with-doxygen],
182149e82cebSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
182249e82cebSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
182349e82cebSmrgm4_undefine([_defopt])
1824168023feSmrg
1825168023feSmrgif test "x$use_doxygen" = x"auto"; then
1826168023feSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1827168023feSmrg   if test "x$DOXYGEN" = "x"; then
1828168023feSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1829168023feSmrg	have_doxygen=no
1830168023feSmrg   else
1831168023feSmrg        have_doxygen=yes
1832168023feSmrg   fi
1833168023feSmrgelif test "x$use_doxygen" = x"yes" ; then
1834168023feSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1835168023feSmrg   if test "x$DOXYGEN" = "x"; then
1836168023feSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1837168023feSmrg   fi
1838168023feSmrg   have_doxygen=yes
1839168023feSmrgelif test "x$use_doxygen" = x"no" ; then
1840168023feSmrg   if test "x$DOXYGEN" != "x"; then
1841168023feSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1842168023feSmrg   fi
1843168023feSmrg   have_doxygen=no
1844168023feSmrgelse
1845168023feSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1846168023feSmrgfi
1847168023feSmrgm4_ifval([$1],
1848168023feSmrg[if test "$have_doxygen" = yes; then
1849168023feSmrg    # scrape the doxygen version
1850168023feSmrg    AC_MSG_CHECKING([the doxygen version])
1851168023feSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1852168023feSmrg    AC_MSG_RESULT([$doxygen_version])
1853168023feSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1854168023feSmrg        [if test "x$use_doxygen" = xauto; then
1855168023feSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1856168023feSmrg            have_doxygen=no
1857168023feSmrg        else
1858168023feSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1859168023feSmrg        fi])
1860168023feSmrgfi])
1861168023feSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1862168023feSmrg]) # XORG_WITH_DOXYGEN
18636ea72052Smrg
186449e82cebSmrg# XORG_WITH_GROFF([DEFAULT])
1865168023feSmrg# ----------------
1866168023feSmrg# Minimum version: 1.6.0
186749e82cebSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1868168023feSmrg#
1869168023feSmrg# Documentation tools are not always available on all platforms and sometimes
1870168023feSmrg# not at the appropriate level. This macro enables a module to test for the
1871168023feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1872168023feSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
187349e82cebSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
187449e82cebSmrg# --with-groff assumes 'auto'.
1875168023feSmrg#
1876168023feSmrg# Interface to module:
1877168023feSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1878168023feSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1879168023feSmrg# HAVE_GROFF_MS: the -ms macros package
1880168023feSmrg# GROFF:	 returns the path of the groff program found
1881168023feSmrg#		 returns the path set by the user in the environment
1882168023feSmrg# --with-groff:	 'yes' user instructs the module to use groff
1883168023feSmrg#		 'no' user instructs the module not to use groff
1884168023feSmrg#
1885168023feSmrg# Added in version 1.9.0:
1886168023feSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1887168023feSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1888168023feSmrg#		   psselect from the psutils package.
1889168023feSmrg#		   the ghostcript package. Refer to the grohtml man pages
1890168023feSmrg#
1891168023feSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1892168023feSmrg#
1893168023feSmrg# OS and distros often splits groff in a basic and full package, the former
1894168023feSmrg# having the groff program and the later having devices, fonts and macros
1895168023feSmrg# Checking for the groff executable is not enough.
1896168023feSmrg#
1897168023feSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1898168023feSmrg# unset HAVE_GROFF or GROFF env variables.
1899168023feSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1900168023feSmrg#
1901168023feSmrgAC_DEFUN([XORG_WITH_GROFF],[
1902168023feSmrgAC_ARG_VAR([GROFF], [Path to groff command])
190349e82cebSmrgm4_define([_defopt], m4_default([$1], [auto]))
1904168023feSmrgAC_ARG_WITH(groff,
1905168023feSmrg	AS_HELP_STRING([--with-groff],
190649e82cebSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
190749e82cebSmrg	   [use_groff=$withval], [use_groff=]_defopt)
190849e82cebSmrgm4_undefine([_defopt])
1909168023feSmrg
1910168023feSmrgif test "x$use_groff" = x"auto"; then
1911168023feSmrg   AC_PATH_PROG([GROFF], [groff])
1912168023feSmrg   if test "x$GROFF" = "x"; then
1913168023feSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1914168023feSmrg	have_groff=no
1915168023feSmrg   else
1916168023feSmrg        have_groff=yes
1917168023feSmrg   fi
1918168023feSmrgelif test "x$use_groff" = x"yes" ; then
1919168023feSmrg   AC_PATH_PROG([GROFF], [groff])
1920168023feSmrg   if test "x$GROFF" = "x"; then
1921168023feSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1922168023feSmrg   fi
1923168023feSmrg   have_groff=yes
1924168023feSmrgelif test "x$use_groff" = x"no" ; then
1925168023feSmrg   if test "x$GROFF" != "x"; then
1926168023feSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1927168023feSmrg   fi
1928168023feSmrg   have_groff=no
19296ea72052Smrgelse
1930168023feSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19316ea72052Smrgfi
19326ea72052Smrg
1933168023feSmrg# We have groff, test for the presence of the macro packages
1934168023feSmrgif test "x$have_groff" = x"yes"; then
1935168023feSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1936168023feSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1937168023feSmrg        groff_ms_works=yes
1938168023feSmrg    else
1939168023feSmrg        groff_ms_works=no
1940168023feSmrg    fi
1941168023feSmrg    AC_MSG_RESULT([$groff_ms_works])
1942168023feSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1943168023feSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1944168023feSmrg        groff_mm_works=yes
1945168023feSmrg    else
1946168023feSmrg        groff_mm_works=no
1947168023feSmrg    fi
1948168023feSmrg    AC_MSG_RESULT([$groff_mm_works])
1949168023feSmrgfi
19506ea72052Smrg
1951168023feSmrg# We have groff, test for HTML dependencies, one command per package
1952168023feSmrgif test "x$have_groff" = x"yes"; then
1953168023feSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1954168023feSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1955168023feSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1956168023feSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1957168023feSmrg      have_groff_html=yes
1958168023feSmrg   else
1959168023feSmrg      have_groff_html=no
1960168023feSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1961168023feSmrg   fi
1962168023feSmrgfi
19636ea72052Smrg
1964168023feSmrg# Set Automake conditionals for Makefiles
1965168023feSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1966168023feSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1967168023feSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1968168023feSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1969168023feSmrg]) # XORG_WITH_GROFF
19706ea72052Smrg
197149e82cebSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
197249e82cebSmrg# ---------------------------------------
1973168023feSmrg# Minimum version: 1.6.0
197449e82cebSmrg# Minimum version for optional DEFAULT argument: 1.11.0
197549e82cebSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1976168023feSmrg#
1977168023feSmrg# Documentation tools are not always available on all platforms and sometimes
1978168023feSmrg# not at the appropriate level. This macro enables a module to test for the
1979168023feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1980168023feSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
198149e82cebSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
198249e82cebSmrg# --with-fop assumes 'auto'.
1983168023feSmrg#
1984168023feSmrg# Interface to module:
1985168023feSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1986168023feSmrg# FOP:	 	returns the path of the fop program found
1987168023feSmrg#		returns the path set by the user in the environment
1988168023feSmrg# --with-fop: 	'yes' user instructs the module to use fop
1989168023feSmrg#		'no' user instructs the module not to use fop
1990168023feSmrg#
1991168023feSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1992168023feSmrg#
1993168023feSmrgAC_DEFUN([XORG_WITH_FOP],[
1994168023feSmrgAC_ARG_VAR([FOP], [Path to fop command])
199549e82cebSmrgm4_define([_defopt], m4_default([$2], [auto]))
1996168023feSmrgAC_ARG_WITH(fop,
1997168023feSmrg	AS_HELP_STRING([--with-fop],
199849e82cebSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
199949e82cebSmrg	   [use_fop=$withval], [use_fop=]_defopt)
200049e82cebSmrgm4_undefine([_defopt])
2001168023feSmrg
2002168023feSmrgif test "x$use_fop" = x"auto"; then
2003168023feSmrg   AC_PATH_PROG([FOP], [fop])
2004168023feSmrg   if test "x$FOP" = "x"; then
2005168023feSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2006168023feSmrg	have_fop=no
2007168023feSmrg   else
2008168023feSmrg        have_fop=yes
2009168023feSmrg   fi
2010168023feSmrgelif test "x$use_fop" = x"yes" ; then
2011168023feSmrg   AC_PATH_PROG([FOP], [fop])
2012168023feSmrg   if test "x$FOP" = "x"; then
2013168023feSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2014168023feSmrg   fi
2015168023feSmrg   have_fop=yes
2016168023feSmrgelif test "x$use_fop" = x"no" ; then
2017168023feSmrg   if test "x$FOP" != "x"; then
2018168023feSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2019168023feSmrg   fi
2020168023feSmrg   have_fop=no
20216ea72052Smrgelse
2022168023feSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20236ea72052Smrgfi
202449e82cebSmrg
202549e82cebSmrg# Test for a minimum version of fop, if provided.
202649e82cebSmrgm4_ifval([$1],
202749e82cebSmrg[if test "$have_fop" = yes; then
202849e82cebSmrg    # scrape the fop version
202949e82cebSmrg    AC_MSG_CHECKING([for fop minimum version])
203049e82cebSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
203149e82cebSmrg    AC_MSG_RESULT([$fop_version])
203249e82cebSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
203349e82cebSmrg        [if test "x$use_fop" = xauto; then
203449e82cebSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
203549e82cebSmrg            have_fop=no
203649e82cebSmrg        else
203749e82cebSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
203849e82cebSmrg        fi])
203949e82cebSmrgfi])
2040168023feSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2041168023feSmrg]) # XORG_WITH_FOP
20426ea72052Smrg
204349e82cebSmrg# XORG_WITH_PS2PDF([DEFAULT])
2044168023feSmrg# ----------------
2045168023feSmrg# Minimum version: 1.6.0
204649e82cebSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2047168023feSmrg#
2048168023feSmrg# Documentation tools are not always available on all platforms and sometimes
2049168023feSmrg# not at the appropriate level. This macro enables a module to test for the
2050168023feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2051168023feSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
205249e82cebSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
205349e82cebSmrg# --with-ps2pdf assumes 'auto'.
2054168023feSmrg#
2055168023feSmrg# Interface to module:
2056168023feSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2057168023feSmrg# PS2PDF:	returns the path of the ps2pdf program found
2058168023feSmrg#		returns the path set by the user in the environment
2059168023feSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2060168023feSmrg#		 'no' user instructs the module not to use ps2pdf
2061168023feSmrg#
2062168023feSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2063168023feSmrg#
2064168023feSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2065168023feSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
206649e82cebSmrgm4_define([_defopt], m4_default([$1], [auto]))
2067168023feSmrgAC_ARG_WITH(ps2pdf,
2068168023feSmrg	AS_HELP_STRING([--with-ps2pdf],
206949e82cebSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
207049e82cebSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
207149e82cebSmrgm4_undefine([_defopt])
2072168023feSmrg
2073168023feSmrgif test "x$use_ps2pdf" = x"auto"; then
2074168023feSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2075168023feSmrg   if test "x$PS2PDF" = "x"; then
2076168023feSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2077168023feSmrg	have_ps2pdf=no
2078168023feSmrg   else
2079168023feSmrg        have_ps2pdf=yes
2080168023feSmrg   fi
2081168023feSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2082168023feSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2083168023feSmrg   if test "x$PS2PDF" = "x"; then
2084168023feSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2085168023feSmrg   fi
2086168023feSmrg   have_ps2pdf=yes
2087168023feSmrgelif test "x$use_ps2pdf" = x"no" ; then
2088168023feSmrg   if test "x$PS2PDF" != "x"; then
2089168023feSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2090168023feSmrg   fi
2091168023feSmrg   have_ps2pdf=no
2092168023feSmrgelse
2093168023feSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2094168023feSmrgfi
2095168023feSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2096168023feSmrg]) # XORG_WITH_PS2PDF
20976ea72052Smrg
2098168023feSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2099168023feSmrg# ----------------
2100168023feSmrg# Minimum version: 1.6.0
2101168023feSmrg#
2102168023feSmrg# Documentation tools are not always available on all platforms and sometimes
2103168023feSmrg# not at the appropriate level. This macro enables a builder to skip all
2104168023feSmrg# documentation targets except traditional man pages.
2105168023feSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2106168023feSmrg# maximum flexibilty in controlling documentation building.
2107168023feSmrg# Refer to:
2108168023feSmrg# XORG_WITH_XMLTO         --with-xmlto
2109168023feSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2110168023feSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2111168023feSmrg# XORG_WITH_FOP           --with-fop
2112168023feSmrg# XORG_WITH_GROFF         --with-groff
2113168023feSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2114168023feSmrg#
2115168023feSmrg# Interface to module:
2116168023feSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2117168023feSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2118168023feSmrg#		 'no' user instructs the module not to generate docs
2119168023feSmrg# parm1:	specify the default value, yes or no.
2120168023feSmrg#
2121168023feSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
212249e82cebSmrgm4_define([docs_default], m4_default([$1], [yes]))
2123168023feSmrgAC_ARG_ENABLE(docs,
2124168023feSmrg	AS_HELP_STRING([--enable-docs],
212549e82cebSmrg	   [Enable building the documentation (default: ]docs_default[)]),
212649e82cebSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
212749e82cebSmrgm4_undefine([docs_default])
2128168023feSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2129168023feSmrgAC_MSG_CHECKING([whether to build documentation])
2130168023feSmrgAC_MSG_RESULT([$build_docs])
2131168023feSmrg]) # XORG_ENABLE_DOCS
2132168023feSmrg
2133168023feSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2134168023feSmrg# ----------------
2135168023feSmrg# Minimum version: 1.6.0
2136168023feSmrg#
2137168023feSmrg# This macro enables a builder to skip all developer documentation.
2138168023feSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2139168023feSmrg# maximum flexibilty in controlling documentation building.
2140168023feSmrg# Refer to:
2141168023feSmrg# XORG_WITH_XMLTO         --with-xmlto
2142168023feSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2143168023feSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2144168023feSmrg# XORG_WITH_FOP           --with-fop
2145168023feSmrg# XORG_WITH_GROFF         --with-groff
2146168023feSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2147168023feSmrg#
2148168023feSmrg# Interface to module:
2149168023feSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2150168023feSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2151168023feSmrg#			'no' user instructs the module not to generate developer docs
2152168023feSmrg# parm1:		specify the default value, yes or no.
2153168023feSmrg#
2154168023feSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
215549e82cebSmrgm4_define([devel_default], m4_default([$1], [yes]))
2156168023feSmrgAC_ARG_ENABLE(devel-docs,
2157168023feSmrg	AS_HELP_STRING([--enable-devel-docs],
215849e82cebSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
215949e82cebSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
216049e82cebSmrgm4_undefine([devel_default])
2161168023feSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2162168023feSmrgAC_MSG_CHECKING([whether to build developer documentation])
2163168023feSmrgAC_MSG_RESULT([$build_devel_docs])
2164168023feSmrg]) # XORG_ENABLE_DEVEL_DOCS
2165168023feSmrg
2166168023feSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2167168023feSmrg# ----------------
2168168023feSmrg# Minimum version: 1.6.0
2169168023feSmrg#
2170168023feSmrg# This macro enables a builder to skip all functional specification targets.
2171168023feSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2172168023feSmrg# maximum flexibilty in controlling documentation building.
2173168023feSmrg# Refer to:
2174168023feSmrg# XORG_WITH_XMLTO         --with-xmlto
2175168023feSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2176168023feSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2177168023feSmrg# XORG_WITH_FOP           --with-fop
2178168023feSmrg# XORG_WITH_GROFF         --with-groff
2179168023feSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2180168023feSmrg#
2181168023feSmrg# Interface to module:
2182168023feSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2183168023feSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2184168023feSmrg#			'no' user instructs the module not to generate specs
2185168023feSmrg# parm1:		specify the default value, yes or no.
2186168023feSmrg#
2187168023feSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
218849e82cebSmrgm4_define([spec_default], m4_default([$1], [yes]))
2189168023feSmrgAC_ARG_ENABLE(specs,
2190168023feSmrg	AS_HELP_STRING([--enable-specs],
219149e82cebSmrg	   [Enable building the specs (default: ]spec_default[)]),
219249e82cebSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
219349e82cebSmrgm4_undefine([spec_default])
2194168023feSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2195168023feSmrgAC_MSG_CHECKING([whether to build functional specifications])
2196168023feSmrgAC_MSG_RESULT([$build_specs])
2197168023feSmrg]) # XORG_ENABLE_SPECS
21986ea72052Smrg
219949e82cebSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
220049e82cebSmrg# ----------------------------------------------
220149e82cebSmrg# Minimum version: 1.13.0
220249e82cebSmrg#
220349e82cebSmrg# This macro enables a builder to enable/disable unit testing
220449e82cebSmrg# It makes no assumption about the test cases implementation
220549e82cebSmrg# Test cases may or may not use Automake "Support for test suites"
220649e82cebSmrg# They may or may not use the software utility library GLib
220749e82cebSmrg#
220849e82cebSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
220949e82cebSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
221049e82cebSmrg# The variable enable_unit_tests is used by other macros in this file.
221149e82cebSmrg#
221249e82cebSmrg# Interface to module:
221349e82cebSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
221449e82cebSmrg# enable_unit_tests:    used in configure.ac for additional configuration
221549e82cebSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
221649e82cebSmrg#			'no' user instructs the module not to build tests
221749e82cebSmrg# parm1:		specify the default value, yes or no.
221849e82cebSmrg#
221949e82cebSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
222049e82cebSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
222149e82cebSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
222249e82cebSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
222349e82cebSmrgm4_define([_defopt], m4_default([$1], [auto]))
222449e82cebSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
222549e82cebSmrg	[Enable building unit test cases (default: ]_defopt[)]),
222649e82cebSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
222749e82cebSmrgm4_undefine([_defopt])
222849e82cebSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
222949e82cebSmrgAC_MSG_CHECKING([whether to build unit test cases])
223049e82cebSmrgAC_MSG_RESULT([$enable_unit_tests])
223149e82cebSmrg]) # XORG_ENABLE_UNIT_TESTS
223249e82cebSmrg
223349e82cebSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
223449e82cebSmrg# ----------------------------------------
223549e82cebSmrg# Minimum version: 1.13.0
223649e82cebSmrg#
223749e82cebSmrg# GLib is a library which provides advanced data structures and functions.
223849e82cebSmrg# This macro enables a module to test for the presence of Glib.
223949e82cebSmrg#
224049e82cebSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
224149e82cebSmrg# Otherwise the value of $enable_unit_tests is blank.
224249e82cebSmrg#
224349e82cebSmrg# Interface to module:
224449e82cebSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
224549e82cebSmrg# with_glib: used in configure.ac to know if GLib has been found
224649e82cebSmrg# --with-glib:	'yes' user instructs the module to use glib
224749e82cebSmrg#		'no' user instructs the module not to use glib
224849e82cebSmrg#
224949e82cebSmrgAC_DEFUN([XORG_WITH_GLIB],[
225049e82cebSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
225149e82cebSmrgm4_define([_defopt], m4_default([$2], [auto]))
225249e82cebSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
225349e82cebSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
225449e82cebSmrg	[with_glib=$withval], [with_glib=]_defopt)
225549e82cebSmrgm4_undefine([_defopt])
225649e82cebSmrg
225749e82cebSmrghave_glib=no
225849e82cebSmrg# Do not probe GLib if user explicitly disabled unit testing
225949e82cebSmrgif test "x$enable_unit_tests" != x"no"; then
226049e82cebSmrg  # Do not probe GLib if user explicitly disabled it
226149e82cebSmrg  if test "x$with_glib" != x"no"; then
226249e82cebSmrg    m4_ifval(
226349e82cebSmrg      [$1],
226449e82cebSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
226549e82cebSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
226649e82cebSmrg    )
226749e82cebSmrg  fi
226849e82cebSmrgfi
226949e82cebSmrg
227049e82cebSmrg# Not having GLib when unit testing has been explicitly requested is an error
227149e82cebSmrgif test "x$enable_unit_tests" = x"yes"; then
227249e82cebSmrg  if test "x$have_glib" = x"no"; then
227349e82cebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
227449e82cebSmrg  fi
227549e82cebSmrgfi
227649e82cebSmrg
227749e82cebSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
227849e82cebSmrgif test "x$enable_unit_tests" = x"no"; then
227949e82cebSmrg  if test "x$with_glib" = x"yes"; then
228049e82cebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
228149e82cebSmrg  fi
228249e82cebSmrgfi
228349e82cebSmrg
228449e82cebSmrg# Not having GLib when it has been explicitly requested is an error
228549e82cebSmrgif test "x$with_glib" = x"yes"; then
228649e82cebSmrg  if test "x$have_glib" = x"no"; then
228749e82cebSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
228849e82cebSmrg  fi
228949e82cebSmrgfi
229049e82cebSmrg
229149e82cebSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
229249e82cebSmrg]) # XORG_WITH_GLIB
229349e82cebSmrg
229449e82cebSmrg# XORG_LD_WRAP([required|optional])
229549e82cebSmrg# ---------------------------------
229649e82cebSmrg# Minimum version: 1.13.0
229749e82cebSmrg#
229849e82cebSmrg# Check if linker supports -wrap, passed via compiler flags
229949e82cebSmrg#
230049e82cebSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
230149e82cebSmrg# Otherwise the value of $enable_unit_tests is blank.
230249e82cebSmrg#
230349e82cebSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
230449e82cebSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
230549e82cebSmrg# available, an argument of "optional" allows use when some unit tests require
230649e82cebSmrg# ld -wrap and others do not.
230749e82cebSmrg#
230849e82cebSmrgAC_DEFUN([XORG_LD_WRAP],[
230949e82cebSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
231049e82cebSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
231149e82cebSmrg                      void __wrap_exit(int status) { return; }],
231249e82cebSmrg                     [exit(0);])])
231349e82cebSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
231449e82cebSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
231549e82cebSmrg  if test "x$have_ld_wrap" = x"no"; then
231649e82cebSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
231749e82cebSmrg  fi
231849e82cebSmrgfi
231949e82cebSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
232049e82cebSmrg#
232149e82cebSmrg]) # XORG_LD_WRAP
232249e82cebSmrg
232349e82cebSmrg# XORG_CHECK_LINKER_FLAGS
232449e82cebSmrg# -----------------------
232549e82cebSmrg# SYNOPSIS
232649e82cebSmrg#
232749e82cebSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
232849e82cebSmrg#
232949e82cebSmrg# DESCRIPTION
233049e82cebSmrg#
233149e82cebSmrg#   Check whether the given linker FLAGS work with the current language's
233249e82cebSmrg#   linker, or whether they give an error.
233349e82cebSmrg#
233449e82cebSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
233549e82cebSmrg#   success/failure.
233649e82cebSmrg#
233749e82cebSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
233849e82cebSmrg#
233949e82cebSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
234049e82cebSmrg#
234149e82cebSmrg# LICENSE
234249e82cebSmrg#
234349e82cebSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
234449e82cebSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
234549e82cebSmrg#   Copyright (c) 2009 Matteo Frigo
234649e82cebSmrg#
234749e82cebSmrg#   This program is free software: you can redistribute it and/or modify it
234849e82cebSmrg#   under the terms of the GNU General Public License as published by the
234949e82cebSmrg#   Free Software Foundation, either version 3 of the License, or (at your
235049e82cebSmrg#   option) any later version.
235149e82cebSmrg#
235249e82cebSmrg#   This program is distributed in the hope that it will be useful, but
235349e82cebSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
235449e82cebSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
235549e82cebSmrg#   Public License for more details.
235649e82cebSmrg#
235749e82cebSmrg#   You should have received a copy of the GNU General Public License along
235849e82cebSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
235949e82cebSmrg#
236049e82cebSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
236149e82cebSmrg#   gives unlimited permission to copy, distribute and modify the configure
236249e82cebSmrg#   scripts that are the output of Autoconf when processing the Macro. You
236349e82cebSmrg#   need not follow the terms of the GNU General Public License when using
236449e82cebSmrg#   or distributing such scripts, even though portions of the text of the
236549e82cebSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
236649e82cebSmrg#   all other use of the material that constitutes the Autoconf Macro.
236749e82cebSmrg#
236849e82cebSmrg#   This special exception to the GPL applies to versions of the Autoconf
236949e82cebSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
237049e82cebSmrg#   modified version of the Autoconf Macro, you may extend this special
237149e82cebSmrg#   exception to the GPL to apply to your modified version as well.#
237249e82cebSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
237349e82cebSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
237449e82cebSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
237549e82cebSmrgAS_LITERAL_IF([$1],
237649e82cebSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
237749e82cebSmrg      ax_save_FLAGS=$LDFLAGS
237849e82cebSmrg      LDFLAGS="$1"
237949e82cebSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
238049e82cebSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
238149e82cebSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
238249e82cebSmrg      LDFLAGS=$ax_save_FLAGS])],
238349e82cebSmrg  [ax_save_FLAGS=$LDFLAGS
238449e82cebSmrg   LDFLAGS="$1"
238549e82cebSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
238649e82cebSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
238749e82cebSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
238849e82cebSmrg   LDFLAGS=$ax_save_FLAGS])
238949e82cebSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
239049e82cebSmrgAC_MSG_RESULT($xorg_check_linker_flags)
239149e82cebSmrgif test "x$xorg_check_linker_flags" = xyes; then
239249e82cebSmrg	m4_default([$2], :)
239349e82cebSmrgelse
239449e82cebSmrg	m4_default([$3], :)
239549e82cebSmrgfi
239649e82cebSmrg]) # XORG_CHECK_LINKER_FLAGS
239749e82cebSmrg
239849e82cebSmrg# XORG_MEMORY_CHECK_FLAGS
239949e82cebSmrg# -----------------------
240049e82cebSmrg# Minimum version: 1.16.0
240149e82cebSmrg#
240249e82cebSmrg# This macro attempts to find appropriate memory checking functionality
240349e82cebSmrg# for various platforms which unit testing code may use to catch various
240449e82cebSmrg# forms of memory allocation and access errors in testing.
240549e82cebSmrg#
240649e82cebSmrg# Interface to module:
240749e82cebSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
240849e82cebSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
240949e82cebSmrg#
241049e82cebSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
241149e82cebSmrg#
241249e82cebSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
241349e82cebSmrg
241449e82cebSmrgAC_REQUIRE([AC_CANONICAL_HOST])
241549e82cebSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
241649e82cebSmrg           [Environment variables to enable memory checking in tests])
241749e82cebSmrg
241849e82cebSmrg# Check for different types of support on different platforms
241949e82cebSmrgcase $host_os in
242049e82cebSmrg    solaris*)
242149e82cebSmrg        AC_CHECK_LIB([umem], [umem_alloc],
242249e82cebSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
242349e82cebSmrg        ;;
242449e82cebSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
242549e82cebSmrg        # both directly and inverted, so should not be 0 or 255.
242649e82cebSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
242749e82cebSmrg        ;;
242849e82cebSmrg    darwin*)
242949e82cebSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
243049e82cebSmrg        ;;
243149e82cebSmrg    *bsd*)
243249e82cebSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
243349e82cebSmrg        ;;
243449e82cebSmrgesac
243549e82cebSmrg
243649e82cebSmrg# User supplied flags override default flags
243749e82cebSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
243849e82cebSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
243949e82cebSmrgfi
244049e82cebSmrg
244149e82cebSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
244249e82cebSmrg]) # XORG_WITH_LINT
244349e82cebSmrg
24446ea72052Smrg# XORG_CHECK_MALLOC_ZERO
24456ea72052Smrg# ----------------------
2446168023feSmrg# Minimum version: 1.0.0
2447168023feSmrg#
24486ea72052Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
24496ea72052Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
24506ea72052Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
24516ea72052SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
24526ea72052SmrgAC_ARG_ENABLE(malloc0returnsnull,
2453168023feSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
24546ea72052Smrg		       [malloc(0) returns NULL (default: auto)]),
24556ea72052Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
24566ea72052Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
24576ea72052Smrg
24586ea72052SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
24596ea72052Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
246049e82cebSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
246149e82cebSmrg#include <stdlib.h>
246249e82cebSmrg],[
24636ea72052Smrg    char *m0, *r0, *c0, *p;
24646ea72052Smrg    m0 = malloc(0);
24656ea72052Smrg    p = malloc(10);
24666ea72052Smrg    r0 = realloc(p,0);
246749e82cebSmrg    c0 = calloc(0,10);
246849e82cebSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
246949e82cebSmrg])],
24706ea72052Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2471168023feSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
2472168023feSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
24736ea72052Smrgfi
24746ea72052SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
24756ea72052Smrg
24766ea72052Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
24776ea72052Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
24786ea72052Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
24796ea72052Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
24806ea72052Smrgelse
24816ea72052Smrg	MALLOC_ZERO_CFLAGS=""
24826ea72052Smrg	XMALLOC_ZERO_CFLAGS=""
24836ea72052Smrg	XTMALLOC_ZERO_CFLAGS=""
24846ea72052Smrgfi
24856ea72052Smrg
24866ea72052SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
24876ea72052SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
24886ea72052SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
24896ea72052Smrg]) # XORG_CHECK_MALLOC_ZERO
24906ea72052Smrg
2491168023feSmrg# XORG_WITH_LINT()
2492168023feSmrg# ----------------
2493168023feSmrg# Minimum version: 1.1.0
2494168023feSmrg#
2495168023feSmrg# This macro enables the use of a tool that flags some suspicious and
2496168023feSmrg# non-portable constructs (likely to be bugs) in C language source code.
2497168023feSmrg# It will attempt to locate the tool and use appropriate options.
2498168023feSmrg# There are various lint type tools on different platforms.
2499168023feSmrg#
2500168023feSmrg# Interface to module:
2501168023feSmrg# LINT:		returns the path to the tool found on the platform
2502168023feSmrg#		or the value set to LINT on the configure cmd line
2503168023feSmrg#		also an Automake conditional
2504168023feSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2505168023feSmrg#
2506168023feSmrg# --with-lint:	'yes' user instructs the module to use lint
2507168023feSmrg#		'no' user instructs the module not to use lint (default)
2508168023feSmrg#
2509168023feSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2510168023feSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2511168023feSmrg#
2512168023feSmrgAC_DEFUN([XORG_WITH_LINT],[
2513168023feSmrg
2514168023feSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2515168023feSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2516168023feSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2517168023feSmrg		[Use a lint-style source code checker (default: disabled)])],
2518168023feSmrg		[use_lint=$withval], [use_lint=no])
2519168023feSmrg
2520168023feSmrg# Obtain platform specific info like program name and options
2521168023feSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2522168023feSmrgcase $host_os in
2523168023feSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2524168023feSmrg	lint_name=splint
2525168023feSmrg	lint_options="-badflag"
2526168023feSmrg	;;
2527168023feSmrg  *freebsd* | *netbsd*)
2528168023feSmrg	lint_name=lint
2529168023feSmrg	lint_options="-u -b"
2530168023feSmrg	;;
2531168023feSmrg  *solaris*)
2532168023feSmrg	lint_name=lint
2533168023feSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2534168023feSmrg	;;
2535168023feSmrgesac
2536168023feSmrg
2537168023feSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2538168023feSmrgif test "x$use_lint" = x"yes" ; then
2539168023feSmrg   AC_PATH_PROG([LINT], [$lint_name])
2540168023feSmrg   if test "x$LINT" = "x"; then
2541168023feSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2542168023feSmrg   fi
2543168023feSmrgelif test "x$use_lint" = x"no" ; then
2544168023feSmrg   if test "x$LINT" != "x"; then
2545168023feSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2546168023feSmrg   fi
2547168023feSmrgelse
2548168023feSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2549168023feSmrgfi
2550168023feSmrg
2551168023feSmrg# User supplied flags override default flags
2552168023feSmrgif test "x$LINT_FLAGS" != "x"; then
2553168023feSmrg   lint_options=$LINT_FLAGS
2554168023feSmrgfi
2555168023feSmrg
2556168023feSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2557168023feSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2558168023feSmrg
2559168023feSmrg]) # XORG_WITH_LINT
2560168023feSmrg
2561168023feSmrg# XORG_LINT_LIBRARY(LIBNAME)
2562168023feSmrg# --------------------------
2563168023feSmrg# Minimum version: 1.1.0
2564168023feSmrg#
2565168023feSmrg# Sets up flags for building lint libraries for checking programs that call
2566168023feSmrg# functions in the library.
2567168023feSmrg#
2568168023feSmrg# Interface to module:
2569168023feSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2570168023feSmrg# MAKE_LINT_LIB		- Automake conditional
2571168023feSmrg#
2572168023feSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2573168023feSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2574168023feSmrg
2575168023feSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2576168023feSmrgAC_REQUIRE([XORG_WITH_LINT])
2577168023feSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2578168023feSmrg	[Create lint library (default: disabled)])],
2579168023feSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2580168023feSmrg
2581168023feSmrgif test "x$make_lint_lib" = x"yes" ; then
2582168023feSmrg   LINTLIB=llib-l$1.ln
2583168023feSmrg   if test "x$LINT" = "x"; then
2584168023feSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2585168023feSmrg   fi
2586168023feSmrgelif test "x$make_lint_lib" != x"no" ; then
2587168023feSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2588168023feSmrgfi
2589168023feSmrg
2590168023feSmrgAC_SUBST(LINTLIB)
2591168023feSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2592168023feSmrg
2593168023feSmrg]) # XORG_LINT_LIBRARY
2594168023feSmrg
259549e82cebSmrg# XORG_COMPILER_BRAND
259649e82cebSmrg# -------------------
259749e82cebSmrg# Minimum version: 1.14.0
259849e82cebSmrg#
259949e82cebSmrg# Checks for various brands of compilers and sets flags as appropriate:
260049e82cebSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
260149e82cebSmrg#   clang compiler - sets CLANGCC to "yes"
260249e82cebSmrg#   Intel compiler - sets INTELCC to "yes"
260349e82cebSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
260449e82cebSmrg#
260549e82cebSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
260649e82cebSmrgAC_REQUIRE([AC_PROG_CC_C99])
260749e82cebSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
260849e82cebSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
260949e82cebSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
261049e82cebSmrg]) # XORG_COMPILER_BRAND
261149e82cebSmrg
261249e82cebSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
261349e82cebSmrg# ---------------
261449e82cebSmrg# Minimum version: 1.16.0
261549e82cebSmrg#
261649e82cebSmrg# Test if the compiler works when passed the given flag as a command line argument.
261749e82cebSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
261849e82cebSmrg# next flag in the list until there are no more options.
261949e82cebSmrg#
262049e82cebSmrg# Note that this does not guarantee that the compiler supports the flag as some
262149e82cebSmrg# compilers will simply ignore arguments that they do not understand, but we do
262249e82cebSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
262349e82cebSmrg# -Werror=unused-command-line-argument
262449e82cebSmrg#
262549e82cebSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
262649e82cebSmrgAC_REQUIRE([AC_PROG_CC_C99])
262749e82cebSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
262849e82cebSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
262949e82cebSmrg
263049e82cebSmrgxorg_testset_save_CFLAGS="$CFLAGS"
263149e82cebSmrg
263249e82cebSmrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
263349e82cebSmrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
263449e82cebSmrg	AC_CACHE_CHECK([if $CC supports -Werror=unknown-warning-option],
263549e82cebSmrg			xorg_cv_cc_flag_unknown_warning_option,
263649e82cebSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
263749e82cebSmrg					  [xorg_cv_cc_flag_unknown_warning_option=yes],
263849e82cebSmrg					  [xorg_cv_cc_flag_unknown_warning_option=no]))
263949e82cebSmrg	xorg_testset_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option
264049e82cebSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
264149e82cebSmrgfi
264249e82cebSmrg
264349e82cebSmrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
264449e82cebSmrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
264549e82cebSmrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
264649e82cebSmrg	fi
264749e82cebSmrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
264849e82cebSmrg	AC_CACHE_CHECK([if $CC supports -Werror=unused-command-line-argument],
264949e82cebSmrg			xorg_cv_cc_flag_unused_command_line_argument,
265049e82cebSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
265149e82cebSmrg					  [xorg_cv_cc_flag_unused_command_line_argument=yes],
265249e82cebSmrg					  [xorg_cv_cc_flag_unused_command_line_argument=no]))
265349e82cebSmrg	xorg_testset_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument
265449e82cebSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
265549e82cebSmrgfi
265649e82cebSmrg
265749e82cebSmrgfound="no"
265849e82cebSmrgm4_foreach([flag], m4_cdr($@), [
265949e82cebSmrg	if test $found = "no" ; then
266049e82cebSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
266149e82cebSmrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
266249e82cebSmrg		fi
266349e82cebSmrg
266449e82cebSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
266549e82cebSmrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
266649e82cebSmrg		fi
266749e82cebSmrg
266849e82cebSmrg		CFLAGS="$CFLAGS ]flag["
266949e82cebSmrg
267049e82cebSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
267149e82cebSmrg		AC_MSG_CHECKING([if $CC supports ]flag[])
267249e82cebSmrg		cacheid=`AS_ECHO_N([xorg_cv_cc_flag_]flag[])`
267349e82cebSmrg		AC_CACHE_VAL(AS_TR_SH($cacheid),
267449e82cebSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
267549e82cebSmrg					     [eval AS_TR_SH($cacheid)=yes],
267649e82cebSmrg					     [eval AS_TR_SH($cacheid)=no])])
267749e82cebSmrg
267849e82cebSmrg		CFLAGS="$xorg_testset_save_CFLAGS"
267949e82cebSmrg
268049e82cebSmrg		eval supported=$AS_TR_SH($cacheid)
268149e82cebSmrg		AC_MSG_RESULT([$supported])
268249e82cebSmrg		if test "$supported" = "yes" ; then
268349e82cebSmrg			$1="$$1 ]flag["
268449e82cebSmrg			found="yes"
268549e82cebSmrg		fi
268649e82cebSmrg	fi
268749e82cebSmrg])
268849e82cebSmrg]) # XORG_TESTSET_CFLAG
268949e82cebSmrg
269049e82cebSmrg# XORG_COMPILER_FLAGS
269149e82cebSmrg# ---------------
269249e82cebSmrg# Minimum version: 1.16.0
269349e82cebSmrg#
269449e82cebSmrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
269549e82cebSmrg# by the selected compiler which do NOT alter the generated code.  These
269649e82cebSmrg# arguments will cause the compiler to print various warnings during
269749e82cebSmrg# compilation AND turn a conservative set of warnings into errors.
269849e82cebSmrg#
269949e82cebSmrg# The set of flags supported by BASE_CFLAGS will grow in future
270049e82cebSmrg# versions of util-macros as options are added to new compilers.
270149e82cebSmrg#
270249e82cebSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
270349e82cebSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
270449e82cebSmrg
270549e82cebSmrgAC_ARG_ENABLE(selective-werror,
270649e82cebSmrg              AS_HELP_STRING([--disable-selective-werror],
270749e82cebSmrg                             [Turn off selective compiler errors. (default: enabled)]),
270849e82cebSmrg              [SELECTIVE_WERROR=$enableval],
270949e82cebSmrg              [SELECTIVE_WERROR=yes])
271049e82cebSmrg
271149e82cebSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
271249e82cebSmrgif test "x$SUNCC" = "xyes"; then
271349e82cebSmrg    BASE_CFLAGS="-v"
271449e82cebSmrgelse
271549e82cebSmrg    BASE_CFLAGS=""
271649e82cebSmrgfi
271749e82cebSmrg
271849e82cebSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
271949e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
272049e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
272149e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
272249e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
272349e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
272449e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
272549e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
272649e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
272749e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
272849e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
272949e82cebSmrg
273049e82cebSmrg# This chunk adds additional warnings that could catch undesired effects.
273149e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
273249e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
273349e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
273449e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
273549e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
273649e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
273749e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
273849e82cebSmrg
273949e82cebSmrg# These are currently disabled because they are noisy.  They will be enabled
274049e82cebSmrg# in the future once the codebase is sufficiently modernized to silence
274149e82cebSmrg# them.  For now, I don't want them to drown out the other warnings.
274249e82cebSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
274349e82cebSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
274449e82cebSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
274549e82cebSmrg
274649e82cebSmrg# Turn some warnings into errors, so we don't accidently get successful builds
274749e82cebSmrg# when there are problems that should be fixed.
274849e82cebSmrg
274949e82cebSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
275049e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
275149e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
275249e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
275349e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
275449e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
275549e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
275649e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
275749e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
275849e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
275949e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
276049e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
276149e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
276249e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
276349e82cebSmrgelse
276449e82cebSmrgAC_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])
276549e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
276649e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
276749e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
276849e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
276949e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
277049e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
277149e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
277249e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
277349e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
277449e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
277549e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
277649e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
277749e82cebSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
277849e82cebSmrgfi
277949e82cebSmrg
278049e82cebSmrgAC_SUBST([BASE_CFLAGS])
278149e82cebSmrg]) # XORG_COMPILER_FLAGS
278249e82cebSmrg
2783168023feSmrg# XORG_CWARNFLAGS
2784168023feSmrg# ---------------
2785168023feSmrg# Minimum version: 1.2.0
278649e82cebSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2787168023feSmrg#
2788168023feSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2789168023feSmrg#
279049e82cebSmrg# This function is deprecated because it defines -fno-strict-aliasing
279149e82cebSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
279249e82cebSmrg# is needed, then it should be added explicitly in the module when
279349e82cebSmrg# it is updated to use BASE_CFLAGS.
279449e82cebSmrg#
2795168023feSmrgAC_DEFUN([XORG_CWARNFLAGS], [
279649e82cebSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
279749e82cebSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
279849e82cebSmrgCWARNFLAGS="$BASE_CFLAGS"
2799168023feSmrgif  test "x$GCC" = xyes ; then
280049e82cebSmrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2801168023feSmrgfi
2802168023feSmrgAC_SUBST(CWARNFLAGS)
2803168023feSmrg]) # XORG_CWARNFLAGS
2804168023feSmrg
2805168023feSmrg# XORG_STRICT_OPTION
2806168023feSmrg# -----------------------
2807168023feSmrg# Minimum version: 1.3.0
2808168023feSmrg#
280949e82cebSmrg# Add configure option to enable strict compilation flags, such as treating
281049e82cebSmrg# warnings as fatal errors.
281149e82cebSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
281249e82cebSmrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
281349e82cebSmrg#
281449e82cebSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
281549e82cebSmrg# when strict compilation is unconditionally desired.
2816168023feSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2817168023feSmrgAC_REQUIRE([XORG_CWARNFLAGS])
281849e82cebSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2819168023feSmrg
2820168023feSmrgAC_ARG_ENABLE(strict-compilation,
2821168023feSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2822168023feSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2823168023feSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
282449e82cebSmrg
282549e82cebSmrgSTRICT_CFLAGS=""
282649e82cebSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
282749e82cebSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
282849e82cebSmrg
282949e82cebSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
283049e82cebSmrg# activate it with -Werror, so we add it here explicitly.
283149e82cebSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
283249e82cebSmrg
2833168023feSmrgif test "x$STRICT_COMPILE" = "xyes"; then
283449e82cebSmrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
283549e82cebSmrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2836168023feSmrgfi
283749e82cebSmrgAC_SUBST([STRICT_CFLAGS])
283849e82cebSmrgAC_SUBST([BASE_CFLAGS])
2839168023feSmrgAC_SUBST([CWARNFLAGS])
2840168023feSmrg]) # XORG_STRICT_OPTION
2841168023feSmrg
2842168023feSmrg# XORG_DEFAULT_OPTIONS
2843168023feSmrg# --------------------
2844168023feSmrg# Minimum version: 1.3.0
2845168023feSmrg#
2846168023feSmrg# Defines default options for X.Org modules.
2847168023feSmrg#
2848168023feSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2849168023feSmrgAC_REQUIRE([AC_PROG_INSTALL])
285049e82cebSmrgXORG_COMPILER_FLAGS
2851168023feSmrgXORG_CWARNFLAGS
2852168023feSmrgXORG_STRICT_OPTION
2853168023feSmrgXORG_RELEASE_VERSION
2854168023feSmrgXORG_CHANGELOG
2855168023feSmrgXORG_INSTALL
2856168023feSmrgXORG_MANPAGE_SECTIONS
2857168023feSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2858168023feSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2859168023feSmrg]) # XORG_DEFAULT_OPTIONS
2860168023feSmrg
2861168023feSmrg# XORG_INSTALL()
2862168023feSmrg# ----------------
2863168023feSmrg# Minimum version: 1.4.0
2864168023feSmrg#
2865168023feSmrg# Defines the variable INSTALL_CMD as the command to copy
2866168023feSmrg# INSTALL from $prefix/share/util-macros.
2867168023feSmrg#
2868168023feSmrgAC_DEFUN([XORG_INSTALL], [
2869168023feSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2870168023feSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2871168023feSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2872168023feSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2873168023feSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2874168023feSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2875168023feSmrgAC_SUBST([INSTALL_CMD])
2876168023feSmrg]) # XORG_INSTALL
28776ea72052Smrgdnl Copyright 2005 Red Hat, Inc
28786ea72052Smrgdnl
28796ea72052Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
28806ea72052Smrgdnl documentation for any purpose is hereby granted without fee, provided that
28816ea72052Smrgdnl the above copyright notice appear in all copies and that both that
28826ea72052Smrgdnl copyright notice and this permission notice appear in supporting
28836ea72052Smrgdnl documentation.
28846ea72052Smrgdnl
28856ea72052Smrgdnl The above copyright notice and this permission notice shall be included
28866ea72052Smrgdnl in all copies or substantial portions of the Software.
28876ea72052Smrgdnl
28886ea72052Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
28896ea72052Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28906ea72052Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28916ea72052Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
28926ea72052Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28936ea72052Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28946ea72052Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
28956ea72052Smrgdnl
28966ea72052Smrgdnl Except as contained in this notice, the name of the copyright holders shall
28976ea72052Smrgdnl not be used in advertising or otherwise to promote the sale, use or
28986ea72052Smrgdnl other dealings in this Software without prior written authorization
28996ea72052Smrgdnl from the copyright holders.
29006ea72052Smrgdnl
29016ea72052Smrg
29026ea72052Smrg# XORG_RELEASE_VERSION
29036ea72052Smrg# --------------------
2904168023feSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
29056ea72052Smrg 
29066ea72052SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2907168023feSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2908168023feSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2909168023feSmrg		[Major version of this package])
2910168023feSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2911168023feSmrg	if test "x$PVM" = "x"; then
2912168023feSmrg		PVM="0"
29136ea72052Smrg	fi
2914168023feSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2915168023feSmrg		[$PVM],
2916168023feSmrg		[Minor version of this package])
2917168023feSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2918168023feSmrg	if test "x$PVP" = "x"; then
2919168023feSmrg		PVP="0"
2920168023feSmrg	fi
2921168023feSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2922168023feSmrg		[$PVP],
2923168023feSmrg		[Patch version of this package])
29246ea72052Smrg])
29256ea72052Smrg
2926168023feSmrg# XORG_CHANGELOG()
2927168023feSmrg# ----------------
2928168023feSmrg# Minimum version: 1.2.0
2929168023feSmrg#
2930168023feSmrg# Defines the variable CHANGELOG_CMD as the command to generate
2931168023feSmrg# ChangeLog from git.
2932168023feSmrg#
2933168023feSmrg#
2934168023feSmrgAC_DEFUN([XORG_CHANGELOG], [
2935168023feSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2936168023feSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2937168023feSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2938168023feSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2939168023feSmrgAC_SUBST([CHANGELOG_CMD])
2940168023feSmrg]) # XORG_CHANGELOG
2941168023feSmrg
2942