1##
2## $Id: aclocal.m4,v 1.1 2003/06/04 00:25:05 marka Exp $
3##
4AC_DEFUN(AC_FIND_SYSTEM_SHOBJ,[
5AC_MSG_CHECKING(for $1 shared object)
6shobj_name=$1
7shobj_path=
8case "$host" in
9*-hpux*)
10    SOEXT=sl
11    ;;
12*)
13    SOEXT=so
14    ;;
15esac
16for shobj_libdir in /lib /usr/lib; do
17    if test -f $shobj_libdir/$shobj_name.$SOEXT; then
18        shobj_path=$shobj_libdir/$shobj_name.$SOEXT
19    else
20        shobj_path=`ls -r $shobj_libdir/$shobj_name.$SOEXT* 2>/dev/null | head -1`
21	if test "$shobj_path" != "" -a -f "$shobj_path"; then
22	    :
23	else
24	    shobj_path=
25	fi
26    fi
27    if test "$shobj_path" != ""; then
28	AC_MSG_RESULT($shobj_path)
29        shobj_pathsymbol=SOPATH_`echo $shobj_name | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
30	AC_DEFINE_UNQUOTED($shobj_pathsymbol, "$shobj_path")
31	break
32    fi
33done
34if test "$shobj_path" = ""; then
35    AC_MSG_RESULT(no)
36fi
37])dnl
38
39## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
40## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
41## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
42##
43## This program is free software; you can redistribute it and/or modify
44## it under the terms of the GNU General Public License as published by
45## the Free Software Foundation; either version 2 of the License, or
46## (at your option) any later version.
47##
48## This program is distributed in the hope that it will be useful, but
49## WITHOUT ANY WARRANTY; without even the implied warranty of
50## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
51## General Public License for more details.
52##
53## You should have received a copy of the GNU General Public License
54## along with this program; if not, write to the Free Software
55## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
56##
57## As a special exception to the GNU General Public License, if you
58## distribute this file as part of a program that contains a
59## configuration script generated by Autoconf, you may include it under
60## the same distribution terms that you use for the rest of that program.
61
62# serial 40 AC_PROG_LIBTOOL
63AC_DEFUN(AC_PROG_LIBTOOL,
64[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
65
66# Save cache, so that ltconfig can load it
67AC_CACHE_SAVE
68
69# Actually configure libtool.  ac_aux_dir is where install-sh is found.
70CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
71LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
72LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
73DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
74${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
75$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
76|| AC_MSG_ERROR([libtool configure failed])
77
78# Reload cache, that may have been modified by ltconfig
79AC_CACHE_LOAD
80
81# This can be used to rebuild libtool when needed
82LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
83
84# Always use our own libtool.
85LIBTOOL='$(SHELL) $(top_builddir)/libtool'
86AC_SUBST(LIBTOOL)dnl
87
88# Redirect the config.log output again, so that the ltconfig log is not
89# clobbered by the next message.
90exec 5>>./config.log
91])
92
93AC_DEFUN(AC_LIBTOOL_SETUP,
94[AC_PREREQ(2.13)dnl
95AC_REQUIRE([AC_ENABLE_SHARED])dnl
96AC_REQUIRE([AC_ENABLE_STATIC])dnl
97AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
98AC_REQUIRE([AC_CANONICAL_HOST])dnl
99AC_REQUIRE([AC_CANONICAL_BUILD])dnl
100AC_REQUIRE([AC_PROG_RANLIB])dnl
101AC_REQUIRE([AC_PROG_CC])dnl
102AC_REQUIRE([AC_PROG_LD])dnl
103AC_REQUIRE([AC_PROG_NM])dnl
104AC_REQUIRE([AC_PROG_LN_S])dnl
105dnl
106
107case "$target" in
108NONE) lt_target="$host" ;;
109*) lt_target="$target" ;;
110esac
111
112# Check for any special flags to pass to ltconfig.
113libtool_flags="--cache-file=$cache_file"
114test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
115test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
116test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
117test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
118test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
119ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
120[libtool_flags="$libtool_flags --enable-dlopen"])
121ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
122[libtool_flags="$libtool_flags --enable-win32-dll"])
123AC_ARG_ENABLE(libtool-lock,
124  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
125test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
126test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
127
128# Some flags need to be propagated to the compiler or linker for good
129# libtool support.
130case "$lt_target" in
131*-*-irix6*)
132  # Find out which ABI we are using.
133  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
134  if AC_TRY_EVAL(ac_compile); then
135    case "`/usr/bin/file conftest.o`" in
136    *32-bit*)
137      LD="${LD-ld} -32"
138      ;;
139    *N32*)
140      LD="${LD-ld} -n32"
141      ;;
142    *64-bit*)
143      LD="${LD-ld} -64"
144      ;;
145    esac
146  fi
147  rm -rf conftest*
148  ;;
149
150*-*-sco3.2v5*)
151  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
152  SAVE_CFLAGS="$CFLAGS"
153  CFLAGS="$CFLAGS -belf"
154  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
155    [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
156  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
157    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
158    CFLAGS="$SAVE_CFLAGS"
159  fi
160  ;;
161
162ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
163[*-*-cygwin* | *-*-mingw*)
164  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
165  AC_CHECK_TOOL(AS, as, false)
166  AC_CHECK_TOOL(OBJDUMP, objdump, false)
167  ;;
168])
169esac
170])
171
172# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
173AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
174
175# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
176AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
177
178# AC_ENABLE_SHARED - implement the --enable-shared flag
179# Usage: AC_ENABLE_SHARED[(DEFAULT)]
180#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
181#   `yes'.
182AC_DEFUN(AC_ENABLE_SHARED, [dnl
183define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
184AC_ARG_ENABLE(shared,
185changequote(<<, >>)dnl
186<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
187changequote([, ])dnl
188[p=${PACKAGE-default}
189case "$enableval" in
190yes) enable_shared=yes ;;
191no) enable_shared=no ;;
192*)
193  enable_shared=no
194  # Look at the argument we got.  We use all the common list separators.
195  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
196  for pkg in $enableval; do
197    if test "X$pkg" = "X$p"; then
198      enable_shared=yes
199    fi
200  done
201  IFS="$ac_save_ifs"
202  ;;
203esac],
204enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
205])
206
207# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
208AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
209AC_ENABLE_SHARED(no)])
210
211# AC_ENABLE_STATIC - implement the --enable-static flag
212# Usage: AC_ENABLE_STATIC[(DEFAULT)]
213#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
214#   `yes'.
215AC_DEFUN(AC_ENABLE_STATIC, [dnl
216define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
217AC_ARG_ENABLE(static,
218changequote(<<, >>)dnl
219<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
220changequote([, ])dnl
221[p=${PACKAGE-default}
222case "$enableval" in
223yes) enable_static=yes ;;
224no) enable_static=no ;;
225*)
226  enable_static=no
227  # Look at the argument we got.  We use all the common list separators.
228  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
229  for pkg in $enableval; do
230    if test "X$pkg" = "X$p"; then
231      enable_static=yes
232    fi
233  done
234  IFS="$ac_save_ifs"
235  ;;
236esac],
237enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
238])
239
240# AC_DISABLE_STATIC - set the default static flag to --disable-static
241AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
242AC_ENABLE_STATIC(no)])
243
244
245# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
246# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
247#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
248#   `yes'.
249AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
250define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
251AC_ARG_ENABLE(fast-install,
252changequote(<<, >>)dnl
253<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
254changequote([, ])dnl
255[p=${PACKAGE-default}
256case "$enableval" in
257yes) enable_fast_install=yes ;;
258no) enable_fast_install=no ;;
259*)
260  enable_fast_install=no
261  # Look at the argument we got.  We use all the common list separators.
262  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
263  for pkg in $enableval; do
264    if test "X$pkg" = "X$p"; then
265      enable_fast_install=yes
266    fi
267  done
268  IFS="$ac_save_ifs"
269  ;;
270esac],
271enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
272])
273
274# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
275AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
276AC_ENABLE_FAST_INSTALL(no)])
277
278# AC_PROG_LD - find the path to the GNU or non-GNU linker
279AC_DEFUN(AC_PROG_LD,
280[AC_ARG_WITH(gnu-ld,
281[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
282test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
283AC_REQUIRE([AC_PROG_CC])dnl
284AC_REQUIRE([AC_CANONICAL_HOST])dnl
285AC_REQUIRE([AC_CANONICAL_BUILD])dnl
286ac_prog=ld
287if test "$ac_cv_prog_gcc" = yes; then
288  # Check if gcc -print-prog-name=ld gives a path.
289  AC_MSG_CHECKING([for ld used by GCC])
290  ac_prog=`($CC -print-prog-name=ld) 2>&5`
291  case "$ac_prog" in
292    # Accept absolute paths.
293changequote(,)dnl
294    [\\/]* | [A-Za-z]:[\\/]*)
295      re_direlt='/[^/][^/]*/\.\./'
296changequote([,])dnl
297      # Canonicalize the path of ld
298      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
299      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
300	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
301      done
302      test -z "$LD" && LD="$ac_prog"
303      ;;
304  "")
305    # If it fails, then pretend we aren't using GCC.
306    ac_prog=ld
307    ;;
308  *)
309    # If it is relative, then search for the first ld in PATH.
310    with_gnu_ld=unknown
311    ;;
312  esac
313elif test "$with_gnu_ld" = yes; then
314  AC_MSG_CHECKING([for GNU ld])
315else
316  AC_MSG_CHECKING([for non-GNU ld])
317fi
318AC_CACHE_VAL(ac_cv_path_LD,
319[if test -z "$LD"; then
320  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
321  for ac_dir in $PATH; do
322    test -z "$ac_dir" && ac_dir=.
323    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
324      ac_cv_path_LD="$ac_dir/$ac_prog"
325      # Check to see if the program is GNU ld.  I'd rather use --version,
326      # but apparently some GNU ld's only accept -v.
327      # Break only if it was the GNU/non-GNU ld that we prefer.
328      if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
329	test "$with_gnu_ld" != no && break
330      else
331	test "$with_gnu_ld" != yes && break
332      fi
333    fi
334  done
335  IFS="$ac_save_ifs"
336else
337  ac_cv_path_LD="$LD" # Let the user override the test with a path.
338fi])
339LD="$ac_cv_path_LD"
340if test -n "$LD"; then
341  AC_MSG_RESULT($LD)
342else
343  AC_MSG_RESULT(no)
344fi
345test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
346AC_PROG_LD_GNU
347])
348
349AC_DEFUN(AC_PROG_LD_GNU,
350[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
351[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
352if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
353  ac_cv_prog_gnu_ld=yes
354else
355  ac_cv_prog_gnu_ld=no
356fi])
357])
358
359# AC_PROG_NM - find the path to a BSD-compatible name lister
360AC_DEFUN(AC_PROG_NM,
361[AC_MSG_CHECKING([for BSD-compatible nm])
362AC_CACHE_VAL(ac_cv_path_NM,
363[if test -n "$NM"; then
364  # Let the user override the test.
365  ac_cv_path_NM="$NM"
366else
367  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
368  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
369    test -z "$ac_dir" && ac_dir=.
370    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
371      # Check to see if the nm accepts a BSD-compat flag.
372      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
373      #   nm: unknown option "B" ignored
374      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
375	ac_cv_path_NM="$ac_dir/nm -B"
376	break
377      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
378	ac_cv_path_NM="$ac_dir/nm -p"
379	break
380      else
381	ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
382	continue # so that we can try to find one that supports BSD flags
383      fi
384    fi
385  done
386  IFS="$ac_save_ifs"
387  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
388fi])
389NM="$ac_cv_path_NM"
390AC_MSG_RESULT([$NM])
391])
392
393# AC_CHECK_LIBM - check for math library
394AC_DEFUN(AC_CHECK_LIBM,
395[AC_REQUIRE([AC_CANONICAL_HOST])dnl
396LIBM=
397case "$lt_target" in
398*-*-beos* | *-*-cygwin*)
399  # These system don't have libm
400  ;;
401*-ncr-sysv4.3*)
402  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
403  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
404  ;;
405*)
406  AC_CHECK_LIB(m, main, LIBM="-lm")
407  ;;
408esac
409])
410
411# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
412# the libltdl convenience library and INCLTDL to the include flags for
413# the libltdl header and adds --enable-ltdl-convenience to the
414# configure arguments.  Note that LIBLTDL and INCLTDL are not
415# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
416# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
417# with '${top_builddir}/' and INCLTDL will be prefixed with
418# '${top_srcdir}/' (note the single quotes!).  If your package is not
419# flat and you're not using automake, define top_builddir and
420# top_srcdir appropriately in the Makefiles.
421AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
422  case "$enable_ltdl_convenience" in
423  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
424  "") enable_ltdl_convenience=yes
425      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
426  esac
427  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
428  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
429])
430
431# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
432# the libltdl installable library and INCLTDL to the include flags for
433# the libltdl header and adds --enable-ltdl-install to the configure
434# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
435# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
436# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
437# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
438# with '${top_srcdir}/' (note the single quotes!).  If your package is
439# not flat and you're not using automake, define top_builddir and
440# top_srcdir appropriately in the Makefiles.
441# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
442AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
443  AC_CHECK_LIB(ltdl, main,
444  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
445  [if test x"$enable_ltdl_install" = xno; then
446     AC_MSG_WARN([libltdl not installed, but installation disabled])
447   else
448     enable_ltdl_install=yes
449   fi
450  ])
451  if test x"$enable_ltdl_install" = x"yes"; then
452    ac_configure_args="$ac_configure_args --enable-ltdl-install"
453    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
454    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
455  else
456    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
457    LIBLTDL="-lltdl"
458    INCLTDL=
459  fi
460])
461
462dnl old names
463AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
464AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
465AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
466AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
467AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
468AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
469AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
470
471dnl This is just to silence aclocal about the macro not being used
472ifelse([AC_DISABLE_FAST_INSTALL])dnl
473