Menu ▾ ▴

#473 Add static archive for the test binaries when static linking is disabled

NextRelease
closed-accepted
nobody
5
2026-10-01
2026-10-01
Nico P
No

Hi,

Since libspectrum-1.6.4, the library is built with -fvisibility=hidden while the tests are statically linked.
Add an optional static archive for the test binaries when static linking is disabled.

--- a/configure.ac
+++ b/configure.ac
@@ -359,6 +359,9 @@ AM_CONDITIONAL([WAV_INTERNAL_AUDIOFILE],
 AM_CONDITIONAL([WAV_INTERNAL_MACOS],
                [test "$selected_wav_backend" = macos])

+AM_CONDITIONAL([BUILD_TEST_ARCHIVE],

+               [test "x$enable_static" != "xyes"])
+
 AC_CONFIG_FILES([
   Makefile
   libspectrum.qpg
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -74,7 +74,17 @@ test/wav-mono-threshold.wav: test/wav-fixtures.pl
 test/wav-stereo-mixdown.wav: test/wav-fixtures.pl
        $(AM_V_GEN)$(PERL) $< stereo-mixdown > $@.tmp && mv $@.tmp $@

+if BUILD_TEST_ARCHIVE
+libspectrum-test.a: libspectrum.la

+       $(AM_V_at)$(AR) crs $@ .libs/*.o
+test_test_DEPENDENCIES += libspectrum-test.a
+test_test_LDADD = libspectrum-test.a $(libspectrum_la_LIBADD)
+noinst_DATA += libspectrum-test.a
+CLEANFILES += libspectrum-test.a
+else
 test_test_LDADD = libspectrum.la
+endif
+
 test_test_LDFLAGS = -static

 EXTRA_DIST += \

Discussion

  • Fredrick Meunier

    • status: open --> closed-accepted
    • Group: future --> NextRelease
     
  • Fredrick Meunier

    Thanks, applied in [df2826].

     

    Related

    Commit: [df2826]


Log in to post a comment.