[m-dev.] diff: fix problem with <inttypes.h> on Solaris

Fergus Henderson fjh at cs.mu.OZ.AU
Mon May 24 18:39:55 AEST 1999


Estimated hours taken: 0.75

Fix a problem on Solaris: Solaris has <inttypes.h> and #includes that
file from <sys/types.h>, which conflicted with our definitions of intptr_t
etc. in runtime/mercury_types.h.  The solution is to check for <inttypes.h>
not just <stdint.h> and to use <inttypes.h> if it is available rather than
defining the types ourselves.

configure.in:
	Check for inttypes.h.

runtime/mercury_conf.h.in:
	Define HAVE_INTTYPES.

runtime/mercury_types.h:
	If HAVE_INTTYPES is defined, use <inttypes.h>.

Workspace: /home/mercury0/fjh/mercury-other
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.169
diff -u -r1.169 configure.in
--- configure.in	1999/05/22 03:40:37	1.169
+++ configure.in	1999/05/24 08:30:53
@@ -666,6 +666,15 @@
 AC_CHECK_HEADER(stdint.h, HAVE_STDINT_H=1)
 if test "$HAVE_STDINT_H" = 1; then
 	AC_DEFINE(HAVE_STDINT)
+fi
+
+AC_CHECK_HEADER(inttypes.h, HAVE_INTTYPES_H=1)
+if test "$HAVE_INTTYPES_H" = 1; then
+	AC_DEFINE(HAVE_INTTYPES)
+fi
+
+if test "$HAVE_STDINT_H" = 1 || test "$HAVE_INTTYPES_H" = 1; then
+	true
 else
 #-----------------------------------------------------------------------------#
 	AC_MSG_CHECKING(for an integer type with the same size as a pointer)
@@ -797,7 +806,7 @@
 	AC_DEFINE_UNQUOTED(MR_INT_LEAST16_TYPE, $mercury_cv_int_least16_type)
 	MR_INT_LEAST16_TYPE=$mercury_cv_int_least16_type
 	AC_SUBST(MR_INT_LEAST16_TYPE)
-fi # ! HAVE_STDINT_H = 1
+fi # ! (HAVE_STDINT_H || HAVE_INTTYPES_H)
 #-----------------------------------------------------------------------------#
 AC_MSG_CHECKING(the number of low tag bits available)
 AC_CACHE_VAL(mercury_cv_low_tag_bits,
Index: runtime/mercury_conf.h.in
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf.h.in,v
retrieving revision 1.19
diff -u -r1.19 mercury_conf.h.in
--- mercury_conf.h.in	1999/05/13 08:08:38	1.19
+++ mercury_conf.h.in	1999/05/24 08:32:26
@@ -92,6 +92,7 @@
 **	HAVE_SYS_WAIT		we have <sys/wait.h>
 **	HAVE_DLFCN_H		we have <dlfcn.h>
 **	HAVE_STDINT		we have <stdint.h>
+**	HAVE_INTTYPES		we have <inttypes.h>
 */
 #undef	HAVE_SYS_SIGINFO
 #undef	HAVE_UCONTEXT
@@ -102,6 +103,7 @@
 #undef	HAVE_SYS_WAIT
 #undef	HAVE_DLFCN_H
 #undef	HAVE_STDINT    
+#undef	HAVE_INTTYPES
 
 /*
 ** The following macros are defined iff the corresponding function or
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.15
diff -u -r1.15 mercury_types.h
--- mercury_types.h	1999/04/30 06:21:27	1.15
+++ mercury_types.h	1999/05/24 08:37:30
@@ -26,8 +26,10 @@
 ** this is ensured by the autoconfiguration script.
 */
 
-#ifdef	HAVE_STDINT
+#if defined(HAVE_STDINT)
   #include <stdint.h>
+#elif defined(HAVE_INTTYPES)
+  #include <inttypes.h>
 #else
   typedef unsigned MR_WORD_TYPE		uintptr_t;
   typedef MR_WORD_TYPE			intptr_t;

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list