]> git.lyx.org Git - lyx.git/blobdiff - src/support/lyxsum.C
another safety belt
[lyx.git] / src / support / lyxsum.C
index 9884c93d014b02c215f46eeefd6f14045493eb6e..f7e89fa200544eaa16c086a91650be70487c082e 100644 (file)
@@ -1,23 +1,32 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file lyxsum.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
- *           Copyright 2001 The LyX Team.
+ * \author Lars Gullik Bjønnes
  *
- * ======================================================
+ * Full author contact details are available in file CREDITS
  */
 
-
 #include <config.h>
 
-#include <algorithm>
-#include <boost/crc.hpp>
-
 #include "support/lyxlib.h"
 #include "debug.h"
 
+#include <algorithm>
+#include <boost/crc.hpp>
+
 using std::endl;
 
+// OK, this is ugly, but it is the only workaround I found to compile
+// with gcc (any version) on a system which uses a non-GNU toolchain.
+// The problem is that gcc uses a weak symbol for a particular
+// instantiation and that the system linker usually does not
+// understand those weak symbols (seen on HP-UX, tru64, AIX and
+// others). Thus we force an explicit instanciation of this particular
+// template (JMarc)
+template class boost::detail::crc_table_t<32, 0x04C11DB7, true>;
+
 // Various implementations of lyx::sum(), depending on what methods
 // are available. Order is faster to slowest.
 #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
@@ -32,12 +41,6 @@ using std::endl;
 #include <unistd.h>
 #include <sys/mman.h>
 
-using std::ifstream;
-using std::for_each;
-using std::istreambuf_iterator;
-using std::istream_iterator;
-using std::ios;
-
 
 unsigned long lyx::sum(string const & file)
 {
@@ -76,6 +79,8 @@ unsigned long lyx::sum(string const & file)
 #include <fstream>
 #include <iterator>
 
+using std::for_each;
+
 namespace {
 
 template<typename InputIterator>
@@ -107,6 +112,10 @@ unsigned long lyx::sum(string const & file)
        return do_crc(beg,end);
 }
 #else
+
+using std::istream_iterator;
+using std::ios;
+
 unsigned long lyx::sum(string const & file)
 {
        lyxerr[Debug::FILES]