blob: 645bfd898f9d33d9f052354ddf149fa7e85df870 [file] [log] [blame]
mostang.com!davidm4ea5c422002-12-03 08:19:58 +00001AC_DEFUN([LIBUNWIND___THREAD],
2[dnl Check whether the compiler supports the __thread keyword.
3if test "x$use__thread" != xno; then
4 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
5 [cat > conftest.c <<\EOF
6 __thread int a = 42;
7EOF
8 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
9 libc_cv_gcc___thread=yes
10 else
11 libc_cv_gcc___thread=no
12 fi
13 rm -f conftest*])
14 if test "$libc_cv_gcc___thread" = yes; then
15 AC_DEFINE(HAVE___THREAD, 1,
16 [Define to 1 if __thread keyword is supported by the C compiler.])
17 fi
18else
19 libc_cv_gcc___thread=no
20fi])
21
22## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
23## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
24## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
25##
26## This program is free software; you can redistribute it and/or modify
27## it under the terms of the GNU General Public License as published by
28## the Free Software Foundation; either version 2 of the License, or
29## (at your option) any later version.
30##
31## This program is distributed in the hope that it will be useful, but
32## WITHOUT ANY WARRANTY; without even the implied warranty of
33## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34## General Public License for more details.
35##
36## You should have received a copy of the GNU General Public License
37## along with this program; if not, write to the Free Software
38## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
39##
40## As a special exception to the GNU General Public License, if you
41## distribute this file as part of a program that contains a
42## configuration script generated by Autoconf, you may include it under
43## the same distribution terms that you use for the rest of that program.
44
45# serial 40 AC_PROG_LIBTOOL
46AC_DEFUN(AC_PROG_LIBTOOL,
47[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
48
49# Save cache, so that ltconfig can load it
50AC_CACHE_SAVE
51
52# Actually configure libtool. ac_aux_dir is where install-sh is found.
53CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
54LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
55LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
56DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
57${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
58$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
59|| AC_MSG_ERROR([libtool configure failed])
60
61# Reload cache, that may have been modified by ltconfig
62AC_CACHE_LOAD
63
64# This can be used to rebuild libtool when needed
65LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
66
67# Always use our own libtool.
68LIBTOOL='$(SHELL) $(top_builddir)/libtool'
69AC_SUBST(LIBTOOL)dnl
70
71# Redirect the config.log output again, so that the ltconfig log is not
72# clobbered by the next message.
73exec 5>>./config.log
74])
75
76AC_DEFUN(AC_LIBTOOL_SETUP,
77[AC_PREREQ(2.13)dnl
78AC_REQUIRE([AC_ENABLE_SHARED])dnl
79AC_REQUIRE([AC_ENABLE_STATIC])dnl
80AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
81AC_REQUIRE([AC_CANONICAL_HOST])dnl
82AC_REQUIRE([AC_CANONICAL_BUILD])dnl
83AC_REQUIRE([AC_PROG_RANLIB])dnl
84AC_REQUIRE([AC_PROG_CC])dnl
85AC_REQUIRE([AC_PROG_LD])dnl
86AC_REQUIRE([AC_PROG_NM])dnl
87AC_REQUIRE([AC_PROG_LN_S])dnl
88dnl
89
90case "$target" in
91NONE) lt_target="$host" ;;
92*) lt_target="$target" ;;
93esac
94
95# Check for any special flags to pass to ltconfig.
96#
97# the following will cause an existing older ltconfig to fail, so
98# we ignore this at the expense of the cache file... Checking this
99# will just take longer ... bummer!
100#libtool_flags="--cache-file=$cache_file"
101#
102test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
103test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
104test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
105test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
106test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
107ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
108[libtool_flags="$libtool_flags --enable-dlopen"])
109ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
110[libtool_flags="$libtool_flags --enable-win32-dll"])
111AC_ARG_ENABLE(libtool-lock,
112 [ --disable-libtool-lock avoid locking (might break parallel builds)])
113test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
114test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
115
116# Some flags need to be propagated to the compiler or linker for good
117# libtool support.
118case "$lt_target" in
119*-*-irix6*)
120 # Find out which ABI we are using.
121 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
122 if AC_TRY_EVAL(ac_compile); then
123 case "`/usr/bin/file conftest.o`" in
124 *32-bit*)
125 LD="${LD-ld} -32"
126 ;;
127 *N32*)
128 LD="${LD-ld} -n32"
129 ;;
130 *64-bit*)
131 LD="${LD-ld} -64"
132 ;;
133 esac
134 fi
135 rm -rf conftest*
136 ;;
137
138*-*-sco3.2v5*)
139 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
140 SAVE_CFLAGS="$CFLAGS"
141 CFLAGS="$CFLAGS -belf"
142 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
143 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
144 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
145 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
146 CFLAGS="$SAVE_CFLAGS"
147 fi
148 ;;
149
150ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
151[*-*-cygwin* | *-*-mingw*)
152 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
153 AC_CHECK_TOOL(AS, as, false)
154 AC_CHECK_TOOL(OBJDUMP, objdump, false)
155 ;;
156])
157esac
158])
159
160# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
161AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
162
163# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
164AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
165
166# AC_ENABLE_SHARED - implement the --enable-shared flag
167# Usage: AC_ENABLE_SHARED[(DEFAULT)]
168# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
169# `yes'.
170AC_DEFUN(AC_ENABLE_SHARED, [dnl
171define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
172AC_ARG_ENABLE(shared,
173changequote(<<, >>)dnl
174<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
175changequote([, ])dnl
176[p=${PACKAGE-default}
177case "$enableval" in
178yes) enable_shared=yes ;;
179no) enable_shared=no ;;
180*)
181 enable_shared=no
182 # Look at the argument we got. We use all the common list separators.
183 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
184 for pkg in $enableval; do
185 if test "X$pkg" = "X$p"; then
186 enable_shared=yes
187 fi
188 done
189 IFS="$ac_save_ifs"
190 ;;
191esac],
192enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
193])
194
195# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
196AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
197AC_ENABLE_SHARED(no)])
198
199# AC_ENABLE_STATIC - implement the --enable-static flag
200# Usage: AC_ENABLE_STATIC[(DEFAULT)]
201# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
202# `yes'.
203AC_DEFUN(AC_ENABLE_STATIC, [dnl
204define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
205AC_ARG_ENABLE(static,
206changequote(<<, >>)dnl
207<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
208changequote([, ])dnl
209[p=${PACKAGE-default}
210case "$enableval" in
211yes) enable_static=yes ;;
212no) enable_static=no ;;
213*)
214 enable_static=no
215 # Look at the argument we got. We use all the common list separators.
216 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
217 for pkg in $enableval; do
218 if test "X$pkg" = "X$p"; then
219 enable_static=yes
220 fi
221 done
222 IFS="$ac_save_ifs"
223 ;;
224esac],
225enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
226])
227
228# AC_DISABLE_STATIC - set the default static flag to --disable-static
229AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
230AC_ENABLE_STATIC(no)])
231
232
233# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
234# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
235# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
236# `yes'.
237AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
238define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
239AC_ARG_ENABLE(fast-install,
240changequote(<<, >>)dnl
241<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
242changequote([, ])dnl
243[p=${PACKAGE-default}
244case "$enableval" in
245yes) enable_fast_install=yes ;;
246no) enable_fast_install=no ;;
247*)
248 enable_fast_install=no
249 # Look at the argument we got. We use all the common list separators.
250 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
251 for pkg in $enableval; do
252 if test "X$pkg" = "X$p"; then
253 enable_fast_install=yes
254 fi
255 done
256 IFS="$ac_save_ifs"
257 ;;
258esac],
259enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
260])
261
262# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
263AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
264AC_ENABLE_FAST_INSTALL(no)])
265
266# AC_PROG_LD - find the path to the GNU or non-GNU linker
267AC_DEFUN(AC_PROG_LD,
268[AC_ARG_WITH(gnu-ld,
269[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
270test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
271AC_REQUIRE([AC_PROG_CC])dnl
272AC_REQUIRE([AC_CANONICAL_HOST])dnl
273AC_REQUIRE([AC_CANONICAL_BUILD])dnl
274ac_prog=ld
275if test "$ac_cv_prog_gcc" = yes; then
276 # Check if gcc -print-prog-name=ld gives a path.
277 AC_MSG_CHECKING([for ld used by GCC])
278 ac_prog=`($CC -print-prog-name=ld) 2>&5`
279 case "$ac_prog" in
280 # Accept absolute paths.
281changequote(,)dnl
282 [\\/]* | [A-Za-z]:[\\/]*)
283 re_direlt='/[^/][^/]*/\.\./'
284changequote([,])dnl
285 # Canonicalize the path of ld
286 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
287 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
288 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
289 done
290 test -z "$LD" && LD="$ac_prog"
291 ;;
292 "")
293 # If it fails, then pretend we aren't using GCC.
294 ac_prog=ld
295 ;;
296 *)
297 # If it is relative, then search for the first ld in PATH.
298 with_gnu_ld=unknown
299 ;;
300 esac
301elif test "$with_gnu_ld" = yes; then
302 AC_MSG_CHECKING([for GNU ld])
303else
304 AC_MSG_CHECKING([for non-GNU ld])
305fi
306AC_CACHE_VAL(ac_cv_path_LD,
307[if test -z "$LD"; then
308 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
309 for ac_dir in $PATH; do
310 test -z "$ac_dir" && ac_dir=.
311 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
312 ac_cv_path_LD="$ac_dir/$ac_prog"
313 # Check to see if the program is GNU ld. I'd rather use --version,
314 # but apparently some GNU ld's only accept -v.
315 # Break only if it was the GNU/non-GNU ld that we prefer.
316 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
317 test "$with_gnu_ld" != no && break
318 else
319 test "$with_gnu_ld" != yes && break
320 fi
321 fi
322 done
323 IFS="$ac_save_ifs"
324else
325 ac_cv_path_LD="$LD" # Let the user override the test with a path.
326fi])
327LD="$ac_cv_path_LD"
328if test -n "$LD"; then
329 AC_MSG_RESULT($LD)
330else
331 AC_MSG_RESULT(no)
332fi
333test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
334AC_PROG_LD_GNU
335])
336
337AC_DEFUN(AC_PROG_LD_GNU,
338[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
339[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
340if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
341 ac_cv_prog_gnu_ld=yes
342else
343 ac_cv_prog_gnu_ld=no
344fi])
345])
346
347# AC_PROG_NM - find the path to a BSD-compatible name lister
348AC_DEFUN(AC_PROG_NM,
349[AC_MSG_CHECKING([for BSD-compatible nm])
350AC_CACHE_VAL(ac_cv_path_NM,
351[if test -n "$NM"; then
352 # Let the user override the test.
353 ac_cv_path_NM="$NM"
354else
355 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
356 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
357 test -z "$ac_dir" && ac_dir=.
358 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
359 # Check to see if the nm accepts a BSD-compat flag.
360 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
361 # nm: unknown option "B" ignored
362 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
363 ac_cv_path_NM="$ac_dir/nm -B"
364 break
365 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
366 ac_cv_path_NM="$ac_dir/nm -p"
367 break
368 else
369 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
370 continue # so that we can try to find one that supports BSD flags
371 fi
372 fi
373 done
374 IFS="$ac_save_ifs"
375 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
376fi])
377NM="$ac_cv_path_NM"
378AC_MSG_RESULT([$NM])
379])
380
381# AC_CHECK_LIBM - check for math library
382AC_DEFUN(AC_CHECK_LIBM,
383[AC_REQUIRE([AC_CANONICAL_HOST])dnl
384LIBM=
385case "$lt_target" in
386*-*-beos* | *-*-cygwin*)
387 # These system don't have libm
388 ;;
389*-ncr-sysv4.3*)
390 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
391 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
392 ;;
393*)
394 AC_CHECK_LIB(m, main, LIBM="-lm")
395 ;;
396esac
397])
398
399# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
400# the libltdl convenience library and INCLTDL to the include flags for
401# the libltdl header and adds --enable-ltdl-convenience to the
402# configure arguments. Note that LIBLTDL and INCLTDL are not
403# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
404# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
405# with '${top_builddir}/' and INCLTDL will be prefixed with
406# '${top_srcdir}/' (note the single quotes!). If your package is not
407# flat and you're not using automake, define top_builddir and
408# top_srcdir appropriately in the Makefiles.
409AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
410 case "$enable_ltdl_convenience" in
411 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
412 "") enable_ltdl_convenience=yes
413 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
414 esac
415 LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
416 INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
417])
418
419# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
420# the libltdl installable library and INCLTDL to the include flags for
421# the libltdl header and adds --enable-ltdl-install to the configure
422# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
423# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
424# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
425# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
426# with '${top_srcdir}/' (note the single quotes!). If your package is
427# not flat and you're not using automake, define top_builddir and
428# top_srcdir appropriately in the Makefiles.
429# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
430AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
431 AC_CHECK_LIB(ltdl, main,
432 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
433 [if test x"$enable_ltdl_install" = xno; then
434 AC_MSG_WARN([libltdl not installed, but installation disabled])
435 else
436 enable_ltdl_install=yes
437 fi
438 ])
439 if test x"$enable_ltdl_install" = x"yes"; then
440 ac_configure_args="$ac_configure_args --enable-ltdl-install"
441 LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
442 INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
443 else
444 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
445 LIBLTDL="-lltdl"
446 INCLTDL=
447 fi
448])
449
450dnl old names
451AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
452AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
453AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
454AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
455AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
456AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
457AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
458
459dnl This is just to silence aclocal about the macro not being used
460ifelse([AC_DISABLE_FAST_INSTALL])dnl