Skip to content

Commit

Permalink
Removed dependency on Google sparsehash. Just use unordered_map.
Browse files Browse the repository at this point in the history
Updates to configure/make util.cc and options for provisional
OSX support.
  • Loading branch information
joespitch committed Oct 21, 2015
1 parent 1c78064 commit deb5899
Show file tree
Hide file tree
Showing 20 changed files with 80 additions and 6,009 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ CONTACT: [email protected]
* OpenFst (Prefer >= 1.4)

### Basic Build [Linux]: ###
Use the existing setup. This should be fine for more linux installations.
Use the existing setup. This should be fine for most Linux distributions
as well as newer versions of OSX.
```
$ cd src/
$ ./configure
Expand Down
19 changes: 14 additions & 5 deletions src/.autoconf/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,20 @@ CC=g++

UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
LIBS=-lfst -ldl -lm -Wall -Wno-sign-compare -Wno-unused-local-typedefs
#Check if we have actual GCC or a 'fake'. If we have the real thing,
# then compile with OpenMP support
REALGCC=$(shell g++ --version 2>&1 | grep -i LLVM)
ifeq ($(REALGCC), )
LIBS += -fopenmp
else
CFLAGS ?= -DFAKEGCC
endif
LIBS += -lfst -lm -ldl
CC=g++ -std=c++0x -Wall -Wno-sign-compare
endif

ifeq ($(UNAME), Linux)
LIBS=-lfst -ldl -lm -lrt
LIBS=-lfst -ldl -lm -lrt -fopenmp
CC=g++ -std=c++0x -Wall -Wno-sign-compare -Wno-unused-local-typedefs
endif

Expand All @@ -52,7 +61,7 @@ OUT =: $(OBJS) $(BINDIR)/phonetisaurus-align $(BINDIR)/phonetisaurus-arpa2wfst \
$(BINDIR)/phonetisaurus-g2prnn $(BINDIR)/rnnlm

CFLAGS ?= -O2
THIRD_PARTIES_INCLUDE ?= -I3rdparty/sparsehash -I3rdparty/utfcpp \
THIRD_PARTIES_INCLUDE ?= -I3rdparty/utfcpp \
-I3rdparty/rnnlm -I$(OPENFST_CXXFLAGS)

EXTRA := $(CFLAGS) $(THIRD_PARTIES_INCLUDE) $(CXXFLAGS) $(CPPFLAGS)
Expand Down Expand Up @@ -97,7 +106,7 @@ $(BINDIR)/phonetisaurus-g2prnn: $(LIBDIR)/rnnlmlib.o bin/phonetisaurus-g2prnn.cc
include/RnnLMDecoder.h include/LegacyRnnLMDecodable.h $(LIBDIR)/util.o
$(CC) $(EXTRA) $(LIBS) -L$(OPENFST_LDFLAGS) -I3rdparty/rnnlm -I3rdparty/utfcpp \
-funroll-loops -I$(ROOT) -ffast-math $(LIBDIR)/util.o $(LIBDIR)/rnnlmlib.o \
bin/phonetisaurus-g2prnn.cc -fopenmp -o bin/phonetisaurus-g2prnn $(LIBS)
bin/phonetisaurus-g2prnn.cc -o bin/phonetisaurus-g2prnn $(LIBS)

#RNNLM library
bin/rnnlm: $(BINDIR)/rnnlm.cc $(LIBDIR)/rnnlmlib.o
Expand Down Expand Up @@ -132,6 +141,6 @@ test:

#Cleanup
clean:
$(RM) $(OUT) $(TMP) .autoconf/config.log \
$(RM) -r $(OUT) $(TMP) .autoconf/config.log \
.autoconf/config.status .autoconf/autom4te.cache/

25 changes: 17 additions & 8 deletions src/.autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ AC_ARG_WITH([openfst-libs],
echo "Set default OpenFst libs: $default_openfst_libs"])
AC_SUBST([OPENFST_LDFLAGS])
#First check OpenFst is actually there
AS_IF([test ! -e "$with_openfst_libs""/libfst.so"],
[AC_MSG_ERROR([OpenFst libs not found: \
--with-openfst-libs=$with_openfst_libs \
Did you specify --with-openfst-libs?])])
AS_IF([test -e "$with_openfst_libs""/libfst.so"],
[AC_MSG_RESULT([Found basic OpenFst installation.])],
[AS_IF([test -e "$with_openfst_libs""/libfst.dylib"],
[AC_MSG_RESULT([Found basic OSX OpenFst installation.])],
[AC_MSG_ERROR([OpenFst libs not found: \
--with-openfst-libs=$with_openfst_libs \
Did you specify --with-openfst-libs?])])])
#Test all the extensions - tell the user how it *should* be compiled
# -a -e "$with_openfst_libs/fst/libfstpdtscript.so" \
AS_IF([test -e "$with_openfst_libs/fst/libfstconst.so" \
Expand All @@ -60,10 +63,16 @@ AS_IF([test -e "$with_openfst_libs/fst/libfstconst.so" \
-a -e "$with_openfst_libs/fst/libfstlookahead.so" \
-a -e "$with_openfst_libs/fst/libfstlinearscript.so"],
[AC_MSG_RESULT([Found all required OpenFst extensions.])],
[AC_MSG_ERROR([Can't find one or more extensions. OpenFst should \
have been configured with the following flags: \
--enable-static --enable-shared --enable-far --enable-lookahead-fsts \
--enable-const-fsts --enable-pdt --enable-ngram-fsts --enable-linear-fsts])])
[AS_IF([test -e "$with_openfst_libs/fst/libfstconst.dylib" \
-a -e "$with_openfst_libs/fst/libfstfar.dylib" \
-a -e "$with_openfst_libs/fst/libfstngram.dylib" \
-a -e "$with_openfst_libs/fst/libfstlookahead.dylib" \
-a -e "$with_openfst_libs/fst/libfstlinearscript.dylib"],
[AC_MSG_RESULT([Found all required OSX OpenFst extensions.])],
[AC_MSG_ERROR([Can't find one or more extensions. OpenFst should \
have been configured with the following flags: \
--enable-static --enable-shared --enable-far --enable-lookahead-fsts \
--enable-const-fsts --enable-pdt --enable-ngram-fsts --enable-linear-fsts])])])

#Set the default install directories
default_install_bin=/usr/local/bin
Expand Down
Loading

0 comments on commit deb5899

Please sign in to comment.