FS-3638: Rework platform library/linker flags handling and libfreeswitch _LDFLAGS/_LIBS to fix applications

This fixes the linking order problems reported in FS-3638.

Clean up libfreeswitch dependency handling:

        PLATFORM_CORE_LDFLAGS - Non-library linker flags, specific to this platform
        PLATFORM_CORE_LIBS    - Library flags/libraries need to build libfreeswitch on this platform

Drop LDADD dependencies from tone2wav and fs_encode, except for libfreeswitch.la, which will
"automagically" pull in all other libraries, now that we fixed libfreeswitch.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
Stefan Knoblich 2011-11-04 21:04:29 +01:00
parent 8604a1e7a9
commit a48da3b46c
2 changed files with 19 additions and 10 deletions

View File

@ -133,8 +133,8 @@ endif
##
lib_LTLIBRARIES = libfreeswitch.la
libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(AM_CFLAGS)
libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS)
libfreeswitch_la_LIBADD = $(CORE_LIBS)
libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_LDFLAGS)
libfreeswitch_la_LIBADD = $(CORE_LIBS) $(PLATFORM_CORE_LIBS)
libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
if HAVE_ODBC
@ -299,16 +299,16 @@ endif
##
fs_encode_SOURCES = src/fs_encode.c
fs_encode_CFLAGS = $(AM_CFLAGS)
fs_encode_LDFLAGS = $(AM_LDFLAGS) $(CORE_LIBS)
fs_encode_LDADD = libfreeswitch.la -lcrypt -lrt
fs_encode_LDFLAGS = $(AM_LDFLAGS)
fs_encode_LDADD = libfreeswitch.la
##
## tone2wav ()
##
tone2wav_SOURCES = src/tone2wav.c
tone2wav_CFLAGS = $(AM_CFLAGS)
tone2wav_LDFLAGS = $(AM_LDFLAGS) $(CORE_LIBS)
tone2wav_LDADD = libfreeswitch.la -lcrypt -lrt
tone2wav_LDFLAGS = $(AM_LDFLAGS)
tone2wav_LDADD = libfreeswitch.la
##
## fs_ivrd ()

View File

@ -407,7 +407,8 @@ APR_ADDTO(SWITCH_AM_LDFLAGS, -lresolv)
fi
ESL_LDFLAGS=
PLATFORM_CORE_DEPLIBS=
PLATFORM_CORE_LDFLAGS=
PLATFORM_CORE_LIBS=
# tweak platform specific flags
case "$host" in
*darwin10.*)
@ -417,23 +418,30 @@ case "$host" in
APR_ADDTO(CXXFLAGS, -pipe)
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
if test "x$enable_core_odbc_support" != "xno"; then
APR_ADDTO(PLATFORM_CORE_DEPLIBS, --framework CoreFoundation)
APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
fi
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
;;
*darwin*)
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
if test "x$enable_core_odbc_support" != "xno"; then
APR_ADDTO(PLATFORM_CORE_DEPLIBS, --framework CoreFoundation)
APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
fi
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
;;
*-solaris2*)
APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048 -D__EXTENSIONS__)
APR_ADDTO(SWITCH_AM_LDFLAGS, -lsendfile -lresolv -lsocket -lnsl -luuid)
APR_ADDTO(ESL_LDFLAGS, -lnsl -lsocket)
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt -lsendfile -lresolv -lsocket -lnsl -luuid])
;;
*bsd*)
APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
;;
*linux*)
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
;;
esac
@ -444,7 +452,8 @@ AC_SUBST(SWITCH_ANSI_CFLAGS)
AC_SUBST(SWITCH_AM_CXXFLAGS)
AC_SUBST(SWITCH_AM_LDFLAGS)
AC_SUBST(ESL_LDFLAGS)
AC_SUBST(PLATFORM_CORE_DEPLIBS)
AC_SUBST(PLATFORM_CORE_LDFLAGS)
AC_SUBST(PLATFORM_CORE_LIBS)
AC_SUBST(SOLINK)
AC_SUBST(DYNAMIC_LIB_EXTEN)
AC_SUBST(LIBTOOL_LIB_EXTEN)