How OpenFst and dl libraries were added under HFST

(1) Make directories openfst and dlfcn under hfst3 root.

(2) Copy OpenFst win32 version source files under openfst, go to openfst and delete everything except and directory src.

(3) Add the line AUTOMAKE_OPTIONS=subdir-objects to

(4) Go to directory src and rewrite as


(5) Delete everything except and directories include and lib.

(6) Go to directory lib, delete and rewrite as

AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../../../dlfcn $(ICU_CPPFLAGS) \

libfst_la_SOURCES = \

(7) Go to directory include and delete

(8) Download the dlfcn library and copy the files dlfcn.c and dlfcn.h to directory dlfcn. Go to directory dlfcn and make the following changes to the file dlfcn.h: Find the lines

#ifndef DLFCN_H
#define DLFCN_H

and add there three lines so that it becomes

#ifndef DLFCN_H
#define DLFCN_H
#ifdef __cplusplus
extern "C" {

Find at the end of the file the line

#endif /* DLFCN_H */

and add there three lines so that it becomes

#ifdef __cplusplus
#endif /* DLFCN_H */

(9) Write as


libdl_la_SOURCES = dlfcn.c

(10) Add dlfcn and openfst to SUBDIRS variable of top-level

Also add ../../openfst/src/lib/ and ../../dlfcn/ to libhfst_la_LIBADD

(11) Make the following changes to

Comment or delete the following lines:

                            [process weighted fsts with OpenFst @<:@default=yes@:>@])],
AS_IF([test "x$with_openfst" != xno], [AC_DEFINE([HAVE_OPENFST], [1],
                                              [Define to compile OpenFst support in HFST])])
AM_CONDITIONAL([WANT_OPENFST], [test x$with_openfst != xno])


AS_IF([test "x$with_openfst" != "xno"],
      [AC_CHECK_LIB([pthread], [main])]
      [AC_CHECK_LIB([dl], [main])]
      [AC_CHECK_LIB([fst], [main], [],
                 [AC_MSG_FAILURE([openfst test failed (--without-openfst to disable)])])]
      [AC_CHECK_LIB([m], [main])])

Add the following files to AC_CONFIG_FILES:


-- ErikAxelson - 2012-08-22

Topic revision: r2 - 2014-02-24 - ErikAxelson
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback