OSDN Git Service

Add - before rms to be more portable.
[pf3gnuchains/gcc-fork.git] / libjava / libltdl / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13
14 # serial 45 AC_PROG_LIBTOOL
15 AC_DEFUN(AC_PROG_LIBTOOL,[AC_REQUIRE([_AC_PROG_LIBTOOL])
16 dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
17 dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
18   AC_PROVIDE_IFELSE([AC_PROG_CXX],
19     [AC_LIBTOOL_CXX],
20     [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
21 ])])
22
23 dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
24 dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
25 dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
26   AC_PROVIDE_IFELSE([AC_PROG_GCJ],
27     [AC_LIBTOOL_GCJ],
28     [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
29         [AC_LIBTOOL_GCJ],
30         [ifdef([AC_PROG_GCJ],
31                [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
32 ])])
33          ifdef([A][M_PROG_GCJ],
34                [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
35 ])])])])])
36
37 AC_DEFUN(_AC_PROG_LIBTOOL,
38 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
39 AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
40 AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
41
42 # Save cache, so that ltconfig can load it
43 AC_CACHE_SAVE
44
45 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
46 AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
47 MAGIC="$MAGIC" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
48 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
49 AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
50 objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
51 deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
52 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
53 $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
54 || AC_MSG_ERROR([libtool configure failed])
55
56 # Reload cache, that may have been modified by ltconfig
57 AC_CACHE_LOAD
58
59 # This can be used to rebuild libtool when needed
60 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
61
62 # Always use our own libtool.
63 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
64 AC_SUBST(LIBTOOL)dnl
65
66 # Redirect the config.log output again, so that the ltconfig log is not
67 # clobbered by the next message.
68 exec 5>>./config.log
69 ])
70
71 AC_DEFUN(AC_LIBTOOL_SETUP,
72 [AC_PREREQ(2.13)dnl
73 AC_REQUIRE([AC_ENABLE_SHARED])dnl
74 AC_REQUIRE([AC_ENABLE_STATIC])dnl
75 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
76 AC_REQUIRE([AC_CANONICAL_HOST])dnl
77 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
78 AC_REQUIRE([AC_PROG_CC])dnl
79 AC_REQUIRE([AC_PROG_LD])dnl
80 AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
81 AC_REQUIRE([AC_PROG_NM])dnl
82 AC_REQUIRE([AC_PROG_LN_S])dnl
83 AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
84 # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
85 AC_REQUIRE([AC_OBJEXT])dnl
86 AC_REQUIRE([AC_EXEEXT])dnl
87 dnl
88
89 # Only perform the check for file, if the check method requires it
90 case "$deplibs_check_method" in
91 file_magic*)
92   if test "$file_magic_cmd" = '${MAGIC}'; then
93     AC_PATH_MAGIC
94   fi
95   ;;
96 esac
97
98 AC_CHECK_TOOL(RANLIB, ranlib, :)
99 AC_CHECK_TOOL(STRIP, strip, :)
100
101 # Check for any special flags to pass to ltconfig.
102 libtool_flags="--cache-file=$cache_file"
103 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
104 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
105 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
106 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
107 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
108 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
109 [libtool_flags="$libtool_flags --enable-dlopen"])
110 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
111 [libtool_flags="$libtool_flags --enable-win32-dll"])
112 AC_ARG_ENABLE(libtool-lock,
113   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
114 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
115 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
116
117 AC_ARG_WITH(pic,
118   [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
119      pic_mode="$withval", pic_mode=default)
120 test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
121 test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
122
123 # Some flags need to be propagated to the compiler or linker for good
124 # libtool support.
125 case "$host" in
126 *-*-irix6*)
127   # Find out which ABI we are using.
128   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
129   if AC_TRY_EVAL(ac_compile); then
130     case "`/usr/bin/file conftest.o`" in
131     *32-bit*)
132       LD="${LD-ld} -32"
133       ;;
134     *N32*)
135       LD="${LD-ld} -n32"
136       ;;
137     *64-bit*)
138       LD="${LD-ld} -64"
139       ;;
140     esac
141   fi
142   rm -rf conftest*
143   ;;
144
145 *-*-sco3.2v5*)
146   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
147   SAVE_CFLAGS="$CFLAGS"
148   CFLAGS="$CFLAGS -belf"
149   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
150     [AC_LANG_SAVE
151      AC_LANG_C
152      AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
153      AC_LANG_RESTORE])
154   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
155     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
156     CFLAGS="$SAVE_CFLAGS"
157   fi
158   ;;
159
160 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
161 [*-*-cygwin* | *-*-mingw*)
162   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
163   AC_CHECK_TOOL(AS, as, false)
164   AC_CHECK_TOOL(OBJDUMP, objdump, false)
165
166   # recent cygwin and mingw systems supply a stub DllMain which the user
167   # can override, but on older systems we have to supply one
168   AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
169     [AC_TRY_LINK([],
170       [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
171       DllMain (0, 0, 0);],
172       [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
173
174   case "$host/$CC" in
175   *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
176     # old mingw systems require "-dll" to link a DLL, while more recent ones
177     # require "-mdll"
178     SAVE_CFLAGS="$CFLAGS"
179     CFLAGS="$CFLAGS -mdll"
180     AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
181       [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
182     CFLAGS="$SAVE_CFLAGS" ;;
183   *-*-cygwin*)
184     # cygwin systems need to pass --dll to the linker, and not link
185     # crt.o which will require a WinMain@16 definition.
186     lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
187   esac
188   ;;
189   ])
190 esac
191 ])
192
193 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
194 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
195
196 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
197 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
198
199 # AC_ENABLE_SHARED - implement the --enable-shared flag
200 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
201 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
202 #   `yes'.
203 AC_DEFUN(AC_ENABLE_SHARED, [dnl
204 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
205 AC_ARG_ENABLE(shared,
206 changequote(<<, >>)dnl
207 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
208 changequote([, ])dnl
209 [p=${PACKAGE-default}
210 case "$enableval" in
211 yes) enable_shared=yes ;;
212 no) enable_shared=no ;;
213 *)
214   enable_shared=no
215   # Look at the argument we got.  We use all the common list separators.
216   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
217   for pkg in $enableval; do
218     if test "X$pkg" = "X$p"; then
219       enable_shared=yes
220     fi
221   done
222   IFS="$ac_save_ifs"
223   ;;
224 esac],
225 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
226 ])
227
228 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
229 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
230 AC_ENABLE_SHARED(no)])
231
232 # AC_ENABLE_STATIC - implement the --enable-static flag
233 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
234 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
235 #   `yes'.
236 AC_DEFUN(AC_ENABLE_STATIC, [dnl
237 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
238 AC_ARG_ENABLE(static,
239 changequote(<<, >>)dnl
240 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
241 changequote([, ])dnl
242 [p=${PACKAGE-default}
243 case "$enableval" in
244 yes) enable_static=yes ;;
245 no) enable_static=no ;;
246 *)
247   enable_static=no
248   # Look at the argument we got.  We use all the common list separators.
249   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
250   for pkg in $enableval; do
251     if test "X$pkg" = "X$p"; then
252       enable_static=yes
253     fi
254   done
255   IFS="$ac_save_ifs"
256   ;;
257 esac],
258 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
259 ])
260
261 # AC_DISABLE_STATIC - set the default static flag to --disable-static
262 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
263 AC_ENABLE_STATIC(no)])
264
265
266 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
267 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
268 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
269 #   `yes'.
270 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
271 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
272 AC_ARG_ENABLE(fast-install,
273 changequote(<<, >>)dnl
274 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
275 changequote([, ])dnl
276 [p=${PACKAGE-default}
277 case "$enableval" in
278 yes) enable_fast_install=yes ;;
279 no) enable_fast_install=no ;;
280 *)
281   enable_fast_install=no
282   # Look at the argument we got.  We use all the common list separators.
283   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
284   for pkg in $enableval; do
285     if test "X$pkg" = "X$p"; then
286       enable_fast_install=yes
287     fi
288   done
289   IFS="$ac_save_ifs"
290   ;;
291 esac],
292 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
293 ])
294
295 # AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
296 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
297 AC_ENABLE_FAST_INSTALL(no)])
298
299 # AC_LIBTOOL_PICMODE - implement the --with-pic flag
300 # Usage: AC_LIBTOOL_PICMODE[(MODE)]
301 #   Where MODE is either `yes' or `no'.  If omitted, it defaults to
302 #   `both'.
303 AC_DEFUN(AC_LIBTOOL_PICMODE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
304 pic_mode=ifelse($#,1,$1,default)])
305
306
307 # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
308 AC_DEFUN(AC_PATH_TOOL_PREFIX,
309 [AC_MSG_CHECKING([for $1])
310 AC_CACHE_VAL(lt_cv_path_MAGIC,
311 [case "$MAGIC" in
312   /*)
313   lt_cv_path_MAGIC="$MAGIC" # Let the user override the test with a path.
314   ;;
315   ?:/*)
316   ac_cv_path_MAGIC="$MAGIC" # Let the user override the test with a dos path.
317   ;;
318   *)
319   ac_save_MAGIC="$MAGIC"
320   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
321 dnl $ac_dummy forces splitting on constant user-supplied paths.
322 dnl POSIX.2 word splitting is done only on the output of word expansions,
323 dnl not every word.  This closes a longstanding sh security hole.
324   ac_dummy="ifelse([$2], , $PATH, [$2])"
325   for ac_dir in $ac_dummy; do
326     test -z "$ac_dir" && ac_dir=.
327     if test -f $ac_dir/$1; then
328       lt_cv_path_MAGIC="$ac_dir/$1"
329       if test -n "$file_magic_test_file"; then
330         case "$deplibs_check_method" in
331         "file_magic "*)
332           file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
333           MAGIC="$lt_cv_path_MAGIC"
334           if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
335             egrep "$file_magic_regex" > /dev/null; then
336             :
337           else
338             cat <<EOF 1>&2
339
340 *** Warning: the command libtool uses to detect shared libraries,
341 *** $file_magic_cmd, produces output that libtool cannot recognize.
342 *** The result is that libtool may fail to recognize shared libraries
343 *** as such.  This will affect the creation of libtool libraries that
344 *** depend on shared libraries, but programs linked with such libtool
345 *** libraries will work regardless of this problem.  Nevertheless, you
346 *** may want to report the problem to your system manager and/or to
347 *** bug-libtool@gnu.org
348
349 EOF
350           fi ;;
351         esac
352       fi
353       break
354     fi
355   done
356   IFS="$ac_save_ifs"
357   MAGIC="$ac_save_MAGIC"
358   ;;
359 esac])
360 MAGIC="$lt_cv_path_MAGIC"
361 if test -n "$MAGIC"; then
362   AC_MSG_RESULT($MAGIC)
363 else
364   AC_MSG_RESULT(no)
365 fi
366 ])
367
368
369 # AC_PATH_MAGIC - find a file program which can recognise a shared library
370 AC_DEFUN(AC_PATH_MAGIC,
371 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
372 AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
373 if test -z "$lt_cv_path_MAGIC"; then
374   if test -n "$ac_tool_prefix"; then
375     AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
376   else
377     MAGIC=:
378   fi
379 fi
380 ])
381
382
383 # AC_PROG_LD - find the path to the GNU or non-GNU linker
384 AC_DEFUN(AC_PROG_LD,
385 [AC_ARG_WITH(gnu-ld,
386 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
387 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
388 AC_REQUIRE([AC_PROG_CC])dnl
389 AC_REQUIRE([AC_CANONICAL_HOST])dnl
390 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
391 ac_prog=ld
392 if test "$ac_cv_prog_gcc" = yes; then
393   # Check if gcc -print-prog-name=ld gives a path.
394   AC_MSG_CHECKING([for ld used by GCC])
395   case $host in
396   *-*-mingw*)
397     # gcc leaves a trailing carriage return which upsets mingw
398     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
399   *)
400     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
401   esac
402   case "$ac_prog" in
403     # Accept absolute paths.
404 changequote(,)dnl
405     [\\/]* | [A-Za-z]:[\\/]*)
406       re_direlt='/[^/][^/]*/\.\./'
407 changequote([,])dnl
408       # Canonicalize the path of ld
409       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
410       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
411         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
412       done
413       test -z "$LD" && LD="$ac_prog"
414       ;;
415   "")
416     # If it fails, then pretend we aren't using GCC.
417     ac_prog=ld
418     ;;
419   *)
420     # If it is relative, then search for the first ld in PATH.
421     with_gnu_ld=unknown
422     ;;
423   esac
424 elif test "$with_gnu_ld" = yes; then
425   AC_MSG_CHECKING([for GNU ld])
426 else
427   AC_MSG_CHECKING([for non-GNU ld])
428 fi
429 AC_CACHE_VAL(ac_cv_path_LD,
430 [if test -z "$LD"; then
431   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
432   for ac_dir in $PATH; do
433     test -z "$ac_dir" && ac_dir=.
434     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
435       ac_cv_path_LD="$ac_dir/$ac_prog"
436       # Check to see if the program is GNU ld.  I'd rather use --version,
437       # but apparently some GNU ld's only accept -v.
438       # Break only if it was the GNU/non-GNU ld that we prefer.
439       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
440         test "$with_gnu_ld" != no && break
441       else
442         test "$with_gnu_ld" != yes && break
443       fi
444     fi
445   done
446   IFS="$ac_save_ifs"
447 else
448   ac_cv_path_LD="$LD" # Let the user override the test with a path.
449 fi])
450 LD="$ac_cv_path_LD"
451 if test -n "$LD"; then
452   AC_MSG_RESULT($LD)
453 else
454   AC_MSG_RESULT(no)
455 fi
456 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
457 AC_PROG_LD_GNU
458 ])
459
460 AC_DEFUN(AC_PROG_LD_GNU,
461 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
462 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
463 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
464   ac_cv_prog_gnu_ld=yes
465 else
466   ac_cv_prog_gnu_ld=no
467 fi])
468 with_gnu_ld=$ac_cv_prog_gnu_ld
469 ])
470
471 # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
472 #   -- PORTME Some linkers may need a different reload flag.
473 AC_DEFUN(AC_PROG_LD_RELOAD_FLAG,
474 [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
475 [lt_cv_ld_reload_flag='-r'])
476 reload_flag=$lt_cv_ld_reload_flag
477 test -n "$reload_flag" && reload_flag=" $reload_flag"
478 ])
479
480 # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
481 #  -- PORTME fill in with the dynamic library characteristics
482 AC_DEFUN(AC_DEPLIBS_CHECK_METHOD,
483 [AC_CACHE_CHECK([how to recognise dependant libraries],
484 lt_cv_deplibs_check_method,
485 [lt_cv_file_magic_cmd='${MAGIC}'
486 lt_cv_file_magic_test_file=
487 lt_cv_deplibs_check_method='unknown'
488 # Need to set the preceding variable on all platforms that support
489 # interlibrary dependencies.
490 # 'none' -- dependencies not supported.
491 # `unknown' -- same as none, but documents that we really don't know.
492 # 'pass_all' -- all dependencies passed with no checks.
493 # 'test_compile' -- check by making test program.
494 # 'file_magic [regex]' -- check by looking for files in library path
495 # which responds to the $file_magic_cmd with a given egrep regex.
496 # If you have `file' or equivalent on your system and you're not sure
497 # whether `pass_all' will *always* work, you probably want this one.
498
499 case "$host_os" in
500 aix4*)
501   lt_cv_deplibs_check_method=pass_all
502   ;;
503
504 beos*)
505   lt_cv_deplibs_check_method=pass_all
506   ;;
507
508 bsdi4*)
509   changequote(,)dnl
510   lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
511   changequote([, ])dnl
512   lt_cv_file_magic_cmd='/usr/bin/file -L'
513   lt_cv_file_magic_test_file=/shlib/libc.so
514   ;;
515
516 cygwin* | mingw*)
517   lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
518   lt_cv_file_magic_cmd='${OBJDUMP} -f'
519   ;;
520
521 freebsd* )
522   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
523     case "$host_cpu" in
524     i*86 )
525       # Not sure whether the presence of OpenBSD here was a mistake.
526       # Let's accept both of them until this is cleared up.
527       changequote(,)dnl
528       lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
529       changequote([, ])dnl
530       lt_cv_file_magic_cmd=/usr/bin/file
531       lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
532       ;;
533     esac
534   else
535     lt_cv_deplibs_check_method=pass_all
536   fi
537   ;;
538
539 gnu*)
540   lt_cv_deplibs_check_method=pass_all
541   ;;
542
543 hpux10.20*)
544   # TODO:  Does this work for hpux-11 too?
545   lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
546   lt_cv_file_magic_cmd=/usr/bin/file
547   lt_cv_file_magic_test_file=/usr/lib/libc.sl
548   ;;
549
550 irix5* | irix6*)
551   case "$host_os" in
552   irix5*)
553     # this will be overridden with pass_all, but let us keep it just in case
554     lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
555     ;;
556   *)
557     case "$LD" in
558     *-32|*"-32 ") libmagic=32-bit;;
559     *-n32|*"-n32 ") libmagic=N32;;
560     *-64|*"-64 ") libmagic=64-bit;;
561     *) libmagic=never-match;;
562     esac
563     # this will be overridden with pass_all, but let us keep it just in case
564     changequote(,)dnl
565     lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
566     changequote([, ])dnl
567     ;;
568   esac
569   lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
570   lt_cv_deplibs_check_method=pass_all
571   ;;
572
573 # This must be Linux ELF.
574 linux-gnu*)
575   case "$host_cpu" in
576   alpha* | i*86 | powerpc* | sparc* | ia64* )
577     lt_cv_deplibs_check_method=pass_all ;;
578   *)
579     # glibc up to 2.1.1 does not perform some relocations on ARM
580     changequote(,)dnl
581     lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
582     changequote([, ])dnl
583   esac
584   lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
585   ;;
586
587 netbsd*)
588   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then :
589   else
590     changequote(,)dnl
591     lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
592     changequote([, ])dnl
593     lt_cv_file_magic_cmd='/usr/bin/file -L'
594     lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
595   fi
596   ;;
597
598 osf3* | osf4* | osf5*)
599   # this will be overridden with pass_all, but let us keep it just in case
600   lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
601   lt_cv_file_magic_test_file=/shlib/libc.so
602   lt_cv_deplibs_check_method=pass_all
603   ;;
604
605 sco3.2v5*)
606   lt_cv_deplibs_check_method=pass_all
607   ;;
608
609 solaris*)
610   lt_cv_deplibs_check_method=pass_all
611   lt_cv_file_magic_test_file=/lib/libc.so
612   ;;
613
614 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
615   case "$host_vendor" in
616   ncr)
617     lt_cv_deplibs_check_method=pass_all
618     ;;
619   motorola)
620     changequote(,)dnl
621     lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
622     changequote([, ])dnl
623     lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
624     ;;
625   esac
626   ;;
627 esac
628 ])
629 file_magic_cmd=$lt_cv_file_magic_cmd
630 deplibs_check_method=$lt_cv_deplibs_check_method
631 ])
632
633
634 # AC_PROG_NM - find the path to a BSD-compatible name lister
635 AC_DEFUN(AC_PROG_NM,
636 [AC_MSG_CHECKING([for BSD-compatible nm])
637 AC_CACHE_VAL(ac_cv_path_NM,
638 [if test -n "$NM"; then
639   # Let the user override the test.
640   ac_cv_path_NM="$NM"
641 else
642   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
643   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
644     test -z "$ac_dir" && ac_dir=.
645     tmp_nm=$ac_dir/${ac_tool_prefix}nm
646     if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
647       # Check to see if the nm accepts a BSD-compat flag.
648       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
649       #   nm: unknown option "B" ignored
650       # Tru64's nm complains that /dev/null is an invalid object file
651       if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
652         ac_cv_path_NM="$tmp_nm -B"
653         break
654       elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
655         ac_cv_path_NM="$tmp_nm -p"
656         break
657       else
658         ac_cv_path_NM=${ac_cv_path_NM="$tmp_nm"} # keep the first match, but
659         continue # so that we can try to find one that supports BSD flags
660       fi
661     fi
662   done
663   IFS="$ac_save_ifs"
664   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
665 fi])
666 NM="$ac_cv_path_NM"
667 AC_MSG_RESULT([$NM])
668 ])
669
670 # AC_CHECK_LIBM - check for math library
671 AC_DEFUN(AC_CHECK_LIBM,
672 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
673 LIBM=
674 case "$host" in
675 *-*-beos* | *-*-cygwin*)
676   # These system don't have libm
677   ;;
678 *-ncr-sysv4.3*)
679   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
680   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
681   ;;
682 *)
683   AC_CHECK_LIB(m, main, LIBM="-lm")
684   ;;
685 esac
686 ])
687
688 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
689 # the libltdl convenience library and INCLTDL to the include flags for
690 # the libltdl header and adds --enable-ltdl-convenience to the
691 # configure arguments.  Note that LIBLTDL and INCLTDL are not
692 # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
693 # provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
694 # with '${top_builddir}/' and INCLTDL will be prefixed with
695 # '${top_srcdir}/' (note the single quotes!).  If your package is not
696 # flat and you're not using automake, define top_builddir and
697 # top_srcdir appropriately in the Makefiles.
698 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
699   case "$enable_ltdl_convenience" in
700   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
701   "") enable_ltdl_convenience=yes
702       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
703   esac
704   LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
705   INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
706 ])
707
708 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
709 # the libltdl installable library and INCLTDL to the include flags for
710 # the libltdl header and adds --enable-ltdl-install to the configure
711 # arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
712 # AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
713 # libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
714 # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
715 # with '${top_srcdir}/' (note the single quotes!).  If your package is
716 # not flat and you're not using automake, define top_builddir and
717 # top_srcdir appropriately in the Makefiles.
718 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
719 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
720   AC_CHECK_LIB(ltdl, main,
721   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
722   [if test x"$enable_ltdl_install" = xno; then
723      AC_MSG_WARN([libltdl not installed, but installation disabled])
724    else
725      enable_ltdl_install=yes
726    fi
727   ])
728   if test x"$enable_ltdl_install" = x"yes"; then
729     ac_configure_args="$ac_configure_args --enable-ltdl-install"
730     LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
731     INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
732   else
733     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
734     LIBLTDL="-lltdl"
735     INCLTDL=
736   fi
737 ])
738
739 # If this macro is not defined by Autoconf, define it here.
740 ifdef([AC_PROVIDE_IFELSE],
741       [],
742       [define([AC_PROVIDE_IFELSE],
743               [ifdef([AC_PROVIDE_$1],
744                      [$2], [$3])])])
745
746 # AC_LIBTOOL_CXX - enable support for C++ libraries
747 AC_DEFUN(AC_LIBTOOL_CXX,[AC_REQUIRE([_AC_LIBTOOL_CXX])])
748 AC_DEFUN(_AC_LIBTOOL_CXX,
749 [AC_REQUIRE([AC_PROG_LIBTOOL])
750 AC_REQUIRE([AC_PROG_CXX])
751 AC_REQUIRE([AC_PROG_CXXCPP])
752 LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
753 lt_save_CC="$CC"
754 lt_save_CFLAGS="$CFLAGS"
755 dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
756 dnl is set to the C++ compiler.
757 AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
758 MAGIC="$MAGIC" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
759 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
760 AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
761 objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
762 deplibs_check_method="$deplibs_check_method" \
763 file_magic_cmd="$file_magic_cmd" \
764 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
765 --build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
766 || AC_MSG_ERROR([libtool tag configuration failed])
767 CC="$lt_save_CC"
768 CFLAGS="$lt_save_CFLAGS"
769
770 # Redirect the config.log output again, so that the ltconfig log is not
771 # clobbered by the next message.
772 exec 5>>./config.log
773 ])
774
775 # AC_LIBTOOL_GCJ - enable support for GCJ libraries
776 AC_DEFUN(AC_LIBTOOL_GCJ,[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
777 AC_DEFUN(_AC_LIBTOOL_GCJ,
778 [AC_REQUIRE([AC_PROG_LIBTOOL])
779 AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
780   [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
781     [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
782        [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
783          [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])
784 LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
785 lt_save_CC="$CC"
786 lt_save_CFLAGS="$CFLAGS"
787 dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
788 dnl is set to the C++ compiler.
789 AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="" \
790 MAGIC="$MAGIC" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
791 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
792 AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
793 objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
794 deplibs_check_method="$deplibs_check_method" \
795 file_magic_cmd="$file_magic_cmd" \
796 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
797 --build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
798 || AC_MSG_ERROR([libtool tag configuration failed])
799 CC="$lt_save_CC"
800 CFLAGS="$lt_save_CFLAGS"
801
802 # Redirect the config.log output again, so that the ltconfig log is not
803 # clobbered by the next message.
804 exec 5>>./config.log
805 ])
806
807 dnl old names
808 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
809 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
810 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
811 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
812 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
813 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
814 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
815
816 dnl This is just to silence aclocal about the macro not being used
817 ifelse([AC_DISABLE_FAST_INSTALL])dnl
818
819 AC_DEFUN([LT_AC_PROG_GCJ],[
820   AC_CHECK_TOOL(GCJ, gcj, no)
821   test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
822   AC_SUBST(GCJFLAGS)
823 ])
824
825 # serial 1 AC_LIB_LTDL
826
827 AC_DEFUN(AC_LIB_LTDL,
828 [AC_PREREQ(2.13)dnl
829 AC_REQUIRE([AC_PROG_CC])dnl
830 AC_REQUIRE([AC_C_CONST])dnl
831 AC_REQUIRE([AC_C_INLINE])dnl
832
833 dnl AC_LIB_LTDL must perform all the checks necessary for compilation
834 dnl of the ltdl objects -- including compiler checks (above) and header
835 dnl checks (below).
836 AC_REQUIRE([AC_HEADER_STDC])dnl
837
838 AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h dld.h)
839 AC_CHECK_HEADERS(string.h strings.h, break)
840 AC_CHECK_FUNCS(strchr index, break)
841 AC_CHECK_FUNCS(strrchr rindex, break)
842 AC_CHECK_FUNCS(strcmp)
843
844 AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])dnl
845 AC_REQUIRE([AC_LTDL_SHLIBEXT])dnl
846 AC_REQUIRE([AC_LTDL_SHLIBPATH])dnl
847 AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])dnl
848 AC_REQUIRE([AC_LTDL_OBJDIR])dnl
849 AC_REQUIRE([AC_LTDL_DLPREOPEN])dnl
850 AC_REQUIRE([AC_LTDL_DLLIB])dnl
851 AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])dnl
852 ])
853
854 AC_DEFUN(AC_LTDL_ENABLE_INSTALL,
855 [AC_ARG_ENABLE(ltdl-install,
856 [  --enable-ltdl-install   install libltdl])
857
858 AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
859 AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
860 ])])
861
862
863 AC_DEFUN(AC_LTDL_SNARF_CONFIG,
864 [# Read the libtool configuration
865 rm -f conftest
866 ./libtool --config > conftest
867 . ./conftest
868 rm -f conftest
869 ])
870
871 AC_DEFUN(AC_LTDL_SHLIBEXT,
872 [AC_REQUIRE([AC_LTDL_SNARF_CONFIG])dnl
873 AC_CACHE_CHECK([which extension is used for shared libraries],
874   libltdl_cv_shlibext, [dnl
875 (
876   last=
877   for spec in $library_names_spec; do
878     last="$spec"
879   done
880 changequote(, )
881   echo "$last" | sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//' > conftest
882 changequote([, ])
883 )
884 libltdl_cv_shlibext=`cat conftest`
885 rm -f conftest
886 ])
887 if test -n "$libltdl_cv_shlibext"; then
888   AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
889     [Define to the extension used for shared libraries, say, ".so". ])
890 fi
891 ])
892
893 AC_DEFUN(AC_LTDL_SHLIBPATH,
894 [AC_REQUIRE([AC_LTDL_SNARF_CONFIG])dnl
895 AC_CACHE_CHECK([which variable specifies run-time library path],
896   libltdl_cv_shlibpath_var, [libltdl_cv_shlibpath_var="$shlibpath_var"])
897 if test -n "$libltdl_cv_shlibpath_var"; then
898   AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
899     [Define to the name of the environment variable that determines the dynamic library search path. ])
900 fi
901 ])
902
903 AC_DEFUN(AC_LTDL_SYSSEARCHPATH,
904 [AC_REQUIRE([AC_LTDL_SNARF_CONFIG])dnl
905 AC_CACHE_CHECK([for the default library search path],
906   libltdl_cv_sys_search_path, [libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"])
907 if test -n "$libltdl_cv_sys_search_path"; then
908   case "$host" in
909   *-*-mingw*) pathsep=";" ;;
910   *) pathsep=":" ;;
911   esac
912   sys_search_path=
913   for dir in $libltdl_cv_sys_search_path; do
914     if test -z "$sys_search_path"; then
915       sys_search_path="$dir"
916     else
917       sys_search_path="$sys_search_path$pathsep$dir"
918     fi
919   done
920   AC_DEFINE_UNQUOTED(LTDL_SYSSEARCHPATH, "$sys_search_path",
921     [Define to the system default library search path. ])
922 fi
923 ])
924
925 AC_DEFUN(AC_LTDL_OBJDIR,
926 [AC_CACHE_CHECK([for objdir],
927   libltdl_cv_objdir, [libltdl_cv_objdir="$objdir"
928 if test -n "$objdir"; then
929   :
930 else
931   rm -f .libs 2>/dev/null
932   mkdir .libs 2>/dev/null
933   if test -d .libs; then
934     libltdl_cv_objdir=.libs
935   else
936     # MS-DOS does not allow filenames that begin with a dot.
937     libltdl_cv_objdir=_libs
938   fi
939 rmdir .libs 2>/dev/null
940 fi])
941 AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
942   [Define to the sub-directory in which libtool stores uninstalled libraries. ])
943 ])
944
945 AC_DEFUN(AC_LTDL_DLPREOPEN,
946 [AC_REQUIRE([AC_LTDL_GLOBAL_SYMBOL_PIPE])dnl
947 AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
948        libltdl_cv_preloaded_symbols, [dnl
949   if test -n "$global_symbol_pipe"; then
950     libltdl_cv_preloaded_symbols=yes
951   else
952     libltdl_cv_preloaded_symbols=no
953   fi
954 ])
955 if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then
956   AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
957     [Define if libtool can extract symbol lists from object files. ])
958 fi
959 ])
960
961 AC_DEFUN(AC_LTDL_DLLIB,
962 [LIBADD_DL=
963 AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
964    [Define if you have the libdl library or equivalent. ]) LIBADD_DL="-ldl"],
965 [AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
966    [Define if you have the libdl library or equivalent.])],
967 [AC_CHECK_LIB(svld, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
968    [Define if you have the libdl library or equivalent.]) LIBADD_DL="-lsvld"]
969 )])])
970 AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1,
971    [Define if you have the shl_load function.])],
972 [AC_CHECK_LIB(dld, shl_load,
973   [AC_DEFINE(HAVE_SHL_LOAD, 1,
974      [Define if you have the shl_load function.])
975    LIBADD_DL="$LIBADD_DL -ldld"])
976 ])
977 AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1,
978   [Define if you have the GNU dld library.])dnl
979 test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="$LIBADD_DL -ldld"])
980 AC_SUBST(LIBADD_DL)
981
982 if test "x$ac_cv_func_dlopen" = xyes || test "x$ac_cv_lib_dl_dlopen" = xyes; then
983  LIBS_SAVE="$LIBS"
984  LIBS="$LIBS $LIBADD_DL"
985  AC_CHECK_FUNCS(dlerror)
986  LIBS="$LIBS_SAVE"
987 fi
988 ])
989
990 AC_DEFUN(AC_LTDL_GLOBAL_SYMBOL_PIPE,
991 [dnl Check for command to grab the raw symbol name followed
992 dnl by C symbol name from nm.
993 AC_REQUIRE([AC_CANONICAL_HOST])dnl
994 AC_REQUIRE([AC_PROG_NM])dnl
995 # Check for command to grab the raw symbol name followed by C symbol from nm.
996 AC_MSG_CHECKING([command to parse $NM output])
997 AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
998 [# These are sane defaults that work on at least a few old systems.
999 # {They come from Ultrix.  What could be older than Ultrix?!! ;)}
1000
1001 changequote(,)dnl
1002 # Character class describing NM global symbol codes.
1003 ac_symcode='[BCDEGRST]'
1004
1005 # Regexp to match symbols that can be accessed directly from C.
1006 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
1007
1008 # Transform the above into a raw symbol and a C symbol.
1009 ac_symxfrm='\1 \2\3 \3'
1010
1011 # Transform an extracted symbol line into a proper C declaration
1012 ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
1013
1014 # Define system-specific variables.
1015 case "$host_os" in
1016 aix*)
1017   ac_symcode='[BCDT]'
1018   ;;
1019 cygwin* | mingw*)
1020   ac_symcode='[ABCDGISTW]'
1021   ;;
1022 hpux*)
1023   ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
1024   ;;
1025 irix*)
1026   ac_symcode='[BCDEGRST]'
1027   ;;
1028 solaris*)
1029   ac_symcode='[BDT]'
1030   ;;
1031 esac
1032
1033 # If we're using GNU nm, then use its standard symbol codes.
1034 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
1035   ac_symcode='[ABCDGISTW]'
1036 fi
1037 changequote([,])dnl
1038
1039 # Try without a prefix undercore, then with it.
1040 for ac_symprfx in "" "_"; do
1041
1042   ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[       ]\($ac_symcode\)[       ][      ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
1043
1044   # Check to see that the pipe works correctly.
1045   ac_pipe_works=no
1046   rm -f conftest.$ac_ext
1047   cat > conftest.$ac_ext <<EOF
1048 #ifdef __cplusplus
1049 extern "C" {
1050 #endif
1051 char nm_test_var;
1052 void nm_test_func(){}
1053 #ifdef __cplusplus
1054 }
1055 #endif
1056 int main(){nm_test_var='a';nm_test_func;return 0;}
1057 EOF
1058
1059   if AC_TRY_EVAL(ac_compile); then
1060     # Now try to grab the symbols.
1061     ac_nlist=conftest.nm
1062
1063     if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
1064
1065       # Try sorting and uniquifying the output.
1066       if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
1067         mv -f "$ac_nlist"T "$ac_nlist"
1068       else
1069         rm -f "$ac_nlist"T
1070       fi
1071
1072       # Make sure that we snagged all the symbols we need.
1073       if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
1074         if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
1075           cat <<EOF > conftest.c
1076 #ifdef __cplusplus
1077 extern "C" {
1078 #endif
1079
1080 EOF
1081           # Now generate the symbol file.
1082           eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
1083
1084           cat <<EOF >> conftest.c
1085 #if defined (__STDC__) && __STDC__
1086 # define lt_ptr_t void *
1087 #else
1088 # define lt_ptr_t char *
1089 # define const
1090 #endif
1091
1092 /* The mapping between symbol names and symbols. */
1093 const struct {
1094   const char *name;
1095   lt_ptr_t address;
1096 }
1097 changequote(,)dnl
1098 lt_preloaded_symbols[] =
1099 changequote([,])dnl
1100 {
1101 EOF
1102         sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
1103         cat <<\EOF >> conftest.c
1104   {0, (lt_ptr_t) 0}
1105 };
1106
1107 #ifdef __cplusplus
1108 }
1109 #endif
1110 EOF
1111           # Now try linking the two files.
1112           mv conftest.$ac_objext conftstm.$ac_objext
1113           ac_save_LIBS="$LIBS"
1114           ac_save_CFLAGS="$CFLAGS"
1115           LIBS="conftstm.$ac_objext"
1116           CFLAGS="$CFLAGS$no_builtin_flag"
1117           if AC_TRY_EVAL(ac_link) && test -s conftest; then
1118             ac_pipe_works=yes
1119           else
1120             echo "configure: failed program was:" >&AC_FD_CC
1121             cat conftest.c >&AC_FD_CC
1122           fi
1123           LIBS="$ac_save_LIBS"
1124           CFLAGS="$ac_save_CFLAGS"
1125         else
1126           echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
1127         fi
1128       else
1129         echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
1130       fi
1131     else
1132       echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
1133     fi
1134   else
1135     echo "$progname: failed program was:" >&AC_FD_CC
1136     cat conftest.c >&AC_FD_CC
1137   fi
1138   rm -rf conftest* conftst*
1139
1140   # Do not use the global_symbol_pipe unless it works.
1141   if test "$ac_pipe_works" = yes; then
1142     if test x"$ac_symprfx" = x"_"; then
1143       ac_cv_sys_symbol_underscore=yes
1144     else
1145       ac_cv_sys_symbol_underscore=no
1146     fi
1147     break
1148   else
1149     ac_cv_sys_global_symbol_pipe=
1150   fi
1151 done
1152 ])
1153
1154 ac_result=yes
1155 if test -z "$ac_cv_sys_global_symbol_pipe"; then
1156    ac_result=no
1157 fi
1158 AC_MSG_RESULT($ac_result)
1159 ])
1160
1161 AC_DEFUN(AC_LTDL_SYMBOL_USCORE,
1162 [dnl does the compiler prefix global symbols with an underscore?
1163 AC_REQUIRE([AC_LTDL_GLOBAL_SYMBOL_PIPE])dnl
1164 AC_MSG_CHECKING([for _ prefix in compiled symbols])
1165 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
1166 [ac_cv_sys_symbol_underscore=no
1167 cat > conftest.$ac_ext <<EOF
1168 void nm_test_func(){}
1169 int main(){nm_test_func;return 0;}
1170 EOF
1171 if AC_TRY_EVAL(ac_compile); then
1172   # Now try to grab the symbols.
1173   ac_nlist=conftest.nm
1174   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
1175     # See whether the symbols have a leading underscore.
1176     if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
1177       ac_cv_sys_symbol_underscore=yes
1178     else
1179       if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
1180         :
1181       else
1182         echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
1183       fi
1184     fi
1185   else
1186     echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
1187   fi
1188 else
1189   echo "configure: failed program was:" >&AC_FD_CC
1190   cat conftest.c >&AC_FD_CC
1191 fi
1192 rm -rf conftest*
1193 ])
1194 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
1195 AC_LTDL_DLSYM_USCORE
1196 ])
1197
1198 AC_DEFUN(AC_LTDL_DLSYM_USCORE,
1199 [AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])dnl
1200 if test x"$ac_cv_sys_symbol_underscore" = xyes; then
1201   if test x"$ac_cv_func_dlopen" = xyes ||
1202      test x"$ac_cv_lib_dl_dlopen" = xyes ; then
1203         AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
1204                 libltdl_cv_need_uscore, [dnl
1205                 AC_TRY_RUN([
1206 #if HAVE_DLFCN_H
1207 #include <dlfcn.h>
1208 #endif
1209
1210 #include <stdio.h>
1211
1212 #ifdef RTLD_GLOBAL
1213 # define LTDL_GLOBAL    RTLD_GLOBAL
1214 #else
1215 # ifdef DL_GLOBAL
1216 #  define LTDL_GLOBAL   DL_GLOBAL
1217 # else
1218 #  define LTDL_GLOBAL   0
1219 # endif
1220 #endif
1221
1222 /* We may have to define LTDL_LAZY_OR_NOW in the command line if we
1223    find out it does not work in some platform. */
1224 #ifndef LTDL_LAZY_OR_NOW
1225 # ifdef RTLD_LAZY
1226 #  define LTDL_LAZY_OR_NOW      RTLD_LAZY
1227 # else
1228 #  ifdef DL_LAZY
1229 #   define LTDL_LAZY_OR_NOW     DL_LAZY
1230 #  else
1231 #   ifdef RTLD_NOW
1232 #    define LTDL_LAZY_OR_NOW    RTLD_NOW
1233 #   else
1234 #    ifdef DL_NOW
1235 #     define LTDL_LAZY_OR_NOW   DL_NOW
1236 #    else
1237 #     define LTDL_LAZY_OR_NOW   0
1238 #    endif
1239 #   endif
1240 #  endif
1241 # endif
1242 #endif
1243
1244 fnord() { int i=42;}
1245 main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
1246     if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
1247                if(ptr1 && !ptr2) { dlclose(self); exit(0); } } exit(1); }
1248 ],      libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
1249         libltdl_cv_need_uscore=cross
1250 )])
1251   fi
1252 fi
1253
1254 if test x"$libltdl_cv_need_uscore" = xyes; then
1255   AC_DEFINE(NEED_USCORE, 1,
1256     [Define if dlsym() requires a leading underscode in symbol names. ])
1257 fi
1258 ])
1259
1260 # Define a conditional.
1261
1262 AC_DEFUN(AM_CONDITIONAL,
1263 [AC_SUBST($1_TRUE)
1264 AC_SUBST($1_FALSE)
1265 if $2; then
1266   $1_TRUE=
1267   $1_FALSE='#'
1268 else
1269   $1_TRUE='#'
1270   $1_FALSE=
1271 fi])
1272
1273 # Do all the work for Automake.  This macro actually does too much --
1274 # some checks are only needed if your package does certain things.
1275 # But this isn't really a big deal.
1276
1277 # serial 1
1278
1279 dnl Usage:
1280 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1281
1282 AC_DEFUN(AM_INIT_AUTOMAKE,
1283 [AC_REQUIRE([AC_PROG_INSTALL])
1284 PACKAGE=[$1]
1285 AC_SUBST(PACKAGE)
1286 VERSION=[$2]
1287 AC_SUBST(VERSION)
1288 dnl test to see if srcdir already configured
1289 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1290   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1291 fi
1292 ifelse([$3],,
1293 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1294 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1295 AC_REQUIRE([AM_SANITY_CHECK])
1296 AC_REQUIRE([AC_ARG_PROGRAM])
1297 dnl FIXME This is truly gross.
1298 missing_dir=`cd $ac_aux_dir && pwd`
1299 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1300 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1301 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1302 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1303 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1304 AC_REQUIRE([AC_PROG_MAKE_SET])])
1305
1306 #
1307 # Check to make sure that the build environment is sane.
1308 #
1309
1310 AC_DEFUN(AM_SANITY_CHECK,
1311 [AC_MSG_CHECKING([whether build environment is sane])
1312 # Just in case
1313 sleep 1
1314 echo timestamp > conftestfile
1315 # Do `set' in a subshell so we don't clobber the current shell's
1316 # arguments.  Must try -L first in case configure is actually a
1317 # symlink; some systems play weird games with the mod time of symlinks
1318 # (eg FreeBSD returns the mod time of the symlink's containing
1319 # directory).
1320 if (
1321    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1322    if test "[$]*" = "X"; then
1323       # -L didn't work.
1324       set X `ls -t $srcdir/configure conftestfile`
1325    fi
1326    if test "[$]*" != "X $srcdir/configure conftestfile" \
1327       && test "[$]*" != "X conftestfile $srcdir/configure"; then
1328
1329       # If neither matched, then we have a broken ls.  This can happen
1330       # if, for instance, CONFIG_SHELL is bash and it inherits a
1331       # broken ls alias from the environment.  This has actually
1332       # happened.  Such a system could not be considered "sane".
1333       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1334 alias in your environment])
1335    fi
1336
1337    test "[$]2" = conftestfile
1338    )
1339 then
1340    # Ok.
1341    :
1342 else
1343    AC_MSG_ERROR([newly created file is older than distributed files!
1344 Check your system clock])
1345 fi
1346 rm -f conftest*
1347 AC_MSG_RESULT(yes)])
1348
1349 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1350 dnl The program must properly implement --version.
1351 AC_DEFUN(AM_MISSING_PROG,
1352 [AC_MSG_CHECKING(for working $2)
1353 # Run test in a subshell; some versions of sh will print an error if
1354 # an executable is not found, even if stderr is redirected.
1355 # Redirect stdin to placate older versions of autoconf.  Sigh.
1356 if ($2 --version) < /dev/null > /dev/null 2>&1; then
1357    $1=$2
1358    AC_MSG_RESULT(found)
1359 else
1360    $1="$3/missing $2"
1361    AC_MSG_RESULT(missing)
1362 fi
1363 AC_SUBST($1)])
1364
1365 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1366
1367 AC_DEFUN(AM_CONFIG_HEADER,
1368 [AC_PREREQ([2.12])
1369 AC_CONFIG_HEADER([$1])
1370 dnl When config.status generates a header, we must update the stamp-h file.
1371 dnl This file resides in the same directory as the config header
1372 dnl that is generated.  We must strip everything past the first ":",
1373 dnl and everything past the last "/".
1374 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1375 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1376 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1377 <<am_indx=1
1378 for am_file in <<$1>>; do
1379   case " <<$>>CONFIG_HEADERS " in
1380   *" <<$>>am_file "*<<)>>
1381     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1382     ;;
1383   esac
1384   am_indx=`expr "<<$>>am_indx" + 1`
1385 done<<>>dnl>>)
1386 changequote([,]))])
1387
1388 # Add --enable-maintainer-mode option to configure.
1389 # From Jim Meyering
1390
1391 # serial 1
1392
1393 AC_DEFUN(AM_MAINTAINER_MODE,
1394 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1395   dnl maintainer-mode is disabled by default
1396   AC_ARG_ENABLE(maintainer-mode,
1397 [  --enable-maintainer-mode enable make rules and dependencies not useful
1398                           (and sometimes confusing) to the casual installer],
1399       USE_MAINTAINER_MODE=$enableval,
1400       USE_MAINTAINER_MODE=no)
1401   AC_MSG_RESULT($USE_MAINTAINER_MODE)
1402   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1403   MAINT=$MAINTAINER_MODE_TRUE
1404   AC_SUBST(MAINT)dnl
1405 ]
1406 )
1407