@@ -1,7 +1,7 @@ dnl -*- Autoconf -*- -dnl Copyright (C) 1993-2009 Free Software Foundation, Inc. +dnl Copyright (C) 1993-2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. @@ -9,16 +9,17 @@ dnl From Bruno Haible, Marcus Daniels, Sam Steingold. AC_PREREQ(2.57) AC_DEFUN([CL_MMAP], -[AC_BEFORE([$0], [CL_MUNMAP])AC_BEFORE([$0], [CL_MPROTECT]) +[AC_REQUIRE([CL_OPENFLAGS])dnl +AC_BEFORE([$0], [CL_MUNMAP])AC_BEFORE([$0], [CL_MPROTECT]) AC_CHECK_HEADER(sys/mman.h, , no_mmap=1)dnl if test -z "$no_mmap"; then AC_CHECK_FUNC(mmap, , no_mmap=1)dnl if test -z "$no_mmap"; then -AC_DEFINE([HAVE_MMAP],[],[have and the mmap() function]) +AC_DEFINE(HAVE_MMAP,,[have and the mmap() function]) AC_CACHE_CHECK(for working mmap, cl_cv_func_mmap_works, [ case "$host" in i[34567]86-*-sysv4*) # UNIX_SYSV_UHC_1 avoid=0x08000000 ;; @@ -35,10 +36,13 @@ #include #ifdef HAVE_UNISTD_H #include #endif #include +#ifdef OPEN_NEEDS_SYS_FILE_H +#include +#endif #include #include int main () { ' mmap_prog_2="#define bits_to_avoid $avoid"' @@ -71,55 +75,51 @@ for (i=my_low; i<=my_high; i++) if (i_ok(i)) { x(i) = y(i); } for (i=my_high; i>=my_low; i--) if (i_ok(i)) { if (x(i) != y(i)) exit(1); } exit(0); }} ' -AC_TRY_RUN(GL_NOCRASH[$mmap_prog_1 +AC_TRY_RUN([$mmap_prog_1 int flags = MAP_ANON | MAP_PRIVATE; int fd = -1; - nocrash_init(); $mmap_prog_2 ], have_mmap_anon=1 -cl_cv_func_mmap_anon=yes, , +cl_cv_func_mmap_anon=yes, rm -f core, : # When cross-compiling, don't assume anything. ) -AC_TRY_RUN(GL_NOCRASH[$mmap_prog_1 +AC_TRY_RUN([$mmap_prog_1 int flags = MAP_ANONYMOUS | MAP_PRIVATE; int fd = -1; - nocrash_init(); $mmap_prog_2 ], have_mmap_anon=1 -cl_cv_func_mmap_anonymous=yes, , +cl_cv_func_mmap_anonymous=yes, rm -f core, : # When cross-compiling, don't assume anything. ) -AC_TRY_RUN(GL_NOCRASH[$mmap_prog_1 +AC_TRY_RUN([$mmap_prog_1 #ifndef MAP_FILE #define MAP_FILE 0 #endif int flags = MAP_FILE | MAP_PRIVATE; int fd = open("/dev/zero",O_RDONLY,0666); if (fd<0) exit(1); - nocrash_init(); $mmap_prog_2 ], have_mmap_devzero=1 -cl_cv_func_mmap_devzero=yes, +cl_cv_func_mmap_devzero=yes, rm -f core retry_mmap=1, : # When cross-compiling, don't assume anything. ) if test -n "$retry_mmap"; then -AC_TRY_RUN(GL_NOCRASH[#define FOR_SUN4_29 +AC_TRY_RUN([#define FOR_SUN4_29 $mmap_prog_1 #ifndef MAP_FILE #define MAP_FILE 0 #endif int flags = MAP_FILE | MAP_PRIVATE; int fd = open("/dev/zero",O_RDONLY,0666); if (fd<0) exit(1); - nocrash_init(); $mmap_prog_2 ], have_mmap_devzero=1 -cl_cv_func_mmap_devzero_sun4_29=yes, , +cl_cv_func_mmap_devzero_sun4_29=yes, rm -f core, : # When cross-compiling, don't assume anything. ) fi if test -n "$have_mmap_anon" -o -n "$have_mmap_devzero"; then cl_cv_func_mmap_works=yes @@ -126,19 +126,19 @@ else cl_cv_func_mmap_works=no fi ]) if test "$cl_cv_func_mmap_anon" = yes; then -AC_DEFINE([HAVE_MMAP_ANON],[],[ defines MAP_ANON and mmaping with MAP_ANON works]) +AC_DEFINE(HAVE_MMAP_ANON,,[ defines MAP_ANON and mmaping with MAP_ANON works]) fi if test "$cl_cv_func_mmap_anonymous" = yes; then -AC_DEFINE([HAVE_MMAP_ANONYMOUS],[],[ defines MAP_ANONYMOUS and mmaping with MAP_ANONYMOUS works]) +AC_DEFINE(HAVE_MMAP_ANONYMOUS,,[ defines MAP_ANONYMOUS and mmaping with MAP_ANONYMOUS works]) fi if test "$cl_cv_func_mmap_devzero" = yes; then -AC_DEFINE([HAVE_MMAP_DEVZERO],[],[mmaping of the special device /dev/zero works]) +AC_DEFINE(HAVE_MMAP_DEVZERO,,[mmaping of the special device /dev/zero works]) fi if test "$cl_cv_func_mmap_devzero_sun4_29" = yes; then -AC_DEFINE([HAVE_MMAP_DEVZERO_SUN4_29],[],[mmaping of the special device /dev/zero works, but only on addresses < 2^29]) +AC_DEFINE(HAVE_MMAP_DEVZERO_SUN4_29,,[mmaping of the special device /dev/zero works, but only on addresses < 2^29]) fi fi fi ])