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