Author: stevehay
Date: Wed Jul 17 08:20:36 2013
New Revision: 1504043

URL: http://svn.apache.org/r1504043
Log:
Fix linking of Apache2::ServerUtil

This commit reverts r1503137: I had failed to spot that ap_get_server_version 
is actually defined in modperl_apache_compat.c (thanks, Jan Kaluza!), which I 
should have known because I'd already fiddled with it in r1502135! This commit 
also reverts that, and (hopefully) does the job properly this time.

Normally, ap_get_server_version is exported from an httpd library and 
AP_DECLARE in third-party code such as ours means to dllimport it from there. 
However, if we're building against httpd-2.3+ then httpd no longer provides 
that symbol, but we have our own definition in modperl_apache_compat.c instead. 
In this case we need AP_DECLARE to mean dllexport (like it does when building 
the httpd core) so that our compat version gets exported from mod_perl.so/lib 
(but we still need to dllimport it when building 
Apache2/ServerUtil/ServerUtil.dll, of course).

This is effected by #defining AP_DECLARE_EXPORT in modperl_apache_compat.c 
(before modperl_apache_compat.h gets included, to cover the declaration too). 
This will affect all such declarations in that file (which is correct, being 
the whole point of the file) without affecting any other code, which continues 
to dllimport as usual (either from some httpd library, or from mod_perl.so/lib, 
whatever happens to provide the definition).

The case of ap_get_server_banner/description must also have been similarly 
broken for httpd-2.2 builds, and should also be fixed by this commit.

Modified:
    perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.c
    perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.h
    perl/modperl/branches/httpd24/xs/maps/apache2_functions.map

Modified: perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.c
URL: 
http://svn.apache.org/viewvc/perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.c?rev=1504043&r1=1504042&r2=1504043&view=diff
==============================================================================
--- perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.c 
(original)
+++ perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.c Wed 
Jul 17 08:20:36 2013
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#define AP_DECLARE_EXPORT
 #include "mod_perl.h"
 
 /* back compat adjustements for older Apache versions
@@ -62,7 +63,7 @@ AP_DECLARE(const char *) ap_get_server_b
                   MP_FUNC, ver, fallback); \
     }
 
-const char * ap_get_server_version(void) {
+AP_DECLARE(const char *) ap_get_server_version(void) {
     modperl_warn_deprecated_http_function("2.3.0",
         "ap_get_server_(description|banner)");
     return ap_get_server_banner();

Modified: perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.h
URL: 
http://svn.apache.org/viewvc/perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.h?rev=1504043&r1=1504042&r2=1504043&view=diff
==============================================================================
--- perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.h 
(original)
+++ perl/modperl/branches/httpd24/src/modules/perl/modperl_apache_compat.h Wed 
Jul 17 08:20:36 2013
@@ -50,7 +50,7 @@ AP_DECLARE(const char *) ap_get_server_b
 #if AP_MODULE_MAGIC_AT_LEAST(20060905,0)
 
 /* removed in APACHE-2.3.0 */
-const char * ap_get_server_version(void);
+AP_DECLARE(const char *) ap_get_server_version(void);
 
 #endif /* since-APACHE-2.3.0 */
 

Modified: perl/modperl/branches/httpd24/xs/maps/apache2_functions.map
URL: 
http://svn.apache.org/viewvc/perl/modperl/branches/httpd24/xs/maps/apache2_functions.map?rev=1504043&r1=1504042&r2=1504043&view=diff
==============================================================================
--- perl/modperl/branches/httpd24/xs/maps/apache2_functions.map (original)
+++ perl/modperl/branches/httpd24/xs/maps/apache2_functions.map Wed Jul 17 
08:20:36 2013
@@ -188,17 +188,9 @@ MODULE=Apache2::ServerUtil   PACKAGE=Apa
 MODULE=Apache2::ServerUtil   PACKAGE=Apache2::ServerUtil
  ap_exists_config_define
  ap_server_root_relative | | p, fname=""
-#_if_ do {                                                                  \
-          Apache2::Build->build_config                                      \
-             ->httpd_version =~ /^(\d+)\.(\d+)\.(\d+)/                     \
-          ? ($1*1000+$2)*1000+$3                                            \
-          : die "Cannot get httpd version";                                 \
-      } > 2003000
  ap_get_server_banner
  ap_get_server_description
-#_else_
  ap_get_server_version
-#_end_
 
 MODULE=Apache2::ServerUtil   PACKAGE=guess
  ap_error_log2stderr


Reply via email to