Commit | Line | Data |
---|---|---|
5e377ed2 ILT |
1 | sinclude(acmacros.m4) |
2 | ||
3 | dnl This is a copy of AM_PROG_LIBTOOL from libtool 1.0, modified to | |
4 | dnl not produce a shared library by default. | |
5 | AC_DEFUN(AM_PROG_LIBTOOL, | |
6 | [AC_REQUIRE([AC_CANONICAL_HOST]) | |
7 | AC_REQUIRE([AC_PROG_CC]) | |
8 | AC_REQUIRE([AC_PROG_RANLIB]) | |
9 | AC_REQUIRE([AM_PROG_LD]) | |
10 | AC_REQUIRE([AC_PROG_LN_S]) | |
11 | ||
12 | # Always use our own libtool. | |
13 | LIBTOOL='$(top_builddir)/libtool' | |
14 | AC_SUBST(LIBTOOL) | |
15 | ||
16 | dnl Allow the --disable-shared flag to stop us from building shared libs. | |
17 | AC_ARG_ENABLE(shared, | |
18 | [ --enable-shared build shared libraries [default=yes]], | |
19 | test "$enableval" = no && libtool_shared=" --disable-shared", | |
20 | libtool_shared=--disable-shared) | |
21 | ||
22 | dnl Allow the --disable-static flag to stop us from building static libs. | |
23 | AC_ARG_ENABLE(static, | |
24 | [ --enable-static build static libraries [default=yes]], | |
25 | test "$enableval" = no && libtool_static=" --disable-static", | |
26 | libtool_static=) | |
27 | ||
28 | libtool_flags="$libtool_shared$libtool_static" | |
29 | test "$silent" = yes && libtool_flags="$libtool_flags --silent" | |
30 | test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" | |
31 | test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" | |
32 | ||
33 | # Some flags need to be propagated to the compiler or linker for good | |
34 | # libtool support. | |
35 | [case "$host" in | |
36 | *-*-irix6*) | |
37 | for f in '-32' '-64' '-cckr' '-n32' '-mips1' '-mips2' '-mips3' '-mips4'; do | |
38 | if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then | |
39 | LD="${LD-ld} $f" | |
40 | fi | |
41 | done | |
42 | ;; | |
43 | ||
44 | *-*-sco3.2v5*) | |
45 | # On SCO OpenServer 5, we need -belf to get full-featured binaries. | |
46 | CFLAGS="$CFLAGS -belf" | |
47 | ;; | |
48 | esac] | |
49 | ||
50 | # Actually configure libtool. ac_aux_dir is where install-sh is found. | |
51 | CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ | |
52 | LD="$LD" RANLIB="$RANLIB" LN_S="$LN_S" \ | |
53 | ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ | |
54 | $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ | |
55 | || AC_MSG_ERROR([libtool configure failed]) | |
56 | ]) | |
57 | ||
58 | # AM_PROG_LD - find the path to the GNU or non-GNU linker | |
59 | AC_DEFUN(AM_PROG_LD, | |
60 | [AC_ARG_WITH(gnu-ld, | |
61 | [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], | |
62 | test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) | |
63 | if test "$with_gnu_ld" = yes; then | |
64 | AC_MSG_CHECKING([for GNU ld]) | |
65 | else | |
66 | AC_MSG_CHECKING([for non-GNU ld]) | |
c0734708 | 67 | fi |
5e377ed2 ILT |
68 | AC_CACHE_VAL(ac_cv_path_LD, |
69 | [case "$LD" in | |
70 | /*) | |
71 | ac_cv_path_LD="$LD" # Let the user override the test with a path. | |
72 | ;; | |
73 | *) | |
74 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
75 | for ac_dir in $PATH; do | |
76 | test -z "$ac_dir" && ac_dir=. | |
77 | if test -f "$ac_dir/ld"; then | |
78 | ac_cv_path_LD="$ac_dir/ld" | |
79 | # Check to see if the program is GNU ld. I'd rather use --version, | |
80 | # but apparently some GNU ld's only accept -v. | |
81 | # Break only if it was the GNU/non-GNU ld that we prefer. | |
82 | if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then | |
83 | test "$with_gnu_ld" = yes && break | |
84 | else | |
85 | test "$with_gnu_ld" != yes && break | |
86 | fi | |
87 | fi | |
88 | done | |
89 | IFS="$ac_save_ifs" | |
90 | ;; | |
91 | esac]) | |
92 | LD="$ac_cv_path_LD" | |
93 | if test -n "$LD"; then | |
94 | AC_MSG_RESULT($LD) | |
95 | else | |
96 | AC_MSG_RESULT(no) | |
c0734708 | 97 | fi |
5e377ed2 ILT |
98 | test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) |
99 | AC_SUBST(LD) | |
100 | AM_PROG_LD_GNU | |
101 | ]) | |
102 | ||
103 | AC_DEFUN(AM_PROG_LD_GNU, | |
104 | [AC_CACHE_CHECK([whether we are using GNU ld], ac_cv_prog_gnu_ld, | |
105 | [# I'd rather use --version here, but apparently some GNU ld's only accept -v. | |
106 | if $LD -v 2>&1 </dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then | |
107 | ac_cv_prog_gnu_ld=yes | |
108 | else | |
109 | ac_cv_prog_gnu_ld=no | |
110 | fi]) | |
111 | ]) |