-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.in
267 lines (229 loc) · 6 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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/global.h)
WV_MAJOR_VERSION=0
WV_MINOR_VERSION=2
WV_MICRO_VERSION=3
WV_VERSION=$WV_MAJOR_VERSION.$WV_MINOR_VERSION.$WV_MICRO_VERSION
AC_SUBST(WV_MAJOR_VERSION)
AC_SUBST(WV_MINOR_VERSION)
AC_SUBST(WV_MICRO_VERSION)
AC_SUBST(WV_VERSION)
# libtool versioning
LT_CURRENT=1
LT_REVISION=8
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
# For automake.
VERSION=$WV_VERSION
PACKAGE=wv2
AC_CANONICAL_SYSTEM
AC_CHECK_COMPILERS
dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
AM_CONFIG_HEADER(config.h)
dnl Initialize libtool
# Configure libtool
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl Debug options
dnl Checks for libraries, etc.
AC_C_BIGENDIAN
dnl Checks for glib
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
# Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_STRTOD
dnl Checks for KJS::UString
AC_CHECK_HEADERS(strings.h string.h math.h float.h ieeefp.h errno.h)
AC_CHECK_LIB(m, isnan, [
AC_DEFINE_UNQUOTED(HAVE_FUNC_ISNAN, 1, [Define if you have isnan])
])
AC_CHECK_LIB(m, finite, [
AC_DEFINE_UNQUOTED(HAVE_FUNC_FINITE, 1, [Define if you have finite])
])
AC_CHECK_LIB(m, _finite, [
AC_DEFINE_UNQUOTED(HAVE_FUNC__FINITE, 1, [Define if you have _finite])
])
AH_TOP([
#ifndef LIBWV2_CONFIG_H
#define LIBWV2_CONFIG_H
])
AH_BOTTOM([
#ifdef ICONV_REQUIRES_CONST
#define ICONV_CONST const
#else
#define ICONV_CONST
#endif
#endif /* ! LIBWV2_CONFIG_H */
])
dnl === Check for libgsf-1 ===
KDE_PKG_CHECK_MODULES(LIBGSF, libgsf-1 >= 1.7.2)
AC_SUBST(LIBGSF_CFLAGS)
AC_SUBST(LIBGSF_LIBS)
dnl ==== Check for iconv ====
wv_iconv=no
WV_ICONV_CFLAGS=""
WV_ICONV_LDFLAGS=""
AC_ARG_WITH(libiconv,[ --with-libiconv[=DIR] use libiconv (in DIR)],[
if [ test "x$withval" != "xno" ]; then
if [ test "x$withval" != "xyes" ]; then
ICONV_DIR=$withval
fi
default_to_libiconv=yes
search_for_libiconv=yes
else
default_to_libiconv=no
search_for_libiconv=no
fi
],[ default_to_libiconv=no
search_for_libiconv=yes
])
if [ test $default_to_libiconv = no ]; then
dnl test for system iconv
dnl Quesion: Do all systems with iconv also have iconv.h?
dnl Note: FreeBSD 5.0 seems to have iconv.h in sys
AC_CHECK_FUNC(iconv,[
AC_CHECK_HEADERS(iconv.h sys/iconv.h)
search_for_libiconv=no
wv_iconv=iconv
])
fi
if [ test $search_for_libiconv = yes ]; then
_cppflags=$CPPFLAGS
_ldflags=$LDFLAGS
if [ test "x$ICONV_DIR" != "x" ]; then
WV_ICONV_CFLAGS="-I$ICONV_DIR/include"
WV_ICONV_LDFLAGS="-L$ICONV_DIR/lib -liconv"
else
WV_ICONV_LDFLAGS="-liconv"
fi
CPPFLAGS="$CPPFLAGS $WV_ICONV_CFLAGS"
LDFLAGS="$LDFLAGS $WV_ICONV_LDFLAGS"
AC_CHECK_LIB(iconv,libiconv_open,[
AC_CHECK_HEADER(iconv.h,[
AC_DEFINE(HAVE_ICONV_H, 1, [Define to 1 if you have the <iconv.h> header file.])
wv_iconv=libiconv
],[ AC_CHECK_HEADER(sys/iconv.h,[
AC_DEFINE(HAVE_SYS_ICONV_H, 1, [Define to 1 if you have the <sys/iconv.h> header file.])
wv_iconv=libiconv
],[ AC_MSG_ERROR(* * * please check libiconv is installed correctly * * *)
])
])
],[ AC_MSG_ERROR(* * * please ensure libiconv is installed * * *)
])
CPPFLAGS=$_cppflags
LDFLAGS=$_ldflags
fi
if [ test $wv_iconv = no ]; then
AC_MSG_ERROR(* * * No iconv support - unable to continue * * *)
fi
AC_LANG_CPLUSPLUS
CPPFLAGS="$CPPFLAGS $WV_ICONV_CFLAGS"
LDFLAGS="$LDFLAGS $WV_ICONV_LDFLAGS"
AC_MSG_CHECKING(need for const in iconv)
AC_TRY_COMPILE([
#ifdef HAVE_ICONV_H
#include <iconv.h>
#endif
#ifdef HAVE_SYS_ICONV_H
#include <sys/iconv.h>
#endif
],[
iconv_t handle;
size_t ib;
size_t ob;
const char* in = 0;
char* out = 0;
iconv (handle,const_cast<char **>(&in),&ib,&out,&ob);
],[ AC_MSG_RESULT(no)
],[ AC_MSG_RESULT(yes)
AC_DEFINE(ICONV_REQUIRES_CONST, 1, [Define to 1 if iconv requires const var in argument 2])
])
AC_LANG_C
dnl Check if the neede conversions are supported
AC_MSG_CHECKING(whether the iconv installation is complete enough)
AC_TRY_RUN([
#ifdef HAVE_ICONV_H
#include <iconv.h>
#endif
#ifdef HAVE_SYS_ICONV_H
#include <sys/iconv.h>
#endif
#include <stdlib.h>
int check( const char* from, const char* to )
{
iconv_t myConverter = iconv_open( to, from );
if ( myConverter != (iconv_t)-1 ) {
iconv_close( myConverter );
return 0;
}
else
return 1;
}
int main(int argc, char** argv)
{
const char* from[] = { "CP874", "CP932", "CP936", "CP949",
"CP950", "CP1250", "CP1251", "CP1252",
"CP1253", "CP1254", "CP1255", "CP1256",
"CP1257", "koi8-r", 0 };
const char* to[] = { "UNICODELITTLE", "UNICODEBIG", 0 };
int fromIndex = 0;
int toIndex = 0;
while ( to[ toIndex ] != 0 ) {
while( from[ fromIndex ] != 0 ) {
if ( check( from[ fromIndex ], to[ toIndex ] ) != 0 )
exit( 1 );
fromIndex = fromIndex + 1;
}
toIndex = toIndex + 1;
fromIndex = 0;
}
exit( 0 );
}
], iconvFlag="yes", iconvFlag="no", iconvFlag="no")
if test "x$iconvFlag" = "xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
echo
echo "wv2 depends on a modern iconv installation, supporting UNICODELITTLE and"
echo "UNICODEBIG. The detected iconv version doesn't support these conversions."
echo
echo "Please get a new libiconv from http://www.gnu.org/software/libiconv/"
echo "You might want to install the library to some alternative directory, in"
echo "order not to overwrite your current installation. Please use the option"
echo "--with-libiconv=DIR to specify the location."
echo
AC_MSG_ERROR(* * * No iconv support - unable to continue * * *)
fi
CPPFLAGS=$_cppflags
LDFLAGS=$_ldflags
AC_SUBST(WV_ICONV_CFLAGS)
AC_SUBST(WV_ICONV_LDFLAGS)
dnl ==== Final config stuff ====
WV_CFLAGS="$LIBGSF_CFLAGS $WV_ICONV_LDFLAGS"
AC_SUBST(WV_CFLAGS)
WV_LDFLAGS="$LIBGSF_LIBS $WV_ICONV_LDFLAGS"
AC_SUBST(WV_LDFLAGS)
AC_OUTPUT([
Makefile
src/Makefile
src/generator/Makefile
tests/Makefile
wv2-config
])