From a5a1b59195b643a238b2ce1208df1bc3f0521494 Mon Sep 17 00:00:00 2001 From: arai Date: Mon, 27 May 2002 15:35:08 +0000 Subject: [PATCH] * configure.ac, config.h.in: use new autoconf macro, AC_CHECK_MEMBERS(). * IFNAMES, configure.in, src/header.c, src/lharc.c: replaced with new macro name. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@143 6a8cc165-1e22-0410-a132-eb4e3f353aba --- IFNAMES | 4 ++-- config.h.in | 12 ++++++------ configure.ac | 39 ++++++++++++++++----------------------- configure.in | 20 ++++++++++++-------- src/header.c | 6 +++--- src/lharc.c | 2 +- 6 files changed, 40 insertions(+), 43 deletions(-) diff --git a/IFNAMES b/IFNAMES index d8a4c79..ae34c6c 100644 --- a/IFNAMES +++ b/IFNAMES @@ -13,7 +13,7 @@ EXTEND_TOWNSOS lhlist.c # FTIME header.c replace with HAVE_FTIME # GETTIMEOFDAY header.c replace with HAVE_GETTIMEOFDAY # SYSV_SYSTEM_DIR lha_macro.h replace with HAVE_DIRENT_H -# HAVE_TM_ZONE header.c replace with HAVE_TM_GMTOFF +# HAVE_TM_ZONE header.c replace with HAVE_STRUCT_TM_TM_GMTOFF LHA_MAIN_SRC lha.h lha_macro.h # LONG_MAX lha_macro.h # LONG_MIN lha_macro.h @@ -35,7 +35,7 @@ NONSYSTEM_DIR_LIBRARY lha_macro.h no use (???) NOT_COMPATIBLE_MODE header.c lhext.c NOT_USED header.c NOVOID lha_macro.h -# NO_INODE lharc.c replace with !HAVE_ST_INO (???) +# NO_INODE lharc.c replace with !HAVE_STRUCT_STAT_ST_INO # HAVE_NO_LCHOWN lhext.c replace with !HAVE_LCHOWN NULL lha_macro.h OSK header.c diff --git a/config.h.in b/config.h.in index 3188703..dc293ae 100644 --- a/config.h.in +++ b/config.h.in @@ -82,12 +82,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if `st_ino' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_INO + +/* Define to 1 if `tm_gmtoff' is member of `struct tm'. */ +#undef HAVE_STRUCT_TM_TM_GMTOFF + /* Define to 1 if `tm_zone' is member of `struct tm'. */ #undef HAVE_STRUCT_TM_TM_ZONE -/* Define if your struct stat has st_ino */ -#undef HAVE_ST_INO - /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H @@ -114,9 +117,6 @@ /* Define to 1 if you have the `timelocal' function. */ #undef HAVE_TIMELOCAL -/* Define if your struct tm has tm_gmtoff */ -#undef HAVE_TM_GMTOFF - /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #undef HAVE_TM_ZONE diff --git a/configure.ac b/configure.ac index ccf9c12..752636a 100644 --- a/configure.ac +++ b/configure.ac @@ -28,33 +28,26 @@ AC_HEADER_TIME AC_STRUCT_TM AC_STRUCT_TIMEZONE -AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, -[AC_TRY_COMPILE([ -#if TM_IN_SYS_TIME -#include +AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct stat.st_ino],,, +[ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if TIME_WITH_SYS_TIME +# include +# include #else -#include +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif #endif - ], [struct tm t; t.tm_gmtoff;], - ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no) -]) - -if test "x$ac_cv_struct_tm_gmtoff" = xyes; then - AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if your struct tm has tm_gmtoff]) -fi - -AC_CACHE_CHECK([for st_ino in struct stat], ac_cv_struct_st_ino, -[AC_TRY_COMPILE([ -#include -#include - ], [struct stat s; s.st_ino;], - ac_cv_struct_st_ino=yes, ac_cv_struct_st_ino=no) ]) -if test "x$ac_cv_struct_st_ino" = xyes; then - AC_DEFINE(HAVE_ST_INO, 1, [Define if your struct stat has st_ino]) -fi - dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_FORK diff --git a/configure.in b/configure.in index f21c5e9..5eed0d9 100644 --- a/configure.in +++ b/configure.in @@ -31,7 +31,7 @@ AC_HEADER_TIME AC_STRUCT_TM AC_STRUCT_TIMEZONE -AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, +AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_member_struct_tm_tm_gmtoff, [AC_TRY_COMPILE([ #if TM_IN_SYS_TIME #include @@ -39,23 +39,27 @@ AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, #include #endif ], [struct tm t; t.tm_gmtoff;], - ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no) + ac_cv_member_struct_tm_tm_gmtoff=yes, + ac_cv_member_struct_tm_tm_gmtoff=no) ]) -if test "x$ac_cv_struct_tm_gmtoff" = xyes; then - AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if your struct tm has tm_gmtoff]) +if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then + AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF, 1, + [Define if your struct tm has tm_gmtoff]) fi -AC_CACHE_CHECK([for st_ino in struct stat], ac_cv_struct_st_ino, +AC_CACHE_CHECK([for st_ino in struct stat], ac_cv_member_struct_stat_st_ino, [AC_TRY_COMPILE([ #include #include ], [struct stat s; s.st_ino;], - ac_cv_struct_st_ino=yes, ac_cv_struct_st_ino=no) + ac_cv_member_struct_stat_st_ino=yes, + ac_cv_member_struct_stat_st_ino=no) ]) -if test "x$ac_cv_struct_st_ino" = xyes; then - AC_DEFINE(HAVE_ST_INO, 1, [Define if your struct stat has st_ino]) +if test "x$ac_cv_member_struct_stat_st_ino" = xyes; then + AC_DEFINE(HAVE_STRUCT_STAT_ST_INO, 1, + [Define if your struct stat has st_ino]) fi dnl Checks for library functions. diff --git a/src/header.c b/src/header.c index 82e504d..c063e4b 100644 --- a/src/header.c +++ b/src/header.c @@ -374,12 +374,12 @@ gettz() /* ------------------------------------------------------------------------ */ #if !defined(HAVE_TZSET) && !defined(HAVE_FTIME) /* maybe defined(HAVE_GETTIMEOFDAY) */ { -#ifdef HAVE_TM_GMTOFF +#ifdef HAVE_STRUCT_TM_TM_GMTOFF time_t tt; time(&tt); return -localtime(&tt)->tm_gmtoff; -#else /* HAVE_TM_GMTOFF */ +#else /* HAVE_STRUCT_TM_TM_GMTOFF */ struct timeval tp; struct timezone tzp; gettimeofday(&tp, &tzp);/* specific to 4.3BSD */ @@ -388,7 +388,7 @@ gettz() * 60L : 0)); */ return (tzp.tz_minuteswest * 60L); -#endif /* HAVE_TM_GMTOFF */ +#endif /* HAVE_STRUCT_TM_TM_GMTOFF */ } #endif #endif /* defined(HAVE_FTIME) || defined(HAVE_GETTIMEOFDAY) || diff --git a/src/lharc.c b/src/lharc.c index 0ba5234..135db34 100644 --- a/src/lharc.c +++ b/src/lharc.c @@ -869,7 +869,7 @@ find_files(name, v_filec, v_filev) newname[len + n] = '\0'; if (GETSTAT(newname, &fil_stbuf) < 0) continue; -#if !defined(HAVE_ST_INO) || __MINGW32__ +#if !defined(HAVE_STRUCT_STAT_ST_INO) || __MINGW32__ if ( dp->d_name[0] != '.' || (n != 1 && (dp->d_name[1] != '.' || -- 2.11.0