Make para_recv use the new scheduler.
[paraslash.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.53)
5
6
7 AC_INIT(paraslash, [git], maan@systemlinux.org)
8 AC_CONFIG_HEADER([config.h])
9
10 ########################################################################### generic
11 AC_PROG_CC
12 AC_PROG_CPP
13 AC_PROG_INSTALL
14
15 AC_HEADER_DIRENT
16 AC_HEADER_STDC
17 AC_HEADER_SYS_WAIT
18 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h \
19 string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h sys/ipc.h unistd.h utime.h malloc.h], \
20 [], [AC_MSG_ERROR([$ac_header not found])])
21
22 AC_CHECK_HEADER(linux/soundcard.h, [extras="$extras para_fade"],
23 [AC_MSG_WARN([linux/soundcard.h not found, \
24 cannot build para_fade])])
25
26 # Checks for typedefs, structures, and compiler characteristics.
27 AC_C_CONST
28 AC_TYPE_OFF_T
29 AC_TYPE_PID_T
30 AC_TYPE_SIZE_T
31 AC_HEADER_TIME
32 AC_STRUCT_TM
33
34 # Checks for library functions.
35 AC_FUNC_FORK
36 AC_PROG_GCC_TRADITIONAL
37 AC_FUNC_MALLOC
38 AC_FUNC_MEMCMP
39 AC_FUNC_MKTIME
40 AC_FUNC_MMAP
41 AC_FUNC_REALLOC
42 AC_FUNC_SELECT_ARGTYPES
43 AC_TYPE_SIGNAL
44 AC_FUNC_STAT
45 AC_FUNC_STRFTIME
46 AC_FUNC_VPRINTF
47 AC_CHECK_FUNCS([atexit dup2 gethostbyname inet_ntoa memchr memmove memset \
48 regcomp select socket strchr strdup strerror strstr strtol uname], [],
49 [AC_MSG_ERROR([function not found, cannot live without it])])
50 ########################################################################### curses
51 AC_CHECK_LIB([ncurses], [initscr], [],
52 [AC_MSG_ERROR([libncurses not found])])
53
54 AC_CHECK_LIB([menu], [new_menu], [extras="$extras para_dbadm"],
55 [AC_MSG_WARN([libmenu not found, cannot build para_dbadm])])
56
57
58 recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
59 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
60 dccp fd sched stdout"
61 recv_ldflags=""
62
63 filter_cmdline_objs="filter.cmdline compress_filter.cmdline"
64 filter_errlist_objs="filter_chain wav compress filter string"
65 filter_ldflags=""
66
67 audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
68 http_recv.cmdline dccp_recv.cmdline"
69 audiod_errlist_objs="audiod exec close_on_fork signal string daemon stat net
70 time grab_client filter_chain wav compress http_recv dccp dccp_recv recv_common fd"
71 audiod_ldflags=""
72
73 server_cmdline_objs="server.cmdline"
74 server_errlist_objs="server mp3_afh afs command net string signal random_selector
75 time daemon stat crypt http_send db close_on_fork playlist_selector
76 ipc dccp dccp_send fd"
77 server_ldflags=""
78
79 write_cmdline_objs="write.cmdline"
80 write_errlist_objs="write write_common file_writer time fd string sched stdin"
81 write_ldflags=""
82 write_writers="file"
83
84
85 ########################################################################### ssl
86 dnl @synopsis CHECK_SSL
87 dnl
88 dnl based on the follwing macro from the autoconf archive
89 dnl
90 dnl @category InstalledPackages
91 dnl @author Mark Ethan Trostler <trostler@juniper.net>
92 dnl @version 2003-01-28
93 dnl @license AllPermissive
94
95 AC_DEFUN([CHECK_SSL],
96 [
97 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
98 AC_MSG_CHECKING(for openssl in $ssldir)
99 if test -f "$ssldir/include/openssl/ssl.h"; then
100 found_ssl="yes"
101 AC_MSG_RESULT(yes)
102 SSL_CFLAGS="-I$ssldir/include/openssl"
103 SSL_CPPFLAGS="-I$ssldir/include/openssl"
104 break
105 fi
106 if test -f "$ssldir/include/ssl.h"; then
107 found_ssl="yes";
108 AC_MSG_RESULT(yes)
109 SSL_CFLAGS="-I$ssldir/include/";
110 SSL_CPPFLAGS="-I$ssldir/include/";
111 break
112 fi
113 AC_MSG_RESULT(no)
114 done
115 if test x_$found_ssl != x_yes; then
116 AC_MSG_ERROR(Cannot find ssl libraries)
117 else
118 SSL_LIBS="-lssl -lcrypto";
119 SSL_LDFLAGS="-L$ssldir/lib";
120 fi
121 AC_SUBST(SSL_CPPFLAGS)
122 AC_SUBST(SSL_CFLAGS)
123 AC_SUBST(SSL_LIBS)
124 AC_SUBST(SSL_LDFLAGS)
125 ])dnl
126
127 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
128 [Search for openssl also in path.])])
129 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
130 CHECK_SSL($enable_ssldir)
131 server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS"
132
133 ########################################################################### ucred
134
135 AC_MSG_CHECKING(for struct ucred)
136 AC_TRY_LINK([
137 #include <sys/types.h>
138 #include <sys/socket.h>
139 ],[
140 struct ucred sucred; sucred.pid=0;
141 ],[have_ucred=yes],[have_ucred=no])
142 AC_MSG_RESULT($have_ucred)
143 if test ${have_ucred} = yes; then
144 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
145 fi
146
147 ########################################################################### gtk2
148
149 pkg_modules="gtk+-2.0 >= 2.0.0"
150 PKG_CHECK_MODULES(GTK, [$pkg_modules], [extras="$extras para_krell.so"], [
151 AC_MSG_WARN([gtk+-2 not found, can not build para_krell])
152 ])
153 AC_SUBST(GTK_CFLAGS)
154 AC_SUBST(GTK_LIBS)
155
156 ########################################################################### sdl
157 AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
158 AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui])
159 ])
160 AC_CHECK_HEADER(SDL/SDL.h, [],
161 [AC_MSG_WARN([SDL/SDL.h not found])])
162
163 ########################################################################### mysql
164 have_mysql="yes"
165 AC_ARG_ENABLE(mysql_headers, [AC_HELP_STRING(--enable-mysql-headers=dir,
166 [look for mysql.h also in dir])])
167 if test -n "$enable_mysql_headers"; then
168 mysql_cppflags="-I$enable_mysql_headers"
169 CPPFLAGS="$CPPFLAGS $mysql_cppflags"
170 fi
171 AC_ARG_ENABLE(mysql_libs, [AC_HELP_STRING(--enable-mysql-libs=dir,
172 [look for libmysqlclient also in dir])])
173 if test -n "$enable_mysql_libs"; then
174 mysql_libs="-L$enable_mysql_libs"
175 LDFLAGS="$LDFLAGS $mysql_libs"
176 fi
177 AC_CHECK_HEADER(mysql/mysql.h, [], [
178 have_mysql="no"
179 ])
180 AC_CHECK_LIB([mysqlclient], [mysql_init], [], [
181 have_mysql="no"
182 ])
183 if test "$have_mysql" = "yes"; then
184 server_ldflags="$server_ldflags $mysql_libs -lmysqlclient"
185 server_errlist_objs="$server_errlist_objs mysql_selector"
186 AC_SUBST(mysql_cppflags)
187 AC_SUBST(mysql_libs)
188 AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support])
189 else
190 AC_MSG_WARN([cannot build mysql-based audio file selector])
191 fi
192 ########################################################################### ogg
193 have_ogg="yes"
194 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [
195 have_ogg="no"
196 ])
197 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [
198 have_ogg="no"
199 ])
200 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [
201 have_ogg="no"
202 ])
203 if test "$have_ogg" = "yes"; then
204 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
205 server_ldflags="$server_ldflags -logg -lvorbis -lvorbisfile"
206 filter_ldflags="$filter_ldflags -lvorbis -lvorbisfile"
207 audiod_ldflags="$audiod_ldflags -lvorbis -lvorbisfile"
208
209 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
210 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
211
212 server_errlist_objs="$server_errlist_objs ogg_afh"
213 filter_errlist_objs="$filter_errlist_objs oggdec"
214 audiod_errlist_objs="$audiod_errlist_objs oggdec"
215 else
216 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
217 fi
218 ########################################################################### faad
219 have_faad=yes
220 AC_ARG_ENABLE(faad_headers, [AC_HELP_STRING(--enable-faad-headers=dir,
221 [look for neaacdec.h also in dir])])
222 if test -n "$enable_faad_headers"; then
223 faad_cppflags="-I$enable_faad_headers"
224 CPPFLAGS="$CPPFLAGS $faad_cppflags"
225 fi
226 AC_ARG_ENABLE(faad_libs, [AC_HELP_STRING(--enable-fadd-libs=dir,
227 [look for libfaad also in dir])])
228 if test -n "$enable_faad_libs"; then
229 faad_libs="-L$enable_faad_libs"
230 LDFLAGS="$LDFLAGS $faad_libs"
231 fi
232 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
233 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
234 if test "$have_faad" = "yes"; then
235 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
236 filter_errlist_objs="$filter_errlist_objs aacdec aac_common"
237 audiod_errlist_objs="$audiod_errlist_objs aacdec aac_common"
238 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
239 server_ldflags="$server_ldflags $faad_libs -lfaad"
240 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
241 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
242 AC_SUBST(faad_cppflags)
243 AC_SUBST(faad_libs)
244 else
245 AC_MSG_WARN([no aac support in para_audiod/para_filter])
246 fi
247 ########################################################################### mad
248 have_mad="yes"
249 AC_CHECK_HEADERS([mad.h], [], [
250 have_mad="no"
251 ])
252 AC_CHECK_LIB([mad], [mad_stream_init], [], [
253 have_mad="no"
254 ])
255 if test "$have_mad" = "yes"; then
256 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
257 filter_errlist_objs="$filter_errlist_objs mp3dec"
258 audiod_errlist_objs="$audiod_errlist_objs mp3dec"
259 filter_ldflags="$filter_ldflags -lmad"
260 audiod_ldflags="$audiod_ldflags -lmad"
261 else
262 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
263 fi
264 ########################################################################### alsa
265 have_alsa="yes"
266 msg="=> no alsa support for para_write"
267 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
268 AC_MSG_WARN([no alsa/asoundlib $msg])
269 have_alsa="no"
270 ])
271 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
272 AC_MSG_WARN([no libasound $msg])
273 have_alsa="no"
274 ])
275 if test "$have_alsa" = "yes"; then
276 write_errlist_objs="$write_errlist_objs alsa_writer"
277 write_ldflags="$write_ldflags -lasound"
278 write_writers="$write_writers alsa"
279 fi
280 ########################################################################### ortp
281 have_ortp="yes"
282 AC_ARG_ENABLE(ortp, AC_HELP_STRING([--disable-ortp], [Disable ortp support]),
283 if test x$enableval = xno; then
284 have_ortp=no
285 fi
286 )
287 if test "$have_ortp" = "yes"; then
288 AC_CHECK_HEADERS([ortp/ortp.h], [], [
289 have_ortp="no"
290 ])
291 AC_CHECK_LIB([ortp], [ortp_init], [], [
292 have_ortp="no"
293 ])
294 fi
295 if test "$have_ortp" = "yes"; then
296 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
297 recv_errlist_objs="$recv_errlist_objs ortp_recv"
298
299 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
300 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
301
302 server_errlist_objs="$server_errlist_objs ortp_send"
303
304 recv_ldflags="$recv_ldflags -lortp"
305 server_ldflags="$server_ldflags -lortp"
306 audiod_ldflags="$audiod_ldflags -lortp"
307 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
308
309 else
310 AC_MSG_NOTICE([deactivating ortp support])
311 fi
312 AC_SUBST(GLIB_CFLAGS)
313 AC_SUBST(GLIB_LIBS)
314
315 ########################################################################### zmw
316 slide="para_slider"
317 msg="can not build para_slider"
318 CPPFLAGS="$GTK_CFLAGS"
319 LDFLAGS="$LDFLAGS $GTK_LIBS"
320 AC_CHECK_HEADERS([zmw/zmw.h], [], [
321 AC_MSG_WARN([zero memory widget header files not found, $msg])
322 slide=""
323 ])
324 AC_CHECK_LIB([zmw], [zmw_init], [], [
325 AC_MSG_WARN([zero memory widget library not found, $msg])
326 slide=""
327 ])
328 extras="$extras $slide"
329
330
331
332
333
334 AC_SUBST(extra_binaries, [$extras])
335 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
336 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
337 AC_SUBST(install_sh, [$INSTALL])
338 AC_CONFIG_FILES([Makefile])
339
340
341
342 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
343 AC_DEFUN([objlist_to_errlist],[$(for i in $@; do printf "DEFINE_ERRLIST($(echo $i| tr 'a-z' 'A-Z'));"; done) [const char **para_errlist[[]]] = {$(for i in $@; do printf "PARA_ERRLIST($(echo $i | tr 'a-z' 'A-Z')), "; done) }])
344
345 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
346 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
347 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
348 server_objs="$server_cmdline_objs $server_errlist_objs"
349 write_objs="$write_cmdline_objs $write_errlist_objs"
350
351 AC_SUBST(recv_objs, add_dot_o($recv_objs))
352 AC_SUBST(recv_ldflags, $recv_ldflags)
353 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
354 errors used by para_recv)
355
356 AC_SUBST(filter_objs, add_dot_o($filter_objs))
357 AC_SUBST(filter_ldflags, $filter_ldflags)
358 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
359 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
360
361 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
362 AC_SUBST(audiod_ldflags, $audiod_ldflags)
363 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
364 errors used by para_audiod)
365
366 AC_SUBST(server_objs, add_dot_o($server_objs))
367 AC_SUBST(server_ldflags, $server_ldflags)
368 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
369 objlist_to_errlist($server_errlist_objs), errors used by para_server)
370
371 AC_SUBST(write_objs, add_dot_o($write_objs))
372 AC_SUBST(write_ldflags, $write_ldflags)
373 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
374 objlist_to_errlist($write_errlist_objs), errors used by para_write)
375
376 enum="$(for i in $write_writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
377 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
378 enum of supported writers)
379 names="$(for i in $write_writers; do printf \"$i\",' ' ; done)"
380 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
381 inits="$(for i in $write_writers; do printf 'extern void '$i'_writer_init(struct writer *); '; done)"
382 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
383 array="$(for i in $write_writers; do printf '{.init = '$i'_writer_init},'; done)"
384 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
385
386 gui_cmdline_objs="gui.cmdline"
387 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
388 gui_other_objs="gui gui_common gui_theme"
389 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
390 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
391 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
392 AC_SUBST(gui_objs, add_dot_o($gui_objs))
393
394 AC_OUTPUT
395 AC_MSG_NOTICE([creating Makefile.deps])
396 gcc -MM -MG $mysql_cppflags $faad_cppflags *.c > Makefile.deps
397 AC_MSG_NOTICE([
398 paraslash configuration:
399 ~~~~~~~~~~~~~~~~~~~~~~~~
400 mysql support: $have_mysql
401 ogg vorbis support: $have_ogg
402 mp3dec support (libmad): $have_mad
403 aac support (libfaad): $have_faad
404 ortp support: $have_ortp
405 unix socket credentials: $have_ucred
406 supported writers for para_write: $write_writers
407 ])