]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
strptime compat in configure (for Minix).
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 28 Sep 2010 14:58:35 +0000 (14:58 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 28 Sep 2010 14:58:35 +0000 (14:58 +0000)
git-svn-id: file:///svn/unbound/trunk@2262 be551aaa-1e26-0410-a405-d3ace91eadb9

compat/strptime.c
config.h.in
configure
configure.ac

index 0b4ecdb2bc47253cd3df29169df190e16799d8ba..47c7930621df30fc8aac8e741fbb89a18ab8648a 100644 (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;
index 81c0c7ba6ba74c28c7616b3405a979a24271ec9e..322bcdbc2638322b29625393426e6cbf6e7c239b 100644 (file)
 /* 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
index 6f940de3ec079d3af61f17fd4b047134acbfff26..ad70f899bcd9a110c26dd506e37455e5bc7d474e 100755 (executable)
--- a/configure
+++ b/configure
 
 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; }
index 2ea4e7d82758ecc3217dc9045f869c65c3d4076e..7af37e0c340473e9f1a60072bd5787f397c3c058 100644 (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