shithub: opus-tools

Download patch

ref: c255b1194c22edcd085d13410620f0b363e97df8
parent: 19923d61f51fa8c9da29f7e2d5fe661002a4149b
author: Ron <ron@debian.org>
date: Fri Jun 28 21:13:27 EDT 2013

Check for libm in a way that shouldn't explode on BeOS

--- a/Makefile.am
+++ b/Makefile.am
@@ -55,12 +55,12 @@
 
 opusenc_SOURCES = src/opus_header.c src/opusenc.c src/picture.c src/resample.c src/audio-in.c src/diag_range.c src/flac.c src/lpc.c win32/unicode_support.c
 opusenc_CPPFLAGS = $(AM_CPPFLAGS) $(resampler_CPPFLAGS)
-opusenc_LDADD = $(OGG_LIBS) $(OPUS_LIBS) -lm
+opusenc_LDADD = $(OGG_LIBS) $(OPUS_LIBS) $(LIBM)
 opusenc_MANS = man/opusenc.1
 
 opusdec_SOURCES = src/opus_header.c src/wav_io.c src/wave_out.c src/opusdec.c src/resample.c src/diag_range.c win32/unicode_support.c
 opusdec_CPPFLAGS = $(AM_CPPFLAGS) $(resampler_CPPFLAGS)
-opusdec_LDADD = $(OGG_LIBS) $(OPUS_LIBS) -lm
+opusdec_LDADD = $(OGG_LIBS) $(OPUS_LIBS) $(LIBM)
 opusdec_MANS = man/opusdec.1
 
 opusinfo_SOURCES = src/opus_header.c src/opusinfo.c src/info_opus.c src/picture.c win32/unicode_support.c
--- a/configure.ac
+++ b/configure.ac
@@ -82,8 +82,6 @@
     ])
 AC_MSG_RESULT([$has_var_arrays])
 
-AC_CHECK_LIB([winmm], [main])
-
 AC_ARG_ENABLE([assertions],
     [AS_HELP_STRING([--enable-assertions],[enable additional software error checking])],,
     [enable_assertions=no])
@@ -105,6 +103,9 @@
     CFLAGS="$saved_CFLAGS"
 fi
 
+LT_LIB_M
+AC_CHECK_LIB([winmm], [main])
+
 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
 
@@ -291,15 +292,8 @@
 
 AC_FUNC_FSEEKO
 
-dnl This is a bit of a mess.  Really we should probably use AC_SEARCH_LIBS to
-dnl check for these, since on Linux at least they aren't found unless libm is
-dnl linked, but that may not be true everywhere.  But we also don't want LIBS
-dnl to contain -lm, since not everything we build actually needs that.
-dnl However the only thing that uses them is opusdec, and since it also uses
-dnl the speex resampler, it already needs libm for lots of other things too.
-dnl So check for them with -lm in LIBS, and then clear it after we're done.
 saved_LIBS="$LIBS"
-LIBS="$LIBS -lm"
+LIBS="$LIBS $LIBM"
 AC_CHECK_FUNCS([lrintf])
 AC_CHECK_FUNCS([fminf])
 AC_CHECK_FUNCS([fmaxf])