file/acinclude.m4

62 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
[AC_REQUIRE([AC_STRUCT_TM])dnl
AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
2021-07-01 14:55:35 +08:00
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;])],
ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
if test "$ac_cv_struct_tm_zone" = yes; then
AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
fi
2009-02-14 02:48:05 +08:00
2010-07-22 00:47:17 +08:00
# On SGI, apparently tzname is a #define, but that's ok, AC_CHECK_DECL will
# consider it declared and we won't give our own extern.
AC_CHECK_DECLS([tzname], , , [#include <time.h>])
AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
2021-07-01 14:55:35 +08:00
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <time.h>],
2021-09-24 03:52:41 +08:00
[[#if !HAVE_DECL_TZNAME
2010-07-22 00:47:17 +08:00
extern char *tzname[];
2021-07-01 14:55:35 +08:00
#endif
2021-09-24 03:52:41 +08:00
return tzname[0][0];]])], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])])
if test $ac_cv_var_tzname = yes; then
AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
fi
AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
2021-07-01 14:55:35 +08:00
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;])],
ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
if test "$ac_cv_struct_tm_isdst" = yes; then
2008-02-07 08:58:51 +08:00
AC_DEFINE(HAVE_TM_ISDST,1,[HAVE_TM_ISDST])
fi
2009-02-14 02:48:05 +08:00
2010-07-22 00:47:17 +08:00
AC_CHECK_DECLS([daylight], , , [#include <time.h>
#include <stdlib.h>])
AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
2021-07-01 14:55:35 +08:00
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <time.h>
#include <stdlib.h>],
2021-07-01 14:55:35 +08:00
[#if !HAVE_DECL_DAYLIGHT
extern int daylight;
2021-07-01 14:55:35 +08:00
#endif
2022-11-20 01:47:30 +08:00
daylight = atoi("1");])], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
if test $ac_cv_var_daylight = yes; then
2008-02-07 08:58:51 +08:00
AC_DEFINE(HAVE_DAYLIGHT,1,[HAVE_DAYLIGHT])
fi
])
2009-02-14 02:48:05 +08:00
AC_DEFUN([AC_STRUCT_OPTION_GETOPT_H],
[AC_CACHE_CHECK([for struct option in getopt], ac_cv_struct_option_getopt_h,
2021-07-01 14:55:35 +08:00
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <getopt.h>], [struct option op; op.name;])],
2009-02-14 02:48:05 +08:00
ac_cv_struct_option_getopt_h=yes, ac_cv_struct_option_getopt_h=no)])
if test "$ac_cv_struct_option_getopt_h" = yes; then
AC_DEFINE(HAVE_STRUCT_OPTION,1,[HAVE_STRUCT_OPTION])
fi
])