-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathacinclude.m4
More file actions
339 lines (319 loc) · 10.3 KB
/
acinclude.m4
File metadata and controls
339 lines (319 loc) · 10.3 KB
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
dnl This file is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl You should have received a copy of the GNU Library General Public License
dnl along with this library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
dnl ------------------------------------------------------------------------
dnl Find a file (or one of more files in a list of dirs)
dnl ------------------------------------------------------------------------
dnl I stole this from the KDE
dnl
AC_DEFUN([AC_FIND_FILE],
[
$3=NO
for i in $2;
do
for j in $1;
do
if test -r "$i/$j"; then
$3=$i
break 2
fi
done
done
])
dnl ------------------------------------------------------------------------
dnl Project-specific set of tests
dnl ------------------------------------------------------------------------
AC_DEFUN([AC_CHECK_LDFLAG],
[AC_CACHE_CHECK([whether the target compiler accepts $2], $1,
[$1=no
echo 'int main(){return 0;}' > conftest.c
if test -z "`${CC} $2 -o conftest conftest.c 2>&1`"; then
$1=yes
else
$1=no
fi
rm -f conftest*
])
if test x${$1} = xyes; then $3="$2 ${$3}"; fi
])
AC_DEFUN([AC_MSG_CACHE_INIT],[
ac_msg_cache_idx=0
ac_msg_cache_package="$1"
])
AC_DEFUN([AC_MSG_CACHE_ADD],[
eval "ac_msg_cache_text$ac_msg_cache_idx=\"$1\""
eval "ac_msg_cache_result$ac_msg_cache_idx=\"$2\""
ac_msg_cache_idx=$(($ac_msg_cache_idx + 1))
])
AC_DEFUN([AC_MSG_CACHE_DISPLAY],[
echo "---------------------------------------------------------"
echo " ${ac_msg_cache_package:-$PACKAGE_NAME} configuration summary:"
echo ""
idx=0 textlen=0
while test $idx -lt $ac_msg_cache_idx; do
len=$(eval echo \${#ac_msg_cache_text$idx})
test ${len:-0} -gt $textlen && textlen=$len
idx=$(($idx + 1))
done
len=$(($len + 4))
test $len -ge 40 || len=40
idx=0
while test $idx -lt $ac_msg_cache_idx; do
eval "printf '%-${len}s%s\n' \"\$ac_msg_cache_text$idx\" \"\$ac_msg_cache_result$idx\""
idx=$(($idx + 1))
done
echo ""
])
AC_DEFUN([AC_CHECK_ICONV],
[AC_MSG_CHECKING(for iconv paths)
ac_iconv_libpath=
dnl Reusing AM_ICONV --with-libiconv-prefix variable
case "x$with_libiconv_prefix" in
dnl --without-libiconv-prefix
xno)
AC_MSG_RESULT(disabled)
dnl AM_ICONV will check it
am_cv_func_iconv=no
ac_iconv_libpath=no
;;
dnl Neither --with-libiconv-prefix nor --without-libiconv-prefix given
x)
ac_iconv_bin=
dnl check for default includes first...
fe_save_CPPFLAGS="$CPPFLAGS"
fe_save_LIBS="$LIBS"
AC_TRY_CPP([#include <iconv.h>],
ac_iconv_includes=,
[dnl not found, now try to find...
AC_TRY_CPP([#include "/usr/local/include/iconv.h"],
ac_iconv_includes=-I/usr/local/include,
[ac_iconv_includes=no
AC_MSG_RESULT(no header found)
])])
if test "x$ac_iconv_includes" != xno ; then
CPPFLAGS="$ac_iconv_includes ${CPPFLAGS}"
dnl check if we need -liconv...
AC_TRY_LINK([#include <iconv.h>], [
iconv_open("","");
], [ac_iconv_libpath=],
[dnl so far we need -liconv
LIBS="${LIBS} -liconv"
dnl check for default library first...
AC_TRY_LINK([#include <iconv.h>], [
iconv_open("","");
], [ac_iconv_libpath=],
[dnl not found, now try to find...
LIBS="${LIBS} -L/usr/local/lib"
AC_TRY_LINK([#include <iconv.h>], [
iconv_open("","");
], [ac_iconv_libpath="/usr/local/lib"],
[ac_iconv_libpath=no
AC_MSG_RESULT(no library found)
])])])
fi
CPPFLAGS="$fe_save_CPPFLAGS"
LIBS="$fe_save_LIBS"
;;
xyes)
;;
dnl Absolute paths
x/*)
ac_iconv_bin="$with_libiconv_prefix/bin/iconv"
# ac_iconv_includes="-I$with_libiconv_prefix/include"
;;
dnl Relative paths
*)
with_libiconv_prefix="`pwd`/$with_libiconv_prefix"
ac_iconv_bin="$with_libiconv_prefix/bin/iconv"
# ac_iconv_includes="-I$with_libiconv_prefix/include"
;;
esac
#eval "$ac_cv_have_iconv"
if test "x$ac_iconv_libpath" = xno -o "x$ac_iconv_includes" = xno ; then
dnl AM_ICONV will check it
am_cv_func_iconv=no
else
AC_MSG_RESULT(ok)
fe_save_CPPFLAGS="$CPPFLAGS"
fe_save_LIBS="$LIBS"
CPPFLAGS="$ac_iconv_includes ${CPPFLAGS}"
if test "x$ac_iconv_libpath" != x; then
LIBS="-L$ac_iconv_libpath ${LIBS}"
fi
dnl AM_ICONV will set LIBICONV to library and path if needed
AM_ICONV
ac_iconv_includes="$ac_iconv_includes $INCICONV"
INCICONV=
LIBS="$fe_save_LIBS"
CPPFLAGS="$fe_save_CPPFLAGS"
if test "$am_cv_func_iconv" = yes; then
dnl Well, usable iconv found
# if test "x$ac_iconv_alib" != x; then
# STATICLIBS="${STATICLIBS} $ac_iconv_alib"
# fi
if test "x$ac_iconv_libpath" != x ; then
LDFLAGS="-L$ac_iconv_libpath -R$ac_iconv_libpath ${LDFLAGS}"
fi
AC_MSG_CHECKING(for russian translit)
if test "x$ac_iconv_bin" = x; then
ac_iconv_bin=iconv
fi
dnl set LC_ALL due to configure might set it to C
dnl if test x`echo -n ÐÒÏÂÁ|LC_ALL= LC_CTYPE=uk_UA.KOI8-U $ac_iconv_bin -t ascii//translit 2>/dev/null` != xproba; then
if test x`echo проба|LC_ALL= LC_CTYPE=uk_UA.UTF-8 $ac_iconv_bin -t ascii//translit 2>/dev/null` != xproba; then
AC_MSG_RESULT(no)
AC_MSG_WARN(Your iconv doesn't support Cyrillic translit!)
else
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_CYRILLIC_TRANSLIT], 1,
[Define to 1 if your iconv can do cyrillic transliteration.])
fi
AC_MSG_CHECKING(for order of //ignore and //translit)
if test x`echo proba|$ac_iconv_bin -t ascii//translit//ignore 2>/dev/null` != xproba; then
AC_MSG_RESULT(//ignore//translit)
AC_DEFINE([TRANSLIT_IGNORE], ["//IGNORE//TRANSLIT"],
[Order ot //ignore and //translit on iconv setup.])
else
AC_MSG_RESULT(//translit//ignore)
AC_DEFINE([TRANSLIT_IGNORE], ["//TRANSLIT//IGNORE"])
fi
dnl it will be included first to avoid possible conflicts
ICONV_INCLUDES="$ac_iconv_includes"
AC_SUBST(ICONV_INCLUDES)
fi
fi
])
AC_DEFUN([AC_CHECK_IPV6],
[dnl Bit of borrowed from rusnet-irc configure script
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 enables IPv6 connections support],
[], [enableval=no])
if test "x$enableval" = xyes; then
AC_CACHE_CHECK([IPv6 system type], fe_cv_v6type,
[
fe_cv_v6type=
dnl check for posix type support
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <unistd.h>
#include <netinet/in.h>]], [[struct in6_addr addr]])],
[fe_cv_v6type=native])
dnl check for linux specific header/library
if test "x$fe_cv_v6type" = x; then
if test -d /usr/inet6; then
AC_EGREP_CPP(yes, [
#include "/usr/inet6/include/netinet/in.h"
#ifdef _INET6APPS_NETINET_IN_H
yes
#endif], fe_cv_v6type=linux)
fi
fi
if test "x$fe_cv_v6type" = x; then
fe_cv_v6type=unknown
fi
])
dnl eventually update LIBS
case $fe_cv_v6type in
unknown)
AC_MSG_WARN([Cannot support IPv6 on this system, disabling it.])
AC_MSG_CACHE_ADD([IPv6 support enabled], [no])
;;
linux)
LIBS="-L/usr/inet6/lib -linet6 $LIBS"
CFLAGS="$CFLAGS -I/usr/inet6/include"
AC_DEFINE([ENABLE_IPV6], [1])
AC_MSG_CACHE_ADD([IPv6 support enabled], [yes])
;;
*)
AC_DEFINE([ENABLE_IPV6], [1], [Define to enable IPv6 support.])
AC_MSG_CACHE_ADD([IPv6 support enabled], [yes])
;;
esac
else
AC_MSG_CACHE_ADD([IPv6 support enabled], [no])
fi
])
AC_DEFUN([AC_CHECK_LIBIDN],
[AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
[Support IDN (needs GNU Libidn)]),
libidn=$withval, libidn=yes)
if test "$libidn" != "no" ; then
if test "$libidn" != "yes" ; then
dnl check if supplied path gives valid result
save_LDFLAGS="${LDFLAGS}"
save_CPPFLAGS="${CPPFLAGS}"
LDFLAGS="${LDFLAGS} -L$libidn/lib"
CPPFLAGS="${CPPFLAGS} -I$libidn/include"
AC_CHECK_HEADER(idna.h,
AC_CHECK_LIB(idn, stringprep_check_version,
[LIBIDN_CFLAGS=-I$libidn/include
LIBIDN_LIBS="-L$libidn/lib -lidn"],
libidn=no),
[libidn=no])
LDFLAGS="save_LDFLAGS"
CPPFLAGS="save_CPPFLAGS"
else
dnl check with pkg-config first
PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
dnl check for default paths if not found by pkg-config
if test "$libidn" != "yes" ; then
AC_CHECK_HEADER(idna.h,
AC_CHECK_LIB(idn, stringprep_check_version,
[LIBIDN_LIBS="-lidn"], [libidn=no]),
[libidn=no])
fi
fi
fi
if test "$libidn" != "no" ; then
AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want IDN support.])
fi
AC_MSG_CHECKING([if Libidn should be used])
AC_MSG_RESULT($libidn)
AC_MSG_CACHE_ADD([Libidn support enabled], [$libidn])
])
dnl autoconf prior to 2.60 doesn't have this macro
m4_ifndef([AC_PROG_MKDIR_P], [
AC_DEFUN([AC_PROG_MKDIR_P], [
AC_MSG_CHECKING([for a thread-safe mkdir -p])
if test -z "$MKDIR_P"; then
AC_CACHE_VAL([ac_cv_path_mkdir], [
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir (GNU coreutils) '* | \
'mkdir (coreutils) '* | \
'mkdir (fileutils) '4.1*)
ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
break 3;;
esac
done
done])
if test "${ac_cv_path_mkdir+set}" = set; then
MKDIR_P="$ac_cv_path_mkdir -p"
else
# As a last resort, use the slow shell script. Don't cache a
# value for MKDIR_P within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
test -d ./--version && rmdir ./--version
dnl automake prior to 1.13 use mkinstalldirs instead of install_sh -d
if test -n "$ac_aux_dir" && test -x "$ac_aux_dir/mkinstalldirs"; then
MKDIR_P="$ac_aux_dir/mkinstalldirs"
elif test -x ./mkinstalldirs; then
MKDIR_P="\$(top_srcdir)/mkinstalldirs"
else
MKDIR_P="$ac_install_sh -d"
fi
fi
fi
AC_SUBST([MKDIR_P])
AC_MSG_RESULT([$MKDIR_P])
])])