-
Notifications
You must be signed in to change notification settings - Fork 7
/
configure.in
269 lines (225 loc) · 6.53 KB
/
configure.in
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
# Source of configuration for Hyper Estraier
#================================================================
# Generic Settings
#================================================================
# Targets
AC_INIT(hyperestraier-encore, 1.5.0)
# Export variables
LIBVER=9
LIBREV=0
PROTVER="1.0"
MYCFLAGS="-Wall -fPIC -fsigned-char -O3 -fomit-frame-pointer -fforce-addr"
MYCPPOPTS=""
MYDEFS="-DNDEBUG"
MYLDOPTS=""
MYMTLIBS=""
MYSKLIBS=""
MYAPPLIBS=""
MYRUNPATH=""
MYPOSTCMD="true"
# Building paths
if type pkg-config > /dev/null 2>&1
then
PATH="$PATH:`pkg-config --variable=bindir qdbm`"
LIBRARY_PATH="$LIBRARY_PATH:`pkg-config --variable=libdir qdbm`"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`pkg-config --variable=libdir qdbm`"
export PATH LIBRARY_PATH LD_LIBRARY_PATH
fi
#================================================================
# Options
#================================================================
# Internal variables
enables=""
stable="no"
# Debug mode
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [build for debugging]))
if test "$enable_debug" = "yes"
then
MYCFLAGS="-Wall -ansi -pedantic -fPIC -fsigned-char -g"
MYDEFS=""
MYLDOPTS="-static"
enables="$enables (debug)"
stable="yes"
fi
# Developping mode
AC_ARG_ENABLE(devel,
AC_HELP_STRING([--enable-devel], [build for development]))
if test "$enable_devel" = "yes"
then
MYCFLAGS="-Wall -ansi -pedantic -fPIC -fsigned-char -g -O2 -pipe"
MYDEFS=""
MYPOSTCMD="sync ; sync"
enables="$enables (devel)"
stable="yes"
fi
# Stable mode
AC_ARG_ENABLE(stable,
AC_HELP_STRING([--enable-stable], [build for stable release]))
if test "$enable_stable" = "yes"
then
MYCFLAGS="-Wall -ansi -pedantic -fPIC -fsigned-char -O2"
enables="$enables (stable)"
stable="yes"
fi
# Profiling mode
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile], [build for profiling]))
if test "$enable_profile" = "yes"
then
MYCFLAGS="-Wall -pedantic -fPIC -fsigned-char -g -pg -O2 -Werror"
enables="$enables (profile)"
fi
# Static mode
AC_ARG_ENABLE(static,
AC_HELP_STRING([--enable-static], [link statically]))
if test "$enable_static" = "yes"
then
MYLDOPTS="-static"
enables="$enables (static)"
fi
# Enable MeCab morphological analyzer
AC_ARG_ENABLE(mecab,
AC_HELP_STRING([--enable-mecab], [feature mecab morphological analyzer]))
if test "$enable_mecab" = "yes"
then
MYDEFS="$MYDEFS -D_MYMECAB"
MYAPPLIBS="$MYAPPLIBS -lmecab -lstdc++"
enables="$enables (mecab)"
fi
# Disable ZLIB compression
AC_ARG_ENABLE(zlib,
AC_HELP_STRING([--disable-zlib], [build without ZLIB compression]))
if test "$enable_zlib" = "no"
then
MYDEFS="$MYDEFS -D_MYNOZLIB"
enables="$enables (no-zlib)"
fi
# Enable LZO compression
AC_ARG_ENABLE(lzo,
AC_HELP_STRING([--enable-lzo], [build with LZO compression]))
if test "$enable_lzo" = "yes"
then
MYDEFS="$MYDEFS -D_MYLZO"
enables="$enables (lzo)"
fi
# Enable BZIP2 compression
AC_ARG_ENABLE(bzip,
AC_HELP_STRING([--enable-bzip], [build with BZIP2 compression]))
if test "$enable_bzip" = "yes"
then
MYDEFS="$MYDEFS -D_MYBZIP"
enables="$enables (bzip)"
fi
# Enable Vista database
AC_ARG_ENABLE(bzip,
AC_HELP_STRING([--enable-vista], [build with Vista database]))
if test "$enable_vista" = "yes"
then
MYDEFS="$MYDEFS -D_MYVISTA"
enables="$enables (vista)"
fi
# Messages
printf '#================================================================\n'
printf '# Configuring Hyper Estraier version %s%s.\n' "$PACKAGE_VERSION" "$enables"
printf '#================================================================\n'
#================================================================
# Checking Commands and Libraries
#================================================================
# C compiler
AC_PROG_CC
if test "$enable_devel" != "yes" && test "$enable_profile" != "yes"
then
if uname | egrep -i 'Linux' > /dev/null 2>&1 && test "$stable" != "yes" &&
uname -m | egrep -i '(x|i)(3|4|5|6|7|8|9)?86' > /dev/null 2>&1
then
MYCFLAGS="$MYCFLAGS -minline-all-stringops"
fi
if uname | egrep -i 'SunOS' > /dev/null 2>&1
then
MYCFLAGS="-Wall -fPIC -fsigned-char -O1"
fi
if uname | egrep -i 'BSD' > /dev/null 2>&1
then
MYCFLAGS="-Wall -fPIC -fsigned-char -O1"
fi
if gcc --version | egrep -i '^2\.(8|9)' > /dev/null 2>&1
then
MYCFLAGS="-Wall -fPIC -fsigned-char -O1"
fi
fi
# Underlying libraries
AC_CHECK_LIB(c, main)
AC_CHECK_LIB(m, main)
AC_CHECK_LIB(regex, main)
AC_CHECK_LIB(iconv, main)
if test "$enable_zlib" != "no" || pkg-config --libs qdbm 2>&1 | grep '\-lz' > /dev/null 2>&1
then
AC_CHECK_LIB(z, main)
fi
if test "$enable_lzo" = "yes" || pkg-config --libs qdbm 2>&1 | grep '\-llzo2' > /dev/null 2>&1
then
AC_CHECK_LIB(lzo2, main)
fi
if test "$enable_bzip" = "yes" || pkg-config --libs qdbm 2>&1 | grep '\-lbz2' > /dev/null 2>&1
then
AC_CHECK_LIB(bz2, main)
fi
AC_CHECK_LIB(qdbm, main)
# For libraries of pthreads
AC_CHECK_LIB(pthread, main, MYMTLIBS="-lpthread $MYMTLIBS")
# For libraries of socket
AC_CHECK_LIB(nsl, main, MYSKLIBS="-lnsl $MYSKLIBS")
AC_CHECK_LIB(socket, main, MYSKLIBS="-lsocket $MYSKLIBS")
AC_CHECK_LIB(resolv, main, MYSKLIBS="-lresolv $MYSKLIBS")
# For old BSDs
if uname -a | grep BSD > /dev/null &&
test -f /usr/lib/libc_r.a && test ! -f /usr/lib/libpthread.a
then
LIBS=`printf '%s' "$LIBS" | sed 's/-lc/-lc_r/g'`
fi
# Set the runtime library path
if test "$prefix" != "NONE"
then
MYRUNPATH="$prefix/lib"
fi
# Checking the version of QDBM with pkg-config
if type pkg-config > /dev/null 2>&1
then
printf 'checking the version of QDBM ... '
if pkg-config --atleast-version=1.8.75 qdbm
then
printf 'ok (%s)\n' `pkg-config --modversion qdbm`
MYCPPOPTS="$MYCPPOPTS -I`pkg-config --variable=includedir qdbm`"
MYLDOPTS="$MYLDOPTS -L`pkg-config --variable=libdir qdbm`"
MYRUNPATH="$MYRUNPATH:`pkg-config --variable=libdir qdbm`"
else
printf 'no (maybe not installed or too old)\n'
fi
fi
#================================================================
# Generic Settings
#================================================================
# Export variables
AC_SUBST(LIBVER)
AC_SUBST(LIBREV)
AC_SUBST(PROTVER)
AC_SUBST(MYCFLAGS)
AC_SUBST(MYCPPOPTS)
AC_SUBST(MYDEFS)
AC_SUBST(MYLDOPTS)
AC_SUBST(MYMTLIBS)
AC_SUBST(MYSKLIBS)
AC_SUBST(MYAPPLIBS)
AC_SUBST(MYRUNPATH)
AC_SUBST(MYPOSTCMD)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
# Targets
AC_OUTPUT(Makefile estconfig hyperestraier.pc)
chmod 755 estconfig
# Messages
printf '#================================================================\n'
printf '# Ready to make.\n'
printf '#================================================================\n'
# END OF FILE