On Thu, 2007-08-30 at 11:23 -0600, Charlie Savage wrote:

> But in the end, --enable-ruby --enable-python should build the bindings 
> whether SWIG is installed or not.
> 
> Is that more clear?
> 
> Charlie

I think so. Here's a patch for you to play with - make sure you have a
relatively recent version of autotools installed and run the autogen.sh
script.

By default, configure will not attempt to build the python or ruby
wrappers unless they are specifically enabled with --enable-python or
--enable-ruby. I have left the Makefiles in swig/python and swig/ruby as
they were so standard make rules should apply - so if geos_wrap.cxx
already exists and the timestamp is later than geos.i then the existing
(checked in) wrappers should be used. Otherwise updating geos.i should
cause the corresponding wrappers to be rebuilt upon the next make,
although I'm having trouble testing this as I only have an old version
of SWIG :(

One more thing - I also tweaked the Ruby macro so that the build fails
if the Ruby executable isn't found. Since the user is explicitly trying
to build with --enable-ruby, it seems silly to push on regardless if the
ruby interpreter isn't found.


HTH,

Mark.

-- 
ILande - Open Source Consultancy
http://www.ilande.co.uk

Index: configure.in
===================================================================
--- configure.in	(revision 2015)
+++ configure.in	(working copy)
@@ -119,20 +119,42 @@
 fi
 
 
+
+
 dnl --------------------------------------------------------------------
-dnl - check for swig 
+dnl - check whether python is required for the build
 dnl --------------------------------------------------------------------
 
-AC_ARG_ENABLE(swig, [  --disable-swig    Disable build of swig wrappers],
+AC_ARG_ENABLE(python, [  --enable-python    Enable build of python module],
 	[case "${enableval}" in
-		yes) use_swig=true ;;
-		no)  use_swig=false ;;
-		*) AC_MSG_ERROR(bad value ${enableval} for --enable-swig) ;;
+		yes) use_python=true ;;
+		no)  use_python=false ;;
+		*) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
 	esac],
-	[use_swig=true]
+	[use_python=false]
 )
 
-if test x"$use_swig" = xtrue; then
+
+dnl --------------------------------------------------------------------
+dnl - check whether ruby is required for the build
+dnl --------------------------------------------------------------------
+
+AC_ARG_ENABLE(ruby, [  --enable-ruby    Enable build of ruby module],
+	[case "${enableval}" in
+		yes) use_ruby=true ;;
+		no)  use_ruby=false ;;
+		*) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;;
+	esac],
+	[use_ruby=false]
+)
+
+
+dnl --------------------------------------------------------------------
+dnl - check for swig if python or ruby are enabled
+dnl --------------------------------------------------------------------
+
+use_swig=false
+if test x"$use_python" = xtrue || test x"$use_ruby" = xtrue; then
 	AC_PROG_SWIG(1.3.28)
 	if test x"$SWIG" = x; then
 		use_swig=false
@@ -140,32 +162,20 @@
 fi
 
 if test x"$use_swig" = xtrue; then
-	SWIG_ENABLE_CXX
+    SWIG_ENABLE_CXX
+    AC_SUBST(SWIG)	
 fi
+AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ])
 
 
-AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ])
-AC_SUBST(SWIG)
-
 dnl --------------------------------------------------------------------
-dnl - check for python 
+dnl - check for python if enabled
 dnl --------------------------------------------------------------------
 
-dnl See geos-devel/2007-February/002816.html
-AM_PATH_PYTHON(,,:)
-
-AC_ARG_ENABLE(python, [  --enable-python    Enable build of python module],
-	[case "${enableval}" in
-		yes) use_python=true ;;
-		no)  use_python=false ;;
-		*) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
-	esac],
-	[use_python=false]
-)
-
 if test x"$use_python" = xtrue; then
 	dnl Check for Python 
-	SWIG_PYTHON
+    AM_PATH_PYTHON	
+    SWIG_PYTHON
 
 	if test x"$PYTHON" = "x"; then
 		use_python=false
@@ -175,23 +185,13 @@
 	AC_SUBST(SWIG_PYTHON_CPPFLAGS)
 	AC_SUBST(SWIG_PYTHON_OPT)
 fi
-
 AM_CONDITIONAL(ENABLE_PYTHON, [test x"$use_python" = xtrue])
 
 
 dnl --------------------------------------------------------------------
-dnl - check for ruby 
+dnl - check for ruby if enabled
 dnl --------------------------------------------------------------------
 
-AC_ARG_ENABLE(ruby, [  --enable-ruby    Enable build of ruby module],
-	[case "${enableval}" in
-		yes) use_ruby=true ;;
-		no)  use_ruby=false ;;
-		*) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;;
-	esac],
-	[use_ruby=false]
-)
-
 if test x"$use_ruby" = xtrue; then
 	dnl Check for Ruby 
 	AC_RUBY_DEVEL
Index: macros/ruby.m4
===================================================================
--- macros/ruby.m4	(revision 2015)
+++ macros/ruby.m4	(working copy)
@@ -16,7 +16,7 @@
   AC_PATH_PROG([RUBY],[ruby])
   
   if test -z "$RUBY" ; then
-		AC_MSG_WARN([Could not find ruby interpreter.])
+		AC_MSG_ERROR([Could not find ruby interpreter.])
     RUBY=''
   else
 		dnl Get Ruby version number
_______________________________________________
geos-devel mailing list
geos-devel@geos.refractions.net
http://geos.refractions.net/mailman/listinfo/geos-devel

Reply via email to