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