Hi,

after some digging, I've modified configure.in against PHP_4_2_0.
The patch resolves all issues mentioned in the bugreport.

I saw something fly by in configure, which checks the include type of
make, but that isn't working correctly or overridden by the hardcoded
section, so that fix should probably be looked at more closely.

INET_ATON is a modification of the code used in bind-9.2.0.
The res_search I fixed myself.

I allowed linking of INET_ATON first, then see if native is available.
With res_search I did the opposite, since it doesn't need any linking and
if INET_ATON was linked with libbind/libisc already, this still would
work.
The combination allows:
- A linked libbind/libisc which ensures functions are linked against a
locally installed nameserver. (requires shared libbind)
- Use of native functions inet_aton and res_search.

The native res_search doesn't search for an external dn_skipname, since
that's also native.

I hope you can commit this on the PHP_4_2_0 tree, cause that will make php
compile out-of-the-box and have getmxrr() capabilities on a BSDi 4.x host.

buildconf has been tested with autoconf 2.52 and libtool 1.4.

Best regards,

Melvyn Sopacua
Index: configure.in
===================================================================
RCS file: /repository/php4/configure.in,v
retrieving revision 1.302
diff -u -r1.302 configure.in
--- configure.in        2 Mar 2002 14:33:25 -0000       1.302
+++ configure.in        17 Mar 2002 15:33:16 -0000
@@ -94,7 +94,10 @@
 *darwin*|*rhapsody*)
     CPPFLAGS="$CPPFLAGS -traditional-cpp";;
 *bsdi*)
-    BSD_MAKEFILE=yes;;
+    if test "GNU" != `${MAKE} --version | sed -n -e "s|^GNU.*|GNU|p"`; then
+        BSD_MAKEFILE=yes
+    fi
+    ;;
 *beos*)
     beos_threads=1
     LIBS="$LIBS -lbe -lroot";;
@@ -315,34 +318,72 @@
 
 dnl Only include libbind if inet_aton is not found in 
 dnl libresolv.
+dnl As of bind9, a shared libbind requires libisc.
+dnl BSDi 4.4 has inet_aton in libc.
 AC_CHECK_LIB(resolv, inet_aton, [], [
   AC_CHECK_LIB(bind, inet_aton, [], [
-    AC_CHECK_LIB(bind, __inet_aton)
+    AC_CHECK_LIB(bind, __inet_aton, [], [
+      AC_CHECK_LIB(bind, inet_aton, [], [
+        AC_MSG_CHECKING([for inet_aton])
+        AC_TRY_LINK([
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>],
+          [struct in_addr in; inet_aton(0, &in); return (0);],
+          [AC_MSG_RESULT(yes)
+           AC_DEFINE(HAVE_INET_ATON,1,[ ])
+          ],
+          [AC_MSG_RESULT(no)]
+        )
+      ],-lisc)
+    ])
   ])
 ])
 
 dnl The res_search may be in libsocket as well, and if it is
 dnl make sure to check for dn_skipname in libresolv, or if res_search
 dnl is in neither of these libs, still check for dn_skipname in libresolv
-AC_CHECK_LIB(socket, res_search, [
- AC_CHECK_LIB(resolv, dn_skipname)
- AC_CHECK_LIB(resolv, __dn_skipname)
- LIBS="$LIBS -lsocket"
- AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
- AC_CHECK_LIB(resolv, res_search, [
-  LIBS="$LIBS -lresolv"
-  AC_DEFINE(HAVE_LIBRESOLV,1,[ ]) 
- ], [
-  AC_CHECK_LIB(resolv, dn_skipname)
-  AC_CHECK_LIB(resolv, __dn_skipname)
- ]) 
-])
-
+dnl There are systems (BSDi4.x) with a native res_search. Check these
+dnl first, so no linking is necessary.
 
+AC_MSG_CHECKING([for native res_search])
+AC_TRY_LINK([
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>],
+        [
+const char host[7]="php.net";
+u_char ans[1024];
+int r;
+res_init();
+/* Capture result in r but return 0, since a working nameserver is
+ * not a requirement for compilation.
+ */
+r =  res_search( host, C_IN, T_MX, (u_char *)&ans, sizeof(ans));
+return 0;
+res_close();
+        ],
+        [AC_MSG_RESULT(yes)
+         AC_DEFINE(HAVE_RES_SEARCH,1,[ ])],
+        [AC_MSG_RESULT(no)
+         AC_CHECK_LIB(socket, res_search, [
+           AC_CHECK_LIB(resolv, dn_skipname)
+           AC_CHECK_LIB(resolv, __dn_skipname)
+           LIBS="$LIBS -lsocket"
+           AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
+           AC_CHECK_LIB(resolv, res_search, [
+             LIBS="$LIBS -lresolv"
+             AC_DEFINE(HAVE_LIBRESOLV,1,[ ]) 
+        ], [
+         AC_CHECK_LIB(resolv, dn_skipname)
+         AC_CHECK_LIB(resolv, __dn_skipname)
+       ])
+])
+])
 
 dnl Then headers.
 dnl -------------------------------------------------------------------------
-
 dnl Checks for header files.
 AC_HEADER_STDC
 
-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to