]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix for solaris openzap from stkn
authorMichael Jerris <mike@jerris.com>
Mon, 26 May 2008 23:53:19 +0000 (23:53 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 26 May 2008 23:53:19 +0000 (23:53 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@486 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/configure.ac
libs/freetdm/src/ss7_boost_client.c

index 2931a4f2621d3b6427911f73d0c1781dba57686a..ec7e935dfbcac126c10f39f99d8ca74c44369b06 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([openzap],[pre-alpha],[bugs@freeswitch.prg])
+AC_INIT([openzap],[pre-alpha],[bugs@freeswitch.org])
 AC_CONFIG_SRCDIR([src/libteletone_detect.c])
 
 # Checks for programs.
@@ -26,7 +26,7 @@ AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compile
   done
  ])
 ])
-AC_ARG_ENABLE(enable_64,  [  --enable-64 Enable 64bit compilation])
+AC_ARG_ENABLE([enable_64], [AS_HELP_STRING([--enable-64], [Enable 64bit compilation])], [enable_64="$enableval"], [enable_64="no"])
 
 AX_COMPILER_VENDOR
 
@@ -46,11 +46,32 @@ sun)
 esac
 
 AC_CHECK_HEADERS([netinet/sctp.h netdb.h])
-AC_CHECK_FUNCS([gethostbyname_r]) 
+AC_CHECK_FUNC([gethostbyname_r],
+       [], [AC_CHECK_LIB([nsl], [gethostbyname_r])]
+)
+if test "$ac_cv_func_gethostbyname_r" = "yes" -o "$ac_cv_lib_nsl_gethostbyname_r" = "yes" ; then
+
+AC_MSG_CHECKING([whether gethostbyname_r requires five arguments])
+
+ac_cv_func_gethostbyname_r_five_args="no"
+
+AC_TRY_COMPILE([#include <netdb.h>],
+       [char *name;
+        struct hostent *he, *res;
+        char buffer[2048];
+        int buflen = 2048;
+        (void)gethostbyname_r(name, he, buffer, buflen, &res)],
+       [ac_cv_func_gethostbyname_r_five_args="yes"
+         AC_DEFINE([HAVE_GETHOSTBYNAME_R_FIVE], [1], [gethostbyname_r has five arguments])]
+)
+
+    AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args])
+    AC_DEFINE([HAVE_GETHOSTBYNAME_R],[1],[threadsafe gethostbyname])
+fi
 
 #  Enable debugging
 AC_ARG_ENABLE(debug,
-[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enable_debug"],[enable_debug="yes"])
+[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
 
 if test "${enable_debug}" = "yes"; then
         AC_DEFINE([DEBUG],[],[Enable extra debugging.])
index 75d274cfaffb05202bac5257972e3ba36e8a1c89..f12f1018a87e37a8b45f14a7773761e2bf259062 100644 (file)
@@ -74,7 +74,7 @@ static int create_conn_socket(ss7bc_connection_t *mcon, char *local_ip, int loca
        int rc;
        struct hostent *result, *local_result;
        char buf[512], local_buf[512];
-       int err = 0;
+       int err = 0, local_err = 0;
 
        memset(&mcon->remote_hp, 0, sizeof(mcon->remote_hp));
        memset(&mcon->local_hp, 0, sizeof(mcon->local_hp));
@@ -91,9 +91,15 @@ static int create_conn_socket(ss7bc_connection_t *mcon, char *local_ip, int loca
                int flag;
 
                flag = 1;
+#ifdef HAVE_GETHOSTBYNAME_R_FIVE
+               gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &err);
+               gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_err);
+               if (!err && !local_err) {
+#else
                gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &result, &err);
-               gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_result, &err);
+               gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_result, &local_err);
                if (result && local_result) {
+#endif
                        mcon->remote_addr.sin_family = mcon->remote_hp.h_addrtype;
                        memcpy((char *) &mcon->remote_addr.sin_addr.s_addr, mcon->remote_hp.h_addr_list[0], mcon->remote_hp.h_length);
                        mcon->remote_addr.sin_port = htons(port);