build: Convert alsa detection to new macros.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 24 Aug 2014 20:57:29 +0000 (22:57 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 Mar 2015 16:45:41 +0000 (16:45 +0000)
Adds alsa_cppflags.

Makefile.in
Makefile.real
configure.ac

index a638f96..39d5b23 100644 (file)
@@ -48,6 +48,7 @@ ao_cppflags := @ao_cppflags@
 flac_cppflags := @flac_cppflags@
 samplerate_cppflags := @samplerate_cppflags@
 readline_cppflags := @readline_cppflags@
+alsa_cppflags := @alsa_cppflags@
 
 clock_gettime_ldflags := @clock_gettime_ldflags@
 id3tag_ldflags := @id3tag_ldflags@
index 269baba..94a0865 100644 (file)
@@ -197,6 +197,7 @@ $(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 \
 : CPPFLAGS += $(readline_cppflags)
index 5358c6e..80fff1e 100644 (file)
@@ -378,38 +378,13 @@ LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
 
 ########################################################################### alsa
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LDFLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-
-msg="=> no alsa support for para_audiod/para_write"
-if test "$OSTYPE" != "Linux"; then
-       have_alsa="no"
-else
-       have_alsa="yes"
-fi
-if test "$have_alsa" = "yes"; then
-       AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
-               have_alsa="no"
-               AC_MSG_WARN([no alsa/asoundlib $msg])
-       ])
-fi
-
-if test "$have_alsa" = "yes"; then
-       AC_CHECK_LIB([asound], [snd_pcm_open], [], [
-               have_alsa="no"
-               AC_MSG_WARN([no libasound $msg])
-       ])
-fi
-
-if test "$have_alsa" = "yes"; then
-       alsa_ldflags="-lasound"
-       AC_SUBST(alsa_ldflags)
-fi
-
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
+STASH_FLAGS
+LIB_ARG_WITH([alsa], [-lasound])
+HAVE_ALSA=yes
+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
 ########################################################################### libao
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LDFLAGS="$LDFLAGS"
@@ -755,7 +730,7 @@ if test -n "$CRYPTOLIB"; then
                audiod_errlist_objs="$audiod_errlist_objs oss_write"
                audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
        fi
-       if test "$have_alsa" = "yes"; then
+       if test $HAVE_ALSA = yes; then
                audiod_errlist_objs="$audiod_errlist_objs alsa_write"
                audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
        fi
@@ -781,7 +756,7 @@ else
        build_audiod="no"
 fi
 ########################################################################### fade
-if test "$have_oss" = "yes" -o "$have_alsa" = "yes"; then
+if test "$have_oss" = "yes" -o $HAVE_ALSA = yes; then
        build_fade="yes"
        executables="$executables fade"
        fade_cmdline_objs="fade"
@@ -791,7 +766,7 @@ if test "$have_oss" = "yes" -o "$have_alsa" = "yes"; then
                mixers="${mixers}oss "
                default_mixer="OSS_MIX"
        fi
-       if test "$have_alsa" = "yes"; then
+       if test $HAVE_ALSA = yes; then
                fade_errlist_objs="$fade_errlist_objs alsa_mix"
                mixers="${mixers}alsa "
                default_mixer="ALSA_MIX"
@@ -1102,7 +1077,7 @@ if test "$have_oss" = "yes"; then
        play_errlist_objs="$play_errlist_objs oss_write"
        play_cmdline_objs="$play_cmdline_objs oss_write"
 fi
-if test "$have_alsa" = "yes"; then
+if test $HAVE_ALSA = yes; then
        play_errlist_objs="$play_errlist_objs alsa_write"
        play_cmdline_objs="$play_cmdline_objs alsa_write"
 fi
@@ -1162,7 +1137,7 @@ if test "$have_oss" = "yes"; then
        writers="$writers oss"
        default_writer="OSS_WRITE"
 fi
-if test "$have_alsa" = "yes"; then
+if test $HAVE_ALSA = yes; then
        write_errlist_objs="$write_errlist_objs alsa_write"
        write_cmdline_objs="$write_cmdline_objs alsa_write"
        writers="$writers alsa"