strptime compat in configure (for Minix).

git-svn-id: file:///svn/unbound/trunk@2262 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2010-09-28 14:58:35 +00:00
parent 560e1d7e8a
commit 67897d9c0d
4 changed files with 31 additions and 10 deletions

View file

@ -104,7 +104,7 @@ str2int(const char **buf, int max)
* using the format specified by format
**/
char *
nsd_strptime(const char *s, const char *format, struct tm *tm)
unbound_strptime(const char *s, const char *format, struct tm *tm)
{
int c, alt_format, ret;
int split_year = 0;
@ -152,7 +152,7 @@ nsd_strptime(const char *s, const char *format, struct tm *tm)
tm->tm_mon = ret;
break;
case 'c': /* date and time representation */
if (!(s = nsd_strptime(s, "%x %X", tm))) {
if (!(s = unbound_strptime(s, "%x %X", tm))) {
return NULL;
}
break;
@ -179,7 +179,7 @@ nsd_strptime(const char *s, const char *format, struct tm *tm)
tm->tm_mday = ret;
break;
case 'D': /* equivalent to %m/%d/%y */
if (!(s = nsd_strptime(s, "%m/%d/%y", tm))) {
if (!(s = unbound_strptime(s, "%m/%d/%y", tm))) {
return NULL;
}
break;
@ -239,12 +239,12 @@ nsd_strptime(const char *s, const char *format, struct tm *tm)
tm->tm_hour += 12;
break;
case 'r': /* equivalent of %I:%M:%S %p */
if (!(s = nsd_strptime(s, "%I:%M:%S %p", tm))) {
if (!(s = unbound_strptime(s, "%I:%M:%S %p", tm))) {
return NULL;
}
break;
case 'R': /* equivalent of %H:%M */
if (!(s = nsd_strptime(s, "%H:%M", tm))) {
if (!(s = unbound_strptime(s, "%H:%M", tm))) {
return NULL;
}
break;
@ -258,7 +258,7 @@ nsd_strptime(const char *s, const char *format, struct tm *tm)
tm->tm_sec = ret;
break;
case 'T': /* equivalent of %H:%M:%S */
if (!(s = nsd_strptime(s, "%H:%M:%S", tm))) {
if (!(s = unbound_strptime(s, "%H:%M:%S", tm))) {
return NULL;
}
break;
@ -288,12 +288,12 @@ nsd_strptime(const char *s, const char *format, struct tm *tm)
**/
break;
case 'x': /* date format */
if (!(s = nsd_strptime(s, "%m/%d/%y", tm))) {
if (!(s = unbound_strptime(s, "%m/%d/%y", tm))) {
return NULL;
}
break;
case 'X': /* time format */
if (!(s = nsd_strptime(s, "%H:%M:%S", tm))) {
if (!(s = unbound_strptime(s, "%H:%M:%S", tm))) {
return NULL;
}
break;

View file

@ -289,6 +289,9 @@
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strptime' function. */
#undef HAVE_STRPTIME
/* Define if you have Swig libraries and header files. */
#undef HAVE_SWIG
@ -812,6 +815,12 @@ int memcmp(const void *x, const void *y, size_t n);
char *ctime_r(const time_t *timep, char *buf);
#endif
#ifndef HAVE_STRPTIME
#define strptime unbound_strptime
struct tm;
char *strptime(const char *s, const char *format, struct tm *tm);
#endif
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
/* using version of libevent that is not threadsafe. */
# define LIBEVENT_SIGNAL_PROBLEM 1

8
configure vendored
View file

@ -16131,8 +16131,13 @@ fi
fi
ac_fn_c_check_func "$LINENO" "strptime" "ac_cv_func_strptime"
for ac_func in strptime
do :
ac_fn_c_check_func "$LINENO" "strptime" "ac_cv_func_strptime"
if test "x$ac_cv_func_strptime" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRPTIME 1
_ACEOF
else
case " $LIBOBJS " in
@ -16142,6 +16147,7 @@ else
esac
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setusercontext" >&5
$as_echo_n "checking for library containing setusercontext... " >&6; }

View file

@ -654,7 +654,7 @@ if test $ac_cv_func_daemon = yes; then
])
fi
AC_CHECK_FUNC([strptime],,[AC_LIBOBJ([strptime])])
AC_CHECK_FUNCS([strptime],,[AC_LIBOBJ([strptime])])
AC_SEARCH_LIBS([setusercontext], [util])
AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex])
AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
@ -822,6 +822,12 @@ AHX_MEMCMP_BROKEN(unbound)
char *ctime_r(const time_t *timep, char *buf);
#endif
#ifndef HAVE_STRPTIME
#define strptime unbound_strptime
struct tm;
char *strptime(const char *s, const char *format, struct tm *tm);
#endif
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
/* using version of libevent that is not threadsafe. */
# define LIBEVENT_SIGNAL_PROBLEM 1