+gui_cmdline_objs="add_cmdline(gui)"
+gui_errlist_objs="exec signal string stat ringbuffer fd gui gui_theme"
+gui_objs="$gui_cmdline_objs $gui_errlist_objs"
+play_errlist_objs="play fd sched ggo buffer_tree time string net
+ afh_recv afh_common
+ wma_afh wma_common mp3_afh
+ recv_common udp_recv http_recv dccp_recv
+ filter_common fec bitstream imdct
+ wav_filter compress_filter amp_filter prebuffer_filter fecdec_filter
+ wmadec_filter
+ write_common file_write
+"
+play_cmdline_objs="add_cmdline(http_recv dccp_recv udp_recv afh_recv compress_filter amp_filter prebuffer_filter file_write play)"
+play_ldflags="-lm"
+########################################################################### snprintf
+# ===========================================================================
+# http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_FUNC_SNPRINTF
+#
+# DESCRIPTION
+#
+# Checks for a fully C99 compliant snprintf, in particular checks whether
+# it does bounds checking and returns the correct string length; does the
+# same check for vsnprintf. If no working snprintf or vsnprintf is found,
+# it prints an error message and aborts.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved.
+
+AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
+AC_DEFUN([AX_FUNC_SNPRINTF],
+[AC_CHECK_FUNCS(snprintf vsnprintf)
+AC_MSG_CHECKING(for working snprintf)
+AC_CACHE_VAL(ac_cv_have_working_snprintf,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <stdio.h>
+
+int main(void)
+{
+ char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
+ char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
+ int i;
+ i = snprintf (bufs, 2, "%s", "111");
+ if (strcmp (bufs, "1")) exit (1);
+ if (i != 3) exit (1);
+ i = snprintf (bufd, 2, "%d", 111);
+ if (strcmp (bufd, "1")) exit (1);
+ if (i != 3) exit (1);
+ exit(0);
+}]])],[ac_cv_have_working_snprintf=yes],
+[ac_cv_have_working_snprintf=no],[ac_cv_have_working_snprintf=cross])])
+AC_MSG_RESULT([$ac_cv_have_working_snprintf])
+AC_MSG_CHECKING(for working vsnprintf)
+AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
+#include <stdarg.h>
+
+int my_vsnprintf (char *buf, const char *tmpl, ...)
+{
+ int i;
+ va_list args;
+ va_start (args, tmpl);
+ i = vsnprintf (buf, 2, tmpl, args);
+ va_end (args);
+ return i;
+}
+
+int main(void)
+{
+ char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
+ char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
+ int i;
+ i = my_vsnprintf (bufs, "%s", "111");
+ if (strcmp (bufs, "1")) exit (1);
+ if (i != 3) exit (1);
+ i = my_vsnprintf (bufd, "%d", 111);
+ if (strcmp (bufd, "1")) exit (1);
+ if (i != 3) exit (1);
+ exit(0);
+}]])],[ac_cv_have_working_vsnprintf=yes],
+[ac_cv_have_working_vsnprintf=no],[ac_cv_have_working_vsnprintf=cross])])
+AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
+if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
+AC_MSG_ERROR([fatal: buggy snprintf() detected])
+fi])
+AX_FUNC_SNPRINTF()
+########################################################################### osl
+have_osl=yes
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
+AC_ARG_WITH(osl_headers, [AS_HELP_STRING(--with-osl-headers=dir,
+ [look for osl.h also in dir])])
+if test -n "$with_osl_headers"; then
+ osl_cppflags="-I$with_osl_headers"
+ CPPFLAGS="$CPPFLAGS $osl_cppflags"
+fi
+AC_ARG_WITH(osl_libs, [AS_HELP_STRING(--with-osl-libs=dir,
+ [look for libosl also in dir])])
+if test -n "$with_osl_libs"; then
+ osl_libs="-L$with_osl_libs"
+ LDFLAGS="$LDFLAGS $osl_libs"
+fi
+
+AC_CHECK_HEADER(osl.h, [], have_osl=no)
+AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
+if test "$have_osl" = "no"; then
+ AC_MSG_WARN([libosl not found, can not build para_server.
+Download libosl at
+ http://systemlinux.org/~maan/osl
+or execute
+ git clone git://git.tuebingen.mpg.de/osl
+ ])
+else
+ extras="$extras server"
+ executables="$executables server"
+ server_cmdline_objs="add_cmdline(server)"
+ server_errlist_objs="server afh_common mp3_afh vss command net
+ string signal time daemon http_send close_on_fork mm
+ crypt_common ipc dccp_send fd user_list chunk_queue
+ afs aft mood score attribute blob playlist sched acl
+ send_common udp_send color fec wma_afh wma_common sideband"
+ all_errlist_objs="$all_errlist_objs server vss command
+ http_send close_on_fork mm ipc dccp_send user_list
+ chunk_queue afs aft mood score attribute blob playlist
+ acl udp_send"
+
+ server_ldflags=""
+ server_audio_formats="mp3 wma"
+ AC_SUBST(osl_cppflags)
+ server_ldflags="$server_ldflags $osl_libs -losl"
+fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
+########################################################################### crypto
+AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
+ Force using crypto library "lib". This package requires either
+ openssl or libgcrypt being installed. Possible values for "lib"
+ are thus "openssl" and "gcrypt". If this option is not given,
+ openssl is tried first. If openssl was not found, gcrypt is
+ tried next.])])
+
+case "$enable_cryptolib" in
+ "openssl") check_openssl="yes"; check_gcrypt="no";;
+ "gcrypt") check_openssl="no"; check_gcrypt="yes";;
+ "") check_openssl="yes"; check_gcrypt="yes";;
+ *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
+esac
+###################################################################### openssl
+if test "$check_openssl" = "yes"; then
+ OLD_CPPFLAGS="$CPPFLAGS"
+ OLD_LD_FLAGS="$LDFLAGS"
+ OLD_LIBS="$LIBS"
+ have_openssl="yes"
+ AC_ARG_WITH(openssl_headers, [AS_HELP_STRING(--with-openssl-headers=dir,
+ [look for openssl headers also in dir])])
+ if test -n "$with_openssl_headers"; then
+ openssl_cppflags="-I$with_openssl_headers"
+ CPPFLAGS="$CPPFLAGS $openssl_cppflags"
+ fi
+ AC_ARG_WITH(openssl_libs, [AS_HELP_STRING(--with-openssl-libs=dir,
+ [look for openssl libraries also in dir])])
+ if test -n "$with_openssl_libs"; then
+ openssl_libs="-L$with_openssl_libs"
+ LDFLAGS="$LDFLAGS $openssl_libs"
+ fi
+ AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
+ AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
+ if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
+ # try harder: openssl is sometimes installed in /usr/local/ssl
+ openssl_cppflags="-I/usr/local/ssl/include"
+ CPPFLAGS="$CPPFLAGS $openssl_cppflags"
+ openssl_libs="-L/usr/local/ssl/lib"
+ LDFLAGS="$LDFLAGS $openssl_libs"
+ # clear cache
+ unset ac_cv_header_openssl_ssl_h 2> /dev/null
+ unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
+ AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
+ if test "$have_openssl" = "yes"; then
+ AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])