]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
build: Convert libao detection to new macros.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 24 Aug 2014 22:00:51 +0000 (00:00 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 Mar 2015 16:45:41 +0000 (16:45 +0000)
Splits the old check into two checks for pthread and libao.

Makefile.in
Makefile.real
configure.ac

index 39d5b23bcb400d6b119a5e3e89977ca658fdb178..d8c6ed83d4e835f5b38f77a5f679cda51faaf3f2 100644 (file)
@@ -44,6 +44,7 @@ ogg_cppflags := @ogg_cppflags@
 mad_cppflags := @mad_cppflags@
 faad_cppflags := @faad_cppflags@
 curses_cppflags := @curses_cppflags@
 mad_cppflags := @mad_cppflags@
 faad_cppflags := @faad_cppflags@
 curses_cppflags := @curses_cppflags@
+pthread_cppflags := @pthread_cppflags@
 ao_cppflags := @ao_cppflags@
 flac_cppflags := @flac_cppflags@
 samplerate_cppflags := @samplerate_cppflags@
 ao_cppflags := @ao_cppflags@
 flac_cppflags := @flac_cppflags@
 samplerate_cppflags := @samplerate_cppflags@
@@ -61,6 +62,7 @@ mad_ldflags := @mad_ldflags@
 flac_ldflags := @flac_ldflags@
 oss_ldflags := @oss_ldflags@
 alsa_ldflags := @alsa_ldflags@
 flac_ldflags := @flac_ldflags@
 oss_ldflags := @oss_ldflags@
 alsa_ldflags := @alsa_ldflags@
+pthread_ldflags := @pthread_ldflags@
 ao_ldflags := @ao_ldflags@
 readline_ldflags := @readline_ldflags@
 samplerate_ldflags := @samplerate_ldflags@
 ao_ldflags := @ao_ldflags@
 readline_ldflags := @readline_ldflags@
 samplerate_ldflags := @samplerate_ldflags@
index 94a0865ee5e6c90bc15022a6937918962de1f23b..55d9e18c4c2a4f216767393510c84b447efff6b4 100644 (file)
@@ -196,7 +196,6 @@ $(object_dir)/flac%.o $(dep_dir)/flac%.d: CPPFLAGS += $(flac_cppflags)
 $(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)/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)/alsa%.o $(dep_dir)/alsa%.d: CPPFLAGS += $(alsa_cppflags)
 
 $(object_dir)/interactive.o $(dep_dir)/interactive.d \
@@ -205,6 +204,9 @@ $(object_dir)/interactive.o $(dep_dir)/interactive.d \
 $(object_dir)/resample_filter.o $(dep_dir)/resample_filter.d \
 : CPPFLAGS += $(samplerate_cppflags)
 
 $(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)
 
 $(object_dir)/mp3dec_filter.o $(dep_dir)/mp3dec_filter.d \
 : CPPFLAGS += $(mad_cppflags)
 
@@ -265,7 +267,8 @@ $(dep_dir)/%.d: %.c error2.h | $(dep_dir)
                -e "s@ \([a-zA-Z0-9_]\{1,\}\.completion.h\)@ $(cmdlist_dir)/\1@g" > $@
 
 para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags)
                -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)
 para_client para_audioc para_play : LDFLAGS += $(readline_ldflags)
 para_server: LDFLAGS += $(osl_ldflags)
 para_gui: LDFLAGS += $(curses_ldflags)
index 80fff1e016f690fe55814ee2d5c21e3b60383269..ac4192f2ecb276435cdb0e54bed659f4596a634c 100644 (file)
@@ -385,58 +385,23 @@ AC_CHECK_HEADER(alsa/asoundlib.h, [], HAVE_ALSA=no)
 AC_CHECK_LIB([asound], [snd_pcm_open], [], HAVE_ALSA=no)
 LIB_SUBST_FLAGS(alsa)
 UNSTASH_FLAGS
 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
 ########################################################################### 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"
 ############################################################# readline
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LDFLAGS="$LDFLAGS"
@@ -734,10 +699,10 @@ if test -n "$CRYPTOLIB"; then
                audiod_errlist_objs="$audiod_errlist_objs alsa_write"
                audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
        fi
                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"
                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"
        if test "$have_samplerate" = "yes"; then
                audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
                audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
@@ -1081,10 +1046,10 @@ if test $HAVE_ALSA = yes; then
        play_errlist_objs="$play_errlist_objs alsa_write"
        play_cmdline_objs="$play_cmdline_objs alsa_write"
 fi
        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"
        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
 if test "$have_readline" = "yes"; then
        play_errlist_objs="$play_errlist_objs interactive"
 fi
@@ -1125,12 +1090,12 @@ if test "$have_core_audio" = "yes"; then
        writers="$writers osx"
        default_writer="OSX_WRITE"
 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"
        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"
 if test "$have_oss" = "yes"; then
        write_errlist_objs="$write_errlist_objs oss_write"
        write_cmdline_objs="$write_cmdline_objs oss_write"