Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 1131)
+++ CMakeLists.txt	(revision 1136)
@@ -71,4 +71,8 @@
 FIND_PACKAGE(Ghostscript)
 
+IF(WIN32)
+  SET(LEMON_WIN32 TRUE)
+ENDIF(WIN32)
+
 SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
 SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
Index: lemon/bits/windows.cc
===================================================================
--- lemon/bits/windows.cc	(revision 1092)
+++ lemon/bits/windows.cc	(revision 1135)
@@ -22,5 +22,9 @@
 #include<lemon/bits/windows.h>
 
-#ifdef WIN32
+#if defined(LEMON_WIN32) && defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+#endif
+
+#ifdef LEMON_WIN32
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
@@ -41,5 +45,5 @@
 #include <unistd.h>
 #include <ctime>
-#ifndef WIN32
+#ifndef LEMON_WIN32
 #include <sys/times.h>
 #endif
@@ -56,5 +60,5 @@
                          double &cutime, double &cstime)
     {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       static const double ch = 4294967296.0e-7;
       static const double cl = 1.0e-7;
@@ -95,9 +99,9 @@
     {
       std::ostringstream os;
-#ifdef WIN32
+#ifdef LEMON_WIN32
       SYSTEMTIME time;
       GetSystemTime(&time);
       char buf1[11], buf2[9], buf3[5];
-          if (GetDateFormat(MY_LOCALE, 0, &time,
+      if (GetDateFormat(MY_LOCALE, 0, &time,
                         ("ddd MMM dd"), buf1, 11) &&
           GetTimeFormat(MY_LOCALE, 0, &time,
@@ -121,5 +125,5 @@
     int getWinRndSeed()
     {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       FILETIME time;
       GetSystemTimeAsFileTime(&time);
@@ -133,5 +137,5 @@
 
     WinLock::WinLock() {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       CRITICAL_SECTION *lock = new CRITICAL_SECTION;
       InitializeCriticalSection(lock);
@@ -143,5 +147,5 @@
 
     WinLock::~WinLock() {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
       DeleteCriticalSection(lock);
@@ -151,5 +155,5 @@
 
     void WinLock::lock() {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
       EnterCriticalSection(lock);
@@ -158,5 +162,5 @@
 
     void WinLock::unlock() {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
       LeaveCriticalSection(lock);
Index: lemon/bits/windows.h
===================================================================
--- lemon/bits/windows.h	(revision 1092)
+++ lemon/bits/windows.h	(revision 1134)
@@ -20,4 +20,5 @@
 #define LEMON_BITS_WINDOWS_H
 
+#include <lemon/config.h>
 #include <string>
 
@@ -35,5 +36,5 @@
       ~WinLock();
       void lock();
-      void unlock();
+      void unlock();\
     private:
       void *_repr;
Index: lemon/config.h.in
===================================================================
--- lemon/config.h.in	(revision 1131)
+++ lemon/config.h.in	(revision 1136)
@@ -1,6 +1,11 @@
+#ifndef LEMON_CONFIG_H
+#define LEMON_CONFIG_H
+
 #define LEMON_VERSION "@PROJECT_VERSION@"
 #cmakedefine LEMON_HAVE_LONG_LONG 1
 
 #cmakedefine LEMON_CXX11 1
+
+#cmakedefine LEMON_WIN32 1
 
 #cmakedefine LEMON_HAVE_LP 1
@@ -12,13 +17,15 @@
 #cmakedefine LEMON_HAVE_CBC 1
 
-#define _LEMON_CPLEX 1
-#define _LEMON_CLP 2
-#define _LEMON_GLPK 3
-#define _LEMON_SOPLEX 4
-#define _LEMON_CBC 5
+#define LEMON_CPLEX_ 1
+#define LEMON_CLP_ 2
+#define LEMON_GLPK_ 3
+#define LEMON_SOPLEX_ 4
+#define LEMON_CBC_ 5
 
-#cmakedefine LEMON_DEFAULT_LP _LEMON_@LEMON_DEFAULT_LP@
-#cmakedefine LEMON_DEFAULT_MIP _LEMON_@LEMON_DEFAULT_MIP@
+#cmakedefine LEMON_DEFAULT_LP LEMON_@LEMON_DEFAULT_LP@_
+#cmakedefine LEMON_DEFAULT_MIP LEMON_@LEMON_DEFAULT_MIP@_
 
 #cmakedefine LEMON_USE_PTHREAD 1
 #cmakedefine LEMON_USE_WIN32_THREADS 1
+
+#endif
Index: lemon/core.h
===================================================================
--- lemon/core.h	(revision 1123)
+++ lemon/core.h	(revision 1135)
@@ -20,11 +20,10 @@
 #define LEMON_CORE_H
 
-#include <vector>
-#include <algorithm>
-
-#include <lemon/config.h>
-#include <lemon/bits/enable_if.h>
-#include <lemon/bits/traits.h>
-#include <lemon/assert.h>
+///\file
+///\brief LEMON core utilities.
+///
+///This header file contains core utilities for LEMON.
+///It is automatically included by all graph types, therefore it usually
+///do not have to be included directly.
 
 // Disable the following warnings when compiling with MSVC:
@@ -44,10 +43,13 @@
 #endif
 
-///\file
-///\brief LEMON core utilities.
-///
-///This header file contains core utilities for LEMON.
-///It is automatically included by all graph types, therefore it usually
-///do not have to be included directly.
+#include <vector>
+#include <algorithm>
+
+#include <lemon/config.h>
+#include <lemon/bits/enable_if.h>
+#include <lemon/bits/traits.h>
+#include <lemon/assert.h>
+
+
 
 namespace lemon {
Index: lemon/graph_to_eps.h
===================================================================
--- lemon/graph_to_eps.h	(revision 1099)
+++ lemon/graph_to_eps.h	(revision 1134)
@@ -26,5 +26,5 @@
 #include<vector>
 
-#ifndef WIN32
+#ifndef LEMON_WIN32
 #include<sys/time.h>
 #include<ctime>
@@ -675,5 +675,5 @@
     {
       os << "%%CreationDate: ";
-#ifndef WIN32
+#ifndef LEMON_WIN32
       timeval tv;
       gettimeofday(&tv, 0);
Index: lemon/lp.h
===================================================================
--- lemon/lp.h	(revision 1120)
+++ lemon/lp.h	(revision 1134)
@@ -23,17 +23,17 @@
 
 
-#if LEMON_DEFAULT_LP == _LEMON_GLPK || LEMON_DEFAULT_MIP == _LEMON_GLPK
+#if LEMON_DEFAULT_LP == LEMON_GLPK_ || LEMON_DEFAULT_MIP == LEMON_GLPK_
 #include <lemon/glpk.h>
 #endif
-#if LEMON_DEFAULT_LP == _LEMON_CPLEX || LEMON_DEFAULT_MIP == _LEMON_CPLEX 
+#if LEMON_DEFAULT_LP == LEMON_CPLEX_ || LEMON_DEFAULT_MIP == LEMON_CPLEX_
 #include <lemon/cplex.h>
 #endif
-#if LEMON_DEFAULT_LP == _LEMON_SOPLEX
+#if LEMON_DEFAULT_LP == LEMON_SOPLEX_
 #include <lemon/soplex.h>
 #endif
-#if LEMON_DEFAULT_LP == _LEMON_CLP
+#if LEMON_DEFAULT_LP == LEMON_CLP_
 #include <lemon/clp.h>
 #endif
-#if LEMON_DEFAULT_MIP == _LEMON_CBC
+#if LEMON_DEFAULT_MIP == LEMON_CBC_
 #include <lemon/cbc.h>
 #endif
@@ -50,6 +50,6 @@
   ///\ingroup lp_group
   ///
-  ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX,
-  ///\c _LEMON_SOPLEX or \c LEMON__CLP
+  ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_,
+  ///\c LEMON_SOPLEX_ or \c LEMON_CLP_
 #define LEMON_DEFAULT_LP SOLVER
   ///The default LP solver
@@ -66,6 +66,6 @@
   ///\ingroup lp_group
   ///
-  ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX
-  ///or \c _LEMON_CBC
+  ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_
+  ///or \c LEMON_CBC_
 #define LEMON_DEFAULT_MIP SOLVER
   ///The default MIP solver.
@@ -77,18 +77,18 @@
   typedef GlpkMip Mip;
 #else
-#if LEMON_DEFAULT_LP == _LEMON_GLPK
+#if LEMON_DEFAULT_LP == LEMON_GLPK_
   typedef GlpkLp Lp;
-#elif LEMON_DEFAULT_LP == _LEMON_CPLEX
+#elif LEMON_DEFAULT_LP == LEMON_CPLEX_
   typedef CplexLp Lp;
-#elif LEMON_DEFAULT_LP == _LEMON_SOPLEX
+#elif LEMON_DEFAULT_LP == LEMON_SOPLEX_
   typedef SoplexLp Lp;
-#elif LEMON_DEFAULT_LP == _LEMON_CLP
+#elif LEMON_DEFAULT_LP == LEMON_CLP_
   typedef ClpLp Lp;
 #endif
-#if LEMON_DEFAULT_MIP == _LEMON_GLPK
+#if LEMON_DEFAULT_MIP == LEMON_GLPK_
   typedef GlpkMip Mip;
-#elif LEMON_DEFAULT_MIP == _LEMON_CPLEX
+#elif LEMON_DEFAULT_MIP == LEMON_CPLEX_
   typedef CplexMip Mip;
-#elif LEMON_DEFAULT_MIP == _LEMON_CBC
+#elif LEMON_DEFAULT_MIP == LEMON_CBC_
   typedef CbcMip Mip;
 #endif
Index: lemon/random.h
===================================================================
--- lemon/random.h	(revision 1132)
+++ lemon/random.h	(revision 1136)
@@ -63,4 +63,6 @@
 #define LEMON_RANDOM_H
 
+#include <lemon/config.h>
+
 #include <algorithm>
 #include <iterator>
@@ -72,5 +74,5 @@
 #include <lemon/dim2.h>
 
-#ifndef WIN32
+#ifndef LEMON_WIN32
 #include <sys/time.h>
 #include <ctime>
@@ -606,5 +608,5 @@
     /// \return Currently always \c true.
     bool seed() {
-#ifndef WIN32
+#ifndef LEMON_WIN32
       if (seedFromFile("/dev/urandom", 0)) return true;
 #endif
@@ -626,5 +628,5 @@
     /// \param offset The offset, from the file read.
     /// \return \c true when the seeding successes.
-#ifndef WIN32
+#ifndef LEMON_WIN32
     bool seedFromFile(const std::string& file = "/dev/urandom", int offset = 0)
 #else
@@ -648,5 +650,5 @@
     /// \return Currently always \c true.
     bool seedFromTime() {
-#ifndef WIN32
+#ifndef LEMON_WIN32
       timeval tv;
       gettimeofday(&tv, 0);
Index: lemon/time_measure.h
===================================================================
--- lemon/time_measure.h	(revision 1092)
+++ lemon/time_measure.h	(revision 1134)
@@ -24,5 +24,7 @@
 ///\brief Tools for measuring cpu usage
 
-#ifdef WIN32
+#include <lemon/config.h>
+
+#ifdef LEMON_WIN32
 #include <lemon/bits/windows.h>
 #else
@@ -103,5 +105,5 @@
     void stamp()
     {
-#ifndef WIN32
+#ifndef LEMON_WIN32
       timeval tv;
       gettimeofday(&tv, 0);
Index: test/radix_sort_test.cc
===================================================================
--- test/radix_sort_test.cc	(revision 1092)
+++ test/radix_sort_test.cc	(revision 1135)
@@ -16,4 +16,6 @@
  *
  */
+
+#include <lemon/core.h>
 
 #include <lemon/time_measure.h>
