From: Andre Noll <maan@tuebingen.mpg.de>
Date: Mon, 25 Aug 2014 21:50:01 +0000 (+0200)
Subject: build: Convert oss detection to new macros.
X-Git-Tag: v0.5.5~44^2~3
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=f6db57bc964bc78f1a7ce521dee2108289cd8b8e;p=paraslash.git

build: Convert oss detection to new macros.

This also adds the missing oss_cppflags autoconf variable and the
corresponding make rule for building the oss writer.
---

diff --git a/Makefile.in b/Makefile.in
index d8c6ed83..14015c9b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -50,6 +50,7 @@ flac_cppflags := @flac_cppflags@
 samplerate_cppflags := @samplerate_cppflags@
 readline_cppflags := @readline_cppflags@
 alsa_cppflags := @alsa_cppflags@
+oss_cppflags := @oss_cppflags@
 
 clock_gettime_ldflags := @clock_gettime_ldflags@
 id3tag_ldflags := @id3tag_ldflags@
diff --git a/Makefile.real b/Makefile.real
index 55d9e18c..c5d64058 100644
--- a/Makefile.real
+++ b/Makefile.real
@@ -204,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)/oss_write.o $(dep_dir)/oss_write.d \
+: CPPFLAGS += $(oss_cppflags)
+
 $(object_dir)/ao_write.o $(dep_dir)/ao_write.d \
 : CPPFLAGS += $(ao_cppflags) $(pthread_cppflags)
 
diff --git a/configure.ac b/configure.ac
index 81f1e64c..98d75c78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -354,29 +354,12 @@ AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no)
 LIB_SUBST_FLAGS(id3tag)
 UNSTASH_FLAGS
 ########################################################################### oss
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LDFLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-
-have_oss="yes"
-msg="=> will not build oss writer"
-
-AC_CHECK_HEADER(sys/soundcard.h, [
-	AC_CHECK_LIB(ossaudio, _oss_ioctl, [
-			oss_ldflags="-lossaudio"
-			AC_SUBST(oss_ldflags)
-		]
-	)
-	],
-	[
-		have_oss="no"
-		AC_MSG_WARN([no sys/soundcard.h $msg])
-	]
-)
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
-
+STASH_FLAGS
+LIB_ARG_WITH([oss], [])
+AC_CHECK_HEADER(sys/soundcard.h, [HAVE_OSS=yes], [HAVE_OSS=no])
+AC_CHECK_LIB(ossaudio, _oss_ioctl, [oss_ldflags="$oss_ldflags -lossaudio"], [])
+LIB_SUBST_FLAGS(oss)
+UNSTASH_FLAGS
 ########################################################################### alsa
 STASH_FLAGS
 LIB_ARG_WITH([alsa], [-lasound])
@@ -667,7 +650,7 @@ if test -n "$CRYPTOLIB"; then
 		audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
 		audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
 	fi
-	if test "$have_oss" = "yes"; then
+	if test $HAVE_OSS = yes; then
 		audiod_errlist_objs="$audiod_errlist_objs oss_write"
 		audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
 	fi
@@ -697,12 +680,12 @@ 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"
 	fade_errlist_objs="fade exec string fd version ggo"
-	if test "$have_oss" = "yes"; then
+	if test $HAVE_OSS = yes; then
 		fade_errlist_objs="$fade_errlist_objs oss_mix"
 		mixers="${mixers}oss "
 		default_mixer="OSS_MIX"
@@ -1014,7 +997,7 @@ if test $HAVE_MAD = yes; then
 	play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
 	play_errlist_objs="$play_errlist_objs mp3dec_filter"
 fi
-if test "$have_oss" = "yes"; then
+if test $HAVE_OSS = yes; then
 	play_errlist_objs="$play_errlist_objs oss_write"
 	play_cmdline_objs="$play_cmdline_objs oss_write"
 fi
@@ -1072,7 +1055,7 @@ NEED_AO_OBJECTS && {
 	writers="$writers ao"
 	default_writer="AO_WRITE"
 }
-if test "$have_oss" = "yes"; then
+if test $HAVE_OSS = yes; then
 	write_errlist_objs="$write_errlist_objs oss_write"
 	write_cmdline_objs="$write_cmdline_objs oss_write"
 	writers="$writers oss"