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