1 AC_INIT([OpenFst], [1.7.7], [help@www.openfst.org])
2 AM_INIT_AUTOMAKE([foreign nostdinc -Wall -Werror subdir-objects])
6 # This library does not throw exceptions, so we do not generate exception
7 # handling code. However, users are free to re-enable exception handling.
8 CXX="$CXX -std=c++11 -fno-exceptions"
13 AC_CONFIG_HEADERS([config.h src/include/fst/config.h])
14 AC_CONFIG_SRCDIR([src/lib/fst.cc])
22 src/extensions/Makefile
23 src/extensions/compact/Makefile
24 src/extensions/compress/Makefile
25 src/extensions/const/Makefile
26 src/extensions/far/Makefile
27 src/extensions/linear/Makefile
28 src/extensions/lookahead/Makefile
29 src/extensions/mpdt/Makefile
30 src/extensions/ngram/Makefile
31 src/extensions/pdt/Makefile
32 src/extensions/python/Makefile
33 src/extensions/special/Makefile
36 AC_CONFIG_MACRO_DIR([m4])
39 AC_ARG_ENABLE([compact-fsts],
40 [AS_HELP_STRING([--enable-compact-fsts],
41 [enable CompactFst extensions])],
43 [enable_compact_fsts=no])
44 AM_CONDITIONAL([HAVE_COMPACT], [test "x$enable_compact_fsts" != xno])
46 AC_ARG_ENABLE([compress],
47 [AS_HELP_STRING([--enable-compress],
48 [enable compression extension])],
51 AM_CONDITIONAL([HAVE_COMPRESS], [test "x$enable_compress" != xno])
53 AC_ARG_ENABLE([const-fsts],
54 [AS_HELP_STRING([--enable-const-fsts],
55 [enable ConstFst extensions])],
57 [enable_const_fsts=no])
58 AM_CONDITIONAL([HAVE_CONST], [test "x$enable_const_fsts" != xno])
61 [AS_HELP_STRING([--enable-far], [enable FAR extensions])],
64 AM_CONDITIONAL([HAVE_FAR], [test "x$enable_far" != xno])
66 AC_ARG_ENABLE([linear-fsts],
67 [AS_HELP_STRING([--enable-linear-fsts],
68 [enable LinearTagger/ClassifierFst extensions])],
70 [enable_linear_fsts=no])
71 AM_CONDITIONAL([HAVE_LINEAR], [test "x$enable_linear_fsts" != xno])
73 AC_ARG_ENABLE([lookahead-fsts],
74 [AS_HELP_STRING([--enable-lookahead-fsts],
75 [enable LookAheadFst extensions])],
77 [enable_lookahead_fsts=no])
78 AM_CONDITIONAL([HAVE_LOOKAHEAD], [test "x$enable_lookahead_fsts" != xno])
81 [AS_HELP_STRING([--enable-mpdt],
82 [enable MPDT extensions])],
85 AM_CONDITIONAL([HAVE_MPDT], [test "x$enable_mpdt" != xno])
87 AC_ARG_ENABLE([ngram-fsts],
88 [AS_HELP_STRING([--enable-ngram-fsts],
89 [enable NGramFst extension])],
91 [enable_ngram_fsts=no])
92 AM_CONDITIONAL([HAVE_NGRAM], [test "x$enable_ngram_fsts" != xno])
95 [AS_HELP_STRING([--enable-pdt],
96 [enable PDT extensions])],
99 AM_CONDITIONAL([HAVE_PDT], [test "x$enable_pdt" != xno])
101 AC_ARG_ENABLE([python],
102 [AS_HELP_STRING([--enable-python],
103 [enable Python extensions])],
106 AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" != xno])
107 if test "x$enable_python" != xno; then
109 AC_PYTHON_DEVEL([>= '2.7'])
112 AC_ARG_ENABLE([special],
113 [AS_HELP_STRING([--enable-special],
114 [enable special-matcher extensions])],
117 AM_CONDITIONAL([HAVE_SPECIAL], [test "x$enable_special" != xno])
119 # --enable-bin enables script and bin "extensions".
121 [AS_HELP_STRING([--enable-bin],
122 [enable fst::script and command-line binaries])],
125 AM_CONDITIONAL([HAVE_BIN], [test "x$enable_bin" != xno])
126 AM_CONDITIONAL([HAVE_SCRIPT], [test "x$enable_bin" != xno])
128 # --enable-fsts is an alias to enable FST SO extensions: compact, const,
129 # linear, lookahead, and ngram.
130 AC_ARG_ENABLE([fsts],
131 [AS_HELP_STRING([--enable-fsts],
132 [enable all FST SOs])],
135 AM_CONDITIONAL([HAVE_FSTS], [test "x$enable_fsts" != xno])
137 # --enable-grm is an alias to enable all dependencies of OpenGrm: far, mpdt,
140 [AS_HELP_STRING([--enable-grm],
141 [enable all dependencies of OpenGrm])],
144 AM_CONDITIONAL([HAVE_GRM], [test "x$enable_grm" != xno])
146 AC_ARG_WITH([libfstdir],
147 [--with-libfstdir[=DIR] fst dynamic extensions [[LIBDIR/fst]]],
148 [], [with_libfstdir=[${libdir}/fst]])
150 AC_SUBST([libfstdir], $with_libfstdir)
152 # Flags may be changed after configuring, so this is checked again by
153 # weight_test.cc. The check here is to save time in the common case,
154 # or when someone does not run `make check`.
155 AC_RUN_IFELSE([AC_LANG_PROGRAM([
158 template <typename T>
159 bool FloatEqIsReflexive(T m) {
160 volatile T x = 1.111;
169 volatile double test_value = 1.1;
170 if (!FloatEqIsReflexive(static_cast<float>(test_value))) {
171 printf("float FAIL\n");
174 if (!FloatEqIsReflexive(test_value)) {
175 printf("double FAIL\n");
179 [echo "Float equality is good"],
180 [AC_MSG_FAILURE(m4_normalize([
181 Test float equality failed!
182 Compile with -msse -mfpmath=sse if using g++.
185 AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])