From: Wouter Wijngaards Date: Tue, 28 Sep 2010 14:58:35 +0000 (+0000) Subject: strptime compat in configure (for Minix). X-Git-Tag: release-1.4.7rc1~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67897d9c0dc0e682633c123c852b4bd7889bb421;p=thirdparty%2Funbound.git strptime compat in configure (for Minix). git-svn-id: file:///svn/unbound/trunk@2262 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/compat/strptime.c b/compat/strptime.c index 0b4ecdb2b..47c793062 100644 --- a/compat/strptime.c +++ b/compat/strptime.c @@ -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; diff --git a/config.h.in b/config.h.in index 81c0c7ba6..322bcdbc2 100644 --- a/config.h.in +++ b/config.h.in @@ -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 diff --git a/configure b/configure index 6f940de3e..ad70f899b 100755 --- a/configure +++ b/configure @@ -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; } diff --git a/configure.ac b/configure.ac index 2ea4e7d82..7af37e0c3 100644 --- a/configure.ac +++ b/configure.ac @@ -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