File: configure.ac

package info (click to toggle)
open-jtalk 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 117,348 kB
  • sloc: cpp: 165,033; ansic: 16,087; sh: 4,173; makefile: 287
file content (295 lines) | stat: -rw-r--r-- 8,712 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(open_jtalk, 1.11, open-jtalk-users@lists.sourceforge.net)
AC_CONFIG_AUX_DIR([config])
AC_COPYRIGHT(Copyright 2008-2018 Nagoya Institute of Technology)
AM_INIT_AUTOMAKE

# Checks for C/C++ compiler
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_RANLIB
AN_MAKEVAR([AR], [AC_PROG_AR])
AN_PROGRAM([ar], [AC_PROG_AR])
AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
AC_PROG_AR

# Check for endian
AC_C_BIGENDIAN

# Checks for libraries.
AC_CHECK_LIB([m], [log])
AC_CHECK_LIB(stdc++, main, MECAB_LIBS="-lstdc++")
AC_CHECK_LIB(iconv,iconv_open,use_libiconv=yes)
AC_CHECK_FUNC(iconv_open,use_iconv=yes)

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/stat.h sys/mman.h sys/times.h sys/types.h dirent.h ctype.h sys/types.h io.h windows.h setjmp.h)

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

# Checks for library functions.
AC_FUNC_MMAP
AC_CHECK_FUNCS(sqrt)
AC_CHECK_FUNCS(strstr)
AC_CHECK_FUNCS(getenv)
AC_CHECK_FUNCS(opendir)
AC_CHECK_FUNCS(setjmp)

# Set compilier option for mecab
MECAB_DEFAULT_RC="dummy"
AC_SUBST(MECAB_DEFAULT_RC)
AC_CONFIG_HEADERS([mecab/config.h:mecab/config.h.in])
DIC_VERSION="102"
AC_SUBST(DIC_VERSION)
AC_PROG_GCC_TRADITIONAL
AC_PROG_MAKE_SET
AC_ISC_POSIX
AC_CYGWIN
AC_LANG_CPLUSPLUS
AC_LANG(C)
AC_TYPE_OFF_T
if test "$use_libiconv" == "yes"; then
   MECAB_LIBS="$MECAB_LIBS -liconv"
   AC_DEFINE(HAVE_ICONV,1,Define to 1 if you have the `iconv_open' library(-liconv).)
   AC_DEFINE(ICONV_CONST,,Define to 1 if you have the `iconv_open' library(-liconv).)
fi
if test "$use_iconv" == "yes"; then
   AC_DEFINE(HAVE_ICONV,1,Define to 1 if you have the `iconv_open' library(-liconv).)
   AC_DEFINE(ICONV_CONST,,Define to 1 if you have the `iconv_open' library(-liconv).)
fi
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(size_t)
AC_TYPE_SIZE_T
AC_LANG(C++)
LIBS="$LIBS $MECAB_LIBS"
AC_SUBST(MECAB_LIBS)
AC_MSG_CHECKING(whether make is GNU Make)
if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
   if test "$host_vendor" = "sun" ; then
      AC_MSG_ERROR("SUN make does not work for building MeCab. Please install GNU make")
   fi
fi
AC_MSG_CHECKING([if ${CXX-c++} supports template <class T> (required)])
AC_TRY_COMPILE(
[
   template <class T> T foo (T &i) { return i++; };
],[
   int i = 0;
   double d = 0.0;
   foo(i); foo(d);
],[
   ac_template=yes
],[
   AC_WARN(${CXX-c++} template <class T> does not work)
   config_error=yes
])
AC_MSG_RESULT([$ac_template])
AC_MSG_CHECKING([if ${CXX-c++} supports const_cast<> (required)])
AC_TRY_COMPILE(
[
   class foo;
],[
   const foo *c=0;
   foo *c1=const_cast<foo*>(c);
],[
   ac_const_cast=yes
],[
   AC_WARN(${CXX-c++} const_cast<> does not work)
   config_error=yes
])
AC_MSG_RESULT([$ac_const_cast])
AC_MSG_CHECKING(if ${CXX-c++} supports static_cast<> (required))
AC_TRY_COMPILE(
[
   class foo;
],[
   foo *c = 0;
   void *c1 = static_cast<void *>(c);
],[
   ac_static_cast=yes
],[
   AC_WARN(${CXX-c++} static_cast<> does not work)
   config_error=yes
])
AC_MSG_RESULT([$ac_static_cast])
AC_MSG_CHECKING(if ${CXX-c++} supports dynamic_cast<> (required))
AC_TRY_COMPILE(
[
   class foo {};
   class bar: public foo {};
],[
   bar *c = 0;
   foo *c1 = dynamic_cast<foo *>(c);
],[
   ac_dynamic_cast=yes
],[
   AC_WARN(${CXX-c++} dynamic_cast<> does not work)
   config_error=yes
])
AC_MSG_RESULT([$ac_dynamic_cast])
AC_MSG_CHECKING(if ${CXX-c++} supports reinterpret_cast<> (required))
AC_TRY_COMPILE(
[
   int *a = 0;
],[
   char *p = reinterpret_cast<char *>(a);
],[
   ac_reinterpret_cast=yes
],[
   AC_WARN(${CXX-c++} reinterpret_cast<> does not work)
   config_error=yes
])
AC_MSG_RESULT([$ac_reinterpret_cast])
AC_MSG_CHECKING(if ${CXX-c++} supports exception handler (required))
AC_TRY_COMPILE(
[
   ;
],[
   try {
      int i = 0;
   }
   catch (char *e) {
   }
   catch (...) {
   }
],[
   ac_exception=yes
],[
   AC_WARN(${CXX-c++} exception does not work)
   config_error=yes
])
AC_MSG_RESULT([$ac_exception])
AC_MSG_CHECKING(if ${CXX-c++} supports namespaces (required) )
AC_TRY_COMPILE(
[
   namespace Foo { struct A {}; }
   using namespace Foo;
],[
   A a;
],[
   ac_namespaces=yes
],[
   config_error=yes
   ac_namespaces=no
])
AC_MSG_RESULT([$ac_namespaces])
AC_MSG_CHECKING(if ${CXX-c++} environment provides all required features)
if test "x$config_error" = xyes ; then
   AC_MSG_RESULT([no])
   AC_MSG_ERROR([Your compiler is not powerful enough to compile MeCab. \
                 If it should be, see config.log for more information of why it failed.])
fi
AC_MSG_RESULT([yes])

# For cygwin
if test -n "$GCC"; then
case "$host_os" in
   *cygwin* )
      CFLAGS="-O2 -Wall -g -D__CYGWIN__ $CFLAGS "
      CXXFLAGS="-O3 -Wall -Wno-deprecated -D__CYGWIN__ $CXXFLAGS "
      ;;
   *)
      CFLAGS="-O2 -Wall -g $CFLAGS"
      CXXFLAGS="-O3 -Wall -Wno-deprecated $CXXFLAGS "
      ;;
esac
fi

# Define HTS_ENGINE_HEADER
AC_ARG_WITH(hts-engine-header-path,
            AS_HELP_STRING([--with-hts-engine-header-path],[specify the hts_engine_API header path]),
            [hts_engine_header_path=$withval],
            [hts_engine_header_path='/usr/local/include'])
if test ! -f "${hts_engine_header_path}/HTS_engine.h"; then
   AC_MSG_ERROR(Cannot find HTS_engine.h)
fi
AC_MSG_CHECKING(for HTS_engine.h)
AC_MSG_RESULT($hts_engine_header_path/HTS_engine.h)
AC_SUBST(HTS_ENGINE_HEADER)
HTS_ENGINE_HEADER=${hts_engine_header_path}/HTS_engine.h

# Define HTS_ENGINE_HEADER_DIR
AC_SUBST(HTS_ENGINE_HEADER_DIR)
HTS_ENGINE_HEADER_DIR=${hts_engine_header_path}

# Define HTS_ENGINE_LIBRARY
AC_ARG_WITH(hts-engine-library-path,
            AS_HELP_STRING([--with-hts-engine-library-path],[specify the hts_engine_API library path]),
            [hts_engine_library_path=$withval],
            [hts_engine_library_path='/usr/local/lib'])
if test ! -f "${hts_engine_library_path}/libHTSEngine.so"; then
   AC_MSG_ERROR(Cannot find libHTSEngine.so)
fi
AC_MSG_CHECKING(for libHTSEngine.so)
AC_MSG_RESULT($hts_engine_library_path/libHTSEngine.so)
AC_SUBST(HTS_ENGINE_LIBRARY)
HTS_ENGINE_LIBRARY=${hts_engine_library_path}/libHTSEngine.so

# Define HTS_ENGINE_LIBRARY_DIR
AC_SUBST(HTS_ENGINE_LIBRARY_DIR)
HTS_ENGINE_LIBRARY_DIR=${hts_engine_library_path}

# Check for windows audio devices
case "$host_os" in
   *win32* | *wince* | *cygwin* | *mingw* )
      AC_HAVE_LIBRARY([winmm],,AC_MSG_ERROR(No winmm))
      ;;
   *)
      ;;
esac

# Define charset
AC_ARG_WITH(charset,
            [  --with-charset          specify charset (EUC-JP/SHIFT_JIS/UTF-8)],
            [charset=$withval],
            [charset='UTF-8'])
AC_MSG_CHECKING(charset)
AC_MSG_RESULT($charset)
AC_SUBST(MECAB_CHARSET)
AC_SUBST(MECAB_DEFAULT_CHARSET)
AC_SUBST(MECAB_USE_UTF8_ONLY)
AC_SUBST(CHARSET)
if test x$charset = xeucjp -o x$charset = xeuc-jp -o x$charset = xeuc_jp -o x$charset = xEUCJP -o x$charset = xEUC-JP -o x$charset = xEUC_JP ; then
   MECAB_CHARSET=EUC-JP
   MECAB_DEFAULT_CHARSET="EUC-JP"
   MECAB_USE_UTF8_ONLY=""
   CHARSET="-D CHARSET_EUC_JP"
   CFLAGS="$CFLAGS -finput-charset=EUC-JP -fexec-charset=EUC-JP "
   CXXFLAGS="$CXXFLAGS -finput-charset=EUC-JP -fexec-charset=EUC-JP "
elif test x$charset = xsjis -o x$charset = xshift-jis -o x$charset = xshift_jis -o x$charset = xSJIS -o x$charset = xSHIFT-JIS -o x$charset = xSHIFT_JIS ; then
   MECAB_CHARSET=SHIFT-JIS
   MECAB_DEFAULT_CHARSET="SHIFT-JIS"
   MECAB_USE_UTF8_ONLY=""
   CHARSET="-D CHARSET_SHIFT_JIS"
   CFLAGS="$CFLAGS -finput-charset=cp932 -fexec-charset=cp932 "
   CXXFLAGS="$CXXFLAGS -finput-charset=cp932 -fexec-charset=cp932 "
elif test x$charset = xutf8 -o x$charset = xutf-8 -o x$charset = xutf_8 -o x$charset = xUTF8 -o x$charset = xUTF-8 -o x$charset = xUTF_8 ; then
   MECAB_CHARSET=UTF-8
   MECAB_DEFAULT_CHARSET="UTF-8"
   MECAB_USE_UTF8_ONLY="-D MECAB_USE_UTF8_ONLY"
   CHARSET="-D CHARSET_UTF_8"
   CFLAGS="$CFLAGS -finput-charset=UTF-8 -fexec-charset=UTF-8 "
   CXXFLAGS="$CXXFLAGS -finput-charset=UTF-8 -fexec-charset=UTF-8 "
else
   AC_MSG_ERROR(Cannot recognize $charset)
fi

# Makefiles
AC_CONFIG_FILES([Makefile bin/Makefile text2mecab/Makefile mecab/Makefile mecab/src/Makefile mecab2njd/Makefile njd/Makefile njd_set_pronunciation/Makefile njd_set_digit/Makefile njd_set_accent_phrase/Makefile njd_set_accent_type/Makefile njd_set_unvoiced_vowel/Makefile njd_set_long_vowel/Makefile njd2jpcommon/Makefile jpcommon/Makefile mecab-naist-jdic/Makefile])

# Make mecab/config.h
AC_OUTPUT