aclocal.m4 revision 475c125c
1475c125cSmrg# generated automatically by aclocal 1.10 -*- Autoconf -*-
205b261ecSmrg
305b261ecSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4475c125cSmrg# 2005, 2006  Free Software Foundation, Inc.
505b261ecSmrg# This file is free software; the Free Software Foundation
605b261ecSmrg# gives unlimited permission to copy and/or distribute it,
705b261ecSmrg# with or without modifications, as long as this notice is preserved.
805b261ecSmrg
905b261ecSmrg# This program is distributed in the hope that it will be useful,
1005b261ecSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1105b261ecSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1205b261ecSmrg# PARTICULAR PURPOSE.
1305b261ecSmrg
14475c125cSmrgm4_if(m4_PACKAGE_VERSION, [2.61],,
15475c125cSmrg[m4_fatal([this file was generated for autoconf 2.61.
16475c125cSmrgYou have another version of autoconf.  If you want to use that,
17475c125cSmrgyou should regenerate the build system entirely.], [63])])
1805b261ecSmrg
19475c125cSmrg# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
204642e01fSmrg#
216747b715Smrg# This file is free software; the Free Software Foundation
226747b715Smrg# gives unlimited permission to copy and/or distribute it,
236747b715Smrg# with or without modifications, as long as this notice is preserved.
244642e01fSmrg
256747b715Smrg# AM_AUTOMAKE_VERSION(VERSION)
266747b715Smrg# ----------------------------
276747b715Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
286747b715Smrg# generated from the m4 files accompanying Automake X.Y.
296747b715Smrg# (This private macro should not be called outside this file.)
306747b715SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
31475c125cSmrg[am__api_version='1.10'
326747b715Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
336747b715Smrgdnl require some minimum version.  Point them to the right macro.
34475c125cSmrgm4_if([$1], [1.10], [],
356747b715Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
364642e01fSmrg])
3705b261ecSmrg
386747b715Smrg# _AM_AUTOCONF_VERSION(VERSION)
396747b715Smrg# -----------------------------
406747b715Smrg# aclocal traces this macro to find the Autoconf version.
416747b715Smrg# This is a private macro too.  Using m4_define simplifies
426747b715Smrg# the logic in aclocal, which can simply ignore this definition.
436747b715Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4405b261ecSmrg
456747b715Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
466747b715Smrg# -------------------------------
476747b715Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
48475c125cSmrg# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
496747b715SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
50475c125cSmrg[AM_AUTOMAKE_VERSION([1.10])dnl
51475c125cSmrg_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
5205b261ecSmrg
536747b715Smrg# Figure out how to run the assembler.                      -*- Autoconf -*-
5405b261ecSmrg
556747b715Smrg# Copyright (C) 2001, 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
566747b715Smrg#
576747b715Smrg# This file is free software; the Free Software Foundation
586747b715Smrg# gives unlimited permission to copy and/or distribute it,
596747b715Smrg# with or without modifications, as long as this notice is preserved.
6005b261ecSmrg
616747b715Smrg# serial 5
626747b715Smrg
636747b715Smrg# AM_PROG_AS
646747b715Smrg# ----------
656747b715SmrgAC_DEFUN([AM_PROG_AS],
666747b715Smrg[# By default we simply use the C compiler to build assembly code.
676747b715SmrgAC_REQUIRE([AC_PROG_CC])
686747b715Smrgtest "${CCAS+set}" = set || CCAS=$CC
696747b715Smrgtest "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
706747b715SmrgAC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
716747b715SmrgAC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
726747b715Smrg_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
734642e01fSmrg])
744642e01fSmrg
756747b715Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
764642e01fSmrg
776747b715Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
786747b715Smrg#
796747b715Smrg# This file is free software; the Free Software Foundation
806747b715Smrg# gives unlimited permission to copy and/or distribute it,
816747b715Smrg# with or without modifications, as long as this notice is preserved.
824642e01fSmrg
836747b715Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
846747b715Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
856747b715Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
866747b715Smrg#
876747b715Smrg# Of course, Automake must honor this variable whenever it calls a
886747b715Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
896747b715Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
906747b715Smrg# depending on how configure is run.  This is pretty annoying, since
916747b715Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
926747b715Smrg# source directory, any form will work fine, but in subdirectories a
936747b715Smrg# relative path needs to be adjusted first.
946747b715Smrg#
956747b715Smrg# $ac_aux_dir/missing
966747b715Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
976747b715Smrg# $top_srcdir/$ac_aux_dir/missing
986747b715Smrg#    fails if $ac_aux_dir is absolute,
996747b715Smrg#    fails when called from a subdirectory in a VPATH build with
1006747b715Smrg#          a relative $ac_aux_dir
1016747b715Smrg#
1026747b715Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
1036747b715Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
1046747b715Smrg# harmless because $srcdir is `.', but things will broke when you
1056747b715Smrg# start a VPATH build or use an absolute $srcdir.
1066747b715Smrg#
1076747b715Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
1086747b715Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
1096747b715Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
1106747b715Smrg# and then we would define $MISSING as
1116747b715Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
1126747b715Smrg# This will work as long as MISSING is not called from configure, because
1136747b715Smrg# unfortunately $(top_srcdir) has no meaning in configure.
1146747b715Smrg# However there are other variables, like CC, which are often used in
1156747b715Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1166747b715Smrg#
1176747b715Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1186747b715Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1196747b715Smrg# configured tree to be moved without reconfiguration.
1204642e01fSmrg
1216747b715SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1226747b715Smrg[dnl Rely on autoconf to set up CDPATH properly.
1236747b715SmrgAC_PREREQ([2.50])dnl
1246747b715Smrg# expand $ac_aux_dir to an absolute path
1256747b715Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
1266747b715Smrg])
12705b261ecSmrg
1286747b715Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
12905b261ecSmrg
130475c125cSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
1316747b715Smrg# Free Software Foundation, Inc.
1326747b715Smrg#
1336747b715Smrg# This file is free software; the Free Software Foundation
1346747b715Smrg# gives unlimited permission to copy and/or distribute it,
1356747b715Smrg# with or without modifications, as long as this notice is preserved.
13605b261ecSmrg
137475c125cSmrg# serial 8
13805b261ecSmrg
1396747b715Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1406747b715Smrg# -------------------------------------
1416747b715Smrg# Define a conditional.
1426747b715SmrgAC_DEFUN([AM_CONDITIONAL],
1436747b715Smrg[AC_PREREQ(2.52)dnl
1446747b715Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1456747b715Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1466747b715SmrgAC_SUBST([$1_TRUE])dnl
1476747b715SmrgAC_SUBST([$1_FALSE])dnl
1486747b715Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1496747b715Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1506747b715Smrgif $2; then
1516747b715Smrg  $1_TRUE=
1526747b715Smrg  $1_FALSE='#'
1536747b715Smrgelse
1546747b715Smrg  $1_TRUE='#'
1556747b715Smrg  $1_FALSE=
1566747b715Smrgfi
1576747b715SmrgAC_CONFIG_COMMANDS_PRE(
1586747b715Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1596747b715Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1606747b715SmrgUsually this means the macro was only invoked conditionally.]])
1616747b715Smrgfi])])
16205b261ecSmrg
163475c125cSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
1646747b715Smrg# Free Software Foundation, Inc.
1656747b715Smrg#
1666747b715Smrg# This file is free software; the Free Software Foundation
1676747b715Smrg# gives unlimited permission to copy and/or distribute it,
1686747b715Smrg# with or without modifications, as long as this notice is preserved.
1694642e01fSmrg
170475c125cSmrg# serial 9
1714642e01fSmrg
1726747b715Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1736747b715Smrg# written in clear, in which case automake, when reading aclocal.m4,
1746747b715Smrg# will think it sees a *use*, and therefore will trigger all it's
1756747b715Smrg# C support machinery.  Also note that it means that autoscan, seeing
1766747b715Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1774642e01fSmrg
1784642e01fSmrg
1796747b715Smrg# _AM_DEPENDENCIES(NAME)
1804642e01fSmrg# ----------------------
1816747b715Smrg# See how the compiler implements dependency checking.
1826747b715Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1836747b715Smrg# We try a few techniques and use that to set a single cache variable.
1846747b715Smrg#
1856747b715Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1866747b715Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1876747b715Smrg# dependency, and given that the user is not expected to run this macro,
1886747b715Smrg# just rely on AC_PROG_CC.
1896747b715SmrgAC_DEFUN([_AM_DEPENDENCIES],
1906747b715Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1916747b715SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1926747b715SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1936747b715SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1944642e01fSmrg
1956747b715Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1966747b715Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1976747b715Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1986747b715Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1996747b715Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2006747b715Smrg                   [depcc="$$1"   am_compiler_list=])
20105b261ecSmrg
2026747b715SmrgAC_CACHE_CHECK([dependency style of $depcc],
2036747b715Smrg               [am_cv_$1_dependencies_compiler_type],
2046747b715Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2056747b715Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
2066747b715Smrg  # making bogus files that we don't know about and never remove.  For
2076747b715Smrg  # instance it was reported that on HP-UX the gcc test will end up
2086747b715Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
2096747b715Smrg  # in D'.
2106747b715Smrg  mkdir conftest.dir
2116747b715Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2126747b715Smrg  # using a relative directory.
2136747b715Smrg  cp "$am_depcomp" conftest.dir
2146747b715Smrg  cd conftest.dir
2156747b715Smrg  # We will build objects and dependencies in a subdirectory because
2166747b715Smrg  # it helps to detect inapplicable dependency modes.  For instance
2176747b715Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2186747b715Smrg  # side effect of compilation, but ICC will put the dependencies in
2196747b715Smrg  # the current directory while Tru64 will put them in the object
2206747b715Smrg  # directory.
2216747b715Smrg  mkdir sub
22205b261ecSmrg
2236747b715Smrg  am_cv_$1_dependencies_compiler_type=none
2246747b715Smrg  if test "$am_compiler_list" = ""; then
2256747b715Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
22605b261ecSmrg  fi
2276747b715Smrg  for depmode in $am_compiler_list; do
2286747b715Smrg    # Setup a source with many dependencies, because some compilers
2296747b715Smrg    # like to wrap large dependency lists on column 80 (with \), and
2306747b715Smrg    # we should not choose a depcomp mode which is confused by this.
2316747b715Smrg    #
2326747b715Smrg    # We need to recreate these files for each test, as the compiler may
2336747b715Smrg    # overwrite some of them when testing with obscure command lines.
2346747b715Smrg    # This happens at least with the AIX C compiler.
2356747b715Smrg    : > sub/conftest.c
2366747b715Smrg    for i in 1 2 3 4 5 6; do
2376747b715Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2386747b715Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2396747b715Smrg      # Solaris 8's {/usr,}/bin/sh.
2406747b715Smrg      touch sub/conftst$i.h
2416747b715Smrg    done
2426747b715Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24305b261ecSmrg
2446747b715Smrg    case $depmode in
2456747b715Smrg    nosideeffect)
2466747b715Smrg      # after this tag, mechanisms are not by side-effect, so they'll
2476747b715Smrg      # only be used when explicitly requested
2486747b715Smrg      if test "x$enable_dependency_tracking" = xyes; then
2496747b715Smrg	continue
2506747b715Smrg      else
2516747b715Smrg	break
2526747b715Smrg      fi
2536747b715Smrg      ;;
2546747b715Smrg    none) break ;;
2556747b715Smrg    esac
256475c125cSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
257475c125cSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
258475c125cSmrg    # handle `-M -o', and we need to detect this.
2596747b715Smrg    if depmode=$depmode \
260475c125cSmrg       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
2616747b715Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
262475c125cSmrg       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
2636747b715Smrg         >/dev/null 2>conftest.err &&
2646747b715Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2656747b715Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
266475c125cSmrg       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
2676747b715Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2686747b715Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2696747b715Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2706747b715Smrg      # that says an option was ignored or not supported.
2716747b715Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2726747b715Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2736747b715Smrg      # The diagnosis changed in icc 8.0:
2746747b715Smrg      #   icc: Command line remark: option '-MP' not supported
2756747b715Smrg      if (grep 'ignoring option' conftest.err ||
2766747b715Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2776747b715Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2786747b715Smrg        break
2796747b715Smrg      fi
2806747b715Smrg    fi
2816747b715Smrg  done
28205b261ecSmrg
2836747b715Smrg  cd ..
2846747b715Smrg  rm -rf conftest.dir
2856747b715Smrgelse
2866747b715Smrg  am_cv_$1_dependencies_compiler_type=none
2876747b715Smrgfi
2886747b715Smrg])
2896747b715SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2906747b715SmrgAM_CONDITIONAL([am__fastdep$1], [
2916747b715Smrg  test "x$enable_dependency_tracking" != xno \
2926747b715Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2936747b715Smrg])
29405b261ecSmrg
29505b261ecSmrg
2966747b715Smrg# AM_SET_DEPDIR
2976747b715Smrg# -------------
2986747b715Smrg# Choose a directory name for dependency files.
2996747b715Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3006747b715SmrgAC_DEFUN([AM_SET_DEPDIR],
3016747b715Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3026747b715SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3036747b715Smrg])
30405b261ecSmrg
30505b261ecSmrg
3066747b715Smrg# AM_DEP_TRACK
3076747b715Smrg# ------------
3086747b715SmrgAC_DEFUN([AM_DEP_TRACK],
3096747b715Smrg[AC_ARG_ENABLE(dependency-tracking,
3106747b715Smrg[  --disable-dependency-tracking  speeds up one-time build
3116747b715Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
3126747b715Smrgif test "x$enable_dependency_tracking" != xno; then
3136747b715Smrg  am_depcomp="$ac_aux_dir/depcomp"
3146747b715Smrg  AMDEPBACKSLASH='\'
3156747b715Smrgfi
3166747b715SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3176747b715SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3186747b715Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3196747b715Smrg])
32005b261ecSmrg
3216747b715Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
32205b261ecSmrg
323475c125cSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
3246747b715Smrg# Free Software Foundation, Inc.
3256747b715Smrg#
3266747b715Smrg# This file is free software; the Free Software Foundation
3276747b715Smrg# gives unlimited permission to copy and/or distribute it,
3286747b715Smrg# with or without modifications, as long as this notice is preserved.
32905b261ecSmrg
330475c125cSmrg#serial 3
33105b261ecSmrg
3326747b715Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3336747b715Smrg# ------------------------------
3346747b715SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
335475c125cSmrg[for mf in $CONFIG_FILES; do
336475c125cSmrg  # Strip MF so we end up with the name of the file.
337475c125cSmrg  mf=`echo "$mf" | sed -e 's/:.*$//'`
338475c125cSmrg  # Check whether this is an Automake generated Makefile or not.
339475c125cSmrg  # We used to match only the files named `Makefile.in', but
340475c125cSmrg  # some people rename them; so instead we look at the file content.
341475c125cSmrg  # Grep'ing the first line is not enough: some people post-process
342475c125cSmrg  # each Makefile.in and add a new line on top of each file to say so.
343475c125cSmrg  # Grep'ing the whole file is not good either: AIX grep has a line
344475c125cSmrg  # limit of 2048, but all sed's we know have understand at least 4000.
345475c125cSmrg  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
346475c125cSmrg    dirpart=`AS_DIRNAME("$mf")`
347475c125cSmrg  else
348475c125cSmrg    continue
349475c125cSmrg  fi
350475c125cSmrg  # Extract the definition of DEPDIR, am__include, and am__quote
351475c125cSmrg  # from the Makefile without running `make'.
352475c125cSmrg  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
353475c125cSmrg  test -z "$DEPDIR" && continue
354475c125cSmrg  am__include=`sed -n 's/^am__include = //p' < "$mf"`
355475c125cSmrg  test -z "am__include" && continue
356475c125cSmrg  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
357475c125cSmrg  # When using ansi2knr, U may be empty or an underscore; expand it
358475c125cSmrg  U=`sed -n 's/^U = //p' < "$mf"`
359475c125cSmrg  # Find all dependency output files, they are included files with
360475c125cSmrg  # $(DEPDIR) in their names.  We invoke sed twice because it is the
361475c125cSmrg  # simplest approach to changing $(DEPDIR) to its actual value in the
362475c125cSmrg  # expansion.
363475c125cSmrg  for file in `sed -n "
364475c125cSmrg    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
365475c125cSmrg       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
366475c125cSmrg    # Make sure the directory exists.
367475c125cSmrg    test -f "$dirpart/$file" && continue
368475c125cSmrg    fdir=`AS_DIRNAME(["$file"])`
369475c125cSmrg    AS_MKDIR_P([$dirpart/$fdir])
370475c125cSmrg    # echo "creating $dirpart/$file"
371475c125cSmrg    echo '# dummy' > "$dirpart/$file"
3726747b715Smrg  done
373475c125cSmrgdone
3746747b715Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
37505b261ecSmrg
37605b261ecSmrg
3776747b715Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3786747b715Smrg# -----------------------------
3796747b715Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3806747b715Smrg#
3816747b715Smrg# This code is only required when automatic dependency tracking
3826747b715Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
3836747b715Smrg# need in order to bootstrap the dependency handling code.
3846747b715SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3856747b715Smrg[AC_CONFIG_COMMANDS([depfiles],
3866747b715Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3876747b715Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
3886747b715Smrg])
3894642e01fSmrg
3906747b715Smrg# Do all the work for Automake.                             -*- Autoconf -*-
3914642e01fSmrg
3926747b715Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
393475c125cSmrg# 2005, 2006 Free Software Foundation, Inc.
3946747b715Smrg#
3956747b715Smrg# This file is free software; the Free Software Foundation
3966747b715Smrg# gives unlimited permission to copy and/or distribute it,
3976747b715Smrg# with or without modifications, as long as this notice is preserved.
3984642e01fSmrg
399475c125cSmrg# serial 12
4004642e01fSmrg
4016747b715Smrg# This macro actually does too much.  Some checks are only needed if
4026747b715Smrg# your package does certain things.  But this isn't really a big deal.
4034642e01fSmrg
4046747b715Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4056747b715Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4066747b715Smrg# -----------------------------------------------
4076747b715Smrg# The call with PACKAGE and VERSION arguments is the old style
4086747b715Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4096747b715Smrg# and VERSION should now be passed to AC_INIT and removed from
4106747b715Smrg# the call to AM_INIT_AUTOMAKE.
4116747b715Smrg# We support both call styles for the transition.  After
4126747b715Smrg# the next Automake release, Autoconf can make the AC_INIT
4136747b715Smrg# arguments mandatory, and then we can depend on a new Autoconf
4146747b715Smrg# release and drop the old call support.
4156747b715SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
416475c125cSmrg[AC_PREREQ([2.60])dnl
4176747b715Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4186747b715Smrgdnl the ones we care about.
4196747b715Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4206747b715SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4216747b715SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4226747b715Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4236747b715Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4246747b715Smrg  # is not polluted with repeated "-I."
4256747b715Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4266747b715Smrg  # test to see if srcdir already configured
4276747b715Smrg  if test -f $srcdir/config.status; then
4286747b715Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4296747b715Smrg  fi
4306747b715Smrgfi
4314642e01fSmrg
4326747b715Smrg# test whether we have cygpath
4336747b715Smrgif test -z "$CYGPATH_W"; then
4346747b715Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4356747b715Smrg    CYGPATH_W='cygpath -w'
4366747b715Smrg  else
4376747b715Smrg    CYGPATH_W=echo
4386747b715Smrg  fi
4396747b715Smrgfi
4406747b715SmrgAC_SUBST([CYGPATH_W])
4414642e01fSmrg
4426747b715Smrg# Define the identity of the package.
4436747b715Smrgdnl Distinguish between old-style and new-style calls.
4446747b715Smrgm4_ifval([$2],
4456747b715Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4466747b715Smrg AC_SUBST([PACKAGE], [$1])dnl
4476747b715Smrg AC_SUBST([VERSION], [$2])],
4486747b715Smrg[_AM_SET_OPTIONS([$1])dnl
4496747b715Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4506747b715Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4516747b715Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4526747b715Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4536747b715Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4544642e01fSmrg
4556747b715Smrg_AM_IF_OPTION([no-define],,
4566747b715Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4576747b715Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4584642e01fSmrg
4596747b715Smrg# Some tools Automake needs.
4606747b715SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4616747b715SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4626747b715SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4636747b715SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
4646747b715SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4656747b715SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
4666747b715SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
467475c125cSmrgAM_PROG_INSTALL_SH
468475c125cSmrgAM_PROG_INSTALL_STRIP
4696747b715SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
4706747b715Smrg# We need awk for the "check" target.  The system "awk" is bad on
4716747b715Smrg# some platforms.
4726747b715SmrgAC_REQUIRE([AC_PROG_AWK])dnl
4736747b715SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
4746747b715SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
4756747b715Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
476475c125cSmrg              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
477475c125cSmrg	      		     [_AM_PROG_TAR([v7])])])
4786747b715Smrg_AM_IF_OPTION([no-dependencies],,
4796747b715Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
480475c125cSmrg                  [_AM_DEPENDENCIES(CC)],
481475c125cSmrg                  [define([AC_PROG_CC],
482475c125cSmrg                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
4836747b715SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
484475c125cSmrg                  [_AM_DEPENDENCIES(CXX)],
485475c125cSmrg                  [define([AC_PROG_CXX],
486475c125cSmrg                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
4876747b715SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
488475c125cSmrg                  [_AM_DEPENDENCIES(OBJC)],
489475c125cSmrg                  [define([AC_PROG_OBJC],
490475c125cSmrg                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
4916747b715Smrg])
4924642e01fSmrg])
4934642e01fSmrg
4944642e01fSmrg
4956747b715Smrg# When config.status generates a header, we must update the stamp-h file.
4966747b715Smrg# This file resides in the same directory as the config header
4976747b715Smrg# that is generated.  The stamp files are numbered to have different names.
4984642e01fSmrg
4996747b715Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5006747b715Smrg# loop where config.status creates the headers, so we can generate
5016747b715Smrg# our stamp files there.
5026747b715SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5036747b715Smrg[# Compute $1's index in $config_headers.
5046747b715Smrg_am_stamp_count=1
5056747b715Smrgfor _am_header in $config_headers :; do
5066747b715Smrg  case $_am_header in
507475c125cSmrg    $1 | $1:* )
5086747b715Smrg      break ;;
5096747b715Smrg    * )
5106747b715Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5116747b715Smrg  esac
5126747b715Smrgdone
513475c125cSmrgecho "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
5144642e01fSmrg
515475c125cSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
5166747b715Smrg#
5176747b715Smrg# This file is free software; the Free Software Foundation
5186747b715Smrg# gives unlimited permission to copy and/or distribute it,
5196747b715Smrg# with or without modifications, as long as this notice is preserved.
5204642e01fSmrg
5216747b715Smrg# AM_PROG_INSTALL_SH
5226747b715Smrg# ------------------
5236747b715Smrg# Define $install_sh.
5246747b715SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5256747b715Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
526475c125cSmrginstall_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
5276747b715SmrgAC_SUBST(install_sh)])
5284642e01fSmrg
5296747b715Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5306747b715Smrg#
5316747b715Smrg# This file is free software; the Free Software Foundation
5326747b715Smrg# gives unlimited permission to copy and/or distribute it,
5336747b715Smrg# with or without modifications, as long as this notice is preserved.
5344642e01fSmrg
5356747b715Smrg# serial 2
5364642e01fSmrg
5376747b715Smrg# Check whether the underlying file-system supports filenames
5386747b715Smrg# with a leading dot.  For instance MS-DOS doesn't.
5396747b715SmrgAC_DEFUN([AM_SET_LEADING_DOT],
5406747b715Smrg[rm -rf .tst 2>/dev/null
5416747b715Smrgmkdir .tst 2>/dev/null
5426747b715Smrgif test -d .tst; then
5436747b715Smrg  am__leading_dot=.
5446747b715Smrgelse
5456747b715Smrg  am__leading_dot=_
5466747b715Smrgfi
5476747b715Smrgrmdir .tst 2>/dev/null
5486747b715SmrgAC_SUBST([am__leading_dot])])
5494642e01fSmrg
5506747b715Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
5516747b715Smrg# From Jim Meyering
5524642e01fSmrg
553475c125cSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
5546747b715Smrg# Free Software Foundation, Inc.
5556747b715Smrg#
5566747b715Smrg# This file is free software; the Free Software Foundation
5576747b715Smrg# gives unlimited permission to copy and/or distribute it,
5586747b715Smrg# with or without modifications, as long as this notice is preserved.
5594642e01fSmrg
560475c125cSmrg# serial 4
5614642e01fSmrg
5626747b715SmrgAC_DEFUN([AM_MAINTAINER_MODE],
563475c125cSmrg[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
564475c125cSmrg  dnl maintainer-mode is disabled by default
565475c125cSmrg  AC_ARG_ENABLE(maintainer-mode,
566475c125cSmrg[  --enable-maintainer-mode  enable make rules and dependencies not useful
5676747b715Smrg			  (and sometimes confusing) to the casual installer],
568475c125cSmrg      USE_MAINTAINER_MODE=$enableval,
569475c125cSmrg      USE_MAINTAINER_MODE=no)
5706747b715Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
571475c125cSmrg  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
5726747b715Smrg  MAINT=$MAINTAINER_MODE_TRUE
573475c125cSmrg  AC_SUBST(MAINT)dnl
5746747b715Smrg]
5756747b715Smrg)
5764642e01fSmrg
5776747b715SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
5784642e01fSmrg
5796747b715Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
5804642e01fSmrg
581475c125cSmrg# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
5826747b715Smrg#
5836747b715Smrg# This file is free software; the Free Software Foundation
5846747b715Smrg# gives unlimited permission to copy and/or distribute it,
5856747b715Smrg# with or without modifications, as long as this notice is preserved.
5864642e01fSmrg
587475c125cSmrg# serial 3
5884642e01fSmrg
5896747b715Smrg# AM_MAKE_INCLUDE()
5906747b715Smrg# -----------------
5916747b715Smrg# Check to see how make treats includes.
5926747b715SmrgAC_DEFUN([AM_MAKE_INCLUDE],
5936747b715Smrg[am_make=${MAKE-make}
5946747b715Smrgcat > confinc << 'END'
5956747b715Smrgam__doit:
596475c125cSmrg	@echo done
5976747b715Smrg.PHONY: am__doit
5986747b715SmrgEND
5996747b715Smrg# If we don't find an include directive, just comment out the code.
6006747b715SmrgAC_MSG_CHECKING([for style of include used by $am_make])
6016747b715Smrgam__include="#"
6026747b715Smrgam__quote=
6036747b715Smrg_am_result=none
6046747b715Smrg# First try GNU make style include.
6056747b715Smrgecho "include confinc" > confmf
606475c125cSmrg# We grep out `Entering directory' and `Leaving directory'
607475c125cSmrg# messages which can occur if `w' ends up in MAKEFLAGS.
608475c125cSmrg# In particular we don't look at `^make:' because GNU make might
609475c125cSmrg# be invoked under some other name (usually "gmake"), in which
610475c125cSmrg# case it prints its new name instead of `make'.
611475c125cSmrgif test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
612475c125cSmrg   am__include=include
613475c125cSmrg   am__quote=
614475c125cSmrg   _am_result=GNU
615475c125cSmrgfi
6166747b715Smrg# Now try BSD make style include.
6176747b715Smrgif test "$am__include" = "#"; then
6186747b715Smrg   echo '.include "confinc"' > confmf
619475c125cSmrg   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
620475c125cSmrg      am__include=.include
621475c125cSmrg      am__quote="\""
622475c125cSmrg      _am_result=BSD
623475c125cSmrg   fi
6246747b715Smrgfi
6256747b715SmrgAC_SUBST([am__include])
6266747b715SmrgAC_SUBST([am__quote])
6276747b715SmrgAC_MSG_RESULT([$_am_result])
6286747b715Smrgrm -f confinc confmf
6296747b715Smrg])
6304642e01fSmrg
6316747b715Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6324642e01fSmrg
633475c125cSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
6346747b715Smrg# Free Software Foundation, Inc.
6356747b715Smrg#
6366747b715Smrg# This file is free software; the Free Software Foundation
6376747b715Smrg# gives unlimited permission to copy and/or distribute it,
6386747b715Smrg# with or without modifications, as long as this notice is preserved.
6394642e01fSmrg
640475c125cSmrg# serial 5
6414642e01fSmrg
6426747b715Smrg# AM_MISSING_PROG(NAME, PROGRAM)
6436747b715Smrg# ------------------------------
6446747b715SmrgAC_DEFUN([AM_MISSING_PROG],
6456747b715Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6466747b715Smrg$1=${$1-"${am_missing_run}$2"}
6476747b715SmrgAC_SUBST($1)])
6484642e01fSmrg
6494642e01fSmrg
6506747b715Smrg# AM_MISSING_HAS_RUN
6516747b715Smrg# ------------------
6526747b715Smrg# Define MISSING if not defined so far and test if it supports --run.
6536747b715Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
6546747b715SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
6556747b715Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6566747b715SmrgAC_REQUIRE_AUX_FILE([missing])dnl
657475c125cSmrgtest x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
6586747b715Smrg# Use eval to expand $SHELL
6596747b715Smrgif eval "$MISSING --run true"; then
6606747b715Smrg  am_missing_run="$MISSING --run "
6616747b715Smrgelse
6626747b715Smrg  am_missing_run=
6636747b715Smrg  AC_MSG_WARN([`missing' script is too old or missing])
6646747b715Smrgfi
6656747b715Smrg])
6664642e01fSmrg
6676747b715Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
6684642e01fSmrg#
6696747b715Smrg# This file is free software; the Free Software Foundation
6706747b715Smrg# gives unlimited permission to copy and/or distribute it,
6716747b715Smrg# with or without modifications, as long as this notice is preserved.
67205b261ecSmrg
6736747b715Smrg# AM_PROG_MKDIR_P
6746747b715Smrg# ---------------
6756747b715Smrg# Check for `mkdir -p'.
6766747b715SmrgAC_DEFUN([AM_PROG_MKDIR_P],
6776747b715Smrg[AC_PREREQ([2.60])dnl
6786747b715SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
6796747b715Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
6806747b715Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
6816747b715Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
6826747b715Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
6836747b715Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
6846747b715Smrgdnl adjustment using top_builddir (which is defined more often than
6856747b715Smrgdnl MKDIR_P).
6866747b715SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
6876747b715Smrgcase $mkdir_p in
6886747b715Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
6896747b715Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
6906747b715Smrgesac
6914642e01fSmrg])
6924642e01fSmrg
6936747b715Smrg# Helper functions for option handling.                     -*- Autoconf -*-
6944642e01fSmrg
695475c125cSmrg# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
6964642e01fSmrg#
6976747b715Smrg# This file is free software; the Free Software Foundation
6986747b715Smrg# gives unlimited permission to copy and/or distribute it,
6996747b715Smrg# with or without modifications, as long as this notice is preserved.
7004642e01fSmrg
701475c125cSmrg# serial 3
7024642e01fSmrg
7036747b715Smrg# _AM_MANGLE_OPTION(NAME)
7044642e01fSmrg# -----------------------
7056747b715SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7066747b715Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7074642e01fSmrg
7086747b715Smrg# _AM_SET_OPTION(NAME)
7096747b715Smrg# ------------------------------
7106747b715Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7116747b715SmrgAC_DEFUN([_AM_SET_OPTION],
7126747b715Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
7134642e01fSmrg
7146747b715Smrg# _AM_SET_OPTIONS(OPTIONS)
7156747b715Smrg# ----------------------------------
7166747b715Smrg# OPTIONS is a space-separated list of Automake options.
7176747b715SmrgAC_DEFUN([_AM_SET_OPTIONS],
718475c125cSmrg[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7194642e01fSmrg
7206747b715Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7216747b715Smrg# -------------------------------------------
7226747b715Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7236747b715SmrgAC_DEFUN([_AM_IF_OPTION],
7246747b715Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7254642e01fSmrg
7266747b715Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
7274642e01fSmrg
728475c125cSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
7296747b715Smrg# Free Software Foundation, Inc.
7306747b715Smrg#
7316747b715Smrg# This file is free software; the Free Software Foundation
7326747b715Smrg# gives unlimited permission to copy and/or distribute it,
7336747b715Smrg# with or without modifications, as long as this notice is preserved.
7344642e01fSmrg
735475c125cSmrg# serial 4
7364642e01fSmrg
7376747b715Smrg# AM_SANITY_CHECK
7386747b715Smrg# ---------------
7396747b715SmrgAC_DEFUN([AM_SANITY_CHECK],
7406747b715Smrg[AC_MSG_CHECKING([whether build environment is sane])
7416747b715Smrg# Just in case
7426747b715Smrgsleep 1
7436747b715Smrgecho timestamp > conftest.file
7446747b715Smrg# Do `set' in a subshell so we don't clobber the current shell's
7456747b715Smrg# arguments.  Must try -L first in case configure is actually a
7466747b715Smrg# symlink; some systems play weird games with the mod time of symlinks
7476747b715Smrg# (eg FreeBSD returns the mod time of the symlink's containing
7486747b715Smrg# directory).
7496747b715Smrgif (
750475c125cSmrg   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
7516747b715Smrg   if test "$[*]" = "X"; then
7526747b715Smrg      # -L didn't work.
753475c125cSmrg      set X `ls -t $srcdir/configure conftest.file`
7546747b715Smrg   fi
7556747b715Smrg   rm -f conftest.file
7566747b715Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
7576747b715Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
7584642e01fSmrg
7596747b715Smrg      # If neither matched, then we have a broken ls.  This can happen
7606747b715Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
7616747b715Smrg      # broken ls alias from the environment.  This has actually
7626747b715Smrg      # happened.  Such a system could not be considered "sane".
7636747b715Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
7646747b715Smrgalias in your environment])
7656747b715Smrg   fi
7664642e01fSmrg
7676747b715Smrg   test "$[2]" = conftest.file
7686747b715Smrg   )
7696747b715Smrgthen
7706747b715Smrg   # Ok.
7716747b715Smrg   :
7726747b715Smrgelse
7736747b715Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
7746747b715SmrgCheck your system clock])
7756747b715Smrgfi
7766747b715SmrgAC_MSG_RESULT(yes)])
7774642e01fSmrg
7786747b715Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
7796747b715Smrg#
7806747b715Smrg# This file is free software; the Free Software Foundation
7816747b715Smrg# gives unlimited permission to copy and/or distribute it,
7826747b715Smrg# with or without modifications, as long as this notice is preserved.
7834642e01fSmrg
7846747b715Smrg# AM_PROG_INSTALL_STRIP
7856747b715Smrg# ---------------------
7866747b715Smrg# One issue with vendor `install' (even GNU) is that you can't
7876747b715Smrg# specify the program used to strip binaries.  This is especially
7886747b715Smrg# annoying in cross-compiling environments, where the build's strip
7896747b715Smrg# is unlikely to handle the host's binaries.
7906747b715Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
7916747b715Smrg# always use install-sh in `make install-strip', and initialize
7926747b715Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
7936747b715SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
7946747b715Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
7956747b715Smrg# Installed binaries are usually stripped using `strip' when the user
7966747b715Smrg# run `make install-strip'.  However `strip' might not be the right
7976747b715Smrg# tool to use in cross-compilation environments, therefore Automake
7986747b715Smrg# will honor the `STRIP' environment variable to overrule this program.
7996747b715Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
8006747b715Smrgif test "$cross_compiling" != no; then
8016747b715Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
8026747b715Smrgfi
8036747b715SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
8046747b715SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
8054642e01fSmrg
806475c125cSmrg# Copyright (C) 2006  Free Software Foundation, Inc.
8076747b715Smrg#
8086747b715Smrg# This file is free software; the Free Software Foundation
8096747b715Smrg# gives unlimited permission to copy and/or distribute it,
8106747b715Smrg# with or without modifications, as long as this notice is preserved.
8114642e01fSmrg
8126747b715Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
8136747b715Smrg# ---------------------------
814475c125cSmrg# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
8156747b715Smrg# This macro is traced by Automake.
8166747b715SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
8174642e01fSmrg
8186747b715Smrg# Check how to create a tarball.                            -*- Autoconf -*-
8194642e01fSmrg
8206747b715Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
8216747b715Smrg#
8226747b715Smrg# This file is free software; the Free Software Foundation
8236747b715Smrg# gives unlimited permission to copy and/or distribute it,
8246747b715Smrg# with or without modifications, as long as this notice is preserved.
8254642e01fSmrg
8266747b715Smrg# serial 2
8274642e01fSmrg
8286747b715Smrg# _AM_PROG_TAR(FORMAT)
8296747b715Smrg# --------------------
8306747b715Smrg# Check how to create a tarball in format FORMAT.
8316747b715Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
8326747b715Smrg#
8336747b715Smrg# Substitute a variable $(am__tar) that is a command
8346747b715Smrg# writing to stdout a FORMAT-tarball containing the directory
8356747b715Smrg# $tardir.
8366747b715Smrg#     tardir=directory && $(am__tar) > result.tar
8376747b715Smrg#
8386747b715Smrg# Substitute a variable $(am__untar) that extract such
8396747b715Smrg# a tarball read from stdin.
8406747b715Smrg#     $(am__untar) < result.tar
8416747b715SmrgAC_DEFUN([_AM_PROG_TAR],
8426747b715Smrg[# Always define AMTAR for backward compatibility.
8436747b715SmrgAM_MISSING_PROG([AMTAR], [tar])
8446747b715Smrgm4_if([$1], [v7],
8456747b715Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
8466747b715Smrg     [m4_case([$1], [ustar],, [pax],,
8476747b715Smrg              [m4_fatal([Unknown tar format])])
8486747b715SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
8496747b715Smrg# Loop over all known methods to create a tar archive until one works.
8506747b715Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
8516747b715Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
8526747b715Smrg# Do not fold the above two line into one, because Tru64 sh and
8536747b715Smrg# Solaris sh will not grok spaces in the rhs of `-'.
8546747b715Smrgfor _am_tool in $_am_tools
8556747b715Smrgdo
8566747b715Smrg  case $_am_tool in
8576747b715Smrg  gnutar)
8586747b715Smrg    for _am_tar in tar gnutar gtar;
8596747b715Smrg    do
8606747b715Smrg      AM_RUN_LOG([$_am_tar --version]) && break
8616747b715Smrg    done
8626747b715Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
8636747b715Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
8646747b715Smrg    am__untar="$_am_tar -xf -"
8656747b715Smrg    ;;
8666747b715Smrg  plaintar)
8676747b715Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
8686747b715Smrg    # ustar tarball either.
8696747b715Smrg    (tar --version) >/dev/null 2>&1 && continue
8706747b715Smrg    am__tar='tar chf - "$$tardir"'
8716747b715Smrg    am__tar_='tar chf - "$tardir"'
8726747b715Smrg    am__untar='tar xf -'
8736747b715Smrg    ;;
8746747b715Smrg  pax)
8756747b715Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
8766747b715Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
8776747b715Smrg    am__untar='pax -r'
8786747b715Smrg    ;;
8796747b715Smrg  cpio)
8806747b715Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
8816747b715Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
8826747b715Smrg    am__untar='cpio -i -H $1 -d'
8836747b715Smrg    ;;
8846747b715Smrg  none)
8856747b715Smrg    am__tar=false
8866747b715Smrg    am__tar_=false
8876747b715Smrg    am__untar=false
8886747b715Smrg    ;;
8896747b715Smrg  esac
8904642e01fSmrg
8916747b715Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
8926747b715Smrg  # and am__untar set.
8936747b715Smrg  test -n "${am_cv_prog_tar_$1}" && break
8944642e01fSmrg
8956747b715Smrg  # tar/untar a dummy directory, and stop if the command works
8966747b715Smrg  rm -rf conftest.dir
8976747b715Smrg  mkdir conftest.dir
8986747b715Smrg  echo GrepMe > conftest.dir/file
8996747b715Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
9006747b715Smrg  rm -rf conftest.dir
9016747b715Smrg  if test -s conftest.tar; then
9026747b715Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
9036747b715Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
9046747b715Smrg  fi
9054642e01fSmrgdone
9066747b715Smrgrm -rf conftest.dir
9074642e01fSmrg
9086747b715SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
9096747b715SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
9106747b715SmrgAC_SUBST([am__tar])
9116747b715SmrgAC_SUBST([am__untar])
9126747b715Smrg]) # _AM_PROG_TAR
9134642e01fSmrg
9146747b715Smrgm4_include([m4/ac_define_dir.m4])
9159ace9065Smrgm4_include([m4/ax_tls.m4])
916475c125cSmrgm4_include([m4/libtool.m4])
917475c125cSmrgm4_include([m4/ltoptions.m4])
918475c125cSmrgm4_include([m4/ltsugar.m4])
919475c125cSmrgm4_include([m4/ltversion.m4])
920475c125cSmrgm4_include([m4/lt~obsolete.m4])
921475c125cSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
922475c125cSmrg# serial 1 (pkg-config-0.24)
923475c125cSmrg# 
924475c125cSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
925475c125cSmrg#
926475c125cSmrg# This program is free software; you can redistribute it and/or modify
927475c125cSmrg# it under the terms of the GNU General Public License as published by
928475c125cSmrg# the Free Software Foundation; either version 2 of the License, or
929475c125cSmrg# (at your option) any later version.
930475c125cSmrg#
931475c125cSmrg# This program is distributed in the hope that it will be useful, but
932475c125cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
933475c125cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
934475c125cSmrg# General Public License for more details.
935475c125cSmrg#
936475c125cSmrg# You should have received a copy of the GNU General Public License
937475c125cSmrg# along with this program; if not, write to the Free Software
938475c125cSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
939475c125cSmrg#
940475c125cSmrg# As a special exception to the GNU General Public License, if you
941475c125cSmrg# distribute this file as part of a program that contains a
942475c125cSmrg# configuration script generated by Autoconf, you may include it under
943475c125cSmrg# the same distribution terms that you use for the rest of that program.
944475c125cSmrg
945475c125cSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
946475c125cSmrg# ----------------------------------
947475c125cSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
948475c125cSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
949475c125cSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
950475c125cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
951475c125cSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
952475c125cSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
953475c125cSmrg
954475c125cSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
955475c125cSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
956475c125cSmrgfi
957475c125cSmrgif test -n "$PKG_CONFIG"; then
958475c125cSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
959475c125cSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
960475c125cSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
961475c125cSmrg		AC_MSG_RESULT([yes])
962475c125cSmrg	else
963475c125cSmrg		AC_MSG_RESULT([no])
964475c125cSmrg		PKG_CONFIG=""
965475c125cSmrg	fi
966475c125cSmrgfi[]dnl
967475c125cSmrg])# PKG_PROG_PKG_CONFIG
968475c125cSmrg
969475c125cSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
970475c125cSmrg#
971475c125cSmrg# Check to see whether a particular set of modules exists.  Similar
972475c125cSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
973475c125cSmrg#
974475c125cSmrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
975475c125cSmrg# only at the first occurence in configure.ac, so if the first place
976475c125cSmrg# it's called might be skipped (such as if it is within an "if", you
977475c125cSmrg# have to call PKG_CHECK_EXISTS manually
978475c125cSmrg# --------------------------------------------------------------
979475c125cSmrgAC_DEFUN([PKG_CHECK_EXISTS],
980475c125cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
981475c125cSmrgif test -n "$PKG_CONFIG" && \
982475c125cSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
983475c125cSmrg  m4_default([$2], [:])
984475c125cSmrgm4_ifvaln([$3], [else
985475c125cSmrg  $3])dnl
986475c125cSmrgfi])
987475c125cSmrg
988475c125cSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
989475c125cSmrg# ---------------------------------------------
990475c125cSmrgm4_define([_PKG_CONFIG],
991475c125cSmrg[if test -n "$$1"; then
992475c125cSmrg    pkg_cv_[]$1="$$1"
993475c125cSmrg elif test -n "$PKG_CONFIG"; then
994475c125cSmrg    PKG_CHECK_EXISTS([$3],
995475c125cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
996475c125cSmrg		     [pkg_failed=yes])
997475c125cSmrg else
998475c125cSmrg    pkg_failed=untried
999475c125cSmrgfi[]dnl
1000475c125cSmrg])# _PKG_CONFIG
1001475c125cSmrg
1002475c125cSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1003475c125cSmrg# -----------------------------
1004475c125cSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1005475c125cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1006475c125cSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1007475c125cSmrg        _pkg_short_errors_supported=yes
1008475c125cSmrgelse
1009475c125cSmrg        _pkg_short_errors_supported=no
1010475c125cSmrgfi[]dnl
1011475c125cSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1012475c125cSmrg
1013475c125cSmrg
1014475c125cSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1015475c125cSmrg# [ACTION-IF-NOT-FOUND])
1016475c125cSmrg#
1017475c125cSmrg#
1018475c125cSmrg# Note that if there is a possibility the first call to
1019475c125cSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1020475c125cSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1021475c125cSmrg#
1022475c125cSmrg#
1023475c125cSmrg# --------------------------------------------------------------
1024475c125cSmrgAC_DEFUN([PKG_CHECK_MODULES],
1025475c125cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1026475c125cSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1027475c125cSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1028475c125cSmrg
1029475c125cSmrgpkg_failed=no
1030475c125cSmrgAC_MSG_CHECKING([for $1])
1031475c125cSmrg
1032475c125cSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1033475c125cSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1034475c125cSmrg
1035475c125cSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1036475c125cSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1037475c125cSmrgSee the pkg-config man page for more details.])
1038475c125cSmrg
1039475c125cSmrgif test $pkg_failed = yes; then
1040475c125cSmrg   	AC_MSG_RESULT([no])
1041475c125cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1042475c125cSmrg        if test $_pkg_short_errors_supported = yes; then
1043475c125cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1044475c125cSmrg        else 
1045475c125cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1046475c125cSmrg        fi
1047475c125cSmrg	# Put the nasty error message in config.log where it belongs
1048475c125cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1049475c125cSmrg
1050475c125cSmrg	m4_default([$4], [AC_MSG_ERROR(
1051475c125cSmrg[Package requirements ($2) were not met:
1052475c125cSmrg
1053475c125cSmrg$$1_PKG_ERRORS
1054475c125cSmrg
1055475c125cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1056475c125cSmrginstalled software in a non-standard prefix.
1057475c125cSmrg
1058475c125cSmrg_PKG_TEXT])[]dnl
1059475c125cSmrg        ])
1060475c125cSmrgelif test $pkg_failed = untried; then
1061475c125cSmrg     	AC_MSG_RESULT([no])
1062475c125cSmrg	m4_default([$4], [AC_MSG_FAILURE(
1063475c125cSmrg[The pkg-config script could not be found or is too old.  Make sure it
1064475c125cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1065475c125cSmrgpath to pkg-config.
1066475c125cSmrg
1067475c125cSmrg_PKG_TEXT
1068475c125cSmrg
1069475c125cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
1070475c125cSmrg        ])
1071475c125cSmrgelse
1072475c125cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1073475c125cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1074475c125cSmrg        AC_MSG_RESULT([yes])
1075475c125cSmrg	$3
1076475c125cSmrgfi[]dnl
1077475c125cSmrg])# PKG_CHECK_MODULES
1078475c125cSmrg
10796747b715Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
10806747b715Smrgdnl
10816747b715Smrgdnl This file comes from X.Org's font-util 1.2.0
10826747b715Smrgdnl
10836747b715Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
10846747b715Smrgdnl
10856747b715Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
10866747b715Smrgdnl copy of this software and associated documentation files (the "Software"),
10876747b715Smrgdnl to deal in the Software without restriction, including without limitation
10886747b715Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10896747b715Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
10906747b715Smrgdnl Software is furnished to do so, subject to the following conditions:
10916747b715Smrgdnl
10926747b715Smrgdnl The above copyright notice and this permission notice (including the next
10936747b715Smrgdnl paragraph) shall be included in all copies or substantial portions of the
10946747b715Smrgdnl Software.
10956747b715Smrgdnl
10966747b715Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10976747b715Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10986747b715Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
10996747b715Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11006747b715Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
11016747b715Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
11026747b715Smrgdnl DEALINGS IN THE SOFTWARE.
11036747b715Smrgdnl
11046747b715Smrgdnl --------------------------------------------------------------------
11056747b715Smrgdnl
11066747b715Smrgdnl Copyright 2005 Red Hat, Inc
11076747b715Smrgdnl
11086747b715Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
11096747b715Smrgdnl documentation for any purpose is hereby granted without fee, provided that
11106747b715Smrgdnl the above copyright notice appear in all copies and that both that
11116747b715Smrgdnl copyright notice and this permission notice appear in supporting
11126747b715Smrgdnl documentation.
11136747b715Smrgdnl
11146747b715Smrgdnl The above copyright notice and this permission notice shall be included
11156747b715Smrgdnl in all copies or substantial portions of the Software.
11166747b715Smrgdnl
11176747b715Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11186747b715Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11196747b715Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
11206747b715Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
11216747b715Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
11226747b715Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
11236747b715Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
11246747b715Smrgdnl
11256747b715Smrgdnl Except as contained in this notice, the name of the copyright holders shall
11266747b715Smrgdnl not be used in advertising or otherwise to promote the sale, use or
11276747b715Smrgdnl other dealings in this Software without prior written authorization
11286747b715Smrgdnl from the copyright holders.
11294642e01fSmrg
11306747b715Smrg# XORG_FONT_MACROS_VERSION(required-version)
11316747b715Smrg# ------------------------------------------
11326747b715Smrg# Minimum version: 1.1.0
11336747b715Smrg#
11346747b715Smrg# If you're using a macro added in Version 1.1 or newer, include this in
11356747b715Smrg# your configure.ac with the minimum required version, such as:
11366747b715Smrg# XORG_FONT_MACROS_VERSION(1.1)
11376747b715Smrg#
11386747b715Smrg# To ensure that this macro is defined, also add:
11396747b715Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
11406747b715Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
11416747b715Smrg#
11426747b715Smrg#
11436747b715Smrg# See the "minimum version" comment for each macro you use to see what
11446747b715Smrg# version you require.
11456747b715Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
11466747b715Smrgm4_define([vers_have], [1.2.0])
11476747b715Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
11486747b715Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
11496747b715Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
11506747b715Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
11516747b715Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
11526747b715Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
11536747b715Smrgm4_undefine([vers_have])
11546747b715Smrgm4_undefine([maj_have])
11556747b715Smrgm4_undefine([maj_needed])
11566747b715Smrg]) # XORG_FONT_MACROS_VERSION
11574642e01fSmrg
11586747b715Smrg# XORG_FONT_CHECK_{maps}()
11596747b715Smrg# ------------------------
11606747b715Smrg# Minimum version: 1.0.0
11616747b715Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
11626747b715Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
11636747b715Smrg
11646747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
11656747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
11666747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
11676747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
11686747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
11696747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
11706747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
11716747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
11726747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
11736747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
11746747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
11756747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
11766747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
11776747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
11786747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
11796747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
11806747b715SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
11816747b715SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
11826747b715Smrg
11836747b715Smrg# XORG_FONT_CHECK_ENCODING(encoding)
11846747b715Smrg# ----------------------------------
11856747b715Smrg# Minimum version: 1.1.0
11866747b715Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
11876747b715Smrg# It replaced individual copies of this code in the above macros in 1.1.
11886747b715Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
11896747b715Smrg# calls if this is not true in the future.
11906747b715Smrg
11916747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
11926747b715Smrg	AC_ARG_ENABLE(m4_tolower($1),
11936747b715Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
11946747b715Smrg				[Build $1 fonts (default: yes)]),
11956747b715Smrg		[AS_TR_SH($1)=$enableval])
11966747b715Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
11976747b715Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
11986747b715Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
11996747b715Smrg]) # XORG_FONT_CHECK_ENCODING
12006747b715Smrg
12016747b715Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
12026747b715Smrg# -----------------------------------------------------
12036747b715Smrg# Minimum version: 1.1.0
12046747b715Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
12056747b715Smrg# Add a shorthand --enable/disable-all-encodings option.
12066747b715Smrg
12076747b715SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
12086747b715Smrg	AC_ARG_ENABLE([all-encodings],
12096747b715Smrg		AS_HELP_STRING([--disable-all-encodings],
12106747b715Smrg				[Disable building of all font encodings]),
12116747b715Smrg		[m4_foreach_w([enc], [$1], [
12126747b715Smrg			AS_TR_SH(enc)=$enableval
12136747b715Smrg		])],
12146747b715Smrg		[m4_foreach_w([enc], [$1], [
12156747b715Smrg			AS_TR_SH(enc)=yes
12166747b715Smrg		])])
12176747b715Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
12186747b715Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
12196747b715Smrg
12206747b715Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
12216747b715Smrg# ------------------------------------------
12226747b715Smrg# Minimum version: 1.1.0
12236747b715Smrg#
12246747b715Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
12256747b715Smrg#
12264642e01fSmrg
12276747b715SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
12286747b715Smrg	AC_PATH_PROG($1, $2)
12296747b715Smrg	if test x"$$1" = x; then
12306747b715Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
12316747b715Smrg	fi
12326747b715Smrg])
12334642e01fSmrg
12344642e01fSmrg
12356747b715Smrg# XORG_FONT_FCCACHE()
12366747b715Smrg# -------------------
12376747b715Smrg# Minimum version: 1.1.0
12386747b715Smrg#
12396747b715Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
12406747b715Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
12416747b715Smrg# to run fc-cache if found and not installing to $DESTDIR
12426747b715Smrg#
12436747b715Smrg# fc-cache is optional, not required, and should be skipped when making
12446747b715Smrg# packages (installing to $DESTDIR).
12456747b715Smrg#
12466747b715SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
12476747b715Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
12486747b715Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
12496747b715Smrg	if test x"$FCCACHE" = x ; then
12506747b715Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
12516747b715Smrg	else
12526747b715Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
12536747b715Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
12546747b715Smrg	fi
12556747b715Smrg	AC_SUBST([RUN_FCCACHE])
12566747b715Smrg])
12574642e01fSmrg
12584642e01fSmrg
12596747b715Smrg# XORG_FONT_COMMON_UTILS()
12606747b715Smrg# ------------------------
12616747b715Smrg# Minimum version: 1.1.0
12624642e01fSmrg#
12636747b715Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
12644642e01fSmrg
12656747b715SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
12666747b715Smrg	XORG_FONT_FCCACHE
12676747b715Smrg	XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
12686747b715Smrg])
12694642e01fSmrg
12706747b715Smrg# XORG_FONT_SCALED_UTILS()
12716747b715Smrg# ------------------------
12726747b715Smrg# Minimum version: 1.1.0
12736747b715Smrg#
12746747b715Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
12756747b715Smrg# (TrueType, OpenType, Type1)
12764642e01fSmrg
12776747b715SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
12786747b715Smrg	XORG_FONT_COMMON_UTILS
12796747b715Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
12806747b715Smrg])
12814642e01fSmrg
12826747b715Smrg# XORG_FONT_BDF_UTILS()
12836747b715Smrg# ---------------------
12846747b715Smrg# Minimum version: 1.1.0
12856747b715Smrg#
12866747b715Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
12876747b715Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
12886747b715Smrg# PCF output files created by bdftopcf
12896747b715Smrg
12906747b715SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
12916747b715Smrg	XORG_FONT_COMMON_UTILS
12926747b715Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
12936747b715Smrg	XORG_FONT_CHECK_COMPRESSION
12946747b715Smrg])
12954642e01fSmrg
12966747b715Smrg# XORG_FONT_CHECK_COMPRESSION()
12976747b715Smrg# -----------------------------
12986747b715Smrg# Minimum version: 1.1.0
12996747b715Smrg#
13006747b715Smrg# Offer a --with-compression flag to control what compression method is
13016747b715Smrg# used for pcf font files.   Offers all the methods currently supported
13026747b715Smrg# by libXfont, including no compression.
13036747b715Smrg
13046747b715SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
13056747b715Smrg	AC_MSG_CHECKING([font compression method])
13066747b715Smrg	AC_ARG_WITH(compression,
13076747b715Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
13086747b715Smrg			 [compression method to use on pcf fonts])],
13096747b715Smrg         [compression="$withval"], [compression="yes"])
13106747b715Smrg	if test x"$compression" = "xyes" ; then
13116747b715Smrg		compression="gzip"
13126747b715Smrg	fi
13136747b715Smrg	AC_MSG_RESULT([${compression}])
13146747b715Smrg	case ${compression} in
13156747b715Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
13166747b715Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
13176747b715Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
13186747b715Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
13196747b715Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
13206747b715Smrg	esac
13216747b715Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
13226747b715Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
13236747b715Smrg	fi
13246747b715Smrg	AC_SUBST([COMPRESS_SUFFIX])
13256747b715Smrg])
13264642e01fSmrg
13276747b715Smrg# XORG_FONT_UCS2ANY()
13286747b715Smrg# -------------------
1329475c125cSmrg# Minimum version: 1.1.0
1330475c125cSmrg#
1331475c125cSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1332475c125cSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1333475c125cSmrg# Also call pkg-config to find the directory with the encoding files needed
1334475c125cSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
133505b261ecSmrg
1336475c125cSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
1337475c125cSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1338475c125cSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1339475c125cSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
1340475c125cSmrg	MAPFILES_PATH=`pkg-config --variable=mapdir fontutil`
1341475c125cSmrg	AC_SUBST(MAPFILES_PATH)
1342475c125cSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1343475c125cSmrg])
134405b261ecSmrg
134505b261ecSmrg
134605b261ecSmrg
1347475c125cSmrg# XORG_FONT_FC_CONFDIR()
1348475c125cSmrg# --------------------
1349475c125cSmrg# Minimum version: 1.2.0
13506747b715Smrg#
1351475c125cSmrg# Sets FC_CONFDIR to the fontconfig config directory
1352475c125cSmrg# (which should be --with-confdir=... when building fontconfig)
1353475c125cSmrg# found from:
1354475c125cSmrg#	--with-fc-confdir=...
1355475c125cSmrg#	pkg-config --variable=confdir fontconfig
1356475c125cSmrg#	${sysconfdir}/fonts
135705b261ecSmrg
1358475c125cSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1359475c125cSmrg	dnl Ensure $PKG_CONFIG is set first
1360475c125cSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1361b1d344b3Smrg
1362475c125cSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1363475c125cSmrg	AC_ARG_WITH(fc-confdir,
1364475c125cSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1365475c125cSmrg			   [Path to fontconfig's configuration directory]),
1366475c125cSmrg		    [FC_CONFDIR="$withval"])
1367475c125cSmrg	# if --with-fc-confdir was not specified
1368475c125cSmrg	if test "x${FC_CONFDIR}" = "x"; then
1369475c125cSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1370475c125cSmrg	fi
1371475c125cSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1372475c125cSmrg	if test "x${FC_CONFDIR}" = "x"; then
1373475c125cSmrg		FC_CONFDIR="${sysconfdir}/fonts"
1374475c125cSmrg	fi
1375475c125cSmrg	AC_SUBST(FC_CONFDIR)
1376475c125cSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
1377475c125cSmrg])
137805b261ecSmrg
1379b1d344b3Smrg
138005b261ecSmrg
1381475c125cSmrg# XORG_FONTROOTDIR()
1382475c125cSmrg# --------------------
1383475c125cSmrg# Minimum version: 1.1.0
1384475c125cSmrg#
1385475c125cSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1386475c125cSmrg# found from:
1387475c125cSmrg#	--with-fontrootdir
1388475c125cSmrg#	pkg-config --variable=fontrootdir fontutil
1389475c125cSmrg#	${datadir}/fonts/X11
139005b261ecSmrg
1391475c125cSmrgAC_DEFUN([XORG_FONTROOTDIR],[
1392475c125cSmrg	dnl Ensure $PKG_CONFIG is set first
1393475c125cSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
139405b261ecSmrg
1395475c125cSmrg	AC_MSG_CHECKING([for root directory for font files])
1396475c125cSmrg	AC_ARG_WITH(fontrootdir,
1397475c125cSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1398475c125cSmrg			   [Path to root directory for font files]),
1399475c125cSmrg		    [FONTROOTDIR="$withval"])
1400475c125cSmrg	# if --with-fontrootdir not specified...
1401475c125cSmrg	if test "x${FONTROOTDIR}" = "x"; then
1402475c125cSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1403475c125cSmrg	fi
1404475c125cSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1405475c125cSmrg	if test "x${FONTROOTDIR}" = "x"; then
1406475c125cSmrg		FONTROOTDIR="${datadir}/fonts/X11"
1407475c125cSmrg	fi
1408475c125cSmrg	AC_SUBST(FONTROOTDIR)
1409475c125cSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
1410475c125cSmrg])
141105b261ecSmrg
1412475c125cSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
1413475c125cSmrg# ---------------------------------------
1414475c125cSmrg# Minimum version: 1.1.0
1415475c125cSmrg#
1416475c125cSmrg# Offer a --with-<flag> flag to control directory for font installation
1417475c125cSmrg# Default is the specified <subdir> of the font root directory.
1418475c125cSmrg# Sets <variable> to the selected directory
141905b261ecSmrg
1420475c125cSmrgAC_DEFUN([XORG_FONTSUBDIR],[
1421475c125cSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
142205b261ecSmrg
1423475c125cSmrg	AC_MSG_CHECKING([for directory for $3 files])
1424475c125cSmrg	AC_ARG_WITH($2,
1425475c125cSmrg		    [AS_HELP_STRING([--with-$2=DIR],
1426475c125cSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1427475c125cSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1428475c125cSmrg	AC_SUBST($1)
1429475c125cSmrg	AC_MSG_RESULT([${$1}])
1430475c125cSmrg]) # XORG_FONTSUBDIR
1431475c125cSmrg
1432475c125cSmrg# XORG_FONTDIR(subdir)
1433475c125cSmrg# --------------------
1434475c125cSmrg# Minimum version: 1.1.0
1435475c125cSmrg#
1436475c125cSmrg# Offer a --with-fontdir flag to control directory for font installation
1437475c125cSmrg# Default is the specified subdir of the font root directory.
1438475c125cSmrg# Sets FONTDIR to the selected directory
1439475c125cSmrg
1440475c125cSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
144105b261ecSmrg
14424642e01fSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14434642e01fSmrgdnl
14446747b715Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
14454642e01fSmrgdnl 
14464642e01fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14476747b715Smrgdnl copy of this software and associated documentation files (the "Software"),
14486747b715Smrgdnl to deal in the Software without restriction, including without limitation
14496747b715Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14506747b715Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14516747b715Smrgdnl Software is furnished to do so, subject to the following conditions:
14524642e01fSmrgdnl
14536747b715Smrgdnl The above copyright notice and this permission notice (including the next
14546747b715Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14556747b715Smrgdnl Software.
14564642e01fSmrgdnl
14576747b715Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14586747b715Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14596747b715Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14606747b715Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14616747b715Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14626747b715Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14636747b715Smrgdnl DEALINGS IN THE SOFTWARE.
14644642e01fSmrg
14654642e01fSmrg# XORG_MACROS_VERSION(required-version)
14664642e01fSmrg# -------------------------------------
14674642e01fSmrg# Minimum version: 1.1.0
14684642e01fSmrg#
14694642e01fSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14704642e01fSmrg# your configure.ac with the minimum required version, such as:
14714642e01fSmrg# XORG_MACROS_VERSION(1.1)
14724642e01fSmrg#
147352397711Smrg# To ensure that this macro is defined, also add:
147452397711Smrg# m4_ifndef([XORG_MACROS_VERSION],
147552397711Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14764642e01fSmrg#
14774642e01fSmrg#
14784642e01fSmrg# See the "minimum version" comment for each macro you use to see what 
14794642e01fSmrg# version you require.
148052397711Smrgm4_defun([XORG_MACROS_VERSION],[
1481475c125cSmrgm4_define([vers_have], [1.16.0])
148252397711Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
148352397711Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
148452397711Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
148552397711Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
148652397711Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
148752397711Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
148852397711Smrgm4_undefine([vers_have])
148952397711Smrgm4_undefine([maj_have])
149052397711Smrgm4_undefine([maj_needed])
14914642e01fSmrg]) # XORG_MACROS_VERSION
14924642e01fSmrg
14934642e01fSmrg# XORG_PROG_RAWCPP()
14944642e01fSmrg# ------------------
14954642e01fSmrg# Minimum version: 1.0.0
14964642e01fSmrg#
14974642e01fSmrg# Find cpp program and necessary flags for use in pre-processing text files
14984642e01fSmrg# such as man pages and config files
14994642e01fSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
15004642e01fSmrgAC_REQUIRE([AC_PROG_CPP])
15014642e01fSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
15024642e01fSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
15034642e01fSmrg
15044642e01fSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
15054642e01fSmrg# which is not the best choice for supporting other OS'es, but covers most
15064642e01fSmrg# of the ones we need for now.
15074642e01fSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1508475c125cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
15094642e01fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15104642e01fSmrg	AC_MSG_RESULT([no])
15114642e01fSmrgelse
15124642e01fSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15134642e01fSmrg		RAWCPPFLAGS=-undef
15144642e01fSmrg		AC_MSG_RESULT([yes])
15154642e01fSmrg	# under Cygwin unix is still defined even with -undef
15164642e01fSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15174642e01fSmrg		RAWCPPFLAGS="-undef -ansi"
15184642e01fSmrg		AC_MSG_RESULT([yes, with -ansi])
15194642e01fSmrg	else
15204642e01fSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15214642e01fSmrg	fi
15224642e01fSmrgfi
15234642e01fSmrgrm -f conftest.$ac_ext
15244642e01fSmrg
15254642e01fSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1526475c125cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15274642e01fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15284642e01fSmrg	AC_MSG_RESULT([no])
15294642e01fSmrgelse
15304642e01fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15314642e01fSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15324642e01fSmrg		AC_MSG_RESULT([yes])
15334642e01fSmrg	else
15344642e01fSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15354642e01fSmrg	fi
15364642e01fSmrgfi
15374642e01fSmrgrm -f conftest.$ac_ext
15384642e01fSmrgAC_SUBST(RAWCPPFLAGS)
15394642e01fSmrg]) # XORG_PROG_RAWCPP
15404642e01fSmrg
15414642e01fSmrg# XORG_MANPAGE_SECTIONS()
15424642e01fSmrg# -----------------------
15434642e01fSmrg# Minimum version: 1.0.0
15444642e01fSmrg#
15454642e01fSmrg# Determine which sections man pages go in for the different man page types
15464642e01fSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15474642e01fSmrg# Not sure if there's any better way than just hardcoding by OS name.
15484642e01fSmrg# Override default settings by setting environment variables
15496747b715Smrg# Added MAN_SUBSTS in version 1.8
15506747b715Smrg# Added AC_PROG_SED in version 1.8
15514642e01fSmrg
15524642e01fSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15534642e01fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15546747b715SmrgAC_REQUIRE([AC_PROG_SED])
15554642e01fSmrg
15564642e01fSmrgif test x$APP_MAN_SUFFIX = x    ; then
15574642e01fSmrg    APP_MAN_SUFFIX=1
15584642e01fSmrgfi
15594642e01fSmrgif test x$APP_MAN_DIR = x    ; then
15604642e01fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15614642e01fSmrgfi
15624642e01fSmrg
15634642e01fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15644642e01fSmrg    LIB_MAN_SUFFIX=3
15654642e01fSmrgfi
15664642e01fSmrgif test x$LIB_MAN_DIR = x    ; then
15674642e01fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15684642e01fSmrgfi
15694642e01fSmrg
15704642e01fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
15714642e01fSmrg    case $host_os in
15724642e01fSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
15734642e01fSmrg	*)		FILE_MAN_SUFFIX=5  ;;
15744642e01fSmrg    esac
15754642e01fSmrgfi
15764642e01fSmrgif test x$FILE_MAN_DIR = x    ; then
15774642e01fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15784642e01fSmrgfi
15794642e01fSmrg
15804642e01fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
15814642e01fSmrg    case $host_os in
15824642e01fSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
15834642e01fSmrg	*)		MISC_MAN_SUFFIX=7  ;;
15844642e01fSmrg    esac
15854642e01fSmrgfi
15864642e01fSmrgif test x$MISC_MAN_DIR = x    ; then
15874642e01fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15884642e01fSmrgfi
15894642e01fSmrg
15904642e01fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15914642e01fSmrg    case $host_os in
15924642e01fSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
15934642e01fSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
15944642e01fSmrg    esac
15954642e01fSmrgfi
15964642e01fSmrgif test x$DRIVER_MAN_DIR = x    ; then
15974642e01fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15984642e01fSmrgfi
15994642e01fSmrg
16004642e01fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
16014642e01fSmrg    case $host_os in
16024642e01fSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
16034642e01fSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
16044642e01fSmrg    esac
16054642e01fSmrgfi
16064642e01fSmrgif test x$ADMIN_MAN_DIR = x    ; then
16074642e01fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16084642e01fSmrgfi
16094642e01fSmrg
16104642e01fSmrg
16114642e01fSmrgAC_SUBST([APP_MAN_SUFFIX])
16124642e01fSmrgAC_SUBST([LIB_MAN_SUFFIX])
16134642e01fSmrgAC_SUBST([FILE_MAN_SUFFIX])
16144642e01fSmrgAC_SUBST([MISC_MAN_SUFFIX])
16154642e01fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16164642e01fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16174642e01fSmrgAC_SUBST([APP_MAN_DIR])
16184642e01fSmrgAC_SUBST([LIB_MAN_DIR])
16194642e01fSmrgAC_SUBST([FILE_MAN_DIR])
16204642e01fSmrgAC_SUBST([MISC_MAN_DIR])
16214642e01fSmrgAC_SUBST([DRIVER_MAN_DIR])
16224642e01fSmrgAC_SUBST([ADMIN_MAN_DIR])
16236747b715Smrg
16246747b715SmrgXORG_MAN_PAGE="X Version 11"
16256747b715SmrgAC_SUBST([XORG_MAN_PAGE])
16266747b715SmrgMAN_SUBSTS="\
16276747b715Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16286747b715Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16296747b715Smrg	-e 's|__xservername__|Xorg|g' \
16306747b715Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16316747b715Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16326747b715Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16336747b715Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16346747b715Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16356747b715Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16366747b715Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16376747b715Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16386747b715Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16396747b715SmrgAC_SUBST([MAN_SUBSTS])
16406747b715Smrg
16414642e01fSmrg]) # XORG_MANPAGE_SECTIONS
16424642e01fSmrg
16436747b715Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16446747b715Smrg# ------------------------
16456747b715Smrg# Minimum version: 1.7.0
16466747b715Smrg#
16476747b715Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16486747b715Smrg# provided by xorg-sgml-doctools, if installed.
16496747b715SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16506747b715SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16516747b715SmrgXORG_SGML_PATH=
16526747b715SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16536747b715Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16546747b715Smrg    [m4_ifval([$1],[:],
16556747b715Smrg        [if test x"$cross_compiling" != x"yes" ; then
16566747b715Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16576747b715Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16586747b715Smrg         fi])
16596747b715Smrg    ])
16606747b715Smrg
16616747b715Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16626747b715Smrg# the path and the name of the doc stylesheet
16636747b715Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16646747b715Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16656747b715Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16666747b715Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16676747b715Smrgelse
16686747b715Smrg   AC_MSG_RESULT([no])
16696747b715Smrgfi
16706747b715Smrg
16716747b715SmrgAC_SUBST(XORG_SGML_PATH)
16726747b715SmrgAC_SUBST(STYLESHEET_SRCDIR)
16736747b715SmrgAC_SUBST(XSL_STYLESHEET)
16746747b715SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16756747b715Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16766747b715Smrg
16774642e01fSmrg# XORG_CHECK_LINUXDOC
16784642e01fSmrg# -------------------
16794642e01fSmrg# Minimum version: 1.0.0
16804642e01fSmrg#
16814642e01fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16824642e01fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16834642e01fSmrg# Whether or not the necessary tools and files are found can be checked
16844642e01fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16854642e01fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16866747b715SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16876747b715SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16884642e01fSmrg
16894642e01fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16904642e01fSmrg
16916747b715SmrgAC_MSG_CHECKING([whether to build documentation])
16924642e01fSmrg
16936747b715Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16944642e01fSmrg   BUILDDOC=yes
16954642e01fSmrgelse
16964642e01fSmrg   BUILDDOC=no
16974642e01fSmrgfi
16984642e01fSmrg
16994642e01fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
17004642e01fSmrg
17014642e01fSmrgAC_MSG_RESULT([$BUILDDOC])
17024642e01fSmrg
17036747b715SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17044642e01fSmrg
17056747b715Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17064642e01fSmrg   BUILDPDFDOC=yes
17074642e01fSmrgelse
17084642e01fSmrg   BUILDPDFDOC=no
17094642e01fSmrgfi
17104642e01fSmrg
17114642e01fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17124642e01fSmrg
17134642e01fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17144642e01fSmrg
17156747b715SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17164642e01fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17174642e01fSmrgMAKE_PDF="$PS2PDF"
17184642e01fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17194642e01fSmrg
17204642e01fSmrgAC_SUBST(MAKE_TEXT)
17214642e01fSmrgAC_SUBST(MAKE_PS)
17224642e01fSmrgAC_SUBST(MAKE_PDF)
17234642e01fSmrgAC_SUBST(MAKE_HTML)
17244642e01fSmrg]) # XORG_CHECK_LINUXDOC
17254642e01fSmrg
17264642e01fSmrg# XORG_CHECK_DOCBOOK
17274642e01fSmrg# -------------------
17284642e01fSmrg# Minimum version: 1.0.0
17294642e01fSmrg#
17304642e01fSmrg# Checks for the ability to build output formats from SGML DocBook source.
17314642e01fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17324642e01fSmrg# indicates whether the necessary tools and files are found and, if set,
17334642e01fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17344642e01fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17356747b715SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17366747b715Smrg
17374642e01fSmrgBUILDTXTDOC=no
17384642e01fSmrgBUILDPDFDOC=no
17394642e01fSmrgBUILDPSDOC=no
17404642e01fSmrgBUILDHTMLDOC=no
17414642e01fSmrg
17424642e01fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17434642e01fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17444642e01fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17454642e01fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17464642e01fSmrg
17476747b715SmrgAC_MSG_CHECKING([whether to build text documentation])
17486747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17494642e01fSmrg   test x$BUILD_TXTDOC != xno; then
17504642e01fSmrg	BUILDTXTDOC=yes
17514642e01fSmrgfi
17524642e01fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17534642e01fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
17544642e01fSmrg
17556747b715SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17566747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17574642e01fSmrg   test x$BUILD_PDFDOC != xno; then
17584642e01fSmrg	BUILDPDFDOC=yes
17594642e01fSmrgfi
17604642e01fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17614642e01fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17624642e01fSmrg
17636747b715SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17646747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17654642e01fSmrg   test x$BUILD_PSDOC != xno; then
17664642e01fSmrg	BUILDPSDOC=yes
17674642e01fSmrgfi
17684642e01fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17694642e01fSmrgAC_MSG_RESULT([$BUILDPSDOC])
17704642e01fSmrg
17716747b715SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17726747b715Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17734642e01fSmrg   test x$BUILD_HTMLDOC != xno; then
17744642e01fSmrg	BUILDHTMLDOC=yes
17754642e01fSmrgfi
17764642e01fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17774642e01fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17784642e01fSmrg
17794642e01fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17804642e01fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17814642e01fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17824642e01fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17834642e01fSmrg
17844642e01fSmrgAC_SUBST(MAKE_TEXT)
17854642e01fSmrgAC_SUBST(MAKE_PS)
17864642e01fSmrgAC_SUBST(MAKE_PDF)
17874642e01fSmrgAC_SUBST(MAKE_HTML)
17884642e01fSmrg]) # XORG_CHECK_DOCBOOK
17894642e01fSmrg
17906747b715Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17916747b715Smrg# ----------------
17926747b715Smrg# Minimum version: 1.5.0
17936747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17946747b715Smrg#
17956747b715Smrg# Documentation tools are not always available on all platforms and sometimes
17966747b715Smrg# not at the appropriate level. This macro enables a module to test for the
17976747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17986747b715Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17996747b715Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
18006747b715Smrg# --with-xmlto assumes 'auto'.
18016747b715Smrg#
18026747b715Smrg# Interface to module:
18036747b715Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18046747b715Smrg# XMLTO:	returns the path of the xmlto program found
18056747b715Smrg#		returns the path set by the user in the environment
18066747b715Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18076747b715Smrg#		'no' user instructs the module not to use xmlto
18086747b715Smrg#
18096747b715Smrg# Added in version 1.10.0
18106747b715Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18116747b715Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18126747b715Smrg#
18136747b715Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18146747b715Smrg#
18156747b715SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18166747b715SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18176747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
18186747b715SmrgAC_ARG_WITH(xmlto,
18196747b715Smrg	AS_HELP_STRING([--with-xmlto],
18206747b715Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18216747b715Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18226747b715Smrgm4_undefine([_defopt])
18236747b715Smrg
18246747b715Smrgif test "x$use_xmlto" = x"auto"; then
18256747b715Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18266747b715Smrg   if test "x$XMLTO" = "x"; then
18276747b715Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18286747b715Smrg	have_xmlto=no
18296747b715Smrg   else
18306747b715Smrg        have_xmlto=yes
18316747b715Smrg   fi
18326747b715Smrgelif test "x$use_xmlto" = x"yes" ; then
18336747b715Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18346747b715Smrg   if test "x$XMLTO" = "x"; then
18356747b715Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18366747b715Smrg   fi
18376747b715Smrg   have_xmlto=yes
18386747b715Smrgelif test "x$use_xmlto" = x"no" ; then
18396747b715Smrg   if test "x$XMLTO" != "x"; then
18406747b715Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18416747b715Smrg   fi
18426747b715Smrg   have_xmlto=no
18436747b715Smrgelse
18446747b715Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18456747b715Smrgfi
18466747b715Smrg
18476747b715Smrg# Test for a minimum version of xmlto, if provided.
18486747b715Smrgm4_ifval([$1],
18496747b715Smrg[if test "$have_xmlto" = yes; then
18506747b715Smrg    # scrape the xmlto version
18516747b715Smrg    AC_MSG_CHECKING([the xmlto version])
18526747b715Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18536747b715Smrg    AC_MSG_RESULT([$xmlto_version])
18546747b715Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18556747b715Smrg        [if test "x$use_xmlto" = xauto; then
18566747b715Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18576747b715Smrg            have_xmlto=no
18586747b715Smrg        else
18596747b715Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18606747b715Smrg        fi])
18616747b715Smrgfi])
18626747b715Smrg
18636747b715Smrg# Test for the ability of xmlto to generate a text target
18646747b715Smrghave_xmlto_text=no
18656747b715Smrgcat > conftest.xml << "EOF"
18666747b715SmrgEOF
18676747b715SmrgAS_IF([test "$have_xmlto" = yes],
18686747b715Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18696747b715Smrg             [have_xmlto_text=yes],
18706747b715Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
18716747b715Smrgrm -f conftest.xml
18726747b715SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18736747b715SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18746747b715Smrg]) # XORG_WITH_XMLTO
18756747b715Smrg
18768223e2f2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18778223e2f2Smrg# --------------------------------------------
18788223e2f2Smrg# Minimum version: 1.12.0
18798223e2f2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18808223e2f2Smrg#
18818223e2f2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18828223e2f2Smrg# XML-based language used for the transformation of XML documents.
18838223e2f2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18848223e2f2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18858223e2f2Smrg# The XSLT processor is often used as a standalone tool for transformations.
18868223e2f2Smrg# It should not be assumed that this tool is used only to work with documnetation.
18878223e2f2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18888223e2f2Smrg#
18898223e2f2Smrg# Interface to module:
18908223e2f2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
18918223e2f2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
18928223e2f2Smrg#		 returns the path set by the user in the environment
18938223e2f2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
18948223e2f2Smrg#		  'no' user instructs the module not to use xsltproc
18958223e2f2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
18968223e2f2Smrg#
18978223e2f2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
18988223e2f2Smrg#
18998223e2f2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19008223e2f2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1901475c125cSmrg# Preserves the interface, should it be implemented later
1902475c125cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19038223e2f2Smrgm4_define([_defopt], m4_default([$2], [auto]))
19048223e2f2SmrgAC_ARG_WITH(xsltproc,
19058223e2f2Smrg	AS_HELP_STRING([--with-xsltproc],
19068223e2f2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19078223e2f2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19088223e2f2Smrgm4_undefine([_defopt])
19098223e2f2Smrg
19108223e2f2Smrgif test "x$use_xsltproc" = x"auto"; then
19118223e2f2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19128223e2f2Smrg   if test "x$XSLTPROC" = "x"; then
19138223e2f2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19148223e2f2Smrg	have_xsltproc=no
19158223e2f2Smrg   else
19168223e2f2Smrg        have_xsltproc=yes
19178223e2f2Smrg   fi
19188223e2f2Smrgelif test "x$use_xsltproc" = x"yes" ; then
19198223e2f2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19208223e2f2Smrg   if test "x$XSLTPROC" = "x"; then
19218223e2f2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19228223e2f2Smrg   fi
19238223e2f2Smrg   have_xsltproc=yes
19248223e2f2Smrgelif test "x$use_xsltproc" = x"no" ; then
19258223e2f2Smrg   if test "x$XSLTPROC" != "x"; then
19268223e2f2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19278223e2f2Smrg   fi
19288223e2f2Smrg   have_xsltproc=no
19298223e2f2Smrgelse
19308223e2f2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19318223e2f2Smrgfi
19328223e2f2Smrg
19338223e2f2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19348223e2f2Smrg]) # XORG_WITH_XSLTPROC
19358223e2f2Smrg
1936475c125cSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1937475c125cSmrg# ----------------------------------------
1938475c125cSmrg# Minimum version: 1.15.0
1939475c125cSmrg#
1940475c125cSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1941475c125cSmrg# scanning arbitrary text files, extracting information from those text files,
1942475c125cSmrg# and printing reports based on that information.
1943475c125cSmrg#
1944475c125cSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1945475c125cSmrg#
1946475c125cSmrg# Interface to module:
1947475c125cSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1948475c125cSmrg# PERL:	     returns the path of the perl program found
1949475c125cSmrg#	     returns the path set by the user in the environment
1950475c125cSmrg# --with-perl: 'yes' user instructs the module to use perl
1951475c125cSmrg#	       'no' user instructs the module not to use perl
1952475c125cSmrg# have_perl: returns yes if perl found in PATH or no
1953475c125cSmrg#
1954475c125cSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1955475c125cSmrg#
1956475c125cSmrgAC_DEFUN([XORG_WITH_PERL],[
1957475c125cSmrgAC_ARG_VAR([PERL], [Path to perl command])
1958475c125cSmrg# Preserves the interface, should it be implemented later
1959475c125cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1960475c125cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1961475c125cSmrgAC_ARG_WITH(perl,
1962475c125cSmrg	AS_HELP_STRING([--with-perl],
1963475c125cSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1964475c125cSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1965475c125cSmrgm4_undefine([_defopt])
1966475c125cSmrg
1967475c125cSmrgif test "x$use_perl" = x"auto"; then
1968475c125cSmrg   AC_PATH_PROG([PERL], [perl])
1969475c125cSmrg   if test "x$PERL" = "x"; then
1970475c125cSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1971475c125cSmrg	have_perl=no
1972475c125cSmrg   else
1973475c125cSmrg        have_perl=yes
1974475c125cSmrg   fi
1975475c125cSmrgelif test "x$use_perl" = x"yes" ; then
1976475c125cSmrg   AC_PATH_PROG([PERL], [perl])
1977475c125cSmrg   if test "x$PERL" = "x"; then
1978475c125cSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1979475c125cSmrg   fi
1980475c125cSmrg   have_perl=yes
1981475c125cSmrgelif test "x$use_perl" = x"no" ; then
1982475c125cSmrg   if test "x$PERL" != "x"; then
1983475c125cSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1984475c125cSmrg   fi
1985475c125cSmrg   have_perl=no
1986475c125cSmrgelse
1987475c125cSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1988475c125cSmrgfi
1989475c125cSmrg
1990475c125cSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1991475c125cSmrg]) # XORG_WITH_PERL
19928223e2f2Smrg
19936747b715Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
19946747b715Smrg# ----------------
19956747b715Smrg# Minimum version: 1.5.0
19966747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19976747b715Smrg#
19986747b715Smrg# Documentation tools are not always available on all platforms and sometimes
19996747b715Smrg# not at the appropriate level. This macro enables a module to test for the
20006747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20016747b715Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
20026747b715Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20036747b715Smrg# --with-asciidoc assumes 'auto'.
20046747b715Smrg#
20056747b715Smrg# Interface to module:
20066747b715Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20076747b715Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20086747b715Smrg#		 returns the path set by the user in the environment
20096747b715Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20106747b715Smrg#		  'no' user instructs the module not to use asciidoc
20116747b715Smrg#
20126747b715Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20136747b715Smrg#
20146747b715SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20156747b715SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20166747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
20176747b715SmrgAC_ARG_WITH(asciidoc,
20186747b715Smrg	AS_HELP_STRING([--with-asciidoc],
20196747b715Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20206747b715Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20216747b715Smrgm4_undefine([_defopt])
20226747b715Smrg
20236747b715Smrgif test "x$use_asciidoc" = x"auto"; then
20246747b715Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20256747b715Smrg   if test "x$ASCIIDOC" = "x"; then
20266747b715Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20276747b715Smrg	have_asciidoc=no
20286747b715Smrg   else
20296747b715Smrg        have_asciidoc=yes
20306747b715Smrg   fi
20316747b715Smrgelif test "x$use_asciidoc" = x"yes" ; then
20326747b715Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20336747b715Smrg   if test "x$ASCIIDOC" = "x"; then
20346747b715Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20356747b715Smrg   fi
20366747b715Smrg   have_asciidoc=yes
20376747b715Smrgelif test "x$use_asciidoc" = x"no" ; then
20386747b715Smrg   if test "x$ASCIIDOC" != "x"; then
20396747b715Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20406747b715Smrg   fi
20416747b715Smrg   have_asciidoc=no
20426747b715Smrgelse
20436747b715Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20446747b715Smrgfi
20456747b715Smrgm4_ifval([$1],
20466747b715Smrg[if test "$have_asciidoc" = yes; then
20476747b715Smrg    # scrape the asciidoc version
20486747b715Smrg    AC_MSG_CHECKING([the asciidoc version])
20496747b715Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20506747b715Smrg    AC_MSG_RESULT([$asciidoc_version])
20516747b715Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20526747b715Smrg        [if test "x$use_asciidoc" = xauto; then
20536747b715Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20546747b715Smrg            have_asciidoc=no
20556747b715Smrg        else
20566747b715Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20576747b715Smrg        fi])
20586747b715Smrgfi])
20596747b715SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20606747b715Smrg]) # XORG_WITH_ASCIIDOC
20616747b715Smrg
20626747b715Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20636747b715Smrg# --------------------------------
20646747b715Smrg# Minimum version: 1.5.0
20656747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20666747b715Smrg#
20676747b715Smrg# Documentation tools are not always available on all platforms and sometimes
20686747b715Smrg# not at the appropriate level. This macro enables a module to test for the
20696747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20706747b715Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20716747b715Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20726747b715Smrg# --with-doxygen assumes 'auto'.
20736747b715Smrg#
20746747b715Smrg# Interface to module:
20756747b715Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20766747b715Smrg# DOXYGEN:	 returns the path of the doxygen program found
20776747b715Smrg#		 returns the path set by the user in the environment
20786747b715Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20796747b715Smrg#		  'no' user instructs the module not to use doxygen
20806747b715Smrg#
20816747b715Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20826747b715Smrg#
20836747b715SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20846747b715SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20856747b715Smrgm4_define([_defopt], m4_default([$2], [auto]))
20866747b715SmrgAC_ARG_WITH(doxygen,
20876747b715Smrg	AS_HELP_STRING([--with-doxygen],
20886747b715Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
20896747b715Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
20906747b715Smrgm4_undefine([_defopt])
20916747b715Smrg
20926747b715Smrgif test "x$use_doxygen" = x"auto"; then
20936747b715Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
20946747b715Smrg   if test "x$DOXYGEN" = "x"; then
20956747b715Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
20966747b715Smrg	have_doxygen=no
20976747b715Smrg   else
20986747b715Smrg        have_doxygen=yes
20996747b715Smrg   fi
21006747b715Smrgelif test "x$use_doxygen" = x"yes" ; then
21016747b715Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21026747b715Smrg   if test "x$DOXYGEN" = "x"; then
21036747b715Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21046747b715Smrg   fi
21056747b715Smrg   have_doxygen=yes
21066747b715Smrgelif test "x$use_doxygen" = x"no" ; then
21076747b715Smrg   if test "x$DOXYGEN" != "x"; then
21086747b715Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21096747b715Smrg   fi
21106747b715Smrg   have_doxygen=no
21116747b715Smrgelse
21126747b715Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21136747b715Smrgfi
21146747b715Smrgm4_ifval([$1],
21156747b715Smrg[if test "$have_doxygen" = yes; then
21166747b715Smrg    # scrape the doxygen version
21176747b715Smrg    AC_MSG_CHECKING([the doxygen version])
21186747b715Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21196747b715Smrg    AC_MSG_RESULT([$doxygen_version])
21206747b715Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21216747b715Smrg        [if test "x$use_doxygen" = xauto; then
21226747b715Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21236747b715Smrg            have_doxygen=no
21246747b715Smrg        else
21256747b715Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21266747b715Smrg        fi])
21276747b715Smrgfi])
21286747b715SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21296747b715Smrg]) # XORG_WITH_DOXYGEN
21306747b715Smrg
21316747b715Smrg# XORG_WITH_GROFF([DEFAULT])
21326747b715Smrg# ----------------
21336747b715Smrg# Minimum version: 1.6.0
21346747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21356747b715Smrg#
21366747b715Smrg# Documentation tools are not always available on all platforms and sometimes
21376747b715Smrg# not at the appropriate level. This macro enables a module to test for the
21386747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21396747b715Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
21406747b715Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21416747b715Smrg# --with-groff assumes 'auto'.
21426747b715Smrg#
21436747b715Smrg# Interface to module:
21446747b715Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21456747b715Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21466747b715Smrg# HAVE_GROFF_MS: the -ms macros package
21476747b715Smrg# GROFF:	 returns the path of the groff program found
21486747b715Smrg#		 returns the path set by the user in the environment
21496747b715Smrg# --with-groff:	 'yes' user instructs the module to use groff
21506747b715Smrg#		 'no' user instructs the module not to use groff
21516747b715Smrg#
21526747b715Smrg# Added in version 1.9.0:
21536747b715Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21546747b715Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21556747b715Smrg#		   psselect from the psutils package.
21566747b715Smrg#		   the ghostcript package. Refer to the grohtml man pages
21576747b715Smrg#
21586747b715Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21596747b715Smrg#
21606747b715Smrg# OS and distros often splits groff in a basic and full package, the former
21616747b715Smrg# having the groff program and the later having devices, fonts and macros
21626747b715Smrg# Checking for the groff executable is not enough.
21636747b715Smrg#
21646747b715Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21656747b715Smrg# unset HAVE_GROFF or GROFF env variables.
21666747b715Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21676747b715Smrg#
21686747b715SmrgAC_DEFUN([XORG_WITH_GROFF],[
21696747b715SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21706747b715Smrgm4_define([_defopt], m4_default([$1], [auto]))
21716747b715SmrgAC_ARG_WITH(groff,
21726747b715Smrg	AS_HELP_STRING([--with-groff],
21736747b715Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21746747b715Smrg	   [use_groff=$withval], [use_groff=]_defopt)
21756747b715Smrgm4_undefine([_defopt])
21766747b715Smrg
21776747b715Smrgif test "x$use_groff" = x"auto"; then
21786747b715Smrg   AC_PATH_PROG([GROFF], [groff])
21796747b715Smrg   if test "x$GROFF" = "x"; then
21806747b715Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
21816747b715Smrg	have_groff=no
21826747b715Smrg   else
21836747b715Smrg        have_groff=yes
21846747b715Smrg   fi
21856747b715Smrgelif test "x$use_groff" = x"yes" ; then
21866747b715Smrg   AC_PATH_PROG([GROFF], [groff])
21876747b715Smrg   if test "x$GROFF" = "x"; then
21886747b715Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
21896747b715Smrg   fi
21906747b715Smrg   have_groff=yes
21916747b715Smrgelif test "x$use_groff" = x"no" ; then
21926747b715Smrg   if test "x$GROFF" != "x"; then
21936747b715Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
21946747b715Smrg   fi
21956747b715Smrg   have_groff=no
21966747b715Smrgelse
21976747b715Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
21986747b715Smrgfi
21996747b715Smrg
22006747b715Smrg# We have groff, test for the presence of the macro packages
22016747b715Smrgif test "x$have_groff" = x"yes"; then
22026747b715Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22036747b715Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22046747b715Smrg        groff_ms_works=yes
22056747b715Smrg    else
22066747b715Smrg        groff_ms_works=no
22076747b715Smrg    fi
22086747b715Smrg    AC_MSG_RESULT([$groff_ms_works])
22096747b715Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22106747b715Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22116747b715Smrg        groff_mm_works=yes
22126747b715Smrg    else
22136747b715Smrg        groff_mm_works=no
22146747b715Smrg    fi
22156747b715Smrg    AC_MSG_RESULT([$groff_mm_works])
22166747b715Smrgfi
22176747b715Smrg
22186747b715Smrg# We have groff, test for HTML dependencies, one command per package
22196747b715Smrgif test "x$have_groff" = x"yes"; then
22206747b715Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22216747b715Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22226747b715Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22236747b715Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22246747b715Smrg      have_groff_html=yes
22256747b715Smrg   else
22266747b715Smrg      have_groff_html=no
22276747b715Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22286747b715Smrg   fi
22296747b715Smrgfi
22306747b715Smrg
22316747b715Smrg# Set Automake conditionals for Makefiles
22326747b715SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22336747b715SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22346747b715SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22356747b715SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22366747b715Smrg]) # XORG_WITH_GROFF
22376747b715Smrg
2238475c125cSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2239475c125cSmrg# ---------------------------------------
22406747b715Smrg# Minimum version: 1.6.0
22416747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2242475c125cSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22436747b715Smrg#
22446747b715Smrg# Documentation tools are not always available on all platforms and sometimes
22456747b715Smrg# not at the appropriate level. This macro enables a module to test for the
22466747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22476747b715Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
22486747b715Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22496747b715Smrg# --with-fop assumes 'auto'.
22506747b715Smrg#
22516747b715Smrg# Interface to module:
22526747b715Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22536747b715Smrg# FOP:	 	returns the path of the fop program found
22546747b715Smrg#		returns the path set by the user in the environment
22556747b715Smrg# --with-fop: 	'yes' user instructs the module to use fop
22566747b715Smrg#		'no' user instructs the module not to use fop
22576747b715Smrg#
22586747b715Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22596747b715Smrg#
22606747b715SmrgAC_DEFUN([XORG_WITH_FOP],[
22616747b715SmrgAC_ARG_VAR([FOP], [Path to fop command])
2262475c125cSmrgm4_define([_defopt], m4_default([$2], [auto]))
22636747b715SmrgAC_ARG_WITH(fop,
22646747b715Smrg	AS_HELP_STRING([--with-fop],
22656747b715Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22666747b715Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22676747b715Smrgm4_undefine([_defopt])
22686747b715Smrg
22696747b715Smrgif test "x$use_fop" = x"auto"; then
22706747b715Smrg   AC_PATH_PROG([FOP], [fop])
22716747b715Smrg   if test "x$FOP" = "x"; then
22726747b715Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22736747b715Smrg	have_fop=no
22746747b715Smrg   else
22756747b715Smrg        have_fop=yes
22766747b715Smrg   fi
22776747b715Smrgelif test "x$use_fop" = x"yes" ; then
22786747b715Smrg   AC_PATH_PROG([FOP], [fop])
22796747b715Smrg   if test "x$FOP" = "x"; then
22806747b715Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
22816747b715Smrg   fi
22826747b715Smrg   have_fop=yes
22836747b715Smrgelif test "x$use_fop" = x"no" ; then
22846747b715Smrg   if test "x$FOP" != "x"; then
22856747b715Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
22866747b715Smrg   fi
22876747b715Smrg   have_fop=no
22886747b715Smrgelse
22896747b715Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
22906747b715Smrgfi
2291475c125cSmrg
2292475c125cSmrg# Test for a minimum version of fop, if provided.
2293475c125cSmrgm4_ifval([$1],
2294475c125cSmrg[if test "$have_fop" = yes; then
2295475c125cSmrg    # scrape the fop version
2296475c125cSmrg    AC_MSG_CHECKING([for fop minimum version])
2297475c125cSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2298475c125cSmrg    AC_MSG_RESULT([$fop_version])
2299475c125cSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2300475c125cSmrg        [if test "x$use_fop" = xauto; then
2301475c125cSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2302475c125cSmrg            have_fop=no
2303475c125cSmrg        else
2304475c125cSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2305475c125cSmrg        fi])
2306475c125cSmrgfi])
23076747b715SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23086747b715Smrg]) # XORG_WITH_FOP
23096747b715Smrg
23106747b715Smrg# XORG_WITH_PS2PDF([DEFAULT])
23116747b715Smrg# ----------------
23126747b715Smrg# Minimum version: 1.6.0
23136747b715Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23146747b715Smrg#
23156747b715Smrg# Documentation tools are not always available on all platforms and sometimes
23166747b715Smrg# not at the appropriate level. This macro enables a module to test for the
23176747b715Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23186747b715Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
23196747b715Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23206747b715Smrg# --with-ps2pdf assumes 'auto'.
23216747b715Smrg#
23226747b715Smrg# Interface to module:
23236747b715Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23246747b715Smrg# PS2PDF:	returns the path of the ps2pdf program found
23256747b715Smrg#		returns the path set by the user in the environment
23266747b715Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23276747b715Smrg#		 'no' user instructs the module not to use ps2pdf
23286747b715Smrg#
23296747b715Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23306747b715Smrg#
23316747b715SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23326747b715SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23336747b715Smrgm4_define([_defopt], m4_default([$1], [auto]))
23346747b715SmrgAC_ARG_WITH(ps2pdf,
23356747b715Smrg	AS_HELP_STRING([--with-ps2pdf],
23366747b715Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23376747b715Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23386747b715Smrgm4_undefine([_defopt])
23396747b715Smrg
23406747b715Smrgif test "x$use_ps2pdf" = x"auto"; then
23416747b715Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23426747b715Smrg   if test "x$PS2PDF" = "x"; then
23436747b715Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23446747b715Smrg	have_ps2pdf=no
23456747b715Smrg   else
23466747b715Smrg        have_ps2pdf=yes
23476747b715Smrg   fi
23486747b715Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23496747b715Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23506747b715Smrg   if test "x$PS2PDF" = "x"; then
23516747b715Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
23526747b715Smrg   fi
23536747b715Smrg   have_ps2pdf=yes
23546747b715Smrgelif test "x$use_ps2pdf" = x"no" ; then
23556747b715Smrg   if test "x$PS2PDF" != "x"; then
23566747b715Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
23576747b715Smrg   fi
23586747b715Smrg   have_ps2pdf=no
23596747b715Smrgelse
23606747b715Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
23616747b715Smrgfi
23626747b715SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
23636747b715Smrg]) # XORG_WITH_PS2PDF
23646747b715Smrg
23656747b715Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
23666747b715Smrg# ----------------
23676747b715Smrg# Minimum version: 1.6.0
23686747b715Smrg#
23696747b715Smrg# Documentation tools are not always available on all platforms and sometimes
23706747b715Smrg# not at the appropriate level. This macro enables a builder to skip all
23716747b715Smrg# documentation targets except traditional man pages.
23726747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23736747b715Smrg# maximum flexibilty in controlling documentation building.
23746747b715Smrg# Refer to:
23756747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
23766747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23776747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23786747b715Smrg# XORG_WITH_FOP           --with-fop
23796747b715Smrg# XORG_WITH_GROFF         --with-groff
23806747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23816747b715Smrg#
23826747b715Smrg# Interface to module:
23836747b715Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
23846747b715Smrg# --enable-docs: 'yes' user instructs the module to generate docs
23856747b715Smrg#		 'no' user instructs the module not to generate docs
23866747b715Smrg# parm1:	specify the default value, yes or no.
23876747b715Smrg#
23886747b715SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
23898223e2f2Smrgm4_define([docs_default], m4_default([$1], [yes]))
23906747b715SmrgAC_ARG_ENABLE(docs,
23916747b715Smrg	AS_HELP_STRING([--enable-docs],
23928223e2f2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
23938223e2f2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
23948223e2f2Smrgm4_undefine([docs_default])
23956747b715SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
23966747b715SmrgAC_MSG_CHECKING([whether to build documentation])
23976747b715SmrgAC_MSG_RESULT([$build_docs])
23986747b715Smrg]) # XORG_ENABLE_DOCS
23996747b715Smrg
24006747b715Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24016747b715Smrg# ----------------
24026747b715Smrg# Minimum version: 1.6.0
24036747b715Smrg#
24046747b715Smrg# This macro enables a builder to skip all developer documentation.
24056747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24066747b715Smrg# maximum flexibilty in controlling documentation building.
24076747b715Smrg# Refer to:
24086747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
24096747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24106747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24116747b715Smrg# XORG_WITH_FOP           --with-fop
24126747b715Smrg# XORG_WITH_GROFF         --with-groff
24136747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24146747b715Smrg#
24156747b715Smrg# Interface to module:
24166747b715Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24176747b715Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24186747b715Smrg#			'no' user instructs the module not to generate developer docs
24196747b715Smrg# parm1:		specify the default value, yes or no.
24206747b715Smrg#
24216747b715SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24226747b715Smrgm4_define([devel_default], m4_default([$1], [yes]))
24236747b715SmrgAC_ARG_ENABLE(devel-docs,
24246747b715Smrg	AS_HELP_STRING([--enable-devel-docs],
24256747b715Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24266747b715Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24276747b715Smrgm4_undefine([devel_default])
24286747b715SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24296747b715SmrgAC_MSG_CHECKING([whether to build developer documentation])
24306747b715SmrgAC_MSG_RESULT([$build_devel_docs])
24316747b715Smrg]) # XORG_ENABLE_DEVEL_DOCS
24326747b715Smrg
24336747b715Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24346747b715Smrg# ----------------
24356747b715Smrg# Minimum version: 1.6.0
24366747b715Smrg#
24376747b715Smrg# This macro enables a builder to skip all functional specification targets.
24386747b715Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24396747b715Smrg# maximum flexibilty in controlling documentation building.
24406747b715Smrg# Refer to:
24416747b715Smrg# XORG_WITH_XMLTO         --with-xmlto
24426747b715Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24436747b715Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24446747b715Smrg# XORG_WITH_FOP           --with-fop
24456747b715Smrg# XORG_WITH_GROFF         --with-groff
24466747b715Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24476747b715Smrg#
24486747b715Smrg# Interface to module:
24496747b715Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24506747b715Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24516747b715Smrg#			'no' user instructs the module not to generate specs
24526747b715Smrg# parm1:		specify the default value, yes or no.
24536747b715Smrg#
24546747b715SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
24556747b715Smrgm4_define([spec_default], m4_default([$1], [yes]))
24566747b715SmrgAC_ARG_ENABLE(specs,
24576747b715Smrg	AS_HELP_STRING([--enable-specs],
24586747b715Smrg	   [Enable building the specs (default: ]spec_default[)]),
24596747b715Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
24606747b715Smrgm4_undefine([spec_default])
24616747b715SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
24626747b715SmrgAC_MSG_CHECKING([whether to build functional specifications])
24636747b715SmrgAC_MSG_RESULT([$build_specs])
24646747b715Smrg]) # XORG_ENABLE_SPECS
24656747b715Smrg
24669ace9065Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
24679ace9065Smrg# ----------------------------------------------
24689ace9065Smrg# Minimum version: 1.13.0
24699ace9065Smrg#
24709ace9065Smrg# This macro enables a builder to enable/disable unit testing
24719ace9065Smrg# It makes no assumption about the test cases implementation
24729ace9065Smrg# Test cases may or may not use Automake "Support for test suites"
24739ace9065Smrg# They may or may not use the software utility library GLib
24749ace9065Smrg#
24759ace9065Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
24769ace9065Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
24779ace9065Smrg# The variable enable_unit_tests is used by other macros in this file.
24789ace9065Smrg#
24799ace9065Smrg# Interface to module:
24809ace9065Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
24819ace9065Smrg# enable_unit_tests:    used in configure.ac for additional configuration
24829ace9065Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
24839ace9065Smrg#			'no' user instructs the module not to build tests
24849ace9065Smrg# parm1:		specify the default value, yes or no.
24859ace9065Smrg#
24869ace9065SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
24879ace9065SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
24889ace9065SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2489475c125cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24909ace9065Smrgm4_define([_defopt], m4_default([$1], [auto]))
24919ace9065SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
24929ace9065Smrg	[Enable building unit test cases (default: ]_defopt[)]),
24939ace9065Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
24949ace9065Smrgm4_undefine([_defopt])
24959ace9065SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
24969ace9065SmrgAC_MSG_CHECKING([whether to build unit test cases])
24979ace9065SmrgAC_MSG_RESULT([$enable_unit_tests])
24989ace9065Smrg]) # XORG_ENABLE_UNIT_TESTS
24999ace9065Smrg
25009ace9065Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25019ace9065Smrg# ----------------------------------------
25029ace9065Smrg# Minimum version: 1.13.0
25039ace9065Smrg#
25049ace9065Smrg# GLib is a library which provides advanced data structures and functions.
25059ace9065Smrg# This macro enables a module to test for the presence of Glib.
25069ace9065Smrg#
25079ace9065Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25089ace9065Smrg# Otherwise the value of $enable_unit_tests is blank.
25099ace9065Smrg#
25109ace9065Smrg# Interface to module:
25119ace9065Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25129ace9065Smrg# with_glib: used in configure.ac to know if GLib has been found
25139ace9065Smrg# --with-glib:	'yes' user instructs the module to use glib
25149ace9065Smrg#		'no' user instructs the module not to use glib
25159ace9065Smrg#
25169ace9065SmrgAC_DEFUN([XORG_WITH_GLIB],[
25179ace9065SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
25189ace9065Smrgm4_define([_defopt], m4_default([$2], [auto]))
25199ace9065SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
25209ace9065Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
25219ace9065Smrg	[with_glib=$withval], [with_glib=]_defopt)
25229ace9065Smrgm4_undefine([_defopt])
25239ace9065Smrg
25249ace9065Smrghave_glib=no
25259ace9065Smrg# Do not probe GLib if user explicitly disabled unit testing
25269ace9065Smrgif test "x$enable_unit_tests" != x"no"; then
25279ace9065Smrg  # Do not probe GLib if user explicitly disabled it
25289ace9065Smrg  if test "x$with_glib" != x"no"; then
25299ace9065Smrg    m4_ifval(
25309ace9065Smrg      [$1],
25319ace9065Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
25329ace9065Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
25339ace9065Smrg    )
25349ace9065Smrg  fi
25359ace9065Smrgfi
25369ace9065Smrg
25379ace9065Smrg# Not having GLib when unit testing has been explicitly requested is an error
25389ace9065Smrgif test "x$enable_unit_tests" = x"yes"; then
25399ace9065Smrg  if test "x$have_glib" = x"no"; then
25409ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
25419ace9065Smrg  fi
25429ace9065Smrgfi
25439ace9065Smrg
25449ace9065Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
25459ace9065Smrgif test "x$enable_unit_tests" = x"no"; then
25469ace9065Smrg  if test "x$with_glib" = x"yes"; then
25479ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
25489ace9065Smrg  fi
25499ace9065Smrgfi
25509ace9065Smrg
25519ace9065Smrg# Not having GLib when it has been explicitly requested is an error
25529ace9065Smrgif test "x$with_glib" = x"yes"; then
25539ace9065Smrg  if test "x$have_glib" = x"no"; then
25549ace9065Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
25559ace9065Smrg  fi
25569ace9065Smrgfi
25579ace9065Smrg
25589ace9065SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
25599ace9065Smrg]) # XORG_WITH_GLIB
25609ace9065Smrg
2561475c125cSmrg# XORG_LD_WRAP([required|optional])
2562475c125cSmrg# ---------------------------------
25639ace9065Smrg# Minimum version: 1.13.0
25649ace9065Smrg#
25659ace9065Smrg# Check if linker supports -wrap, passed via compiler flags
25669ace9065Smrg#
25679ace9065Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25689ace9065Smrg# Otherwise the value of $enable_unit_tests is blank.
25699ace9065Smrg#
2570475c125cSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2571475c125cSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2572475c125cSmrg# available, an argument of "optional" allows use when some unit tests require
2573475c125cSmrg# ld -wrap and others do not.
2574475c125cSmrg#
25759ace9065SmrgAC_DEFUN([XORG_LD_WRAP],[
2576475c125cSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2577475c125cSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2578475c125cSmrg                      void __wrap_exit(int status) { return; }],
2579475c125cSmrg                     [exit(0);])])
25809ace9065Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2581475c125cSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25829ace9065Smrg  if test "x$have_ld_wrap" = x"no"; then
25839ace9065Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25849ace9065Smrg  fi
25859ace9065Smrgfi
25869ace9065SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25879ace9065Smrg#
25889ace9065Smrg]) # XORG_LD_WRAP
25899ace9065Smrg
25909ace9065Smrg# XORG_CHECK_LINKER_FLAGS
25919ace9065Smrg# -----------------------
25929ace9065Smrg# SYNOPSIS
25939ace9065Smrg#
2594475c125cSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25959ace9065Smrg#
25969ace9065Smrg# DESCRIPTION
25979ace9065Smrg#
25989ace9065Smrg#   Check whether the given linker FLAGS work with the current language's
25999ace9065Smrg#   linker, or whether they give an error.
26009ace9065Smrg#
26019ace9065Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26029ace9065Smrg#   success/failure.
26039ace9065Smrg#
2604475c125cSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2605475c125cSmrg#
26069ace9065Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26079ace9065Smrg#
26089ace9065Smrg# LICENSE
26099ace9065Smrg#
26109ace9065Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26119ace9065Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26129ace9065Smrg#   Copyright (c) 2009 Matteo Frigo
26139ace9065Smrg#
26149ace9065Smrg#   This program is free software: you can redistribute it and/or modify it
26159ace9065Smrg#   under the terms of the GNU General Public License as published by the
26169ace9065Smrg#   Free Software Foundation, either version 3 of the License, or (at your
26179ace9065Smrg#   option) any later version.
26189ace9065Smrg#
26199ace9065Smrg#   This program is distributed in the hope that it will be useful, but
26209ace9065Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
26219ace9065Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
26229ace9065Smrg#   Public License for more details.
26239ace9065Smrg#
26249ace9065Smrg#   You should have received a copy of the GNU General Public License along
26259ace9065Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
26269ace9065Smrg#
26279ace9065Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
26289ace9065Smrg#   gives unlimited permission to copy, distribute and modify the configure
26299ace9065Smrg#   scripts that are the output of Autoconf when processing the Macro. You
26309ace9065Smrg#   need not follow the terms of the GNU General Public License when using
26319ace9065Smrg#   or distributing such scripts, even though portions of the text of the
26329ace9065Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
26339ace9065Smrg#   all other use of the material that constitutes the Autoconf Macro.
26349ace9065Smrg#
26359ace9065Smrg#   This special exception to the GPL applies to versions of the Autoconf
26369ace9065Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
26379ace9065Smrg#   modified version of the Autoconf Macro, you may extend this special
26389ace9065Smrg#   exception to the GPL to apply to your modified version as well.#
26399ace9065SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
26409ace9065Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
26419ace9065Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
26429ace9065SmrgAS_LITERAL_IF([$1],
26439ace9065Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
26449ace9065Smrg      ax_save_FLAGS=$LDFLAGS
26459ace9065Smrg      LDFLAGS="$1"
2646475c125cSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
26479ace9065Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
26489ace9065Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26499ace9065Smrg      LDFLAGS=$ax_save_FLAGS])],
26509ace9065Smrg  [ax_save_FLAGS=$LDFLAGS
26519ace9065Smrg   LDFLAGS="$1"
26529ace9065Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
26539ace9065Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
26549ace9065Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26559ace9065Smrg   LDFLAGS=$ax_save_FLAGS])
26569ace9065Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
26579ace9065SmrgAC_MSG_RESULT($xorg_check_linker_flags)
26589ace9065Smrgif test "x$xorg_check_linker_flags" = xyes; then
26599ace9065Smrg	m4_default([$2], :)
26609ace9065Smrgelse
26619ace9065Smrg	m4_default([$3], :)
26629ace9065Smrgfi
26639ace9065Smrg]) # XORG_CHECK_LINKER_FLAGS
26649ace9065Smrg
2665475c125cSmrg# XORG_MEMORY_CHECK_FLAGS
2666475c125cSmrg# -----------------------
2667475c125cSmrg# Minimum version: 1.16.0
2668475c125cSmrg#
2669475c125cSmrg# This macro attempts to find appropriate memory checking functionality
2670475c125cSmrg# for various platforms which unit testing code may use to catch various
2671475c125cSmrg# forms of memory allocation and access errors in testing.
2672475c125cSmrg#
2673475c125cSmrg# Interface to module:
2674475c125cSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2675475c125cSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2676475c125cSmrg#
2677475c125cSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2678475c125cSmrg#
2679475c125cSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2680475c125cSmrg
2681475c125cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2682475c125cSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2683475c125cSmrg           [Environment variables to enable memory checking in tests])
2684475c125cSmrg
2685475c125cSmrg# Check for different types of support on different platforms
2686475c125cSmrgcase $host_os in
2687475c125cSmrg    solaris*)
2688475c125cSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2689475c125cSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2690475c125cSmrg        ;;
2691475c125cSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2692475c125cSmrg        # both directly and inverted, so should not be 0 or 255.
2693475c125cSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2694475c125cSmrg        ;;
2695475c125cSmrg    darwin*)
2696475c125cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2697475c125cSmrg        ;;
2698475c125cSmrg    *bsd*)
2699475c125cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2700475c125cSmrg        ;;
2701475c125cSmrgesac
2702475c125cSmrg
2703475c125cSmrg# User supplied flags override default flags
2704475c125cSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2705475c125cSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2706475c125cSmrgfi
2707475c125cSmrg
2708475c125cSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2709475c125cSmrg]) # XORG_WITH_LINT
2710475c125cSmrg
27114642e01fSmrg# XORG_CHECK_MALLOC_ZERO
27124642e01fSmrg# ----------------------
27134642e01fSmrg# Minimum version: 1.0.0
27144642e01fSmrg#
27154642e01fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
27164642e01fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
27174642e01fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
27184642e01fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
27194642e01fSmrgAC_ARG_ENABLE(malloc0returnsnull,
2720b1d344b3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
27214642e01fSmrg		       [malloc(0) returns NULL (default: auto)]),
27224642e01fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
27234642e01fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
27244642e01fSmrg
27254642e01fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
27264642e01fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
27278223e2f2Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
27288223e2f2Smrg#include <stdlib.h>
27298223e2f2Smrg],[
27304642e01fSmrg    char *m0, *r0, *c0, *p;
27314642e01fSmrg    m0 = malloc(0);
27324642e01fSmrg    p = malloc(10);
27334642e01fSmrg    r0 = realloc(p,0);
27348223e2f2Smrg    c0 = calloc(0,10);
27358223e2f2Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
27368223e2f2Smrg])],
27374642e01fSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
27386747b715Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
27396747b715Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
27404642e01fSmrgfi
27414642e01fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
27424642e01fSmrg
27434642e01fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
27444642e01fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
27454642e01fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
27464642e01fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
27474642e01fSmrgelse
27484642e01fSmrg	MALLOC_ZERO_CFLAGS=""
27494642e01fSmrg	XMALLOC_ZERO_CFLAGS=""
27504642e01fSmrg	XTMALLOC_ZERO_CFLAGS=""
27514642e01fSmrgfi
27524642e01fSmrg
27534642e01fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
27544642e01fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
27554642e01fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
27564642e01fSmrg]) # XORG_CHECK_MALLOC_ZERO
27574642e01fSmrg
27584642e01fSmrg# XORG_WITH_LINT()
27594642e01fSmrg# ----------------
27604642e01fSmrg# Minimum version: 1.1.0
27614642e01fSmrg#
27626747b715Smrg# This macro enables the use of a tool that flags some suspicious and
27636747b715Smrg# non-portable constructs (likely to be bugs) in C language source code.
27646747b715Smrg# It will attempt to locate the tool and use appropriate options.
27656747b715Smrg# There are various lint type tools on different platforms.
27666747b715Smrg#
27676747b715Smrg# Interface to module:
27686747b715Smrg# LINT:		returns the path to the tool found on the platform
27696747b715Smrg#		or the value set to LINT on the configure cmd line
27706747b715Smrg#		also an Automake conditional
27716747b715Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
27726747b715Smrg#
27736747b715Smrg# --with-lint:	'yes' user instructs the module to use lint
27746747b715Smrg#		'no' user instructs the module not to use lint (default)
27756747b715Smrg#
27766747b715Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
27776747b715Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27784642e01fSmrg#
27794642e01fSmrgAC_DEFUN([XORG_WITH_LINT],[
27804642e01fSmrg
27816747b715SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
27826747b715SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2783b1d344b3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27844642e01fSmrg		[Use a lint-style source code checker (default: disabled)])],
27854642e01fSmrg		[use_lint=$withval], [use_lint=no])
27866747b715Smrg
27876747b715Smrg# Obtain platform specific info like program name and options
27886747b715Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
27896747b715Smrgcase $host_os in
27906747b715Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
27916747b715Smrg	lint_name=splint
27926747b715Smrg	lint_options="-badflag"
27936747b715Smrg	;;
27946747b715Smrg  *freebsd* | *netbsd*)
27956747b715Smrg	lint_name=lint
27966747b715Smrg	lint_options="-u -b"
27976747b715Smrg	;;
27986747b715Smrg  *solaris*)
27996747b715Smrg	lint_name=lint
28006747b715Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28016747b715Smrg	;;
28026747b715Smrgesac
28036747b715Smrg
28046747b715Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28056747b715Smrgif test "x$use_lint" = x"yes" ; then
28066747b715Smrg   AC_PATH_PROG([LINT], [$lint_name])
28076747b715Smrg   if test "x$LINT" = "x"; then
28086747b715Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28096747b715Smrg   fi
28106747b715Smrgelif test "x$use_lint" = x"no" ; then
28116747b715Smrg   if test "x$LINT" != "x"; then
28126747b715Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28136747b715Smrg   fi
28144642e01fSmrgelse
28156747b715Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
28164642e01fSmrgfi
28176747b715Smrg
28186747b715Smrg# User supplied flags override default flags
28196747b715Smrgif test "x$LINT_FLAGS" != "x"; then
28206747b715Smrg   lint_options=$LINT_FLAGS
28214642e01fSmrgfi
28224642e01fSmrg
28236747b715SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
28246747b715SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
28254642e01fSmrg
28264642e01fSmrg]) # XORG_WITH_LINT
28274642e01fSmrg
28284642e01fSmrg# XORG_LINT_LIBRARY(LIBNAME)
28294642e01fSmrg# --------------------------
28304642e01fSmrg# Minimum version: 1.1.0
28314642e01fSmrg#
28324642e01fSmrg# Sets up flags for building lint libraries for checking programs that call
28334642e01fSmrg# functions in the library.
28344642e01fSmrg#
28356747b715Smrg# Interface to module:
28366747b715Smrg# LINTLIB		- Automake variable with the name of lint library file to make
28376747b715Smrg# MAKE_LINT_LIB		- Automake conditional
28386747b715Smrg#
28396747b715Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
28406747b715Smrg#			  - 'no' user instructs the module not to create a lint library (default)
28414642e01fSmrg
28424642e01fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
28434642e01fSmrgAC_REQUIRE([XORG_WITH_LINT])
2844b1d344b3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
28454642e01fSmrg	[Create lint library (default: disabled)])],
28464642e01fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
28476747b715Smrg
28486747b715Smrgif test "x$make_lint_lib" = x"yes" ; then
28496747b715Smrg   LINTLIB=llib-l$1.ln
28506747b715Smrg   if test "x$LINT" = "x"; then
28516747b715Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
28526747b715Smrg   fi
28536747b715Smrgelif test "x$make_lint_lib" != x"no" ; then
28546747b715Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
28554642e01fSmrgfi
28566747b715Smrg
28574642e01fSmrgAC_SUBST(LINTLIB)
28584642e01fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
28594642e01fSmrg
28604642e01fSmrg]) # XORG_LINT_LIBRARY
28614642e01fSmrg
28629ace9065Smrg# XORG_COMPILER_BRAND
28639ace9065Smrg# -------------------
28649ace9065Smrg# Minimum version: 1.14.0
28659ace9065Smrg#
28669ace9065Smrg# Checks for various brands of compilers and sets flags as appropriate:
28679ace9065Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28689ace9065Smrg#   clang compiler - sets CLANGCC to "yes"
28699ace9065Smrg#   Intel compiler - sets INTELCC to "yes"
28709ace9065Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28719ace9065Smrg#
28729ace9065SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28739ace9065SmrgAC_REQUIRE([AC_PROG_CC_C99])
28749ace9065SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28759ace9065SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28769ace9065SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28779ace9065Smrg]) # XORG_COMPILER_BRAND
28789ace9065Smrg
2879475c125cSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2880475c125cSmrg# ---------------
2881475c125cSmrg# Minimum version: 1.16.0
2882475c125cSmrg#
2883475c125cSmrg# Test if the compiler works when passed the given flag as a command line argument.
2884475c125cSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2885475c125cSmrg# next flag in the list until there are no more options.
2886475c125cSmrg#
2887475c125cSmrg# Note that this does not guarantee that the compiler supports the flag as some
2888475c125cSmrg# compilers will simply ignore arguments that they do not understand, but we do
2889475c125cSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2890475c125cSmrg# -Werror=unused-command-line-argument
2891475c125cSmrg#
2892475c125cSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2893475c125cSmrgAC_REQUIRE([AC_PROG_CC_C99])
2894475c125cSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2895475c125cSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2896475c125cSmrg
2897475c125cSmrgxorg_testset_save_CFLAGS="$CFLAGS"
2898475c125cSmrg
2899475c125cSmrgif test "x$xorg_testset_unknown_warning_option" = "x" ; then
2900475c125cSmrg	CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2901475c125cSmrg	AC_MSG_CHECKING([if $CC supports -Werror=unknown-warning-option])
2902475c125cSmrg	AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2903475c125cSmrg	                  [xorg_testset_unknown_warning_option=yes],
2904475c125cSmrg	                  [xorg_testset_unknown_warning_option=no])
2905475c125cSmrg	AC_MSG_RESULT([$xorg_testset_unknown_warning_option])
2906475c125cSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
2907475c125cSmrgfi
2908475c125cSmrg
2909475c125cSmrgif test "x$xorg_testset_unused_command_line_argument" = "x" ; then
2910475c125cSmrg	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2911475c125cSmrg		CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2912475c125cSmrg	fi
2913475c125cSmrg	CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2914475c125cSmrg	AC_MSG_CHECKING([if $CC supports -Werror=unused-command-line-argument])
2915475c125cSmrg	AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2916475c125cSmrg	                  [xorg_testset_unused_command_line_argument=yes],
2917475c125cSmrg	                  [xorg_testset_unused_command_line_argument=no])
2918475c125cSmrg	AC_MSG_RESULT([$xorg_testset_unused_command_line_argument])
2919475c125cSmrg	CFLAGS="$xorg_testset_save_CFLAGS"
2920475c125cSmrgfi
2921475c125cSmrg
2922475c125cSmrgfound="no"
2923475c125cSmrgm4_foreach([flag], m4_cdr($@), [
2924475c125cSmrg	if test $found = "no" ; then
2925475c125cSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2926475c125cSmrg			CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2927475c125cSmrg		fi
2928475c125cSmrg
2929475c125cSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2930475c125cSmrg			CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2931475c125cSmrg		fi
2932475c125cSmrg
2933475c125cSmrg		CFLAGS="$CFLAGS ]flag["
2934475c125cSmrg
2935475c125cSmrg		AC_MSG_CHECKING([if $CC supports ]flag[])
2936475c125cSmrg		AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2937475c125cSmrg		                  [supported=yes], [supported=no])
2938475c125cSmrg		AC_MSG_RESULT([$supported])
2939475c125cSmrg		CFLAGS="$xorg_testset_save_CFLAGS"
2940475c125cSmrg
2941475c125cSmrg		if test "$supported" = "yes" ; then
2942475c125cSmrg			$1="$$1 ]flag["
2943475c125cSmrg			found="yes"
2944475c125cSmrg		fi
2945475c125cSmrg	fi
2946475c125cSmrg])
2947475c125cSmrg]) # XORG_TESTSET_CFLAG
2948475c125cSmrg
2949475c125cSmrg# XORG_COMPILER_FLAGS
2950475c125cSmrg# ---------------
2951475c125cSmrg# Minimum version: 1.16.0
2952475c125cSmrg#
2953475c125cSmrg# Defines BASE_CFLAGS to contain a set of command line arguments supported
2954475c125cSmrg# by the selected compiler which do NOT alter the generated code.  These
2955475c125cSmrg# arguments will cause the compiler to print various warnings during
2956475c125cSmrg# compilation AND turn a conservative set of warnings into errors.
2957475c125cSmrg#
2958475c125cSmrg# The set of flags supported by BASE_CFLAGS will grow in future
2959475c125cSmrg# versions of util-macros as options are added to new compilers.
2960475c125cSmrg#
2961475c125cSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2962475c125cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2963475c125cSmrg
2964475c125cSmrgAC_ARG_ENABLE(selective-werror,
2965475c125cSmrg              AS_HELP_STRING([--disable-selective-werror],
2966475c125cSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2967475c125cSmrg              [SELECTIVE_WERROR=$enableval],
2968475c125cSmrg              [SELECTIVE_WERROR=yes])
2969475c125cSmrg
2970475c125cSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2971475c125cSmrgif test "x$SUNCC" = "xyes"; then
2972475c125cSmrg    BASE_CFLAGS="-v"
2973475c125cSmrgelse
2974475c125cSmrg    BASE_CFLAGS=""
2975475c125cSmrgfi
2976475c125cSmrg
2977475c125cSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2978475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
2979475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
2980475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
2981475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
2982475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
2983475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
2984475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
2985475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
2986475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
2987475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
2988475c125cSmrg
2989475c125cSmrg# This chunk adds additional warnings that could catch undesired effects.
2990475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
2991475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
2992475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
2993475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
2994475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
2995475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
2996475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
2997475c125cSmrg
2998475c125cSmrg# These are currently disabled because they are noisy.  They will be enabled
2999475c125cSmrg# in the future once the codebase is sufficiently modernized to silence
3000475c125cSmrg# them.  For now, I don't want them to drown out the other warnings.
3001475c125cSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
3002475c125cSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
3003475c125cSmrg# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
3004475c125cSmrg
3005475c125cSmrg# Turn some warnings into errors, so we don't accidently get successful builds
3006475c125cSmrg# when there are problems that should be fixed.
3007475c125cSmrg
3008475c125cSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3009475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3010475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
3011475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
3012475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
3013475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
3014475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
3015475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3016475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
3017475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
3018475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
3019475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
3020475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3021475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3022475c125cSmrgelse
3023475c125cSmrgAC_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])
3024475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
3025475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
3026475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
3027475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
3028475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
3029475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
3030475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
3031475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
3032475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
3033475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
3034475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
3035475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
3036475c125cSmrgXORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
3037475c125cSmrgfi
3038475c125cSmrg
3039475c125cSmrgAC_SUBST([BASE_CFLAGS])
3040475c125cSmrg]) # XORG_COMPILER_FLAGS
3041475c125cSmrg
30424642e01fSmrg# XORG_CWARNFLAGS
30434642e01fSmrg# ---------------
30444642e01fSmrg# Minimum version: 1.2.0
3045475c125cSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30464642e01fSmrg#
30474642e01fSmrg# Defines CWARNFLAGS to enable C compiler warnings.
30484642e01fSmrg#
3049475c125cSmrg# This function is deprecated because it defines -fno-strict-aliasing
3050475c125cSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3051475c125cSmrg# is needed, then it should be added explicitly in the module when
3052475c125cSmrg# it is updated to use BASE_CFLAGS.
3053475c125cSmrg#
30544642e01fSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3055475c125cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30569ace9065SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3057475c125cSmrgCWARNFLAGS="$BASE_CFLAGS"
30584642e01fSmrgif  test "x$GCC" = xyes ; then
3059475c125cSmrg    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30604642e01fSmrgfi
30614642e01fSmrgAC_SUBST(CWARNFLAGS)
30624642e01fSmrg]) # XORG_CWARNFLAGS
3063b1d344b3Smrg
3064b1d344b3Smrg# XORG_STRICT_OPTION
3065b1d344b3Smrg# -----------------------
3066b1d344b3Smrg# Minimum version: 1.3.0
3067b1d344b3Smrg#
30689ace9065Smrg# Add configure option to enable strict compilation flags, such as treating
30699ace9065Smrg# warnings as fatal errors.
30709ace9065Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3071475c125cSmrg# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
30729ace9065Smrg#
30739ace9065Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30749ace9065Smrg# when strict compilation is unconditionally desired.
3075b1d344b3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3076b1d344b3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3077475c125cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3078b1d344b3Smrg
3079b1d344b3SmrgAC_ARG_ENABLE(strict-compilation,
3080b1d344b3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3081b1d344b3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3082b1d344b3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3083475c125cSmrg
3084475c125cSmrgSTRICT_CFLAGS=""
3085475c125cSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
3086475c125cSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
3087475c125cSmrg
3088475c125cSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3089475c125cSmrg# activate it with -Werror, so we add it here explicitly.
3090475c125cSmrgXORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
3091475c125cSmrg
3092b1d344b3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3093475c125cSmrg    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
30949ace9065Smrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
3095b1d344b3Smrgfi
30969ace9065SmrgAC_SUBST([STRICT_CFLAGS])
3097475c125cSmrgAC_SUBST([BASE_CFLAGS])
3098b1d344b3SmrgAC_SUBST([CWARNFLAGS])
3099b1d344b3Smrg]) # XORG_STRICT_OPTION
3100b1d344b3Smrg
3101b1d344b3Smrg# XORG_DEFAULT_OPTIONS
3102b1d344b3Smrg# --------------------
3103b1d344b3Smrg# Minimum version: 1.3.0
3104b1d344b3Smrg#
3105b1d344b3Smrg# Defines default options for X.Org modules.
3106b1d344b3Smrg#
3107b1d344b3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
31086747b715SmrgAC_REQUIRE([AC_PROG_INSTALL])
3109475c125cSmrgXORG_COMPILER_FLAGS
3110b1d344b3SmrgXORG_CWARNFLAGS
3111b1d344b3SmrgXORG_STRICT_OPTION
3112b1d344b3SmrgXORG_RELEASE_VERSION
3113b1d344b3SmrgXORG_CHANGELOG
31146747b715SmrgXORG_INSTALL
3115b1d344b3SmrgXORG_MANPAGE_SECTIONS
31166747b715Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
31176747b715Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3118b1d344b3Smrg]) # XORG_DEFAULT_OPTIONS
31196747b715Smrg
31206747b715Smrg# XORG_INSTALL()
31216747b715Smrg# ----------------
31226747b715Smrg# Minimum version: 1.4.0
31236747b715Smrg#
31246747b715Smrg# Defines the variable INSTALL_CMD as the command to copy
31256747b715Smrg# INSTALL from $prefix/share/util-macros.
31266747b715Smrg#
31276747b715SmrgAC_DEFUN([XORG_INSTALL], [
31286747b715SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
31296747b715Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
31306747b715SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
31316747b715Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
31326747b715Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
31336747b715Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
31346747b715SmrgAC_SUBST([INSTALL_CMD])
31356747b715Smrg]) # XORG_INSTALL
31364642e01fSmrgdnl Copyright 2005 Red Hat, Inc
31374642e01fSmrgdnl
31384642e01fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31394642e01fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
31404642e01fSmrgdnl the above copyright notice appear in all copies and that both that
31414642e01fSmrgdnl copyright notice and this permission notice appear in supporting
31424642e01fSmrgdnl documentation.
31434642e01fSmrgdnl
31444642e01fSmrgdnl The above copyright notice and this permission notice shall be included
31454642e01fSmrgdnl in all copies or substantial portions of the Software.
31464642e01fSmrgdnl
31474642e01fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31484642e01fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31494642e01fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31504642e01fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
31514642e01fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31524642e01fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31534642e01fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
31544642e01fSmrgdnl
31554642e01fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
31564642e01fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
31574642e01fSmrgdnl other dealings in this Software without prior written authorization
31584642e01fSmrgdnl from the copyright holders.
31594642e01fSmrgdnl
31604642e01fSmrg
31614642e01fSmrg# XORG_RELEASE_VERSION
31624642e01fSmrg# --------------------
31636747b715Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
31644642e01fSmrg 
31654642e01fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31664642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31674642e01fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31684642e01fSmrg		[Major version of this package])
31694642e01fSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31704642e01fSmrg	if test "x$PVM" = "x"; then
31714642e01fSmrg		PVM="0"
31724642e01fSmrg	fi
31734642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31744642e01fSmrg		[$PVM],
31754642e01fSmrg		[Minor version of this package])
31764642e01fSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31774642e01fSmrg	if test "x$PVP" = "x"; then
31784642e01fSmrg		PVP="0"
31794642e01fSmrg	fi
31804642e01fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31814642e01fSmrg		[$PVP],
31824642e01fSmrg		[Patch version of this package])
31834642e01fSmrg])
31844642e01fSmrg
31854642e01fSmrg# XORG_CHANGELOG()
31864642e01fSmrg# ----------------
31874642e01fSmrg# Minimum version: 1.2.0
31884642e01fSmrg#
31894642e01fSmrg# Defines the variable CHANGELOG_CMD as the command to generate
31904642e01fSmrg# ChangeLog from git.
31914642e01fSmrg#
319252397711Smrg#
31934642e01fSmrgAC_DEFUN([XORG_CHANGELOG], [
31946747b715SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
31956747b715Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
31966747b715Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31974642e01fSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31984642e01fSmrgAC_SUBST([CHANGELOG_CMD])
31994642e01fSmrg]) # XORG_CHANGELOG
32004642e01fSmrg
32014642e01fSmrgdnl
32028223e2f2Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
32038223e2f2Smrgdnl
32048223e2f2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
32058223e2f2Smrgdnl copy of this software and associated documentation files (the "Software"),
32068223e2f2Smrgdnl to deal in the Software without restriction, including without limitation
32078223e2f2Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
32088223e2f2Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
32098223e2f2Smrgdnl Software is furnished to do so, subject to the following conditions:
32108223e2f2Smrgdnl
32118223e2f2Smrgdnl The above copyright notice and this permission notice (including the next
32128223e2f2Smrgdnl paragraph) shall be included in all copies or substantial portions of the
32138223e2f2Smrgdnl Software.
32148223e2f2Smrgdnl
32158223e2f2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32168223e2f2Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32178223e2f2Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
32188223e2f2Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32198223e2f2Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
32208223e2f2Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32218223e2f2Smrgdnl DEALINGS IN THE SOFTWARE.
32228223e2f2Smrgdnl
32234642e01fSmrg
32244642e01fSmrg# XTRANS_TCP_FLAGS()
32254642e01fSmrg# ------------------
32264642e01fSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
32274642e01fSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
32284642e01fSmrg # SVR4 hides these in libraries other than libc
32294642e01fSmrg AC_SEARCH_LIBS(socket, [socket])
32304642e01fSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
32316747b715Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
32326747b715Smrg   AC_HAVE_LIBRARY([ws2_32])
32336747b715Smrg fi
32344642e01fSmrg
32354642e01fSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
32364642e01fSmrg AC_ARG_ENABLE(ipv6, 
323752397711Smrg	AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
32384642e01fSmrg	[IPV6CONN=$enableval], 
32394642e01fSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
32404642e01fSmrg AC_MSG_CHECKING([if IPv6 support should be built])
32414642e01fSmrg if test "$IPV6CONN" = "yes"; then
32424642e01fSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
32434642e01fSmrg fi
32444642e01fSmrg AC_MSG_RESULT($IPV6CONN)
32454642e01fSmrg
32464642e01fSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
32474642e01fSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len], 
32484642e01fSmrg	AC_DEFINE([BSD44SOCKETS],1,
32494642e01fSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
32504642e01fSmrg#include <sys/types.h>
32514642e01fSmrg#include <sys/socket.h>
32524642e01fSmrg#include <netinet/in.h>
32534642e01fSmrg ])
32544642e01fSmrg
32554642e01fSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
32564642e01fSmrg AC_CHECK_TYPES([socklen_t], [], [], [
32574642e01fSmrgAC_INCLUDES_DEFAULT
32584642e01fSmrg#include <sys/socket.h>])
32594642e01fSmrg 
32604642e01fSmrg]) # XTRANS_TCP_FLAGS
32614642e01fSmrg
32624642e01fSmrg# XTRANS_CONNECTION_FLAGS()
32634642e01fSmrg# -------------------------
32644642e01fSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
32654642e01fSmrg# that use Xtrans functions
32664642e01fSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
32674642e01fSmrg AC_REQUIRE([AC_CANONICAL_HOST])
32684642e01fSmrg AC_REQUIRE([AC_TYPE_SIGNAL])
32694642e01fSmrg [case $host_os in
32704642e01fSmrg	mingw*)	unixdef="no"   ;;
32714642e01fSmrg	*)	unixdef="yes"  ;;
32724642e01fSmrg esac]
32734642e01fSmrg AC_ARG_ENABLE(unix-transport,
32744642e01fSmrg	AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
32754642e01fSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
32764642e01fSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
32774642e01fSmrg if test "$UNIXCONN" = "yes"; then
32784642e01fSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
32794642e01fSmrg fi
32804642e01fSmrg AC_MSG_RESULT($UNIXCONN)
32814642e01fSmrg AC_ARG_ENABLE(tcp-transport, 
32824642e01fSmrg	AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
32834642e01fSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
32844642e01fSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
32854642e01fSmrg AC_MSG_RESULT($TCPCONN)
32864642e01fSmrg if test "$TCPCONN" = "yes"; then
32874642e01fSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
32884642e01fSmrg	XTRANS_TCP_FLAGS
32894642e01fSmrg fi
32904642e01fSmrg [case $host_os in
32914642e01fSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
32924642e01fSmrg	*)			localdef="no"  ;;
32934642e01fSmrg esac]
32944642e01fSmrg AC_ARG_ENABLE(local-transport,
32954642e01fSmrg	AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
32964642e01fSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
32974642e01fSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
32984642e01fSmrg AC_MSG_RESULT($LOCALCONN)
32994642e01fSmrg if test "$LOCALCONN" = "yes"; then
33004642e01fSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
33014642e01fSmrg fi
33024642e01fSmrg 
33034642e01fSmrg]) # XTRANS_CONNECTION_FLAGS
33044642e01fSmrg
33054642e01fSmrg
33064642e01fSmrg# XTRANS_SECURE_RPC_FLAGS()
33074642e01fSmrg# -------------------------
33084642e01fSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
33094642e01fSmrg# so that any necessary networking libraries are already found
33104642e01fSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
33114642e01fSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
33124642e01fSmrg AC_ARG_ENABLE(secure-rpc, 
33134642e01fSmrg	AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
33144642e01fSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
33154642e01fSmrg
33164642e01fSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
33174642e01fSmrg	FOUND_SECURE_RPC="no"
33184642e01fSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
33194642e01fSmrg			[FOUND_SECURE_RPC="yes"])
33204642e01fSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
33214642e01fSmrg		if test "x$SECURE_RPC" = "xyes" ; then
33224642e01fSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
33234642e01fSmrg		fi	
33244642e01fSmrg		SECURE_RPC="no"
33254642e01fSmrg	else
33264642e01fSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
33274642e01fSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
33284642e01fSmrg		SECURE_RPC="yes"
33294642e01fSmrg	fi
33304642e01fSmrg fi
33314642e01fSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
33324642e01fSmrg if test "x$SECURE_RPC" = "xyes" ; then
33334642e01fSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
33344642e01fSmrg fi
33354642e01fSmrg AC_MSG_RESULT($SECURE_RPC)
33364642e01fSmrg]) # XTRANS_SECURE_RPC_FLAGS
33374642e01fSmrg
33384642e01fSmrg
3339