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