From d2cf6821b8edf6ed5bf8f3b10fe5b2aa589a4e38 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Fri, 3 Nov 2017 21:55:20 +0900 Subject: [PATCH] fix the library dependency --- configure.ac | 45 ++++++-------------- lib/base/Makefile.am | 2 + lib/core/src/Makefile.am | 3 +- lib/freeDiameter-1.2.1/configure.ac | 33 ++++++++++---- lib/freeDiameter-1.2.1/libfdcore/Makefile.am | 2 + 5 files changed, 45 insertions(+), 40 deletions(-) diff --git a/configure.ac b/configure.ac index 0d3d54ab4..87c15bb84 100644 --- a/configure.ac +++ b/configure.ac @@ -381,43 +381,26 @@ AC_CHECK_FUNCS(\ sched_yield \ ) -AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket)) -AC_CHECK_FUNCS(inet_addr, , AC_CHECK_LIB(nsl, inet_addr)) +AC_SUBST(CORE_LIBS) +AC_SEARCH_LIBS(gethostbyname, nsl) +AC_SEARCH_LIBS(gethostname, nsl) +AC_SEARCH_LIBS(socket, socket) +AC_SEARCH_LIBS([pthread_mutex_init], pthread) -AC_CHECK_LIB([pthread], [pthread_mutex_init], [LIBS="${LIBS} -lpthread"]) -AC_CHECK_LIB([dl], [dlopen], [LIBS="${LIBS} -ldl"]) -AC_CHECK_LIB([sctp], [sctp_sendmsg], [have_sctp_lib=yes], [have_sctp_lib=no]) -if test "$have_sctp_lib" == "yes"; then - LIBS="${LIBS} -lsctp" -else - AC_CHECK_LIB([usrsctp], [usrsctp_init], [have_usrsctp_lib=yes], [have_usrsctp_lib=no]) - if test "$have_usrsctp_lib" == "yes"; then - LIBS="${LIBS} -lusrsctp" +AC_SEARCH_LIBS([sctp_sendmsg], [sctp], [have_sctp_lib=yes], [have_sctp_lib=no]) +if test x$have_sctp_lib == xno; then + AC_SEARCH_LIBS([usrsctp_init], [usrsctp], [have_usrsctp_lib=yes], [have_usrsctp_lib=no]) + if test x$have_usrsctp_lib == xno; then + AC_MSG_ERROR([You must install the SCTP libraries and development headers to enable SCTP support.]) + else AC_DEFINE([USE_USRSCTP], [1], [Define to 1 if you have the usrsctp library.]) fi fi AM_CONDITIONAL([USRSCTP], [test x$have_usrsctp_lib = xyes]) -AC_CHECK_LIB([gnutls], [gnutls_global_init], [have_gnutls_lib=yes], [have_gnutls_lib=no]) -if test "$have_gnutls_lib" == "yes"; then - LIBS="${LIBS} -lgnutls" -else - AC_MSG_ERROR([You must install the GnuTLS libraries and development headers to enable GnuTLS support.]) -fi -AC_CHECK_LIB([gcrypt], [gcry_control], [have_gcrypt_lib=yes], [have_gcrypt_lib=no]) -if test "$have_gcrypt_lib" == "yes"; then - LIBS="${LIBS} -lgcrypt" -else - AC_MSG_ERROR([You must install the Libgcrypt libraries and development headers to enable Libgcrypt support.]) -fi -AC_CHECK_LIB([idn], [idna_strerror], [have_idn_lib=yes], [have_idn_lib=no]) -if test "$have_idn_lib" == "yes"; then - LIBS="${LIBS} -lidn" -else - AC_MSG_ERROR([You must install the GNU Libidn libraries and development headers to enable GNU Libidn support.]) -fi +CORE_LIBS="$LIBS" +LIBS="" PKG_CHECK_MODULES([MONGOC], libmongoc-1.0 >= 1.3.1) -LIBS="$LIBS $MONGOC_LIBS" FREEDIAMETER_DIR=freeDiameter-1.2.1 AC_SUBST(FREEDIAMETER_DIR) @@ -492,7 +475,7 @@ host : ${host} source code location : ${srcdir} compiler : ${CC} compiler flags : ${CFLAGS} -linker flags : ${LDFLAGS} ${LIBS} +linker flags : ${LDFLAGS} ${CORE_LIBS} ${MONGOC_LIBS} bin directory : ${BIN_DIR} lib directory : ${LIB_DIR}/nextepc config directory : ${SYSCONF_DIR}/nextepc diff --git a/lib/base/Makefile.am b/lib/base/Makefile.am index dc76dfdd9..e718f4dcc 100644 --- a/lib/base/Makefile.am +++ b/lib/base/Makefile.am @@ -6,6 +6,8 @@ libbase_la_SOURCES = \ types.h context.h \ types.c context.c +libbase_la_LIBADD = @MONGOC_LIBS@ + AM_CPPFLAGS = \ -I$(top_srcdir)/lib/core/include \ @MONGOC_CFLAGS@ diff --git a/lib/core/src/Makefile.am b/lib/core/src/Makefile.am index f92c3760d..27721cd59 100644 --- a/lib/core/src/Makefile.am +++ b/lib/core/src/Makefile.am @@ -27,7 +27,8 @@ libcore_la_DEPENDENCIES = \ $(top_srcdir)/lib/core/src/@OSDIR@/libcore@OSDIR@.la libcore_la_LIBADD = \ - $(top_srcdir)/lib/core/src/@OSDIR@/libcore@OSDIR@.la + $(top_srcdir)/lib/core/src/@OSDIR@/libcore@OSDIR@.la \ + @CORE_LIBS@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/core/include/arch/@OSDIR@ \ diff --git a/lib/freeDiameter-1.2.1/configure.ac b/lib/freeDiameter-1.2.1/configure.ac index e4e5b04ef..edbbf0b2f 100644 --- a/lib/freeDiameter-1.2.1/configure.ac +++ b/lib/freeDiameter-1.2.1/configure.ac @@ -131,29 +131,46 @@ AC_SUBST(PREFIX) AC_CHECK_FUNCS([strndup]) + AC_CHECK_DECL([ntohll],[AC_DEFINE([HAVE_NTOHLL], [1], [Define to 1 if you have ntohll.])]) -AC_CHECK_LIB([rt], [clock_gettime], +AC_CHECK_DECL([AI_ADDRCONFIG], + [AC_DEFINE([HAVE_AI_ADDRCONFIG], [1], [Define AI_ADDRCONFIG])], [], [[#include ]]) + +AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define clock_gettime])]) -AC_CHECK_LIB([pthread], [pthread_barrier_wait], +AC_SEARCH_LIBS([pthread_barrier_wait], [pthread], [AC_DEFINE([HAVE_PTHREAD_BAR], [1], [Define to 1 if you have pthread_barrier_wait in libpthread])], []) -AC_CHECK_DECL([AI_ADDRCONFIG], - [AC_DEFINE([HAVE_AI_ADDRCONFIG], [1], [Define AI_ADDRCONFIG])], [], [[#include ]]) -AC_CHECK_LIB([gnutls], [gnutls_hash], +AC_SEARCH_LIBS([dlopen], [dl dld]) + +AC_SEARCH_LIBS([gnutls_global_init], [gnutls],, [have_gnutls_lib=no]) +if test x$have_gnutls_lib == xno; then + AC_MSG_ERROR([You must install the GnuTLS libraries and development headers to enable GnuTLS support.]) +fi +AC_SEARCH_LIBS([gnutls_hash], [gnutls], [AC_DEFINE(GNUTLS_VERSION_210, 1, [Define to 1 if you have gnutls 2.10 installed])], []) -AC_CHECK_LIB([gnutls], [gnutls_transport_set_vec_push_function], +AC_SEARCH_LIBS([gnutls_transport_set_vec_push_function], [gnutls], [AC_DEFINE(GNUTLS_VERSION_212, 1, [Define to 1 if you have gnutls 2.10 installed])], []) -AC_CHECK_LIB([gnutls], [gnutls_x509_trust_list_verify_crt], +AC_SEARCH_LIBS([gnutls_x509_trust_list_verify_crt], [gnutls], [AC_DEFINE(GNUTLS_VERSION_300, 1, [Define to 1 if you have gnutls 3.0 installed])], []) -AC_CHECK_LIB([gnutls], [gnutls_handshake_set_timeout], +AC_SEARCH_LIBS([gnutls_handshake_set_timeout], [gnutls], [AC_DEFINE(GNUTLS_VERSION_310, 1, [Define to 1 if you have gnutls 3.1 installed])], []) +AC_SEARCH_LIBS([gcry_control], [gcrypt],, [have_gcrypt_lib=no]) +if test x$have_gcrypt_lib == xno; then + AC_MSG_ERROR([You must install the Libgcrypt libraries and development headers to enable Libgcrypt support.]) +fi +AC_SEARCH_LIBS([idna_strerror], [idn],, [have_idn_lib=no]) +if test x$have_idn_lib == xno; then + AC_MSG_ERROR([You must install the GNU Libidn libraries and development headers to enable GNU Libidn support.]) +fi + AC_CACHE_CHECK([whether sctp_connectx function accepts 4 arguments], [ap_cv_sctp_connectx], [AC_TRY_COMPILE( diff --git a/lib/freeDiameter-1.2.1/libfdcore/Makefile.am b/lib/freeDiameter-1.2.1/libfdcore/Makefile.am index 71fb164d6..bbab8d6cf 100644 --- a/lib/freeDiameter-1.2.1/libfdcore/Makefile.am +++ b/lib/freeDiameter-1.2.1/libfdcore/Makefile.am @@ -10,6 +10,8 @@ libfdcore_la_SOURCES = \ p_out.c p_psm.c p_sr.c routing_dispatch.c server.c tcp.c \ fdd.tab.y lex.fdd.l version.c +libfdcore_la_LIBADD = $(LIBS) + if SCTP libfdcore_la_SOURCES += sctp.c sctp3436.c endif