From ff821bdc93ff60b0cc8a7920d7f1f928bd9b0dce Mon Sep 17 00:00:00 2001 From: doursse Date: Wed, 5 Mar 2008 09:19:38 +0000 Subject: [PATCH] fix compilation with cegcc and minor fixing * COPYING: copyright update * configure.ac: * src/lib/Evil.h: * src/lib/dlfcn/dlfcn.h: * src/lib/mman/sys/mman.h: define EFL_EVIL_BUILD in config.h for managing correctly EAPI * src/bin/test_pipe.c: stdio.h is needed after winsock2.h for mingw32ce * src/lib/dlfcn/dlfcn.c (get_last_error), (dlopen), (dlsym): * src/lib/evil.c: fix some heafer files inclusion on cegc platform. first step of mingw32ce support * src/lib/mman/mman.c: define _get_osfhandle for mingw32ce SVN revision: 33934 --- legacy/evil/COPYING | 2 +- legacy/evil/ChangeLog | 24 ++++++++++++++++++++++++ legacy/evil/configure.ac | 5 ++++- legacy/evil/src/bin/test_pipe.c | 4 ++-- legacy/evil/src/lib/Evil.h | 10 +++++++--- legacy/evil/src/lib/dlfcn/dlfcn.c | 21 ++++++++++++--------- legacy/evil/src/lib/dlfcn/dlfcn.h | 11 ++++++++--- legacy/evil/src/lib/evil.c | 12 ++++++++---- legacy/evil/src/lib/mman/mman.c | 6 ++++-- legacy/evil/src/lib/mman/sys/mman.h | 10 +++++++--- 10 files changed, 77 insertions(+), 28 deletions(-) diff --git a/legacy/evil/COPYING b/legacy/evil/COPYING index 474fcc5faa..0fd96abc0e 100644 --- a/legacy/evil/COPYING +++ b/legacy/evil/COPYING @@ -1,4 +1,4 @@ -Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS) +Copyright (C) 2008 Vincent Torri and various contributors (see AUTHORS) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 52cb4037eb..4119796ab4 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,27 @@ +2008-03-05 Vincent Torri + + fix compilation with cegcc and minor fixing + + * COPYING: + copyright update + + * configure.ac: + * src/lib/Evil.h: + * src/lib/dlfcn/dlfcn.h: + * src/lib/mman/sys/mman.h: + define EFL_EVIL_BUILD in config.h for managing correctly EAPI + + * src/bin/test_pipe.c: + stdio.h is needed after winsock2.h for mingw32ce + + * src/lib/dlfcn/dlfcn.c (get_last_error), (dlopen), (dlsym): + * src/lib/evil.c: + fix some heafer files inclusion on cegc platform. + first step of mingw32ce support + + * src/lib/mman/mman.c: + define _get_osfhandle for mingw32ce + 2008-03-03 Vincent Torri * COPYING: diff --git a/legacy/evil/configure.ac b/legacy/evil/configure.ac index 70621d30b6..faed1b3a30 100644 --- a/legacy/evil/configure.ac +++ b/legacy/evil/configure.ac @@ -9,7 +9,7 @@ dnl If the host is not windows, we exit, dnl otherwise, we set the correct flags dnl for each platform. mingw_libs="" -cegcc_libs="" +cegcc_cflags="" case "$host_os" in mingw|mingw32) mingw_libs="-lole32 -luuid -lws2_32" @@ -26,6 +26,9 @@ win32_libs="${mingw_libs}" AC_SUBST(win32_cflags) AC_SUBST(win32_libs) +dnl needed for correct definition of EAPI +AC_DEFINE(EFL_EVIL_BUILD, 1, [Define to mention that evil is built]) + AM_INIT_AUTOMAKE(1.6 dist-bzip2) AC_LIBTOOL_WIN32_DLL diff --git a/legacy/evil/src/bin/test_pipe.c b/legacy/evil/src/bin/test_pipe.c index 7cd62c5a11..6f5d49d6b4 100644 --- a/legacy/evil/src/bin/test_pipe.c +++ b/legacy/evil/src/bin/test_pipe.c @@ -1,9 +1,9 @@ -#include - # define WIN32_LEAN_AND_MEAN # include # undef WIN32_LEAN_AND_MEAN +#include + #include "Evil.h" #define FDREAD 0 diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h index 648503422b..9fa36c5e96 100644 --- a/legacy/evil/src/lib/Evil.h +++ b/legacy/evil/src/lib/Evil.h @@ -6,11 +6,15 @@ #endif /* EAPI */ #ifdef _WIN32 -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) +# ifdef EFL_EVIL_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ # else # define EAPI __declspec(dllimport) -# endif +# endif /* ! EFL_EVIL_BUILD */ #endif /* _WIN32 */ #ifdef __cplusplus diff --git a/legacy/evil/src/lib/dlfcn/dlfcn.c b/legacy/evil/src/lib/dlfcn/dlfcn.c index 1b067e234f..a84e1e583c 100644 --- a/legacy/evil/src/lib/dlfcn/dlfcn.c +++ b/legacy/evil/src/lib/dlfcn/dlfcn.c @@ -4,6 +4,10 @@ #include #undef WIN32_LEAN_AND_MEAN +#ifdef __MINGW32CE__ +# include +#endif /* __MINGW32CE__ */ + #ifdef HAVE_CONFIG_H # include "config.h" #endif /* HAVE_CONFIG_H */ @@ -18,7 +22,7 @@ static char *dl_err = NULL; static int dl_err_viewed = 0; -#ifdef __CEGCC__ +#if defined(__CEGCC__) || defined(__MINGW32CE__) static wchar_t * string_to_wchar(const char *text) @@ -61,8 +65,7 @@ wchar_to_string(const wchar_t *text) return atext; } - -#endif /* __CEGCC__ */ +#endif /* __CEGCC__ || __MINGW32CE__ */ static void get_last_error(char *desc) @@ -79,11 +82,11 @@ get_last_error(char *desc) MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&str, 0, NULL); -#ifdef __CEGCC__ +#if defined(__CEGCC__) || defined(__MINGW32CE__) str2 = wchar_to_string(str); #else str2 = str; -#endif /* __CEGCC__ */ +#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ l1 = strlen(desc); l2 = strlen(str2); @@ -139,7 +142,7 @@ dlopen(const char* path, int mode __UNUSED__) else new_path[i] = path[i]; } -#ifdef __CEGCC__ +#if defined(__CEGCC__) || defined(__MINGW32CE__) { wchar_t *wpath; @@ -151,7 +154,7 @@ dlopen(const char* path, int mode __UNUSED__) #else module = LoadLibraryEx(new_path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); -#endif /* __CEGCC__ */ +#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ if (!module) get_last_error("LoadLibraryEx returned: "); @@ -178,7 +181,7 @@ dlsym(void *handle, const char *symbol) { FARPROC fp; -#ifdef __CEGCC__ +#if defined(__CEGCC__) || defined(__MINGW32CE__) { wchar_t *wsymbol; @@ -188,7 +191,7 @@ dlsym(void *handle, const char *symbol) } #else fp = GetProcAddress(handle, symbol); -#endif /* __CEGCC__ */ +#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ if (!fp) get_last_error("GetProcAddress returned: "); diff --git a/legacy/evil/src/lib/dlfcn/dlfcn.h b/legacy/evil/src/lib/dlfcn/dlfcn.h index 441d2b2dd8..46dc5910de 100644 --- a/legacy/evil/src/lib/dlfcn/dlfcn.h +++ b/legacy/evil/src/lib/dlfcn/dlfcn.h @@ -6,17 +6,22 @@ #endif /* EAPI */ #ifdef _WIN32 -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) +# ifdef EFL_EVIL_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ # else # define EAPI __declspec(dllimport) -# endif +# endif /* ! EFL_EVIL_BUILD */ #endif /* _WIN32 */ #ifdef __cplusplus extern "C" { #endif + /** * @def RTLD_LAZY * Lazy function call binding diff --git a/legacy/evil/src/lib/evil.c b/legacy/evil/src/lib/evil.c index 38f1b6cf5c..ae4d7085b6 100644 --- a/legacy/evil/src/lib/evil.c +++ b/legacy/evil/src/lib/evil.c @@ -1,16 +1,20 @@ #include +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + #ifndef __CEGCC__ # include -# define WIN32_LEAN_AND_MEAN -# include -# undef WIN32_LEAN_AND_MEAN # include # include # include # include # include -#endif /* ! __CEGCC__ */ +#else +# include +#endif /* __CEGCC__ */ + #include #include #include diff --git a/legacy/evil/src/lib/mman/mman.c b/legacy/evil/src/lib/mman/mman.c index 01e12f22a4..a211214cf7 100644 --- a/legacy/evil/src/lib/mman/mman.c +++ b/legacy/evil/src/lib/mman/mman.c @@ -20,10 +20,12 @@ # define __UNUSED__ #endif /* HAVE___ATTRIBUTE__ */ -#ifdef __CEGCC__ +#if defined(__CEGCC__) # define CreateFileMapping CreateFileMappingW # define _get_osfhandle get_osfhandle -#endif /* __CEGCC__ */ +elif defined (__MINGW32CE__) +# define _get_osfhandle(FILEDES) ((long)FILEDES) +#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ void * diff --git a/legacy/evil/src/lib/mman/sys/mman.h b/legacy/evil/src/lib/mman/sys/mman.h index 0d6e9e22a8..fd0d0a5c26 100644 --- a/legacy/evil/src/lib/mman/sys/mman.h +++ b/legacy/evil/src/lib/mman/sys/mman.h @@ -6,11 +6,15 @@ #endif /* EAPI */ #ifdef _WIN32 -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) +# ifdef EFL_EVIL_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ # else # define EAPI __declspec(dllimport) -# endif +# endif /* ! EFL_EVIL_BUILD */ #endif /* _WIN32 */ #ifdef __cplusplus