xref: /freebsd/contrib/file/acinclude.m4 (revision faf25f48d601ae39f5752602f3020e2e92605625)
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>])
39AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
40[AC_LINK_IFELSE(
41[AC_LANG_PROGRAM([#include <time.h>],
42[#if !HAVE_DECL_DAYLIGHT
43extern int daylight;
44#endif
45atoi(daylight);])], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
46  if test $ac_cv_var_daylight = yes; then
47    AC_DEFINE(HAVE_DAYLIGHT,1,[HAVE_DAYLIGHT])
48  fi
49])
50
51AC_DEFUN([AC_STRUCT_OPTION_GETOPT_H],
52[AC_CACHE_CHECK([for struct option in getopt], ac_cv_struct_option_getopt_h,
53[AC_COMPILE_IFELSE(
54[AC_LANG_PROGRAM([#include <getopt.h>], [struct option op; op.name;])],
55  ac_cv_struct_option_getopt_h=yes, ac_cv_struct_option_getopt_h=no)])
56if test "$ac_cv_struct_option_getopt_h" = yes; then
57  AC_DEFINE(HAVE_STRUCT_OPTION,1,[HAVE_STRUCT_OPTION])
58fi
59])
60