From e1da7b528467a8f8f82058993b2e01333677ee39 Mon Sep 17 00:00:00 2001 From: Oron Peled Date: Mon, 28 Dec 2015 19:34:39 +0200 Subject: [PATCH] link libtonezone directly to libm * Now we properly '-lm' to libtonezone itself. Tools that link with libtonezone get it automatically without having to individually link it. - dahdi_cfg historically needed -lm, but no longer does. * Also use "autoscan" to refresh "configure.ac": - Added missing tests - Move AC_CHECK_HEADERS() to their correct location (before testing libraries). * Fixes the following (on Ubuntu-14.04): CCLD dahdi_cfg ./.libs/libtonezone.so: undefined reference to `sin' ./.libs/libtonezone.so: undefined reference to `cos' ./.libs/libtonezone.so: undefined reference to `pow' collect2: error: ld returned 1 exit status make[2]: *** [dahdi_cfg] Error 1 Signed-off-by: Tzafrir Cohen --- Makefile.am | 7 ++++--- configure.ac | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index cfd561b..d43ce91 100644 --- a/Makefile.am +++ b/Makefile.am @@ -74,14 +74,15 @@ libtonezone_la_SOURCES = \ dahdiinclude_HEADERS = tonezone.h libtonezone_la_CFLAGS = $(CFLAGS) -I$(srcdir) -DBUILDING_TONEZONE libtonezone_la_LDFLAGS = -version-info "$(LTZ_CURRENT):$(LTZ_REVISION):$(LTZ_AGE)" +libtonezone_la_LIBADD = -lm if PBX_PCAP noinst_PROGRAMS += dahdi_pcap dahdi_pcap_LDADD = -lpcap endif -patlooptest_LDADD = libtonezone.la -lm -fxstest_LDADD = libtonezone.la -lm +patlooptest_LDADD = libtonezone.la +fxstest_LDADD = libtonezone.la fxotune_LDADD = -lm dahdi_speed_CFLAGS = -O2 @@ -93,7 +94,7 @@ dahdi_tool_CFLAGS = $(CFLAGS) $(NEWT_INCLUDE) dahdi_tool_LDADD = $(NEWT_LIB) endif -dahdi_cfg_LDFLAGS = -lm -lpthread +dahdi_cfg_LDFLAGS = -lpthread dahdi_cfg_LDADD = libtonezone.la udevrulesdir = @udevrulesdir@ diff --git a/configure.ac b/configure.ac index ee06287..826a7ec 100644 --- a/configure.ac +++ b/configure.ac @@ -68,8 +68,6 @@ AC_CONFIG_HEADER(autoconfig.h) # This needs to be before any macros that use the C compiler AC_GNU_SOURCE -AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h]) - AC_CHECK_TOOL([LD], [ld]) # Checks for programs. @@ -160,6 +158,22 @@ else fi AC_SUBST(DAHDI_DECLARATION_AFTER_STATEMENT) +# Checks for header files. +AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h]) +AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_INLINE +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT8_T + +# Checks for libraries. +AC_CHECK_LIB([m], [cos]) +AC_CHECK_LIB([pthread], [pthread_create]) + AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi]) AST_EXT_LIB_SETUP([NEWT], [newt], [newt]) AST_EXT_LIB_SETUP([USB], [usb], [usb]) @@ -181,6 +195,9 @@ AM_CONDITIONAL([PBX_NEWT], [test "$PBX_NEWT" = "1"]) AM_CONDITIONAL([PBX_PCAP], [test "$PBX_PCAP" = "1" -a "$DAHDI_TXMIRROR" = "1"]) AC_CHECK_FUNCS([semtimedop]) +AC_CHECK_FUNCS([alarm bzero gettimeofday memset pow regcomp select socket strcasecmp strchr strdup strerror strrchr strstr strtol strtoul]) +AC_FUNC_ERROR_AT_LINE +AC_FUNC_MALLOC # What the user asked for? libusb/libusbx AC_ARG_WITH([libusbx],