OSDN Git Service

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