Fixes for building on windows
authorDavid Schleef <ds@schleef.org>
Fri, 6 Mar 2009 00:05:58 +0000 (16:05 -0800)
committerDavid Schleef <ds@schleef.org>
Fri, 6 Mar 2009 00:05:58 +0000 (16:05 -0800)
m4/as-host-defines.m4
orc/Makefile.am
orc/orcprogram-mmx.c
orc/orcprogram-powerpc.c
orc/orcprogram-win32.c [new file with mode: 0644]
orc/orcrules-mmx.c

index 8b813bb..d43596f 100644 (file)
@@ -45,8 +45,8 @@ AM_CONDITIONAL(HAVE_ARM, test "x$HAVE_ARM" = "xyes")
       ;;
   esac
 
-AM_CONDITIONAL(HAVE_OS_WIN32, test "$HAVE_WIN32" = "yes")
-AM_CONDITIONAL(HAVE_OS_LINUX, test "$HAVE_LINUX" = "yes")
+AM_CONDITIONAL(HAVE_OS_WIN32, test "$HAVE_OS_WIN32" = "yes")
+AM_CONDITIONAL(HAVE_OS_LINUX, test "$HAVE_OS_LINUX" = "yes")
 
 ])
 
index 4b118c4..889d9fc 100644 (file)
@@ -4,6 +4,8 @@ pkgincludedir = $(includedir)/orc-@ORC_MAJORMINOR@/orc
 lib_LTLIBRARIES = liborc-@ORC_MAJORMINOR@.la
 
 liborc_@ORC_MAJORMINOR@_la_LIBS = $(ORC_LIBS)
+liborc_@ORC_MAJORMINOR@_la_LDFLAGS = \
+       -no-undefined -export-symbols-regex 'orc_'
 liborc_@ORC_MAJORMINOR@_la_CFLAGS = $(ORC_CFLAGS)
 
 liborc_@ORC_MAJORMINOR@_la_SOURCES = \
@@ -17,13 +19,19 @@ liborc_@ORC_MAJORMINOR@_la_SOURCES = \
        orcprogram-sse.c \
        orcprogram.h \
        orcopcodes.c \
-       orcprogram-linux.c \
        orcrules-mmx.c \
        orcrules-sse.c \
        orcdebug.c \
        orccpu.c \
        x86.c
 
+if HAVE_OS_LINUX
+liborc_@ORC_MAJORMINOR@_la_SOURCES += orcprogram-linux.c
+endif
+if HAVE_OS_WIN32
+liborc_@ORC_MAJORMINOR@_la_SOURCES += orcprogram-win32.c
+endif
+
 if HAVE_I386
 liborc_@ORC_MAJORMINOR@_la_SOURCES += orccpu-x86.c
 else
index 9a74d7c..8c677ee 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/mman.h>
 
 #include <orc/orcprogram.h>
 #include <orc/x86.h>
index c99ec51..2e6ef42 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/mman.h>
 
 #include <orc/orcprogram.h>
 
diff --git a/orc/orcprogram-win32.c b/orc/orcprogram-win32.c
new file mode 100644 (file)
index 0000000..5f7445a
--- /dev/null
@@ -0,0 +1,26 @@
+
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <orc/orcprogram.h>
+
+#define SIZE 65536
+
+
+void
+orc_program_allocate_codemem (OrcProgram *program)
+{
+  /* Now you know why Windows has viruses */
+
+  program->code = malloc(SIZE);
+  program->code_exec = program->code;
+  program->code_size = SIZE;
+  program->codeptr = program->code;
+}
+
index 9c6eceb..2fce71b 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/mman.h>
 
 #include <orc/orcprogram.h>
 #include <orc/x86.h>