aclocal.m4 revision b4485a66
1# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
5# Inc.
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13# PARTICULAR PURPOSE.
14
15m4_ifndef([AC_AUTOCONF_VERSION],
16  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18[m4_warning([this file was generated for autoconf 2.68.
19You have another version of autoconf.  It may work, but is not guaranteed to.
20If you have problems, you may need to regenerate the build system entirely.
21To do so, use the procedure documented by the package, typically `autoreconf'.])])
22
23# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
24# Foundation, Inc.
25#
26# This file is free software; the Free Software Foundation
27# gives unlimited permission to copy and/or distribute it,
28# with or without modifications, as long as this notice is preserved.
29
30# serial 1
31
32# AM_AUTOMAKE_VERSION(VERSION)
33# ----------------------------
34# Automake X.Y traces this macro to ensure aclocal.m4 has been
35# generated from the m4 files accompanying Automake X.Y.
36# (This private macro should not be called outside this file.)
37AC_DEFUN([AM_AUTOMAKE_VERSION],
38[am__api_version='1.11'
39dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40dnl require some minimum version.  Point them to the right macro.
41m4_if([$1], [1.11.2], [],
42      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43])
44
45# _AM_AUTOCONF_VERSION(VERSION)
46# -----------------------------
47# aclocal traces this macro to find the Autoconf version.
48# This is a private macro too.  Using m4_define simplifies
49# the logic in aclocal, which can simply ignore this definition.
50m4_define([_AM_AUTOCONF_VERSION], [])
51
52# AM_SET_CURRENT_AUTOMAKE_VERSION
53# -------------------------------
54# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
55# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
57[AM_AUTOMAKE_VERSION([1.11.2])dnl
58m4_ifndef([AC_AUTOCONF_VERSION],
59  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
60_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61
62# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
63
64# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65#
66# This file is free software; the Free Software Foundation
67# gives unlimited permission to copy and/or distribute it,
68# with or without modifications, as long as this notice is preserved.
69
70# serial 1
71
72# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75#
76# Of course, Automake must honor this variable whenever it calls a
77# tool from the auxiliary directory.  The problem is that $srcdir (and
78# therefore $ac_aux_dir as well) can be either absolute or relative,
79# depending on how configure is run.  This is pretty annoying, since
80# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81# source directory, any form will work fine, but in subdirectories a
82# relative path needs to be adjusted first.
83#
84# $ac_aux_dir/missing
85#    fails when called from a subdirectory if $ac_aux_dir is relative
86# $top_srcdir/$ac_aux_dir/missing
87#    fails if $ac_aux_dir is absolute,
88#    fails when called from a subdirectory in a VPATH build with
89#          a relative $ac_aux_dir
90#
91# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92# are both prefixed by $srcdir.  In an in-source build this is usually
93# harmless because $srcdir is `.', but things will broke when you
94# start a VPATH build or use an absolute $srcdir.
95#
96# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99# and then we would define $MISSING as
100#   MISSING="\${SHELL} $am_aux_dir/missing"
101# This will work as long as MISSING is not called from configure, because
102# unfortunately $(top_srcdir) has no meaning in configure.
103# However there are other variables, like CC, which are often used in
104# configure, and could therefore not use this "fixed" $ac_aux_dir.
105#
106# Another solution, used here, is to always expand $ac_aux_dir to an
107# absolute PATH.  The drawback is that using absolute paths prevent a
108# configured tree to be moved without reconfiguration.
109
110AC_DEFUN([AM_AUX_DIR_EXPAND],
111[dnl Rely on autoconf to set up CDPATH properly.
112AC_PREREQ([2.50])dnl
113# expand $ac_aux_dir to an absolute path
114am_aux_dir=`cd $ac_aux_dir && pwd`
115])
116
117# AM_CONDITIONAL                                            -*- Autoconf -*-
118
119# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120# Free Software Foundation, Inc.
121#
122# This file is free software; the Free Software Foundation
123# gives unlimited permission to copy and/or distribute it,
124# with or without modifications, as long as this notice is preserved.
125
126# serial 9
127
128# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129# -------------------------------------
130# Define a conditional.
131AC_DEFUN([AM_CONDITIONAL],
132[AC_PREREQ(2.52)dnl
133 ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
134	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135AC_SUBST([$1_TRUE])dnl
136AC_SUBST([$1_FALSE])dnl
137_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138_AM_SUBST_NOTMAKE([$1_FALSE])dnl
139m4_define([_AM_COND_VALUE_$1], [$2])dnl
140if $2; then
141  $1_TRUE=
142  $1_FALSE='#'
143else
144  $1_TRUE='#'
145  $1_FALSE=
146fi
147AC_CONFIG_COMMANDS_PRE(
148[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149  AC_MSG_ERROR([[conditional "$1" was never defined.
150Usually this means the macro was only invoked conditionally.]])
151fi])])
152
153# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
154# 2010, 2011 Free Software Foundation, Inc.
155#
156# This file is free software; the Free Software Foundation
157# gives unlimited permission to copy and/or distribute it,
158# with or without modifications, as long as this notice is preserved.
159
160# serial 12
161
162# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163# written in clear, in which case automake, when reading aclocal.m4,
164# will think it sees a *use*, and therefore will trigger all it's
165# C support machinery.  Also note that it means that autoscan, seeing
166# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167
168
169# _AM_DEPENDENCIES(NAME)
170# ----------------------
171# See how the compiler implements dependency checking.
172# NAME is "CC", "CXX", "GCJ", or "OBJC".
173# We try a few techniques and use that to set a single cache variable.
174#
175# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177# dependency, and given that the user is not expected to run this macro,
178# just rely on AC_PROG_CC.
179AC_DEFUN([_AM_DEPENDENCIES],
180[AC_REQUIRE([AM_SET_DEPDIR])dnl
181AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182AC_REQUIRE([AM_MAKE_INCLUDE])dnl
183AC_REQUIRE([AM_DEP_TRACK])dnl
184
185ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
188       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190                   [depcc="$$1"   am_compiler_list=])
191
192AC_CACHE_CHECK([dependency style of $depcc],
193               [am_cv_$1_dependencies_compiler_type],
194[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195  # We make a subdir and do the tests there.  Otherwise we can end up
196  # making bogus files that we don't know about and never remove.  For
197  # instance it was reported that on HP-UX the gcc test will end up
198  # making a dummy file named `D' -- because `-MD' means `put the output
199  # in D'.
200  rm -rf conftest.dir
201  mkdir conftest.dir
202  # Copy depcomp to subdir because otherwise we won't find it if we're
203  # using a relative directory.
204  cp "$am_depcomp" conftest.dir
205  cd conftest.dir
206  # We will build objects and dependencies in a subdirectory because
207  # it helps to detect inapplicable dependency modes.  For instance
208  # both Tru64's cc and ICC support -MD to output dependencies as a
209  # side effect of compilation, but ICC will put the dependencies in
210  # the current directory while Tru64 will put them in the object
211  # directory.
212  mkdir sub
213
214  am_cv_$1_dependencies_compiler_type=none
215  if test "$am_compiler_list" = ""; then
216     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217  fi
218  am__universal=false
219  m4_case([$1], [CC],
220    [case " $depcc " in #(
221     *\ -arch\ *\ -arch\ *) am__universal=true ;;
222     esac],
223    [CXX],
224    [case " $depcc " in #(
225     *\ -arch\ *\ -arch\ *) am__universal=true ;;
226     esac])
227
228  for depmode in $am_compiler_list; do
229    # Setup a source with many dependencies, because some compilers
230    # like to wrap large dependency lists on column 80 (with \), and
231    # we should not choose a depcomp mode which is confused by this.
232    #
233    # We need to recreate these files for each test, as the compiler may
234    # overwrite some of them when testing with obscure command lines.
235    # This happens at least with the AIX C compiler.
236    : > sub/conftest.c
237    for i in 1 2 3 4 5 6; do
238      echo '#include "conftst'$i'.h"' >> sub/conftest.c
239      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
240      # Solaris 8's {/usr,}/bin/sh.
241      touch sub/conftst$i.h
242    done
243    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244
245    # We check with `-c' and `-o' for the sake of the "dashmstdout"
246    # mode.  It turns out that the SunPro C++ compiler does not properly
247    # handle `-M -o', and we need to detect this.  Also, some Intel
248    # versions had trouble with output in subdirs
249    am__obj=sub/conftest.${OBJEXT-o}
250    am__minus_obj="-o $am__obj"
251    case $depmode in
252    gcc)
253      # This depmode causes a compiler race in universal mode.
254      test "$am__universal" = false || continue
255      ;;
256    nosideeffect)
257      # after this tag, mechanisms are not by side-effect, so they'll
258      # only be used when explicitly requested
259      if test "x$enable_dependency_tracking" = xyes; then
260	continue
261      else
262	break
263      fi
264      ;;
265    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
266      # This compiler won't grok `-c -o', but also, the minuso test has
267      # not run yet.  These depmodes are late enough in the game, and
268      # so weak that their functioning should not be impacted.
269      am__obj=conftest.${OBJEXT-o}
270      am__minus_obj=
271      ;;
272    none) break ;;
273    esac
274    if depmode=$depmode \
275       source=sub/conftest.c object=$am__obj \
276       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
277       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278         >/dev/null 2>conftest.err &&
279       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
281       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283      # icc doesn't choke on unknown options, it will just issue warnings
284      # or remarks (even with -Werror).  So we grep stderr for any message
285      # that says an option was ignored or not supported.
286      # When given -MP, icc 7.0 and 7.1 complain thusly:
287      #   icc: Command line warning: ignoring option '-M'; no argument required
288      # The diagnosis changed in icc 8.0:
289      #   icc: Command line remark: option '-MP' not supported
290      if (grep 'ignoring option' conftest.err ||
291          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292        am_cv_$1_dependencies_compiler_type=$depmode
293        break
294      fi
295    fi
296  done
297
298  cd ..
299  rm -rf conftest.dir
300else
301  am_cv_$1_dependencies_compiler_type=none
302fi
303])
304AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305AM_CONDITIONAL([am__fastdep$1], [
306  test "x$enable_dependency_tracking" != xno \
307  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308])
309
310
311# AM_SET_DEPDIR
312# -------------
313# Choose a directory name for dependency files.
314# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315AC_DEFUN([AM_SET_DEPDIR],
316[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318])
319
320
321# AM_DEP_TRACK
322# ------------
323AC_DEFUN([AM_DEP_TRACK],
324[AC_ARG_ENABLE(dependency-tracking,
325[  --disable-dependency-tracking  speeds up one-time build
326  --enable-dependency-tracking   do not reject slow dependency extractors])
327if test "x$enable_dependency_tracking" != xno; then
328  am_depcomp="$ac_aux_dir/depcomp"
329  AMDEPBACKSLASH='\'
330  am__nodep='_no'
331fi
332AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
333AC_SUBST([AMDEPBACKSLASH])dnl
334_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
335AC_SUBST([am__nodep])dnl
336_AM_SUBST_NOTMAKE([am__nodep])dnl
337])
338
339# Generate code to set up dependency tracking.              -*- Autoconf -*-
340
341# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
342# Free Software Foundation, Inc.
343#
344# This file is free software; the Free Software Foundation
345# gives unlimited permission to copy and/or distribute it,
346# with or without modifications, as long as this notice is preserved.
347
348#serial 5
349
350# _AM_OUTPUT_DEPENDENCY_COMMANDS
351# ------------------------------
352AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
353[{
354  # Autoconf 2.62 quotes --file arguments for eval, but not when files
355  # are listed without --file.  Let's play safe and only enable the eval
356  # if we detect the quoting.
357  case $CONFIG_FILES in
358  *\'*) eval set x "$CONFIG_FILES" ;;
359  *)   set x $CONFIG_FILES ;;
360  esac
361  shift
362  for mf
363  do
364    # Strip MF so we end up with the name of the file.
365    mf=`echo "$mf" | sed -e 's/:.*$//'`
366    # Check whether this is an Automake generated Makefile or not.
367    # We used to match only the files named `Makefile.in', but
368    # some people rename them; so instead we look at the file content.
369    # Grep'ing the first line is not enough: some people post-process
370    # each Makefile.in and add a new line on top of each file to say so.
371    # Grep'ing the whole file is not good either: AIX grep has a line
372    # limit of 2048, but all sed's we know have understand at least 4000.
373    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
374      dirpart=`AS_DIRNAME("$mf")`
375    else
376      continue
377    fi
378    # Extract the definition of DEPDIR, am__include, and am__quote
379    # from the Makefile without running `make'.
380    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
381    test -z "$DEPDIR" && continue
382    am__include=`sed -n 's/^am__include = //p' < "$mf"`
383    test -z "am__include" && continue
384    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
385    # When using ansi2knr, U may be empty or an underscore; expand it
386    U=`sed -n 's/^U = //p' < "$mf"`
387    # Find all dependency output files, they are included files with
388    # $(DEPDIR) in their names.  We invoke sed twice because it is the
389    # simplest approach to changing $(DEPDIR) to its actual value in the
390    # expansion.
391    for file in `sed -n "
392      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
393	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
394      # Make sure the directory exists.
395      test -f "$dirpart/$file" && continue
396      fdir=`AS_DIRNAME(["$file"])`
397      AS_MKDIR_P([$dirpart/$fdir])
398      # echo "creating $dirpart/$file"
399      echo '# dummy' > "$dirpart/$file"
400    done
401  done
402}
403])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404
405
406# AM_OUTPUT_DEPENDENCY_COMMANDS
407# -----------------------------
408# This macro should only be invoked once -- use via AC_REQUIRE.
409#
410# This code is only required when automatic dependency tracking
411# is enabled.  FIXME.  This creates each `.P' file that we will
412# need in order to bootstrap the dependency handling code.
413AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414[AC_CONFIG_COMMANDS([depfiles],
415     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417])
418
419# Do all the work for Automake.                             -*- Autoconf -*-
420
421# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
422# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423#
424# This file is free software; the Free Software Foundation
425# gives unlimited permission to copy and/or distribute it,
426# with or without modifications, as long as this notice is preserved.
427
428# serial 16
429
430# This macro actually does too much.  Some checks are only needed if
431# your package does certain things.  But this isn't really a big deal.
432
433# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
434# AM_INIT_AUTOMAKE([OPTIONS])
435# -----------------------------------------------
436# The call with PACKAGE and VERSION arguments is the old style
437# call (pre autoconf-2.50), which is being phased out.  PACKAGE
438# and VERSION should now be passed to AC_INIT and removed from
439# the call to AM_INIT_AUTOMAKE.
440# We support both call styles for the transition.  After
441# the next Automake release, Autoconf can make the AC_INIT
442# arguments mandatory, and then we can depend on a new Autoconf
443# release and drop the old call support.
444AC_DEFUN([AM_INIT_AUTOMAKE],
445[AC_PREREQ([2.62])dnl
446dnl Autoconf wants to disallow AM_ names.  We explicitly allow
447dnl the ones we care about.
448m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
449AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
450AC_REQUIRE([AC_PROG_INSTALL])dnl
451if test "`cd $srcdir && pwd`" != "`pwd`"; then
452  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
453  # is not polluted with repeated "-I."
454  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
455  # test to see if srcdir already configured
456  if test -f $srcdir/config.status; then
457    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
458  fi
459fi
460
461# test whether we have cygpath
462if test -z "$CYGPATH_W"; then
463  if (cygpath --version) >/dev/null 2>/dev/null; then
464    CYGPATH_W='cygpath -w'
465  else
466    CYGPATH_W=echo
467  fi
468fi
469AC_SUBST([CYGPATH_W])
470
471# Define the identity of the package.
472dnl Distinguish between old-style and new-style calls.
473m4_ifval([$2],
474[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
475 AC_SUBST([PACKAGE], [$1])dnl
476 AC_SUBST([VERSION], [$2])],
477[_AM_SET_OPTIONS([$1])dnl
478dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
479m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
480  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
481 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
482 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483
484_AM_IF_OPTION([no-define],,
485[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
486 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487
488# Some tools Automake needs.
489AC_REQUIRE([AM_SANITY_CHECK])dnl
490AC_REQUIRE([AC_ARG_PROGRAM])dnl
491AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
492AM_MISSING_PROG(AUTOCONF, autoconf)
493AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
494AM_MISSING_PROG(AUTOHEADER, autoheader)
495AM_MISSING_PROG(MAKEINFO, makeinfo)
496AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
497AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
498AC_REQUIRE([AM_PROG_MKDIR_P])dnl
499# We need awk for the "check" target.  The system "awk" is bad on
500# some platforms.
501AC_REQUIRE([AC_PROG_AWK])dnl
502AC_REQUIRE([AC_PROG_MAKE_SET])dnl
503AC_REQUIRE([AM_SET_LEADING_DOT])dnl
504_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
505	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
506			     [_AM_PROG_TAR([v7])])])
507_AM_IF_OPTION([no-dependencies],,
508[AC_PROVIDE_IFELSE([AC_PROG_CC],
509		  [_AM_DEPENDENCIES(CC)],
510		  [define([AC_PROG_CC],
511			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
512AC_PROVIDE_IFELSE([AC_PROG_CXX],
513		  [_AM_DEPENDENCIES(CXX)],
514		  [define([AC_PROG_CXX],
515			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
516AC_PROVIDE_IFELSE([AC_PROG_OBJC],
517		  [_AM_DEPENDENCIES(OBJC)],
518		  [define([AC_PROG_OBJC],
519			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
520])
521_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
522dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
523dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
524dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
525AC_CONFIG_COMMANDS_PRE(dnl
526[m4_provide_if([_AM_COMPILER_EXEEXT],
527  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
528])
529
530dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
531dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
532dnl mangled by Autoconf and run in a shell conditional statement.
533m4_define([_AC_COMPILER_EXEEXT],
534m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
535
536
537# When config.status generates a header, we must update the stamp-h file.
538# This file resides in the same directory as the config header
539# that is generated.  The stamp files are numbered to have different names.
540
541# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
542# loop where config.status creates the headers, so we can generate
543# our stamp files there.
544AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
545[# Compute $1's index in $config_headers.
546_am_arg=$1
547_am_stamp_count=1
548for _am_header in $config_headers :; do
549  case $_am_header in
550    $_am_arg | $_am_arg:* )
551      break ;;
552    * )
553      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
554  esac
555done
556echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557
558# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
559# Inc.
560#
561# This file is free software; the Free Software Foundation
562# gives unlimited permission to copy and/or distribute it,
563# with or without modifications, as long as this notice is preserved.
564
565# serial 1
566
567# AM_PROG_INSTALL_SH
568# ------------------
569# Define $install_sh.
570AC_DEFUN([AM_PROG_INSTALL_SH],
571[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
572if test x"${install_sh}" != xset; then
573  case $am_aux_dir in
574  *\ * | *\	*)
575    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
576  *)
577    install_sh="\${SHELL} $am_aux_dir/install-sh"
578  esac
579fi
580AC_SUBST(install_sh)])
581
582# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
583#
584# This file is free software; the Free Software Foundation
585# gives unlimited permission to copy and/or distribute it,
586# with or without modifications, as long as this notice is preserved.
587
588# serial 2
589
590# Check whether the underlying file-system supports filenames
591# with a leading dot.  For instance MS-DOS doesn't.
592AC_DEFUN([AM_SET_LEADING_DOT],
593[rm -rf .tst 2>/dev/null
594mkdir .tst 2>/dev/null
595if test -d .tst; then
596  am__leading_dot=.
597else
598  am__leading_dot=_
599fi
600rmdir .tst 2>/dev/null
601AC_SUBST([am__leading_dot])])
602
603# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
604# From Jim Meyering
605
606# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
607# 2011 Free Software Foundation, Inc.
608#
609# This file is free software; the Free Software Foundation
610# gives unlimited permission to copy and/or distribute it,
611# with or without modifications, as long as this notice is preserved.
612
613# serial 5
614
615# AM_MAINTAINER_MODE([DEFAULT-MODE])
616# ----------------------------------
617# Control maintainer-specific portions of Makefiles.
618# Default is to disable them, unless `enable' is passed literally.
619# For symmetry, `disable' may be passed as well.  Anyway, the user
620# can override the default with the --enable/--disable switch.
621AC_DEFUN([AM_MAINTAINER_MODE],
622[m4_case(m4_default([$1], [disable]),
623       [enable], [m4_define([am_maintainer_other], [disable])],
624       [disable], [m4_define([am_maintainer_other], [enable])],
625       [m4_define([am_maintainer_other], [enable])
626        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
627AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
628  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
629  AC_ARG_ENABLE([maintainer-mode],
630[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
631			  (and sometimes confusing) to the casual installer],
632      [USE_MAINTAINER_MODE=$enableval],
633      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
635  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636  MAINT=$MAINTAINER_MODE_TRUE
637  AC_SUBST([MAINT])dnl
638]
639)
640
641AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
642
643# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644
645# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
646#
647# This file is free software; the Free Software Foundation
648# gives unlimited permission to copy and/or distribute it,
649# with or without modifications, as long as this notice is preserved.
650
651# serial 4
652
653# AM_MAKE_INCLUDE()
654# -----------------
655# Check to see how make treats includes.
656AC_DEFUN([AM_MAKE_INCLUDE],
657[am_make=${MAKE-make}
658cat > confinc << 'END'
659am__doit:
660	@echo this is the am__doit target
661.PHONY: am__doit
662END
663# If we don't find an include directive, just comment out the code.
664AC_MSG_CHECKING([for style of include used by $am_make])
665am__include="#"
666am__quote=
667_am_result=none
668# First try GNU make style include.
669echo "include confinc" > confmf
670# Ignore all kinds of additional output from `make'.
671case `$am_make -s -f confmf 2> /dev/null` in #(
672*the\ am__doit\ target*)
673  am__include=include
674  am__quote=
675  _am_result=GNU
676  ;;
677esac
678# Now try BSD make style include.
679if test "$am__include" = "#"; then
680   echo '.include "confinc"' > confmf
681   case `$am_make -s -f confmf 2> /dev/null` in #(
682   *the\ am__doit\ target*)
683     am__include=.include
684     am__quote="\""
685     _am_result=BSD
686     ;;
687   esac
688fi
689AC_SUBST([am__include])
690AC_SUBST([am__quote])
691AC_MSG_RESULT([$_am_result])
692rm -f confinc confmf
693])
694
695# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
696# Free Software Foundation, Inc.
697#
698# This file is free software; the Free Software Foundation
699# gives unlimited permission to copy and/or distribute it,
700# with or without modifications, as long as this notice is preserved.
701
702# serial 6
703
704# AM_PROG_CC_C_O
705# --------------
706# Like AC_PROG_CC_C_O, but changed for automake.
707AC_DEFUN([AM_PROG_CC_C_O],
708[AC_REQUIRE([AC_PROG_CC_C_O])dnl
709AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
710AC_REQUIRE_AUX_FILE([compile])dnl
711# FIXME: we rely on the cache variable name because
712# there is no other way.
713set dummy $CC
714am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
715eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
716if test "$am_t" != yes; then
717   # Losing compiler, so override with the script.
718   # FIXME: It is wrong to rewrite CC.
719   # But if we don't then we get into trouble of one sort or another.
720   # A longer-term fix would be to have automake use am__CC in this case,
721   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
722   CC="$am_aux_dir/compile $CC"
723fi
724dnl Make sure AC_PROG_CC is never called again, or it will override our
725dnl setting of CC.
726m4_define([AC_PROG_CC],
727          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
728])
729
730# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
731
732# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
733# Free Software Foundation, Inc.
734#
735# This file is free software; the Free Software Foundation
736# gives unlimited permission to copy and/or distribute it,
737# with or without modifications, as long as this notice is preserved.
738
739# serial 6
740
741# AM_MISSING_PROG(NAME, PROGRAM)
742# ------------------------------
743AC_DEFUN([AM_MISSING_PROG],
744[AC_REQUIRE([AM_MISSING_HAS_RUN])
745$1=${$1-"${am_missing_run}$2"}
746AC_SUBST($1)])
747
748
749# AM_MISSING_HAS_RUN
750# ------------------
751# Define MISSING if not defined so far and test if it supports --run.
752# If it does, set am_missing_run to use it, otherwise, to nothing.
753AC_DEFUN([AM_MISSING_HAS_RUN],
754[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
755AC_REQUIRE_AUX_FILE([missing])dnl
756if test x"${MISSING+set}" != xset; then
757  case $am_aux_dir in
758  *\ * | *\	*)
759    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
760  *)
761    MISSING="\${SHELL} $am_aux_dir/missing" ;;
762  esac
763fi
764# Use eval to expand $SHELL
765if eval "$MISSING --run true"; then
766  am_missing_run="$MISSING --run "
767else
768  am_missing_run=
769  AC_MSG_WARN([`missing' script is too old or missing])
770fi
771])
772
773# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
774# Inc.
775#
776# This file is free software; the Free Software Foundation
777# gives unlimited permission to copy and/or distribute it,
778# with or without modifications, as long as this notice is preserved.
779
780# serial 1
781
782# AM_PROG_MKDIR_P
783# ---------------
784# Check for `mkdir -p'.
785AC_DEFUN([AM_PROG_MKDIR_P],
786[AC_PREREQ([2.60])dnl
787AC_REQUIRE([AC_PROG_MKDIR_P])dnl
788dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
789dnl while keeping a definition of mkdir_p for backward compatibility.
790dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
791dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
792dnl Makefile.ins that do not define MKDIR_P, so we do our own
793dnl adjustment using top_builddir (which is defined more often than
794dnl MKDIR_P).
795AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
796case $mkdir_p in
797  [[\\/$]]* | ?:[[\\/]]*) ;;
798  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
799esac
800])
801
802# Helper functions for option handling.                     -*- Autoconf -*-
803
804# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
805# Foundation, Inc.
806#
807# This file is free software; the Free Software Foundation
808# gives unlimited permission to copy and/or distribute it,
809# with or without modifications, as long as this notice is preserved.
810
811# serial 5
812
813# _AM_MANGLE_OPTION(NAME)
814# -----------------------
815AC_DEFUN([_AM_MANGLE_OPTION],
816[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
817
818# _AM_SET_OPTION(NAME)
819# --------------------
820# Set option NAME.  Presently that only means defining a flag for this option.
821AC_DEFUN([_AM_SET_OPTION],
822[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
823
824# _AM_SET_OPTIONS(OPTIONS)
825# ------------------------
826# OPTIONS is a space-separated list of Automake options.
827AC_DEFUN([_AM_SET_OPTIONS],
828[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
829
830# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
831# -------------------------------------------
832# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
833AC_DEFUN([_AM_IF_OPTION],
834[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
835
836# Check to make sure that the build environment is sane.    -*- Autoconf -*-
837
838# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
839# Free Software Foundation, Inc.
840#
841# This file is free software; the Free Software Foundation
842# gives unlimited permission to copy and/or distribute it,
843# with or without modifications, as long as this notice is preserved.
844
845# serial 5
846
847# AM_SANITY_CHECK
848# ---------------
849AC_DEFUN([AM_SANITY_CHECK],
850[AC_MSG_CHECKING([whether build environment is sane])
851# Just in case
852sleep 1
853echo timestamp > conftest.file
854# Reject unsafe characters in $srcdir or the absolute working directory
855# name.  Accept space and tab only in the latter.
856am_lf='
857'
858case `pwd` in
859  *[[\\\"\#\$\&\'\`$am_lf]]*)
860    AC_MSG_ERROR([unsafe absolute working directory name]);;
861esac
862case $srcdir in
863  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
864    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
865esac
866
867# Do `set' in a subshell so we don't clobber the current shell's
868# arguments.  Must try -L first in case configure is actually a
869# symlink; some systems play weird games with the mod time of symlinks
870# (eg FreeBSD returns the mod time of the symlink's containing
871# directory).
872if (
873   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
874   if test "$[*]" = "X"; then
875      # -L didn't work.
876      set X `ls -t "$srcdir/configure" conftest.file`
877   fi
878   rm -f conftest.file
879   if test "$[*]" != "X $srcdir/configure conftest.file" \
880      && test "$[*]" != "X conftest.file $srcdir/configure"; then
881
882      # If neither matched, then we have a broken ls.  This can happen
883      # if, for instance, CONFIG_SHELL is bash and it inherits a
884      # broken ls alias from the environment.  This has actually
885      # happened.  Such a system could not be considered "sane".
886      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
887alias in your environment])
888   fi
889
890   test "$[2]" = conftest.file
891   )
892then
893   # Ok.
894   :
895else
896   AC_MSG_ERROR([newly created file is older than distributed files!
897Check your system clock])
898fi
899AC_MSG_RESULT(yes)])
900
901# Copyright (C) 2009  Free Software Foundation, Inc.
902#
903# This file is free software; the Free Software Foundation
904# gives unlimited permission to copy and/or distribute it,
905# with or without modifications, as long as this notice is preserved.
906
907# serial 1
908
909# AM_SILENT_RULES([DEFAULT])
910# --------------------------
911# Enable less verbose build rules; with the default set to DEFAULT
912# (`yes' being less verbose, `no' or empty being verbose).
913AC_DEFUN([AM_SILENT_RULES],
914[AC_ARG_ENABLE([silent-rules],
915[  --enable-silent-rules          less verbose build output (undo: `make V=1')
916  --disable-silent-rules         verbose build output (undo: `make V=0')])
917case $enable_silent_rules in
918yes) AM_DEFAULT_VERBOSITY=0;;
919no)  AM_DEFAULT_VERBOSITY=1;;
920*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
921esac
922AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
923AM_BACKSLASH='\'
924AC_SUBST([AM_BACKSLASH])dnl
925_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
926])
927
928# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
929#
930# This file is free software; the Free Software Foundation
931# gives unlimited permission to copy and/or distribute it,
932# with or without modifications, as long as this notice is preserved.
933
934# serial 1
935
936# AM_PROG_INSTALL_STRIP
937# ---------------------
938# One issue with vendor `install' (even GNU) is that you can't
939# specify the program used to strip binaries.  This is especially
940# annoying in cross-compiling environments, where the build's strip
941# is unlikely to handle the host's binaries.
942# Fortunately install-sh will honor a STRIPPROG variable, so we
943# always use install-sh in `make install-strip', and initialize
944# STRIPPROG with the value of the STRIP variable (set by the user).
945AC_DEFUN([AM_PROG_INSTALL_STRIP],
946[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
947# Installed binaries are usually stripped using `strip' when the user
948# run `make install-strip'.  However `strip' might not be the right
949# tool to use in cross-compilation environments, therefore Automake
950# will honor the `STRIP' environment variable to overrule this program.
951dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
952if test "$cross_compiling" != no; then
953  AC_CHECK_TOOL([STRIP], [strip], :)
954fi
955INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
956AC_SUBST([INSTALL_STRIP_PROGRAM])])
957
958# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
959#
960# This file is free software; the Free Software Foundation
961# gives unlimited permission to copy and/or distribute it,
962# with or without modifications, as long as this notice is preserved.
963
964# serial 3
965
966# _AM_SUBST_NOTMAKE(VARIABLE)
967# ---------------------------
968# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
969# This macro is traced by Automake.
970AC_DEFUN([_AM_SUBST_NOTMAKE])
971
972# AM_SUBST_NOTMAKE(VARIABLE)
973# --------------------------
974# Public sister of _AM_SUBST_NOTMAKE.
975AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
976
977# Check how to create a tarball.                            -*- Autoconf -*-
978
979# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
980#
981# This file is free software; the Free Software Foundation
982# gives unlimited permission to copy and/or distribute it,
983# with or without modifications, as long as this notice is preserved.
984
985# serial 2
986
987# _AM_PROG_TAR(FORMAT)
988# --------------------
989# Check how to create a tarball in format FORMAT.
990# FORMAT should be one of `v7', `ustar', or `pax'.
991#
992# Substitute a variable $(am__tar) that is a command
993# writing to stdout a FORMAT-tarball containing the directory
994# $tardir.
995#     tardir=directory && $(am__tar) > result.tar
996#
997# Substitute a variable $(am__untar) that extract such
998# a tarball read from stdin.
999#     $(am__untar) < result.tar
1000AC_DEFUN([_AM_PROG_TAR],
1001[# Always define AMTAR for backward compatibility.
1002AM_MISSING_PROG([AMTAR], [tar])
1003m4_if([$1], [v7],
1004     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
1005     [m4_case([$1], [ustar],, [pax],,
1006              [m4_fatal([Unknown tar format])])
1007AC_MSG_CHECKING([how to create a $1 tar archive])
1008# Loop over all known methods to create a tar archive until one works.
1009_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1010_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1011# Do not fold the above two line into one, because Tru64 sh and
1012# Solaris sh will not grok spaces in the rhs of `-'.
1013for _am_tool in $_am_tools
1014do
1015  case $_am_tool in
1016  gnutar)
1017    for _am_tar in tar gnutar gtar;
1018    do
1019      AM_RUN_LOG([$_am_tar --version]) && break
1020    done
1021    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1022    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1023    am__untar="$_am_tar -xf -"
1024    ;;
1025  plaintar)
1026    # Must skip GNU tar: if it does not support --format= it doesn't create
1027    # ustar tarball either.
1028    (tar --version) >/dev/null 2>&1 && continue
1029    am__tar='tar chf - "$$tardir"'
1030    am__tar_='tar chf - "$tardir"'
1031    am__untar='tar xf -'
1032    ;;
1033  pax)
1034    am__tar='pax -L -x $1 -w "$$tardir"'
1035    am__tar_='pax -L -x $1 -w "$tardir"'
1036    am__untar='pax -r'
1037    ;;
1038  cpio)
1039    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1040    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1041    am__untar='cpio -i -H $1 -d'
1042    ;;
1043  none)
1044    am__tar=false
1045    am__tar_=false
1046    am__untar=false
1047    ;;
1048  esac
1049
1050  # If the value was cached, stop now.  We just wanted to have am__tar
1051  # and am__untar set.
1052  test -n "${am_cv_prog_tar_$1}" && break
1053
1054  # tar/untar a dummy directory, and stop if the command works
1055  rm -rf conftest.dir
1056  mkdir conftest.dir
1057  echo GrepMe > conftest.dir/file
1058  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1059  rm -rf conftest.dir
1060  if test -s conftest.tar; then
1061    AM_RUN_LOG([$am__untar <conftest.tar])
1062    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1063  fi
1064done
1065rm -rf conftest.dir
1066
1067AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1068AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1069AC_SUBST([am__tar])
1070AC_SUBST([am__untar])
1071]) # _AM_PROG_TAR
1072
1073# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1074# 
1075# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1076#
1077# This program is free software; you can redistribute it and/or modify
1078# it under the terms of the GNU General Public License as published by
1079# the Free Software Foundation; either version 2 of the License, or
1080# (at your option) any later version.
1081#
1082# This program is distributed in the hope that it will be useful, but
1083# WITHOUT ANY WARRANTY; without even the implied warranty of
1084# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1085# General Public License for more details.
1086#
1087# You should have received a copy of the GNU General Public License
1088# along with this program; if not, write to the Free Software
1089# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1090#
1091# As a special exception to the GNU General Public License, if you
1092# distribute this file as part of a program that contains a
1093# configuration script generated by Autoconf, you may include it under
1094# the same distribution terms that you use for the rest of that program.
1095
1096# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1097# ----------------------------------
1098AC_DEFUN([PKG_PROG_PKG_CONFIG],
1099[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1100m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1101AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1102if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1103	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1104fi
1105if test -n "$PKG_CONFIG"; then
1106	_pkg_min_version=m4_default([$1], [0.9.0])
1107	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1108	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1109		AC_MSG_RESULT([yes])
1110	else
1111		AC_MSG_RESULT([no])
1112		PKG_CONFIG=""
1113	fi
1114		
1115fi[]dnl
1116])# PKG_PROG_PKG_CONFIG
1117
1118# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1119#
1120# Check to see whether a particular set of modules exists.  Similar
1121# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1122#
1123#
1124# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1125# this or PKG_CHECK_MODULES is called, or make sure to call
1126# PKG_CHECK_EXISTS manually
1127# --------------------------------------------------------------
1128AC_DEFUN([PKG_CHECK_EXISTS],
1129[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1130if test -n "$PKG_CONFIG" && \
1131    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1132  m4_ifval([$2], [$2], [:])
1133m4_ifvaln([$3], [else
1134  $3])dnl
1135fi])
1136
1137
1138# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1139# ---------------------------------------------
1140m4_define([_PKG_CONFIG],
1141[if test -n "$$1"; then
1142    pkg_cv_[]$1="$$1"
1143 elif test -n "$PKG_CONFIG"; then
1144    PKG_CHECK_EXISTS([$3],
1145                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1146		     [pkg_failed=yes])
1147 else
1148    pkg_failed=untried
1149fi[]dnl
1150])# _PKG_CONFIG
1151
1152# _PKG_SHORT_ERRORS_SUPPORTED
1153# -----------------------------
1154AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1155[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1156if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1157        _pkg_short_errors_supported=yes
1158else
1159        _pkg_short_errors_supported=no
1160fi[]dnl
1161])# _PKG_SHORT_ERRORS_SUPPORTED
1162
1163
1164# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1165# [ACTION-IF-NOT-FOUND])
1166#
1167#
1168# Note that if there is a possibility the first call to
1169# PKG_CHECK_MODULES might not happen, you should be sure to include an
1170# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1171#
1172#
1173# --------------------------------------------------------------
1174AC_DEFUN([PKG_CHECK_MODULES],
1175[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1176AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1177AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1178
1179pkg_failed=no
1180AC_MSG_CHECKING([for $1])
1181
1182_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1183_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1184
1185m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1186and $1[]_LIBS to avoid the need to call pkg-config.
1187See the pkg-config man page for more details.])
1188
1189if test $pkg_failed = yes; then
1190        _PKG_SHORT_ERRORS_SUPPORTED
1191        if test $_pkg_short_errors_supported = yes; then
1192	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1193        else 
1194	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1195        fi
1196	# Put the nasty error message in config.log where it belongs
1197	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1198
1199	ifelse([$4], , [AC_MSG_ERROR(dnl
1200[Package requirements ($2) were not met:
1201
1202$$1_PKG_ERRORS
1203
1204Consider adjusting the PKG_CONFIG_PATH environment variable if you
1205installed software in a non-standard prefix.
1206
1207_PKG_TEXT
1208])],
1209		[AC_MSG_RESULT([no])
1210                $4])
1211elif test $pkg_failed = untried; then
1212	ifelse([$4], , [AC_MSG_FAILURE(dnl
1213[The pkg-config script could not be found or is too old.  Make sure it
1214is in your PATH or set the PKG_CONFIG environment variable to the full
1215path to pkg-config.
1216
1217_PKG_TEXT
1218
1219To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1220		[$4])
1221else
1222	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1223	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1224        AC_MSG_RESULT([yes])
1225	ifelse([$3], , :, [$3])
1226fi[]dnl
1227])# PKG_CHECK_MODULES
1228
1229dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1230dnl
1231dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1232dnl 
1233dnl Permission is hereby granted, free of charge, to any person obtaining a
1234dnl copy of this software and associated documentation files (the "Software"),
1235dnl to deal in the Software without restriction, including without limitation
1236dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1237dnl and/or sell copies of the Software, and to permit persons to whom the
1238dnl Software is furnished to do so, subject to the following conditions:
1239dnl
1240dnl The above copyright notice and this permission notice (including the next
1241dnl paragraph) shall be included in all copies or substantial portions of the
1242dnl Software.
1243dnl
1244dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1245dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1246dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1247dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1248dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1249dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1250dnl DEALINGS IN THE SOFTWARE.
1251
1252# XORG_MACROS_VERSION(required-version)
1253# -------------------------------------
1254# Minimum version: 1.1.0
1255#
1256# If you're using a macro added in Version 1.1 or newer, include this in
1257# your configure.ac with the minimum required version, such as:
1258# XORG_MACROS_VERSION(1.1)
1259#
1260# To ensure that this macro is defined, also add:
1261# m4_ifndef([XORG_MACROS_VERSION],
1262#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1263#
1264#
1265# See the "minimum version" comment for each macro you use to see what 
1266# version you require.
1267m4_defun([XORG_MACROS_VERSION],[
1268m4_define([vers_have], [1.17])
1269m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1270m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1271m4_if(m4_cmp(maj_have, maj_needed), 0,,
1272    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1273m4_if(m4_version_compare(vers_have, [$1]), -1,
1274    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1275m4_undefine([vers_have])
1276m4_undefine([maj_have])
1277m4_undefine([maj_needed])
1278]) # XORG_MACROS_VERSION
1279
1280# XORG_PROG_RAWCPP()
1281# ------------------
1282# Minimum version: 1.0.0
1283#
1284# Find cpp program and necessary flags for use in pre-processing text files
1285# such as man pages and config files
1286AC_DEFUN([XORG_PROG_RAWCPP],[
1287AC_REQUIRE([AC_PROG_CPP])
1288AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1289   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1290
1291# Check for flag to avoid builtin definitions - assumes unix is predefined,
1292# which is not the best choice for supporting other OS'es, but covers most
1293# of the ones we need for now.
1294AC_MSG_CHECKING([if $RAWCPP requires -undef])
1295AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1296if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1297	AC_MSG_RESULT([no])
1298else
1299	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1300		RAWCPPFLAGS=-undef
1301		AC_MSG_RESULT([yes])
1302	# under Cygwin unix is still defined even with -undef
1303	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1304		RAWCPPFLAGS="-undef -ansi"
1305		AC_MSG_RESULT([yes, with -ansi])
1306	else
1307		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1308	fi
1309fi
1310rm -f conftest.$ac_ext
1311
1312AC_MSG_CHECKING([if $RAWCPP requires -traditional])
1313AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1314if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1315	AC_MSG_RESULT([no])
1316else
1317	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1318		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1319		AC_MSG_RESULT([yes])
1320	else
1321		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1322	fi
1323fi
1324rm -f conftest.$ac_ext
1325AC_SUBST(RAWCPPFLAGS)
1326]) # XORG_PROG_RAWCPP
1327
1328# XORG_MANPAGE_SECTIONS()
1329# -----------------------
1330# Minimum version: 1.0.0
1331#
1332# Determine which sections man pages go in for the different man page types
1333# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1334# Not sure if there's any better way than just hardcoding by OS name.
1335# Override default settings by setting environment variables
1336# Added MAN_SUBSTS in version 1.8
1337# Added AC_PROG_SED in version 1.8
1338
1339AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1340AC_REQUIRE([AC_CANONICAL_HOST])
1341AC_REQUIRE([AC_PROG_SED])
1342
1343if test x$APP_MAN_SUFFIX = x    ; then
1344    APP_MAN_SUFFIX=1
1345fi
1346if test x$APP_MAN_DIR = x    ; then
1347    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1348fi
1349
1350if test x$LIB_MAN_SUFFIX = x    ; then
1351    LIB_MAN_SUFFIX=3
1352fi
1353if test x$LIB_MAN_DIR = x    ; then
1354    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1355fi
1356
1357if test x$FILE_MAN_SUFFIX = x    ; then
1358    case $host_os in
1359	solaris*)	FILE_MAN_SUFFIX=4  ;;
1360	*)		FILE_MAN_SUFFIX=5  ;;
1361    esac
1362fi
1363if test x$FILE_MAN_DIR = x    ; then
1364    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1365fi
1366
1367if test x$MISC_MAN_SUFFIX = x    ; then
1368    case $host_os in
1369	solaris*)	MISC_MAN_SUFFIX=5  ;;
1370	*)		MISC_MAN_SUFFIX=7  ;;
1371    esac
1372fi
1373if test x$MISC_MAN_DIR = x    ; then
1374    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1375fi
1376
1377if test x$DRIVER_MAN_SUFFIX = x    ; then
1378    case $host_os in
1379	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1380	*)		DRIVER_MAN_SUFFIX=4  ;;
1381    esac
1382fi
1383if test x$DRIVER_MAN_DIR = x    ; then
1384    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1385fi
1386
1387if test x$ADMIN_MAN_SUFFIX = x    ; then
1388    case $host_os in
1389	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1390	*)		ADMIN_MAN_SUFFIX=8  ;;
1391    esac
1392fi
1393if test x$ADMIN_MAN_DIR = x    ; then
1394    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1395fi
1396
1397
1398AC_SUBST([APP_MAN_SUFFIX])
1399AC_SUBST([LIB_MAN_SUFFIX])
1400AC_SUBST([FILE_MAN_SUFFIX])
1401AC_SUBST([MISC_MAN_SUFFIX])
1402AC_SUBST([DRIVER_MAN_SUFFIX])
1403AC_SUBST([ADMIN_MAN_SUFFIX])
1404AC_SUBST([APP_MAN_DIR])
1405AC_SUBST([LIB_MAN_DIR])
1406AC_SUBST([FILE_MAN_DIR])
1407AC_SUBST([MISC_MAN_DIR])
1408AC_SUBST([DRIVER_MAN_DIR])
1409AC_SUBST([ADMIN_MAN_DIR])
1410
1411XORG_MAN_PAGE="X Version 11"
1412AC_SUBST([XORG_MAN_PAGE])
1413MAN_SUBSTS="\
1414	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1415	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1416	-e 's|__xservername__|Xorg|g' \
1417	-e 's|__xconfigfile__|xorg.conf|g' \
1418	-e 's|__projectroot__|\$(prefix)|g' \
1419	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1420	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1421	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1422	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1423	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1424	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1425	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1426AC_SUBST([MAN_SUBSTS])
1427
1428]) # XORG_MANPAGE_SECTIONS
1429
1430# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1431# ------------------------
1432# Minimum version: 1.7.0
1433#
1434# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1435# provided by xorg-sgml-doctools, if installed.
1436AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1437AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1438XORG_SGML_PATH=
1439PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1440    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1441    [m4_ifval([$1],[:],
1442        [if test x"$cross_compiling" != x"yes" ; then
1443            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1444                          [XORG_SGML_PATH=$prefix/share/sgml])
1445         fi])
1446    ])
1447
1448# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1449# the path and the name of the doc stylesheet
1450if test "x$XORG_SGML_PATH" != "x" ; then
1451   AC_MSG_RESULT([$XORG_SGML_PATH])
1452   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1453   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1454else
1455   AC_MSG_RESULT([no])
1456fi
1457
1458AC_SUBST(XORG_SGML_PATH)
1459AC_SUBST(STYLESHEET_SRCDIR)
1460AC_SUBST(XSL_STYLESHEET)
1461AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1462]) # XORG_CHECK_SGML_DOCTOOLS
1463
1464# XORG_CHECK_LINUXDOC
1465# -------------------
1466# Minimum version: 1.0.0
1467#
1468# Defines the variable MAKE_TEXT if the necessary tools and
1469# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1470# Whether or not the necessary tools and files are found can be checked
1471# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1472AC_DEFUN([XORG_CHECK_LINUXDOC],[
1473AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1474AC_REQUIRE([XORG_WITH_PS2PDF])
1475
1476AC_PATH_PROG(LINUXDOC, linuxdoc)
1477
1478AC_MSG_CHECKING([whether to build documentation])
1479
1480if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1481   BUILDDOC=yes
1482else
1483   BUILDDOC=no
1484fi
1485
1486AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1487
1488AC_MSG_RESULT([$BUILDDOC])
1489
1490AC_MSG_CHECKING([whether to build pdf documentation])
1491
1492if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1493   BUILDPDFDOC=yes
1494else
1495   BUILDPDFDOC=no
1496fi
1497
1498AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1499
1500AC_MSG_RESULT([$BUILDPDFDOC])
1501
1502MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1503MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1504MAKE_PDF="$PS2PDF"
1505MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1506
1507AC_SUBST(MAKE_TEXT)
1508AC_SUBST(MAKE_PS)
1509AC_SUBST(MAKE_PDF)
1510AC_SUBST(MAKE_HTML)
1511]) # XORG_CHECK_LINUXDOC
1512
1513# XORG_CHECK_DOCBOOK
1514# -------------------
1515# Minimum version: 1.0.0
1516#
1517# Checks for the ability to build output formats from SGML DocBook source.
1518# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1519# indicates whether the necessary tools and files are found and, if set,
1520# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1521AC_DEFUN([XORG_CHECK_DOCBOOK],[
1522AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1523
1524BUILDTXTDOC=no
1525BUILDPDFDOC=no
1526BUILDPSDOC=no
1527BUILDHTMLDOC=no
1528
1529AC_PATH_PROG(DOCBOOKPS, docbook2ps)
1530AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1531AC_PATH_PROG(DOCBOOKHTML, docbook2html)
1532AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1533
1534AC_MSG_CHECKING([whether to build text documentation])
1535if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1536   test x$BUILD_TXTDOC != xno; then
1537	BUILDTXTDOC=yes
1538fi
1539AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1540AC_MSG_RESULT([$BUILDTXTDOC])
1541
1542AC_MSG_CHECKING([whether to build PDF documentation])
1543if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1544   test x$BUILD_PDFDOC != xno; then
1545	BUILDPDFDOC=yes
1546fi
1547AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1548AC_MSG_RESULT([$BUILDPDFDOC])
1549
1550AC_MSG_CHECKING([whether to build PostScript documentation])
1551if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1552   test x$BUILD_PSDOC != xno; then
1553	BUILDPSDOC=yes
1554fi
1555AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1556AC_MSG_RESULT([$BUILDPSDOC])
1557
1558AC_MSG_CHECKING([whether to build HTML documentation])
1559if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1560   test x$BUILD_HTMLDOC != xno; then
1561	BUILDHTMLDOC=yes
1562fi
1563AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1564AC_MSG_RESULT([$BUILDHTMLDOC])
1565
1566MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1567MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1568MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1569MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1570
1571AC_SUBST(MAKE_TEXT)
1572AC_SUBST(MAKE_PS)
1573AC_SUBST(MAKE_PDF)
1574AC_SUBST(MAKE_HTML)
1575]) # XORG_CHECK_DOCBOOK
1576
1577# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1578# ----------------
1579# Minimum version: 1.5.0
1580# Minimum version for optional DEFAULT argument: 1.11.0
1581#
1582# Documentation tools are not always available on all platforms and sometimes
1583# not at the appropriate level. This macro enables a module to test for the
1584# presence of the tool and obtain it's path in separate variables. Coupled with
1585# the --with-xmlto option, it allows maximum flexibilty in making decisions
1586# as whether or not to use the xmlto package. When DEFAULT is not specified,
1587# --with-xmlto assumes 'auto'.
1588#
1589# Interface to module:
1590# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1591# XMLTO:	returns the path of the xmlto program found
1592#		returns the path set by the user in the environment
1593# --with-xmlto:	'yes' user instructs the module to use xmlto
1594#		'no' user instructs the module not to use xmlto
1595#
1596# Added in version 1.10.0
1597# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1598#                  xmlto for text output requires either lynx, links, or w3m browsers
1599#
1600# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1601#
1602AC_DEFUN([XORG_WITH_XMLTO],[
1603AC_ARG_VAR([XMLTO], [Path to xmlto command])
1604m4_define([_defopt], m4_default([$2], [auto]))
1605AC_ARG_WITH(xmlto,
1606	AS_HELP_STRING([--with-xmlto],
1607	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1608	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1609m4_undefine([_defopt])
1610
1611if test "x$use_xmlto" = x"auto"; then
1612   AC_PATH_PROG([XMLTO], [xmlto])
1613   if test "x$XMLTO" = "x"; then
1614        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1615	have_xmlto=no
1616   else
1617        have_xmlto=yes
1618   fi
1619elif test "x$use_xmlto" = x"yes" ; then
1620   AC_PATH_PROG([XMLTO], [xmlto])
1621   if test "x$XMLTO" = "x"; then
1622        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1623   fi
1624   have_xmlto=yes
1625elif test "x$use_xmlto" = x"no" ; then
1626   if test "x$XMLTO" != "x"; then
1627      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1628   fi
1629   have_xmlto=no
1630else
1631   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1632fi
1633
1634# Test for a minimum version of xmlto, if provided.
1635m4_ifval([$1],
1636[if test "$have_xmlto" = yes; then
1637    # scrape the xmlto version
1638    AC_MSG_CHECKING([the xmlto version])
1639    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1640    AC_MSG_RESULT([$xmlto_version])
1641    AS_VERSION_COMPARE([$xmlto_version], [$1],
1642        [if test "x$use_xmlto" = xauto; then
1643            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1644            have_xmlto=no
1645        else
1646            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1647        fi])
1648fi])
1649
1650# Test for the ability of xmlto to generate a text target
1651have_xmlto_text=no
1652cat > conftest.xml << "EOF"
1653EOF
1654AS_IF([test "$have_xmlto" = yes],
1655      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1656             [have_xmlto_text=yes],
1657             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1658rm -f conftest.xml
1659AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1660AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1661]) # XORG_WITH_XMLTO
1662
1663# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1664# --------------------------------------------
1665# Minimum version: 1.12.0
1666# Minimum version for optional DEFAULT argument: 1.12.0
1667#
1668# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1669# XML-based language used for the transformation of XML documents.
1670# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1671# It is used under the cover by xmlto to generate html files from DocBook/XML.
1672# The XSLT processor is often used as a standalone tool for transformations.
1673# It should not be assumed that this tool is used only to work with documnetation.
1674# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1675#
1676# Interface to module:
1677# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1678# XSLTPROC:	 returns the path of the xsltproc program found
1679#		 returns the path set by the user in the environment
1680# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1681#		  'no' user instructs the module not to use xsltproc
1682# have_xsltproc: returns yes if xsltproc found in PATH or no
1683#
1684# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1685#
1686AC_DEFUN([XORG_WITH_XSLTPROC],[
1687AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1688# Preserves the interface, should it be implemented later
1689m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1690m4_define([_defopt], m4_default([$2], [auto]))
1691AC_ARG_WITH(xsltproc,
1692	AS_HELP_STRING([--with-xsltproc],
1693	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1694	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1695m4_undefine([_defopt])
1696
1697if test "x$use_xsltproc" = x"auto"; then
1698   AC_PATH_PROG([XSLTPROC], [xsltproc])
1699   if test "x$XSLTPROC" = "x"; then
1700        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1701	have_xsltproc=no
1702   else
1703        have_xsltproc=yes
1704   fi
1705elif test "x$use_xsltproc" = x"yes" ; then
1706   AC_PATH_PROG([XSLTPROC], [xsltproc])
1707   if test "x$XSLTPROC" = "x"; then
1708        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1709   fi
1710   have_xsltproc=yes
1711elif test "x$use_xsltproc" = x"no" ; then
1712   if test "x$XSLTPROC" != "x"; then
1713      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1714   fi
1715   have_xsltproc=no
1716else
1717   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1718fi
1719
1720AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1721]) # XORG_WITH_XSLTPROC
1722
1723# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1724# ----------------------------------------
1725# Minimum version: 1.15.0
1726#
1727# PERL (Practical Extraction and Report Language) is a language optimized for
1728# scanning arbitrary text files, extracting information from those text files,
1729# and printing reports based on that information.
1730#
1731# When DEFAULT is not specified, --with-perl assumes 'auto'.
1732#
1733# Interface to module:
1734# HAVE_PERL: used in makefiles to conditionally scan text files
1735# PERL:	     returns the path of the perl program found
1736#	     returns the path set by the user in the environment
1737# --with-perl: 'yes' user instructs the module to use perl
1738#	       'no' user instructs the module not to use perl
1739# have_perl: returns yes if perl found in PATH or no
1740#
1741# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1742#
1743AC_DEFUN([XORG_WITH_PERL],[
1744AC_ARG_VAR([PERL], [Path to perl command])
1745# Preserves the interface, should it be implemented later
1746m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1747m4_define([_defopt], m4_default([$2], [auto]))
1748AC_ARG_WITH(perl,
1749	AS_HELP_STRING([--with-perl],
1750	   [Use perl for extracting information from files (default: ]_defopt[)]),
1751	   [use_perl=$withval], [use_perl=]_defopt)
1752m4_undefine([_defopt])
1753
1754if test "x$use_perl" = x"auto"; then
1755   AC_PATH_PROG([PERL], [perl])
1756   if test "x$PERL" = "x"; then
1757        AC_MSG_WARN([perl not found - cannot extract information and report])
1758	have_perl=no
1759   else
1760        have_perl=yes
1761   fi
1762elif test "x$use_perl" = x"yes" ; then
1763   AC_PATH_PROG([PERL], [perl])
1764   if test "x$PERL" = "x"; then
1765        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1766   fi
1767   have_perl=yes
1768elif test "x$use_perl" = x"no" ; then
1769   if test "x$PERL" != "x"; then
1770      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1771   fi
1772   have_perl=no
1773else
1774   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1775fi
1776
1777AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1778]) # XORG_WITH_PERL
1779
1780# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1781# ----------------
1782# Minimum version: 1.5.0
1783# Minimum version for optional DEFAULT argument: 1.11.0
1784#
1785# Documentation tools are not always available on all platforms and sometimes
1786# not at the appropriate level. This macro enables a module to test for the
1787# presence of the tool and obtain it's path in separate variables. Coupled with
1788# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1789# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1790# --with-asciidoc assumes 'auto'.
1791#
1792# Interface to module:
1793# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1794# ASCIIDOC:	 returns the path of the asciidoc program found
1795#		 returns the path set by the user in the environment
1796# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1797#		  'no' user instructs the module not to use asciidoc
1798#
1799# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1800#
1801AC_DEFUN([XORG_WITH_ASCIIDOC],[
1802AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1803m4_define([_defopt], m4_default([$2], [auto]))
1804AC_ARG_WITH(asciidoc,
1805	AS_HELP_STRING([--with-asciidoc],
1806	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1807	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1808m4_undefine([_defopt])
1809
1810if test "x$use_asciidoc" = x"auto"; then
1811   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1812   if test "x$ASCIIDOC" = "x"; then
1813        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1814	have_asciidoc=no
1815   else
1816        have_asciidoc=yes
1817   fi
1818elif test "x$use_asciidoc" = x"yes" ; then
1819   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1820   if test "x$ASCIIDOC" = "x"; then
1821        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1822   fi
1823   have_asciidoc=yes
1824elif test "x$use_asciidoc" = x"no" ; then
1825   if test "x$ASCIIDOC" != "x"; then
1826      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1827   fi
1828   have_asciidoc=no
1829else
1830   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1831fi
1832m4_ifval([$1],
1833[if test "$have_asciidoc" = yes; then
1834    # scrape the asciidoc version
1835    AC_MSG_CHECKING([the asciidoc version])
1836    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1837    AC_MSG_RESULT([$asciidoc_version])
1838    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1839        [if test "x$use_asciidoc" = xauto; then
1840            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1841            have_asciidoc=no
1842        else
1843            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1844        fi])
1845fi])
1846AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1847]) # XORG_WITH_ASCIIDOC
1848
1849# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1850# --------------------------------
1851# Minimum version: 1.5.0
1852# Minimum version for optional DEFAULT argument: 1.11.0
1853#
1854# Documentation tools are not always available on all platforms and sometimes
1855# not at the appropriate level. This macro enables a module to test for the
1856# presence of the tool and obtain it's path in separate variables. Coupled with
1857# the --with-doxygen option, it allows maximum flexibilty in making decisions
1858# as whether or not to use the doxygen package. When DEFAULT is not specified,
1859# --with-doxygen assumes 'auto'.
1860#
1861# Interface to module:
1862# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1863# DOXYGEN:	 returns the path of the doxygen program found
1864#		 returns the path set by the user in the environment
1865# --with-doxygen: 'yes' user instructs the module to use doxygen
1866#		  'no' user instructs the module not to use doxygen
1867#
1868# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1869#
1870AC_DEFUN([XORG_WITH_DOXYGEN],[
1871AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1872m4_define([_defopt], m4_default([$2], [auto]))
1873AC_ARG_WITH(doxygen,
1874	AS_HELP_STRING([--with-doxygen],
1875	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1876	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1877m4_undefine([_defopt])
1878
1879if test "x$use_doxygen" = x"auto"; then
1880   AC_PATH_PROG([DOXYGEN], [doxygen])
1881   if test "x$DOXYGEN" = "x"; then
1882        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1883	have_doxygen=no
1884   else
1885        have_doxygen=yes
1886   fi
1887elif test "x$use_doxygen" = x"yes" ; then
1888   AC_PATH_PROG([DOXYGEN], [doxygen])
1889   if test "x$DOXYGEN" = "x"; then
1890        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1891   fi
1892   have_doxygen=yes
1893elif test "x$use_doxygen" = x"no" ; then
1894   if test "x$DOXYGEN" != "x"; then
1895      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1896   fi
1897   have_doxygen=no
1898else
1899   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1900fi
1901m4_ifval([$1],
1902[if test "$have_doxygen" = yes; then
1903    # scrape the doxygen version
1904    AC_MSG_CHECKING([the doxygen version])
1905    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1906    AC_MSG_RESULT([$doxygen_version])
1907    AS_VERSION_COMPARE([$doxygen_version], [$1],
1908        [if test "x$use_doxygen" = xauto; then
1909            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1910            have_doxygen=no
1911        else
1912            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1913        fi])
1914fi])
1915AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1916]) # XORG_WITH_DOXYGEN
1917
1918# XORG_WITH_GROFF([DEFAULT])
1919# ----------------
1920# Minimum version: 1.6.0
1921# Minimum version for optional DEFAULT argument: 1.11.0
1922#
1923# Documentation tools are not always available on all platforms and sometimes
1924# not at the appropriate level. This macro enables a module to test for the
1925# presence of the tool and obtain it's path in separate variables. Coupled with
1926# the --with-groff option, it allows maximum flexibilty in making decisions
1927# as whether or not to use the groff package. When DEFAULT is not specified,
1928# --with-groff assumes 'auto'.
1929#
1930# Interface to module:
1931# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1932# HAVE_GROFF_MM: the memorandum macros (-mm) package
1933# HAVE_GROFF_MS: the -ms macros package
1934# GROFF:	 returns the path of the groff program found
1935#		 returns the path set by the user in the environment
1936# --with-groff:	 'yes' user instructs the module to use groff
1937#		 'no' user instructs the module not to use groff
1938#
1939# Added in version 1.9.0:
1940# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1941#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1942#		   psselect from the psutils package.
1943#		   the ghostcript package. Refer to the grohtml man pages
1944#
1945# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1946#
1947# OS and distros often splits groff in a basic and full package, the former
1948# having the groff program and the later having devices, fonts and macros
1949# Checking for the groff executable is not enough.
1950#
1951# If macros are missing, we cannot assume that groff is useless, so we don't
1952# unset HAVE_GROFF or GROFF env variables.
1953# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1954#
1955AC_DEFUN([XORG_WITH_GROFF],[
1956AC_ARG_VAR([GROFF], [Path to groff command])
1957m4_define([_defopt], m4_default([$1], [auto]))
1958AC_ARG_WITH(groff,
1959	AS_HELP_STRING([--with-groff],
1960	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1961	   [use_groff=$withval], [use_groff=]_defopt)
1962m4_undefine([_defopt])
1963
1964if test "x$use_groff" = x"auto"; then
1965   AC_PATH_PROG([GROFF], [groff])
1966   if test "x$GROFF" = "x"; then
1967        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1968	have_groff=no
1969   else
1970        have_groff=yes
1971   fi
1972elif test "x$use_groff" = x"yes" ; then
1973   AC_PATH_PROG([GROFF], [groff])
1974   if test "x$GROFF" = "x"; then
1975        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1976   fi
1977   have_groff=yes
1978elif test "x$use_groff" = x"no" ; then
1979   if test "x$GROFF" != "x"; then
1980      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1981   fi
1982   have_groff=no
1983else
1984   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1985fi
1986
1987# We have groff, test for the presence of the macro packages
1988if test "x$have_groff" = x"yes"; then
1989    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1990    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1991        groff_ms_works=yes
1992    else
1993        groff_ms_works=no
1994    fi
1995    AC_MSG_RESULT([$groff_ms_works])
1996    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1997    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1998        groff_mm_works=yes
1999    else
2000        groff_mm_works=no
2001    fi
2002    AC_MSG_RESULT([$groff_mm_works])
2003fi
2004
2005# We have groff, test for HTML dependencies, one command per package
2006if test "x$have_groff" = x"yes"; then
2007   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2008   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2009   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2010   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2011      have_groff_html=yes
2012   else
2013      have_groff_html=no
2014      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2015   fi
2016fi
2017
2018# Set Automake conditionals for Makefiles
2019AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2020AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2021AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2022AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2023]) # XORG_WITH_GROFF
2024
2025# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2026# ---------------------------------------
2027# Minimum version: 1.6.0
2028# Minimum version for optional DEFAULT argument: 1.11.0
2029# Minimum version for optional MIN-VERSION argument: 1.15.0
2030#
2031# Documentation tools are not always available on all platforms and sometimes
2032# not at the appropriate level. This macro enables a module to test for the
2033# presence of the tool and obtain it's path in separate variables. Coupled with
2034# the --with-fop option, it allows maximum flexibilty in making decisions
2035# as whether or not to use the fop package. When DEFAULT is not specified,
2036# --with-fop assumes 'auto'.
2037#
2038# Interface to module:
2039# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2040# FOP:	 	returns the path of the fop program found
2041#		returns the path set by the user in the environment
2042# --with-fop: 	'yes' user instructs the module to use fop
2043#		'no' user instructs the module not to use fop
2044#
2045# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2046#
2047AC_DEFUN([XORG_WITH_FOP],[
2048AC_ARG_VAR([FOP], [Path to fop command])
2049m4_define([_defopt], m4_default([$2], [auto]))
2050AC_ARG_WITH(fop,
2051	AS_HELP_STRING([--with-fop],
2052	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2053	   [use_fop=$withval], [use_fop=]_defopt)
2054m4_undefine([_defopt])
2055
2056if test "x$use_fop" = x"auto"; then
2057   AC_PATH_PROG([FOP], [fop])
2058   if test "x$FOP" = "x"; then
2059        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2060	have_fop=no
2061   else
2062        have_fop=yes
2063   fi
2064elif test "x$use_fop" = x"yes" ; then
2065   AC_PATH_PROG([FOP], [fop])
2066   if test "x$FOP" = "x"; then
2067        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2068   fi
2069   have_fop=yes
2070elif test "x$use_fop" = x"no" ; then
2071   if test "x$FOP" != "x"; then
2072      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2073   fi
2074   have_fop=no
2075else
2076   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2077fi
2078
2079# Test for a minimum version of fop, if provided.
2080m4_ifval([$1],
2081[if test "$have_fop" = yes; then
2082    # scrape the fop version
2083    AC_MSG_CHECKING([for fop minimum version])
2084    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2085    AC_MSG_RESULT([$fop_version])
2086    AS_VERSION_COMPARE([$fop_version], [$1],
2087        [if test "x$use_fop" = xauto; then
2088            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2089            have_fop=no
2090        else
2091            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2092        fi])
2093fi])
2094AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2095]) # XORG_WITH_FOP
2096
2097# XORG_WITH_PS2PDF([DEFAULT])
2098# ----------------
2099# Minimum version: 1.6.0
2100# Minimum version for optional DEFAULT argument: 1.11.0
2101#
2102# Documentation tools are not always available on all platforms and sometimes
2103# not at the appropriate level. This macro enables a module to test for the
2104# presence of the tool and obtain it's path in separate variables. Coupled with
2105# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2106# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2107# --with-ps2pdf assumes 'auto'.
2108#
2109# Interface to module:
2110# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2111# PS2PDF:	returns the path of the ps2pdf program found
2112#		returns the path set by the user in the environment
2113# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2114#		 'no' user instructs the module not to use ps2pdf
2115#
2116# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2117#
2118AC_DEFUN([XORG_WITH_PS2PDF],[
2119AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2120m4_define([_defopt], m4_default([$1], [auto]))
2121AC_ARG_WITH(ps2pdf,
2122	AS_HELP_STRING([--with-ps2pdf],
2123	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2124	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2125m4_undefine([_defopt])
2126
2127if test "x$use_ps2pdf" = x"auto"; then
2128   AC_PATH_PROG([PS2PDF], [ps2pdf])
2129   if test "x$PS2PDF" = "x"; then
2130        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2131	have_ps2pdf=no
2132   else
2133        have_ps2pdf=yes
2134   fi
2135elif test "x$use_ps2pdf" = x"yes" ; then
2136   AC_PATH_PROG([PS2PDF], [ps2pdf])
2137   if test "x$PS2PDF" = "x"; then
2138        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2139   fi
2140   have_ps2pdf=yes
2141elif test "x$use_ps2pdf" = x"no" ; then
2142   if test "x$PS2PDF" != "x"; then
2143      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2144   fi
2145   have_ps2pdf=no
2146else
2147   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2148fi
2149AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2150]) # XORG_WITH_PS2PDF
2151
2152# XORG_ENABLE_DOCS (enable_docs=yes)
2153# ----------------
2154# Minimum version: 1.6.0
2155#
2156# Documentation tools are not always available on all platforms and sometimes
2157# not at the appropriate level. This macro enables a builder to skip all
2158# documentation targets except traditional man pages.
2159# Combined with the specific tool checking macros XORG_WITH_*, it provides
2160# maximum flexibilty in controlling documentation building.
2161# Refer to:
2162# XORG_WITH_XMLTO         --with-xmlto
2163# XORG_WITH_ASCIIDOC      --with-asciidoc
2164# XORG_WITH_DOXYGEN       --with-doxygen
2165# XORG_WITH_FOP           --with-fop
2166# XORG_WITH_GROFF         --with-groff
2167# XORG_WITH_PS2PDF        --with-ps2pdf
2168#
2169# Interface to module:
2170# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2171# --enable-docs: 'yes' user instructs the module to generate docs
2172#		 'no' user instructs the module not to generate docs
2173# parm1:	specify the default value, yes or no.
2174#
2175AC_DEFUN([XORG_ENABLE_DOCS],[
2176m4_define([docs_default], m4_default([$1], [yes]))
2177AC_ARG_ENABLE(docs,
2178	AS_HELP_STRING([--enable-docs],
2179	   [Enable building the documentation (default: ]docs_default[)]),
2180	   [build_docs=$enableval], [build_docs=]docs_default)
2181m4_undefine([docs_default])
2182AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2183AC_MSG_CHECKING([whether to build documentation])
2184AC_MSG_RESULT([$build_docs])
2185]) # XORG_ENABLE_DOCS
2186
2187# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2188# ----------------
2189# Minimum version: 1.6.0
2190#
2191# This macro enables a builder to skip all developer documentation.
2192# Combined with the specific tool checking macros XORG_WITH_*, it provides
2193# maximum flexibilty in controlling documentation building.
2194# Refer to:
2195# XORG_WITH_XMLTO         --with-xmlto
2196# XORG_WITH_ASCIIDOC      --with-asciidoc
2197# XORG_WITH_DOXYGEN       --with-doxygen
2198# XORG_WITH_FOP           --with-fop
2199# XORG_WITH_GROFF         --with-groff
2200# XORG_WITH_PS2PDF        --with-ps2pdf
2201#
2202# Interface to module:
2203# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2204# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2205#			'no' user instructs the module not to generate developer docs
2206# parm1:		specify the default value, yes or no.
2207#
2208AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2209m4_define([devel_default], m4_default([$1], [yes]))
2210AC_ARG_ENABLE(devel-docs,
2211	AS_HELP_STRING([--enable-devel-docs],
2212	   [Enable building the developer documentation (default: ]devel_default[)]),
2213	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2214m4_undefine([devel_default])
2215AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2216AC_MSG_CHECKING([whether to build developer documentation])
2217AC_MSG_RESULT([$build_devel_docs])
2218]) # XORG_ENABLE_DEVEL_DOCS
2219
2220# XORG_ENABLE_SPECS (enable_specs=yes)
2221# ----------------
2222# Minimum version: 1.6.0
2223#
2224# This macro enables a builder to skip all functional specification targets.
2225# Combined with the specific tool checking macros XORG_WITH_*, it provides
2226# maximum flexibilty in controlling documentation building.
2227# Refer to:
2228# XORG_WITH_XMLTO         --with-xmlto
2229# XORG_WITH_ASCIIDOC      --with-asciidoc
2230# XORG_WITH_DOXYGEN       --with-doxygen
2231# XORG_WITH_FOP           --with-fop
2232# XORG_WITH_GROFF         --with-groff
2233# XORG_WITH_PS2PDF        --with-ps2pdf
2234#
2235# Interface to module:
2236# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2237# --enable-specs:	'yes' user instructs the module to generate specs
2238#			'no' user instructs the module not to generate specs
2239# parm1:		specify the default value, yes or no.
2240#
2241AC_DEFUN([XORG_ENABLE_SPECS],[
2242m4_define([spec_default], m4_default([$1], [yes]))
2243AC_ARG_ENABLE(specs,
2244	AS_HELP_STRING([--enable-specs],
2245	   [Enable building the specs (default: ]spec_default[)]),
2246	   [build_specs=$enableval], [build_specs=]spec_default)
2247m4_undefine([spec_default])
2248AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2249AC_MSG_CHECKING([whether to build functional specifications])
2250AC_MSG_RESULT([$build_specs])
2251]) # XORG_ENABLE_SPECS
2252
2253# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2254# ----------------------------------------------
2255# Minimum version: 1.13.0
2256#
2257# This macro enables a builder to enable/disable unit testing
2258# It makes no assumption about the test cases implementation
2259# Test cases may or may not use Automake "Support for test suites"
2260# They may or may not use the software utility library GLib
2261#
2262# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2263# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2264# The variable enable_unit_tests is used by other macros in this file.
2265#
2266# Interface to module:
2267# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2268# enable_unit_tests:    used in configure.ac for additional configuration
2269# --enable-unit-tests:	'yes' user instructs the module to build tests
2270#			'no' user instructs the module not to build tests
2271# parm1:		specify the default value, yes or no.
2272#
2273AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2274AC_BEFORE([$0], [XORG_WITH_GLIB])
2275AC_BEFORE([$0], [XORG_LD_WRAP])
2276AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2277m4_define([_defopt], m4_default([$1], [auto]))
2278AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2279	[Enable building unit test cases (default: ]_defopt[)]),
2280	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2281m4_undefine([_defopt])
2282AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2283AC_MSG_CHECKING([whether to build unit test cases])
2284AC_MSG_RESULT([$enable_unit_tests])
2285]) # XORG_ENABLE_UNIT_TESTS
2286
2287# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2288# ------------------------------------------------------
2289# Minimum version: 1.17.0
2290#
2291# This macro enables a builder to enable/disable integration testing
2292# It makes no assumption about the test cases' implementation
2293# Test cases may or may not use Automake "Support for test suites"
2294#
2295# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2296# usually requires less dependencies and may be built and run under less
2297# stringent environments than integration tests.
2298#
2299# Interface to module:
2300# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2301# enable_integration_tests:   used in configure.ac for additional configuration
2302# --enable-integration-tests: 'yes' user instructs the module to build tests
2303#                             'no' user instructs the module not to build tests
2304# parm1:                      specify the default value, yes or no.
2305#
2306AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2307AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2308m4_define([_defopt], m4_default([$1], [auto]))
2309AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2310	[Enable building integration test cases (default: ]_defopt[)]),
2311	[enable_integration_tests=$enableval],
2312	[enable_integration_tests=]_defopt)
2313m4_undefine([_defopt])
2314AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2315	[test "x$enable_integration_tests" != xno])
2316AC_MSG_CHECKING([whether to build unit test cases])
2317AC_MSG_RESULT([$enable_integration_tests])
2318]) # XORG_ENABLE_INTEGRATION_TESTS
2319
2320# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2321# ----------------------------------------
2322# Minimum version: 1.13.0
2323#
2324# GLib is a library which provides advanced data structures and functions.
2325# This macro enables a module to test for the presence of Glib.
2326#
2327# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2328# Otherwise the value of $enable_unit_tests is blank.
2329#
2330# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2331# test support usually requires less dependencies and may be built and run under
2332# less stringent environments than integration tests.
2333#
2334# Interface to module:
2335# HAVE_GLIB: used in makefiles to conditionally build targets
2336# with_glib: used in configure.ac to know if GLib has been found
2337# --with-glib:	'yes' user instructs the module to use glib
2338#		'no' user instructs the module not to use glib
2339#
2340AC_DEFUN([XORG_WITH_GLIB],[
2341AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2342m4_define([_defopt], m4_default([$2], [auto]))
2343AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2344	[Use GLib library for unit testing (default: ]_defopt[)]),
2345	[with_glib=$withval], [with_glib=]_defopt)
2346m4_undefine([_defopt])
2347
2348have_glib=no
2349# Do not probe GLib if user explicitly disabled unit testing
2350if test "x$enable_unit_tests" != x"no"; then
2351  # Do not probe GLib if user explicitly disabled it
2352  if test "x$with_glib" != x"no"; then
2353    m4_ifval(
2354      [$1],
2355      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2356      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2357    )
2358  fi
2359fi
2360
2361# Not having GLib when unit testing has been explicitly requested is an error
2362if test "x$enable_unit_tests" = x"yes"; then
2363  if test "x$have_glib" = x"no"; then
2364    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2365  fi
2366fi
2367
2368# Having unit testing disabled when GLib has been explicitly requested is an error
2369if test "x$enable_unit_tests" = x"no"; then
2370  if test "x$with_glib" = x"yes"; then
2371    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2372  fi
2373fi
2374
2375# Not having GLib when it has been explicitly requested is an error
2376if test "x$with_glib" = x"yes"; then
2377  if test "x$have_glib" = x"no"; then
2378    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2379  fi
2380fi
2381
2382AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2383]) # XORG_WITH_GLIB
2384
2385# XORG_LD_WRAP([required|optional])
2386# ---------------------------------
2387# Minimum version: 1.13.0
2388#
2389# Check if linker supports -wrap, passed via compiler flags
2390#
2391# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2392# Otherwise the value of $enable_unit_tests is blank.
2393#
2394# Argument added in 1.16.0 - default is "required", to match existing behavior
2395# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2396# available, an argument of "optional" allows use when some unit tests require
2397# ld -wrap and others do not.
2398#
2399AC_DEFUN([XORG_LD_WRAP],[
2400XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2401    [AC_LANG_PROGRAM([#include <stdlib.h>
2402                      void __wrap_exit(int status) { return; }],
2403                     [exit(0);])])
2404# Not having ld wrap when unit testing has been explicitly requested is an error
2405if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2406  if test "x$have_ld_wrap" = x"no"; then
2407    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2408  fi
2409fi
2410AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2411#
2412]) # XORG_LD_WRAP
2413
2414# XORG_CHECK_LINKER_FLAGS
2415# -----------------------
2416# SYNOPSIS
2417#
2418#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2419#
2420# DESCRIPTION
2421#
2422#   Check whether the given linker FLAGS work with the current language's
2423#   linker, or whether they give an error.
2424#
2425#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2426#   success/failure.
2427#
2428#   PROGRAM-SOURCE is the program source to link with, if needed
2429#
2430#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2431#
2432# LICENSE
2433#
2434#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2435#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2436#   Copyright (c) 2009 Matteo Frigo
2437#
2438#   This program is free software: you can redistribute it and/or modify it
2439#   under the terms of the GNU General Public License as published by the
2440#   Free Software Foundation, either version 3 of the License, or (at your
2441#   option) any later version.
2442#
2443#   This program is distributed in the hope that it will be useful, but
2444#   WITHOUT ANY WARRANTY; without even the implied warranty of
2445#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2446#   Public License for more details.
2447#
2448#   You should have received a copy of the GNU General Public License along
2449#   with this program. If not, see <http://www.gnu.org/licenses/>.
2450#
2451#   As a special exception, the respective Autoconf Macro's copyright owner
2452#   gives unlimited permission to copy, distribute and modify the configure
2453#   scripts that are the output of Autoconf when processing the Macro. You
2454#   need not follow the terms of the GNU General Public License when using
2455#   or distributing such scripts, even though portions of the text of the
2456#   Macro appear in them. The GNU General Public License (GPL) does govern
2457#   all other use of the material that constitutes the Autoconf Macro.
2458#
2459#   This special exception to the GPL applies to versions of the Autoconf
2460#   Macro released by the Autoconf Archive. When you make and distribute a
2461#   modified version of the Autoconf Macro, you may extend this special
2462#   exception to the GPL to apply to your modified version as well.#
2463AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2464[AC_MSG_CHECKING([whether the linker accepts $1])
2465dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2466AS_LITERAL_IF([$1],
2467  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2468      ax_save_FLAGS=$LDFLAGS
2469      LDFLAGS="$1"
2470      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2471        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2472        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2473      LDFLAGS=$ax_save_FLAGS])],
2474  [ax_save_FLAGS=$LDFLAGS
2475   LDFLAGS="$1"
2476   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2477     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2478     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2479   LDFLAGS=$ax_save_FLAGS])
2480eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2481AC_MSG_RESULT($xorg_check_linker_flags)
2482if test "x$xorg_check_linker_flags" = xyes; then
2483	m4_default([$2], :)
2484else
2485	m4_default([$3], :)
2486fi
2487]) # XORG_CHECK_LINKER_FLAGS
2488
2489# XORG_MEMORY_CHECK_FLAGS
2490# -----------------------
2491# Minimum version: 1.16.0
2492#
2493# This macro attempts to find appropriate memory checking functionality
2494# for various platforms which unit testing code may use to catch various
2495# forms of memory allocation and access errors in testing.
2496#
2497# Interface to module:
2498# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2499#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2500#
2501# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2502#
2503AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2504
2505AC_REQUIRE([AC_CANONICAL_HOST])
2506AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2507           [Environment variables to enable memory checking in tests])
2508
2509# Check for different types of support on different platforms
2510case $host_os in
2511    solaris*)
2512        AC_CHECK_LIB([umem], [umem_alloc],
2513            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2514        ;;
2515    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2516        # both directly and inverted, so should not be 0 or 255.
2517        malloc_debug_env='MALLOC_PERTURB_=15'
2518        ;;
2519    darwin*)
2520        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2521        ;;
2522    *bsd*)
2523        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2524        ;;
2525esac
2526
2527# User supplied flags override default flags
2528if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2529    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2530fi
2531
2532AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2533]) # XORG_WITH_LINT
2534
2535# XORG_CHECK_MALLOC_ZERO
2536# ----------------------
2537# Minimum version: 1.0.0
2538#
2539# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2540# malloc(0) returns NULL.  Packages should add one of these cflags to
2541# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2542AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2543AC_ARG_ENABLE(malloc0returnsnull,
2544	AS_HELP_STRING([--enable-malloc0returnsnull],
2545		       [malloc(0) returns NULL (default: auto)]),
2546	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2547	[MALLOC_ZERO_RETURNS_NULL=auto])
2548
2549AC_MSG_CHECKING([whether malloc(0) returns NULL])
2550if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2551	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2552#include <stdlib.h>
2553],[
2554    char *m0, *r0, *c0, *p;
2555    m0 = malloc(0);
2556    p = malloc(10);
2557    r0 = realloc(p,0);
2558    c0 = calloc(0,10);
2559    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2560])],
2561		[MALLOC_ZERO_RETURNS_NULL=yes],
2562		[MALLOC_ZERO_RETURNS_NULL=no],
2563		[MALLOC_ZERO_RETURNS_NULL=yes])
2564fi
2565AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2566
2567if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2568	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2569	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2570	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2571else
2572	MALLOC_ZERO_CFLAGS=""
2573	XMALLOC_ZERO_CFLAGS=""
2574	XTMALLOC_ZERO_CFLAGS=""
2575fi
2576
2577AC_SUBST([MALLOC_ZERO_CFLAGS])
2578AC_SUBST([XMALLOC_ZERO_CFLAGS])
2579AC_SUBST([XTMALLOC_ZERO_CFLAGS])
2580]) # XORG_CHECK_MALLOC_ZERO
2581
2582# XORG_WITH_LINT()
2583# ----------------
2584# Minimum version: 1.1.0
2585#
2586# This macro enables the use of a tool that flags some suspicious and
2587# non-portable constructs (likely to be bugs) in C language source code.
2588# It will attempt to locate the tool and use appropriate options.
2589# There are various lint type tools on different platforms.
2590#
2591# Interface to module:
2592# LINT:		returns the path to the tool found on the platform
2593#		or the value set to LINT on the configure cmd line
2594#		also an Automake conditional
2595# LINT_FLAGS:	an Automake variable with appropriate flags
2596#
2597# --with-lint:	'yes' user instructs the module to use lint
2598#		'no' user instructs the module not to use lint (default)
2599#
2600# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2601# If the user sets the value of LINT_FLAGS, they are used verbatim.
2602#
2603AC_DEFUN([XORG_WITH_LINT],[
2604
2605AC_ARG_VAR([LINT], [Path to a lint-style command])
2606AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2607AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2608		[Use a lint-style source code checker (default: disabled)])],
2609		[use_lint=$withval], [use_lint=no])
2610
2611# Obtain platform specific info like program name and options
2612# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2613case $host_os in
2614  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2615	lint_name=splint
2616	lint_options="-badflag"
2617	;;
2618  *freebsd* | *netbsd*)
2619	lint_name=lint
2620	lint_options="-u -b"
2621	;;
2622  *solaris*)
2623	lint_name=lint
2624	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2625	;;
2626esac
2627
2628# Test for the presence of the program (either guessed by the code or spelled out by the user)
2629if test "x$use_lint" = x"yes" ; then
2630   AC_PATH_PROG([LINT], [$lint_name])
2631   if test "x$LINT" = "x"; then
2632        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2633   fi
2634elif test "x$use_lint" = x"no" ; then
2635   if test "x$LINT" != "x"; then
2636      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2637   fi
2638else
2639   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2640fi
2641
2642# User supplied flags override default flags
2643if test "x$LINT_FLAGS" != "x"; then
2644   lint_options=$LINT_FLAGS
2645fi
2646
2647AC_SUBST([LINT_FLAGS],[$lint_options])
2648AM_CONDITIONAL(LINT, [test "x$LINT" != x])
2649
2650]) # XORG_WITH_LINT
2651
2652# XORG_LINT_LIBRARY(LIBNAME)
2653# --------------------------
2654# Minimum version: 1.1.0
2655#
2656# Sets up flags for building lint libraries for checking programs that call
2657# functions in the library.
2658#
2659# Interface to module:
2660# LINTLIB		- Automake variable with the name of lint library file to make
2661# MAKE_LINT_LIB		- Automake conditional
2662#
2663# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2664#			  - 'no' user instructs the module not to create a lint library (default)
2665
2666AC_DEFUN([XORG_LINT_LIBRARY],[
2667AC_REQUIRE([XORG_WITH_LINT])
2668AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2669	[Create lint library (default: disabled)])],
2670	[make_lint_lib=$enableval], [make_lint_lib=no])
2671
2672if test "x$make_lint_lib" = x"yes" ; then
2673   LINTLIB=llib-l$1.ln
2674   if test "x$LINT" = "x"; then
2675        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2676   fi
2677elif test "x$make_lint_lib" != x"no" ; then
2678   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2679fi
2680
2681AC_SUBST(LINTLIB)
2682AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2683
2684]) # XORG_LINT_LIBRARY
2685
2686# XORG_COMPILER_BRAND
2687# -------------------
2688# Minimum version: 1.14.0
2689#
2690# Checks for various brands of compilers and sets flags as appropriate:
2691#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2692#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2693#   clang compiler - sets CLANGCC to "yes"
2694#   Intel compiler - sets INTELCC to "yes"
2695#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2696#
2697AC_DEFUN([XORG_COMPILER_BRAND], [
2698AC_LANG_CASE(
2699	[C], [
2700		AC_REQUIRE([AC_PROG_CC_C99])
2701	],
2702	[C++], [
2703		AC_REQUIRE([AC_PROG_CXX])
2704	]
2705)
2706AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2707AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2708AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2709]) # XORG_COMPILER_BRAND
2710
2711# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2712# ---------------
2713# Minimum version: 1.16.0
2714#
2715# Test if the compiler works when passed the given flag as a command line argument.
2716# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2717# next flag in the list until there are no more options.
2718#
2719# Note that this does not guarantee that the compiler supports the flag as some
2720# compilers will simply ignore arguments that they do not understand, but we do
2721# attempt to weed out false positives by using -Werror=unknown-warning-option and
2722# -Werror=unused-command-line-argument
2723#
2724AC_DEFUN([XORG_TESTSET_CFLAG], [
2725m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2726m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2727
2728AC_LANG_COMPILER_REQUIRE
2729
2730AC_LANG_CASE(
2731	[C], [
2732		AC_REQUIRE([AC_PROG_CC_C99])
2733		define([PREFIX], [C])
2734		define([CACHE_PREFIX], [cc])
2735		define([COMPILER], [$CC])
2736	],
2737	[C++], [
2738		define([PREFIX], [CXX])
2739		define([CACHE_PREFIX], [cxx])
2740		define([COMPILER], [$CXX])
2741	]
2742)
2743
2744[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2745
2746if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2747	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2748	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2749			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2750			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2751					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2752					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2753	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2754	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2755fi
2756
2757if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2758	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2759		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2760	fi
2761	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2762	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2763			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2764			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2765					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2766					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2767	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2768	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2769fi
2770
2771found="no"
2772m4_foreach([flag], m4_cdr($@), [
2773	if test $found = "no" ; then
2774		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2775			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2776		fi
2777
2778		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2779			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2780		fi
2781
2782		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2783
2784dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2785		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2786		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2787		AC_CACHE_VAL($cacheid,
2788			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2789					     [eval $cacheid=yes],
2790					     [eval $cacheid=no])])
2791
2792		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2793
2794		eval supported=\$$cacheid
2795		AC_MSG_RESULT([$supported])
2796		if test "$supported" = "yes" ; then
2797			$1="$$1 ]flag["
2798			found="yes"
2799		fi
2800	fi
2801])
2802]) # XORG_TESTSET_CFLAG
2803
2804# XORG_COMPILER_FLAGS
2805# ---------------
2806# Minimum version: 1.16.0
2807#
2808# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2809# arguments supported by the selected compiler which do NOT alter the generated
2810# code.  These arguments will cause the compiler to print various warnings
2811# during compilation AND turn a conservative set of warnings into errors.
2812#
2813# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2814# future versions of util-macros as options are added to new compilers.
2815#
2816AC_DEFUN([XORG_COMPILER_FLAGS], [
2817AC_REQUIRE([XORG_COMPILER_BRAND])
2818
2819AC_ARG_ENABLE(selective-werror,
2820              AS_HELP_STRING([--disable-selective-werror],
2821                             [Turn off selective compiler errors. (default: enabled)]),
2822              [SELECTIVE_WERROR=$enableval],
2823              [SELECTIVE_WERROR=yes])
2824
2825AC_LANG_CASE(
2826        [C], [
2827                define([PREFIX], [C])
2828        ],
2829        [C++], [
2830                define([PREFIX], [CXX])
2831        ]
2832)
2833# -v is too short to test reliably with XORG_TESTSET_CFLAG
2834if test "x$SUNCC" = "xyes"; then
2835    [BASE_]PREFIX[FLAGS]="-v"
2836else
2837    [BASE_]PREFIX[FLAGS]=""
2838fi
2839
2840# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2841XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2842XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2843XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2844XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2845
2846AC_LANG_CASE(
2847	[C], [
2848		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2849		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2850		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2851		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2852		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2853		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2854	]
2855)
2856
2857# This chunk adds additional warnings that could catch undesired effects.
2858XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2859XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2860XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2861XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2862XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2863XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2864XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2865
2866# These are currently disabled because they are noisy.  They will be enabled
2867# in the future once the codebase is sufficiently modernized to silence
2868# them.  For now, I don't want them to drown out the other warnings.
2869# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2870# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2871# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2872
2873# Turn some warnings into errors, so we don't accidently get successful builds
2874# when there are problems that should be fixed.
2875
2876if test "x$SELECTIVE_WERROR" = "xyes" ; then
2877XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2878XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2879XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2880XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2881XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2882XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2883XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2884XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2885XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2886XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2887XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2888XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2889XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2890else
2891AC_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])
2892XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2893XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2894XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2895XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2896XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2897XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2898XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2899XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2900XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2901XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2902XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2903XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2904XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2905fi
2906
2907AC_SUBST([BASE_]PREFIX[FLAGS])
2908]) # XORG_COMPILER_FLAGS
2909
2910# XORG_CWARNFLAGS
2911# ---------------
2912# Minimum version: 1.2.0
2913# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2914#
2915# Defines CWARNFLAGS to enable C compiler warnings.
2916#
2917# This function is deprecated because it defines -fno-strict-aliasing
2918# which alters the code generated by the compiler.  If -fno-strict-aliasing
2919# is needed, then it should be added explicitly in the module when
2920# it is updated to use BASE_CFLAGS.
2921#
2922AC_DEFUN([XORG_CWARNFLAGS], [
2923AC_REQUIRE([XORG_COMPILER_FLAGS])
2924AC_REQUIRE([XORG_COMPILER_BRAND])
2925AC_LANG_CASE(
2926	[C], [
2927		CWARNFLAGS="$BASE_CFLAGS"
2928		if  test "x$GCC" = xyes ; then
2929		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2930		fi
2931		AC_SUBST(CWARNFLAGS)
2932	]
2933)
2934]) # XORG_CWARNFLAGS
2935
2936# XORG_STRICT_OPTION
2937# -----------------------
2938# Minimum version: 1.3.0
2939#
2940# Add configure option to enable strict compilation flags, such as treating
2941# warnings as fatal errors.
2942# If --enable-strict-compilation is passed to configure, adds strict flags to
2943# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2944#
2945# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2946# when strict compilation is unconditionally desired.
2947AC_DEFUN([XORG_STRICT_OPTION], [
2948AC_REQUIRE([XORG_CWARNFLAGS])
2949AC_REQUIRE([XORG_COMPILER_FLAGS])
2950
2951AC_ARG_ENABLE(strict-compilation,
2952			  AS_HELP_STRING([--enable-strict-compilation],
2953			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2954			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2955
2956AC_LANG_CASE(
2957        [C], [
2958                define([PREFIX], [C])
2959        ],
2960        [C++], [
2961                define([PREFIX], [CXX])
2962        ]
2963)
2964
2965[STRICT_]PREFIX[FLAGS]=""
2966XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2967XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2968
2969# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2970# activate it with -Werror, so we add it here explicitly.
2971XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2972
2973if test "x$STRICT_COMPILE" = "xyes"; then
2974    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2975    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2976fi
2977AC_SUBST([STRICT_]PREFIX[FLAGS])
2978AC_SUBST([BASE_]PREFIX[FLAGS])
2979AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2980]) # XORG_STRICT_OPTION
2981
2982# XORG_DEFAULT_OPTIONS
2983# --------------------
2984# Minimum version: 1.3.0
2985#
2986# Defines default options for X.Org modules.
2987#
2988AC_DEFUN([XORG_DEFAULT_OPTIONS], [
2989AC_REQUIRE([AC_PROG_INSTALL])
2990XORG_COMPILER_FLAGS
2991XORG_CWARNFLAGS
2992XORG_STRICT_OPTION
2993XORG_RELEASE_VERSION
2994XORG_CHANGELOG
2995XORG_INSTALL
2996XORG_MANPAGE_SECTIONS
2997m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2998    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2999]) # XORG_DEFAULT_OPTIONS
3000
3001# XORG_INSTALL()
3002# ----------------
3003# Minimum version: 1.4.0
3004#
3005# Defines the variable INSTALL_CMD as the command to copy
3006# INSTALL from $prefix/share/util-macros.
3007#
3008AC_DEFUN([XORG_INSTALL], [
3009AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3010macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3011INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3012mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3013|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3014echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3015AC_SUBST([INSTALL_CMD])
3016]) # XORG_INSTALL
3017dnl Copyright 2005 Red Hat, Inc
3018dnl
3019dnl Permission to use, copy, modify, distribute, and sell this software and its
3020dnl documentation for any purpose is hereby granted without fee, provided that
3021dnl the above copyright notice appear in all copies and that both that
3022dnl copyright notice and this permission notice appear in supporting
3023dnl documentation.
3024dnl
3025dnl The above copyright notice and this permission notice shall be included
3026dnl in all copies or substantial portions of the Software.
3027dnl
3028dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3029dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3030dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3031dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3032dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3033dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3034dnl OTHER DEALINGS IN THE SOFTWARE.
3035dnl
3036dnl Except as contained in this notice, the name of the copyright holders shall
3037dnl not be used in advertising or otherwise to promote the sale, use or
3038dnl other dealings in this Software without prior written authorization
3039dnl from the copyright holders.
3040dnl
3041
3042# XORG_RELEASE_VERSION
3043# --------------------
3044# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3045 
3046AC_DEFUN([XORG_RELEASE_VERSION],[
3047	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3048		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3049		[Major version of this package])
3050	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3051	if test "x$PVM" = "x"; then
3052		PVM="0"
3053	fi
3054	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3055		[$PVM],
3056		[Minor version of this package])
3057	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3058	if test "x$PVP" = "x"; then
3059		PVP="0"
3060	fi
3061	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3062		[$PVP],
3063		[Patch version of this package])
3064])
3065
3066# XORG_CHANGELOG()
3067# ----------------
3068# Minimum version: 1.2.0
3069#
3070# Defines the variable CHANGELOG_CMD as the command to generate
3071# ChangeLog from git.
3072#
3073#
3074AC_DEFUN([XORG_CHANGELOG], [
3075CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3076mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3077|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3078echo 'git directory not found: installing possibly empty changelog.' >&2)"
3079AC_SUBST([CHANGELOG_CMD])
3080]) # XORG_CHANGELOG
3081
3082