1AC_INIT([OpenFst], [1.8.1], [help@www.openfst.org]) 2AM_INIT_AUTOMAKE([foreign nostdinc -Wall -Werror subdir-objects]) 3AM_PROG_AR 4 5AC_PROG_CXX 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. 8CXX="$CXX -std=c++17 -fno-exceptions -Wno-deprecated-declarations" 9 10AC_DISABLE_STATIC 11AC_PROG_LIBTOOL 12 13AC_CONFIG_HEADERS([config.h src/include/fst/config.h]) 14AC_CONFIG_SRCDIR([src/lib/fst.cc]) 15AC_CONFIG_FILES([ 16 Makefile 17 src/Makefile 18 src/include/Makefile 19 src/lib/Makefile 20 src/bin/Makefile 21 src/test/Makefile 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 34 src/script/Makefile 35]) 36AC_CONFIG_MACRO_DIR([m4]) 37AC_LANG([C++]) 38 39AC_ARG_ENABLE([compact-fsts], 40 [AS_HELP_STRING([--enable-compact-fsts], 41 [enable CompactFst extensions])], 42 [], 43 [enable_compact_fsts=no]) 44AM_CONDITIONAL([HAVE_COMPACT], [test "x$enable_compact_fsts" != xno]) 45 46AC_ARG_ENABLE([compress], 47 [AS_HELP_STRING([--enable-compress], 48 [enable compression extension])], 49 [], 50 [enable_compress=no]) 51AM_CONDITIONAL([HAVE_COMPRESS], [test "x$enable_compress" != xno]) 52 53AC_ARG_ENABLE([const-fsts], 54 [AS_HELP_STRING([--enable-const-fsts], 55 [enable ConstFst extensions])], 56 [], 57 [enable_const_fsts=no]) 58AM_CONDITIONAL([HAVE_CONST], [test "x$enable_const_fsts" != xno]) 59 60AC_ARG_ENABLE([far], 61 [AS_HELP_STRING([--enable-far], [enable FAR extensions])], 62 [], 63 [enable_far=no]) 64AM_CONDITIONAL([HAVE_FAR], [test "x$enable_far" != xno]) 65 66AC_ARG_ENABLE([linear-fsts], 67 [AS_HELP_STRING([--enable-linear-fsts], 68 [enable LinearTagger/ClassifierFst extensions])], 69 [], 70 [enable_linear_fsts=no]) 71AM_CONDITIONAL([HAVE_LINEAR], [test "x$enable_linear_fsts" != xno]) 72 73AC_ARG_ENABLE([lookahead-fsts], 74 [AS_HELP_STRING([--enable-lookahead-fsts], 75 [enable LookAheadFst extensions])], 76 [], 77 [enable_lookahead_fsts=no]) 78AM_CONDITIONAL([HAVE_LOOKAHEAD], [test "x$enable_lookahead_fsts" != xno]) 79 80AC_ARG_ENABLE([mpdt], 81 [AS_HELP_STRING([--enable-mpdt], 82 [enable MPDT extensions])], 83 [], 84 [enable_mpdt=no]) 85AM_CONDITIONAL([HAVE_MPDT], [test "x$enable_mpdt" != xno]) 86 87AC_ARG_ENABLE([ngram-fsts], 88 [AS_HELP_STRING([--enable-ngram-fsts], 89 [enable NGramFst extension])], 90 [], 91 [enable_ngram_fsts=no]) 92AM_CONDITIONAL([HAVE_NGRAM], [test "x$enable_ngram_fsts" != xno]) 93 94AC_ARG_ENABLE([pdt], 95 [AS_HELP_STRING([--enable-pdt], 96 [enable PDT extensions])], 97 [], 98 [enable_pdt=no]) 99AM_CONDITIONAL([HAVE_PDT], [test "x$enable_pdt" != xno]) 100 101AC_ARG_ENABLE([python], 102 [AS_HELP_STRING([--enable-python], 103 [enable Python extensions])], 104 [], 105 [enable_python=no]) 106AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" != xno]) 107if test "x$enable_python" != xno; then 108 AM_PATH_PYTHON(3.6) 109 AC_PYTHON_DEVEL([>= '3.6']) 110fi 111 112AC_ARG_ENABLE([special], 113 [AS_HELP_STRING([--enable-special], 114 [enable special-matcher extensions])], 115 [], 116 [enable_special=no]) 117AM_CONDITIONAL([HAVE_SPECIAL], [test "x$enable_special" != xno]) 118 119# --enable-bin enables script and bin "extensions". 120AC_ARG_ENABLE([bin], 121 [AS_HELP_STRING([--enable-bin], 122 [enable fst::script and command-line binaries])], 123 [], 124 [enable_bin=yes]) 125AM_CONDITIONAL([HAVE_BIN], [test "x$enable_bin" != xno]) 126AM_CONDITIONAL([HAVE_SCRIPT], [test "x$enable_bin" != xno]) 127 128# --enable-fsts is an alias to enable FST SO extensions: compact, const, 129# linear, lookahead, and ngram. 130AC_ARG_ENABLE([fsts], 131 [AS_HELP_STRING([--enable-fsts], 132 [enable all FST SOs])], 133 [], 134 [enable_fsts=no]) 135AM_CONDITIONAL([HAVE_FSTS], [test "x$enable_fsts" != xno]) 136 137# --enable-grm is an alias to enable all dependencies of OpenGrm: far, mpdt, 138# and pdt. 139AC_ARG_ENABLE([grm], 140 [AS_HELP_STRING([--enable-grm], 141 [enable all dependencies of OpenGrm])], 142 [], 143 [enable_grm=no]) 144AM_CONDITIONAL([HAVE_GRM], [test "x$enable_grm" != xno]) 145 146AC_ARG_WITH([libfstdir], 147[--with-libfstdir[=DIR] fst dynamic extensions [[LIBDIR/fst]]], 148[], [with_libfstdir=[${libdir}/fst]]) 149 150AC_SUBST([libfstdir], $with_libfstdir) 151 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`. 155AC_RUN_IFELSE([AC_LANG_PROGRAM([ 156 #include <cstdio> 157 158 template <typename T> 159 bool FloatEqIsReflexive(T m) { 160 volatile T x = 1.111; 161 x *= m; 162 163 T y = 1.111; 164 y *= m; 165 166 return x == y; 167 } 168 ], [ 169 volatile double test_value = 1.1; 170 if (!FloatEqIsReflexive(static_cast<float>(test_value))) { 171 printf("float FAIL\n"); 172 return 1; 173 } 174 if (!FloatEqIsReflexive(test_value)) { 175 printf("double FAIL\n"); 176 return 1; 177 } 178 ])], 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++. 183 ]))]) 184 185AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl]) 186AC_SUBST([DL_LIBS]) 187 188AC_OUTPUT 189