1# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005  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# Configure paths for SDL
15# Sam Lantinga 9/21/99
16# stolen from Manish Singh
17# stolen back from Frank Belew
18# stolen from Manish Singh
19# Shamelessly stolen from Owen Taylor
20
21dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
22dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
23dnl
24AC_DEFUN([AM_PATH_SDL],
25[dnl
26dnl Get the cflags and libraries from the sdl-config script
27dnl
28AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
29            sdl_prefix="$withval", sdl_prefix="")
30AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
31            sdl_exec_prefix="$withval", sdl_exec_prefix="")
32AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
33		    , enable_sdltest=yes)
34
35  if test x$sdl_exec_prefix != x ; then
36     sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
37     if test x${SDL_CONFIG+set} != xset ; then
38        SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
39     fi
40  fi
41  if test x$sdl_prefix != x ; then
42     sdl_args="$sdl_args --prefix=$sdl_prefix"
43     if test x${SDL_CONFIG+set} != xset ; then
44        SDL_CONFIG=$sdl_prefix/bin/sdl-config
45     fi
46  fi
47
48  AC_REQUIRE([AC_CANONICAL_TARGET])
49  PATH="$prefix/bin:$prefix/usr/bin:$PATH"
50  AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
51  min_sdl_version=ifelse([$1], ,0.11.0,$1)
52  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
53  no_sdl=""
54  if test "$SDL_CONFIG" = "no" ; then
55    no_sdl=yes
56  else
57    SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
58    SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
59
60    sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
61           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
62    sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
63           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
64    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
65           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
66    if test "x$enable_sdltest" = "xyes" ; then
67      ac_save_CFLAGS="$CFLAGS"
68      ac_save_LIBS="$LIBS"
69      CFLAGS="$CFLAGS $SDL_CFLAGS"
70      LIBS="$LIBS $SDL_LIBS"
71dnl
72dnl Now check if the installed SDL is sufficiently new. (Also sanity
73dnl checks the results of sdl-config to some extent
74dnl
75      rm -f conf.sdltest
76      AC_TRY_RUN([
77#include <stdio.h>
78#include <stdlib.h>
79#include <string.h>
80#include "SDL.h"
81
82char*
83my_strdup (char *str)
84{
85  char *new_str;
86
87  if (str)
88    {
89      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
90      strcpy (new_str, str);
91    }
92  else
93    new_str = NULL;
94
95  return new_str;
96}
97
98int main (int argc, char *argv[])
99{
100  int major, minor, micro;
101  char *tmp_version;
102
103  /* This hangs on some systems (?)
104  system ("touch conf.sdltest");
105  */
106  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
107
108  /* HP/UX 9 (%@#!) writes to sscanf strings */
109  tmp_version = my_strdup("$min_sdl_version");
110  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
111     printf("%s, bad version string\n", "$min_sdl_version");
112     exit(1);
113   }
114
115   if (($sdl_major_version > major) ||
116      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
117      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
118    {
119      return 0;
120    }
121  else
122    {
123      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
124      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
125      printf("*** best to upgrade to the required version.\n");
126      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
127      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
128      printf("*** config.cache before re-running configure\n");
129      return 1;
130    }
131}
132
133],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
134       CFLAGS="$ac_save_CFLAGS"
135       LIBS="$ac_save_LIBS"
136     fi
137  fi
138  if test "x$no_sdl" = x ; then
139     AC_MSG_RESULT(yes)
140     ifelse([$2], , :, [$2])
141  else
142     AC_MSG_RESULT(no)
143     if test "$SDL_CONFIG" = "no" ; then
144       echo "*** The sdl-config script installed by SDL could not be found"
145       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
146       echo "*** your path, or set the SDL_CONFIG environment variable to the"
147       echo "*** full path to sdl-config."
148     else
149       if test -f conf.sdltest ; then
150        :
151       else
152          echo "*** Could not run SDL test program, checking why..."
153          CFLAGS="$CFLAGS $SDL_CFLAGS"
154          LIBS="$LIBS $SDL_LIBS"
155          AC_TRY_LINK([
156#include <stdio.h>
157#include "SDL.h"
158
159int main(int argc, char *argv[])
160{ return 0; }
161#undef  main
162#define main K_and_R_C_main
163],      [ return 0; ],
164        [ echo "*** The test program compiled, but did not run. This usually means"
165          echo "*** that the run-time linker is not finding SDL or finding the wrong"
166          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
167          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
168          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
169          echo "*** is required on your system"
170	  echo "***"
171          echo "*** If you have an old version installed, it is best to remove it, although"
172          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
173        [ echo "*** The test program failed to compile or link. See the file config.log for the"
174          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
175          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
176          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
177          CFLAGS="$ac_save_CFLAGS"
178          LIBS="$ac_save_LIBS"
179       fi
180     fi
181     SDL_CFLAGS=""
182     SDL_LIBS=""
183     ifelse([$3], , :, [$3])
184  fi
185  AC_SUBST(SDL_CFLAGS)
186  AC_SUBST(SDL_LIBS)
187  rm -f conf.sdltest
188])
189
190# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
191#
192# This file is free software; the Free Software Foundation
193# gives unlimited permission to copy and/or distribute it,
194# with or without modifications, as long as this notice is preserved.
195
196# AM_AUTOMAKE_VERSION(VERSION)
197# ----------------------------
198# Automake X.Y traces this macro to ensure aclocal.m4 has been
199# generated from the m4 files accompanying Automake X.Y.
200AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
201
202# AM_SET_CURRENT_AUTOMAKE_VERSION
203# -------------------------------
204# Call AM_AUTOMAKE_VERSION so it can be traced.
205# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
206AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
207	 [AM_AUTOMAKE_VERSION([1.9.5])])
208
209# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
210
211# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
212#
213# This file is free software; the Free Software Foundation
214# gives unlimited permission to copy and/or distribute it,
215# with or without modifications, as long as this notice is preserved.
216
217# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
218# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
219# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
220#
221# Of course, Automake must honor this variable whenever it calls a
222# tool from the auxiliary directory.  The problem is that $srcdir (and
223# therefore $ac_aux_dir as well) can be either absolute or relative,
224# depending on how configure is run.  This is pretty annoying, since
225# it makes $ac_aux_dir quite unusable in subdirectories: in the top
226# source directory, any form will work fine, but in subdirectories a
227# relative path needs to be adjusted first.
228#
229# $ac_aux_dir/missing
230#    fails when called from a subdirectory if $ac_aux_dir is relative
231# $top_srcdir/$ac_aux_dir/missing
232#    fails if $ac_aux_dir is absolute,
233#    fails when called from a subdirectory in a VPATH build with
234#          a relative $ac_aux_dir
235#
236# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
237# are both prefixed by $srcdir.  In an in-source build this is usually
238# harmless because $srcdir is `.', but things will broke when you
239# start a VPATH build or use an absolute $srcdir.
240#
241# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
242# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
243#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
244# and then we would define $MISSING as
245#   MISSING="\${SHELL} $am_aux_dir/missing"
246# This will work as long as MISSING is not called from configure, because
247# unfortunately $(top_srcdir) has no meaning in configure.
248# However there are other variables, like CC, which are often used in
249# configure, and could therefore not use this "fixed" $ac_aux_dir.
250#
251# Another solution, used here, is to always expand $ac_aux_dir to an
252# absolute PATH.  The drawback is that using absolute paths prevent a
253# configured tree to be moved without reconfiguration.
254
255AC_DEFUN([AM_AUX_DIR_EXPAND],
256[dnl Rely on autoconf to set up CDPATH properly.
257AC_PREREQ([2.50])dnl
258# expand $ac_aux_dir to an absolute path
259am_aux_dir=`cd $ac_aux_dir && pwd`
260])
261
262# AM_CONDITIONAL                                            -*- Autoconf -*-
263
264# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
265# Free Software Foundation, Inc.
266#
267# This file is free software; the Free Software Foundation
268# gives unlimited permission to copy and/or distribute it,
269# with or without modifications, as long as this notice is preserved.
270
271# serial 7
272
273# AM_CONDITIONAL(NAME, SHELL-CONDITION)
274# -------------------------------------
275# Define a conditional.
276AC_DEFUN([AM_CONDITIONAL],
277[AC_PREREQ(2.52)dnl
278 ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
279	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
280AC_SUBST([$1_TRUE])
281AC_SUBST([$1_FALSE])
282if $2; then
283  $1_TRUE=
284  $1_FALSE='#'
285else
286  $1_TRUE='#'
287  $1_FALSE=
288fi
289AC_CONFIG_COMMANDS_PRE(
290[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
291  AC_MSG_ERROR([[conditional "$1" was never defined.
292Usually this means the macro was only invoked conditionally.]])
293fi])])
294
295
296# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
297# Free Software Foundation, Inc.
298#
299# This file is free software; the Free Software Foundation
300# gives unlimited permission to copy and/or distribute it,
301# with or without modifications, as long as this notice is preserved.
302
303# serial 8
304
305# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
306# written in clear, in which case automake, when reading aclocal.m4,
307# will think it sees a *use*, and therefore will trigger all it's
308# C support machinery.  Also note that it means that autoscan, seeing
309# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
310
311
312# _AM_DEPENDENCIES(NAME)
313# ----------------------
314# See how the compiler implements dependency checking.
315# NAME is "CC", "CXX", "GCJ", or "OBJC".
316# We try a few techniques and use that to set a single cache variable.
317#
318# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
319# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
320# dependency, and given that the user is not expected to run this macro,
321# just rely on AC_PROG_CC.
322AC_DEFUN([_AM_DEPENDENCIES],
323[AC_REQUIRE([AM_SET_DEPDIR])dnl
324AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
325AC_REQUIRE([AM_MAKE_INCLUDE])dnl
326AC_REQUIRE([AM_DEP_TRACK])dnl
327
328ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
329       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
330       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
331       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
332                   [depcc="$$1"   am_compiler_list=])
333
334AC_CACHE_CHECK([dependency style of $depcc],
335               [am_cv_$1_dependencies_compiler_type],
336[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
337  # We make a subdir and do the tests there.  Otherwise we can end up
338  # making bogus files that we don't know about and never remove.  For
339  # instance it was reported that on HP-UX the gcc test will end up
340  # making a dummy file named `D' -- because `-MD' means `put the output
341  # in D'.
342  mkdir conftest.dir
343  # Copy depcomp to subdir because otherwise we won't find it if we're
344  # using a relative directory.
345  cp "$am_depcomp" conftest.dir
346  cd conftest.dir
347  # We will build objects and dependencies in a subdirectory because
348  # it helps to detect inapplicable dependency modes.  For instance
349  # both Tru64's cc and ICC support -MD to output dependencies as a
350  # side effect of compilation, but ICC will put the dependencies in
351  # the current directory while Tru64 will put them in the object
352  # directory.
353  mkdir sub
354
355  am_cv_$1_dependencies_compiler_type=none
356  if test "$am_compiler_list" = ""; then
357     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
358  fi
359  for depmode in $am_compiler_list; do
360    # Setup a source with many dependencies, because some compilers
361    # like to wrap large dependency lists on column 80 (with \), and
362    # we should not choose a depcomp mode which is confused by this.
363    #
364    # We need to recreate these files for each test, as the compiler may
365    # overwrite some of them when testing with obscure command lines.
366    # This happens at least with the AIX C compiler.
367    : > sub/conftest.c
368    for i in 1 2 3 4 5 6; do
369      echo '#include "conftst'$i'.h"' >> sub/conftest.c
370      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
371      # Solaris 8's {/usr,}/bin/sh.
372      touch sub/conftst$i.h
373    done
374    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
375
376    case $depmode in
377    nosideeffect)
378      # after this tag, mechanisms are not by side-effect, so they'll
379      # only be used when explicitly requested
380      if test "x$enable_dependency_tracking" = xyes; then
381	continue
382      else
383	break
384      fi
385      ;;
386    none) break ;;
387    esac
388    # We check with `-c' and `-o' for the sake of the "dashmstdout"
389    # mode.  It turns out that the SunPro C++ compiler does not properly
390    # handle `-M -o', and we need to detect this.
391    if depmode=$depmode \
392       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
393       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
394       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
395         >/dev/null 2>conftest.err &&
396       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
397       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
398       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
399      # icc doesn't choke on unknown options, it will just issue warnings
400      # or remarks (even with -Werror).  So we grep stderr for any message
401      # that says an option was ignored or not supported.
402      # When given -MP, icc 7.0 and 7.1 complain thusly:
403      #   icc: Command line warning: ignoring option '-M'; no argument required
404      # The diagnosis changed in icc 8.0:
405      #   icc: Command line remark: option '-MP' not supported
406      if (grep 'ignoring option' conftest.err ||
407          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
408        am_cv_$1_dependencies_compiler_type=$depmode
409        break
410      fi
411    fi
412  done
413
414  cd ..
415  rm -rf conftest.dir
416else
417  am_cv_$1_dependencies_compiler_type=none
418fi
419])
420AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
421AM_CONDITIONAL([am__fastdep$1], [
422  test "x$enable_dependency_tracking" != xno \
423  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
424])
425
426
427# AM_SET_DEPDIR
428# -------------
429# Choose a directory name for dependency files.
430# This macro is AC_REQUIREd in _AM_DEPENDENCIES
431AC_DEFUN([AM_SET_DEPDIR],
432[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
433AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
434])
435
436
437# AM_DEP_TRACK
438# ------------
439AC_DEFUN([AM_DEP_TRACK],
440[AC_ARG_ENABLE(dependency-tracking,
441[  --disable-dependency-tracking  speeds up one-time build
442  --enable-dependency-tracking   do not reject slow dependency extractors])
443if test "x$enable_dependency_tracking" != xno; then
444  am_depcomp="$ac_aux_dir/depcomp"
445  AMDEPBACKSLASH='\'
446fi
447AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
448AC_SUBST([AMDEPBACKSLASH])
449])
450
451# Generate code to set up dependency tracking.              -*- Autoconf -*-
452
453# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
454# Free Software Foundation, Inc.
455#
456# This file is free software; the Free Software Foundation
457# gives unlimited permission to copy and/or distribute it,
458# with or without modifications, as long as this notice is preserved.
459
460#serial 3
461
462# _AM_OUTPUT_DEPENDENCY_COMMANDS
463# ------------------------------
464AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
465[for mf in $CONFIG_FILES; do
466  # Strip MF so we end up with the name of the file.
467  mf=`echo "$mf" | sed -e 's/:.*$//'`
468  # Check whether this is an Automake generated Makefile or not.
469  # We used to match only the files named `Makefile.in', but
470  # some people rename them; so instead we look at the file content.
471  # Grep'ing the first line is not enough: some people post-process
472  # each Makefile.in and add a new line on top of each file to say so.
473  # So let's grep whole file.
474  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
475    dirpart=`AS_DIRNAME("$mf")`
476  else
477    continue
478  fi
479  # Extract the definition of DEPDIR, am__include, and am__quote
480  # from the Makefile without running `make'.
481  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
482  test -z "$DEPDIR" && continue
483  am__include=`sed -n 's/^am__include = //p' < "$mf"`
484  test -z "am__include" && continue
485  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
486  # When using ansi2knr, U may be empty or an underscore; expand it
487  U=`sed -n 's/^U = //p' < "$mf"`
488  # Find all dependency output files, they are included files with
489  # $(DEPDIR) in their names.  We invoke sed twice because it is the
490  # simplest approach to changing $(DEPDIR) to its actual value in the
491  # expansion.
492  for file in `sed -n "
493    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
494       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
495    # Make sure the directory exists.
496    test -f "$dirpart/$file" && continue
497    fdir=`AS_DIRNAME(["$file"])`
498    AS_MKDIR_P([$dirpart/$fdir])
499    # echo "creating $dirpart/$file"
500    echo '# dummy' > "$dirpart/$file"
501  done
502done
503])# _AM_OUTPUT_DEPENDENCY_COMMANDS
504
505
506# AM_OUTPUT_DEPENDENCY_COMMANDS
507# -----------------------------
508# This macro should only be invoked once -- use via AC_REQUIRE.
509#
510# This code is only required when automatic dependency tracking
511# is enabled.  FIXME.  This creates each `.P' file that we will
512# need in order to bootstrap the dependency handling code.
513AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
514[AC_CONFIG_COMMANDS([depfiles],
515     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
516     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
517])
518
519# Do all the work for Automake.                             -*- Autoconf -*-
520
521# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
522# Free Software Foundation, Inc.
523#
524# This file is free software; the Free Software Foundation
525# gives unlimited permission to copy and/or distribute it,
526# with or without modifications, as long as this notice is preserved.
527
528# serial 12
529
530# This macro actually does too much.  Some checks are only needed if
531# your package does certain things.  But this isn't really a big deal.
532
533# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
534# AM_INIT_AUTOMAKE([OPTIONS])
535# -----------------------------------------------
536# The call with PACKAGE and VERSION arguments is the old style
537# call (pre autoconf-2.50), which is being phased out.  PACKAGE
538# and VERSION should now be passed to AC_INIT and removed from
539# the call to AM_INIT_AUTOMAKE.
540# We support both call styles for the transition.  After
541# the next Automake release, Autoconf can make the AC_INIT
542# arguments mandatory, and then we can depend on a new Autoconf
543# release and drop the old call support.
544AC_DEFUN([AM_INIT_AUTOMAKE],
545[AC_PREREQ([2.58])dnl
546dnl Autoconf wants to disallow AM_ names.  We explicitly allow
547dnl the ones we care about.
548m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
549AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
550AC_REQUIRE([AC_PROG_INSTALL])dnl
551# test to see if srcdir already configured
552if test "`cd $srcdir && pwd`" != "`pwd`" &&
553   test -f $srcdir/config.status; then
554  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
555fi
556
557# test whether we have cygpath
558if test -z "$CYGPATH_W"; then
559  if (cygpath --version) >/dev/null 2>/dev/null; then
560    CYGPATH_W='cygpath -w'
561  else
562    CYGPATH_W=echo
563  fi
564fi
565AC_SUBST([CYGPATH_W])
566
567# Define the identity of the package.
568dnl Distinguish between old-style and new-style calls.
569m4_ifval([$2],
570[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
571 AC_SUBST([PACKAGE], [$1])dnl
572 AC_SUBST([VERSION], [$2])],
573[_AM_SET_OPTIONS([$1])dnl
574 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
575 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
576
577_AM_IF_OPTION([no-define],,
578[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
579 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
580
581# Some tools Automake needs.
582AC_REQUIRE([AM_SANITY_CHECK])dnl
583AC_REQUIRE([AC_ARG_PROGRAM])dnl
584AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
585AM_MISSING_PROG(AUTOCONF, autoconf)
586AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
587AM_MISSING_PROG(AUTOHEADER, autoheader)
588AM_MISSING_PROG(MAKEINFO, makeinfo)
589AM_PROG_INSTALL_SH
590AM_PROG_INSTALL_STRIP
591AC_REQUIRE([AM_PROG_MKDIR_P])dnl
592# We need awk for the "check" target.  The system "awk" is bad on
593# some platforms.
594AC_REQUIRE([AC_PROG_AWK])dnl
595AC_REQUIRE([AC_PROG_MAKE_SET])dnl
596AC_REQUIRE([AM_SET_LEADING_DOT])dnl
597_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
598              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
599	      		     [_AM_PROG_TAR([v7])])])
600_AM_IF_OPTION([no-dependencies],,
601[AC_PROVIDE_IFELSE([AC_PROG_CC],
602                  [_AM_DEPENDENCIES(CC)],
603                  [define([AC_PROG_CC],
604                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
605AC_PROVIDE_IFELSE([AC_PROG_CXX],
606                  [_AM_DEPENDENCIES(CXX)],
607                  [define([AC_PROG_CXX],
608                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
609])
610])
611
612
613# When config.status generates a header, we must update the stamp-h file.
614# This file resides in the same directory as the config header
615# that is generated.  The stamp files are numbered to have different names.
616
617# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
618# loop where config.status creates the headers, so we can generate
619# our stamp files there.
620AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
621[# Compute $1's index in $config_headers.
622_am_stamp_count=1
623for _am_header in $config_headers :; do
624  case $_am_header in
625    $1 | $1:* )
626      break ;;
627    * )
628      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
629  esac
630done
631echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
632
633# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
634#
635# This file is free software; the Free Software Foundation
636# gives unlimited permission to copy and/or distribute it,
637# with or without modifications, as long as this notice is preserved.
638
639# AM_PROG_INSTALL_SH
640# ------------------
641# Define $install_sh.
642AC_DEFUN([AM_PROG_INSTALL_SH],
643[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
644install_sh=${install_sh-"$am_aux_dir/install-sh"}
645AC_SUBST(install_sh)])
646
647# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
648#
649# This file is free software; the Free Software Foundation
650# gives unlimited permission to copy and/or distribute it,
651# with or without modifications, as long as this notice is preserved.
652
653# serial 2
654
655# Check whether the underlying file-system supports filenames
656# with a leading dot.  For instance MS-DOS doesn't.
657AC_DEFUN([AM_SET_LEADING_DOT],
658[rm -rf .tst 2>/dev/null
659mkdir .tst 2>/dev/null
660if test -d .tst; then
661  am__leading_dot=.
662else
663  am__leading_dot=_
664fi
665rmdir .tst 2>/dev/null
666AC_SUBST([am__leading_dot])])
667
668# Check to see how 'make' treats includes.	            -*- Autoconf -*-
669
670# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
671#
672# This file is free software; the Free Software Foundation
673# gives unlimited permission to copy and/or distribute it,
674# with or without modifications, as long as this notice is preserved.
675
676# serial 3
677
678# AM_MAKE_INCLUDE()
679# -----------------
680# Check to see how make treats includes.
681AC_DEFUN([AM_MAKE_INCLUDE],
682[am_make=${MAKE-make}
683cat > confinc << 'END'
684am__doit:
685	@echo done
686.PHONY: am__doit
687END
688# If we don't find an include directive, just comment out the code.
689AC_MSG_CHECKING([for style of include used by $am_make])
690am__include="#"
691am__quote=
692_am_result=none
693# First try GNU make style include.
694echo "include confinc" > confmf
695# We grep out `Entering directory' and `Leaving directory'
696# messages which can occur if `w' ends up in MAKEFLAGS.
697# In particular we don't look at `^make:' because GNU make might
698# be invoked under some other name (usually "gmake"), in which
699# case it prints its new name instead of `make'.
700if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
701   am__include=include
702   am__quote=
703   _am_result=GNU
704fi
705# Now try BSD make style include.
706if test "$am__include" = "#"; then
707   echo '.include "confinc"' > confmf
708   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
709      am__include=.include
710      am__quote="\""
711      _am_result=BSD
712   fi
713fi
714AC_SUBST([am__include])
715AC_SUBST([am__quote])
716AC_MSG_RESULT([$_am_result])
717rm -f confinc confmf
718])
719
720# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
721
722# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
723# Free Software Foundation, Inc.
724#
725# This file is free software; the Free Software Foundation
726# gives unlimited permission to copy and/or distribute it,
727# with or without modifications, as long as this notice is preserved.
728
729# serial 4
730
731# AM_MISSING_PROG(NAME, PROGRAM)
732# ------------------------------
733AC_DEFUN([AM_MISSING_PROG],
734[AC_REQUIRE([AM_MISSING_HAS_RUN])
735$1=${$1-"${am_missing_run}$2"}
736AC_SUBST($1)])
737
738
739# AM_MISSING_HAS_RUN
740# ------------------
741# Define MISSING if not defined so far and test if it supports --run.
742# If it does, set am_missing_run to use it, otherwise, to nothing.
743AC_DEFUN([AM_MISSING_HAS_RUN],
744[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
745test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
746# Use eval to expand $SHELL
747if eval "$MISSING --run true"; then
748  am_missing_run="$MISSING --run "
749else
750  am_missing_run=
751  AC_MSG_WARN([`missing' script is too old or missing])
752fi
753])
754
755# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
756#
757# This file is free software; the Free Software Foundation
758# gives unlimited permission to copy and/or distribute it,
759# with or without modifications, as long as this notice is preserved.
760
761# AM_PROG_MKDIR_P
762# ---------------
763# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
764#
765# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
766# created by `make install' are always world readable, even if the
767# installer happens to have an overly restrictive umask (e.g. 077).
768# This was a mistake.  There are at least two reasons why we must not
769# use `-m 0755':
770#   - it causes special bits like SGID to be ignored,
771#   - it may be too restrictive (some setups expect 775 directories).
772#
773# Do not use -m 0755 and let people choose whatever they expect by
774# setting umask.
775#
776# We cannot accept any implementation of `mkdir' that recognizes `-p'.
777# Some implementations (such as Solaris 8's) are not thread-safe: if a
778# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
779# concurrently, both version can detect that a/ is missing, but only
780# one can create it and the other will error out.  Consequently we
781# restrict ourselves to GNU make (using the --version option ensures
782# this.)
783AC_DEFUN([AM_PROG_MKDIR_P],
784[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
785  # We used to keeping the `.' as first argument, in order to
786  # allow $(mkdir_p) to be used without argument.  As in
787  #   $(mkdir_p) $(somedir)
788  # where $(somedir) is conditionally defined.  However this is wrong
789  # for two reasons:
790  #  1. if the package is installed by a user who cannot write `.'
791  #     make install will fail,
792  #  2. the above comment should most certainly read
793  #     $(mkdir_p) $(DESTDIR)$(somedir)
794  #     so it does not work when $(somedir) is undefined and
795  #     $(DESTDIR) is not.
796  #  To support the latter case, we have to write
797  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
798  #  so the `.' trick is pointless.
799  mkdir_p='mkdir -p --'
800else
801  # On NextStep and OpenStep, the `mkdir' command does not
802  # recognize any option.  It will interpret all options as
803  # directories to create, and then abort because `.' already
804  # exists.
805  for d in ./-p ./--version;
806  do
807    test -d $d && rmdir $d
808  done
809  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
810  if test -f "$ac_aux_dir/mkinstalldirs"; then
811    mkdir_p='$(mkinstalldirs)'
812  else
813    mkdir_p='$(install_sh) -d'
814  fi
815fi
816AC_SUBST([mkdir_p])])
817
818# Helper functions for option handling.                     -*- Autoconf -*-
819
820# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
821#
822# This file is free software; the Free Software Foundation
823# gives unlimited permission to copy and/or distribute it,
824# with or without modifications, as long as this notice is preserved.
825
826# serial 3
827
828# _AM_MANGLE_OPTION(NAME)
829# -----------------------
830AC_DEFUN([_AM_MANGLE_OPTION],
831[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
832
833# _AM_SET_OPTION(NAME)
834# ------------------------------
835# Set option NAME.  Presently that only means defining a flag for this option.
836AC_DEFUN([_AM_SET_OPTION],
837[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
838
839# _AM_SET_OPTIONS(OPTIONS)
840# ----------------------------------
841# OPTIONS is a space-separated list of Automake options.
842AC_DEFUN([_AM_SET_OPTIONS],
843[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
844
845# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
846# -------------------------------------------
847# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
848AC_DEFUN([_AM_IF_OPTION],
849[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
850
851# Check to make sure that the build environment is sane.    -*- Autoconf -*-
852
853# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
854# Free Software Foundation, Inc.
855#
856# This file is free software; the Free Software Foundation
857# gives unlimited permission to copy and/or distribute it,
858# with or without modifications, as long as this notice is preserved.
859
860# serial 4
861
862# AM_SANITY_CHECK
863# ---------------
864AC_DEFUN([AM_SANITY_CHECK],
865[AC_MSG_CHECKING([whether build environment is sane])
866# Just in case
867sleep 1
868echo timestamp > conftest.file
869# Do `set' in a subshell so we don't clobber the current shell's
870# arguments.  Must try -L first in case configure is actually a
871# symlink; some systems play weird games with the mod time of symlinks
872# (eg FreeBSD returns the mod time of the symlink's containing
873# directory).
874if (
875   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
876   if test "$[*]" = "X"; then
877      # -L didn't work.
878      set X `ls -t $srcdir/configure conftest.file`
879   fi
880   rm -f conftest.file
881   if test "$[*]" != "X $srcdir/configure conftest.file" \
882      && test "$[*]" != "X conftest.file $srcdir/configure"; then
883
884      # If neither matched, then we have a broken ls.  This can happen
885      # if, for instance, CONFIG_SHELL is bash and it inherits a
886      # broken ls alias from the environment.  This has actually
887      # happened.  Such a system could not be considered "sane".
888      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
889alias in your environment])
890   fi
891
892   test "$[2]" = conftest.file
893   )
894then
895   # Ok.
896   :
897else
898   AC_MSG_ERROR([newly created file is older than distributed files!
899Check your system clock])
900fi
901AC_MSG_RESULT(yes)])
902
903# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
904#
905# This file is free software; the Free Software Foundation
906# gives unlimited permission to copy and/or distribute it,
907# with or without modifications, as long as this notice is preserved.
908
909# AM_PROG_INSTALL_STRIP
910# ---------------------
911# One issue with vendor `install' (even GNU) is that you can't
912# specify the program used to strip binaries.  This is especially
913# annoying in cross-compiling environments, where the build's strip
914# is unlikely to handle the host's binaries.
915# Fortunately install-sh will honor a STRIPPROG variable, so we
916# always use install-sh in `make install-strip', and initialize
917# STRIPPROG with the value of the STRIP variable (set by the user).
918AC_DEFUN([AM_PROG_INSTALL_STRIP],
919[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
920# Installed binaries are usually stripped using `strip' when the user
921# run `make install-strip'.  However `strip' might not be the right
922# tool to use in cross-compilation environments, therefore Automake
923# will honor the `STRIP' environment variable to overrule this program.
924dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
925if test "$cross_compiling" != no; then
926  AC_CHECK_TOOL([STRIP], [strip], :)
927fi
928INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
929AC_SUBST([INSTALL_STRIP_PROGRAM])])
930
931# Check how to create a tarball.                            -*- Autoconf -*-
932
933# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
934#
935# This file is free software; the Free Software Foundation
936# gives unlimited permission to copy and/or distribute it,
937# with or without modifications, as long as this notice is preserved.
938
939# serial 2
940
941# _AM_PROG_TAR(FORMAT)
942# --------------------
943# Check how to create a tarball in format FORMAT.
944# FORMAT should be one of `v7', `ustar', or `pax'.
945#
946# Substitute a variable $(am__tar) that is a command
947# writing to stdout a FORMAT-tarball containing the directory
948# $tardir.
949#     tardir=directory && $(am__tar) > result.tar
950#
951# Substitute a variable $(am__untar) that extract such
952# a tarball read from stdin.
953#     $(am__untar) < result.tar
954AC_DEFUN([_AM_PROG_TAR],
955[# Always define AMTAR for backward compatibility.
956AM_MISSING_PROG([AMTAR], [tar])
957m4_if([$1], [v7],
958     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
959     [m4_case([$1], [ustar],, [pax],,
960              [m4_fatal([Unknown tar format])])
961AC_MSG_CHECKING([how to create a $1 tar archive])
962# Loop over all known methods to create a tar archive until one works.
963_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
964_am_tools=${am_cv_prog_tar_$1-$_am_tools}
965# Do not fold the above two line into one, because Tru64 sh and
966# Solaris sh will not grok spaces in the rhs of `-'.
967for _am_tool in $_am_tools
968do
969  case $_am_tool in
970  gnutar)
971    for _am_tar in tar gnutar gtar;
972    do
973      AM_RUN_LOG([$_am_tar --version]) && break
974    done
975    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
976    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
977    am__untar="$_am_tar -xf -"
978    ;;
979  plaintar)
980    # Must skip GNU tar: if it does not support --format= it doesn't create
981    # ustar tarball either.
982    (tar --version) >/dev/null 2>&1 && continue
983    am__tar='tar chf - "$$tardir"'
984    am__tar_='tar chf - "$tardir"'
985    am__untar='tar xf -'
986    ;;
987  pax)
988    am__tar='pax -L -x $1 -w "$$tardir"'
989    am__tar_='pax -L -x $1 -w "$tardir"'
990    am__untar='pax -r'
991    ;;
992  cpio)
993    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
994    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
995    am__untar='cpio -i -H $1 -d'
996    ;;
997  none)
998    am__tar=false
999    am__tar_=false
1000    am__untar=false
1001    ;;
1002  esac
1003
1004  # If the value was cached, stop now.  We just wanted to have am__tar
1005  # and am__untar set.
1006  test -n "${am_cv_prog_tar_$1}" && break
1007
1008  # tar/untar a dummy directory, and stop if the command works
1009  rm -rf conftest.dir
1010  mkdir conftest.dir
1011  echo GrepMe > conftest.dir/file
1012  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1013  rm -rf conftest.dir
1014  if test -s conftest.tar; then
1015    AM_RUN_LOG([$am__untar <conftest.tar])
1016    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1017  fi
1018done
1019rm -rf conftest.dir
1020
1021AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1022AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1023AC_SUBST([am__tar])
1024AC_SUBST([am__untar])
1025]) # _AM_PROG_TAR
1026
1027