More autoconf housekeeping
authorRon <ron@debian.org>
Fri, 28 Jun 2013 20:21:40 +0000 (05:51 +0930)
committerRon <ron@debian.org>
Fri, 28 Jun 2013 20:32:54 +0000 (06:02 +0930)
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.

Makefile.am
configure.ac

index 9cd0633..e13c7cf 100644 (file)
@@ -12,7 +12,7 @@ libopusfile_la_SOURCES = \
        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@
 
index 04b69c3..e9e3431 100644 (file)
@@ -13,6 +13,7 @@ m4_define([CURRENT_VERSION],
 
 AC_INIT([opusfile],[CURRENT_VERSION],[opus@xiph.org])
 AC_CONFIG_SRCDIR([src/opusfile.c])
+AC_CONFIG_MACRO_DIR([m4])
 
 AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
@@ -23,8 +24,6 @@ LT_INIT
 
 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,18 +112,22 @@ AS_IF([test "$enable_float" = "no"],
 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 @@ AC_ARG_ENABLE([doc],
   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