[Spice-commits] 8 commits - client/application.cpp client/application.h client/canvas.cpp client/canvas.h client/client_net_socket.cpp client/cmd_line_parser.cpp client/common.h client/controller.cpp client/cursor_channel.cpp client/cursor.cpp client/display_channel.cpp client/display_channel.h client/foreign_menu.cpp client/glz_decoder.cpp client/glz_decoder.h client/glz_decoder_window.cpp client/glz_decode_tmpl.c client/gui client/hot_keys.cpp client/inputs_channel.cpp client/jpeg_decoder.cpp client/jpeg_decoder.h client/Makefile.am client/menu.cpp client/mjpeg_decoder.cpp client/monitor.cpp client/playback_channel.cpp client/process_loop.cpp client/record_channel.cpp client/red_canvas_base.h client/red_channel.cpp client/red_client.cpp client/red_gdi_canvas.cpp client/red_gdi_canvas.h client/red_gl_canvas.cpp client/red_gl_canvas.h client/red_peer.cpp client/red_sw_canvas.cpp client/red_sw_canvas.h client/red_window.h client/screen.cpp client/screen.h client/screen_layer.cpp clie nt/smartcard_channel.cpp client/threads.cpp client/tunnel_channel.cpp client/utils.cpp client/windows client/x11 client/zlib_decoder.cpp client/zlib_decoder.h common/canvas_base.c common/canvas_base.h common/canvas_utils.c common/gdi_canvas.c common/gdi_canvas.h common/gl_canvas.c common/gl_canvas.h common/glc.c common/lines.c common/lz.c common/lz_compress_tmpl.c common/lz_decompress_tmpl.c common/Makefile.am common/marshaller.c common/mem.c common/ogl_ctx.c common/pixman_utils.c common/quic.c common/quic_family_tmpl.c common/quic_rgb_tmpl.c common/quic_tmpl.c common/region.c common/rop3.c common/sw_canvas.c common/sw_canvas.h configure.ac server/agent-msg-filter.c server/glz_encode_match_tmpl.c server/glz_encoder.c server/glz_encoder_dictionary.c server/glz_encode_tmpl.c server/inputs_channel.c server/jpeg_encoder.c server/main_channel.c server/Makefile.am server/mjpeg_encoder.c server/red_channel.c server/red_dispatcher.c server/red_memslots.c server/red_parse_qxl.c serve r/reds.c server/reds_gl_canvas.c server/reds_gl_canvas.h server/reds.h server/reds_sw_canvas.c server/reds_sw_canvas.h server/red_tunnel_worker.c server/red_worker.c server/smartcard.c server/snd_worker.c server/tests server/zlib_encoder.c spice_codegen.py

Christophe Fergau teuf at kemper.freedesktop.org
Tue May 3 05:48:01 PDT 2011


 client/Makefile.am                 |  342 +++++++++++++++++++++++++------------
 client/application.cpp             |   13 -
 client/application.h               |    2 
 client/canvas.cpp                  |    3 
 client/canvas.h                    |    1 
 client/client_net_socket.cpp       |    3 
 client/cmd_line_parser.cpp         |    3 
 client/common.h                    |    2 
 client/controller.cpp              |    3 
 client/cursor.cpp                  |    3 
 client/cursor_channel.cpp          |    3 
 client/display_channel.cpp         |   43 ++--
 client/display_channel.h           |   12 -
 client/foreign_menu.cpp            |    3 
 client/glz_decode_tmpl.c           |    3 
 client/glz_decoder.cpp             |    3 
 client/glz_decoder.h               |    2 
 client/glz_decoder_window.cpp      |    3 
 client/gui/gui.cpp                 |    4 
 client/gui/resource_provider.cpp   |    4 
 client/gui/softrenderer.cpp        |    3 
 client/gui/softtexture.cpp         |    3 
 client/hot_keys.cpp                |    3 
 client/inputs_channel.cpp          |    3 
 client/jpeg_decoder.cpp            |    3 
 client/jpeg_decoder.h              |    2 
 client/menu.cpp                    |    3 
 client/mjpeg_decoder.cpp           |    3 
 client/monitor.cpp                 |    3 
 client/playback_channel.cpp        |    3 
 client/process_loop.cpp            |    3 
 client/record_channel.cpp          |    3 
 client/red_canvas_base.h           |   26 ++
 client/red_channel.cpp             |    3 
 client/red_client.cpp              |    5 
 client/red_gdi_canvas.cpp          |    9 
 client/red_gdi_canvas.h            |    4 
 client/red_gl_canvas.cpp           |    9 
 client/red_gl_canvas.h             |    5 
 client/red_peer.cpp                |    3 
 client/red_sw_canvas.cpp           |    9 
 client/red_sw_canvas.h             |    4 
 client/red_window.h                |    2 
 client/screen.cpp                  |    9 
 client/screen.h                    |    6 
 client/screen_layer.cpp            |    3 
 client/smartcard_channel.cpp       |    4 
 client/threads.cpp                 |    3 
 client/tunnel_channel.cpp          |    3 
 client/utils.cpp                   |    3 
 client/windows/Makefile.am         |  236 -------------------------
 client/windows/event_sources_p.cpp |    3 
 client/windows/main.cpp            |    3 
 client/windows/my_getopt.cpp       |    3 
 client/windows/named_pipe.cpp      |    3 
 client/windows/pixels_source.cpp   |    3 
 client/windows/platform.cpp        |    3 
 client/windows/platform_utils.cpp  |    3 
 client/windows/playback.cpp        |    3 
 client/windows/record.cpp          |    3 
 client/windows/red_drawable.cpp    |    3 
 client/windows/red_pixmap.cpp      |    3 
 client/windows/red_pixmap_gdi.cpp  |    3 
 client/windows/red_pixmap_sw.cpp   |    7 
 client/windows/red_window.cpp      |    5 
 client/windows/redc.vcproj         |    8 
 client/x11/Makefile.am             |  223 ------------------------
 client/x11/event_sources_p.cpp     |    3 
 client/x11/images/Makefile.am      |    5 
 client/x11/main.cpp                |    3 
 client/x11/named_pipe.cpp          |    3 
 client/x11/pixels_source.cpp       |    3 
 client/x11/pixels_source_p.h       |   20 +-
 client/x11/platform.cpp            |   27 +-
 client/x11/platform_utils.cpp      |    3 
 client/x11/playback.cpp            |    3 
 client/x11/record.cpp              |    3 
 client/x11/red_drawable.cpp        |   31 +--
 client/x11/red_pixmap.cpp          |    3 
 client/x11/red_pixmap_gl.cpp       |    3 
 client/x11/red_pixmap_sw.cpp       |    3 
 client/x11/red_window.cpp          |   27 +-
 client/x11/red_window_p.h          |   16 -
 client/x11/res.cpp                 |    3 
 client/x11/x_icon.cpp              |    3 
 client/x11/x_platform.h            |    4 
 client/zlib_decoder.cpp            |    4 
 client/zlib_decoder.h              |    2 
 common/Makefile.am                 |   83 +++++---
 common/canvas_base.c               |    8 
 common/canvas_base.h               |    3 
 common/canvas_utils.c              |    3 
 common/gdi_canvas.c                |    7 
 common/gdi_canvas.h                |    4 
 common/gl_canvas.c                 |    8 
 common/gl_canvas.h                 |    4 
 common/glc.c                       |    3 
 common/lines.c                     |    4 
 common/lz.c                        |    3 
 common/lz_compress_tmpl.c          |    3 
 common/lz_decompress_tmpl.c        |    4 
 common/marshaller.c                |    5 
 common/mem.c                       |    3 
 common/ogl_ctx.c                   |    3 
 common/pixman_utils.c              |    4 
 common/quic.c                      |    4 
 common/quic_family_tmpl.c          |    3 
 common/quic_rgb_tmpl.c             |    3 
 common/quic_tmpl.c                 |    3 
 common/region.c                    |    3 
 common/rop3.c                      |    3 
 common/sw_canvas.c                 |    7 
 common/sw_canvas.h                 |    4 
 configure.ac                       |   18 -
 server/Makefile.am                 |  139 ++++++---------
 server/agent-msg-filter.c          |    3 
 server/glz_encode_match_tmpl.c     |    3 
 server/glz_encode_tmpl.c           |    3 
 server/glz_encoder.c               |    3 
 server/glz_encoder_dictionary.c    |    3 
 server/inputs_channel.c            |    3 
 server/jpeg_encoder.c              |    3 
 server/main_channel.c              |    3 
 server/mjpeg_encoder.c             |    3 
 server/red_channel.c               |    3 
 server/red_dispatcher.c            |   17 +
 server/red_memslots.c              |    3 
 server/red_parse_qxl.c             |    3 
 server/red_tunnel_worker.c         |    3 
 server/red_worker.c                |   15 -
 server/reds.c                      |    5 
 server/reds.h                      |    2 
 server/reds_gl_canvas.c            |   26 ++
 server/reds_gl_canvas.h            |   27 ++
 server/reds_sw_canvas.c            |   26 ++
 server/reds_sw_canvas.h            |   26 ++
 server/smartcard.c                 |    4 
 server/snd_worker.c                |    3 
 server/tests/Makefile.am           |   25 --
 server/zlib_encoder.c              |    4 
 spice_codegen.py                   |    6 
 141 files changed, 999 insertions(+), 852 deletions(-)

New commits:
commit 7e2373c2e90648644ce2f103ced7a445a5e87ea4
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Apr 21 13:25:19 2011 +0200

    add comment to beginning of autogenerated files

diff --git a/spice_codegen.py b/spice_codegen.py
index 4dad06c..05b47f6 100755
--- a/spice_codegen.py
+++ b/spice_codegen.py
@@ -142,6 +142,8 @@ writer.set_option("source", os.path.basename(proto_file))
 
 writer.public_prefix = options.prefix
 
+writer.writeln("/* this is a file autogenerated by spice_codegen.py */")
+writer.header.writeln("/* this is a file autogenerated by spice_codegen.py */")
 writer.writeln("#ifdef HAVE_CONFIG_H")
 writer.writeln("#include <config.h>")
 writer.writeln("#endif")
commit e0c20725c8c7b516ed500b570fcf134534efd6b3
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Apr 21 13:06:37 2011 +0200

    s/USE_OGL/USE_OPENGL
    
    This is more explicit about what it does, and not much longer

diff --git a/client/application.cpp b/client/application.cpp
index 1f3ad24..bc6a6ee 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -35,7 +35,7 @@
 #endif
 #include "platform.h"
 #include "red_sw_canvas.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "red_gl_canvas.h"
 #endif
 #include "quic.h"
@@ -2051,7 +2051,7 @@ bool Application::set_canvas_option(CmdLineParser& parser, char *val, const char
 #ifdef WIN32
     canvas_types["gdi"] = CANVAS_OPTION_GDI;
 #endif
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     canvas_types["gl_fbo"] = CANVAS_OPTION_OGL_FBO;
     canvas_types["gl_pbuff"] = CANVAS_OPTION_OGL_PBUFF;
 #endif
@@ -2548,7 +2548,7 @@ void Application::init_globals()
     SSL_load_error_strings();
 
     sw_canvas_init();
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     gl_canvas_init();
 #endif
     quic_init();
diff --git a/client/application.h b/client/application.h
index 4133dfe..a08da13 100644
--- a/client/application.h
+++ b/client/application.h
@@ -112,7 +112,7 @@ enum CanvasOption {
 #ifdef WIN32
     CANVAS_OPTION_GDI,
 #endif
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     CANVAS_OPTION_OGL_FBO,
     CANVAS_OPTION_OGL_PBUFF,
 #endif
diff --git a/client/common.h b/client/common.h
index 80911d2..30fbf79 100644
--- a/client/common.h
+++ b/client/common.h
@@ -65,7 +65,7 @@
 #else
 #include <unistd.h>
 #include <X11/X.h>
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include <GL/glx.h>
 #endif
 #endif
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index 16a014c..dbe7d0b 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -22,7 +22,7 @@
 #include "common.h"
 #include "canvas.h"
 #include "red_pixmap.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "red_pixmap_gl.h"
 #endif
 #include "debug.h"
@@ -31,7 +31,7 @@
 #include "display_channel.h"
 #include "application.h"
 #include "screen.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "red_gl_canvas.h"
 #endif
 #include "red_sw_canvas.h"
@@ -485,7 +485,7 @@ void StreamsTrigger::on_event()
     _channel.on_streams_trigger();
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 
 GLInterruptRecreate::GLInterruptRecreate(DisplayChannel& channel)
     : _channel (channel)
@@ -604,7 +604,7 @@ DisplayChannel::DisplayChannel(RedClient& client, uint32_t id,
     , _inputs_channel (NULL)
     , _active_streams (NULL)
     , _streams_trigger (*this)
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     , _gl_interrupt_recreate (*this)
 #endif
     , _interrupt_update (*this)
@@ -641,7 +641,7 @@ DisplayChannel::DisplayChannel(RedClient& client, uint32_t id,
     handler->set_handler(SPICE_MSG_DISPLAY_SURFACE_DESTROY, &DisplayChannel::handle_surface_destroy);
 
     get_process_loop().add_trigger(_streams_trigger);
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     get_process_loop().add_trigger(_gl_interrupt_recreate);
 #endif
     get_process_loop().add_trigger(_interrupt_update);
@@ -725,7 +725,7 @@ void DisplayChannel::copy_pixels(const QRegion& dest_region,
     canvas->copy_pixels(dest_region, NULL, &dest_pixmap);
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 void DisplayChannel::recreate_ogl_context_interrupt()
 {
     Canvas* canvas;
@@ -883,7 +883,7 @@ void DisplayChannel::set_capture_mode(bool on)
 
 void DisplayChannel::update_interrupt()
 {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     Canvas *canvas;
 #endif
 
@@ -891,7 +891,7 @@ void DisplayChannel::update_interrupt()
         return;
     }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     canvas = surfaces_mngr.get_canvas(0);
     if (canvas->get_pixmap_type() == CANVAS_TYPE_GL) {
         ((GCanvas *)(canvas))->pre_gl_copy();
@@ -900,14 +900,14 @@ void DisplayChannel::update_interrupt()
 
     screen()->update();
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     if (canvas->get_pixmap_type() == CANVAS_TYPE_GL) {
         ((GCanvas *)(canvas))->post_gl_copy();
     }
 #endif
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 
 void DisplayChannel::pre_migrate()
 {
@@ -915,7 +915,7 @@ void DisplayChannel::pre_migrate()
 
 void DisplayChannel::post_migrate()
 {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     if (surfaces_mngr.get_canvas(0)->get_pixmap_type() == CANVAS_TYPE_GL) {
         _gl_interrupt_recreate.trigger();
     }
@@ -1083,7 +1083,7 @@ bool DisplayChannel::create_sw_canvas(int surface_id, int width, int height, uin
     return true;
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 bool DisplayChannel::create_ogl_canvas(int surface_id, int width, int height, uint32_t format,
                                        bool recreate, RenderType rendertype)
 {
@@ -1143,7 +1143,7 @@ void DisplayChannel::destroy_canvas(int surface_id)
 
     canvas = surfaces_mngr.get_canvas(surface_id);
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     if (canvas->get_pixmap_type() == CANVAS_TYPE_GL) {
         ((GCanvas *)(canvas))->touch_context();
     }
@@ -1158,12 +1158,12 @@ void DisplayChannel::destroy_canvas(int surface_id)
 void DisplayChannel::create_canvas(int surface_id, const std::vector<int>& canvas_types, int width,
                                    int height, uint32_t format)
 {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     bool recreate = true;
 #endif
     unsigned int i;
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     if (screen()->need_recreate_context_gl()) {
         recreate = false;
     }
@@ -1176,7 +1176,7 @@ void DisplayChannel::create_canvas(int surface_id, const std::vector<int>& canva
         if (canvas_types[i] == CANVAS_OPTION_SW && create_sw_canvas(surface_id, width, height, format)) {
             break;
         }
-#ifdef USE_OGL
+#ifdef USE_OPENGL
         if (canvas_types[i] == CANVAS_OPTION_OGL_FBO && create_ogl_canvas(surface_id, width, height, format,
                                                                           recreate,
                                                                           RENDER_TYPE_FBO)) {
@@ -1408,7 +1408,7 @@ void DisplayChannel::handle_stream_destroy_all(RedPeer::InMessage* message)
 
 void DisplayChannel::create_primary_surface(int width, int height, uint32_t format)
 {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
    Canvas *canvas;
 #endif
    _mark = false;
@@ -1427,7 +1427,7 @@ void DisplayChannel::create_primary_surface(int width, int height, uint32_t form
     _y_res = height;
     _format = format;
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     canvas = surfaces_mngr.get_canvas(0);
 
     if (canvas->get_pixmap_type() == CANVAS_TYPE_GL) {
@@ -1448,7 +1448,7 @@ void DisplayChannel::create_surface(int surface_id, int width, int height, uint3
         THROW("Create surface failed");
     }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     Canvas *canvas;
 
     canvas = surfaces_mngr.get_canvas(surface_id);
@@ -1462,7 +1462,7 @@ void DisplayChannel::create_surface(int surface_id, int width, int height, uint3
 void DisplayChannel::destroy_primary_surface()
 {
     if (screen()) {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
         if (surfaces_mngr.is_present_canvas(0)) {
             Canvas *canvas;
 
diff --git a/client/display_channel.h b/client/display_channel.h
index e6cd227..647fb66 100644
--- a/client/display_channel.h
+++ b/client/display_channel.h
@@ -26,7 +26,7 @@
 #include "cache.hpp"
 #include "screen_layer.h"
 #include "process_loop.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "red_pixmap_gl.h"
 #endif
 #include "glz_decoder_window.h"
@@ -48,7 +48,7 @@ private:
     DisplayChannel& _channel;
 };
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 class GLInterruptRecreate: public EventSources::Trigger {
 public:
     GLInterruptRecreate(DisplayChannel& channel);
@@ -103,7 +103,7 @@ public:
 
     virtual void copy_pixels(const QRegion& dest_region, RedDrawable& dest_dc);
     virtual void copy_pixels(const QRegion& dest_region, const PixmapHeader &dest);
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     virtual void recreate_ogl_context();
     virtual void recreate_ogl_context_interrupt();
     virtual void pre_migrate();
@@ -134,7 +134,7 @@ private:
     void set_draw_handlers();
     void clear_draw_handlers();
     bool create_sw_canvas(int surface_id, int width, int height, uint32_t format);
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     bool create_ogl_canvas(int surface_id, int width, int height, uint32_t format, bool recreate,
                            RenderType rendertype);
 #endif
@@ -200,7 +200,7 @@ private:
     int _x_res;
     int _y_res;
     uint32_t _format;
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     RenderType _rendertype;
 #endif
 
@@ -226,7 +226,7 @@ private:
     std::vector<VideoStream*> _streams;
     VideoStream* _active_streams;
     StreamsTrigger _streams_trigger;
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     GLInterruptRecreate _gl_interrupt_recreate;
 #endif
     InterruptUpdate _interrupt_update;
diff --git a/client/red_client.cpp b/client/red_client.cpp
index 7fd2b5e..56a3e22 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -811,7 +811,7 @@ void RedClient::calc_pixmap_cach_and_glz_window_size(uint32_t display_channels_h
 
 void RedClient::on_display_mode_change()
 {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     Lock lock(_channels_lock);
     Channels::iterator iter = _channels.begin();
     for (; iter != _channels.end(); ++iter) {
diff --git a/client/red_window.h b/client/red_window.h
index 632564d..dc5bad7 100644
--- a/client/red_window.h
+++ b/client/red_window.h
@@ -72,7 +72,7 @@ public:
     void stop_key_interception();
     void set_menu(Menu* menu);
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     void untouch_context();
     RedGlContext create_context_gl();
     RedPbuffer create_pbuff(int width, int height);
diff --git a/client/screen.cpp b/client/screen.cpp
index d8b6dde..f17a0ba 100644
--- a/client/screen.cpp
+++ b/client/screen.cpp
@@ -892,7 +892,7 @@ int RedScreen::get_screen_id()
     return _monitor ? _monitor->get_screen_id() : 0;
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 void RedScreen::untouch_context()
 {
     _window.untouch_context();
@@ -923,7 +923,7 @@ void RedScreen::interrupt_update()
     _update_interrupt_trigger->trigger();
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 void RedScreen::set_type_gl()
 {
     _window.set_type_gl();
@@ -933,5 +933,5 @@ void RedScreen::unset_type_gl()
 {
     _window.unset_type_gl();
 }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
diff --git a/client/screen.h b/client/screen.h
index 2b40d77..1d40e6c 100644
--- a/client/screen.h
+++ b/client/screen.h
@@ -21,9 +21,9 @@
 #include "common.h"
 #include "region.h"
 #include "red_key.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "GL/gl.h"
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 #include "red_window.h"
 #include "platform.h"
@@ -95,7 +95,7 @@ public:
     int get_id() { return _id;}
     int get_screen_id();
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     void untouch_context();
     bool need_recreate_context_gl();
     void set_type_gl();
diff --git a/client/windows/red_pixmap_sw.cpp b/client/windows/red_pixmap_sw.cpp
index a72d870..991b673 100644
--- a/client/windows/red_pixmap_sw.cpp
+++ b/client/windows/red_pixmap_sw.cpp
@@ -52,7 +52,7 @@ RedPixmapSw::RedPixmapSw(int width, int height, RedDrawable::Format format,
     bitmap_info.inf.bmiHeader.biWidth = _width;
     bitmap_info.inf.bmiHeader.biHeight = top_bottom ? -_height : _height;
 
-/*#ifdef USE_OGL
+/*#ifdef USE_OPENGL
     // -----------------------------------------------------------------------------
     // ensure valid access to additional stride.
     // apparently glReadPixels validate ((ptr of last line) + GL_PACK_ROW_LENGTH + 1).
@@ -98,7 +98,7 @@ RedPixmapSw::RedPixmapSw(int width, int height, RedDrawable::Format format,
     if (!bitmap.valid()) {
         THROW("create compatible bitmap failed");
     }
-/*#ifdef USE_OGL
+/*#ifdef USE_OPENGL
     SetWindowOrgEx(dc.get(), 0, -1, NULL); // compensate for one pad line
 #endif*/
     ((RedPixmap_p*)get_opaque())->prev_bitmap = (HBITMAP)SelectObject(dc.get(), bitmap.release());
diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp
index 92ece9b..dcd35fa 100644
--- a/client/windows/red_window.cpp
+++ b/client/windows/red_window.cpp
@@ -814,7 +814,7 @@ void RedWindow::cleanup()
     UnhookWindowsHookEx(low_keyboard_hook);
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 
 void RedWindow::touch_context_draw()
 {
diff --git a/client/x11/pixels_source_p.h b/client/x11/pixels_source_p.h
index b1b5261..8892c58 100644
--- a/client/x11/pixels_source_p.h
+++ b/client/x11/pixels_source_p.h
@@ -19,26 +19,26 @@
 #define _H_PIXELE_SOURSR_P
 
 #include <X11/X.h>
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include <GL/glu.h>
-#endif // USE_OGL
+#endif // USE_OPENGL
 #include <X11/Xdefs.h>
 #include <X11/Xutil.h> // required by Xshm.h, but not included by it
 #include <X11/extensions/XShm.h>
 #include "red_window.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "red_pixmap_gl.h"
-#endif // USE_OGL
+#endif // USE_OPENGL
 #include "pixman_utils.h"
 
 enum {
     PIXELS_SOURCE_TYPE_INVALID,
     PIXELS_SOURCE_TYPE_X_DRAWABLE,
     PIXELS_SOURCE_TYPE_PIXMAP,
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     PIXELS_SOURCE_TYPE_GL_TEXTURE,
     PIXELS_SOURCE_TYPE_GL_DRAWABLE,
-#endif // USE_OGL
+#endif // USE_OPENGL
 };
 
 struct PixelsSource_p {
@@ -56,17 +56,17 @@ struct PixelsSource_p {
             int screen;
             GC gc;
             int width, height;
-#ifdef USE_OGL
+#ifdef USE_OPENGL
             RenderType rendertype;
             union {
                 GLXPbuffer pbuff;
                 GLuint fbo;
             };
             RedGlContext context;
-#endif // USE_OGL
+#endif // USE_OPENGL
         } x_drawable;
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
         struct {
             RenderType rendertype;
             Win win;
@@ -80,7 +80,7 @@ struct PixelsSource_p {
             };
             RedGlContext context;
         } gl;
-#endif // USE_OGL
+#endif // USE_OPENGL
     };
 };
 
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 37df809..7c31058 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -78,9 +78,9 @@ static Display* x_display = NULL;
 static bool x_shm_avail = false;
 static XVisualInfo **vinfo = NULL;
 static RedDrawable::Format *screen_format = NULL;
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 static GLXFBConfig **fb_config = NULL;
-#endif // USE_OGL
+#endif // USE_OPENGL
 static XIM x_input_method = NULL;
 static XIC x_input_context = NULL;
 
@@ -510,12 +510,12 @@ RedDrawable::Format XPlatform::get_screen_format(int screen)
     return screen_format[screen];
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 GLXFBConfig** XPlatform::get_fbconfig()
 {
     return fb_config;
 }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 XIC XPlatform::get_input_context()
 {
@@ -2884,7 +2884,7 @@ static void cleanup(void)
         delete vinfo;
         vinfo = NULL;
     }
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     if (fb_config) {
         for (i = 0; i < ScreenCount(x_display); ++i) {
             if (fb_config[i]) {
@@ -2894,7 +2894,7 @@ static void cleanup(void)
         delete fb_config;
         fb_config = NULL;
     }
-#endif // USE_OGL
+#endif // USE_OPENGL
 }
 
 static void quit_handler(int sig)
@@ -3057,10 +3057,10 @@ static XVisualInfo* get_x_vis_info(int screen)
 
 void Platform::init()
 {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     int err, ev;
     int threads_enable;
-#endif // USE_OGL
+#endif // USE_OPENGL
     int major, minor;
     Bool pixmaps;
 
@@ -3068,7 +3068,7 @@ void Platform::init()
 
     setlocale(LC_ALL, "");
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     threads_enable = XInitThreads();
 #else
     XInitThreads();
@@ -3087,7 +3087,7 @@ void Platform::init()
     memset(vinfo, 0, sizeof(XVisualInfo *) * ScreenCount(x_display));
     screen_format = new RedDrawable::Format[ScreenCount(x_display)];
     memset(screen_format, 0, sizeof(RedDrawable::Format) * ScreenCount(x_display));
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     fb_config = new GLXFBConfig *[ScreenCount(x_display)];
     memset(fb_config, 0, sizeof(GLXFBConfig *) * ScreenCount(x_display));
 
@@ -3122,13 +3122,13 @@ void Platform::init()
             }
         }
     } else
-#else // !USE_OGL
+#else // !USE_OPENGL
     {
         for (int i = 0; i < ScreenCount(x_display); ++i) {
             vinfo[i] = get_x_vis_info(i);
         }
     }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
     for (int i = 0; i < ScreenCount(x_display); ++i) {
         if (vinfo[i] == NULL) {
diff --git a/client/x11/red_drawable.cpp b/client/x11/red_drawable.cpp
index 3712dfd..d6cce92 100644
--- a/client/x11/red_drawable.cpp
+++ b/client/x11/red_drawable.cpp
@@ -25,7 +25,7 @@
 #include "x_platform.h"
 #include "utils.h"
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "gl_utils.h"
 #include <GL/gl.h>
 #include <GL/glu.h>
@@ -136,7 +136,7 @@ static inline void copy_to_gldrawable_from_pixmap(const RedDrawable_p* dest,
         glXMakeCurrent(XPlatform::get_display(), pbuffer, context);
     }
 }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 static inline void copy_to_drawable_from_drawable(const RedDrawable_p* dest,
                                                   const SpiceRect& area,
@@ -274,7 +274,7 @@ static inline void copy_to_x_drawable(const RedDrawable_p* dest,
     }
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 static inline void copy_to_gl_drawable(const RedDrawable_p* dest,
                                        const SpiceRect& area,
                                        const SpicePoint& offset,
@@ -292,7 +292,7 @@ static inline void copy_to_gl_drawable(const RedDrawable_p* dest,
         THROW("invalid source type %d", source->type);
     }
 }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 static inline void copy_to_pixmap_from_drawable(const RedDrawable_p* dest,
                                                 const SpiceRect& area,
@@ -323,7 +323,7 @@ static inline void copy_to_pixmap_from_pixmap(const RedDrawable_p* dest,
                              area.bottom - area.top);
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 static inline void copy_to_pixmap_from_gltexture(const RedDrawable_p* dest,
                                                  const SpiceRect& area,
                                                  const SpicePoint& offset,
@@ -367,7 +367,7 @@ static inline void copy_to_pixmap_from_gltexture(const RedDrawable_p* dest,
         glXMakeCurrent(XPlatform::get_display(), win, context);
     }
 }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 static inline void copy_to_pixmap(const RedDrawable_p* dest,
                                   const SpiceRect& area,
@@ -376,11 +376,11 @@ static inline void copy_to_pixmap(const RedDrawable_p* dest,
                                   int src_x, int src_y)
 {
     switch (source->type) {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     case PIXELS_SOURCE_TYPE_GL_TEXTURE:
         copy_to_pixmap_from_gltexture(dest, area, offset, source, src_x, src_y);
         break;
-#endif // USE_OGL
+#endif // USE_OPENGL
     case PIXELS_SOURCE_TYPE_X_DRAWABLE:
         copy_to_pixmap_from_drawable(dest, area, offset, source, src_x, src_y);
         break;
@@ -397,12 +397,12 @@ void RedDrawable::copy_pixels(const PixelsSource& src, int src_x, int src_y, con
     PixelsSource_p* source = (PixelsSource_p*)src.get_opaque();
     RedDrawable_p* dest = (RedDrawable_p*)get_opaque();
     switch (dest->source.type) {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     case PIXELS_SOURCE_TYPE_GL_DRAWABLE:
         copy_to_gl_drawable(dest, area, _origin, source, src_x + src._origin.x,
                             src_y + src._origin.y);
         break;
-#endif // USE_OGL
+#endif // USE_OPENGL
     case PIXELS_SOURCE_TYPE_X_DRAWABLE:
         copy_to_x_drawable(dest, area, _origin, source, src_x + src._origin.x,
                            src_y + src._origin.y);
@@ -654,7 +654,7 @@ static inline void fill_drawable(RedDrawable_p* dest, const SpiceRect& area, rgb
                    area.right - area.left, area.bottom - area.top);
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 static inline void fill_gl_drawable(RedDrawable_p* dest, const SpiceRect& area, rgb32_t color,
                                     const SpicePoint& offset)
 {
@@ -688,7 +688,7 @@ static inline void fill_gl_drawable(RedDrawable_p* dest, const SpiceRect& area,
 
     glColor3f(1, 1, 1);
 }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 static inline void fill_pixmap(RedDrawable_p* dest, const SpiceRect& area, rgb32_t color,
                                const SpicePoint& offset)
@@ -706,11 +706,11 @@ void RedDrawable::fill_rect(const SpiceRect& area, rgb32_t color)
 {
     RedDrawable_p* dest = (RedDrawable_p*)get_opaque();
     switch (dest->source.type) {
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     case PIXELS_SOURCE_TYPE_GL_DRAWABLE:
         fill_gl_drawable(dest, area, color, _origin);
         break;
-#endif // USE_OGL
+#endif // USE_OPENGL
     case PIXELS_SOURCE_TYPE_X_DRAWABLE:
         fill_drawable(dest, area, color, _origin);
         break;
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 8af2226..9f4da60 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -25,12 +25,12 @@
 #include <X11/Xatom.h>
 #include <X11/XKBlib.h>
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include <GL/gl.h>
 #include <GL/glu.h>
 #include <GL/glx.h>
 #include <GL/glext.h>
-#endif // USE_OGL
+#endif // USE_OPENGL
 #include <stdio.h>
 
 #include "red_window.h"
@@ -41,10 +41,10 @@
 #include "pixels_source_p.h"
 #include <spice/protocol.h>
 #include "region.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "gl_utils.h"
 #include "red_pixmap_gl.h"
-#endif // USE_OGL
+#endif // USE_OPENGL
 #include "x_icon.h"
 
 
@@ -1066,7 +1066,7 @@ void RedWindow_p::wait_for_unmap()
     }
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 void RedWindow_p::set_glx(int width, int height)
 {
     if (_glcont_copy) {
@@ -1086,7 +1086,7 @@ void RedWindow_p::set_glx(int width, int height)
         GLC_ERROR_TEST_FINISH;
     }
 }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 void RedWindow_p::set_minmax(PixelsSource_p& pix_source)
 {
@@ -1127,9 +1127,9 @@ Cursor RedWindow_p::create_invisible_cursor(Window window)
 RedWindow_p::RedWindow_p()
     : _win (None)
     , _show_pos_valid (false)
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     , _glcont_copy (NULL)
-#endif // USE_OGL
+#endif // USE_OPENGL
     , _icon (NULL)
     , _focused (false)
     , _ignore_foucs (false)
@@ -1167,12 +1167,12 @@ void RedWindow_p::destroy(RedWindow& red_window, PixelsSource_p& pix_source)
     XFreeCursor(x_display, _invisible_cursor);
     _invisible_cursor = None;
     XDeleteContext(x_display, window, user_data_context);
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     if (_glcont_copy) {
         glXDestroyContext(x_display, _glcont_copy);
         _glcont_copy = NULL;
     }
-#endif // USE_OGL
+#endif // USE_OPENGL
     XDestroyWindow(x_display, window);
     XFreeColormap(x_display, _colormap);
     XFreeGC(x_display, pix_source.x_drawable.gc);
@@ -2075,7 +2075,7 @@ bool RedWindow::get_mouse_anchor_point(SpicePoint& pt)
     return true;
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 RedGlContext RedWindow::create_context_gl()
 {
     if (XPlatform::get_fbconfig()[_screen]) {
@@ -2148,7 +2148,7 @@ void RedWindow::set_render_fbo(GLuint fbo)
     pix_source->x_drawable.rendertype = RENDER_TYPE_FBO;
     pix_source->x_drawable.fbo = fbo;
 }
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 int RedWindow::get_screen_num()
 {
diff --git a/client/x11/red_window_p.h b/client/x11/red_window_p.h
index 6f05a90..6f94d26 100644
--- a/client/x11/red_window_p.h
+++ b/client/x11/red_window_p.h
@@ -18,17 +18,17 @@
 #ifndef _H_RED_WINDOW_P
 #define _H_RED_WINDOW_P
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include <GL/glx.h>
-#endif // USE_OGL
+#endif // USE_OPENGL
 #include <X11/Xdefs.h>
 #include <X11/Xlib.h>
 
 typedef Window Win;
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 typedef GLXContext RedGlContext;
 typedef GLXPbuffer RedPbuffer;
-#endif // USE_OGL
+#endif // USE_OPENGL
 
 class RedWindow;
 class Icon;
@@ -54,9 +54,9 @@ public:
     static void win_proc(XEvent& event);
     static Cursor create_invisible_cursor(Window window);
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     void set_glx(int width, int height);
-#endif // USE_OGL
+#endif // USE_OPENGL
     static void handle_key_press_event(RedWindow& red_window, XKeyEvent* event);
 
 protected:
@@ -67,9 +67,9 @@ protected:
     bool _expect_parent;
     SpicePoint _show_pos;
     bool _show_pos_valid;
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     GLXContext _glcont_copy;
-#endif // USE_OGL
+#endif // USE_OPENGL
     Icon* _icon;
     bool _focused;
     bool _ignore_foucs;
diff --git a/client/x11/x_platform.h b/client/x11/x_platform.h
index c535652..93debdc 100644
--- a/client/x11/x_platform.h
+++ b/client/x11/x_platform.h
@@ -29,9 +29,9 @@ public:
     static XVisualInfo** get_vinfo();
     static RedDrawable::Format get_screen_format(int screen);
     static XIC get_input_context();
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     static GLXFBConfig** get_fbconfig();
-#endif // USE_OGL
+#endif // USE_OPENGL
 
     typedef void (*win_proc_t)(XEvent& event);
     static void set_win_proc(Window win, win_proc_t proc);
diff --git a/configure.ac b/configure.ac
index 23c814f..ac1d5e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,7 +232,7 @@ SPICE_REQUIRES+=" openssl"
 if test "x$enable_opengl" = "xyes"; then
    AC_CHECK_LIB(GL, glBlendFunc, GL_LIBS="$GL_LIBS -lGL", enable_opengl=no)
    AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lGLU", enable_opengl=no)
-   AC_DEFINE([USE_OGL], [1], [Define to build with OpenGL support])
+   AC_DEFINE([USE_OPENGL], [1], [Define to build with OpenGL support])
    AC_DEFINE([GL_GLEXT_PROTOTYPES], [], [Enable GLExt prototypes])
 
    if test "x$enable_opengl" = "xno"; then
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 8b3d0ff..19d6e8d 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -32,9 +32,9 @@
 #include "red_worker.h"
 #include "quic.h"
 #include "reds_sw_canvas.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "reds_gl_canvas.h"
-#endif // USE_OGL
+#endif // USE_OPENGL
 #include "reds.h"
 #include "red_dispatcher.h"
 #include "red_parse_qxl.h"
@@ -140,7 +140,7 @@ typedef struct RendererInfo {
 
 static RendererInfo renderers_info[] = {
     {RED_RENDERER_SW, "sw"},
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     {RED_RENDERER_OGL_PBUF, "oglpbuf"},
     {RED_RENDERER_OGL_PIXMAP, "oglpixmap"},
 #endif
@@ -496,9 +496,9 @@ RedDispatcher *red_dispatcher_init(QXLInstance *qxl)
 
     quic_init();
     sw_canvas_init();
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     gl_canvas_init();
-#endif // USE_OGL
+#endif // USE_OPENGL
 
     if (socketpair(AF_LOCAL, SOCK_STREAM, 0, channels) == -1) {
         red_error("socketpair failed %s", strerror(errno));
diff --git a/server/red_worker.c b/server/red_worker.c
index 856b66a..a9452fb 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -40,10 +40,10 @@
 #include <spice/protocol.h>
 #include "red_worker.h"
 #include "reds_sw_canvas.h"
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 #include "reds_gl_canvas.h"
 #include "ogl_ctx.h"
-#endif /* USE_OGL */
+#endif /* USE_OPENGL */
 #include "quic.h"
 #include "lz.h"
 #include "glz_encoder_dictionary.h"
@@ -8305,7 +8305,7 @@ static void red_migrate_display(RedWorker *worker)
     }
 }
 
-#ifdef USE_OGL
+#ifdef USE_OPENGL
 static SpiceCanvas *create_ogl_context_common(RedWorker *worker, OGLCtx *ctx, uint32_t width,
                                               uint32_t height, int32_t stride, uint8_t depth)
 {
@@ -8375,7 +8375,7 @@ static inline void *create_canvas_for_surface(RedWorker *worker, RedSurface *sur
         surface->context.top_down = TRUE;
         surface->context.canvas_draws_on_surface = TRUE;
         return canvas;
-#ifdef USE_OGL
+#ifdef USE_OPENGL
     case RED_RENDERER_OGL_PBUF:
         canvas = create_ogl_pbuf_context(worker, width, height, stride,
                                          SPICE_SURFACE_FMT_DEPTH(format));
commit c1b7ecac3f51a2818bf7abd00d27f0475b507ba1
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Apr 20 17:52:23 2011 +0200

    use AC_DEFINE instead of hardcoding preprocessor flags
    
    Now that all source files include config.h, we can use AC_DEFINE
    to enable/disable optional features (opengl, cegui). This is
    cleaner than directly appending -Dxxx directives to the preprocessor
    flags. This also guarantees that everything will be appropriately
    rebuilt when using the same source tree to build first with opengl
    support and then without (the config.h timestamp will change,
    triggering a rebuild of the files including it)

diff --git a/configure.ac b/configure.ac
index 7e77672..23c814f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -173,13 +173,13 @@ if test "x$enable_gui" = "xyes"; then
     [
         AC_SUBST(CEGUI06_CFLAGS)
         AC_SUBST(CEGUI06_LIBS)
-        CEGUI06_CFLAGS+="-DUSE_GUI"
+        AC_DEFINE([USE_GUI], [1], [Define to build with CEGUI support])
     ],
     [
         PKG_CHECK_MODULES(CEGUI, CEGUI >= 0.6.0 CEGUI < 0.7.0)
         AC_SUBST(CEGUI_CFLAGS)
         AC_SUBST(CEGUI_LIBS)
-        CEGUI_CFLAGS+="-DUSE_GUI"
+        AC_DEFINE([USE_GUI], [1], [Define to build with CEGUI support])
     ])
 fi
 
@@ -232,7 +232,8 @@ SPICE_REQUIRES+=" openssl"
 if test "x$enable_opengl" = "xyes"; then
    AC_CHECK_LIB(GL, glBlendFunc, GL_LIBS="$GL_LIBS -lGL", enable_opengl=no)
    AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lGLU", enable_opengl=no)
-   GL_CFLAGS="-DGL_GLEXT_PROTOTYPES -DUSE_OGL"
+   AC_DEFINE([USE_OGL], [1], [Define to build with OpenGL support])
+   AC_DEFINE([GL_GLEXT_PROTOTYPES], [], [Enable GLExt prototypes])
 
    if test "x$enable_opengl" = "xno"; then
       AC_MSG_ERROR([GL libraries not available])
commit 7e30572ab1d51d5b8a7f6f9b9a3472d59a0ea167
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Apr 21 13:16:18 2011 +0200

    add config.h to autogenerated files too
    
    Modify the python (de)marshaller generator to add #include
    <config.h> at the beginning of the C files it generates

diff --git a/spice_codegen.py b/spice_codegen.py
index 3a9989d..4dad06c 100755
--- a/spice_codegen.py
+++ b/spice_codegen.py
@@ -142,6 +142,10 @@ writer.set_option("source", os.path.basename(proto_file))
 
 writer.public_prefix = options.prefix
 
+writer.writeln("#ifdef HAVE_CONFIG_H")
+writer.writeln("#include <config.h>")
+writer.writeln("#endif")
+
 if options.assert_on_error:
     writer.set_option("assert_on_error")
 
commit 78c1465ed309d2e8937dc00a19635f40c8a4b05a
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Apr 21 12:35:34 2011 +0200

    add #include <config.h> to all source files
    
    When using config.h, it must be the very first include in all source
    files since it contains #define that may change the compilation process
    (eg libc structure layout changes when it's used to enable large file
    support on 32 bit x86 archs). This commit adds it at the beginning
    of all .c and .cpp files

diff --git a/client/application.cpp b/client/application.cpp
index 9e2c7e1..1f3ad24 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #ifdef WIN32
diff --git a/client/canvas.cpp b/client/canvas.cpp
index 284a814..3b5f4b6 100644
--- a/client/canvas.cpp
+++ b/client/canvas.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "canvas.h"
diff --git a/client/client_net_socket.cpp b/client/client_net_socket.cpp
index 6ce44c5..412c1fd 100644
--- a/client/client_net_socket.cpp
+++ b/client/client_net_socket.cpp
@@ -18,6 +18,9 @@
     Author:
         yhalperi at redhat.com
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "client_net_socket.h"
diff --git a/client/cmd_line_parser.cpp b/client/cmd_line_parser.cpp
index ec00c3e..2f63c04 100644
--- a/client/cmd_line_parser.cpp
+++ b/client/cmd_line_parser.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 
diff --git a/client/controller.cpp b/client/controller.cpp
index e8d37e6..e7c4b95 100644
--- a/client/controller.cpp
+++ b/client/controller.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "controller.h"
diff --git a/client/cursor.cpp b/client/cursor.cpp
index 0b7d956..2ca2cd7 100644
--- a/client/cursor.cpp
+++ b/client/cursor.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "cursor.h"
diff --git a/client/cursor_channel.cpp b/client/cursor_channel.cpp
index c973e9d..12e2470 100644
--- a/client/cursor_channel.cpp
+++ b/client/cursor_channel.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "cursor_channel.h"
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index 2950c30..16a014c 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "canvas.h"
diff --git a/client/foreign_menu.cpp b/client/foreign_menu.cpp
index e5d7459..926e266 100644
--- a/client/foreign_menu.cpp
+++ b/client/foreign_menu.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "foreign_menu.h"
diff --git a/client/glz_decode_tmpl.c b/client/glz_decode_tmpl.c
index 2c47571..2e4f136 100644
--- a/client/glz_decode_tmpl.c
+++ b/client/glz_decode_tmpl.c
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 // External defines: PLT, RGBX/PLTXX/ALPHA, TO_RGB32.
 // If PLT4/1 and TO_RGB32 are defined, we need CAST_PLT_DISTANCE (
diff --git a/client/glz_decoder.cpp b/client/glz_decoder.cpp
index c5ccb95..dea1a1b 100644
--- a/client/glz_decoder.cpp
+++ b/client/glz_decoder.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "glz_decoder_config.h"
diff --git a/client/glz_decoder_window.cpp b/client/glz_decoder_window.cpp
index ab081f8..54fdbdc 100644
--- a/client/glz_decoder_window.cpp
+++ b/client/glz_decoder_window.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 
diff --git a/client/gui/gui.cpp b/client/gui/gui.cpp
index eba241f..abfe111 100644
--- a/client/gui/gui.cpp
+++ b/client/gui/gui.cpp
@@ -15,6 +15,10 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "common.h"
 
 #include <limits.h>
diff --git a/client/gui/resource_provider.cpp b/client/gui/resource_provider.cpp
index 2b5c44f..b80ce09 100644
--- a/client/gui/resource_provider.cpp
+++ b/client/gui/resource_provider.cpp
@@ -15,6 +15,10 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "common.h"
 
 #include "resource_provider.h"
diff --git a/client/gui/softrenderer.cpp b/client/gui/softrenderer.cpp
index bdc7a6c..92a1c83 100644
--- a/client/gui/softrenderer.cpp
+++ b/client/gui/softrenderer.cpp
@@ -15,10 +15,11 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-#include "common.h"
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
+#include "common.h"
 #include "utils.h"
 #include "debug.h"
 
diff --git a/client/gui/softtexture.cpp b/client/gui/softtexture.cpp
index a633f24..b41dd65 100644
--- a/client/gui/softtexture.cpp
+++ b/client/gui/softtexture.cpp
@@ -15,12 +15,11 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-#include "common.h"
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#include "common.h"
 
 #include "softtexture.h"
 #include "softrenderer.h"
diff --git a/client/hot_keys.cpp b/client/hot_keys.cpp
index 053f499..65b1bc3 100644
--- a/client/hot_keys.cpp
+++ b/client/hot_keys.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "hot_keys.h"
diff --git a/client/inputs_channel.cpp b/client/inputs_channel.cpp
index ae41624..4d1232a 100644
--- a/client/inputs_channel.cpp
+++ b/client/inputs_channel.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "inputs_channel.h"
diff --git a/client/jpeg_decoder.cpp b/client/jpeg_decoder.cpp
index f7aba76..74cb758 100644
--- a/client/jpeg_decoder.cpp
+++ b/client/jpeg_decoder.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "jpeg_decoder.h"
diff --git a/client/menu.cpp b/client/menu.cpp
index 1743821..ebbd323 100644
--- a/client/menu.cpp
+++ b/client/menu.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "menu.h"
diff --git a/client/mjpeg_decoder.cpp b/client/mjpeg_decoder.cpp
index 4950950..0ac6eae 100644
--- a/client/mjpeg_decoder.cpp
+++ b/client/mjpeg_decoder.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "debug.h"
diff --git a/client/monitor.cpp b/client/monitor.cpp
index 0b73956..3d74296 100644
--- a/client/monitor.cpp
+++ b/client/monitor.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "monitor.h"
diff --git a/client/playback_channel.cpp b/client/playback_channel.cpp
index 1e902a9..731b520 100644
--- a/client/playback_channel.cpp
+++ b/client/playback_channel.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_client.h"
diff --git a/client/process_loop.cpp b/client/process_loop.cpp
index 9a0dadc..9cd530e 100644
--- a/client/process_loop.cpp
+++ b/client/process_loop.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "process_loop.h"
diff --git a/client/record_channel.cpp b/client/record_channel.cpp
index 084866c..738f98f 100644
--- a/client/record_channel.cpp
+++ b/client/record_channel.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_client.h"
diff --git a/client/red_channel.cpp b/client/red_channel.cpp
index f4cdf52..bcd7051 100644
--- a/client/red_channel.cpp
+++ b/client/red_channel.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_channel.h"
diff --git a/client/red_client.cpp b/client/red_client.cpp
index ea85278..7fd2b5e 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <math.h>
diff --git a/client/red_gdi_canvas.cpp b/client/red_gdi_canvas.cpp
index 2e0b453..038f784 100644
--- a/client/red_gdi_canvas.cpp
+++ b/client/red_gdi_canvas.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <stdint.h>
diff --git a/client/red_gl_canvas.cpp b/client/red_gl_canvas.cpp
index db47aaf..92529ce 100644
--- a/client/red_gl_canvas.cpp
+++ b/client/red_gl_canvas.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <stdint.h>
diff --git a/client/red_peer.cpp b/client/red_peer.cpp
index 86a9047..19919a6 100644
--- a/client/red_peer.cpp
+++ b/client/red_peer.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <openssl/x509.h>
diff --git a/client/red_sw_canvas.cpp b/client/red_sw_canvas.cpp
index fec6605..782caca 100644
--- a/client/red_sw_canvas.cpp
+++ b/client/red_sw_canvas.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <stdint.h>
diff --git a/client/screen.cpp b/client/screen.cpp
index 575ab5d..d8b6dde 100644
--- a/client/screen.cpp
+++ b/client/screen.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "screen.h"
diff --git a/client/screen_layer.cpp b/client/screen_layer.cpp
index 8a016b7..4515be2 100644
--- a/client/screen_layer.cpp
+++ b/client/screen_layer.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "screen_layer.h"
diff --git a/client/smartcard_channel.cpp b/client/smartcard_channel.cpp
index 32b6d8d..e0e9b88 100644
--- a/client/smartcard_channel.cpp
+++ b/client/smartcard_channel.cpp
@@ -14,6 +14,10 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <spice/enums.h>
 
 #include "client/red_client.h"
diff --git a/client/threads.cpp b/client/threads.cpp
index eb4b7a1..0b359e8 100644
--- a/client/threads.cpp
+++ b/client/threads.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "threads.h"
diff --git a/client/tunnel_channel.cpp b/client/tunnel_channel.cpp
index 5258742..3ed4572 100644
--- a/client/tunnel_channel.cpp
+++ b/client/tunnel_channel.cpp
@@ -18,6 +18,9 @@
     Author:
         yhalperi at redhat.com
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "tunnel_channel.h"
diff --git a/client/utils.cpp b/client/utils.cpp
index 460f610..01ea0d3 100644
--- a/client/utils.cpp
+++ b/client/utils.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <stdlib.h>
diff --git a/client/windows/event_sources_p.cpp b/client/windows/event_sources_p.cpp
index c357857..4a9adf1 100644
--- a/client/windows/event_sources_p.cpp
+++ b/client/windows/event_sources_p.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "event_sources.h"
diff --git a/client/windows/main.cpp b/client/windows/main.cpp
index 9c40102..5d6f85b 100644
--- a/client/windows/main.cpp
+++ b/client/windows/main.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <fstream>
diff --git a/client/windows/my_getopt.cpp b/client/windows/my_getopt.cpp
index 280850a..da87655 100644
--- a/client/windows/my_getopt.cpp
+++ b/client/windows/my_getopt.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "../../common/win/my_getopt-1.5/my_getopt.c"
diff --git a/client/windows/named_pipe.cpp b/client/windows/named_pipe.cpp
index 856235a..76d77da 100644
--- a/client/windows/named_pipe.cpp
+++ b/client/windows/named_pipe.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "named_pipe.h"
diff --git a/client/windows/pixels_source.cpp b/client/windows/pixels_source.cpp
index a27bfd3..167255b 100644
--- a/client/windows/pixels_source.cpp
+++ b/client/windows/pixels_source.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "pixels_source.h"
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index f57413d..c50d7fd 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 
diff --git a/client/windows/platform_utils.cpp b/client/windows/platform_utils.cpp
index eb87468..b57e921 100644
--- a/client/windows/platform_utils.cpp
+++ b/client/windows/platform_utils.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <map>
diff --git a/client/windows/playback.cpp b/client/windows/playback.cpp
index 5278288..701dffc 100644
--- a/client/windows/playback.cpp
+++ b/client/windows/playback.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "playback.h"
diff --git a/client/windows/record.cpp b/client/windows/record.cpp
index 398b165..f0bb644 100644
--- a/client/windows/record.cpp
+++ b/client/windows/record.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "record.h"
diff --git a/client/windows/red_drawable.cpp b/client/windows/red_drawable.cpp
index e4b6d8c..dabc0d9 100644
--- a/client/windows/red_drawable.cpp
+++ b/client/windows/red_drawable.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_drawable.h"
diff --git a/client/windows/red_pixmap.cpp b/client/windows/red_pixmap.cpp
index 2f8655c..4538441 100644
--- a/client/windows/red_pixmap.cpp
+++ b/client/windows/red_pixmap.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_pixmap.h"
diff --git a/client/windows/red_pixmap_gdi.cpp b/client/windows/red_pixmap_gdi.cpp
index 035618c..4336f46 100644
--- a/client/windows/red_pixmap_gdi.cpp
+++ b/client/windows/red_pixmap_gdi.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_pixmap_gdi.h"
diff --git a/client/windows/red_pixmap_sw.cpp b/client/windows/red_pixmap_sw.cpp
index 4d74da4..a72d870 100644
--- a/client/windows/red_pixmap_sw.cpp
+++ b/client/windows/red_pixmap_sw.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_pixmap_sw.h"
diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp
index 9f79ab3..92ece9b 100644
--- a/client/windows/red_window.cpp
+++ b/client/windows/red_window.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_window.h"
diff --git a/client/x11/event_sources_p.cpp b/client/x11/event_sources_p.cpp
index 9a69255..1958a04 100644
--- a/client/x11/event_sources_p.cpp
+++ b/client/x11/event_sources_p.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <sys/select.h>
 #include <sys/fcntl.h>
diff --git a/client/x11/main.cpp b/client/x11/main.cpp
index dfcc101..ccc9532 100644
--- a/client/x11/main.cpp
+++ b/client/x11/main.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "application.h"
diff --git a/client/x11/named_pipe.cpp b/client/x11/named_pipe.cpp
index c6f38da..0653bfc 100644
--- a/client/x11/named_pipe.cpp
+++ b/client/x11/named_pipe.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <sys/types.h>
 #include <sys/socket.h>
diff --git a/client/x11/pixels_source.cpp b/client/x11/pixels_source.cpp
index a2d49f3..8d8b344 100644
--- a/client/x11/pixels_source.cpp
+++ b/client/x11/pixels_source.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "x_platform.h"
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index dbd2b6a..37df809 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 
diff --git a/client/x11/platform_utils.cpp b/client/x11/platform_utils.cpp
index 5ca68f4..6ae30a4 100644
--- a/client/x11/platform_utils.cpp
+++ b/client/x11/platform_utils.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdarg.h>
 #include "utils.h"
diff --git a/client/x11/playback.cpp b/client/x11/playback.cpp
index be89a98..e69294c 100644
--- a/client/x11/playback.cpp
+++ b/client/x11/playback.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "playback.h"
 #include "utils.h"
diff --git a/client/x11/record.cpp b/client/x11/record.cpp
index 4ef9228..d799e5a 100644
--- a/client/x11/record.cpp
+++ b/client/x11/record.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "record.h"
 #include "utils.h"
diff --git a/client/x11/red_drawable.cpp b/client/x11/red_drawable.cpp
index 19dcd92..3712dfd 100644
--- a/client/x11/red_drawable.cpp
+++ b/client/x11/red_drawable.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_drawable.h"
diff --git a/client/x11/red_pixmap.cpp b/client/x11/red_pixmap.cpp
index 2a0eb99..79190a0 100644
--- a/client/x11/red_pixmap.cpp
+++ b/client/x11/red_pixmap.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_pixmap.h"
diff --git a/client/x11/red_pixmap_gl.cpp b/client/x11/red_pixmap_gl.cpp
index 0e7b8c1..011ead9 100644
--- a/client/x11/red_pixmap_gl.cpp
+++ b/client/x11/red_pixmap_gl.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <GL/gl.h>
 #include <GL/glu.h>
diff --git a/client/x11/red_pixmap_sw.cpp b/client/x11/red_pixmap_sw.cpp
index 2b514b7..a0dea4d 100644
--- a/client/x11/red_pixmap_sw.cpp
+++ b/client/x11/red_pixmap_sw.cpp
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "red_pixmap_sw.h"
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index d53a92f..8af2226 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include <X11/Xlib.h>
diff --git a/client/x11/res.cpp b/client/x11/res.cpp
index b2d3f71..f73e540 100644
--- a/client/x11/res.cpp
+++ b/client/x11/res.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "common.h"
 #include "resource.h"
diff --git a/client/x11/x_icon.cpp b/client/x11/x_icon.cpp
index 937eecc..8931d05 100644
--- a/client/x11/x_icon.cpp
+++ b/client/x11/x_icon.cpp
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "x_icon.h"
 #include "platform.h"
diff --git a/client/zlib_decoder.cpp b/client/zlib_decoder.cpp
index 9cdadb3..6c154fe 100644
--- a/client/zlib_decoder.cpp
+++ b/client/zlib_decoder.cpp
@@ -14,6 +14,10 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "common.h"
 #include "zlib_decoder.h"
 #include "debug.h"
diff --git a/common/canvas_base.c b/common/canvas_base.c
index fe650fe..272c7e8 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -20,6 +20,10 @@
 #error "This file shouldn't be compiled directly"
 #endif
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdarg.h>
 #include <stdlib.h>
 #include <setjmp.h>
diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index 020b23c..1b81d54 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "canvas_utils.h"
 
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index 27f644c..f67aadf 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -15,7 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifndef SPICE_CANVAS_INTERNAL
 #error "This file shouldn't be compiled directly"
diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index 844fc07..a04740b 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifndef SPICE_CANVAS_INTERNAL
 #error "This file shouldn't be compiled directly"
diff --git a/common/glc.c b/common/glc.c
index e58718f..d90e383 100644
--- a/common/glc.c
+++ b/common/glc.c
@@ -17,6 +17,9 @@
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <string.h>
diff --git a/common/lines.c b/common/lines.c
index 1a14c18..baf1ce9 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -45,7 +45,9 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 SOFTWARE.
 
 ******************************************************************/
-
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <spice/macros.h>
diff --git a/common/lz.c b/common/lz.c
index d0d9511..2e3a136 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -43,6 +43,9 @@
    SOFTWARE.
 
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "lz.h"
 
diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
index 18d6697..865a30a 100644
--- a/common/lz_compress_tmpl.c
+++ b/common/lz_compress_tmpl.c
@@ -40,6 +40,9 @@
    SOFTWARE.
 
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #define DJB2_START 5381;
 #define DJB2_HASH(hash, c) (hash = ((hash << 5) + hash) ^ (c)) //|{hash = ((hash << 5) + hash) + c;}
diff --git a/common/lz_decompress_tmpl.c b/common/lz_decompress_tmpl.c
index aa403f6..6d52074 100644
--- a/common/lz_decompress_tmpl.c
+++ b/common/lz_decompress_tmpl.c
@@ -59,6 +59,10 @@
     COPY_COMP_PIXEL(encoder, out) - copies pixel from the compressed buffer to the decompressed
                                     buffer. Increases out.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #if !defined(LZ_RGB_ALPHA)
 #define COPY_PIXEL(p, out) (*out++ = p)
 #define COPY_REF_PIXEL(ref, out) (*out++ = *ref++)
diff --git a/common/marshaller.c b/common/marshaller.c
index 6ee7b6a..2d62cd8 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -15,8 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "marshaller.h"
 #include "mem.h"
diff --git a/common/mem.c b/common/mem.c
index a9bd6cc..96be351 100644
--- a/common/mem.c
+++ b/common/mem.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "mem.h"
 #include <stdlib.h>
diff --git a/common/ogl_ctx.c b/common/ogl_ctx.c
index ae25c2d..072a0c0 100644
--- a/common/ogl_ctx.c
+++ b/common/ogl_ctx.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index 5daee27..e876fe6 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -15,8 +15,10 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include "pixman_utils.h"
 #include <spice/macros.h>
 
diff --git a/common/quic.c b/common/quic.c
index cd3aee8..8f8d726 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -19,6 +19,10 @@
 // Red Hat image compression based on SFALIC by Roman Starosolski
 // http://sun.iinf.polsl.gliwice.pl/~rstaros/sfalic/index.html
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "quic.h"
 #include <spice/macros.h>
 
diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c
index 5547c4d..7a32f2d 100644
--- a/common/quic_family_tmpl.c
+++ b/common/quic_family_tmpl.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifdef QUIC_FAMILY_8BPC
 #undef QUIC_FAMILY_8BPC
diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index 681493a..814fa5a 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifdef QUIC_RGB32
 #undef QUIC_RGB32
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index 47a6a23..d300fa9 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifdef ONE_BYTE
 #undef ONE_BYTE
diff --git a/common/region.c b/common/region.c
index 3f51f7b..0e1613c 100644
--- a/common/region.c
+++ b/common/region.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
diff --git a/common/rop3.c b/common/rop3.c
index 83880fe..53e8a6d 100644
--- a/common/rop3.c
+++ b/common/rop3.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 
diff --git a/common/sw_canvas.c b/common/sw_canvas.c
index e1b13e0..651c52b 100644
--- a/common/sw_canvas.c
+++ b/common/sw_canvas.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifndef SPICE_CANVAS_INTERNAL
 #error "This file shouldn't be compiled directly"
diff --git a/server/agent-msg-filter.c b/server/agent-msg-filter.c
index cd1f78c..71ff49b 100644
--- a/server/agent-msg-filter.c
+++ b/server/agent-msg-filter.c
@@ -17,6 +17,9 @@
    Red Hat Authors:
         hdegoede at redhat.com
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <string.h>
 #include "red_common.h"
diff --git a/server/glz_encode_match_tmpl.c b/server/glz_encode_match_tmpl.c
index bba44dc..b793e7f 100644
--- a/server/glz_encode_match_tmpl.c
+++ b/server/glz_encode_match_tmpl.c
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #define SHORT_PIX_IMAGE_DIST_LEVEL_1 64 //(1 << 6)
 #define SHORT_PIX_IMAGE_DIST_LEVEL_2 16384 // (1 << 14)
diff --git a/server/glz_encode_tmpl.c b/server/glz_encode_tmpl.c
index 359a25b..d514421 100644
--- a/server/glz_encode_tmpl.c
+++ b/server/glz_encode_tmpl.c
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #define DJB2_START 5381;
 #define DJB2_HASH(hash, c) (hash = ((hash << 5) + hash) ^ (c)) //|{hash = ((hash << 5) + hash) + c;}
diff --git a/server/glz_encoder.c b/server/glz_encoder.c
index 89b759c..8d20807 100644
--- a/server/glz_encoder.c
+++ b/server/glz_encoder.c
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <pthread.h>
 #include <stdio.h>
diff --git a/server/glz_encoder_dictionary.c b/server/glz_encoder_dictionary.c
index de8963d..7cadc49 100644
--- a/server/glz_encoder_dictionary.c
+++ b/server/glz_encoder_dictionary.c
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <pthread.h>
 #include <string.h>
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index 213f8a0..0cc53a2 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <netinet/in.h> // IPPROTO_TCP
 #include <netinet/tcp.h> // TCP_NODELAY
diff --git a/server/jpeg_encoder.c b/server/jpeg_encoder.c
index 44dad86..85ef54e 100644
--- a/server/jpeg_encoder.c
+++ b/server/jpeg_encoder.c
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "red_common.h"
 #include "jpeg_encoder.h"
diff --git a/server/main_channel.c b/server/main_channel.c
index 4ddd38b..e0fa1e4 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdint.h>
 #include <stdio.h>
diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c
index bfd7f92..bae7bd2 100644
--- a/server/mjpeg_encoder.c
+++ b/server/mjpeg_encoder.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "red_common.h"
 #include "mjpeg_encoder.h"
diff --git a/server/red_channel.c b/server/red_channel.c
index fe4c614..9012b0d 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -18,6 +18,9 @@
     Author:
         yhalperi at redhat.com
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdint.h>
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index c5cac58..8b3d0ff 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/server/red_memslots.c b/server/red_memslots.c
index 8c9810d..d98f38c 100644
--- a/server/red_memslots.c
+++ b/server/red_memslots.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "red_common.h"
 #include "red_memslots.h"
diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index 380765d..258a541 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdbool.h>
 #include <inttypes.h>
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index b27fdee..636f71e 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -18,6 +18,9 @@
     Author:
         yhalperi at redhat.com
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdint.h>
diff --git a/server/red_worker.c b/server/red_worker.c
index 8082139..856b66a 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdarg.h>
diff --git a/server/reds.c b/server/reds.c
index fe4c603..99a3176 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -15,8 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdint.h>
 #include <stdio.h>
diff --git a/server/reds.h b/server/reds.h
index b286471..07f0a11 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -18,8 +18,6 @@
 #ifndef _H_REDS
 #define _H_REDS
 
-#include "config.h"
-
 #include <stdint.h>
 #include <openssl/ssl.h>
 #include <sys/uio.h>
diff --git a/server/reds_gl_canvas.c b/server/reds_gl_canvas.c
index 4855a20..bf5244f 100644
--- a/server/reds_gl_canvas.c
+++ b/server/reds_gl_canvas.c
@@ -14,7 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "reds_gl_canvas.h"
 #define SPICE_CANVAS_INTERNAL
diff --git a/server/reds_sw_canvas.c b/server/reds_sw_canvas.c
index 428a9dc..6df63e6 100644
--- a/server/reds_sw_canvas.c
+++ b/server/reds_sw_canvas.c
@@ -14,7 +14,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "reds_sw_canvas.h"
 #define SPICE_CANVAS_INTERNAL
diff --git a/server/smartcard.c b/server/smartcard.c
index d201f5f..fed88a5 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -15,6 +15,10 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <arpa/inet.h>
 
 #include "server/char_device.h"
diff --git a/server/snd_worker.c b/server/snd_worker.c
index c8e9d12..8da11e1 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -15,6 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <fcntl.h>
 #include <errno.h>
diff --git a/server/zlib_encoder.c b/server/zlib_encoder.c
index 214180e..c51466b 100644
--- a/server/zlib_encoder.c
+++ b/server/zlib_encoder.c
@@ -15,6 +15,10 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "red_common.h"
 #include "zlib_encoder.h"
 #include <zlib.h>
commit 2db7212175c51f4121790bfd1fd677c0b77833d5
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Apr 20 17:50:22 2011 +0200

    autotools: correctly build canvas-related code
    
    spice client and spice server shares code from
    common/{gdi,gl,sw}_canvas.[ch]. However, while most of the code is
    shared, the server code wants a canvas compiled with
    SW_CANVAS_IMAGE_CACHE defined while the client code wants a canvas
    compiled with SW_CANVAS_CACHE.
    
    The initial autotools refactoring didn't take that into account,
    this is now fixed by this commit. After this commit, the canvas
    files from common/ are no longer compiled as part of the
    libspice-common.la convenience library. Instead, there are "proxy"
    canvas source files in client/ and server/ which #include the
    appropriate C files after defining the relevant #define for the
    binary that is being built.
    
    To prevent misuse of the canvas c files and headers in common/,
    SPICE_CANVAS_INTERNAL must be set when including the canvas headers
    from common/ or when building the c files from common/ otherwise
    the build will error out.

diff --git a/client/Makefile.am b/client/Makefile.am
index 627bd8a..2508267 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -77,6 +77,7 @@ spicec_SOURCES =		\
 	process_loop.h		\
 	read_write_mutex.h	\
 	record_channel.cpp	\
+	red_canvas_base.h	\
 	red_channel.cpp		\
 	red_channel.h		\
 	red_client.cpp		\
@@ -208,7 +209,6 @@ endif
 
 
 INCLUDES = \
-	-DSW_CANVAS_CACHE				\
 	-D__STDC_LIMIT_MACROS				\
 	-I$(top_srcdir)/client/x11			\
 	-I$(top_srcdir)/common				\
diff --git a/client/application.cpp b/client/application.cpp
index 292dae6..9e2c7e1 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -31,8 +31,10 @@
 #include "red_gdi_canvas.h"
 #endif
 #include "platform.h"
-#include "sw_canvas.h"
-#include "gl_canvas.h"
+#include "red_sw_canvas.h"
+#ifdef USE_OGL
+#include "red_gl_canvas.h"
+#endif
 #include "quic.h"
 #include "mutex.h"
 #include "cmd_line_parser.h"
diff --git a/client/canvas.h b/client/canvas.h
index 4844c31..0b8f2b6 100644
--- a/client/canvas.h
+++ b/client/canvas.h
@@ -25,7 +25,6 @@
 #include "messages.h"
 #include "cache.hpp"
 #include "shared_cache.hpp"
-#include "canvas_base.h"
 #include "canvas_utils.h"
 #include "glz_decoded_image.h"
 #include "glz_decoder.h"
diff --git a/client/glz_decoder.h b/client/glz_decoder.h
index f046f8c..35b0a3e 100644
--- a/client/glz_decoder.h
+++ b/client/glz_decoder.h
@@ -22,7 +22,7 @@
 #include "lz_common.h"
 #include "glz_decoder_config.h"
 #include "glz_decoder_window.h"
-#include "canvas_base.h"
+#include "red_canvas_base.h"
 
 class GlzDecodeHandler {
 public:
diff --git a/client/jpeg_decoder.h b/client/jpeg_decoder.h
index bd83b2e..34aa336 100644
--- a/client/jpeg_decoder.h
+++ b/client/jpeg_decoder.h
@@ -20,7 +20,7 @@
 #define _H_JPEG_DECODER
 
 #include "common.h"
-#include "canvas_base.h"
+#include "red_canvas_base.h"
 
 #ifdef WIN32
 /* We need some hacks to avoid warnings from the jpeg headers */
diff --git a/client/red_canvas_base.h b/client/red_canvas_base.h
new file mode 100644
index 0000000..bd59109
--- /dev/null
+++ b/client/red_canvas_base.h
@@ -0,0 +1,26 @@
+/*
+   Copyright (C) 2011 Red Hat, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef _H_RED_CANVAS_BASE
+#define _H_RED_CANVAS_BASE
+
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
+#include "canvas_base.h"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
+#endif
diff --git a/client/red_gdi_canvas.cpp b/client/red_gdi_canvas.cpp
index 72b31df..2e0b453 100644
--- a/client/red_gdi_canvas.cpp
+++ b/client/red_gdi_canvas.cpp
@@ -23,6 +23,12 @@
 #include "region.h"
 #include "red_pixmap_gdi.h"
 
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
+#include "gdi_canvas.c"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
 GDICanvas::GDICanvas(int width, int height, uint32_t format,
 		     PixmapCache& pixmap_cache, PaletteCache& palette_cache,
                      GlzDecoderWindow &glz_decoder_window, CSurfaces &csurfaces)
diff --git a/client/red_gdi_canvas.h b/client/red_gdi_canvas.h
index 643f3c6..76de12b 100644
--- a/client/red_gdi_canvas.h
+++ b/client/red_gdi_canvas.h
@@ -19,7 +19,11 @@
 #define _H_GDICANVAS
 
 #include "canvas.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
 #include "gdi_canvas.h"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
 #include "red_pixmap_gdi.h"
 
 class RedPixmap;
diff --git a/client/red_gl_canvas.cpp b/client/red_gl_canvas.cpp
index d7841b9..db47aaf 100644
--- a/client/red_gl_canvas.cpp
+++ b/client/red_gl_canvas.cpp
@@ -24,6 +24,12 @@
 #include "red_pixmap_gl.h"
 #include <GL/glx.h>
 
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
+#include "gl_canvas.c"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
 GCanvas::GCanvas(int width, int height, uint32_t format, RedWindow *win,
                  RenderType rendertype,
                  PixmapCache& pixmap_cache, PaletteCache& palette_cache,
diff --git a/client/red_gl_canvas.h b/client/red_gl_canvas.h
index 0260958..83e6512 100644
--- a/client/red_gl_canvas.h
+++ b/client/red_gl_canvas.h
@@ -19,8 +19,13 @@
 #define _H_GCANVAS
 
 #include "canvas.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
 #include "sw_canvas.h"
 #include "gl_canvas.h"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
 #include "red_pixmap_gl.h"
 #include "red_window.h"
 
diff --git a/client/red_sw_canvas.cpp b/client/red_sw_canvas.cpp
index b580e61..fec6605 100644
--- a/client/red_sw_canvas.cpp
+++ b/client/red_sw_canvas.cpp
@@ -25,6 +25,12 @@
 #include "region.h"
 #include "red_pixmap_sw.h"
 
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
+#include "sw_canvas.c"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
 SCanvas::SCanvas(bool onscreen,
                  int width, int height, uint32_t format, RedWindow *win,
                  PixmapCache& pixmap_cache, PaletteCache& palette_cache,
diff --git a/client/red_sw_canvas.h b/client/red_sw_canvas.h
index ebac710..2f807c7 100644
--- a/client/red_sw_canvas.h
+++ b/client/red_sw_canvas.h
@@ -20,7 +20,11 @@
 #define _H_CCANVAS
 
 #include "canvas.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
 #include "sw_canvas.h"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
 
 class RedPixmap;
 
diff --git a/client/windows/redc.vcproj b/client/windows/redc.vcproj
index 0b1ecbf..70eb170 100644
--- a/client/windows/redc.vcproj
+++ b/client/windows/redc.vcproj
@@ -413,10 +413,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\common\gdi_canvas.c"
-				>
-			</File>
-			<File
 				RelativePath="..\generated_demarshallers.cpp"
 				>
 			</File>
@@ -637,10 +633,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\common\sw_canvas.c"
-				>
-			</File>
-			<File
 				RelativePath="..\threads.cpp"
 				>
 			</File>
diff --git a/client/zlib_decoder.h b/client/zlib_decoder.h
index 4444040..c91ed49 100644
--- a/client/zlib_decoder.h
+++ b/client/zlib_decoder.h
@@ -20,7 +20,7 @@
 #define _H_ZLIB_DECODER
 
 #include "common.h"
-#include "canvas_base.h"
+#include "red_canvas_base.h"
 
 #ifndef __GNUC__
 #define ZLIB_WINAPI
diff --git a/common/Makefile.am b/common/Makefile.am
index 0a2f9c1..501a6e1 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -6,7 +6,6 @@ NULL =
 
 noinst_LTLIBRARIES = libspice-common.la
 libspice_common_la_SOURCES =		\
-	canvas_base.h			\
 	canvas_utils.c			\
 	canvas_utils.h			\
 	draw.h				\
@@ -34,21 +33,10 @@ libspice_common_la_SOURCES =		\
 	rop3.c				\
 	rop3.h				\
 	spice_common.h			\
-	sw_canvas.c			\
-	sw_canvas.h			\
-	$(NULL)
-
-if OS_WIN32
-libspice_common_la_SOURCES +=		\
-	gdi_canvas.h			\
-	gdi_canvas.c			\
 	$(NULL)
-endif
 
 if SUPPORT_GL
 libspice_common_la_SOURCES +=		\
-	gl_canvas.h			\
-	gl_canvas.c			\
 	gl_utils.h			\
 	glc.h				\
 	glc.c				\
@@ -58,7 +46,6 @@ libspice_common_la_SOURCES +=		\
 endif
 
 INCLUDES = \
-	-DSW_CANVAS_IMAGE_CACHE		\
 	$(GL_CFLAGS)			\
 	$(PIXMAN_CFLAGS)		\
 	$(PROTOCOL_CFLAGS)		\
@@ -69,6 +56,13 @@ INCLUDES = \
 
 EXTRA_DIST =				\
 	canvas_base.c			\
+	canvas_base.h			\
+	gdi_canvas.c			\
+	gdi_canvas.h			\
+	gl_canvas.c			\
+	gl_canvas.h			\
+	sw_canvas.c			\
+	sw_canvas.h			\
 	lz_compress_tmpl.c		\
 	lz_decompress_tmpl.c		\
 	quic_family_tmpl.c		\
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 4dedfcf..fe650fe 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -16,6 +16,10 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
+#ifndef SPICE_CANVAS_INTERNAL
+#error "This file shouldn't be compiled directly"
+#endif
+
 #include <stdarg.h>
 #include <stdlib.h>
 #include <setjmp.h>
diff --git a/common/canvas_base.h b/common/canvas_base.h
index ff0f972..7c5f275 100644
--- a/common/canvas_base.h
+++ b/common/canvas_base.h
@@ -19,6 +19,9 @@
 #ifndef _H_CANVAS_BASE
 #define _H_CANVAS_BASE
 
+#ifndef SPICE_CANVAS_INTERNAL
+#error "This header shouldn't be included directly"
+#endif
 
 #include "pixman_utils.h"
 #include "lz.h"
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index 360e6bf..27f644c 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -16,6 +16,11 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
+
+#ifndef SPICE_CANVAS_INTERNAL
+#error "This file shouldn't be compiled directly"
+#endif
+
 #include <windows.h>
 #include <wingdi.h>
 #include "gdi_canvas.h"
diff --git a/common/gdi_canvas.h b/common/gdi_canvas.h
index 86be9e1..af5b229 100644
--- a/common/gdi_canvas.h
+++ b/common/gdi_canvas.h
@@ -19,6 +19,10 @@
 #ifndef _H__GDI_CANVAS
 #define _H__GDI_CANVAS
 
+#ifndef SPICE_CANVAS_INTERNAL
+#error "This header shouldn't be included directly"
+#endif
+
 #include <stdint.h>
 
 #ifdef __cplusplus
diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index 9867c4f..844fc07 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -16,11 +16,14 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
+#ifndef SPICE_CANVAS_INTERNAL
+#error "This file shouldn't be compiled directly"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "gl_canvas.h"
 #include "quic.h"
 #include "rop3.h"
 #include "region.h"
diff --git a/common/gl_canvas.h b/common/gl_canvas.h
index 6776379..40b6713 100644
--- a/common/gl_canvas.h
+++ b/common/gl_canvas.h
@@ -20,6 +20,10 @@
 #include "canvas_base.h"
 #include "region.h"
 
+#ifndef SPICE_CANVAS_INTERNAL
+#error "This header shouldn't be included directly"
+#endif
+
 #ifndef _H__GL_CANVAS
 #define _H__GL_CANVAS
 
diff --git a/common/sw_canvas.c b/common/sw_canvas.c
index 95ec292..e1b13e0 100644
--- a/common/sw_canvas.c
+++ b/common/sw_canvas.c
@@ -16,6 +16,10 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
+#ifndef SPICE_CANVAS_INTERNAL
+#error "This file shouldn't be compiled directly"
+#endif
+
 #include <math.h>
 #include "sw_canvas.h"
 #define CANVAS_USE_PIXMAN
diff --git a/common/sw_canvas.h b/common/sw_canvas.h
index 5465526..d8d26a9 100644
--- a/common/sw_canvas.h
+++ b/common/sw_canvas.h
@@ -19,6 +19,10 @@
 #ifndef _H__CANVAS
 #define _H__CANVAS
 
+#ifndef SPICE_CANVAS_INTERNAL
+#error "This header shouldn't be included directly"
+#endif
+
 #include <stdint.h>
 
 #include "draw.h"
diff --git a/server/Makefile.am b/server/Makefile.am
index 73a886f..81649a4 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -6,7 +6,6 @@ INCLUDES = \
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/common			\
 	-DRED_STATISTICS			\
-	-DSW_CANVAS_IMAGE_CACHE			\
 	$(Z_LIBS)				\
 	$(CELT051_CFLAGS)			\
 	$(PIXMAN_CFLAGS)			\
@@ -89,6 +88,8 @@ libspice_server_la_SOURCES =			\
 	red_worker.h				\
 	reds.c					\
 	reds.h					\
+	reds_sw_canvas.c			\
+	reds_sw_canvas.h			\
 	snd_worker.c				\
 	snd_worker.h				\
 	spice-experimental.h			\
@@ -105,6 +106,13 @@ libspice_server_la_SOURCES +=	\
 	$(NULL)
 endif
 
+if SUPPORT_GL
+libspice_server_la_SOURCES +=	\
+	reds_gl_canvas.c	\
+	reds_gl_canvas.h	\
+	$(NULL)
+endif
+
 if SUPPORT_SMARTCARD
 libspice_server_la_SOURCES +=	\
 	smartcard.c		\
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 0692458..c5cac58 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -28,9 +28,9 @@
 #include "spice.h"
 #include "red_worker.h"
 #include "quic.h"
-#include "sw_canvas.h"
+#include "reds_sw_canvas.h"
 #ifdef USE_OGL
-#include "gl_canvas.h"
+#include "reds_gl_canvas.h"
 #endif // USE_OGL
 #include "reds.h"
 #include "red_dispatcher.h"
diff --git a/server/red_worker.c b/server/red_worker.c
index 49dffb4..8082139 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -36,9 +36,9 @@
 #include "region.h"
 #include <spice/protocol.h>
 #include "red_worker.h"
-#include "sw_canvas.h"
+#include "reds_sw_canvas.h"
 #ifdef USE_OGL
-#include "gl_canvas.h"
+#include "reds_gl_canvas.h"
 #include "ogl_ctx.h"
 #endif /* USE_OGL */
 #include "quic.h"
diff --git a/server/reds_gl_canvas.c b/server/reds_gl_canvas.c
new file mode 100644
index 0000000..4855a20
--- /dev/null
+++ b/server/reds_gl_canvas.c
@@ -0,0 +1,24 @@
+/*
+   Copyright (C) 2011 Red Hat, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#include "config.h"
+
+#include "reds_gl_canvas.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_IMAGE_CACHE
+#include "gl_canvas.c"
+#undef SW_CANVAS_IMAGE_CACHE
+#undef SPICE_CANVAS_INTERNAL
diff --git a/server/reds_gl_canvas.h b/server/reds_gl_canvas.h
new file mode 100644
index 0000000..c20cca5
--- /dev/null
+++ b/server/reds_gl_canvas.h
@@ -0,0 +1,27 @@
+/*
+   Copyright (C) 2011 Red Hat, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _H_REDS_GL_CANVAS
+#define _H_REDS_GL_CANVAS
+
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_IMAGE_CACHE
+#include "gl_canvas.h"
+#undef SW_CANVAS_IMAGE_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
+#endif
diff --git a/server/reds_sw_canvas.c b/server/reds_sw_canvas.c
new file mode 100644
index 0000000..428a9dc
--- /dev/null
+++ b/server/reds_sw_canvas.c
@@ -0,0 +1,24 @@
+/*
+   Copyright (C) 2011 Red Hat, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#include "config.h"
+
+#include "reds_sw_canvas.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_IMAGE_CACHE
+#include "sw_canvas.c"
+#undef SW_CANVAS_IMAGE_CACHE
+#undef SPICE_CANVAS_INTERNAL
diff --git a/server/reds_sw_canvas.h b/server/reds_sw_canvas.h
new file mode 100644
index 0000000..00e6156
--- /dev/null
+++ b/server/reds_sw_canvas.h
@@ -0,0 +1,26 @@
+/*
+   Copyright (C) 2011 Red Hat, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef _H_REDS_SW_CANVAS
+#define _H_REDS_SW_CANVAS
+
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_IMAGE_CACHE
+#include "sw_canvas.h"
+#undef SW_CANVAS_IMAGE_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
+#endif
commit 253aa0c960ccb3fd2cd6f6b2550ef09b9cbd5d1a
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Apr 20 15:13:39 2011 +0200

    configure.ac: remove unused AC_SUBST

diff --git a/configure.ac b/configure.ac
index 92957fa..7e77672 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,9 +13,6 @@ AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip subdir-objects])
 AM_MAINTAINER_MODE
 
-# Define default SPICE_COMMON_SRCDIR
-SPICE_COMMON_SRCDIR='$(top_srcdir)'/common
-
 AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes])
 AC_PROG_CC
 AS_IF([test "$CXXFLAGS" = ""], [], [_cxxflags_is_set=yes])
@@ -487,7 +484,6 @@ fi
 AC_MSG_RESULT($have_gcc4)
 AC_SUBST(VISIBILITY_HIDDEN_CFLAGS)
 
-AC_SUBST(SPICE_COMMON_SRCDIR)
 AC_SUBST(SPICE_REQUIRES)
 AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS)
 AC_SUBST(SPICE_NONPKGCONFIG_LIBS)
commit 2a4614ea94dc77638455358bdb90904352e8d246
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Apr 20 11:09:55 2011 +0200

    autotools: refactor the whole build machinery
    
    spice Makefile.am setup is a bit confusing, with source file
    names being listed several times in different Makefile.am
    (generally, once in EXTRA_DIST and another time in another
    Makefile.am in _SOURCES). The client binaries are built
    by client/x11/Makefile.am, which means recursing into client,
    then into x11 to finally build spicec. This Makefile.am is
    also referencing files from common/ and client/, which is
    a bit unusual with autotools.
    
    This patch attempts to simplify the build process to get
    something more usual from an autotools point of view.
    The source from common/ are compiled into a libtool convenience
    library, which the server and the client links against which avoids
    referencing source files from common/ when building the server and
    the client. The client is built in client/Makefile.am and directly
    builds files from x11/ windows/ and gui/ if needed (without
    recursing in these subdirectories).
    
    This makes the build simpler to understand, and also makes it
    possible to list source files once, which avoids potential
    make distcheck breakage when adding new files.
    
    There is a regression in this patch with respect to
    sw_canvas/gl_canvas/gdi_canvas. They should be built with
    different preprocessor #defines resulting in different behaviour
    of the canvas for the client and the server. However, this is not
    currently the case, both the client and the server will use the same
    code for now (which probably means one of them is broken). This will
    be fixed in a subsequent commit.
    
    make distcheck passes, but compilation on windows using the
    autotools build system hasn't been tested, which means it's likely
    to be broken. It shouldn't be too hard ot fix it though, just let
    me know of any issues with this.

diff --git a/client/Makefile.am b/client/Makefile.am
index bbea61f..627bd8a 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -1,9 +1,13 @@
 NULL =
 
-SUBDIRS = . $(red_target) gui
-DIST_SUBDIRS = x11 windows gui
+bin_PROGRAMS = spicec
 
-spice_built_sources = generated_demarshallers.cpp generated_marshallers.cpp generated_demarshallers1.cpp generated_marshallers1.cpp
+BUILT_SOURCES = 			\
+	generated_demarshallers.cpp	\
+	generated_marshallers.cpp	\
+	generated_demarshallers1.cpp	\
+	generated_marshallers1.cpp	\
+	$(NULL)
 
 generated_demarshallers.cpp: $(top_srcdir)/spice.proto
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include common.h --include messages.h $(top_srcdir)/spice.proto generated_demarshallers.cpp
@@ -17,119 +21,243 @@ generated_marshallers.cpp: $(top_srcdir)/spice.proto
 generated_marshallers1.cpp: $(top_srcdir)/spice1.proto
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P  --include "common.h" --include messages.h --include marshallers.h --client --prefix 1 --ptrsize 8 $(top_srcdir)/spice1.proto generated_marshallers1.cpp
 
-if SUPPORT_GL
-GL_SRCS =				\
-	red_gl_canvas.cpp		\
-	red_gl_canvas.h			\
-	red_pixmap_gl.h
+MAINTAINERCLEANFILES = $(BUILT_SOURCES)
+
+spicec_SOURCES =		\
+	application.cpp		\
+	application.h		\
+	audio_channels.h	\
+	audio_devices.h		\
+	cache.hpp		\
+	canvas.cpp		\
+	canvas.h		\
+	client_net_socket.cpp	\
+	client_net_socket.h	\
+	cmd_line_parser.cpp	\
+	cmd_line_parser.h	\
+	common.h		\
+	controller.cpp		\
+	controller.h		\
+	cursor.cpp		\
+	cursor.h		\
+	cursor_channel.cpp	\
+	cursor_channel.h	\
+	debug.h			\
+	demarshallers.h		\
+	display_channel.cpp	\
+	display_channel.h	\
+	event_sources.h		\
+	foreign_menu.cpp	\
+	foreign_menu.h		\
+	glz_decoded_image.h	\
+	glz_decoder.cpp		\
+	glz_decoder.h		\
+	glz_decoder_config.h	\
+	glz_decoder_window.cpp	\
+	glz_decoder_window.h	\
+	hot_keys.cpp		\
+	hot_keys.h		\
+	icon.h			\
+	inputs_channel.cpp	\
+	inputs_channel.h	\
+	inputs_handler.h	\
+	jpeg_decoder.cpp	\
+	jpeg_decoder.h		\
+	marshallers.h		\
+	menu.cpp		\
+	menu.h			\
+	mjpeg_decoder.cpp	\
+	mjpeg_decoder.h		\
+	monitor.cpp		\
+	monitor.h		\
+	pixels_source.h		\
+	platform.h		\
+	playback_channel.cpp	\
+	process_loop.cpp	\
+	process_loop.h		\
+	read_write_mutex.h	\
+	record_channel.cpp	\
+	red_channel.cpp		\
+	red_channel.h		\
+	red_client.cpp		\
+	red_client.h		\
+	red_drawable.h		\
+	red_key.h		\
+	red_peer.cpp		\
+	red_peer.h		\
+	red_pixmap.h		\
+	red_pixmap_sw.h		\
+	red_sw_canvas.cpp	\
+	red_sw_canvas.h		\
+	red_types.h		\
+	red_window.h		\
+	screen.cpp		\
+	screen.h		\
+	screen_layer.cpp	\
+	screen_layer.h		\
+	shared_cache.hpp	\
+	threads.cpp		\
+	threads.h		\
+	utils.cpp		\
+	utils.h			\
+	zlib_decoder.cpp	\
+	zlib_decoder.h		\
+	$(BUILT_SOURCES)	\
+	$(NULL)
+
+if OS_WIN32
+spicec_SOURCES +=			\
+	red_gdi_canvas.cpp		\
+	red_gdi_canvas.h		\
+	red_pixmap_gdi.h		\
+	windows/atomic_count.h		\
+	windows/event_sources_p.cpp	\
+	windows/main.cpp		\
+	windows/my_getopt.cpp		\
+	windows/named_pipe.cpp		\
+	windows/named_pipe.h		\
+	windows/pixels_source.cpp	\
+	windows/pixels_source_p.h	\
+	windows/platform.cpp		\
+	windows/platform_utils.cpp	\
+	windows/platform_utils.h	\
+	windows/playback.cpp		\
+	windows/playback.h		\
+	windows/record.cpp		\
+	windows/record.h		\
+	windows/red_drawable.cpp	\
+	windows/red_pixmap.cpp		\
+	windows/red_pixmap_gdi.cpp	\
+	windows/red_pixmap_sw.cpp	\
+	windows/red_window.cpp		\
+	windows/red_window_p.h		\
+	windows/resource.h		\
+	windows/stdint.h		\
+	windows/win_platform.h		\
+	$(NULL)
 else
-GL_SRCS =
+spicec_SOURCES +=			\
+	x11/atomic_count.h		\
+	x11/event_sources_p.cpp		\
+	x11/event_sources_p.h		\
+	x11/main.cpp			\
+	x11/named_pipe.cpp		\
+	x11/named_pipe.h		\
+	x11/pixels_source.cpp		\
+	x11/pixels_source_p.h		\
+	x11/platform.cpp		\
+	x11/platform_utils.cpp		\
+	x11/platform_utils.h		\
+	x11/playback.cpp		\
+	x11/playback.h			\
+	x11/record.cpp			\
+	x11/record.h			\
+	x11/red_drawable.cpp		\
+	x11/red_pixmap.cpp		\
+	x11/red_pixmap_sw.cpp		\
+	x11/red_window.cpp		\
+	x11/red_window_p.h		\
+	x11/res.cpp			\
+	x11/res.h			\
+	x11/resource.h			\
+	x11/x_icon.cpp			\
+	x11/x_icon.h			\
+	x11/x_platform.h		\
+	$(NULL)
 endif
 
-SMARTCARD_SRC_ENABLED = smartcard_channel.cpp smartcard_channel.h
+if SUPPORT_TUNNEL
+spicec_SOURCES +=		\
+	tunnel_channel.cpp	\
+	tunnel_channel.h	\
+	$(NULL)
+endif
 
-if SUPPORT_SMARTCARD
-SMARTCARD_SRCS = $(SMARTCARD_SRC_ENABLED)
-else
-SMARTCARD_SRCS =
+if SUPPORT_GUI
+spicec_SOURCES +=			\
+	gui/gui.cpp			\
+	gui/gui.h			\
+	gui/resource_provider.cpp	\
+	gui/resource_provider.h		\
+	gui/softrenderer.cpp		\
+	gui/softrenderer.h		\
+	gui/softtexture.cpp		\
+	gui/softtexture.h		\
+	$(NULL)
 endif
 
-RED_COMMON_SRCS =			\
-	application.cpp			\
-	application.h			\
-	audio_channels.h		\
-	audio_devices.h			\
-	cache.hpp			\
-	canvas.cpp			\
-	canvas.h			\
-	red_sw_canvas.cpp		\
-	red_sw_canvas.h			\
-	client_net_socket.cpp		\
-	client_net_socket.h		\
-	cmd_line_parser.cpp		\
-	cmd_line_parser.h		\
-	common.h			\
-	demarshallers.h			\
-	marshallers.h			\
-	generated_demarshallers.cpp	\
-	generated_demarshallers1.cpp	\
-	generated_marshallers.cpp	\
-	generated_marshallers1.cpp	\
-	controller.cpp			\
-	controller.h			\
-	cursor_channel.cpp		\
-	cursor_channel.h		\
-	cursor.cpp			\
-	cursor.h			\
-	debug.h				\
-	display_channel.cpp		\
-	display_channel.h		\
-	foreign_menu.cpp		\
-	foreign_menu.h			\
-	glz_decoded_image.h		\
-	glz_decoder_config.h		\
-	glz_decoder.cpp			\
-	glz_decoder.h			\
-	glz_decoder_window.cpp		\
-	glz_decoder_window.h		\
-	glz_decode_tmpl.c		\
-	inputs_channel.cpp		\
-	inputs_channel.h		\
-	inputs_handler.h		\
-	jpeg_decoder.cpp		\
-	jpeg_decoder.h			\
-	monitor.cpp			\
-	monitor.h			\
-	mem.cpp				\
-	menu.cpp			\
-	menu.h				\
-	mjpeg_decoder.h			\
-	mjpeg_decoder.cpp		\
-	event_sources.h			\
-	pixels_source.h			\
-	platform.h			\
-	playback_channel.cpp		\
-	process_loop.cpp		\
-	process_loop.h			\
-	read_write_mutex.h		\
-	record_channel.cpp		\
-	red_channel.cpp			\
-	red_channel.h			\
-	red_client.cpp			\
-	red_client.h			\
-	red_drawable.h			\
-	red_key.h			\
-	red_peer.cpp			\
-	red_peer.h			\
-	red_pixmap_sw.h			\
-	red_pixmap.h			\
-	red_types.h			\
-	red_window.h			\
-	screen.cpp			\
-	screen.h			\
-	screen_layer.cpp		\
-	screen_layer.h			\
-	shared_cache.hpp		\
-	tunnel_channel.cpp		\
-	tunnel_channel.h		\
-	hot_keys.cpp			\
-	hot_keys.h			\
-	threads.cpp			\
-	threads.h			\
-	utils.cpp			\
-	utils.h				\
-	zlib_decoder.cpp		\
-	zlib_decoder.h			\
+if SUPPORT_GL
+spicec_SOURCES +=		\
+	red_gl_canvas.cpp	\
+	red_gl_canvas.h		\
+	red_pixmap_gl.h		\
 	$(NULL)
 
-GDI_FILES =				\
-	red_gdi_canvas.cpp		\
-	red_gdi_canvas.h		\
-	red_pixmap_gdi.h		\
+if !OS_WIN32
+spicec_SOURCES += x11/red_pixmap_gl.cpp
+endif
+
+endif
+
+if SUPPORT_SMARTCARD
+spicec_SOURCES +=		\
+	smartcard_channel.cpp	\
+	smartcard_channel.h	\
+	$(NULL)
+endif
+
+
+INCLUDES = \
+	-DSW_CANVAS_CACHE				\
+	-D__STDC_LIMIT_MACROS				\
+	-I$(top_srcdir)/client/x11			\
+	-I$(top_srcdir)/common				\
+	$(ALSA_CFLAGS)					\
+	$(CEGUI_CFLAGS)					\
+	$(CEGUI06_CFLAGS)				\
+	$(CELT051_CFLAGS)				\
+	$(GL_CFLAGS)					\
+	$(MISC_X_CFLAGS)				\
+	$(PIXMAN_CFLAGS)				\
+	$(PROTOCOL_CFLAGS)				\
+	$(SPICE_NONPKGCONFIG_CFLAGS)			\
+	$(SMARTCARD_CFLAGS)				\
+	$(SSL_CFLAGS)					\
+	$(XRANDR_CFLAGS)				\
+	$(XFIXES_CFLAGS)				\
+	$(WARN_CFLAGS)					\
 	$(NULL)
 
-MAINTAINERCLEANFILES = $(spice_built_sources)
+spicec_LDFLAGS = $(SPICEC_STATIC_LINKAGE_BSTATIC)
 
-EXTRA_DIST = $(RED_COMMON_SRCS) $(spice_built_sources) $(GL_SRCS) $(GDI_FILES) $(SMARTCARD_SRC_ENABLED)
+spicec_LDADD =						\
+	$(top_builddir)/common/libspice-common.la	\
+	$(ALSA_LIBS)					\
+	$(CEGUI_LIBS)					\
+	$(CEGUI06_LIBS)					\
+	$(CELT051_LIBS)					\
+	$(GL_LIBS)					\
+	$(JPEG_LIBS)					\
+	$(MISC_X_LIBS)					\
+	$(PIXMAN_LIBS)					\
+	$(SMARTCARD_LIBS)				\
+	$(SPICE_NONPKGCONFIG_LIBS)			\
+	$(SSL_LIBS)					\
+	$(XFIXES_LIBS)					\
+	$(XRANDR_LIBS)					\
+	$(Z_LIBS)					\
+	$(NULL)
 
-BUILT_SOURCES = $(spice_built_sources)
+EXTRA_DIST =				\
+	glz_decode_tmpl.c		\
+	x11/images/red_icon.c		\
+	x11/images/alt_image.c		\
+	gui/commonv2c.ttf.c		\
+	gui/commonwealth-10.font.c	\
+	gui/dejavu_sans-10.font.c	\
+	gui/dejavu_sans.ttf.c		\
+	gui/taharez_look.imageset.c	\
+	gui/taharez_look.looknfeel.c	\
+	gui/taharez_look.scheme.c	\
+	gui/taharez_look.tga.c		\
+	$(NULL)
diff --git a/client/windows/Makefile.am b/client/windows/Makefile.am
deleted file mode 100644
index eae0bbe..0000000
--- a/client/windows/Makefile.am
+++ /dev/null
@@ -1,236 +0,0 @@
-NULL =
-
-COMMON_DIR=$(SPICE_COMMON_SRCDIR)
-CLIENT_DIR=$(top_srcdir)/client
-
-INCLUDES = \
-	-DSW_CANVAS_CACHE				\
-	-DSW_CANVAS_NO_CHUNKS				\
-	-DUSE_GLZ					\
-	-D__STDC_LIMIT_MACROS				\
-	-I.						\
-	-I..						\
-	-I$(COMMON_DIR)					\
-	-I$(COMMON_DIR)/win				\
-	-I$(CLIENT_DIR)					\
-	$(PROTOCOL_CFLAGS)				\
-	$(GL_CFLAGS)					\
-	$(PIXMAN_CFLAGS)				\
-	$(CELT051_CFLAGS)				\
-	$(SSL_CFLAGS)					\
-	$(CEGUI_CFLAGS)					\
-	$(WARN_CFLAGS)                                  \
-	$(SPICE_NONPKGCONFIG_CFLAGS)			\
-	$(CXIMAGE_CFLAGS)               \
-	$(NULL)
-
-
-RED_COMMON_SRCS =					\
-	$(CLIENT_DIR)/application.cpp			\
-	$(CLIENT_DIR)/application.h			\
-	$(CLIENT_DIR)/audio_channels.h			\
-	$(CLIENT_DIR)/audio_devices.h			\
-	$(CLIENT_DIR)/cache.hpp				\
-	$(CLIENT_DIR)/demarshallers.h			\
-	$(CLIENT_DIR)/generated_demarshallers.cpp	\
-	$(CLIENT_DIR)/generated_demarshallers1.cpp	\
-	$(COMMON_DIR)/marshaller.c			\
-	$(CLIENT_DIR)/marshallers.h			\
-	$(CLIENT_DIR)/generated_marshallers.cpp		\
-	$(CLIENT_DIR)/generated_marshallers1.cpp	\
-	$(COMMON_DIR)/sw_canvas.c			\
-	$(CLIENT_DIR)/canvas.cpp			\
-	$(COMMON_DIR)/gdi_canvas.c			\
-	$(CLIENT_DIR)/canvas.h				\
-	$(COMMON_DIR)/canvas_utils.c			\
-	$(CLIENT_DIR)/red_sw_canvas.cpp			\
-	$(CLIENT_DIR)/red_sw_canvas.h			\
-	$(CLIENT_DIR)/cmd_line_parser.cpp		\
-	$(CLIENT_DIR)/cmd_line_parser.h			\
-	$(CLIENT_DIR)/client_net_socket.cpp		\
-	$(CLIENT_DIR)/client_net_socket.h		\
-	$(CLIENT_DIR)/common.h				\
-	$(CLIENT_DIR)/controller.cpp			\
-	$(CLIENT_DIR)/controller.h			\
-	$(CLIENT_DIR)/cursor_channel.cpp		\
-	$(CLIENT_DIR)/cursor_channel.h			\
-	$(CLIENT_DIR)/cursor.cpp			\
-	$(CLIENT_DIR)/cursor.h				\
-	$(CLIENT_DIR)/debug.h				\
-	$(CLIENT_DIR)/display_channel.cpp		\
-	$(CLIENT_DIR)/display_channel.h			\
-	$(CLIENT_DIR)/foreign_menu.cpp			\
-	$(CLIENT_DIR)/foreign_menu.h			\
-	$(CLIENT_DIR)/glz_decoded_image.h		\
-	$(CLIENT_DIR)/glz_decoder_config.h		\
-	$(CLIENT_DIR)/glz_decoder.cpp			\
-	$(CLIENT_DIR)/glz_decoder.h			\
-	$(CLIENT_DIR)/glz_decoder_window.cpp		\
-	$(CLIENT_DIR)/glz_decoder_window.h		\
-	$(CLIENT_DIR)/inputs_channel.cpp		\
-	$(CLIENT_DIR)/inputs_channel.h			\
-	$(CLIENT_DIR)/inputs_handler.h			\
-	$(CLIENT_DIR)/jpeg_decoder.cpp			\
-	$(CLIENT_DIR)/jpeg_decoder.h			\
-	$(COMMON_DIR)/lz.c				\
-	$(COMMON_DIR)/lines.c				\
-	$(CLIENT_DIR)/monitor.cpp			\
-	$(CLIENT_DIR)/monitor.h				\
-	$(COMMON_DIR)/mem.c				\
-	$(CLIENT_DIR)/menu.cpp				\
-	$(CLIENT_DIR)/menu.h				\
-	$(CLIENT_DIR)/mjpeg_decoder.h			\
-	$(CLIENT_DIR)/mjpeg_decoder.cpp			\
-	$(CLIENT_DIR)/pixels_source.h			\
-	$(COMMON_DIR)/pixman_utils.c			\
-	$(CLIENT_DIR)/platform.h			\
-	$(CLIENT_DIR)/playback_channel.cpp		\
-	$(CLIENT_DIR)/process_loop.cpp			\
-	$(COMMON_DIR)/quic.c				\
-	$(CLIENT_DIR)/record_channel.cpp		\
-	$(CLIENT_DIR)/red_channel.cpp			\
-	$(CLIENT_DIR)/red_channel.h			\
-	$(CLIENT_DIR)/red_client.cpp			\
-	$(CLIENT_DIR)/red_client.h			\
-	$(CLIENT_DIR)/red_drawable.h			\
-	$(CLIENT_DIR)/red_key.h				\
-	$(CLIENT_DIR)/red_peer.cpp			\
-	$(CLIENT_DIR)/red_gdi_canvas.cpp		\
-	$(CLIENT_DIR)/red_peer.h			\
-	$(CLIENT_DIR)/red_pixmap_sw.h			\
-	$(CLIENT_DIR)/red_pixmap.h			\
-	$(CLIENT_DIR)/red_types.h			\
-	$(CLIENT_DIR)/red_window.h			\
-	$(COMMON_DIR)/region.c				\
-	$(COMMON_DIR)/rop3.c				\
-	$(CLIENT_DIR)/screen.cpp			\
-	$(CLIENT_DIR)/screen.h				\
-	$(CLIENT_DIR)/screen_layer.cpp			\
-	$(CLIENT_DIR)/screen_layer.h			\
-	$(CLIENT_DIR)/shared_cache.hpp			\
-	$(CLIENT_DIR)/hot_keys.cpp			\
-	$(CLIENT_DIR)/hot_keys.h			\
-	$(CLIENT_DIR)/threads.cpp			\
-	$(CLIENT_DIR)/tunnel_channel.cpp		\
-	$(CLIENT_DIR)/tunnel_channel.h			\
-	$(CLIENT_DIR)/utils.cpp				\
-	$(CLIENT_DIR)/utils.h				\
-	$(CLIENT_DIR)/zlib_decoder.cpp			\
-	$(CLIENT_DIR)/zlib_decoder.h			\
-	$(CLIENT_DIR)/icon.h				\
-	$(NULL)
-
-if SUPPORT_GUI
-RED_GUI_SRCS =						\
-	$(CLIENT_DIR)/gui/softrenderer.h		\
-	$(CLIENT_DIR)/gui/softrenderer.cpp		\
-	$(CLIENT_DIR)/gui/softtexture.h			\
-	$(CLIENT_DIR)/gui/softtexture.cpp		\
-	$(CLIENT_DIR)/gui/resource_provider.h		\
-	$(CLIENT_DIR)/gui/resource_provider.cpp		\
-	$(CLIENT_DIR)/gui/gui.h				\
-	$(CLIENT_DIR)/gui/gui.cpp
-else
-RED_GUI_SRCS =
-endif
-
-
-if SUPPORT_GL
-RED_OGL_SRCS =						\
-	$(COMMON_DIR)/gl_canvas.c			\
-	$(COMMON_DIR)/glc.c				\
-	$(CLIENT_DIR)/red_gl_canvas.cpp			\
-	$(CLIENT_DIR)/red_gl_canvas.h			\
-	$(CLIENT_DIR)/red_pixmap_gl.h
-else
-RED_OGL_SRCS =
-endif
-
-bin_PROGRAMS = spicec
-
-spicec_SOURCES =			\
-	atomic_count.h			\
-	event_sources_p.cpp		\
-	main.cpp			\
-	my_getopt.cpp			\
-	named_pipe.h                    \
-	named_pipe.cpp                  \
-	pixels_source.cpp		\
-	pixels_source_p.h		\
-	platform.cpp			\
-	platform_utils.h                \
-	platform_utils.cpp              \
-	playback.cpp			\
-	playback.h			\
-	record.cpp			\
-	record.h			\
-	red_drawable.cpp		\
-	red_pixmap.cpp			\
-	red_pixmap_gdi.cpp		\
-	red_pixmap_sw.cpp		\
-	red_window.cpp			\
-	red_window_p.h			\
-	resource.h			\
-	stdint.h			\
-	win_platform.h			\
-	$(RED_COMMON_SRCS)		\
-	$(RED_GUI_SRCS)			\
-	$(RED_OGL_SRCS)			\
-	$(NULL)
-
-spicec_LDFLAGS = \
-	$(SPICEC_STATIC_LINKAGE_BSTATIC)		\
-	$(CELT051_LIBS)					\
-	$(SSL_LIBS)					\
-	$(CEGUI_LIBS)					\
-	$(JPEG_LIBS)					\
-	$(Z_LIBS)					\
-	$(SPICE_NONPKGCONFIG_LIBS)
-
-spicec_LDADD =						\
-	redc.res					\
-	$(PIXMAN_LIBS)					\
-	$(GL_LIBS)					\
-	$(CEGUI_LIBS)
-
-spicec_DEPENDENCIES = redc.res
-
-redc.res: redc.rc
-	$(WINDRES) -J rc -i $< -O coff -o $@
-
-EXTRA_DIST = \
-	atomic_count.h		\
-	event_sources_p.cpp	\
-	event_sources_p.h	\
-	generate1.bat		\
-	generate.bat		\
-	main.cpp		\
-	my_getopt.cpp		\
-	named_pipe.cpp		\
-	named_pipe.h		\
-	pixels_source.cpp	\
-	pixels_source_p.h	\
-	platform.cpp		\
-	platform_utils.cpp	\
-	platform_utils.h	\
-	playback.cpp		\
-	playback.h		\
-	record.cpp		\
-	record.h		\
-	redc.rc			\
-	redc.sln		\
-	redc.vcproj		\
-	red_drawable.cpp	\
-	red_pixmap.cpp		\
-	red_pixmap_gdi.cpp	\
-	red_pixmap_sw.cpp	\
-	red_window.cpp		\
-	red_window_p.h		\
-	resource.h		\
-	spicec.exe.manifest	\
-	spice.ico		\
-	stdint.h		\
-	sticky_alt.bmp		\
-	win_platform.h		\
-        $(NULL)
-
diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am
deleted file mode 100644
index 54d05ce..0000000
--- a/client/x11/Makefile.am
+++ /dev/null
@@ -1,223 +0,0 @@
-NULL =
-
-COMMON_DIR=$(SPICE_COMMON_SRCDIR)
-CLIENT_DIR=$(top_srcdir)/client
-
-SUBDIRS = images
-
-INCLUDES = \
-	-DSW_CANVAS_CACHE				\
-	-DSW_CANVAS_NO_CHUNKS				\
-	-DUSE_GLZ					\
-	-D__STDC_LIMIT_MACROS				\
-	-I.						\
-	-I..						\
-	-I$(COMMON_DIR)					\
-	-I$(COMMON_DIR)/linux				\
-	-I$(CLIENT_DIR)					\
-	$(PROTOCOL_CFLAGS)				\
-	$(GL_CFLAGS)					\
-	$(ALSA_CFLAGS)					\
-	$(PIXMAN_CFLAGS)				\
-	$(CELT051_CFLAGS)				\
-	$(SSL_CFLAGS)					\
-	$(XRANDR_CFLAGS)				\
-	$(XFIXES_CFLAGS)				\
-	$(MISC_X_CFLAGS)				\
-	$(CEGUI_CFLAGS)					\
-	$(CEGUI06_CFLAGS)					\
-	$(WARN_CFLAGS)                                  \
-	$(SPICE_NONPKGCONFIG_CFLAGS)			\
-	$(SMARTCARD_CFLAGS)				\
-	$(NULL)
-
-
-RED_COMMON_SRCS =					\
-	$(CLIENT_DIR)/application.cpp			\
-	$(CLIENT_DIR)/application.h			\
-	$(CLIENT_DIR)/audio_channels.h			\
-	$(CLIENT_DIR)/audio_devices.h			\
-	$(CLIENT_DIR)/cache.hpp				\
-	$(CLIENT_DIR)/demarshallers.h			\
-	$(CLIENT_DIR)/generated_demarshallers.cpp	\
-	$(CLIENT_DIR)/generated_demarshallers1.cpp	\
-	$(COMMON_DIR)/marshaller.c			\
-	$(CLIENT_DIR)/marshallers.h			\
-	$(CLIENT_DIR)/generated_marshallers.cpp		\
-	$(CLIENT_DIR)/generated_marshallers1.cpp	\
-	$(COMMON_DIR)/sw_canvas.c			\
-	$(CLIENT_DIR)/canvas.cpp			\
-	$(CLIENT_DIR)/canvas.h				\
-	$(COMMON_DIR)/canvas_utils.c			\
-	$(CLIENT_DIR)/red_sw_canvas.cpp			\
-	$(CLIENT_DIR)/red_sw_canvas.h			\
-	$(CLIENT_DIR)/cmd_line_parser.cpp		\
-	$(CLIENT_DIR)/cmd_line_parser.h			\
-	$(CLIENT_DIR)/client_net_socket.cpp		\
-	$(CLIENT_DIR)/client_net_socket.h		\
-	$(CLIENT_DIR)/common.h				\
-	$(CLIENT_DIR)/controller.cpp			\
-	$(CLIENT_DIR)/controller.h			\
-	$(CLIENT_DIR)/cursor_channel.cpp		\
-	$(CLIENT_DIR)/cursor_channel.h			\
-	$(CLIENT_DIR)/cursor.cpp			\
-	$(CLIENT_DIR)/cursor.h				\
-	$(CLIENT_DIR)/debug.h				\
-	$(CLIENT_DIR)/display_channel.cpp		\
-	$(CLIENT_DIR)/display_channel.h			\
- 	$(CLIENT_DIR)/foreign_menu.cpp			\
- 	$(CLIENT_DIR)/foreign_menu.h			\
-	$(CLIENT_DIR)/glz_decoded_image.h		\
-	$(CLIENT_DIR)/glz_decoder_config.h		\
-	$(CLIENT_DIR)/glz_decoder.cpp			\
-	$(CLIENT_DIR)/glz_decoder.h			\
-	$(CLIENT_DIR)/glz_decoder_window.cpp		\
-	$(CLIENT_DIR)/glz_decoder_window.h		\
-	$(CLIENT_DIR)/inputs_channel.cpp		\
-	$(CLIENT_DIR)/inputs_channel.h			\
-	$(CLIENT_DIR)/inputs_handler.h			\
-	$(CLIENT_DIR)/jpeg_decoder.cpp			\
-	$(CLIENT_DIR)/jpeg_decoder.h			\
-	$(COMMON_DIR)/lz.c				\
-	$(COMMON_DIR)/lines.c				\
-	$(CLIENT_DIR)/monitor.cpp			\
-	$(CLIENT_DIR)/monitor.h				\
-	$(COMMON_DIR)/mem.c				\
-	$(CLIENT_DIR)/menu.cpp				\
-	$(CLIENT_DIR)/menu.h				\
-	$(CLIENT_DIR)/mjpeg_decoder.h			\
-	$(CLIENT_DIR)/mjpeg_decoder.cpp			\
-	$(CLIENT_DIR)/pixels_source.h			\
-	$(COMMON_DIR)/pixman_utils.c			\
-	$(CLIENT_DIR)/platform.h			\
-	$(CLIENT_DIR)/playback_channel.cpp		\
-	$(CLIENT_DIR)/process_loop.cpp			\
-	$(COMMON_DIR)/quic.c				\
-	$(CLIENT_DIR)/record_channel.cpp		\
-	$(CLIENT_DIR)/red_channel.cpp			\
-	$(CLIENT_DIR)/red_channel.h			\
-	$(CLIENT_DIR)/red_client.cpp			\
-	$(CLIENT_DIR)/red_client.h			\
-	$(CLIENT_DIR)/red_drawable.h			\
-	$(CLIENT_DIR)/red_key.h				\
-	$(CLIENT_DIR)/red_peer.cpp			\
-	$(CLIENT_DIR)/red_peer.h			\
-	$(CLIENT_DIR)/red_pixmap_sw.h			\
-	$(CLIENT_DIR)/red_pixmap.h			\
-	$(CLIENT_DIR)/red_types.h			\
-	$(CLIENT_DIR)/red_window.h			\
-	$(COMMON_DIR)/region.c				\
-	$(COMMON_DIR)/rop3.c				\
-	$(CLIENT_DIR)/screen.cpp			\
-	$(CLIENT_DIR)/screen.h				\
-	$(CLIENT_DIR)/screen_layer.cpp			\
-	$(CLIENT_DIR)/screen_layer.h			\
-	$(CLIENT_DIR)/shared_cache.hpp			\
-	$(CLIENT_DIR)/hot_keys.cpp			\
-	$(CLIENT_DIR)/hot_keys.h			\
-	$(CLIENT_DIR)/threads.cpp			\
-	$(CLIENT_DIR)/utils.cpp				\
-	$(CLIENT_DIR)/utils.h				\
-	$(CLIENT_DIR)/zlib_decoder.cpp			\
-	$(CLIENT_DIR)/zlib_decoder.h			\
-	$(CLIENT_DIR)/icon.h				\
-	$(NULL)
-
-if SUPPORT_TUNNEL
-RED_TUNNEL_SRCS =					\
-	$(CLIENT_DIR)/tunnel_channel.cpp		\
-	$(CLIENT_DIR)/tunnel_channel.h			\
-	$(NULL)
-else
-RED_TUNNEL_SRCS =
-endif
-
-if SUPPORT_GUI
-RED_GUI_SRCS =						\
-	$(CLIENT_DIR)/gui/softrenderer.h		\
-	$(CLIENT_DIR)/gui/softrenderer.cpp		\
-	$(CLIENT_DIR)/gui/softtexture.h			\
-	$(CLIENT_DIR)/gui/softtexture.cpp		\
-	$(CLIENT_DIR)/gui/resource_provider.h		\
-	$(CLIENT_DIR)/gui/resource_provider.cpp		\
-	$(CLIENT_DIR)/gui/gui.h				\
-	$(CLIENT_DIR)/gui/gui.cpp			\
-	$(NULL)
-else
-RED_GUI_SRCS =
-endif
-
-
-if SUPPORT_GL
-RED_OGL_SRCS =						\
-	$(COMMON_DIR)/gl_canvas.c			\
-	$(COMMON_DIR)/glc.c				\
-	$(CLIENT_DIR)/red_gl_canvas.cpp			\
-	$(CLIENT_DIR)/red_gl_canvas.h			\
-	$(CLIENT_DIR)/red_pixmap_gl.h			\
-	red_pixmap_gl.cpp
-else
-RED_OGL_SRCS =
-endif
-
-if SUPPORT_SMARTCARD
-RED_SCARD_SRCS = $(CLIENT_DIR)/smartcard_channel.cpp
-else
-RED_SCARD_SRCS =
-endif
-
-bin_PROGRAMS = spicec
-
-spicec_SOURCES =			\
-	atomic_count.h			\
-	event_sources_p.cpp		\
-	event_sources_p.h		\
-	main.cpp			\
-	named_pipe.h                    \
-	named_pipe.cpp                  \
-	pixels_source.cpp		\
-	pixels_source_p.h		\
-	platform.cpp			\
-	platform_utils.h                \
-	platform_utils.cpp              \
-	playback.cpp			\
-	playback.h			\
-	record.cpp			\
-	record.h			\
-	red_drawable.cpp		\
-	red_pixmap.cpp			\
-	red_pixmap_sw.cpp		\
-	red_window.cpp			\
-	red_window_p.h			\
-	res.cpp				\
-	res.h				\
-	resource.h			\
-	x_icon.cpp			\
-	x_icon.h			\
-	x_platform.h			\
-	$(RED_COMMON_SRCS)		\
-	$(RED_GUI_SRCS)			\
-	$(RED_TUNNEL_SRCS)		\
-	$(RED_OGL_SRCS)			\
-	$(RED_SCARD_SRCS)		\
-	$(NULL)
-
-spicec_LDFLAGS = \
-	$(SPICEC_STATIC_LINKAGE_BSTATIC)		\
-	$(CELT051_LIBS)					\
-	$(SSL_LIBS)					\
-	$(CEGUI_LIBS)					\
-	$(CEGUI06_LIBS)					\
-	$(JPEG_LIBS)					\
-	$(Z_LIBS)					\
-	$(SMARTCARD_LIBS)				\
-	$(SPICE_NONPKGCONFIG_LIBS)
-
-spicec_LDADD =						\
-	$(PIXMAN_LIBS)					\
-	$(ALSA_LIBS)					\
-	$(GL_LIBS)					\
-	$(XRANDR_LIBS)					\
-	$(XFIXES_LIBS)					\
-	$(MISC_X_LIBS)					\
-	$(CEGUI_LIBS)
diff --git a/client/x11/images/Makefile.am b/client/x11/images/Makefile.am
deleted file mode 100644
index 9012158..0000000
--- a/client/x11/images/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-EXTRA_DIST = \
-        red_icon.c                                      \
-        alt_image.c                                     \
-        $(NULL)
-
diff --git a/common/Makefile.am b/common/Makefile.am
index 407de1d..0a2f9c1 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,53 +1,78 @@
+if OS_WIN32
 SUBDIRS = win
+endif
 
 NULL =
 
-COMMON_SRCS =				\
-	sw_canvas.h			\
-	sw_canvas.c			\
-	pixman_utils.h			\
-	pixman_utils.c			\
+noinst_LTLIBRARIES = libspice-common.la
+libspice_common_la_SOURCES =		\
 	canvas_base.h			\
-	canvas_base.c			\
-	canvas_utils.h			\
 	canvas_utils.c			\
+	canvas_utils.h			\
 	draw.h				\
-	gdi_canvas.h			\
-	gdi_canvas.c			\
-	gl_canvas.h			\
-	gl_canvas.c			\
-	glc.h				\
-	glc.c				\
-	gl_utils.h			\
+	lines.c				\
+	lines.h				\
+	lz.c				\
+	lz.h				\
 	lz_common.h			\
+	lz_config.h			\
+	marshaller.c			\
+	marshaller.h			\
+	mem.c				\
+	mem.h				\
+	messages.h			\
 	mutex.h				\
-	ogl_ctx.h			\
-	ogl_ctx.c			\
-	quic.h				\
+	pixman_utils.c			\
+	pixman_utils.h			\
 	quic.c				\
+	quic.h				\
 	quic_config.h			\
 	rect.h				\
-	region.h			\
 	region.c			\
+	region.h			\
 	ring.h				\
-	rop3.h				\
 	rop3.c				\
-	lines.h				\
-	lines.c				\
-	lz.c				\
+	rop3.h				\
+	spice_common.h			\
+	sw_canvas.c			\
+	sw_canvas.h			\
+	$(NULL)
+
+if OS_WIN32
+libspice_common_la_SOURCES +=		\
+	gdi_canvas.h			\
+	gdi_canvas.c			\
+	$(NULL)
+endif
+
+if SUPPORT_GL
+libspice_common_la_SOURCES +=		\
+	gl_canvas.h			\
+	gl_canvas.c			\
+	gl_utils.h			\
+	glc.h				\
+	glc.c				\
+	ogl_ctx.h			\
+	ogl_ctx.c			\
+	$(NULL)
+endif
+
+INCLUDES = \
+	-DSW_CANVAS_IMAGE_CACHE		\
+	$(GL_CFLAGS)			\
+	$(PIXMAN_CFLAGS)		\
+	$(PROTOCOL_CFLAGS)		\
+	$(VISIBILITY_HIDDEN_CFLAGS)	\
+	$(WARN_CFLAGS)			\
+	-std=gnu99			\
+	$(NULL)
+
+EXTRA_DIST =				\
+	canvas_base.c			\
 	lz_compress_tmpl.c		\
-	lz_config.h			\
 	lz_decompress_tmpl.c		\
-	lz.h				\
-	marshaller.h			\
-	marshaller.c			\
-	messages.h			\
-	mem.h				\
-	mem.c				\
 	quic_family_tmpl.c		\
 	quic_rgb_tmpl.c			\
 	quic_tmpl.c			\
 	$(NULL)
 
-EXTRA_DIST = $(COMMON_SRCS)
-
diff --git a/configure.ac b/configure.ac
index a972470..92957fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@ AC_CONFIG_MACRO_DIR([m4])
 AM_CONFIG_HEADER([config.h])
 AC_CONFIG_AUX_DIR(.)
 
-AM_INIT_AUTOMAKE([dist-bzip2])
+AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip subdir-objects])
 AM_MAINTAINER_MODE
 
 # Define default SPICE_COMMON_SRCDIR
@@ -85,7 +85,6 @@ if test "$platform_win32" = yes; then
 else
   red_target=x11
 fi
-AC_SUBST(red_target)
 
 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
 AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
@@ -507,10 +506,6 @@ python_modules/Makefile
 server/Makefile
 server/tests/Makefile
 client/Makefile
-client/x11/Makefile
-client/x11/images/Makefile
-client/gui/Makefile
-client/windows/Makefile
 ])
 
 dnl ==========================================================================
diff --git a/server/Makefile.am b/server/Makefile.am
index 37ff183..73a886f 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -3,23 +3,21 @@ SUBDIRS = . tests
 NULL =
 
 INCLUDES = \
-	-I.					\
+	-I$(top_srcdir)				\
 	-I$(top_srcdir)/common			\
-	-I$(top_srcdir)/common/linux	\
-	$(PROTOCOL_CFLAGS)			\
-	$(JPEG_CFLAGS)				\
+	-DRED_STATISTICS			\
+	-DSW_CANVAS_IMAGE_CACHE			\
+	$(Z_LIBS)				\
+	$(CELT051_CFLAGS)			\
 	$(PIXMAN_CFLAGS)			\
-	$(GL_CFLAGS)				\
-	$(SSL_CFLAGS)				\
+	$(PROTOCOL_CFLAGS)			\
 	$(SASL_CFLAGS)				\
-	$(CELT051_CFLAGS)			\
 	$(SLIRP_CFLAGS)				\
-	-DSW_CANVAS_IMAGE_CACHE			\
-	-DRED_STATISTICS			\
-	$(WARN_CFLAGS)                          \
+	$(SMARTCARD_CFLAGS)			\
+	$(SSL_CFLAGS)				\
 	$(VISIBILITY_HIDDEN_CFLAGS)		\
-	$(SMARTCARD_CFLAGS)				\
-	-std=gnu99 \
+	$(WARN_CFLAGS)				\
+	-std=gnu99				\
 	$(NULL)
 
 spice_built_sources = generated_marshallers.c generated_marshallers.h generated_demarshallers.c
@@ -34,29 +32,6 @@ generated_marshallers.c: $(top_srcdir)/spice.proto
 generated_marshallers.h: $(top_srcdir)/spice.proto
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server -H $(top_srcdir)/spice.proto generated_marshallers.h
 
-if SUPPORT_GL
-GL_SRCS =				\
-	$(top_srcdir)/common/gl_canvas.c		\
-	$(top_srcdir)/common/glc.c			\
-	$(top_srcdir)/common/ogl_ctx.c			\
-	$(NULL)
-else
-GL_SRCS =
-endif
-
-COMMON_SRCS =						\
-	$(top_srcdir)/common/sw_canvas.c		\
-	$(top_srcdir)/common/pixman_utils.c		\
-	$(top_srcdir)/common/lines.c			\
-	$(top_srcdir)/common/region.c			\
-	$(top_srcdir)/common/rop3.c			\
-	$(top_srcdir)/common/quic.c			\
-	$(top_srcdir)/common/lz.c			\
-	$(top_srcdir)/common/canvas_utils.c		\
-	$(top_srcdir)/common/mem.c			\
-	$(top_srcdir)/common/marshaller.c		\
-	$(NULL)
-
 lib_LTLIBRARIES = libspice-server.la
 
 libspice_server_la_LDFLAGS =			\
@@ -64,51 +39,43 @@ libspice_server_la_LDFLAGS =			\
 	-no-undefined				\
 	$(NULL)
 
-libspice_server_la_LIBADD =			\
-	$(GL_LIBS)				\
-	$(JPEG_LIBS)				\
-	$(PIXMAN_LIBS)				\
-	$(SSL_LIBS)				\
-	$(SASL_LIBS)				\
-	$(CELT051_LIBS)				\
-	$(SLIRP_LIBS)				\
-	$(LIBRT)				\
-	$(Z_LIBS)				\
+libspice_server_la_LIBADD =				\
+	$(top_builddir)/common/libspice-common.la	\
+	$(CELT051_LIBS)					\
+	$(GL_LIBS)					\
+	$(JPEG_LIBS)					\
+	$(LIBRT)					\
+	$(PIXMAN_LIBS)					\
+	$(SASL_LIBS)					\
+	$(SLIRP_LIBS)					\
+	$(SSL_LIBS)					\
 	$(NULL)
 
-if SUPPORT_TUNNEL
-TUNNEL_SRCS =			\
-	red_tunnel_worker.c	\
-	red_tunnel_worker.h	\
-	$(NULL)
-else
-TUNNEL_SRCS =
-endif
-
-if SUPPORT_SMARTCARD
-SMARTCARD_SRCS =		\
-	smartcard.c			\
-	smartcard.h			\
-	$(NULL)
-else
-SMARTCARD_SRCS =
-endif
-
 libspice_server_la_SOURCES =			\
 	agent-msg-filter.c			\
 	agent-msg-filter.h			\
+	char_device.h				\
 	demarshallers.h				\
+	generated_demarshallers.c		\
+	generated_marshallers.c			\
+	generated_marshallers.h			\
 	glz_encoder.c				\
+	glz_encoder.h				\
 	glz_encoder_config.h			\
 	glz_encoder_dictionary.c		\
 	glz_encoder_dictionary.h		\
 	glz_encoder_dictionary_protected.h	\
-	glz_encoder.h				\
+	inputs_channel.c			\
+	inputs_channel.h			\
 	jpeg_encoder.c				\
 	jpeg_encoder.h				\
-	mjpeg_encoder.h				\
+	main_channel.c				\
+	main_channel.h				\
 	mjpeg_encoder.c				\
+	mjpeg_encoder.h				\
 	red_bitmap_utils.h			\
+	red_channel.c				\
+	red_channel.h				\
 	red_client_cache.h			\
 	red_client_shared_cache.h		\
 	red_common.h				\
@@ -118,31 +85,33 @@ libspice_server_la_SOURCES =			\
 	red_memslots.h				\
 	red_parse_qxl.c				\
 	red_parse_qxl.h				\
-	reds.c					\
-	main_channel.c				\
-	inputs_channel.c			\
-	reds.h					\
-	stat.h					\
 	red_worker.c				\
 	red_worker.h				\
+	reds.c					\
+	reds.h					\
 	snd_worker.c				\
 	snd_worker.h				\
-	red_channel.h				\
-	red_channel.c				\
-	spice.h					\
 	spice-experimental.h			\
-	generated_demarshallers.c		\
-	generated_marshallers.c			\
-	generated_marshallers.h			\
+	spice.h					\
+	stat.h					\
 	zlib_encoder.c				\
 	zlib_encoder.h				\
-	char_device.h				\
-	$(TUNNEL_SRCS)				\
-	$(SMARTCARD_SRCS)			\
-	$(COMMON_SRCS)				\
-	$(GL_SRCS)				\
 	$(NULL)
 
+if SUPPORT_TUNNEL
+libspice_server_la_SOURCES +=	\
+	red_tunnel_worker.c	\
+	red_tunnel_worker.h	\
+	$(NULL)
+endif
+
+if SUPPORT_SMARTCARD
+libspice_server_la_SOURCES +=	\
+	smartcard.c		\
+	smartcard.h		\
+	$(NULL)
+endif
+
 libspice_serverincludedir = $(includedir)/spice-server
 libspice_serverinclude_HEADERS =		\
 	spice.h					\
diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index 9d20264..8ec4094 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -1,35 +1,26 @@
 NULL =
 
-INCLUDES =                          \
-	-I..                            \
-	-I../../common                  \
+INCLUDES =                              \
+	-I$(top_srcdir)                 \
+	-I$(top_srcdir)/common          \
+	-I$(top_srcdir)/server          \
+	-I$(top_srcdir)/server/tests    \
 	$(PROTOCOL_CFLAGS)              \
 	$(SPICE_NONPKGCONFIG_CFLAGS)    \
 	$(NULL)
 
-AM_LDFLAGS = -L../.libs -lspice-server
+AM_LDFLAGS = $(top_builddir)/server/libspice-server.la
 
 noinst_PROGRAMS = test_just_sockets_no_ssl test_empty_success test_fail_on_null_core_interface test_display_no_ssl test_display_streaming test_playback
 
-test_display_streaming_SOURCES = test_display_streaming.c test_display_base.c basic_event_loop.c basic_event_loop.h test_util.h
+test_display_streaming_SOURCES = test_display_streaming.c test_display_base.c test_display_base.h basic_event_loop.c basic_event_loop.h test_util.h
 
-test_display_no_ssl_SOURCES = test_display_no_ssl.c test_display_base.c basic_event_loop.c basic_event_loop.h test_util.h
-
-test_display_no_ssl_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
+test_display_no_ssl_SOURCES = test_display_no_ssl.c test_display_base.c test_display_base.h basic_event_loop.c basic_event_loop.h test_util.h
 
 test_just_sockets_no_ssl_SOURCES = test_just_sockets_no_ssl.c basic_event_loop.c basic_event_loop.h test_util.h
 
-test_just_sockets_no_ssl_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
-
 test_empty_success_SOURCES = test_empty_success.c
 
-test_empty_success_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
-
 test_fail_on_null_core_interface_SOURCES = test_fail_on_null_core_interface.c
 
-test_fail_on_null_core_interface_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
-
 test_playback_SOURCES = test_playback.c basic_event_loop.c basic_event_loop.h test_util.h
-
-test_playback_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
-


More information about the Spice-commits mailing list