1dnl aclocal.m4 generated automatically by aclocal 1.4-p5
2
3dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13# Configure paths for SDL
14# Sam Lantinga 9/21/99
15# stolen from Manish Singh
16# stolen back from Frank Belew
17# stolen from Manish Singh
18# Shamelessly stolen from Owen Taylor
19
20dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
21dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
22dnl
23AC_DEFUN(AM_PATH_SDL,
24[dnl
25dnl Get the cflags and libraries from the sdl-config script
26dnl
27AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
28            sdl_prefix="$withval", sdl_prefix="")
29AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
30            sdl_exec_prefix="$withval", sdl_exec_prefix="")
31AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
32		    , enable_sdltest=yes)
33
34  if test x$sdl_exec_prefix != x ; then
35     sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
36     if test x${SDL_CONFIG+set} != xset ; then
37        SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
38     fi
39  fi
40  if test x$sdl_prefix != x ; then
41     sdl_args="$sdl_args --prefix=$sdl_prefix"
42     if test x${SDL_CONFIG+set} != xset ; then
43        SDL_CONFIG=$sdl_prefix/bin/sdl-config
44     fi
45  fi
46
47  AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
48  min_sdl_version=ifelse([$1], ,0.11.0,$1)
49  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
50  no_sdl=""
51  if test "$SDL_CONFIG" = "no" ; then
52    no_sdl=yes
53  else
54    SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
55    SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
56
57    sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
58           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
59    sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
60           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
61    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
62           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
63    if test "x$enable_sdltest" = "xyes" ; then
64      ac_save_CFLAGS="$CFLAGS"
65      ac_save_LIBS="$LIBS"
66      CFLAGS="$CFLAGS $SDL_CFLAGS"
67      LIBS="$LIBS $SDL_LIBS"
68dnl
69dnl Now check if the installed SDL is sufficiently new. (Also sanity
70dnl checks the results of sdl-config to some extent
71dnl
72      rm -f conf.sdltest
73      AC_TRY_RUN([
74#include <stdio.h>
75#include <stdlib.h>
76#include <string.h>
77#include <SDL/SDL.h>
78
79char*
80my_strdup (char *str)
81{
82  char *new_str;
83
84  if (str)
85    {
86      new_str = malloc ((strlen (str) + 1) * sizeof(char));
87      strcpy (new_str, str);
88    }
89  else
90    new_str = NULL;
91
92  return new_str;
93}
94
95int main ()
96{
97  int major, minor, micro;
98  char *tmp_version;
99
100  system ("touch conf.sdltest");
101
102  /* HP/UX 9 (%@#!) writes to sscanf strings */
103  tmp_version = my_strdup("$min_sdl_version");
104  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
105     printf("%s, bad version string\n", "$min_sdl_version");
106     exit(1);
107   }
108
109   if (($sdl_major_version > major) ||
110      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
111      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
112    {
113      return 0;
114    }
115  else
116    {
117      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
118      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
119      printf("*** best to upgrade to the required version.\n");
120      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
121      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
122      printf("*** config.cache before re-running configure\n");
123      return 1;
124    }
125}
126
127],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
128       CFLAGS="$ac_save_CFLAGS"
129       LIBS="$ac_save_LIBS"
130     fi
131  fi
132  if test "x$no_sdl" = x ; then
133     AC_MSG_RESULT(yes)
134     ifelse([$2], , :, [$2])
135  else
136     AC_MSG_RESULT(no)
137     if test "$SDL_CONFIG" = "no" ; then
138       echo "*** The sdl-config script installed by SDL could not be found"
139       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
140       echo "*** your path, or set the SDL_CONFIG environment variable to the"
141       echo "*** full path to sdl-config."
142     else
143       if test -f conf.sdltest ; then
144        :
145       else
146          echo "*** Could not run SDL test program, checking why..."
147          CFLAGS="$CFLAGS $SDL_CFLAGS"
148          LIBS="$LIBS $SDL_LIBS"
149          AC_TRY_LINK([
150#include <stdio.h>
151#include <SDL/SDL.h>
152],      [ return 0; ],
153        [ echo "*** The test program compiled, but did not run. This usually means"
154          echo "*** that the run-time linker is not finding SDL or finding the wrong"
155          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
156          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
157          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
158          echo "*** is required on your system"
159	  echo "***"
160          echo "*** If you have an old version installed, it is best to remove it, although"
161          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
162        [ echo "*** The test program failed to compile or link. See the file config.log for the"
163          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
164          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
165          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
166          CFLAGS="$ac_save_CFLAGS"
167          LIBS="$ac_save_LIBS"
168       fi
169     fi
170     SDL_CFLAGS=""
171     SDL_LIBS=""
172     ifelse([$3], , :, [$3])
173  fi
174  AC_SUBST(SDL_CFLAGS)
175  AC_SUBST(SDL_LIBS)
176  rm -f conf.sdltest
177])
178
179# serial 41 AC_PROG_LIBTOOL
180AC_DEFUN(AC_PROG_LIBTOOL,
181[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
182
183# Save cache, so that ltconfig can load it
184AC_CACHE_SAVE
185
186# Actually configure libtool.  ac_aux_dir is where install-sh is found.
187CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
188LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
189LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
190DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
191${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
192$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
193|| AC_MSG_ERROR([libtool configure failed])
194
195# Reload cache, that may have been modified by ltconfig
196AC_CACHE_LOAD
197
198# This can be used to rebuild libtool when needed
199LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
200
201# Always use our own libtool.
202LIBTOOL='$(SHELL) $(top_builddir)/libtool'
203AC_SUBST(LIBTOOL)dnl
204
205# Redirect the config.log output again, so that the ltconfig log is not
206# clobbered by the next message.
207exec 5>>./config.log
208])
209
210AC_DEFUN(AC_LIBTOOL_SETUP,
211[AC_PREREQ(2.13)dnl
212AC_REQUIRE([AC_ENABLE_SHARED])dnl
213AC_REQUIRE([AC_ENABLE_STATIC])dnl
214AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
215AC_REQUIRE([AC_CANONICAL_HOST])dnl
216AC_REQUIRE([AC_CANONICAL_BUILD])dnl
217AC_REQUIRE([AC_PROG_CC])dnl
218AC_REQUIRE([AC_PROG_LD])dnl
219AC_REQUIRE([AC_PROG_NM])dnl
220AC_REQUIRE([AC_PROG_LN_S])dnl
221dnl
222
223AC_CHECK_TOOL(RANLIB, ranlib, :)
224
225# Check for any special flags to pass to ltconfig.
226libtool_flags="--cache-file=$cache_file"
227test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
228test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
229test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
230test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
231test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
232ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
233[libtool_flags="$libtool_flags --enable-dlopen"])
234ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
235[libtool_flags="$libtool_flags --enable-win32-dll"])
236AC_ARG_ENABLE(libtool-lock,
237  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
238test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
239test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
240
241AC_ARG_WITH(pic,
242  [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
243     pic_mode="$withval", pic_mode=default)
244test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
245test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
246
247# Some flags need to be propagated to the compiler or linker for good
248# libtool support.
249case "$host" in
250*-*-irix6*)
251  # Find out which ABI we are using.
252  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
253  if AC_TRY_EVAL(ac_compile); then
254    case "`/usr/bin/file conftest.o`" in
255    *32-bit*)
256      LD="${LD-ld} -32"
257      ;;
258    *N32*)
259      LD="${LD-ld} -n32"
260      ;;
261    *64-bit*)
262      LD="${LD-ld} -64"
263      ;;
264    esac
265  fi
266  rm -rf conftest*
267  ;;
268
269*-*-sco3.2v5*)
270  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
271  SAVE_CFLAGS="$CFLAGS"
272  CFLAGS="$CFLAGS -belf"
273  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
274    [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
275  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
276    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
277    CFLAGS="$SAVE_CFLAGS"
278  fi
279  ;;
280
281ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
282[*-*-cygwin* | *-*-mingw*)
283  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
284  AC_CHECK_TOOL(AS, as, false)
285  AC_CHECK_TOOL(OBJDUMP, objdump, false)
286
287  # recent cygwin and mingw systems supply a stub DllMain which the user
288  # can override, but on older systems we have to supply one
289  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
290    [AC_TRY_LINK([DllMain (0, 0, 0);],
291      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);],
292      [lt_cv_need_dllmain=yes],[lt_cv_need_dllmain=no])])
293
294  case $host in
295  *-*-cygwin*)
296    # cygwin systems need to pass --dll to the linker, and not link
297    # crt.o which will require a WinMain@16 definition.
298    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
299  *-*-mingw*)
300    # old mingw systems require "-dll" to link a DLL, while more recent ones
301    # require "-mdll"
302    SAVE_CFLAGS="$CFLAGS"
303    CFLAGS="$CFLAGS -mdll"
304    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
305      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
306    CFLAGS="$SAVE_CFLAGS" ;;
307  esac
308  ;;
309  ])
310esac
311])
312
313# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
314AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
315
316# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
317AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
318
319# AC_ENABLE_SHARED - implement the --enable-shared flag
320# Usage: AC_ENABLE_SHARED[(DEFAULT)]
321#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
322#   `yes'.
323AC_DEFUN(AC_ENABLE_SHARED, [dnl
324define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
325AC_ARG_ENABLE(shared,
326changequote(<<, >>)dnl
327<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
328changequote([, ])dnl
329[p=${PACKAGE-default}
330case "$enableval" in
331yes) enable_shared=yes ;;
332no) enable_shared=no ;;
333*)
334  enable_shared=no
335  # Look at the argument we got.  We use all the common list separators.
336  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
337  for pkg in $enableval; do
338    if test "X$pkg" = "X$p"; then
339      enable_shared=yes
340    fi
341  done
342  IFS="$ac_save_ifs"
343  ;;
344esac],
345enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
346])
347
348# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
349AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
350AC_ENABLE_SHARED(no)])
351
352# AC_ENABLE_STATIC - implement the --enable-static flag
353# Usage: AC_ENABLE_STATIC[(DEFAULT)]
354#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
355#   `yes'.
356AC_DEFUN(AC_ENABLE_STATIC, [dnl
357define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
358AC_ARG_ENABLE(static,
359changequote(<<, >>)dnl
360<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
361changequote([, ])dnl
362[p=${PACKAGE-default}
363case "$enableval" in
364yes) enable_static=yes ;;
365no) enable_static=no ;;
366*)
367  enable_static=no
368  # Look at the argument we got.  We use all the common list separators.
369  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
370  for pkg in $enableval; do
371    if test "X$pkg" = "X$p"; then
372      enable_static=yes
373    fi
374  done
375  IFS="$ac_save_ifs"
376  ;;
377esac],
378enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
379])
380
381# AC_DISABLE_STATIC - set the default static flag to --disable-static
382AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
383AC_ENABLE_STATIC(no)])
384
385
386# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
387# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
388#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
389#   `yes'.
390AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
391define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
392AC_ARG_ENABLE(fast-install,
393changequote(<<, >>)dnl
394<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
395changequote([, ])dnl
396[p=${PACKAGE-default}
397case "$enableval" in
398yes) enable_fast_install=yes ;;
399no) enable_fast_install=no ;;
400*)
401  enable_fast_install=no
402  # Look at the argument we got.  We use all the common list separators.
403  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
404  for pkg in $enableval; do
405    if test "X$pkg" = "X$p"; then
406      enable_fast_install=yes
407    fi
408  done
409  IFS="$ac_save_ifs"
410  ;;
411esac],
412enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
413])
414
415# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
416AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
417AC_ENABLE_FAST_INSTALL(no)])
418
419# AC_PROG_LD - find the path to the GNU or non-GNU linker
420AC_DEFUN(AC_PROG_LD,
421[AC_ARG_WITH(gnu-ld,
422[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
423test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
424AC_REQUIRE([AC_PROG_CC])dnl
425AC_REQUIRE([AC_CANONICAL_HOST])dnl
426AC_REQUIRE([AC_CANONICAL_BUILD])dnl
427ac_prog=ld
428if test "$ac_cv_prog_gcc" = yes; then
429  # Check if gcc -print-prog-name=ld gives a path.
430  AC_MSG_CHECKING([for ld used by GCC])
431  case $host in
432  *-*-mingw*)
433    # gcc leaves a trailing carriage return which upsets mingw
434    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
435  *)
436    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
437  esac
438  case "$ac_prog" in
439    # Accept absolute paths.
440changequote(,)dnl
441    [\\/]* | [A-Za-z]:[\\/]*)
442      re_direlt='/[^/][^/]*/\.\./'
443changequote([,])dnl
444      # Canonicalize the path of ld
445      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
446      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
447	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
448      done
449      test -z "$LD" && LD="$ac_prog"
450      ;;
451  "")
452    # If it fails, then pretend we aren't using GCC.
453    ac_prog=ld
454    ;;
455  *)
456    # If it is relative, then search for the first ld in PATH.
457    with_gnu_ld=unknown
458    ;;
459  esac
460elif test "$with_gnu_ld" = yes; then
461  AC_MSG_CHECKING([for GNU ld])
462else
463  AC_MSG_CHECKING([for non-GNU ld])
464fi
465AC_CACHE_VAL(ac_cv_path_LD,
466[if test -z "$LD"; then
467  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
468  for ac_dir in $PATH; do
469    test -z "$ac_dir" && ac_dir=.
470    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
471      ac_cv_path_LD="$ac_dir/$ac_prog"
472      # Check to see if the program is GNU ld.  I'd rather use --version,
473      # but apparently some GNU ld's only accept -v.
474      # Break only if it was the GNU/non-GNU ld that we prefer.
475      if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
476	test "$with_gnu_ld" != no && break
477      else
478	test "$with_gnu_ld" != yes && break
479      fi
480    fi
481  done
482  IFS="$ac_save_ifs"
483else
484  ac_cv_path_LD="$LD" # Let the user override the test with a path.
485fi])
486LD="$ac_cv_path_LD"
487if test -n "$LD"; then
488  AC_MSG_RESULT($LD)
489else
490  AC_MSG_RESULT(no)
491fi
492test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
493AC_SUBST(LD)
494AC_PROG_LD_GNU
495])
496
497AC_DEFUN(AC_PROG_LD_GNU,
498[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
499[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
500if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
501  ac_cv_prog_gnu_ld=yes
502else
503  ac_cv_prog_gnu_ld=no
504fi])
505])
506
507# AC_PROG_NM - find the path to a BSD-compatible name lister
508AC_DEFUN(AC_PROG_NM,
509[AC_MSG_CHECKING([for BSD-compatible nm])
510AC_CACHE_VAL(ac_cv_path_NM,
511[if test -n "$NM"; then
512  # Let the user override the test.
513  ac_cv_path_NM="$NM"
514else
515  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
516  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
517    test -z "$ac_dir" && ac_dir=.
518    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
519      # Check to see if the nm accepts a BSD-compat flag.
520      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
521      #   nm: unknown option "B" ignored
522      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
523	ac_cv_path_NM="$ac_dir/nm -B"
524	break
525      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
526	ac_cv_path_NM="$ac_dir/nm -p"
527	break
528      else
529	ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
530	continue # so that we can try to find one that supports BSD flags
531      fi
532    fi
533  done
534  IFS="$ac_save_ifs"
535  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
536fi])
537NM="$ac_cv_path_NM"
538AC_MSG_RESULT([$NM])
539AC_SUBST(NM)
540])
541
542# AC_CHECK_LIBM - check for math library
543AC_DEFUN(AC_CHECK_LIBM,
544[AC_REQUIRE([AC_CANONICAL_HOST])dnl
545LIBM=
546case "$host" in
547*-*-beos* | *-*-cygwin*)
548  # These system don't have libm
549  ;;
550*-ncr-sysv4.3*)
551  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
552  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
553  ;;
554*)
555  AC_CHECK_LIB(m, main, LIBM="-lm")
556  ;;
557esac
558])
559
560# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
561# the libltdl convenience library, adds --enable-ltdl-convenience to
562# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
563# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
564# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
565# '${top_builddir}/' (note the single quotes!) if your package is not
566# flat, and, if you're not using automake, define top_builddir as
567# appropriate in the Makefiles.
568AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
569  case "$enable_ltdl_convenience" in
570  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
571  "") enable_ltdl_convenience=yes
572      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
573  esac
574  LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
575  INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
576])
577
578# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
579# the libltdl installable library, and adds --enable-ltdl-install to
580# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
581# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
582# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
583# '${top_builddir}/' (note the single quotes!) if your package is not
584# flat, and, if you're not using automake, define top_builddir as
585# appropriate in the Makefiles.
586# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
587AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
588  AC_CHECK_LIB(ltdl, main,
589  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
590  [if test x"$enable_ltdl_install" = xno; then
591     AC_MSG_WARN([libltdl not installed, but installation disabled])
592   else
593     enable_ltdl_install=yes
594   fi
595  ])
596  if test x"$enable_ltdl_install" = x"yes"; then
597    ac_configure_args="$ac_configure_args --enable-ltdl-install"
598    LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
599    INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
600  else
601    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
602    LIBLTDL="-lltdl"
603    INCLTDL=
604  fi
605])
606
607dnl old names
608AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
609AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
610AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
611AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
612AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
613AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
614AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
615
616dnl This is just to silence aclocal about the macro not being used
617ifelse([AC_DISABLE_FAST_INSTALL])dnl
618
619
620dnl Thanks to Ingo Ruhnke <grumbel@gmx.de>
621AC_DEFUN(MY_EXPAND_DIR, [
622	$1=$2
623	$1=`(
624		test "x$prefix" = xNONE && prefix=${ac_default_prefix}
625		test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
626		eval echo \""[$]$1"\"
627	     )`
628	])
629
630
631dnl AM_PROG_LEX
632dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
633AC_DEFUN([AM_PROG_LEX],
634[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
635AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
636AC_PROG_LEX
637AC_DECL_YYTEXT])
638
639# Do all the work for Automake.  This macro actually does too much --
640# some checks are only needed if your package does certain things.
641# But this isn't really a big deal.
642
643# serial 1
644
645dnl Usage:
646dnl AM_INIT_AUTOMAKE(package,version, [no-define])
647
648AC_DEFUN([AM_INIT_AUTOMAKE],
649[AC_REQUIRE([AC_PROG_INSTALL])
650PACKAGE=[$1]
651AC_SUBST(PACKAGE)
652VERSION=[$2]
653AC_SUBST(VERSION)
654dnl test to see if srcdir already configured
655if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
656  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
657fi
658ifelse([$3],,
659AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
660AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
661AC_REQUIRE([AM_SANITY_CHECK])
662AC_REQUIRE([AC_ARG_PROGRAM])
663dnl FIXME This is truly gross.
664missing_dir=`cd $ac_aux_dir && pwd`
665AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
666AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
667AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
668AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
669AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
670AC_REQUIRE([AC_PROG_MAKE_SET])])
671
672#
673# Check to make sure that the build environment is sane.
674#
675
676AC_DEFUN([AM_SANITY_CHECK],
677[AC_MSG_CHECKING([whether build environment is sane])
678# Just in case
679sleep 1
680echo timestamp > conftestfile
681# Do `set' in a subshell so we don't clobber the current shell's
682# arguments.  Must try -L first in case configure is actually a
683# symlink; some systems play weird games with the mod time of symlinks
684# (eg FreeBSD returns the mod time of the symlink's containing
685# directory).
686if (
687   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
688   if test "[$]*" = "X"; then
689      # -L didn't work.
690      set X `ls -t $srcdir/configure conftestfile`
691   fi
692   if test "[$]*" != "X $srcdir/configure conftestfile" \
693      && test "[$]*" != "X conftestfile $srcdir/configure"; then
694
695      # If neither matched, then we have a broken ls.  This can happen
696      # if, for instance, CONFIG_SHELL is bash and it inherits a
697      # broken ls alias from the environment.  This has actually
698      # happened.  Such a system could not be considered "sane".
699      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
700alias in your environment])
701   fi
702
703   test "[$]2" = conftestfile
704   )
705then
706   # Ok.
707   :
708else
709   AC_MSG_ERROR([newly created file is older than distributed files!
710Check your system clock])
711fi
712rm -f conftest*
713AC_MSG_RESULT(yes)])
714
715dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
716dnl The program must properly implement --version.
717AC_DEFUN([AM_MISSING_PROG],
718[AC_MSG_CHECKING(for working $2)
719# Run test in a subshell; some versions of sh will print an error if
720# an executable is not found, even if stderr is redirected.
721# Redirect stdin to placate older versions of autoconf.  Sigh.
722if ($2 --version) < /dev/null > /dev/null 2>&1; then
723   $1=$2
724   AC_MSG_RESULT(found)
725else
726   $1="$3/missing $2"
727   AC_MSG_RESULT(missing)
728fi
729AC_SUBST($1)])
730
731# Like AC_CONFIG_HEADER, but automatically create stamp file.
732
733AC_DEFUN([AM_CONFIG_HEADER],
734[AC_PREREQ([2.12])
735AC_CONFIG_HEADER([$1])
736dnl When config.status generates a header, we must update the stamp-h file.
737dnl This file resides in the same directory as the config header
738dnl that is generated.  We must strip everything past the first ":",
739dnl and everything past the last "/".
740AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
741ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
742<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
743<<am_indx=1
744for am_file in <<$1>>; do
745  case " <<$>>CONFIG_HEADERS " in
746  *" <<$>>am_file "*<<)>>
747    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
748    ;;
749  esac
750  am_indx=`expr "<<$>>am_indx" + 1`
751done<<>>dnl>>)
752changequote([,]))])
753
754