diff mbox series

[2/4] src/Versions.in: Add guards for opt. alisp symbols

Message ID b60ab4a86cc69a7749f5a4b1a6325933a048eb45.1704635150.git.nvinson234@gmail.com
State New
Headers show
Series Clang: fix versioned symbol build errors | expand

Commit Message

Nicholas Vinson Jan. 7, 2024, 1:48 p.m. UTC
Add guards for optional alisp symbols. This ensures that the Versions
file does not contain undefined symbols when building alisp support is
disabled.

Fixes Gentoo bugs 914511 (https://bugs.gentoo.org/914511),
    914643 (https://bugs.gentoo.org/914643),
    and 919417 (https://bugs.gentoo.org/919417).

Fixes bug #305
Fixes alsa_lisp symbol error reported in bug #356

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
---
 configure.ac                        |  2 +-
 src/Makefile.am                     | 11 ++++++++++-
 src/{Versions.in => Versions.in.in} |  4 ++++
 3 files changed, 15 insertions(+), 2 deletions(-)
 rename src/{Versions.in => Versions.in.in} (99%)
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 9db527c3..024e70b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -749,7 +749,7 @@  fi
 
 AC_CONFIG_FILES(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
 		include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
-		src/Versions src/Makefile \
+		src/Versions.in src/Makefile \
 		src/control/Makefile src/mixer/Makefile \
 		src/pcm/Makefile src/pcm/scopes/Makefile \
 		src/rawmidi/Makefile src/timer/Makefile \
diff --git a/src/Makefile.am b/src/Makefile.am
index df46dbc4..b4a0d5d9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,10 +1,11 @@ 
-EXTRA_DIST=Versions
 COMPATNUM=@LIBTOOL_VERSION_INFO@
 
 if VERSIONED_SYMBOLS
 VSYMS = -Wl,--version-script=Versions
+BUILT_SOURCES = $(top_builddir)/src/Versions
 else
 VSYMS =
+BUILT_SOURCES =
 endif
 
 if SYMBOLIC_FUNCTIONS
@@ -13,6 +14,8 @@  else
 SYMFUNCS =
 endif
 
+VERSION_CPPFLAGS =
+
 lib_LTLIBRARIES = libasound.la
 libasound_la_SOURCES = conf.c confeval.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c
 
@@ -43,6 +46,9 @@  SUBDIRS += ucm
 libasound_la_LIBADD += ucm/libucm.la
 endif
 if BUILD_ALISP
+if VERSIONED_SYMBOLS
+VERSION_CPPFLAGS += -DHAVE_ALISP_SYMS
+endif
 SUBDIRS += alisp
 libasound_la_LIBADD += alisp/libalisp.la
 endif
@@ -51,6 +57,9 @@  libasound_la_LIBADD += @ALSA_DEPLIBS@
 
 libasound_la_LDFLAGS = -version-info $(COMPATNUM) $(VSYMS) $(SYMFUNCS) $(LDFLAGS_NOUNDEFINED)
 
+$(top_builddir)/src/Versions: $(top_builddir)/src/Versions.in
+	$(COMPILE) -E $(VERSION_CPPFLAGS) -x assembler-with-cpp -o $@ $<
+
 control/libcontrol.la:
 	$(MAKE) -C control libcontrol.la
 
diff --git a/src/Versions.in b/src/Versions.in.in
similarity index 99%
rename from src/Versions.in
rename to src/Versions.in.in
index c53a99fa..041eff08 100644
--- a/src/Versions.in
+++ b/src/Versions.in.in
@@ -118,15 +118,19 @@  ALSA_0.9.3 {
 } ALSA_0.9.0;
 
 ALSA_0.9.5 {
+#ifdef HAVE_ALISP_SYMS
   global:
 
     @SYMBOL_PREFIX@alsa_lisp;
+#endif
 } ALSA_0.9.3;
 
 ALSA_0.9.7 {
+#ifdef HAVE_ALISP_SYMS
   global:
 
     @SYMBOL_PREFIX@alsa_lisp_*;
+#endif
 } ALSA_0.9.5;
 
 ALSA_1.1.6 {