aft.c: Move definition of "buf" down a bit.
[paraslash.git] / configure.ac
index 4d984457868b6657bf1c2666da7be25c507c4bc7..64ef3f90d83b5701761a97c2a272c07c3ae4bbc4 100644 (file)
@@ -15,12 +15,18 @@ AC_MSG_CHECKING(os type)
 OSTYPE="`$UNAMEPATH -s`"
 AC_MSG_RESULT("$OSTYPE")
 
+if test "$OSTYPE" = "SunOS"; then
+       # needed on SunOS for socket magic
+       arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
+       AC_SUBST(arch_cppflags)
+fi
+
 AC_C_BIGENDIAN()
 
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_INSTALL
-
+AC_REPLACE_FNMATCH
 
 AC_HEADER_DIRENT
 AC_HEADER_STDC
@@ -30,8 +36,6 @@ AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
        sys/ipc.h unistd.h utime.h stddef.h],
        [], [AC_MSG_ERROR([$ac_header not found])])
 
-AC_CHECK_HEADER(linux/soundcard.h, [extras="$extras para_fade"], 
-       [AC_MSG_WARN([linux/soundcard.h not found, cannot build para_fade])])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -42,12 +46,15 @@ AC_TYPE_SIZE_T
 AC_HEADER_TIME
 AC_STRUCT_TM
 AC_TYPE_INT16_T
+AC_TYPE_INT32_T
+AC_TYPE_INT64_T
 AC_TYPE_MODE_T
 AC_TYPE_SSIZE_T
 AC_TYPE_UID_T
+AC_TYPE_UINT8_T
 AC_TYPE_UINT16_T
 AC_TYPE_UINT32_T
-AC_TYPE_UINT8_T
+AC_TYPE_UINT64_T
 
 # Checks for library functions.
 AC_FUNC_FORK
@@ -68,26 +75,24 @@ AC_FUNC_LSTAT
 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
        regcomp select strchr strdup strerror strstr strtol uname \
        fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
-       strncasecmp strrchr strspn alarm], [],
+       strncasecmp strrchr strspn alarm mkdir rmdir], [],
        [AC_MSG_ERROR([function not found, cannot live without it])])
 
-all_errlist_objs="server mp3_afh afh_common vss command net string signal random_selector time
-daemon stat crypt http_send afs_common close_on_fork playlist_selector ipc dccp
+all_errlist_objs="server mp3_afh afh_common vss command net string signal time
+daemon stat crypt http_send close_on_fork ipc acl
 dccp_send fd user_list chunk_queue afs osl aft mood score attribute blob ringbuffer
 playlist sha1 rbtree sched audiod grab_client filter_chain wav compress
 http_recv dccp_recv recv_common write_common file_write audiod_command
-client_common recv stdout filter stdin audioc write client fsck exec"
-all_executables="server audiod recv filter audioc write client fsck"
-
+client_common recv stdout filter stdin audioc write client fsck exec send_common"
+all_executables="server recv filter audioc write client fsck"
 
 recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
-       dccp fd sched stdout"
+       fd sched stdout"
 recv_ldflags=""
 
 receivers=" http dccp"
 senders=" http dccp"
-selectors=" random playlist"
 
 filter_cmdline_objs="filter.cmdline compress_filter.cmdline"
 filter_errlist_objs="filter_chain wav compress filter string stdin stdout sched fd"
@@ -102,18 +107,17 @@ audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
        http_recv.cmdline dccp_recv.cmdline file_write.cmdline client.cmdline
        audiod_command_list"
 audiod_errlist_objs="audiod signal string daemon stat net
-       time grab_client filter_chain wav compress http_recv dccp dccp_recv
+       time grab_client filter_chain wav compress http_recv dccp_recv
        recv_common fd sched write_common file_write audiod_command crypt
        client_common"
 audiod_ldflags=""
 audiod_audio_formats=""
 
-server_cmdline_objs="server.cmdline server_command_list random_selector_command_list
-       playlist_selector_command_list afs_command_list"
-server_errlist_objs="server afh_common mp3_afh vss command net string signal random_selector
-       time daemon stat crypt http_send afs_common close_on_fork playlist_selector
-       ipc dccp dccp_send fd user_list chunk_queue afs osl aft mood score attribute
-       blob playlist sha1 rbtree sched"
+server_cmdline_objs="server.cmdline server_command_list afs_command_list"
+server_errlist_objs="server afh_common mp3_afh vss command net string signal
+       time daemon stat crypt http_send close_on_fork
+       ipc dccp_send fd user_list chunk_queue afs osl aft mood score attribute
+       blob playlist sha1 rbtree sched acl send_common"
 server_ldflags=""
 server_audio_formats=" mp3"
 
@@ -132,7 +136,7 @@ fsck_errlist_objs="osl rbtree fsck string sha1 fd"
 
 gui_cmdline_objs="gui.cmdline"
 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
-gui_other_objs="gui gui_common gui_theme"
+gui_other_objs="gui gui_theme"
 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
 
 ########################################################################### ssl
@@ -187,7 +191,11 @@ AC_CHECK_LIB([c], [socket],
 server_ldflags="$server_ldflags $socket_lib"
 client_ldflags="$client_ldflags $socket_lib"
 audioc_ldflags="$audioc_ldflags $socket_lib"
+audiod_ldflags="$audiod_ldflags $socket_lib"
 recv_ldflags="$recv_ldflags $socket_lib"
+AC_SEARCH_LIBS([connect],[socket],[],[
+       AC_MSG_ERROR([Fatal: Did not find connect().])
+],[])
 ########################################################################### libnsl
 AC_CHECK_LIB([c], [gethostbyname],
        [nsl_lib=],
@@ -197,6 +205,9 @@ server_ldflags="$server_ldflags $nsl_lib"
 client_ldflags="$client_ldflags $nsl_lib"
 audioc_ldflags="$audioc_ldflags $nsl_lib"
 recv_ldflags="$recv_ldflags $nsl_lib"
+AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
+       AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
+],[])
 ########################################################################### ucred
 AC_MSG_CHECKING(for struct ucred)
 AC_TRY_LINK([
@@ -273,73 +284,6 @@ if test ${have_core_audio} = yes; then
        default_writer="OSX_WRITE"
        AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
 fi
-########################################################################### gtk2
-build_para_krell="yes"
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LD_FLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-pkg_modules="gtk+-2.0 >= 2.0.0"
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.4], [], [build_para_krell="no"])
-PKG_CHECK_MODULES(GTK, [$pkg_modules], [], [build_para_krell="no"])
-CPPFLAGS="$GTK_CFLAGS $GLIB_CFLAGS"
-LDFLAGS="$LDFLAGS $GTK_LIBS"
-AC_CHECK_HEADER(gkrellm2/gkrellm.h, [], [build_para_krell="no"])
-if test "$build_para_krell" = "yes"; then
-       AC_SUBST(GTK_CFLAGS)
-       AC_SUBST(GTK_LIBS)
-       extras="$extras para_krell.so"
-else
-       AC_MSG_WARN([can not build para_krell])
-fi
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
-########################################################################### sdl
-# FIXME
-AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
-       AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui])
-])
-AC_CHECK_HEADER(SDL/SDL.h, [], 
-       [AC_MSG_WARN([SDL/SDL.h not found])])
-
-########################################################################### mysql
-have_mysql="yes"
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LD_FLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-AC_ARG_WITH(mysql_headers, [AC_HELP_STRING(--with-mysql-headers=dir,
-       [look for mysql.h also in dir])])
-if test -n "$with_mysql_headers"; then
-       mysql_cppflags="-I$with_mysql_headers"
-       CPPFLAGS="$CPPFLAGS $mysql_cppflags"
-fi
-AC_ARG_WITH(mysql_libs, [AC_HELP_STRING(--with-mysql-libs=dir,
-       [look for libmysqlclient also in dir])])
-if test -n "$with_mysql_libs"; then
-       mysql_libs="-L$with_mysql_libs"
-       LDFLAGS="$LDFLAGS $mysql_libs"
-fi
-AC_CHECK_HEADER(mysql/mysql.h, [], [
-       have_mysql="no"
-])
-AC_CHECK_LIB([mysqlclient], [mysql_init], [], [
-       have_mysql="no"
-])
-if test "$have_mysql" = "yes"; then
-       selectors="$selectors mysql"
-       server_ldflags="$server_ldflags $mysql_libs -lmysqlclient"
-       server_errlist_objs="$server_errlist_objs mysql_selector"
-       all_errlist_objs="$all_errlist_objs mysql_selector"
-       server_cmdline_objs="$server_cmdline_objs mysql_selector_command_list"
-       AC_SUBST(mysql_cppflags)
-       AC_SUBST(mysql_libs)
-       AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support])
-else
-       AC_MSG_WARN([cannot build mysql-based audio file selector])
-fi
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
 ########################################################################### ogg
 have_ogg="yes"
 OLD_CPPFLAGS="$CPPFLAGS"
@@ -470,6 +414,7 @@ else
 fi
 if test -n "$audiod_audio_formats"; then
        extras="$extras para_audiod"
+       all_executables="$all_executables audiod"
 else
        AC_MSG_WARN([can not build para_audiod (no supported audio formats)])
 fi
@@ -481,15 +426,34 @@ have_alsa="yes"
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LD_FLAGS="$LDFLAGS"
 OLD_LIBS="$LIBS"
-msg="=> no alsa support for para_audiod/para_write"
-AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
-       AC_MSG_WARN([no alsa/asoundlib $msg])
+if test "$OSTYPE" != "Linux"; then
        have_alsa="no"
-])
-AC_CHECK_LIB([asound], [snd_pcm_open], [], [
-       AC_MSG_WARN([no libasound $msg])
-       have_alsa="no"
-])
+fi
+msg="=> can not build para_fade, and no alsa support for para_audiod/para_write"
+if test "$have_alsa" = "yes"; then
+       AC_CHECK_HEADER(linux/soundcard.h,
+               [extras="$extras para_fade"],
+               [
+                       have_alsa="no"
+                       AC_MSG_WARN([no linux/soundcard.h $msg])
+               ]
+       )
+fi
+
+if test "$have_alsa" = "yes"; then
+       AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
+               have_alsa="no"
+               AC_MSG_WARN([no alsa/asoundlib $msg])
+       ])
+fi
+
+if test "$have_alsa" = "yes"; then
+       AC_CHECK_LIB([asound], [snd_pcm_open], [], [
+               have_alsa="no"
+               AC_MSG_WARN([no libasound $msg])
+       ])
+fi
+
 if test "$have_alsa" = "yes"; then
        all_errlist_objs="$all_errlist_objs alsa_write"
        audiod_errlist_objs="$audiod_errlist_objs alsa_write"
@@ -550,28 +514,6 @@ fi
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
-########################################################################### zmw
-build_slider="yes"
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LD_FLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-PKG_CHECK_MODULES(GTK, [$pkg_modules], [], [build_para_slider="no"])
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.4], [], [build_slider="no"])
-CPPFLAGS="$GTK_CFLAGS $GLIB_CFLAGS"
-LDFLAGS="$LDFLAGS $GTK_LIBS"
-AC_CHECK_HEADERS([zmw/zmw.h], [], [build_slider="no"])
-AC_CHECK_LIB([zmw], [zmw_init], [], [build_slider="no"])
-if test "$build_slider" = "no"; then
-       AC_MSG_WARN([will not build para_slider])
-else
-       extras="$extras para_slider"
-fi
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
-
-
-
 
 
 AC_SUBST(extra_binaries, [$extras])
@@ -581,10 +523,11 @@ AC_SUBST(install_sh, [$INSTALL])
 AC_CONFIG_FILES([Makefile])
 
 
-
 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
 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) }])
 
+############################################################# error2.h
+
 AC_DEFUN([define_safe_error_enums],
 [
        exe=""
@@ -624,6 +567,7 @@ AC_DEFUN([define_safe_error_enums],
 ]
 )
 
+
 AC_MSG_NOTICE(creating error2.h)
 for obj in $all_errlist_objs; do
        SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
@@ -636,6 +580,38 @@ AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
        [list of all objects that use paraslash's error facility]
 )
 
+################################################################## status items
+
+status_items="basename status num_played mtime bitrate frequency file_size
+status_flags format score audio_file_info taginfo1 taginfo2 afs_mode
+attributes_txt decoder_flags audiod_status play_time attributes_bitmap
+offset seconds_total stream_start current_time audiod_uptime image_id
+lyrics_id duration directory lyrics_name image_name path hash channels
+last_played num_chunks chunk_time"
+
+# $1: prefix, $2: items
+AC_DEFUN([make_enum_items], [$(
+       for i in $2; do
+               printf "$1_$(echo $i | tr 'a-z' 'A-Z'), "
+       done
+)])
+
+# $1: prefix, $2: items
+AC_DEFUN([make_enum_array], [$(
+       for i in $2; do
+               printf "\"$i\", "
+       done
+)])
+
+AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM,
+       make_enum_items(SI,  $status_items),
+       [enum of all status items]
+)
+AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY,
+       make_enum_array(SI,  $status_items),
+       [char * array of all status items]
+)
+
 
 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
@@ -708,12 +684,11 @@ AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats sup
 
 AC_OUTPUT
 AC_MSG_NOTICE([creating Makefile.deps])
-gcc -MM -MG $mysql_cppflags $faad_cppflags $mad_cppflags $ortp_cppflags $oggvorbis_cppflags *.c > Makefile.deps
+gcc -MM -MG $faad_cppflags $mad_cppflags $ortp_cppflags $oggvorbis_cppflags *.c > Makefile.deps
 AC_MSG_NOTICE([
 paraslash configuration:
 ~~~~~~~~~~~~~~~~~~~~~~~~
 unix socket credentials: $have_ucred
-audio file selectors supported by para_server: $selectors
 audio formats supported by para_server: $server_audio_formats
 senders supported by para_server/para_send: $senders
 receivers supported by para_audiod/para_recv: $receivers