]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - configure.ac
build: Add object "cmdline" suffix only once.
[paraslash.git] / configure.ac
index a6fc62afdf65377aea78197ba4758fe86f86ed01..c90baf79a22b7841416781e991a7a11e09ad7f63 100644 (file)
@@ -8,6 +8,7 @@ AC_CONFIG_HEADER([config.h])
 
 AC_CONFIG_FILES([Makefile])
 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
+AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; 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) }])
 AC_PATH_PROG(UNAMEPATH, uname, no)
 if test "$UNAMEPATH" = "no"; then
@@ -33,11 +34,12 @@ AC_PATH_PROG([help2man], [help2man])
 test -z "$help2man" && AC_MSG_ERROR(
        [help2man is required to build this package])
 
+AC_PATH_PROG([install], [install])
+test -z "$install" && AC_MSG_ERROR(
+       [The install program is required to build this package])
+
 AC_PROG_CC
 AC_PROG_CPP
-AC_PROG_INSTALL
-AC_SUBST(install_sh, [$INSTALL])
-AC_REPLACE_FNMATCH
 
 AC_HEADER_DIRENT
 AC_HEADER_STDC
@@ -71,11 +73,9 @@ AC_TYPE_UINT64_T
 # Checks for library functions.
 AC_FUNC_FORK
 AC_PROG_GCC_TRADITIONAL
-AC_FUNC_MALLOC
 AC_FUNC_MEMCMP
 AC_FUNC_MKTIME
 AC_FUNC_MMAP
-AC_FUNC_REALLOC
 AC_FUNC_SELECT_ARGTYPES
 AC_FUNC_STAT
 AC_FUNC_STRFTIME
@@ -89,13 +89,16 @@ AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
        strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
        [AC_MSG_ERROR([function not found, cannot live without it])])
 
-AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
-
-
-executables="recv filter audioc write afh audiod play"
+executables="recv filter audioc write afh play"
 audio_format_handlers="mp3 wma"
 
-recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv afh_recv)"
+recv_cmdline_objs="
+       recv
+       http_recv
+       dccp_recv
+       udp_recv
+       afh_recv
+"
 
 recv_errlist_objs="
        http_recv recv_common recv time string net dccp_recv fd
@@ -105,14 +108,19 @@ recv_errlist_objs="
 
 recv_ldflags=""
 
-filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
+filter_cmdline_objs="
+       filter
+       compress_filter
+       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_ldflags="-lm"
 filters=" compress wav amp fecdec wmadec prebuffer"
 
-audioc_cmdline_objs="add_cmdline(audioc)"
+audioc_cmdline_objs="audioc"
 audioc_errlist_objs="
        audioc
        string
@@ -123,28 +131,19 @@ audioc_errlist_objs="
 "
 audioc_ldflags=""
 
-audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
-audiod_errlist_objs="audiod signal string daemon stat net crypt_common 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 ggo udp_recv color fec prebuffer_filter version
-       bitstream imdct wma_common wmadec_filter buffer_tree"
-audiod_ldflags="-lm"
-audiod_audio_formats="wma"
-
-afh_cmdline_objs="add_cmdline(afh)"
+afh_cmdline_objs="afh"
 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common
        version ggo"
 afh_ldflags=""
 
-write_cmdline_objs="add_cmdline(write file_write)"
+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"
 default_writer="FILE_WRITE"
 
-gui_cmdline_objs="add_cmdline(gui)"
+gui_cmdline_objs="gui"
 gui_errlist_objs="
        exec
        signal
@@ -158,7 +157,6 @@ gui_errlist_objs="
        version
        ggo
 "
-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
@@ -169,7 +167,17 @@ play_errlist_objs="play fd sched ggo buffer_tree time string net
        write_common file_write
        version
 "
-play_cmdline_objs="add_cmdline(http_recv dccp_recv udp_recv afh_recv compress_filter amp_filter prebuffer_filter file_write play)"
+play_cmdline_objs="
+       http_recv
+       dccp_recv
+       udp_recv
+       afh_recv
+       compress_filter
+       amp_filter
+       prebuffer_filter
+       file_write
+       play
+"
 play_ldflags="-lm"
 ################################################################## clock_gettime
 clock_gettime_lib=
@@ -325,10 +333,6 @@ if test "$check_gcrypt" = "yes"; then
 else
        have_gcrypt="no"
 fi
-###########################################################################
-if test "$have_openssl" = "no" -a "$have_gcrypt" = "no"; then
-       AC_MSG_ERROR([neither openssl nor gcrypt usable])
-fi
 ########################################################################### libsocket
 AC_CHECK_LIB([c], [socket],
        [socket_lib=],
@@ -703,9 +707,9 @@ AC_CHECK_LIB([mad], [mad_stream_init], [], [
 ])
 if test "$have_mad" = "yes"; then
        AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
-       filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
-       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
-       play_cmdline_objs="$play_cmdline_objs add_cmdline(mp3dec_filter)"
+       filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter"
+       audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
+       play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
        filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
        audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
        play_errlist_objs="$play_errlist_objs mp3dec_filter"
@@ -817,11 +821,11 @@ msg="=> will not build oss writer"
 AC_CHECK_HEADER(sys/soundcard.h, [
        audiod_errlist_objs="$audiod_errlist_objs oss_write"
        play_errlist_objs="$play_errlist_objs oss_write"
-       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
-       play_cmdline_objs="$play_cmdline_objs add_cmdline(oss_write)"
+       audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
+       play_cmdline_objs="$play_cmdline_objs oss_write"
 
        write_errlist_objs="$write_errlist_objs oss_write"
-       write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
+       write_cmdline_objs="$write_cmdline_objs oss_write"
        fade_errlist_objs="$fade_errlist_objs oss_mix"
 
        writers="$writers oss"
@@ -873,14 +877,14 @@ fi
 
 if test "$have_alsa" = "yes"; then
        audiod_errlist_objs="$audiod_errlist_objs alsa_write"
-       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
+       audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
        audiod_ldflags="$audiod_ldflags -lasound"
        play_errlist_objs="$play_errlist_objs alsa_write"
-       play_cmdline_objs="$play_cmdline_objs add_cmdline(alsa_write)"
+       play_cmdline_objs="$play_cmdline_objs alsa_write"
        play_ldflags="$play_ldflags -lasound"
 
        write_errlist_objs="$write_errlist_objs alsa_write"
-       write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
+       write_cmdline_objs="$write_cmdline_objs alsa_write"
        write_ldflags="$write_ldflags -lasound"
        fade_errlist_objs="$fade_errlist_objs alsa_mix"
        fade_ldflags="$fade_ldflags -lasound"
@@ -899,8 +903,8 @@ 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="add_cmdline(fade)"
-       fade_objs="$fade_cmdline_objs $fade_errlist_objs"
+       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,
@@ -977,15 +981,15 @@ if test "$have_ao" = "yes"; then
 fi
 if test "$have_ao" = "yes"; then
        audiod_errlist_objs="$audiod_errlist_objs ao_write"
-       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
+       audiod_cmdline_objs="$audiod_cmdline_objs ao_write"
        audiod_ldflags="$audiod_ldflags -lao -lpthread"
 
        play_errlist_objs="$play_errlist_objs ao_write"
-       play_cmdline_objs="$play_cmdline_objs add_cmdline(ao_write)"
+       play_cmdline_objs="$play_cmdline_objs ao_write"
        play_ldflags="$play_ldflags -lao -lpthread"
 
        write_errlist_objs="$write_errlist_objs ao_write"
-       write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
+       write_cmdline_objs="$write_cmdline_objs ao_write"
        write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
        writers="$writers ao"
        AC_SUBST(ao_cppflags)
@@ -1088,11 +1092,11 @@ AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
 
 if test "$have_samplerate" = "yes"; then
        filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
-       filter_cmdline_objs="$filter_cmdline_objs add_cmdline(resample_filter)"
+       filter_cmdline_objs="$filter_cmdline_objs resample_filter"
        audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
-       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(resample_filter)"
+       audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
        play_errlist_objs="$play_errlist_objs resample_filter check_wav"
-       play_cmdline_objs="$play_cmdline_objs add_cmdline(resample_filter)"
+       play_cmdline_objs="$play_cmdline_objs resample_filter"
        filter_ldflags="$filter_ldflags $samplerate_libs -lsamplerate"
        audiod_ldflags="$audiod_ldflags $samplerate_libs -lsamplerate"
        play_ldflags="$play_ldflags $samplerate_libs -lsamplerate"
@@ -1110,7 +1114,7 @@ if test \( "$have_openssl" = "yes" -o "$have_gcrypt" = "yes" \) \
 
        build_server="yes"
        executables="$executables server"
-       server_cmdline_objs="add_cmdline(server)"
+       server_cmdline_objs="server"
        server_errlist_objs="$server_errlist_objs
                server
                afh_common
@@ -1158,7 +1162,7 @@ fi
 if test "$have_openssl" = "yes" -o "$have_gcrypt" = "yes"; then
        build_client="yes"
        executables="$executables client"
-       client_cmdline_objs="add_cmdline(client)"
+       client_cmdline_objs="client"
        client_errlist_objs="$client_errlist_objs
                client
                net
@@ -1178,6 +1182,63 @@ if test "$have_openssl" = "yes" -o "$have_gcrypt" = "yes"; then
 else
        build_client="no"
 fi
+############################################################# audiod
+if test "$have_openssl" = "yes" -o "$have_gcrypt" = "yes"; then
+       build_audiod="yes"
+       executables="$executables audiod"
+       audiod_cmdline_objs="$audiod_cmdline_objs
+               audiod
+               compress_filter
+               http_recv
+               dccp_recv
+               file_write
+               client
+               amp_filter
+               udp_recv
+               prebuffer_filter
+       "
+       audiod_errlist_objs="$audiod_errlist_objs
+               audiod
+               signal
+               string
+               daemon
+               stat
+               net
+               crypt_common
+               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
+               ggo
+               udp_recv
+               color
+               fec
+               prebuffer_filter
+               version
+               bitstream
+               imdct
+               wma_common
+               wmadec_filter
+               buffer_tree
+       "
+       audiod_ldflags="$audiod_ldflags -lm"
+       audiod_audio_formats="$audiod_audio_formats wma"
+else
+       build_audiod="no"
+fi
 ############################################################# error2.h
 AC_MSG_NOTICE(creating error2.h)
 
@@ -1188,7 +1249,6 @@ all_errlist_objs="
        $audioc_errlist_objs
        $write_errlist_objs
        $afh_errlist_objs
-       $audiod_errlist_objs
        $play_errlist_objs
 "
 
@@ -1205,6 +1265,9 @@ fi
 if test "$build_client" = "yes"; then
        all_errlist_objs="$all_errlist_objs $client_errlist_objs"
 fi
+if test "$build_audiod" = "yes"; then
+       all_errlist_objs="$all_errlist_objs $audiod_errlist_objs"
+fi
 
 all_errlist_objs="$(echo $all_errlist_objs | tr ' ' '\n' | sort | uniq)"
 
@@ -1249,16 +1312,16 @@ AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
 
 AC_SUBST(executables)
 
-recv_objs="$recv_cmdline_objs $recv_errlist_objs"
-filter_objs="$filter_cmdline_objs $filter_errlist_objs"
-audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
-server_objs="$server_cmdline_objs $server_errlist_objs"
-write_objs="$write_cmdline_objs $write_errlist_objs"
-client_objs="$client_cmdline_objs $client_errlist_objs"
-audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
-afh_objs="$afh_cmdline_objs $afh_errlist_objs"
-play_objs="$play_cmdline_objs $play_errlist_objs"
-
+recv_objs="add_cmdline($recv_cmdline_objs) $recv_errlist_objs"
+filter_objs="add_cmdline($filter_cmdline_objs) $filter_errlist_objs"
+audiod_objs="add_cmdline($audiod_cmdline_objs) $audiod_errlist_objs"
+server_objs="add_cmdline($server_cmdline_objs) $server_errlist_objs"
+write_objs="add_cmdline($write_cmdline_objs) $write_errlist_objs"
+client_objs="add_cmdline($client_cmdline_objs) $client_errlist_objs"
+audioc_objs="add_cmdline($audioc_cmdline_objs) $audioc_errlist_objs"
+afh_objs="add_cmdline($afh_cmdline_objs) $afh_errlist_objs"
+play_objs="add_cmdline($play_cmdline_objs) $play_errlist_objs"
+gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
 
 AC_SUBST(recv_objs, add_dot_o($recv_objs))
 AC_SUBST(recv_ldflags, $recv_ldflags)
@@ -1351,4 +1414,5 @@ para_server: $build_server
 para_gui: $build_gui
 para_fade: $build_fade
 para_client: $build_client
+para_audiod: $build_audiod
 ])