update to libortp-0.9.1
[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([readline], [readline], [],
55 [AC_MSG_ERROR([libreadline not found])])
56 AC_CHECK_LIB([menu], [new_menu], [extras="$extras para_dbadm"],
57 [AC_MSG_WARN([libmenu not found, cannot build para_dbadm])])
58
59
60 recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
61 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv dccp"
62 recv_ldflags=""
63
64 filter_cmdline_objs="filter.cmdline compress_filter.cmdline"
65 filter_errlist_objs="filter_chain wav compress filter string"
66 filter_ldflags=""
67
68 audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
69 http_recv.cmdline dccp_recv.cmdline"
70 audiod_errlist_objs="audiod exec close_on_fork signal string daemon stat net
71 time grab_client filter_chain wav compress http_recv dccp dccp_recv recv_common ringbuffer"
72 audiod_ldflags=""
73
74 server_cmdline_objs="server.cmdline"
75 server_errlist_objs="server mp3 afs command net string signal random_selector
76 time daemon stat crypt http_send db close_on_fork playlist_selector ipc dccp dccp_send"
77 server_ldflags=""
78
79 ########################################################################### ssl
80 dnl @synopsis CHECK_SSL
81 dnl
82 dnl based on the follwing macro from the autoconf archive
83 dnl
84 dnl @category InstalledPackages
85 dnl @author Mark Ethan Trostler <trostler@juniper.net>
86 dnl @version 2003-01-28
87 dnl @license AllPermissive
88
89 AC_DEFUN([CHECK_SSL],
90 [
91 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
92 AC_MSG_CHECKING(for openssl in $ssldir)
93 if test -f "$ssldir/include/openssl/ssl.h"; then
94 found_ssl="yes"
95 AC_MSG_RESULT(yes)
96 SSL_CFLAGS="-I$ssldir/include/openssl"
97 SSL_CPPFLAGS="-I$ssldir/include/openssl"
98 break
99 fi
100 if test -f "$ssldir/include/ssl.h"; then
101 found_ssl="yes";
102 AC_MSG_RESULT(yes)
103 SSL_CFLAGS="-I$ssldir/include/";
104 SSL_CPPFLAGS="-I$ssldir/include/";
105 break
106 fi
107 AC_MSG_RESULT(no)
108 done
109 if test x_$found_ssl != x_yes; then
110 AC_MSG_ERROR(Cannot find ssl libraries)
111 else
112 SSL_LIBS="-lssl -lcrypto";
113 SSL_LDFLAGS="-L$ssldir/lib";
114 fi
115 AC_SUBST(SSL_CPPFLAGS)
116 AC_SUBST(SSL_CFLAGS)
117 AC_SUBST(SSL_LIBS)
118 AC_SUBST(SSL_LDFLAGS)
119 ])dnl
120
121 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
122 [Search for openssl also in path.])])
123 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
124 CHECK_SSL($enable_ssldir)
125 server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS"
126
127 ########################################################################### gtk2
128
129 pkg_modules="gtk+-2.0 >= 2.0.0"
130 PKG_CHECK_MODULES(GTK, [$pkg_modules], [extras="$extras para_krell.so"], [
131 AC_MSG_WARN([gtk+-2 not found, can not build para_krell])
132 ])
133 AC_SUBST(GTK_CFLAGS)
134 AC_SUBST(GTK_LIBS)
135
136 ########################################################################### sdl
137 AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
138 AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui])
139 ])
140 AC_CHECK_HEADER(SDL/SDL.h, [],
141 [AC_MSG_WARN([SDL/SDL.h not found])])
142
143 ########################################################################### mysql
144 have_mysql="yes"
145 AC_CHECK_HEADER(mysql/mysql.h, [], [
146 have_mysql="no"
147 ])
148 AC_CHECK_LIB([mysqlclient], [mysql_init], [], [
149 have_mysql="no"
150 ])
151 if test "$have_mysql" = "yes"; then
152 server_ldflags="$server_ldflags -lmysqlclient"
153 server_errlist_objs="$server_errlist_objs mysql_selector"
154 AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support])
155 else
156 AC_MSG_WARN([cannot build mysql-based audio file selector])
157 fi
158 ########################################################################### ogg
159 have_ogg="yes"
160 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [
161 have_ogg="no"
162 ])
163 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [
164 have_ogg="no"
165 ])
166 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [
167 have_ogg="no"
168 ])
169 if test "$have_ogg" = "yes"; then
170 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
171 server_ldflags="$server_ldflags -logg -lvorbis -lvorbisfile"
172 filter_ldflags="$filter_ldflags -lvorbis -lvorbisfile"
173 audiod_ldflags="$audiod_ldflags -lvorbis -lvorbisfile"
174
175 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
176 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
177
178 server_errlist_objs="$server_errlist_objs ogg"
179 filter_errlist_objs="$filter_errlist_objs oggdec"
180 audiod_errlist_objs="$audiod_errlist_objs oggdec"
181 else
182 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
183 fi
184 ########################################################################### mad
185 have_mad="yes"
186 AC_CHECK_HEADERS([mad.h], [], [
187 have_mad="no"
188 ])
189 AC_CHECK_LIB([mad], [mad_stream_init], [], [
190 have_mad="no"
191 ])
192 if test "$have_mad" = "yes"; then
193 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
194 filter_errlist_objs="$filter_errlist_objs mp3dec"
195 audiod_errlist_objs="$audiod_errlist_objs mp3dec"
196 filter_ldflags="$filter_ldflags -lmad"
197 audiod_ldflags="$audiod_ldflags -lmad"
198 else
199 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
200 fi
201 ########################################################################### alsa
202 play="para_play"
203 msg="will not build para_play"
204 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
205 AC_MSG_WARN([no alsa/asoundlib, $msg])
206 play=""
207 ])
208 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
209 AC_MSG_WARN([no libasound, $msg])
210 play=""
211 ])
212 extras="$extras $play"
213
214
215 ########################################################################### ortp
216 have_ortp="yes"
217 AC_CHECK_HEADERS([ortp/ortp.h], [], [
218 have_ortp="no"
219 ])
220 AC_CHECK_LIB([ortp], [ortp_init], [], [
221 have_ortp="no"
222 ])
223 if test "$have_ortp" = "yes"; then
224 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
225 recv_errlist_objs="$recv_errlist_objs ortp_recv"
226
227 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
228 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
229
230 server_errlist_objs="$server_errlist_objs ortp_send"
231
232 recv_ldflags="$recv_ldflags -lortp"
233 server_ldflags="$server_ldflags -lortp"
234 audiod_ldflags="$audiod_ldflags -lortp"
235 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
236
237 else
238 AC_MSG_WARN([deactivating ortp support])
239 fi
240 AC_SUBST(GLIB_CFLAGS)
241 AC_SUBST(GLIB_LIBS)
242
243 ########################################################################### zmw
244 slide="para_slider"
245 msg="can not build para_slider"
246 CPPFLAGS="$GTK_CFLAGS"
247 LDFLAGS="$LDFLAGS $GTK_LIBS"
248 AC_CHECK_HEADERS([zmw/zmw.h], [], [
249 AC_MSG_WARN([zero memory widget header files not found, $msg])
250 slide=""
251 ])
252 AC_CHECK_LIB([zmw], [zmw_init], [], [
253 AC_MSG_WARN([zero memory widget library not found, $msg])
254 slide=""
255 ])
256 extras="$extras $slide"
257
258
259
260
261
262 AC_SUBST(extra_binaries, [$extras])
263 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
264 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
265 AC_SUBST(install_sh, [$INSTALL])
266 AC_CONFIG_FILES([Makefile])
267
268
269
270 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
271 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) }])
272
273 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
274 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
275 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
276 server_objs="$server_cmdline_objs $server_errlist_objs"
277
278 AC_SUBST(recv_objs, add_dot_o($recv_objs))
279 AC_SUBST(recv_ldflags, $recv_ldflags)
280 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
281 errors used by para_recv)
282
283 AC_SUBST(filter_objs, add_dot_o($filter_objs))
284 AC_SUBST(filter_ldflags, $filter_ldflags)
285 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
286 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
287
288 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
289 AC_SUBST(audiod_ldflags, $audiod_ldflags)
290 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
291 errors used by para_audiod)
292
293 AC_SUBST(server_objs, add_dot_o($server_objs))
294 AC_SUBST(server_ldflags, $server_ldflags)
295 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
296 objlist_to_errlist($server_errlist_objs), errors used by para_server)
297 AC_OUTPUT
298 AC_MSG_NOTICE([creating Makefile.deps])
299 gcc -MM -MG *.c > Makefile.deps
300 AC_MSG_NOTICE([
301 paraslash configuration:
302 ~~~~~~~~~~~~~~~~~~~~~~~~
303 mysql support: $have_mysql
304 ogg vorbis support: $have_ogg
305 mp3dec support (libmad): $have_mad
306 ortp support: $have_ortp
307 ])