diff --git a/configure.ac b/configure.ac index a311afe34..fda85dd08 100644 --- a/configure.ac +++ b/configure.ac @@ -759,13 +759,15 @@ AM_CONDITIONAL(ENABLE_TESTS, test x$tests_enabled = xyes) PKG_CHECK_MODULES(CUNIT, cunit, [found_cunit=yes],[found_cunit=no]) if test "$found_cunit" = "no" ; then - AC_CHECK_HEADERS(CUnit/CUnit.h, - [ - found_cunit=yes - CUNIT_LIBS="-lcunit" - ]) -fi + AC_CHECK_HEADERS(CUnit/CUnit.h, + [ + AC_CHECK_LIB(cunit,CU_add_suite,[ + found_cunit=yes + CUNIT_LIBS+=" -lcunit" + ]) + ]) +fi case "$target_os" in *darwin*) @@ -774,7 +776,16 @@ case "$target_os" in ;; esac AM_CONDITIONAL([BUILD_CUNIT_TESTS], [test x$found_cunit = xyes && test x$enable_tests != xno]) - +if test "$found_cunit" = "no" ; then + AC_MSG_WARN([Could not find cunit framework, tests are not compiled.]) +else + AC_CHECK_LIB(cunit,CU_get_suite,[ + AC_DEFINE(HAVE_CU_GET_SUITE,1,[defined when CU_get_suite is available]) + ],[foo=bar],[$CUNIT_LIBS]) + AC_CHECK_LIB(cunit,CU_curses_run_tests,[ + AC_DEFINE(HAVE_CU_CURSES,1,[defined when CU_curses_run_tests is available]) + ],[foo=bar],[$CUNIT_LIBS]) +fi dnl ################################################## diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 83073578b..0ef2250df 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -237,46 +237,46 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even sal_op_set_contact_address(op,(const SalAddress *)contact_address); belle_sip_object_unref(contact_address); } + if (sal_op_get_contact(op)){ + if (received!=NULL || rport>0) { - if (received!=NULL || rport>0) { - if (sal_op_get_contact(op)){ contact_address = BELLE_SIP_HEADER_ADDRESS(sal_address_clone(sal_op_get_contact_address(op))); - } - contact_uri=belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(contact_address)); - if (received && strcmp(received,belle_sip_uri_get_host(contact_uri))!=0) { - /*need to update host*/ - belle_sip_uri_set_host(contact_uri,received); - contact_updated=TRUE; - } - contact_port = belle_sip_uri_get_port(contact_uri); - if (rport>0 && rport!=contact_port && (contact_port+rport)!=5060) { - /*need to update port*/ - belle_sip_uri_set_port(contact_uri,rport); - contact_updated=TRUE; - } + contact_uri=belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(contact_address)); + if (received && strcmp(received,belle_sip_uri_get_host(contact_uri))!=0) { + /*need to update host*/ + belle_sip_uri_set_host(contact_uri,received); + contact_updated=TRUE; + } + contact_port = belle_sip_uri_get_port(contact_uri); + if (rport>0 && rport!=contact_port && (contact_port+rport)!=5060) { + /*need to update port*/ + belle_sip_uri_set_port(contact_uri,rport); + contact_updated=TRUE; + } - /*try to fix transport if needed (very unlikely)*/ - if (strcasecmp(belle_sip_header_via_get_transport(via_header),"UDP")!=0) { - if (!belle_sip_uri_get_transport_param(contact_uri) - ||strcasecmp(belle_sip_uri_get_transport_param(contact_uri),belle_sip_header_via_get_transport(via_header))!=0) { - belle_sip_uri_set_transport_param(contact_uri,belle_sip_header_via_get_transport_lowercase(via_header)); - contact_updated=TRUE; + /*try to fix transport if needed (very unlikely)*/ + if (strcasecmp(belle_sip_header_via_get_transport(via_header),"UDP")!=0) { + if (!belle_sip_uri_get_transport_param(contact_uri) + ||strcasecmp(belle_sip_uri_get_transport_param(contact_uri),belle_sip_header_via_get_transport(via_header))!=0) { + belle_sip_uri_set_transport_param(contact_uri,belle_sip_header_via_get_transport_lowercase(via_header)); + contact_updated=TRUE; + } + } else { + if (belle_sip_uri_get_transport_param(contact_uri)) { + contact_updated=TRUE; + belle_sip_uri_set_transport_param(contact_uri,NULL); + } } - } else { - if (belle_sip_uri_get_transport_param(contact_uri)) { - contact_updated=TRUE; - belle_sip_uri_set_transport_param(contact_uri,NULL); + if (contact_updated) { + char* old_contact=belle_sip_object_to_string(BELLE_SIP_OBJECT(sal_op_get_contact_address(op))); + new_contact=belle_sip_object_to_string(BELLE_SIP_OBJECT(contact_address)); + ms_message("Updating contact from [%s] to [%s] for [%p]",old_contact,new_contact,op); + sal_op_set_contact_address(op,(const SalAddress *)contact_address); + belle_sip_free(new_contact); + belle_sip_free(old_contact); } + if (contact_address)belle_sip_object_unref(contact_address); } - if (contact_updated) { - char* old_contact=belle_sip_object_to_string(BELLE_SIP_OBJECT(sal_op_get_contact_address(op))); - new_contact=belle_sip_object_to_string(BELLE_SIP_OBJECT(contact_address)); - ms_message("Updating contact from [%s] to [%s] for [%p]",old_contact,new_contact,op); - sal_op_set_contact_address(op,(const SalAddress *)contact_address); - belle_sip_free(new_contact); - belle_sip_free(old_contact); - } - if (contact_address)belle_sip_object_unref(contact_address); } } /*update request/response diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 9e411ef54..d3997526d 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -20,6 +20,9 @@ #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" +#if HAVE_CU_CURSES +#include "CUnit/CUCurses.h" +#endif static test_suite_t **test_suite = NULL;