1AC_INIT(src)
2
3CFLAGS="$CFLAGS"
4CPPFLAGS="$CPPFLAGS"
5CXXFLAGS="$CXXFLAGS"
6
7AC_PREFIX_DEFAULT(/usr/local/irstlm)
8AM_CONFIG_HEADER(config.h)
9AM_INIT_AUTOMAKE(irstlm, 5.70.03)
10WEBSITE="http://hlt.fbk.eu/en/irstlm"
11
12AC_CONFIG_MACRO_DIR([m4])
13
14AC_PROG_CXX
15AC_PROG_CXXCPP
16AC_LANG_CPLUSPLUS
17
18AC_DISABLE_SHARED
19AC_PROG_LIBTOOL
20# Shared library are disabled for default
21#LT_INIT([disable-shared])
22
23AC_CHECK_TOOL(PDFLATEX,pdflatex,"no")
24AC_CHECK_TOOL(BIBTEX,bibtex,"no")
25
26AC_ARG_ENABLE([trace],
27    AS_HELP_STRING([--enable-trace|--disable-trace], [Enable or Disable (default) trace]))
28
29AC_ARG_ENABLE([debugging],
30    AS_HELP_STRING([--enable-debugging|--disable-debugging], [Enable or Disable (default) compilation with debugging "-g -O2" info]))
31
32AC_ARG_ENABLE(profiling,
33            [AC_HELP_STRING([--enable-profiling|--disable-profiling], [Enable or Disable (default) profiling info])])
34
35AC_ARG_ENABLE(traincaching,
36            [AC_HELP_STRING([--enable-traincaching|--disable-traincaching], [Enable or Disable (default) the usage of caching in training])])
37
38AC_ARG_ENABLE(caching,
39            [AC_HELP_STRING([--enable-caching|--disable-caching], [Enable or Disable (default) the usage prob caches to store probs and other info])])
40
41AC_ARG_ENABLE(interpsearch,
42            [AC_HELP_STRING([--enable-interpsearch|--disable-interpsearch], [Enable or Disable (default) the use interpolated search to retrieve n-grams])])
43
44AC_ARG_ENABLE(optimization,
45            [AC_HELP_STRING([--enable-optimization|--disable-optimization], [Enable or Disable (default) compilation with optimization -O3 flag])])
46
47AC_ARG_WITH(zlib,
48            [AC_HELP_STRING([--with-zlib=PATH], [(optional) path to zlib])],
49            [with_zlib=$withval],
50            [with_zlib=no]
51           )
52
53AM_CONDITIONAL([am__fastdepCC], false)
54AM_CONDITIONAL([WITH_THREADS],false)
55
56#### Use this if you want that the default is yes
57#### if test "x$enable_foo" != 'xno'
58#### Use this if you want that the default is no
59#### if test "x$enable_foo" = 'xyes'
60
61
62if test "x$enable_trace" = 'xyes'
63then
64    AC_MSG_NOTICE([trace enabled])
65    CPPFLAGS="$CPPFLAGS -DTRACE_ENABLE=1"
66else
67    AC_MSG_NOTICE([trace disabled (default), most regression tests will fail])
68fi
69
70if test "x$enable_debugging" = 'xyes'
71then
72    AC_MSG_NOTICE([generation of debugging symbols enabled, compilation with "-g -O2"])
73    CPPFLAGS="$CPPFLAGS -g -O2"
74else
75    AC_MSG_NOTICE([generation of debugging symbols disabled (default), compilation without "-g", only "-O2"])
76fi
77
78if test "x$enable_profiling" = 'xyes'
79then
80    AC_MSG_NOTICE([profiling enabled])
81    CPPFLAGS="$CPPFLAGS -pg"
82    LDFLAGS="$LDFLAGS -pg"
83else
84    AC_MSG_NOTICE([profiling disabled (default)])
85fi
86
87if test "x$enable_traincaching" = 'xyes'
88then
89    AC_MSG_NOTICE([train-caching enabled])
90    CPPFLAGS="$CPPFLAGS -DMDIADAPTLM_CACHE_ENABLE=1";
91    LDFLAGS="$LDFLAGS"
92else
93    AC_MSG_NOTICE([train-caching disabled (default)])
94fi
95
96if test "x$enable_caching" = 'xyes'
97then
98    AC_MSG_NOTICE([caching enabled])
99    CPPFLAGS="$CPPFLAGS -DPS_CACHE_ENABLE=1 -DLMT_CACHE_ENABLE=1";
100    LDFLAGS="$LDFLAGS"
101else
102    AC_MSG_NOTICE([caching disabled (default)])
103fi
104
105if test "x$enable_interpsearch" = 'xyes'
106then
107    AC_MSG_NOTICE([interpolated search enabled])
108    CPPFLAGS="$CPPFLAGS -DINTERP_SEARCH=1";
109    LDFLAGS="$LDFLAGS"
110else
111    AC_MSG_NOTICE([interpolated search disabled (default)])
112fi
113
114if test "x$enable_optimization" = 'xyes'
115then
116    AC_MSG_NOTICE([optimization enabled])
117    CPPFLAGS="$CPPFLAGS -O3";
118    LDFLAGS="$LDFLAGS -O3"
119else
120    AC_MSG_NOTICE([optimization disabled (default)])
121fi
122
123AC_MSG_NOTICE([Building non-threaded irstlm.])
124
125AC_CHECK_HEADERS([getopt.h],
126            [AM_CONDITIONAL([WITH_MERT],true)],
127            [AC_MSG_WARN([Cannot find getopt.h - disabling new mert])])
128
129if test "x$with_zlib" != 'xno'
130then
131  CPPFLAGS="$CPPFLAGS -I${with_zlib}/include"
132  LDFLAGS="$LDFLAGS -L${with_zlib}/lib"
133fi
134
135LIBS="$LIBS -lz"
136
137
138AC_CONFIG_FILES(Makefile src/Makefile scripts/Makefile)
139
140AC_SUBST(transform,'s/_lm/-lm/')
141
142AC_OUTPUT()
143
144AC_MSG_NOTICE([The software will be installed into $prefix])
145