rather than hand-crafted conversion, avoid signed int overflow there.
Add configure support for SIZEOF_LONG_LONG to enable portable use of
snprintf() with time_t.
bk: 4d37f1f4gpu7tDOPSbW-bC83_nxKtg
-* changed timeval / timespec string conversion (snprintf() format
- strings for time_t vs. int / long / long long; avoid signed integer
- overflow)
+* Change new timeval and timespec to string routines to use snprintf()
+ rather than hand-crafted conversion, avoid signed int overflow there.
+* Add configure support for SIZEOF_LONG_LONG to enable portable use of
+ snprintf() with time_t.
* Grow ntpd/work_thread.c arrays as needed.
* Add DEBUG_* variants of ntp_assert.h macros which compile away using
./configure --disable-debugging.
)]
)
AC_CHECK_HEADERS([sys/timers.h sys/tpro.h sys/types.h sys/wait.h])
-AC_HEADER_TIME
case "$host" in
*-convex-*)
AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
]
)
-AC_C_INLINE
-
-case "$ac_cv_c_inline" in
- '')
- ;;
- *)
- AC_DEFINE([HAVE_INLINE], [1], [inline keyword or macro available])
- AC_SUBST([HAVE_INLINE])
-esac
-
-AC_C_CHAR_UNSIGNED dnl CROSS_COMPILE?
-AC_CHECK_SIZEOF([signed char])
-AC_CHECK_TYPES([s_char])
-AC_CHECK_SIZEOF([short])
-AC_CHECK_SIZEOF([int])
-AC_CHECK_SIZEOF([long])
-
-case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
- *yes)
- # We have a typedef for s_char. Might as well believe it...
- ;;
- no0no)
- # We have signed chars, can't say 'signed char', no s_char typedef.
- AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
- [Do we need an s_char typedef?])
- ;;
- no1no)
- # We have signed chars, can say 'signed char', no s_char typedef.
- AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
- [Do we need an s_char typedef?])
- ;;
- yes0no)
- # We have unsigned chars, can't say 'signed char', no s_char typedef.
- AC_MSG_ERROR([No way to specify a signed character!])
- ;;
- yes1no)
- # We have unsigned chars, can say 'signed char', no s_char typedef.
- AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
- [Do we need an s_char typedef?])
- ;;
-esac
-AC_TYPE_UID_T
-
case "$host" in
*-*-aix[[456]]*)
# (prr) aix 4.1 doesn't have clock_settime, but in aix 4.3 it's a stub
#elif SIZEOF_TIME_T <= SIZEOF_LONG
typedef unsigned long u_time;
#define TIMEFMT "l"
-#elif SIZEOF_TIME_T <= SIZEOF_LONG_LONG
+#elif defined(SIZEOF_LONG_LONG) && SIZEOF_TIME_T <= SIZEOF_LONG_LONG
typedef unsigned long long u_time;
#define TIMEFMT "ll"
#else
-# include "GRONK: what size has a time_t here?"
+#include "GRONK: what size has a time_t here?"
#endif
#elif SIZEOF_TIME_T <= SIZEOF_LONG
typedef unsigned long u_time;
#define TIMEFMT "l"
-#elif SIZEOF_TIME_T <= SIZEOF_LONG_LONG
+#elif defined(SIZEOF_LONG_LONG) && SIZEOF_TIME_T <= SIZEOF_LONG_LONG
typedef unsigned long long u_time;
#define TIMEFMT "ll"
#else
-# include "GRONK: what size has a time_t here?"
+#include "GRONK: what size has a time_t here?"
#endif
/* copy and normalise. Used often enough to warrant a macro. */
# define SIZEOF_SIGNED_CHAR 1
# define SIZEOF_SHORT 2
-# define SIZEOF_INT 4 /* for ntp_types.h */
+# define SIZEOF_INT 4
+# define SIZEOF_LONG 4
+# define SIZEOF_LONG_LONG 8
# define HAVE_ALLOCA
# define HAVE_SETVBUF
AC_CHECK_HEADERS([netdb.h netinet/in.h stdlib.h string.h strings.h syslog.h])
AC_CHECK_HEADERS([sys/time.h])
-AC_HEADER_TIME
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
-AC_CHECK_SIZEOF([time_t])
-
-AC_C_INLINE
-
-case "$ac_cv_c_inline" in
- '')
- ;;
- *)
- AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available])
- AC_SUBST(HAVE_INLINE)
-esac
-
-AC_C_CHAR_UNSIGNED dnl CROSS_COMPILE?
-AC_CHECK_SIZEOF([signed char])
-AC_CHECK_SIZEOF([short])
-AC_CHECK_SIZEOF([int])
-AC_CHECK_SIZEOF([long])
-
-AC_CHECK_TYPES([s_char])
-case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
- *yes)
- # We have a typedef for s_char. Might as well believe it...
- ;;
- no0no)
- # We have signed chars, can't say 'signed char', no s_char typedef.
- AC_DEFINE([NEED_S_CHAR_TYPEDEF], 1, [Do we need an s_char typedef?])
- ;;
- no1no)
- # We have signed chars, can say 'signed char', no s_char typedef.
- AC_DEFINE([NEED_S_CHAR_TYPEDEF])
- ;;
- yes0no)
- # We have unsigned chars, can't say 'signed char', no s_char typedef.
- AC_MSG_ERROR([No way to specify a signed character!])
- ;;
- yes1no)
- # We have unsigned chars, can say 'signed char', no s_char typedef.
- AC_DEFINE([NEED_S_CHAR_TYPEDEF])
- ;;
-esac
-AC_TYPE_UID_T
NTP_OPENSSL
NTP_IPV6
esac
AS_UNSET([saved_LIBS])
+AC_C_INLINE
+
+case "$ac_cv_c_inline" in
+ '')
+ ;;
+ *)
+ AC_DEFINE([HAVE_INLINE], [1], [inline keyword or macro available])
+ AC_SUBST([HAVE_INLINE])
+esac
+
+AC_HEADER_TIME
+AC_CHECK_SIZEOF([time_t])
+AC_C_CHAR_UNSIGNED dnl CROSS_COMPILE?
+AC_CHECK_SIZEOF([signed char])
+AC_CHECK_TYPES([s_char, long long])
+AC_CHECK_SIZEOF([short])
+AC_CHECK_SIZEOF([int])
+AC_CHECK_SIZEOF([long])
+
+case "$ac_cv_type_long_long" in
+ no)
+ ;;
+ *)
+ AC_CHECK_SIZEOF([long long])
+ ;;
+esac
+
+case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
+ *yes)
+ # We have a typedef for s_char. Might as well believe it...
+ ;;
+ no0no)
+ # We have signed chars, can't say 'signed char', no s_char typedef.
+ AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
+ [Do we need an s_char typedef?])
+ ;;
+ no1no)
+ # We have signed chars, can say 'signed char', no s_char typedef.
+ AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
+ [Do we need an s_char typedef?])
+ ;;
+ yes0no)
+ # We have unsigned chars, can't say 'signed char', no s_char typedef.
+ AC_MSG_ERROR([No way to specify a signed character!])
+ ;;
+ yes1no)
+ # We have unsigned chars, can say 'signed char', no s_char typedef.
+ AC_DEFINE([NEED_S_CHAR_TYPEDEF], [1],
+ [Do we need an s_char typedef?])
+ ;;
+esac
+
+AC_TYPE_UID_T
AC_FUNC_STRERROR_R
dnl preset withsntp=no in env to change default to --without-sntp