List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:November 5 2007 6:13pm
Subject:Rev 235: Fixed various build issues across the source tree to make sure that make in the top level actually works. in http://bazaar.launchpad.net/~ndb...
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge

------------------------------------------------------------
revno: 235
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Mon 2007-11-05 10:12:57 -0800
message:
  Fixed various build issues across the source tree to make sure that make in the top
level actually works.
  Cleaned up some of the m4 macros.
modified:
  Makefile.am                    makefile.am-20070228020914-u2pk759xg7thauwf-4
  acinclude.m4                   acinclude.m4-20070228020914-u2pk759xg7thauwf-8
  configure.in                   configure.in-20070228020914-u2pk759xg7thauwf-13
  csharp/Makefile.am             makefile.in-20070228073157-gkwqutuh9f3nq7s2-1
  csharp/ndbapi.i               
svn-v2:10@5fca6d9a-db22-0410-b55c-899b0a28da89-trunk-csharp%2fndb.i
  interface/Ndb.i                ndb.i-20070228021421-qkr4cbpxymyqdrf3-1
  perl/Makefile.am               makefile.am-20070228070325-lv4v4ey3018yr147-1
  perl/mgmapi.i                  mgmapi.i-20070415084702-pjs702i1rleb6otl-1
  perl/ndbapi.i                  ndb.i-20070225155255-5ief7aicto319mbu-1
  perl/swig/perl_callback_typemap.i perl_callback_typema-20070323110355-zppwqruk69m5t3hz-1
  perl/swig/perl_extend_ndbtransaction_async.i
perl_extend_ndbtrans-20070323110355-zppwqruk69m5t3hz-2
  ruby/mgmapi.i                  mgmapi.i-20070415091411-plc5gtpiwg93c2lx-1
  ruby/ndbapi.i                  ndb.i-20070228212451-7arjxk90dkwcn5xr-3
=== modified file 'Makefile.am'
--- a/Makefile.am	2007-11-04 21:32:20 +0000
+++ b/Makefile.am	2007-11-05 18:12:57 +0000
@@ -15,6 +15,9 @@
 if BUILD_RUBY_SUBDIR
   d_ruby = ruby
 endif
+if BUILD_PERL_SUBDIR
+  d_perl = perl
+endif
 if BUILD_PHP_SUBDIR
   d_php = php
 endif

=== modified file 'acinclude.m4'
--- a/acinclude.m4	2007-11-04 21:32:20 +0000
+++ b/acinclude.m4	2007-11-05 18:12:57 +0000
@@ -101,8 +101,9 @@
 
 AC_DEFUN([WITH_RUBY], [
 
-  AC_ARG_WITH([ruby],[--with-ruby],
-      [BULD NDB/Ruby @<:@default=yes@:>@],
+  AC_ARG_WITH([ruby],
+    [AS_HELP_STRING([--with-ruby],
+      [BULD NDB/Ruby @<:@default=yes@:>@])],
       [with_ruby=$withval],
       [with_ruby=ruby])
 
@@ -144,25 +145,29 @@
 ])
  
 AC_DEFUN([WITH_MYSQL], [ 
+
   AC_MSG_CHECKING(for mysql_config executable)
 
-  AC_ARG_WITH(mysql, [  --with-mysql=PATH	path to mysql_config binary or mysql prefix
dir], [
-	if test -x $withval -a -f $withval
-    then
-      MYSQL_CONFIG=$withval
-    elif test -x $withval/bin/mysql_config -a -f $withval/bin/mysql_config
-    then 
-     MYSQL_CONFIG=$withval/bin/mysql_config
-    fi
-  ], [
-AC_CHECK_PROGS(MYSQL_CONFIG,mysql_config)
-  ])
-
-  if test "x$MYSQL_CONFIG" = "x" 
-  then
-    AC_MSG_RESULT(not found)
-    exit 3
-  else
+  AC_ARG_WITH([mysql],
+    [AS_HELP_STRING([--with-mysql=PATH],
+        [path to mysql_config binary or mysql prefix dir])], 
+      [with_mysql=$withval],
+      [with_mysql=mysql_config])
+
+   AS_IF([test -x $with_mysql -a -f $with_mysql],
+      [ac_chk_mysql_config=$with_mysql],
+      [AS_IF([test -x $with_mysql/bin/mysql_config -a -f $with_mysql/bin/mysql_config],
+        [ac_chk_mysql_config=$with_mysql/bin/mysql_config])])
+        
+  AS_IF([test "x$with_mysql" = "xmysql_config"],
+    [ac_chk_mysql_config=$with_mysql])
+
+  AC_CHECK_PROGS(MYSQL_CONFIG,$ac_chk_mysql_config)
+
+  AS_IF([test "x$MYSQL_CONFIG" = "x"],
+    AC_MSG_ERROR([MySQL not found]))
+
+
     AC_PROG_CC
     AC_PROG_CXX
  
@@ -189,11 +194,9 @@
     AC_MSG_CHECKING(for NdbApi headers)
      AC_TRY_LINK([#include <NdbApi.hpp>], [int attr=NdbTransaction::Commit; ],
                         [ndbapi_found="yes"])
-    if test "$ndbapi_found" = "yes"  ; then 
-       AC_MSG_RESULT("found")
-    else
-       AC_MSG_ERROR([Couldn't find NdbApi.h!.])
-    fi
+    AS_IF([test "$ndbapi_found" = "yes"], 
+       [AC_MSG_RESULT("found")],
+       [AC_MSG_ERROR([Couldn't find NdbApi.h!])])
 
   
 
@@ -213,8 +216,6 @@
     AC_SUBST(MYSQL_CONFIG)
     
     AC_MSG_RESULT($MYSQL_CONFIG)
-  fi
-
 
   
 ])

=== modified file 'configure.in'
--- a/configure.in	2007-11-04 21:32:20 +0000
+++ b/configure.in	2007-11-05 18:12:57 +0000
@@ -22,8 +22,8 @@
 
 if test "$with_debug" = "yes"
 then
-  CXXFLAGS="-ggdb3 -Wall"
-  CFLAGS="-ggdb3 -Wall"
+  CXXFLAGS="-ggdb3 -Wall -I\${top_srcdir}"
+  CFLAGS="-ggdb3 -Wall -I\${top_srcdir}"
 else
   # -02 causes problems per SWIG... although I think we should get that fixed
   if test -z $CXXFLAGS ; then 

=== modified file 'csharp/Makefile.am'
--- a/csharp/Makefile.am	2007-10-11 08:35:50 +0000
+++ b/csharp/Makefile.am	2007-11-05 18:12:57 +0000
@@ -25,6 +25,6 @@
 .i.cpp: ${SWIG_SOURCES}
 	@mkdir -p $*
 	${SWIG} -csharp -dllimport libndbsharp -namespace MySql.Cluster.NdbApi \
-		-I$(SWIG_DIR) $(MYSQL_INCLUDES) -outdir $* -o $@ $<
+		-I$(top_srcdir) -I$(SWIG_DIR) $(MYSQL_INCLUDES) -outdir $* -o $@ $<
 #@cp NdbError.cs $*
 

=== modified file 'csharp/ndbapi.i'
--- a/csharp/ndbapi.i	2007-10-05 03:52:23 +0000
+++ b/csharp/ndbapi.i	2007-11-05 18:12:57 +0000
@@ -17,9 +17,8 @@
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-%module(directors="1") ndbapi
+%module ndbapi
 
-//%include "enums.swg"
 %include "enumtypesafe.swg"
 
 
@@ -114,6 +113,7 @@
 
 %{
 #define NDB_exception(excp,msg) { SWIG_CSharpSetPendingExceptionCustom(excp,msg); }
+#define NDB_exception_err(excp,msg,err) { SWIG_CSharpSetPendingExceptionCustom(excp,msg);
}
 %}
 
 %insert(runtime) %{
@@ -123,7 +123,6 @@
   typedef void (SWIGSTDCALL* CSharpExceptionCallback_t)(int excp, const char *);
   CSharpExceptionCallback_t customExceptionCallback = NULL;
 
-  
   extern "C" SWIGEXPORT
   void SWIGSTDCALL CustomExceptionRegisterCallback(CSharpExceptionCallback_t
customCallback) {
     customExceptionCallback = customCallback;
@@ -134,10 +133,24 @@
   static void SWIG_CSharpSetPendingExceptionCustom(int excp, const char *msg) {
     customExceptionCallback(excp, msg);
   }
+
+
 %}
 
+%typemap(ctype) (asynch_callback_t *) "AsynchCallback_t"
+%typemap(cstype) asynch_callback_t * "Object"
+%typemap(imtype) asynch_callback_t * "BaseCallback"
+%typemap(csin) asynch_callback_t * "(Object)$csinput"
+
+
 %pragma(csharp) imclasscode=%{
 
+   class AsynchHelper { 
+
+    public delegate void AsynchCallbackDelegate(int result, NdbTransaction theTrans);
+
+   }
+
   class CustomExceptionHelper {
     // C# delegate for the C/C++ customExceptionCallback
     public delegate void CustomExceptionDelegate(int excp, string message);
@@ -193,6 +206,28 @@
 %include "ndbglobals.i"
 %include "NdbFactory.i"
 
+%{
+#include <stdio.h>
+
+typedef void (SWIGSTDCALL* AsynchCallback_t)(int results, NdbTransaction * trans);
+
+typedef struct
+asynch_callback_t
+{  
+  AsynchCallback_t theCallback;
+  long long create_time;
+};
+
+
+  
+
+static void theCallBack(int result,
+                     NdbTransaction *trans,
+                     void *aObject)
+{
+}
+%}
+
 enum NdbException {
     BaseRuntimeError,
     NdbApiException,
@@ -262,3 +297,5 @@
 
 %include "NdbBlob.i"
 %include "NdbScanFilter.i"
+
+

=== modified file 'interface/Ndb.i'
--- a/interface/Ndb.i	2007-11-01 14:23:46 +0000
+++ b/interface/Ndb.i	2007-11-05 18:12:57 +0000
@@ -125,7 +125,11 @@
       if (result==(Uint64)-1) { 
 	NdbError err = arg1->getNdbError();
 	NDB_exception_err(NdbApiException,err.message,err);
-	return NULL;
+#if defined(SWIGPERL)
+	SWIG_croak_null();
+#else
+	return (Uint64)0;
+#endif
       }
   }
   Uint64 getAutoIncrementValue(const char* aTableName,

=== modified file 'perl/Makefile.am'
--- a/perl/Makefile.am	2007-05-08 18:04:53 +0000
+++ b/perl/Makefile.am	2007-11-05 18:12:57 +0000
@@ -11,7 +11,7 @@
 CLEANFILES=$(PERL_CRUFT) ${SWIG_OUTPUTS}
 MAINTAINERCLEANFILES=
 
-SWIG_OPTS=-perl5 $(DEFS) -outdir lib/mysql/cluster -I$(SWIG_DIR) -I$(srcdir)/swig
$(MYSQL_INCLUDES)
+SWIG_OPTS=-perl5 $(DEFS) -outdir lib/mysql/cluster -I${top_srcdir} -I$(SWIG_DIR)
-I$(srcdir)/swig $(MYSQL_INCLUDES)
 
 ndbapi/ndbapi_wrap.cpp lib/mysql/cluster/ndbapi.pm: ndbapi.i  $(SWIG_SOURCES) 
 	mkdir -p lib/mysql/cluster

=== modified file 'perl/mgmapi.i'
--- a/perl/mgmapi.i	2007-09-20 12:39:05 +0000
+++ b/perl/mgmapi.i	2007-11-05 18:12:57 +0000
@@ -31,4 +31,4 @@
 %}
 
 %include "mgmglobals.i"
-%include "NdbMgm.i"
+//%include "NdbMgm.i"

=== modified file 'perl/ndbapi.i'
--- a/perl/ndbapi.i	2007-07-25 14:16:35 +0000
+++ b/perl/ndbapi.i	2007-11-05 18:12:57 +0000
@@ -23,6 +23,7 @@
 %{
 
 #define NDB_exception(excp, msg) do { sv_setpvf(GvSV(PL_errgv),#excp " %s\n", msg);
SWIG_fail; } while (0)
+#define NDB_exception_err(excp, msg,err) do { sv_setpvf(GvSV(PL_errgv),#excp " %s\n",
msg); SWIG_fail; } while (0)
 
 #include <my_global.h>
 
@@ -45,7 +46,7 @@
 
 
 
-%include "../swig/Ndb.i"
+%include "Ndb.i"
 %include "NdbDictionary.i"
 %include "NdbTransaction.i"
 %include "perl_extend_ndbtransaction_async.i"
@@ -54,7 +55,7 @@
 %include "NdbIndexOperation.i"
 %include "NdbIndexScanOperation.i"
 %include "NdbEventOperation.i"
-%include "perl_ndbrecattr_typemap.i" 
+ //%include "perl_ndbrecattr_typemap.i" 
 %include "NdbRecAttr.i"
 %include "perl_extend_ndbrecattr.i"
 %include "NdbError.i"

=== modified file 'perl/swig/perl_callback_typemap.i'
--- a/perl/swig/perl_callback_typemap.i	2007-04-26 15:30:02 +0000
+++ b/perl/swig/perl_callback_typemap.i	2007-11-05 18:12:57 +0000
@@ -1,12 +1,31 @@
+%typemap(in) asynch_callback_t * {   
+
+  $1 = new asynch_callback_t;
+  $1->obj = $input;
+  $1->create_time = 0;
+  SvREFCNT_inc($input);
+ }
+
+
 %{
 /* This function matches the prototype of the normal C callback
    function for our widget. However, we use the clientdata pointer
    for holding a reference to a Perl callable object. */
 
-static void PerlCallBack(int result,
+
+typedef struct
+asynch_callback_t
+{  
+  SV * obj;
+  long long create_time;
+};
+
+static void theCallBack(int result,
 		     NdbTransaction *trans,
-		     void *perlFunc)
+		     void *cbData)
 {
+  asynch_callback_t * callback_data = (asynch_callback_t *)cbData;
+  SV * perlFunc = callback_data->obj;
   dSP;
   ENTER;
   SAVETMPS;
@@ -17,9 +36,10 @@
   SV* trans_obj = SWIG_NewPointerObj(SWIG_as_voidptr(trans), SWIGTYPE_p_NdbTransaction, 0
|  0 );
   XPUSHs(trans_obj);
   PUTBACK;
-  perl_call_sv( (SV*)perlFunc, G_VOID);
+  perl_call_sv( perlFunc, G_VOID);
   FREETMPS;
-  SvREFCNT_dec( (SV*)perlFunc );
+  SvREFCNT_dec( perlFunc );
+  delete callback_data;
   LEAVE;
 }
 

=== modified file 'perl/swig/perl_extend_ndbtransaction_async.i'
--- a/perl/swig/perl_extend_ndbtransaction_async.i	2007-05-08 18:32:56 +0000
+++ b/perl/swig/perl_extend_ndbtransaction_async.i	2007-11-05 18:12:57 +0000
@@ -1,7 +1,7 @@
 %extend NdbTransaction { 
 
 %feature("shadow") executeAsynchPrepare(ExecType execType,
-                            SV*                  pFcn,
+                            async_callback_t * cb,
                             AbortOption          abortOption = AbortOnError)
 %{
     sub executeAsynchPrepare {
@@ -16,12 +16,6 @@
     }
 %} 
 
-  void executeAsynchPrepare(ExecType    execType,
-                            SV*         pFcn,
-                            AbortOption abortOption = AbortOnError)
-  {
-    self->executeAsynchPrepare(execType,PerlCallBack,(void *)pFcn,abortOption);
SvREFCNT_inc(pFcn);
-  };
 };
 
 

=== modified file 'ruby/mgmapi.i'
--- a/ruby/mgmapi.i	2007-09-19 09:54:56 +0000
+++ b/ruby/mgmapi.i	2007-11-05 18:12:57 +0000
@@ -106,4 +106,4 @@
 
 //%apply ndb_logevent *OUTPUT { ndb_logevent *dst };
 
-%include "NdbMgm.i"
+//%include "NdbMgm.i"

=== modified file 'ruby/ndbapi.i'
--- a/ruby/ndbapi.i	2007-07-25 17:20:31 +0000
+++ b/ruby/ndbapi.i	2007-11-05 18:12:57 +0000
@@ -23,6 +23,12 @@
 
 %include "ndbglobals.i"
 
+%typemap(in) (asynch_callback_t * cb) { 
+
+  $1 = new asynch_callback_t; 
+  $1->obj = $input; 
+  $1->create_time = 0;
+ }
 %typemap(in) (const char* anInputString, size_t len) {
 
   $1 = STR2CSTR($input);
@@ -69,6 +75,7 @@
 %{ 
 
 #define NDB_exception(code,msg) do { ndb_raise_exception(code, msg); SWIG_fail; }
while(0);
+#define NDB_exception_err(code,msg,err) do { ndb_raise_exception(code, msg); SWIG_fail; }
while(0);
 
 #define getExceptionMethod(excptype,eparent) \
   SWIGINTERN VALUE \
@@ -130,13 +137,22 @@
   return exception;
 }
 
-static void RubyCallBack(int result, 
+typedef struct
+asynch_callback_t
+{  
+  VALUE obj;
+  long long create_time;
+};
+static void theCallBack(int result, 
                         NdbTransaction *trans,
                         void *aObject)
 {
-  VALUE cb_obj = (VALUE)aObject;
+  asynch_callback_t * callback_data = (asynch_callback_t *)aObject;
+
+  VALUE cb_obj = callback_data->obj;
   VALUE trans_obj = SWIG_NewPointerObj(SWIG_as_voidptr(trans), SWIGTYPE_p_NdbTransaction,
0 |  0 );
   rb_funcall(cb_obj,rb_intern("call"),1,trans_obj); //,trans);
+  delete callback_data; 
   
 }
  %}
@@ -147,14 +163,6 @@
 %include "NdbDictionary.i"
 %include "NdbTransaction.i"
 
-%extend NdbTransaction {
-  void executeAsynchPrepare(ExecType          execType,
-                            VALUE             cb_obj,
-                            AbortOption       abortOption = AbortOnError)
-  {
-    self->executeAsynchPrepare(execType,RubyCallBack,(void *)cb_obj,abortOption);
-  };
-};
 
 %include "NdbOperation.i"
 %include "NdbScanOperation.i"

Thread
Rev 235: Fixed various build issues across the source tree to make sure that make in the top level actually works. in http://bazaar.launchpad.net/~ndb...Monty Taylor5 Nov