xref: /freebsd/contrib/file/acinclude.m4 (revision 898496ee09ed2b7d25f6807edc4515628196ec0a)
1649d615cSDavid E. O'Briendnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
2649d615cSDavid E. O'Brien
38ed12636SDavid E. O'BrienAC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
4649d615cSDavid E. O'Brien[AC_REQUIRE([AC_STRUCT_TM])dnl
5649d615cSDavid E. O'BrienAC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
643a5ec4eSXin LI[AC_COMPILE_IFELSE(
743a5ec4eSXin LI[AC_LANG_PROGRAM([#include <sys/types.h>
843a5ec4eSXin LI#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;])],
9649d615cSDavid E. O'Brien  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
10649d615cSDavid E. O'Brienif test "$ac_cv_struct_tm_zone" = yes; then
118ed12636SDavid E. O'Brien  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
12649d615cSDavid E. O'Brienfi
1370b95ceeSXin LI
1480c86c36SDavid E. O'Brien# On SGI, apparently tzname is a #define, but that's ok, AC_CHECK_DECL will
1580c86c36SDavid E. O'Brien# consider it declared and we won't give our own extern.
1680c86c36SDavid E. O'BrienAC_CHECK_DECLS([tzname], , , [#include <time.h>])
17649d615cSDavid E. O'BrienAC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
1843a5ec4eSXin LI[AC_LINK_IFELSE(
1943a5ec4eSXin LI[AC_LANG_PROGRAM([#include <time.h>],
2043a5ec4eSXin LI[[#if !HAVE_DECL_TZNAME
2180c86c36SDavid E. O'Brienextern char *tzname[];
2243a5ec4eSXin LI#endif
2343a5ec4eSXin LIreturn tzname[0][0];]])], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])])
24649d615cSDavid E. O'Brien  if test $ac_cv_var_tzname = yes; then
258ed12636SDavid E. O'Brien    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
26649d615cSDavid E. O'Brien  fi
27649d615cSDavid E. O'Brien
28649d615cSDavid E. O'BrienAC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
2943a5ec4eSXin LI[AC_COMPILE_IFELSE(
3043a5ec4eSXin LI[AC_LANG_PROGRAM([#include <sys/types.h>
3143a5ec4eSXin LI#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;])],
32649d615cSDavid E. O'Brien  ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
33649d615cSDavid E. O'Brienif test "$ac_cv_struct_tm_isdst" = yes; then
3428a8b562SDavid E. O'Brien  AC_DEFINE(HAVE_TM_ISDST,1,[HAVE_TM_ISDST])
35649d615cSDavid E. O'Brienfi
3670b95ceeSXin LI
3780c86c36SDavid E. O'Brien
38a2dfb722SXin LIAC_CHECK_DECLS([daylight], , , [#include <time.h>
39a2dfb722SXin LI#include <stdlib.h>])
40649d615cSDavid E. O'BrienAC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
4143a5ec4eSXin LI[AC_LINK_IFELSE(
42*898496eeSXin LI[AC_LANG_PROGRAM([#include <time.h>
43*898496eeSXin LI#include <stdlib.h>],
4443a5ec4eSXin LI[#if !HAVE_DECL_DAYLIGHT
45649d615cSDavid E. O'Brienextern int daylight;
4643a5ec4eSXin LI#endif
47*898496eeSXin LIdaylight = atoi("1");])], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
48649d615cSDavid E. O'Brien  if test $ac_cv_var_daylight = yes; then
4928a8b562SDavid E. O'Brien    AC_DEFINE(HAVE_DAYLIGHT,1,[HAVE_DAYLIGHT])
50649d615cSDavid E. O'Brien  fi
51649d615cSDavid E. O'Brien])
5270b95ceeSXin LI
5370b95ceeSXin LIAC_DEFUN([AC_STRUCT_OPTION_GETOPT_H],
5470b95ceeSXin LI[AC_CACHE_CHECK([for struct option in getopt], ac_cv_struct_option_getopt_h,
5543a5ec4eSXin LI[AC_COMPILE_IFELSE(
5643a5ec4eSXin LI[AC_LANG_PROGRAM([#include <getopt.h>], [struct option op; op.name;])],
5770b95ceeSXin LI  ac_cv_struct_option_getopt_h=yes, ac_cv_struct_option_getopt_h=no)])
5870b95ceeSXin LIif test "$ac_cv_struct_option_getopt_h" = yes; then
5970b95ceeSXin LI  AC_DEFINE(HAVE_STRUCT_OPTION,1,[HAVE_STRUCT_OPTION])
6070b95ceeSXin LIfi
6170b95ceeSXin LI])
62