[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`-belf' test
From: |
Golubev I. N. |
Subject: |
`-belf' test |
Date: |
Sat, 30 Jun 2001 17:21:24 (GMT) |
Version: 1.4
It is just a fore- port of patch in <address@hidden> to
libtool-1.4 and autoconf-2.50.
Unnecessary `-belf' passed to compiler always causes warnings and
sometimes causes badly- reproducible wrong code generation. The patch
tries to avoid this.
It still assumes that, regardless of whether our target is native or
cross, our `file' program recognizes ELF files. I do not know more
portable way to check that we have created an ELF object. E. g.,
`head -c 4' is not as portable as `tail +16c' (otherwise we could just
`echo' right magic and `cmp' it with beginning of the object).
--- libtool.m4 2001/06/14 14:10:54 1.5
+++ libtool.m4 2001/06/30 17:03:20 1.7
@@ -99,16 +99,24 @@
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
- [AC_LANG_SAVE
- AC_LANG_C
- AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
- AC_LANG_RESTORE])
- if test x"$lt_cv_cc_needs_belf" != x"yes"; then
- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+[ AC_LIBTOOL_SCO5_ELF
+ if test x"$lt_have_elf_compiler" != xyes; then
+ dnl to prevent adding -belf twice
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_LIBTOOL_SCO5_ELF
+ if test x"$lt_have_elf_compiler" != xyes; then
+ lt_cv_cc_needs_belf=yes
+ else
+ AC_MSG_ERROR([can not make your compiler ($CC $SAVE_CFLAGS $LDFLAGS)
generate full-featured ELF objects])
+ fi
CFLAGS="$SAVE_CFLAGS"
+ else
+ lt_cv_cc_needs_belf=no
+ fi])
+ if test x"$lt_cv_cc_needs_belf" = yes; then
+ CFLAGS="$CFLAGS -belf"
fi
;;
@@ -3422,6 +3430,24 @@
LIBLTDL="-lltdl"
INCLTDL=
fi
+])
+dnl checks that current compiler setup generates ELF objects
+AC_DEFUN(AC_LIBTOOL_SCO5_ELF, [dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+lt_have_elf_compiler=no
+cat > conftest.$ac_ext <<EOF
+[#]line __oline__ "configure"
+struct dummy;
+EOF
+if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then
+ if file conftest.o|fgrep ELF>/dev/null; then
+ lt_have_elf_compiler=yes
+ fi
+else
+ echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
+fi
+rm -f conftest*
])
# old names
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- `-belf' test,
Golubev I. N. <=