source: trunk/src/gcc/boehm-gc/libtool.m4@ 1036

Last change on this file since 1036 was 2, checked in by bird, 22 years ago

Initial revision

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