OSDN Git Service

* acconfig.h (GCJVERSION): New undef.
[pf3gnuchains/gcc-fork.git] / libjava / 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 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
14 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
15 # are probably using a cross compiler, which will not be able to fully
16 # link an executable.  This should really be fixed in autoconf
17 # itself.
18
19 AC_DEFUN(LIBGCJ_CONFIGURE,
20 [
21 dnl Default to --enable-multilib
22 AC_ARG_ENABLE(multilib,
23 [  --enable-multilib         build many library versions (default)],
24 [case "${enableval}" in
25   yes) multilib=yes ;;
26   no)  multilib=no ;;
27   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
28  esac], [multilib=yes])dnl
29
30 dnl We may get other options which we dont document:
31 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
32
33 if test "[$]{srcdir}" = "."; then
34   if test "[$]{with_target_subdir}" != "."; then
35     libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
36   else
37     libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
38   fi
39 else
40   libgcj_basedir="[$]{srcdir}/$1"
41 fi
42 AC_SUBST(libgcj_basedir)
43
44 AC_CANONICAL_HOST
45
46 dnl Still use "libjava" here to placate dejagnu.
47 AM_INIT_AUTOMAKE(libjava, 0.0.7)
48
49 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
50 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
51 # are probably using a cross compiler, which will not be able to fully
52 # link an executable.  This should really be fixed in autoconf
53 # itself.
54
55 AC_DEFUN(LIB_AC_PROG_CC,
56 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
57 AC_CHECK_PROG(CC, gcc, gcc)
58 if test -z "$CC"; then
59   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
60   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
61 fi
62
63 AC_PROG_CC_GNU
64
65 if test $ac_cv_prog_gcc = yes; then
66   GCC=yes
67 dnl Check whether -g works, even if CFLAGS is set, in case the package
68 dnl plays around with CFLAGS (such as to build both debugging and
69 dnl normal versions of a library), tasteless as that idea is.
70   ac_test_CFLAGS="${CFLAGS+set}"
71   ac_save_CFLAGS="$CFLAGS"
72   CFLAGS=
73   AC_PROG_CC_G
74   if test "$ac_test_CFLAGS" = set; then
75     CFLAGS="$ac_save_CFLAGS"
76   elif test $ac_cv_prog_cc_g = yes; then
77     CFLAGS="-g -O2"
78   else
79     CFLAGS="-O2"
80   fi
81 else
82   GCC=
83   test "${CFLAGS+set}" = set || CFLAGS="-g"
84 fi
85 ])
86
87 LIB_AC_PROG_CC
88
89 # Likewise for AC_PROG_CXX.
90 AC_DEFUN(LIB_AC_PROG_CXX,
91 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
92 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
93 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
94
95 AC_PROG_CXX_GNU
96
97 if test $ac_cv_prog_gxx = yes; then
98   GXX=yes
99 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
100 dnl plays around with CXXFLAGS (such as to build both debugging and
101 dnl normal versions of a library), tasteless as that idea is.
102   ac_test_CXXFLAGS="${CXXFLAGS+set}"
103   ac_save_CXXFLAGS="$CXXFLAGS"
104   CXXFLAGS=
105   AC_PROG_CXX_G
106   if test "$ac_test_CXXFLAGS" = set; then
107     CXXFLAGS="$ac_save_CXXFLAGS"
108   elif test $ac_cv_prog_cxx_g = yes; then
109     CXXFLAGS="-g -O2"
110   else
111     CXXFLAGS="-O2"
112   fi
113 else
114   GXX=
115   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
116 fi
117 ])
118
119 LIB_AC_PROG_CXX
120
121 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we dont
122 # run it explicitly here, it will be run implicitly before
123 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
124 # be run before AC_CANONICAL_HOST.
125 AC_CANONICAL_BUILD
126
127 AC_CHECK_TOOL(AS, as)
128 AC_CHECK_TOOL(AR, ar)
129 AC_CHECK_TOOL(RANLIB, ranlib, :)
130
131 AC_PROG_INSTALL
132
133 AM_MAINTAINER_MODE
134
135 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
136 # at least currently, we never actually build a program, so we never
137 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
138 # fails, because we are probably configuring with a cross compiler
139 # which cant create executables.  So we include AC_EXEEXT to keep
140 # automake happy, but we dont execute it, since we dont care about
141 # the result.
142 if false; then
143   AC_EXEEXT
144 fi
145
146 # configure.host sets the following important variables
147 #       libgcj_cflags    - host specific C compiler flags
148 #       libgcj_cxxflags  - host specific C++ compiler flags
149 #       libgcj_javaflags - host specific Java compiler flags
150
151 libgcj_cflags=
152 libgcj_cxxflags=
153 libgcj_javaflags=
154
155 . [$]{libgcj_basedir}/configure.host
156
157 case [$]{libgcj_basedir} in
158 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{libgcj_basedir} ;;
159 *) libgcj_flagbasedir='[$](top_builddir)/'[$]{libgcj_basedir} ;;
160 esac
161
162 LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
163 LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
164 LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
165 AC_SUBST(LIBGCJ_CFLAGS)
166 AC_SUBST(LIBGCJ_CXXFLAGS)
167 AC_SUBST(LIBGCJ_JAVAFLAGS)
168 ])dnl
169
170 # Do all the work for Automake.  This macro actually does too much --
171 # some checks are only needed if your package does certain things.
172 # But this isn't really a big deal.
173
174 # serial 1
175
176 dnl Usage:
177 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
178
179 AC_DEFUN(AM_INIT_AUTOMAKE,
180 [AC_REQUIRE([AC_PROG_INSTALL])
181 PACKAGE=[$1]
182 AC_SUBST(PACKAGE)
183 VERSION=[$2]
184 AC_SUBST(VERSION)
185 dnl test to see if srcdir already configured
186 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
187   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
188 fi
189 ifelse([$3],,
190 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
191 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
192 AC_REQUIRE([AM_SANITY_CHECK])
193 AC_REQUIRE([AC_ARG_PROGRAM])
194 dnl FIXME This is truly gross.
195 missing_dir=`cd $ac_aux_dir && pwd`
196 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
197 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
198 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
199 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
200 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
201 AC_REQUIRE([AC_PROG_MAKE_SET])])
202
203 #
204 # Check to make sure that the build environment is sane.
205 #
206
207 AC_DEFUN(AM_SANITY_CHECK,
208 [AC_MSG_CHECKING([whether build environment is sane])
209 # Just in case
210 sleep 1
211 echo timestamp > conftestfile
212 # Do `set' in a subshell so we don't clobber the current shell's
213 # arguments.  Must try -L first in case configure is actually a
214 # symlink; some systems play weird games with the mod time of symlinks
215 # (eg FreeBSD returns the mod time of the symlink's containing
216 # directory).
217 if (
218    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
219    if test "[$]*" = "X"; then
220       # -L didn't work.
221       set X `ls -t $srcdir/configure conftestfile`
222    fi
223    if test "[$]*" != "X $srcdir/configure conftestfile" \
224       && test "[$]*" != "X conftestfile $srcdir/configure"; then
225
226       # If neither matched, then we have a broken ls.  This can happen
227       # if, for instance, CONFIG_SHELL is bash and it inherits a
228       # broken ls alias from the environment.  This has actually
229       # happened.  Such a system could not be considered "sane".
230       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
231 alias in your environment])
232    fi
233
234    test "[$]2" = conftestfile
235    )
236 then
237    # Ok.
238    :
239 else
240    AC_MSG_ERROR([newly created file is older than distributed files!
241 Check your system clock])
242 fi
243 rm -f conftest*
244 AC_MSG_RESULT(yes)])
245
246 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
247 dnl The program must properly implement --version.
248 AC_DEFUN(AM_MISSING_PROG,
249 [AC_MSG_CHECKING(for working $2)
250 # Run test in a subshell; some versions of sh will print an error if
251 # an executable is not found, even if stderr is redirected.
252 # Redirect stdin to placate older versions of autoconf.  Sigh.
253 if ($2 --version) < /dev/null > /dev/null 2>&1; then
254    $1=$2
255    AC_MSG_RESULT(found)
256 else
257    $1="$3/missing $2"
258    AC_MSG_RESULT(missing)
259 fi
260 AC_SUBST($1)])
261
262 # Add --enable-maintainer-mode option to configure.
263 # From Jim Meyering
264
265 # serial 1
266
267 AC_DEFUN(AM_MAINTAINER_MODE,
268 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
269   dnl maintainer-mode is disabled by default
270   AC_ARG_ENABLE(maintainer-mode,
271 [  --enable-maintainer-mode enable make rules and dependencies not useful
272                           (and sometimes confusing) to the casual installer],
273       USE_MAINTAINER_MODE=$enableval,
274       USE_MAINTAINER_MODE=no)
275   AC_MSG_RESULT($USE_MAINTAINER_MODE)
276   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
277   MAINT=$MAINTAINER_MODE_TRUE
278   AC_SUBST(MAINT)dnl
279 ]
280 )
281
282 # Define a conditional.
283
284 AC_DEFUN(AM_CONDITIONAL,
285 [AC_SUBST($1_TRUE)
286 AC_SUBST($1_FALSE)
287 if $2; then
288   $1_TRUE=
289   $1_FALSE='#'
290 else
291   $1_TRUE='#'
292   $1_FALSE=
293 fi])
294
295 # Like AC_CONFIG_HEADER, but automatically create stamp file.
296
297 AC_DEFUN(AM_CONFIG_HEADER,
298 [AC_PREREQ([2.12])
299 AC_CONFIG_HEADER([$1])
300 dnl When config.status generates a header, we must update the stamp-h file.
301 dnl This file resides in the same directory as the config header
302 dnl that is generated.  We must strip everything past the first ":",
303 dnl and everything past the last "/".
304 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
305 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
306 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
307 <<am_indx=1
308 for am_file in <<$1>>; do
309   case " <<$>>CONFIG_HEADERS " in
310   *" <<$>>am_file "*<<)>>
311     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
312     ;;
313   esac
314   am_indx=`expr "<<$>>am_indx" + 1`
315 done<<>>dnl>>)
316 changequote([,]))])
317
318
319 # serial 35 AC_PROG_LIBTOOL
320 AC_DEFUN(AC_PROG_LIBTOOL,
321 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
322
323 # Save cache, so that ltconfig can load it
324 AC_CACHE_SAVE
325
326 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
327 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
328 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
329 DLLTOOL="$DLLTOOL" AS="$AS" \
330 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
331 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
332 || AC_MSG_ERROR([libtool configure failed])
333
334 # Reload cache, that may have been modified by ltconfig
335 AC_CACHE_LOAD
336
337 # This can be used to rebuild libtool when needed
338 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
339
340 # Always use our own libtool.
341 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
342 AC_SUBST(LIBTOOL)dnl
343
344 # Redirect the config.log output again, so that the ltconfig log is not
345 # clobbered by the next message.
346 exec 5>>./config.log
347 ])
348
349 AC_DEFUN(AC_LIBTOOL_SETUP,
350 [AC_PREREQ(2.13)dnl
351 AC_REQUIRE([AC_ENABLE_SHARED])dnl
352 AC_REQUIRE([AC_ENABLE_STATIC])dnl
353 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
354 AC_REQUIRE([AC_CANONICAL_HOST])dnl
355 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
356 AC_REQUIRE([AC_PROG_RANLIB])dnl
357 AC_REQUIRE([AC_PROG_CC])dnl
358 AC_REQUIRE([AC_PROG_LD])dnl
359 AC_REQUIRE([AC_PROG_NM])dnl
360 AC_REQUIRE([AC_SYS_NM_PARSE])dnl
361 AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl
362 AC_REQUIRE([AC_PROG_LN_S])dnl
363 dnl
364
365 # Check for any special flags to pass to ltconfig.
366 libtool_flags="--cache-file=$cache_file"
367 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
368 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
369 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
370 test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
371 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
372 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
373 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
374
375 # Some flags need to be propagated to the compiler or linker for good
376 # libtool support.
377 case "$host" in
378 *-*-irix6*)
379   # Find out which ABI we are using.
380   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
381   if AC_TRY_EVAL(ac_compile); then
382     case "`/usr/bin/file conftest.o`" in
383     *32-bit*)
384       LD="${LD-ld} -32"
385       ;;
386     *N32*)
387       LD="${LD-ld} -n32"
388       ;;
389     *64-bit*)
390       LD="${LD-ld} -64"
391       ;;
392     esac
393   fi
394   rm -rf conftest*
395   ;;
396
397 *-*-sco3.2v5*)
398   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
399   SAVE_CFLAGS="$CFLAGS"
400   CFLAGS="$CFLAGS -belf"
401   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
402     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
403   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
404     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
405     CFLAGS="$SAVE_CFLAGS"
406   fi
407   ;;
408
409 *-*-cygwin*)
410   AC_SYS_LIBTOOL_CYGWIN
411   ;;
412
413 esac
414
415 # enable the --disable-libtool-lock switch
416
417 AC_ARG_ENABLE(libtool-lock,
418 [  --disable-libtool-lock  force libtool not to do file locking],
419 need_locks=$enableval,
420 need_locks=yes)
421
422 if test x"$need_locks" = xno; then
423   libtool_flags="$libtool_flags --disable-lock"
424 fi
425 ])
426
427 # AC_LIBTOOL_DLOPEN - check for dlopen support
428 AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
429
430 # AC_ENABLE_SHARED - implement the --enable-shared flag
431 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
432 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
433 #   `yes'.
434 AC_DEFUN(AC_ENABLE_SHARED,
435 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
436 AC_ARG_ENABLE(shared,
437 changequote(<<, >>)dnl
438 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
439 changequote([, ])dnl
440 [p=${PACKAGE-default}
441 case "$enableval" in
442 yes) enable_shared=yes ;;
443 no) enable_shared=no ;;
444 *)
445   enable_shared=no
446   # Look at the argument we got.  We use all the common list separators.
447   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
448   for pkg in $enableval; do
449     if test "X$pkg" = "X$p"; then
450       enable_shared=yes
451     fi
452   done
453   IFS="$ac_save_ifs"
454   ;;
455 esac],
456 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
457 ])
458
459 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
460 AC_DEFUN(AC_DISABLE_SHARED,
461 [AC_ENABLE_SHARED(no)])
462
463 # AC_ENABLE_STATIC - implement the --enable-static flag
464 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
465 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
466 #   `yes'.
467 AC_DEFUN(AC_ENABLE_STATIC,
468 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
469 AC_ARG_ENABLE(static,
470 changequote(<<, >>)dnl
471 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
472 changequote([, ])dnl
473 [p=${PACKAGE-default}
474 case "$enableval" in
475 yes) enable_static=yes ;;
476 no) enable_static=no ;;
477 *)
478   enable_static=no
479   # Look at the argument we got.  We use all the common list separators.
480   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
481   for pkg in $enableval; do
482     if test "X$pkg" = "X$p"; then
483       enable_static=yes
484     fi
485   done
486   IFS="$ac_save_ifs"
487   ;;
488 esac],
489 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
490 ])
491
492 # AC_DISABLE_STATIC - set the default static flag to --disable-static
493 AC_DEFUN(AC_DISABLE_STATIC,
494 [AC_ENABLE_STATIC(no)])
495
496
497 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
498 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
499 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
500 #   `yes'.
501 AC_DEFUN(AC_ENABLE_FAST_INSTALL,
502 [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
503 AC_ARG_ENABLE(fast-install,
504 changequote(<<, >>)dnl
505 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
506 changequote([, ])dnl
507 [p=${PACKAGE-default}
508 case "$enableval" in
509 yes) enable_fast_install=yes ;;
510 no) enable_fast_install=no ;;
511 *)
512   enable_fast_install=no
513   # Look at the argument we got.  We use all the common list separators.
514   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
515   for pkg in $enableval; do
516     if test "X$pkg" = "X$p"; then
517       enable_fast_install=yes
518     fi
519   done
520   IFS="$ac_save_ifs"
521   ;;
522 esac],
523 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
524 ])
525
526 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
527 AC_DEFUN(AC_DISABLE_FAST_INSTALL,
528 [AC_ENABLE_FAST_INSTALL(no)])
529
530
531 # AC_PROG_LD - find the path to the GNU or non-GNU linker
532 AC_DEFUN(AC_PROG_LD,
533 [AC_ARG_WITH(gnu-ld,
534 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
535 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
536 AC_REQUIRE([AC_PROG_CC])dnl
537 AC_REQUIRE([AC_CANONICAL_HOST])dnl
538 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
539 ac_prog=ld
540 if test "$ac_cv_prog_gcc" = yes; then
541   # Check if gcc -print-prog-name=ld gives a path.
542   AC_MSG_CHECKING([for ld used by GCC])
543   ac_prog=`($CC -print-prog-name=ld) 2>&5`
544   case "$ac_prog" in
545     # Accept absolute paths.
546 changequote(,)dnl
547     /* | [A-Za-z]:[\\/]*)
548       re_direlt='/[^/][^/]*/\.\./'
549 changequote([,])dnl
550       # Canonicalize the path of ld
551       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
552       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
553         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
554       done
555       test -z "$LD" && LD="$ac_prog"
556       ;;
557   "")
558     # If it fails, then pretend we aren't using GCC.
559     ac_prog=ld
560     ;;
561   *)
562     # If it is relative, then search for the first ld in PATH.
563     with_gnu_ld=unknown
564     ;;
565   esac
566 elif test "$with_gnu_ld" = yes; then
567   AC_MSG_CHECKING([for GNU ld])
568 else
569   AC_MSG_CHECKING([for non-GNU ld])
570 fi
571 AC_CACHE_VAL(ac_cv_path_LD,
572 [if test -z "$LD"; then
573   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
574   for ac_dir in $PATH; do
575     test -z "$ac_dir" && ac_dir=.
576     if test -f "$ac_dir/$ac_prog"; then
577       ac_cv_path_LD="$ac_dir/$ac_prog"
578       # Check to see if the program is GNU ld.  I'd rather use --version,
579       # but apparently some GNU ld's only accept -v.
580       # Break only if it was the GNU/non-GNU ld that we prefer.
581       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
582         test "$with_gnu_ld" != no && break
583       else
584         test "$with_gnu_ld" != yes && break
585       fi
586     fi
587   done
588   IFS="$ac_save_ifs"
589 else
590   ac_cv_path_LD="$LD" # Let the user override the test with a path.
591 fi])
592 LD="$ac_cv_path_LD"
593 if test -n "$LD"; then
594   AC_MSG_RESULT($LD)
595 else
596   AC_MSG_RESULT(no)
597 fi
598 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
599 AC_SUBST(LD)
600 AC_PROG_LD_GNU
601 ])
602
603 AC_DEFUN(AC_PROG_LD_GNU,
604 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
605 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
606 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
607   ac_cv_prog_gnu_ld=yes
608 else
609   ac_cv_prog_gnu_ld=no
610 fi])
611 ])
612
613 # AC_PROG_NM - find the path to a BSD-compatible name lister
614 AC_DEFUN(AC_PROG_NM,
615 [AC_MSG_CHECKING([for BSD-compatible nm])
616 AC_CACHE_VAL(ac_cv_path_NM,
617 [if test -n "$NM"; then
618   # Let the user override the test.
619   ac_cv_path_NM="$NM"
620 else
621   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
622   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
623     test -z "$ac_dir" && ac_dir=.
624     if test -f $ac_dir/nm; then
625       # Check to see if the nm accepts a BSD-compat flag.
626       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
627       #   nm: unknown option "B" ignored
628       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
629         ac_cv_path_NM="$ac_dir/nm -B"
630         break
631       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
632         ac_cv_path_NM="$ac_dir/nm -p"
633         break
634       else
635         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
636         continue # so that we can try to find one that supports BSD flags
637       fi
638     fi
639   done
640   IFS="$ac_save_ifs"
641   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
642 fi])
643 NM="$ac_cv_path_NM"
644 AC_MSG_RESULT([$NM])
645 AC_SUBST(NM)
646 ])
647
648 # AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
649 # by C symbol name from nm.
650 AC_DEFUN(AC_SYS_NM_PARSE,
651 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
652 AC_REQUIRE([AC_PROG_NM])dnl
653 # Check for command to grab the raw symbol name followed by C symbol from nm.
654 AC_MSG_CHECKING([command to parse $NM output])
655 AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
656 [# These are sane defaults that work on at least a few old systems.
657 # {They come from Ultrix.  What could be older than Ultrix?!! ;)}
658
659 changequote(,)dnl
660 # Character class describing NM global symbol codes.
661 ac_symcode='[BCDEGRST]'
662
663 # Regexp to match symbols that can be accessed directly from C.
664 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
665
666 # Transform the above into a raw symbol and a C symbol.
667 ac_symxfrm='\1 \2\3 \3'
668
669 # Transform an extracted symbol line into a proper C declaration
670 ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
671
672 # Define system-specific variables.
673 case "$host_os" in
674 aix*)
675   ac_symcode='[BCDT]'
676   ;;
677 cygwin* | mingw*)
678   ac_symcode='[ABCDGISTW]'
679   ;;
680 hpux*)
681   ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
682   ;;
683 irix*)
684   ac_symcode='[BCDEGRST]'
685   ;;
686 solaris*)
687   ac_symcode='[BDT]'
688   ;;
689 esac
690
691 # If we're using GNU nm, then use its standard symbol codes.
692 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
693   ac_symcode='[ABCDGISTW]'
694 fi
695 changequote([,])dnl
696
697 # Try without a prefix undercore, then with it.
698 for ac_symprfx in "" "_"; do
699
700   ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[       ]\($ac_symcode\)[       ][      ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
701
702   # Check to see that the pipe works correctly.
703   ac_pipe_works=no
704   rm -f conftest.$ac_ext
705   cat > conftest.$ac_ext <<EOF
706 #ifdef __cplusplus
707 extern "C" {
708 #endif
709 char nm_test_var;
710 void nm_test_func(){}
711 #ifdef __cplusplus
712 }
713 #endif
714 int main(){nm_test_var='a';nm_test_func;return 0;}
715 EOF
716
717   if AC_TRY_EVAL(ac_compile); then
718     # Now try to grab the symbols.
719     ac_nlist=conftest.nm
720   
721     if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
722
723       # Try sorting and uniquifying the output.
724       if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
725         mv -f "$ac_nlist"T "$ac_nlist"
726       else
727         rm -f "$ac_nlist"T
728       fi
729
730       # Make sure that we snagged all the symbols we need.
731       if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
732         if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
733           cat <<EOF > conftest.c
734 #ifdef __cplusplus
735 extern "C" {
736 #endif
737
738 EOF
739           # Now generate the symbol file.
740           eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
741
742           cat <<EOF >> conftest.c
743 #if defined (__STDC__) && __STDC__
744 # define lt_ptr_t void *
745 #else
746 # define lt_ptr_t char *
747 # define const
748 #endif
749
750 /* The mapping between symbol names and symbols. */
751 const struct {
752   const char *name;
753   lt_ptr_t address;
754 }
755 changequote(,)dnl
756 lt_preloaded_symbols[] =
757 changequote([,])dnl
758 {
759 EOF
760         sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
761         cat <<\EOF >> conftest.c
762   {0, (lt_ptr_t) 0}
763 };
764
765 #ifdef __cplusplus
766 }
767 #endif
768 EOF
769           # Now try linking the two files.
770           mv conftest.$ac_objext conftestm.$ac_objext
771           ac_save_LIBS="$LIBS"
772           ac_save_CFLAGS="$CFLAGS"
773           LIBS="conftestm.$ac_objext"
774           CFLAGS="$CFLAGS$no_builtin_flag"
775           if AC_TRY_EVAL(ac_link) && test -s conftest; then
776             ac_pipe_works=yes
777           else
778             echo "configure: failed program was:" >&AC_FD_CC
779             cat conftest.c >&AC_FD_CC
780           fi
781           LIBS="$ac_save_LIBS"
782           CFLAGS="$ac_save_CFLAGS"
783         else
784           echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
785         fi
786       else
787         echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
788       fi
789     else
790       echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
791     fi
792   else
793     echo "$progname: failed program was:" >&AC_FD_CC
794     cat conftest.c >&AC_FD_CC
795   fi
796   rm -rf conftest*
797
798   # Do not use the global_symbol_pipe unless it works.
799   if test "$ac_pipe_works" = yes; then
800     if test x"$ac_symprfx" = x"_"; then
801       ac_cv_sys_symbol_underscore=yes
802     else
803       ac_cv_sys_symbol_underscore=no
804     fi
805     break
806   else
807     ac_cv_sys_global_symbol_pipe=
808   fi
809 done
810 ])
811
812 ac_result=yes
813 if test -z "$ac_cv_sys_global_symbol_pipe"; then
814    ac_result=no
815 fi
816 AC_MSG_RESULT($ac_result)
817 ])
818
819 # AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
820 AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
821 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
822 AC_CHECK_TOOL(AS, as, false)
823 ])
824
825 # AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
826 #                            with an underscore?
827 AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
828 [AC_REQUIRE([AC_PROG_NM])dnl
829 AC_REQUIRE([AC_SYS_NM_PARSE])dnl
830 AC_MSG_CHECKING([for _ prefix in compiled symbols])
831 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
832 [ac_cv_sys_symbol_underscore=no
833 cat > conftest.$ac_ext <<EOF
834 void nm_test_func(){}
835 int main(){nm_test_func;return 0;}
836 EOF
837 if AC_TRY_EVAL(ac_compile); then
838   # Now try to grab the symbols.
839   ac_nlist=conftest.nm
840   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
841     # See whether the symbols have a leading underscore.
842     if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
843       ac_cv_sys_symbol_underscore=yes
844     else
845       if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
846         :
847       else
848         echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
849       fi
850     fi
851   else
852     echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
853   fi
854 else
855   echo "configure: failed program was:" >&AC_FD_CC
856   cat conftest.c >&AC_FD_CC
857 fi
858 rm -rf conftest*
859 ])
860 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
861 USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
862 AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
863 ])
864
865 # AC_CHECK_LIBM - check for math library
866 AC_DEFUN(AC_CHECK_LIBM, [
867 AC_CHECK_LIB(mw, _mwvalidcheckl)
868 AC_CHECK_LIB(m, cos)
869 ])
870
871 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
872 # the libltdl convenience library, adds --enable-ltdl-convenience to
873 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
874 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
875 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
876 # '${top_builddir}/' (note the single quotes!) if your package is not
877 # flat, and, if you're not using automake, define top_builddir as
878 # appropriate in the Makefiles.
879 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [
880   case "$enable_ltdl_convenience" in
881   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
882   "") enable_ltdl_convenience=yes
883       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
884   esac
885   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
886 ])
887
888 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
889 # the libltdl installable library, and adds --enable-ltdl-install to
890 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
891 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
892 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
893 # '${top_builddir}/' (note the single quotes!) if your package is not
894 # flat, and, if you're not using automake, define top_builddir as
895 # appropriate in the Makefiles.
896 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
897 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [
898   AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
899     case "$enable_ltdl_install" in
900     no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
901     "") enable_ltdl_install=yes
902         ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
903     esac
904   ])
905   if test x"$enable_ltdl_install" != x"no"; then
906     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
907   fi
908 ])
909
910 dnl old names
911 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
912 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
913 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
914 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
915 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
916 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
917 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
918 AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
919 AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
920 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])dnl
921