]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - configure.ac
build: ldflags/cppflags conversion: libopus.
[paraslash.git] / configure.ac
index c90baf79a22b7841416781e991a7a11e09ad7f63..82a0d8cb4e2cf3d7594cc5d4684f115fa748b065 100644 (file)
@@ -101,9 +101,25 @@ recv_cmdline_objs="
 "
 
 recv_errlist_objs="
-       http_recv recv_common recv time string net dccp_recv fd
-       sched stdout ggo udp_recv buffer_tree afh_recv afh_common
-       wma_afh wma_common mp3_afh version
+       http_recv
+       recv_common
+       recv
+       time
+       string
+       net
+       dccp_recv
+       fd
+       sched
+       stdout
+       ggo
+       udp_recv
+       buffer_tree
+       afh_recv
+       afh_common
+       wma_afh
+       wma_common
+       mp3_afh
+       version
 "
 
 recv_ldflags=""
@@ -114,11 +130,38 @@ filter_cmdline_objs="
        amp_filter
        prebuffer_filter
 "
-filter_errlist_objs="filter_common wav_filter compress_filter filter string
-       stdin stdout sched fd amp_filter ggo fecdec_filter fec version
-       prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
+filter_errlist_objs="
+       filter_common
+       wav_filter
+       compress_filter
+       filter
+       string
+       stdin
+       stdout
+       sched
+       fd
+       amp_filter
+       ggo
+       fecdec_filter
+       fec
+       version
+       prebuffer_filter
+       time
+       bitstream
+       imdct
+       wma_common
+       wmadec_filter
+       buffer_tree
+"
 filter_ldflags="-lm"
-filters=" compress wav amp fecdec wmadec prebuffer"
+filters="
+       compress
+       wav
+       amp
+       fecdec
+       wmadec
+       prebuffer
+"
 
 audioc_cmdline_objs="audioc"
 audioc_errlist_objs="
@@ -132,39 +175,72 @@ audioc_errlist_objs="
 audioc_ldflags=""
 
 afh_cmdline_objs="afh"
-afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common
-       version ggo"
+afh_errlist_objs="
+       afh
+       string
+       fd
+       mp3_afh
+       afh_common
+       time
+       wma_afh
+       wma_common
+       version
+       ggo
+"
 afh_ldflags=""
 
-write_cmdline_objs="write file_write"
-write_errlist_objs="write write_common file_write time fd string sched stdin
-       buffer_tree ggo check_wav version"
+write_cmdline_objs="
+       write
+       file_write
+"
+write_errlist_objs="
+       write
+       write_common
+       file_write
+       time
+       fd
+       string
+       sched
+       stdin
+       buffer_tree
+       ggo
+       check_wav
+       version
+"
 write_ldflags=""
-writers=" file"
+writers="file"
 default_writer="FILE_WRITE"
 
-gui_cmdline_objs="gui"
-gui_errlist_objs="
-       exec
-       signal
-       string
-       stat
-       ringbuffer
+play_errlist_objs="
+       play
        fd
-       gui
-       gui_theme
-       time
-       version
+       sched
        ggo
-"
-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
+       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
        version
 "
 play_cmdline_objs="
@@ -400,27 +476,20 @@ fi
 AC_CHECK_HEADER(curses.h, [], [
        have_curses="no"
 ])
-gui_ldflags="$curses_libs"
+curses_ldflags="$curses_libs"
 AC_CHECK_LIB([ncursesw], [initscr],
-       [gui_ldflags="$curses_libs -lncursesw"], [
+       [curses_ldflags="$curses_libs -lncursesw"], [
                AC_CHECK_LIB([curses], [initscr],
-                       [gui_ldflags="$curses_libs -lcurses"],
+                       [curses_ldflags="$curses_libs -lcurses"],
                        [have_curses="no"]
                )
        ]
 )
-if test "$have_curses" = "yes"; then
-       AC_SUBST(curses_cppflags)
-       build_gui="yes"
-       executables="$executables gui"
-else
-       build_gui="no"
-       AC_MSG_WARN([no curses lib, cannot build para_gui])
-fi
+AC_SUBST(curses_cppflags)
+AC_SUBST(curses_ldflags)
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
-
 ########################################################################### ip_mreqn
 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
@@ -549,16 +618,11 @@ if test "$have_vorbis" = "yes" || \
                test "$have_speex" = "yes" || \
                test "$have_opus" = "yes"; then
        AC_SUBST(ogg_cppflags)
-       ogg_libs="$ogg_libs -logg"
+       ogg_ldflags="$ogg_libs -logg"
        if test "$OSTYPE" = "Darwin"; then
-               ogg_libs="-Wl,-bind_at_load $ogg_libs"
+               ogg_ldflags="-Wl,-bind_at_load $ogg_ldflags"
        fi
-       server_ldflags="$server_ldflags $ogg_libs"
-       filter_ldflags="$filter_ldflags $ogg_libs"
-       audiod_ldflags="$audiod_ldflags $ogg_libs"
-       play_ldflags="$play_ldflags $ogg_libs"
-       afh_ldflags="$afh_ldflags $ogg_libs"
-       recv_ldflags="$recv_ldflags $ogg_libs"
+       AC_SUBST(ogg_ldflags)
        afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
        recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
        server_errlist_objs="$server_errlist_objs ogg_afh_common"
@@ -567,13 +631,8 @@ fi
 if test "$have_vorbis" = "yes"; then
        AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
        filters="$filters oggdec"
-       vorbis_libs="-lvorbis -lvorbisfile"
-       server_ldflags="$server_ldflags $vorbis_libs"
-       filter_ldflags="$filter_ldflags $vorbis_libs"
-       audiod_ldflags="$audiod_ldflags $vorbis_libs"
-       play_ldflags="$play_ldflags $vorbis_libs"
-       afh_ldflags="$afh_ldflags $vorbis_libs"
-       recv_ldflags="$recv_ldflags $vorbis_libs"
+       vorbis_ldflags="$vorbis_libs -lvorbis -lvorbisfile"
+       AC_SUBST(vorbis_ldflags)
 
        server_errlist_objs="$server_errlist_objs ogg_afh"
        filter_errlist_objs="$filter_errlist_objs oggdec_filter"
@@ -584,19 +643,14 @@ if test "$have_vorbis" = "yes"; then
 
        audiod_audio_formats="$audiod_audio_formats ogg"
        audio_format_handlers="$audio_format_handlers ogg"
-else
-       AC_MSG_WARN([no ogg/vorbis $msg])
 fi
 if test "$have_speex" = "yes"; then
        AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
+       AC_SUBST(speex_cppflags)
+       speex_ldflags="$speex_libs -lspeex"
+       AC_SUBST(speex_ldflags)
+
        filters="$filters spxdec"
-       speex_libs="-lspeex"
-       server_ldflags="$server_ldflags $speex_libs"
-       filter_ldflags="$filter_ldflags $speex_libs"
-       audiod_ldflags="$audiod_ldflags $speex_libs"
-       play_ldflags="$play_ldflags $speex_libs"
-       afh_ldflags="$afh_ldflags $speex_libs"
-       recv_ldflags="$recv_ldflags $speex_libs"
 
        server_errlist_objs="$server_errlist_objs spx_afh spx_common"
        filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
@@ -612,14 +666,11 @@ else
 fi
 if test "$have_opus" = "yes"; then
        AC_DEFINE(HAVE_OPUS, 1, define to 1 to turn on ogg/opus support)
+       AC_SUBST(opus_cppflags)
+       opus_ldflags="$opus_libs -lopus"
+       AC_SUBST(opus_ldflags)
+
        filters="$filters opusdec"
-       opus_libs="-lopus"
-       server_ldflags="$server_ldflags $opus_libs"
-       filter_ldflags="$filter_ldflags $opus_libs"
-       audiod_ldflags="$audiod_ldflags $opus_libs"
-       afh_ldflags="$afh_ldflags $opus_libs"
-       play_ldflags="$play_ldflags $opus_libs"
-       recv_ldflags="$recv_ldflags $opus_libs"
 
        server_errlist_objs="$server_errlist_objs opus_afh opus_common"
        filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
@@ -754,14 +805,8 @@ AC_MSG_RESULT($have_libid3tag)
 
 if test ${have_libid3tag} = yes; then
        AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
-       server_ldflags="$server_ldflags $id3tag_libs -lid3tag -lz"
-       afh_ldflags="$afh_ldflags $id3tag_libs -lid3tag -lz"
-       play_ldflags="$play_ldflags -lz"
-       recv_ldflags="$recv_ldflags $id3tag_libs -lid3tag"
-       play_ldflags="$play_ldflags $id3tag_libs -lid3tag"
        AC_SUBST(id3tag_cppflags)
-else
-       AC_MSG_WARN([no support for id3v2 tags])
+       AC_SUBST(id3tag_ldflags, "$id3tag_libs -lid3tag -lz")
 fi
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
@@ -898,44 +943,6 @@ fi
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
-########################################################################### fade
-if test -n "$mixers"; then
-       build_fade="yes"
-       executables="$executables fade"
-       fade_errlist_objs="$fade_errlist_objs fade exec string fd version ggo"
-       fade_cmdline_objs="fade"
-       fade_objs="add_cmdline($fade_cmdline_objs) $fade_errlist_objs"
-       AC_SUBST(fade_objs, add_dot_o($fade_objs))
-       AC_SUBST(fade_ldflags, $fade_ldflags)
-       AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
-               objlist_to_errlist($fade_errlist_objs),
-               errors used by para_fade)
-       enum="$(
-               for i in $mixers; do
-                       printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
-               done
-       )"
-       AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
-               enum of supported mixers)
-       AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
-               use this mixer if none was specified)
-       names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
-       AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
-       inits="$(
-               for i in $mixers; do
-                       printf 'extern void '$i'_mix_init(struct mixer *); '
-               done
-       )"
-       AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
-               init functions of the supported mixers)
-       array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
-       AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
-       mixer_summary="supported mixers:: $mixers, default: $default_mixer"
-else
-       build_fade="no"
-       AC_MSG_WARN([no mixer support])
-       mixer_summary="para_fade: no"
-fi
 ########################################################################### libao
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LDFLAGS="$LDFLAGS"
@@ -1239,9 +1246,68 @@ if test "$have_openssl" = "yes" -o "$have_gcrypt" = "yes"; then
 else
        build_audiod="no"
 fi
+########################################################################### fade
+if test -n "$mixers"; then
+       build_fade="yes"
+       executables="$executables fade"
+       fade_errlist_objs="$fade_errlist_objs fade exec string fd version ggo"
+       fade_cmdline_objs="fade"
+       fade_objs="add_cmdline($fade_cmdline_objs) $fade_errlist_objs"
+       AC_SUBST(fade_objs, add_dot_o($fade_objs))
+       AC_SUBST(fade_ldflags, $fade_ldflags)
+       AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
+               objlist_to_errlist($fade_errlist_objs),
+               errors used by para_fade)
+       enum="$(
+               for i in $mixers; do
+                       printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
+               done
+       )"
+       AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
+               enum of supported mixers)
+       AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
+               use this mixer if none was specified)
+       names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
+       AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
+       inits="$(
+               for i in $mixers; do
+                       printf 'extern void '$i'_mix_init(struct mixer *); '
+               done
+       )"
+       AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
+               init functions of the supported mixers)
+       array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
+       AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
+       mixer_summary="supported mixers:: $mixers, default: $default_mixer"
+else
+       build_fade="no"
+       AC_MSG_WARN([no mixer support])
+       mixer_summary="para_fade: no"
+fi
+########################################################################### gui
+if test "$have_curses" = "yes"; then
+       build_gui="yes"
+       executables="$executables gui"
+       gui_cmdline_objs="gui"
+       gui_errlist_objs="
+               exec
+               signal
+               string
+               stat
+               ringbuffer
+               fd
+               gui
+               gui_theme
+               time
+               version
+               ggo
+       "
+       gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
+else
+       build_gui="no"
+       AC_MSG_WARN([no curses lib, cannot build para_gui])
+fi
 ############################################################# error2.h
-AC_MSG_NOTICE(creating error2.h)
-
 # these are always built
 all_errlist_objs="
        $recv_errlist_objs
@@ -1271,10 +1337,14 @@ fi
 
 all_errlist_objs="$(echo $all_errlist_objs | tr ' ' '\n' | sort | uniq)"
 
+object_executable_matrix=
 for i in $executables; do
-       echo "$i: "
-       eval echo \$${i}_errlist_objs
-done | ./error2.pl > error2.h
+       eval objs=\$${i}_errlist_objs
+       object_executable_matrix="$object_executable_matrix $i: $objs"
+done
+# use echo to replace newlines by space
+AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
+
 for obj in $all_errlist_objs; do
        SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
 done
@@ -1282,7 +1352,6 @@ AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
        [enum {$SS NUM_SS}],
        [list of all objects that use the paraslash error facility]
 )
-
 ################################################################## status items
 
 status_items="basename status num_played mtime bitrate frequency file_size
@@ -1364,7 +1433,6 @@ AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
        objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
 
 AC_SUBST(gui_objs, add_dot_o($gui_objs))
-AC_SUBST(gui_ldflags, $gui_ldflags)
 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
        objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
 
@@ -1406,7 +1474,7 @@ unix socket credentials: $have_ucred
 readline (interactive CLIs): $have_readline
 audio formats handlers: $audio_format_handlers
 id3 version2 support: $have_libid3tag
-filters: $filters
+filters: $(echo $filters)
 writers: $writers
 
 $mixer_summary