home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / grep20.zip / configure.in < prev    next >
Text File  |  1993-05-22  |  1KB  |  71 lines

  1. dnl Process this file with autoconf to produce a configure script
  2. AC_INIT(grep.c)
  3. AC_PROG_AWK
  4. AC_PROG_CC
  5. AC_ISC_POSIX
  6. AC_PROG_CPP
  7. AC_PROG_INSTALL
  8. AC_STDC_HEADERS
  9. AC_HAVE_HEADERS(string.h sys/param.h)
  10. AC_MEMORY_H
  11. AC_UNISTD_H
  12. AC_SIZE_T
  13. AC_ALLOCA
  14. AC_HAVE_FUNCS(getpagesize memchr strerror valloc)
  15. AC_CHAR_UNSIGNED
  16. AC_CONST
  17. echo checking for working mmap
  18. AC_TEST_PROGRAM([
  19. #include <fcntl.h>
  20. #include <sys/types.h>
  21. #include <sys/mman.h>
  22.  
  23. #ifdef BSD
  24. #ifndef BSD4_1
  25. #define HAVE_GETPAGESIZE
  26. #endif
  27. #endif
  28. #ifndef HAVE_GETPAGESIZE
  29. #include <sys/param.h>
  30. #ifdef EXEC_PAGESIZE
  31. #define getpagesize() EXEC_PAGESIZE
  32. #else
  33. #ifdef NBPG
  34. #define getpagesize() NBPG * CLSIZE
  35. #ifndef CLSIZE
  36. #define CLSIZE 1
  37. #endif /* no CLSIZE */
  38. #else /* no NBPG */
  39. #define getpagesize() NBPC
  40. #endif /* no NBPG */
  41. #endif /* no EXEC_PAGESIZE */
  42. #endif /* not HAVE_GETPAGESIZE */
  43.  
  44. #ifdef __osf__
  45. #define valloc malloc
  46. #endif
  47.  
  48. extern char *valloc();
  49.  
  50. int
  51. main()
  52. {
  53.   char *buf1, *buf2;
  54.   int i = getpagesize(), j;
  55.   int fd;
  56.  
  57.   buf1 = valloc(i);
  58.   buf2 = valloc(i);
  59.   for (j = 0; j < i; ++j)
  60.     *(buf1 + j) = rand();
  61.   fd = open("conftestmmap", O_CREAT | O_RDWR, 0666);
  62.   write(fd, buf1, i);
  63.   mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0);
  64.   for (j = 0; j < i; ++j)
  65.     if (*(buf1 + j) != *(buf2 + j))
  66.       exit(1);
  67.   exit(0);
  68. }
  69. ], AC_DEFINE(HAVE_WORKING_MMAP))
  70. AC_OUTPUT(Makefile)
  71.