Skip to content

Commit

Permalink
build: un-break self-contained build
Browse files Browse the repository at this point in the history
After learning a bit more about autoconf/automake interaction, I have
to do things even more similarly to the initial PR. Sometimes things
have reasons.


git-svn-id: svn://scm.orgis.org/mpg123/trunk@5383 35dc7657-300d-0410-a2e5-dc2837fedb53
  • Loading branch information
thor committed Dec 3, 2023
1 parent 5f80e54 commit 62aef4e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
20 changes: 20 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@ AM_CPPFLAGS += \
-I$(top_srcdir)/src/compat \
-I$(top_srcdir)/src/common

# Automake cannot handle dependencies behind an autoconf expansion.
# So we need elaborate ifelsery here to make it see the libtool
# files for dependency rule generation. That is stupid. One point
# for those usurping build systems with new flaws.
if BUILD_LIBMPG123
LIBMPG123 = src/libmpg123/libmpg123.la
else
LIBMPG123 = @LIBMPG123_LD@
endif
if BUILD_LIBOUT123
LIBOUT123 = src/libout123/libout123.la
else
LIBOUT123 = @LIBOUT123_LD@
endif
if BUILD_LIBSYN123
LIBSYN123 = src/libsyn123/libsyn123.la
else
LIBSYN123 = @LIBSYN123_LD@
endif

# Include Make modules from subdirectories.
include src/Makemodule.am
include doc/Makemodule.am
Expand Down
25 changes: 10 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -487,47 +487,42 @@ if test "x$build_programs" = xyes; then
components="$components programs"
fi

LIBMPG123_LD=abugifused
if test "x$build_libmpg123" = xyes; then
components="$components libmpg123"
LIBMPG123=src/libmpg123/libmpg123.la
elif test "x$build_programs" = xyes; then
PKG_CHECK_MODULES(LIBMPG123_PKG, libmpg123, HAVE_LIBMPG123="yes", HAVE_LIBMPG123="no" missing_lib=yes)
CFLAGS="$CFLAGS $LIBMPG123_PKG_CFLAGS"
LIBMPG123="$LIBMPG123_PKG_LIBS"
else
LIBMPG123=abugifused
LIBMPG123_LD="$LIBMPG123_PKG_LIBS"
fi
LIBOUT123_LD=abugifused
if test "x$build_libout123" = xyes; then
components="$components libout123"
LIBOUT123=src/libout123/libout123.la
elif test "x$build_programs" = xyes; then
PKG_CHECK_MODULES(LIBOUT123_PKG, libout123, HAVE_LIBOUT123="yes", HAVE_LIBOUT123="no" missing_lib=yes)
CFLAGS="$CFLAGS $LIBOUT123_PKG_CFLAGS"
LIBOUT123="$LIBOUT123_PKG_LIBS"
else
LIBOUT123=abugifused
LIBOUT123_LD="$LIBOUT123_PKG_LIBS"
fi
if test "x$build_libout123_modules" = xyes; then
components="$components libout123-modules"
fi
LIBSYN123=abugifused
if test "x$build_libsyn123" = xyes; then
components="$components libsyn123"
LIBSYN123=src/libsyn123/libsyn123.la
elif test "x$build_programs" = xyes; then
PKG_CHECK_MODULES(LIBSYN123_PKG, libsyn123, HAVE_LIBSYN123="yes", HAVE_LIBSYN123="no" missing_lib=yes)
CFLAGS="$CFLAGS $LIBSYN123_PKG_CFLAGS"
LIBSYN123="$LIBSYN123_PKG_LIBS"
else
LIBSYN123=abugifused
LIBSYN123_LD="$LIBSYN123_PKG_LIBS"
fi

if test "x$missing_lib" = xyes; then
AC_MSG_ERROR([Missing an external mpg123 library for the programs.])
fi

AC_SUBST(LIBMPG123)
AC_SUBST(LIBOUT123)
AC_SUBST(LIBSYN123)
dnl Stupid names because @foo@ cannot coexist with foo.
AC_SUBST(LIBMPG123_LD)
AC_SUBST(LIBOUT123_LD)
AC_SUBST(LIBSYN123_LD)

components=$(echo $components)

Expand Down
14 changes: 7 additions & 7 deletions src/Makemodule.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ endif

src_mpg123_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@ \
@LIBOUT123@ \
@LIBSYN123@ \
$(LIBMPG123) \
$(LIBOUT123) \
$(LIBSYN123) \
@PROG_LIBS@

src_mpg123_LDFLAGS = @EXEC_LT_LDFLAGS@

src_out123_LDADD = \
src/compat/libcompat.la \
@LIBSYN123@ \
@LIBOUT123@ \
$(LIBSYN123) \
$(LIBOUT123) \
@PROG_LIBS@

src_out123_LDFLAGS = @EXEC_LT_LDFLAGS@
Expand All @@ -47,12 +47,12 @@ CLEANFILES += src/*.a

src_mpg123_id3dump_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@ \
$(LIBMPG123) \
@PROG_LIBS@

src_mpg123_strip_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@ \
$(LIBMPG123) \
@PROG_LIBS@

src_mpg123_SOURCES = \
Expand Down
20 changes: 10 additions & 10 deletions src/tests/Makemodule.am
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,25 @@ endif
src_tests_volume_SOURCES = \
src/tests/volume.c
src_tests_volume_LDADD = \
@LIBSYN123@
$(LIBSYN123)

src_tests_decode_fixed_SOURCES = \
src/tests/decode_fixed.c
src_tests_decode_fixed_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@
$(LIBMPG123)

src_tests_seek_whence_SOURCES = \
src/tests/seek_whence.c
src_tests_seek_whence_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@
$(LIBMPG123)

src_tests_seek_accuracy_SOURCES = \
src/tests/seek_accuracy.c
src_tests_seek_accuracy_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@
$(LIBMPG123)

src_tests_noise_SOURCES = \
src/tests/noise.c \
Expand All @@ -89,20 +89,20 @@ src_tests_sweeper_SOURCES = \
src/tests/sweeper.c
src_tests_sweeper_LDADD = \
src/compat/libcompat.la \
@LIBSYN123@ \
@LIBOUT123@
$(LIBSYN123) \
$(LIBOUT123)

src_tests_resample_total_SOURCES = \
src/tests/resample_total.c
src_tests_resample_total_LDADD = \
@LIBSYN123@
$(LIBSYN123)

src_tests_text_SOURCES = \
src/tests/text.c \
src/tests/testtext.h
src_tests_text_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@
$(LIBMPG123)

src_tests_textprint_SOURCES =\
src/tests/textprint.c \
Expand All @@ -111,10 +111,10 @@ src_tests_textprint_SOURCES =\

src_tests_textprint_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@
$(LIBMPG123)

src_tests_plain_id3_SOURCES = \
src/tests/plain_id3.c
src_tests_plain_id3_LDADD = \
src/compat/libcompat.la \
@LIBMPG123@
$(LIBMPG123)

0 comments on commit 62aef4e

Please sign in to comment.