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