Renamed sb-file.xpm to sb-pg.xpm
[bpt/emacs.git] / aclocal.m4
CommitLineData
8e82f0c2 1dnl The following are from prerelease autoconf 2.14a. When 2.14 is
4487f86d 2dnl released, we should be able to zap them and just use AC_PREREQ(2.14).
8e82f0c2
DL
3
4
5# AC_PROG_CC_STDC
6# ---------------
7# If the C compiler in not in ANSI C mode by default, try to add an
8# option to output variable @code{CC} to make it so. This macro tries
9# various options that select ANSI C on some system or another. It
10# considers the compiler to be in ANSI C mode if it handles function
11# prototypes correctly.
12AC_DEFUN(AC_PROG_CC_STDC,
13[AC_REQUIRE([AC_PROG_CC])dnl
14AC_BEFORE([$0], [AC_C_INLINE])dnl
15AC_BEFORE([$0], [AC_C_CONST])dnl
16dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
17dnl a magic option to avoid problems with ANSI preprocessor commands
18dnl like #elif.
19dnl FIXME: can't do this because then AC_AIX won't work due to a
20dnl circular dependency.
21dnl AC_BEFORE([$0], [AC_PROG_CPP])
22AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
23AC_CACHE_VAL(ac_cv_prog_cc_stdc,
24[ac_cv_prog_cc_stdc=no
25ac_save_CC="$CC"
26# Don't try gcc -ansi; that turns off useful extensions and
27# breaks some systems' header files.
28# AIX -qlanglvl=ansi
29# Ultrix and OSF/1 -std1
30# HP-UX 10.20 and later -Ae
31# HP-UX older versions -Aa -D_HPUX_SOURCE
32# SVR4 -Xc -D__EXTENSIONS__
33for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
34do
35 CC="$ac_save_CC $ac_arg"
36 AC_TRY_COMPILE(
37[#include <stdarg.h>
38#include <stdio.h>
39#include <sys/types.h>
40#include <sys/stat.h>
41/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
42struct buf { int x; };
43FILE * (*rcsopen) (struct buf *, struct stat *, int);
44static char *e (p, i)
45 char **p;
46 int i;
47{
48 return p[i];
49}
50static char *f (char * (*g) (char **, int), char **p, ...)
51{
52 char *s;
53 va_list v;
54 va_start (v,p);
55 s = g (p, va_arg (v,int));
56 va_end (v);
57 return s;
58}
59int test (int i, double x);
60struct s1 {int (*f) (int a);};
61struct s2 {int (*f) (double a);};
62int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
63int argc;
64char **argv;],
65[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];],
66[ac_cv_prog_cc_stdc="$ac_arg"; break])
67done
68CC="$ac_save_CC"
69])
70case "x$ac_cv_prog_cc_stdc" in
71 x|xno)
72 AC_MSG_RESULT([none needed]) ;;
73 *)
74 AC_MSG_RESULT($ac_cv_prog_cc_stdc)
75 CC="$CC $ac_cv_prog_cc_stdc" ;;
76esac
77])# AC_PROG_CC_STDC
78
4487f86d
DL
79# AC_FUNC_MKTIME
80# --------------
81AC_DEFUN(AC_FUNC_MKTIME,
82[AC_REQUIRE([AC_HEADER_TIME])dnl
83AC_CHECK_HEADERS(sys/time.h unistd.h)
84AC_CHECK_FUNCS(alarm)
85AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime,
86[AC_TRY_RUN(
87[/* Test program from Paul Eggert (eggert@twinsun.com)
88 and Tony Leneis (tony@plaza.ds.adp.com). */
89#if TIME_WITH_SYS_TIME
90# include <sys/time.h>
91# include <time.h>
92#else
93# if HAVE_SYS_TIME_H
94# include <sys/time.h>
95# else
96# include <time.h>
97# endif
98#endif
99
100#if HAVE_UNISTD_H
101# include <unistd.h>
102#endif
103
104#if !HAVE_ALARM
105# define alarm(X) /* empty */
106#endif
107
108/* Work around redefinition to rpl_putenv by other config tests. */
109#undef putenv
110
111static time_t time_t_max;
112
113/* Values we'll use to set the TZ environment variable. */
114static const char *const tz_strings[] = {
115 (const char *) 0, "TZ=GMT0", "TZ=JST-9",
116 "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
117};
118#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
119
120/* Fail if mktime fails to convert a date in the spring-forward gap.
121 Based on a problem report from Andreas Jaeger. */
122static void
123spring_forward_gap ()
124{
125 /* glibc (up to about 1998-10-07) failed this test) */
126 struct tm tm;
127
128 /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
129 instead of "TZ=America/Vancouver" in order to detect the bug even
130 on systems that don't support the Olson extension, or don't have the
131 full zoneinfo tables installed. */
132 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
133
134 tm.tm_year = 98;
135 tm.tm_mon = 3;
136 tm.tm_mday = 5;
137 tm.tm_hour = 2;
138 tm.tm_min = 0;
139 tm.tm_sec = 0;
140 tm.tm_isdst = -1;
141 if (mktime (&tm) == (time_t)-1)
142 exit (1);
143}
144
145static void
146mktime_test (now)
147 time_t now;
148{
149 struct tm *lt;
150 if ((lt = localtime (&now)) && mktime (lt) != now)
151 exit (1);
152 now = time_t_max - now;
153 if ((lt = localtime (&now)) && mktime (lt) != now)
154 exit (1);
155}
156
157static void
158irix_6_4_bug ()
159{
160 /* Based on code from Ariel Faigon. */
161 struct tm tm;
162 tm.tm_year = 96;
163 tm.tm_mon = 3;
164 tm.tm_mday = 0;
165 tm.tm_hour = 0;
166 tm.tm_min = 0;
167 tm.tm_sec = 0;
168 tm.tm_isdst = -1;
169 mktime (&tm);
170 if (tm.tm_mon != 2 || tm.tm_mday != 31)
171 exit (1);
172}
173
174static void
175bigtime_test (j)
176 int j;
177{
178 struct tm tm;
179 time_t now;
180 tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
181 now = mktime (&tm);
182 if (now != (time_t) -1)
183 {
184 struct tm *lt = localtime (&now);
185 if (! (lt
186 && lt->tm_year == tm.tm_year
187 && lt->tm_mon == tm.tm_mon
188 && lt->tm_mday == tm.tm_mday
189 && lt->tm_hour == tm.tm_hour
190 && lt->tm_min == tm.tm_min
191 && lt->tm_sec == tm.tm_sec
192 && lt->tm_yday == tm.tm_yday
193 && lt->tm_wday == tm.tm_wday
194 && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
195 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
196 exit (1);
197 }
198}
199
200int
201main ()
202{
203 time_t t, delta;
204 int i, j;
205
206 /* This test makes some buggy mktime implementations loop.
207 Give up after 60 seconds; a mktime slower than that
208 isn't worth using anyway. */
209 alarm (60);
210
211 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
212 continue;
213 time_t_max--;
214 delta = time_t_max / 997; /* a suitable prime number */
215 for (i = 0; i < N_STRINGS; i++)
216 {
217 if (tz_strings[i])
218 putenv (tz_strings[i]);
219
220 for (t = 0; t <= time_t_max - delta; t += delta)
221 mktime_test (t);
222 mktime_test ((time_t) 60 * 60);
223 mktime_test ((time_t) 60 * 60 * 24);
224
225 for (j = 1; 0 < j; j *= 2)
226 bigtime_test (j);
227 bigtime_test (j - 1);
228 }
229 irix_6_4_bug ();
230 spring_forward_gap ();
231 exit (0);
232}],
233ac_cv_func_working_mktime=yes, ac_cv_func_working_mktime=no,
234ac_cv_func_working_mktime=no)])
235if test $ac_cv_func_working_mktime = no; then
236 LIBOBJS="$LIBOBJS mktime.${ac_objext}"
237fi
0b8f263e 238AC_SUBST(LIBOBJS)dnl
4487f86d
DL
239])# AC_FUNC_MKTIME
240
8e82f0c2
DL
241# AC_C_VOLATILE
242# -------------
243# Note that, unlike const, #defining volatile to be the empty string can
244# actually turn a correct program into an incorrect one, since removing
245# uses of volatile actually grants the compiler permission to perform
246# optimizations that could break the user's code. So, do not #define
247# volatile away unless it is really necessary to allow the user's code
248# to compile cleanly. Benign compiler failures should be tolerated.
249AC_DEFUN(AC_C_VOLATILE,
250[AC_REQUIRE([AC_PROG_CC_STDC])dnl
251AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
252[AC_TRY_COMPILE(,[
253volatile int x;
254int * volatile y;],
255ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
256if test $ac_cv_c_volatile = no; then
257 AC_DEFINE(volatile,,
258 [Define to empty if the keyword `volatile' does not work.
259 Warning: valid code using `volatile' can become incorrect
260 without. Disable with care.])
261fi
262])
263
264# AC_C_PROTOTYPES
265# ---------------
266# Check if the C compiler supports prototypes, included if it needs
267# options.
268AC_DEFUN(AC_C_PROTOTYPES,
269[AC_REQUIRE([AC_PROG_CC_STDC])dnl
270AC_REQUIRE([AC_PROG_CPP])dnl
271AC_MSG_CHECKING([for function prototypes])
272if test "$ac_cv_prog_cc_stdc" != no; then
273 AC_MSG_RESULT(yes)
274 AC_DEFINE(PROTOTYPES, 1,
275 [Define if the compiler supports function prototypes.])
276else
277 AC_MSG_RESULT(no)
278fi
279])# AC_C_PROTOTYPES