xref: /freebsd/contrib/file/acinclude.m4 (revision be181ee2a28aa2b4b0e76684bce9f673ef668874)
1dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
2
3AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
4[AC_REQUIRE([AC_STRUCT_TM])dnl
5AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
6[AC_COMPILE_IFELSE(
7[AC_LANG_PROGRAM([#include <sys/types.h>
8#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;])],
9  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
10if test "$ac_cv_struct_tm_zone" = yes; then
11  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
12fi
13
14# On SGI, apparently tzname is a #define, but that's ok, AC_CHECK_DECL will
15# consider it declared and we won't give our own extern.
16AC_CHECK_DECLS([tzname], , , [#include <time.h>])
17AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
18[AC_LINK_IFELSE(
19[AC_LANG_PROGRAM([#include <time.h>],
20[[#if !HAVE_DECL_TZNAME
21extern char *tzname[];
22#endif
23return tzname[0][0];]])], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])])
24  if test $ac_cv_var_tzname = yes; then
25    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
26  fi
27
28AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
29[AC_COMPILE_IFELSE(
30[AC_LANG_PROGRAM([#include <sys/types.h>
31#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;])],
32  ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
33if test "$ac_cv_struct_tm_isdst" = yes; then
34  AC_DEFINE(HAVE_TM_ISDST,1,[HAVE_TM_ISDST])
35fi
36
37
38AC_CHECK_DECLS([daylight], , , [#include <time.h>
39#include <stdlib.h>])
40AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
41[AC_LINK_IFELSE(
42[AC_LANG_PROGRAM([#include <time.h>],
43[#if !HAVE_DECL_DAYLIGHT
44extern int daylight;
45#endif
46atoi(daylight);])], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
47  if test $ac_cv_var_daylight = yes; then
48    AC_DEFINE(HAVE_DAYLIGHT,1,[HAVE_DAYLIGHT])
49  fi
50])
51
52AC_DEFUN([AC_STRUCT_OPTION_GETOPT_H],
53[AC_CACHE_CHECK([for struct option in getopt], ac_cv_struct_option_getopt_h,
54[AC_COMPILE_IFELSE(
55[AC_LANG_PROGRAM([#include <getopt.h>], [struct option op; op.name;])],
56  ac_cv_struct_option_getopt_h=yes, ac_cv_struct_option_getopt_h=no)])
57if test "$ac_cv_struct_option_getopt_h" = yes; then
58  AC_DEFINE(HAVE_STRUCT_OPTION,1,[HAVE_STRUCT_OPTION])
59fi
60])
61