Mercurial > emacs
annotate aclocal.m4 @ 35071:bf884d9d7949
Revert last change except for %X.
author | Dave Love <fx@gnu.org> |
---|---|
date | Thu, 04 Jan 2001 21:01:18 +0000 |
parents | 14bff16f1d37 |
children | b5a4db21c424 |
rev | line source |
---|---|
27939 | 1 dnl The following are from prerelease autoconf 2.14a. When 2.14 is |
28583 | 2 dnl released, we should be able to zap them and just use AC_PREREQ(2.14). |
27939 | 3 |
29901
56407d559c03
Define the post-2.13 stuff conditionally on autoconf version.
Dave Love <fx@gnu.org>
parents:
29404
diff
changeset
|
4 ifelse(_AC_VERSION_COMPARE(AC_ACVERSION, [2.14]), -1, |
27939 | 5 |
6 # AC_PROG_CC_STDC | |
7 # --------------- | |
8 # If the C compiler in not in ANSI C mode by default, try to add an | |
9 # option to output variable @code{CC} to make it so. This macro tries | |
10 # various options that select ANSI C on some system or another. It | |
11 # considers the compiler to be in ANSI C mode if it handles function | |
12 # prototypes correctly. | |
13 AC_DEFUN(AC_PROG_CC_STDC, | |
14 [AC_REQUIRE([AC_PROG_CC])dnl | |
15 AC_BEFORE([$0], [AC_C_INLINE])dnl | |
16 AC_BEFORE([$0], [AC_C_CONST])dnl | |
17 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require | |
18 dnl a magic option to avoid problems with ANSI preprocessor commands | |
19 dnl like #elif. | |
20 dnl FIXME: can't do this because then AC_AIX won't work due to a | |
21 dnl circular dependency. | |
22 dnl AC_BEFORE([$0], [AC_PROG_CPP]) | |
23 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) | |
24 AC_CACHE_VAL(ac_cv_prog_cc_stdc, | |
25 [ac_cv_prog_cc_stdc=no | |
26 ac_save_CC="$CC" | |
27 # Don't try gcc -ansi; that turns off useful extensions and | |
28 # breaks some systems' header files. | |
29 # AIX -qlanglvl=ansi | |
30 # Ultrix and OSF/1 -std1 | |
31 # HP-UX 10.20 and later -Ae | |
32 # HP-UX older versions -Aa -D_HPUX_SOURCE | |
33 # SVR4 -Xc -D__EXTENSIONS__ | |
34 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" | |
35 do | |
36 CC="$ac_save_CC $ac_arg" | |
37 AC_TRY_COMPILE( | |
38 [#include <stdarg.h> | |
39 #include <stdio.h> | |
40 #include <sys/types.h> | |
41 #include <sys/stat.h> | |
42 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ | |
43 struct buf { int x; }; | |
44 FILE * (*rcsopen) (struct buf *, struct stat *, int); | |
45 static char *e (p, i) | |
46 char **p; | |
47 int i; | |
48 { | |
49 return p[i]; | |
50 } | |
51 static char *f (char * (*g) (char **, int), char **p, ...) | |
52 { | |
53 char *s; | |
54 va_list v; | |
55 va_start (v,p); | |
56 s = g (p, va_arg (v,int)); | |
57 va_end (v); | |
58 return s; | |
59 } | |
60 int test (int i, double x); | |
61 struct s1 {int (*f) (int a);}; | |
62 struct s2 {int (*f) (double a);}; | |
63 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); | |
64 int argc; | |
65 char **argv;], | |
66 [return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];], | |
67 [ac_cv_prog_cc_stdc="$ac_arg"; break]) | |
68 done | |
69 CC="$ac_save_CC" | |
70 ]) | |
71 case "x$ac_cv_prog_cc_stdc" in | |
72 x|xno) | |
73 AC_MSG_RESULT([none needed]) ;; | |
74 *) | |
75 AC_MSG_RESULT($ac_cv_prog_cc_stdc) | |
76 CC="$CC $ac_cv_prog_cc_stdc" ;; | |
77 esac | |
78 ])# AC_PROG_CC_STDC | |
79 | |
28583 | 80 # AC_FUNC_MKTIME |
81 # -------------- | |
82 AC_DEFUN(AC_FUNC_MKTIME, | |
83 [AC_REQUIRE([AC_HEADER_TIME])dnl | |
84 AC_CHECK_HEADERS(sys/time.h unistd.h) | |
85 AC_CHECK_FUNCS(alarm) | |
86 AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime, | |
87 [AC_TRY_RUN( | |
88 [/* Test program from Paul Eggert (eggert@twinsun.com) | |
89 and Tony Leneis (tony@plaza.ds.adp.com). */ | |
90 #if TIME_WITH_SYS_TIME | |
91 # include <sys/time.h> | |
92 # include <time.h> | |
93 #else | |
94 # if HAVE_SYS_TIME_H | |
95 # include <sys/time.h> | |
96 # else | |
97 # include <time.h> | |
98 # endif | |
99 #endif | |
100 | |
101 #if HAVE_UNISTD_H | |
102 # include <unistd.h> | |
103 #endif | |
104 | |
105 #if !HAVE_ALARM | |
106 # define alarm(X) /* empty */ | |
107 #endif | |
108 | |
109 /* Work around redefinition to rpl_putenv by other config tests. */ | |
110 #undef putenv | |
111 | |
112 static time_t time_t_max; | |
113 | |
114 /* Values we'll use to set the TZ environment variable. */ | |
115 static const char *const tz_strings[] = { | |
116 (const char *) 0, "TZ=GMT0", "TZ=JST-9", | |
117 "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" | |
118 }; | |
119 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) | |
120 | |
121 /* Fail if mktime fails to convert a date in the spring-forward gap. | |
122 Based on a problem report from Andreas Jaeger. */ | |
123 static void | |
124 spring_forward_gap () | |
125 { | |
126 /* glibc (up to about 1998-10-07) failed this test) */ | |
127 struct tm tm; | |
128 | |
129 /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" | |
130 instead of "TZ=America/Vancouver" in order to detect the bug even | |
131 on systems that don't support the Olson extension, or don't have the | |
132 full zoneinfo tables installed. */ | |
133 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); | |
134 | |
135 tm.tm_year = 98; | |
136 tm.tm_mon = 3; | |
137 tm.tm_mday = 5; | |
138 tm.tm_hour = 2; | |
139 tm.tm_min = 0; | |
140 tm.tm_sec = 0; | |
141 tm.tm_isdst = -1; | |
142 if (mktime (&tm) == (time_t)-1) | |
143 exit (1); | |
144 } | |
145 | |
146 static void | |
147 mktime_test (now) | |
148 time_t now; | |
149 { | |
150 struct tm *lt; | |
151 if ((lt = localtime (&now)) && mktime (lt) != now) | |
152 exit (1); | |
153 now = time_t_max - now; | |
154 if ((lt = localtime (&now)) && mktime (lt) != now) | |
155 exit (1); | |
156 } | |
157 | |
158 static void | |
159 irix_6_4_bug () | |
160 { | |
161 /* Based on code from Ariel Faigon. */ | |
162 struct tm tm; | |
163 tm.tm_year = 96; | |
164 tm.tm_mon = 3; | |
165 tm.tm_mday = 0; | |
166 tm.tm_hour = 0; | |
167 tm.tm_min = 0; | |
168 tm.tm_sec = 0; | |
169 tm.tm_isdst = -1; | |
170 mktime (&tm); | |
171 if (tm.tm_mon != 2 || tm.tm_mday != 31) | |
172 exit (1); | |
173 } | |
174 | |
175 static void | |
176 bigtime_test (j) | |
177 int j; | |
178 { | |
179 struct tm tm; | |
180 time_t now; | |
181 tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; | |
182 now = mktime (&tm); | |
183 if (now != (time_t) -1) | |
184 { | |
185 struct tm *lt = localtime (&now); | |
186 if (! (lt | |
187 && lt->tm_year == tm.tm_year | |
188 && lt->tm_mon == tm.tm_mon | |
189 && lt->tm_mday == tm.tm_mday | |
190 && lt->tm_hour == tm.tm_hour | |
191 && lt->tm_min == tm.tm_min | |
192 && lt->tm_sec == tm.tm_sec | |
193 && lt->tm_yday == tm.tm_yday | |
194 && lt->tm_wday == tm.tm_wday | |
195 && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) | |
196 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) | |
197 exit (1); | |
198 } | |
199 } | |
200 | |
201 int | |
202 main () | |
203 { | |
204 time_t t, delta; | |
205 int i, j; | |
206 | |
207 /* This test makes some buggy mktime implementations loop. | |
208 Give up after 60 seconds; a mktime slower than that | |
209 isn't worth using anyway. */ | |
210 alarm (60); | |
211 | |
212 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) | |
213 continue; | |
214 time_t_max--; | |
215 delta = time_t_max / 997; /* a suitable prime number */ | |
216 for (i = 0; i < N_STRINGS; i++) | |
217 { | |
218 if (tz_strings[i]) | |
219 putenv (tz_strings[i]); | |
220 | |
221 for (t = 0; t <= time_t_max - delta; t += delta) | |
222 mktime_test (t); | |
223 mktime_test ((time_t) 60 * 60); | |
224 mktime_test ((time_t) 60 * 60 * 24); | |
225 | |
226 for (j = 1; 0 < j; j *= 2) | |
227 bigtime_test (j); | |
228 bigtime_test (j - 1); | |
229 } | |
230 irix_6_4_bug (); | |
231 spring_forward_gap (); | |
232 exit (0); | |
233 }], | |
234 ac_cv_func_working_mktime=yes, ac_cv_func_working_mktime=no, | |
235 ac_cv_func_working_mktime=no)]) | |
236 if test $ac_cv_func_working_mktime = no; then | |
237 LIBOBJS="$LIBOBJS mktime.${ac_objext}" | |
238 fi | |
28638 | 239 AC_SUBST(LIBOBJS)dnl |
28583 | 240 ])# AC_FUNC_MKTIME |
241 | |
27939 | 242 # AC_C_VOLATILE |
243 # ------------- | |
244 # Note that, unlike const, #defining volatile to be the empty string can | |
245 # actually turn a correct program into an incorrect one, since removing | |
246 # uses of volatile actually grants the compiler permission to perform | |
247 # optimizations that could break the user's code. So, do not #define | |
248 # volatile away unless it is really necessary to allow the user's code | |
249 # to compile cleanly. Benign compiler failures should be tolerated. | |
250 AC_DEFUN(AC_C_VOLATILE, | |
251 [AC_REQUIRE([AC_PROG_CC_STDC])dnl | |
252 AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile, | |
253 [AC_TRY_COMPILE(,[ | |
254 volatile int x; | |
255 int * volatile y;], | |
256 ac_cv_c_volatile=yes, ac_cv_c_volatile=no)]) | |
257 if test $ac_cv_c_volatile = no; then | |
258 AC_DEFINE(volatile,, | |
259 [Define to empty if the keyword `volatile' does not work. | |
260 Warning: valid code using `volatile' can become incorrect | |
261 without. Disable with care.]) | |
262 fi | |
263 ]) | |
264 | |
265 # AC_C_PROTOTYPES | |
266 # --------------- | |
267 # Check if the C compiler supports prototypes, included if it needs | |
268 # options. | |
269 AC_DEFUN(AC_C_PROTOTYPES, | |
270 [AC_REQUIRE([AC_PROG_CC_STDC])dnl | |
271 AC_REQUIRE([AC_PROG_CPP])dnl | |
272 AC_MSG_CHECKING([for function prototypes]) | |
273 if test "$ac_cv_prog_cc_stdc" != no; then | |
274 AC_MSG_RESULT(yes) | |
275 AC_DEFINE(PROTOTYPES, 1, | |
276 [Define if the compiler supports function prototypes.]) | |
277 else | |
278 AC_MSG_RESULT(no) | |
279 fi | |
280 ])# AC_C_PROTOTYPES | |
29384 | 281 |
29901
56407d559c03
Define the post-2.13 stuff conditionally on autoconf version.
Dave Love <fx@gnu.org>
parents:
29404
diff
changeset
|
282 dnl The following is a bit different from the prerelease autoconf at |
56407d559c03
Define the post-2.13 stuff conditionally on autoconf version.
Dave Love <fx@gnu.org>
parents:
29404
diff
changeset
|
283 dnl this time since that requires extra definitions. |
29404 | 284 |
29384 | 285 dnl By default, many hosts won't let programs access large files; |
286 dnl one must use special compiler options to get large-file access to work. | |
287 dnl For more details about this brain damage please see: | |
288 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html | |
289 | |
290 dnl Written by Paul Eggert <eggert@twinsun.com>. | |
291 | |
292 dnl Internal subroutine of AC_SYS_LARGEFILE. | |
293 dnl AC_SYS_LARGEFILE_TEST_INCLUDES | |
294 AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES, | |
295 [[#include <sys/types.h> | |
296 int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; | |
297 ]]) | |
298 | |
299 dnl Internal subroutine of AC_SYS_LARGEFILE. | |
300 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY) | |
301 AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, | |
302 [AC_CACHE_CHECK([for $1 value needed for large files], $3, | |
303 [$3=no | |
34426
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
304 AC_TRY_COMPILE([$5], |
29384 | 305 [$6], |
306 , | |
307 [AC_TRY_COMPILE([#define $1 $2] | |
34426
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
308 [$5] |
29384 | 309 , |
310 [$6], | |
311 [$3=$2])])]) | |
312 if test "[$]$3" != no; then | |
313 AC_DEFINE_UNQUOTED([$1], [$]$3, [$4]) | |
314 fi]) | |
315 | |
316 AC_DEFUN(AC_SYS_LARGEFILE, | |
34426
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
317 [AC_REQUIRE([AC_PROG_CC]) |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
318 AC_ARG_ENABLE(largefile, |
29384 | 319 [ --disable-largefile omit support for large files]) |
320 if test "$enable_largefile" != no; then | |
321 | |
322 AC_CACHE_CHECK([for special C compiler options needed for large files], | |
323 ac_cv_sys_largefile_CC, | |
324 [ac_cv_sys_largefile_CC=no | |
325 if test "$GCC" != yes; then | |
326 # IRIX 6.2 and later do not support large files by default, | |
327 # so use the C compiler's -n32 option if that helps. | |
328 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , , | |
329 [ac_save_CC="$CC" | |
330 CC="$CC -n32" | |
331 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , | |
332 ac_cv_sys_largefile_CC=' -n32') | |
333 CC="$ac_save_CC"]) | |
334 fi]) | |
335 if test "$ac_cv_sys_largefile_CC" != no; then | |
336 CC="$CC$ac_cv_sys_largefile_CC" | |
337 fi | |
338 | |
339 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, | |
340 ac_cv_sys_file_offset_bits, | |
34426
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
341 [Number of bits in a file offset, on hosts where this is settable.], |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
342 AC_SYS_LARGEFILE_TEST_INCLUDES) |
29384 | 343 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, |
344 ac_cv_sys_large_files, | |
34426
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
345 [Define for large files, on AIX-style hosts.] |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
346 AC_SYS_LARGEFILE_TEST_INCLUDES) |
29384 | 347 fi |
348 ]) | |
29901
56407d559c03
Define the post-2.13 stuff conditionally on autoconf version.
Dave Love <fx@gnu.org>
parents:
29404
diff
changeset
|
349 |
34426
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
350 AC_DEFUN(AC_FUNC_FSEEKO, |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
351 [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
352 ac_cv_sys_largefile_source, |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
353 [Define to make fseeko visible on some hosts (e.g. glibc 2.2).], |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
354 [#include <stdio.h>], [return !fseeko;]) |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
355 # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
356 # in glibc 2.1.3, but that breaks too many other things. |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
357 # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
358 |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
359 AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko, |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
360 [ac_cv_func_fseeko=no |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
361 AC_TRY_LINK([#include <stdio.h>], |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
362 [return fseeko && fseeko (stdin, 0, 0);], |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
363 [ac_cv_func_fseeko=yes])]) |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
364 if test $ac_cv_func_fseeko != no; then |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
365 AC_DEFINE(HAVE_FSEEKO, 1, |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
366 [Define if fseeko (and presumably ftello) exists and is declared.]) |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
367 fi]) |
14bff16f1d37
(AC_SYS_LARGEFILE, AC_SYS_LARGEFILE_MACRO_VALUE):
Gerd Moellmann <gerd@gnu.org>
parents:
31511
diff
changeset
|
368 |
31511
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
369 undefine([AC_FUNC_MMAP])dnl |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
370 dnl The autoconf 2.13 version loses on OSF, at least, |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
371 dnl by messing up the declaration of malloc. |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
372 AC_DEFUN([AC_FUNC_MMAP], |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
373 [AC_CHECK_HEADERS(stdlib.h unistd.h sys/stat.h) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
374 AC_CHECK_FUNCS(getpagesize) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
375 AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
376 [AC_TRY_RUN( |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
377 [/* Thanks to Mike Haertel and Jim Avera for this test. |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
378 Here is a matrix of mmap possibilities: |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
379 mmap private not fixed |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
380 mmap private fixed at somewhere currently unmapped |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
381 mmap private fixed at somewhere already mapped |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
382 mmap shared not fixed |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
383 mmap shared fixed at somewhere currently unmapped |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
384 mmap shared fixed at somewhere already mapped |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
385 For private mappings, we should verify that changes cannot be read() |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
386 back from the file, nor mmap's back from the file at a different |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
387 address. (There have been systems where private was not correctly |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
388 implemented like the infamous i386 svr4.0, and systems where the |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
389 VM page cache was not coherent with the file system buffer cache |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
390 like early versions of FreeBSD and possibly contemporary NetBSD.) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
391 For shared mappings, we should conversely verify that changes get |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
392 propogated back to all the places they're supposed to be. |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
393 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
394 Grep wants private fixed already mapped. |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
395 The main things grep needs to know about mmap are: |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
396 * does it exist and is it safe to write into the mmap'd area |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
397 * how to use it (BSD variants) */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
398 #include <sys/types.h> |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
399 #include <fcntl.h> |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
400 #include <sys/mman.h> |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
401 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
402 #if STDC_HEADERS || HAVE_STDLIB_H |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
403 # include <stdlib.h> |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
404 #else |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
405 char *malloc (); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
406 #endif |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
407 #if HAVE_UNISTD_H |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
408 # include <unistd.h> |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
409 #endif |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
410 #if HAVE_SYS_STAT_H |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
411 # include <sys/stat.h> |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
412 #endif |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
413 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
414 /* This mess was copied from the GNU getpagesize.h. */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
415 #if !HAVE_GETPAGESIZE |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
416 /* Assume that all systems that can run configure have sys/param.h. */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
417 # if !HAVE_SYS_PARAM_H |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
418 # define HAVE_SYS_PARAM_H 1 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
419 # endif |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
420 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
421 # ifdef _SC_PAGESIZE |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
422 # define getpagesize() sysconf(_SC_PAGESIZE) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
423 # else /* no _SC_PAGESIZE */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
424 # if HAVE_SYS_PARAM_H |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
425 # include <sys/param.h> |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
426 # ifdef EXEC_PAGESIZE |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
427 # define getpagesize() EXEC_PAGESIZE |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
428 # else /* no EXEC_PAGESIZE */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
429 # ifdef NBPG |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
430 # define getpagesize() NBPG * CLSIZE |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
431 # ifndef CLSIZE |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
432 # define CLSIZE 1 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
433 # endif /* no CLSIZE */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
434 # else /* no NBPG */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
435 # ifdef NBPC |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
436 # define getpagesize() NBPC |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
437 # else /* no NBPC */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
438 # ifdef PAGESIZE |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
439 # define getpagesize() PAGESIZE |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
440 # endif /* PAGESIZE */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
441 # endif /* no NBPC */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
442 # endif /* no NBPG */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
443 # endif /* no EXEC_PAGESIZE */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
444 # else /* no HAVE_SYS_PARAM_H */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
445 # define getpagesize() 8192 /* punt totally */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
446 # endif /* no HAVE_SYS_PARAM_H */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
447 # endif /* no _SC_PAGESIZE */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
448 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
449 #endif /* no HAVE_GETPAGESIZE */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
450 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
451 int |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
452 main () |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
453 { |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
454 char *data, *data2, *data3; |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
455 int i, pagesize; |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
456 int fd; |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
457 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
458 pagesize = getpagesize (); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
459 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
460 /* First, make a file with some known garbage in it. */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
461 data = (char *) malloc (pagesize); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
462 if (!data) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
463 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
464 for (i = 0; i < pagesize; ++i) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
465 *(data + i) = rand (); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
466 umask (0); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
467 fd = creat ("conftestmmap", 0600); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
468 if (fd < 0) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
469 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
470 if (write (fd, data, pagesize) != pagesize) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
471 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
472 close (fd); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
473 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
474 /* Next, try to mmap the file at a fixed address which already has |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
475 something else allocated at it. If we can, also make sure that |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
476 we see the same garbage. */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
477 fd = open ("conftestmmap", O_RDWR); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
478 if (fd < 0) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
479 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
480 data2 = (char *) malloc (2 * pagesize); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
481 if (!data2) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
482 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
483 data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
484 if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
485 MAP_PRIVATE | MAP_FIXED, fd, 0L)) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
486 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
487 for (i = 0; i < pagesize; ++i) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
488 if (*(data + i) != *(data2 + i)) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
489 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
490 |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
491 /* Finally, make sure that changes to the mapped area do not |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
492 percolate back to the file as seen by read(). (This is a bug on |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
493 some variants of i386 svr4.0.) */ |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
494 for (i = 0; i < pagesize; ++i) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
495 *(data2 + i) = *(data2 + i) + 1; |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
496 data3 = (char *) malloc (pagesize); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
497 if (!data3) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
498 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
499 if (read (fd, data3, pagesize) != pagesize) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
500 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
501 for (i = 0; i < pagesize; ++i) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
502 if (*(data + i) != *(data3 + i)) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
503 exit (1); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
504 close (fd); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
505 unlink ("conftestmmap"); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
506 exit (0); |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
507 }], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no, |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
508 ac_cv_func_mmap_fixed_mapped=no)]) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
509 if test $ac_cv_func_mmap_fixed_mapped = yes; then |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
510 AC_DEFINE(HAVE_MMAP, 1, |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
511 [Define if you have a working `mmap' system call.]) |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
512 fi |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
513 ])# AC_FUNC_MMAP |
b7463306b3ac
(AC_FUNC_MMAP): Use fixed version from development
Dave Love <fx@gnu.org>
parents:
29901
diff
changeset
|
514 |
29901
56407d559c03
Define the post-2.13 stuff conditionally on autoconf version.
Dave Love <fx@gnu.org>
parents:
29404
diff
changeset
|
515 ) dnl ifelse |