]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
build: Construct audiod and client object list in Makefile.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 24 Jun 2023 18:03:06 +0000 (20:03 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 17 Mar 2024 11:34:49 +0000 (12:34 +0100)
Both executables are built iff CRYPTOLIB is set, so they can be
handled in one conditional block of Makefile.real.

Makefile.in
Makefile.real
configure.ac

index 74af5d57aa784dd51b59f255c2234a76d6f5f8a1..4c49b3394aad5cc8dd38fdc9ae6046f003aebce9 100644 (file)
@@ -19,18 +19,24 @@ NEED_VORBIS_OBJECTS := @NEED_VORBIS_OBJECTS@
 NEED_SPEEX_OBJECTS := @NEED_SPEEX_OBJECTS@
 NEED_OPUS_OBJECTS := @NEED_OPUS_OBJECTS@
 NEED_FLAC_OBJECTS := @NEED_FLAC_OBJECTS@
+NEED_AO_OBJECTS := @NEED_AO_OBJECTS@
 
 HAVE_OSL := @HAVE_OSL@
 HAVE_FAAD := @HAVE_FAAD@
+HAVE_READLINE := @HAVE_READLINE@
 HAVE_FLAC := @HAVE_FLAC@
+HAVE_MAD := @HAVE_MAD@
+HAVE_SAMPLERATE := @HAVE_SAMPLERATE@
+HAVE_AO := @HAVE_AO@
+HAVE_PTHREAD := @HAVE_PTHREAD@
+HAVE_OSS := @HAVE_OSS@
+HAVE_ALSA := @HAVE_ALSA@
 
 executables := @executables@
 
 recv_objs := @recv_objs@
 filter_objs := @filter_objs@
-client_objs := @client_objs@
 gui_objs := @gui_objs@
-audiod_objs := @audiod_objs@
 audioc_objs := @audioc_objs@
 mixer_objs := @mixer_objs@
 write_objs := @write_objs@
index 0ba0feaca572f2937bae45624d72d4da577d6fa8..a261fa6f8aaff0d1580709f579cd29985b76b07e 100644 (file)
@@ -75,6 +75,60 @@ ifneq ($(CRYPTOLIB),)
                        upgrade_db version base64)
        endif
 endif
+ifneq ($(CRYPTOLIB),)
+       client_objs := $(addsuffix .o, \
+               client net string fd lsu sched stdin stdout time sideband client_common \
+               buffer_tree crypt_common base64 version $(CRYPTOLIB) \
+       )
+       ifeq ($(HAVE_READLINE),yes)
+               client_objs += interactive.o
+       endif
+       audiod_objs := $(addsuffix .o, \
+               audiod signal string daemon stat net crypt_common base64 sideband \
+               time grab_client filter_common wav_filter compress_filter amp_filter \
+               http_recv dccp_recv recv_common fd sched write_common file_write \
+               audiod_command fecdec_filter client_common udp_recv color fec \
+               prebuffer_filter version bitstream imdct wma_common wmadec_filter \
+               buffer_tree sync_filter lsu $(CRYPTOLIB) \
+       )
+       audiod_audio_formats := "wma"
+       ifeq ($(NEED_VORBIS_OBJECTS),yes)
+               audiod_objs += oggdec_filter.o
+               audiod_audio_formats += ,"ogg"
+       endif
+       ifeq ($(NEED_SPEEX_OBJECTS),yes)
+               audiod_objs += spxdec_filter.o spx_common.o
+               audiod_audio_formats += ,"spx"
+       endif
+       ifeq ($(NEED_OPUS_OBJECTS),yes)
+               audiod_objs += opusdec_filter.o opus_common.o
+               audiod_audio_formats += ,"opus"
+       endif
+       ifeq ($(NEED_FLAC_OBJECTS),yes)
+               audiod_objs += flacdec_filter.o
+               audiod_audio_formats += ,"flac"
+       endif
+       ifeq ($(HAVE_FAAD),yes)
+               audiod_objs += aacdec_filter.o
+               audiod_audio_formats += ,"aac"
+       endif
+       ifeq ($(HAVE_MAD),yes)
+               audiod_objs += mp3dec_filter.o
+               audiod_audio_formats += ,"mp3"
+       endif
+       ifeq ($(HAVE_OSS),yes)
+               audiod_objs += oss_write.o
+       endif
+       ifeq ($(HAVE_ALSA),yes)
+               audiod_objs += alsa_write.o
+       endif
+       ifeq ($(NEED_AO_OBJECTS),yes)
+               audiod_objs += ao_write.o
+       endif
+       ifeq ($(HAVE_SAMPLERATE),yes)
+               audiod_objs += resample_filter.o check_wav.o
+       endif
+endif
 
 # sort removes duplicate words, which is all we need here
 all_objs := $(sort $(recv_objs) $(filter_objs) $(client_objs) $(gui_objs) \
@@ -238,6 +292,8 @@ $(object_dir)/%.o: %.c | $(object_dir)
 OD = $(addsuffix .d, $(addprefix $(dep_dir)/, $(1))) \
        $(addsuffix .o, $(addprefix $(object_dir)/, $(1)))
 
+$(call OD, audiod): \
+       CPPFLAGS += -DAUDIOD_AUDIO_FORMAT_ARRAY='$(audiod_audio_formats)'
 $(call OD, opus%): CPPFLAGS += $(opus_cppflags)
 $(call OD, gui gui%): CPPFLAGS += $(curses_cppflags)
 $(call OD, spx%): CPPFLAGS += $(speex_cppflags)
index b44f78e47c4a3bfacc6df1b72ebea10486f88e38..e574cf79766a1aba11a98ff5de8b5ef32077c198 100644 (file)
@@ -350,7 +350,9 @@ AC_CHECK_HEADER(ao/ao.h, [], HAVE_AO=no)
 AC_CHECK_LIB([ao], [ao_initialize], [], HAVE_AO=no)
 LIB_SUBST_FLAGS(ao)
 UNSTASH_FLAGS
-AC_DEFUN([NEED_AO_OBJECTS], [{ test $HAVE_AO = yes -a $HAVE_PTHREAD = yes; }])
+AS_IF([test $HAVE_AO = yes -a $HAVE_PTHREAD = yes],
+       [NEED_AO_OBJECTS]=yes, [NEED_AO_OBJECTS=no])
+AC_SUBST([NEED_AO_OBJECTS])
 ######################################################################## readline
 STASH_FLAGS
 AC_SEARCH_LIBS([tgetent], [tinfo curses terminfo termcap])
@@ -393,32 +395,6 @@ fi
 if test -n "$CRYPTOLIB"; then
        build_client="yes"
        executables="$executables client"
-       client_objs="
-               client
-               net
-               string
-               fd
-               lsu
-               sched
-               stdin
-               stdout
-               time
-               sideband
-               client_common
-               buffer_tree
-               crypt_common
-               base64
-               version
-       "
-       if test "$CRYPTOLIB" = openssl; then
-               client_objs="$client_objs openssl"
-       else
-               client_objs="$client_objs gcrypt"
-       fi
-       if test $HAVE_READLINE = yes; then
-               client_objs="$client_objs interactive"
-       fi
-       AC_SUBST(client_objs, add_dot_o($client_objs))
 else
        build_client="no"
 fi
@@ -426,91 +402,6 @@ fi
 if test -n "$CRYPTOLIB"; then
        build_audiod="yes"
        executables="$executables audiod"
-       audiod_audio_formats="wma"
-       audiod_objs="$audiod_objs
-               audiod
-               signal
-               string
-               daemon
-               stat
-               net
-               crypt_common
-               base64
-               sideband
-               time
-               grab_client
-               filter_common
-               wav_filter
-               compress_filter
-               amp_filter
-               http_recv
-               dccp_recv
-               recv_common
-               fd
-               sched
-               write_common
-               file_write
-               audiod_command
-               fecdec_filter
-               client_common
-               udp_recv
-               color
-               fec
-               prebuffer_filter
-               version
-               bitstream
-               imdct
-               wma_common
-               wmadec_filter
-               buffer_tree
-               sync_filter
-               lsu
-       "
-       if test "$CRYPTOLIB" = openssl; then
-               audiod_objs="$audiod_objs openssl"
-       else
-               audiod_objs="$audiod_objs gcrypt"
-       fi
-       AS_IF([test $NEED_VORBIS_OBJECTS = yes], [
-               audiod_objs="$audiod_objs oggdec_filter"
-               audiod_audio_formats="$audiod_audio_formats ogg"
-       ])
-       AS_IF([test $NEED_SPEEX_OBJECTS = yes], [
-               audiod_objs="$audiod_objs spxdec_filter spx_common"
-               audiod_audio_formats="$audiod_audio_formats spx"
-       ])
-       AS_IF([test $NEED_OPUS_OBJECTS = yes], [
-               audiod_objs="$audiod_objs opusdec_filter opus_common"
-               audiod_audio_formats="$audiod_audio_formats opus"
-       ])
-       AS_IF([test $NEED_FLAC_OBJECTS = yes], [
-               audiod_objs="$audiod_objs flacdec_filter"
-               audiod_audio_formats="$audiod_audio_formats flac"
-       ])
-       if test $HAVE_FAAD = yes; then
-               audiod_objs="$audiod_objs aacdec_filter"
-               audiod_audio_formats="$audiod_audio_formats aac"
-       fi
-       if test $HAVE_MAD = yes; then
-               audiod_audio_formats="$audiod_audio_formats mp3"
-               audiod_objs="$audiod_objs mp3dec_filter"
-       fi
-       if test $HAVE_OSS = yes; then
-               audiod_objs="$audiod_objs oss_write"
-       fi
-       if test $HAVE_ALSA = yes; then
-               audiod_objs="$audiod_objs alsa_write"
-       fi
-       NEED_AO_OBJECTS && {
-               audiod_objs="$audiod_objs ao_write"
-       }
-       if test $HAVE_SAMPLERATE = yes; then
-               audiod_objs="$audiod_objs resample_filter check_wav"
-       fi
-       AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
-
-       names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
-       AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
 else
        build_audiod="no"
 fi
@@ -720,9 +611,9 @@ fi
 if test $HAVE_ALSA = yes; then
        play_objs="$play_objs alsa_write"
 fi
-NEED_AO_OBJECTS && {
+if test $NEED_AO_OBJECTS = yes; then
        play_objs="$play_objs ao_write"
-}
+fi
 if test $HAVE_READLINE = yes; then
        play_objs="$play_objs interactive"
 fi
@@ -745,9 +636,9 @@ write_objs="
        version
 "
 
-NEED_AO_OBJECTS && {
+if test $NEED_AO_OBJECTS = yes; then
        write_objs="$write_objs ao_write"
-}
+fi
 if test $HAVE_OSS = yes; then
        write_objs="$write_objs oss_write"
 fi