Am Fri, 03 Mar 2000 schrieb Akim Demaille: >>>>>> "Franz" == Franz Sirl <[EMAIL PROTECTED]> writes: > >Franz> If you tell me how to do it right and platform-independent, I >Franz> will happily come up with another patch. > >Just look for the right header on a sane system, and include it under >the condition HAVE_foo_H. It is better to AC_CHECK_HEADER beforehand. > >AC_FUNC_MKTIME is a good tutorial. OK, how about this one? Franz. * acspecific.m4 (AC_FUNC_MMAP): Make it c++ safe. (AC_FUNC_ALLOCA): Likewise.
? diff ? diff2 Index: acspecific.m4 =================================================================== RCS file: /cvs/autoconf/acspecific.m4,v retrieving revision 1.231 diff -u -p -r1.231 acspecific.m4 --- acspecific.m4 2000/03/03 14:25:03 1.231 +++ acspecific.m4 2000/03/05 20:15:01 @@ -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( @@ -1839,9 +1840,17 @@ AC_CACHE_CHECK(for working mmap, ac_cv_f #endif /* no HAVE_GETPAGESIZE */ #ifdef __cplusplus -extern "C" { void *malloc(unsigned); } +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif +# ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +# endif #else -char *malloc(); +char *malloc (); #endif int @@ -1854,7 +1863,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 +1882,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 +1898,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)