X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/edcc1067b6d81aadf43f1d9397817d8173857762..9985827feca70e0ba3f370603763c144f79b1f41:/aclocal.m4?ds=sidebyside diff --git a/aclocal.m4 b/aclocal.m4 index e5bc43cdbc..25474afe90 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,26 @@ dnl The following are from prerelease autoconf 2.14a. When 2.14 is dnl released, we should be able to zap them and just use AC_PREREQ(2.14). +% Copyright (C) 2000, 2001 Free Software Foundation, Inc. +% +% This file is part of GNU Emacs. +% +% GNU Emacs is free software; you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation; either version 2, or (at your option) +% any later version. +% +% GNU Emacs is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with GNU Emacs; see the file COPYING. If not, write to the +% Free Software Foundation, Inc., 59 Temple Place - Suite 330, +% Boston, MA 02111-1307, USA. + +ifelse(_AC_VERSION_COMPARE(AC_ACVERSION, [2.14]), -1, # AC_PROG_CC_STDC # --------------- @@ -278,8 +298,8 @@ else fi ])# AC_C_PROTOTYPES -dnl The following isn't in the prerelease autoconf at this time, but -dnl eggert expects it to go in eventually. +dnl The following is a bit different from the prerelease autoconf at +dnl this time since that requires extra definitions. dnl By default, many hosts won't let programs access large files; dnl one must use special compiler options to get large-file access to work. @@ -300,14 +320,11 @@ dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, F AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, [AC_CACHE_CHECK([for $1 value needed for large files], $3, [$3=no - AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES -$5 - , + AC_TRY_COMPILE([$5], [$6], , [AC_TRY_COMPILE([#define $1 $2] -AC_SYS_LARGEFILE_TEST_INCLUDES -$5 +[$5] , [$6], [$3=$2])])]) @@ -316,7 +333,8 @@ $5 fi]) AC_DEFUN(AC_SYS_LARGEFILE, - [AC_ARG_ENABLE(largefile, + [AC_REQUIRE([AC_PROG_CC]) + AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) if test "$enable_largefile" != no; then @@ -339,17 +357,178 @@ AC_DEFUN(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits, - [Number of bits in a file offset, on hosts where this is settable.]) - AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, - ac_cv_sys_largefile_source, - [Define to make ftello visible on some hosts (e.g. HP-UX 10.20).], - [#include ], [return !ftello;]) + [Number of bits in a file offset, on hosts where this is settable.], + AC_SYS_LARGEFILE_TEST_INCLUDES) AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files, - [Define for large files, on AIX-style hosts.]) - AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500, - ac_cv_sys_xopen_source, - [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).], - [#include ], [return !ftello;]) + [Define for large files, on AIX-style hosts.] + AC_SYS_LARGEFILE_TEST_INCLUDES) fi ]) + +AC_DEFUN(AC_FUNC_FSEEKO, + [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, + ac_cv_sys_largefile_source, + [Define to make fseeko visible on some hosts (e.g. glibc 2.2).], + [#include ], [return !fseeko;]) + # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug + # in glibc 2.1.3, but that breaks too many other things. + # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. + + AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko, + [ac_cv_func_fseeko=no + AC_TRY_LINK([#include ], + [return fseeko && fseeko (stdin, 0, 0);], + [ac_cv_func_fseeko=yes])]) + if test $ac_cv_func_fseeko != no; then + AC_DEFINE(HAVE_FSEEKO, 1, + [Define if fseeko (and presumably ftello) exists and is declared.]) + fi]) + +undefine([AC_FUNC_MMAP])dnl +dnl The autoconf 2.13 version loses on OSF, at least, +dnl by messing up the declaration of malloc. +AC_DEFUN([AC_FUNC_MMAP], +[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( +[/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ +#include +#include +#include + +#if STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif +#if HAVE_UNISTD_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# if !HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# if HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftestmmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftestmmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + unlink ("conftestmmap"); + exit (0); +}], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no, +ac_cv_func_mmap_fixed_mapped=no)]) +if test $ac_cv_func_mmap_fixed_mapped = yes; then + AC_DEFINE(HAVE_MMAP, 1, + [Define if you have a working `mmap' system call.]) +fi +])# AC_FUNC_MMAP + +) dnl ifelse