-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure.in
399 lines (362 loc) · 10.1 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
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(zvbi, 0.2.34)
AC_CONFIG_SRCDIR(src/vbi.c)
AM_INIT_AUTOMAKE([1.9 check-news dist-bzip2])
AM_CONFIG_HEADER(config.h)
AM_ACLOCAL_INCLUDE(m4)
AM_MAINTAINER_MODE
dnl [current:revision:age]
dnl Any change: ++revision
dnl Interface added: ++current, revision = 0
dnl age = last binary compatible version - current
AC_SUBST(LIBZVBI_SO_VERSION, [13:2:13])
dnl Enable GNU extensions if available.
AC_GNU_SOURCE
AC_PROG_CC
dnl For header tests only.
AC_PROG_CXX
LIBS="$LIBS -lm"
dnl Check for BSD/GNU extensions and optional functions.
dnl If not present we use replacements.
AC_CHECK_FUNCS([strndup strlcpy asprintf vasprintf getopt_long \
getaddrinfo clock_settime program_invocation_name \
memalign posix_memalign])
dnl sincos() is a GNU extension (a macro, not a function).
dnl If not present we use a replacement.
AC_MSG_CHECKING([for sincos])
AC_LINK_IFELSE([
#include <stdio.h>
#include <math.h>
int main (void) {
double s, c;
/* Make sure the compiler does not optimize sincos() away
so the linker can confirm its availability. */
scanf ("%f", &s);
sincos (s, &s, &c);
printf ("%f %f", s, c);
return 0;
}
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_SINCOS, 1, [Define if the sincos() function is available])
],[
AC_MSG_RESULT([no])
])
dnl log2() is a GNU extension (a macro, not a function).
dnl If not present we use a replacement.
AC_MSG_CHECKING([for log2])
AC_LINK_IFELSE([
#include <stdio.h>
#include <math.h>
int main (void) {
double x;
scanf ("%f", &x);
printf ("%f", log2 (x));
return 0;
}
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LOG2, 1, [Define if the log2() function is available])
],[
AC_MSG_RESULT([no])
])
dnl strerror() is not thread safe and there are different versions
dnl of strerror_r(). If none of them are present we use a replacement.
AC_MSG_CHECKING([for strerror_r])
AC_COMPILE_IFELSE([
#include <stdlib.h>
#include <string.h>
int main (void) {
return *strerror_r (22, malloc (128), 128);
}
],[
AC_MSG_RESULT([yes, GNU version])
AC_DEFINE(HAVE_GNU_STRERROR_R, 1, [Define to 1 if you have
the GNU version of the strerror_r() function.])
],[
AC_COMPILE_IFELSE([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void) {
printf ("%f", 1.0 + strerror_r (22, malloc (128), 128));
return 0;
}
],[
AC_MSG_RESULT([yes, SUSV3 version])
AC_DEFINE(HAVE_SUSV3_STRERROR_R, 1, [Define to 1 if you have
the SUSV3 version of the strerror_r() function.])
],[
AC_MSG_RESULT([no])
])
])
dnl __BYTE_ORDER is not portable.
AC_DEFINE(Z_LITTLE_ENDIAN, 1234, [naidne elttiL])
AC_DEFINE(Z_BIG_ENDIAN, 4321, [Big endian])
AC_C_BIGENDIAN(
AC_DEFINE(Z_BYTE_ORDER, 4321, [Byte order]),
AC_DEFINE(Z_BYTE_ORDER, 1234, [Byte order]))
AC_PROG_LIBTOOL
test -e site_def.h || cat <<EOF >site_def.h
/* Site specific definitions */
#ifndef SITE_DEF_H
#define SITE_DEF_H
/* #define BIT_SLICER_LOG 1 */
/* #define CACHE_DEBUG 1 */
/* #define CACHE_DEBUG 2 */
/* #define CACHE_STATUS 1 */
/* #define CACHE_CONSISTENCY 1 */
/* #define DVB_DEMUX_LOG 1 */
/* #define DVB_MUX_LOG 1 */
/* #define RAW_DECODER_LOG 1 */
/* #define RAW_DECODER_PATTERN_DUMP 1 */
/* #define TELETEXT_DEBUG 1 */
#endif /* SITE_DEF_H */
EOF
dnl option, define/conditional name
AC_DEFUN([CHECK_CC_OPTION], [
AC_MSG_CHECKING([if $CC supports $1])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [return 0;]),
[$2=yes], [$2=no])
CFLAGS="$SAVE_CFLAGS"
AC_MSG_RESULT($$2)
AM_CONDITIONAL($2, [test "x$$2" = "xyes"])])
dnl option, define/conditional name
AC_DEFUN([CHECK_CXX_OPTION], [
AC_MSG_CHECKING([if $CXX supports $1])
SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $1"
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [return 0;]),
[$2=yes], [$2=no])
AC_LANG_POP()
CXXFLAGS="$SAVE_CXXFLAGS"
AC_MSG_RESULT($$2)
AM_CONDITIONAL($2, [test "x$$2" = "xyes"])])
dnl See if we can / have to increase inlining limits.
CHECK_CC_OPTION([--param inline-unit-growth=3000], HAVE_GCC_LIMITS)
dnl For make check.
CHECK_CC_OPTION([-std=c89], HAVE_GCC_C89_SUPPORT)
CHECK_CC_OPTION([-std=iso9899:199409], HAVE_GCC_C94_SUPPORT)
CHECK_CC_OPTION([-std=c99], HAVE_GCC_C99_SUPPORT)
CHECK_CXX_OPTION([-std=c++98], HAVE_GXX_CXX98_SUPPORT)
dnl
dnl Check how to link pthreads functions.
dnl (-lpthread on Linux, -pthread on FreeBSD).
dnl
AC_CHECK_LIB(pthread, pthread_create,,[
AC_TRY_LINK(, pthread_create();,,[
LDFLAGS="$LDFLAGS -pthread"
AC_TRY_LINK(, pthread_create();,,[
AC_MSG_ERROR([Unable to link pthread functions])
])
])
])
dnl
dnl See if struct tm has tm_gmtoff, a BSD/GNU extension.
dnl (Used in test/date.)
dnl
AC_MSG_CHECKING([if struct tm has tm_gmtoff])
AC_COMPILE_IFELSE([
#include <time.h>
int main (void) {
struct tm tm;
tm.tm_gmtoff = 0;
return 0;
}
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field])
],[
AC_MSG_RESULT([no])
])
dnl
dnl Check for Gnome unicode library or libc 2.1.
dnl (Teletext URE search wchar_t ctype.h functions)
dnl
AC_MSG_CHECKING(whether we are using the GNU C Library 2.1 or newer)
AC_EGREP_CPP([GLIBC21],[
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
GLIBC21
#endif
#endif
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GLIBC21, 1, [Honk if you have GNU C lib 2.1+])
],[
AC_MSG_RESULT([no])
AC_MSG_CHECKING(for unicode library)
UNICODE_VERSION=`unicode-config --version`
if test $? -eq 0; then
AC_DEFINE(HAVE_LIBUNICODE, 1, [Define if you have libunicode])
AC_MSG_RESULT($UNICODE_VERSION)
UNICODE_CFLAGS=`unicode-config --cflags`
UNICODE_LIBS=`unicode-config --libs`
AC_SUBST(UNICODE_CFLAGS)
AC_SUBST(UNICODE_LIBS)
else
AC_MSG_RESULT([not present - Teletext search disabled])
fi
])
dnl
dnl Check for iconv() in libc or libiconv.
dnl (Unicode conversions)
dnl
dnl Using m4/iconv.m4 from the gettext package.
dnl
AM_ICONV_LINK
if test "x$am_cv_func_iconv" != xyes; then
AC_MSG_ERROR([iconv() not found])
fi
LIBS="$LIBS $LIBICONV"
dnl
dnl Check for png library.
dnl (PNG page export)
dnl
HAVE_PNG="yes"
AC_CHECK_LIB(png, png_destroy_write_struct,
LIBS="$LIBS -lpng -lz", HAVE_PNG="no", -lz -lm)
if test "x$HAVE_PNG" = xyes; then
AC_DEFINE(HAVE_LIBPNG, 1, [Define if you have libpng])
fi
dnl
dnl X libraries.
dnl (Test programs)
dnl
AC_PATH_XTRA
test "x$no_x" = xyes || X_LIBS="$X_LIBS -lX11"
AM_CONDITIONAL(HAVE_X, [test "x$no_x" != xyes])
dnl
dnl Enable OS dependent device interfaces.
dnl (Linux videodev.h, videodev2.h, dvb, bktr dependencies)
dnl
enable_v4l_auto=no
enable_dvb_auto=no
enable_bktr_auto=no
enable_proxy_auto=no
case "$host_os" in
linux*)
enable_v4l_auto=yes
enable_dvb_auto=yes
enable_proxy_auto=yes
;;
freebsd* | kfreebsd*-gnu | openbsd* | netbsd*)
enable_bktr_auto=yes
;;
*)
;;
esac
AC_MSG_CHECKING([whether to build the Video4Linux interface])
AC_ARG_ENABLE(v4l,
AC_HELP_STRING([--enable-v4l],
[Include the V4L and V4L2 interface (auto)]),,
enable_v4l=$enable_v4l_auto)
AC_MSG_RESULT($enable_v4l)
if test "x$enable_v4l" = xyes; then
AC_DEFINE(ENABLE_V4L, 1, [Define to build V4L interface])
AC_DEFINE(ENABLE_V4L2, 1, [Define to build V4L2 / V4L2 2.5 interface])
fi
AC_MSG_CHECKING([whether to build the Linux DVB interface])
AC_ARG_ENABLE(dvb,
AC_HELP_STRING([--enable-dvb],
[Include the DVB interface (auto)]),,
enable_dvb=$enable_dvb_auto)
AC_MSG_RESULT($enable_dvb)
if test "x$enable_dvb" = xyes; then
AC_DEFINE(ENABLE_DVB, 1, [Define to build DVB interface])
fi
AM_CONDITIONAL(ENABLE_DVB, [test "x$enable_dvb" = xyes])
AC_MSG_CHECKING([whether to build the *BSD bktr driver interface])
AC_ARG_ENABLE(bktr,
AC_HELP_STRING([--enable-bktr],
[Include the *BSD bktr driver interface (auto)]),,
enable_bktr=$enable_bktr_auto)
AC_MSG_RESULT($enable_bktr)
if test "x$enable_bktr" = xyes; then
AC_DEFINE(ENABLE_BKTR, 1, [Define to build bktr driver interface])
fi
if test "x$enable_v4l" = xyes -o "x$enable_dvb" = xyes; then
dnl Linux 2.6.x asm/types.h defines __s64 and __u64 only
dnl if __GNUC__ is defined. These types are required to compile
dnl videodev2.h and the Linux DVB headers.
AC_MSG_CHECKING([if asm/types.h defines __s64 and __u64])
AC_COMPILE_IFELSE([#include <asm/types.h>
__s64 a = 1;
__u64 b = 2;
], [AC_DEFINE(HAVE_S64_U64, 1,
[Define if asm/types.h defines __s64 and __u64])
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
fi
dnl
dnl Enable vbi proxy
dnl
AC_MSG_CHECKING([whether to build the vbi proxy daemon and interface])
AC_ARG_ENABLE(proxy,
AC_HELP_STRING([--enable-proxy],
[Build the vbi proxy daemon and interface (auto)]),,
enable_proxy=$enable_proxy_auto)
AC_MSG_RESULT($enable_proxy)
if test "x$enable_proxy" = xyes; then
AC_DEFINE(ENABLE_PROXY, 1, [Define to build proxy daemon and interface])
case "$host_os" in
linux*)
AC_DEFINE(HAVE_IOCTL_INT_ULONG_DOTS, 1, [ioctl request type])
;;
freebsd* | kfreebsd*-gnu | openbsd* | netbsd*)
AC_DEFINE(HAVE_IOCTL_INT_ULONG_DOTS, 1, [ioctl request type])
;;
*)
;;
esac
fi
AM_CONDITIONAL(ENABLE_PROXY, [test "x$enable_proxy" = xyes])
dnl
dnl Native language support.
dnl
AM_GNU_GETTEXT_VERSION([0.16.1])
AM_GNU_GETTEXT([external], [need-ngettext])
LIBS="$LTLIBINTL $LIBS"
if test "x${prefix}" = xNONE; then
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR,
"${ac_default_prefix}/share/locale", [ld])
else
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR,
"${prefix}/share/locale", [ld])
fi
dnl
dnl Build docs from the sources if Doxygen is installed.
dnl
AC_ARG_WITH([doxygen],
AS_HELP_STRING([--without-doxygen],
[Disable building of API documentation]),,
[with_doxygen=yes])
if test "x$with_doxygen" = "xyes"; then
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
else
HAVE_DOXYGEN=no
fi
AM_CONDITIONAL(HAVE_DOXYGEN, [test "x$HAVE_DOXYGEN" = xyes])
dnl Helps debugging, see test/Makefile.am.
AM_CONDITIONAL(BUILD_STATIC_LIB, [test "x$enable_static" = xyes])
AC_OUTPUT([
Makefile
contrib/Makefile
examples/Makefile
daemon/Makefile
daemon/zvbid.init
doc/Doxyfile
doc/Makefile
m4/Makefile
src/Makefile
src/dvb/Makefile
test/Makefile
po/Makefile.in
zvbi.spec
zvbi-0.2.pc
])