xref: /netbsd-src/external/bsd/file/dist/acinclude.m4 (revision e15daa8be9575f7ad2ca804c7c7c2d7f8e182d98)
11b108b8bSchristosdnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
21b108b8bSchristos
31b108b8bSchristosAC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
41b108b8bSchristos[AC_REQUIRE([AC_STRUCT_TM])dnl
51b108b8bSchristosAC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
6a77ebd86Schristos[AC_COMPILE_IFELSE(
7a77ebd86Schristos[AC_LANG_PROGRAM([#include <sys/types.h>
8a77ebd86Schristos#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;])],
91b108b8bSchristos  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
101b108b8bSchristosif test "$ac_cv_struct_tm_zone" = yes; then
111b108b8bSchristos  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
121b108b8bSchristosfi
131b108b8bSchristos
145ccaa8c0Schristos# On SGI, apparently tzname is a #define, but that's ok, AC_CHECK_DECL will
155ccaa8c0Schristos# consider it declared and we won't give our own extern.
165ccaa8c0SchristosAC_CHECK_DECLS([tzname], , , [#include <time.h>])
171b108b8bSchristosAC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
18a77ebd86Schristos[AC_LINK_IFELSE(
19a77ebd86Schristos[AC_LANG_PROGRAM([#include <time.h>],
20a77ebd86Schristos[[#if !HAVE_DECL_TZNAME
215ccaa8c0Schristosextern char *tzname[];
22a77ebd86Schristos#endif
23a77ebd86Schristosreturn tzname[0][0];]])], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])])
241b108b8bSchristos  if test $ac_cv_var_tzname = yes; then
251b108b8bSchristos    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
261b108b8bSchristos  fi
271b108b8bSchristos
281b108b8bSchristosAC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
29a77ebd86Schristos[AC_COMPILE_IFELSE(
30a77ebd86Schristos[AC_LANG_PROGRAM([#include <sys/types.h>
31a77ebd86Schristos#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;])],
321b108b8bSchristos  ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
331b108b8bSchristosif test "$ac_cv_struct_tm_isdst" = yes; then
341b108b8bSchristos  AC_DEFINE(HAVE_TM_ISDST,1,[HAVE_TM_ISDST])
351b108b8bSchristosfi
361b108b8bSchristos
375ccaa8c0Schristos
38a77ebd86SchristosAC_CHECK_DECLS([daylight], , , [#include <time.h>
39a77ebd86Schristos#include <stdlib.h>])
401b108b8bSchristosAC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
41a77ebd86Schristos[AC_LINK_IFELSE(
42*e15daa8bSchristos[AC_LANG_PROGRAM([#include <time.h>
43*e15daa8bSchristos#include <stdlib.h>],
44a77ebd86Schristos[#if !HAVE_DECL_DAYLIGHT
451b108b8bSchristosextern int daylight;
46a77ebd86Schristos#endif
47*e15daa8bSchristosdaylight = atoi("1");])], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
481b108b8bSchristos  if test $ac_cv_var_daylight = yes; then
491b108b8bSchristos    AC_DEFINE(HAVE_DAYLIGHT,1,[HAVE_DAYLIGHT])
501b108b8bSchristos  fi
511b108b8bSchristos])
521b108b8bSchristos
531b108b8bSchristosAC_DEFUN([AC_STRUCT_OPTION_GETOPT_H],
541b108b8bSchristos[AC_CACHE_CHECK([for struct option in getopt], ac_cv_struct_option_getopt_h,
55a77ebd86Schristos[AC_COMPILE_IFELSE(
56a77ebd86Schristos[AC_LANG_PROGRAM([#include <getopt.h>], [struct option op; op.name;])],
571b108b8bSchristos  ac_cv_struct_option_getopt_h=yes, ac_cv_struct_option_getopt_h=no)])
581b108b8bSchristosif test "$ac_cv_struct_option_getopt_h" = yes; then
591b108b8bSchristos  AC_DEFINE(HAVE_STRUCT_OPTION,1,[HAVE_STRUCT_OPTION])
601b108b8bSchristosfi
611b108b8bSchristos])
62