[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] configure.in adjustments
From: |
Teun Burgers |
Subject: |
[gnugo-devel] configure.in adjustments |
Date: |
Thu, 18 Oct 2001 23:17:53 +0200 |
This patch adds some tests to configure.in
and adds a function gg_cputime to gg_utils.c
- test for headers sys/times.h, ncurses/term.h
ncurses/curses.h
- check for times function
- check for perl executable
- include one of curses.h or ncurses/curses.h
where required
- include one of term.h or ncurses/term.h
where required
- new function gg_cputime in utils/gg_utils.c
autoconf and autoheader must be rerun after this patch
Teun
Index: configure.in
===================================================================
RCS file: /cvsroot/gnugo/gnugo/configure.in,v
retrieving revision 1.14
diff -u -r1.14 configure.in
--- configure.in 2001/10/15 00:21:16 1.14
+++ configure.in 2001/10/18 21:07:52
@@ -107,8 +107,11 @@
AC_C_CONST
-AC_CHECK_HEADERS(unistd.h sys/time.h curses.h term.h)
+AC_CHECK_HEADERS(unistd.h sys/time.h sys/times.h)
+AC_CHECK_HEADERS(curses.h term.h ncurses/curses.h ncurses/term.h)
+AC_PATH_PROG(perl, perl)
+
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
@@ -116,7 +119,7 @@
dnl alarm not available in VC
dnl vsnprintf not universally available
dnl usleep not available in Unicos and mingw32
-AC_CHECK_FUNCS(setlinebuf alarm vsnprintf gettimeofday usleep)
+AC_CHECK_FUNCS(setlinebuf alarm vsnprintf gettimeofday usleep times)
dnl if snprintf not available try to use g_snprintf from glib
if test $ac_cv_func_vsnprintf = no; then
Index: interface/debugboard/display.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/debugboard/display.h,v
retrieving revision 1.3
diff -u -r1.3 display.h
--- interface/debugboard/display.h 2001/09/06 21:34:20 1.3
+++ interface/debugboard/display.h 2001/10/18 21:07:53
@@ -29,7 +29,14 @@
*/
#include <stdlib.h>
+
+#if HAVE_CURSES_H
#include <curses.h>
+#elif HAVE_NCURSES_CURSES_H
+#include <ncurses/curses.h>
+#else
+#endif
+
#include <stdarg.h>
#include "gnugo.h"
Index: utils/gg_utils.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/utils/gg_utils.c,v
retrieving revision 1.10
diff -u -r1.10 gg_utils.c
--- utils/gg_utils.c 2001/10/13 15:29:15 1.10
+++ utils/gg_utils.c 2001/10/18 21:07:55
@@ -54,8 +54,21 @@
#ifdef _AIX
#define _TPARM_COMPAT
#endif
+
+#if HAVE_CURSES_H
#include <curses.h>
+#elif HAVE_NCURSES_CURSES_H
+#include <ncurses/curses.h>
+#else
+#endif
+
+#if HAVE_TERM_H
#include <term.h>
+#elif HAVE_NCURSES_TERM_H
+#include <ncurses/term.h>
+#else
+#endif
+
/* terminfo attributes */
static char *setaf; /* terminfo string to set color */
@@ -63,6 +76,14 @@
static int init = 0;
+#endif /* TERMINFO */
+
+/* for gg_cputime */
+
+#ifdef HAVE_SYS_TIMES_H
+#include <sys/times.h>
+#elif defined(WIN32)
+#include <windows.h>
#endif
void
@@ -112,7 +133,7 @@
}
#else
-
+/* mingw32 lacks crtdbg.h and _ASSERTE */
verifyW32(BOOL b)
{
if (!b) {
@@ -243,6 +264,31 @@
const char *
gg_version(void) {
return VERSION;
+}
+
+/* return cputime used in mili secs */
+
+int gg_cputime(void)
+{
+#if HAVE_SYS_TIMES_H && HAVE_TIMES
+ struct tms t;
+ times(&t);
+ return t.tms_utime + t.tms_stime + t.tms_cutime + t.tms_cstime;
+#elif defined(WIN32)
+ FILETIME creationTime, exitTime, kernelTime, userTime;
+ ULARGE_INTEGER uKernelTime,uUserTime,uElapsedTime;
+ unsigned long ulElapsedTime;
+ UNUSED(s);
+ GetProcessTimes(GetCurrentProcess(), &creationTime, &exitTime,
&kernelTime, &userTime);
+ uKernelTime.LowPart = kernelTime.dwLowDateTime;
+ uKernelTime.HighPart = kernelTime.dwHighDateTime;
+ uUserTime.LowPart = userTime.dwLowDateTime;
+ uUserTime.HighPart = userTime.dwHighDateTime;
+ uElapsedTime.QuadPart = uKernelTime.QuadPart + uUserTime.QuadPart;
+ ulElapsedTime = (unsigned long)(uElapsedTime.QuadPart / 10000); /* convert
to milliseconds: */
+ /*_ASSERTE(0 && "Debug Times");*/
+ return ulElapsedTime;
+#endif
}
/* Reorientation of point (i,j) into (*ri, *rj) */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] configure.in adjustments,
Teun Burgers <=