since Gentoo is a from-source distribution, we do a lot of compiling ...
as such, our maintainers often have to fix bugs in autotool source files
in misc packages (bugs in say configure.ac, not bugs in autoconf).  thus
it is not uncommon that we re-run portions of autotools so that we dont
have huge patches against generated files (like configure or
Makefile.in).

since autotools can be a bit on the confusing side for people who are
not familiar with them, we hit many cases of package maintainers
regenerating some autotool files, but not all of them.  so we would 
hit cases where the libtool code in configure was from a diff version
of libtool than the ltmain.sh file.  the end result was that we would
see weird packing issues were say shared libraries were being created
without a '.so' extension.

our solution was to patch libtool in Gentoo with a sanity check where
configure would grep the version written in the ltmain.sh file and if
it did not match the version in configure, the process bail out with
a fun error message.

find attached said patch written by Martin Schlemmer and myself (well,
mostly Martin ;D) against cvs.
-mike
2005-12-11  Martin Schlemmer  <[EMAIL PROTECTED]>

        * libltdl/m4/libtool.m4 (_LT_VERSION_CHECK): sanity check to make
        sure libtool.m4 version matches ltmain.sh version.
        (LT_INIT): execute new _LT_VERSION_CHECK function.

Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.51
diff -u -r1.51 libtool.m4
--- libltdl/m4/libtool.m4       8 Dec 2005 04:17:02 -0000       1.51
+++ libltdl/m4/libtool.m4       8 Dec 2005 19:41:08 -0000
@@ -68,6 +68,7 @@
 AC_REQUIRE([LTVERSION_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
 m4_require([_LT_SET_OPTIONS], [_LT_SET_OPTIONS([$1])])dnl
+AC_REQUIRE([_LT_VERSION_CHECK])dnl
 
 # This can be used to rebuild libtool when needed
 LIBTOOL_DEPS="$ltmain"
@@ -115,6 +116,34 @@
 : ${MV="mv -f"}
 : ${RM="rm -f"}
 ])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_VERSION_CHECK
+# -----------------
+# Check that we do not have a version mismatch between libtool.m4 and
+# ltmain.sh.
+# Note that this should be called after _LT_PROG_LTMAIN have setup $ltmain,
+# but *before* _LT_SETUP so that libtool is not created.
+AC_DEFUN([_LT_VERSION_CHECK],
+[AC_REQUIRE([_LT_PROG_LTMAIN])dnl
+AC_BEFORE([$0], [_LT_SETUP])dnl
+
+AC_MSG_CHECKING([for correct ltmain.sh version])
+_ltmain_version=`grep '^[[     ]]*VERSION=' $ltmain | sed -e 's/^[[    
]]*VERSION=//'`
+if test X"${_ltmain_version+set}" != Xset ; then
+  AC_MSG_RESULT([no])
+  AC_MSG_ERROR([could not determine ltmain.sh version])
+fi
+
+_lt_m4_verion=m4_quote(m4_defn([LT_PACKAGE_VERSION]))
+if test "X$_lt_m4_verion" = "X$_ltmain_version" ; then
+  AC_MSG_RESULT([yes])
+else
+  AC_MSG_RESULT([no])
+  AC_MSG_ERROR([ltmain.sh version mismatch
+Try running 'libtoolize -c -f; aclocal; autoconf' and then try again'])
+fi
+])# _LT_VERSION_CHECK
 
 
 # _LT_SETUP
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool

Reply via email to