Fix some typos in CREDITS
[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"
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 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 ########################################################################### 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 ########################################################################### ucred
128
129 AC_MSG_CHECKING(for struct ucred)
130 AC_TRY_LINK([
131 #include <sys/types.h>
132 #include <sys/socket.h>
133 ],[
134 struct ucred sucred; sucred.pid=0;
135 ],[have_ucred=yes],[have_ucred=no])
136 AC_MSG_RESULT($have_ucred)
137 if test ${have_ucred} = yes; then
138 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
139 fi
140
141 ########################################################################### gtk2
142
143 pkg_modules="gtk+-2.0 >= 2.0.0"
144 PKG_CHECK_MODULES(GTK, [$pkg_modules], [extras="$extras para_krell.so"], [
145 AC_MSG_WARN([gtk+-2 not found, can not build para_krell])
146 ])
147 AC_SUBST(GTK_CFLAGS)
148 AC_SUBST(GTK_LIBS)
149
150 ########################################################################### sdl
151 AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
152 AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui])
153 ])
154 AC_CHECK_HEADER(SDL/SDL.h, [],
155 [AC_MSG_WARN([SDL/SDL.h not found])])
156
157 ########################################################################### mysql
158 have_mysql="yes"
159 AC_CHECK_HEADER(mysql/mysql.h, [], [
160 have_mysql="no"
161 ])
162 AC_CHECK_LIB([mysqlclient], [mysql_init], [], [
163 have_mysql="no"
164 ])
165 if test "$have_mysql" = "yes"; then
166 server_ldflags="$server_ldflags -lmysqlclient"
167 server_errlist_objs="$server_errlist_objs mysql_selector"
168 AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support])
169 else
170 AC_MSG_WARN([cannot build mysql-based audio file selector])
171 fi
172 ########################################################################### ogg
173 have_ogg="yes"
174 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [
175 have_ogg="no"
176 ])
177 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [
178 have_ogg="no"
179 ])
180 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [
181 have_ogg="no"
182 ])
183 if test "$have_ogg" = "yes"; then
184 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
185 server_ldflags="$server_ldflags -logg -lvorbis -lvorbisfile"
186 filter_ldflags="$filter_ldflags -lvorbis -lvorbisfile"
187 audiod_ldflags="$audiod_ldflags -lvorbis -lvorbisfile"
188
189 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
190 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
191
192 server_errlist_objs="$server_errlist_objs ogg"
193 filter_errlist_objs="$filter_errlist_objs oggdec"
194 audiod_errlist_objs="$audiod_errlist_objs oggdec"
195 else
196 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
197 fi
198 ########################################################################### mad
199 have_mad="yes"
200 AC_CHECK_HEADERS([mad.h], [], [
201 have_mad="no"
202 ])
203 AC_CHECK_LIB([mad], [mad_stream_init], [], [
204 have_mad="no"
205 ])
206 if test "$have_mad" = "yes"; then
207 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
208 filter_errlist_objs="$filter_errlist_objs mp3dec"
209 audiod_errlist_objs="$audiod_errlist_objs mp3dec"
210 filter_ldflags="$filter_ldflags -lmad"
211 audiod_ldflags="$audiod_ldflags -lmad"
212 else
213 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
214 fi
215 ########################################################################### alsa
216 play="para_play"
217 msg="will not build para_play"
218 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
219 AC_MSG_WARN([no alsa/asoundlib, $msg])
220 play=""
221 ])
222 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
223 AC_MSG_WARN([no libasound, $msg])
224 play=""
225 ])
226 extras="$extras $play"
227
228
229 ########################################################################### ortp
230 have_ortp="yes"
231 AC_CHECK_HEADERS([ortp/ortp.h], [], [
232 have_ortp="no"
233 ])
234 AC_CHECK_LIB([ortp], [ortp_init], [], [
235 have_ortp="no"
236 ])
237 if test "$have_ortp" = "yes"; then
238 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
239 recv_errlist_objs="$recv_errlist_objs ortp_recv"
240
241 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
242 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
243
244 server_errlist_objs="$server_errlist_objs ortp_send"
245
246 recv_ldflags="$recv_ldflags -lortp"
247 server_ldflags="$server_ldflags -lortp"
248 audiod_ldflags="$audiod_ldflags -lortp"
249 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
250
251 else
252 AC_MSG_WARN([deactivating ortp support])
253 fi
254 AC_SUBST(GLIB_CFLAGS)
255 AC_SUBST(GLIB_LIBS)
256
257 ########################################################################### zmw
258 slide="para_slider"
259 msg="can not build para_slider"
260 CPPFLAGS="$GTK_CFLAGS"
261 LDFLAGS="$LDFLAGS $GTK_LIBS"
262 AC_CHECK_HEADERS([zmw/zmw.h], [], [
263 AC_MSG_WARN([zero memory widget header files not found, $msg])
264 slide=""
265 ])
266 AC_CHECK_LIB([zmw], [zmw_init], [], [
267 AC_MSG_WARN([zero memory widget library not found, $msg])
268 slide=""
269 ])
270 extras="$extras $slide"
271
272
273
274
275
276 AC_SUBST(extra_binaries, [$extras])
277 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
278 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
279 AC_SUBST(install_sh, [$INSTALL])
280 AC_CONFIG_FILES([Makefile])
281
282
283
284 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
285 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) }])
286
287 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
288 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
289 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
290 server_objs="$server_cmdline_objs $server_errlist_objs"
291
292 AC_SUBST(recv_objs, add_dot_o($recv_objs))
293 AC_SUBST(recv_ldflags, $recv_ldflags)
294 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
295 errors used by para_recv)
296
297 AC_SUBST(filter_objs, add_dot_o($filter_objs))
298 AC_SUBST(filter_ldflags, $filter_ldflags)
299 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
300 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
301
302 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
303 AC_SUBST(audiod_ldflags, $audiod_ldflags)
304 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
305 errors used by para_audiod)
306
307 AC_SUBST(server_objs, add_dot_o($server_objs))
308 AC_SUBST(server_ldflags, $server_ldflags)
309 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
310 objlist_to_errlist($server_errlist_objs), errors used by para_server)
311
312 gui_cmdline_objs="gui.cmdline"
313 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
314 gui_other_objs="gui gui_common gui_theme"
315 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
316 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
317 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
318 AC_SUBST(gui_objs, add_dot_o($gui_objs))
319
320 AC_OUTPUT
321 AC_MSG_NOTICE([creating Makefile.deps])
322 gcc -MM -MG *.c > Makefile.deps
323 AC_MSG_NOTICE([
324 paraslash configuration:
325 ~~~~~~~~~~~~~~~~~~~~~~~~
326 mysql support: $have_mysql
327 ogg vorbis support: $have_ogg
328 mp3dec support (libmad): $have_mad
329 ortp support: $have_ortp
330 unix socket credentials: $have_ucred
331 ])