diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-20 21:47:56 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-20 21:48:09 -0800 |
commit | 67ab447959b62454f4e0273177baa19711babb96 (patch) | |
tree | f0a0a7c4bdad446a6311d65d18d19a2e534db81a /configure.ac | |
parent | 1c2b70d13c42f5461a2d7c3cae7adf8d9b2e3cea (diff) |
Use lrint() from math library if available
Moves -lm from being hardcoded in Makefile.am to being added via
AC_SEARCH_LIBS in configure.ac setting it in $(MATH_LIBS)
Using lrint() [returns long int] instead of rint() [returns double]
clears a bunch of gcc warnings of the form:
"cast from function call of type ‘double’ to non-matching type ‘short int’"
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index ecb71ce..c3fcba9 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,18 @@ AM_PROG_CC_C_O AC_CHECK_FUNCS([mkstemp]) +# Math libraries & functions +# - some compilers use builtin inlines for floor when optimizing +# - lrint() is a C99 addition not found on some older systems +# - must do the libm check first so that the lrint check will have it in $LIBS +save_LIBS="$LIBS" +AC_SEARCH_LIBS([floor], [m]) +AC_SEARCH_LIBS([lrint], [m]) +AC_CHECK_FUNCS([lrint]) +MATH_LIBS="$LIBS" +LIBS="$save_LIBS" +AC_SUBST([MATH_LIBS]) + # Obtain compiler/linker options from dependencies PKG_CHECK_MODULES(BMTOA, x11 xmu) PKG_CHECK_MODULES(ATOBM, xproto) |