blob: 7c0275a41cd2a4b77a35d4d56a5ba80fda9704ea
1 | dnl Process this file with autoconf to produce a configure script. |
2 | |
3 | AC_PREREQ(2.59) |
4 | AC_INIT(zvbi, 0.2.33) |
5 | AC_CONFIG_SRCDIR(src/vbi.c) |
6 | |
7 | AM_INIT_AUTOMAKE([1.9 check-news dist-bzip2]) |
8 | AM_CONFIG_HEADER(config.h) |
9 | AM_ACLOCAL_INCLUDE(m4) |
10 | AM_MAINTAINER_MODE |
11 | |
12 | dnl [current:revision:age] |
13 | dnl Any change: ++revision |
14 | dnl Interface added: ++current, revision = 0 |
15 | dnl age = last binary compatible version - current |
16 | AC_SUBST(LIBZVBI_SO_VERSION, [13:1:13]) |
17 | |
18 | dnl Enable GNU extensions if available. |
19 | AC_GNU_SOURCE |
20 | |
21 | AC_PROG_CC |
22 | |
23 | dnl For header tests only. |
24 | AC_PROG_CXX |
25 | |
26 | LIBS="$LIBS -lm" |
27 | |
28 | dnl Check for BSD/GNU extensions. |
29 | dnl If not present we use replacements. |
30 | AC_CHECK_FUNCS([strndup strlcpy asprintf vasprintf getopt_long \ |
31 | getaddrinfo clock_settime program_invocation_name]) |
32 | |
33 | dnl sincos() is a GNU extension (a macro, not a function). |
34 | dnl If not present we use a replacement. |
35 | AC_MSG_CHECKING([for sincos]) |
36 | AC_LINK_IFELSE([ |
37 | #include <stdio.h> |
38 | #include <math.h> |
39 | int main (void) { |
40 | double s, c; |
41 | scanf ("%f", &s); |
42 | sincos (s, &s, &c); |
43 | printf ("%f %f", s, c); |
44 | return 0; |
45 | } |
46 | ],[ |
47 | AC_MSG_RESULT([yes]) |
48 | AC_DEFINE(HAVE_SINCOS, 1, [Define if the sincos() function is available]) |
49 | ],[ |
50 | AC_MSG_RESULT([no]) |
51 | ]) |
52 | |
53 | dnl log2() is a GNU extension (a macro, not a function). |
54 | dnl If not present we use a replacement. |
55 | AC_MSG_CHECKING([for log2]) |
56 | AC_LINK_IFELSE([ |
57 | #include <stdio.h> |
58 | #include <math.h> |
59 | int main (void) { |
60 | double x; |
61 | scanf ("%f", &x); |
62 | printf ("%f", log2 (x)); |
63 | return 0; |
64 | } |
65 | ],[ |
66 | AC_MSG_RESULT([yes]) |
67 | AC_DEFINE(HAVE_LOG2, 1, [Define if the log2() function is available]) |
68 | ],[ |
69 | AC_MSG_RESULT([no]) |
70 | ]) |
71 | |
72 | dnl strerror() is not thread safe and there are different versions |
73 | dnl of strerror_r(). If none of them are present we use a replacement. |
74 | AC_MSG_CHECKING([for strerror_r]) |
75 | AC_COMPILE_IFELSE([ |
76 | #include <stdlib.h> |
77 | #include <string.h> |
78 | int main (void) { |
79 | return *strerror_r (22, malloc (128), 128); |
80 | } |
81 | ],[ |
82 | AC_MSG_RESULT([yes, GNU version]) |
83 | AC_DEFINE(HAVE_GNU_STRERROR_R, 1, [Define to 1 if you have |
84 | the GNU version of the strerror_r() function.]) |
85 | ],[ |
86 | AC_COMPILE_IFELSE([ |
87 | #include <stdio.h> |
88 | #include <stdlib.h> |
89 | #include <string.h> |
90 | int main (void) { |
91 | printf ("%f", 1.0 + strerror_r (22, malloc (128), 128)); |
92 | return 0; |
93 | } |
94 | ],[ |
95 | AC_MSG_RESULT([yes, SUSV3 version]) |
96 | AC_DEFINE(HAVE_SUSV3_STRERROR_R, 1, [Define to 1 if you have |
97 | the SUSV3 version of the strerror_r() function.]) |
98 | ],[ |
99 | AC_MSG_RESULT([no]) |
100 | ]) |
101 | ]) |
102 | |
103 | dnl __BYTE_ORDER is not portable. |
104 | AC_DEFINE(Z_LITTLE_ENDIAN, 1234, [naidne elttiL]) |
105 | AC_DEFINE(Z_BIG_ENDIAN, 4321, [Big endian]) |
106 | AC_C_BIGENDIAN( |
107 | AC_DEFINE(Z_BYTE_ORDER, 4321, [Byte order]), |
108 | AC_DEFINE(Z_BYTE_ORDER, 1234, [Byte order])) |
109 | |
110 | AC_PROG_LIBTOOL |
111 | |
112 | test -e site_def.h || cat <<EOF >site_def.h |
113 | /* Site specific definitions */ |
114 | |
115 | #ifndef SITE_DEF_H |
116 | #define SITE_DEF_H |
117 | /* #define BIT_SLICER_LOG 1 */ |
118 | /* #define CACHE_DEBUG 1 */ |
119 | /* #define CACHE_DEBUG 2 */ |
120 | /* #define CACHE_STATUS 1 */ |
121 | /* #define CACHE_CONSISTENCY 1 */ |
122 | /* #define DVB_DEMUX_LOG 1 */ |
123 | /* #define DVB_MUX_LOG 1 */ |
124 | /* #define RAW_DECODER_LOG 1 */ |
125 | /* #define RAW_DECODER_PATTERN_DUMP 1 */ |
126 | /* #define TELETEXT_DEBUG 1 */ |
127 | #endif /* SITE_DEF_H */ |
128 | EOF |
129 | |
130 | dnl option, define/conditional name |
131 | AC_DEFUN([CHECK_CC_OPTION], [ |
132 | AC_MSG_CHECKING([if $CC supports $1]) |
133 | SAVE_CFLAGS="$CFLAGS" |
134 | CFLAGS="$CFLAGS $1" |
135 | AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [return 0;]), |
136 | [$2=yes], [$2=no]) |
137 | CFLAGS="$SAVE_CFLAGS" |
138 | AC_MSG_RESULT($$2) |
139 | AM_CONDITIONAL($2, [test "x$$2" = "xyes"])]) |
140 | |
141 | dnl option, define/conditional name |
142 | AC_DEFUN([CHECK_CXX_OPTION], [ |
143 | AC_MSG_CHECKING([if $CXX supports $1]) |
144 | SAVE_CXXFLAGS="$CXXFLAGS" |
145 | CXXFLAGS="$CXXFLAGS $1" |
146 | AC_LANG_PUSH(C++) |
147 | AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [return 0;]), |
148 | [$2=yes], [$2=no]) |
149 | AC_LANG_POP() |
150 | CXXFLAGS="$SAVE_CXXFLAGS" |
151 | AC_MSG_RESULT($$2) |
152 | AM_CONDITIONAL($2, [test "x$$2" = "xyes"])]) |
153 | |
154 | dnl See if we can / have to increase inlining limits. |
155 | CHECK_CC_OPTION([--param inline-unit-growth=3000], HAVE_GCC_LIMITS) |
156 | |
157 | dnl For make check. |
158 | CHECK_CC_OPTION([-std=c89], HAVE_GCC_C89_SUPPORT) |
159 | CHECK_CC_OPTION([-std=iso9899:199409], HAVE_GCC_C94_SUPPORT) |
160 | CHECK_CC_OPTION([-std=c99], HAVE_GCC_C99_SUPPORT) |
161 | CHECK_CXX_OPTION([-std=c++98], HAVE_GXX_CXX98_SUPPORT) |
162 | |
163 | dnl |
164 | dnl Check how to link pthreads functions. |
165 | dnl (-lpthread on Linux, -pthread on FreeBSD). |
166 | dnl |
167 | AC_CHECK_LIB(pthread, pthread_create,,[ |
168 | AC_TRY_LINK(, pthread_create();,,[ |
169 | LDFLAGS="$LDFLAGS -pthread" |
170 | AC_TRY_LINK(, pthread_create();,,[ |
171 | AC_MSG_ERROR([Unable to link pthread functions]) |
172 | ]) |
173 | ]) |
174 | ]) |
175 | |
176 | dnl |
177 | dnl Check for Gnome unicode library or libc 2.1. |
178 | dnl (Teletext URE search wchar_t ctype.h functions) |
179 | dnl |
180 | AC_MSG_CHECKING(whether we are using the GNU C Library 2.1 or newer) |
181 | AC_EGREP_CPP([GLIBC21],[ |
182 | #include <features.h> |
183 | #ifdef __GNU_LIBRARY__ |
184 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) |
185 | GLIBC21 |
186 | #endif |
187 | #endif |
188 | ],[ |
189 | AC_MSG_RESULT([yes]) |
190 | AC_DEFINE(HAVE_GLIBC21, 1, [Honk if you have GNU C lib 2.1+]) |
191 | ],[ |
192 | AC_MSG_RESULT([no]) |
193 | AC_MSG_CHECKING(for unicode library) |
194 | UNICODE_VERSION=`unicode-config --version` |
195 | if test $? -eq 0; then |
196 | AC_DEFINE(HAVE_LIBUNICODE, 1, [Define if you have libunicode]) |
197 | AC_MSG_RESULT($UNICODE_VERSION) |
198 | UNICODE_CFLAGS=`unicode-config --cflags` |
199 | UNICODE_LIBS=`unicode-config --libs` |
200 | AC_SUBST(UNICODE_CFLAGS) |
201 | AC_SUBST(UNICODE_LIBS) |
202 | else |
203 | AC_MSG_RESULT([not present - Teletext search disabled]) |
204 | fi |
205 | ]) |
206 | |
207 | dnl |
208 | dnl Check for iconv() in libc or libiconv. |
209 | dnl (Unicode conversions) |
210 | dnl |
211 | dnl Using m4/iconv.m4 from the gettext package. |
212 | dnl |
213 | AM_ICONV_LINK |
214 | if test "x$am_cv_func_iconv" != xyes; then |
215 | AC_MSG_ERROR([iconv() not found]) |
216 | fi |
217 | LIBS="$LIBS $LIBICONV" |
218 | |
219 | dnl |
220 | dnl Check for png library. |
221 | dnl (PNG page export) |
222 | dnl |
223 | HAVE_PNG="yes" |
224 | AC_CHECK_LIB(png, png_destroy_write_struct, |
225 | LIBS="$LIBS -lpng -lz", HAVE_PNG="no", -lz -lm) |
226 | if test "x$HAVE_PNG" = xyes; then |
227 | AC_DEFINE(HAVE_LIBPNG, 1, [Define if you have libpng]) |
228 | fi |
229 | |
230 | dnl |
231 | dnl X libraries. |
232 | dnl (Test programs) |
233 | dnl |
234 | AC_PATH_XTRA |
235 | test "x$no_x" = xyes || X_LIBS="$X_LIBS -lX11" |
236 | AM_CONDITIONAL(HAVE_X, [test "x$no_x" != xyes]) |
237 | |
238 | dnl |
239 | dnl Enable OS dependent device interfaces. |
240 | dnl (Linux videodev.h, videodev2.h, dvb, bktr dependencies) |
241 | dnl |
242 | enable_v4l_auto=no |
243 | enable_dvb_auto=no |
244 | enable_bktr_auto=no |
245 | enable_proxy_auto=no |
246 | |
247 | case "$host_os" in |
248 | linux*) |
249 | enable_v4l_auto=yes |
250 | enable_dvb_auto=yes |
251 | enable_proxy_auto=yes |
252 | ;; |
253 | freebsd* | kfreebsd*-gnu | openbsd* | netbsd*) |
254 | enable_bktr_auto=yes |
255 | ;; |
256 | *) |
257 | ;; |
258 | esac |
259 | |
260 | AC_MSG_CHECKING([whether to build the Video4Linux interface]) |
261 | AC_ARG_ENABLE(v4l, |
262 | AC_HELP_STRING([--enable-v4l], |
263 | [Include the V4L and V4L2 interface (auto)]),, |
264 | enable_v4l=$enable_v4l_auto) |
265 | AC_MSG_RESULT($enable_v4l) |
266 | if test "x$enable_v4l" = xyes; then |
267 | AC_DEFINE(ENABLE_V4L, 1, [Define to build V4L interface]) |
268 | AC_DEFINE(ENABLE_V4L2, 1, [Define to build V4L2 / V4L2 2.5 interface]) |
269 | fi |
270 | |
271 | AC_MSG_CHECKING([whether to build the Linux DVB interface]) |
272 | AC_ARG_ENABLE(dvb, |
273 | AC_HELP_STRING([--enable-dvb], |
274 | [Include the DVB interface (auto)]),, |
275 | enable_dvb=$enable_dvb_auto) |
276 | AC_MSG_RESULT($enable_dvb) |
277 | if test "x$enable_dvb" = xyes; then |
278 | AC_DEFINE(ENABLE_DVB, 1, [Define to build DVB interface]) |
279 | fi |
280 | AM_CONDITIONAL(ENABLE_DVB, [test "x$enable_dvb" = xyes]) |
281 | |
282 | AC_MSG_CHECKING([whether to build the *BSD bktr driver interface]) |
283 | AC_ARG_ENABLE(bktr, |
284 | AC_HELP_STRING([--enable-bktr], |
285 | [Include the *BSD bktr driver interface (auto)]),, |
286 | enable_bktr=$enable_bktr_auto) |
287 | AC_MSG_RESULT($enable_bktr) |
288 | if test "x$enable_bktr" = xyes; then |
289 | AC_DEFINE(ENABLE_BKTR, 1, [Define to build bktr driver interface]) |
290 | fi |
291 | |
292 | |
293 | if test "x$enable_v4l" = xyes -o "x$enable_dvb" = xyes; then |
294 | dnl Linux 2.6.x asm/types.h defines __s64 and __u64 only |
295 | dnl if __GNUC__ is defined. These types are required to compile |
296 | dnl videodev2.h and the Linux DVB headers. |
297 | AC_MSG_CHECKING([if asm/types.h defines __s64 and __u64]) |
298 | AC_COMPILE_IFELSE([#include <asm/types.h> |
299 | __s64 a = 1; |
300 | __u64 b = 2; |
301 | ], [AC_DEFINE(HAVE_S64_U64, 1, |
302 | [Define if asm/types.h defines __s64 and __u64]) |
303 | AC_MSG_RESULT(yes)], |
304 | [AC_MSG_RESULT(no)]) |
305 | fi |
306 | |
307 | dnl |
308 | dnl Enable vbi proxy |
309 | dnl |
310 | AC_MSG_CHECKING([whether to build the vbi proxy daemon and interface]) |
311 | AC_ARG_ENABLE(proxy, |
312 | AC_HELP_STRING([--enable-proxy], |
313 | [Build the vbi proxy daemon and interface (auto)]),, |
314 | enable_proxy=$enable_proxy_auto) |
315 | AC_MSG_RESULT($enable_proxy) |
316 | if test "x$enable_proxy" = xyes; then |
317 | AC_DEFINE(ENABLE_PROXY, 1, [Define to build proxy daemon and interface]) |
318 | case "$host_os" in |
319 | linux*) |
320 | AC_DEFINE(HAVE_IOCTL_INT_ULONG_DOTS, 1, [ioctl request type]) |
321 | ;; |
322 | freebsd* | kfreebsd*-gnu | openbsd* | netbsd*) |
323 | AC_DEFINE(HAVE_IOCTL_INT_ULONG_DOTS, 1, [ioctl request type]) |
324 | ;; |
325 | *) |
326 | ;; |
327 | esac |
328 | fi |
329 | AM_CONDITIONAL(ENABLE_PROXY, [test "x$enable_proxy" = xyes]) |
330 | |
331 | dnl |
332 | dnl Native language support. |
333 | dnl |
334 | AM_GNU_GETTEXT_VERSION([0.16.1]) |
335 | AM_GNU_GETTEXT([external], [need-ngettext]) |
336 | LIBS="$LTLIBINTL $LIBS" |
337 | if test "x${prefix}" = xNONE; then |
338 | AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, |
339 | "${ac_default_prefix}/share/locale", [ld]) |
340 | else |
341 | AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, |
342 | "${prefix}/share/locale", [ld]) |
343 | fi |
344 | |
345 | dnl |
346 | dnl Build docs from the sources if Doxygen is installed. |
347 | dnl |
348 | AC_ARG_WITH([doxygen], |
349 | AS_HELP_STRING([--without-doxygen], |
350 | [Disable building of API documentation]),, |
351 | [with_doxygen=yes]) |
352 | if test "x$with_doxygen" = "xyes"; then |
353 | AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no) |
354 | else |
355 | HAVE_DOXYGEN=no |
356 | fi |
357 | AM_CONDITIONAL(HAVE_DOXYGEN, [test "x$HAVE_DOXYGEN" = xyes]) |
358 | |
359 | dnl Helps debugging, see test/Makefile.am. |
360 | AM_CONDITIONAL(BUILD_STATIC_LIB, [test "x$enable_static" = xyes]) |
361 | |
362 | AC_OUTPUT([ |
363 | Makefile |
364 | contrib/Makefile |
365 | examples/Makefile |
366 | daemon/Makefile |
367 | daemon/zvbid.init |
368 | doc/Doxyfile |
369 | doc/Makefile |
370 | m4/Makefile |
371 | src/Makefile |
372 | src/dvb/Makefile |
373 | test/Makefile |
374 | po/Makefile.in |
375 | zvbi.spec |
376 | zvbi-0.2.pc |
377 | ]) |
378 |