autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AC_FUNC_MMAP on 64-bit Sun with Sun's C++ compiler


From: Bill Clarke
Subject: AC_FUNC_MMAP on 64-bit Sun with Sun's C++ compiler
Date: Fri, 04 Jul 2003 14:39:49 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030507

Sun's recent C++ compilers will not allow a cast from a pointer (e.g.,
char *) to an int when compiling for 64-bit architecture.  This means
that AC_FUNC_MMAP fails, since it has a cast from char* to an integer.
The fix is to cast to long instead; I think this is even more portable
than was the case, since long is more usually the same size as pointer.
With this patch, AC_FUNC_MMAP now correctly determines that mmap works
with Sun's C++ when compiling for 64-bit arch.

(apologies if mozilla wraps the patch, but it is trivial)

cheers,
/lib

Index: lib/autoconf/functions.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/functions.m4,v
retrieving revision 1.78
diff -u -r1.78 functions.m4
--- lib/autoconf/functions.m4   28 May 2003 20:03:53 -0000      1.78
+++ lib/autoconf/functions.m4   4 Jul 2003 04:25:05 -0000
@@ -1227,7 +1227,7 @@
   data2 = (char *) malloc (2 * pagesize);
   if (!data2)
     exit (1);
-  data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+  data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
   if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
                     MAP_PRIVATE | MAP_FIXED, fd, 0L))
     exit (1);


-- 
/lib BillClarke PostdoctoralFellow CompSci ANU cs.anu.edu.au/CC-NUMA
http://llib.cjb.net address@hidden  tel:+61-2-6125x5687 fax:x0010
PGPid:B381EE7DB7D3E58F17248C672E2DA124ADADF444 GNU unix LaTeX XPilot
Buffy DrWho Goodies StarTrek XFiles Origami SML SMP MPI mozilla tcsh
Asimov Bear Clarke Donaldson Volleyball Ultimate Cricket emacs C++ X
Jordan Kay Lackey Martin Stasheff DeepPurple H&C KLF Queen PinkFloyd

Attachment: pgpuUlY87jlxt.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]