Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Somehow fix the ruby detection with autotools. Still doesn't compile for some reason...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 1 Mar 2010 14:06:12 +0000 (14:06 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 1 Mar 2010 14:06:12 +0000 (14:06 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7148 48e7efb5-ca39-0410-a469-dd3cf9ba447f

configure.ac
src/bindings/ruby/rb_msg_process.c
src/simix/smx_context.c
src/simix/smx_context_ruby.c

index 2a3d527..98b5b53 100644 (file)
@@ -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 <ruby.h>
+  ], 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}
index 96280ee..d82d07b 100644 (file)
@@ -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
+}
index 59846ba..70a41ba 100644 (file)
 #include "xbt/swag.h"
 #include "private.h"
 #include <lua5.1/lauxlib.h>
-#include <ruby.h>
-#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 <ruby.h>
+ 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");
index cbe02b4..54a9fdf 100644 (file)
@@ -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