From dd46d0ec71185f2f1953c8a0e3305e065e2656f4 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Fri, 13 Jun 2003 16:05:03 +0000 Subject: [PATCH] - configure check for XPM support added - x.cc uses the old monochrome icon if there's no XPM support present --- bochs/Makefile.in | 5 +- bochs/config.h.in | 1 + bochs/configure | 117 ++++++++++++++++++++++++++++++++++++++++++++- bochs/configure.in | 8 +++- bochs/gui/x.cc | 28 ++++++++--- 5 files changed, 148 insertions(+), 11 deletions(-) diff --git a/bochs/Makefile.in b/bochs/Makefile.in index ee359dda1..c6a453925 100644 --- a/bochs/Makefile.in +++ b/bochs/Makefile.in @@ -99,7 +99,8 @@ LIBS = @LIBS@ # solaris needs -lreadline -lcurses X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ -GUI_LINK_OPTS_X = $(X_LIBS) $(X_PRE_LIBS) -lX11 -lXpm +XPM_LIB = @XPM_LIB@ +GUI_LINK_OPTS_X = $(X_LIBS) $(X_PRE_LIBS) -lX11 $(XPM_LIB) GUI_LINK_OPTS_SDL = `sdl-config --cflags --libs` GUI_LINK_OPTS_SVGA = -lvga -lvgagl GUI_LINK_OPTS_BEOS = -lbe @@ -242,7 +243,7 @@ $(BX_OBJS): $(BX_INCLUDES) bxversion.h: $(RM) -f bxversion.h echo '/////////////////////////////////////////////////////////////////////////' > bxversion.h - echo '// $$Id: Makefile.in,v 1.152 2003-06-06 19:57:17 vruppert Exp $$' >> bxversion.h + echo '// $$Id: Makefile.in,v 1.153 2003-06-13 16:04:49 vruppert Exp $$' >> bxversion.h echo '/////////////////////////////////////////////////////////////////////////' >> bxversion.h echo '// This file is generated by "make bxversion.h"' >> bxversion.h echo "#define VER_STRING \"$(VER_STRING)\"" >> bxversion.h diff --git a/bochs/config.h.in b/bochs/config.h.in index 12d6aec3c..4ae6b34a0 100644 --- a/bochs/config.h.in +++ b/bochs/config.h.in @@ -202,6 +202,7 @@ #endif #define BX_HAVE_MKSTEMP 0 #define BX_HAVE_SYS_MMAN_H 0 +#define BX_HAVE_XPM_H 0 // This turns on Roland Mainz's idle hack. Presently it is specific to the X11 // gui. If people try to enable it elsewhere, give a compile error after the diff --git a/bochs/configure b/bochs/configure index 116a33235..82f463306 100755 --- a/bochs/configure +++ b/bochs/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in,v 1.213 2003/05/30 08:57:25 sshwarts Exp . +# From configure.in Id: configure.in,v 1.214 2003/06/06 19:57:25 vruppert Exp . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. # @@ -21873,6 +21873,7 @@ display_libs="" # indicate the platform. Settings that depend on the platform should be # handled later. +XPM_LIB='' if test "$with_x11" = yes; then display_libs="$display_libs X11" if test "$no_x" = yes; then @@ -21887,7 +21888,120 @@ _ACEOF GUI_CFLAGS="$GUI_CFLAGS \$(X_CFLAGS)" GUI_CXXFLAGS="$GUI_CXXFLAGS \$(X_CFLAGS)" GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_X)" + if test "${ac_cv_header_X11_xpm_h+set}" = set; then + echo "$as_me:$LINENO: checking for X11/xpm.h" >&5 +echo $ECHO_N "checking for X11/xpm.h... $ECHO_C" >&6 +if test "${ac_cv_header_X11_xpm_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi +echo "$as_me:$LINENO: result: $ac_cv_header_X11_xpm_h" >&5 +echo "${ECHO_T}$ac_cv_header_X11_xpm_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking X11/xpm.h usability" >&5 +echo $ECHO_N "checking X11/xpm.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking X11/xpm.h presence" >&5 +echo $ECHO_N "checking X11/xpm.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: X11/xpm.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: X11/xpm.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: X11/xpm.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: X11/xpm.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: X11/xpm.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: X11/xpm.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: X11/xpm.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: X11/xpm.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: X11/xpm.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: X11/xpm.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for X11/xpm.h" >&5 +echo $ECHO_N "checking for X11/xpm.h... $ECHO_C" >&6 +if test "${ac_cv_header_X11_xpm_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_X11_xpm_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_X11_xpm_h" >&5 +echo "${ECHO_T}$ac_cv_header_X11_xpm_h" >&6 + +fi +if test $ac_cv_header_X11_xpm_h = yes; then + + cat >>confdefs.h <<\_ACEOF +#define BX_HAVE_XPM_H 1 +_ACEOF + + XPM_LIB='-lXpm' + +fi + + +fi + if test "$with_beos" = yes; then display_libs="$display_libs beos" @@ -24088,6 +24202,7 @@ s,@EXTERNAL_DEPENDENCY@,$EXTERNAL_DEPENDENCY,;t t s,@EXT_DEBUG_OBJS@,$EXT_DEBUG_OBJS,;t t s,@RC_CMD@,$RC_CMD,;t t s,@WX_CONFIG@,$WX_CONFIG,;t t +s,@XPM_LIB@,$XPM_LIB,;t t s,@GUI_CFLAGS@,$GUI_CFLAGS,;t t s,@GUI_CXXFLAGS@,$GUI_CXXFLAGS,;t t s,@WX_CFLAGS@,$WX_CFLAGS,;t t diff --git a/bochs/configure.in b/bochs/configure.in index 8e79e3bbb..228f771fd 100644 --- a/bochs/configure.in +++ b/bochs/configure.in @@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) AC_INIT(bochs.h) -AC_REVISION([[$Id: configure.in,v 1.214 2003-06-06 19:57:25 vruppert Exp $]]) +AC_REVISION([[$Id: configure.in,v 1.215 2003-06-13 16:05:01 vruppert Exp $]]) AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(ltdlconf.h) @@ -1826,6 +1826,7 @@ display_libs="" # indicate the platform. Settings that depend on the platform should be # handled later. +XPM_LIB='' if test "$with_x11" = yes; then display_libs="$display_libs X11" if test "$no_x" = yes; then @@ -1837,7 +1838,12 @@ if test "$with_x11" = yes; then GUI_CFLAGS="$GUI_CFLAGS \$(X_CFLAGS)" GUI_CXXFLAGS="$GUI_CXXFLAGS \$(X_CFLAGS)" GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_X)" + AC_CHECK_HEADER(X11/xpm.h, [ + AC_DEFINE(BX_HAVE_XPM_H) + XPM_LIB='-lXpm' + ]) fi +AC_SUBST(XPM_LIB) if test "$with_beos" = yes; then display_libs="$display_libs beos" diff --git a/bochs/gui/x.cc b/bochs/gui/x.cc index c830cb40c..a8fca965b 100644 --- a/bochs/gui/x.cc +++ b/bochs/gui/x.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: x.cc,v 1.68 2003-06-11 18:44:45 vruppert Exp $ +// $Id: x.cc,v 1.69 2003-06-13 16:05:03 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -41,11 +41,16 @@ extern "C" { #include #include #include +#ifdef BX_HAVE_XPM_H #include +#endif } -//#include "icon_bochs.h" +#ifdef BX_HAVE_XPM_H #include "icon_bochs.xpm" +#else +#include "icon_bochs.h" +#endif #include "font/vga.bitmap.h" @@ -337,7 +342,10 @@ bx_x_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsigned ti char *window_name = "Bochs Pentium emulator, http://bochs.sourceforge.net/"; #endif char *icon_name = "Bochs"; - Pixmap icon_pixmap, icon_mask; + Pixmap icon_pixmap; +#ifdef BX_HAVE_XPM_H + Pixmap icon_mask; +#endif XSizeHints size_hints; char *display_name = NULL; /* create GC for text and drawing */ @@ -457,11 +465,14 @@ bx_x_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsigned ti /* Get available icon sizes from Window manager */ - /* Create pixmap of depth 1 (bitmap) for icon */ -/* icon_pixmap = XCreateBitmapFromData(bx_x_display, win, - (char *) bochs_icon_bits, bochs_icon_width, bochs_icon_height);*/ +#ifdef BX_HAVE_XPM_H /* Create pixmap from XPM for icon */ XCreatePixmapFromData(bx_x_display, win, icon_bochs_xpm, &icon_pixmap, &icon_mask, NULL); +#else + /* Create pixmap of depth 1 (bitmap) for icon */ + icon_pixmap = XCreateBitmapFromData(bx_x_display, win, + (char *) bochs_icon_bits, bochs_icon_width, bochs_icon_height); +#endif /* Set size hints for window manager. The window manager may * override these settings. Note that in a real @@ -500,9 +511,12 @@ bx_x_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsigned ti wm_hints.initial_state = NormalState; wm_hints.input = True; wm_hints.icon_pixmap = icon_pixmap; +#ifdef BX_HAVE_XPM_H wm_hints.icon_mask = icon_mask; wm_hints.flags = StateHint | IconPixmapHint | IconMaskHint | InputHint; - +#else + wm_hints.flags = StateHint | IconPixmapHint | InputHint; +#endif class_hints.res_name = progname; class_hints.res_class = "Bochs";