Skip to content

Commit 2fcc481

Browse files
committed
add: linking libm on demand
1 parent 1b8b50b commit 2fcc481

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ AC_FUNC_MALLOC
176176
AC_FUNC_REALLOC
177177
AC_CHECK_FUNCS([clock_gettime memset socket strdup strerror strndup]) #pthread_setaffinity_np])
178178

179+
AC_CHECK_LIB(m, sqrt, MATH_LIBS="-lm")
180+
AC_SUBST(MATH_LIBS)
181+
179182
AC_CONFIG_FILES([Makefile src/Makefile tools/ethercatdiag/Makefile tools/eepromtool/Makefile tools/example_with_dc/Makefile tools/foe_tool/Makefile libethercat.pc])
180183
AC_OUTPUT
181184

tools/example_with_dc/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ACLOCAL_AMFLAGS = -I m4
22

33
LDADD = $(top_builddir)/src/.libs/libethercat.la
4-
LIBS = @LIBOSAL_LIBS@ -lm
4+
LIBS = @LIBOSAL_LIBS@ @MATH_LIBS@
55

66
bin_PROGRAMS = example_with_dc
77
example_with_dc_SOURCES = example_with_dc.c

0 commit comments

Comments
 (0)