Author: tschoening
Date: Sun Jan 26 19:34:24 2014
New Revision: 1561536

URL: http://svn.apache.org/r1561536
Log:
LOG4CXX-421: Some progress in fixing build errors on Windows and specially 
Borland Builder.

Added:
    incubator/log4cxx/trunk/src/ant/ilink32-workaround.xml
Modified:
    incubator/log4cxx/trunk/build.xml
    incubator/log4cxx/trunk/src/ant/apr-build.xml
    incubator/log4cxx/trunk/src/ant/common.xml
    incubator/log4cxx/trunk/src/test/cpp/abts.h
    incubator/log4cxx/trunk/src/test/cpp/helpers/transcodertestcase.cpp

Modified: incubator/log4cxx/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/log4cxx/trunk/build.xml?rev=1561536&r1=1561535&r2=1561536&view=diff
==============================================================================
--- incubator/log4cxx/trunk/build.xml (original)
+++ incubator/log4cxx/trunk/build.xml Sun Jan 26 19:34:24 2014
@@ -51,7 +51,7 @@
                        if="is-unix"
        />
 
-       <syslibset      libs="advapi32 mswsock ws2_32 shell32"
+       <syslibset      libs="advapi32 mswsock shell32 ws2_32"
                                if="is-windows"
        />
        <syslibset      libs="stdc++"
@@ -81,6 +81,7 @@
 <!ENTITY find-apr SYSTEM 'src/ant/find-apr.xml'>
 <!ENTITY find-apr-util SYSTEM 'src/ant/find-apr-util.xml'>
 <!ENTITY find-libesmtp SYSTEM 'src/ant/find-libesmtp.xml'>
+<!ENTITY ilink32Workaround SYSTEM 'src/ant/ilink32-workaround.xml'>
 ]>
 
 <!--
@@ -93,6 +94,7 @@
        &find-apr;
        &find-apr-util;
        &find-libesmtp;
+       &ilink32Workaround;
 
        <property       name="base.dir"
                                location="."
@@ -247,45 +249,52 @@
                />
                <mkdir dir="${log4cxx.lib.dir}" />
 
-               <condition property="with-logchar" value="wchar_t">
+               <condition      property="with-logchar"
+                                       value="wchar_t">
                        <isset property="is-windows" />
                </condition>
                <property       name="with-logchar"
                                        value="utf-8"
                />
 
-               <condition property="has-libesmtp" value="1">
+               <condition      property="has-libesmtp"
+                                       value="1">
                        <equals arg1="${with-SMTP}"
                                        arg2="libesmtp"
                        />
                </condition>
 
-               <condition property="odbc.lib" value="iodbc">
+               <condition      property="odbc.lib"
+                                       value="iodbc">
                        <equals arg1="${with-ODBC}"
                                        arg2="iODBC"
                        />
                </condition>
 
-               <condition property="odbc.lib" value="unixodbc">
+               <condition      property="odbc.lib"
+                                       value="unixodbc">
                        <equals arg1="${with-ODBC}"
                                        arg2="unixODBC"
                        />
                </condition>
 
-               <condition property="odbc.lib" value="odbc32">
+               <condition      property="odbc.lib"
+                                       value="odbc32">
                        <equals arg1="${with-ODBC}"
                                        arg2="Microsoft"
                        />
                </condition>
 
-               <condition property="has-ODBC" value="1">
+               <condition      property="has-ODBC"
+                                       value="1">
                        <isset property="odbc.lib" />
                </condition>
                <property       name="has-ODBC"
                                        value="0"
                />
 
-               <condition property="force-ant" value="1">
+               <condition      property="force-ant"
+                                       value="1">
                        <equals arg1="${find}"
                                        arg2="false"
                        />
@@ -326,9 +335,6 @@
                                
file="${include.dir}/log4cxx/private/log4cxx_private.hw"
                                overwrite="true"
                />
-               <property       name="odbc.lib"
-                                       value="odbc32"
-               />
        </target>
 
        <target name="configure"
@@ -342,7 +348,8 @@
                <echo message="Configuring enable-unichar=${enable-unichar}" />
                <echo message="Configuring enable-cfstring=${enable-cfstring}" 
/>
 
-               <condition property="logchar_is_utf8" value="1">
+               <condition      property="logchar_is_utf8"
+                                       value="1">
                        <equals arg1="${with-logchar}"
                                        arg2="utf-8"
                        />
@@ -351,7 +358,8 @@
                                        value="0"
                />
 
-               <condition property="logchar_is_unichar" value="1">
+               <condition      property="logchar_is_unichar"
+                                       value="1">
                        <equals arg1="${with-logchar}"
                                        arg2="unichar"
                        />
@@ -360,7 +368,8 @@
                                        value="0"
                />
 
-               <condition property="logchar_is_wchar" value="1">
+               <condition      property="logchar_is_wchar"
+                                       value="1">
                        <equals arg1="${with-logchar}"
                                        arg2="wchar_t"
                        />
@@ -384,7 +393,8 @@
                                                replace="${logchar_is_wchar}"
                />
 
-               <condition property="charset_is_utf8" value="1">
+               <condition      property="charset_is_utf8"
+                                       value="1">
                        <equals arg1="${with-charset}"
                                        arg2="utf-8"
                        />
@@ -393,7 +403,8 @@
                                        value="0"
                />
 
-               <condition property="charset_is_iso-8859-1" value="1">
+               <condition      property="charset_is_iso-8859-1"
+                                       value="1">
                        <equals arg1="${with-charset}"
                                        arg2="iso-8859-1"
                        />
@@ -402,7 +413,8 @@
                                        value="0"
                />
 
-               <condition property="charset_is_usascii" value="1">
+               <condition      property="charset_is_usascii"
+                                       value="1">
                        <equals arg1="${with-charset}"
                                        arg2="usascii"
                        />
@@ -411,7 +423,8 @@
                                        value="0"
                />
 
-               <condition property="charset_is_ebcdic" value="1">
+               <condition      property="charset_is_ebcdic"
+                                       value="1">
                        <equals arg1="${with-charset}"
                                        arg2="ebcdic"
                        />
@@ -954,6 +967,11 @@
 
                <antcall target="update-rc-files-version-info" />
 
+               <!--
+                       Linking doesn't work for bcc and is implemented 
manually afterwards, but because
+                       compiling works we don't want to unnecessary double 
code and simply ignore linkage
+                       errors until there's a way to explicitly don't link if 
bcc.
+                -->
                <cc     name="${project.compiler}"
                        exceptions="true"
                        
outfile="${log4cxx.lib.dir}/${lib.prefix}${lib.name}${lib.suffix}"
@@ -964,7 +982,8 @@
                        outtype="${lib.type}"
                        objdir="${log4cxx.lib.dir}/log4cxx_obj"
                        debug="${debug}"
-                       projectsOnly="${projectsOnly}">
+                       projectsOnly="${projectsOnly}"
+                       failonerror="false">
 
                        <!-- brc aborts with an access violation. -->
                        <compiler       name="${resource.compiler}"
@@ -995,9 +1014,6 @@
                                                        if="esmtp.include.dir"
                        />
 
-                       <defineset      define="_USRDLL DLL_EXPORTS"
-                                               if="is-windows"
-                       />
                        <defineset      define="LOG4CXX"
                        />
                        <defineset      define="LOG4CXX_STATIC"
@@ -1009,14 +1025,16 @@
                        <defineset      define="APU_DECLARE_STATIC"
                                                if="apr-util-static"
                        />
-                       <defineset      define="WIN32"
+                       <defineset      define="WIN32 _USRDLL DLL_EXPORTS"
                                                if="is-windows"
                        />
 
                        <compilerarg    value="${pic-option}"
                                                        if="pic-option"
                        />
+
                        &libsets;
+
                        <project        type="${project.type}"
                                                
outfile="${projects.dir}/${lib.name}"
                                                if="project.if">
@@ -1027,6 +1045,7 @@
                                <dependency name="${projects.dir}/libesmtp" />
                        </project>
                </cc>
+               <antcall target="build-lib-ilink32-workaround" />
 
                <antcall target="restore-rc-files-version-info" />
 
@@ -1096,11 +1115,15 @@
 
                        <compilerarg value="${pic-option}" if="pic-option" />
 
-                       <libset libs="${lib.prefix}${lib.name}${lib.suffix}" 
dir="${log4cxx.lib.dir}" />
+                       <libset libs="${lib.prefix}${lib.name}${lib.suffix}"
+                                       dir="${log4cxx.lib.dir}"
+                       />
                        &libsets;
 
-                       <project outfile="${projects.dir}/${example.name}" 
type="${project.type}" if="project.if">
-                       <comment>&license;</comment>
+                       <project        
outfile="${projects.dir}/${example.name}"
+                                               type="${project.type}"
+                                               if="project.if">
+                               <comment>&license;</comment>
                                <dependency file="${projects.dir}/apr" />
                                <dependency file="${projects.dir}/xml" />
                                <dependency name="${projects.dir}/aprutil" 
depends="apr,xml" />
@@ -1219,7 +1242,8 @@
                        outtype="executable"
                        objdir="${log4cxx.lib.dir}/testsuite_obj"
                        debug="${debug}"
-                       projectsOnly="${projectsOnly}">
+                       projectsOnly="${projectsOnly}"
+                       failonerror="false">
 
                        <fileset        dir="${tests.cpp.dir}"
                                                includes="**/*.cpp **/*.c 
**/*.h"
@@ -1268,6 +1292,7 @@
                                <dependency file="${projects.dir}/log4cxx" 
depends="apr,aprutil,libesmtp" />
                        </project>
                </cc>
+               <antcall target="build-unittest-ilink32-workaround" />
        </target>
 
        <target name="build-standalone-unittest"

Modified: incubator/log4cxx/trunk/src/ant/apr-build.xml
URL: 
http://svn.apache.org/viewvc/incubator/log4cxx/trunk/src/ant/apr-build.xml?rev=1561536&r1=1561535&r2=1561536&view=diff
==============================================================================
--- incubator/log4cxx/trunk/src/ant/apr-build.xml (original)
+++ incubator/log4cxx/trunk/src/ant/apr-build.xml Sun Jan 26 19:34:24 2014
@@ -18,6 +18,7 @@
 -->
 <!DOCTYPE project [
 <!ENTITY common SYSTEM 'common.xml'>
+<!ENTITY ilink32Workaround SYSTEM 'ilink32-workaround.xml'>
 <!ENTITY license '
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
@@ -42,6 +43,7 @@
 <project name="apr" default="check">
 
 &common;
+&ilink32Workaround;
 
 <property      name="src.dir"
                        location="${basedir}"
@@ -161,19 +163,22 @@
                                        if="is-static"
                />
                <fileset        dir="${src.dir}/file_io/unix"
-                       includes="copy.c fileacc.c filepath_util.c fullrw.c 
mktemp.c tempdir.c" />
+                               includes="copy.c fileacc.c filepath_util.c 
fullrw.c mktemp.c tempdir.c"
+               />
                <fileset        dir="${src.dir}/memory/unix"
                                        includes="*.c"
                />
                <fileset        dir="${src.dir}/misc/unix"
-                       includes="errorcodes.c getopt.c otherchild.c version.c" 
/>
+                                       includes="errorcodes.c getopt.c 
otherchild.c version.c"
+               />
                <fileset        dir="${src.dir}/mmap/unix"
                                        includes="common.c"
                />
                <fileset        dir="${src.dir}/network_io/unix"
-                       includes="inet_ntop.c inet_pton.c sockaddr.c" />
+                                       includes="inet_ntop.c inet_pton.c 
sockaddr.c"
+               />
                <fileset        dir="${src.dir}/poll/unix"
-                                       includes="select.c"
+                                       includes="*.c"
                />
                <fileset        dir="${src.dir}/random/unix"
                                        includes="*.c"
@@ -220,11 +225,23 @@
                <defineset      define="HAVE_CONFIG_H DARWIN 
SIGPROCMASK_SETS_THREAD_MASK"
                                        if="is-mac"
                />
+               <defineset if="is-bcc">
+                       <define name="_dup2"
+                                       value="dup2"
+                       />
+                       <define name="_isatty"
+                                       value="isatty"
+                       />
+                       <define name="_setmode"
+                                       value="setmode"
+                       />
+               </defineset>
+
                <compilerarg    value="${pic-option}"
                                                if="pic-option"
                />
 
-               <libset libs="advapi32 ws2_32 mswsock rpcrt4"
+               <libset libs="advapi32 mswsock rpcrt4 ws2_32"
                                if="is-windows"
                />
                <libset libs="pthread dl"
@@ -240,6 +257,7 @@
                        <comment>&license;</comment>
                </project>
        </cc>
+       <!-- antcall target="apr-build-ilink32-workaround" /-->
 
        <property       name="apr.lib.dir"
                                location="${executable.dir}"

Modified: incubator/log4cxx/trunk/src/ant/common.xml
URL: 
http://svn.apache.org/viewvc/incubator/log4cxx/trunk/src/ant/common.xml?rev=1561536&r1=1561535&r2=1561536&view=diff
==============================================================================
--- incubator/log4cxx/trunk/src/ant/common.xml (original)
+++ incubator/log4cxx/trunk/src/ant/common.xml Sun Jan 26 19:34:24 2014
@@ -15,7 +15,7 @@
  limitations under the License.
 
 -->
-
+
 <property      file="build.properties"
 />
 <property      name="debug"
@@ -32,11 +32,11 @@
 />
 <property      name="runtime"
                        value="dynamic"
-/>
+/>
 
 <taskdef resource="cpptasks.tasks" />
 <typedef resource="cpptasks.types" />
-<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
+<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
 
 <target name="os-detect">
        <condition      property="os.family"
@@ -95,6 +95,19 @@
                        <equals arg1="${compiler}" arg2="g++" />
                </or>
        </condition>
+
+       <!-- LOG4CXX-421 -->
+       <exec   executable="where"
+                       outputproperty="ilink32.path"
+                       failonerror="true">
+               <arg value="ilink32" />
+       </exec>
+       <propertyregex  property="bcc.rootPath"
+                                       input="${ilink32.path}"
+                                       regexp="^(.+?)\\bin\\ilink32.exe"
+                                       select="\1"
+                                       casesensitive="false"
+       />
 </target>
 
 <target        name="mac-init"

Added: incubator/log4cxx/trunk/src/ant/ilink32-workaround.xml
URL: 
http://svn.apache.org/viewvc/incubator/log4cxx/trunk/src/ant/ilink32-workaround.xml?rev=1561536&view=auto
==============================================================================
--- incubator/log4cxx/trunk/src/ant/ilink32-workaround.xml (added)
+++ incubator/log4cxx/trunk/src/ant/ilink32-workaround.xml Sun Jan 26 19:34:24 
2014
@@ -0,0 +1,84 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<!--
+       LOG4CXX-421
+
+       ilink32 doesn't work the way it's used by cpptasks anymore, but it 
should have created a
+       partially correct answer file which we'll need to update to get a 
properly linked result.
+ -->
+
+<target        name="apr-build-ilink32-workaround"
+               if="is-bcc">
+       <concat destfile="${target.dir}/debug/static/apr-1.lib.rsp"
+                       append="true"> &amp;
++"${bcc.rootPath}\lib\win32\release\psdk\advapi32.lib" &amp;
++"${bcc.rootPath}\lib\win32\release\psdk\mswsock.lib" &amp;
++"${bcc.rootPath}\lib\win32\release\psdk\rpcrt4.lib" &amp;
++"${bcc.rootPath}\lib\win32\release\psdk\ws2_32.lib"</concat>
+
+       <exec   executable="ilink32"
+                       failonerror="true">
+               <arg value="@${target.dir}\debug\static\apr-1.lib.rsp" />
+       </exec>
+</target>
+
+<target        name="build-lib-ilink32-workaround"
+               if="is-bcc">
+       <replace        file="${target.dir}/debug/shared/log4cxx.dll.rsp"
+                               token="/Gi +">
+               <replacevalue expandProperties="true">/Gi +
+/aa +</replacevalue>
+       </replace>
+       <replace        file="${target.dir}/debug/shared/log4cxx.dll.rsp"
+                               token="apr-1.lib +">
+               <replacevalue expandProperties="true">apr-1.lib +
+"${bcc.rootPath}\lib\win32\release\psdk\advapi32.lib" +
+"${bcc.rootPath}\lib\win32\release\psdk\mswsock.lib" +
+"${bcc.rootPath}\lib\win32\release\psdk\odbc32.lib" +
+"${bcc.rootPath}\lib\win32\release\psdk\shell32.lib" +
+"${bcc.rootPath}\lib\win32\release\psdk\ws2_32.lib" +</replacevalue>
+       </replace>
+       <replaceregexp  file="${target.dir}/debug/shared/log4cxx.dll.rsp"
+                                       match="cw32\.lib"
+                                       replace="cw32mt.lib"
+       />
+
+       <exec   executable="ilink32"
+                       failonerror="true">
+               <arg value="@${target.dir}\debug\shared\log4cxx.dll.rsp" />
+       </exec>
+</target>
+
+<target        name="build-unittest-ilink32-workaround"
+               if="is-bcc">
+       <replace        file="${target.dir}/debug/shared/testsuite.exe.rsp"
+                               token="apr-1.lib +">
+               <replacevalue expandProperties="true">apr-1.lib +
+"${bcc.rootPath}\lib\win32\release\psdk\ws2_32.lib" +</replacevalue>
+       </replace>
+       <replaceregexp  file="${target.dir}/debug/shared/testsuite.exe.rsp"
+                                       match="cw32\.lib"
+                                       replace="cw32mt.lib"
+       />
+
+       <exec   executable="ilink32"
+                       failonerror="true">
+               <arg value="@${target.dir}\debug\shared\testsuite.exe.rsp" />
+       </exec>
+</target>
\ No newline at end of file

Modified: incubator/log4cxx/trunk/src/test/cpp/abts.h
URL: 
http://svn.apache.org/viewvc/incubator/log4cxx/trunk/src/test/cpp/abts.h?rev=1561536&r1=1561535&r2=1561536&view=diff
==============================================================================
--- incubator/log4cxx/trunk/src/test/cpp/abts.h (original)
+++ incubator/log4cxx/trunk/src/test/cpp/abts.h Sun Jan 26 19:34:24 2014
@@ -19,6 +19,8 @@
 #include <string.h>
 #ifdef WIN32
 #include <io.h>
+// WIN32 is missing STDOUT_FILENO and Co.
+#include <apr.h>
 #else
 #include <unistd.h>
 #endif

Modified: incubator/log4cxx/trunk/src/test/cpp/helpers/transcodertestcase.cpp
URL: 
http://svn.apache.org/viewvc/incubator/log4cxx/trunk/src/test/cpp/helpers/transcodertestcase.cpp?rev=1561536&r1=1561535&r2=1561536&view=diff
==============================================================================
--- incubator/log4cxx/trunk/src/test/cpp/helpers/transcodertestcase.cpp 
(original)
+++ incubator/log4cxx/trunk/src/test/cpp/helpers/transcodertestcase.cpp Sun Jan 
26 19:34:24 2014
@@ -60,9 +60,11 @@ LOGUNIT_CLASS(TranscoderTestCase)
                 LOGUNIT_TEST(uencode3);
                 LOGUNIT_TEST(uencode5);
 #endif
+#if LOG4CXX_LOGCHAR_IS_UTF8
                 LOGUNIT_TEST(encodeCharsetName1);
                 LOGUNIT_TEST(encodeCharsetName2);
-                LOGUNIT_TEST(encodeCharsetName3);                
+                LOGUNIT_TEST(encodeCharsetName3);
+#endif
         LOGUNIT_TEST_SUITE_END();
 
 
@@ -305,13 +307,13 @@ public:
         }
 #endif
 
-
+#if LOG4CXX_LOGCHAR_IS_UTF8
         void encodeCharsetName1() {
             const logchar utf8[] = { 0x75, 0x74, 0x66, 0x2D, 0x38, 0x00 };
             std::string 
encoded(Transcoder::encodeCharsetName(LogString(utf8)));
             LOGUNIT_ASSERT_EQUAL(std::string("utf-8"), encoded);
         }
-        
+
         void encodeCharsetName2() {
             logchar lascii[0x60];
             char ascii[0x60];
@@ -333,6 +335,7 @@ public:
             std::string 
encoded(Transcoder::encodeCharsetName(LogString(unsupported)));
             LOGUNIT_ASSERT_EQUAL(std::string("????"), encoded);
         }
+#endif
 
 };
 


Reply via email to