configure.ac: Kill $gui_other_objs.
[paraslash.git] / configure.ac
index 79aaee63b3f159e20941f137b4b8d279823f7bf0..98b6ea2834d88db5c36aa8bbc96b25ee998e8150 100644 (file)
@@ -23,6 +23,14 @@ fi
 
 AC_C_BIGENDIAN()
 
+AC_PATH_PROG([gengetopt], [gengetopt])
+test -z "$gengetopt" && AC_MSG_ERROR(
+       [gengetopt is required to build this package])
+
+AC_PATH_PROG([help2man], [help2man])
+test -z "$help2man" && AC_MSG_ERROR(
+       [help2man is required to build this package])
+
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_INSTALL
@@ -92,7 +100,7 @@ http_recv dccp_recv recv_common write_common file_write audiod_command
 client_common recv stdout filter stdin audioc write client exec send_common ggo
 udp_recv udp_send color fec fecdec_filter prebuffer_filter mm
 server_command_list afs_command_list audiod_command_list bitstream imdct wma_afh
-wma_common wmadec_filter buffer_tree crypt_common
+wma_common wmadec_filter buffer_tree crypt_common gui gui_theme
 "
 
 executables="recv filter audioc write client afh audiod"
@@ -149,9 +157,8 @@ client_errlist_objs="client net string fd sched stdin stdout time
 client_ldflags=""
 
 gui_cmdline_objs="add_cmdline(gui)"
-gui_errlist_objs="exec signal string stat ringbuffer fd"
-gui_other_objs="gui gui_theme"
-gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
+gui_errlist_objs="exec signal string stat ringbuffer fd gui gui_theme"
+gui_objs="$gui_cmdline_objs $gui_errlist_objs"
 
 fade_cmdline_objs="add_cmdline(fade)"
 fade_errlist_objs="fade exec string fd"
@@ -721,6 +728,47 @@ if test ${have_libid3tag} = yes; then
 else
        AC_MSG_WARN([no support for id3v2 tags])
 fi
+########################################################################### flac
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
+
+have_flac="yes"
+AC_ARG_WITH(flac_headers, [AC_HELP_STRING(--with-flac-headers=dir,
+       [look for flac headers also in dir])])
+if test -n "$with_flac_headers"; then
+       flac_cppflags="-I$with_flac_headers"
+       CPPFLAGS="$CPPFLAGS $flac_cppflags"
+fi
+AC_ARG_WITH(flac_libs, [AC_HELP_STRING(--with-flac-libs=dir,
+       [look for flac libs also in dir])])
+if test -n "$with_flac_libs"; then
+       flac_libs="-L$with_flac_libs"
+       LDFLAGS="$LDFLAGS $flac_libs"
+fi
+AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
+AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no)
+if test "$have_flac" = "yes"; then
+       AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
+       all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
+       filter_errlist_objs="$filter_errlist_objs flacdec_filter"
+       audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
+       afh_errlist_objs="$afh_errlist_objs flac_afh"
+       server_errlist_objs="$server_errlist_objs flac_afh"
+       filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
+       audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
+       server_ldflags="$server_ldflags $flac_libs -lFLAC"
+       afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
+       filters="$filters flacdec"
+       server_audio_formats="$server_audio_formats flac"
+       audiod_audio_formats="$audiod_audio_formats flac"
+       AC_SUBST(flac_cppflags)
+else
+       AC_MSG_WARN([no flac support in para_audiod/para_filter])
+fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 ########################################################################### oss
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LD_FLAGS="$LDFLAGS"
@@ -856,7 +904,69 @@ fi
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
+############################################################# readline
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
+
+have_readline="yes"
+AC_ARG_WITH(readline_headers, [AC_HELP_STRING(--with-readline-headers=dir,
+       [look for libreadline header files also in dir])])
+if test -n "$with_readline_headers"; then
+       readline_cppflags="-I$with_readline_headers"
+       CPPFLAGS="$CPPFLAGS $readline_cppflags"
+fi
 
+AC_ARG_WITH(readline_libs, [AC_HELP_STRING(--with-readline-libs=dir,
+       [look for readline library also in dir])])
+if test -n "$with_readline_libs"; then
+       readline_libs="-L$with_readline_libs"
+       LDFLAGS="$LDFLAGS $readline_libs"
+fi
+msg="no interactive cli support"
+AC_CHECK_HEADERS([readline/readline.h], [
+       ], [
+       have_readline="no"
+       AC_MSG_WARN([readline/readline.h not found, $msg])
+])
+if test "$have_readline" = "yes"; then
+       readline_libs="$readline_libs -lreadline"
+       AC_SEARCH_LIBS([rl_replace_line], [readline], [], [have_readline="no"])
+       if test "$have_readline" = "no"; then # try with -lcurses
+                # clear cache
+               AC_MSG_NOTICE([trying again with -lcurses])
+                unset ac_cv_search_rl_replace_line 2> /dev/null
+               AC_SEARCH_LIBS([rl_replace_line], [readline], [
+                       have_readline=yes
+                       readline_libs="$readline_libs -lcurses"
+               ], [], [-lcurses])
+       fi
+       if test "$have_readline" = "no"; then # try with -ltermcap
+                # clear cache
+               AC_MSG_NOTICE([trying again with -ltermcap])
+                unset ac_cv_search_rl_replace_line 2> /dev/null
+               AC_SEARCH_LIBS([rl_replace_line], [readline], [
+                       have_readline=yes
+                       readline_libs="$readline_libs -ltermcap"
+               ], [], [-ltermcap])
+       fi
+fi
+
+if test "$have_readline" = "yes"; then
+       all_errlist_objs="$all_errlist_objs interactive"
+       client_errlist_objs="$client_errlist_objs interactive"
+       client_ldflags="$client_ldflags $readline_libs"
+       audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
+       audioc_ldflags="$audioc_ldflags $readline_libs"
+       AC_SUBST(readline_cppflags)
+       AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
+else
+       AC_MSG_WARN([libreadline not found or unusable])
+fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
+#############################################################
 
 
 AC_SUBST(install_sh, [$INSTALL])
@@ -999,6 +1109,7 @@ AC_MSG_NOTICE([
 paraslash configuration:
 ~~~~~~~~~~~~~~~~~~~~~~~~
 unix socket credentials: $have_ucred
+readline (interactive CLIs): $have_readline
 audio formats supported by para_server/para_afh: $server_audio_formats
 id3 version2 support: $have_libid3tag
 filters supported by para_audiod/para_filter: $filters