annotate aclocal.m4 @ 38331:b45a8f9db907 raeburn-tag-6-for-export

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