OSDN Git Service

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