OSDN Git Service

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