Author: gonzalo
Date: 2005-12-08 20:19:00 -0500 (Thu, 08 Dec 2005)
New Revision: 54141

Modified:
   trunk/mod_mono/ChangeLog
   trunk/mod_mono/configure.in
   trunk/mod_mono/src/mod_mono.c
   trunk/mod_mono/src/mod_mono.h
Log:
2005-12-08 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * configure.in:
        * src/mod_mono.[ch]: now apache 2.2 is supported.



Modified: trunk/mod_mono/ChangeLog
===================================================================
--- trunk/mod_mono/ChangeLog    2005-12-09 01:18:46 UTC (rev 54140)
+++ trunk/mod_mono/ChangeLog    2005-12-09 01:19:00 UTC (rev 54141)
@@ -1,5 +1,10 @@
 2005-12-08 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
+       * configure.in:
+       * src/mod_mono.[ch]: now apache 2.2 is supported.
+
+2005-12-08 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
        * src/mod_mono.c: patch by Dean Brettle that fixes chunked encoding
        support.
 

Modified: trunk/mod_mono/configure.in
===================================================================
--- trunk/mod_mono/configure.in 2005-12-09 01:18:46 UTC (rev 54140)
+++ trunk/mod_mono/configure.in 2005-12-09 01:19:00 UTC (rev 54141)
@@ -107,23 +107,8 @@
   else
     AC_MSG_RESULT(no)
   fi
-else
-  if test -z "$APRCONFIG" ; then
-    APRCONFIG=`dirname ${APXS}`/apr-config
-  fi
 fi
 
-if test -z "$APRCONFIG"; then
-  AC_MSG_CHECKING(for apr-config in /usr/local/apache/sbin)
-  if test -x /usr/local/apache/sbin/apr-config; then
-    APRCONFIG=/usr/local/apache/sbin/apr-config
-    AC_MSG_RESULT([found, we'll use this. Use --with-apr-config to specify 
another.])    
-  else
-    AC_MSG_RESULT(no)
-    APRCONFIG=""
-  fi
-fi
-
 if test -z "$APXS"; then
   AC_MSG_CHECKING(for apxs2 in /usr/local/apache2/bin)
   if test -x /usr/local/apache/bin/apxs2; then
@@ -144,17 +129,6 @@
   fi
 fi
 
-if test -z "$APRCONFIG"; then
-  AC_MSG_CHECKING(for apr-config in /usr/local/apache2/bin)
-  if test -x /usr/local/apache2/bin/apr-config; then
-    APRCONFIG=/usr/local/apache2/bin/apr-config
-    AC_MSG_RESULT([found, we'll use this. Use --with-apr-config to specify 
another.])
-  else
-    AC_MSG_RESULT(no)
-    APRCONFIG=""
-  fi
-fi
-
 if test -z "$APXS"; then
   AC_MSG_CHECKING(for apxs2 in /usr/sbin)
   if test -x /usr/sbin/apxs2; then
@@ -174,18 +148,6 @@
     AC_MSG_RESULT(no)
   fi
 fi
-
-if test -z "$APRCONFIG"; then
-  AC_MSG_CHECKING(for apr-config in /usr/sbin)
-  if test -x /usr/sbin/apr-config; then
-    APRCONFIG=/usr/sbin/apr-config
-    AC_MSG_RESULT([found, we'll use this. Use --with-apr-config to specify 
another.])
-  else
-    AC_MSG_RESULT(no)
-    APRCONFIG=""
-  fi
-fi
-
 # last resort
 if test -z "$APXS"; then
   AC_PATH_PROG(APXS, apxs2)
@@ -199,10 +161,6 @@
   AC_MSG_ERROR([**** apxs was not found, DSO compilation will not be 
available.])
 fi
 
-if test -z "$APRCONFIG"; then
-  AC_PATH_PROG(APRCONFIG, apr-config)
-fi
-
 # determine LIBEXEC
 AC_MSG_CHECKING(for Apache libexec directory)
 APXS_LIBEXECDIR=`${APXS} -q LIBEXECDIR`
@@ -220,7 +178,7 @@
 
 AC_MSG_CHECKING([Apache version])
 AC_TRY_COMPILE([
-       #include <httpd.h>
+       #include <ap_release.h>
 ], [
        char *version = AP_SERVER_BASEREVISION;
 ], [
@@ -240,9 +198,74 @@
        ], [
                APACHE_VER=retry
        ])
+else
+AC_TRY_RUN([
+       #include <ap_release.h>
+       int main ()
+       {
+               return (AP_SERVER_MAJORVERSION_NUMBER == 2 && 
AP_SERVER_MINORVERSION_NUMBER == 2) ? 0 : 1;
+       }
+], [
+       APACHE_VER=2.2
+       APRCONFIG_NAME=apr-1-config
+], [
+       APRCONFIG_NAME=apr-config
+])
+
 fi
 
-# Try apr-config
+if test ! "$APACHE_VER" = "1.3" -a ! "$APACHE_VER" = "retry" ; then
+       AC_MSG_RESULT(${APACHE_VER})
+fi
+if test ! "$APACHE_VER" = "1.3" -a -z "$APRCONFIG" ; then
+   A_DIR=`dirname ${APXS}`
+   AC_MSG_CHECKING(for ${APRCONFIG_NAME} in ${A_DIR})
+   APRCONFIG=`dirname ${APXS}`/${APRCONFIG_NAME}
+   if test -x $APRCONFIG ; then
+      AC_MSG_RESULT([found. We'll use this. Use --with-apr-config to specify 
another.])
+   else
+      AC_MSG_RESULT(no)
+   fi
+fi
+
+if test ! "$APACHE_VER" = "1.3" -a -z "$APRCONFIG"; then
+  AC_MSG_CHECKING(for ${APRCONFIG_NAME} in /usr/local/apache/sbin)
+  if test -x /usr/local/apache/sbin/${APRCONFIG_NAME}; then
+    APRCONFIG=/usr/local/apache/sbin/${APRCONFIG_NAME}
+    AC_MSG_RESULT([found, we'll use this. Use --with-apr-config to specify 
another.])    
+  else
+    AC_MSG_RESULT(no)
+    APRCONFIG=""
+  fi
+fi
+
+if test ! "$APACHE_VER" = "1.3" -a -z "$APRCONFIG"; then
+  AC_MSG_CHECKING(for ${APRCONFIG_NAME} in /usr/local/apache2/bin)
+  if test -x /usr/local/apache2/bin/${APRCONFIG_NAME}; then
+    APRCONFIG=/usr/local/apache2/bin/${APRCONFIG_NAME}
+    AC_MSG_RESULT([found, we'll use this. Use --with-apr-config to specify 
another.])
+  else
+    AC_MSG_RESULT(no)
+    APRCONFIG=""
+  fi
+fi
+
+if test ! "$APACHE_VER" = "1.3" -a -z "$APRCONFIG"; then
+  AC_MSG_CHECKING(for ${APRCONFIG_NAME} in /usr/sbin)
+  if test -x /usr/sbin/${APRCONFIG_NAME}; then
+    APRCONFIG=/usr/sbin/${APRCONFIG_NAME}
+    AC_MSG_RESULT([found, we'll use this. Use --with-apr-config to specify 
another.])
+  else
+    AC_MSG_RESULT(no)
+    APRCONFIG=""
+  fi
+fi
+
+if test ! "$APACHE_VER" = "1.3" -a -z "$APRCONFIG"; then
+  AC_PATH_PROG(APRCONFIG, ${APRCONFIG_NAME})
+fi
+
+# Try apr-config, probably 1.3
 if test "$APACHE_VER" = "retry" -a -x "$APRCONFIG"; then
        CFLAGS="$CFLAGS `$APRCONFIG --includes`"
        AC_TRY_COMPILE([
@@ -262,11 +285,9 @@
 
 if test "$APACHE_VER" = "1.3"; then
        CFLAGS="$CFLAGS -DAPACHE13 -DEAPI"
+       AC_MSG_RESULT($APACHE_VER)
 fi
 
-AC_MSG_RESULT($APACHE_VER)
-
-
 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 if test "x$PKG_CONFIG" = "xno"; then
         AC_MSG_ERROR([You need to install pkg-config])
@@ -285,12 +306,16 @@
         fi
 )
 
-AM_CONDITIONAL(APACHE2, test "$APACHE_VER" = "2.0")
-if test "$APACHE_VER" = "2.0" ; then
+AM_CONDITIONAL(APACHE2, test ! "$APACHE_VER" = "1.3")
+if test ! "$APACHE_VER" = "1.3" ; then
 dnl Sources are recompiled if we change the target version
-       AC_DEFINE([APACHE2],,[Compiling for Apache 2.0])
+       AC_DEFINE([APACHE2],,[Compiling for Apache >= 2.0 ])
 fi
 
+if test "$APACHE_VER" = "2.2" ; then
+       AC_DEFINE([APACHE22],,[Compiling for Apache >= 2.2 ])
+fi
+
 # check for --with-mono-default-config-dir
 AC_MSG_CHECKING(for --with-mono-default-config-dir)
 DFLT_MONO_CONFIG_DIR=`$APXS -q SYSCONFDIR`/mod-mono-applications
@@ -307,10 +332,16 @@
 ],
 AC_MSG_RESULT($DFLT_MONO_CONFIG_DIR))
 
-found_apr_socket_connect=no
-AC_CHECK_LIB(apr-0, apr_socket_connect, found_apr_socket_connect=yes)
-if test "x$found_apr_socket_connect" = "xyes" ; then
-       AC_DEFINE([HAVE_APR_SOCKET_CONNECT],,[apr_socket_connect is present])
+if test ! "$APACHE_VER" = "1.3" ; then
+   found_apr_socket_connect=yes
+   AC_DEFINE([HAVE_APR_SOCKET_CONNECT],,[apr_socket_connect is present])
+else
+   found_apr_socket_connect=no
+   AC_CHECK_LIB(apr-0, apr_socket_connect, found_apr_socket_connect=yes)
+   if test "x$found_apr_socket_connect" = "xyes" ; then
+      AC_DEFINE([HAVE_APR_SOCKET_CONNECT],,[apr_socket_connect is present])
+   fi
+
 fi
 
 MONO_PREFIX=`$PKG_CONFIG --silence-errors --variable=prefix mono`
@@ -370,7 +401,7 @@
 echo "   * Apache modules directory = $APXS_LIBEXECDIR"
 test -x "$APXS" && \
 echo "   * apxs = $APXS"
-test "$APACHE_VER" = "2.0" -a -x "$APRCONFIG" && \
+test ! "$APACHE_VER" = "1.3" -a -x "$APRCONFIG" && \
 echo "   * apr-config = $APRCONFIG"
 echo "   * Verbose logging (debug) = $enable_debug"
 echo "   * mono prefix = $MONO_PREFIX"

Modified: trunk/mod_mono/src/mod_mono.c
===================================================================
--- trunk/mod_mono/src/mod_mono.c       2005-12-09 01:18:46 UTC (rev 54140)
+++ trunk/mod_mono/src/mod_mono.c       2005-12-09 01:19:00 UTC (rev 54141)
@@ -329,6 +329,8 @@
 { 
 #ifdef APACHE13
        return  ntohs (c->remote_addr.sin_port);
+#elif defined(APACHE22)
+       return c->remote_addr->port;
 #else
        apr_port_t port;
        apr_sockaddr_port_get (&port, c->remote_addr);
@@ -342,6 +344,8 @@
 {
 #ifdef APACHE13  
        return ap_get_server_port (r);
+#elif defined(APACHE22)
+       return r->connection->local_addr->port;
 #else
        apr_port_t port;
        apr_sockaddr_port_get (&port, r->connection->local_addr);
@@ -1160,20 +1164,26 @@
 setup_socket (apr_socket_t **sock, xsp_data *conf, apr_pool_t *pool)
 {
        apr_status_t rv;
-       int family;
+       int family, proto;
 
-       family = (conf->listen_port != NULL) ? PF_INET : PF_UNIX;
+       family = (conf->listen_port != NULL) ? AF_UNSPEC : PF_UNIX;
+       /* APR_PROTO_TCP = 6 */
+       proto = (family == AF_UNSPEC) ? 6 : 0;
 #ifdef APACHE2
+#ifdef APACHE22
+       rv = apr_socket_create (sock, family, SOCK_STREAM, proto, pool);
+#else
        rv = apr_socket_create (sock, family, SOCK_STREAM, pool);
+#endif
 #else
        (*sock)->fd = ap_psocket (pool, family, SOCK_STREAM, 0);
        (*sock)->pool = pool;
        rv = ((*sock)->fd != -1) ? APR_SUCCESS : -1;
 #endif
        if (rv != APR_SUCCESS) {
+               int err= errno;
                ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
-                             "mod_mono: error creating socket.");
-
+                             "mod_mono: error creating socket: %d %s", err, 
strerror (err));
                return rv;
        }
 

Modified: trunk/mod_mono/src/mod_mono.h
===================================================================
--- trunk/mod_mono/src/mod_mono.h       2005-12-09 01:18:46 UTC (rev 54140)
+++ trunk/mod_mono/src/mod_mono.h       2005-12-09 01:19:00 UTC (rev 54141)
@@ -247,6 +247,10 @@
        (void *) APR_OFFSETOF (xsp_data, field_name), RSRC_CONF, description)
 #endif
 
+#ifndef AF_UNSPEC
+#define AF_UNSPEC 0
+#endif
+
 /* Debugging */
 #ifdef DEBUG
 #define DEBUG_PRINT(a,...) \

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to