]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acspecific.m4 (AC_FUNC_MMAP, AC_FUNC_ALLOCA): Make them C++
authorAkim Demaille <akim@epita.fr>
Wed, 8 Mar 2000 16:44:55 +0000 (16:44 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 8 Mar 2000 16:44:55 +0000 (16:44 +0000)
safe: include the right headers, cast the allocations etc.

ChangeLog
acspecific.m4
lib/autoconf/specific.m4

index 324d30a9616c98b6e11a1f1464afc32063abdbd6..814bb5cfd5f897776d6561157a46582eeb53d0b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-03-08   Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+       * acspecific.m4 (AC_FUNC_MMAP, AC_FUNC_ALLOCA): Make them C++
+       safe: include the right headers, cast the allocations etc.
+
 2000-03-08  Akim Demaille  <akim@epita.fr>
 
        The argument of AC_COPYRIGHT should be plain text, not an sh
index e6fe11a42e5739781911436420015713ddd8672e..de2e1f9b6b843836899f5134c66f1d861af963f7 100644 (file)
@@ -1265,7 +1265,8 @@ AC_DEFUN(AC_FUNC_ALLOCA,
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h,
-[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
+[AC_TRY_LINK([#include <alloca.h>],
+  [char *p = (char *) alloca (2 * sizeof (int));],
   ac_cv_working_alloca_h=yes, ac_cv_working_alloca_h=no)])
 if test $ac_cv_working_alloca_h = yes; then
   AC_DEFINE(HAVE_ALLOCA_H, 1,
@@ -1768,7 +1769,7 @@ fi
 # AC_FUNC_MMAP
 # ------------
 AC_DEFUN(AC_FUNC_MMAP,
-[AC_CHECK_HEADERS(unistd.h)
+[AC_CHECK_HEADERS(stdlib.h unistd.h sys/stat.h)
 AC_CHECK_FUNCS(getpagesize)
 AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 [AC_TRY_RUN(
@@ -1797,12 +1798,20 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 #include <fcntl.h>
 #include <sys/mman.h>
 
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
 /* This mess was copied from the GNU getpagesize.h.  */
 #if !HAVE_GETPAGESIZE
-# if HAVE_UNISTD_H
-#  include <unistd.h>
-# endif
-
 /* Assume that all systems that can run configure have sys/param.h.  */
 # if !HAVE_SYS_PARAM_H
 #  define HAVE_SYS_PARAM_H 1
@@ -1838,12 +1847,6 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 
 #endif /* no HAVE_GETPAGESIZE */
 
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
 int
 main ()
 {
@@ -1854,7 +1857,7 @@ main ()
   pagesize = getpagesize ();
 
   /* First, make a file with some known garbage in it. */
-  data = malloc (pagesize);
+  data = (char *) malloc (pagesize);
   if (!data)
     exit (1);
   for (i = 0; i < pagesize; ++i)
@@ -1873,7 +1876,7 @@ main ()
   fd = open ("conftestmmap", O_RDWR);
   if (fd < 0)
     exit (1);
-  data2 = malloc (2 * pagesize);
+  data2 = (char *) malloc (2 * pagesize);
   if (!data2)
     exit (1);
   data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
@@ -1889,7 +1892,7 @@ main ()
      some variants of i386 svr4.0.)  */
   for (i = 0; i < pagesize; ++i)
     *(data2 + i) = *(data2 + i) + 1;
-  data3 = malloc (pagesize);
+  data3 = (char *) malloc (pagesize);
   if (!data3)
     exit (1);
   if (read (fd, data3, pagesize) != pagesize)
index e6fe11a42e5739781911436420015713ddd8672e..de2e1f9b6b843836899f5134c66f1d861af963f7 100644 (file)
@@ -1265,7 +1265,8 @@ AC_DEFUN(AC_FUNC_ALLOCA,
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h,
-[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
+[AC_TRY_LINK([#include <alloca.h>],
+  [char *p = (char *) alloca (2 * sizeof (int));],
   ac_cv_working_alloca_h=yes, ac_cv_working_alloca_h=no)])
 if test $ac_cv_working_alloca_h = yes; then
   AC_DEFINE(HAVE_ALLOCA_H, 1,
@@ -1768,7 +1769,7 @@ fi
 # AC_FUNC_MMAP
 # ------------
 AC_DEFUN(AC_FUNC_MMAP,
-[AC_CHECK_HEADERS(unistd.h)
+[AC_CHECK_HEADERS(stdlib.h unistd.h sys/stat.h)
 AC_CHECK_FUNCS(getpagesize)
 AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 [AC_TRY_RUN(
@@ -1797,12 +1798,20 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 #include <fcntl.h>
 #include <sys/mman.h>
 
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
 /* This mess was copied from the GNU getpagesize.h.  */
 #if !HAVE_GETPAGESIZE
-# if HAVE_UNISTD_H
-#  include <unistd.h>
-# endif
-
 /* Assume that all systems that can run configure have sys/param.h.  */
 # if !HAVE_SYS_PARAM_H
 #  define HAVE_SYS_PARAM_H 1
@@ -1838,12 +1847,6 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 
 #endif /* no HAVE_GETPAGESIZE */
 
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
 int
 main ()
 {
@@ -1854,7 +1857,7 @@ main ()
   pagesize = getpagesize ();
 
   /* First, make a file with some known garbage in it. */
-  data = malloc (pagesize);
+  data = (char *) malloc (pagesize);
   if (!data)
     exit (1);
   for (i = 0; i < pagesize; ++i)
@@ -1873,7 +1876,7 @@ main ()
   fd = open ("conftestmmap", O_RDWR);
   if (fd < 0)
     exit (1);
-  data2 = malloc (2 * pagesize);
+  data2 = (char *) malloc (2 * pagesize);
   if (!data2)
     exit (1);
   data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
@@ -1889,7 +1892,7 @@ main ()
      some variants of i386 svr4.0.)  */
   for (i = 0; i < pagesize; ++i)
     *(data2 + i) = *(data2 + i) + 1;
-  data3 = malloc (pagesize);
+  data3 = (char *) malloc (pagesize);
   if (!data3)
     exit (1);
   if (read (fd, data3, pagesize) != pagesize)