xref: /freebsd/contrib/file/acinclude.m4 (revision b2db760808f74bb53c232900091c9da801ebbfcc)
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_TRY_COMPILE([#include <sys/types.h>
7#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
8  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
9if test "$ac_cv_struct_tm_zone" = yes; then
10  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
11fi
12
13AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
14[AC_TRY_LINK(
15changequote(<<, >>)dnl
16<<#include <time.h>
17#ifndef tzname /* For SGI.  */
18extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
19#endif>>,
20changequote([, ])dnl
21[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
22  if test $ac_cv_var_tzname = yes; then
23    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
24  fi
25
26AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
27[AC_TRY_COMPILE([#include <sys/types.h>
28#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;],
29  ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
30if test "$ac_cv_struct_tm_isdst" = yes; then
31  AC_DEFINE(HAVE_TM_ISDST,1,[HAVE_TM_ISDST])
32fi
33
34AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
35[AC_TRY_LINK(
36changequote(<<, >>)dnl
37<<#include <time.h>
38#ifndef daylight /* In case IRIX #defines this, too  */
39extern int daylight;
40#endif>>,
41changequote([, ])dnl
42[atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
43  if test $ac_cv_var_daylight = yes; then
44    AC_DEFINE(HAVE_DAYLIGHT,1,[HAVE_DAYLIGHT])
45  fi
46])
47
48AC_DEFUN([AC_STRUCT_OPTION_GETOPT_H],
49[AC_CACHE_CHECK([for struct option in getopt], ac_cv_struct_option_getopt_h,
50[AC_TRY_COMPILE([#include <getopt.h>], [struct option op; op.name;],
51  ac_cv_struct_option_getopt_h=yes, ac_cv_struct_option_getopt_h=no)])
52if test "$ac_cv_struct_option_getopt_h" = yes; then
53  AC_DEFINE(HAVE_STRUCT_OPTION,1,[HAVE_STRUCT_OPTION])
54fi
55])
56