aclocal.m4 revision a85aecdf
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# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
696
697# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
698# Free Software Foundation, Inc.
699#
700# This file is free software; the Free Software Foundation
701# gives unlimited permission to copy and/or distribute it,
702# with or without modifications, as long as this notice is preserved.
703
704# serial 6
705
706# AM_MISSING_PROG(NAME, PROGRAM)
707# ------------------------------
708AC_DEFUN([AM_MISSING_PROG],
709[AC_REQUIRE([AM_MISSING_HAS_RUN])
710$1=${$1-"${am_missing_run}$2"}
711AC_SUBST($1)])
712
713
714# AM_MISSING_HAS_RUN
715# ------------------
716# Define MISSING if not defined so far and test if it supports --run.
717# If it does, set am_missing_run to use it, otherwise, to nothing.
718AC_DEFUN([AM_MISSING_HAS_RUN],
719[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
720AC_REQUIRE_AUX_FILE([missing])dnl
721if test x"${MISSING+set}" != xset; then
722  case $am_aux_dir in
723  *\ * | *\	*)
724    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
725  *)
726    MISSING="\${SHELL} $am_aux_dir/missing" ;;
727  esac
728fi
729# Use eval to expand $SHELL
730if eval "$MISSING --run true"; then
731  am_missing_run="$MISSING --run "
732else
733  am_missing_run=
734  AC_MSG_WARN([`missing' script is too old or missing])
735fi
736])
737
738# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
739# Inc.
740#
741# This file is free software; the Free Software Foundation
742# gives unlimited permission to copy and/or distribute it,
743# with or without modifications, as long as this notice is preserved.
744
745# serial 1
746
747# AM_PROG_MKDIR_P
748# ---------------
749# Check for `mkdir -p'.
750AC_DEFUN([AM_PROG_MKDIR_P],
751[AC_PREREQ([2.60])dnl
752AC_REQUIRE([AC_PROG_MKDIR_P])dnl
753dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
754dnl while keeping a definition of mkdir_p for backward compatibility.
755dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
756dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
757dnl Makefile.ins that do not define MKDIR_P, so we do our own
758dnl adjustment using top_builddir (which is defined more often than
759dnl MKDIR_P).
760AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
761case $mkdir_p in
762  [[\\/$]]* | ?:[[\\/]]*) ;;
763  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
764esac
765])
766
767# Helper functions for option handling.                     -*- Autoconf -*-
768
769# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
770# Foundation, Inc.
771#
772# This file is free software; the Free Software Foundation
773# gives unlimited permission to copy and/or distribute it,
774# with or without modifications, as long as this notice is preserved.
775
776# serial 5
777
778# _AM_MANGLE_OPTION(NAME)
779# -----------------------
780AC_DEFUN([_AM_MANGLE_OPTION],
781[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782
783# _AM_SET_OPTION(NAME)
784# --------------------
785# Set option NAME.  Presently that only means defining a flag for this option.
786AC_DEFUN([_AM_SET_OPTION],
787[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
788
789# _AM_SET_OPTIONS(OPTIONS)
790# ------------------------
791# OPTIONS is a space-separated list of Automake options.
792AC_DEFUN([_AM_SET_OPTIONS],
793[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794
795# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
796# -------------------------------------------
797# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
798AC_DEFUN([_AM_IF_OPTION],
799[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800
801# Check to make sure that the build environment is sane.    -*- Autoconf -*-
802
803# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
804# Free Software Foundation, Inc.
805#
806# This file is free software; the Free Software Foundation
807# gives unlimited permission to copy and/or distribute it,
808# with or without modifications, as long as this notice is preserved.
809
810# serial 5
811
812# AM_SANITY_CHECK
813# ---------------
814AC_DEFUN([AM_SANITY_CHECK],
815[AC_MSG_CHECKING([whether build environment is sane])
816# Just in case
817sleep 1
818echo timestamp > conftest.file
819# Reject unsafe characters in $srcdir or the absolute working directory
820# name.  Accept space and tab only in the latter.
821am_lf='
822'
823case `pwd` in
824  *[[\\\"\#\$\&\'\`$am_lf]]*)
825    AC_MSG_ERROR([unsafe absolute working directory name]);;
826esac
827case $srcdir in
828  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
829    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
830esac
831
832# Do `set' in a subshell so we don't clobber the current shell's
833# arguments.  Must try -L first in case configure is actually a
834# symlink; some systems play weird games with the mod time of symlinks
835# (eg FreeBSD returns the mod time of the symlink's containing
836# directory).
837if (
838   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
839   if test "$[*]" = "X"; then
840      # -L didn't work.
841      set X `ls -t "$srcdir/configure" conftest.file`
842   fi
843   rm -f conftest.file
844   if test "$[*]" != "X $srcdir/configure conftest.file" \
845      && test "$[*]" != "X conftest.file $srcdir/configure"; then
846
847      # If neither matched, then we have a broken ls.  This can happen
848      # if, for instance, CONFIG_SHELL is bash and it inherits a
849      # broken ls alias from the environment.  This has actually
850      # happened.  Such a system could not be considered "sane".
851      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
852alias in your environment])
853   fi
854
855   test "$[2]" = conftest.file
856   )
857then
858   # Ok.
859   :
860else
861   AC_MSG_ERROR([newly created file is older than distributed files!
862Check your system clock])
863fi
864AC_MSG_RESULT(yes)])
865
866# Copyright (C) 2009  Free Software Foundation, Inc.
867#
868# This file is free software; the Free Software Foundation
869# gives unlimited permission to copy and/or distribute it,
870# with or without modifications, as long as this notice is preserved.
871
872# serial 1
873
874# AM_SILENT_RULES([DEFAULT])
875# --------------------------
876# Enable less verbose build rules; with the default set to DEFAULT
877# (`yes' being less verbose, `no' or empty being verbose).
878AC_DEFUN([AM_SILENT_RULES],
879[AC_ARG_ENABLE([silent-rules],
880[  --enable-silent-rules          less verbose build output (undo: `make V=1')
881  --disable-silent-rules         verbose build output (undo: `make V=0')])
882case $enable_silent_rules in
883yes) AM_DEFAULT_VERBOSITY=0;;
884no)  AM_DEFAULT_VERBOSITY=1;;
885*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
886esac
887AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
888AM_BACKSLASH='\'
889AC_SUBST([AM_BACKSLASH])dnl
890_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
891])
892
893# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
894#
895# This file is free software; the Free Software Foundation
896# gives unlimited permission to copy and/or distribute it,
897# with or without modifications, as long as this notice is preserved.
898
899# serial 1
900
901# AM_PROG_INSTALL_STRIP
902# ---------------------
903# One issue with vendor `install' (even GNU) is that you can't
904# specify the program used to strip binaries.  This is especially
905# annoying in cross-compiling environments, where the build's strip
906# is unlikely to handle the host's binaries.
907# Fortunately install-sh will honor a STRIPPROG variable, so we
908# always use install-sh in `make install-strip', and initialize
909# STRIPPROG with the value of the STRIP variable (set by the user).
910AC_DEFUN([AM_PROG_INSTALL_STRIP],
911[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
912# Installed binaries are usually stripped using `strip' when the user
913# run `make install-strip'.  However `strip' might not be the right
914# tool to use in cross-compilation environments, therefore Automake
915# will honor the `STRIP' environment variable to overrule this program.
916dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
917if test "$cross_compiling" != no; then
918  AC_CHECK_TOOL([STRIP], [strip], :)
919fi
920INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
921AC_SUBST([INSTALL_STRIP_PROGRAM])])
922
923# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
924#
925# This file is free software; the Free Software Foundation
926# gives unlimited permission to copy and/or distribute it,
927# with or without modifications, as long as this notice is preserved.
928
929# serial 3
930
931# _AM_SUBST_NOTMAKE(VARIABLE)
932# ---------------------------
933# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
934# This macro is traced by Automake.
935AC_DEFUN([_AM_SUBST_NOTMAKE])
936
937# AM_SUBST_NOTMAKE(VARIABLE)
938# --------------------------
939# Public sister of _AM_SUBST_NOTMAKE.
940AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
941
942# Check how to create a tarball.                            -*- Autoconf -*-
943
944# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
945#
946# This file is free software; the Free Software Foundation
947# gives unlimited permission to copy and/or distribute it,
948# with or without modifications, as long as this notice is preserved.
949
950# serial 2
951
952# _AM_PROG_TAR(FORMAT)
953# --------------------
954# Check how to create a tarball in format FORMAT.
955# FORMAT should be one of `v7', `ustar', or `pax'.
956#
957# Substitute a variable $(am__tar) that is a command
958# writing to stdout a FORMAT-tarball containing the directory
959# $tardir.
960#     tardir=directory && $(am__tar) > result.tar
961#
962# Substitute a variable $(am__untar) that extract such
963# a tarball read from stdin.
964#     $(am__untar) < result.tar
965AC_DEFUN([_AM_PROG_TAR],
966[# Always define AMTAR for backward compatibility.
967AM_MISSING_PROG([AMTAR], [tar])
968m4_if([$1], [v7],
969     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
970     [m4_case([$1], [ustar],, [pax],,
971              [m4_fatal([Unknown tar format])])
972AC_MSG_CHECKING([how to create a $1 tar archive])
973# Loop over all known methods to create a tar archive until one works.
974_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
975_am_tools=${am_cv_prog_tar_$1-$_am_tools}
976# Do not fold the above two line into one, because Tru64 sh and
977# Solaris sh will not grok spaces in the rhs of `-'.
978for _am_tool in $_am_tools
979do
980  case $_am_tool in
981  gnutar)
982    for _am_tar in tar gnutar gtar;
983    do
984      AM_RUN_LOG([$_am_tar --version]) && break
985    done
986    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
987    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
988    am__untar="$_am_tar -xf -"
989    ;;
990  plaintar)
991    # Must skip GNU tar: if it does not support --format= it doesn't create
992    # ustar tarball either.
993    (tar --version) >/dev/null 2>&1 && continue
994    am__tar='tar chf - "$$tardir"'
995    am__tar_='tar chf - "$tardir"'
996    am__untar='tar xf -'
997    ;;
998  pax)
999    am__tar='pax -L -x $1 -w "$$tardir"'
1000    am__tar_='pax -L -x $1 -w "$tardir"'
1001    am__untar='pax -r'
1002    ;;
1003  cpio)
1004    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1005    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1006    am__untar='cpio -i -H $1 -d'
1007    ;;
1008  none)
1009    am__tar=false
1010    am__tar_=false
1011    am__untar=false
1012    ;;
1013  esac
1014
1015  # If the value was cached, stop now.  We just wanted to have am__tar
1016  # and am__untar set.
1017  test -n "${am_cv_prog_tar_$1}" && break
1018
1019  # tar/untar a dummy directory, and stop if the command works
1020  rm -rf conftest.dir
1021  mkdir conftest.dir
1022  echo GrepMe > conftest.dir/file
1023  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1024  rm -rf conftest.dir
1025  if test -s conftest.tar; then
1026    AM_RUN_LOG([$am__untar <conftest.tar])
1027    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1028  fi
1029done
1030rm -rf conftest.dir
1031
1032AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1033AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1034AC_SUBST([am__tar])
1035AC_SUBST([am__untar])
1036]) # _AM_PROG_TAR
1037
1038# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1039# 
1040# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1041#
1042# This program is free software; you can redistribute it and/or modify
1043# it under the terms of the GNU General Public License as published by
1044# the Free Software Foundation; either version 2 of the License, or
1045# (at your option) any later version.
1046#
1047# This program is distributed in the hope that it will be useful, but
1048# WITHOUT ANY WARRANTY; without even the implied warranty of
1049# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1050# General Public License for more details.
1051#
1052# You should have received a copy of the GNU General Public License
1053# along with this program; if not, write to the Free Software
1054# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1055#
1056# As a special exception to the GNU General Public License, if you
1057# distribute this file as part of a program that contains a
1058# configuration script generated by Autoconf, you may include it under
1059# the same distribution terms that you use for the rest of that program.
1060
1061# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1062# ----------------------------------
1063AC_DEFUN([PKG_PROG_PKG_CONFIG],
1064[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1065m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1066AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1067if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1068	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1069fi
1070if test -n "$PKG_CONFIG"; then
1071	_pkg_min_version=m4_default([$1], [0.9.0])
1072	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1073	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1074		AC_MSG_RESULT([yes])
1075	else
1076		AC_MSG_RESULT([no])
1077		PKG_CONFIG=""
1078	fi
1079		
1080fi[]dnl
1081])# PKG_PROG_PKG_CONFIG
1082
1083# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1084#
1085# Check to see whether a particular set of modules exists.  Similar
1086# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1087#
1088#
1089# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1090# this or PKG_CHECK_MODULES is called, or make sure to call
1091# PKG_CHECK_EXISTS manually
1092# --------------------------------------------------------------
1093AC_DEFUN([PKG_CHECK_EXISTS],
1094[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1095if test -n "$PKG_CONFIG" && \
1096    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1097  m4_ifval([$2], [$2], [:])
1098m4_ifvaln([$3], [else
1099  $3])dnl
1100fi])
1101
1102
1103# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1104# ---------------------------------------------
1105m4_define([_PKG_CONFIG],
1106[if test -n "$$1"; then
1107    pkg_cv_[]$1="$$1"
1108 elif test -n "$PKG_CONFIG"; then
1109    PKG_CHECK_EXISTS([$3],
1110                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1111		     [pkg_failed=yes])
1112 else
1113    pkg_failed=untried
1114fi[]dnl
1115])# _PKG_CONFIG
1116
1117# _PKG_SHORT_ERRORS_SUPPORTED
1118# -----------------------------
1119AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1120[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1121if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1122        _pkg_short_errors_supported=yes
1123else
1124        _pkg_short_errors_supported=no
1125fi[]dnl
1126])# _PKG_SHORT_ERRORS_SUPPORTED
1127
1128
1129# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1130# [ACTION-IF-NOT-FOUND])
1131#
1132#
1133# Note that if there is a possibility the first call to
1134# PKG_CHECK_MODULES might not happen, you should be sure to include an
1135# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1136#
1137#
1138# --------------------------------------------------------------
1139AC_DEFUN([PKG_CHECK_MODULES],
1140[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1141AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1142AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1143
1144pkg_failed=no
1145AC_MSG_CHECKING([for $1])
1146
1147_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1148_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1149
1150m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1151and $1[]_LIBS to avoid the need to call pkg-config.
1152See the pkg-config man page for more details.])
1153
1154if test $pkg_failed = yes; then
1155        _PKG_SHORT_ERRORS_SUPPORTED
1156        if test $_pkg_short_errors_supported = yes; then
1157	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1158        else 
1159	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1160        fi
1161	# Put the nasty error message in config.log where it belongs
1162	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1163
1164	ifelse([$4], , [AC_MSG_ERROR(dnl
1165[Package requirements ($2) were not met:
1166
1167$$1_PKG_ERRORS
1168
1169Consider adjusting the PKG_CONFIG_PATH environment variable if you
1170installed software in a non-standard prefix.
1171
1172_PKG_TEXT
1173])],
1174		[AC_MSG_RESULT([no])
1175                $4])
1176elif test $pkg_failed = untried; then
1177	ifelse([$4], , [AC_MSG_FAILURE(dnl
1178[The pkg-config script could not be found or is too old.  Make sure it
1179is in your PATH or set the PKG_CONFIG environment variable to the full
1180path to pkg-config.
1181
1182_PKG_TEXT
1183
1184To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1185		[$4])
1186else
1187	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1188	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1189        AC_MSG_RESULT([yes])
1190	ifelse([$3], , :, [$3])
1191fi[]dnl
1192])# PKG_CHECK_MODULES
1193
1194dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1195dnl
1196dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1197dnl 
1198dnl Permission is hereby granted, free of charge, to any person obtaining a
1199dnl copy of this software and associated documentation files (the "Software"),
1200dnl to deal in the Software without restriction, including without limitation
1201dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1202dnl and/or sell copies of the Software, and to permit persons to whom the
1203dnl Software is furnished to do so, subject to the following conditions:
1204dnl
1205dnl The above copyright notice and this permission notice (including the next
1206dnl paragraph) shall be included in all copies or substantial portions of the
1207dnl Software.
1208dnl
1209dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1210dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1211dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1212dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1213dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1214dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1215dnl DEALINGS IN THE SOFTWARE.
1216
1217# XORG_MACROS_VERSION(required-version)
1218# -------------------------------------
1219# Minimum version: 1.1.0
1220#
1221# If you're using a macro added in Version 1.1 or newer, include this in
1222# your configure.ac with the minimum required version, such as:
1223# XORG_MACROS_VERSION(1.1)
1224#
1225# To ensure that this macro is defined, also add:
1226# m4_ifndef([XORG_MACROS_VERSION],
1227#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1228#
1229#
1230# See the "minimum version" comment for each macro you use to see what 
1231# version you require.
1232m4_defun([XORG_MACROS_VERSION],[
1233m4_define([vers_have], [1.17])
1234m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1235m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1236m4_if(m4_cmp(maj_have, maj_needed), 0,,
1237    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1238m4_if(m4_version_compare(vers_have, [$1]), -1,
1239    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1240m4_undefine([vers_have])
1241m4_undefine([maj_have])
1242m4_undefine([maj_needed])
1243]) # XORG_MACROS_VERSION
1244
1245# XORG_PROG_RAWCPP()
1246# ------------------
1247# Minimum version: 1.0.0
1248#
1249# Find cpp program and necessary flags for use in pre-processing text files
1250# such as man pages and config files
1251AC_DEFUN([XORG_PROG_RAWCPP],[
1252AC_REQUIRE([AC_PROG_CPP])
1253AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1254   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1255
1256# Check for flag to avoid builtin definitions - assumes unix is predefined,
1257# which is not the best choice for supporting other OS'es, but covers most
1258# of the ones we need for now.
1259AC_MSG_CHECKING([if $RAWCPP requires -undef])
1260AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1261if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1262	AC_MSG_RESULT([no])
1263else
1264	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1265		RAWCPPFLAGS=-undef
1266		AC_MSG_RESULT([yes])
1267	# under Cygwin unix is still defined even with -undef
1268	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1269		RAWCPPFLAGS="-undef -ansi"
1270		AC_MSG_RESULT([yes, with -ansi])
1271	else
1272		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1273	fi
1274fi
1275rm -f conftest.$ac_ext
1276
1277AC_MSG_CHECKING([if $RAWCPP requires -traditional])
1278AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1279if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1280	AC_MSG_RESULT([no])
1281else
1282	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1283		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1284		AC_MSG_RESULT([yes])
1285	else
1286		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1287	fi
1288fi
1289rm -f conftest.$ac_ext
1290AC_SUBST(RAWCPPFLAGS)
1291]) # XORG_PROG_RAWCPP
1292
1293# XORG_MANPAGE_SECTIONS()
1294# -----------------------
1295# Minimum version: 1.0.0
1296#
1297# Determine which sections man pages go in for the different man page types
1298# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1299# Not sure if there's any better way than just hardcoding by OS name.
1300# Override default settings by setting environment variables
1301# Added MAN_SUBSTS in version 1.8
1302# Added AC_PROG_SED in version 1.8
1303
1304AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1305AC_REQUIRE([AC_CANONICAL_HOST])
1306AC_REQUIRE([AC_PROG_SED])
1307
1308if test x$APP_MAN_SUFFIX = x    ; then
1309    APP_MAN_SUFFIX=1
1310fi
1311if test x$APP_MAN_DIR = x    ; then
1312    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1313fi
1314
1315if test x$LIB_MAN_SUFFIX = x    ; then
1316    LIB_MAN_SUFFIX=3
1317fi
1318if test x$LIB_MAN_DIR = x    ; then
1319    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1320fi
1321
1322if test x$FILE_MAN_SUFFIX = x    ; then
1323    case $host_os in
1324	solaris*)	FILE_MAN_SUFFIX=4  ;;
1325	*)		FILE_MAN_SUFFIX=5  ;;
1326    esac
1327fi
1328if test x$FILE_MAN_DIR = x    ; then
1329    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1330fi
1331
1332if test x$MISC_MAN_SUFFIX = x    ; then
1333    case $host_os in
1334	solaris*)	MISC_MAN_SUFFIX=5  ;;
1335	*)		MISC_MAN_SUFFIX=7  ;;
1336    esac
1337fi
1338if test x$MISC_MAN_DIR = x    ; then
1339    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1340fi
1341
1342if test x$DRIVER_MAN_SUFFIX = x    ; then
1343    case $host_os in
1344	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1345	*)		DRIVER_MAN_SUFFIX=4  ;;
1346    esac
1347fi
1348if test x$DRIVER_MAN_DIR = x    ; then
1349    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1350fi
1351
1352if test x$ADMIN_MAN_SUFFIX = x    ; then
1353    case $host_os in
1354	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1355	*)		ADMIN_MAN_SUFFIX=8  ;;
1356    esac
1357fi
1358if test x$ADMIN_MAN_DIR = x    ; then
1359    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1360fi
1361
1362
1363AC_SUBST([APP_MAN_SUFFIX])
1364AC_SUBST([LIB_MAN_SUFFIX])
1365AC_SUBST([FILE_MAN_SUFFIX])
1366AC_SUBST([MISC_MAN_SUFFIX])
1367AC_SUBST([DRIVER_MAN_SUFFIX])
1368AC_SUBST([ADMIN_MAN_SUFFIX])
1369AC_SUBST([APP_MAN_DIR])
1370AC_SUBST([LIB_MAN_DIR])
1371AC_SUBST([FILE_MAN_DIR])
1372AC_SUBST([MISC_MAN_DIR])
1373AC_SUBST([DRIVER_MAN_DIR])
1374AC_SUBST([ADMIN_MAN_DIR])
1375
1376XORG_MAN_PAGE="X Version 11"
1377AC_SUBST([XORG_MAN_PAGE])
1378MAN_SUBSTS="\
1379	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1380	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1381	-e 's|__xservername__|Xorg|g' \
1382	-e 's|__xconfigfile__|xorg.conf|g' \
1383	-e 's|__projectroot__|\$(prefix)|g' \
1384	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1385	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1386	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1387	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1388	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1389	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1390	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1391AC_SUBST([MAN_SUBSTS])
1392
1393]) # XORG_MANPAGE_SECTIONS
1394
1395# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1396# ------------------------
1397# Minimum version: 1.7.0
1398#
1399# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1400# provided by xorg-sgml-doctools, if installed.
1401AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1402AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1403XORG_SGML_PATH=
1404PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1405    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1406    [m4_ifval([$1],[:],
1407        [if test x"$cross_compiling" != x"yes" ; then
1408            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1409                          [XORG_SGML_PATH=$prefix/share/sgml])
1410         fi])
1411    ])
1412
1413# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1414# the path and the name of the doc stylesheet
1415if test "x$XORG_SGML_PATH" != "x" ; then
1416   AC_MSG_RESULT([$XORG_SGML_PATH])
1417   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1418   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1419else
1420   AC_MSG_RESULT([no])
1421fi
1422
1423AC_SUBST(XORG_SGML_PATH)
1424AC_SUBST(STYLESHEET_SRCDIR)
1425AC_SUBST(XSL_STYLESHEET)
1426AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1427]) # XORG_CHECK_SGML_DOCTOOLS
1428
1429# XORG_CHECK_LINUXDOC
1430# -------------------
1431# Minimum version: 1.0.0
1432#
1433# Defines the variable MAKE_TEXT if the necessary tools and
1434# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1435# Whether or not the necessary tools and files are found can be checked
1436# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1437AC_DEFUN([XORG_CHECK_LINUXDOC],[
1438AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1439AC_REQUIRE([XORG_WITH_PS2PDF])
1440
1441AC_PATH_PROG(LINUXDOC, linuxdoc)
1442
1443AC_MSG_CHECKING([whether to build documentation])
1444
1445if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1446   BUILDDOC=yes
1447else
1448   BUILDDOC=no
1449fi
1450
1451AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1452
1453AC_MSG_RESULT([$BUILDDOC])
1454
1455AC_MSG_CHECKING([whether to build pdf documentation])
1456
1457if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1458   BUILDPDFDOC=yes
1459else
1460   BUILDPDFDOC=no
1461fi
1462
1463AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1464
1465AC_MSG_RESULT([$BUILDPDFDOC])
1466
1467MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1468MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1469MAKE_PDF="$PS2PDF"
1470MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1471
1472AC_SUBST(MAKE_TEXT)
1473AC_SUBST(MAKE_PS)
1474AC_SUBST(MAKE_PDF)
1475AC_SUBST(MAKE_HTML)
1476]) # XORG_CHECK_LINUXDOC
1477
1478# XORG_CHECK_DOCBOOK
1479# -------------------
1480# Minimum version: 1.0.0
1481#
1482# Checks for the ability to build output formats from SGML DocBook source.
1483# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1484# indicates whether the necessary tools and files are found and, if set,
1485# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1486AC_DEFUN([XORG_CHECK_DOCBOOK],[
1487AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1488
1489BUILDTXTDOC=no
1490BUILDPDFDOC=no
1491BUILDPSDOC=no
1492BUILDHTMLDOC=no
1493
1494AC_PATH_PROG(DOCBOOKPS, docbook2ps)
1495AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1496AC_PATH_PROG(DOCBOOKHTML, docbook2html)
1497AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1498
1499AC_MSG_CHECKING([whether to build text documentation])
1500if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1501   test x$BUILD_TXTDOC != xno; then
1502	BUILDTXTDOC=yes
1503fi
1504AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1505AC_MSG_RESULT([$BUILDTXTDOC])
1506
1507AC_MSG_CHECKING([whether to build PDF documentation])
1508if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1509   test x$BUILD_PDFDOC != xno; then
1510	BUILDPDFDOC=yes
1511fi
1512AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1513AC_MSG_RESULT([$BUILDPDFDOC])
1514
1515AC_MSG_CHECKING([whether to build PostScript documentation])
1516if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1517   test x$BUILD_PSDOC != xno; then
1518	BUILDPSDOC=yes
1519fi
1520AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1521AC_MSG_RESULT([$BUILDPSDOC])
1522
1523AC_MSG_CHECKING([whether to build HTML documentation])
1524if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1525   test x$BUILD_HTMLDOC != xno; then
1526	BUILDHTMLDOC=yes
1527fi
1528AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1529AC_MSG_RESULT([$BUILDHTMLDOC])
1530
1531MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1532MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1533MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1534MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1535
1536AC_SUBST(MAKE_TEXT)
1537AC_SUBST(MAKE_PS)
1538AC_SUBST(MAKE_PDF)
1539AC_SUBST(MAKE_HTML)
1540]) # XORG_CHECK_DOCBOOK
1541
1542# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1543# ----------------
1544# Minimum version: 1.5.0
1545# Minimum version for optional DEFAULT argument: 1.11.0
1546#
1547# Documentation tools are not always available on all platforms and sometimes
1548# not at the appropriate level. This macro enables a module to test for the
1549# presence of the tool and obtain it's path in separate variables. Coupled with
1550# the --with-xmlto option, it allows maximum flexibilty in making decisions
1551# as whether or not to use the xmlto package. When DEFAULT is not specified,
1552# --with-xmlto assumes 'auto'.
1553#
1554# Interface to module:
1555# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1556# XMLTO:	returns the path of the xmlto program found
1557#		returns the path set by the user in the environment
1558# --with-xmlto:	'yes' user instructs the module to use xmlto
1559#		'no' user instructs the module not to use xmlto
1560#
1561# Added in version 1.10.0
1562# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1563#                  xmlto for text output requires either lynx, links, or w3m browsers
1564#
1565# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1566#
1567AC_DEFUN([XORG_WITH_XMLTO],[
1568AC_ARG_VAR([XMLTO], [Path to xmlto command])
1569m4_define([_defopt], m4_default([$2], [auto]))
1570AC_ARG_WITH(xmlto,
1571	AS_HELP_STRING([--with-xmlto],
1572	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1573	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1574m4_undefine([_defopt])
1575
1576if test "x$use_xmlto" = x"auto"; then
1577   AC_PATH_PROG([XMLTO], [xmlto])
1578   if test "x$XMLTO" = "x"; then
1579        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1580	have_xmlto=no
1581   else
1582        have_xmlto=yes
1583   fi
1584elif test "x$use_xmlto" = x"yes" ; then
1585   AC_PATH_PROG([XMLTO], [xmlto])
1586   if test "x$XMLTO" = "x"; then
1587        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1588   fi
1589   have_xmlto=yes
1590elif test "x$use_xmlto" = x"no" ; then
1591   if test "x$XMLTO" != "x"; then
1592      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1593   fi
1594   have_xmlto=no
1595else
1596   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1597fi
1598
1599# Test for a minimum version of xmlto, if provided.
1600m4_ifval([$1],
1601[if test "$have_xmlto" = yes; then
1602    # scrape the xmlto version
1603    AC_MSG_CHECKING([the xmlto version])
1604    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1605    AC_MSG_RESULT([$xmlto_version])
1606    AS_VERSION_COMPARE([$xmlto_version], [$1],
1607        [if test "x$use_xmlto" = xauto; then
1608            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1609            have_xmlto=no
1610        else
1611            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1612        fi])
1613fi])
1614
1615# Test for the ability of xmlto to generate a text target
1616have_xmlto_text=no
1617cat > conftest.xml << "EOF"
1618EOF
1619AS_IF([test "$have_xmlto" = yes],
1620      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1621             [have_xmlto_text=yes],
1622             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1623rm -f conftest.xml
1624AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1625AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1626]) # XORG_WITH_XMLTO
1627
1628# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1629# --------------------------------------------
1630# Minimum version: 1.12.0
1631# Minimum version for optional DEFAULT argument: 1.12.0
1632#
1633# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1634# XML-based language used for the transformation of XML documents.
1635# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1636# It is used under the cover by xmlto to generate html files from DocBook/XML.
1637# The XSLT processor is often used as a standalone tool for transformations.
1638# It should not be assumed that this tool is used only to work with documnetation.
1639# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1640#
1641# Interface to module:
1642# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1643# XSLTPROC:	 returns the path of the xsltproc program found
1644#		 returns the path set by the user in the environment
1645# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1646#		  'no' user instructs the module not to use xsltproc
1647# have_xsltproc: returns yes if xsltproc found in PATH or no
1648#
1649# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1650#
1651AC_DEFUN([XORG_WITH_XSLTPROC],[
1652AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1653# Preserves the interface, should it be implemented later
1654m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1655m4_define([_defopt], m4_default([$2], [auto]))
1656AC_ARG_WITH(xsltproc,
1657	AS_HELP_STRING([--with-xsltproc],
1658	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1659	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1660m4_undefine([_defopt])
1661
1662if test "x$use_xsltproc" = x"auto"; then
1663   AC_PATH_PROG([XSLTPROC], [xsltproc])
1664   if test "x$XSLTPROC" = "x"; then
1665        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1666	have_xsltproc=no
1667   else
1668        have_xsltproc=yes
1669   fi
1670elif test "x$use_xsltproc" = x"yes" ; then
1671   AC_PATH_PROG([XSLTPROC], [xsltproc])
1672   if test "x$XSLTPROC" = "x"; then
1673        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1674   fi
1675   have_xsltproc=yes
1676elif test "x$use_xsltproc" = x"no" ; then
1677   if test "x$XSLTPROC" != "x"; then
1678      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1679   fi
1680   have_xsltproc=no
1681else
1682   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1683fi
1684
1685AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1686]) # XORG_WITH_XSLTPROC
1687
1688# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1689# ----------------------------------------
1690# Minimum version: 1.15.0
1691#
1692# PERL (Practical Extraction and Report Language) is a language optimized for
1693# scanning arbitrary text files, extracting information from those text files,
1694# and printing reports based on that information.
1695#
1696# When DEFAULT is not specified, --with-perl assumes 'auto'.
1697#
1698# Interface to module:
1699# HAVE_PERL: used in makefiles to conditionally scan text files
1700# PERL:	     returns the path of the perl program found
1701#	     returns the path set by the user in the environment
1702# --with-perl: 'yes' user instructs the module to use perl
1703#	       'no' user instructs the module not to use perl
1704# have_perl: returns yes if perl found in PATH or no
1705#
1706# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1707#
1708AC_DEFUN([XORG_WITH_PERL],[
1709AC_ARG_VAR([PERL], [Path to perl command])
1710# Preserves the interface, should it be implemented later
1711m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1712m4_define([_defopt], m4_default([$2], [auto]))
1713AC_ARG_WITH(perl,
1714	AS_HELP_STRING([--with-perl],
1715	   [Use perl for extracting information from files (default: ]_defopt[)]),
1716	   [use_perl=$withval], [use_perl=]_defopt)
1717m4_undefine([_defopt])
1718
1719if test "x$use_perl" = x"auto"; then
1720   AC_PATH_PROG([PERL], [perl])
1721   if test "x$PERL" = "x"; then
1722        AC_MSG_WARN([perl not found - cannot extract information and report])
1723	have_perl=no
1724   else
1725        have_perl=yes
1726   fi
1727elif test "x$use_perl" = x"yes" ; then
1728   AC_PATH_PROG([PERL], [perl])
1729   if test "x$PERL" = "x"; then
1730        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1731   fi
1732   have_perl=yes
1733elif test "x$use_perl" = x"no" ; then
1734   if test "x$PERL" != "x"; then
1735      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1736   fi
1737   have_perl=no
1738else
1739   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1740fi
1741
1742AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1743]) # XORG_WITH_PERL
1744
1745# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1746# ----------------
1747# Minimum version: 1.5.0
1748# Minimum version for optional DEFAULT argument: 1.11.0
1749#
1750# Documentation tools are not always available on all platforms and sometimes
1751# not at the appropriate level. This macro enables a module to test for the
1752# presence of the tool and obtain it's path in separate variables. Coupled with
1753# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1754# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1755# --with-asciidoc assumes 'auto'.
1756#
1757# Interface to module:
1758# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1759# ASCIIDOC:	 returns the path of the asciidoc program found
1760#		 returns the path set by the user in the environment
1761# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1762#		  'no' user instructs the module not to use asciidoc
1763#
1764# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1765#
1766AC_DEFUN([XORG_WITH_ASCIIDOC],[
1767AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1768m4_define([_defopt], m4_default([$2], [auto]))
1769AC_ARG_WITH(asciidoc,
1770	AS_HELP_STRING([--with-asciidoc],
1771	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1772	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1773m4_undefine([_defopt])
1774
1775if test "x$use_asciidoc" = x"auto"; then
1776   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1777   if test "x$ASCIIDOC" = "x"; then
1778        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1779	have_asciidoc=no
1780   else
1781        have_asciidoc=yes
1782   fi
1783elif test "x$use_asciidoc" = x"yes" ; then
1784   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1785   if test "x$ASCIIDOC" = "x"; then
1786        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1787   fi
1788   have_asciidoc=yes
1789elif test "x$use_asciidoc" = x"no" ; then
1790   if test "x$ASCIIDOC" != "x"; then
1791      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1792   fi
1793   have_asciidoc=no
1794else
1795   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1796fi
1797m4_ifval([$1],
1798[if test "$have_asciidoc" = yes; then
1799    # scrape the asciidoc version
1800    AC_MSG_CHECKING([the asciidoc version])
1801    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1802    AC_MSG_RESULT([$asciidoc_version])
1803    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1804        [if test "x$use_asciidoc" = xauto; then
1805            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1806            have_asciidoc=no
1807        else
1808            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1809        fi])
1810fi])
1811AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1812]) # XORG_WITH_ASCIIDOC
1813
1814# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1815# --------------------------------
1816# Minimum version: 1.5.0
1817# Minimum version for optional DEFAULT argument: 1.11.0
1818#
1819# Documentation tools are not always available on all platforms and sometimes
1820# not at the appropriate level. This macro enables a module to test for the
1821# presence of the tool and obtain it's path in separate variables. Coupled with
1822# the --with-doxygen option, it allows maximum flexibilty in making decisions
1823# as whether or not to use the doxygen package. When DEFAULT is not specified,
1824# --with-doxygen assumes 'auto'.
1825#
1826# Interface to module:
1827# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1828# DOXYGEN:	 returns the path of the doxygen program found
1829#		 returns the path set by the user in the environment
1830# --with-doxygen: 'yes' user instructs the module to use doxygen
1831#		  'no' user instructs the module not to use doxygen
1832#
1833# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1834#
1835AC_DEFUN([XORG_WITH_DOXYGEN],[
1836AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1837m4_define([_defopt], m4_default([$2], [auto]))
1838AC_ARG_WITH(doxygen,
1839	AS_HELP_STRING([--with-doxygen],
1840	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1841	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1842m4_undefine([_defopt])
1843
1844if test "x$use_doxygen" = x"auto"; then
1845   AC_PATH_PROG([DOXYGEN], [doxygen])
1846   if test "x$DOXYGEN" = "x"; then
1847        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1848	have_doxygen=no
1849   else
1850        have_doxygen=yes
1851   fi
1852elif test "x$use_doxygen" = x"yes" ; then
1853   AC_PATH_PROG([DOXYGEN], [doxygen])
1854   if test "x$DOXYGEN" = "x"; then
1855        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1856   fi
1857   have_doxygen=yes
1858elif test "x$use_doxygen" = x"no" ; then
1859   if test "x$DOXYGEN" != "x"; then
1860      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1861   fi
1862   have_doxygen=no
1863else
1864   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1865fi
1866m4_ifval([$1],
1867[if test "$have_doxygen" = yes; then
1868    # scrape the doxygen version
1869    AC_MSG_CHECKING([the doxygen version])
1870    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1871    AC_MSG_RESULT([$doxygen_version])
1872    AS_VERSION_COMPARE([$doxygen_version], [$1],
1873        [if test "x$use_doxygen" = xauto; then
1874            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1875            have_doxygen=no
1876        else
1877            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1878        fi])
1879fi])
1880AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1881]) # XORG_WITH_DOXYGEN
1882
1883# XORG_WITH_GROFF([DEFAULT])
1884# ----------------
1885# Minimum version: 1.6.0
1886# Minimum version for optional DEFAULT argument: 1.11.0
1887#
1888# Documentation tools are not always available on all platforms and sometimes
1889# not at the appropriate level. This macro enables a module to test for the
1890# presence of the tool and obtain it's path in separate variables. Coupled with
1891# the --with-groff option, it allows maximum flexibilty in making decisions
1892# as whether or not to use the groff package. When DEFAULT is not specified,
1893# --with-groff assumes 'auto'.
1894#
1895# Interface to module:
1896# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1897# HAVE_GROFF_MM: the memorandum macros (-mm) package
1898# HAVE_GROFF_MS: the -ms macros package
1899# GROFF:	 returns the path of the groff program found
1900#		 returns the path set by the user in the environment
1901# --with-groff:	 'yes' user instructs the module to use groff
1902#		 'no' user instructs the module not to use groff
1903#
1904# Added in version 1.9.0:
1905# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1906#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1907#		   psselect from the psutils package.
1908#		   the ghostcript package. Refer to the grohtml man pages
1909#
1910# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1911#
1912# OS and distros often splits groff in a basic and full package, the former
1913# having the groff program and the later having devices, fonts and macros
1914# Checking for the groff executable is not enough.
1915#
1916# If macros are missing, we cannot assume that groff is useless, so we don't
1917# unset HAVE_GROFF or GROFF env variables.
1918# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1919#
1920AC_DEFUN([XORG_WITH_GROFF],[
1921AC_ARG_VAR([GROFF], [Path to groff command])
1922m4_define([_defopt], m4_default([$1], [auto]))
1923AC_ARG_WITH(groff,
1924	AS_HELP_STRING([--with-groff],
1925	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1926	   [use_groff=$withval], [use_groff=]_defopt)
1927m4_undefine([_defopt])
1928
1929if test "x$use_groff" = x"auto"; then
1930   AC_PATH_PROG([GROFF], [groff])
1931   if test "x$GROFF" = "x"; then
1932        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1933	have_groff=no
1934   else
1935        have_groff=yes
1936   fi
1937elif test "x$use_groff" = x"yes" ; then
1938   AC_PATH_PROG([GROFF], [groff])
1939   if test "x$GROFF" = "x"; then
1940        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1941   fi
1942   have_groff=yes
1943elif test "x$use_groff" = x"no" ; then
1944   if test "x$GROFF" != "x"; then
1945      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1946   fi
1947   have_groff=no
1948else
1949   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1950fi
1951
1952# We have groff, test for the presence of the macro packages
1953if test "x$have_groff" = x"yes"; then
1954    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1955    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1956        groff_ms_works=yes
1957    else
1958        groff_ms_works=no
1959    fi
1960    AC_MSG_RESULT([$groff_ms_works])
1961    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1962    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1963        groff_mm_works=yes
1964    else
1965        groff_mm_works=no
1966    fi
1967    AC_MSG_RESULT([$groff_mm_works])
1968fi
1969
1970# We have groff, test for HTML dependencies, one command per package
1971if test "x$have_groff" = x"yes"; then
1972   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1973   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1974   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1975   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1976      have_groff_html=yes
1977   else
1978      have_groff_html=no
1979      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1980   fi
1981fi
1982
1983# Set Automake conditionals for Makefiles
1984AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1985AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1986AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1987AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1988]) # XORG_WITH_GROFF
1989
1990# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1991# ---------------------------------------
1992# Minimum version: 1.6.0
1993# Minimum version for optional DEFAULT argument: 1.11.0
1994# Minimum version for optional MIN-VERSION argument: 1.15.0
1995#
1996# Documentation tools are not always available on all platforms and sometimes
1997# not at the appropriate level. This macro enables a module to test for the
1998# presence of the tool and obtain it's path in separate variables. Coupled with
1999# the --with-fop option, it allows maximum flexibilty in making decisions
2000# as whether or not to use the fop package. When DEFAULT is not specified,
2001# --with-fop assumes 'auto'.
2002#
2003# Interface to module:
2004# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2005# FOP:	 	returns the path of the fop program found
2006#		returns the path set by the user in the environment
2007# --with-fop: 	'yes' user instructs the module to use fop
2008#		'no' user instructs the module not to use fop
2009#
2010# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2011#
2012AC_DEFUN([XORG_WITH_FOP],[
2013AC_ARG_VAR([FOP], [Path to fop command])
2014m4_define([_defopt], m4_default([$2], [auto]))
2015AC_ARG_WITH(fop,
2016	AS_HELP_STRING([--with-fop],
2017	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2018	   [use_fop=$withval], [use_fop=]_defopt)
2019m4_undefine([_defopt])
2020
2021if test "x$use_fop" = x"auto"; then
2022   AC_PATH_PROG([FOP], [fop])
2023   if test "x$FOP" = "x"; then
2024        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2025	have_fop=no
2026   else
2027        have_fop=yes
2028   fi
2029elif test "x$use_fop" = x"yes" ; then
2030   AC_PATH_PROG([FOP], [fop])
2031   if test "x$FOP" = "x"; then
2032        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2033   fi
2034   have_fop=yes
2035elif test "x$use_fop" = x"no" ; then
2036   if test "x$FOP" != "x"; then
2037      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2038   fi
2039   have_fop=no
2040else
2041   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2042fi
2043
2044# Test for a minimum version of fop, if provided.
2045m4_ifval([$1],
2046[if test "$have_fop" = yes; then
2047    # scrape the fop version
2048    AC_MSG_CHECKING([for fop minimum version])
2049    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2050    AC_MSG_RESULT([$fop_version])
2051    AS_VERSION_COMPARE([$fop_version], [$1],
2052        [if test "x$use_fop" = xauto; then
2053            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2054            have_fop=no
2055        else
2056            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2057        fi])
2058fi])
2059AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2060]) # XORG_WITH_FOP
2061
2062# XORG_WITH_PS2PDF([DEFAULT])
2063# ----------------
2064# Minimum version: 1.6.0
2065# Minimum version for optional DEFAULT argument: 1.11.0
2066#
2067# Documentation tools are not always available on all platforms and sometimes
2068# not at the appropriate level. This macro enables a module to test for the
2069# presence of the tool and obtain it's path in separate variables. Coupled with
2070# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2071# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2072# --with-ps2pdf assumes 'auto'.
2073#
2074# Interface to module:
2075# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2076# PS2PDF:	returns the path of the ps2pdf program found
2077#		returns the path set by the user in the environment
2078# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2079#		 'no' user instructs the module not to use ps2pdf
2080#
2081# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2082#
2083AC_DEFUN([XORG_WITH_PS2PDF],[
2084AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2085m4_define([_defopt], m4_default([$1], [auto]))
2086AC_ARG_WITH(ps2pdf,
2087	AS_HELP_STRING([--with-ps2pdf],
2088	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2089	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2090m4_undefine([_defopt])
2091
2092if test "x$use_ps2pdf" = x"auto"; then
2093   AC_PATH_PROG([PS2PDF], [ps2pdf])
2094   if test "x$PS2PDF" = "x"; then
2095        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2096	have_ps2pdf=no
2097   else
2098        have_ps2pdf=yes
2099   fi
2100elif test "x$use_ps2pdf" = x"yes" ; then
2101   AC_PATH_PROG([PS2PDF], [ps2pdf])
2102   if test "x$PS2PDF" = "x"; then
2103        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2104   fi
2105   have_ps2pdf=yes
2106elif test "x$use_ps2pdf" = x"no" ; then
2107   if test "x$PS2PDF" != "x"; then
2108      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2109   fi
2110   have_ps2pdf=no
2111else
2112   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2113fi
2114AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2115]) # XORG_WITH_PS2PDF
2116
2117# XORG_ENABLE_DOCS (enable_docs=yes)
2118# ----------------
2119# Minimum version: 1.6.0
2120#
2121# Documentation tools are not always available on all platforms and sometimes
2122# not at the appropriate level. This macro enables a builder to skip all
2123# documentation targets except traditional man pages.
2124# Combined with the specific tool checking macros XORG_WITH_*, it provides
2125# maximum flexibilty in controlling documentation building.
2126# Refer to:
2127# XORG_WITH_XMLTO         --with-xmlto
2128# XORG_WITH_ASCIIDOC      --with-asciidoc
2129# XORG_WITH_DOXYGEN       --with-doxygen
2130# XORG_WITH_FOP           --with-fop
2131# XORG_WITH_GROFF         --with-groff
2132# XORG_WITH_PS2PDF        --with-ps2pdf
2133#
2134# Interface to module:
2135# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2136# --enable-docs: 'yes' user instructs the module to generate docs
2137#		 'no' user instructs the module not to generate docs
2138# parm1:	specify the default value, yes or no.
2139#
2140AC_DEFUN([XORG_ENABLE_DOCS],[
2141m4_define([docs_default], m4_default([$1], [yes]))
2142AC_ARG_ENABLE(docs,
2143	AS_HELP_STRING([--enable-docs],
2144	   [Enable building the documentation (default: ]docs_default[)]),
2145	   [build_docs=$enableval], [build_docs=]docs_default)
2146m4_undefine([docs_default])
2147AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2148AC_MSG_CHECKING([whether to build documentation])
2149AC_MSG_RESULT([$build_docs])
2150]) # XORG_ENABLE_DOCS
2151
2152# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2153# ----------------
2154# Minimum version: 1.6.0
2155#
2156# This macro enables a builder to skip all developer documentation.
2157# Combined with the specific tool checking macros XORG_WITH_*, it provides
2158# maximum flexibilty in controlling documentation building.
2159# Refer to:
2160# XORG_WITH_XMLTO         --with-xmlto
2161# XORG_WITH_ASCIIDOC      --with-asciidoc
2162# XORG_WITH_DOXYGEN       --with-doxygen
2163# XORG_WITH_FOP           --with-fop
2164# XORG_WITH_GROFF         --with-groff
2165# XORG_WITH_PS2PDF        --with-ps2pdf
2166#
2167# Interface to module:
2168# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2169# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2170#			'no' user instructs the module not to generate developer docs
2171# parm1:		specify the default value, yes or no.
2172#
2173AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2174m4_define([devel_default], m4_default([$1], [yes]))
2175AC_ARG_ENABLE(devel-docs,
2176	AS_HELP_STRING([--enable-devel-docs],
2177	   [Enable building the developer documentation (default: ]devel_default[)]),
2178	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2179m4_undefine([devel_default])
2180AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2181AC_MSG_CHECKING([whether to build developer documentation])
2182AC_MSG_RESULT([$build_devel_docs])
2183]) # XORG_ENABLE_DEVEL_DOCS
2184
2185# XORG_ENABLE_SPECS (enable_specs=yes)
2186# ----------------
2187# Minimum version: 1.6.0
2188#
2189# This macro enables a builder to skip all functional specification targets.
2190# Combined with the specific tool checking macros XORG_WITH_*, it provides
2191# maximum flexibilty in controlling documentation building.
2192# Refer to:
2193# XORG_WITH_XMLTO         --with-xmlto
2194# XORG_WITH_ASCIIDOC      --with-asciidoc
2195# XORG_WITH_DOXYGEN       --with-doxygen
2196# XORG_WITH_FOP           --with-fop
2197# XORG_WITH_GROFF         --with-groff
2198# XORG_WITH_PS2PDF        --with-ps2pdf
2199#
2200# Interface to module:
2201# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2202# --enable-specs:	'yes' user instructs the module to generate specs
2203#			'no' user instructs the module not to generate specs
2204# parm1:		specify the default value, yes or no.
2205#
2206AC_DEFUN([XORG_ENABLE_SPECS],[
2207m4_define([spec_default], m4_default([$1], [yes]))
2208AC_ARG_ENABLE(specs,
2209	AS_HELP_STRING([--enable-specs],
2210	   [Enable building the specs (default: ]spec_default[)]),
2211	   [build_specs=$enableval], [build_specs=]spec_default)
2212m4_undefine([spec_default])
2213AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2214AC_MSG_CHECKING([whether to build functional specifications])
2215AC_MSG_RESULT([$build_specs])
2216]) # XORG_ENABLE_SPECS
2217
2218# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2219# ----------------------------------------------
2220# Minimum version: 1.13.0
2221#
2222# This macro enables a builder to enable/disable unit testing
2223# It makes no assumption about the test cases implementation
2224# Test cases may or may not use Automake "Support for test suites"
2225# They may or may not use the software utility library GLib
2226#
2227# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2228# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2229# The variable enable_unit_tests is used by other macros in this file.
2230#
2231# Interface to module:
2232# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2233# enable_unit_tests:    used in configure.ac for additional configuration
2234# --enable-unit-tests:	'yes' user instructs the module to build tests
2235#			'no' user instructs the module not to build tests
2236# parm1:		specify the default value, yes or no.
2237#
2238AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2239AC_BEFORE([$0], [XORG_WITH_GLIB])
2240AC_BEFORE([$0], [XORG_LD_WRAP])
2241AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2242m4_define([_defopt], m4_default([$1], [auto]))
2243AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2244	[Enable building unit test cases (default: ]_defopt[)]),
2245	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2246m4_undefine([_defopt])
2247AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2248AC_MSG_CHECKING([whether to build unit test cases])
2249AC_MSG_RESULT([$enable_unit_tests])
2250]) # XORG_ENABLE_UNIT_TESTS
2251
2252# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2253# ------------------------------------------------------
2254# Minimum version: 1.17.0
2255#
2256# This macro enables a builder to enable/disable integration testing
2257# It makes no assumption about the test cases' implementation
2258# Test cases may or may not use Automake "Support for test suites"
2259#
2260# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2261# usually requires less dependencies and may be built and run under less
2262# stringent environments than integration tests.
2263#
2264# Interface to module:
2265# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2266# enable_integration_tests:   used in configure.ac for additional configuration
2267# --enable-integration-tests: 'yes' user instructs the module to build tests
2268#                             'no' user instructs the module not to build tests
2269# parm1:                      specify the default value, yes or no.
2270#
2271AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2272AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2273m4_define([_defopt], m4_default([$1], [auto]))
2274AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2275	[Enable building integration test cases (default: ]_defopt[)]),
2276	[enable_integration_tests=$enableval],
2277	[enable_integration_tests=]_defopt)
2278m4_undefine([_defopt])
2279AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2280	[test "x$enable_integration_tests" != xno])
2281AC_MSG_CHECKING([whether to build unit test cases])
2282AC_MSG_RESULT([$enable_integration_tests])
2283]) # XORG_ENABLE_INTEGRATION_TESTS
2284
2285# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2286# ----------------------------------------
2287# Minimum version: 1.13.0
2288#
2289# GLib is a library which provides advanced data structures and functions.
2290# This macro enables a module to test for the presence of Glib.
2291#
2292# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2293# Otherwise the value of $enable_unit_tests is blank.
2294#
2295# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2296# test support usually requires less dependencies and may be built and run under
2297# less stringent environments than integration tests.
2298#
2299# Interface to module:
2300# HAVE_GLIB: used in makefiles to conditionally build targets
2301# with_glib: used in configure.ac to know if GLib has been found
2302# --with-glib:	'yes' user instructs the module to use glib
2303#		'no' user instructs the module not to use glib
2304#
2305AC_DEFUN([XORG_WITH_GLIB],[
2306AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2307m4_define([_defopt], m4_default([$2], [auto]))
2308AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2309	[Use GLib library for unit testing (default: ]_defopt[)]),
2310	[with_glib=$withval], [with_glib=]_defopt)
2311m4_undefine([_defopt])
2312
2313have_glib=no
2314# Do not probe GLib if user explicitly disabled unit testing
2315if test "x$enable_unit_tests" != x"no"; then
2316  # Do not probe GLib if user explicitly disabled it
2317  if test "x$with_glib" != x"no"; then
2318    m4_ifval(
2319      [$1],
2320      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2321      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2322    )
2323  fi
2324fi
2325
2326# Not having GLib when unit testing has been explicitly requested is an error
2327if test "x$enable_unit_tests" = x"yes"; then
2328  if test "x$have_glib" = x"no"; then
2329    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2330  fi
2331fi
2332
2333# Having unit testing disabled when GLib has been explicitly requested is an error
2334if test "x$enable_unit_tests" = x"no"; then
2335  if test "x$with_glib" = x"yes"; then
2336    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2337  fi
2338fi
2339
2340# Not having GLib when it has been explicitly requested is an error
2341if test "x$with_glib" = x"yes"; then
2342  if test "x$have_glib" = x"no"; then
2343    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2344  fi
2345fi
2346
2347AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2348]) # XORG_WITH_GLIB
2349
2350# XORG_LD_WRAP([required|optional])
2351# ---------------------------------
2352# Minimum version: 1.13.0
2353#
2354# Check if linker supports -wrap, passed via compiler flags
2355#
2356# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2357# Otherwise the value of $enable_unit_tests is blank.
2358#
2359# Argument added in 1.16.0 - default is "required", to match existing behavior
2360# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2361# available, an argument of "optional" allows use when some unit tests require
2362# ld -wrap and others do not.
2363#
2364AC_DEFUN([XORG_LD_WRAP],[
2365XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2366    [AC_LANG_PROGRAM([#include <stdlib.h>
2367                      void __wrap_exit(int status) { return; }],
2368                     [exit(0);])])
2369# Not having ld wrap when unit testing has been explicitly requested is an error
2370if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2371  if test "x$have_ld_wrap" = x"no"; then
2372    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2373  fi
2374fi
2375AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2376#
2377]) # XORG_LD_WRAP
2378
2379# XORG_CHECK_LINKER_FLAGS
2380# -----------------------
2381# SYNOPSIS
2382#
2383#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2384#
2385# DESCRIPTION
2386#
2387#   Check whether the given linker FLAGS work with the current language's
2388#   linker, or whether they give an error.
2389#
2390#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2391#   success/failure.
2392#
2393#   PROGRAM-SOURCE is the program source to link with, if needed
2394#
2395#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2396#
2397# LICENSE
2398#
2399#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2400#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2401#   Copyright (c) 2009 Matteo Frigo
2402#
2403#   This program is free software: you can redistribute it and/or modify it
2404#   under the terms of the GNU General Public License as published by the
2405#   Free Software Foundation, either version 3 of the License, or (at your
2406#   option) any later version.
2407#
2408#   This program is distributed in the hope that it will be useful, but
2409#   WITHOUT ANY WARRANTY; without even the implied warranty of
2410#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2411#   Public License for more details.
2412#
2413#   You should have received a copy of the GNU General Public License along
2414#   with this program. If not, see <http://www.gnu.org/licenses/>.
2415#
2416#   As a special exception, the respective Autoconf Macro's copyright owner
2417#   gives unlimited permission to copy, distribute and modify the configure
2418#   scripts that are the output of Autoconf when processing the Macro. You
2419#   need not follow the terms of the GNU General Public License when using
2420#   or distributing such scripts, even though portions of the text of the
2421#   Macro appear in them. The GNU General Public License (GPL) does govern
2422#   all other use of the material that constitutes the Autoconf Macro.
2423#
2424#   This special exception to the GPL applies to versions of the Autoconf
2425#   Macro released by the Autoconf Archive. When you make and distribute a
2426#   modified version of the Autoconf Macro, you may extend this special
2427#   exception to the GPL to apply to your modified version as well.#
2428AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2429[AC_MSG_CHECKING([whether the linker accepts $1])
2430dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2431AS_LITERAL_IF([$1],
2432  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2433      ax_save_FLAGS=$LDFLAGS
2434      LDFLAGS="$1"
2435      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2436        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2437        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2438      LDFLAGS=$ax_save_FLAGS])],
2439  [ax_save_FLAGS=$LDFLAGS
2440   LDFLAGS="$1"
2441   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2442     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2443     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2444   LDFLAGS=$ax_save_FLAGS])
2445eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2446AC_MSG_RESULT($xorg_check_linker_flags)
2447if test "x$xorg_check_linker_flags" = xyes; then
2448	m4_default([$2], :)
2449else
2450	m4_default([$3], :)
2451fi
2452]) # XORG_CHECK_LINKER_FLAGS
2453
2454# XORG_MEMORY_CHECK_FLAGS
2455# -----------------------
2456# Minimum version: 1.16.0
2457#
2458# This macro attempts to find appropriate memory checking functionality
2459# for various platforms which unit testing code may use to catch various
2460# forms of memory allocation and access errors in testing.
2461#
2462# Interface to module:
2463# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2464#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2465#
2466# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2467#
2468AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2469
2470AC_REQUIRE([AC_CANONICAL_HOST])
2471AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2472           [Environment variables to enable memory checking in tests])
2473
2474# Check for different types of support on different platforms
2475case $host_os in
2476    solaris*)
2477        AC_CHECK_LIB([umem], [umem_alloc],
2478            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2479        ;;
2480    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2481        # both directly and inverted, so should not be 0 or 255.
2482        malloc_debug_env='MALLOC_PERTURB_=15'
2483        ;;
2484    darwin*)
2485        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2486        ;;
2487    *bsd*)
2488        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2489        ;;
2490esac
2491
2492# User supplied flags override default flags
2493if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2494    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2495fi
2496
2497AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2498]) # XORG_WITH_LINT
2499
2500# XORG_CHECK_MALLOC_ZERO
2501# ----------------------
2502# Minimum version: 1.0.0
2503#
2504# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2505# malloc(0) returns NULL.  Packages should add one of these cflags to
2506# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2507AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2508AC_ARG_ENABLE(malloc0returnsnull,
2509	AS_HELP_STRING([--enable-malloc0returnsnull],
2510		       [malloc(0) returns NULL (default: auto)]),
2511	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2512	[MALLOC_ZERO_RETURNS_NULL=auto])
2513
2514AC_MSG_CHECKING([whether malloc(0) returns NULL])
2515if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2516	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2517#include <stdlib.h>
2518],[
2519    char *m0, *r0, *c0, *p;
2520    m0 = malloc(0);
2521    p = malloc(10);
2522    r0 = realloc(p,0);
2523    c0 = calloc(0,10);
2524    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2525])],
2526		[MALLOC_ZERO_RETURNS_NULL=yes],
2527		[MALLOC_ZERO_RETURNS_NULL=no],
2528		[MALLOC_ZERO_RETURNS_NULL=yes])
2529fi
2530AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2531
2532if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2533	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2534	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2535	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2536else
2537	MALLOC_ZERO_CFLAGS=""
2538	XMALLOC_ZERO_CFLAGS=""
2539	XTMALLOC_ZERO_CFLAGS=""
2540fi
2541
2542AC_SUBST([MALLOC_ZERO_CFLAGS])
2543AC_SUBST([XMALLOC_ZERO_CFLAGS])
2544AC_SUBST([XTMALLOC_ZERO_CFLAGS])
2545]) # XORG_CHECK_MALLOC_ZERO
2546
2547# XORG_WITH_LINT()
2548# ----------------
2549# Minimum version: 1.1.0
2550#
2551# This macro enables the use of a tool that flags some suspicious and
2552# non-portable constructs (likely to be bugs) in C language source code.
2553# It will attempt to locate the tool and use appropriate options.
2554# There are various lint type tools on different platforms.
2555#
2556# Interface to module:
2557# LINT:		returns the path to the tool found on the platform
2558#		or the value set to LINT on the configure cmd line
2559#		also an Automake conditional
2560# LINT_FLAGS:	an Automake variable with appropriate flags
2561#
2562# --with-lint:	'yes' user instructs the module to use lint
2563#		'no' user instructs the module not to use lint (default)
2564#
2565# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2566# If the user sets the value of LINT_FLAGS, they are used verbatim.
2567#
2568AC_DEFUN([XORG_WITH_LINT],[
2569
2570AC_ARG_VAR([LINT], [Path to a lint-style command])
2571AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2572AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2573		[Use a lint-style source code checker (default: disabled)])],
2574		[use_lint=$withval], [use_lint=no])
2575
2576# Obtain platform specific info like program name and options
2577# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2578case $host_os in
2579  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2580	lint_name=splint
2581	lint_options="-badflag"
2582	;;
2583  *freebsd* | *netbsd*)
2584	lint_name=lint
2585	lint_options="-u -b"
2586	;;
2587  *solaris*)
2588	lint_name=lint
2589	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2590	;;
2591esac
2592
2593# Test for the presence of the program (either guessed by the code or spelled out by the user)
2594if test "x$use_lint" = x"yes" ; then
2595   AC_PATH_PROG([LINT], [$lint_name])
2596   if test "x$LINT" = "x"; then
2597        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2598   fi
2599elif test "x$use_lint" = x"no" ; then
2600   if test "x$LINT" != "x"; then
2601      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2602   fi
2603else
2604   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2605fi
2606
2607# User supplied flags override default flags
2608if test "x$LINT_FLAGS" != "x"; then
2609   lint_options=$LINT_FLAGS
2610fi
2611
2612AC_SUBST([LINT_FLAGS],[$lint_options])
2613AM_CONDITIONAL(LINT, [test "x$LINT" != x])
2614
2615]) # XORG_WITH_LINT
2616
2617# XORG_LINT_LIBRARY(LIBNAME)
2618# --------------------------
2619# Minimum version: 1.1.0
2620#
2621# Sets up flags for building lint libraries for checking programs that call
2622# functions in the library.
2623#
2624# Interface to module:
2625# LINTLIB		- Automake variable with the name of lint library file to make
2626# MAKE_LINT_LIB		- Automake conditional
2627#
2628# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2629#			  - 'no' user instructs the module not to create a lint library (default)
2630
2631AC_DEFUN([XORG_LINT_LIBRARY],[
2632AC_REQUIRE([XORG_WITH_LINT])
2633AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2634	[Create lint library (default: disabled)])],
2635	[make_lint_lib=$enableval], [make_lint_lib=no])
2636
2637if test "x$make_lint_lib" = x"yes" ; then
2638   LINTLIB=llib-l$1.ln
2639   if test "x$LINT" = "x"; then
2640        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2641   fi
2642elif test "x$make_lint_lib" != x"no" ; then
2643   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2644fi
2645
2646AC_SUBST(LINTLIB)
2647AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2648
2649]) # XORG_LINT_LIBRARY
2650
2651# XORG_COMPILER_BRAND
2652# -------------------
2653# Minimum version: 1.14.0
2654#
2655# Checks for various brands of compilers and sets flags as appropriate:
2656#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2657#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2658#   clang compiler - sets CLANGCC to "yes"
2659#   Intel compiler - sets INTELCC to "yes"
2660#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2661#
2662AC_DEFUN([XORG_COMPILER_BRAND], [
2663AC_LANG_CASE(
2664	[C], [
2665		AC_REQUIRE([AC_PROG_CC_C99])
2666	],
2667	[C++], [
2668		AC_REQUIRE([AC_PROG_CXX])
2669	]
2670)
2671AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2672AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2673AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2674]) # XORG_COMPILER_BRAND
2675
2676# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2677# ---------------
2678# Minimum version: 1.16.0
2679#
2680# Test if the compiler works when passed the given flag as a command line argument.
2681# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2682# next flag in the list until there are no more options.
2683#
2684# Note that this does not guarantee that the compiler supports the flag as some
2685# compilers will simply ignore arguments that they do not understand, but we do
2686# attempt to weed out false positives by using -Werror=unknown-warning-option and
2687# -Werror=unused-command-line-argument
2688#
2689AC_DEFUN([XORG_TESTSET_CFLAG], [
2690m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2691m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2692
2693AC_LANG_COMPILER_REQUIRE
2694
2695AC_LANG_CASE(
2696	[C], [
2697		AC_REQUIRE([AC_PROG_CC_C99])
2698		define([PREFIX], [C])
2699		define([CACHE_PREFIX], [cc])
2700		define([COMPILER], [$CC])
2701	],
2702	[C++], [
2703		define([PREFIX], [CXX])
2704		define([CACHE_PREFIX], [cxx])
2705		define([COMPILER], [$CXX])
2706	]
2707)
2708
2709[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2710
2711if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2712	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2713	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2714			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2715			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2716					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2717					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2718	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2719	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2720fi
2721
2722if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2723	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2724		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2725	fi
2726	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2727	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2728			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2729			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2730					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2731					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2732	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2733	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2734fi
2735
2736found="no"
2737m4_foreach([flag], m4_cdr($@), [
2738	if test $found = "no" ; then
2739		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2740			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2741		fi
2742
2743		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2744			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2745		fi
2746
2747		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2748
2749dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2750		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2751		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2752		AC_CACHE_VAL($cacheid,
2753			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2754					     [eval $cacheid=yes],
2755					     [eval $cacheid=no])])
2756
2757		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2758
2759		eval supported=\$$cacheid
2760		AC_MSG_RESULT([$supported])
2761		if test "$supported" = "yes" ; then
2762			$1="$$1 ]flag["
2763			found="yes"
2764		fi
2765	fi
2766])
2767]) # XORG_TESTSET_CFLAG
2768
2769# XORG_COMPILER_FLAGS
2770# ---------------
2771# Minimum version: 1.16.0
2772#
2773# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2774# arguments supported by the selected compiler which do NOT alter the generated
2775# code.  These arguments will cause the compiler to print various warnings
2776# during compilation AND turn a conservative set of warnings into errors.
2777#
2778# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2779# future versions of util-macros as options are added to new compilers.
2780#
2781AC_DEFUN([XORG_COMPILER_FLAGS], [
2782AC_REQUIRE([XORG_COMPILER_BRAND])
2783
2784AC_ARG_ENABLE(selective-werror,
2785              AS_HELP_STRING([--disable-selective-werror],
2786                             [Turn off selective compiler errors. (default: enabled)]),
2787              [SELECTIVE_WERROR=$enableval],
2788              [SELECTIVE_WERROR=yes])
2789
2790AC_LANG_CASE(
2791        [C], [
2792                define([PREFIX], [C])
2793        ],
2794        [C++], [
2795                define([PREFIX], [CXX])
2796        ]
2797)
2798# -v is too short to test reliably with XORG_TESTSET_CFLAG
2799if test "x$SUNCC" = "xyes"; then
2800    [BASE_]PREFIX[FLAGS]="-v"
2801else
2802    [BASE_]PREFIX[FLAGS]=""
2803fi
2804
2805# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2806XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2807XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2808XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2809XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2810
2811AC_LANG_CASE(
2812	[C], [
2813		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2814		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2815		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2816		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2817		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2818		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2819	]
2820)
2821
2822# This chunk adds additional warnings that could catch undesired effects.
2823XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2824XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2825XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2826XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2827XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2828XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2829XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2830
2831# These are currently disabled because they are noisy.  They will be enabled
2832# in the future once the codebase is sufficiently modernized to silence
2833# them.  For now, I don't want them to drown out the other warnings.
2834# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2835# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2836# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2837
2838# Turn some warnings into errors, so we don't accidently get successful builds
2839# when there are problems that should be fixed.
2840
2841if test "x$SELECTIVE_WERROR" = "xyes" ; then
2842XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2843XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2844XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2845XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2846XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2847XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2848XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2849XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2850XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2851XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2852XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2853XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2854XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2855else
2856AC_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])
2857XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2858XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2859XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2860XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2861XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2862XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2863XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2864XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2865XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2866XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2867XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2868XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2869XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2870fi
2871
2872AC_SUBST([BASE_]PREFIX[FLAGS])
2873]) # XORG_COMPILER_FLAGS
2874
2875# XORG_CWARNFLAGS
2876# ---------------
2877# Minimum version: 1.2.0
2878# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2879#
2880# Defines CWARNFLAGS to enable C compiler warnings.
2881#
2882# This function is deprecated because it defines -fno-strict-aliasing
2883# which alters the code generated by the compiler.  If -fno-strict-aliasing
2884# is needed, then it should be added explicitly in the module when
2885# it is updated to use BASE_CFLAGS.
2886#
2887AC_DEFUN([XORG_CWARNFLAGS], [
2888AC_REQUIRE([XORG_COMPILER_FLAGS])
2889AC_REQUIRE([XORG_COMPILER_BRAND])
2890AC_LANG_CASE(
2891	[C], [
2892		CWARNFLAGS="$BASE_CFLAGS"
2893		if  test "x$GCC" = xyes ; then
2894		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2895		fi
2896		AC_SUBST(CWARNFLAGS)
2897	]
2898)
2899]) # XORG_CWARNFLAGS
2900
2901# XORG_STRICT_OPTION
2902# -----------------------
2903# Minimum version: 1.3.0
2904#
2905# Add configure option to enable strict compilation flags, such as treating
2906# warnings as fatal errors.
2907# If --enable-strict-compilation is passed to configure, adds strict flags to
2908# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2909#
2910# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2911# when strict compilation is unconditionally desired.
2912AC_DEFUN([XORG_STRICT_OPTION], [
2913AC_REQUIRE([XORG_CWARNFLAGS])
2914AC_REQUIRE([XORG_COMPILER_FLAGS])
2915
2916AC_ARG_ENABLE(strict-compilation,
2917			  AS_HELP_STRING([--enable-strict-compilation],
2918			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2919			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2920
2921AC_LANG_CASE(
2922        [C], [
2923                define([PREFIX], [C])
2924        ],
2925        [C++], [
2926                define([PREFIX], [CXX])
2927        ]
2928)
2929
2930[STRICT_]PREFIX[FLAGS]=""
2931XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2932XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2933
2934# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2935# activate it with -Werror, so we add it here explicitly.
2936XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2937
2938if test "x$STRICT_COMPILE" = "xyes"; then
2939    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2940    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2941fi
2942AC_SUBST([STRICT_]PREFIX[FLAGS])
2943AC_SUBST([BASE_]PREFIX[FLAGS])
2944AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2945]) # XORG_STRICT_OPTION
2946
2947# XORG_DEFAULT_OPTIONS
2948# --------------------
2949# Minimum version: 1.3.0
2950#
2951# Defines default options for X.Org modules.
2952#
2953AC_DEFUN([XORG_DEFAULT_OPTIONS], [
2954AC_REQUIRE([AC_PROG_INSTALL])
2955XORG_COMPILER_FLAGS
2956XORG_CWARNFLAGS
2957XORG_STRICT_OPTION
2958XORG_RELEASE_VERSION
2959XORG_CHANGELOG
2960XORG_INSTALL
2961XORG_MANPAGE_SECTIONS
2962m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2963    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2964]) # XORG_DEFAULT_OPTIONS
2965
2966# XORG_INSTALL()
2967# ----------------
2968# Minimum version: 1.4.0
2969#
2970# Defines the variable INSTALL_CMD as the command to copy
2971# INSTALL from $prefix/share/util-macros.
2972#
2973AC_DEFUN([XORG_INSTALL], [
2974AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2975macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2976INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2977mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2978|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2979echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2980AC_SUBST([INSTALL_CMD])
2981]) # XORG_INSTALL
2982dnl Copyright 2005 Red Hat, Inc
2983dnl
2984dnl Permission to use, copy, modify, distribute, and sell this software and its
2985dnl documentation for any purpose is hereby granted without fee, provided that
2986dnl the above copyright notice appear in all copies and that both that
2987dnl copyright notice and this permission notice appear in supporting
2988dnl documentation.
2989dnl
2990dnl The above copyright notice and this permission notice shall be included
2991dnl in all copies or substantial portions of the Software.
2992dnl
2993dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2994dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2995dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2996dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2997dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2998dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2999dnl OTHER DEALINGS IN THE SOFTWARE.
3000dnl
3001dnl Except as contained in this notice, the name of the copyright holders shall
3002dnl not be used in advertising or otherwise to promote the sale, use or
3003dnl other dealings in this Software without prior written authorization
3004dnl from the copyright holders.
3005dnl
3006
3007# XORG_RELEASE_VERSION
3008# --------------------
3009# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3010 
3011AC_DEFUN([XORG_RELEASE_VERSION],[
3012	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3013		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3014		[Major version of this package])
3015	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3016	if test "x$PVM" = "x"; then
3017		PVM="0"
3018	fi
3019	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3020		[$PVM],
3021		[Minor version of this package])
3022	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3023	if test "x$PVP" = "x"; then
3024		PVP="0"
3025	fi
3026	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3027		[$PVP],
3028		[Patch version of this package])
3029])
3030
3031# XORG_CHANGELOG()
3032# ----------------
3033# Minimum version: 1.2.0
3034#
3035# Defines the variable CHANGELOG_CMD as the command to generate
3036# ChangeLog from git.
3037#
3038#
3039AC_DEFUN([XORG_CHANGELOG], [
3040CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3041mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3042|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3043echo 'git directory not found: installing possibly empty changelog.' >&2)"
3044AC_SUBST([CHANGELOG_CMD])
3045]) # XORG_CHANGELOG
3046
3047