This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: Auto detect HOST_64BIT_TYPE and HOST_U_64BIT_TYPE
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Thu, 18 Sep 2003 09:50:56 -0700
- Subject: PATCH: Auto detect HOST_64BIT_TYPE and HOST_U_64BIT_TYPE
There is no need to hard code HOST_64BIT_TYPE nor HOST_U_64BIT_TYPE. We
can auto detect them. Here is the patch.
H.J.
----
2003-09-18 H.J. Lu <hongjiu.lu@intel.com>
* acinclude.m4: Include ../config/accross.m4.
* aclocal.m4: Regenerated.
* configure.host (HOST_64BIT_TYPE): Remove if it is set to long
or long long.
(HOST_U_64BIT_TYPE): Remove if it is set to unsigned long long.
* configure.in (HOST_64BIT_TYPE): Set according to the size of
long and long long.
(HOST_U_64BIT_TYPE): Likewise.
* configure: Regenerated.
--- bfd/acinclude.m4.ll 2003-05-03 08:51:46.000000000 -0700
+++ bfd/acinclude.m4 2003-09-18 09:29:24.000000000 -0700
@@ -1,3 +1,5 @@
+sinclude(../config/accross.m4)
+
dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
AC_DEFUN(BFD_BINARY_FOPEN,
[AC_REQUIRE([AC_CANONICAL_SYSTEM])
--- bfd/configure.host.ll 2003-07-17 16:56:18.000000000 -0700
+++ bfd/configure.host 2003-09-18 09:16:20.000000000 -0700
@@ -19,22 +19,18 @@ HOST_U_64BIT_TYPE=
case "${host}" in
-alpha*-*-*) host64=true; HOST_64BIT_TYPE=long ;;
+alpha*-*-*) host64=true;;
hppa*64*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX;
- host64=true; HOST_64BIT_TYPE=long ;;
+ host64=true;;
hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;;
hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
-hppa*64*-*-linux*) host64=true; HOST_64BIT_TYPE=long ;;
+hppa*64*-*-linux*) host64=true;;
hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;;
hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
-ia64-*-linux*) host64=true; HOST_64BIT_TYPE=long ;;
-ia64-*-hpux*) host64=true
- HOST_64BIT_TYPE="long long";
- HOST_U_64BIT_TYPE="unsigned long long";
- ;;
+ia64-*-*) host64=true;;
i[3-7]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
i[3-7]86-sequent-sysv4*) ;;
@@ -45,28 +41,14 @@ mips*-*-openbsd*) ;;
mips*-dec-*) HDEFINES="-G 4" ;;
mips*-sgi-irix3*) HDEFINES="-G 4" ;;
mips*-sgi-irix4*) HDEFINES="-G 4" ;;
-mips*-sgi-irix6*) host64=true
- HOST_64BIT_TYPE="long long";
- HOST_U_64BIT_TYPE="unsigned long long";
- ;;
-mips64*-*-linux*) host64=true
- HOST_64BIT_TYPE="long long";
- HOST_U_64BIT_TYPE="unsigned long long";
- ;;
+mips*-sgi-irix6*) host64=true;;
+mips64*-*-linux*) host64=true;;
mips*-*-sysv4*) ;;
mips*-*-sysv*) HDEFINES="-G 4" ;;
mips*-*-riscos*) HDEFINES="-G 4" ;;
m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
-*-*-aix*) HOST_64BIT_TYPE="long long"
- HOST_U_64BIT_TYPE="unsigned long long"
- ;;
-
-*-*-solaris*) HOST_64BIT_TYPE="long long"
- HOST_U_64BIT_TYPE="unsigned long long"
- ;;
-
*-*-windows*)
HOST_64BIT_TYPE=__int64
HOST_U_64BIT_TYPE="unsigned __int64"
--- bfd/configure.in.ll 2003-09-16 09:26:06.000000000 -0700
+++ bfd/configure.in 2003-09-18 09:32:32.000000000 -0700
@@ -117,13 +117,6 @@ BFD_HOST_LONG_LONG=0
BFD_HOST_64_BIT_DEFINED=0
BFD_HOST_64_BIT=
BFD_HOST_U_64_BIT=
-if test "x${HOST_64BIT_TYPE}" = "xlong"; then
- BFD_HOST_64BIT_LONG=1
-elif test "x${HOST_64BIT_TYPE}" != "x"; then
- BFD_HOST_64_BIT_DEFINED=1
- BFD_HOST_64_BIT=${HOST_64BIT_TYPE}
- BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE}
-fi
AC_MSG_CHECKING([for long long])
AC_CACHE_VAL(bfd_cv_has_long_long,
@@ -133,6 +126,23 @@ bfd_cv_has_long_long=yes, bfd_cv_has_lon
AC_MSG_RESULT($bfd_cv_has_long_long)
if test $bfd_cv_has_long_long = yes; then
BFD_HOST_LONG_LONG=1
+ AC_COMPILE_CHECK_SIZEOF(long long)
+fi
+
+AC_COMPILE_CHECK_SIZEOF(long)
+if test "x${ac_cv_sizeof_long}" = "x8"; then
+ HOST_64BIT_TYPE="long"
+elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+ HOST_64BIT_TYPE="long long"
+ HOST_U_64BIT_TYPE="unsigned long long"
+fi
+
+if test "x${HOST_64BIT_TYPE}" = "xlong"; then
+ BFD_HOST_64BIT_LONG=1
+elif test "x${HOST_64BIT_TYPE}" != "x"; then
+ BFD_HOST_64_BIT_DEFINED=1
+ BFD_HOST_64_BIT=${HOST_64BIT_TYPE}
+ BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE}
fi
AC_SUBST(BFD_HOST_64BIT_LONG)