diff --git a/CMakeLists.txt b/CMakeLists.txt index b31da37d..18468df7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,6 +210,23 @@ if (INSTALL_PKGCONFIG_MODULE) set (EXTERNAL_XIPH_REQUIRE "${EXTERNAL_XIPH_REQUIRE} speex") endif () endif () + if (ENABLE_MPEG) + set (EXTERNAL_MPEG_REQUIRE "libmpg123") + get_filename_component(LAME_WE ${LAME_LIBRARY} NAME_WE) + if (LAME_HIP_LIBRARY) + get_filename_component(LAME_HIP_WE ${LAME_HIP_LIBRARY} NAME_WE) + endif () + if (CMAKE_IMPORT_LIBRARY_PREFIX) + string (REGEX REPLACE "^${CMAKE_IMPORT_LIBRARY_PREFIX}" "" LAME_WE_NO_PREFIX ${LAME_WE}) + if (LAME_HIP_LIBRARY) + string (REGEX REPLACE "^${CMAKE_IMPORT_LIBRARY_PREFIX}" "" LAME_HIP_WE_NO_PREFIX ${LAME_HIP_WE}) + endif () + endif () + set (EXTERNAL_MPEG_LIBS "-l${LAME_WE_NO_PREFIX}") + if (LAME_HIP_LIBRARY) + set (EXTERNAL_MPEG_LIBS "${MPEG_LIBS} -l${LAME_HIP_WE}") + endif () + endif () configure_file (sndfile.pc.in sndfile.pc @ONLY) diff --git a/configure.ac b/configure.ac index 1ddfd98e..70de6442 100644 --- a/configure.ac +++ b/configure.ac @@ -410,8 +410,8 @@ dnl Check for MPEG libraris liblame ac_cv_lame="no" ac_cv_mpg123="no" HAVE_MPEG=0 -MPEG_CFLAGS="" -MPEG_LIBS="" +EXTERNAL_MPEG_REQUIRE="" +EXTERNAL_MPEG_LIBS="" AS_IF([test -n "$PKG_CONFIG"], [ AS_IF([test "x$enable_mpeg" = "xno"], [ @@ -436,6 +436,8 @@ AS_IF([test -n "$PKG_CONFIG"], [ AS_IF([test "x$ac_cv_lame$ac_cv_mpg123" = "xyesyes"], [ enable_mpeg="yes" HAVE_MPEG=1 + EXTERNAL_MPEG_REQUIRE="libmpg123" + EXTERNAL_MPEG_LIBS="-lmp3lame" MPEG_CFLAGS="$MPG123_CFLAGS" MPEG_LIBS="$MPG123_LIBS" ], [ @@ -736,6 +738,7 @@ AC_SUBST(SNDIO_LIBS) AC_SUBST(EXTERNAL_XIPH_CFLAGS) AC_SUBST(EXTERNAL_XIPH_LIBS) AC_SUBST(EXTERNAL_XIPH_REQUIRE) +AC_SUBST(EXTERNAL_MPEG_REQUIRE) AC_SUBST(MPG123_CFLAGS) AC_SUBST(MPG123_LIBS) AC_SUBST(MPEG_CFLAGS) diff --git a/sndfile.pc.in b/sndfile.pc.in index 961cf93c..6b884537 100644 --- a/sndfile.pc.in +++ b/sndfile.pc.in @@ -6,7 +6,8 @@ includedir=@includedir@ Name: sndfile Description: A library for reading and writing audio files Requires: -Requires.private: @EXTERNAL_XIPH_REQUIRE@ +Requires.private: @EXTERNAL_XIPH_REQUIRE@ @EXTERNAL_MPEG_REQUIRE@ Version: @VERSION@ Libs: -L${libdir} -lsndfile +Libs.private: @EXTERNAL_MPEG_LIBS@ Cflags: -I${includedir}