184685Sobriendnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
284685Sobrien
3103373SobrienAC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
484685Sobrien[AC_REQUIRE([AC_STRUCT_TM])dnl
584685SobrienAC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
684685Sobrien[AC_TRY_COMPILE([#include <sys/types.h>
784685Sobrien#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
884685Sobrien  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
984685Sobrienif test "$ac_cv_struct_tm_zone" = yes; then
10103373Sobrien  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
1184685Sobrienfi
12192350Sdelphij
13234449Sobrien# On SGI, apparently tzname is a #define, but that's ok, AC_CHECK_DECL will
14234449Sobrien# consider it declared and we won't give our own extern.
15234449SobrienAC_CHECK_DECLS([tzname], , , [#include <time.h>])
1684685SobrienAC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
1784685Sobrien[AC_TRY_LINK(
18234449Sobrien[#include <time.h>
19234449Sobrien#if !HAVE_DECL_TZNAME
20234449Sobrienextern char *tzname[];
21234449Sobrien#endif],
22234449Sobrien[return tzname[0][0];], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])])
2384685Sobrien  if test $ac_cv_var_tzname = yes; then
24103373Sobrien    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
2584685Sobrien  fi
2684685Sobrien
2784685SobrienAC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
2884685Sobrien[AC_TRY_COMPILE([#include <sys/types.h>
2984685Sobrien#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;],
3084685Sobrien  ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
3184685Sobrienif test "$ac_cv_struct_tm_isdst" = yes; then
32186691Sobrien  AC_DEFINE(HAVE_TM_ISDST,1,[HAVE_TM_ISDST])
3384685Sobrienfi
34192350Sdelphij
35234449Sobrien
36234449SobrienAC_CHECK_DECLS([daylight], , , [#include <time.h>])
3784685SobrienAC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
3884685Sobrien[AC_TRY_LINK(
3984685Sobrienchangequote(<<, >>)dnl
4084685Sobrien<<#include <time.h>
41234449Sobrien#if !HAVE_DECL_DAYLIGHT
4284685Sobrienextern int daylight;
4384685Sobrien#endif>>,
4484685Sobrienchangequote([, ])dnl
4584685Sobrien[atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
4684685Sobrien  if test $ac_cv_var_daylight = yes; then
47186691Sobrien    AC_DEFINE(HAVE_DAYLIGHT,1,[HAVE_DAYLIGHT])
4884685Sobrien  fi
4984685Sobrien])
50192350Sdelphij
51192350SdelphijAC_DEFUN([AC_STRUCT_OPTION_GETOPT_H],
52192350Sdelphij[AC_CACHE_CHECK([for struct option in getopt], ac_cv_struct_option_getopt_h,
53192350Sdelphij[AC_TRY_COMPILE([#include <getopt.h>], [struct option op; op.name;],
54192350Sdelphij  ac_cv_struct_option_getopt_h=yes, ac_cv_struct_option_getopt_h=no)])
55192350Sdelphijif test "$ac_cv_struct_option_getopt_h" = yes; then
56192350Sdelphij  AC_DEFINE(HAVE_STRUCT_OPTION,1,[HAVE_STRUCT_OPTION])
57192350Sdelphijfi
58192350Sdelphij])
59