Skip to content

Commit ff19d10

Browse files
committed
fixes to Libs.private in .pc file. revise -lm dependencies in autotools.
1 parent b11d0dd commit ff19d10

4 files changed

Lines changed: 36 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,15 @@ install(FILES
176176
${CMAKE_INSTALL_INCLUDEDIR}/libmodplug
177177
)
178178

179-
if (NOT WIN32)
179+
if (NOT MSVC)
180+
if(MINGW OR CYGWIN)
181+
set(LIBS_PRIVATE "-luser32 -lstdc++")
182+
else()
183+
set(LIBS_PRIVATE "-lstdc++")
184+
if(MATH_LIB)
185+
set(LIBS_PRIVATE "${LIBS_PRIVATE} -lm")
186+
endif()
187+
endif()
180188
set(prefix ${CMAKE_INSTALL_PREFIX})
181189
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
182190
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
@@ -187,4 +195,4 @@ if (NOT WIN32)
187195
install(FILES "${PROJECT_BINARY_DIR}/libmodplug.pc"
188196
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
189197
)
190-
endif (NOT WIN32)
198+
endif ()

configure.ac

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ LT_INIT([win32-dll])
2929

3030
AC_HEADER_STDC
3131
AC_CHECK_HEADERS([inttypes.h stdint.h malloc.h])
32-
AC_CHECK_FUNCS(sinf)
3332

3433
CXXFLAGS="$CXXFLAGS -fno-exceptions -Wall -ffast-math -fno-common -D_REENTRANT"
3534

@@ -44,6 +43,30 @@ case "$host" in
4443
esac
4544
AC_SUBST(LT_LDFLAGS)
4645

46+
LIBS_PRIVATE=-lstdc++
47+
LIBM=
48+
case "${host_os}" in
49+
dnl Djgpp has all c89 math funcs in libc.a
50+
*djgpp)
51+
;;
52+
dnl These systems don't have libm or don't need it (list based on libtool)
53+
darwin*|haiku*|beos*|cegcc*|pw32*)
54+
;;
55+
dnl MinGW and Cygwin don't need libm, either
56+
mingw*|cygwin*)
57+
LIBS_PRIVATE="-luser32 ${LIBS_PRIVATE}"
58+
;;
59+
dnl All others:
60+
*) AC_CHECK_LIB(m, pow, LIBM="-lm")
61+
if test x$LIBM != x; then
62+
LIBS="${LIBS} ${LIBM}"
63+
LIBS_PRIVATE="${LIBS_PRIVATE} ${LIBM}"
64+
fi
65+
;;
66+
esac
67+
AC_SUBST(LIBS_PRIVATE)
68+
AC_CHECK_FUNCS(sinf)
69+
4770
# symbol visibility
4871
ac_save_CXXFLAGS="$CXXFLAGS"
4972
CXXFLAGS="$CXXFLAGS -fvisibility=hidden -Werror"

libmodplug.pc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Name: libmodplug
77
Description: The ModPlug mod file playing library.
88
Version: @VERSION@
99
Requires:
10-
Libs: -L${libdir} -lmodplug
11-
Libs.private: -lstdc++ -lm
10+
Libs: -L${libdir} -lmodplug
11+
Libs.private: @LIBS_PRIVATE@
1212
Cflags: -I${includedir}

src/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/libmodplug
66

77
lib_LTLIBRARIES = libmodplug.la
88
libmodplug_la_LDFLAGS = -version-info $(MODPLUG_LIBRARY_VERSION) $(LT_LDFLAGS)
9-
libmodplug_la_LIBADD = -lm
109
libmodplug_la_SOURCES = tables.h \
1110
sndmix.cpp \
1211
sndfile.cpp \

0 commit comments

Comments
 (0)