# AC_HAVE_HEADERS(string.h)
AC_CHECK_HEADERS(stdarg.h stddef.h stddef.h stdlib.h stdint.h malloc.h \
search.h getopt.h pthread.h values.h float.h limits.h termios.h \
- errno.h time.h sys/time.h sys/times.h sys/types.h unistd.h fenv.h \
- sys/select.h fpu_control.h sys/fpu.h strings.h sys/socket.h sys/stat.h)
+ errno.h time.h unistd.h fenv.h strings.h \
+ sys/time.h sys/times.h sys/types.h sys/select.h fpu_control.h \
+ sys/fpu.h strings.h sys/socket.h sys/stat.h sys/mman.h)
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_HEADER_STDBOOL
#include "render.h"
#include "agxbuf.h"
+#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
static void ps_freeimage_ps (usershape_t *us)
{
+#if HAVE_SYS_MMAN_H
munmap(us->data, us->datasize);
+#else
+ free(us->data);
+#endif
}
/* ps_usershape:
case FT_EPS:
fstat(fd, &statbuf);
us->datasize = statbuf.st_size;
+#if HAVE_SYS_MMAN_H
us->data = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
+#else
+ us->data = malloc(statbuf.st_size);
+ read(fd, us->data, statbuf.st_size);
+#endif
us->datafree = ps_freeimage_ps;
us->must_inline = true;
break;
#endif
#include <stdlib.h>
+#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
static void ps_freeimage(usershape_t *us)
{
+#if HAVE_SYS_MMAN_H
munmap(us->data, us->datasize);
+#else
+ free(us->data);
+#endif
}
/* usershape described by a postscript function */
case FT_EPS:
fstat(fd, &statbuf);
us->datasize = statbuf.st_size;
+#if HAVE_SYS_MMAN_H
us->data = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
+#else
+ us->data = malloc(statbuf.st_size);
+ read(fd, us->data, statbuf.st_size);
+#endif
us->must_inline = true;
break;
default: