$(object_dir)/mp3_afh.o $(dep_dir)/mp3_afh.d: CPPFLAGS += $(id3tag_cppflags)
$(object_dir)/crypt.o $(dep_dir)/crypt.d: CPPFLAGS += $(openssl_cppflags)
$(object_dir)/gcrypt.o $(dep_dir)/gcrypt.d: CPPFLAGS += $(gcrypt_cppflags)
-$(object_dir)/ao_write.o $(dep_dir)/ao_write.d: CPPFLAGS += $(ao_cppflags)
$(object_dir)/alsa%.o $(dep_dir)/alsa%.d: CPPFLAGS += $(alsa_cppflags)
$(object_dir)/interactive.o $(dep_dir)/interactive.d \
$(object_dir)/resample_filter.o $(dep_dir)/resample_filter.d \
: CPPFLAGS += $(samplerate_cppflags)
+$(object_dir)/ao_write.o $(dep_dir)/ao_write.d \
+: CPPFLAGS += $(ao_cppflags) $(pthread_cppflags)
+
$(object_dir)/mp3dec_filter.o $(dep_dir)/mp3dec_filter.d \
: CPPFLAGS += $(mad_cppflags)
-e "s@ \([a-zA-Z0-9_]\{1,\}\.completion.h\)@ $(cmdlist_dir)/\1@g" > $@
para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags)
-para_write para_play para_audiod: LDFLAGS += $(ao_ldflags) $(core_audio_ldflags)
+para_write para_play para_audiod \
+: LDFLAGS += $(ao_ldflags) $(pthread_ldflags) $(core_audio_ldflags)
para_client para_audioc para_play : LDFLAGS += $(readline_ldflags)
para_server: LDFLAGS += $(osl_ldflags)
para_gui: LDFLAGS += $(curses_ldflags)
AC_CHECK_LIB([asound], [snd_pcm_open], [], HAVE_ALSA=no)
LIB_SUBST_FLAGS(alsa)
UNSTASH_FLAGS
+######################################################################### pthread
+STASH_FLAGS
+LIB_ARG_WITH([pthread], [-lpthread])
+HAVE_PTHREAD=yes
+AC_CHECK_HEADER(pthread.h, [], HAVE_PTHREAD=no)
+AC_CHECK_LIB([pthread], [pthread_create], [], HAVE_PTHREAD=no)
+LIB_SUBST_FLAGS(pthread)
+UNSTASH_FLAGS
########################################################################### libao
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LDFLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-
-have_ao="yes"
-AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
- [look for ao/ao.h also in dir])])
-if test -n "$with_ao_headers"; then
- ao_cppflags="-I$with_ao_headers"
- CPPFLAGS="$CPPFLAGS $ao_cppflags"
-fi
-AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
- [look for libao also in dir])])
-if test -n "$with_ao_libs"; then
- ao_libs="-L$with_ao_libs"
- LDFLAGS="$LDFLAGS $ao_libs"
-fi
-msg="no libao support for para_audiod/para_write"
-AC_CHECK_HEADERS([ao/ao.h], [
- ], [
- have_ao="no"
- AC_MSG_WARN([ao.h not found, $msg])
-])
-if test "$have_ao" = "yes"; then
- AC_CHECK_LIB([ao], [ao_initialize], [], [
- have_ao="no"
- AC_MSG_WARN([ao lib not found or not working, $msg])
- ])
-fi
-if test "$have_ao" = "yes"; then
- AC_CHECK_HEADERS([pthread.h], [
- ], [
- have_ao="no"
- AC_MSG_WARN([pthread.h not found, $msg])
- ])
-fi
-if test "$have_ao" = "yes"; then
- AC_CHECK_LIB([pthread], [pthread_create], [], [
- have_ao="no"
- AC_MSG_WARN([pthread lib not found or not working, $msg])
- ])
-fi
-if test "$have_ao" = "yes"; then
- AC_SUBST(ao_cppflags)
- ao_ldflags="$ao_libs -lao -lpthread"
- AC_SUBST(ao_ldflags)
-fi
-
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
+STASH_FLAGS
+LIB_ARG_WITH([ao], [-lao])
+HAVE_AO=yes
+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; }])
############################################################# readline
OLD_CPPFLAGS="$CPPFLAGS"
OLD_LDFLAGS="$LDFLAGS"
audiod_errlist_objs="$audiod_errlist_objs alsa_write"
audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
fi
- if test "$have_ao" = "yes"; then
+ NEED_AO_OBJECTS && {
audiod_errlist_objs="$audiod_errlist_objs ao_write"
audiod_cmdline_objs="$audiod_cmdline_objs ao_write"
- fi
+ }
if test "$have_samplerate" = "yes"; then
audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
play_errlist_objs="$play_errlist_objs alsa_write"
play_cmdline_objs="$play_cmdline_objs alsa_write"
fi
-if test "$have_ao" = "yes"; then
+NEED_AO_OBJECTS && {
play_errlist_objs="$play_errlist_objs ao_write"
play_cmdline_objs="$play_cmdline_objs ao_write"
-fi
+}
if test "$have_readline" = "yes"; then
play_errlist_objs="$play_errlist_objs interactive"
fi
writers="$writers osx"
default_writer="OSX_WRITE"
fi
-if test "$have_ao" = "yes"; then
+NEED_AO_OBJECTS && {
write_errlist_objs="$write_errlist_objs ao_write"
write_cmdline_objs="$write_cmdline_objs ao_write"
writers="$writers ao"
default_writer="AO_WRITE"
-fi
+}
if test "$have_oss" = "yes"; then
write_errlist_objs="$write_errlist_objs oss_write"
write_cmdline_objs="$write_cmdline_objs oss_write"