1# This file is part of Autoconf.                       -*- Autoconf -*-
2# Type related macros: existence, sizeof, and structure members.
3# Copyright 2000, 2001
4# Free Software Foundation, Inc.
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19# 02111-1307, USA.
20#
21# As a special exception, the Free Software Foundation gives unlimited
22# permission to copy, distribute and modify the configure scripts that
23# are the output of Autoconf.  You need not follow the terms of the GNU
24# General Public License when using or distributing such scripts, even
25# though portions of the text of Autoconf appear in them.  The GNU
26# General Public License (GPL) does govern all other use of the material
27# that constitutes the Autoconf program.
28#
29# Certain portions of the Autoconf source text are designed to be copied
30# (in certain cases, depending on the input) into the output of
31# Autoconf.  We call these the "data" portions.  The rest of the Autoconf
32# source text consists of comments plus executable code that decides which
33# of the data portions to output in any given case.  We call these
34# comments and executable code the "non-data" portions.  Autoconf never
35# copies any of the non-data portions into its output.
36#
37# This special exception to the GPL applies to versions of Autoconf
38# released by the Free Software Foundation.  When you make and
39# distribute a modified version of Autoconf, you may extend this special
40# exception to the GPL to apply to your modified version as well, *unless*
41# your modified version has the potential to copy into its output some
42# of the text that was the non-data portion of the version that you started
43# with.  (In other words, unless your change moves or copies text from
44# the non-data portions to the data portions.)  If your modification has
45# such potential, you must delete any notice of this special exception
46# to the GPL from your modified version.
47#
48# Written by David MacKenzie, with help from
49# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
50# Roland McGrath, Noah Friedman, david d zuhn, and many others.
51
52
53## ---------------- ##
54## Type existence.  ##
55## ---------------- ##
56
57# ---------------- #
58# General checks.  #
59# ---------------- #
60
61# Up to 2.13 included, Autoconf used to provide the macro
62#
63#    AC_CHECK_TYPE(TYPE, DEFAULT)
64#
65# Since, it provides another version which fits better with the other
66# AC_CHECK_ families:
67#
68#    AC_CHECK_TYPE(TYPE,
69#	           [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
70#	           [INCLUDES])
71#
72# In order to provide backward compatibility, the new scheme is
73# implemented as _AC_CHECK_TYPE_NEW, the old scheme as _AC_CHECK_TYPE_OLD,
74# and AC_CHECK_TYPE branches to one or the other, depending upon its
75# arguments.
76
77
78
79# _AC_CHECK_TYPE_NEW(TYPE,
80#		     [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
81#		     [INCLUDES])
82# ------------------------------------------------------------
83# Check whether the type TYPE is supported by the system, maybe via the
84# the provided includes.  This macro implements the former task of
85# AC_CHECK_TYPE, with one big difference though: AC_CHECK_TYPE was
86# grepping in the headers, which, BTW, led to many problems until
87# the egrep expression was correct and did not given false positives.
88# It turned out there are even portability issues with egrep...
89#
90# The most obvious way to check for a TYPE is just to compile a variable
91# definition:
92#
93# 	  TYPE my_var;
94#
95# Unfortunately this does not work for const qualified types in C++,
96# where you need an initializer.  So you think of
97#
98# 	  TYPE my_var = (TYPE) 0;
99#
100# Unfortunately, again, this is not valid for some C++ classes.
101#
102# Then you look for another scheme.  For instance you think of declaring
103# a function which uses a parameter of type TYPE:
104#
105# 	  int foo (TYPE param);
106#
107# but of course you soon realize this does not make it with K&R
108# compilers.  And by no ways you want to
109#
110# 	  int foo (param)
111# 	    TYPE param
112# 	  { ; }
113#
114# since this time it's C++ who is not happy.
115#
116# Don't even think of the return type of a function, since K&R cries
117# there too.  So you start thinking of declaring a *pointer* to this TYPE:
118#
119# 	  TYPE *p;
120#
121# but you know fairly well that this is legal in C for aggregates which
122# are unknown (TYPE = struct does-not-exist).
123#
124# Then you think of using sizeof to make sure the TYPE is really
125# defined:
126#
127# 	  sizeof (TYPE);
128#
129# But this succeeds if TYPE is a variable: you get the size of the
130# variable's type!!!
131#
132# This time you tell yourself the last two options *together* will make
133# it.  And indeed this is the solution invented by Alexandre Oliva.
134#
135# Also note that we use
136#
137# 	  if (sizeof (TYPE))
138#
139# to `read' sizeof (to avoid warnings), while not depending on its type
140# (not necessarily size_t etc.).  Equally, instead of defining an unused
141# variable, we just use a cast to avoid warnings from the compiler.
142# Suggested by Paul Eggert.
143m4_define([_AC_CHECK_TYPE_NEW],
144[AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
145AC_CACHE_CHECK([for $1], ac_Type,
146[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
147[if (($1 *) 0)
148  return 0;
149if (sizeof ($1))
150  return 0;])],
151                   [AS_VAR_SET(ac_Type, yes)],
152                   [AS_VAR_SET(ac_Type, no)])])
153AS_IF([test AS_VAR_GET(ac_Type) = yes], [$2], [$3])[]dnl
154AS_VAR_POPDEF([ac_Type])dnl
155])# _AC_CHECK_TYPE_NEW
156
157
158# AC_CHECK_TYPES(TYPES,
159#                [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
160#                [INCLUDES])
161# --------------------------------------------------------
162# TYPES is an m4 list.  There are no ambiguities here, we mean the newer
163# AC_CHECK_TYPE.
164AC_DEFUN([AC_CHECK_TYPES],
165[m4_foreach([AC_Type], [$1],
166  [_AC_CHECK_TYPE_NEW(AC_Type,
167                      [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Type), 1,
168                                          [Define if the system has the type
169                                          `]AC_Type['.])
170$2],
171                      [$3],
172                      [$4])])])
173
174
175# _AC_CHECK_TYPE_OLD(TYPE, DEFAULT)
176# ---------------------------------
177# FIXME: This is an extremely badly chosen name, since this
178# macro actually performs an AC_REPLACE_TYPE.  Some day we
179# have to clean this up.
180m4_define([_AC_CHECK_TYPE_OLD],
181[_AC_CHECK_TYPE_NEW([$1],,
182   [AC_DEFINE_UNQUOTED([$1], [$2],
183                       [Define to `$2' if <sys/types.h> does not define.])])dnl
184])# _AC_CHECK_TYPE_OLD
185
186
187# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P(STRING)
188# -----------------------------------------
189# Return `1' if STRING seems to be a builtin C/C++ type, i.e., if it
190# starts with `_Bool', `bool', `char', `double', `float', `int',
191# `long', `short', `signed', or `unsigned' followed by characters
192# that are defining types.
193# Because many people have used `off_t' and `size_t' too, they are added
194# for better common-useward backward compatibility.
195m4_define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P],
196[m4_if(m4_regexp([$1],
197                 [^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|[_a-zA-Z][_a-zA-Z0-9]*_t\)[][_a-zA-Z0-9() *]*$]),
198       0, 1, 0)dnl
199])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P
200
201
202# _AC_CHECK_TYPE_MAYBE_TYPE_P(STRING)
203# -----------------------------------
204# Return `1' if STRING looks like a C/C++ type.
205m4_define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
206[m4_if(m4_regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
207       0, 1, 0)dnl
208])# _AC_CHECK_TYPE_MAYBE_TYPE_P
209
210
211# AC_CHECK_TYPE(TYPE, DEFAULT)
212#  or
213# AC_CHECK_TYPE(TYPE,
214#	        [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
215#	        [INCLUDES])
216# -------------------------------------------------------
217#
218# Dispatch respectively to _AC_CHECK_TYPE_OLD or _AC_CHECK_TYPE_NEW.
219# 1. More than two arguments         => NEW
220# 2. $2 seems to be replacement type => OLD
221#    See _AC_CHECK_TYPE_REPLACEMENT_TYPE_P for `replacement type'.
222# 3. $2 seems to be a type           => NEW plus a warning
223# 4. default                         => NEW
224AC_DEFUN([AC_CHECK_TYPE],
225[m4_if($#, 3,
226         [_AC_CHECK_TYPE_NEW($@)],
227       $#, 4,
228         [_AC_CHECK_TYPE_NEW($@)],
229       _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1,
230         [_AC_CHECK_TYPE_OLD($@)],
231       _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1,
232         [AC_DIAGNOSE([syntax],
233                    [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
234       [_AC_CHECK_TYPE_NEW($@)])[]dnl
235])# AC_CHECK_TYPE
236
237
238
239# ----------------- #
240# Specific checks.  #
241# ----------------- #
242
243# AC_TYPE_GETGROUPS
244# -----------------
245AC_DEFUN([AC_TYPE_GETGROUPS],
246[AC_REQUIRE([AC_TYPE_UID_T])dnl
247AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups,
248[AC_RUN_IFELSE([AC_LANG_SOURCE(
249[[/* Thanks to Mike Rendell for this test.  */
250#include <sys/types.h>
251#define NGID 256
252#undef MAX
253#define MAX(x, y) ((x) > (y) ? (x) : (y))
254
255int
256main ()
257{
258  gid_t gidset[NGID];
259  int i, n;
260  union { gid_t gval; long lval; }  val;
261
262  val.lval = -1;
263  for (i = 0; i < NGID; i++)
264    gidset[i] = val.gval;
265  n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
266                 gidset);
267  /* Exit non-zero if getgroups seems to require an array of ints.  This
268     happens when gid_t is short but getgroups modifies an array of ints.  */
269  exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
270}]])],
271               [ac_cv_type_getgroups=gid_t],
272               [ac_cv_type_getgroups=int],
273               [ac_cv_type_getgroups=cross])
274if test $ac_cv_type_getgroups = cross; then
275  dnl When we can't run the test program (we are cross compiling), presume
276  dnl that <unistd.h> has either an accurate prototype for getgroups or none.
277  dnl Old systems without prototypes probably use int.
278  AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h,
279		  ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)
280fi])
281AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups,
282                   [Define to the type of elements in the array set by
283                    `getgroups'. Usually this is either `int' or `gid_t'.])
284])# AC_TYPE_GETGROUPS
285
286
287# AU::AM_TYPE_PTRDIFF_T
288AU_DEFUN([AM_TYPE_PTRDIFF_T],
289[AC_CHECK_TYPES(ptrdiff_t)])
290
291
292# AC_TYPE_UID_T
293# -------------
294# FIXME: Rewrite using AC_CHECK_TYPE.
295AC_DEFUN([AC_TYPE_UID_T],
296[AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t,
297[AC_EGREP_HEADER(uid_t, sys/types.h,
298  ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)])
299if test $ac_cv_type_uid_t = no; then
300  AC_DEFINE(uid_t, int, [Define to `int' if <sys/types.h> doesn't define.])
301  AC_DEFINE(gid_t, int, [Define to `int' if <sys/types.h> doesn't define.])
302fi
303])
304
305
306AC_DEFUN([AC_TYPE_SIZE_T], [AC_CHECK_TYPE(size_t, unsigned)])
307AC_DEFUN([AC_TYPE_PID_T],  [AC_CHECK_TYPE(pid_t,  int)])
308AC_DEFUN([AC_TYPE_OFF_T],  [AC_CHECK_TYPE(off_t,  long)])
309AC_DEFUN([AC_TYPE_MODE_T], [AC_CHECK_TYPE(mode_t, int)])
310
311
312# AC_TYPE_SIGNAL
313# --------------
314# Note that identifiers starting with SIG are reserved by ANSI C.
315AC_DEFUN([AC_TYPE_SIGNAL],
316[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,
317[AC_COMPILE_IFELSE(
318[AC_LANG_PROGRAM([#include <sys/types.h>
319#include <signal.h>
320#ifdef signal
321# undef signal
322#endif
323#ifdef __cplusplus
324extern "C" void (*signal (int, void (*)(int)))(int);
325#else
326void (*signal ()) ();
327#endif
328],
329                 [int i;])],
330                   [ac_cv_type_signal=void],
331                   [ac_cv_type_signal=int])])
332AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
333                   [Define as the return type of signal handlers
334                    (`int' or `void').])
335])
336
337
338## ------------------------ ##
339## Checking size of types.  ##
340## ------------------------ ##
341
342# ---------------- #
343# Generic checks.  #
344# ---------------- #
345
346
347# AC_CHECK_SIZEOF(TYPE, [IGNORED], [INCLUDES])
348# --------------------------------------------
349AC_DEFUN([AC_CHECK_SIZEOF],
350[AS_LITERAL_IF([$1], [],
351               [AC_FATAL([$0: requires literal arguments])])dnl
352AC_CHECK_TYPE([$1], [], [], [$3])
353AC_CACHE_CHECK([size of $1], AS_TR_SH([ac_cv_sizeof_$1]),
354[if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
355  _AC_COMPUTE_INT([sizeof ($1)],
356                  [AS_TR_SH([ac_cv_sizeof_$1])],
357                  [AC_INCLUDES_DEFAULT([$3])])
358else
359  AS_TR_SH([ac_cv_sizeof_$1])=0
360fi])dnl
361AC_DEFINE_UNQUOTED(AS_TR_CPP(sizeof_$1), $AS_TR_SH([ac_cv_sizeof_$1]),
362                   [The size of a `$1', as computed by sizeof.])
363])# AC_CHECK_SIZEOF
364
365
366
367# ---------------- #
368# Generic checks.  #
369# ---------------- #
370
371# AU::AC_INT_16_BITS
372# ------------------
373# What a great name :)
374AU_DEFUN([AC_INT_16_BITS],
375[AC_CHECK_SIZEOF([int])
376AC_DIAGNOSE([obsolete], [$0:
377        your code should no longer depend upon `INT_16_BITS', but upon
378        `SIZEOF_INT'.  Remove this warning and the `AC_DEFINE' when you
379        adjust the code.])dnl
380test $ac_cv_sizeof_int = 2 &&
381  AC_DEFINE(INT_16_BITS, 1,
382            [Define if `sizeof (int)' = 2.  Obsolete, use `SIZEOF_INT'.])
383])
384
385
386# AU::AC_LONG_64_BITS
387# -------------------
388AU_DEFUN([AC_LONG_64_BITS],
389[AC_CHECK_SIZEOF([long int])
390AC_DIAGNOSE([obsolete], [$0:
391        your code should no longer depend upon `LONG_64_BITS', but upon
392        `SIZEOF_LONG_INT'.  Remove this warning and the `AC_DEFINE' when
393        you adjust the code.])dnl
394test $ac_cv_sizeof_long_int = 8 &&
395  AC_DEFINE(LONG_64_BITS, 1,
396            [Define if `sizeof (long int)' = 8.  Obsolete, use
397             `SIZEOF_LONG_INT'.])
398])
399
400
401
402## -------------------------- ##
403## Generic structure checks.  ##
404## -------------------------- ##
405
406
407# ---------------- #
408# Generic checks.  #
409# ---------------- #
410
411# AC_CHECK_MEMBER(AGGREGATE.MEMBER,
412#                 [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
413#                 [INCLUDES])
414# ---------------------------------------------------------
415# AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell
416# variables are not a valid argument.
417AC_DEFUN([AC_CHECK_MEMBER],
418[AS_LITERAL_IF([$1], [],
419               [AC_FATAL([$0: requires literal arguments])])dnl
420m4_if(m4_regexp([$1], [\.]), -1,
421      [AC_FATAL([$0: Did not see any dot in `$1'])])dnl
422AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
423dnl Extract the aggregate name, and the member name
424AC_CACHE_CHECK([for $1], ac_Member,
425[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
426[dnl AGGREGATE ac_aggr;
427static m4_patsubst([$1], [\..*]) ac_aggr;
428dnl ac_aggr.MEMBER;
429if (ac_aggr.m4_patsubst([$1], [^[^.]*\.]))
430return 0;])],
431                [AS_VAR_SET(ac_Member, yes)],
432                [AS_VAR_SET(ac_Member, no)])])
433AS_IF([test AS_VAR_GET(ac_Member) = yes], [$2], [$3])dnl
434AS_VAR_POPDEF([ac_Member])dnl
435])# AC_CHECK_MEMBER
436
437
438# AC_CHECK_MEMBERS([AGGREGATE.MEMBER, ...],
439#                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]
440#                  [INCLUDES])
441# ---------------------------------------------------------
442# The first argument is an m4 list.
443AC_DEFUN([AC_CHECK_MEMBERS],
444[m4_foreach([AC_Member], [$1],
445  [AC_CHECK_MEMBER(AC_Member,
446         [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Member), 1,
447                            [Define if `]m4_patsubst(AC_Member,
448                                                     [^[^.]*\.])[' is
449                             member of `]m4_patsubst(AC_Member, [\..*])['.])
450$2],
451                 [$3],
452                 [$4])])])
453
454
455# ----------------- #
456# Specific checks.  #
457# ----------------- #
458
459# Alphabetic order, please.
460
461# AC_STRUCT_ST_BLKSIZE
462# --------------------
463AU_DEFUN([AC_STRUCT_ST_BLKSIZE],
464[AC_DIAGNOSE([obsolete], [$0:
465        your code should no longer depend upon `HAVE_ST_BLKSIZE', but
466        `HAVE_STRUCT_STAT_ST_BLKSIZE'.  Remove this warning and
467        the `AC_DEFINE' when you adjust the code.])
468AC_CHECK_MEMBERS([struct stat.st_blksize],
469                 [AC_DEFINE(HAVE_ST_BLKSIZE, 1,
470                            [Define if your `struct stat' has
471                             `st_blksize'.  Deprecated, use
472                             `HAVE_STRUCT_STAT_ST_BLKSIZE' instead.])])
473])# AC_STRUCT_ST_BLKSIZE
474
475
476# AC_STRUCT_ST_BLOCKS
477# -------------------
478# If `struct stat' contains an `st_blocks' member, define
479# HAVE_STRUCT_STAT_ST_BLOCKS.  Otherwise, add `fileblocks.o' to the
480# output variable LIBOBJS.  We still define HAVE_ST_BLOCKS for backward
481# compatibility.  In the future, we will activate specializations for
482# this macro, so don't obsolete it right now.
483#
484# AC_OBSOLETE([$0], [; replace it with
485#   AC_CHECK_MEMBERS([struct stat.st_blocks],
486#                     [AC_LIBOBJ([fileblocks])])
487# Please note that it will define `HAVE_STRUCT_STAT_ST_BLOCKS',
488# and not `HAVE_ST_BLOCKS'.])dnl
489#
490AC_DEFUN([AC_STRUCT_ST_BLOCKS],
491[AC_CHECK_MEMBERS([struct stat.st_blocks],
492                  [AC_DEFINE(HAVE_ST_BLOCKS, 1,
493                             [Define if your `struct stat' has
494                              `st_blocks'.  Deprecated, use
495                              `HAVE_STRUCT_STAT_ST_BLOCKS' instead.])],
496                  [AC_LIBOBJ([fileblocks])])
497])# AC_STRUCT_ST_BLOCKS
498
499
500# AC_STRUCT_ST_RDEV
501# -----------------
502AU_DEFUN([AC_STRUCT_ST_RDEV],
503[AC_DIAGNOSE([obsolete], [$0:
504        your code should no longer depend upon `HAVE_ST_RDEV', but
505        `HAVE_STRUCT_STAT_ST_RDEV'.  Remove this warning and
506        the `AC_DEFINE' when you adjust the code.])
507AC_CHECK_MEMBERS([struct stat.st_rdev],
508                 [AC_DEFINE(HAVE_ST_RDEV, 1,
509                            [Define if your `struct stat' has `st_rdev'.
510                             Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV'
511                             instead.])])
512])# AC_STRUCT_ST_RDEV
513
514
515# AC_STRUCT_TM
516# ------------
517# FIXME: This macro is badly named, it should be AC_CHECK_TYPE_STRUCT_TM.
518# Or something else, but what? AC_CHECK_TYPE_STRUCT_TM_IN_SYS_TIME?
519AC_DEFUN([AC_STRUCT_TM],
520[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h],
521  ac_cv_struct_tm,
522[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
523#include <time.h>
524],
525                                    [struct tm *tp; tp->tm_sec;])],
526                   [ac_cv_struct_tm=time.h],
527                   [ac_cv_struct_tm=sys/time.h])])
528if test $ac_cv_struct_tm = sys/time.h; then
529  AC_DEFINE(TM_IN_SYS_TIME, 1,
530            [Define if your <sys/time.h> declares `struct tm'.])
531fi
532])# AC_STRUCT_TM
533
534
535# AC_STRUCT_TIMEZONE
536# ------------------
537# Figure out how to get the current timezone.  If `struct tm' has a
538# `tm_zone' member, define `HAVE_TM_ZONE'.  Otherwise, if the
539# external array `tzname' is found, define `HAVE_TZNAME'.
540AC_DEFUN([AC_STRUCT_TIMEZONE],
541[AC_REQUIRE([AC_STRUCT_TM])dnl
542AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h>
543#include <$ac_cv_struct_tm>
544])
545if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
546  AC_DEFINE(HAVE_TM_ZONE, 1,
547            [Define if your `struct tm' has `tm_zone'. Deprecated, use
548             `HAVE_STRUCT_TM_TM_ZONE' instead.])
549else
550  AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
551[AC_TRY_LINK(
552[#include <time.h>
553#ifndef tzname /* For SGI.  */
554extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
555#endif
556],
557[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
558  if test $ac_cv_var_tzname = yes; then
559    AC_DEFINE(HAVE_TZNAME, 1,
560              [Define if you don't have `tm_zone' but do have the external
561               array `tzname'.])
562  fi
563fi
564])# AC_STRUCT_TIMEZONE
565