summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2015-04-02 00:50:04 -0400
committerChris Dyer <redpony@gmail.com>2015-04-02 00:50:04 -0400
commit5ee02ce1602f2fce6d5af5db93c2278fe6c9ede5 (patch)
tree7ebad8dd99e38d190c579f425c3eb959363e96e5
parente7d77de8a9b9929b22fc6562f88f3668900f9662 (diff)
parent737ed7a7f932b1a7e40d2755bcdee6bc0aa2de63 (diff)
Merge pull request #70 from redpony/cmake
Cmake
-rw-r--r--.gitignore12
-rw-r--r--CMakeLists.txt37
-rw-r--r--LICENSE.cctbx.txt45
-rw-r--r--Makefile.am23
-rw-r--r--README.cmake3
-rw-r--r--cmake/FindGMock.cmake130
-rw-r--r--cmake/FindLibDL.cmake30
-rw-r--r--cmake/FindRT.cmake55
-rw-r--r--config.h.cmake6
-rw-r--r--configure.ac244
-rw-r--r--decoder/CMakeLists.txt185
-rw-r--r--decoder/Makefile.am166
-rw-r--r--decoder/apply_models.h6
-rw-r--r--decoder/decoder.h4
-rw-r--r--decoder/factored_lexicon_helper.h2
-rw-r--r--decoder/ff_csplit.h4
-rw-r--r--decoder/ff_klm.cc1
-rw-r--r--decoder/ff_klm.h2
-rw-r--r--decoder/ff_lm.cc2
-rw-r--r--decoder/ff_lm.h3
-rw-r--r--decoder/ff_ngrams.cc8
-rw-r--r--decoder/ff_ngrams.h2
-rw-r--r--decoder/ff_spans.h1
-rw-r--r--decoder/ff_wordalign.cc2
-rw-r--r--decoder/grammar.h2
-rw-r--r--decoder/hg_union.cc4
-rw-r--r--decoder/phrasebased_translator.h2
-rw-r--r--decoder/scfg_translator.cc2
-rw-r--r--decoder/sentence_metadata.h6
-rw-r--r--decoder/translator.h8
-rw-r--r--decoder/tree_fragment.cc4
-rw-r--r--decoder/trule.h2
-rw-r--r--example_extff/CMakeLists.txt10
-rw-r--r--example_extff/Makefile.am5
-rw-r--r--extractor/CMakeLists.txt141
-rw-r--r--extractor/Makefile.am192
-rw-r--r--extractor/extract.cc14
-rw-r--r--extractor/scorer2_test.cc (renamed from extractor/scorer_test.cc)0
-rw-r--r--klm/lm/CMakeLists.txt137
-rw-r--r--klm/lm/Makefile.am63
-rw-r--r--klm/lm/builder/CMakeLists.txt31
-rw-r--r--klm/lm/builder/Makefile.am34
-rw-r--r--klm/search/CMakeLists.txt22
-rw-r--r--klm/search/Makefile.am22
-rw-r--r--klm/util/CMakeLists.txt53
-rw-r--r--klm/util/Makefile.am66
-rw-r--r--klm/util/double-conversion/CMakeLists.txt24
-rw-r--r--klm/util/double-conversion/Makefile.am23
-rw-r--r--klm/util/stream/CMakeLists.txt20
-rw-r--r--klm/util/stream/Makefile.am21
-rw-r--r--m4/acx_pthread.m4363
-rw-r--r--m4/ax_cxx_compile_stdcxx_11.m4140
-rw-r--r--m4/ax_pthread.m4332
-rw-r--r--m4/boost.m41343
-rw-r--r--m4/cython.m481
-rw-r--r--m4/gtest.m474
-rw-r--r--m4/misc.m4110
-rw-r--r--mteval/CMakeLists.txt68
-rw-r--r--mteval/Makefile.am52
-rw-r--r--mteval/ns.cc6
-rw-r--r--training/CMakeLists.txt14
-rw-r--r--training/Makefile.am12
-rw-r--r--training/const_reorder/CMakeLists.txt9
-rw-r--r--training/const_reorder/Makefile.am8
-rw-r--r--training/crf/CMakeLists.txt72
-rw-r--r--training/crf/Makefile.am36
-rw-r--r--training/dpmert/CMakeLists.txt59
-rw-r--r--training/dpmert/Makefile.am27
-rw-r--r--training/dpmert/ces.h4
-rw-r--r--training/dtrain/CMakeLists.txt15
-rw-r--r--training/dtrain/Makefile.am7
-rw-r--r--training/latent_svm/CMakeLists.txt8
-rw-r--r--training/latent_svm/Makefile.am6
-rw-r--r--training/liblbfgs/CMakeLists.txt37
-rw-r--r--training/liblbfgs/Makefile.am21
-rw-r--r--training/minrisk/CMakeLists.txt9
-rw-r--r--training/minrisk/Makefile.am8
-rw-r--r--training/minrisk/minrisk_optimize.cc2
-rw-r--r--training/mira/CMakeLists.txt16
-rw-r--r--training/mira/Makefile.am20
-rwxr-xr-xtraining/mira/mira.py45
-rw-r--r--training/pro/CMakeLists.txt18
-rw-r--r--training/pro/Makefile.am13
-rw-r--r--training/pro/mr_pro_reduce.cc1
-rw-r--r--training/rampion/CMakeLists.txt8
-rw-r--r--training/rampion/Makefile.am8
-rw-r--r--training/utils/CMakeLists.txt34
-rw-r--r--training/utils/Makefile.am48
-rw-r--r--utils/CMakeLists.txt118
-rw-r--r--utils/Makefile.am127
-rw-r--r--utils/fast_sparse_vector.h6
-rw-r--r--utils/gzstream.cc2
-rw-r--r--utils/perfect_hash.cc37
-rw-r--r--utils/perfect_hash.h27
-rw-r--r--utils/phmt.cc42
-rw-r--r--word-aligner/CMakeLists.txt10
-rw-r--r--word-aligner/Makefile.am12
97 files changed, 1452 insertions, 3944 deletions
diff --git a/.gitignore b/.gitignore
index 545ffdbd..07145db9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,18 @@
+example_extff/libff_example.so*
+Testing/
+*/Testing/
+training/Testing/
+utils/Testing/
+CTestTestfile.cmake
+cmake_install.cmake
+CMakeCache.txt
+CMakeFiles
utils/dedup_corpus
klm/lm/builder/dump_counts
klm/util/cat_compressed
+example_extff/libff_example.1.0.0.dylib
+example_extff/libff_example.1.dylib
+example_extff/libff_example.dylib
example_extff/ff_example.lo
example_extff/libff_example.la
mteval/meteor_jar.cc
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..934c69e6
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 2.8)
+
+add_definitions(-DKENLM_MAX_ORDER=6)
+set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -O3")
+set(METEOR_JAR "" CACHE FILEPATH "Path to meteor.jar")
+
+enable_testing()
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+#### packages
+find_package(ZLIB REQUIRED)
+find_package(BZip2 REQUIRED)
+find_package(LibDL REQUIRED)
+
+# for pycdec
+find_package(PythonInterp 2.7 REQUIRED)
+
+find_package(Boost COMPONENTS regex filesystem serialization program_options unit_test_framework system thread REQUIRED)
+include_directories(${Boost_INCLUDE_DIR})
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
+add_subdirectory(utils)
+add_subdirectory(klm/util/double-conversion)
+add_subdirectory(klm/util)
+add_subdirectory(klm/util/stream)
+add_subdirectory(klm/lm)
+add_subdirectory(klm/lm/builder)
+add_subdirectory(klm/search)
+add_subdirectory(mteval)
+add_subdirectory(decoder)
+add_subdirectory(training)
+add_subdirectory(word-aligner)
+add_subdirectory(extractor)
+add_subdirectory(example_extff)
+
diff --git a/LICENSE.cctbx.txt b/LICENSE.cctbx.txt
deleted file mode 100644
index a8d9a494..00000000
--- a/LICENSE.cctbx.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-*** License agreement ***
-
-cctbx Copyright (c) 2006, The Regents of the University of
-California, through Lawrence Berkeley National Laboratory (subject to
-receipt of any required approvals from the U.S. Dept. of Energy). All
-rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-(1) Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-(2) Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-(3) Neither the name of the University of California, Lawrence Berkeley
-National Laboratory, U.S. Dept. of Energy nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-You are under no obligation whatsoever to provide any bug fixes,
-patches, or upgrades to the features, functionality or performance of
-the source code ("Enhancements") to anyone; however, if you choose to
-make your Enhancements available either publicly, or directly to
-Lawrence Berkeley National Laboratory, without imposing a separate
-written license agreement for such Enhancements, then you hereby grant
-the following license: a non-exclusive, royalty-free perpetual license
-to install, use, modify, prepare derivative works, incorporate into
-other computer software, distribute, and sublicense such enhancements or
-derivative works thereof, in binary and source code form.
-
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index a2d2f332..00000000
--- a/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-# warning - the subdirectories in the following list should
-# be kept in topologically sorted order. Also, DO NOT introduce
-# cyclic dependencies between these directories!
-SUBDIRS = \
- utils \
- klm/util/double-conversion \
- klm/util \
- klm/util/stream \
- klm/lm \
- klm/lm/builder \
- klm/search \
- mteval \
- decoder \
- training \
- word-aligner \
- extractor \
- example_extff
-
-
-EXTRA_DIST = corpus tests python/cdec python/tests python/examples compound-split environment
-AUTOMAKE_OPTIONS = foreign
-ACLOCAL_AMFLAGS = -I m4
-AM_CPPFLAGS = -D_GLIBCXX_PARALLEL -march=native -mtune=native -O2 -pipe -fomit-frame-pointer -Wall
diff --git a/README.cmake b/README.cmake
new file mode 100644
index 00000000..4653bee6
--- /dev/null
+++ b/README.cmake
@@ -0,0 +1,3 @@
+
+ cmake -G 'Unix Makefiles' -DMETEOR_JAR=/Users/cdyer/software/meteor-1.5/meteor-1.5.jar
+
diff --git a/cmake/FindGMock.cmake b/cmake/FindGMock.cmake
new file mode 100644
index 00000000..2ad92212
--- /dev/null
+++ b/cmake/FindGMock.cmake
@@ -0,0 +1,130 @@
+# Locate the Google C++ Mocking Framework.
+# (This file is almost an identical copy of the original FindGTest.cmake file,
+# feel free to use it as it is or modify it for your own needs.)
+#
+#
+# Defines the following variables:
+#
+# GMOCK_FOUND - Found the Google Testing framework
+# GMOCK_INCLUDE_DIRS - Include directories
+#
+# Also defines the library variables below as normal
+# variables. These contain debug/optimized keywords when
+# a debugging library is found.
+#
+# GMOCK_BOTH_LIBRARIES - Both libgmock & libgmock-main
+# GMOCK_LIBRARIES - libgmock
+# GMOCK_MAIN_LIBRARIES - libgmock-main
+#
+# Accepts the following variables as input:
+#
+# GMOCK_ROOT - (as a CMake or environment variable)
+# The root directory of the gmock install prefix
+#
+# GMOCK_MSVC_SEARCH - If compiling with MSVC, this variable can be set to
+# "MD" or "MT" to enable searching a gmock build tree
+# (defaults: "MD")
+#
+#-----------------------
+# Example Usage:
+#
+# find_package(GMock REQUIRED)
+# include_directories(${GMOCK_INCLUDE_DIRS})
+#
+# add_executable(foo foo.cc)
+# target_link_libraries(foo ${GMOCK_BOTH_LIBRARIES})
+#
+#=============================================================================
+# This file is released under the MIT licence:
+#
+# Copyright (c) 2011 Matej Svec
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#=============================================================================
+
+
+function(_gmock_append_debugs _endvar _library)
+ if(${_library} AND ${_library}_DEBUG)
+ set(_output optimized ${${_library}} debug ${${_library}_DEBUG})
+ else()
+ set(_output ${${_library}})
+ endif()
+ set(${_endvar} ${_output} PARENT_SCOPE)
+endfunction()
+
+function(_gmock_find_library _name)
+ find_library(${_name}
+ NAMES ${ARGN}
+ HINTS
+ $ENV{GMOCK_ROOT}
+ ${GMOCK_ROOT}
+ PATH_SUFFIXES ${_gmock_libpath_suffixes}
+ )
+ mark_as_advanced(${_name})
+endfunction()
+
+
+if(NOT DEFINED GMOCK_MSVC_SEARCH)
+ set(GMOCK_MSVC_SEARCH MD)
+endif()
+
+set(_gmock_libpath_suffixes lib)
+if(MSVC)
+ if(GMOCK_MSVC_SEARCH STREQUAL "MD")
+ list(APPEND _gmock_libpath_suffixes
+ msvc/gmock-md/Debug
+ msvc/gmock-md/Release)
+ elseif(GMOCK_MSVC_SEARCH STREQUAL "MT")
+ list(APPEND _gmock_libpath_suffixes
+ msvc/gmock/Debug
+ msvc/gmock/Release)
+ endif()
+endif()
+
+find_path(GMOCK_INCLUDE_DIR gmock/gmock.h
+ HINTS
+ $ENV{GMOCK_ROOT}/include
+ ${GMOCK_ROOT}/include
+)
+mark_as_advanced(GMOCK_INCLUDE_DIR)
+
+if(MSVC AND GMOCK_MSVC_SEARCH STREQUAL "MD")
+ # The provided /MD project files for Google Mock add -md suffixes to the
+ # library names.
+ _gmock_find_library(GMOCK_LIBRARY gmock-md gmock)
+ _gmock_find_library(GMOCK_LIBRARY_DEBUG gmock-mdd gmockd)
+ _gmock_find_library(GMOCK_MAIN_LIBRARY gmock_main-md gmock_main)
+ _gmock_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_main-mdd gmock_maind)
+else()
+ _gmock_find_library(GMOCK_LIBRARY gmock)
+ _gmock_find_library(GMOCK_LIBRARY_DEBUG gmockd)
+ _gmock_find_library(GMOCK_MAIN_LIBRARY gmock_main)
+ _gmock_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_maind)
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMock DEFAULT_MSG GMOCK_LIBRARY GMOCK_INCLUDE_DIR GMOCK_MAIN_LIBRARY)
+
+if(GMOCK_FOUND)
+ set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR})
+ _gmock_append_debugs(GMOCK_LIBRARIES GMOCK_LIBRARY)
+ _gmock_append_debugs(GMOCK_MAIN_LIBRARIES GMOCK_MAIN_LIBRARY)
+ set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARIES} ${GMOCK_MAIN_LIBRARIES})
+endif()
+
diff --git a/cmake/FindLibDL.cmake b/cmake/FindLibDL.cmake
new file mode 100644
index 00000000..1689e4c7
--- /dev/null
+++ b/cmake/FindLibDL.cmake
@@ -0,0 +1,30 @@
+# - Find libdl
+# Find the native LIBDL includes and library
+#
+# LIBDL_INCLUDE_DIR - where to find dlfcn.h, etc.
+# LIBDL_LIBRARIES - List of libraries when using libdl.
+# LIBDL_FOUND - True if libdl found.
+
+
+IF (LIBDL_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(LIBDL_FIND_QUIETLY TRUE)
+ENDIF (LIBDL_INCLUDE_DIR)
+
+FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h)
+
+SET(LIBDL_NAMES dl libdl ltdl libltdl)
+FIND_LIBRARY(LIBDL_LIBRARY NAMES ${LIBDL_NAMES} )
+
+# handle the QUIETLY and REQUIRED arguments and set LIBDL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
+
+IF(LIBDL_FOUND)
+ SET( LIBDL_LIBRARIES ${LIBDL_LIBRARY} )
+ELSE(LIBDL_FOUND)
+ SET( LIBDL_LIBRARIES )
+ENDIF(LIBDL_FOUND)
+
+MARK_AS_ADVANCED( LIBDL_LIBRARY LIBDL_INCLUDE_DIR )
diff --git a/cmake/FindRT.cmake b/cmake/FindRT.cmake
new file mode 100644
index 00000000..55ae1a26
--- /dev/null
+++ b/cmake/FindRT.cmake
@@ -0,0 +1,55 @@
+# - Check for the presence of RT
+#
+# The following variables are set when RT is found:
+# HAVE_RT = Set to true, if all components of RT
+# have been found.
+# RT_INCLUDES = Include path for the header files of RT
+# RT_LIBRARIES = Link these to use RT
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (RT_INCLUDES time.h
+ PATHS /usr/local/include /usr/include ${CMAKE_EXTRA_INCLUDES}
+ )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (RT_LIBRARIES rt
+ PATHS /usr/local/lib /usr/lib /lib ${CMAKE_EXTRA_LIBRARIES}
+ )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (RT_INCLUDES AND RT_LIBRARIES)
+ set (HAVE_RT TRUE)
+else (RT_INCLUDES AND RT_LIBRARIES)
+ if (NOT RT_FIND_QUIETLY)
+ if (NOT RT_INCLUDES)
+ message (STATUS "Unable to find RT header files!")
+ endif (NOT RT_INCLUDES)
+ if (NOT RT_LIBRARIES)
+ message (STATUS "Unable to find RT library files!")
+ endif (NOT RT_LIBRARIES)
+ endif (NOT RT_FIND_QUIETLY)
+endif (RT_INCLUDES AND RT_LIBRARIES)
+
+if (HAVE_RT)
+ if (NOT RT_FIND_QUIETLY)
+ message (STATUS "Found components for RT")
+ message (STATUS "RT_INCLUDES = ${RT_INCLUDES}")
+ message (STATUS "RT_LIBRARIES = ${RT_LIBRARIES}")
+ endif (NOT RT_FIND_QUIETLY)
+else (HAVE_RT)
+ if (RT_FIND_REQUIRED)
+ message (FATAL_ERROR "Could not find RT!")
+ endif (RT_FIND_REQUIRED)
+endif (HAVE_RT)
+
+mark_as_advanced (
+ HAVE_RT
+ RT_LIBRARIES
+ RT_INCLUDES
+ )
diff --git a/config.h.cmake b/config.h.cmake
new file mode 100644
index 00000000..aa0a9f4a
--- /dev/null
+++ b/config.h.cmake
@@ -0,0 +1,6 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#cmakedefine METEOR_JAR "@METEOR_JAR@"
+
+#endif // CONFIG_H
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 36cee5af..00000000
--- a/configure.ac
+++ /dev/null
@@ -1,244 +0,0 @@
-AC_CONFIG_MACRO_DIR([m4])
-AC_INIT([cdec],[2014-10-12])
-AC_CONFIG_SRCDIR([decoder/cdec.cc])
-AM_INIT_AUTOMAKE
-AC_CONFIG_HEADERS(config.h)
-AC_PROG_LIBTOOL
-AC_PROG_LEX
-case $LEX in
-:) AC_MSG_ERROR([No lex (Flex, lex, etc.) program found]);;
-esac
-OLD_CXXFLAGS=$CXXFLAGS
-AC_PROG_CC
-AC_PROG_CXX
-CXXFLAGS=$OLD_CXXFLAGS
-AX_PTHREAD
-AX_CXX_COMPILE_STDCXX_11([],[mandatory])
-AC_LANG_CPLUSPLUS
-AC_OPENMP
-AC_CHECK_LIB(rt, clock_gettime)
-BOOST_REQUIRE([1.44])
-BOOST_FILESYSTEM
-BOOST_PROGRAM_OPTIONS
-BOOST_SYSTEM
-BOOST_REGEX
-BOOST_SERIALIZATION
-BOOST_TEST
-BOOST_THREADS
-AM_PATH_PYTHON
-AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
-AC_CHECK_LIB(dl, dlopen)
-AC_CHECK_HEADERS(zlib.h,
- AC_CHECK_LIB(z, gzread,[
- AC_DEFINE(HAVE_ZLIB,[],[Do we have zlib])
- ZLIBS="$ZLIBS -lz"
- ]))
-
-AC_CHECK_HEADERS(bzlib.h,
- AC_CHECK_LIB(bz2, BZ2_bzReadOpen,[
- AC_DEFINE(HAVE_BZLIB,[],[Do we have bzlib])
- ZLIBS="$ZLIBS -lbz2"
- ]))
-
-AC_CHECK_HEADERS(lzma.h,
- AC_CHECK_LIB(lzma, lzma_code,[
- AC_DEFINE(HAVE_XZLIB,[],[Do we have lzma])
- ZLIBS="$ZLIBS -llzma"
- ]))
-
-AC_ARG_ENABLE(mpi,
- [ --enable-mpi Build MPI binaries, assumes mpi.h is present ],
- [ mpi=yes
- ])
-AM_CONDITIONAL([MPI], [test "x$mpi" = xyes])
-
-if test "x$mpi" = xyes
-then
- AC_DEFINE([HAVE_MPI], [1], [flag for MPI])
- BOOST_MPI
- #LIBS="$LIBS -lboost_mpi"
-fi
-
-AM_CONDITIONAL([HAVE_METEOR], false)
-AC_ARG_WITH(meteor,
- [AC_HELP_STRING([--with-meteor=PATH], [(optional) path to METEOR jar])],
- [with_meteor=$withval],
- [with_meteor=no]
- )
-
-if test "x$with_meteor" != 'xno'
-then
- AC_CHECK_FILE([$with_meteor],
- [AC_DEFINE([HAVE_METEOR], [1], [flag for METEOR jar library])],
- [AC_MSG_ERROR([Cannot find METEOR jar!])])
- AC_SUBST(METEOR_JAR,"${with_meteor}")
- AM_CONDITIONAL([HAVE_METEOR], true)
-fi
-
-AM_CONDITIONAL([HAVE_CMPH], false)
-AC_ARG_WITH(cmph,
- [AC_HELP_STRING([--with-cmph=PATH], [(optional) path to cmph perfect hashing library])],
- [with_cmph=$withval],
- [with_cmph=no]
- )
-
-if test "x$with_cmph" != 'xno'
-then
- SAVE_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS -I${with_cmph}/include"
-
- AC_CHECK_HEADER(cmph.h,
- [AC_DEFINE([HAVE_CMPH], [1], [flag for cmph perfect hashing library])],
- [AC_MSG_ERROR([Cannot find cmph library!])])
-
- LDFLAGS="$LDFLAGS -L${with_cmph}/lib"
- AC_CHECK_LIB(cmph, cmph_search)
- AM_CONDITIONAL([HAVE_CMPH], true)
-fi
-
-AM_CONDITIONAL([HAVE_GTEST], false)
-AC_ARG_WITH(gtest,
- [AC_HELP_STRING([--with-gtest=DIR], [(optional) path to Google Test library])],
- [with_gtest=$withval],
- [with_gtest=no]
- )
-
-AM_CONDITIONAL([HAVE_GMOCK], false)
-AC_ARG_WITH(gmock,
- [AC_HELP_STRING([--with-gmock=DIR], [(optional) path to Google Mock library])],
- [with_gmock=$withval],
- [with_gmock=no]
- )
-
-if test "x$with_gtest" != 'xno'
-then
- gtest_CPPFLAGS="-I${with_gtest}/include"
- gtest_LDFLAGS="-L${with_gtest} -L${with_gtest}/lib"
- gtest_LIBS="-lgtest_main -lgtest -lpthread"
-
- SAVECPP_FLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $gtest_CPPFLAGS"
- AC_CHECK_HEADER(${with_gtest}/include/gtest/gtest.h,
- [AC_DEFINE([HAVE_GTEST], [1], [flag for Google Test header])],
- [AC_MSG_ERROR([Cannot find Google Test headers!])]
- )
-
- SAVE_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $gtest_LDFLAGS"
- SAVE_LIBS="$LIBS"
- # Google Test needs pthreads.
- AC_CHECK_LIB([pthread],
- [pthread_mutex_init],
- [],
- [AC_MSG_ERROR([Cannot find pthread library])]
- )
- AX_CXX_CHECK_LIB([gtest],
- [testing::TestInfo::name() const],
- [],
- [AC_MSG_ERROR([Cannot find Google Test library libgtest])]
- )
- AC_CHECK_LIB([gtest_main],
- [main],
- [],
- [AC_MSG_ERROR([Cannot find Google Test library libgtest_main])]
- )
-
- AC_SUBST(AS_TR_CPP([GTEST_CPPFLAGS]), ["$gtest_CPPFLAGS"])
- AC_SUBST(AS_TR_CPP([GTEST_LDFLAGS]), ["$gtest_LDFLAGS"])
- AC_SUBST(AS_TR_CPP([GTEST_LIBS]), ["$gtest_LIBS"])
-
-
- if test "x$with_gmock" != 'xno'
- then
- gmock_CPPFLAGS="-I${with_gmock}/include"
- gmock_LDFLAGS="-L${with_gmock} -L${with_gmock}/lib"
- gmock_LIBS="-lgmock"
-
- CPPFLAGS="$CPPFLAGS $gmock_CPPFLAGS"
- AC_CHECK_HEADER(${with_gmock}/include/gmock/gmock.h,
- [AC_DEFINE([HAVE_GMOCK], [1], [flag for Google Mock header])],
- [AC_MSG_ERROR([Cannot find Google Mock headers!])]
- )
-
- LDFLAGS="$LDFLAGS $gmock_LDFLAGS"
- AX_CXX_CHECK_LIB([gmock],
- [testing::Expectation],
- [],
- [AC_MSG_ERROR([Cannot find Google Mock library libgmock])]
- )
-
- AC_SUBST(AS_TR_CPP([GMOCK_CPPFLAGS]), ["$gmock_CPPFLAGS"])
- AC_SUBST(AS_TR_CPP([GMOCK_LDFLAGS]), ["$gmock_LDFLAGS"])
- AC_SUBST(AS_TR_CPP([GMOCK_LIBS]), ["$gmock_LIBS"])
- AM_CONDITIONAL([HAVE_GMOCK], true)
- fi
-
- CPPFLAGS="$SAVE_CPPFLAGS"
- LDFLAGS="$SAVE_LDFLAGS"
- LIBS="$SAVE_LIBS"
- AM_CONDITIONAL([HAVE_GTEST], true)
-fi
-
-# Enable static linking
-AC_ARG_WITH(
- [static],
- AS_HELP_STRING([--with-static], [Statically link binaries when possible]),
- AC_SUBST(AS_TR_CPP([STATIC_FLAGS]), ["-all-static"]),
-)
-
-#BOOST_THREADS
-CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-LDFLAGS="$LDFLAGS $BOOST_PROGRAM_OPTIONS_LDFLAGS $BOOST_REGEX_LDFLAGS $BOOST_SERIALIZATION_LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS"
-# $BOOST_THREAD_LDFLAGS"
-LIBS="$LIBS $BOOST_PROGRAM_OPTIONS_LIBS $BOOST_REGEX_LIBS $BOOST_SERIALIZATION_LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $ZLIBS"
-# $BOOST_THREAD_LIBS"
-
-AC_CHECK_HEADER(google/dense_hash_map,
- [AC_DEFINE([HAVE_SPARSEHASH], [1], [flag for google::dense_hash_map])])
-
-AC_PROG_INSTALL
-
-CPPFLAGS="-DPIC $CPPFLAGS -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6"
-CXXFLAGS="$CXX11_SWITCH $CXXFLAGS -fPIC -g -O3"
-CFLAGS="$CFLAGS -fPIC -g -O3"
-
-if test "x$HAVE_CXX11" = "x0"; then
- CPPFLAGS="$CPPFLAGS -DHAVE_OLD_CPP"
-fi
-
-# core cdec stuff
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([utils/Makefile])
-AC_CONFIG_FILES([mteval/Makefile])
-AC_CONFIG_FILES([mteval/meteor_jar.cc])
-AC_CONFIG_FILES([decoder/Makefile])
-AC_CONFIG_FILES([python/setup.py])
-AC_CONFIG_FILES([extractor/Makefile])
-AC_CONFIG_FILES([word-aligner/Makefile])
-
-# KenLM stuff
-AC_CONFIG_FILES([klm/util/double-conversion/Makefile])
-AC_CONFIG_FILES([klm/util/stream/Makefile])
-AC_CONFIG_FILES([klm/util/Makefile])
-AC_CONFIG_FILES([klm/lm/Makefile])
-AC_CONFIG_FILES([klm/search/Makefile])
-AC_CONFIG_FILES([klm/lm/builder/Makefile])
-
-# training stuff
-AC_CONFIG_FILES([training/Makefile])
-AC_CONFIG_FILES([training/utils/Makefile])
-AC_CONFIG_FILES([training/liblbfgs/Makefile])
-AC_CONFIG_FILES([training/crf/Makefile])
-AC_CONFIG_FILES([training/dpmert/Makefile])
-AC_CONFIG_FILES([training/pro/Makefile])
-AC_CONFIG_FILES([training/rampion/Makefile])
-AC_CONFIG_FILES([training/minrisk/Makefile])
-AC_CONFIG_FILES([training/mira/Makefile])
-AC_CONFIG_FILES([training/latent_svm/Makefile])
-AC_CONFIG_FILES([training/dtrain/Makefile])
-AC_CONFIG_FILES([training/const_reorder/Makefile])
-
-# external feature function example code
-AC_CONFIG_FILES([example_extff/Makefile])
-
-AC_OUTPUT
diff --git a/decoder/CMakeLists.txt b/decoder/CMakeLists.txt
new file mode 100644
index 00000000..b49d6477
--- /dev/null
+++ b/decoder/CMakeLists.txt
@@ -0,0 +1,185 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../klm)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+PROJECT(decoder CXX)
+
+if (CMAKE_VERSION VERSION_LESS 2.8.9) # TODO remove once we increase the cmake requirement
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
+else()
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+endif()
+
+find_package(FLEX REQUIRED)
+
+FLEX_TARGET(RuleLexer rule_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/rule_lexer.cc)
+
+set(libcdec_SRCS
+ aligner.h
+ apply_models.h
+ bottom_up_parser.h
+ bottom_up_parser-rs.h
+ csplit.h
+ decoder.h
+ earley_composer.h
+ factored_lexicon_helper.h
+ ff.h
+ ff_basic.h
+ ff_bleu.h
+ ff_charset.h
+ ff_conll.h
+ ff_const_reorder_common.h
+ ff_const_reorder.h
+ ff_context.h
+ ff_csplit.h
+ ff_external.h
+ ff_factory.h
+ ff_klm.h
+ ff_lexical.h
+ ff_lm.h
+ ff_ngrams.h
+ ff_parse_match.h
+ ff_register.h
+ ff_rules.h
+ ff_ruleshape.h
+ ff_sample_fsa.h
+ ff_soft_syn.h
+ ff_soft_syntax.h
+ ff_soft_syntax_mindist.h
+ ff_source_path.h
+ ff_source_syntax.h
+ ff_source_syntax2.h
+ ff_spans.h
+ ff_tagger.h
+ ff_wordalign.h
+ ff_wordset.h
+ ffset.h
+ forest_writer.h
+ freqdict.h
+ grammar.h
+ hg.h
+ hg_intersect.h
+ hg_io.h
+ hg_remove_eps.h
+ hg_sampler.h
+ hg_test.h
+ hg_union.h
+ incremental.h
+ inside_outside.h
+ kbest.h
+ lattice.h
+ lexalign.h
+ lextrans.h
+ nt_span.h
+ oracle_bleu.h
+ phrasebased_translator.h
+ phrasetable_fst.h
+ program_options.h
+ rule_lexer.h
+ sentence_metadata.h
+ sentences.h
+ tagger.h
+ translator.h
+ trule.h
+ viterbi.h
+ aligner.cc
+ apply_models.cc
+ bottom_up_parser.cc
+ bottom_up_parser-rs.cc
+ cdec_ff.cc
+ csplit.cc
+ decoder.cc
+ earley_composer.cc
+ factored_lexicon_helper.cc
+ ff.cc
+ ff_basic.cc
+ ff_bleu.cc
+ ff_charset.cc
+ ff_conll.cc
+ ff_context.cc
+ ff_const_reorder.cc
+ ff_csplit.cc
+ ff_external.cc
+ ff_factory.cc
+ ff_klm.cc
+ ff_lm.cc
+ ff_ngrams.cc
+ ff_parse_match.cc
+ ff_rules.cc
+ ff_ruleshape.cc
+ ff_soft_syn.cc
+ ff_soft_syntax.cc
+ ff_soft_syntax_mindist.cc
+ ff_source_path.cc
+ ff_source_syntax.cc
+ ff_source_syntax2.cc
+ ff_spans.cc
+ ff_tagger.cc
+ ff_wordalign.cc
+ ff_wordset.cc
+ ffset.cc
+ forest_writer.cc
+ fst_translator.cc
+ tree2string_translator.cc
+ grammar.cc
+ hg.cc
+ hg_intersect.cc
+ hg_io.cc
+ hg_remove_eps.cc
+ hg_sampler.cc
+ hg_union.cc
+ incremental.cc
+ lattice.cc
+ lexalign.cc
+ lextrans.cc
+ node_state_hash.h
+ tree_fragment.cc
+ tree_fragment.h
+ maxtrans_blunsom.cc
+ phrasebased_translator.cc
+ phrasetable_fst.cc
+ rescore_translator.cc
+ ${FLEX_RuleLexer_OUTPUTS}
+ scfg_translator.cc
+ tagger.cc
+ translator.cc
+ trule.cc
+ viterbi.cc)
+
+add_library(libcdec STATIC ${libcdec_SRCS})
+
+set(cdec_SRCS cdec.cc)
+add_executable(cdec ${cdec_SRCS})
+target_link_libraries(cdec libcdec mteval utils ksearch klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBDL_LIBRARIES})
+
+set(TEST_SRCS
+ grammar_test.cc
+ hg_test.cc
+ parser_test.cc
+ t2s_test.cc
+ trule_test.cc)
+
+foreach(testSrc ${TEST_SRCS})
+ #Extract the filename without an extension (NAME_WE)
+ get_filename_component(testName ${testSrc} NAME_WE)
+
+ #Add compile target
+ set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"")
+ add_executable(${testName} ${testSrc})
+
+ #link to Boost libraries AND your targets and dependencies
+ target_link_libraries(${testName} libcdec mteval utils ksearch klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+ #I like to move testing binaries into a testBin directory
+ set_target_properties(${testName} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ #Finally add it to test execution -
+ #Notice the WORKING_DIRECTORY and COMMAND
+ add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endforeach(testSrc)
+
+
+
diff --git a/decoder/Makefile.am b/decoder/Makefile.am
deleted file mode 100644
index dbec532e..00000000
--- a/decoder/Makefile.am
+++ /dev/null
@@ -1,166 +0,0 @@
-bin_PROGRAMS = cdec
-
-noinst_PROGRAMS = \
- trule_test \
- hg_test \
- parser_test \
- t2s_test \
- grammar_test
-
-TESTS = trule_test parser_test grammar_test hg_test
-t2s_test_SOURCES = t2s_test.cc
-t2s_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a
-parser_test_SOURCES = parser_test.cc
-parser_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a
-grammar_test_SOURCES = grammar_test.cc
-grammar_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a
-hg_test_SOURCES = hg_test.cc
-hg_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a
-trule_test_SOURCES = trule_test.cc
-trule_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a
-
-cdec_SOURCES = cdec.cc
-cdec_LDFLAGS= -rdynamic $(STATIC_FLAGS)
-cdec_LDADD = libcdec.a ../mteval/libmteval.a ../utils/libutils.a ../klm/search/libksearch.a ../klm/lm/libklm.a ../klm/util/libklm_util.a ../klm/util/double-conversion/libklm_util_double.a
-
-AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/decoder/test_data\" -DBOOST_TEST_DYN_LINK -W -Wno-sign-compare -I$(top_srcdir) -I$(top_srcdir)/mteval -I$(top_srcdir)/utils -I$(top_srcdir)/klm
-
-rule_lexer.cc: rule_lexer.ll
- $(LEX) -s -CF -8 -o$@ $<
-
-noinst_LIBRARIES = libcdec.a
-
-EXTRA_DIST = test_data rule_lexer.ll
-
-libcdec_a_SOURCES = \
- aligner.h \
- apply_models.h \
- bottom_up_parser.h \
- bottom_up_parser-rs.h \
- csplit.h \
- decoder.h \
- earley_composer.h \
- factored_lexicon_helper.h \
- ff.h \
- ff_basic.h \
- ff_bleu.h \
- ff_charset.h \
- ff_conll.h \
- ff_const_reorder_common.h \
- ff_const_reorder.h \
- ff_context.h \
- ff_csplit.h \
- ff_external.h \
- ff_factory.h \
- ff_klm.h \
- ff_lexical.h \
- ff_lm.h \
- ff_ngrams.h \
- ff_parse_match.h \
- ff_register.h \
- ff_rules.h \
- ff_ruleshape.h \
- ff_sample_fsa.h \
- ff_soft_syn.h \
- ff_soft_syntax.h \
- ff_soft_syntax_mindist.h \
- ff_source_path.h \
- ff_source_syntax.h \
- ff_source_syntax2.h \
- ff_spans.h \
- ff_tagger.h \
- ff_wordalign.h \
- ff_wordset.h \
- ffset.h \
- forest_writer.h \
- freqdict.h \
- grammar.h \
- hg.h \
- hg_intersect.h \
- hg_io.h \
- hg_remove_eps.h \
- hg_sampler.h \
- hg_test.h \
- hg_union.h \
- incremental.h \
- inside_outside.h \
- kbest.h \
- lattice.h \
- lexalign.h \
- lextrans.h \
- nt_span.h \
- oracle_bleu.h \
- phrasebased_translator.h \
- phrasetable_fst.h \
- program_options.h \
- rule_lexer.h \
- sentence_metadata.h \
- sentences.h \
- tagger.h \
- translator.h \
- trule.h \
- viterbi.h \
- aligner.cc \
- apply_models.cc \
- bottom_up_parser.cc \
- bottom_up_parser-rs.cc \
- cdec.cc \
- cdec_ff.cc \
- csplit.cc \
- decoder.cc \
- earley_composer.cc \
- factored_lexicon_helper.cc \
- ff.cc \
- ff_basic.cc \
- ff_bleu.cc \
- ff_charset.cc \
- ff_conll.cc \
- ff_context.cc \
- ff_const_reorder.cc \
- ff_csplit.cc \
- ff_external.cc \
- ff_factory.cc \
- ff_klm.cc \
- ff_lm.cc \
- ff_ngrams.cc \
- ff_parse_match.cc \
- ff_rules.cc \
- ff_ruleshape.cc \
- ff_soft_syn.cc \
- ff_soft_syntax.cc \
- ff_soft_syntax_mindist.cc \
- ff_source_path.cc \
- ff_source_syntax.cc \
- ff_source_syntax2.cc \
- ff_spans.cc \
- ff_tagger.cc \
- ff_wordalign.cc \
- ff_wordset.cc \
- ffset.cc \
- forest_writer.cc \
- fst_translator.cc \
- tree2string_translator.cc \
- grammar.cc \
- hg.cc \
- hg_intersect.cc \
- hg_io.cc \
- hg_remove_eps.cc \
- hg_sampler.cc \
- hg_union.cc \
- incremental.cc \
- lattice.cc \
- lexalign.cc \
- lextrans.cc \
- node_state_hash.h \
- tree_fragment.cc \
- tree_fragment.h \
- maxtrans_blunsom.cc \
- phrasebased_translator.cc \
- phrasetable_fst.cc \
- rescore_translator.cc \
- rule_lexer.cc \
- scfg_translator.cc \
- tagger.cc \
- translator.cc \
- trule.cc \
- viterbi.cc
diff --git a/decoder/apply_models.h b/decoder/apply_models.h
index f03c973a..bfb37df1 100644
--- a/decoder/apply_models.h
+++ b/decoder/apply_models.h
@@ -3,9 +3,9 @@
#include <iostream>
-struct ModelSet;
-struct Hypergraph;
-struct SentenceMetadata;
+class ModelSet;
+class Hypergraph;
+class SentenceMetadata;
struct exhaustive_t {};
diff --git a/decoder/decoder.h b/decoder/decoder.h
index a545206b..6250d1eb 100644
--- a/decoder/decoder.h
+++ b/decoder/decoder.h
@@ -25,7 +25,7 @@ private:
class SentenceMetadata;
class Hypergraph;
-class DecoderImpl;
+struct DecoderImpl;
class DecoderObserver {
public:
@@ -38,7 +38,7 @@ class DecoderObserver {
virtual void NotifyDecodingComplete(const SentenceMetadata& smeta);
};
-class Grammar; // TODO once the decoder interface is cleaned up,
+struct Grammar; // TODO once the decoder interface is cleaned up,
// this should be somewhere else
class Decoder {
public:
diff --git a/decoder/factored_lexicon_helper.h b/decoder/factored_lexicon_helper.h
index 460bdebb..8e89f473 100644
--- a/decoder/factored_lexicon_helper.h
+++ b/decoder/factored_lexicon_helper.h
@@ -7,7 +7,7 @@
#include <map>
#include "tdict.h"
-struct SentenceMetadata;
+class SentenceMetadata;
// when computing features, it can be advantageous to:
// 1) back off to less specific forms (e.g., less highly inflected forms, POS tags, etc)
diff --git a/decoder/ff_csplit.h b/decoder/ff_csplit.h
index 227f2a14..1721ed38 100644
--- a/decoder/ff_csplit.h
+++ b/decoder/ff_csplit.h
@@ -6,7 +6,7 @@
#include "ff.h"
#include "klm/lm/model.hh"
-class BasicCSplitFeaturesImpl;
+struct BasicCSplitFeaturesImpl;
class BasicCSplitFeatures : public FeatureFunction {
public:
BasicCSplitFeatures(const std::string& param);
@@ -22,7 +22,7 @@ class BasicCSplitFeatures : public FeatureFunction {
boost::shared_ptr<BasicCSplitFeaturesImpl> pimpl_;
};
-template <class M> class ReverseCharLMCSplitFeatureImpl;
+template <class M> struct ReverseCharLMCSplitFeatureImpl;
class ReverseCharLMCSplitFeature : public FeatureFunction {
public:
ReverseCharLMCSplitFeature(const std::string& param);
diff --git a/decoder/ff_klm.cc b/decoder/ff_klm.cc
index 339a10c3..d395fb47 100644
--- a/decoder/ff_klm.cc
+++ b/decoder/ff_klm.cc
@@ -347,7 +347,6 @@ void KLanguageModel<Model>::TraversalFeaturesImpl(const SentenceMetadata& /* sme
SparseVector<double>* features,
SparseVector<double>* /*estimated_features*/,
void* state) const {
- double est = 0;
double oovs = 0;
double emit = 0;
features->set_value(fid_, pimpl_->LookupWords(*edge.rule_, ant_states, &oovs, &emit, state));
diff --git a/decoder/ff_klm.h b/decoder/ff_klm.h
index c8350623..7a0b92ec 100644
--- a/decoder/ff_klm.h
+++ b/decoder/ff_klm.h
@@ -7,7 +7,7 @@
#include "ff_factory.h"
#include "ff.h"
-template <class Model> struct KLanguageModelImpl;
+template <class Model> class KLanguageModelImpl;
// the supported template types are instantiated explicitly
// in ff_klm.cc.
diff --git a/decoder/ff_lm.cc b/decoder/ff_lm.cc
index bc51076f..0780b266 100644
--- a/decoder/ff_lm.cc
+++ b/decoder/ff_lm.cc
@@ -211,7 +211,7 @@ class LanguageModelImpl : public LanguageModelInterface {
// may be shorter than actual null-terminated length. context must be null terminated. len is just to save effort for subclasses that don't support contextID
virtual int ContextSize(WordID const* context,int len) {
- unsigned ret;
+ unsigned ret = 0;
//ngram_.contextID((VocabIndex*)context,ret);
return ret;
}
diff --git a/decoder/ff_lm.h b/decoder/ff_lm.h
index 83a2e186..740cc492 100644
--- a/decoder/ff_lm.h
+++ b/decoder/ff_lm.h
@@ -44,8 +44,7 @@ class LanguageModelInterface {
}
};
-struct LanguageModelImpl;
-
+class LanguageModelImpl;
class LanguageModel : public FeatureFunction {
public:
// param = "filename.lm [-o n]"
diff --git a/decoder/ff_ngrams.cc b/decoder/ff_ngrams.cc
index 38e1a60a..a45bd27d 100644
--- a/decoder/ff_ngrams.cc
+++ b/decoder/ff_ngrams.cc
@@ -33,11 +33,12 @@ struct State {
}
const State& operator=(const State<MAX_ORDER>& other) {
memcpy(state, other.state, sizeof(state));
+ return *this;
}
explicit State(const State<MAX_ORDER>& other, unsigned order, WordID extend) {
- char om1 = order - 1;
+ unsigned om1 = order - 1;
if (!om1) { memset(state, 0, sizeof(state)); return; }
- for (char i = 1; i < om1; ++i) state[i - 1]= other.state[i];
+ for (unsigned i = 1; i < om1; ++i) state[i - 1]= other.state[i];
state[om1 - 1] = extend;
}
const WordID& operator[](size_t i) const { return state[i]; }
@@ -249,8 +250,6 @@ class NgramDetectorImpl {
public:
void LookupWords(const TRule& rule, const vector<const void*>& ant_states, SparseVector<double>* feats, SparseVector<double>* est_feats, void* remnant) {
- double sum = 0.0;
- double est_sum = 0.0;
int num_scored = 0;
int num_estimated = 0;
bool saw_eos = false;
@@ -264,7 +263,6 @@ class NgramDetectorImpl {
int unscored_ant_len = UnscoredSize(astate);
for (int k = 0; k < unscored_ant_len; ++k) {
const WordID cur_word = IthUnscoredWord(k, astate);
- const bool is_oov = (cur_word == 0);
SparseVector<double> p;
if (cur_word == kSOS_) {
state = BeginSentenceState();
diff --git a/decoder/ff_ngrams.h b/decoder/ff_ngrams.h
index 5dea9a7d..05b25974 100644
--- a/decoder/ff_ngrams.h
+++ b/decoder/ff_ngrams.h
@@ -7,7 +7,7 @@
#include "ff.h"
-struct NgramDetectorImpl;
+class NgramDetectorImpl;
class NgramDetector : public FeatureFunction {
public:
// param = "filename.lm [-o <order>] [-U <unigram-prefix>] [-B <bigram-prefix>] [-T <trigram-prefix>] [-4 <4-gram-prefix>] [-5 <5-gram-prefix>] [-S <separator>]
diff --git a/decoder/ff_spans.h b/decoder/ff_spans.h
index e2475491..d0036340 100644
--- a/decoder/ff_spans.h
+++ b/decoder/ff_spans.h
@@ -62,7 +62,6 @@ class CMR2008ReorderingFeatures : public FeatureFunction {
// collapsed feature values
bool use_collapsed_features_;
- int fid_reorder_;
std::pair<double, double> uncoditioned_vals_;
std::vector<std::pair<double, double> > fvals_;
};
diff --git a/decoder/ff_wordalign.cc b/decoder/ff_wordalign.cc
index dcb80110..5d4c80c7 100644
--- a/decoder/ff_wordalign.cc
+++ b/decoder/ff_wordalign.cc
@@ -28,8 +28,6 @@ namespace std { using std::tr1::unordered_map; }
#include "tdict.h" // Blunsom hack
#include "filelib.h" // Blunsom hack
-static const int MAX_SENTENCE_SIZE = 100;
-
static const int kNULL_i = 255; // -1 as an unsigned char
using namespace std;
diff --git a/decoder/grammar.h b/decoder/grammar.h
index add1a235..37c7276d 100644
--- a/decoder/grammar.h
+++ b/decoder/grammar.h
@@ -61,7 +61,7 @@ struct Grammar {
typedef boost::shared_ptr<Grammar> GrammarPtr;
-class TGImpl;
+struct TGImpl;
struct TextGrammar : public Grammar {
TextGrammar();
explicit TextGrammar(const std::string& file);
diff --git a/decoder/hg_union.cc b/decoder/hg_union.cc
index a659b6bc..da9f2624 100644
--- a/decoder/hg_union.cc
+++ b/decoder/hg_union.cc
@@ -64,9 +64,9 @@ void Union(const Hypergraph& in, Hypergraph* out) {
double n_created = 0;
for (const auto& in_node : in.nodes_) {
HG::Node& out_node = out->nodes_[h2n[in_node.node_hash]];
- for (const auto oeid : out_node.in_edges_) {
+ //for (const auto oeid : out_node.in_edges_) {
// TODO hash currently existing edges for quick check for duplication
- }
+ //}
for (const auto ieid : in_node.in_edges_) {
const HG::Edge& in_edge = in.edges_[ieid];
// TODO: replace slow N^2 check with hashing
diff --git a/decoder/phrasebased_translator.h b/decoder/phrasebased_translator.h
index 10790d0d..85dc0a26 100644
--- a/decoder/phrasebased_translator.h
+++ b/decoder/phrasebased_translator.h
@@ -3,7 +3,7 @@
#include "translator.h"
-class PhraseBasedTranslatorImpl;
+struct PhraseBasedTranslatorImpl;
class PhraseBasedTranslator : public Translator {
public:
PhraseBasedTranslator(const boost::program_options::variables_map& conf);
diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc
index 538f82ec..9831a3c3 100644
--- a/decoder/scfg_translator.cc
+++ b/decoder/scfg_translator.cc
@@ -62,7 +62,7 @@ PassThroughGrammar::PassThroughGrammar(const Lattice& input, const string& cat,
for (int i = 0; i < input.size(); ++i) {
const vector<LatticeArc>& alts = input[i];
for (int k = 0; k < alts.size(); ++k) {
- const int j = alts[k].dist2next + i;
+ // const int j = alts[k].dist2next + i;
const string& src = TD::Convert(alts[k].label);
if (ss.count(alts[k].label) == 0) {
if (num_pt_features > 0) {
diff --git a/decoder/sentence_metadata.h b/decoder/sentence_metadata.h
index e13c2ca5..27fcac38 100644
--- a/decoder/sentence_metadata.h
+++ b/decoder/sentence_metadata.h
@@ -7,8 +7,8 @@
#include "lattice.h"
#include "tree_fragment.h"
-struct DocScorer; // deprecated, will be removed
-struct Score; // deprecated, will be removed
+class DocScorer; // deprecated, will be removed
+class Score; // deprecated, will be removed
namespace cdec {
enum InputType { kSEQUENCE, kTREE, kLATTICE, kFOREST, kUNKNOWN };
@@ -17,7 +17,7 @@ class TreeFragment;
class SentenceMetadata {
public:
- friend class DecoderImpl;
+ friend struct DecoderImpl;
SentenceMetadata(int id, const Lattice& ref) :
sent_id_(id),
src_len_(-1),
diff --git a/decoder/translator.h b/decoder/translator.h
index 096cf191..37070cda 100644
--- a/decoder/translator.h
+++ b/decoder/translator.h
@@ -54,7 +54,7 @@ class Translator {
State state_;
};
-class SCFGTranslatorImpl;
+struct SCFGTranslatorImpl;
class SCFGTranslator : public Translator {
public:
SCFGTranslator(const boost::program_options::variables_map& conf);
@@ -72,7 +72,7 @@ class SCFGTranslator : public Translator {
boost::shared_ptr<SCFGTranslatorImpl> pimpl_;
};
-class FSTTranslatorImpl;
+struct FSTTranslatorImpl;
class FSTTranslator : public Translator {
public:
FSTTranslator(const boost::program_options::variables_map& conf);
@@ -85,7 +85,7 @@ class FSTTranslator : public Translator {
boost::shared_ptr<FSTTranslatorImpl> pimpl_;
};
-class RescoreTranslatorImpl;
+struct RescoreTranslatorImpl;
class RescoreTranslator : public Translator {
public:
RescoreTranslator(const boost::program_options::variables_map& conf);
@@ -98,7 +98,7 @@ class RescoreTranslator : public Translator {
boost::shared_ptr<RescoreTranslatorImpl> pimpl_;
};
-class Tree2StringTranslatorImpl;
+struct Tree2StringTranslatorImpl;
class Tree2StringTranslator : public Translator {
public:
Tree2StringTranslator(const boost::program_options::variables_map& conf,
diff --git a/decoder/tree_fragment.cc b/decoder/tree_fragment.cc
index 5f717c5b..ff406adf 100644
--- a/decoder/tree_fragment.cc
+++ b/decoder/tree_fragment.cc
@@ -79,7 +79,7 @@ void TreeFragment::ParseRec(const StringPiece& tree, bool afs, unsigned cp, unsi
cerr << "Expected ( at " << cp << endl;
abort();
}
- const unsigned i = symp;
+ // const unsigned i = symp;
vector<unsigned> rhs; // w | 0 = terminal, w | NT_BIT, index | FRONTIER_BIT
++cp;
while(tree[cp] == ' ') { ++cp; }
@@ -119,7 +119,7 @@ void TreeFragment::ParseRec(const StringPiece& tree, bool afs, unsigned cp, unsi
}
}
} // continuent has completed, cp is at ), build node
- const unsigned j = symp; // span from (i,j)
+ // const unsigned j = symp; // span from (i,j)
// add an internal non-terminal symbol
const unsigned nt = TD::Convert(tree.substr(nt_start, nt_end - nt_start).as_string()) | RHS_BIT;
nodes[np] = TreeFragmentProduction(nt, rhs);
diff --git a/decoder/trule.h b/decoder/trule.h
index 7af46747..dda85cef 100644
--- a/decoder/trule.h
+++ b/decoder/trule.h
@@ -16,7 +16,7 @@
class TRule;
typedef boost::shared_ptr<TRule> TRulePtr;
-namespace cdec { struct TreeFragment; }
+namespace cdec { class TreeFragment; }
struct AlignmentPoint {
AlignmentPoint() : s_(), t_() {}
diff --git a/example_extff/CMakeLists.txt b/example_extff/CMakeLists.txt
new file mode 100644
index 00000000..5170a0b2
--- /dev/null
+++ b/example_extff/CMakeLists.txt
@@ -0,0 +1,10 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../klm)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../decoder)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+set(ff_example_LIB_SRCS ff_example.cc)
+add_library(ff_example SHARED ${ff_example_LIB_SRCS})
+target_link_libraries(ff_example libcdec utils)
+set_target_properties(ff_example PROPERTIES VERSION 1.0.0 SOVERSION 1)
diff --git a/example_extff/Makefile.am b/example_extff/Makefile.am
deleted file mode 100644
index 6abfe6c5..00000000
--- a/example_extff/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir) -I$(top_srcdir)/mteval -I$(top_srcdir)/utils -I$(top_srcdir)/klm -I$(top_srcdir)/decoder
-
-lib_LTLIBRARIES = libff_example.la
-libff_example_la_SOURCES = ff_example.cc
-libff_example_la_LDFLAGS = -version-info 1:0:0 -module
diff --git a/extractor/CMakeLists.txt b/extractor/CMakeLists.txt
new file mode 100644
index 00000000..93a524cc
--- /dev/null
+++ b/extractor/CMakeLists.txt
@@ -0,0 +1,141 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/features)
+
+find_package(OpenMP)
+if (OPENMP_FOUND)
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+endif()
+
+find_package(GTest)
+find_package(GMock)
+if(GTEST_FOUND)
+ if(GMOCK_FOUND)
+ #rule_factory_test.cc
+ set(TEST_SRCS alignment_test.cc
+ data_array_test.cc
+ fast_intersector_test.cc
+ grammar_extractor_test.cc
+ matchings_finder_test.cc
+ matchings_sampler_test.cc
+ phrase_location_sampler_test.cc
+ phrase_test.cc
+ precomputation_test.cc
+ rule_extractor_helper_test.cc
+ rule_extractor_test.cc
+ scorer2_test.cc
+ suffix_array_sampler_test.cc
+ suffix_array_test.cc
+ target_phrase_extractor_test.cc
+ translation_table_test.cc
+ vocabulary_test.cc)
+ INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
+ INCLUDE_DIRECTORIES(${GMOCK_INCLUDE_DIRS})
+ foreach(testSrc ${TEST_SRCS})
+ #Extract the filename without an extension (NAME_WE)
+ get_filename_component(testName ${testSrc} NAME_WE)
+
+ #Add compile target
+ add_executable(${testName} ${testSrc})
+
+ #link to Boost libraries AND your targets and dependencies
+ target_link_libraries(${testName} extractor ${GMOCK_BOTH_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+ #I like to move testing binaries into a testBin directory
+ set_target_properties(${testName} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ #Finally add it to test execution -
+ #Notice the WORKING_DIRECTORY and COMMAND
+ add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ endforeach(testSrc)
+ endif(GMOCK_FOUND)
+endif(GTEST_FOUND)
+
+set(sacompile_SRCS sacompile.cc)
+add_executable(sacompile ${sacompile_SRCS})
+target_link_libraries(sacompile extractor ${Boost_LIBRARIES} z)
+
+set(run_extractor_SRCS run_extractor.cc)
+add_executable(run_extractor ${run_extractor_SRCS})
+target_link_libraries(run_extractor extractor ${Boost_LIBRARIES} z)
+
+
+set(extract_SRCS extract.cc)
+add_executable(extract ${extract_SRCS})
+target_link_libraries(extract extractor utils ${Boost_LIBRARIES} z)
+
+
+set(extractor_STAT_SRCS
+ alignment.cc
+ backoff_sampler.cc
+ data_array.cc
+ fast_intersector.cc
+ features/count_source_target.cc
+ features/feature.cc
+ features/is_source_singleton.cc
+ features/is_source_target_singleton.cc
+ features/max_lex_source_given_target.cc
+ features/max_lex_target_given_source.cc
+ features/sample_source_count.cc
+ features/target_given_source_coherent.cc
+ features/count_source_target.h
+ features/feature.h
+ features/is_source_singleton.h
+ features/is_source_target_singleton.h
+ features/max_lex_source_given_target.h
+ features/max_lex_target_given_source.h
+ features/sample_source_count.h
+ features/target_given_source_coherent.h
+ grammar.cc
+ grammar_extractor.cc
+ matchings_finder.cc
+ matchings_sampler.cc
+ matchings_trie.cc
+ phrase.cc
+ phrase_builder.cc
+ phrase_location.cc
+ phrase_location_sampler.cc
+ precomputation.cc
+ rule.cc
+ rule_extractor.cc
+ rule_extractor_helper.cc
+ rule_factory.cc
+ scorer.cc
+ suffix_array.cc
+ suffix_array_sampler.cc
+ target_phrase_extractor.cc
+ time_util.cc
+ translation_table.cc
+ vocabulary.cc
+ alignment.h
+ backoff_sampler.h
+ data_array.h
+ fast_intersector.h
+ grammar.h
+ grammar_extractor.h
+ matchings_finder.h
+ matchings_sampler.h
+ matchings_trie.h
+ phrase.h
+ phrase_builder.h
+ phrase_location.h
+ phrase_location_sampler.h
+ precomputation.h
+ rule.h
+ rule_extractor.h
+ rule_extractor_helper.h
+ rule_factory.h
+ sampler.h
+ scorer.h
+ suffix_array.h
+ suffix_array_sampler.h
+ target_phrase_extractor.h
+ time_util.h
+ translation_table.h
+ vocabulary.h)
+
+add_library(extractor STATIC ${extractor_STAT_SRCS})
+
diff --git a/extractor/Makefile.am b/extractor/Makefile.am
deleted file mode 100644
index a406d9dc..00000000
--- a/extractor/Makefile.am
+++ /dev/null
@@ -1,192 +0,0 @@
-
-bin_PROGRAMS = sacompile run_extractor extract
-
-EXTRA_PROGRAMS = alignment_test \
- data_array_test \
- fast_intersector_test \
- feature_count_source_target_test \
- feature_is_source_singleton_test \
- feature_is_source_target_singleton_test \
- feature_max_lex_source_given_target_test \
- feature_max_lex_target_given_source_test \
- feature_sample_source_count_test \
- feature_target_given_source_coherent_test \
- grammar_extractor_test \
- matchings_finder_test \
- matchings_sampler_test \
- phrase_location_sampler_test \
- phrase_test \
- precomputation_test \
- rule_extractor_helper_test \
- rule_extractor_test \
- rule_factory_test \
- scorer_test \
- suffix_array_sampler_test \
- suffix_array_test \
- target_phrase_extractor_test \
- translation_table_test \
- vocabulary_test
-
-if HAVE_GTEST
- RUNNABLE_TESTS = alignment_test \
- data_array_test \
- fast_intersector_test \
- feature_count_source_target_test \
- feature_is_source_singleton_test \
- feature_is_source_target_singleton_test \
- feature_max_lex_source_given_target_test \
- feature_max_lex_target_given_source_test \
- feature_sample_source_count_test \
- feature_target_given_source_coherent_test \
- grammar_extractor_test \
- matchings_finder_test \
- matchings_sampler_test \
- phrase_location_sampler_test \
- phrase_test \
- precomputation_test \
- rule_extractor_helper_test \
- rule_extractor_test \
- rule_factory_test \
- scorer_test \
- suffix_array_sampler_test \
- suffix_array_test \
- target_phrase_extractor_test \
- translation_table_test \
- vocabulary_test
-endif
-
-noinst_PROGRAMS = $(RUNNABLE_TESTS)
-
-TESTS = $(RUNNABLE_TESTS)
-
-alignment_test_SOURCES = alignment_test.cc
-alignment_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libextractor.a
-data_array_test_SOURCES = data_array_test.cc
-data_array_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libextractor.a
-fast_intersector_test_SOURCES = fast_intersector_test.cc
-fast_intersector_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-feature_count_source_target_test_SOURCES = features/count_source_target_test.cc
-feature_count_source_target_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libextractor.a
-feature_is_source_singleton_test_SOURCES = features/is_source_singleton_test.cc
-feature_is_source_singleton_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libextractor.a
-feature_is_source_target_singleton_test_SOURCES = features/is_source_target_singleton_test.cc
-feature_is_source_target_singleton_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libextractor.a
-feature_max_lex_source_given_target_test_SOURCES = features/max_lex_source_given_target_test.cc
-feature_max_lex_source_given_target_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-feature_max_lex_target_given_source_test_SOURCES = features/max_lex_target_given_source_test.cc
-feature_max_lex_target_given_source_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-feature_sample_source_count_test_SOURCES = features/sample_source_count_test.cc
-feature_sample_source_count_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libextractor.a
-feature_target_given_source_coherent_test_SOURCES = features/target_given_source_coherent_test.cc
-feature_target_given_source_coherent_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libextractor.a
-grammar_extractor_test_SOURCES = grammar_extractor_test.cc
-grammar_extractor_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-matchings_finder_test_SOURCES = matchings_finder_test.cc
-matchings_finder_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-matchings_sampler_test_SOURCES = matchings_sampler_test.cc
-matchings_sampler_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-phrase_location_sampler_test_SOURCES = phrase_location_sampler_test.cc
-phrase_location_sampler_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-phrase_test_SOURCES = phrase_test.cc
-phrase_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-precomputation_test_SOURCES = precomputation_test.cc
-precomputation_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-rule_extractor_helper_test_SOURCES = rule_extractor_helper_test.cc
-rule_extractor_helper_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-rule_extractor_test_SOURCES = rule_extractor_test.cc
-rule_extractor_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-rule_factory_test_SOURCES = rule_factory_test.cc
-rule_factory_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-scorer_test_SOURCES = scorer_test.cc
-scorer_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-suffix_array_sampler_test_SOURCES = suffix_array_sampler_test.cc
-suffix_array_sampler_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-suffix_array_test_SOURCES = suffix_array_test.cc
-suffix_array_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-target_phrase_extractor_test_SOURCES = target_phrase_extractor_test.cc
-target_phrase_extractor_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-translation_table_test_SOURCES = translation_table_test.cc
-translation_table_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) $(GMOCK_LDFLAGS) $(GMOCK_LIBS) libextractor.a
-vocabulary_test_SOURCES = vocabulary_test.cc
-vocabulary_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libextractor.a
-
-noinst_LIBRARIES = libextractor.a
-
-sacompile_SOURCES = sacompile.cc
-sacompile_LDADD = libextractor.a
-run_extractor_SOURCES = run_extractor.cc
-run_extractor_LDADD = libextractor.a
-extract_SOURCES = extract.cc
-extract_LDADD = libextractor.a
-
-libextractor_a_SOURCES = \
- alignment.cc \
- backoff_sampler.cc \
- data_array.cc \
- fast_intersector.cc \
- features/count_source_target.cc \
- features/feature.cc \
- features/is_source_singleton.cc \
- features/is_source_target_singleton.cc \
- features/max_lex_source_given_target.cc \
- features/max_lex_target_given_source.cc \
- features/sample_source_count.cc \
- features/target_given_source_coherent.cc \
- features/count_source_target.h \
- features/feature.h \
- features/is_source_singleton.h \
- features/is_source_target_singleton.h \
- features/max_lex_source_given_target.h \
- features/max_lex_target_given_source.h \
- features/sample_source_count.h \
- features/target_given_source_coherent.h \
- grammar.cc \
- grammar_extractor.cc \
- matchings_finder.cc \
- matchings_sampler.cc \
- matchings_trie.cc \
- phrase.cc \
- phrase_builder.cc \
- phrase_location.cc \
- phrase_location_sampler.cc \
- precomputation.cc \
- rule.cc \
- rule_extractor.cc \
- rule_extractor_helper.cc \
- rule_factory.cc \
- scorer.cc \
- suffix_array.cc \
- suffix_array_sampler.cc \
- target_phrase_extractor.cc \
- time_util.cc \
- translation_table.cc \
- vocabulary.cc \
- alignment.h \
- backoff_sampler.h \
- data_array.h \
- fast_intersector.h \
- grammar.h \
- grammar_extractor.h \
- matchings_finder.h \
- matchings_sampler.h \
- matchings_trie.h \
- phrase.h \
- phrase_builder.h \
- phrase_location.h \
- phrase_location_sampler.h \
- precomputation.h \
- rule.h \
- rule_extractor.h \
- rule_extractor_helper.h \
- rule_factory.h \
- sampler.h \
- scorer.h \
- suffix_array.h \
- suffix_array_sampler.h \
- target_phrase_extractor.h \
- time_util.h \
- translation_table.h \
- vocabulary.h
-
-AM_CPPFLAGS = -W -Wall -Wno-sign-compare $(OPENMP_CXXFLAGS) $(GTEST_CPPFLAGS) $(GMOCK_CPPFLAGS)
-AM_LDFLAGS = $(OPENMP_CXXFLAGS)
diff --git a/extractor/extract.cc b/extractor/extract.cc
index e5b6f6ff..08f209cc 100644
--- a/extractor/extract.cc
+++ b/extractor/extract.cc
@@ -14,6 +14,7 @@
const unsigned omp_get_num_threads() { return 1; }
#endif
+#include "filelib.h"
#include "alignment.h"
#include "data_array.h"
#include "features/count_source_target.h"
@@ -42,8 +43,8 @@ using namespace features;
using namespace std;
// Returns the file path in which a given grammar should be written.
-fs::path GetGrammarFilePath(const fs::path& grammar_path, int file_number) {
- string file_name = "grammar." + to_string(file_number);
+fs::path GetGrammarFilePath(const fs::path& grammar_path, int file_number, bool use_zip) {
+ string file_name = "grammar." + to_string(file_number) + (use_zip ? ".gz" : "");
return grammar_path / file_name;
}
@@ -58,6 +59,7 @@ int main(int argc, char** argv) {
("threads,t", po::value<int>()->required()->default_value(1),
threads_option.c_str())
("grammars,g", po::value<string>()->required(), "Grammars output path")
+ ("gzip,z", "Gzip grammars")
("max_rule_span", po::value<int>()->default_value(15),
"Maximum rule span")
("max_rule_symbols", po::value<int>()->default_value(5),
@@ -205,12 +207,14 @@ int main(int argc, char** argv) {
vm["max_rule_symbols"].as<int>(),
vm["max_samples"].as<int>(),
vm["tight_phrases"].as<bool>());
+ const bool use_zip = vm.count("gzip");
// Creates the grammars directory if it doesn't exist.
fs::path grammar_path = vm["grammars"].as<string>();
if (!fs::is_directory(grammar_path)) {
fs::create_directory(grammar_path);
}
+ grammar_path = fs::canonical(grammar_path);
// Reads all sentences for which we extract grammar rules (the paralellization
// is simplified if we read all sentences upfront).
@@ -239,12 +243,12 @@ int main(int argc, char** argv) {
}
Grammar grammar = extractor.GetGrammar(
sentences[i], blacklisted_sentence_ids);
- ofstream output(GetGrammarFilePath(grammar_path, i).c_str());
- output << grammar;
+ WriteFile wf(GetGrammarFilePath(grammar_path, i, use_zip).c_str());
+ *wf.stream() << grammar;
}
for (size_t i = 0; i < sentences.size(); ++i) {
- cout << "<seg grammar=" << GetGrammarFilePath(grammar_path, i) << " id=\""
+ cout << "<seg grammar=" << GetGrammarFilePath(grammar_path, i, use_zip) << " id=\""
<< i << "\"> " << sentences[i] << " </seg> " << suffixes[i] << endl;
}
diff --git a/extractor/scorer_test.cc b/extractor/scorer2_test.cc
index bf77f7ef..bf77f7ef 100644
--- a/extractor/scorer_test.cc
+++ b/extractor/scorer2_test.cc
diff --git a/klm/lm/CMakeLists.txt b/klm/lm/CMakeLists.txt
new file mode 100644
index 00000000..fcd288c1
--- /dev/null
+++ b/klm/lm/CMakeLists.txt
@@ -0,0 +1,137 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+find_package(RT QUIET)
+
+set(build_binary_SRCS build_binary_main.cc)
+add_executable(build_binary ${build_binary_SRCS})
+set(ngram_query_SRCS query_main.cc)
+add_executable(ngram_query ${ngram_query_SRCS})
+if (HAVE_RT)
+ target_link_libraries(build_binary klm klm_util klm_util_double z ${RT_LIBRARIES})
+ target_link_libraries(ngram_query klm klm_util klm_util_double z ${RT_LIBRARIES})
+else (HAVE_RT)
+ target_link_libraries(build_binary klm klm_util klm_util_double z)
+ target_link_libraries(ngram_query klm klm_util klm_util_double z)
+endif (HAVE_RT)
+
+
+
+
+set(klm_STAT_SRCS
+ bhiksha.hh
+ binary_format.hh
+ blank.hh
+ config.hh
+ enumerate_vocab.hh
+ facade.hh
+ left.hh
+ lm_exception.hh
+ max_order.hh
+ model.hh
+ model_type.hh
+ ngram_query.hh
+ partial.hh
+ quantize.hh
+ read_arpa.hh
+ return.hh
+ search_hashed.hh
+ search_trie.hh
+ sizes.hh
+ state.hh
+ trie.hh
+ trie_sort.hh
+ value.hh
+ value_build.hh
+ virtual_interface.hh
+ vocab.hh
+ weights.hh
+ word_index.hh
+ bhiksha.cc
+ binary_format.cc
+ config.cc
+ lm_exception.cc
+ quantize.cc
+ model.cc
+ read_arpa.cc
+ search_hashed.cc
+ search_trie.cc
+ sizes.cc
+ trie.cc
+ trie_sort.cc
+ value_build.cc
+ virtual_interface.cc
+ vocab.cc)
+
+add_library(klm STATIC ${klm_STAT_SRCS})
+
+
+########### install files ###############
+
+
+
+
+#original Makefile.am contents follow:
+
+#bin_PROGRAMS = build_binary ngram_query
+#
+#build_binary_SOURCES = build_binary_main.cc
+#build_binary_LDADD = libklm.a ../util/libklm_util.a ../util/double-conversion/libklm_util_double.a -lz
+#
+#ngram_query_SOURCES = query_main.cc
+#ngram_query_LDADD = libklm.a ../util/libklm_util.a ../util/double-conversion/libklm_util_double.a -lz
+#
+##noinst_PROGRAMS = \
+## ngram_test
+##TESTS = ngram_test
+##ngram_test_SOURCES = ngram_test.cc
+##ngram_test_LDADD = ../util/libklm_util.a
+#
+#noinst_LIBRARIES = libklm.a
+#
+#libklm_a_SOURCES = \
+# bhiksha.hh \
+# binary_format.hh \
+# blank.hh \
+# config.hh \
+# enumerate_vocab.hh \
+# facade.hh \
+# left.hh \
+# lm_exception.hh \
+# max_order.hh \
+# model.hh \
+# model_type.hh \
+# ngram_query.hh \
+# partial.hh \
+# quantize.hh \
+# read_arpa.hh \
+# return.hh \
+# search_hashed.hh \
+# search_trie.hh \
+# sizes.hh \
+# state.hh \
+# trie.hh \
+# trie_sort.hh \
+# value.hh \
+# value_build.hh \
+# virtual_interface.hh \
+# vocab.hh \
+# weights.hh \
+# word_index.hh \
+# bhiksha.cc \
+# binary_format.cc \
+# config.cc \
+# lm_exception.cc \
+# quantize.cc \
+# model.cc \
+# read_arpa.cc \
+# search_hashed.cc \
+# search_trie.cc \
+# sizes.cc \
+# trie.cc \
+# trie_sort.cc \
+# value_build.cc \
+# virtual_interface.cc \
+# vocab.cc
+#
+#AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/klm
+#
diff --git a/klm/lm/Makefile.am b/klm/lm/Makefile.am
deleted file mode 100644
index 48b0ba34..00000000
--- a/klm/lm/Makefile.am
+++ /dev/null
@@ -1,63 +0,0 @@
-bin_PROGRAMS = build_binary ngram_query
-
-build_binary_SOURCES = build_binary_main.cc
-build_binary_LDADD = libklm.a ../util/libklm_util.a ../util/double-conversion/libklm_util_double.a -lz
-
-ngram_query_SOURCES = query_main.cc
-ngram_query_LDADD = libklm.a ../util/libklm_util.a ../util/double-conversion/libklm_util_double.a -lz
-
-#noinst_PROGRAMS = \
-# ngram_test
-#TESTS = ngram_test
-#ngram_test_SOURCES = ngram_test.cc
-#ngram_test_LDADD = ../util/libklm_util.a
-
-noinst_LIBRARIES = libklm.a
-
-libklm_a_SOURCES = \
- bhiksha.hh \
- binary_format.hh \
- blank.hh \
- config.hh \
- enumerate_vocab.hh \
- facade.hh \
- left.hh \
- lm_exception.hh \
- max_order.hh \
- model.hh \
- model_type.hh \
- ngram_query.hh \
- partial.hh \
- quantize.hh \
- read_arpa.hh \
- return.hh \
- search_hashed.hh \
- search_trie.hh \
- sizes.hh \
- state.hh \
- trie.hh \
- trie_sort.hh \
- value.hh \
- value_build.hh \
- virtual_interface.hh \
- vocab.hh \
- weights.hh \
- word_index.hh \
- bhiksha.cc \
- binary_format.cc \
- config.cc \
- lm_exception.cc \
- quantize.cc \
- model.cc \
- read_arpa.cc \
- search_hashed.cc \
- search_trie.cc \
- sizes.cc \
- trie.cc \
- trie_sort.cc \
- value_build.cc \
- virtual_interface.cc \
- vocab.cc
-
-AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/klm
-
diff --git a/klm/lm/builder/CMakeLists.txt b/klm/lm/builder/CMakeLists.txt
new file mode 100644
index 00000000..5fb1b2d2
--- /dev/null
+++ b/klm/lm/builder/CMakeLists.txt
@@ -0,0 +1,31 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../..)
+
+set(lmplz_SRCS
+ lmplz_main.cc
+ adjust_counts.cc
+ adjust_counts.hh
+ corpus_count.cc
+ corpus_count.hh
+ discount.hh
+ hash_gamma.hh
+ header_info.hh
+ initial_probabilities.cc
+ initial_probabilities.hh
+ interpolate.cc
+ interpolate.hh
+ joint_order.hh
+ multi_stream.hh
+ ngram.hh
+ ngram_stream.hh
+ pipeline.cc
+ pipeline.hh
+ print.cc
+ print.hh
+ sort.hh)
+
+add_executable(lmplz ${lmplz_SRCS})
+target_link_libraries(lmplz klm klm_util_double klm_util_stream klm_util ${Boost_LIBRARIES})
+
+set(dump_counts_SRCS print.cc dump_counts_main.cc)
+add_executable(dump_counts ${dump_counts_SRCS})
+target_link_libraries(dump_counts klm klm_util_double klm_util_stream klm_util ${Boost_LIBRARIES})
diff --git a/klm/lm/builder/Makefile.am b/klm/lm/builder/Makefile.am
deleted file mode 100644
index bb15ff04..00000000
--- a/klm/lm/builder/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-bin_PROGRAMS = lmplz dump_counts
-
-dump_counts_SOURCES = \
- print.cc \
- dump_counts_main.cc
-
-lmplz_SOURCES = \
- lmplz_main.cc \
- adjust_counts.cc \
- adjust_counts.hh \
- corpus_count.cc \
- corpus_count.hh \
- discount.hh \
- hash_gamma.hh \
- header_info.hh \
- initial_probabilities.cc \
- initial_probabilities.hh \
- interpolate.cc \
- interpolate.hh \
- joint_order.hh \
- multi_stream.hh \
- ngram.hh \
- ngram_stream.hh \
- pipeline.cc \
- pipeline.hh \
- print.cc \
- print.hh \
- sort.hh
-
-dump_counts_LDADD = ../libklm.a ../../util/double-conversion/libklm_util_double.a ../../util/stream/libklm_util_stream.a ../../util/libklm_util.a $(BOOST_THREAD_LIBS)
-lmplz_LDADD = ../libklm.a ../../util/double-conversion/libklm_util_double.a ../../util/stream/libklm_util_stream.a ../../util/libklm_util.a $(BOOST_THREAD_LIBS)
-
-AM_CPPFLAGS = -W -Wall -I$(top_srcdir)/klm
-
diff --git a/klm/search/CMakeLists.txt b/klm/search/CMakeLists.txt
new file mode 100644
index 00000000..af352499
--- /dev/null
+++ b/klm/search/CMakeLists.txt
@@ -0,0 +1,22 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+set(ksearch_STAT_SRCS
+ applied.hh
+ config.hh
+ context.hh
+ dedupe.hh
+ edge.hh
+ edge_generator.cc
+ edge_generator.hh
+ header.hh
+ nbest.cc
+ nbest.hh
+ rule.cc
+ rule.hh
+ types.hh
+ vertex.cc
+ vertex.hh
+ vertex_generator.hh)
+
+add_library(ksearch STATIC ${ksearch_STAT_SRCS})
+
diff --git a/klm/search/Makefile.am b/klm/search/Makefile.am
deleted file mode 100644
index b7f01c24..00000000
--- a/klm/search/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-noinst_LIBRARIES = libksearch.a
-
-libksearch_a_SOURCES = \
- applied.hh \
- config.hh \
- context.hh \
- dedupe.hh \
- edge.hh \
- edge_generator.cc \
- edge_generator.hh \
- header.hh \
- nbest.cc \
- nbest.hh \
- rule.cc \
- rule.hh \
- types.hh \
- vertex.cc \
- vertex.hh \
- vertex_generator.hh
-
-AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I..
-
diff --git a/klm/util/CMakeLists.txt b/klm/util/CMakeLists.txt
new file mode 100644
index 00000000..bef1db78
--- /dev/null
+++ b/klm/util/CMakeLists.txt
@@ -0,0 +1,53 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+set(cat_compressed_SRCS cat_compressed_main.cc)
+
+add_executable(cat_compressed ${cat_compressed_SRCS})
+target_link_libraries(cat_compressed klm_util)
+
+set(klm_util_STAT_SRCS
+ bit_packing.cc
+ bit_packing.hh
+ ersatz_progress.cc
+ ersatz_progress.hh
+ exception.cc
+ exception.hh
+ fake_ofstream.hh
+ file.cc
+ file.hh
+ file_piece.cc
+ file_piece.hh
+ fixed_array.hh
+ getopt.c
+ getopt.hh
+ have.hh
+ joint_sort.hh
+ mmap.cc
+ mmap.hh
+ multi_intersection.hh
+ murmur_hash.cc
+ murmur_hash.hh
+ parallel_read.cc
+ parallel_read.hh
+ pcqueue.hh
+ pool.cc
+ pool.hh
+ probing_hash_table.hh
+ proxy_iterator.hh
+ read_compressed.cc
+ read_compressed.hh
+ scoped.cc
+ scoped.hh
+ sized_iterator.hh
+ sorted_uniform.hh
+ string_piece.cc
+ string_piece.hh
+ string_piece_hash.hh
+ thread_pool.hh
+ tokenize_piece.hh
+ unistd.hh
+ usage.cc
+ usage.hh)
+
+add_library(klm_util STATIC ${klm_util_STAT_SRCS})
+
diff --git a/klm/util/Makefile.am b/klm/util/Makefile.am
deleted file mode 100644
index 5db6e340..00000000
--- a/klm/util/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-
-noinst_PROGRAMS = cat_compressed
-
-cat_compressed_SOURCES = cat_compressed_main.cc
-cat_compressed_LDADD = libklm_util.a
-
-#TESTS = \
-# file_piece_test \
-# joint_sort_test \
-# key_value_packing_test \
-# probing_hash_table_test \
-# sorted_uniform_test
-# file_piece_test \
-# joint_sort_test \
-# key_value_packing_test \
-# probing_hash_table_test \
-# sorted_uniform_test
-
-noinst_LIBRARIES = libklm_util.a
-
-libklm_util_a_SOURCES = \
- bit_packing.cc \
- bit_packing.hh \
- ersatz_progress.cc \
- ersatz_progress.hh \
- exception.cc \
- exception.hh \
- fake_ofstream.hh \
- file.cc \
- file.hh \
- file_piece.cc \
- file_piece.hh \
- fixed_array.hh \
- getopt.c \
- getopt.hh \
- have.hh \
- joint_sort.hh \
- mmap.cc \
- mmap.hh \
- multi_intersection.hh \
- murmur_hash.cc \
- murmur_hash.hh \
- parallel_read.cc \
- parallel_read.hh \
- pcqueue.hh \
- pool.cc \
- pool.hh \
- probing_hash_table.hh \
- proxy_iterator.hh \
- read_compressed.cc \
- read_compressed.hh \
- scoped.cc \
- scoped.hh \
- sized_iterator.hh \
- sorted_uniform.hh \
- string_piece.cc \
- string_piece.hh \
- string_piece_hash.hh \
- thread_pool.hh \
- tokenize_piece.hh \
- unistd.hh \
- usage.cc \
- usage.hh
-
-AM_CPPFLAGS = -W -Wall -I$(top_srcdir)/klm -I$(top_srcdir)/klm/util/double-conversion
-
diff --git a/klm/util/double-conversion/CMakeLists.txt b/klm/util/double-conversion/CMakeLists.txt
new file mode 100644
index 00000000..df4162dc
--- /dev/null
+++ b/klm/util/double-conversion/CMakeLists.txt
@@ -0,0 +1,24 @@
+
+
+set(klm_util_double_STAT_SRCS
+ bignum-dtoa.h
+ bignum.h
+ cached-powers.h
+ diy-fp.h
+ double-conversion.h
+ fast-dtoa.h
+ fixed-dtoa.h
+ ieee.h
+ strtod.h
+ utils.h
+ bignum.cc
+ bignum-dtoa.cc
+ cached-powers.cc
+ diy-fp.cc
+ double-conversion.cc
+ fast-dtoa.cc
+ fixed-dtoa.cc
+ strtod.cc)
+
+add_library(klm_util_double STATIC ${klm_util_double_STAT_SRCS})
+
diff --git a/klm/util/double-conversion/Makefile.am b/klm/util/double-conversion/Makefile.am
deleted file mode 100644
index dfcfb009..00000000
--- a/klm/util/double-conversion/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-noinst_LIBRARIES = libklm_util_double.a
-
-libklm_util_double_a_SOURCES = \
- bignum-dtoa.h \
- bignum.h \
- cached-powers.h \
- diy-fp.h \
- double-conversion.h \
- fast-dtoa.h \
- fixed-dtoa.h \
- ieee.h \
- strtod.h \
- utils.h \
- bignum.cc \
- bignum-dtoa.cc \
- cached-powers.cc \
- diy-fp.cc \
- double-conversion.cc \
- fast-dtoa.cc \
- fixed-dtoa.cc \
- strtod.cc
-
-AM_CPPFLAGS = -W -Wall -I$(top_srcdir)/klm -I$(top_srcdir)/klm/util/double-conversion
diff --git a/klm/util/stream/CMakeLists.txt b/klm/util/stream/CMakeLists.txt
new file mode 100644
index 00000000..3ca25f17
--- /dev/null
+++ b/klm/util/stream/CMakeLists.txt
@@ -0,0 +1,20 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../..)
+
+set(klm_util_stream_STAT_SRCS
+ block.hh
+ chain.cc
+ chain.hh
+ config.hh
+ io.cc
+ io.hh
+ line_input.cc
+ line_input.hh
+ multi_progress.cc
+ multi_progress.hh
+ multi_stream.hh
+ sort.hh
+ stream.hh
+ timer.hh)
+
+add_library(klm_util_stream STATIC ${klm_util_stream_STAT_SRCS})
+
diff --git a/klm/util/stream/Makefile.am b/klm/util/stream/Makefile.am
deleted file mode 100644
index 25817b50..00000000
--- a/klm/util/stream/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-noinst_LIBRARIES = libklm_util_stream.a
-
-libklm_util_stream_a_SOURCES = \
- block.hh \
- chain.cc \
- chain.hh \
- config.hh \
- io.cc \
- io.hh \
- line_input.cc \
- line_input.hh \
- multi_progress.cc \
- multi_progress.hh \
- multi_stream.hh \
- sort.hh \
- stream.hh \
- timer.hh
-
-AM_CPPFLAGS = -W -Wall -I$(top_srcdir)/klm
-
-#-I$(top_srcdir)/klm/util/double-conversion
diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4
deleted file mode 100644
index 2cf20de1..00000000
--- a/m4/acx_pthread.m4
+++ /dev/null
@@ -1,363 +0,0 @@
-# This was retrieved from
-# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi
-# See also (perhaps for new versions?)
-# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi
-#
-# We've rewritten the inconsistency check code (from avahi), to work
-# more broadly. In particular, it no longer assumes ld accepts -zdefs.
-# This caused a restructing of the code, but the functionality has only
-# changed a little.
-
-dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-dnl
-dnl @summary figure out how to build C programs using POSIX threads
-dnl
-dnl This macro figures out how to build C programs using POSIX threads.
-dnl It sets the PTHREAD_LIBS output variable to the threads library and
-dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
-dnl C compiler flags that are needed. (The user can also force certain
-dnl compiler flags/libs to be tested by setting these environment
-dnl variables.)
-dnl
-dnl Also sets PTHREAD_CC to any special C compiler that is needed for
-dnl multi-threaded programs (defaults to the value of CC otherwise).
-dnl (This is necessary on AIX to use the special cc_r compiler alias.)
-dnl
-dnl NOTE: You are assumed to not only compile your program with these
-dnl flags, but also link it with them as well. e.g. you should link
-dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
-dnl $LIBS
-dnl
-dnl If you are only building threads programs, you may wish to use
-dnl these variables in your default LIBS, CFLAGS, and CC:
-dnl
-dnl LIBS="$PTHREAD_LIBS $LIBS"
-dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-dnl CC="$PTHREAD_CC"
-dnl
-dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
-dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
-dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-dnl
-dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
-dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
-dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
-dnl default action will define HAVE_PTHREAD.
-dnl
-dnl Please let the authors know if this macro fails on any platform, or
-dnl if you have any other suggestions or comments. This macro was based
-dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
-dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
-dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
-dnl We are also grateful for the helpful feedback of numerous users.
-dnl
-dnl @category InstalledPackages
-dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
-dnl @version 2006-05-29
-dnl @license GPLWithACException
-dnl
-dnl Checks for GCC shared/pthread inconsistency based on work by
-dnl Marcin Owsiany <marcin@owsiany.pl>
-
-
-AC_DEFUN([ACX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-AC_LANG_SAVE
-AC_LANG_C
-acx_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
- AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
- AC_MSG_RESULT($acx_pthread_ok)
- if test x"$acx_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-fi
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# Create a list of thread flags to try. Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all, and "pthread-config"
-# which is a program returning the flags for the Pth emulation library.
-
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-
-# The ordering *is* (sometimes) important. Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-# other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# ... -mt is also the pthreads flag for HP/aCC
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-# pthread-config: use pthread-config program (for GNU Pth library)
-
-case "${host_cpu}-${host_os}" in
- *solaris*)
-
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthreads/-mt/
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
-
- acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
- ;;
-esac
-
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
-
- case $flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $flag])
- PTHREAD_CFLAGS="$flag"
- ;;
-
- pthread-config)
- AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
- if test x"$acx_pthread_config" = xno; then continue; fi
- PTHREAD_CFLAGS="`pthread-config --cflags`"
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$flag])
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [acx_pthread_ok=yes])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- AC_MSG_RESULT($acx_pthread_ok)
- if test "x$acx_pthread_ok" = xyes; then
- break;
- fi
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
- AC_MSG_CHECKING([for joinable pthread attribute])
- attr_name=unknown
- for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
- [attr_name=$attr; break])
- done
- AC_MSG_RESULT($attr_name)
- if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
- AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
- [Define to necessary symbol if this constant
- uses a non-standard name on your system.])
- fi
-
- AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
- case "${host_cpu}-${host_os}" in
- *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
- *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
- esac
- AC_MSG_RESULT(${flag})
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
- # More AIX lossage: must compile with xlc_r or cc_r
- if test x"$GCC" != xyes; then
- AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
- else
- PTHREAD_CC=$CC
- fi
-
- # The next part tries to detect GCC inconsistency with -shared on some
- # architectures and systems. The problem is that in certain
- # configurations, when -shared is specified, GCC "forgets" to
- # internally use various flags which are still necessary.
-
- #
- # Prepare the flags
- #
- save_CFLAGS="$CFLAGS"
- save_LIBS="$LIBS"
- save_CC="$CC"
-
- # Try with the flags determined by the earlier checks.
- #
- # -Wl,-z,defs forces link-time symbol resolution, so that the
- # linking checks with -shared actually have any value
- #
- # FIXME: -fPIC is required for -shared on many architectures,
- # so we specify it here, but the right way would probably be to
- # properly detect whether it is actually required.
- CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CC="$PTHREAD_CC"
-
- # In order not to create several levels of indentation, we test
- # the value of "$done" until we find the cure or run out of ideas.
- done="no"
-
- # First, make sure the CFLAGS we added are actually accepted by our
- # compiler. If not (and OS X's ld, for instance, does not accept -z),
- # then we can't do this test.
- if test x"$done" = xno; then
- AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
- AC_TRY_LINK(,, , [done=yes])
-
- if test "x$done" = xyes ; then
- AC_MSG_RESULT([no])
- else
- AC_MSG_RESULT([yes])
- fi
- fi
-
- if test x"$done" = xno; then
- AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [done=yes])
-
- if test "x$done" = xyes; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- fi
-
- #
- # Linux gcc on some architectures such as mips/mipsel forgets
- # about -lpthread
- #
- if test x"$done" = xno; then
- AC_MSG_CHECKING([whether -lpthread fixes that])
- LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [done=yes])
-
- if test "x$done" = xyes; then
- AC_MSG_RESULT([yes])
- PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
- else
- AC_MSG_RESULT([no])
- fi
- fi
- #
- # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
- #
- if test x"$done" = xno; then
- AC_MSG_CHECKING([whether -lc_r fixes that])
- LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [done=yes])
-
- if test "x$done" = xyes; then
- AC_MSG_RESULT([yes])
- PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
- else
- AC_MSG_RESULT([no])
- fi
- fi
- if test x"$done" = xno; then
- # OK, we have run out of ideas
- AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
-
- # so it's not safe to assume that we may use pthreads
- acx_pthread_ok=no
- fi
-
- CFLAGS="$save_CFLAGS"
- LIBS="$save_LIBS"
- CC="$save_CC"
-else
- PTHREAD_CC="$CC"
-fi
-
-AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(PTHREAD_CFLAGS)
-AC_SUBST(PTHREAD_CC)
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
- ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
- :
-else
- acx_pthread_ok=no
- $2
-fi
-AC_LANG_RESTORE
-])dnl ACX_PTHREAD
diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4
deleted file mode 100644
index f6cf4a15..00000000
--- a/m4/ax_cxx_compile_stdcxx_11.m4
+++ /dev/null
@@ -1,140 +0,0 @@
-# ============================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
-# ============================================================================
-#
-# SYNOPSIS
-#
-# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
-#
-# DESCRIPTION
-#
-# Check for baseline language coverage in the compiler for the C++11
-# standard; if necessary, add switches to CXXFLAGS to enable support.
-#
-# The first argument, if specified, indicates whether you insist on an
-# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
-# -std=c++11). If neither is specified, you get whatever works, with
-# preference for an extended mode.
-#
-# The second argument, if specified 'mandatory' or if left unspecified,
-# indicates that baseline C++11 support is required and that the macro
-# should error out if no mode with that support is found. If specified
-# 'optional', then configuration proceeds regardless, after defining
-# HAVE_CXX11 if and only if a supporting mode is found.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
-# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
-# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 3
-
-m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
- template <typename T>
- struct check
- {
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
- };
-
- typedef check<check<bool>> right_angle_brackets;
-
- int a;
- decltype(a) b;
-
- typedef check<int> check_type;
- check_type c;
- check_type&& cr = static_cast<check_type&&>(c);
-
- auto d = a;
-])
-
-AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
- m4_if([$1], [], [],
- [$1], [ext], [],
- [$1], [noext], [],
- [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
- m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
- [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
- [$2], [optional], [ax_cxx_compile_cxx11_required=false],
- [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl
- AC_LANG_PUSH([C++])dnl
- ac_success=no
- AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
- ax_cv_cxx_compile_cxx11,
- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [ax_cv_cxx_compile_cxx11=yes],
- [ax_cv_cxx_compile_cxx11=no])])
- if test x$ax_cv_cxx_compile_cxx11 = xyes; then
- ac_success=yes
- fi
-
- restore_it="$CXXFLAGS"
- m4_if([$1], [noext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=gnu++11 -std=gnu++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS"
- c11switch="$switch"
- ac_success=yes
- break
- fi
- done
- fi])
-
- m4_if([$1], [ext], [], [dnl
- if test x$ac_success = xno; then
- for switch in -std=c++11 -std=c++0x; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
- $cachevar,
- [ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXXFLAGS="$ac_save_CXXFLAGS"])
- if eval test x\$$cachevar = xyes; then
- CXXFLAGS="$CXXFLAGS"
- c11switch="$switch"
- ac_success=yes
- break
- fi
- done
- fi])
- CXXFLAGS="$restore_it"
- AC_SUBST([CXX11_SWITCH], ["$c11switch"])
- AC_LANG_POP([C++])
- if test x$ax_cxx_compile_cxx11_required = xtrue; then
- if test x$ac_success = xno; then
- AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
- fi
- else
- if test x$ac_success = xno; then
- HAVE_CXX11=0
- AC_MSG_NOTICE([No compiler with C++11 support was found])
- else
- HAVE_CXX11=1
- AC_DEFINE(HAVE_CXX11,1,
- [define if the compiler supports basic C++11 syntax])
- fi
- AM_CONDITIONAL([HAVE_CXX11],[test "x$HAVE_CXX11" = "x1"])
-
- AC_SUBST(HAVE_CXX11)
- fi
-])
-
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
deleted file mode 100644
index d383ad5c..00000000
--- a/m4/ax_pthread.m4
+++ /dev/null
@@ -1,332 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-#
-# DESCRIPTION
-#
-# This macro figures out how to build C programs using POSIX threads. It
-# sets the PTHREAD_LIBS output variable to the threads library and linker
-# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
-# flags that are needed. (The user can also force certain compiler
-# flags/libs to be tested by setting these environment variables.)
-#
-# Also sets PTHREAD_CC to any special C compiler that is needed for
-# multi-threaded programs (defaults to the value of CC otherwise). (This
-# is necessary on AIX to use the special cc_r compiler alias.)
-#
-# NOTE: You are assumed to not only compile your program with these flags,
-# but also link it with them as well. e.g. you should link with
-# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
-#
-# If you are only building threads programs, you may wish to use these
-# variables in your default LIBS, CFLAGS, and CC:
-#
-# LIBS="$PTHREAD_LIBS $LIBS"
-# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-# CC="$PTHREAD_CC"
-#
-# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
-# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
-# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-#
-# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
-# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
-# PTHREAD_CFLAGS.
-#
-# ACTION-IF-FOUND is a list of shell commands to run if a threads library
-# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
-# is not found. If ACTION-IF-FOUND is not specified, the default action
-# will define HAVE_PTHREAD.
-#
-# Please let the authors know if this macro fails on any platform, or if
-# you have any other suggestions or comments. This macro was based on work
-# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
-# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
-# Alejandro Forero Cuervo to the autoconf macro repository. We are also
-# grateful for the helpful feedback of numerous users.
-#
-# Updated for Autoconf 2.68 by Daniel Richard G.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
-# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception, the respective Autoconf Macro's copyright owner
-# gives unlimited permission to copy, distribute and modify the configure
-# scripts that are the output of Autoconf when processing the Macro. You
-# need not follow the terms of the GNU General Public License when using
-# or distributing such scripts, even though portions of the text of the
-# Macro appear in them. The GNU General Public License (GPL) does govern
-# all other use of the material that constitutes the Autoconf Macro.
-#
-# This special exception to the GPL applies to versions of the Autoconf
-# Macro released by the Autoconf Archive. When you make and distribute a
-# modified version of the Autoconf Macro, you may extend this special
-# exception to the GPL to apply to your modified version as well.
-
-#serial 21
-
-AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
-AC_DEFUN([AX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-AC_LANG_PUSH([C])
-ax_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
- AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
- AC_MSG_RESULT([$ax_pthread_ok])
- if test x"$ax_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-fi
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# Create a list of thread flags to try. Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all, and "pthread-config"
-# which is a program returning the flags for the Pth emulation library.
-
-ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-
-# The ordering *is* (sometimes) important. Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-# other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# ... -mt is also the pthreads flag for HP/aCC
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-# pthread-config: use pthread-config program (for GNU Pth library)
-
-case ${host_os} in
- solaris*)
-
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthreads/-mt/
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
-
- ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
- ;;
-
- darwin*)
- ax_pthread_flags="-pthread $ax_pthread_flags"
- ;;
-esac
-
-# Clang doesn't consider unrecognized options an error unless we specify
-# -Werror. We throw in some extra Clang-specific options to ensure that
-# this doesn't happen for GCC, which also accepts -Werror.
-
-AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
-save_CFLAGS="$CFLAGS"
-ax_pthread_extra_flags="-Werror"
-CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
- [AC_MSG_RESULT([yes])],
- [ax_pthread_extra_flags=
- AC_MSG_RESULT([no])])
-CFLAGS="$save_CFLAGS"
-
-if test x"$ax_pthread_ok" = xno; then
-for flag in $ax_pthread_flags; do
-
- case $flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $flag])
- PTHREAD_CFLAGS="$flag"
- ;;
-
- pthread-config)
- AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
- if test x"$ax_pthread_config" = xno; then continue; fi
- PTHREAD_CFLAGS="`pthread-config --cflags`"
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$flag])
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
- static void routine(void *a) { a = 0; }
- static void *start_routine(void *a) { return a; }],
- [pthread_t th; pthread_attr_t attr;
- pthread_create(&th, 0, start_routine, 0);
- pthread_join(th, 0);
- pthread_attr_init(&attr);
- pthread_cleanup_push(routine, 0);
- pthread_cleanup_pop(0) /* ; */])],
- [ax_pthread_ok=yes],
- [])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- AC_MSG_RESULT([$ax_pthread_ok])
- if test "x$ax_pthread_ok" = xyes; then
- break;
- fi
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$ax_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
- AC_MSG_CHECKING([for joinable pthread attribute])
- attr_name=unknown
- for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
- [int attr = $attr; return attr /* ; */])],
- [attr_name=$attr; break],
- [])
- done
- AC_MSG_RESULT([$attr_name])
- if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
- AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
- [Define to necessary symbol if this constant
- uses a non-standard name on your system.])
- fi
-
- AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
- case ${host_os} in
- aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
- osf* | hpux*) flag="-D_REENTRANT";;
- solaris*)
- if test "$GCC" = "yes"; then
- flag="-D_REENTRANT"
- else
- # TODO: What about Clang on Solaris?
- flag="-mt -D_REENTRANT"
- fi
- ;;
- esac
- AC_MSG_RESULT([$flag])
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
-
- AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
- [ax_cv_PTHREAD_PRIO_INHERIT], [
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
- [[int i = PTHREAD_PRIO_INHERIT;]])],
- [ax_cv_PTHREAD_PRIO_INHERIT=yes],
- [ax_cv_PTHREAD_PRIO_INHERIT=no])
- ])
- AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
- [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: compile with *_r variant
- if test "x$GCC" != xyes; then
- case $host_os in
- aix*)
- AS_CASE(["x/$CC"],
- [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
- [#handle absolute path differently from PATH based program lookup
- AS_CASE(["x$CC"],
- [x/*],
- [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
- [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
- ;;
- esac
- fi
-fi
-
-test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
-
-AC_SUBST([PTHREAD_LIBS])
-AC_SUBST([PTHREAD_CFLAGS])
-AC_SUBST([PTHREAD_CC])
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$ax_pthread_ok" = xyes; then
- ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
- :
-else
- ax_pthread_ok=no
- $2
-fi
-AC_LANG_POP
-])dnl AX_PTHREAD
diff --git a/m4/boost.m4 b/m4/boost.m4
deleted file mode 100644
index 11a623dc..00000000
--- a/m4/boost.m4
+++ /dev/null
@@ -1,1343 +0,0 @@
-# boost.m4: Locate Boost headers and libraries for autoconf-based projects.
-# Copyright (C) 2007-2011, 2014 Benoit Sigoure <tsuna@lrde.epita.fr>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Additional permission under section 7 of the GNU General Public
-# License, version 3 ("GPLv3"):
-#
-# If you convey this file as part of a work that contains a
-# configuration script generated by Autoconf, you may do so under
-# terms of your choice.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-m4_define([_BOOST_SERIAL], [m4_translit([
-# serial 23
-], [#
-], [])])
-
-# Original sources can be found at http://github.com/tsuna/boost.m4
-# You can fetch the latest version of the script by doing:
-# wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4
-
-# ------ #
-# README #
-# ------ #
-
-# This file provides several macros to use the various Boost libraries.
-# The first macro is BOOST_REQUIRE. It will simply check if it's possible to
-# find the Boost headers of a given (optional) minimum version and it will
-# define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to
-# your configure so that users can specify non standard locations.
-# If the user's environment contains BOOST_ROOT and --with-boost was not
-# specified, --with-boost=$BOOST_ROOT is implicitly used.
-# For more README and documentation, go to http://github.com/tsuna/boost.m4
-# Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry,
-# simply read the README, it will show you what to do step by step.
-
-m4_pattern_forbid([^_?(BOOST|Boost)_])
-
-
-# _BOOST_SED_CPP(SED-PROGRAM, PROGRAM,
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# --------------------------------------------------------
-# Same as AC_EGREP_CPP, but leave the result in conftest.i.
-#
-# SED-PROGRAM is *not* overquoted, as in AC_EGREP_CPP. It is expanded
-# in double-quotes, so escape your double quotes.
-#
-# It could be useful to turn this into a macro which extracts the
-# value of any macro.
-m4_define([_BOOST_SED_CPP],
-[AC_LANG_PUSH([C++])dnl
-AC_LANG_PREPROC_REQUIRE()dnl
-AC_REQUIRE([AC_PROG_SED])dnl
-AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
-AS_IF([dnl eval is necessary to expand ac_cpp.
-dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
-dnl Beware of Windows end-of-lines, for instance if we are running
-dnl some Windows programs under Wine. In that case, boost/version.hpp
-dnl is certainly using "\r\n", but the regular Unix shell will only
-dnl strip `\n' with backquotes, not the `\r'. This results in
-dnl boost_cv_lib_version='1_37\r' for instance, which breaks
-dnl everything else.
-dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK
-(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
- tr -d '\r' |
- $SED -n -e "$1" >conftest.i 2>&1],
- [$3],
- [$4])
-rm -rf conftest*
-AC_LANG_POP([C++])dnl
-])# _BOOST_SED_CPP
-
-
-
-# BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND])
-# -----------------------------------------------
-# Look for Boost. If version is given, it must either be a literal of the form
-# "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a
-# variable "$var".
-# Defines the value BOOST_CPPFLAGS. This macro only checks for headers with
-# the required version, it does not check for any of the Boost libraries.
-# On # success, defines HAVE_BOOST. On failure, calls the optional
-# ACTION-IF-NOT-FOUND action if one was supplied.
-# Otherwise aborts with an error message.
-AC_DEFUN([BOOST_REQUIRE],
-[AC_REQUIRE([AC_PROG_CXX])dnl
-AC_REQUIRE([AC_PROG_GREP])dnl
-echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD
-boost_save_IFS=$IFS
-boost_version_req=$1
-IFS=.
-set x $boost_version_req 0 0 0
-IFS=$boost_save_IFS
-shift
-boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"`
-boost_version_req_string=$[1].$[2].$[3]
-AC_ARG_WITH([boost],
- [AS_HELP_STRING([--with-boost=DIR],
- [prefix of Boost $1 @<:@guess@:>@])])dnl
-AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl
-# If BOOST_ROOT is set and the user has not provided a value to
-# --with-boost, then treat BOOST_ROOT as if it the user supplied it.
-if test x"$BOOST_ROOT" != x; then
- if test x"$with_boost" = x; then
- AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT])
- with_boost=$BOOST_ROOT
- else
- AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost])
- fi
-fi
-AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],
- ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])dnl
-boost_save_CPPFLAGS=$CPPFLAGS
- AC_CACHE_CHECK([for Boost headers version >= $boost_version_req_string],
- [boost_cv_inc_path],
- [boost_cv_inc_path=no
-AC_LANG_PUSH([C++])dnl
-m4_pattern_allow([^BOOST_VERSION$])dnl
- AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include <boost/version.hpp>
-#if !defined BOOST_VERSION
-# error BOOST_VERSION is not defined
-#elif BOOST_VERSION < $boost_version_req
-# error Boost headers version < $boost_version_req
-#endif
-]])])
- # If the user provided a value to --with-boost, use it and only it.
- case $with_boost in #(
- ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \
- /usr/include C:/Boost/include;; #(
- *) set x "$with_boost/include" "$with_boost";;
- esac
- shift
- for boost_dir
- do
- # Without --layout=system, Boost (or at least some versions) installs
- # itself in <prefix>/include/boost-<version>. This inner loop helps to
- # find headers in such directories.
- #
- # Any ${boost_dir}/boost-x_xx directories are searched in reverse version
- # order followed by ${boost_dir}. The final '.' is a sentinel for
- # searching $boost_dir" itself. Entries are whitespace separated.
- #
- # I didn't indent this loop on purpose (to avoid over-indented code)
- boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \
- && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \
- && echo .`
- for boost_inc in $boost_layout_system_search_list
- do
- if test x"$boost_inc" != x.; then
- boost_inc="$boost_dir/$boost_inc"
- else
- boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list
- fi
- if test x"$boost_inc" != x; then
- # We are going to check whether the version of Boost installed
- # in $boost_inc is usable by running a compilation that
- # #includes it. But if we pass a -I/some/path in which Boost
- # is not installed, the compiler will just skip this -I and
- # use other locations (either from CPPFLAGS, or from its list
- # of system include directories). As a result we would use
- # header installed on the machine instead of the /some/path
- # specified by the user. So in that precise case (trying
- # $boost_inc), make sure the version.hpp exists.
- #
- # Use test -e as there can be symlinks.
- test -e "$boost_inc/boost/version.hpp" || continue
- CPPFLAGS="$CPPFLAGS -I$boost_inc"
- fi
- AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no])
- if test x"$boost_cv_inc_path" = xyes; then
- if test x"$boost_inc" != x; then
- boost_cv_inc_path=$boost_inc
- fi
- break 2
- fi
- done
- done
-AC_LANG_POP([C++])dnl
- ])
- case $boost_cv_inc_path in #(
- no)
- boost_errmsg="cannot find Boost headers version >= $boost_version_req_string"
- m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])],
- [AC_MSG_NOTICE([$boost_errmsg])])
- $2
- ;;#(
- yes)
- BOOST_CPPFLAGS=
- ;;#(
- *)
- AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])dnl
- ;;
- esac
- if test x"$boost_cv_inc_path" != xno; then
- AC_DEFINE([HAVE_BOOST], [1],
- [Defined if the requested minimum BOOST version is satisfied])
- AC_CACHE_CHECK([for Boost's header version],
- [boost_cv_lib_version],
- [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl
- _BOOST_SED_CPP([/^boost-lib-version = /{s///;s/\"//g;p;q;}],
- [#include <boost/version.hpp>
-boost-lib-version = BOOST_LIB_VERSION],
- [boost_cv_lib_version=`cat conftest.i`])])
- # e.g. "134" for 1_34_1 or "135" for 1_35
- boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'`
- case $boost_major_version in #(
- '' | *[[!0-9]]*)
- AC_MSG_ERROR([invalid value: boost_major_version=$boost_major_version])
- ;;
- esac
-fi
-CPPFLAGS=$boost_save_CPPFLAGS
-])# BOOST_REQUIRE
-
-
-# BOOST_STATIC()
-# --------------
-# Add the "--enable-static-boost" configure argument. If this argument is given
-# on the command line, static versions of the libraries will be looked up.
-AC_DEFUN([BOOST_STATIC],
- [AC_ARG_ENABLE([static-boost],
- [AS_HELP_STRING([--enable-static-boost],
- [Prefer the static boost libraries over the shared ones [no]])],
- [enable_static_boost=yes],
- [enable_static_boost=no])])# BOOST_STATIC
-
-
-# BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND])
-# --------------------------------------------------------------------------
-# Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for
-# some parts of the Boost library which are only made of headers and don't
-# require linking (such as Boost.Foreach).
-#
-# Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be
-# found in the first place, in which case by default a notice is issued to the
-# user. Presumably if we haven't died already it's because it's OK to not have
-# Boost, which is why only a notice is issued instead of a hard error.
-#
-# Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_<HEADER-NAME> in
-# case of success # (where HEADER-NAME is written LIKE_THIS, e.g.,
-# HAVE_BOOST_FOREACH_HPP).
-AC_DEFUN([BOOST_FIND_HEADER],
-[AC_REQUIRE([BOOST_REQUIRE])dnl
-if test x"$boost_cv_inc_path" = xno; then
- m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])])
-else
-AC_LANG_PUSH([C++])dnl
-boost_save_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-AC_CHECK_HEADER([$1],
- [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1],
- [Define to 1 if you have <$1>])])],
- [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])])
-CPPFLAGS=$boost_save_CPPFLAGS
-AC_LANG_POP([C++])dnl
-fi
-])# BOOST_FIND_HEADER
-
-
-# BOOST_FIND_LIBS([COMPONENT-NAME], [CANDIDATE-LIB-NAMES],
-# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
-# [CXX-PROLOGUE])
-# --------------------------------------------------------------
-# Look for the Boost library COMPONENT-NAME (e.g., `thread', for
-# libboost_thread) under the possible CANDIDATE-LIB-NAMES (e.g.,
-# "thread_win32 thread"). Check that HEADER-NAME works and check that
-# libboost_LIB-NAME can link with the code CXX-TEST. The optional
-# argument CXX-PROLOGUE can be used to include some C++ code before
-# the `main' function.
-#
-# Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above).
-#
-# Boost libraries typically come compiled with several flavors (with different
-# runtime options) so PREFERRED-RT-OPT is the preferred suffix. A suffix is one
-# or more of the following letters: sgdpn (in that order). s = static
-# runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build,
-# n = (unsure) STLPort build without iostreams from STLPort (it looks like `n'
-# must always be used along with `p'). Additionally, PREFERRED-RT-OPT can
-# start with `mt-' to indicate that there is a preference for multi-thread
-# builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp
-# ... If you want to make sure you have a specific version of Boost
-# (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro.
-AC_DEFUN([BOOST_FIND_LIBS],
-[AC_REQUIRE([BOOST_REQUIRE])dnl
-AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl
-AC_REQUIRE([BOOST_STATIC])dnl
-AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl
-if test x"$boost_cv_inc_path" = xno; then
- AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library])
-else
-dnl The else branch is huge and wasn't intended on purpose.
-AC_LANG_PUSH([C++])dnl
-AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl
-AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl
-AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl
-AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl
-BOOST_FIND_HEADER([$4])
-boost_save_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib],
- [_BOOST_FIND_LIBS($@)])
-case $Boost_lib in #(
- (no) _AC_MSG_LOG_CONFTEST
- AC_MSG_ERROR([cannot find the flags to link with Boost $1])
- ;;
-esac
-AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl
-AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl
-AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl
-AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl
-CPPFLAGS=$boost_save_CPPFLAGS
-AS_VAR_POPDEF([Boost_lib])dnl
-AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl
-AS_VAR_POPDEF([Boost_lib_LDPATH])dnl
-AS_VAR_POPDEF([Boost_lib_LIBS])dnl
-AC_LANG_POP([C++])dnl
-fi
-])
-
-
-# BOOST_FIND_LIB([LIB-NAME],
-# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
-# [CXX-PROLOGUE])
-# --------------------------------------------------------------
-# Backward compatibility wrapper for BOOST_FIND_LIBS.
-AC_DEFUN([BOOST_FIND_LIB],
-[BOOST_FIND_LIBS([$1], $@)])
-
-
-# _BOOST_FIND_LIBS([LIB-NAME], [CANDIDATE-LIB-NAMES],
-# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
-# [CXX-PROLOGUE])
-# --------------------------------------------------------------
-# Real implementation of BOOST_FIND_LIBS: rely on these local macros:
-# Boost_lib, Boost_lib_LDFLAGS, Boost_lib_LDPATH, Boost_lib_LIBS
-#
-# The algorithm is as follows: first look for a given library name
-# according to the user's PREFERRED-RT-OPT. For each library name, we
-# prefer to use the ones that carry the tag (toolset name). Each
-# library is searched through the various standard paths were Boost is
-# usually installed. If we can't find the standard variants, we try
-# to enforce -mt (for instance on MacOSX, libboost_thread.dylib
-# doesn't exist but there's -obviously- libboost_thread-mt.dylib).
-AC_DEFUN([_BOOST_FIND_LIBS],
-[Boost_lib=no
- case "$3" in #(
- (mt | mt-) boost_mt=-mt; boost_rtopt=;; #(
- (mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$3" : 'Xmt-*\(.*\)'`;; #(
- (*) boost_mt=; boost_rtopt=$3;;
- esac
- if test $enable_static_boost = yes; then
- boost_rtopt="s$boost_rtopt"
- fi
- # Find the proper debug variant depending on what we've been asked to find.
- case $boost_rtopt in #(
- (*d*) boost_rt_d=$boost_rtopt;; #(
- (*[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn')
- boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #(
- (*) boost_rt_d='-d';;
- esac
- # If the PREFERRED-RT-OPT are not empty, prepend a `-'.
- test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt"
- $boost_guess_use_mt && boost_mt=-mt
- # Look for the abs path the static archive.
- # $libext is computed by Libtool but let's make sure it's non empty.
- test -z "$libext" &&
- AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?])
- boost_save_ac_objext=$ac_objext
- # Generate the test file.
- AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$4>
-$6], [$5])])
-dnl Optimization hacks: compiling C++ is slow, especially with Boost. What
-dnl we're trying to do here is guess the right combination of link flags
-dnl (LIBS / LDFLAGS) to use a given library. This can take several
-dnl iterations before it succeeds and is thus *very* slow. So what we do
-dnl instead is that we compile the code first (and thus get an object file,
-dnl typically conftest.o). Then we try various combinations of link flags
-dnl until we succeed to link conftest.o in an executable. The problem is
-dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always
-dnl remove all the temporary files including conftest.o. So the trick here
-dnl is to temporarily change the value of ac_objext so that conftest.o is
-dnl preserved accross tests. This is obviously fragile and I will burn in
-dnl hell for not respecting Autoconf's documented interfaces, but in the
-dnl mean time, it optimizes the macro by a factor of 5 to 30.
-dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left
-dnl empty because the test file is generated only once above (before we
-dnl start the for loops).
- AC_COMPILE_IFELSE([],
- [ac_objext=do_not_rm_me_plz],
- [AC_MSG_ERROR([cannot compile a test that uses Boost $1])])
- ac_objext=$boost_save_ac_objext
- boost_failed_libs=
-# Don't bother to ident the following nested for loops, only the 2
-# innermost ones matter.
-for boost_lib_ in $2; do
-for boost_tag_ in -$boost_cv_lib_tag ''; do
-for boost_ver_ in -$boost_cv_lib_version ''; do
-for boost_mt_ in $boost_mt -mt ''; do
-for boost_rtopt_ in $boost_rtopt '' -d; do
- for boost_lib in \
- boost_$boost_lib_$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \
- boost_$boost_lib_$boost_tag_$boost_rtopt_$boost_ver_ \
- boost_$boost_lib_$boost_tag_$boost_mt_$boost_ver_ \
- boost_$boost_lib_$boost_tag_$boost_ver_
- do
- # Avoid testing twice the same lib
- case $boost_failed_libs in #(
- (*@$boost_lib@*) continue;;
- esac
- # If with_boost is empty, we'll search in /lib first, which is not quite
- # right so instead we'll try to a location based on where the headers are.
- boost_tmp_lib=$with_boost
- test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include}
- for boost_ldpath in "$boost_tmp_lib/lib" '' \
- /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \
- "$with_boost" C:/Boost/lib /lib*
- do
- # Don't waste time with directories that don't exist.
- if test x"$boost_ldpath" != x && test ! -e "$boost_ldpath"; then
- continue
- fi
- boost_save_LDFLAGS=$LDFLAGS
- # Are we looking for a static library?
- case $boost_ldpath:$boost_rtopt_ in #(
- (*?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt)
- Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext"
- test -e "$Boost_lib_LIBS" || continue;; #(
- (*) # No: use -lboost_foo to find the shared library.
- Boost_lib_LIBS="-l$boost_lib";;
- esac
- boost_save_LIBS=$LIBS
- LIBS="$Boost_lib_LIBS $LIBS"
- test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath"
-dnl First argument of AC_LINK_IFELSE left empty because the test file is
-dnl generated only once above (before we start the for loops).
- _BOOST_AC_LINK_IFELSE([],
- [Boost_lib=yes], [Boost_lib=no])
- ac_objext=$boost_save_ac_objext
- LDFLAGS=$boost_save_LDFLAGS
- LIBS=$boost_save_LIBS
- if test x"$Boost_lib" = xyes; then
- # Check or used cached result of whether or not using -R or
- # -rpath makes sense. Some implementations of ld, such as for
- # Mac OSX, require -rpath but -R is the flag known to work on
- # other systems. https://github.com/tsuna/boost.m4/issues/19
- AC_CACHE_VAL([boost_cv_rpath_link_ldflag],
- [case $boost_ldpath in
- '') # Nothing to do.
- boost_cv_rpath_link_ldflag=
- boost_rpath_link_ldflag_found=yes;;
- *)
- for boost_cv_rpath_link_ldflag in -Wl,-R, -Wl,-rpath,; do
- LDFLAGS="$boost_save_LDFLAGS -L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
- LIBS="$boost_save_LIBS $Boost_lib_LIBS"
- _BOOST_AC_LINK_IFELSE([],
- [boost_rpath_link_ldflag_found=yes
- break],
- [boost_rpath_link_ldflag_found=no])
- done
- ;;
- esac
- AS_IF([test "x$boost_rpath_link_ldflag_found" != "xyes"],
- [AC_MSG_ERROR([Unable to determine whether to use -R or -rpath])])
- LDFLAGS=$boost_save_LDFLAGS
- LIBS=$boost_save_LIBS
- ])
- test x"$boost_ldpath" != x &&
- Boost_lib_LDFLAGS="-L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
- Boost_lib_LDPATH="$boost_ldpath"
- break 7
- else
- boost_failed_libs="$boost_failed_libs@$boost_lib@"
- fi
- done
- done
-done
-done
-done
-done
-done # boost_lib_
-rm -f conftest.$ac_objext
-])
-
-
-
-# --------------------------------------- #
-# Checks for the various Boost libraries. #
-# --------------------------------------- #
-
-# List of boost libraries: http://www.boost.org/libs/libraries.htm
-# The page http://beta.boost.org/doc/libs is useful: it gives the first release
-# version of each library (among other things).
-
-# BOOST_DEFUN(LIBRARY, CODE)
-# --------------------------
-# Define BOOST_<LIBRARY-UPPERCASE> as a macro that runs CODE.
-#
-# Use indir to avoid the warning on underquoted macro name given to AC_DEFUN.
-m4_define([BOOST_DEFUN],
-[m4_indir([AC_DEFUN],
- m4_toupper([BOOST_$1]),
-[m4_pushdef([BOOST_Library], [$1])dnl
-$2
-m4_popdef([BOOST_Library])dnl
-])
-])
-
-# BOOST_ARRAY()
-# -------------
-# Look for Boost.Array
-BOOST_DEFUN([Array],
-[BOOST_FIND_HEADER([boost/array.hpp])])
-
-
-# BOOST_ASIO()
-# ------------
-# Look for Boost.Asio (new in Boost 1.35).
-BOOST_DEFUN([Asio],
-[AC_REQUIRE([BOOST_SYSTEM])dnl
-BOOST_FIND_HEADER([boost/asio.hpp])])
-
-
-# BOOST_BIND()
-# ------------
-# Look for Boost.Bind.
-BOOST_DEFUN([Bind],
-[BOOST_FIND_HEADER([boost/bind.hpp])])
-
-
-# BOOST_CHRONO()
-# --------------
-# Look for Boost.Chrono.
-BOOST_DEFUN([Chrono],
-[# Do we have to check for Boost.System? This link-time dependency was
-# added as of 1.35.0. If we have a version <1.35, we must not attempt to
-# find Boost.System as it didn't exist by then.
-if test $boost_major_version -ge 135; then
- BOOST_SYSTEM([$1])
-fi # end of the Boost.System check.
-boost_filesystem_save_LIBS=$LIBS
-boost_filesystem_save_LDFLAGS=$LDFLAGS
-m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
-LIBS="$LIBS $BOOST_SYSTEM_LIBS"
-LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
-BOOST_FIND_LIB([chrono], [$1],
- [boost/chrono.hpp],
- [boost::chrono::thread_clock d;])
-if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
- BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
-fi
-LIBS=$boost_filesystem_save_LIBS
-LDFLAGS=$boost_filesystem_save_LDFLAGS
-])# BOOST_CHRONO
-
-
-# BOOST_CONVERSION()
-# ------------------
-# Look for Boost.Conversion (cast / lexical_cast)
-BOOST_DEFUN([Conversion],
-[BOOST_FIND_HEADER([boost/cast.hpp])
-BOOST_FIND_HEADER([boost/lexical_cast.hpp])
-])# BOOST_CONVERSION
-
-
-# BOOST_CRC()
-# -----------
-# Look for Boost.CRC
-BOOST_DEFUN([CRC],
-[BOOST_FIND_HEADER([boost/crc.hpp])
-])# BOOST_CRC
-
-
-# BOOST_DATE_TIME([PREFERRED-RT-OPT])
-# -----------------------------------
-# Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Date_Time],
-[BOOST_FIND_LIB([date_time], [$1],
- [boost/date_time/posix_time/posix_time.hpp],
- [boost::posix_time::ptime t;])
-])# BOOST_DATE_TIME
-
-
-# BOOST_FILESYSTEM([PREFERRED-RT-OPT])
-# ------------------------------------
-# Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see
-# the documentation of BOOST_FIND_LIB above.
-# Do not check for boost/filesystem.hpp because this file was introduced in
-# 1.34.
-BOOST_DEFUN([Filesystem],
-[# Do we have to check for Boost.System? This link-time dependency was
-# added as of 1.35.0. If we have a version <1.35, we must not attempt to
-# find Boost.System as it didn't exist by then.
-if test $boost_major_version -ge 135; then
- BOOST_SYSTEM([$1])
-fi # end of the Boost.System check.
-boost_filesystem_save_LIBS=$LIBS
-boost_filesystem_save_LDFLAGS=$LDFLAGS
-m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
-LIBS="$LIBS $BOOST_SYSTEM_LIBS"
-LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
-BOOST_FIND_LIB([filesystem], [$1],
- [boost/filesystem/path.hpp], [boost::filesystem::path p;])
-if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
- BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
-fi
-LIBS=$boost_filesystem_save_LIBS
-LDFLAGS=$boost_filesystem_save_LDFLAGS
-])# BOOST_FILESYSTEM
-
-
-# BOOST_FLYWEIGHT()
-# -----------------
-# Look for Boost.Flyweight.
-BOOST_DEFUN([Flyweight],
-[dnl There's a hidden dependency on pthreads.
-AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
-BOOST_FIND_HEADER([boost/flyweight.hpp])
-AC_SUBST([BOOST_FLYWEIGHT_LIBS], [$boost_cv_pthread_flag])
-])
-
-
-# BOOST_FOREACH()
-# ---------------
-# Look for Boost.Foreach.
-BOOST_DEFUN([Foreach],
-[BOOST_FIND_HEADER([boost/foreach.hpp])])
-
-
-# BOOST_FORMAT()
-# --------------
-# Look for Boost.Format.
-# Note: we can't check for boost/format/format_fwd.hpp because the header isn't
-# standalone. It can't be compiled because it triggers the following error:
-# boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std'
-# does not name a type
-BOOST_DEFUN([Format],
-[BOOST_FIND_HEADER([boost/format.hpp])])
-
-
-# BOOST_FUNCTION()
-# ----------------
-# Look for Boost.Function
-BOOST_DEFUN([Function],
-[BOOST_FIND_HEADER([boost/function.hpp])])
-
-
-# BOOST_GEOMETRY()
-# ----------------
-# Look for Boost.Geometry (new since 1.47.0).
-BOOST_DEFUN([Geometry],
-[BOOST_FIND_HEADER([boost/geometry.hpp])
-])# BOOST_GEOMETRY
-
-
-# BOOST_GRAPH([PREFERRED-RT-OPT])
-# -------------------------------
-# Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Graph],
-[BOOST_FIND_LIB([graph], [$1],
- [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;])
-])# BOOST_GRAPH
-
-
-# BOOST_IOSTREAMS([PREFERRED-RT-OPT])
-# -----------------------------------
-# Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([IOStreams],
-[BOOST_FIND_LIB([iostreams], [$1],
- [boost/iostreams/device/file_descriptor.hpp],
- [boost::iostreams::file_descriptor fd; fd.close();])
-])# BOOST_IOSTREAMS
-
-
-# BOOST_HASH()
-# ------------
-# Look for Boost.Functional/Hash
-BOOST_DEFUN([Hash],
-[BOOST_FIND_HEADER([boost/functional/hash.hpp])])
-
-
-# BOOST_LAMBDA()
-# --------------
-# Look for Boost.Lambda
-BOOST_DEFUN([Lambda],
-[BOOST_FIND_HEADER([boost/lambda/lambda.hpp])])
-
-
-# BOOST_LOG([PREFERRED-RT-OPT])
-# -----------------------------
-# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Log],
-[BOOST_FIND_LIB([log], [$1],
- [boost/log/core/core.hpp],
- [boost::log::attribute a; a.get_value();])
-])# BOOST_LOG
-
-
-# BOOST_LOG_SETUP([PREFERRED-RT-OPT])
-# -----------------------------------
-# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Log_Setup],
-[AC_REQUIRE([BOOST_LOG])dnl
-BOOST_FIND_LIB([log_setup], [$1],
- [boost/log/utility/setup/from_settings.hpp],
- [boost::log::basic_settings<char> bs; bs.empty();])
-])# BOOST_LOG_SETUP
-
-
-# BOOST_MATH()
-# ------------
-# Look for Boost.Math
-# TODO: This library isn't header-only but it comes in multiple different
-# flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99,
-# libboost_math_c99f, libboost_math_c99l, libboost_math_tr1,
-# libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the
-# right thing anyway.
-BOOST_DEFUN([Math],
-[BOOST_FIND_HEADER([boost/math/special_functions.hpp])])
-
-
-# BOOST_MPI([PREFERRED-RT-OPT])
-# -------------------------------
-# Look for Boost MPI. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above. Uses MPICXX variable if it is
-# set, otherwise tries CXX
-#
-BOOST_DEFUN([MPI],
-[boost_save_CXX=${CXX}
-boost_save_CXXCPP=${CXXCPP}
-if test x"${MPICXX}" != x; then
- CXX=${MPICXX}
- CXXCPP="${MPICXX} -E"
-fi
-BOOST_FIND_LIB([mpi], [$1],
- [boost/mpi.hpp],
- [int argc = 0;
- char **argv = 0;
- boost::mpi::environment env(argc,argv);])
-CXX=${boost_save_CXX}
-CXXCPP=${boost_save_CXXCPP}
-])# BOOST_MPI
-
-
-# BOOST_MULTIARRAY()
-# ------------------
-# Look for Boost.MultiArray
-BOOST_DEFUN([MultiArray],
-[BOOST_FIND_HEADER([boost/multi_array.hpp])])
-
-
-# BOOST_NUMERIC_UBLAS()
-# --------------------------
-# Look for Boost.NumericUblas (Basic Linear Algebra)
-BOOST_DEFUN([Numeric_Ublas],
-[BOOST_FIND_HEADER([boost/numeric/ublas/vector.hpp])
-])# BOOST_NUMERIC_UBLAS
-
-
-# BOOST_NUMERIC_CONVERSION()
-# --------------------------
-# Look for Boost.NumericConversion (policy-based numeric conversion)
-BOOST_DEFUN([Numeric_Conversion],
-[BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp])
-])# BOOST_NUMERIC_CONVERSION
-
-
-# BOOST_OPTIONAL()
-# ----------------
-# Look for Boost.Optional
-BOOST_DEFUN([Optional],
-[BOOST_FIND_HEADER([boost/optional.hpp])])
-
-
-# BOOST_PREPROCESSOR()
-# --------------------
-# Look for Boost.Preprocessor
-BOOST_DEFUN([Preprocessor],
-[BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])])
-
-
-# BOOST_UNORDERED()
-# -----------------
-# Look for Boost.Unordered
-BOOST_DEFUN([Unordered],
-[BOOST_FIND_HEADER([boost/unordered_map.hpp])])
-
-
-# BOOST_UUID()
-# ------------
-# Look for Boost.Uuid
-BOOST_DEFUN([Uuid],
-[BOOST_FIND_HEADER([boost/uuid/uuid.hpp])])
-
-
-# BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT])
-# -----------------------------------------
-# Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT,
-# see the documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Program_Options],
-[BOOST_FIND_LIB([program_options], [$1],
- [boost/program_options.hpp],
- [boost::program_options::options_description d("test");])
-])# BOOST_PROGRAM_OPTIONS
-
-
-
-# _BOOST_PYTHON_CONFIG(VARIABLE, FLAG)
-# ------------------------------------
-# Save VARIABLE, and define it via `python-config --FLAG`.
-# Substitute BOOST_PYTHON_VARIABLE.
-m4_define([_BOOST_PYTHON_CONFIG],
-[AC_SUBST([BOOST_PYTHON_$1],
- [`python-config --$2 2>/dev/null`])dnl
-boost_python_save_$1=$$1
-$1="$$1 $BOOST_PYTHON_$1"])
-
-
-# BOOST_PYTHON([PREFERRED-RT-OPT])
-# --------------------------------
-# Look for Boost.Python. For the documentation of PREFERRED-RT-OPT,
-# see the documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Python],
-[_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes])
-_BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags])
-_BOOST_PYTHON_CONFIG([LIBS], [libs])
-m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
-BOOST_FIND_LIBS([python], [python python3], [$1],
- [boost/python.hpp],
- [], [BOOST_PYTHON_MODULE(empty) {}])
-CPPFLAGS=$boost_python_save_CPPFLAGS
-LDFLAGS=$boost_python_save_LDFLAGS
-LIBS=$boost_python_save_LIBS
-])# BOOST_PYTHON
-
-
-# BOOST_REF()
-# -----------
-# Look for Boost.Ref
-BOOST_DEFUN([Ref],
-[BOOST_FIND_HEADER([boost/ref.hpp])])
-
-
-# BOOST_REGEX([PREFERRED-RT-OPT])
-# -------------------------------
-# Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Regex],
-[BOOST_FIND_LIB([regex], [$1],
- [boost/regex.hpp],
- [boost::regex exp("*"); boost::regex_match("foo", exp);])
-])# BOOST_REGEX
-
-
-# BOOST_SERIALIZATION([PREFERRED-RT-OPT])
-# ---------------------------------------
-# Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see
-# the documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Serialization],
-[BOOST_FIND_LIB([serialization], [$1],
- [boost/archive/text_oarchive.hpp],
- [std::ostream* o = 0; // Cheap way to get an ostream...
- boost::archive::text_oarchive t(*o);])
-])# BOOST_SERIALIZATION
-
-
-# BOOST_SIGNALS([PREFERRED-RT-OPT])
-# ---------------------------------
-# Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Signals],
-[BOOST_FIND_LIB([signals], [$1],
- [boost/signal.hpp],
- [boost::signal<void ()> s;])
-])# BOOST_SIGNALS
-
-
-# BOOST_SIGNALS2()
-# ----------------
-# Look for Boost.Signals2 (new since 1.39.0).
-BOOST_DEFUN([Signals2],
-[BOOST_FIND_HEADER([boost/signals2.hpp])
-])# BOOST_SIGNALS2
-
-
-# BOOST_SMART_PTR()
-# -----------------
-# Look for Boost.SmartPtr
-BOOST_DEFUN([Smart_Ptr],
-[BOOST_FIND_HEADER([boost/scoped_ptr.hpp])
-BOOST_FIND_HEADER([boost/shared_ptr.hpp])
-])
-
-
-# BOOST_STATICASSERT()
-# --------------------
-# Look for Boost.StaticAssert
-BOOST_DEFUN([StaticAssert],
-[BOOST_FIND_HEADER([boost/static_assert.hpp])])
-
-
-# BOOST_STRING_ALGO()
-# -------------------
-# Look for Boost.StringAlgo
-BOOST_DEFUN([String_Algo],
-[BOOST_FIND_HEADER([boost/algorithm/string.hpp])
-])
-
-
-# BOOST_SYSTEM([PREFERRED-RT-OPT])
-# --------------------------------
-# Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above. This library was introduced in Boost
-# 1.35.0.
-BOOST_DEFUN([System],
-[BOOST_FIND_LIB([system], [$1],
- [boost/system/error_code.hpp],
- [boost::system::error_code e; e.clear();])
-])# BOOST_SYSTEM
-
-
-# BOOST_TEST([PREFERRED-RT-OPT])
-# ------------------------------
-# Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Test],
-[m4_pattern_allow([^BOOST_CHECK$])dnl
-BOOST_FIND_LIB([unit_test_framework], [$1],
- [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);],
- [using boost::unit_test::test_suite;
- test_suite* init_unit_test_suite(int argc, char ** argv)
- { return NULL; }])
-])# BOOST_TEST
-
-
-# BOOST_THREAD([PREFERRED-RT-OPT])
-# ---------------------------------
-# Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Thread],
-[dnl Having the pthread flag is required at least on GCC3 where
-dnl boost/thread.hpp would complain if we try to compile without
-dnl -pthread on GNU/Linux.
-AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
-boost_thread_save_LIBS=$LIBS
-boost_thread_save_LDFLAGS=$LDFLAGS
-boost_thread_save_CPPFLAGS=$CPPFLAGS
-# Link-time dependency from thread to system was added as of 1.49.0.
-if test $boost_major_version -ge 149; then
-BOOST_SYSTEM([$1])
-fi # end of the Boost.System check.
-m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
-LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
-LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
-CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
-
-# When compiling for the Windows platform, the threads library is named
-# differently.
-case $host_os in
- (*mingw*) boost_thread_lib_ext=_win32;;
-esac
-BOOST_FIND_LIBS([thread], [thread$boost_thread_lib_ext],
- [$1],
- [boost/thread.hpp], [boost::thread t; boost::mutex m;])
-
-BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
-BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS"
-BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
-LIBS=$boost_thread_save_LIBS
-LDFLAGS=$boost_thread_save_LDFLAGS
-CPPFLAGS=$boost_thread_save_CPPFLAGS
-])# BOOST_THREAD
-
-AU_ALIAS([BOOST_THREADS], [BOOST_THREAD])
-
-
-# BOOST_TOKENIZER()
-# -----------------
-# Look for Boost.Tokenizer
-BOOST_DEFUN([Tokenizer],
-[BOOST_FIND_HEADER([boost/tokenizer.hpp])])
-
-
-# BOOST_TRIBOOL()
-# ---------------
-# Look for Boost.Tribool
-BOOST_DEFUN([Tribool],
-[BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp])
-BOOST_FIND_HEADER([boost/logic/tribool.hpp])
-])
-
-
-# BOOST_TUPLE()
-# -------------
-# Look for Boost.Tuple
-BOOST_DEFUN([Tuple],
-[BOOST_FIND_HEADER([boost/tuple/tuple.hpp])])
-
-
-# BOOST_TYPETRAITS()
-# --------------------
-# Look for Boost.TypeTraits
-BOOST_DEFUN([TypeTraits],
-[BOOST_FIND_HEADER([boost/type_traits.hpp])])
-
-
-# BOOST_UTILITY()
-# ---------------
-# Look for Boost.Utility (noncopyable, result_of, base-from-member idiom,
-# etc.)
-BOOST_DEFUN([Utility],
-[BOOST_FIND_HEADER([boost/utility.hpp])])
-
-
-# BOOST_VARIANT()
-# ---------------
-# Look for Boost.Variant.
-BOOST_DEFUN([Variant],
-[BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp])
-BOOST_FIND_HEADER([boost/variant.hpp])])
-
-
-# BOOST_POINTER_CONTAINER()
-# ------------------------
-# Look for Boost.PointerContainer
-BOOST_DEFUN([Pointer_Container],
-[BOOST_FIND_HEADER([boost/ptr_container/ptr_deque.hpp])
-BOOST_FIND_HEADER([boost/ptr_container/ptr_list.hpp])
-BOOST_FIND_HEADER([boost/ptr_container/ptr_vector.hpp])
-BOOST_FIND_HEADER([boost/ptr_container/ptr_array.hpp])
-BOOST_FIND_HEADER([boost/ptr_container/ptr_set.hpp])
-BOOST_FIND_HEADER([boost/ptr_container/ptr_map.hpp])
-])# BOOST_POINTER_CONTAINER
-
-
-# BOOST_WAVE([PREFERRED-RT-OPT])
-# ------------------------------
-# NOTE: If you intend to use Wave/Spirit with thread support, make sure you
-# call BOOST_THREAD first.
-# Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above.
-BOOST_DEFUN([Wave],
-[AC_REQUIRE([BOOST_FILESYSTEM])dnl
-AC_REQUIRE([BOOST_DATE_TIME])dnl
-boost_wave_save_LIBS=$LIBS
-boost_wave_save_LDFLAGS=$LDFLAGS
-m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl
-LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS \
-$BOOST_THREAD_LIBS"
-LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS \
-$BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS"
-BOOST_FIND_LIB([wave], [$1],
- [boost/wave.hpp],
- [boost::wave::token_id id; get_token_name(id);])
-LIBS=$boost_wave_save_LIBS
-LDFLAGS=$boost_wave_save_LDFLAGS
-])# BOOST_WAVE
-
-
-# BOOST_XPRESSIVE()
-# -----------------
-# Look for Boost.Xpressive (new since 1.36.0).
-BOOST_DEFUN([Xpressive],
-[BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])])
-
-
-# ----------------- #
-# Internal helpers. #
-# ----------------- #
-
-
-# _BOOST_PTHREAD_FLAG()
-# ---------------------
-# Internal helper for BOOST_THREAD. Computes boost_cv_pthread_flag
-# which must be used in CPPFLAGS and LIBS.
-#
-# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
-# boost/thread.hpp will trigger a #error if -pthread isn't used:
-# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
-# is not turned on. Please set the correct command line options for
-# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
-#
-# Based on ACX_PTHREAD: http://autoconf-archive.cryp.to/acx_pthread.html
-AC_DEFUN([_BOOST_PTHREAD_FLAG],
-[AC_REQUIRE([AC_PROG_CXX])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_LANG_PUSH([C++])dnl
-AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag],
-[ boost_cv_pthread_flag=
- # The ordering *is* (sometimes) important. Some notes on the
- # individual items follow:
- # (none): in case threads are in libc; should be tried before -Kthread and
- # other compiler flags to prevent continual compiler warnings
- # -lpthreads: AIX (must check this before -lpthread)
- # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
- # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
- # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
- # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
- # -pthreads: Solaris/GCC
- # -mthreads: MinGW32/GCC, Lynx/GCC
- # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
- # doesn't hurt to check since this sometimes defines pthreads too;
- # also defines -D_REENTRANT)
- # ... -mt is also the pthreads flag for HP/aCC
- # -lpthread: GNU Linux, etc.
- # --thread-safe: KAI C++
- case $host_os in #(
- *solaris*)
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthreads/-mt/
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
- boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #(
- *)
- boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \
- -pthreads -mthreads -lpthread --thread-safe -mt";;
- esac
- # Generate the test file.
- AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0);])])
- for boost_pthread_flag in '' $boost_pthread_flags; do
- boost_pthread_ok=false
-dnl Re-use the test file already generated.
- boost_pthreads__save_LIBS=$LIBS
- LIBS="$LIBS $boost_pthread_flag"
- AC_LINK_IFELSE([],
- [if grep ".*$boost_pthread_flag" conftest.err; then
- echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD
- else
- boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag
- fi])
- LIBS=$boost_pthreads__save_LIBS
- $boost_pthread_ok && break
- done
-])
-AC_LANG_POP([C++])dnl
-])# _BOOST_PTHREAD_FLAG
-
-
-# _BOOST_gcc_test(MAJOR, MINOR)
-# -----------------------------
-# Internal helper for _BOOST_FIND_COMPILER_TAG.
-m4_define([_BOOST_gcc_test],
-["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl
-
-# _BOOST_mingw_test(MAJOR, MINOR)
-# -----------------------------
-# Internal helper for _BOOST_FIND_COMPILER_TAG.
-m4_define([_BOOST_mingw_test],
-["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC && \
- (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
- || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw$1$2"])dnl
-
-
-# _BOOST_FIND_COMPILER_TAG()
-# --------------------------
-# Internal. When Boost is installed without --layout=system, each library
-# filename will hold a suffix that encodes the compiler used during the
-# build. The Boost build system seems to call this a `tag'.
-AC_DEFUN([_BOOST_FIND_COMPILER_TAG],
-[AC_REQUIRE([AC_PROG_CXX])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_CACHE_CHECK([for the toolset name used by Boost for $CXX],
- [boost_cv_lib_tag],
-[boost_cv_lib_tag=unknown
-if test x$boost_cv_inc_path != xno; then
- AC_LANG_PUSH([C++])dnl
- # The following tests are mostly inspired by boost/config/auto_link.hpp
- # The list is sorted to most recent/common to oldest compiler (in order
- # to increase the likelihood of finding the right compiler with the
- # least number of compilation attempt).
- # Beware that some tests are sensible to the order (for instance, we must
- # look for MinGW before looking for GCC3).
- # I used one compilation test per compiler with a #error to recognize
- # each compiler so that it works even when cross-compiling (let me know
- # if you know a better approach).
- # Known missing tags (known from Boost's tools/build/v2/tools/common.jam):
- # como, edg, kcc, bck, mp, sw, tru, xlc
- # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
- # the same defines as GCC's).
- for i in \
- _BOOST_mingw_test(4, 10) \
- _BOOST_gcc_test(4, 10) \
- _BOOST_mingw_test(4, 9) \
- _BOOST_gcc_test(4, 9) \
- _BOOST_mingw_test(4, 8) \
- _BOOST_gcc_test(4, 8) \
- _BOOST_mingw_test(4, 7) \
- _BOOST_gcc_test(4, 7) \
- _BOOST_mingw_test(4, 6) \
- _BOOST_gcc_test(4, 6) \
- _BOOST_mingw_test(4, 5) \
- _BOOST_gcc_test(4, 5) \
- _BOOST_mingw_test(4, 4) \
- _BOOST_gcc_test(4, 4) \
- _BOOST_mingw_test(4, 3) \
- _BOOST_gcc_test(4, 3) \
- _BOOST_mingw_test(4, 2) \
- _BOOST_gcc_test(4, 2) \
- _BOOST_mingw_test(4, 1) \
- _BOOST_gcc_test(4, 1) \
- _BOOST_mingw_test(4, 0) \
- _BOOST_gcc_test(4, 0) \
- "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \
- && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
- || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \
- _BOOST_gcc_test(3, 4) \
- _BOOST_gcc_test(3, 3) \
- "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \
- "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \
- _BOOST_gcc_test(3, 2) \
- "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \
- _BOOST_gcc_test(3, 1) \
- _BOOST_gcc_test(3, 0) \
- "defined __BORLANDC__ @ bcb" \
- "defined __ICC && (defined __unix || defined __unix__) @ il" \
- "defined __ICL @ iw" \
- "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \
- _BOOST_gcc_test(2, 95) \
- "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \
- "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \
- "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \
- "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8"
- do
- boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '`
- boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'`
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#if $boost_tag_test
-/* OK */
-#else
-# error $boost_tag_test
-#endif
-]])], [boost_cv_lib_tag=$boost_tag; break], [])
- done
-AC_LANG_POP([C++])dnl
- case $boost_cv_lib_tag in #(
- # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed
- # to "gcc41" for instance.
- *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there.
- gcc*)
- boost_tag_x=
- case $host_os in #(
- darwin*)
- if test $boost_major_version -ge 136; then
- # The `x' added in r46793 of Boost.
- boost_tag_x=x
- fi;;
- esac
- # We can specify multiple tags in this variable because it's used by
- # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ...
- boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc"
- ;; #(
- unknown)
- AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]])
- boost_cv_lib_tag=
- ;;
- esac
-fi])dnl end of AC_CACHE_CHECK
-])# _BOOST_FIND_COMPILER_TAG
-
-
-# _BOOST_GUESS_WHETHER_TO_USE_MT()
-# --------------------------------
-# Compile a small test to try to guess whether we should favor MT (Multi
-# Thread) flavors of Boost. Sets boost_guess_use_mt accordingly.
-AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT],
-[# Check whether we do better use `mt' even though we weren't ask to.
-AC_LANG_PUSH([C++])dnl
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#if defined _REENTRANT || defined _MT || defined __MT__
-/* use -mt */
-#else
-# error MT not needed
-#endif
-]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false])
-AC_LANG_POP([C++])dnl
-])
-
-# _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
-# -------------------------------------------------------------------
-# Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile,
-# will break when Autoconf changes its internals. Requires that you manually
-# rm -f conftest.$ac_objext in between to really different tests, otherwise
-# you will try to link a conftest.o left behind by a previous test.
-# Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this
-# macro).
-#
-# Don't use "break" in the actions, as it would short-circuit some code
-# this macro runs after the actions.
-m4_define([_BOOST_AC_LINK_IFELSE],
-[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-rm -f conftest$ac_exeext
-boost_save_ac_ext=$ac_ext
-boost_use_source=:
-# If we already have a .o, re-use it. We change $ac_ext so that $ac_link
-# tries to link the existing object file instead of compiling from source.
-test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
- _AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
-AS_IF([_AC_DO_STDERR($ac_link) && {
- test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_executable_p conftest$ac_exeext
-dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
- }],
- [$2],
- [if $boost_use_source; then
- _AC_MSG_LOG_CONFTEST
- fi
- $3])
-ac_objext=$boost_save_ac_objext
-ac_ext=$boost_save_ac_ext
-dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
-dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
-dnl as it would interfere with the next link command.
-rm -f core conftest.err conftest_ipa8_conftest.oo \
- conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
-])# _BOOST_AC_LINK_IFELSE
-
-# Local Variables:
-# mode: autoconf
-# End:
diff --git a/m4/cython.m4 b/m4/cython.m4
deleted file mode 100644
index 2d98eee7..00000000
--- a/m4/cython.m4
+++ /dev/null
@@ -1,81 +0,0 @@
-dnl Taken from the python bindings to the Enlightenment foundation libraries,
-dnl and was part of a GPL package. I have included this file to fix the build.
-dnl
-dnl
-dnl AM_CHECK_CYTHON([VERSION [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
-dnl Check if a Cython version is installed
-dnl Defines CYTHON_VERSION and CYTHON_FOUND
-AC_DEFUN([AM_CHECK_CYTHON],
-[
-AC_REQUIRE([AM_PATH_PYTHON])
-ifelse([$1], [], [_msg=""], [_msg=" >= $1"])
-AC_MSG_CHECKING(for Cython$_msg)
-AC_CACHE_VAL(py_cv_cython, [
-
-prog="import Cython.Compiler.Version; print Cython.Compiler.Version.version"
-CYTHON_VERSION=`$PYTHON -c "$prog" 2>&AC_FD_CC`
-
-py_cv_cython=no
-if test "x$CYTHON_VERSION" != "x"; then
- py_cv_cython=yes
-fi
-
-if test "x$py_cv_cython" = "xyes"; then
- ifelse([$1], [], [:],
- AS_VERSION_COMPARE([$CYTHON_VERSION], [$1], [py_cv_cython=no]))
-fi
-])
-
-AC_MSG_RESULT([$py_cv_cython])
-
-if test "x$py_cv_cython" = "xyes"; then
- CYTHON_FOUND=yes
- ifelse([$2], [], [:], [$2])
-else
- CYTHON_FOUND=no
- ifelse([$3], [], [AC_MSG_ERROR([Could not find usable Cython$_msg])], [$3])
-fi
-])
-
-dnl AM_CHECK_CYTHON_PRECOMPILED(FILE-LIST [, ACTION-IF-ALL [, ACTION-IF-NOT-ALL]])
-dnl given a list of files ending in .pyx (FILE-LIST), check if their .c
-dnl counterpart exists and is not older than the source.
-dnl ACTION-IF-ALL is called only if no files failed the check and thus
-dnl all pre-generated files are usable.
-dnl ACTION-IF-NOT-ALL is called if some or all failed. If not provided,
-dnl an error will be issued.
-AC_DEFUN([AM_CHECK_CYTHON_PRECOMPILED],
-[
-_to_check_list="$1"
-_failed_list=""
-_exists_list=""
-
-for inf in $_to_check_list; do
- outf=`echo "$inf" | sed -e 's/^\(.*\)[.]pyx$/\1.c/'`
- if test "$outf" = "$inf"; then
- AC_MSG_WARN([File to check must end in .pyx, but got: $inf -- Skip])
- continue
- fi
-
- AC_MSG_CHECKING([for pre-generated $outf for $inf])
- if ! test -f "$outf"; then
- _res=no
- _failed_list="${_failed_list} $outf"
- elif ! test "$outf" -nt "$inf"; then
- _res="no (older)"
- _failed_list="${_failed_list} $outf"
- else
- _res=yes
- _exists_list="${_exists_list} $outf"
- fi
- AC_MSG_RESULT($_res)
-done
-
-if test -z "$_failed_list" -a -n "$_exists_list"; then
- ifelse([$2], [], [:], [$2])
-else
- ifelse([$3], [],
- [AC_MSG_ERROR([Missing pre-generated files: $_failed_list])],
- [$3])
-fi
-])
diff --git a/m4/gtest.m4 b/m4/gtest.m4
deleted file mode 100644
index 28ccd2de..00000000
--- a/m4/gtest.m4
+++ /dev/null
@@ -1,74 +0,0 @@
-dnl GTEST_LIB_CHECK([minimum version [,
-dnl action if found [,action if not found]]])
-dnl
-dnl Check for the presence of the Google Test library, optionally at a minimum
-dnl version, and indicate a viable version with the HAVE_GTEST flag. It defines
-dnl standard variables for substitution including GTEST_CPPFLAGS,
-dnl GTEST_CXXFLAGS, GTEST_LDFLAGS, and GTEST_LIBS. It also defines
-dnl GTEST_VERSION as the version of Google Test found. Finally, it provides
-dnl optional custom action slots in the event GTEST is found or not.
-AC_DEFUN([GTEST_LIB_CHECK],
-[
-dnl Provide a flag to enable or disable Google Test usage.
-AC_ARG_ENABLE([gtest],
- [AS_HELP_STRING([--enable-gtest],
- [Enable tests using the Google C++ Testing Framework.
- (Default is enabled.)])],
- [],
- [enable_gtest=])
-AC_ARG_VAR([GTEST_CONFIG],
- [The exact path of Google Test's 'gtest-config' script.])
-AC_ARG_VAR([GTEST_CPPFLAGS],
- [C-like preprocessor flags for Google Test.])
-AC_ARG_VAR([GTEST_CXXFLAGS],
- [C++ compile flags for Google Test.])
-AC_ARG_VAR([GTEST_LDFLAGS],
- [Linker path and option flags for Google Test.])
-AC_ARG_VAR([GTEST_LIBS],
- [Library linking flags for Google Test.])
-AC_ARG_VAR([GTEST_VERSION],
- [The version of Google Test available.])
-HAVE_GTEST="no"
-AS_IF([test "x${enable_gtest}" != "xno"],
- [AC_MSG_CHECKING([for 'gtest-config'])
- AS_IF([test "x${enable_gtest}" != "xyes"],
- [AS_IF([test -x "${enable_gtest}/scripts/gtest-config"],
- [GTEST_CONFIG="${enable_gtest}/scripts/gtest-config"],
- [GTEST_CONFIG="${enable_gtest}/bin/gtest-config"])
- AS_IF([test -x "${GTEST_CONFIG}"], [],
- [AC_MSG_RESULT([no])
- AC_MSG_ERROR([dnl
-Unable to locate either a built or installed Google Test.
-The specific location '${enable_gtest}' was provided for a built or installed
-Google Test, but no 'gtest-config' script could be found at this location.])
- ])],
- [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])])
- AS_IF([test -x "${GTEST_CONFIG}"],
- [AC_MSG_RESULT([${GTEST_CONFIG}])
- m4_ifval([$1],
- [_gtest_min_version="--min-version=$1"
- AC_MSG_CHECKING([for Google Test at least version >= $1])],
- [_gtest_min_version="--min-version=0"
- AC_MSG_CHECKING([for Google Test])])
- AS_IF([${GTEST_CONFIG} ${_gtest_min_version}],
- [AC_MSG_RESULT([yes])
- HAVE_GTEST='yes'],
- [AC_MSG_RESULT([no])])],
- [AC_MSG_RESULT([no])])
- AS_IF([test "x${HAVE_GTEST}" = "xyes"],
- [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`
- GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`
- GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
- GTEST_LIBS=`${GTEST_CONFIG} --libs`
- GTEST_VERSION=`${GTEST_CONFIG} --version`
- AC_DEFINE([HAVE_GTEST],[1],[Defined when Google Test is available.])],
- [AS_IF([test "x${enable_gtest}" = "xyes"],
- [AC_MSG_ERROR([dnl
-Google Test was enabled, but no viable version could be found.])
- ])])])
-AC_SUBST([HAVE_GTEST])
-AM_CONDITIONAL([HAVE_GTEST],[test "x$HAVE_GTEST" = "xyes"])
-dnl AS_IF([test "x$HAVE_GTEST" = "xyes"], [] [])
-dnl [m4_ifval([$2], [$2])],
-dnl [m4_ifval([$3], [$3])])
-])
diff --git a/m4/misc.m4 b/m4/misc.m4
deleted file mode 100644
index d4aab47b..00000000
--- a/m4/misc.m4
+++ /dev/null
@@ -1,110 +0,0 @@
-dnl @synopsis AX_CXX_CHECK_LIB(libname, functioname, action-if, action-if-not)
-dnl
-dnl The standard AC_CHECK_LIB can not test functions in namespaces.
-dnl Therefore AC_CHECK_LIB(cgicc, cgicc::Cgicc::getVersion) will always
-dnl fail. We need to decompose the functionname into a series of namespaces
-dnl where it gets declared so that it can be used for a link test.
-dnl
-dnl In the first version I did allow namespace::functionname to be a
-dnl reference to a void-argument global functionname (just wrapped in a
-dnl namespace) like its C counterparts would be - but in reality such
-dnl thing does not exist. The only global / static functions are always
-dnl made const-functions which is an attribute mangled along into the
-dnl library function export name.
-dnl
-dnl The normal usage will ask for a test of a class-member function which
-dnl should be presented with a full function spec with arguments given in
-dnl parentheses following the function name - if the function to test for
-dnl does expect arguments then you should add default initial values in the
-dnl prototype (even if they do not exist originally, these are used only
-dnl locally to build a correct function call in the configure test script).
-dnl
-dnl In the current version if you do omit the parenthesis from the macro
-dnl argument then the macro will assume that you want to check for the
-dnl class name - which is really to check for default constructor being
-dnl exported from the given library name.
-dnl
-dnl EXAMPLE:
-dnl AX_CXX_CHECK_LIB(cgicc, [cgicc::HTTPCookie])
-dnl AX_CXX_CHECK_LIB(cgicc, [cgicc::Cgicc::getVersion () const],
-dnl AX_CXX_CHECK_LIB(boost_regex, [boost::RegEx::Position (int i = 0) const])
-dnl
-dnl Result:
-dnl Just as the usual AX_CXX_CHECK_LIB - defines HAVE_LIBCGICC
-dnl and adds the libraries to the default library path (and
-dnl uses internally the normal ac_check_lib cache symbol
-dnl like ac_cv_lib_cgicc_cgicc__Cgicc)
-dnl
-dnl Footnote: The C++ language is not good at creating stable library
-dnl interfaces at the binary level - a lot of functionality is usually being
-dnl given as inline functions plus there is hardly a chance to create opaque
-dnl types. Therefore most C++ library tests will only do compile tests using
-dnl the header files. Doing a check_lib is however good to check the link
-dnl dependency before hitting it as an error in the build later.
-dnl
-dnl @category C++
-dnl @author Guido U. Draheim
-dnl @vesion 2006-12-18
-
-AC_DEFUN([AX_CXX_CHECK_LIB],
-[m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl
-AS_LITERAL_IF([$1],
- [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
- [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl
-AC_CACHE_CHECK([for $2 in -l$1], ac_Lib,
-[ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$1 $5 $LIBS"
-case "$2"
-in *::*::*\(*)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
- namespace `echo "$2" | sed -e "s/::.*//"`
- { class `echo "$2" | sed -e "s/.*::\\(.*\\)::.*/\\1/" -e "s/(.*//"`
- { public: int `echo "$2" | sed -e "s/.*:://" -e "/(/!s/..*/&()/"`;
- };
- }
-],[`echo "$2" | sed -e "s/(.*//" -e "s/\\(.*\\)::\\(.*\\)/((\\1*)(0))->\\2/g"`()])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; *::*::*)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
- namespace `echo "$2" | sed -e "s/::.*//"`
- { namespace `echo "$2" | sed -e "s/.*::\\(.*\\)::.*/\\1/"`
- { class `echo "$2" | sed -e "s/.*:://"`
- { public: `echo "$2" | sed -e "s/.*:://"` ();
- };
- }
- }
-],[new $2()])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; *::*\(*)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
- class `echo "$2" | sed -e "s/\\(.*\\)::.*/\\1/" -e "s/(.*//"`
- { public: int `echo "$2" | sed -e "s/.*:://" -e "/(/!s/..*/&()/"`;
- };
-],[`echo "$2" | sed -e "s/(.*//" -e "s/\\(.*\\)::\\(.*\\)/((\\1*)(0))->\\2/g"`()])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; *::*)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
- namespace `echo "$2" | sed -e "s/::.*//"`
- { class `echo "$2" | sed -e "s/.*:://"`
- { public: `echo "$2" | sed -e "s/.*:://"` ();
- };
- }
-],[new $2()])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; *)
-AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; esac
-LIBS=$ac_check_lib_save_LIBS])
-AS_IF([test AS_VAR_GET(ac_Lib) = yes],
- [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
- LIBS="-l$1 $LIBS"
-])],
- [$4])dnl
-AS_VAR_POPDEF([ac_Lib])dnl
-])# AC_CHECK_LIB
diff --git a/mteval/CMakeLists.txt b/mteval/CMakeLists.txt
new file mode 100644
index 00000000..8217c116
--- /dev/null
+++ b/mteval/CMakeLists.txt
@@ -0,0 +1,68 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+
+set(fast_score_SRCS fast_score.cc)
+add_executable(fast_score ${fast_score_SRCS})
+target_link_libraries(fast_score mteval utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+set(mbr_kbest_SRCS mbr_kbest.cc)
+add_executable(mbr_kbest ${mbr_kbest_SRCS})
+target_link_libraries(mbr_kbest mteval utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+set(TEST_SRCS scorer_test.cc)
+
+foreach(testSrc ${TEST_SRCS})
+ #Extract the filename without an extension (NAME_WE)
+ get_filename_component(testName ${testSrc} NAME_WE)
+
+ #Add compile target
+ set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"")
+ add_executable(${testName} ${testSrc})
+
+ #link to Boost libraries AND your targets and dependencies
+ target_link_libraries(${testName} mteval utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+ #I like to move testing binaries into a testBin directory
+ set_target_properties(${testName} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ #Finally add it to test execution -
+ #Notice the WORKING_DIRECTORY and COMMAND
+ add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endforeach(testSrc)
+
+
+
+set(mteval_STAT_SRCS
+ aer_scorer.h
+ comb_scorer.h
+ external_scorer.h
+ levenshtein.h
+ ns.h
+ ns_cer.h
+ ns_comb.h
+ ns_docscorer.h
+ ns_ext.h
+ ns_ssk.h
+ ns_ter.h
+ ns_wer.h
+ scorer.h
+ ter.h
+ aer_scorer.cc
+ comb_scorer.cc
+ external_scorer.cc
+ meteor_jar.cc
+ ns.cc
+ ns_cer.cc
+ ns_comb.cc
+ ns_docscorer.cc
+ ns_ext.cc
+ ns_ssk.cc
+ ns_ter.cc
+ ns_wer.cc
+ scorer.cc
+ ter.cc)
+
+add_library(mteval STATIC ${mteval_STAT_SRCS})
+
+
diff --git a/mteval/Makefile.am b/mteval/Makefile.am
deleted file mode 100644
index aac3e6b5..00000000
--- a/mteval/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-bin_PROGRAMS = \
- fast_score \
- mbr_kbest
-
-noinst_PROGRAMS = \
- scorer_test
-TESTS = scorer_test
-
-noinst_LIBRARIES = libmteval.a
-
-EXTRA_DIST = test_data
-
-libmteval_a_SOURCES = \
- aer_scorer.h \
- comb_scorer.h \
- external_scorer.h \
- levenshtein.h \
- ns.h \
- ns_cer.h \
- ns_comb.h \
- ns_docscorer.h \
- ns_ext.h \
- ns_ssk.h \
- ns_ter.h \
- ns_wer.h \
- scorer.h \
- ter.h \
- aer_scorer.cc \
- comb_scorer.cc \
- external_scorer.cc \
- meteor_jar.cc \
- ns.cc \
- ns_cer.cc \
- ns_comb.cc \
- ns_docscorer.cc \
- ns_ext.cc \
- ns_ssk.cc \
- ns_ter.cc \
- ns_wer.cc \
- scorer.cc \
- ter.cc
-
-fast_score_SOURCES = fast_score.cc
-fast_score_LDADD = libmteval.a ../utils/libutils.a
-
-mbr_kbest_SOURCES = mbr_kbest.cc
-mbr_kbest_LDADD = libmteval.a ../utils/libutils.a
-
-scorer_test_SOURCES = scorer_test.cc
-scorer_test_LDADD = libmteval.a ../utils/libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-
-AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/mteval/test_data\" -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir) -I$(top_srcdir)/utils -I$(top_srcdir)/klm
diff --git a/mteval/ns.cc b/mteval/ns.cc
index 075e0121..2c8bd806 100644
--- a/mteval/ns.cc
+++ b/mteval/ns.cc
@@ -13,6 +13,8 @@
#include <iostream>
#include <sstream>
+#include "config.h"
+
#include "tdict.h"
#include "filelib.h"
#include "stringlib.h"
@@ -272,14 +274,14 @@ EvaluationMetric* EvaluationMetric::Instance(const string& imetric_id) {
} else if (metric_id == "TER") {
m = new TERMetric;
} else if (metric_id == "METEOR") {
-#if HAVE_METEOR
+#ifdef METEOR_JAR
if (!FileExists(meteor_jar_path)) {
cerr << meteor_jar_path << " not found!\n";
abort();
}
m = new ExternalMetric("METEOR", string("java -Xmx1536m -jar ") + meteor_jar_path + " - - -mira -lower -t tune -l en");
#else
- cerr << "cdec was not built with the --with-meteor option." << endl;
+ cerr << "cdec was not built with the -DMETEOR_JAR=/path/to/meteor.jar option." << endl;
abort();
#endif
} else if (metric_id.find("COMB:") == 0) {
diff --git a/training/CMakeLists.txt b/training/CMakeLists.txt
new file mode 100644
index 00000000..c0ae42e8
--- /dev/null
+++ b/training/CMakeLists.txt
@@ -0,0 +1,14 @@
+
+add_subdirectory(liblbfgs)
+add_subdirectory(utils)
+add_subdirectory(crf)
+add_subdirectory(minrisk)
+add_subdirectory(dpmert)
+add_subdirectory(pro)
+add_subdirectory(dtrain)
+add_subdirectory(latent_svm)
+add_subdirectory(mira)
+add_subdirectory(rampion)
+add_subdirectory(const_reorder)
+
+
diff --git a/training/Makefile.am b/training/Makefile.am
deleted file mode 100644
index 2812a9be..00000000
--- a/training/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-SUBDIRS = \
- liblbfgs \
- utils \
- crf \
- minrisk \
- dpmert \
- pro \
- dtrain \
- latent_svm \
- mira \
- rampion \
- const_reorder
diff --git a/training/const_reorder/CMakeLists.txt b/training/const_reorder/CMakeLists.txt
new file mode 100644
index 00000000..da074a23
--- /dev/null
+++ b/training/const_reorder/CMakeLists.txt
@@ -0,0 +1,9 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+
+set(const_reorder_model_trainer_SRCS constituent_reorder_model.cc trainer.h trainer.cc)
+add_executable(const_reorder_model_trainer ${const_reorder_model_trainer_SRCS})
+target_link_libraries(const_reorder_model_trainer utils ${Boost_LIBRARIES} z)
+
+set(argument_reorder_model_trainer_SRCS argument_reorder_model.cc trainer.h trainer.cc)
+add_executable(argument_reorder_model_trainer ${argument_reorder_model_trainer_SRCS})
+target_link_libraries(argument_reorder_model_trainer utils ${Boost_LIBRARIES} z)
diff --git a/training/const_reorder/Makefile.am b/training/const_reorder/Makefile.am
deleted file mode 100644
index 2c681398..00000000
--- a/training/const_reorder/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-bin_PROGRAMS = const_reorder_model_trainer argument_reorder_model_trainer
-
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/utils -I$(top_srcdir)/decoder
-
-const_reorder_model_trainer_SOURCES = constituent_reorder_model.cc trainer.h trainer.cc
-const_reorder_model_trainer_LDADD = ../../utils/libutils.a
-argument_reorder_model_trainer_SOURCES = argument_reorder_model.cc trainer.h trainer.cc
-argument_reorder_model_trainer_LDADD = ../../utils/libutils.a
diff --git a/training/crf/CMakeLists.txt b/training/crf/CMakeLists.txt
new file mode 100644
index 00000000..85fab7a0
--- /dev/null
+++ b/training/crf/CMakeLists.txt
@@ -0,0 +1,72 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+
+
+########### next target ###############
+
+set(mpi_batch_optimize_SRCS mpi_batch_optimize.cc cllh_observer.cc cllh_observer.h)
+add_executable(mpi_batch_optimize ${mpi_batch_optimize_SRCS})
+target_link_libraries(mpi_batch_optimize training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+########### next target ###############
+
+set(mpi_adagrad_optimize_SRCS mpi_adagrad_optimize.cc cllh_observer.cc cllh_observer.h)
+
+add_executable(mpi_adagrad_optimize ${mpi_adagrad_optimize_SRCS})
+
+target_link_libraries(mpi_adagrad_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+
+########### next target ###############
+
+set(mpi_compute_cllh_SRCS mpi_compute_cllh.cc cllh_observer.cc cllh_observer.h)
+
+add_executable(mpi_compute_cllh ${mpi_compute_cllh_SRCS})
+
+target_link_libraries(mpi_compute_cllh ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+
+########### next target ###############
+
+set(mpi_extract_features_SRCS mpi_extract_features.cc)
+
+add_executable(mpi_extract_features ${mpi_extract_features_SRCS})
+
+target_link_libraries(mpi_extract_features ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+
+########### next target ###############
+
+set(mpi_extract_reachable_SRCS mpi_extract_reachable.cc)
+
+add_executable(mpi_extract_reachable ${mpi_extract_reachable_SRCS})
+
+target_link_libraries(mpi_extract_reachable ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+########### next target ###############
+
+set(mpi_flex_optimize_SRCS mpi_flex_optimize.cc)
+
+add_executable(mpi_flex_optimize ${mpi_flex_optimize_SRCS})
+
+target_link_libraries(mpi_flex_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+########### next target ###############
+
+set(mpi_online_optimize_SRCS mpi_online_optimize.cc)
+
+add_executable(mpi_online_optimize ${mpi_online_optimize_SRCS})
+
+target_link_libraries(mpi_online_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+########### next target ###############
+
+set(mpi_baum_welch_SRCS mpi_baum_welch.cc)
+
+add_executable(mpi_baum_welch ${mpi_baum_welch_SRCS})
+
+target_link_libraries(mpi_baum_welch ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
diff --git a/training/crf/Makefile.am b/training/crf/Makefile.am
deleted file mode 100644
index 87d9f838..00000000
--- a/training/crf/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-bin_PROGRAMS = \
- mpi_batch_optimize \
- mpi_adagrad_optimize \
- mpi_compute_cllh \
- mpi_extract_features \
- mpi_extract_reachable \
- mpi_flex_optimize \
- mpi_online_optimize \
- mpi_baum_welch
-
-mpi_baum_welch_SOURCES = mpi_baum_welch.cc
-mpi_baum_welch_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
-
-mpi_adagrad_optimize_SOURCES = mpi_adagrad_optimize.cc cllh_observer.cc cllh_observer.h
-mpi_adagrad_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
-
-mpi_online_optimize_SOURCES = mpi_online_optimize.cc
-mpi_online_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
-
-mpi_flex_optimize_SOURCES = mpi_flex_optimize.cc
-mpi_flex_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
-
-mpi_extract_reachable_SOURCES = mpi_extract_reachable.cc
-mpi_extract_reachable_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
-
-mpi_extract_features_SOURCES = mpi_extract_features.cc
-mpi_extract_features_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
-
-mpi_batch_optimize_SOURCES = mpi_batch_optimize.cc cllh_observer.cc cllh_observer.h
-mpi_batch_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
-
-mpi_compute_cllh_SOURCES = mpi_compute_cllh.cc cllh_observer.cc cllh_observer.h
-mpi_compute_cllh_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
-
-AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir)/training -I$(top_srcdir)/training/utils -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval
-
diff --git a/training/dpmert/CMakeLists.txt b/training/dpmert/CMakeLists.txt
new file mode 100644
index 00000000..382af070
--- /dev/null
+++ b/training/dpmert/CMakeLists.txt
@@ -0,0 +1,59 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+set(dpmert_SRCS
+ mert_geometry.cc
+ ces.cc
+ error_surface.cc
+ mr_dpmert_map.cc
+ line_optimizer.cc
+ ces.h
+ error_surface.h
+ line_optimizer.h
+ mert_geometry.h)
+add_library(dpmert ${dpmert_SRCS})
+
+set(mr_dpmert_map_SRCS mr_dpmert_map.cc)
+
+add_executable(mr_dpmert_map ${mr_dpmert_map_SRCS})
+target_link_libraries(mr_dpmert_map dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
+
+########### next target ###############
+
+set(mr_dpmert_reduce_SRCS
+ mr_dpmert_reduce.cc)
+
+add_executable(mr_dpmert_reduce ${mr_dpmert_reduce_SRCS})
+target_link_libraries(mr_dpmert_reduce dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
+
+
+set(mr_dpmert_generate_mapper_input_SRCS mr_dpmert_generate_mapper_input.cc)
+add_executable(mr_dpmert_generate_mapper_input ${mr_dpmert_generate_mapper_input_SRCS})
+target_link_libraries(mr_dpmert_generate_mapper_input dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
+
+set(TEST_SRCS lo_test.cc)
+foreach(testSrc ${TEST_SRCS})
+ #Extract the filename without an extension (NAME_WE)
+ get_filename_component(testName ${testSrc} NAME_WE)
+
+ #Add compile target
+ set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"")
+ add_executable(${testName} ${testSrc})
+
+ #link to Boost libraries AND your targets and dependencies
+ target_link_libraries(${testName} dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+ #I like to move testing binaries into a testBin directory
+ set_target_properties(${testName} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ #Finally add it to test execution -
+ #Notice the WORKING_DIRECTORY and COMMAND
+ add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endforeach(testSrc)
+
+
+
diff --git a/training/dpmert/Makefile.am b/training/dpmert/Makefile.am
deleted file mode 100644
index b85bb275..00000000
--- a/training/dpmert/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-bin_PROGRAMS = \
- mr_dpmert_map \
- mr_dpmert_reduce \
- mr_dpmert_generate_mapper_input
-
-noinst_PROGRAMS = \
- lo_test
-TESTS = lo_test
-
-mr_dpmert_generate_mapper_input_SOURCES = mr_dpmert_generate_mapper_input.cc line_optimizer.cc
-mr_dpmert_generate_mapper_input_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a
-
-# nbest2hg_SOURCES = nbest2hg.cc
-# nbest2hg_LDADD = $(top_srcdir)/decoder/libcdec.a $(top_srcdir)/mteval/libmteval.a $(top_srcdir)/utils/libutils.a -lfst
-
-mr_dpmert_map_SOURCES = mert_geometry.cc ces.cc error_surface.cc mr_dpmert_map.cc line_optimizer.cc ces.h error_surface.h line_optimizer.h mert_geometry.h
-mr_dpmert_map_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a
-
-mr_dpmert_reduce_SOURCES = error_surface.cc ces.cc mr_dpmert_reduce.cc line_optimizer.cc mert_geometry.cc ces.h error_surface.h line_optimizer.h mert_geometry.h
-mr_dpmert_reduce_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a
-
-lo_test_SOURCES = lo_test.cc ces.cc mert_geometry.cc error_surface.cc line_optimizer.cc ces.h error_surface.h line_optimizer.h mert_geometry.h
-lo_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a
-
-EXTRA_DIST = test_data dpmert.pl
-
-AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/training/dpmert/test_data\" -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval
diff --git a/training/dpmert/ces.h b/training/dpmert/ces.h
index e4fa2080..b179499d 100644
--- a/training/dpmert/ces.h
+++ b/training/dpmert/ces.h
@@ -1,9 +1,9 @@
#ifndef _CES_H_
#define _CES_H_
-class ConvexHull;
+struct ConvexHull;
class Hypergraph;
-class SegmentEvaluator;
+struct SegmentEvaluator;
class ErrorSurface;
class EvaluationMetric;
diff --git a/training/dtrain/CMakeLists.txt b/training/dtrain/CMakeLists.txt
new file mode 100644
index 00000000..72e80b6b
--- /dev/null
+++ b/training/dtrain/CMakeLists.txt
@@ -0,0 +1,15 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+set(dtrain_SRCS
+ dtrain.cc
+ score.cc
+ dtrain.h
+ kbestget.h
+ ksampler.h
+ pairsampling.h
+ score.h)
+add_executable(dtrain ${dtrain_SRCS})
+target_link_libraries(dtrain libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
diff --git a/training/dtrain/Makefile.am b/training/dtrain/Makefile.am
deleted file mode 100644
index 844c790d..00000000
--- a/training/dtrain/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-bin_PROGRAMS = dtrain
-
-dtrain_SOURCES = dtrain.cc score.cc dtrain.h kbestget.h ksampler.h pairsampling.h score.h
-dtrain_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a
-
-AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval
-
diff --git a/training/latent_svm/CMakeLists.txt b/training/latent_svm/CMakeLists.txt
new file mode 100644
index 00000000..332b8d42
--- /dev/null
+++ b/training/latent_svm/CMakeLists.txt
@@ -0,0 +1,8 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+set(latent_svm_SRCS latent_svm.cc)
+add_executable(latent_svm ${latent_svm_SRCS})
+target_link_libraries(latent_svm libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
diff --git a/training/latent_svm/Makefile.am b/training/latent_svm/Makefile.am
deleted file mode 100644
index 65c5e038..00000000
--- a/training/latent_svm/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-bin_PROGRAMS = latent_svm
-
-latent_svm_SOURCES = latent_svm.cc
-latent_svm_LDADD = ../..//decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a
-
-AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval
diff --git a/training/liblbfgs/CMakeLists.txt b/training/liblbfgs/CMakeLists.txt
new file mode 100644
index 00000000..d936c0ab
--- /dev/null
+++ b/training/liblbfgs/CMakeLists.txt
@@ -0,0 +1,37 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+
+set(lbfgs_STAT_SRCS
+ lbfgs.c
+ arithmetic_ansi.h
+ arithmetic_sse_double.h
+ arithmetic_sse_float.h
+ lbfgs++.h
+ lbfgs.h)
+
+add_library(lbfgs STATIC ${lbfgs_STAT_SRCS})
+
+set(TEST_SRCS ll_test.cc)
+
+foreach(testSrc ${TEST_SRCS})
+ #Extract the filename without an extension (NAME_WE)
+ get_filename_component(testName ${testSrc} NAME_WE)
+
+ #Add compile target
+ set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"")
+ add_executable(${testName} ${testSrc})
+
+ #link to Boost libraries AND your targets and dependencies
+ target_link_libraries(${testName} lbfgs ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+ #I like to move testing binaries into a testBin directory
+ set_target_properties(${testName} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ #Finally add it to test execution -
+ #Notice the WORKING_DIRECTORY and COMMAND
+ add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endforeach(testSrc)
+
+
diff --git a/training/liblbfgs/Makefile.am b/training/liblbfgs/Makefile.am
deleted file mode 100644
index aa3af377..00000000
--- a/training/liblbfgs/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-noinst_LIBRARIES = liblbfgs.a
-
-noinst_PROGRAMS = ll_test
-ll_test_SOURCES = ll_test.cc
-ll_test_LDADD = liblbfgs.a -lz
-TESTS = ll_test
-
-liblbfgs_a_SOURCES = \
- lbfgs.c \
- arithmetic_ansi.h \
- arithmetic_sse_double.h \
- arithmetic_sse_float.h \
- lbfgs++.h \
- lbfgs.h
-
-################################################################
-# do NOT NOT NOT add any other -I includes NO NO NO NO NO ######
-AM_LDFLAGS = liblbfgs.a -lz
-AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -I$(top_srcdir)/training -I$(top_srcdir)/training/liblbfgs
-################################################################
-
diff --git a/training/minrisk/CMakeLists.txt b/training/minrisk/CMakeLists.txt
new file mode 100644
index 00000000..0795bc54
--- /dev/null
+++ b/training/minrisk/CMakeLists.txt
@@ -0,0 +1,9 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+set(minrisk_optimize_SRCS minrisk_optimize.cc)
+add_executable(minrisk_optimize ${minrisk_optimize_SRCS})
+target_link_libraries(minrisk_optimize training_utils libcdec mteval utils lbfgs ${Boost_LIBRARIES} z)
diff --git a/training/minrisk/Makefile.am b/training/minrisk/Makefile.am
deleted file mode 100644
index ebf6fa91..00000000
--- a/training/minrisk/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-bin_PROGRAMS = minrisk_optimize
-
-minrisk_optimize_SOURCES = minrisk_optimize.cc
-minrisk_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a ../../training/liblbfgs/liblbfgs.a
-
-EXTRA_DIST = minrisk.pl minrisk_generate_input.pl
-
-AM_CPPFLAGS = -W -Wall -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I$(top_srcdir)/training -I$(top_srcdir)/training/utils
diff --git a/training/minrisk/minrisk_optimize.cc b/training/minrisk/minrisk_optimize.cc
index a2938fb0..f90c7118 100644
--- a/training/minrisk/minrisk_optimize.cc
+++ b/training/minrisk/minrisk_optimize.cc
@@ -163,7 +163,7 @@ int main(int argc, char** argv) {
cerr << "Loading hypergraphs...\n";
while(getline(in, line)) {
istringstream is(line);
- int sent_id;
+ int sent_id = 0;
kis.resize(kis.size() + 1);
training::CandidateSet& curkbest = kis.back();
string kbest_file;
diff --git a/training/mira/CMakeLists.txt b/training/mira/CMakeLists.txt
new file mode 100644
index 00000000..bba9ef5f
--- /dev/null
+++ b/training/mira/CMakeLists.txt
@@ -0,0 +1,16 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+set(kbest_mira_SRCS kbest_mira.cc)
+add_executable(kbest_mira ${kbest_mira_SRCS})
+target_link_libraries(kbest_mira libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+set(kbest_cut_mira_SRCS kbest_cut_mira.cc)
+add_executable(kbest_cut_mira ${kbest_cut_mira_SRCS})
+target_link_libraries(kbest_cut_mira libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
+
+set(ada_opt_sm_SRCS ada_opt_sm.cc)
+add_executable(ada_opt_sm ${ada_opt_sm_SRCS})
+target_link_libraries(ada_opt_sm training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
diff --git a/training/mira/Makefile.am b/training/mira/Makefile.am
deleted file mode 100644
index a318cf6e..00000000
--- a/training/mira/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-bin_PROGRAMS = \
- kbest_mira \
- kbest_cut_mira \
- ada_opt_sm
-
-EXTRA_DIST = mira.py
-
-ada_opt_sm_SOURCES = ada_opt_sm.cc
-ada_opt_sm_LDFLAGS= -rdynamic
-ada_opt_sm_LDADD = ../utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a
-
-kbest_mira_SOURCES = kbest_mira.cc
-kbest_mira_LDFLAGS= -rdynamic
-kbest_mira_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a
-
-kbest_cut_mira_SOURCES = kbest_cut_mira.cc
-kbest_cut_mira_LDFLAGS= -rdynamic
-kbest_cut_mira_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a
-
-AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I$(top_srcdir)/training/utils
diff --git a/training/mira/mira.py b/training/mira/mira.py
index b84eafad..4c87c664 100755
--- a/training/mira/mira.py
+++ b/training/mira/mira.py
@@ -5,12 +5,6 @@ import argparse
import logging
import random, time
import gzip, itertools
-try:
- import cdec.score
-except ImportError:
- sys.stderr.write('Could not import pycdec, see cdec/python/README.md for details\n')
- sys.exit(1)
-have_mpl = True
try:
import matplotlib
matplotlib.use('Agg')
@@ -19,26 +13,19 @@ except ImportError:
have_mpl = False
#mira run script
-#requires pycdec to be built, since it is used for scoring hypothesis
-#translations.
#matplotlib must be installed for graphing to work
#email option requires mail
+script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
+fast_score_binary = script_dir+'/../../mteval/fast_score'
+dlog = None
+
#scoring function using pycdec scoring
def fast_score(hyps, refs, metric):
- scorer = cdec.score.Scorer(metric)
- logging.info('loaded {0} references for scoring with {1}'.format(
- len(refs), metric))
- if metric=='BLEU':
- logging.warning('BLEU is ambiguous, assuming IBM_BLEU\n')
- metric = 'IBM_BLEU'
- elif metric=='COMBI':
- logging.warning('COMBI metric is no longer supported, switching to '
- 'COMB:TER=-0.5;BLEU=0.5')
- metric = 'COMB:TER=-0.5;BLEU=0.5'
- stats = sum(scorer(r).evaluate(h) for h,r in itertools.izip(hyps,refs))
- logging.info('Score={} ({})'.format(stats.score, stats.detail))
- return stats.score
+ cmd = ('{0} -r{1} -i {2} -m {3}').format(fast_score_binary, refs, hyps, metric)
+ proc = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
+ o = proc.stdout.readline().strip()
+ return float(o)
#create new parallel input file in output directory in sgml format
def enseg(devfile, newfile, gprefix):
@@ -81,7 +68,6 @@ def enseg(devfile, newfile, gprefix):
def main():
#set logging to write all info messages to stderr
logging.basicConfig(level=logging.INFO)
- script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
if not have_mpl:
logging.warning('Failed to import matplotlib, graphs will not be generated.')
@@ -376,7 +362,8 @@ def optimize(args, script_dir, dev_size, score_sign):
cmd = parallel_cmd + ' ' + decoder_cmd
logging.info('OPTIMIZATION COMMAND: {}'.format(cmd))
-
+
+ global dlog
dlog = open(decoderlog,'w')
runf = open(runfile,'w')
retries = 0
@@ -423,7 +410,7 @@ def optimize(args, script_dir, dev_size, score_sign):
bests = []
fears = []
for line in run:
- hope, best, fear = line.split(' ||| ')
+ hope, best, fear = line.strip().split(' ||| ')
hopes.append(hope)
bests.append(best)
fears.append(fear)
@@ -439,14 +426,10 @@ def optimize(args, script_dir, dev_size, score_sign):
gzip_file(runfile)
gzip_file(decoderlog)
- ref_file = open(refs)
- references = [line.split(' ||| ') for line in
- ref_file.read().strip().split('\n')]
- ref_file.close()
#get score for best hypothesis translations, hope and fear translations
- dec_score = fast_score(bests, references, args.metric)
- dec_score_h = fast_score(hopes, references, args.metric)
- dec_score_f = fast_score(fears, references, args.metric)
+ dec_score = fast_score(runfile+'.B', refs, args.metric)
+ dec_score_h = fast_score(runfile+'.H', refs, args.metric)
+ dec_score_f = fast_score(runfile+'.F', refs, args.metric)
hope_best_fear['hope'].append(dec_score)
hope_best_fear['best'].append(dec_score_h)
diff --git a/training/pro/CMakeLists.txt b/training/pro/CMakeLists.txt
new file mode 100644
index 00000000..5ee09a74
--- /dev/null
+++ b/training/pro/CMakeLists.txt
@@ -0,0 +1,18 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+########### next target ###############
+
+set(mr_pro_map_SRCS mr_pro_map.cc)
+add_executable(mr_pro_map ${mr_pro_map_SRCS})
+target_link_libraries(mr_pro_map training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
+
+########### next target ###############
+
+set(mr_pro_reduce_SRCS mr_pro_reduce.cc)
+add_executable(mr_pro_reduce ${mr_pro_reduce_SRCS})
+target_link_libraries(mr_pro_reduce lbfgs utils ${Boost_LIBRARIES} z)
+
diff --git a/training/pro/Makefile.am b/training/pro/Makefile.am
deleted file mode 100644
index 09364804..00000000
--- a/training/pro/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-bin_PROGRAMS = \
- mr_pro_map \
- mr_pro_reduce
-
-mr_pro_map_SOURCES = mr_pro_map.cc
-mr_pro_map_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a
-
-mr_pro_reduce_SOURCES = mr_pro_reduce.cc
-mr_pro_reduce_LDADD = ../../training/liblbfgs/liblbfgs.a ../../utils/libutils.a
-
-EXTRA_DIST = mr_pro_generate_mapper_input.pl pro.pl
-
-AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I$(top_srcdir)/training/utils -I$(top_srcdir)/training
diff --git a/training/pro/mr_pro_reduce.cc b/training/pro/mr_pro_reduce.cc
index 5ef9b470..a61a3a5f 100644
--- a/training/pro/mr_pro_reduce.cc
+++ b/training/pro/mr_pro_reduce.cc
@@ -18,7 +18,6 @@ namespace po = boost::program_options;
// since this is a ranking model, there should be equal numbers of
// positive and negative examples, so the bias should be 0
-static const double MAX_BIAS = 1e-10;
void InitCommandLine(int argc, char** argv, po::variables_map* conf) {
po::options_description opts("Configuration options");
diff --git a/training/rampion/CMakeLists.txt b/training/rampion/CMakeLists.txt
new file mode 100644
index 00000000..8a60b5ff
--- /dev/null
+++ b/training/rampion/CMakeLists.txt
@@ -0,0 +1,8 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+set(rampion_cccp_SRCS rampion_cccp.cc)
+add_executable(rampion_cccp ${rampion_cccp_SRCS})
+target_link_libraries(rampion_cccp training_utils libcdec mteval utils ${Boost_LIBRARIES} z)
diff --git a/training/rampion/Makefile.am b/training/rampion/Makefile.am
deleted file mode 100644
index c72283cd..00000000
--- a/training/rampion/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-bin_PROGRAMS = rampion_cccp
-
-rampion_cccp_SOURCES = rampion_cccp.cc
-rampion_cccp_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a
-
-EXTRA_DIST = rampion.pl rampion_generate_input.pl
-
-AM_CPPFLAGS = -W -Wall $(GTEST_CPPFLAGS) -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I$(top_srcdir)/training/utils
diff --git a/training/utils/CMakeLists.txt b/training/utils/CMakeLists.txt
new file mode 100644
index 00000000..2753b9f0
--- /dev/null
+++ b/training/utils/CMakeLists.txt
@@ -0,0 +1,34 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)
+
+find_package(Threads REQUIRED)
+
+set(training_utils_STAT_SRCS
+ candidate_set.h
+ entropy.h
+ lbfgs.h
+ online_optimizer.h
+ optimize.h
+ risk.h
+ sentserver.h
+ candidate_set.cc
+ entropy.cc
+ optimize.cc
+ online_optimizer.cc
+ risk.cc)
+
+add_library(training_utils STATIC ${training_utils_STAT_SRCS})
+
+
+set(sentserver_SRCS sentserver.cc)
+add_executable(sentserver ${sentserver_SRCS})
+target_link_libraries(sentserver ${CMAKE_THREAD_LIBS_INIT})
+
+set(sentclient_SRCS sentclient.cc)
+add_executable(sentclient ${sentclient_SRCS})
+target_link_libraries(sentclient ${CMAKE_THREAD_LIBS_INIT})
+
+set(grammar_convert_SRCS grammar_convert.cc)
+add_executable(grammar_convert ${grammar_convert_SRCS})
+target_link_libraries(grammar_convert libcdec mteval utils ${Boost_LIBRARIES} z)
diff --git a/training/utils/Makefile.am b/training/utils/Makefile.am
deleted file mode 100644
index edaaf3d4..00000000
--- a/training/utils/Makefile.am
+++ /dev/null
@@ -1,48 +0,0 @@
-noinst_LIBRARIES = libtraining_utils.a
-
-bin_PROGRAMS = \
- sentserver \
- sentclient \
- grammar_convert
-
-noinst_PROGRAMS = \
- lbfgs_test \
- optimize_test
-
-EXTRA_DIST = decode-and-evaluate.pl libcall.pl parallelize.pl
-
-sentserver_SOURCES = sentserver.cc
-sentserver_LDFLAGS = $(PTHREAD_LIBS)
-sentserver_CXXFLAGS = $(PTHREAD_CFLAGS)
-
-sentclient_SOURCES = sentclient.cc
-sentclient_LDFLAGS = $(PTHREAD_LIBS)
-sentclient_CXXFLAGS = $(PTHREAD_CFLAGS)
-
-TESTS = lbfgs_test optimize_test
-
-libtraining_utils_a_SOURCES = \
- candidate_set.h \
- entropy.h \
- lbfgs.h \
- online_optimizer.h \
- optimize.h \
- risk.h \
- sentserver.h \
- candidate_set.cc \
- entropy.cc \
- optimize.cc \
- online_optimizer.cc \
- risk.cc
-
-optimize_test_SOURCES = optimize_test.cc
-optimize_test_LDADD = libtraining_utils.a ../../utils/libutils.a
-
-grammar_convert_SOURCES = grammar_convert.cc
-grammar_convert_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a
-
-lbfgs_test_SOURCES = lbfgs_test.cc
-lbfgs_test_LDADD = ../../utils/libutils.a
-
-AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/decoder -I$(top_srcdir)/utils -I$(top_srcdir)/mteval -I$(top_srcdir)/klm
-
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
new file mode 100644
index 00000000..6982fa11
--- /dev/null
+++ b/utils/CMakeLists.txt
@@ -0,0 +1,118 @@
+if (CMAKE_VERSION VERSION_LESS 2.8.9) # TODO remove once we increase the cmake requirement
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
+else()
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+endif()
+
+set(TEST_SRCS dict_test.cc
+ logval_test.cc
+ m_test.cc
+ small_vector_test.cc
+ stringlib_test.cc
+ sv_test.cc
+ ts.cc
+ weights_test.cc)
+
+foreach(testSrc ${TEST_SRCS})
+ #Extract the filename without an extension (NAME_WE)
+ get_filename_component(testName ${testSrc} NAME_WE)
+
+ #Add compile target
+ set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"")
+ add_executable(${testName} ${testSrc})
+
+ #link to Boost libraries AND your targets and dependencies
+ target_link_libraries(${testName} utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+ #I like to move testing binaries into a testBin directory
+ set_target_properties(${testName} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ #Finally add it to test execution -
+ #Notice the WORKING_DIRECTORY and COMMAND
+ add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endforeach(testSrc)
+
+
+set(atools_SRCS atools.cc)
+add_executable(atools ${atools_SRCS})
+target_link_libraries(atools utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+set(dedup_corpus_SRCS dedup_corpus.cc)
+add_executable(dedup_corpus ${dedup_corpus_SRCS})
+target_link_libraries(dedup_corpus utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+set(utils_STAT_SRCS
+ test_data
+ alias_sampler.h
+ alignment_io.h
+ array2d.h
+ b64featvector.h
+ b64tools.h
+ batched_append.h
+ city.h
+ citycrc.h
+ corpus_tools.h
+ dict.h
+ exp_semiring.h
+ fast_sparse_vector.h
+ fdict.h
+ feature_vector.h
+ filelib.h
+ gzstream.h
+ hash.h
+ have_64_bits.h
+ indices_after.h
+ kernel_string_subseq.h
+ logval.h
+ m.h
+ maxent.h
+ maxent.cpp
+ murmur_hash3.h
+ murmur_hash3.cc
+ named_enum.h
+ null_deleter.h
+ null_traits.h
+ prob.h
+ sampler.h
+ semiring.h
+ show.h
+ small_vector.h
+ sparse_vector.h
+ star.h
+ static_utoa.h
+ stringlib.h
+ string_piece.hh
+ tdict.h
+ timing_stats.h
+ utoa.h
+ value_array.h
+ verbose.h
+ warning_compiler.h
+ warning_pop.h
+ warning_push.h
+ weights.h
+ wordid.h
+ writer.h
+ fast_lexical_cast.hpp
+ intrusive_refcount.hpp
+ alignment_io.cc
+ b64featvector.cc
+ b64tools.cc
+ corpus_tools.cc
+ dict.cc
+ tdict.cc
+ fdict.cc
+ gzstream.cc
+ filelib.cc
+ stringlib.cc
+ string_piece.cc
+ sparse_vector.cc
+ timing_stats.cc
+ verbose.cc
+ weights.cc)
+
+add_library(utils STATIC ${utils_STAT_SRCS})
+
+
diff --git a/utils/Makefile.am b/utils/Makefile.am
deleted file mode 100644
index c858ac7e..00000000
--- a/utils/Makefile.am
+++ /dev/null
@@ -1,127 +0,0 @@
-bin_PROGRAMS = reconstruct_weights atools dedup_corpus
-
-noinst_PROGRAMS = \
- ts \
- phmt \
- dict_test \
- m_test \
- weights_test \
- logval_test \
- small_vector_test \
- stringlib_test \
- sv_test
-
-TESTS = ts small_vector_test logval_test weights_test dict_test m_test sv_test stringlib_test
-
-noinst_LIBRARIES = libutils.a
-
-# EXTRA_DIST = test_data
-
-libutils_a_SOURCES = \
- test_data \
- alias_sampler.h \
- alignment_io.h \
- array2d.h \
- b64featvector.h \
- b64tools.h \
- batched_append.h \
- city.h \
- citycrc.h \
- corpus_tools.h \
- dict.h \
- exp_semiring.h \
- fast_sparse_vector.h \
- fdict.h \
- feature_vector.h \
- filelib.h \
- gzstream.h \
- hash.h \
- have_64_bits.h \
- indices_after.h \
- kernel_string_subseq.h \
- logval.h \
- m.h \
- maxent.h \
- maxent.cpp \
- murmur_hash3.h \
- murmur_hash3.cc \
- named_enum.h \
- null_deleter.h \
- null_traits.h \
- perfect_hash.h \
- prob.h \
- sampler.h \
- semiring.h \
- show.h \
- small_vector.h \
- sparse_vector.h \
- star.h \
- static_utoa.h \
- stringlib.h \
- string_piece.hh \
- tdict.h \
- timing_stats.h \
- utoa.h \
- value_array.h \
- verbose.h \
- warning_compiler.h \
- warning_pop.h \
- warning_push.h \
- weights.h \
- wordid.h \
- writer.h \
- fast_lexical_cast.hpp \
- intrusive_refcount.hpp \
- alignment_io.cc \
- b64featvector.cc \
- b64tools.cc \
- corpus_tools.cc \
- dict.cc \
- tdict.cc \
- fdict.cc \
- gzstream.cc \
- filelib.cc \
- stringlib.cc \
- string_piece.cc \
- sparse_vector.cc \
- timing_stats.cc \
- verbose.cc \
- weights.cc
-
-if HAVE_CMPH
- libutils_a_SOURCES += perfect_hash.cc
-endif
-
-reconstruct_weights_SOURCES = reconstruct_weights.cc
-reconstruct_weights_LDADD = libutils.a
-atools_SOURCES = atools.cc
-atools_LDADD = libutils.a
-atools_LDFLAGS = $(STATIC_FLAGS)
-
-dedup_corpus_SOURCES = dedup_corpus.cc
-dedup_corpus_LDADD = libutils.a
-dedup_corpus_LDFLAGS = $(STATIC_FLAGS)
-
-phmt_SOURCES = phmt.cc
-phmt_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-ts_SOURCES = ts.cc
-ts_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-m_test_SOURCES = m_test.cc
-m_test_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-dict_test_SOURCES = dict_test.cc
-dict_test_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-weights_test_SOURCES = weights_test.cc
-weights_test_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-logval_test_SOURCES = logval_test.cc
-logval_test_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-small_vector_test_SOURCES = small_vector_test.cc
-small_vector_test_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-sv_test_SOURCES = sv_test.cc
-sv_test_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-stringlib_test_SOURCES = stringlib_test.cc
-stringlib_test_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-
-################################################################
-# do NOT NOT NOT add any other -I includes NO NO NO NO NO ######
-AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -I. -I$(top_srcdir) -DTEST_DATA=\"$(top_srcdir)/utils/test_data\"
-################################################################
diff --git a/utils/fast_sparse_vector.h b/utils/fast_sparse_vector.h
index 1e0ab428..0697fc44 100644
--- a/utils/fast_sparse_vector.h
+++ b/utils/fast_sparse_vector.h
@@ -20,9 +20,7 @@
#endif
#include <boost/static_assert.hpp>
-#if HAVE_BOOST_ARCHIVE_TEXT_OARCHIVE_HPP
#include <boost/serialization/map.hpp>
-#endif
#include "fdict.h"
@@ -471,7 +469,6 @@ class FastSparseVector {
unsigned char local_size_;
bool is_remote_;
-#if HAVE_BOOST_ARCHIVE_TEXT_OARCHIVE_HPP
private:
friend class boost::serialization::access;
template<class Archive>
@@ -502,12 +499,9 @@ class FastSparseVector {
}
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
-#endif
};
-#if HAVE_BOOST_ARCHIVE_TEXT_OARCHIVE_HPP
BOOST_CLASS_TRACKING(FastSparseVector<double>,track_never)
-#endif
template <typename T>
const FastSparseVector<T> operator+(const FastSparseVector<T>& x, const FastSparseVector<T>& y) {
diff --git a/utils/gzstream.cc b/utils/gzstream.cc
index 88cd1bd2..dbfa2f53 100644
--- a/utils/gzstream.cc
+++ b/utils/gzstream.cc
@@ -26,7 +26,7 @@
// Standard C++ Library".
// ============================================================================
-#include <gzstream.h>
+#include "gzstream.h"
#include <iostream>
#include <cstring> // for memcpy
#include <stdexcept>
diff --git a/utils/perfect_hash.cc b/utils/perfect_hash.cc
deleted file mode 100644
index 706e2741..00000000
--- a/utils/perfect_hash.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "config.h"
-
-#ifdef HAVE_CMPH
-
-#include "perfect_hash.h"
-
-#include <cstdio>
-#include <iostream>
-
-using namespace std;
-
-PerfectHashFunction::~PerfectHashFunction() {
- cmph_destroy(mphf_);
-}
-
-PerfectHashFunction::PerfectHashFunction(const string& fname) {
- FILE* f = fopen(fname.c_str(), "r");
- if (!f) {
- cerr << "Failed to open file " << fname << " for reading: cannot load hash function.\n";
- abort();
- }
- mphf_ = cmph_load(f);
- if (!mphf_) {
- cerr << "cmph_load failed on " << fname << "!\n";
- abort();
- }
-}
-
-size_t PerfectHashFunction::operator()(const string& key) const {
- return cmph_search(mphf_, &key[0], key.size());
-}
-
-size_t PerfectHashFunction::number_of_keys() const {
- return cmph_size(mphf_);
-}
-
-#endif
diff --git a/utils/perfect_hash.h b/utils/perfect_hash.h
deleted file mode 100644
index 8c12c9f0..00000000
--- a/utils/perfect_hash.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef PERFECT_HASH_MAP_H_
-#define PERFECT_HASH_MAP_H_
-
-#include <vector>
-#include <boost/utility.hpp>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_CMPH
-#include "cmph.h"
-#endif
-
-class PerfectHashFunction : boost::noncopyable {
- public:
- explicit PerfectHashFunction(const std::string& fname);
- ~PerfectHashFunction();
- size_t operator()(const std::string& key) const;
- size_t number_of_keys() const;
- private:
-#ifdef HAVE_CMPH
- cmph_t *mphf_;
-#endif
-};
-
-#endif
diff --git a/utils/phmt.cc b/utils/phmt.cc
deleted file mode 100644
index b17febf6..00000000
--- a/utils/phmt.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifndef HAVE_CMPH
-int main() {
- return 0;
-}
-#else
-
-#include <iostream>
-#include "weights.h"
-#include "fdict.h"
-
-using namespace std;
-
-int main(int argc, char** argv) {
- if (argc != 2) { cerr << "Usage: " << argv[0] << " file.mphf\n"; return 1; }
- FD::EnableHash(argv[1]);
- cerr << "Number of keys: " << FD::NumFeats() << endl;
- cerr << "LexFE = " << FD::Convert("LexFE") << endl;
- cerr << "LexEF = " << FD::Convert("LexEF") << endl;
- {
- vector<weight_t> v(FD::NumFeats());
- v[FD::Convert("LexFE")] = 1.0;
- v[FD::Convert("LexEF")] = 0.5;
- cerr << "Writing...\n";
- Weights::WriteToFile("weights.bin", v);
- cerr << "Done.\n";
- }
- {
- vector<weight_t> v(FD::NumFeats());
- cerr << "Reading...\n";
- Weights::InitFromFile("weights.bin", &v);
- cerr << "Done.\n";
- assert(v[FD::Convert("LexFE")] == 1.0);
- assert(v[FD::Convert("LexEF")] == 0.5);
- }
-}
-
-#endif
-
diff --git a/word-aligner/CMakeLists.txt b/word-aligner/CMakeLists.txt
new file mode 100644
index 00000000..baf85b31
--- /dev/null
+++ b/word-aligner/CMakeLists.txt
@@ -0,0 +1,10 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+
+set(fast_align_SRCS
+ fast_align.cc
+ ttables.cc
+ da.h
+ ttables.h)
+add_executable(fast_align ${fast_align_SRCS})
+target_link_libraries(fast_align utils ${Boost_LIBRARIES} z)
+
diff --git a/word-aligner/Makefile.am b/word-aligner/Makefile.am
deleted file mode 100644
index 071e4977..00000000
--- a/word-aligner/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-bin_PROGRAMS = fast_align binderiv
-
-fast_align_SOURCES = fast_align.cc ttables.cc da.h ttables.h
-fast_align_LDADD = ../utils/libutils.a
-fast_align_LDFLAGS = $(STATIC_FLAGS)
-
-binderiv_SOURCES = binderiv.cc
-binderiv_LDADD = ../utils/libutils.a
-
-EXTRA_DIST = aligner.pl ortho-norm support makefiles stemmers
-
-AM_CPPFLAGS = -W -Wall -I$(top_srcdir) -I$(top_srcdir)/utils -I$(top_srcdir)/training