Commit 19d13a3b authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

portability fixes for FreeBSD 8 and 9

parent 7baa64fc
...@@ -238,7 +238,6 @@ CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) ...@@ -238,7 +238,6 @@ CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H) CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H) CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
CHECK_INCLUDE_FILES ("time.h;sys/timeb.h" HAVE_SYS_TIMEB_H)
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H) CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H) CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)
CHECK_INCLUDE_FILES (termbits.h HAVE_TERMBITS_H) CHECK_INCLUDE_FILES (termbits.h HAVE_TERMBITS_H)
......
...@@ -372,9 +372,6 @@ C_MODE_END ...@@ -372,9 +372,6 @@ C_MODE_END
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#ifdef HAVE_SYS_TIMEB_H
#include <sys/timeb.h> /* Avoid warnings on SCO */
#endif
#if TIME_WITH_SYS_TIME #if TIME_WITH_SYS_TIME
# include <sys/time.h> # include <sys/time.h>
# include <time.h> # include <time.h>
...@@ -858,7 +855,7 @@ static inline double my_isinf(double x) ...@@ -858,7 +855,7 @@ static inline double my_isinf(double x)
This will be slightly slower and perhaps a tiny bit less accurate than This will be slightly slower and perhaps a tiny bit less accurate than
doing it the IEEE754 way but log2() should be available on C99 systems. doing it the IEEE754 way but log2() should be available on C99 systems.
*/ */
inline double log2(double x) static inline double log2(double x)
{ {
return (log(x) / M_LN2); return (log(x) / M_LN2);
} }
......
...@@ -118,6 +118,7 @@ void my_time_init() ...@@ -118,6 +118,7 @@ void my_time_init()
ulonglong my_getcputime() ulonglong my_getcputime()
{ {
#ifdef CLOCK_THREAD_CPUTIME_ID
#ifdef HAVE_CLOCK_GETTIME #ifdef HAVE_CLOCK_GETTIME
struct timespec tp; struct timespec tp;
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)) if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp))
...@@ -128,7 +129,8 @@ ulonglong my_getcputime() ...@@ -128,7 +129,8 @@ ulonglong my_getcputime()
if (syscall(__NR_clock_gettime, CLOCK_THREAD_CPUTIME_ID, &tp)) if (syscall(__NR_clock_gettime, CLOCK_THREAD_CPUTIME_ID, &tp))
return 0; return 0;
return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100; return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100;
#else
return 0;
#endif /* HAVE_CLOCK_GETTIME */ #endif /* HAVE_CLOCK_GETTIME */
#else /* HAVE_THREAD_CPUTIME_ID */
return 0;
#endif
} }
...@@ -32,7 +32,7 @@ Created 9/20/1997 Heikki Tuuri ...@@ -32,7 +32,7 @@ Created 9/20/1997 Heikki Tuuri
#include "config.h" #include "config.h"
#ifdef HAVE_ALLOCA_H #ifdef HAVE_ALLOCA_H
#include "alloca.h" #include "alloca.h"
#else #elif defined(HAVE_MALLOC_H)
#include "malloc.h" #include "malloc.h"
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment