Changes to allow SRILM on Mac OS X.

By default, SRILM defines a function called zopen.

However, on Mac OS X (and possibly other BSDs),
<stdio.h> already defines a zopen function.

To resolve this conflict, SRILM checks to see if HAVE_ZOPEN is defined.
If it is, SRILM will rename its zopen function as my_zopen.

So, before importing any SRILM headers,
it is important to define HAVE_ZOPEN if we are on an Apple OS.
This commit is contained in:
Lane Schwartz 2013-08-28 12:39:47 -04:00
parent 08225d8e57
commit 8a726a9de4
2 changed files with 30 additions and 0 deletions

View File

@ -35,6 +35,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "moses/TypeDef.h"
#include "moses/Util.h"
// By default, SRILM defines a function called zopen.
//
// However, on Mac OS X (and possibly other BSDs),
// <stdio.h> already defines a zopen function.
//
// To resolve this conflict, SRILM checks to see if HAVE_ZOPEN is defined.
// If it is, SRILM will rename its zopen function as my_zopen.
//
// So, before importing any SRILM headers,
// it is important to define HAVE_ZOPEN if we are on an Apple OS:
//
#ifdef __APPLE__
#define HAVE_ZOPEN
#endif
#include "FNgramSpecs.h"
#include "FNgramStats.h"
#include "FactoredVocab.h"

View File

@ -31,6 +31,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "moses/Phrase.h"
#include "moses/StaticData.h"
// By default, SRILM defines a function called zopen.
//
// However, on Mac OS X (and possibly other BSDs),
// <stdio.h> already defines a zopen function.
//
// To resolve this conflict, SRILM checks to see if HAVE_ZOPEN is defined.
// If it is, SRILM will rename its zopen function as my_zopen.
//
// So, before importing any SRILM headers,
// it is important to define HAVE_ZOPEN if we are on an Apple OS:
//
#ifdef __APPLE__
#define HAVE_ZOPEN
#endif
#include "Vocab.h"
#include "Ngram.h"