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 <tzafrir.cohen@xorcom.com>
This commit is contained in:
Oron Peled 2015-12-28 19:34:39 +02:00 committed by Tzafrir Cohen
parent f105a09eda
commit e1da7b5284
2 changed files with 23 additions and 5 deletions

View File

@ -74,14 +74,15 @@ libtonezone_la_SOURCES = \
dahdiinclude_HEADERS = tonezone.h dahdiinclude_HEADERS = tonezone.h
libtonezone_la_CFLAGS = $(CFLAGS) -I$(srcdir) -DBUILDING_TONEZONE libtonezone_la_CFLAGS = $(CFLAGS) -I$(srcdir) -DBUILDING_TONEZONE
libtonezone_la_LDFLAGS = -version-info "$(LTZ_CURRENT):$(LTZ_REVISION):$(LTZ_AGE)" libtonezone_la_LDFLAGS = -version-info "$(LTZ_CURRENT):$(LTZ_REVISION):$(LTZ_AGE)"
libtonezone_la_LIBADD = -lm
if PBX_PCAP if PBX_PCAP
noinst_PROGRAMS += dahdi_pcap noinst_PROGRAMS += dahdi_pcap
dahdi_pcap_LDADD = -lpcap dahdi_pcap_LDADD = -lpcap
endif endif
patlooptest_LDADD = libtonezone.la -lm patlooptest_LDADD = libtonezone.la
fxstest_LDADD = libtonezone.la -lm fxstest_LDADD = libtonezone.la
fxotune_LDADD = -lm fxotune_LDADD = -lm
dahdi_speed_CFLAGS = -O2 dahdi_speed_CFLAGS = -O2
@ -93,7 +94,7 @@ dahdi_tool_CFLAGS = $(CFLAGS) $(NEWT_INCLUDE)
dahdi_tool_LDADD = $(NEWT_LIB) dahdi_tool_LDADD = $(NEWT_LIB)
endif endif
dahdi_cfg_LDFLAGS = -lm -lpthread dahdi_cfg_LDFLAGS = -lpthread
dahdi_cfg_LDADD = libtonezone.la dahdi_cfg_LDADD = libtonezone.la
udevrulesdir = @udevrulesdir@ udevrulesdir = @udevrulesdir@

View File

@ -68,8 +68,6 @@ AC_CONFIG_HEADER(autoconfig.h)
# This needs to be before any macros that use the C compiler # This needs to be before any macros that use the C compiler
AC_GNU_SOURCE AC_GNU_SOURCE
AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h])
AC_CHECK_TOOL([LD], [ld]) AC_CHECK_TOOL([LD], [ld])
# Checks for programs. # Checks for programs.
@ -160,6 +158,22 @@ else
fi fi
AC_SUBST(DAHDI_DECLARATION_AFTER_STATEMENT) 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([DAHDI], [DAHDI], [dahdi])
AST_EXT_LIB_SETUP([NEWT], [newt], [newt]) AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
AST_EXT_LIB_SETUP([USB], [usb], [usb]) 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"]) AM_CONDITIONAL([PBX_PCAP], [test "$PBX_PCAP" = "1" -a "$DAHDI_TXMIRROR" = "1"])
AC_CHECK_FUNCS([semtimedop]) 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 # What the user asked for? libusb/libusbx
AC_ARG_WITH([libusbx], AC_ARG_WITH([libusbx],