-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure.ac
147 lines (122 loc) · 4.23 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([tatoparser], 3.1, [[email protected]])
AM_INIT_AUTOMAKE
AC_LANG(C++)
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST([TATOPARSER_SO_VERSION], [3:0:0])
AC_SUBST([TATOPARSER_API_VERSION], [3.0])
LT_PREREQ([2.2])
LT_INIT()
BOOST_REQUIRE
# Checks for programs.
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_LN_S
AC_PROG_SED
# AC_PROG_CXX doesn't let us determine whether a CXX compiler is available
AC_CHECK_PROG([CXX_COMPILER],[$CXX],[yes],[no])
if test "x$CXX_COMPILER" = "xno"
then
AC_MSG_ERROR([Unable to find a C++ compiler.])
fi
# Debug mode
AC_ARG_ENABLE([limit-mem],
AS_HELP_STRING([--enable-limit-mem],[Provides an option to limitate the virtual memory (--limit-mem).]),
[limit_mem=${enableval}],
[limit_mem=no])
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],[Adds asserts and debug code to the build.]),
[debug_mode=${enableval}],
[debug_mode=no])
AC_ARG_ENABLE([download],
AS_HELP_STRING([--enable-download],[Uses curl to download tatoeba material.]),
[download_mode=${enableval}],
[download_mode=no])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--enable-python],[Adds python wrappers.]),
[python_mode=${enableval}],
[python_mode=no])
AC_ARG_ENABLE([ncurses],
AS_HELP_STRING([--enable-ncurses],[Adds ncurses support.]),
[ncurses_mode=${enableval}],
[ncurses_mode=no])
if test "$debug_mode" = "no"
then
CXXFLAGS="$CXXFLAGS -DNDEBUG"
fi
if test "$python_mode" = "yes"
then
AC_PATH_PROG([PYTHON_CONFIG],[python-config],[no])
AS_IF([test "x$PYTHON_CONFIG" = "xno"], [
AC_MSG_ERROR([Unable to find python-config in PATH.])
])
MY_PYTHON_VERSION=$("$PYTHON_CONFIG" --libs | grep -o '[[23]]\.[[0-9]]')
MY_BOOST_PYTHON="boost_python-$MY_PYTHON_VERSION"
CFLAGS_PYTHON_=$("$PYTHON_CONFIG" --cflags)
LDFLAGS_PYTHON_=$("$PYTHON_CONFIG" --ldflags)
LIBS_PYTHON_=$("$PYTHON_CONFIG" --libs)
INCLUDE_PYTHON_=$("$PYTHON_CONFIG" --includes)
CPPFLAGS_PYTHON_="-DUSE_PYTHON_WRAPPER"
AC_SUBST([CFLAGS_PYTHON], [$CFLAGS_PYTHON_])
AC_SUBST([LDFLAGS_PYTHON], ["$LDFLAGS_PYTHON_ -l$MY_BOOST_PYTHON"])
AC_SUBST([LIBS_PYTHON], [$LIBS_PYTHON_])
AC_SUBST([INCLUDE_PYTHON], [$INCLUDE_PYTHON_])
AC_SUBST([CPPFLAGS_PYTHON], [$CPPFLAGS_PYTHON_])
fi
# Checks for libraries.
AS_IF([test "x$download_mode" = "xyes"], [
PKG_CHECK_MODULES([CURL], [libcurl])
])
# NCURSES
AS_IF([test "x$ncurses_mode" = "xyes"], [
PKG_CHECK_MODULES([NCURSES], [ncurses])
])
# ICU
PKG_CHECK_MODULES([ICUUC], [icu-uc])
LDFLAGS="$LDFLAGS $ICUUC_LIBS $CURL_LIBS"
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h string.h unistd.h])
# Checks for boost headers
BOOST_REGEX
BOOST_PROGRAM_OPTIONS
AC_CHECK_HEADERS([boost/spirit/include/qi.hpp], , [AC_MSG_ERROR([Unable to find Boost Spirit header (boost/spirit/include/qi.hpp)])])
AC_CHECK_HEADERS([boost/config.hpp], , )
if test "$download_mode" = "yes"
then
AC_CHECK_HEADERS([curl/curl.h], , [AC_MSG_ERROR([Unable to find curl header (curl/curl.h)])])
fi
# Checks for memory limitation headers
if test "x${limit_mem}" = xyes; then
AC_CHECK_HEADERS([sys/resource.h], ,[AC_MSG_ERROR([Unable to find <sys/resource.h>, necessary to build debug functions.])])
fi
# Checks for mmap
AC_CHECK_HEADERS([sys/mman.h], ,[AC_MSG_WARN([mman.h was not found on your computer. Parsing will be slower.])])
AC_CHECK_HEADERS([signal.h], ,[AC_MSG_WARN([signal.h was not found: signals will not be handled properly.])])
# Checks for typedefs, structures, and compiler characteristics.
#AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
# Checks for library functions.
AC_CONFIG_FILES([Makefile
src/Makefile
include/Makefile
unittests/Makefile])
AC_OUTPUT
echo \
"-------------------------------------------------
${PACKAGE_NAME} Version ${PACKAGE_VERSION}
Prefix: '${prefix}'.
Compiler: '${CXX} ${CXXFLAGS}'
Now type 'make @<:@<target>@:>@'
where the optional <target> is:
all - build all binaries
install - install everything
check - run unit tests
--------------------------------------------------"