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