From: mquinson Date: Mon, 1 Mar 2010 14:06:12 +0000 (+0000) Subject: Somehow fix the ruby detection with autotools. Still doesn't compile for some reason... X-Git-Tag: SVN~590 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9d1a487722431c76f5861a1490d9469de8af8f7e Somehow fix the ruby detection with autotools. Still doesn't compile for some reason when detected. Use --disable-ruby for now git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7148 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/configure.ac b/configure.ac index 2a3d527028..98b5b531a2 100644 --- a/configure.ac +++ b/configure.ac @@ -449,6 +449,33 @@ fi AC_MSG_RESULT(decide whether to compile lua bindings... $use_lua) AM_CONDITIONAL(HAVE_LUA,test "x$use_lua" = "xyes") +SG_CONFIGURE_PART(Checking Ruby bindings...) +# Ruby cruft +AC_ARG_ENABLE(ruby, + AS_HELP_STRING([--disable-ruby], [To not compile the Ruby bindings even if the tools are found]), + disable_ruby=$enableval,disable_ruby=yes) +if test "x$disable_ruby" != "xyes" ; then + use_ruby="disabled by user" +else + CPPFLAGS="-I/usr/lib/ruby/1.8/i486-linux/ $CPPFLAGS" + AC_MSG_CHECKING(checking ruby.h usability and presence) + AC_COMPILE_IFELSE([ + #undef PACKAGE_NAME + #undef PACKAGE_TARNAME + #undef PACKAGE_VERSION + #undef PACKAGE_STRING + #undef PACKAGE_BUGREPORT + #include + ], use_ruby=yes,use_ruby=no) + AC_MSG_RESULT($use_ruby) + if test "x$use_ruby" = "xyes" ; then + AC_DEFINE(HAVE_RUBY,1, [defines whether Ruby bindings must be compiled or not]) + fi +fi +AC_MSG_RESULT(decide whether to compile ruby bindings... $use_ruby) +AM_CONDITIONAL(HAVE_RUBY,test "x$use_ruby" = "xyes") + + ##################### ## Check for programs ## @@ -649,6 +676,7 @@ Configuration of package \`${PACKAGE}' (version ${VERSION}) on $gras_arch_name ( Context backend: ${with_context} Compile Java: ${use_java} Compile Lua: ${use_lua} + Compile Ruby: ${use_ruby} Maintainer mode: ${USE_MAINTAINER_MODE} Supernovae mode: ${supernovae} diff --git a/src/bindings/ruby/rb_msg_process.c b/src/bindings/ruby/rb_msg_process.c index 96280ee0d4..d82d07b441 100644 --- a/src/bindings/ruby/rb_msg_process.c +++ b/src/bindings/ruby/rb_msg_process.c @@ -1,8 +1,5 @@ /* - * $Id$ - * - * Copyright 2010 Martin Quinson, Mehdi Fekari - * All right reserved. + * Copyright 2010, The SimGrid Team. All right reserved. * * This program is free software; you can redistribute * it and/or modify it under the terms of the license @@ -187,11 +184,6 @@ static void processCreate(VALUE class,VALUE ruby_process,VALUE host) return; } process->simdata->PID = msg_global->PID++; // msg_global ?? - /*DEBUG - ("fil in process %s/%s (pid=%d) %p (sd=%p, host=%p, host->sd=%p) ", - process->name ,process->simdata->m_host->name,process->simdata->PID, - process,process->simdata, process->simdata->m_host, - process->simdata->m_host->simdata);*/ #ifdef DEBUG printf("fill in process %s/%s (pid=%d) %p (sd%=%p , host=%p, host->sd=%p)\n", @@ -206,7 +198,6 @@ static void processCreate(VALUE class,VALUE ruby_process,VALUE host) process->simdata->m_host->simdata->smx_host->name, 0,NULL,NULL); - //DEBUG ( "context created (s_process=%p)",process->simdata->s_process); #ifdef DEBUG printf("context created (s_process=%p)\n",process->simdata->s_process); #endif @@ -332,4 +323,4 @@ static void processExit(VALUE class,VALUE ruby_process) } SIMIX_context_stop(SIMIX_process_self()->context); -} \ No newline at end of file +} diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index 59846bae96..70a41babaf 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -11,14 +11,21 @@ #include "xbt/swag.h" #include "private.h" #include -#include -#include "smx_context_ruby.c" -#define HAVE_RUBY /* HACK HACK */ -// #define DEBUG #ifdef HAVE_RUBY - extern void SIMIX_ctx_ruby_factory_init(smx_context_factory_t *factory); +/* Damn Ruby. They load their full config.h, which breaks since we also load ours. + * So, we undef the offending defines + */ +#undef PACKAGE_VERSION +#undef PACKAGE_NAME +#undef PACKAGE_TARNAME +#undef PACKAGE_STRING +#undef PACKAGE_BUGREPORT +#undef _GNU_SOURCE +#include + void SIMIX_ctx_ruby_factory_init(smx_context_factory_t *factory); +#include "smx_context_ruby.c" #endif XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix, "Context switching mecanism"); diff --git a/src/simix/smx_context_ruby.c b/src/simix/smx_context_ruby.c index cbe02b4fca..54a9fdf69d 100644 --- a/src/simix/smx_context_ruby.c +++ b/src/simix/smx_context_ruby.c @@ -1,8 +1,8 @@ /* $Id$ */ -/* context_Ruby - implementation of context switching with lua coroutines */ +/* context_Ruby - implementation of context switching with ruby coroutines */ -/* Copyright (c) 2004-2008 the SimGrid team. All right reserved */ +/* Copyright (c) 2010, the SimGrid team. All right reserved */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -14,9 +14,6 @@ #include "xbt/asserts.h" #include "context_sysv_config.h" #include "bindings/ruby/rb_msg_process.c" -// #include "bindings/ruby/rb_msg.c" - -// #define MY_DEBUG typedef struct s_smx_ctx_ruby