This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

4.0.2/4.1 PATCH: Support LP64 targets without <stdint.h> in libgfortran


The following trivial patch fixes the last problem in PR libfortran/15234,
where there's no definition of int32_t etc. in any system header.

This allows libgfortran to build on alpha-dec-osf4.0f (but all execution
tests still fail since the platform lacks scalbn which is used
unconditionally).

Bootstrapped on alpha-dec-osf4.0f, ok for mainline and the 4.0 branch once
it reopens?

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University


Wed Nov 24 17:15:47 2004  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	PR libfortran/15234
	* acinclude.m4 (LIBGFOR_TARGET_LP64): New check.
	* configure.ac: Include LIBGFOR_TARGET_LP64.
	* configure: Regenerate.
	* config.h.in: Likewise.
	* libgfortran.h: Provide default definitions for C99 types
	on LP64 targets that don't have them.

Index: libgfortran/acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/acinclude.m4,v
retrieving revision 1.5
diff -u -p -r1.5 acinclude.m4
--- libgfortran/acinclude.m4	12 Dec 2004 08:59:01 -0000	1.5
+++ libgfortran/acinclude.m4	6 Jun 2005 14:27:23 -0000
@@ -103,6 +103,26 @@ else
   fi
   ])
 
+dnl Check whether the target is LP64.
+AC_DEFUN([LIBGFOR_TARGET_LP64], [
+  AC_CACHE_CHECK([whether the target is LP64], target_lp64, [
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="-O2"
+  AC_TRY_LINK(,[
+if (sizeof(int) == 4 && sizeof(long) == 8 && sizeof(void *) == 8)
+  ;
+else
+  undefined_function ();
+               ],
+               target_lp64=yes,
+               target_lp64=no)
+  CFLAGS="$save_CFLAGS"])
+  if test $target_lp64 = yes; then
+    AC_DEFINE(TARGET_LP64, 1,
+      [Define to 1 if the target is LP64.])
+  fi
+  ])
+
 dnl Check whether the target supports hidden visibility.
 AC_DEFUN([LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY], [
   AC_CACHE_CHECK([whether the target supports hidden visibility],
Index: libgfortran/configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/configure.ac,v
retrieving revision 1.27
diff -u -p -r1.27 configure.ac
--- libgfortran/configure.ac	21 May 2005 06:44:50 -0000	1.27
+++ libgfortran/configure.ac	6 Jun 2005 14:27:25 -0000
@@ -247,6 +247,7 @@ LIBGFOR_GETTIMEOFDAY
 # Attempt to assert that the target is of common type in case we don't
 # have C99 integer types at all.
 LIBGFOR_TARGET_ILP32
+LIBGFOR_TARGET_LP64
 
 # Check out attribute support.
 LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
Index: libgfortran/libgfortran.h
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/libgfortran.h,v
retrieving revision 1.24
diff -u -p -r1.24 libgfortran.h
--- libgfortran/libgfortran.h	30 Apr 2005 20:51:29 -0000	1.24
+++ libgfortran/libgfortran.h	6 Jun 2005 14:27:25 -0000
@@ -59,16 +59,23 @@ Boston, MA 02111-1307, USA.  */
 #include <inttypes.h>
 #endif
 
-#if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && defined(TARGET_ILP32)
+#if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && \
+  (defined(TARGET_ILP32) || defined(TARGET_LP64))
 typedef char int8_t;
 typedef short int16_t;
 typedef int int32_t;
-typedef long long int64_t;
 typedef unsigned char uint8_t;
 typedef unsigned short uint16_t;
 typedef unsigned int uint32_t;
+#ifdef TARGET_ILP32
+typedef long long int64_t;
 typedef unsigned long long uint64_t;
 #endif
+#ifdef TARGET_LP64
+typedef long int64_t;
+typedef unsigned long uint64_t;
+#endif
+#endif
 
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]