shithub: opusfile

Download patch

ref: c939c7360895ad2b46d3606fd942ca30d846e781
parent: 8df43f7ca556f85a2ad9d431766c4b82501a35fb
author: Ron <[email protected]>
date: Sat Jun 29 01:51:40 EDT 2013

More autoconf housekeeping

Don't let AC_SEARCH_LIBS([lrintf]) add -lm to LIBS, otherwise we'll
unconditionally link everything with it.

Correctly handle the third possibility of AC_SEARCH_LIBS, that no
library at all was found.

Link libopusfile with $lrintf_lib, it uses it and will otherwise fail
with linkers that use --no-add-needed / --no-copy-dt-needed-entries.

Don't bother to test for doxygen if using it is --disable'd.

--- a/Makefile.am
+++ b/Makefile.am
@@ -12,7 +12,7 @@
 	src/info.c \
 	src/internal.c src/internal.h \
 	src/opusfile.c src/stream.c
-libopusfile_la_LIBADD = $(DEPS_LIBS)
+libopusfile_la_LIBADD = $(DEPS_LIBS) $(lrintf_lib)
 libopusfile_la_LDFLAGS = -no-undefined \
  -version-info @OP_LT_CURRENT@:@OP_LT_REVISION@:@OP_LT_AGE@
 
--- a/configure.ac
+++ b/configure.ac
@@ -13,6 +13,7 @@
 
 AC_INIT([opusfile],[CURRENT_VERSION],[[email protected]])
 AC_CONFIG_SRCDIR([src/opusfile.c])
+AC_CONFIG_MACRO_DIR([m4])
 
 AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
@@ -23,8 +24,6 @@
 
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
-AC_CONFIG_MACRO_DIR([m4])
-
 dnl Library versioning for libtool.
 dnl Please update these for releases.
 dnl CURRENT, REVISION, AGE
@@ -113,19 +112,23 @@
 AS_IF([test "$enable_fixed_point" = "yes"],
   [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
   [dnl This only has to be tested for if float->fixed conversions are required
+   saved_LIBS="$LIBS"
    AC_SEARCH_LIBS([lrintf], [m], [
       AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
       lrintf_notice="
     Library for lrintf() ......... ${ac_cv_search_lrintf}"
    ])
+   LIBS="$saved_LIBS"
   ]
 )
-lrintf_lib="$ac_cv_search_lrintf"
-AS_IF([test "$ac_cv_search_lrintf" = "none required"],
-  [lrintf_lib=""]
-)
-AC_SUBST(lrintf_lib)
 
+AS_CASE(["$ac_cv_search_lrintf"],
+  ["no"],[],
+  ["none required"],[],
+  [lrintf_lib="$ac_cv_search_lrintf"])
+
+AC_SUBST([lrintf_lib])
+
 CC_ATTRIBUTE_VISIBILITY([default], [
   CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
 ])
@@ -135,12 +138,14 @@
   AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
   [enable_doc=yes]
 )
-AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
-if test "$HAVE_DOXYGEN" != "yes" -o "$enable_doc" != "yes" ; then
-  HAVE_DOXYGEN="no"
-  enable_doc="no"
-fi
-AM_CONDITIONAL(HAVE_DOXYGEN, [test $HAVE_DOXYGEN = yes])
+
+AS_IF([test "$enable_doc" = "yes"], [
+  AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
+],[
+  HAVE_DOXYGEN=no
+])
+
+AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
 
 AC_CONFIG_FILES([
   Makefile