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