OSDN Git Service

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