-
Notifications
You must be signed in to change notification settings - Fork 38
/
configure.ac
180 lines (156 loc) · 5.81 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
AC_INIT([OpenFst], [1.7.2], [[email protected]])
AM_INIT_AUTOMAKE([foreign nostdinc -Wall -Werror subdir-objects])
AM_PROG_AR
# OpenFst does not throw exceptions, so we do not generate exception handling
# code. However, users are free to re-enable exception handling.
# OpenFst assumes char is unsigned; -fsigned-char is likely unsafe.
CPPFLAGS="$CPPFLAGS -fno-exceptions -funsigned-char"
CXXFLAGS="$CXXFLAGS -std=c++11"
AC_PROG_CXX
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_CONFIG_HEADERS([config.h src/include/fst/config.h])
AC_CONFIG_SRCDIR([src/lib/fst.cc])
AC_CONFIG_FILES([
Makefile
src/Makefile
src/include/Makefile
src/lib/Makefile
src/bin/Makefile
src/test/Makefile
src/extensions/Makefile
src/extensions/compact/Makefile
src/extensions/compress/Makefile
src/extensions/const/Makefile
src/extensions/far/Makefile
src/extensions/linear/Makefile
src/extensions/lookahead/Makefile
src/extensions/mpdt/Makefile
src/extensions/ngram/Makefile
src/extensions/pdt/Makefile
src/extensions/python/Makefile
src/extensions/special/Makefile
src/script/Makefile
])
AC_CONFIG_MACRO_DIR([m4])
AC_LANG([C++])
AC_ARG_ENABLE([compact-fsts],
[AS_HELP_STRING([--enable-compact-fsts],
[enable CompactFst extensions])],
[],
[enable_compact_fsts=no])
AM_CONDITIONAL([HAVE_COMPACT], [test "x$enable_compact_fsts" != xno])
AC_ARG_ENABLE([compress],
[AS_HELP_STRING([--enable-compress],
[enable compression extension])],
[],
[enable_compress=no])
AM_CONDITIONAL([HAVE_COMPRESS], [test "x$enable_compress" != xno])
AC_ARG_ENABLE([const-fsts],
[AS_HELP_STRING([--enable-const-fsts],
[enable ConstFst extensions])],
[],
[enable_const_fsts=no])
AM_CONDITIONAL([HAVE_CONST], [test "x$enable_const_fsts" != xno])
AC_ARG_ENABLE([far],
[AS_HELP_STRING([--enable-far], [enable FAR extensions])],
[],
[enable_far=no])
AM_CONDITIONAL([HAVE_FAR], [test "x$enable_far" != xno])
AC_ARG_ENABLE([linear-fsts],
[AS_HELP_STRING([--enable-linear-fsts],
[enable LinearTagger/ClassifierFst extensions])],
[],
[enable_linear_fsts=no])
AM_CONDITIONAL([HAVE_LINEAR], [test "x$enable_linear_fsts" != xno])
AC_ARG_ENABLE([lookahead-fsts],
[AS_HELP_STRING([--enable-lookahead-fsts],
[enable LookAheadFst extensions])],
[],
[enable_lookahead_fsts=no])
AM_CONDITIONAL([HAVE_LOOKAHEAD], [test "x$enable_lookahead_fsts" != xno])
AC_ARG_ENABLE([mpdt],
[AS_HELP_STRING([--enable-mpdt],
[enable MPDT extensions])],
[],
[enable_mpdt=no])
AM_CONDITIONAL([HAVE_MPDT], [test "x$enable_mpdt" != xno])
AC_ARG_ENABLE([ngram-fsts],
[AS_HELP_STRING([--enable-ngram-fsts],
[enable NGramFst extension])],
[],
[enable_ngram_fsts=no])
AM_CONDITIONAL([HAVE_NGRAM], [test "x$enable_ngram_fsts" != xno])
AC_ARG_ENABLE([pdt],
[AS_HELP_STRING([--enable-pdt],
[enable PDT extensions])],
[],
[enable_pdt=no])
AM_CONDITIONAL([HAVE_PDT], [test "x$enable_pdt" != xno])
AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python],
[enable Python extensions])],
[],
[enable_python=no])
AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" != xno])
if test "x$enable_python" != xno; then
AM_PATH_PYTHON(2.7)
AC_PYTHON_DEVEL([>= '2.7'])
fi
AC_ARG_ENABLE([special],
[AS_HELP_STRING([--enable-special],
[enable special-matcher extensions])],
[],
[enable_special=no])
AM_CONDITIONAL([HAVE_SPECIAL], [test "x$enable_special" != xno])
# --enable-bin enables script and bin "extensions".
AC_ARG_ENABLE([bin],
[AS_HELP_STRING([--enable-bin],
[enable fst::script and command-line binaries])],
[],
[enable_bin=yes])
AM_CONDITIONAL([HAVE_BIN], [test "x$enable_bin" != xno])
AM_CONDITIONAL([HAVE_SCRIPT], [test "x$enable_bin" != xno])
# --enable-grm enables dependencies of OpenGrm: far, mpdt, and pdt.
AC_ARG_ENABLE([grm],
[AS_HELP_STRING([--enable-grm],
[enable all dependencies of OpenGrm])],
[],
[enable_grm=no])
AM_CONDITIONAL([HAVE_GRM], [test "x$enable_grm" != xno])
AC_ARG_WITH([libfstdir],
[--with-libfstdir[=DIR] fst dynamic extensions [[LIBDIR/fst]]],
[], [with_libfstdir=[${libdir}/fst]])
AC_SUBST([libfstdir], $with_libfstdir)
# Flags may be changed after configuring, so this is checked again by
# weight_test.cc. The check here is to save time in the common case,
# or when someone does not run `make check`.
AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <cstdio>
template <typename T>
bool FloatEqIsReflexive(T m) {
volatile T x = 1.111;
x *= m;
T y = 1.111;
y *= m;
return x == y;
}
], [
volatile double test_value = 1.1;
if (!FloatEqIsReflexive(static_cast<float>(test_value))) {
printf("float FAIL\n");
return 1;
}
if (!FloatEqIsReflexive(test_value)) {
printf("double FAIL\n");
return 1;
}
])],
[echo "Float equality is good"],
[AC_MSG_FAILURE(m4_normalize([
Test float equality failed!
Compile with -msse -mfpmath=sse if using g++.
]))])
AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
AC_SUBST([DL_LIBS])
AC_OUTPUT