Commits

Lars Yencken  committed 2f26d92

Updated build instructions to work for FreeBSD.

  • Participants
  • Parent commits 02e7c17

Comments (0)

Files changed (7)

     """ Check whether the correct libraries exist, and thus whether building
         is possible.
     """
-    # Detect OS X python installation, and attempt to correct for it.
-    if os.uname()[0] == 'Darwin':
+    # Some platform-specific customisations.
+    platform = os.uname()[0].lower()
+    if platform.endswith('bsd') or platform == 'darwin':
+        env.Append(CXXFLAGS='-DBSD ')
+
+    if platform == 'darwin':
+        # Extra build parameters for OS X 
         env.Replace(SHLINKFLAGS='$LINKFLAGS -bundle -flat_namespace -undefined suppress')
         env.Replace(SHLIBSUFFIX='.so')
-        env.Append(CXXFLAGS='-DDARWIN ')
+
+    print 'Configuring for platform: %s' % platform
 
     # Detect the presence of necessary dependencies.
     conf = Configure(env)
         print "Can't find standard math libraries."
         Exit(1)
 
+    if not conf.CheckLib('pthread'):
+        print "Can't find pthread."
+        Exit(1)
+
     if not conf.CheckLibWithHeader('cppunit', 'cppunit/ui/text/TestRunner.h',
             'c++'):
         print "Can't find cppunit."
 # Set up the compilation environment.
 env = Environment(
         SHLIBPREFIX='',
-        LIBS=['gomp'],
+        LIBS=['gomp', 'pthread'],
     )
+env.Append(CXXFLAGS='-DBSD ')
 
 environmentVars = (
         'CPATH',
     wcout << L"Reading from " << filename << endl;
     wifstream iStream(filename);
 
-#ifndef DARWIN
+#ifndef BSD
     iStream.imbue(locale(g_locale));
 #endif
 
     wcout << L"Writing to " << filename << endl;
     wcout << L"--> " << alignments.size() << L" records" << endl;
     wofstream oStream(filename);
-#ifndef DARWIN
+#ifndef BSD
     oStream.imbue(locale("en_US.UTF-8"));
 #endif
     if (!oStream) {

File src/kanjidic.cpp

 Kanjidic::Kanjidic(const char* filename)
 {
     wifstream iStream(filename);
-#ifndef DARWIN
+#ifndef BSD
     iStream.imbue(locale("en_US.UTF8"));
 #endif
     wchar_t* reading;

File src/main.cpp

 
 using namespace std;
 
-#ifdef DARWIN
+#ifdef BSD
 #include <locale.h>
 #endif
 
 
 int main(int argc, char *argv[])
 {
-#ifdef DARWIN
+#ifdef BSD
     setlocale(LC_CTYPE, g_locale);
 #else
     cout.imbue(locale(g_locale));

File src/platform.hpp

 
 //--------------------------------------------------------------------------//
 
-#ifdef DARWIN
+#ifdef BSD
 #define PLATFORM_CONST
 #else
 #define PLATFORM_CONST const

File src/tests/runTests.cpp

 int main(int argc, char *argv[])
 {
     ios::sync_with_stdio(false);
-#ifdef DARWIN
+#ifdef BSD
     setlocale(LC_CTYPE, "g_locale");
     // if (!setlocale(LC_CTYPE, "en_US.UTF8")) {
     //     wcerr << "Error: couldn't set the C locale to use utf8" << endl;

File src/tfIdfAligner.cpp

     int nFailed = 0;
     wofstream errorLog;
     errorLog.open("errors.log");
-#ifndef DARWIN
+#ifndef BSD
     errorLog.imbue(locale(g_locale));
 #endif