shithub: sox

Download patch

ref: 794e0d43cbb12de4273a2636552ae5a63892ba97
parent: f6cb823170d75133d29d25f8119ba44405832859
author: Mans Rullgard <mans@mansr.com>
date: Fri Aug 14 17:25:23 EDT 2020

build: simplify symlink creation

--- a/configure.ac
+++ b/configure.ac
@@ -578,9 +578,8 @@
     AS_HELP_STRING([--disable-symlinks], [Don't make any symlinks to sox.]),,enable_symlinks=yes)
 AC_MSG_RESULT($enable_symlinks)
 
-enable_playrec_symlinks=no
 if test "$enable_symlinks" = "yes"; then
-  SYMLINKS=yes
+  SYMLINKS=soxi
   if test "" \
       -o "$using_alsa" = yes \
       -o "$using_ao" = yes \
@@ -588,13 +587,13 @@
       -o "$using_oss" = yes \
       -o "$using_pulseaudio" = yes \
       -o "$using_sndio" = yes \
+      -o "$using_sunaudio" = yes \
+      -o "$using_waveaudio" = yes \
     ; then
-    PLAYRECLINKS=yes
-    enable_playrec_symlinks=yes
+    SYMLINKS="$SYMLINKS play rec"
   fi
 fi
 AC_SUBST(SYMLINKS)
-AC_SUBST(PLAYRECLINKS)
 
 AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
 
@@ -623,8 +622,7 @@
 echo "Distro name ...............$DISTRO"
 echo "Dynamic loading support....$using_libltdl"
 echo "Pkg-config location........$pkgconfig_option"
-echo "Play and rec symlinks......$enable_playrec_symlinks"
-echo "Symlinks enabled...........$enable_symlinks"
+echo "Symlinks enabled...........${SYMLINKS:-no}"
 echo
 echo "OPTIONAL DEVICE DRIVERS"
 echo "ao (Xiph)..................$using_ao"
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -131,33 +131,18 @@
 EXTRA_DIST = monkey.wav optional-fmts.am \
 	     tests.sh testall.sh tests.bat testall.bat test-comments
 
-all: sox$(EXEEXT) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT) sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT)
+all: sox$(EXEEXT) sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT)
 
-play$(EXEEXT) rec$(EXEEXT): sox$(EXEEXT)
-	if test "$(PLAYRECLINKS)" = "yes"; then	\
-		test -f sox$(EXEEXT) && ( $(RM) $@ && $(LN_S) sox$(EXEEXT) $@ ) || $(LN_S) sox $@; \
-	fi
+MAKELINKS = for n in $(SYMLINKS); do $(RM) $$n$(EXEEXT) && $(LN_S) sox$(EXEEXT) $$n$(EXEEXT); done
 
-soxi$(EXEEXT): sox$(EXEEXT)
-	if test "$(SYMLINKS)" = "yes"; then	\
-		test -f sox$(EXEEXT) && ( $(RM) $@ && $(LN_S) sox$(EXEEXT) $@ ) || $(LN_S) sox $@; \
-	fi
+all-local: sox$(EXEEXT)
+	$(MAKELINKS)
 
 install-exec-hook:
-	if test "$(PLAYRECLINKS)" = "yes"; then	\
-		cd $(DESTDIR)$(bindir); $(RM) play$(EXEEXT) rec$(EXEEXT); $(LN_S) sox$(EXEEXT) play$(EXEEXT); $(LN_S) sox$(EXEEXT) rec$(EXEEXT); \
-	fi
-	if test "$(SYMLINKS)" = "yes"; then	\
-		cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT); $(LN_S) sox$(EXEEXT) soxi$(EXEEXT); \
-	fi
+	cd $(DESTDIR)$(bindir) && $(MAKELINKS)
 
 uninstall-hook:
-	if test "$(PLAYRECLINKS)" = "yes"; then	\
-		cd $(DESTDIR)$(bindir); $(RM) play$(EXTEXT) rec$(EXEEXT); \
-	fi
-	if test "$(SYMLINKS)" = "yes"; then	\
-		cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT); \
-	fi
+	cd $(DESTDIR)$(bindir) && $(RM) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT)
 
 clean-local:
 	$(RM) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT)