You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2012/08/13 00:53:32 UTC

svn commit: r1372206 - in /apr/apr/branches/1.5.x: ./ CHANGES build/apr_rules.mk.in configure.in include/apr.h.in test/Makefile.in

Author: trawick
Date: Sun Aug 12 22:53:31 2012
New Revision: 1372206

URL: http://svn.apache.org/viewvc?rev=1372206&view=rev
Log:
Merge r1088023 from trunk:

MinGW/MSYS:  Support shared builds of APR, other general improvements
to support of this toolchain.

test/Makefile.in:
* $(LT_LDFLAGS) must be placed after the driver, otherwise it will act exactly
like $(LTFLAGS). This is required, otherwise libtool will be never able to
recognize the "-no-undefined" flag.
* if mod_test.la does not specify $(LOCAL_LIBS), compilation will fail (this is
required by both static and shared builds).

include/apr.h.in:
* It is required to declare APR_DECLARE, APR_DECLARE_NONSTD and
APR_DECLARE_DATA as they are in apr.hw, otherwise the generate DLL won't export
any symbol. APR_MODULE_DECLARE_DATA is already included, but previous ones are
not.

configure.in:
* $(LT_LDFLAGS) must be placed after the driver, as described for
test/Makefile.in.
* Added "-no-undefined" flag to $(LT_LDFLAGS) if the target platform is
Windows.
* Declare APR_DECLARE_EXPORT or APR_DECLARE_STATIC, required by the macro added
in include/apr.h.in.
* Removed the "strange" libraries detection (btw, probably it was also breaking
platforms without __stdcall calling convention, like Windows CE/Mobile/Phone,
since function names were decorated), linker gave error without sense if adding
"-lkernel32", probably because it creates a conflict of library precedence and
dependency.+++

PR: 46175
Submitted by: Carlo Bramini <carlo.bramix libero.it>


(+++This small subset of r1088023 had already been merged with r1091186.)

Modified:
    apr/apr/branches/1.5.x/   (props changed)
    apr/apr/branches/1.5.x/CHANGES
    apr/apr/branches/1.5.x/build/apr_rules.mk.in
    apr/apr/branches/1.5.x/configure.in
    apr/apr/branches/1.5.x/include/apr.h.in
    apr/apr/branches/1.5.x/test/Makefile.in

Propchange: apr/apr/branches/1.5.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1088023

Modified: apr/apr/branches/1.5.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/CHANGES?rev=1372206&r1=1372205&r2=1372206&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.5.x/CHANGES [utf-8] Sun Aug 12 22:53:31 2012
@@ -1,6 +1,10 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.5.0
 
+  *) MinGW/MSYS:  Support shared builds of APR, other general improvements
+     to support of this toolchain.  PR 46175.  [Carlo Bramini 
+     <carlo.bramix libero.it>]  
+
   *) Improve platform detection by updating config.guess and config.sub.
      [Rainer Jung]
 

Modified: apr/apr/branches/1.5.x/build/apr_rules.mk.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/build/apr_rules.mk.in?rev=1372206&r1=1372205&r2=1372206&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/build/apr_rules.mk.in (original)
+++ apr/apr/branches/1.5.x/build/apr_rules.mk.in Sun Aug 12 22:53:31 2012
@@ -56,6 +56,10 @@ EXTRA_LDFLAGS=@EXTRA_LDFLAGS@
 EXTRA_LIBS=@EXTRA_LIBS@
 EXTRA_INCLUDES=@EXTRA_INCLUDES@
 
+# CPPFLAGS which are used only while building APR itself
+#
+INTERNAL_CPPFLAGS=@INTERNAL_CPPFLAGS@
+
 # NOTEST_* are flags and libraries that can be added by the user without
 # causing them to be used in configure tests (necessary for things like
 # -Werror and other strict warnings that maintainers like to use).
@@ -71,7 +75,7 @@ NOTEST_LIBS=@NOTEST_LIBS@
 # left-to-right precedence and CPPFLAGS may include user-defined overrides.
 #
 ALL_CFLAGS   = $(EXTRA_CFLAGS) $(NOTEST_CFLAGS) $(CFLAGS)
-ALL_CPPFLAGS = $(DEFS) $(EXTRA_CPPFLAGS) $(NOTEST_CPPFLAGS) $(CPPFLAGS)
+ALL_CPPFLAGS = $(DEFS) $(INTERNAL_CPPFLAGS) $(EXTRA_CPPFLAGS) $(EXTRA_CPPFLAGS) $(NOTEST_CPPFLAGS) $(CPPFLAGS)
 ALL_LDFLAGS  = $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS)
 ALL_LIBS     = $(LIBS) $(NOTEST_LIBS) $(EXTRA_LIBS)
 ALL_INCLUDES = $(INCLUDES) $(EXTRA_INCLUDES)

Modified: apr/apr/branches/1.5.x/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/configure.in?rev=1372206&r1=1372205&r2=1372206&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/configure.in (original)
+++ apr/apr/branches/1.5.x/configure.in Sun Aug 12 22:53:31 2012
@@ -282,7 +282,7 @@ AC_ARG_WITH(libtool, [  --without-libtoo
 if test "x$use_libtool" = "xyes"; then
       lt_compile='$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -o $@ -c $< && touch $@'
       LT_VERSION="-version-info `$get_version libtool $version_hdr APR`"
-      link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(LT_LDFLAGS) \$(COMPILE) \$(LT_VERSION) \$(ALL_LDFLAGS) -o \$@"
+      link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(COMPILE) \$(LT_LDFLAGS) \$(LT_VERSION) \$(ALL_LDFLAGS) -o \$@"
       so_ext='lo'
       lib_target='-rpath $(libdir) $(OBJECTS)'
       export_lib_target='-rpath \$(libdir) \$(OBJECTS)'
@@ -298,6 +298,9 @@ case $host in
     *-solaris2*)
         apr_platform_runtime_link_flag="-R"
         ;;
+    *-mingw* | *-cygwin*)
+        LT_LDFLAGS="$LT_LDFLAGS -no-undefined"
+        ;;
     *)
         ;;
 esac
@@ -432,6 +435,18 @@ case "$host:$CC" in
 	APR_SETVAR(CC,mwcc)
 	APR_SETVAR(AR,ar)
 	;;
+    dnl If building static APR, both the APR build and the app build
+    dnl need -DAPR_DECLARE_STATIC to generate the right linkage from    
+    dnl APR_DECLARE et al.
+    dnl If building dynamic APR, the APR build needs APR_DECLARE_EXPORT
+    dnl and the app build should have neither define.
+    *-mingw* | *-cygwin*)
+        if test "$enable_shared" = "yes"; then
+            APR_ADDTO(INTERNAL_CPPFLAGS, -DAPR_DECLARE_EXPORT)
+        else
+            APR_ADDTO(CPPFLAGS, -DAPR_DECLARE_STATIC)
+        fi
+        ;;
 esac
 
 AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins],
@@ -2726,6 +2741,7 @@ AC_SUBST(NOTEST_INCLUDES)
 
 dnl ----------------------------- Construct the files
 
+AC_SUBST(INTERNAL_CPPFLAGS)
 AC_SUBST(LDLIBS)
 AC_SUBST(INCLUDES)
 AC_SUBST(AR)

Modified: apr/apr/branches/1.5.x/include/apr.h.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/include/apr.h.in?rev=1372206&r1=1372205&r2=1372206&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/include/apr.h.in (original)
+++ apr/apr/branches/1.5.x/include/apr.h.in Sun Aug 12 22:53:31 2012
@@ -453,6 +453,8 @@ typedef  apr_uint32_t            apr_uin
  */
 #define APR_THREAD_FUNC       @apr_thread_func@
 
+#if defined(DOXYGEN) || !defined(WIN32)
+
 /**
  * The public APR functions are declared with APR_DECLARE(), so they may
  * use the most appropriate calling convention.  Public APR functions with 
@@ -505,6 +507,20 @@ typedef  apr_uint32_t            apr_uin
  */
 #define APR_DECLARE_DATA
 
+#elif defined(APR_DECLARE_STATIC)
+#define APR_DECLARE(type)            type __stdcall
+#define APR_DECLARE_NONSTD(type)     type __cdecl
+#define APR_DECLARE_DATA
+#elif defined(APR_DECLARE_EXPORT)
+#define APR_DECLARE(type)            __declspec(dllexport) type __stdcall
+#define APR_DECLARE_NONSTD(type)     __declspec(dllexport) type __cdecl
+#define APR_DECLARE_DATA             __declspec(dllexport)
+#else
+#define APR_DECLARE(type)            __declspec(dllimport) type __stdcall
+#define APR_DECLARE_NONSTD(type)     __declspec(dllimport) type __cdecl
+#define APR_DECLARE_DATA             __declspec(dllimport)
+#endif
+
 /* Define APR_SSIZE_T_FMT.  
  * If ssize_t is an integer we define it to be "d",
  * if ssize_t is a long int we define it to be "ld",

Modified: apr/apr/branches/1.5.x/test/Makefile.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/test/Makefile.in?rev=1372206&r1=1372205&r2=1372206&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/test/Makefile.in (original)
+++ apr/apr/branches/1.5.x/test/Makefile.in Sun Aug 12 22:53:31 2012
@@ -67,7 +67,7 @@ INCLUDES=-I$(INCDIR) -I$(srcdir)/../incl
 
 # link programs using -no-install to get real executables not
 # libtool wrapper scripts which link an executable when first run.
-LINK_PROG = $(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) \
+LINK_PROG = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LT_LDFLAGS) \
 	    @LT_NO_INSTALL@ $(ALL_LDFLAGS) -o $@
 
 # STDTEST_PORTABLE;
@@ -119,10 +119,10 @@ mod_test.lo: $(srcdir)/mod_test.c
 	  -c $(srcdir)/mod_test.c
 
 OBJECTS_mod_test = mod_test.lo
-mod_test.la: $(OBJECTS_mod_test)
+mod_test.la: $(OBJECTS_mod_test) $(LOCAL_LIBS)
 	$(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -rpath `pwd` -module \
 	  -avoid-version $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@ \
-	  $(OBJECTS_mod_test)
+	  $(OBJECTS_mod_test) $(LOCAL_LIBS)
 
 OBJECTS_libmod_test = mod_test.lo $(LOCAL_LIBS)
 libmod_test.la: $(OBJECTS_libmod_test)