build: don't link against libm.so

There are very few places where we actually use floating point
or #include <math.h>.

Drop that library, although we very likely still get it as indirect
dependency (e.g. on my system it is still dragged in by libsystemd.so,
libudev.so and libnl-3.so).
This commit is contained in:
Thomas Haller 2017-03-23 13:35:02 +01:00
parent 25654cfa31
commit 0fefcbfb2d
6 changed files with 9 additions and 17 deletions

View file

@ -1473,7 +1473,6 @@ src_libNetworkManager_la_LIBADD = \
$(SYSTEMD_LOGIN_LIBS) \
$(LIBNDP_LIBS) \
$(DL_LIBS) \
$(LIBM) \
$(SELINUX_LIBS) \
$(LIBAUDIT_LIBS) \
$(LIBPSL_LIBS) \
@ -1546,8 +1545,7 @@ src_nm_iface_helper_LDADD = \
$(LIBUDEV_LIBS) \
$(LIBNL_LIBS) \
$(LIBNDP_LIBS) \
$(DL_LIBS) \
$(LIBM)
$(DL_LIBS)
src_nm_iface_helper_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-binary.ver"

View file

@ -274,11 +274,6 @@ else
AC_DEFINE(HAVE_VLAN_FLAG_LOOSE_BINDING, 0, [Define if you have VLAN_FLAG_LOOSE_BINDING])
fi
dnl
dnl Checks for libm - needed for pow()
dnl
LT_LIB_M
dnl
dnl Checks for libdl - on certain platforms its part of libc
dnl

View file

@ -23,7 +23,6 @@
#include "nm-default.h"
#include <string.h>
#include <math.h>
#include <netinet/in.h>
#include "nm-property-compare.h"

View file

@ -30,7 +30,6 @@ struct _NMParamSpecSpecialized {
};
#include <string.h>
#include <math.h>
#include <netinet/in.h>
#include <dbus/dbus-glib.h>
@ -157,15 +156,19 @@ _gvalues_compare_fixed (const GValue *value1, const GValue *value2)
case G_TYPE_FLOAT: {
gfloat val1 = g_value_get_float (value1);
gfloat val2 = g_value_get_float (value2);
float diff = val1 - val2;
/* Can't use == or != here due to inexactness of FP */
if (fabsf (val1 - val2) > FLOAT_FACTOR)
if (diff > FLOAT_FACTOR || diff < -FLOAT_FACTOR)
ret = val1 < val2 ? -1 : val1 > val2;
break;
}
case G_TYPE_DOUBLE: {
gdouble val1 = g_value_get_double (value1);
gdouble val2 = g_value_get_double (value2);
if (fabs (val1 - val2) > FLOAT_FACTOR)
double diff = val1 - val2;
if (diff > FLOAT_FACTOR || diff < -FLOAT_FACTOR)
ret = val1 < val2 ? -1 : val1 > val2;
break;
}

View file

@ -27,7 +27,6 @@
#include <sys/ioctl.h>
#include <net/ethernet.h>
#include <unistd.h>
#include <math.h>
#include <netlink/netlink.h>
#include <netlink/msg.h>
#include <linux/nl80211.h>

View file

@ -26,7 +26,6 @@
#include <sys/ioctl.h>
#include <net/ethernet.h>
#include <unistd.h>
#include <math.h>
#include "wifi-utils-private.h"
#include "wifi-utils-wext.h"
@ -79,7 +78,7 @@ struct iw_range_with_scan_capa
} G_STMT_END
static guint32
iw_freq_to_uint32 (struct iw_freq *freq)
iw_freq_to_uint32 (const struct iw_freq *freq)
{
if (freq->e == 0) {
/* Some drivers report channel not frequency. Convert to a
@ -90,8 +89,7 @@ iw_freq_to_uint32 (struct iw_freq *freq)
else if (freq->m == 14)
return 2484;
}
return (guint32) (((double) freq->m) * pow (10, freq->e) / 1000000);
return (guint32) ((((double) freq->m) * nm_utils_10pow (freq->e)) / 1000000.0);
}
static void