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
###