-
Notifications
You must be signed in to change notification settings - Fork 45
/
charset-configure.in
229 lines (195 loc) · 6.03 KB
/
charset-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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(bootstrap)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(dpcharset, 4.16-`date "+%d%m%Y"`)
dnl AM_INIT_AUTOMAKE(dpcharset, 4.16)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(include/dps_config.h)
AC_PROG_MAKE_SET
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4
DPS_TRIM_VERSION=`echo $VERSION | sed -e "s|\.*pre[[0-9]]*$||"`
DPS_BASE_VERSION=`echo $DPS_TRIM_VERSION | sed -e "s|\.[[^.]]*$||" | sed -e "s|^\(.\)\.\(.\)$|\\1\.0\\2|" | sed -e "s|\.||g"`
dnl DPS_TAIL_VERSION=`echo $DPS_TRIM_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|"`
DPS_TAIL_VERSION=`echo $DPS_TRIM_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|" | sed -e "s|-.*||" | sed -e "s|^.*\.||"`
DPS_VERSION_ID=${DPS_BASE_VERSION}${DPS_TAIL_VERSION}
AC_DEFINE_UNQUOTED(DPS_VERSION_ID,$DPS_VERSION_ID)
AC_SUBST(DPS_BASE_VERSION)
AC_SUBST(DPS_TAIL_VERSION)
AC_SUBST(DPS_VERSION_ID)
dnl Installation prefix by default
AC_PREFIX_DEFAULT(/usr/local/dpsearch)
dnl Check if build env is sane
AM_SANITY_CHECK
dnl Check for programs.
AC_PROG_CC
AC_PROG_INSTALL
dnl Enable shared libs by default (to disable - place AM_DISABLE_SHARED)
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
dnl Checks for header files.
AC_STDC_HEADERS
AC_CHECK_HEADERS(fcntl.h unistd.h libutil.h \
sys/ioctl.h sys/time.h sys/times.h sys/param.h sys/wait.h sys/mman.h \
getopt.h syslog.h select.h sys/select.h sys/socket.h arpa/inet.h netdb.h\
netinet/in.h netinet/in_systm.h netinet/ip.h netinet/tcp.h netinet/in.h\
arpa/nameser.h resolv.h)
dnl Check if we are little or big endian
AC_C_BIGENDIAN
dnl Hack to build statically linked binary distributions
STATIC_LFLAGS=""
static_lflags=no
AC_MSG_CHECKING(for -all-static linker flags)
AC_ARG_ENABLE(all-static,
[ --enable-all-static build statically linked binaries],static_lflags=$enableval)
if test "$static_lflags" != no; then
AC_MSG_RESULT(enabled)
STATIC_LFLAGS="-all-static"
LINKING="static"
else
AC_MSG_RESULT([disabled])
LINKING="dynamic"
fi
AC_SUBST(STATIC_LFLAGS)
AC_SUBST(LINKING)
#
PTHREAD_CFLAGS=""
PTHREAD_LFLAGS=""
PTHREAD_LDADD=""
pthreads=no
AC_MSG_CHECKING(for pthreads)
AC_ARG_ENABLE(pthreads,
[ --enable-pthreads enable POSIX pthreads],pthreads=$enableval)
if test "$pthreads" != no; then
case "$host" in
*-*-bsdi*)
PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
;;
*-*-darwin*)
PTHREAD_CFLAGS="-D_THREAD_SAFE"
# causes Carbon.p complaints?
# PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
;;
*-*-freebsd*)
PTHREAD_CFLAGS="-pthread -D_REENTRANT -D_THREAD_SAFE"
PTHREAD_LFLAGS="-pthread"
;;
*-*-netbsd*)
PTHREAD_CFLAGS="-I/usr/pkg/include -D_REENTRANT"
PTHREAD_LDADD="-L/usr/pkg/lib -lpthread -lsem"
;;
*-*-openbsd*)
PTHREAD_CFLAGS="-D_REENTRANT"
PTHREAD_LFLAGS="-pthread"
;;
*-*-solaris*)
PTHREAD_CFLAGS="-D_REENTRANT"
PTHREAD_LDADD="-lpthread -lposix4"
;;
*-*-sysv5*)
PTHREAD_CFLAGS="-D_REENTRANT -Kthread"
PTHREAD_LDADD=""
;;
*-*-irix*)
PTHREAD_CFLAGS="-D_SGI_MP_SOURCE"
PTHREAD_LDADD="-lpthread"
;;
*-*-aix*)
PTHREAD_CFLAGS="-D_REENTRANT -mthreads"
PTHREAD_LDADD="-lpthread"
;;
*-*-qnx*)
PTHREAD_CFLAGS=""
PTHREAD_LDADD=""
;;
*)
PTHREAD_CFLAGS="-D_REENTRANT"
PTHREAD_LDADD="-lpthread"
;;
esac
ac_save_libs="$LIBS"
LIBS="$LIBS $PTHREAD_LFLAGS $PTHREAD_LDADD"
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
AC_TRY_LINK([#include <pthread.h>],
[
pthread_attr_t type;
pthread_attr_init(&type);
],AC_MSG_RESULT([yes]),
AC_MSG_ERROR([POSIX thread support not found])
)
LIBS="$ac_save_libs"
AC_DEFINE(HAVE_PTHREAD)
else
AC_MSG_RESULT([disabled])
fi
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LFLAGS)
AC_SUBST(PTHREAD_LDADD)
#
AC_DIVERT_PUSH(0)
CHARSETS_AVAILABLE="big5 gb2312 gbk japanese euc-kr gujarati tscii"
AC_DIVERT_POP
AC_ARG_WITH(extra-charsets,
[ --with-extra-charsets=CHARSET[,CHARSET,...]
Use additional non-default charsets:
none, all or a list from this set:
$CHARSETS_AVAILABLE],
[extra_charsets="$withval"],
[extra_charsets="none"])
AC_MSG_CHECKING(for additional character sets)
if test "$extra_charsets" = none; then
CHARSETS=""
else
if test "$extra_charsets" = all; then
CHARSETS="$CHARSETS_AVAILABLE"
else
CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
fi
fi
for cs in $CHARSETS
do
case $cs in
big5)
AC_DEFINE(HAVE_CHARSET_big5)
;;
euc-kr)
AC_DEFINE(HAVE_CHARSET_euc_kr)
;;
gb2312)
AC_DEFINE(HAVE_CHARSET_gb2312)
;;
japanese)
AC_DEFINE(HAVE_CHARSET_japanese)
;;
gbk)
AC_DEFINE(HAVE_CHARSET_gbk)
;;
gujarati)
AC_DEFINE(HAVE_CHARSET_gujarati)
;;
tscii)
AC_DEFINE(HAVE_CHARSET_tscii)
;;
*)
AC_MSG_ERROR([Charset $cs not available. (Available: $CHARSETS_AVAILABLE).]);
esac
ADDCHARSETS="$ADDCHARSETS $cs"
done
AC_MSG_RESULT($ADDCHARSETS)
have_db=no
DBTYPE=
AC_DEFINE_UNQUOTED(DPS_DBTYPE,"$DBTYPE")
CDIR=`pwd`
AC_SUBST(CDIR)
AC_OUTPUT(Makefile src/Makefile)
echo
echo "***********************************************"
echo "* *"
echo "* Now run make && make install *"
echo "* If it fails, try to use GNU make, *"
echo "* often installed as gmake. *"
echo "* *"
echo "* *"
echo "* Thank you for using libdpcharset! *"
echo "***********************************************"
echo