1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

configure: check for -lm and log10 function

We already use -lm functions in a couple of places (these are
satisfied by gcc built-ins for most builds): add a configure.in
check and explicitly link to -lm.
This commit is contained in:
Bryn M. Reeves 2015-08-18 15:21:19 +01:00
parent a7abade088
commit c1bd76d6fc
4 changed files with 53 additions and 1 deletions

46
configure vendored
View File

@ -665,6 +665,7 @@ PYTHON_LIBDIRS
PYTHON_INCDIRS PYTHON_INCDIRS
PYTHON_BINDINGS PYTHON_BINDINGS
PTHREAD_LIBS PTHREAD_LIBS
M_LIBS
POOL POOL
PKGCONFIG PKGCONFIG
OCFDIR OCFDIR
@ -12569,6 +12570,50 @@ if [ \( "$LVM1" = shared -o "$POOL" = shared -o "$CLUSTER" = shared \
as_fn_error $? "Features cannot be 'shared' when building statically" "$LINENO" 5 as_fn_error $? "Features cannot be 'shared' when building statically" "$LINENO" 5
fi fi
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for log10 in -lm" >&5
$as_echo_n "checking for log10 in -lm... " >&6; }
if ${ac_cv_lib_m_log10+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char log10 ();
int
main ()
{
return log10 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_m_log10=yes
else
ac_cv_lib_m_log10=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log10" >&5
$as_echo "$ac_cv_lib_m_log10" >&6; }
if test "x$ac_cv_lib_m_log10" = xyes; then :
M_LIBS="-lm"
else
hard_bailout
fi
################################################################################ ################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_lock in -lpthread" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_lock in -lpthread" >&5
$as_echo_n "checking for pthread_mutex_lock in -lpthread... " >&6; } $as_echo_n "checking for pthread_mutex_lock in -lpthread... " >&6; }
@ -14151,6 +14196,7 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
################################################################################ ################################################################################

View File

@ -1537,6 +1537,10 @@ if [[ \( "$LVM1" = shared -o "$POOL" = shared -o "$CLUSTER" = shared \
AC_MSG_ERROR([Features cannot be 'shared' when building statically]) AC_MSG_ERROR([Features cannot be 'shared' when building statically])
fi fi
################################################################################
AC_CHECK_LIB(m, log10,
[M_LIBS="-lm"], hard_bailout)
################################################################################ ################################################################################
AC_CHECK_LIB([pthread], [pthread_mutex_lock], AC_CHECK_LIB([pthread], [pthread_mutex_lock],
[PTHREAD_LIBS="-lpthread"], hard_bailout) [PTHREAD_LIBS="-lpthread"], hard_bailout)
@ -1984,6 +1988,7 @@ AC_SUBST(OCF)
AC_SUBST(OCFDIR) AC_SUBST(OCFDIR)
AC_SUBST(PKGCONFIG) AC_SUBST(PKGCONFIG)
AC_SUBST(POOL) AC_SUBST(POOL)
AC_SUBST(M_LIBS)
AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PYTHON) AC_SUBST(PYTHON)
AC_SUBST(PYTHON_BINDINGS) AC_SUBST(PYTHON_BINDINGS)

View File

@ -55,7 +55,7 @@ include $(top_builddir)/make.tmpl
CFLAGS += $(UDEV_CFLAGS) $(VALGRIND_CFLAGS) CFLAGS += $(UDEV_CFLAGS) $(VALGRIND_CFLAGS)
LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) $(M_LIBS)
device-mapper: all device-mapper: all

View File

@ -54,6 +54,7 @@ LDDEPS += @LDDEPS@
LIB_SUFFIX = @LIB_SUFFIX@ LIB_SUFFIX = @LIB_SUFFIX@
LVMINTERNAL_LIBS = -llvm-internal $(DAEMON_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS) LVMINTERNAL_LIBS = -llvm-internal $(DAEMON_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS)
DL_LIBS = @DL_LIBS@ DL_LIBS = @DL_LIBS@
M_LIBS = @M_LIBS@
PTHREAD_LIBS = @PTHREAD_LIBS@ PTHREAD_LIBS = @PTHREAD_LIBS@
READLINE_LIBS = @READLINE_LIBS@ READLINE_LIBS = @READLINE_LIBS@
SELINUX_LIBS = @SELINUX_LIBS@ SELINUX_LIBS = @SELINUX_LIBS@