From 85ecd070e2544363a6272db808de38948e0ed7a0 Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Tue, 12 Nov 2002 20:59:00 +0000 Subject: [PATCH] x11 graphics svn path=/trunk/boinc/; revision=602 --- api/boinc_api.C | 4 + api/graphics_api.C | 25 ++++++ api/x_opengl.C | 134 +++++++++++++++++++++++++++++++ api/x_opengl.h | 2 + apps/Makefile.in | 27 +++++-- apps/upper_case.C | 10 ++- checkin_notes | 16 ++++ configure | 194 ++++++++++++++++++++++++++++++++------------- configure.in | 4 + 9 files changed, 354 insertions(+), 62 deletions(-) create mode 100644 api/x_opengl.C create mode 100644 api/x_opengl.h diff --git a/api/boinc_api.C b/api/boinc_api.C index 458a83bde9..27e3494fbb 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -56,6 +56,10 @@ HANDLE hGlobalDrawEvent; #include // Header File For The GLu32 Library #include // Header File For The Glaux Library #endif + +#ifdef HAVE_GL_LIB +#include +#endif #endif #include "parse.h" diff --git a/api/graphics_api.C b/api/graphics_api.C index 447dbec107..bd94d300c0 100755 --- a/api/graphics_api.C +++ b/api/graphics_api.C @@ -32,6 +32,11 @@ DWORD WINAPI win_graphics_event_loop( LPVOID duff ); #include // Header File For The GLu32 Library #include // Header File For The Glaux Library #endif + +#ifdef HAVE_GL_LIB +#include +#include "x_opengl.h" +#endif #endif #include "graphics_api.h" @@ -39,10 +44,17 @@ DWORD WINAPI win_graphics_event_loop( LPVOID duff ); #include "parse.h" +#include +#include + #ifdef __APPLE_CC__ #include "mac_app_opengl.h" #endif +#ifdef HAVE_PTHREAD +#include +#endif + extern GRAPHICS_INFO gi; int boinc_init_opengl() { @@ -52,6 +64,7 @@ int boinc_init_opengl() { HANDLE hThread; // Create the graphics thread, passing it the graphics info + // TODO: is it better to use _beginthreadex here? hThread = CreateThread( NULL, 0, win_graphics_event_loop, &gi, CREATE_SUSPENDED, &threadId ); @@ -82,6 +95,18 @@ int boinc_init_opengl() { YieldToAnyThread(); #endif + +#ifdef _PTHREAD_H + pthread_t graphics_thread; + pthread_attr_t graphics_thread_attr; + int retval; + + pthread_attr_init( &graphics_thread_attr ); + retval = pthread_create( &graphics_thread, &graphics_thread_attr, p_graphics_loop, &gi ); + if (retval) return ERR_THREAD; + pthread_attr_destroy( &graphics_thread_attr ); +#endif + #endif return 0; diff --git a/api/x_opengl.C b/api/x_opengl.C new file mode 100644 index 0000000000..aee427e084 --- /dev/null +++ b/api/x_opengl.C @@ -0,0 +1,134 @@ +#include "x_opengl.h" +#include + +#include +#include +#include + +#include "graphics_api.h" + +void process_input(Display *dpy); +void refresh( void ); +int DrawGLScene(GLvoid); +GLvoid buildFont(GLvoid); + +extern int ok_to_draw; +int win_open; +GLuint main_font; +Display *dpy; +Window win; + +static Bool WaitForNotify(Display *d,XEvent *e,char *arg) { + return(e->type == MapNotify) && (e->xmap.window == (Window)arg); +} + +void *p_graphics_loop( void *duff ) { + XVisualInfo *vi; + Colormap cmap; + XSetWindowAttributes swa; + GLXContext cx; + XEvent event; + GRAPHICS_INFO *gfx; + int attributeList[] = {GLX_RGBA, GLX_DOUBLEBUFFER, + GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None}; + + gfx = (GRAPHICS_INFO *)duff; + + /* get a connection */ + dpy = XOpenDisplay(0); + + if (dpy == NULL) { + printf("couldn't open display\n"); + return 0; + } + + /* get an appropriate visual */ + vi = glXChooseVisual(dpy,DefaultScreen(dpy),attributeList); + if (vi == NULL) { + printf("couldn't find the visual \n"); + return 0; + } + + /* create a GLX context */ + if (!(cx = glXCreateContext(dpy,vi,0,GL_FALSE))) { + fprintf(stderr, "glXGetContext failed!\n"); + return 0; + } + + /* create color map */ + if (!(cmap = XCreateColormap(dpy,RootWindow(dpy,vi->screen), + vi->visual,AllocNone))) + { + fprintf(stderr, "XCreateColormap failed!\n"); + return 0; + } + + /* create window */ + swa.colormap = cmap; + swa.border_pixel = 0; + swa.event_mask = StructureNotifyMask; + win = XCreateWindow(dpy,RootWindow(dpy,vi->screen),0,0,gfx->xsize,gfx->ysize,0,vi->depth, InputOutput,vi->visual,CWBorderPixel|CWColormap|CWEventMask, &swa); + XMapWindow(dpy,win); + XIfEvent(dpy,&event,WaitForNotify,(char*)win); + + if (!(glXMakeCurrent(dpy,win,cx))) + { + fprintf(stderr, "glXMakeCurrent failed (window)!\n"); + return 0; + } + + win_open = true; + buildFont(); + while(1) { + process_input(dpy); + } + + return NULL; +} + +// How do we prevent broken pipes and broken connection error messages? +// +void process_input(Display *dpy) { + XEvent event; + + if( XPending(dpy) ) { + do { + + XNextEvent(dpy, &event); + switch(event.type) { + case DestroyNotify: + win_open = false; + break; + default: + break; + } + } while (XPending(dpy)); + } + if (ok_to_draw && win_open) { + DrawGLScene(); + glXSwapBuffers(dpy,win); + ok_to_draw = 0; + } +} + +GLvoid buildFont(GLvoid) +{ + XFontStruct *font; + + main_font = glGenLists(256); /* storage for 256 characters */ + /* load a font with a specific name in "Host Portable Character Encoding" */ + /*font = XLoadQueryFont(dpy, + "-*-helvetica-bold-r-normal--24-*-*-*-p-*-iso8859-1");*/ + /* this really *should* be available on every X Window System...*/ + font = XLoadQueryFont(dpy, "fixed"); + if (font == NULL) + { + printf("Problems loading fonts :-(\n"); + return; // exit(1); + } + /* build 256 display lists out of our font */ + glXUseXFont(font->fid, 0, 256, main_font); + /* free our XFontStruct since we have our display lists */ + XFreeFont(dpy, font); +} + diff --git a/api/x_opengl.h b/api/x_opengl.h new file mode 100644 index 0000000000..668f851d4d --- /dev/null +++ b/api/x_opengl.h @@ -0,0 +1,2 @@ +void *p_graphics_loop( void * ); + diff --git a/apps/Makefile.in b/apps/Makefile.in index d2e9975349..79771d8250 100644 --- a/apps/Makefile.in +++ b/apps/Makefile.in @@ -13,27 +13,44 @@ CFLAGS = -g -Wall @DEFS@ \ CC = @CC@ $(CFLAGS) -I @top_srcdir@/api -I@top_srcdir@/lib -LIBS = ../api/boinc_api.o ../api/graphics_api.o ../api/mfile.o ../lib/parse.o ../lib/filesys.o ../lib/util.o +APIOBJS = ../api/boinc_api.o ../api/graphics_api.o +X11APIOBJS = ../api/boinc_api.x11.o ../api/graphics_api.x11.o ../api/x_opengl.x11.o + +LIBS = ../api/mfile.o ../lib/parse.o ../lib/filesys.o ../lib/util.o CLIBS = @LIBS@ +XLIBS = -lGL -lGLU -lpthread + APPS = upper_case concat 1sec .C.o: $(CC) -c -o $*.o $< .c.o: $(CC) -c -o $*.o $< +upper_case.x11.o: + $(CC) -DBOINC_APP_GRAPHICS -c -o $*.o upper_case.C +../api/x_opengl.x11.o: + $(CC) -DBOINC_APP_GRAPHICS -c -o $*.o ../api/x_opengl.C +../api/boinc_api.x11.o: + $(CC) -DBOINC_APP_GRAPHICS -c -o $*.o ../api/boinc_api.C +../api/graphics_api.x11.o: + $(CC) -DBOINC_APP_GRAPHICS -c -o $*.o ../api/graphics_api.C + all: $(APPS) +upper_case_x11: upper_case.x11.o $(X11APIOBJS) + $(CC) upper_case.x11.o $(X11APIOBJS) $(LIBS) $(CLIBS) $(XLIBS) -lm -o upper_case_x11 + upper_case: upper_case.o - $(CC) upper_case.o $(LIBS) $(CLIBS) -lm -o upper_case + $(CC) upper_case.o $(APIOBJS) $(LIBS) $(CLIBS) -lm -o upper_case concat: concat.o - $(CC) concat.o $(LIBS) $(CLIBS) -lm -o concat + $(CC) concat.o $(APIOBJS) $(LIBS) $(CLIBS) -lm -o concat 1sec: 1sec.o - $(CC) 1sec.o $(LIBS) $(CLIBS) -lm -o 1sec + $(CC) 1sec.o $(APIOBJS) $(LIBS) $(CLIBS) -lm -o 1sec install: all -mkdir -p $(INSTALL_DIR)/apps @@ -45,7 +62,7 @@ uninstall: $(RM) -r $(INSTALL_DIR)/apps clean: - rm -f *.o $(APPS) dependencies + rm -f *.o $(APPS) $(X11APIOBJS) dependencies dependencies: @srcdir@/*.C $(CC) -M @srcdir@/*.C > dependencies diff --git a/apps/upper_case.C b/apps/upper_case.C index 631876321a..dee597a2d5 100755 --- a/apps/upper_case.C +++ b/apps/upper_case.C @@ -44,13 +44,15 @@ #include #include "mac_carbon_gl.h" -#endif - -#ifdef _WIN32 +#elif _WIN32 #include #include // Header File For The OpenGL32 Library #include // Header File For The GLu32 Library #include // Header File For The Glaux Library +#elif HAVE_GL_LIB +#include +#include +#include #endif bool app_render(int xs, int ys, double time_of_day); @@ -258,7 +260,7 @@ int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing glRasterPos2f(-0.9, 0.7); glPrint(main_font, "CPU Time: %f", uc_aid.wu_cpu_time); - return TRUE; // Everything Went OK + return true; // Everything Went OK } #endif diff --git a/checkin_notes b/checkin_notes index 4568ddb954..a3b614449a 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2385,3 +2385,19 @@ David Nov 9 2002 util.inc test/ test_uc.php + +Eric Nov 12, 2002 + - X11 graphics support added + - upper_case_x11 target added + - configure now checks for pthread, gl libraries + + configure + configure.in + api/ + boinc_api.C + graphics_api.C + x_opengl.C,h (added) + apps/ + upper_case.C + Makefile.in + diff --git a/configure b/configure index d513159ab8..982a13e44f 100755 --- a/configure +++ b/configure @@ -1077,18 +1077,104 @@ else echo "$ac_t""no" 1>&6 fi +echo $ac_n "checking for pthread_mutex_init in -lpthread""... $ac_c" 1>&6 +echo "configure:1082: checking for pthread_mutex_init in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_mutex_init | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_PTHREAD 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for glCallList in -lGL""... $ac_c" 1>&6 +echo "configure:1125: checking for glCallList in -lGL" >&5 +ac_lib_var=`echo GL'_'glCallList | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lGL $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GL_LIB 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1087: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1173: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1096,7 +1182,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1121,7 +1207,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1125: checking for opendir in -ldir" >&5 +echo "configure:1211: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1129,7 +1215,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1162,7 +1248,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1166: checking for opendir in -lx" >&5 +echo "configure:1252: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1170,7 +1256,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1204,7 +1290,7 @@ fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1208: checking how to run the C preprocessor" >&5 +echo "configure:1294: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1219,13 +1305,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1236,13 +1322,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1332: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1253,13 +1339,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1284,12 +1370,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1288: checking for ANSI C header files" >&5 +echo "configure:1374: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1297,7 +1383,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1387: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1314,7 +1400,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1332,7 +1418,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1353,7 +1439,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1364,7 +1450,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1388,12 +1474,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1392: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1478: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1409,7 +1495,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1413: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1433,17 +1519,17 @@ for ac_hdr in fcntl.h malloc.h strings.h sys/time.h unistd.h sys/systeminfo.h sy do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1437: checking for $ac_hdr" >&5 +echo "configure:1523: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1447: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1473,17 +1559,17 @@ for ac_hdr in mysql/include/mysql_com.h mysql/mysql_com.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1477: checking for $ac_hdr" >&5 +echo "configure:1563: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1487: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1573: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1511,12 +1597,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1515: checking for working const" >&5 +echo "configure:1601: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1586,12 +1672,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1590: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1676: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1600,7 +1686,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1623,13 +1709,13 @@ fi if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1627: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1713: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -1647,7 +1733,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1669,12 +1755,12 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1673: checking for vprintf" >&5 +echo "configure:1759: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1721,12 +1807,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1725: checking for _doprnt" >&5 +echo "configure:1811: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -1774,7 +1860,7 @@ fi fi echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 -echo "configure:1778: checking for wait3 that fills in rusage" >&5 +echo "configure:1864: checking for wait3 that fills in rusage" >&5 if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1782,7 +1868,7 @@ else ac_cv_func_wait3_rusage=no else cat > conftest.$ac_ext < #include @@ -1802,6 +1888,8 @@ main() { r.ru_majflt = r.ru_minflt = 0; switch (fork()) { case 0: /* Child. */ + /* Unless we actually _do_ something, the kernel sometimes doesn't chalk up any system time to this process. */ + if(fork()) { i = 123; wait(NULL); } else { i = 234; exit(0); } sleep(1); /* Give up the CPU. */ _exit(0); case -1: _exit(0); /* What can we do? */ @@ -1813,7 +1901,7 @@ main() { } } EOF -if { (eval echo configure:1817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_wait3_rusage=yes else @@ -1838,12 +1926,12 @@ fi for ac_func in gethostname gettimeofday mkdir select socket strstr uname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1842: checking for $ac_func" >&5 +echo "configure:1930: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/configure.in b/configure.in index 2b816066de..10d16f19ab 100644 --- a/configure.in +++ b/configure.in @@ -20,6 +20,10 @@ dnl Replace `main' with a function in -lstdc: AC_CHECK_LIB(stdc, main) dnl Replace `main' with a function in -lz: AC_CHECK_LIB(z, gzopen) +dnl check for pthread +AC_CHECK_LIB(pthread, pthread_mutex_init, AC_DEFINE(HAVE_PTHREAD)) +dnl check for GL library +AC_CHECK_LIB(GL, glCallList, AC_DEFINE(HAVE_GL_LIB)) dnl Checks for header files. AC_HEADER_DIRENT