diff --git a/configure.ac b/configure.ac index 5c79f3cfd3..a106e1eedd 100644 --- a/configure.ac +++ b/configure.ac @@ -440,7 +440,8 @@ if test "x${COMPILE_JNI}" = xyes; then AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t])) AC_SEARCH_LIBS([clock_gettime], [rt]) - AC_SEARCH_LIBS([inet_pton],[nsl]) + dnl Haiku has the socket functions and h_errno in libnetwork. + AC_SEARCH_LIBS([inet_pton],[nsl network]) AC_CHECK_LIB([socket], [gethostname]) AC_CHECK_FUNCS([ftruncate fsync select \ diff --git a/native/jni/java-net/java_net_VMNetworkInterface.c b/native/jni/java-net/java_net_VMNetworkInterface.c index 658299733e..90da75857c 100644 --- a/native/jni/java-net/java_net_VMNetworkInterface.c +++ b/native/jni/java-net/java_net_VMNetworkInterface.c @@ -51,6 +51,11 @@ exception statement from your version. */ #include #include + +/* Haiku does not define IFF_RUNNING. */ +#ifndef IFF_RUNNING +#define IFF_RUNNING 0x40 +#endif #include /* Required on Solaris. */ #include diff --git a/native/jni/native-lib/cpnet.c b/native/jni/native-lib/cpnet.c index 534eaa46ed..eeced7d6a2 100644 --- a/native/jni/native-lib/cpnet.c +++ b/native/jni/native-lib/cpnet.c @@ -645,7 +645,12 @@ jint cpnet_getHostByName (JNIEnv *env, const char *hostname, cpnet_address ***ad { buf = (char *)JCL_malloc(env, buflen); -#ifdef HAVE_GETHOSTBYNAME_R +/* Use gethostbyname_r only if its declaration was found. Haiku has the + function in libnetwork but does not declare it. */ +#if defined(HAVE_GETHOSTBYNAME_R) \ + && (defined(HAVE_FUNC_GETHOSTBYNAME_R_6) \ + || defined(HAVE_FUNC_GETHOSTBYNAME_R_5) \ + || defined(HAVE_FUNC_GETHOSTBYNAME_R_3)) # if defined(HAVE_FUNC_GETHOSTBYNAME_R_6) ret = gethostbyname_r (hostname, &hret, buf, buflen, &result, &herr); # elif defined(HAVE_FUNC_GETHOSTBYNAME_R_5)