I haven't checked whether this bug has been fixed in SWIG's
Subversion repository yet (but it wasn't present in SWIG 1.3.28).
2006-07-04 Roland Levillain <roland(a)lrde.epita.fr>
Work around a bug in SWIG 1.3.29.
* generate_arith_instantiations.py (write_algorithms)
* generate_morpho_instantiations.py (write_algorithms): Work
around a bug in SWIG 1.3.29 in the generation of C++ wrappers.
Index: 10.229/tools/swilena/generate_morpho_instantiations.py
--- 10.229/tools/swilena/generate_morpho_instantiations.py Fri, 30 Jun 2006 17:26:15 +0200 levill_r (oln/v/24_generate_m 1.8.1.1 700)
+++ 10.229(w)/tools/swilena/generate_morpho_instantiations.py Mon, 03 Jul 2006 12:23:42 +0200 levill_r (oln/v/24_generate_m 1.8.1.1 700)
@@ -57,7 +57,13 @@
"ntg_int_u8", "ntg_int_u32",
"ntg_int_s8", "ntg_int_s32",
"ntg_float" ]:
- img_type = "::oln::image%(dim)sd< %(type)s >" % vars()
+ # FIXME: SWIG 1.3.29 Bug. We used to refer to `oln::image' from
+ # the global (top-level) namespace, i.e. `::oln::image',
+ # but it makes swig 1.3.29 generate invalid C++ code when
+ # used ad a template argument: the space between `<' and
+ # `::' is eaten by swig, and `<:' is understood as a
+ # trigraph (for `[') by the C++ compiler.
+ img_type = "oln::image%(dim)sd< %(type)s >" % vars()
win_type = "::oln::window%(dim)sd" % vars()
neighb_type = "::oln::neighborhood%(dim)sd" % vars()
@@ -135,10 +141,12 @@
instantiate(idx, "top_hat_contrast_op", img_type, img_type, win_type)
instantiate(idx, "fast_top_hat_contrast_op", img_type, img_type, win_type)
# Watershed
- img_ret_type = "::oln::image%(dim)sd< ntg_int_u32 >" % vars()
+ # FIXME: SWIG 1.3.29 Bug (same as above).
+ img_ret_type = "oln::image%(dim)sd< ntg_int_u32 >" % vars()
instantiate(idx, "watershed_seg", img_ret_type, img_type, neighb_type)
instantiate(idx, "watershed_con", img_ret_type, img_type, neighb_type)
- bin_img_type = "::oln::image%(dim)sd< ntg_bin >" % vars()
+ # FIXME: SWIG 1.3.29 Bug (same as above).
+ bin_img_type = "oln::image%(dim)sd< ntg_bin >" % vars()
instantiate(idx, "sure_minima_imposition", img_type, img_type, bin_img_type, neighb_type)
instantiate(idx, "sequential_minima_imposition", img_type, img_type, bin_img_type, neighb_type)
instantiate(idx, "hybrid_minima_imposition", img_type, img_type, bin_img_type, neighb_type)
Index: 10.229/tools/swilena/generate_arith_instantiations.py
--- 10.229/tools/swilena/generate_arith_instantiations.py Fri, 30 Jun 2006 17:26:15 +0200 levill_r (oln/v/51_generate_a 1.1.1.1 700)
+++ 10.229(w)/tools/swilena/generate_arith_instantiations.py Mon, 03 Jul 2006 11:44:33 +0200 levill_r (oln/v/51_generate_a 1.1.1.1 700)
@@ -59,13 +59,19 @@
"ntg_int_u8", "ntg_int_u32",
"ntg_int_s8", "ntg_int_s32",
"ntg_float" ]:
- img_type = "::oln::image%(dim)sd< %(type)s >" % vars()
+ # FIXME: SWIG 1.3.29 Bug. We used to refer to `oln::image' from
+ # the global (top-level) namespace, i.e. `::oln::image',
+ # but it makes swig 1.3.29 generate invalid C++ code when
+ # used ad a template argument: the space between `<' and
+ # `::' is eaten by swig, and `<:' is understood as a
+ # trigraph (for `[') by the C++ compiler.
+ img_type = "oln::image%(dim)sd< %(type)s >" % vars()
bigger_type = get_bigger_type(type)
- return_img_type = "::oln::image%(dim)sd< %(bigger_type)s >" % vars()
+ return_img_type = "oln::image%(dim)sd< %(bigger_type)s >" % vars()
# FIXME: these algorithms do not work with bin
if type != "ntg_bin":
- for algo in [ "plus", "minus", "times", "div" ]:
+ for algo in [ "plus", "minus", "times", "div" ]:
instantiate(dim, algo, return_img_type, img_type, img_type)
instantiate(dim, "min", return_img_type, img_type, img_type)
2006-07-13 Roland Levillain <roland(a)lrde.epita.fr>
* ruby/ltrequire.rb: Add copyright header.
--- 10.243/tools/swilena/ruby/ltrequire.rb Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/w/42_ltrequire. 1.1 644)
+++ 10.244/tools/swilena/ruby/ltrequire.rb Thu, 13 Jul 2006 16:20:10 +0200 levill_r (oln/w/42_ltrequire. 1.2 644)
@@ -1,3 +1,20 @@
+# Copyright (C) 2006 EPITA Research and Development Laboratory.
+#
+# This file is part of the Olena Library. This library is free
+# software; you can redistribute it and/or modify it under the terms
+# of the GNU General Public License version 2 as published by the
+# Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this library; see the file COPYING. If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02111-1307, USA.
+
# Extension of the Kernel.require method understanding Libtool libraries.
# Inspired by ltihooks.py.
2006-07-12 Roland Levillain <roland(a)lrde.epita.fr>
Add missing SWIG interfaces to the distribution.
* expand.sh (EXTRA_DIST_MODULES): New.
Add modules basics1d, basics2d and basics3d.
Include them in the distribution.
--- 10.242/tools/swilena/expand.sh Tue, 11 Jul 2006 15:29:25 +0200 levill_r (oln/s/25_expand.sh 1.20 700)
+++ 10.243/tools/swilena/expand.sh Wed, 12 Jul 2006 12:39:41 +0200 levill_r (oln/s/25_expand.sh 1.21 700)
@@ -10,6 +10,7 @@
mkdir -p "$SWILENA/ruby"
MODULES="$MODULES ntg"
+EXTRA_DIST_MODULES=
for dim in 1 2 3; do
## C++ header inclusions for basic types.
@@ -19,6 +20,9 @@
%include swilena_basics.i
decl_basics($dim)
EOF
+ # Have Automake include these modules in the distribution, but
+ # don't create SWIG wrappers for them.
+ EXTRA_DIST_MODULES="$EXTRA_DIST_MODULES basics${dim}d"
## {1d,2d,3d} families
for mod in point structelt w_win imagesize image; do
@@ -277,7 +281,7 @@
dump_src() {
echo -n "EXTRA_DIST ="
ilist=0
- for mod in $MODULES; do
+ for mod in $MODULES $EXTRA_DIST_MODULES; do
if [ -r "$SWILENA/src/swilena_${mod}.i" ]; then
if [ `expr $ilist % 4` = 0 ]; then
echo " \\"
2006-07-11 Roland Levillain <roland(a)lrde.epita.fr>
Use Libtool.
* config/oln.m4 (AC_SHARED_LDFLAGS): Remove.
* configure.ac: No longer use AC_SHARED_LDFLAGS.
Use AC_PROG_LIBTOOL.
Index: 10.239/configure.ac
--- 10.239/configure.ac Fri, 07 Jul 2006 18:18:48 +0200 levill_r (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.8 600)
+++ 10.240/configure.ac Tue, 11 Jul 2006 15:25:21 +0200 levill_r (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.9 600)
@@ -23,6 +23,9 @@
AC_PROG_RANLIB
AC_PROG_CC
+# Use Libtool to build Swilena's dynamic modules.
+AC_PROG_LIBTOOL
+
# If available, use these.
AC_WITH_CXX_ZLIB
AC_WITH_CXX_FFTW
@@ -388,8 +391,6 @@
AC_CHECK_SWIG_FLAGS
- AC_SHARED_LDFLAGS
-
AC_ARG_VAR([DVIPS], [program to make Postscript from TeX DVI files])
AC_CHECK_PROGS([DVIPS], [dvips], [$am_aux_dir/missing dvips])
AC_ARG_VAR([TEXI2DVI], [program to create DVI from Texinfo files])
Index: 10.239/config/oln.m4
--- 10.239/config/oln.m4 Fri, 07 Jul 2006 18:18:48 +0200 levill_r (oln/j/15_oln.m4 1.38.1.14 600)
+++ 10.240/config/oln.m4 Tue, 11 Jul 2006 15:25:21 +0200 levill_r (oln/j/15_oln.m4 1.38.1.15 600)
@@ -650,54 +650,6 @@
AC_LANG_POP([C++])
])
-# AC_SHARED_LDFLAGS
-
-# Queries the linker and set the required LDFLAGS for creating a
-# shared library.
-
-# FIXME: This is a simple hack to have Swilena compile on our main
-# targets (GNU/Linux/IA-32, Mac OS X/PowerPC). We should obviously
-# use Libtool instead, as it handle a whole lot more
-# linkers and parameters.
-
-AC_DEFUN([AC_SHARED_LDFLAGS],
-[dnl
- AC_CACHE_CHECK([for linker flags to create a shared library],
- [ac_cv_ld_style],
- [ac_cv_ld_style=unknown
- # FIXME: We should not use a hard-coded name for the
- # linker, but I can't find a means to get the (C++) linker
- # from Autoconf.
- if ld -v 2>&1 | grep -i "Apple Computer" >/dev/null 2>&1;
- then
- ac_cv_ld_style=Apple
- elif ld -v 2>&1 | grep -i "GNU" >/dev/null 2>&1; then
- ac_cv_ld_style=GNU
- else
- ac_cv_ld_style=other
- fi])
-
- case "$ac_cv_ld_style" in
- GNU)
- _SHARED_LDFLAGS="-shared"
- ;;
- Apple)
- # Seen on http://www.penzilla.net/tutorials/python/swig/.
- _SHARED_LDFLAGS="-bundle -flat_namespace -undefined suppress"
- ;;
- other)
- # Default: assume we're using GNU ld.
- _SHARED_LDFLAGS="-shared"
- ;;
- esac
-
- if test ! ${SHARED_LDFLAGS+set}; then
- SHARED_LDFLAGS=$_SHARED_LDFLAGS
- fi
-
- AC_SUBST([SHARED_LDFLAGS])
-])
-
###
### Internal stuff for Olena
###
I'll try to use Libtool in Olena 0.10a (soon) to replace this hack.
2006-07-07 Roland Levillain <roland(a)lrde.epita.fr>
Add an Autoconf macro to figure out what are the linker flags for
creating a shared library. This is actually a hack, hopefully
replaced by Libtool in a future update.
* config/oln.m4 (AC_SHARED_LDFLAGS): New macro.
* configure.ac: Use it.
Save CPPFLAGS before altering them.
Index: 10.236/configure.ac
--- 10.236/configure.ac Thu, 24 Jun 2004 18:10:23 +0200 odou_s (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.7 600)
+++ 10.237/configure.ac Fri, 07 Jul 2006 18:18:48 +0200 levill_r (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.8 600)
@@ -388,6 +388,8 @@
AC_CHECK_SWIG_FLAGS
+ AC_SHARED_LDFLAGS
+
AC_ARG_VAR([DVIPS], [program to make Postscript from TeX DVI files])
AC_CHECK_PROGS([DVIPS], [dvips], [$am_aux_dir/missing dvips])
AC_ARG_VAR([TEXI2DVI], [program to create DVI from Texinfo files])
@@ -438,6 +440,7 @@
echo $line
fi
done`"])
+ save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $RUBY_CPPFLAGS"
AC_CHECK_HEADERS([ruby.h],,
AC_MSG_ERROR(
Index: 10.236/config/oln.m4
--- 10.236/config/oln.m4 Tue, 04 Jul 2006 13:33:04 +0200 levill_r (oln/j/15_oln.m4 1.38.1.13 600)
+++ 10.237/config/oln.m4 Fri, 07 Jul 2006 18:18:48 +0200 levill_r (oln/j/15_oln.m4 1.38.1.14 600)
@@ -650,6 +650,54 @@
AC_LANG_POP([C++])
])
+# AC_SHARED_LDFLAGS
+
+# Queries the linker and set the required LDFLAGS for creating a
+# shared library.
+
+# FIXME: This is a simple hack to have Swilena compile on our main
+# targets (GNU/Linux/IA-32, Mac OS X/PowerPC). We should obviously
+# use Libtool instead, as it handle a whole lot more
+# linkers and parameters.
+
+AC_DEFUN([AC_SHARED_LDFLAGS],
+[dnl
+ AC_CACHE_CHECK([for linker flags to create a shared library],
+ [ac_cv_ld_style],
+ [ac_cv_ld_style=unknown
+ # FIXME: We should not use a hard-coded name for the
+ # linker, but I can't find a means to get the (C++) linker
+ # from Autoconf.
+ if ld -v 2>&1 | grep -i "Apple Computer" >/dev/null 2>&1;
+ then
+ ac_cv_ld_style=Apple
+ elif ld -v 2>&1 | grep -i "GNU" >/dev/null 2>&1; then
+ ac_cv_ld_style=GNU
+ else
+ ac_cv_ld_style=other
+ fi])
+
+ case "$ac_cv_ld_style" in
+ GNU)
+ _SHARED_LDFLAGS="-shared"
+ ;;
+ Apple)
+ # Seen on http://www.penzilla.net/tutorials/python/swig/.
+ _SHARED_LDFLAGS="-bundle -flat_namespace -undefined suppress"
+ ;;
+ other)
+ # Default: assume we're using GNU ld.
+ _SHARED_LDFLAGS="-shared"
+ ;;
+ esac
+
+ if test ! ${SHARED_LDFLAGS+set}; then
+ SHARED_LDFLAGS=$_SHARED_LDFLAGS
+ fi
+
+ AC_SUBST([SHARED_LDFLAGS])
+])
+
###
### Internal stuff for Olena
###