2006-08-23 19:18:53 +04:00
AC_INIT(moses/src)
2006-07-04 21:44:36 +04:00
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(moses, 0.1)
2010-02-24 12:27:18 +03:00
AC_CONFIG_MACRO_DIR([m4])
2006-07-04 21:44:36 +04:00
AC_PROG_CXX
2009-12-17 18:15:43 +03:00
AC_PROG_CXXCPP
2006-07-04 21:44:36 +04:00
AC_LANG_CPLUSPLUS
2010-02-24 12:27:18 +03:00
2010-02-25 18:36:39 +03:00
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
2010-02-24 17:02:24 +03:00
# Shared library are disabled for default
2010-02-25 18:36:39 +03:00
#LT_INIT([disable-shared])
2006-07-04 21:44:36 +04:00
2009-08-07 20:47:54 +04:00
AX_XMLRPC_C
2008-09-24 20:48:23 +04:00
AC_ARG_WITH(protobuf,
[AC_HELP_STRING([--with-protobuf=PATH], [(optional) path to Google protobuf])],
[with_protobuf=$withval],
[with_protobuf=no]
)
2006-07-04 21:44:36 +04:00
AC_ARG_WITH(srilm,
[AC_HELP_STRING([--with-srilm=PATH], [(optional) path to SRI's LM toolkit])],
[with_srilm=$withval],
[with_srilm=no]
)
2010-02-24 12:19:37 +03:00
AC_ARG_WITH(srilm-dynamic,
[AC_HELP_STRING([--with-srilm-dynamic], [(optional) link dynamically with srilm])],
[with_srilm_dynamic=yes],
[with_srilm_dynamic=no]
)
2006-07-18 00:07:17 +04:00
AC_ARG_WITH(irstlm,
[AC_HELP_STRING([--with-irstlm=PATH], [(optional) path to IRST's LM toolkit])],
[with_irstlm=$withval],
[with_irstlm=no]
)
2010-09-22 02:43:29 +04:00
AC_ARG_WITH(kenlm,
2010-09-28 22:02:08 +04:00
[AC_HELP_STRING([--with-kenlm], [(optional) Include Ken's LM toolkit; default is yes])],
2010-09-22 02:43:29 +04:00
[with_kenlm=$withval],
2010-09-28 22:02:08 +04:00
[with_kenlm=yes]
2010-09-22 02:43:29 +04:00
)
2008-11-04 20:49:44 +03:00
AC_ARG_WITH(randlm,
[AC_HELP_STRING([--with-randlm=PATH], [(optional) path to RandLM toolkit])],
[with_randlm=$withval],
[with_randlm=no]
)
2010-03-01 14:32:15 +03:00
AC_ARG_WITH(notrace,
[AC_HELP_STRING([--notrace], [disable trace])],
[without_trace=yes],
)
2006-07-13 21:59:27 +04:00
AC_ARG_ENABLE(profiling,
[AC_HELP_STRING([--enable-profiling], [moses will dump profiling info])],
[CPPFLAGS="$CPPFLAGS -pg"; LDFLAGS="$LDFLAGS -pg" ]
)
2006-08-23 19:18:53 +04:00
AC_ARG_ENABLE(optimization,
[AC_HELP_STRING([--enable-optimization], [compile with -O3 flag])],
[CPPFLAGS="$CPPFLAGS -O3"; LDFLAGS="$LDFLAGS -O3" ]
)
2009-08-07 20:47:54 +04:00
AC_ARG_ENABLE(threads,
[AC_HELP_STRING([--enable-threads], [compile threadsafe library and multi-threaded moses (mosesmt)])],
2011-02-07 18:43:19 +03:00
[],
[enable_threads=no]
2009-08-07 20:47:54 +04:00
)
2010-10-01 01:07:01 +04:00
AC_ARG_ENABLE(boost,
[AC_HELP_STRING([--enable-boost], [use Boost library])],
2011-02-07 18:43:19 +03:00
[],
[enable_boost=no]
2010-10-01 01:07:01 +04:00
)
2010-02-24 13:37:49 +03:00
2010-02-24 13:35:18 +03:00
AC_ARG_WITH(zlib,
[AC_HELP_STRING([--with-zlib=PATH], [(optional) path to zlib])],
[with_zlib=$withval],
[with_zlib=no]
)
2011-02-02 23:06:52 +03:00
AC_ARG_WITH(tcmalloc,
[AC_HELP_STRING([--with-tcmalloc], [(optional) link with tcmalloc; default is no])],
[with_tcmalloc=$withval],
2011-02-07 18:43:19 +03:00
[with_tcmalloc=no]
2011-02-02 23:06:52 +03:00
)
2011-02-07 18:43:19 +03:00
require_boost=no
if test "x$enable_threads" != 'xno' || test "x$enable_boost" != 'xno'
then
require_boost=yes
fi
AC_ARG_ENABLE(boost-pool,
[AC_HELP_STRING([--enable-boost-pool], [(optional) try to improve speed by selectively using Boost pool allocation (may increase total memory use); default is yes if Boost enabled])],
[],
[enable_boost_pool=$require_boost]
)
2006-11-08 21:49:47 +03:00
AM_CONDITIONAL([INTERNAL_LM], false)
AM_CONDITIONAL([SRI_LM], false)
AM_CONDITIONAL([IRST_LM], false)
2010-09-22 02:43:29 +04:00
AM_CONDITIONAL([KEN_LM], false)
2008-11-05 21:06:14 +03:00
AM_CONDITIONAL([RAND_LM], false)
2008-09-24 20:48:23 +04:00
AM_CONDITIONAL([PROTOBUF], false)
2009-08-07 20:47:54 +04:00
AM_CONDITIONAL([am__fastdepCC], false)
AM_CONDITIONAL([WITH_THREADS],false)
2010-03-01 14:32:15 +03:00
if test "x$without_trace" = 'xyes'
then
AC_MSG_NOTICE([trace disabled, most regression test will fail])
else
AC_MSG_NOTICE([trace enabled (default)])
CPPFLAGS="$CPPFLAGS -DTRACE_ENABLE=1"
fi
2011-02-07 18:43:19 +03:00
if test "x$require_boost" = 'xyes'
2010-10-01 01:07:01 +04:00
then
AC_MSG_NOTICE([Using Boost library])
2011-01-14 02:38:48 +03:00
BOOST_REQUIRE([1.36.0])
2010-10-01 01:07:01 +04:00
fi
2011-02-07 18:43:19 +03:00
if test "x$enable_threads" = 'xyes'
2009-08-07 20:47:54 +04:00
then
AC_MSG_NOTICE([Building threaded moses])
2011-01-14 02:38:48 +03:00
BOOST_THREADS
2009-08-07 20:47:54 +04:00
CPPFLAGS="$CPPFLAGS -DWITH_THREADS"
AM_CONDITIONAL([WITH_THREADS],true)
else
AC_MSG_NOTICE([Building non-threaded moses. This will disable the moses server])
fi
2008-09-24 20:48:23 +04:00
if test "x$with_protobuf" != 'xno'
then
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I${with_protobuf}/include"
AC_CHECK_HEADER(google/protobuf/message.h,
[AC_DEFINE([HAVE_PROTOBUF], [], [flag for protobuf])],
[AC_MSG_ERROR([Cannot find protobuf!])])
LIB_PROTOBUF="-lprotobuf"
LDFLAGS="$LDFLAGS -L${with_protobuf}/lib"
LIBS="$LIBS $LIB_PROTOBUF"
AC_PATH_PROG(PROTOC,protoc,,"${PATH}:${with_protobuf}/bin")
FMTLIBS="$FMTLIBS libprotobuf.a"
AM_CONDITIONAL([PROTOBUF], true)
fi
2006-11-08 21:49:47 +03:00
2006-07-04 21:44:36 +04:00
if test "x$with_srilm" != 'xno'
then
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I${with_srilm}/include"
2006-08-23 19:18:53 +04:00
2006-07-04 21:44:36 +04:00
AC_CHECK_HEADER(Ngram.h,
2010-02-24 12:19:37 +03:00
[AC_DEFINE([HAVE_SRILM], [], [flag for SRILM])],
[AC_MSG_ERROR([Cannot find SRILM!])])
if test "x$with_srilm_dynamic" != 'xyes'
then
2010-04-20 19:25:52 +04:00
LIB_SRILM="-loolm -ldstruct -lmisc -lflm"
2010-02-24 12:19:37 +03:00
# ROOT/lib/i686-m64/liboolm.a
# ROOT/lib/i686-m64/libdstruct.a
# ROOT/lib/i686-m64/libmisc.a
MY_ARCH=`${with_srilm}/sbin/machine-type`
2010-04-20 19:25:52 +04:00
LDFLAGS="$LDFLAGS -L${with_srilm}/lib/${MY_ARCH} -L${with_srilm}/flm/obj/${MY_ARCH}"
2010-02-24 12:19:37 +03:00
LIBS="$LIBS $LIB_SRILM"
FMTLIBS="$FMTLIBS liboolm.a libdstruct.a libmisc.a"
else
LDFLAGS="$LDFLAGS -L${with_srilm}/lib"
LIBS="$LIBS -lsrilm"
fi
2010-05-26 19:46:23 +04:00
AC_CHECK_LIB([oolm], [trigram_init], [], [AC_MSG_ERROR([Cannot find SRILM's library in ${with_srilm}/lib/${MY_ARCH} ])])
2006-07-04 21:44:36 +04:00
AM_CONDITIONAL([SRI_LM], true)
2010-02-24 12:26:58 +03:00
fi
2006-11-08 21:49:47 +03:00
if test "x$with_irstlm" != 'xno'
2006-07-18 00:07:17 +04:00
then
SAVE_CPPFLAGS="$CPPFLAGS"
2010-06-08 15:42:28 +04:00
CPPFLAGS="$CPPFLAGS -I${with_irstlm}/include"
2006-08-23 19:18:53 +04:00
2010-10-26 20:06:01 +04:00
AC_MSG_NOTICE([])
AC_MSG_NOTICE([!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
AC_MSG_NOTICE([!!! You are linking the IRSTLM library; be sure the release is >= 5.50.01 !!!])
AC_MSG_NOTICE([!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
AC_MSG_NOTICE([])
2006-08-15 03:33:21 +04:00
AC_CHECK_HEADER(n_gram.h,
2006-07-18 00:07:17 +04:00
[AC_DEFINE([HAVE_IRSTLM], [], [flag for IRSTLM])],
2010-06-08 03:12:38 +04:00
[AC_MSG_ERROR([Cannot find IRST-LM in ${with_irstlm}])])
2006-07-18 00:07:17 +04:00
2009-10-01 18:12:55 +04:00
MY_ARCH=`uname -m`
2007-05-22 19:40:56 +04:00
LIB_IRSTLM="-lirstlm"
2010-10-26 20:06:01 +04:00
LDFLAGS="$LDFLAGS -L${with_irstlm}/lib"
2007-05-22 19:40:56 +04:00
LIBS="$LIBS $LIB_IRSTLM"
2006-07-18 00:07:17 +04:00
FMTLIBS="$FMTLIBS libirstlm.a"
AM_CONDITIONAL([IRST_LM], true)
2006-07-04 21:44:36 +04:00
fi
2010-09-22 02:43:29 +04:00
if test "x$with_kenlm" != 'xno'
then
SAVE_CPPFLAGS="$CPPFLAGS"
2010-09-28 22:02:08 +04:00
CPPFLAGS="$CPPFLAGS -I${PWD}/kenlm"
2010-09-22 02:43:29 +04:00
2010-11-06 03:40:16 +03:00
AC_CHECK_HEADER(lm/model.hh,
2010-09-22 02:43:29 +04:00
[AC_DEFINE([HAVE_KENLM], [], [flag for KENLM])],
2010-10-27 21:50:40 +04:00
[AC_MSG_ERROR([Cannot find KEN-LM in ${PWD}/kenlm])])
2010-09-22 02:43:29 +04:00
2011-01-11 22:32:59 +03:00
KENLM_LDFLAGS="-L\$(top_srcdir)/kenlm -lkenlm -lz"
KENLM_DEPS="\$(top_srcdir)/kenlm/libkenlm.la"
FMTLIBS="$FMTLIBS libkenlm.la"
2010-09-22 02:43:29 +04:00
AM_CONDITIONAL([KEN_LM], true)
2011-01-11 22:32:59 +03:00
else
KENLM_LDFLAGS=""
KENLM_DEPS=""
2010-09-22 02:43:29 +04:00
fi
2011-01-11 22:32:59 +03:00
AC_SUBST(KENLM_LDFLAGS)
AC_SUBST(KENLM_DEPS)
2010-09-22 02:43:29 +04:00
2008-11-04 20:49:44 +03:00
if test "x$with_randlm" != 'xno'
then
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I${with_randlm}/include"
AC_CHECK_HEADER(RandLM.h,
[AC_DEFINE([HAVE_RANDLM], [], [flag for RandLM])],
[AC_MSG_ERROR([Cannot find RandLM!])])
MY_ARCH=`uname -m`
LIB_RANDLM="-lrandlm"
LDFLAGS="$LDFLAGS -L${with_randlm}/lib"
LIBS="$LIBS $LIB_RANDLM"
FMTLIBS="$FMTLIBS librandlm.a"
AM_CONDITIONAL([RAND_LM], true)
fi
2011-02-02 23:06:52 +03:00
if test "x$with_tcmalloc" != 'xno'
then
AC_CHECK_LIB([tcmalloc], [malloc], [], [AC_MSG_ERROR([Cannot find tcmalloc])])
fi
2009-02-26 14:17:12 +03:00
2011-02-07 18:43:19 +03:00
if test "x$enable_boost_pool" != 'xno'
then
AC_CHECK_HEADER(boost/pool/object_pool.hpp,
[AC_DEFINE([USE_BOOST_POOL], [], [Flag to enable use of Boost pool])],
[AC_MSG_WARN([Cannot find boost/pool/object_pool.hpp])]
)
fi
2009-02-26 14:17:12 +03:00
AM_CONDITIONAL([WITH_MERT],false)
AC_CHECK_HEADERS([getopt.h],
[AM_CONDITIONAL([WITH_MERT],true)],
[AC_MSG_WARN([Cannot find getopt.h - disabling new mert])])
2009-08-07 20:47:54 +04:00
AM_CONDITIONAL([WITH_SERVER],false)
2011-02-07 18:43:19 +03:00
if test "x$have_xmlrpc_c" = "xyes" && test "x$enable_threads" = "xyes"; then
2009-08-07 20:47:54 +04:00
AM_CONDITIONAL([WITH_SERVER],true)
else
AC_MSG_NOTICE([Disabling server])
fi
2010-02-24 13:35:18 +03:00
if test "x$with_zlib" != 'xno'
then
CPPFLAGS="$CPPFLAGS -I${with_zlib}/include"
LDFLAGS="$LDFLAGS -L${with_zlib}/lib"
fi
2006-08-23 19:18:53 +04:00
LIBS="$LIBS -lz"
2009-02-26 14:17:12 +03:00
2010-09-28 20:26:55 +04:00
AC_CONFIG_FILES(Makefile OnDiskPt/src/Makefile moses/src/Makefile moses-chart/src/Makefile moses-cmd/src/Makefile moses-chart-cmd/src/Makefile misc/Makefile mert/Makefile server/Makefile CreateOnDisk/src/Makefile kenlm/Makefile)
2009-02-26 14:17:12 +03:00
AC_OUTPUT()