[CONFIGURATION]

* BUG: Set Cygwin Shared Library Extension to dll

[GB.JIT]
* NEW: Add conditional defines for Cygwin to allow compile:
  Use finite in place of _finite, __isnand in place of __isnan
  and __isinfd in place of __isinf.

* NEW: Remove jit_gambas_pass_dummy.cpp as this is no longer
  required to compile with later versions of llvm. Also fixes
  issue with Cygwin compile.

[GB.NET]
* NEW: Redefine TIOCOUTQ for Cygwin

[GB.SDL.SOUND]
* NEW: -lSDL needed for Cygwin linker

[INTERPRETER]
* NEW: Redefine FIONREAD for Cygwin

* NEW: Cygwin needs <strings.h> to avoid compiler issues when
  redefining strcasecmp etc.
 
[DEVELOPMENT ENVIRONMENT]
* NEW: Make the environment Cygwin aware



git-svn-id: svn://localhost/gambas/trunk@6435 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Nigel Gerrard 2014-08-28 13:50:09 +00:00
parent 4c264fad52
commit e0b9fc1eac
12 changed files with 52 additions and 19 deletions

View file

@ -565,7 +565,7 @@ AC_DEFUN([GB_SHARED_LIBRARY_EXT],
case "${host}" in
*-*-cygwin* )
SHLIBEXT="la"
AC_DEFINE(SHARED_LIBRARY_EXT, "la", [Shared library extension is '.la'])
AC_DEFINE(SHARED_LIBRARY_EXT, "dll", [Shared library extension is '.dll'])
;;
*-*-darwin* )
SHLIBEXT="dylib"

View file

@ -76,10 +76,14 @@ Static Private Sub GetDistribution() As String
Next
sDistro = File.Load("/etc/issue")
If sDistro Then
iPos = InStr(sDistro, "\\")
If iPos Then sDistro = Left(sDistro, iPos - 1)
If Exist("/etc/issue") Then
sDistro = File.Load("/etc/issue")
If sDistro Then
iPos = InStr(sDistro, "\\")
If iPos Then sDistro = Left(sDistro, iPos - 1)
Endif
Else
Exec ["uname", "-s"] To sDistro
Endif
Return Trim(sDistro)
@ -129,9 +133,13 @@ Static Public Sub GetInfo() As String[]
Try sTemp = Format(CInt(sTemp) / 1024, "0") & "M"
If Not Error Then aText.Add("Memory=" & sTemp)
Endif
cSearch = ["Qt4": "libQtCore.so.*.*.*", "GTK+": "libgtk-x11-2*.so.*.*.*", "GTK+3": "libgtk-3*.so.*.*.*", "SDL": "libSDL-1.*.so.*.*.*", "GStreamer": "libgstreamer-*.so.*.*.*", "Poppler": "libpoppler.so.*.*.*", "Curl": "libcurl.so.*.*.*",
"OpenGL": "libGL.so.*.*.*", "Cairo": "libcairo.so.*.*.*", "DBus": "libdbus-[0-9].so.*.*.*"]
If System.Family = "Cygwin" Then
cSearch = ["Qt4": "libQtCore.dll.a", "GTK+": "libgtk-x11-2*.dll.a", "SDL": "libSDL*.dll.a", "GStreamer": "libgstreamer-*.dll.a", "Poppler": "libpoppler.dll.a", "Curl": "libcurl.dll.a", "OpenGL": "libGL.dll.a",
"Cairo": "libcairo.dll.a", "DBus": "libdbus-[0-9].dll.a"]
Else
cSearch = ["Qt4": "libQtCore.so.*.*.*", "GTK+": "libgtk-x11-2*.so.*.*.*", "GTK+3": "libgtk-3*.so.*.*.*", "SDL": "libSDL-1.*.so.*.*.*", "GStreamer": "libgstreamer-*.so.*.*.*", "Poppler": "libpoppler.so.*.*.*", "Curl": "libcurl.so.*.*.*",
"OpenGL": "libGL.so.*.*.*", "Cairo": "libcairo.so.*.*.*", "DBus": "libdbus-[0-9].so.*.*.*"]
EndIf
cFile = New Collection
aText.Add("[Libraries]")

View file

@ -8,4 +8,4 @@ gb_jit_la_LDFLAGS = -module @LD_FLAGS@ @JIT_LDFLAGS@
gb_jit_la_CPPFLAGS = @JIT_INC@
gb_jit_la_CXXFLAGS = $(AM_CXXFLAGS) -std=gnu++0x -fno-exceptions
gb_jit_la_SOURCES = gb.jit.h jit_api.cpp jit_codegen_conv.h jit_codegen.cpp jit_compile.cpp jit_conv.cpp jit_expressions.cpp jit.h jit_read.cpp jit_runtime.c jit_runtime.h jit_gambas_pass.cpp jit_gambas_pass.h jit_gambas_pass_dummy.cpp main.cpp main.h
gb_jit_la_SOURCES = gb.jit.h jit_api.cpp jit_codegen_conv.h jit_codegen.cpp jit_compile.cpp jit_conv.cpp jit_expressions.cpp jit.h jit_read.cpp jit_runtime.c jit_runtime.h jit_gambas_pass.cpp jit_gambas_pass.h main.cpp main.h

View file

@ -65,6 +65,12 @@ extern "C" {
#define LONG_TYPE (TARGET_BITS == 64 ? llvmType(getInt64Ty) : llvmType(getInt32Ty))
#ifdef __CYGWIN__
#define __finite finite
#define __isnan __isnand
#define __isinf __isinfd
#endif
const size_t TYPE_sizeof_memory_tab[16] = { 0, 1, 1, 2, 4, 8, 4, 8, 8, sizeof(void *), sizeof(void *), sizeof(void *), sizeof(VARIANT), 0, 0, 0 };
///DEBUG

View file

@ -31,6 +31,10 @@ extern "C" {
#include "gb_common_buffer.h"
}
#ifdef __CYGWIN__
#define __finite finite
#endif
llvm::Value* JIT_conv_to_variant(Expression* value, llvm::Value* val, bool on_stack, bool* no_ref_variant){
llvm::Value* ret;
if (TYPE_is_string(value->type)){

View file

@ -38,6 +38,14 @@
#include "main.h"
#ifdef __CYGWIN__
#define __finite finite
#define __isnan __isnand
#define __isinf __isinfd
#endif
#define FUNCTION_NAME(s) _FN(s)
#define _FN(s) #s
using namespace llvm;
namespace {
@ -94,7 +102,7 @@ bool GambasPass::runOnFunction(Function &F){
CI->eraseFromParent();
changed = true;
} else if (name == "__finite"){
} else if (name == FUNCTION_NAME(__finite)){
ConstantFP* op = dyn_cast<ConstantFP>(CI->getArgOperand(0));
if (!op)
continue;
@ -104,7 +112,7 @@ bool GambasPass::runOnFunction(Function &F){
CI->replaceAllUsesWith(res);
CI->eraseFromParent();
changed = true;
} else if (name == "__isnan"){
} else if (name == FUNCTION_NAME(__isnan)){
ConstantFP* op = dyn_cast<ConstantFP>(CI->getArgOperand(0));
if (!op)
continue;
@ -114,7 +122,7 @@ bool GambasPass::runOnFunction(Function &F){
CI->replaceAllUsesWith(res);
CI->eraseFromParent();
changed = true;
} else if (name == "__isinf"){
} else if (name == FUNCTION_NAME(__isinf)){
ConstantFP* op = dyn_cast<ConstantFP>(CI->getArgOperand(0));
if (!op)
continue;

View file

@ -1,6 +0,0 @@
// I found no easy way to compile jit_gambas_pass.cpp with -no-rtti as CXXFLAGS while still
// have rtti enabled for jit_codegen.cpp ...
extern "C" {
void* _ZTIN4llvm12FunctionPassE;
}

View file

@ -34,6 +34,8 @@
#ifdef __CYGWIN__
/* Cygwin defines FIONREAD in <sys/socket.h>. */
#include <sys/socket.h>
/* TIOCOUTQ is not implemented on Cygwin */
#define TIOCOUTQ ((unsigned int) -1)
#endif /* __CYGWIN__ */
#include "main.h"

View file

@ -15,7 +15,7 @@ GB_COMPONENT(
sdlsound, SDLSOUND, gb.sdl.sound, [src],
[GB_FIND(SDL_mixer.h SDL_cdrom.h, `sdl-config --prefix`, include/SDL)],
[GB_FIND(libSDL_mixer.$SHLIBEXT, /usr /usr/local `sdl-config --prefix`, lib)],
[-lSDL_mixer],
[-lSDL_mixer -lSDL],
[$SDL_CFLAGS])
AC_OUTPUT( \

View file

@ -46,6 +46,9 @@
#include "gbx_c_task.h"
//#define DEBUG_ME 1
#ifdef __CYGWIN__
#define FIONREAD TIOCINQ
#endif
DECLARE_EVENT(EVENT_Read);
DECLARE_EVENT(EVENT_Error);

View file

@ -24,6 +24,10 @@
#ifndef __GAMBAS_H
#define __GAMBAS_H
#ifdef __CYGWIN__
#include <strings.h>
#endif
#include "config.h"
#include <stdint.h>
#include <stddef.h>

View file

@ -24,6 +24,10 @@
#ifndef __GB_COMMON_CASE_H
#define __GB_COMMON_CASE_H
#ifdef __CYGWIN__
#include <strings.h>
#endif
#include <ctype.h>
#include <string.h>