case "${host_os}" in
mingw*|cygwin*)
- CODEMEM_BACKEND=win32
+ AC_DEFINE(HAVE_CODEMEM_MALLOC, 1, [Use malloc to allocate code for execution])
;;
linux*|darwin*|solaris*|netbsd*|freebsd*|openbsd*)
- CODEMEM_BACKEND=linux
+ AC_DEFINE(HAVE_CODEMEM_MMAP, 1, [Use mmap to allocate code for execution])
;;
*)
AC_ERROR([no code allocation backend])
;;
esac
-AC_SUBST(CODEMEM_BACKEND)
AC_DEFINE(ORC_EXPORTS, 1, [Defined for compiling internal code])
orc.c \
orcexecutor.c \
orcrule.c \
+ orccodemem.c \
orcprogram.c \
orcprogram-arm.c \
orcprogram-c.c \
x86.c \
arm.c
-liborc_@ORC_MAJORMINOR@_la_SOURCES += orcprogram-@CODEMEM_BACKEND@.c
-
if HAVE_I386
liborc_@ORC_MAJORMINOR@_la_SOURCES += orccpu-x86.c
else
#define SIZE 65536
+#ifdef HAVE_CODEMEM_MMAP
void
orc_program_allocate_codemem (OrcProgram *program)
{
program->code_size = SIZE;
program->codeptr = program->code;
}
+#endif
+
+#ifdef HAVE_CODEMEM_MALLOC
+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;
+}
+#endif
+++ /dev/null
-
-#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;
-}
-