Initial packaging.
[profile/ivi/log4cxx.git] / build.xml
1 <?xml version="1.0"?>
2 <!--
3  Licensed to the Apache Software Foundation (ASF) under one or more
4  contributor license agreements.  See the NOTICE file distributed with
5  this work for additional information regarding copyright ownership.
6  The ASF licenses this file to You under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with
8  the License.  You may obtain a copy of the License at
9
10       http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17
18 -->
19 <!DOCTYPE project [
20 <!ENTITY libsets '
21         <libset libs="${apr-util.lib.prefix}${apr-util.lib.name}${apr-util.lib.suffix}" dir="${apr-util.lib.dir}" if="apr-util.lib.dir"/>
22         <libset libs="${apr-util.lib.prefix}${apr-util.lib.name}${apr-util.lib.suffix}" unless="apr-util.lib.dir"/>
23         <libset libs="${apr.lib.prefix}${apr.lib.name}${apr.lib.suffix}" dir="${apr.lib.dir}" if="apr.lib.dir"/>
24         <libset libs="${apr.lib.prefix}${apr.lib.name}${apr.lib.suffix}" unless="apr.lib.dir"/>
25         <libset libs="esmtp" dir="${esmtp.lib.dir}" if="esmtp.lib.dir"/>
26         <libset libs="esmtp" if="has-libesmtp" unless="esmtp.lib.dir"/>
27       <libset libs="${odbc.lib}" if="odbc.lib"/>
28       <libset libs="${apr-util.dependencies}" if="apr-util.dependencies" unless="apr-util-includes-dependencies"/>
29         <libset libs="pthread" if="is-unix"/>
30         <syslibset libs="advapi32 mswsock ws2_32 shell32" if="is-windows"/>
31         <syslibset libs="stdc++" if="is-gcc"/>
32         <syslibset libs="cw32mt" if="is-bcc"/>
33 '>
34 <!ENTITY license '
35  Licensed to the Apache Software Foundation (ASF) under one or more
36  contributor license agreements.  See the NOTICE file distributed with
37  this work for additional information regarding copyright ownership.
38  The ASF licenses this file to You under the Apache License, Version 2.0
39  (the "License"); you may not use this file except in compliance with
40  the License.  You may obtain a copy of the License at
41
42       http://www.apache.org/licenses/LICENSE-2.0
43
44  Unless required by applicable law or agreed to in writing, software
45  distributed under the License is distributed on an "AS IS" BASIS,
46  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47  See the License for the specific language governing permissions and
48  limitations under the License.
49 '>
50 <!ENTITY common SYSTEM 'src/ant/common.xml'>
51 <!ENTITY find-apr SYSTEM 'src/ant/find-apr.xml'>
52 <!ENTITY find-apr-util SYSTEM 'src/ant/find-apr-util.xml'>
53 <!ENTITY find-libesmtp SYSTEM 'src/ant/find-libesmtp.xml'>
54 ]>
55
56 <!--
57 This file builds log4cxx using Apache Ant (http://ant.apache.org)
58 and the C++ compilation tasks from http://ant-contrib.sourceforge.net.
59
60
61 -->
62 <project name="log4cxx" default="check">
63
64 &common;
65 &find-apr;
66 &find-apr-util;
67 &find-libesmtp;
68
69 <property name="base.dir" location="."/>
70 <property name="src.dir" location="${base.dir}/src/main/cpp"/>
71 <property name="resources.dir" location="${base.dir}/src/main/resources"/>
72 <property name="include.dir" location="${base.dir}/src/main/include"/>
73 <property name="target.dir" location="${base.dir}/target"/>
74 <property name="lib.dir" location="${target.dir}/lib"/>
75 <property name="examples.dir" location="${base.dir}/src/examples/cpp"/>
76 <property name="tests.dir" location="${base.dir}/src/test"/>
77 <property name="tests.cpp.dir" location="${tests.dir}/cpp"/>
78 <property name="tests.resources.dir" location="${tests.dir}/resources"/>
79 <property name="tests.output.dir" location="${tests.resources.dir}/output"/>
80 <property name="m2_repo" location="${user.home}/.m2/repository"/>
81 <property name="log4j.version" value="1.2.14"/>
82 <available property="log4j.jar"
83            value="/usr/share/java/log4j-1.2.jar"
84            file="/usr/share/java/log4j-1.2.jar"/>
85 <property name="log4j.jar" 
86        location="${m2_repo}/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"/>
87
88
89 <property name="doxygen.exe" value="doxygen"/>
90
91 <property name="lib.name" value="log4cxx"/>
92 <property name="lib.prefix" value=""/>
93 <property name="version" value="0.10.0"/>
94 <property name="enable-char" value="1"/>
95 <property name="enable-wchar_t" value="1"/>
96 <property name="enable-unichar" value="0"/>
97 <property name="enable-cfstring" value="0"/>
98 <property name="with-charset" value="auto"/>
99 <property name="with-SMTP" value="no"/>
100 <property name="with-ODBC" value="no"/>
101
102
103 <property name="svnsite.url" value="https://svn.apache.org/repos/asf/logging/site/trunk/docs/log4cxx"/>
104
105
106
107 <target name="usage" description="Describes usage of the build script">
108         <echo>
109 Ant build file for log4cxx
110
111 Common invocations:
112
113 > ant
114
115 will attempt to locate APR and APR-util in /usr, /usr/local/apr and ..
116
117 Builds and tests log4cxx.
118
119 > ant -Dwith-apr=APRPATH -Dwith-apr-util=APUPATH
120
121 Builds and tests log4cxx using APR and APR-Util at specified location
122
123 > ant -p
124
125 Displays available targets
126
127 > ant build-projects-vc6
128
129 Builds Microsoft Visual Studio 6 projects.
130 -vc7, -vc8, -vc9 and -xcode for Visual Studio .NET, 2005, 2008 and Apple Xcode 2 and later.
131 respectively.
132
133 Command line options:
134
135 -Ddebug=[true|false]
136 -Doptimize=[speed|size|none]
137 -Dversion=n.n.n
138 -Denable-shared=[yes|no] (default yes)
139 -Denable-static=[yes|no] (default yes)
140 -Denable-char=[0, 1] (expose char* API, default 1)
141 -Denable-wchar_t=[0, 1] (expose wchar_t* API, default 1)
142 -Denable-unichar=[0, 1] (expose UniChar API, default 0)
143 -Denable-cfstring[0, 1] (expose CFString API, default 0)
144 -Dwith-charset=[auto|utf-8|iso-8859-1|usascii|ebcdic] (default auto)
145 -Dwith-logchar=[utf-8|wchar_t|unichar] (default=utf-8 on Unix, wchar_t on Windows)
146 -Dwith-apr=APRPATH
147 -Dwith-apr-util=PATH
148 -Dwith-SMTP=[libesmtp, no] (default no)
149 -Dwith-ODBC=[unixODBC, iODBC, Microsoft, no] (default no)
150
151 </echo>
152 </target>
153
154
155 <target name="init" depends="common-init">
156
157         <property name="log4cxx.lib.dir" value="${executable.dir}"/>
158         <mkdir dir="${log4cxx.lib.dir}"/>
159
160         <condition property="with-logchar" value="wchar_t">
161             <isset property="is-windows"/>
162         </condition>
163         <property name="with-logchar" value="utf-8"/>
164         
165         <condition property="has-libesmtp" value="1">
166             <equals arg1="${with-SMTP}" arg2="libesmtp"/>
167         </condition>
168
169       <condition property="odbc.lib" value="iodbc">
170           <equals arg1="${with-ODBC}" arg2="iODBC"/>
171       </condition>
172
173       <condition property="odbc.lib" value="unixodbc">
174           <equals arg1="${with-ODBC}" arg2="unixODBC"/>
175       </condition>
176
177       <condition property="odbc.lib" value="odbc32">
178           <equals arg1="${with-ODBC}" arg2="Microsoft"/>
179       </condition>
180
181       <condition property="has-ODBC" value="1">
182           <isset property="odbc.lib"/>
183       </condition>
184       <property name="has-ODBC" value="0"/>
185         
186         <condition property="force-ant" value="1">
187             <equals arg1="${find}" arg2="false"/>
188         </condition>
189         <echo>force-ant: ${force-ant}</echo>
190
191 </target>
192
193 <target name="clean" depends="init" description="Removes built files">
194         <delete dir="${target.dir}"/>
195         <delete>
196             <fileset dir="${include.dir}/log4cxx" includes="**/log4cxx.h"/>
197         </delete>
198         
199 </target>
200
201 <target name="unix-configure" if="is-unix">
202         <copy tofile="${include.dir}/log4cxx/log4cxx.tmp"
203               file="${include.dir}/log4cxx/log4cxx.h.in" overwrite="true"/>
204         <copy tofile="${include.dir}/log4cxx/private/log4cxx_private.tmp"
205               file="${include.dir}/log4cxx/private/log4cxx_private.h.in" overwrite="true"/>
206 </target>
207
208 <target name="win-configure" if="is-windows">
209         <copy tofile="${include.dir}/log4cxx/log4cxx.tmp"
210               file="${include.dir}/log4cxx/log4cxx.hw" overwrite="true"/>
211         <copy tofile="${include.dir}/log4cxx/private/log4cxx_private.tmp"
212               file="${include.dir}/log4cxx/private/log4cxx_private.hw" overwrite="true"/>
213       <property name="odbc.lib" value="odbc32"/>
214 </target>
215
216
217 <target name="configure" depends="init,
218                                   unix-configure,
219                                   win-configure">
220     <echo message="Configuring with-logchar=${with-logchar}" />
221     <echo message="Configuring with-charset=${with-charset}" />
222     <echo message="Configuring with-SMTP=${with-SMTP}" />
223     <echo message="Configuring with-ODBC=${with-ODBC}" />
224     <echo message="Configuring enable-char=${enable-char}"/>
225     <echo message="Configuring enable-wchar_t=${enable-wchar_t}"/>
226     <echo message="Configuring enable-unichar=${enable-unichar}"/>
227     <echo message="Configuring enable-cfstring=${enable-cfstring}"/>
228
229     <condition property="logchar_is_utf8" value="1">
230        <equals arg1="${with-logchar}" arg2="utf-8"/>
231     </condition>
232     <property name="logchar_is_utf8" value="0"/>
233
234     <condition property="logchar_is_unichar" value="1">
235        <equals arg1="${with-logchar}" arg2="unichar"/>
236     </condition>
237     <property name="logchar_is_unichar" value="0"/>
238
239     <condition property="logchar_is_wchar" value="1">
240        <equals arg1="${with-logchar}" arg2="wchar_t"/>
241     </condition>
242     <property name="logchar_is_wchar" value="0"/>
243
244     <replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
245        match="@LOGCHAR_IS_UNICHAR@"
246        replace="${logchar_is_unichar}"/>
247
248     <replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
249        match="@LOGCHAR_IS_UTF8@"
250        replace="${logchar_is_utf8}"/>
251
252     <replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
253        match="@LOGCHAR_IS_WCHAR@"
254        replace="${logchar_is_wchar}"/>
255
256     <condition property="charset_is_utf8" value="1">
257        <equals arg1="${with-charset}" arg2="utf-8"/>
258     </condition>
259     <property name="charset_is_utf8" value="0"/>
260
261     <condition property="charset_is_iso-8859-1" value="1">
262        <equals arg1="${with-charset}" arg2="iso-8859-1"/>
263     </condition>
264     <property name="charset_is_iso-8859-1" value="0"/>
265
266     <condition property="charset_is_usascii" value="1">
267        <equals arg1="${with-charset}" arg2="usascii"/>
268     </condition>
269     <property name="charset_is_usascii" value="0"/>
270
271     <condition property="charset_is_ebcdic" value="1">
272        <equals arg1="${with-charset}" arg2="ebcdic"/>
273     </condition>
274     <property name="charset_is_ebcdic" value="0"/>
275
276     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
277        match="@CHARSET_UTF8@"
278        replace="${charset_is_utf8}"/>
279
280     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
281        match="@CHARSET_ISO88591@"
282        replace="${charset_is_iso-8859-1}"/>
283     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
284        match="@CHARSET_USASCII@"
285        replace="${charset_is_usascii}"/>
286     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
287        match="@CHARSET_EBCDIC@"
288        replace="${charset_is_ebcdic}"/>
289
290     <replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
291        match="@CHAR_API@"
292        replace="${enable-char}"/>
293
294     <replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
295        match="@WCHAR_T_API@"
296        replace="${enable-wchar_t}"/>
297
298     <replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
299        match="@UNICHAR_API@"
300        replace="${enable-unichar}"/>
301
302     <replaceregexp file="${include.dir}/log4cxx/log4cxx.tmp"
303        match="@CFSTRING_API@"
304        replace="${enable-cfstring}"/>
305
306
307     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
308        match="@HAS_SYSLOG@"
309        replace="1"/>
310     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
311        match="@HAS_STD_LOCALE@"
312        replace="1"/>
313     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
314        match="@HAS_MBSRTOWCS@"
315        replace="1"/>
316     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
317        match="@HAS_WCSTOMBS@"
318        replace="1"/>
319     <condition property="has-fwide" value="0">
320         <isset property="is-cygwin"/>
321     </condition>
322     <property name="has-fwide" value="1"/>
323     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
324        match="@HAS_FWIDE@"
325        replace="${has-fwide}"/>
326
327     <condition property="has-libesmtp-value" value="1">
328         <isset property="has-libesmtp"/>
329     </condition>
330     <property name="has-libesmtp-value" value="0"/>
331     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
332        match="LOG4CXX_HAVE_LIBESMTP 0"
333        replace="LOG4CXX_HAVE_LIBESMTP ${has-libesmtp-value}"/>
334     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
335        match="@HAS_LIBESMTP@"
336        replace="${has-libesmtp-value}"/>
337
338     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.tmp"
339        match="@HAS_ODBC@"
340        replace="${has-ODBC}"/>
341        
342     <antcall target="copy-if-changed">
343         <param name="tofile" value="${include.dir}/log4cxx/log4cxx.h"/>
344         <param name="file" value="${include.dir}/log4cxx/log4cxx.tmp"/>
345     </antcall>
346     <delete file="${include.dir}/log4cxx/log4cxx.tmp"/>
347     <antcall target="copy-if-changed">
348         <param name="tofile" value="${include.dir}/log4cxx/private/log4cxx_private.h"/>
349         <param name="file" value="${include.dir}/log4cxx/private/log4cxx_private.tmp"/>
350     </antcall>
351     <delete file="${include.dir}/log4cxx/private/log4cxx_private.tmp"/>
352     
353 </target>
354
355
356 <target name="build-apr" depends="find-apr" unless="apr.lib.file">
357     <fail unless="apr.src.dir">Could not locate apr library or source.</fail>
358     <property name="apr.lib.type" value="static"/>
359    <property name="apr.lib.prefix" value=""/>
360    <property name="apr.lib.suffix" value=""/>
361    <property name="project.type" value="msvc6"/>
362     <ant antfile="src/ant/apr-build.xml" target="build" inheritAll="false">
363         <property name="basedir" value="${apr.src.dir}"/>
364         <property name="target.dir" value="${target.dir}"/>
365         <property name="debug" value="${debug}"/>
366         <property name="lib.prefix" value="${apr.lib.prefix}"/>
367         <property name="lib.suffix" value="${apr.lib.suffix}"/>
368         <property name="compiler" value="${compiler}"/>
369         <property name="runtime" value="${runtime}"/>
370         <property name="lib.type" value="${apr.lib.type}"/>
371         <property name="project.type" value="${project.type}"/>
372         <property name="projects.dir" value="${projects.dir}"/>
373         <property name="project.if.value" value="${project.if}"/>
374         <property name="use-pic" value="${use-pic}"/>
375         <property name="os.family" value="${os.family}"/>
376     </ant>
377     <condition property="apr.lib.dir" value="${target.dir}/${debug.release}/shared">
378         <equals arg1="${apr.lib.type}" arg2="shared"/>
379     </condition>
380     <property name="apr.lib.dir" location="${target.dir}/${debug.release}/static"/>
381     <property name="apr.project.file" location="${projects.dir}/apr"/>
382 </target>
383
384
385 <target name="build-apr-util" depends="build-apr, find-apr-util" unless="apr-util.lib.file">
386     <fail unless="apr-util.src.dir">Could not locate apr-util library or source.</fail>
387     <property name="apr-util.lib.type" value="${apr.lib.type}"/>
388    <property name="apr-util.lib.prefix" value=""/>
389    <property name="apr-util.lib.suffix" value=""/>
390    <property name="project.type" value="msvc6"/>
391    <!--  built this way, apr-util will include expat and doesn't need an external reference  -->
392    <property name="apr-util-includes-dependencies" value="1"/>
393
394     <ant antfile="src/ant/apr-util-build.xml" target="build" inheritAll="false">
395         <property name="target.dir" value="${target.dir}"/>
396         <property name="basedir" value="${apr-util.src.dir}"/>
397         <property name="debug" value="${debug}"/>
398         <property name="lib.prefix" value="${apr-util.lib.prefix}"/>
399         <property name="lib.suffix" value="${apr-util.lib.suffix}"/>
400         <property name="compiler" value="${compiler}"/>
401         <property name="runtime" value="${runtime}"/>
402         <property name="apr.include.dir" value="${apr.include.dir}"/>
403         <property name="apr.lib.dir" value="${apr.lib.dir}"/>
404         <property name="apr.lib.type" value="${apr.lib.type}"/>
405         <property name="lib.type" value="${apr-util.lib.type}"/>
406         <property name="project.type" value="${project.type}"/>
407         <property name="projects.dir" value="${projects.dir}"/>
408         <property name="project.if.value" value="${project.if}"/>
409         <property name="use-pic" value="${use-pic}"/>
410         <property name="os.family" value="${os.family}"/>
411     </ant>
412
413     <condition property="apr-util.lib.dir" value="${target.dir}/${debug.release}/shared">
414         <equals arg1="${apr-util.lib.type}" arg2="shared"/>
415     </condition>
416     <property name="apr-util.lib.dir" location="${target.dir}/${debug.release}/static"/>
417     <property name="apr-util.project.file" location="${projects.dir}/apr-util"/>
418 </target>
419
420 <target name="build-libesmtp" depends="find-esmtp" if="has-libesmtp" unless="esmtp.lib.file">
421     <fail unless="esmtp.src.dir">Could not locate libesmtp library or source.</fail>
422     <property name="esmtp.lib.type" value="static"/>
423     <property name="esmtp.lib.prefix" value=""/>
424     <property name="esmtp.lib.suffix" value=""/>
425     <property name="project.type" value="msvc6"/>
426     <condition property="esmtp.compiler" value="gcc">
427         <equals arg1="${compiler}" arg2="g++"/>
428     </condition>
429     <property name="esmtp.compiler" value="${compiler}"/>
430
431     <ant antfile="src/ant/esmtp-build.xml" target="build" inheritAll="false">
432         <property name="target.dir" value="${target.dir}"/>
433         <property name="basedir" value="${esmtp.src.dir}"/>
434         <property name="debug" value="${debug}"/>
435         <property name="lib.prefix" value="${esmtp.lib.prefix}"/>
436         <property name="lib.suffix" value="${esmtp.lib.suffix}"/>
437         <property name="compiler" value="${esmtp.compiler}"/>
438         <property name="runtime" value="${runtime}"/>
439         <property name="lib.type" value="${esmtp.lib.type}"/>
440         <property name="project.type" value="${project.type}"/>
441         <property name="projects.dir" value="${projects.dir}"/>
442         <property name="project.if.value" value="${project.if}"/>
443         <property name="use-pic" value="${use-pic}"/>
444         <property name="os.family" value="${os.family}"/>
445     </ant>
446
447     <condition property="esmtp.lib.dir" value="${target.dir}/${debug.release}/shared">
448         <equals arg1="${esmtp.lib.type}" arg2="shared"/>
449     </condition>
450     <property name="esmtp.lib.dir" location="${target.dir}/${debug.release}/static"/>
451     <property name="esmtp.project.file" location="${projects.dir}/libesmtp"/>
452 </target>
453
454
455 <target name="make-header-check">
456    <echo file="${header}.cpp" append="false">
457 #include "${header}"
458 #include "${header}"
459 </echo>
460 </target>
461
462
463 <target name="header-check" depends="build-apr-util, configure"
464     description="Checks headers against Effective C++ guidelines">
465         <fail unless="is-gcc">Requires GCC compiler</fail>
466         <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
467         <delete dir="${target.dir}/header-check"/>
468         <mkdir dir="${target.dir}/header-check"/>
469         <copy todir="${target.dir}/header-check" overwrite="true">
470              <fileset dir="${include.dir}" includes="**/*.h">
471                     <!-- obsolete header with #error directive to eliminate its use -->
472                     <exclude name="**/tchar.h"/>
473                     <!--  excluded due to conflict between log4cxx/rfa.h and log4cxx/rolling/rfa.h  -->
474                     <exclude name="log4cxx/rollingfileappender.h"/>
475              </fileset>
476         </copy>
477         <foreach target="make-header-check" param="header">
478                 <path><fileset dir="${target.dir}/header-check" includes="**/*.h"/></path>
479         </foreach>
480        <property name="project.type" value="msvc6"/>
481         <cc objdir="${target.dir}/header-check"
482                 name="gcc"
483                 exceptions="true"
484                 subsystem="gui"
485                 optimize="none"
486                 multithreaded="true"
487                 relentless="true"
488                 debug="${debug}"
489                 projectsOnly="${projectsOnly}">
490                 <compilerarg value="-Weffc++"/>
491                 <compilerarg value="-Wall"/>
492                 <compilerarg value="${pic-option}" if="pic-option"/>
493                 <fileset dir="${target.dir}/header-check"
494                      includes="**/*.cpp"
495                      excludes="log4cxx/private/*.cpp **/aprinitializer.h.cpp"/>
496                 <includepath path="${include.dir}"/>
497                 <project outfile="${projects.dir}/header-check"
498                     type="${project.type}" if="project.if"/>
499          </cc>
500 </target>
501
502 <target name="build-lib" depends="build-apr-util, build-libesmtp, configure" description="Build log4cxx library">
503     <mkdir dir="${log4cxx.lib.dir}/log4cxx_obj"/>
504
505    <condition property="apr-static" value="1">
506       <equals arg1="${apr.lib.type}" arg2="static"/>
507    </condition>
508       
509    <condition property="apr-util-static" value="1">
510       <equals arg1="${apr-util.lib.type}" arg2="static"/>
511    </condition>
512
513    <condition property="apr-libs-match" value="1">
514       <equals arg1="${apr.lib.type}" arg2="${apr-util.lib.type}"/>
515    </condition>
516
517    <fail unless="apr-libs-match">apr is ${apr.lib.type} and apr-util is ${apr-util.lib.type}, must be same type.</fail>
518    <property name="lib.name" value="log4cxx"/>
519    <property name="lib.prefix" value=""/>
520    <property name="lib.suffix" value=""/>
521
522    <condition property="apr-util.dependencies" value="expat iconv">
523       <equals arg1="${apr-util.lib.type}" arg2="static"/>
524    </condition>
525
526
527     <property name="project.compiler" value="${compiler}"/>
528    <property name="project.type" value="msvc6"/>
529
530   <condition property="resource.compiler" value="windres">
531     <isset property="is-gcc"/>
532   </condition>
533   <condition property="resource.compiler" value="brc">
534     <isset property="is-bcc"/>
535   </condition>
536   <property name="resource.compiler" value="msrc"/>
537     
538     <cc name="${project.compiler}"
539                 exceptions="true"
540                 outfile="${log4cxx.lib.dir}/${lib.prefix}${lib.name}${lib.suffix}"
541                 outputfileproperty="log4cxx.lib.file"
542                 subsystem="console"
543                 multithreaded="true"
544                 runtime="${runtime}"
545                 outtype="${lib.type}"
546                 objdir="${log4cxx.lib.dir}/log4cxx_obj"
547                 debug="${debug}"
548                 projectsOnly="${projectsOnly}">
549         <compiler name="${resource.compiler}" if="is-windows">
550           <includepath path="${resources.dir}"/>
551           <fileset dir="${resources.dir}" includes="*.rc"/>
552         </compiler>
553         <fileset dir="${src.dir}" includes="*.cpp"/>
554         <fileset dir="${include.dir}" includes="**/*.h"/>
555         <includepath path="${include.dir}"/>
556         <includepath path="${apr.include.dir}" if="apr.include.dir"/>
557         <includepath path="${apr-util.include.dir}" if="apr-util.include.dir"/>
558         <includepath path="${esmtp.include.dir}" if="esmtp.include.dir"/>
559         <defineset define="_USRDLL DLL_EXPORTS" if="is-windows"/>
560         <defineset define="LOG4CXX"/>
561         <defineset define="LOG4CXX_STATIC" if="is-static"/>
562         <defineset define="APR_DECLARE_STATIC" if="apr-static"/>
563         <defineset define="APU_DECLARE_STATIC" if="apr-util-static"/>
564         <defineset define="WIN32" if="is-windows"/>
565         <compilerarg value="${pic-option}" if="pic-option"/>
566         &libsets;
567         <project type="${project.type}" outfile="${projects.dir}/${lib.name}" if="project.if">
568          <comment>&license;</comment>
569             <dependency file="${projects.dir}/apr"/>
570             <dependency file="${projects.dir}/xml"/>
571             <dependency file="${projects.dir}/aprutil" depends="apr,xml"/>
572             <dependency name="${projects.dir}/libesmtp"/>
573         </project>
574     </cc>
575
576     <!-- copy liblog4cxx.so to log4cxx.dll for MinGW and Cygwin -->
577     <condition property="copy.log4cxx" value="${log4cxx.lib.dir}/${lib.prefix}${lib.name}${lib.suffix}.dll">
578         <and>
579             <os family="windows"/>
580             <isset property="is-gcc"/>
581             <equals arg1="${lib.type}" arg2="shared"/>
582             <isset property="log4cxx.lib.file"/>
583          </and>
584     </condition>
585 </target>
586
587 <target name="build" depends="build-lib" if="copy.log4cxx">
588     <copy file="${log4cxx.lib.file}" tofile="${copy.log4cxx}" 
589        overwrite="true" preservelastmodified="true"/>
590 </target>
591
592 <target name="build-example">
593     <mkdir dir="${log4cxx.lib.dir}/${example.name}_obj"/>
594     <property name="project.compiler" value="${compiler}"/>
595    <property name="project.type" value="msvc6"/>
596     <property name="example.include.dir" value="${example.src.dir}"/>
597     <cc name="${project.compiler}"
598                 exceptions="true"
599                 outfile="${log4cxx.lib.dir}/${example.name}"
600                 subsystem="console"
601                 multithreaded="true"
602                 runtime="${runtime}"
603                 outtype="executable"
604                 objdir="${log4cxx.lib.dir}/${example.name}_obj"
605                 debug="${debug}"
606                 projectsOnly="${projectsOnly}">
607         <fileset dir="${example.src.dir}" includes="${example.includes}"/>
608         <includepath path="${include.dir}"/>
609         <includepath path="${example.include.dir}"/>
610         <includepath path="${apr.include.dir}" if="apr.include.dir"/>
611
612         <defineset define="WIN32" if="is-windows"/>
613         <defineset define="LOG4CXX_STATIC" if="is-static"/>
614         <defineset define="APR_DECLARE_STATIC" if="apr-static"/>
615
616         <compilerarg value="${pic-option}" if="pic-option"/>
617
618         <libset libs="${lib.prefix}${lib.name}${lib.suffix}" dir="${log4cxx.lib.dir}"/>
619         &libsets;
620
621         <project outfile="${projects.dir}/${example.name}" type="${project.type}" if="project.if">
622          <comment>&license;</comment>
623             <dependency file="${projects.dir}/apr"/>
624             <dependency file="${projects.dir}/xml"/>
625             <dependency name="${projects.dir}/aprutil" depends="apr,xml"/>
626             <dependency name="${projects.dir}/libesmtp"/>
627             <dependency file="${projects.dir}/log4cxx" depends="apr,aprutil,xml"/>
628         </project>
629         
630     </cc>
631 </target>
632
633 <target name="run-example">
634     <!--  remove any stray configuration files  -->
635     <delete>
636         <fileset dir="${log4cxx.lib.dir}" includes="log4*.properties log4*.xml"/>
637     </delete>
638     <exec executable="${log4cxx.lib.dir}/${example.name}"
639           dir="${log4cxx.lib.dir}"
640           failonerror="true">
641           <env key="DYLD_LIBRARY_PATH"
642                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
643             <env key="LD_LIBRARY_PATH"
644                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"/>
645             <env key="Path" value="${env.Path}"/>
646     </exec>
647 </target>
648
649
650 <target name="build-delayedloop" depends="build">
651     <antcall target="build-example">
652        <param name="example.src.dir" value="${examples.dir}"/>
653        <param name="example.name" value="delayedloop"/>
654        <param name="example.includes" value="delayedloop.cpp"/>
655     </antcall>
656 </target>
657
658 <target name="build-trivial" depends="build">
659     <antcall target="build-example">
660        <param name="example.src.dir" value="${examples.dir}"/>
661        <param name="example.name" value="trivial"/>
662        <param name="example.includes" value="trivial.cpp"/>
663     </antcall>
664 </target>
665
666 <target name="build-console" depends="build">
667     <antcall target="build-example">
668        <param name="example.src.dir" value="${examples.dir}"/>
669        <param name="example.name" value="console"/>
670        <param name="example.includes" value="console.cpp"/>
671     </antcall>
672 </target>
673
674 <target name="build-stream" depends="build">
675     <antcall target="build-example">
676        <param name="example.src.dir" value="${examples.dir}"/>
677        <param name="example.name" value="stream"/>
678        <param name="example.includes" value="stream.cpp"/>
679     </antcall>
680 </target>
681
682 <target name="build-examples"
683     depends="build-delayedloop, build-trivial, build-stream, build-console"
684     description="Builds example programs"/>
685
686
687
688 <target name="build-unittest" depends="build"
689     description="Builds unit test app">
690     <mkdir dir="${log4cxx.lib.dir}/testsuite_obj"/>
691
692     <property name="project.compiler" value="${compiler}"/>
693    <property name="project.type" value="msvc6"/>
694     <cc name="${project.compiler}"
695                 exceptions="true"
696                 outfile="${log4cxx.lib.dir}/testsuite"
697                 subsystem="console"
698                 multithreaded="true"
699                 runtime="${runtime}"
700                 outputfileproperty="testsuite.exe"
701                 outtype="executable"
702                 objdir="${log4cxx.lib.dir}/testsuite_obj"
703                 debug="${debug}"
704                 projectsOnly="${projectsOnly}">
705         <fileset dir="${tests.cpp.dir}" includes="**/*.cpp **/*.c **/*.h"/>
706         <includepath path="${include.dir}"/>
707         <includepath path="${apr.include.dir}" if="apr.include.dir"/>
708         <includepath path="${apr-util.include.dir}" if="apr-util.include.dir"/>
709         <defineset define="LOG4CXX_STATIC" if="is-static"/>
710         <defineset define="APR_DECLARE_STATIC" if="apr-static"/>
711         <defineset define="APU_DECLARE_STATIC" if="apr-util-static"/>
712         <defineset define="WIN32" if="is-windows"/>
713         <compilerarg value="${pic-option}" if="pic-option"/>
714
715         <libset libs="${lib.prefix}${lib.name}${lib.suffix}" dir="${log4cxx.lib.dir}"/>
716         &libsets;
717
718         <project outfile="${projects.dir}/testsuite" type="${project.type}" if="project.if">
719          <comment>&license;</comment>
720             <dependency file="${projects.dir}/apr"/>
721             <dependency file="${projects.dir}/xml"/>
722             <dependency file="${projects.dir}/aprutil" depends="apr,xml"/>
723             <dependency name="${projects.dir}/libesmtp"/>
724             <dependency file="${projects.dir}/log4cxx" depends="apr,aprutil,libesmtp"/>
725         </project>
726     </cc>
727 </target>
728
729
730
731
732 <target name="build-standalone-unittest"
733     description="Builds a unit tests + log4cxx executable"
734     depends="build-apr-util, build-libesmtp, configure">
735     <mkdir dir="${executable.dir}/static/testsuite-standalone_obj"/>
736     <property name="project.compiler" value="${compiler}"/>
737    <property name="project.type" value="msvc6"/>
738   <condition property="resource.compiler" value="windres">
739     <isset property="is-gcc"/>
740   </condition>
741   <property name="resource.compiler" value="msrc"/>
742
743   <cc name="${project.compiler}"
744                 exceptions="true"
745                 outfile="${executable.dir}/static/testsuite-standalone"
746                 subsystem="console"
747                 multithreaded="true"
748                 runtime="${runtime}"
749                 outputfileproperty="testsuite-standalone.exe"
750                 outtype="executable"
751                 objdir="${executable.dir}/static/testsuite-standalone_obj"
752                 debug="${debug}"
753                 projectsOnly="${projectsOnly}">
754         <compiler name="${resource.compiler}" if="is-windows">
755           <includepath path="${resources.dir}"/>
756           <fileset dir="${resources.dir}" includes="*.rc"/>
757         </compiler>
758         <fileset dir="${src.dir}" includes="*.cpp" excludes="**/iconv_module.cpp"/>
759         <fileset dir="${include.dir}" includes="**/*.h"/>
760         <fileset dir="${tests.cpp.dir}" includes="**/*.cpp **/*.c **/*.h"/>
761         <includepath path="${include.dir}"/>
762          <includepath path="${apr.include.dir}" if="apr.include.dir"/>
763         <includepath path="${apr-util.include.dir}" if="apr-util.include.dir"/>
764         <includepath path="${esmtp.include.dir}" if="esmtp.include.dir"/>
765         <defineset define="LOG4CXX"/>
766         <defineset define="APR_DECLARE_STATIC" if="apr-static"/>
767         <defineset define="APU_DECLARE_STATIC" if="apr-util-static"/>
768         <defineset define="WIN32" if="is-windows"/>
769         <compilerarg value="${pic-option}" if="pic-option"/>
770
771         &libsets;
772
773         <includepath path="${include.dir}"/>
774         <includepath path="${apr.include.dir}"/>
775         <defineset define="LOG4CXX"/>
776         <libset libs="cw32mt" if="is-bcc"/>
777
778
779         <project outfile="${projects.dir}/testsuite-standalone"
780                  type="${project.type}"
781                  if="project.if">
782          <comment>&license;</comment>
783             <dependency file="${projects.dir}/apr"/>
784             <dependency file="${projects.dir}/xml"/>
785             <dependency file="${projects.dir}/aprutil" depends="apr,xml"/>
786             <dependency name="${projects.dir}/libesmtp"/>
787         </project>
788     </cc>
789 </target>
790
791 <target name="build-all" depends="build-examples, build-unittest"
792      description="Builds all artifacts"/>
793
794 <target name="clean-output" depends="init">
795      <delete>
796          <fileset dir="${tests.dir}" includes="output/*"/>
797      </delete>
798 </target>
799
800 <target name="run-defaultinit-unittest" depends="build-unittest">
801     <antcall target="run-defaultinit-log4X">
802         <param name="config" value="log4j"/>
803     </antcall>
804     <antcall target="run-defaultinit-log4X">
805         <param name="config" value="log4cxx"/>
806     </antcall>
807 </target>
808
809 <target name="run-defaultinit-log4X">
810     <mkdir dir="${tests.output.dir}"/>
811
812
813     <!--  test of log4j.properties -->
814     <delete>
815         <fileset dir="${log4cxx.lib.dir}" includes="*.properties *.xml"/>
816     </delete>
817     <exec executable="${testsuite.exe}" dir="${log4cxx.lib.dir}"
818               failonerror="true">
819             <arg value="-v"/>
820             <arg value="testcase1"/>
821             <env key="DYLD_LIBRARY_PATH"
822                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
823             <env key="LD_LIBRARY_PATH"
824                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"/>
825     </exec>
826
827     <copy tofile="${log4cxx.lib.dir}/${config}.xml"
828        file="${tests.resources.dir}/input/xml/defaultInit.xml" overwrite="true"/>
829     <exec executable="${testsuite.exe}" dir="${log4cxx.lib.dir}"
830               failonerror="true">
831             <arg value="-v"/>
832             <arg value="testcase2"/>
833             <env key="DYLD_LIBRARY_PATH"
834                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
835             <env key="LD_LIBRARY_PATH"
836                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"/>
837     </exec>
838     <delete>
839         <fileset dir="${log4cxx.lib.dir}" includes="*.properties *.xml"/>
840     </delete>
841
842
843     <copy tofile="${log4cxx.lib.dir}/${config}.properties"
844        file="${tests.resources.dir}/input/defaultInit3.properties" overwrite="true"/>
845     <exec executable="${testsuite.exe}" dir="${log4cxx.lib.dir}"
846               failonerror="true">
847             <arg value="-v"/>
848             <arg value="testcase3"/>
849             <env key="DYLD_LIBRARY_PATH"
850                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
851             <env key="LD_LIBRARY_PATH"
852                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"/>
853     </exec>
854     <delete>
855         <fileset dir="${log4cxx.lib.dir}" includes="*.properties *.xml"/>
856     </delete>
857
858
859     <copy file="${tests.resources.dir}/input/xml/defaultInit.xml" tofile="${log4cxx.lib.dir}/${config}.xml"/>
860     <copy file="${tests.resources.dir}/input/defaultInit3.properties" tofile="${log4cxx.lib.dir}/${config}.properties"/>
861     <exec executable="${testsuite.exe}" dir="${log4cxx.lib.dir}"
862               failonerror="true">
863             <arg value="-v"/>
864             <arg value="testcase4"/>
865             <env key="LD_LIBRARY_PATH"
866                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"/>
867             <env key="DYLD_LIBRARY_PATH"
868                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
869     </exec>
870     <delete>
871         <fileset dir="${log4cxx.lib.dir}" includes="*.properties *.xml"/>
872     </delete>
873
874
875 </target>
876
877 <target name="run-unittest" depends="build-unittest, run-defaultinit-unittest, clean-output"
878     description="Runs unit test">
879     <property environment="env"/>
880     <mkdir dir="${tests.output.dir}"/>
881     <delete>
882          <fileset dir="${tests.output.dir}" includes="*"/>
883     </delete>
884     <exec executable="${testsuite.exe}" dir="${tests.resources.dir}"
885               failonerror="true">
886             <arg value="-v"/>
887             <env key="TOTO" value="wonderful"/>
888             <env key="key1" value="value1"/>
889             <env key="key2" value="value2"/>
890             <env key="LD_LIBRARY_PATH"
891                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"/>
892             <env key="DYLD_LIBRARY_PATH"
893                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
894             <env key="Path"
895                    value="${log4cxx.lib.dir};${env.Path}"/>
896     </exec>
897     <available property="dom3-status" value="" file="src/test/resources/output/dom&#xB3;"/>
898     <available property="dom4-status" value="" file="src/test/resources/output/dom&#x3195;"/>
899     <property name="dom3-status" value="NOT"/>
900     <property name="dom4-status" value="NOT"/>
901     <echo>output/dom&#xB3; was ${dom3-status} created in DOMTestCase::test3</echo>
902     <echo>output/dom&#x3195; was ${dom4-status} created in DOMTestCase::test4</echo>
903 </target>
904
905 <target name="run-standalone-unittest"
906    depends="build-standalone-unittest, clean-output"
907    description="Runs standalone unit test">
908     <property environment="env"/>
909     <mkdir dir="${tests.output.dir}"/>
910     <delete>
911          <fileset dir="${tests.output.dir}" includes="*"/>
912     </delete>
913     <exec executable="${log4cxx-standalone-test.exe}" dir="${tests.resources.dir}"
914               failonerror="true">
915             <arg value="-v"/>
916             <env key="TOTO" value="wonderful"/>
917             <env key="key1" value="value1"/>
918             <env key="key2" value="value2"/>
919             <env key="DYLD_LIBRARY_PATH"
920                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
921             <env key="LD_LIBRARY_PATH"
922                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"/>
923             <env key="Path"
924                    value="${log4cxx.lib.dir};${env.Path}"/>
925     </exec>
926     <available property="dom3-status" value="" file="src/test/resources/output/dom&#xB3;"/>
927     <available property="dom4-status" value="" file="src/test/resources/output/dom&#x3195;"/>
928     <property name="dom3-status" value="NOT"/>
929     <property name="dom4-status" value="NOT"/>
930     <echo>output/dom&#xB3; was ${dom3-status} created in DOMTestCase::test3</echo>
931     <echo>output/dom&#x3195; was ${dom4-status} created in DOMTestCase::test4</echo>
932 </target>
933
934 <target name="run-socketserver" depends="build-unittest, clean-output"
935     description="Runs SocketServer test">
936     <property environment="env"/>
937     <mkdir dir="${tests.output.dir}"/>
938     <delete>
939          <fileset dir="${tests.output.dir}" includes="*"/>
940     </delete>
941     <mkdir dir="target/test-classes"/>
942     <javac srcdir="src/test/java"
943            includes="org/apache/log4j/net/ShortSocketServer.java" 
944            destdir="target/test-classes" 
945            classpath="${log4j.jar}"/>
946     <parallel>
947        <java classname="org.apache.log4j.net.ShortSocketServer" 
948           fork="yes" dir="src/test/resources" classpath="target/test-classes:${log4j.jar}">
949             <arg value="8"/> 
950             <arg value="input/socketServer"/> 
951        </java>
952        <sequential>
953           <sleep seconds="2"/>
954             <exec executable="${testsuite.exe}" dir="${tests.resources.dir}"
955               failonerror="true">
956                 <arg value="-v"/>
957                 <arg value="socketservertestcase"/>
958                 <env key="LD_LIBRARY_PATH"
959                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}"/>
960                 <env key="DYLD_LIBRARY_PATH"
961                    value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
962                 <env key="Path"
963                    value="${log4cxx.lib.dir};${env.Path}"/>
964             </exec>
965         </sequential>
966     </parallel>
967
968 </target>
969
970 <target name="build-projects">
971         <mkdir dir="${projects.dir}"/>
972        <property name="project.type" value="msvc6"/>
973         <antcall target="build-unittest">
974                 <param name="project.if" value="true"/>
975                 <param name="project.type" value="${project.type}"/>
976                 <param name="project.compiler" value="${project.compiler}"/>
977                 <param name="debug" value="${debug}"/>
978                 <param name="projectsOnly" value="true"/>
979                 <param name="os.family" value="${os.family}"/>
980                 <param name="find" value="${find}"/>
981         </antcall>
982         <antcall target="build-standalone-unittest">
983                 <param name="project.if" value="true"/>
984                 <param name="project.type" value="${project.type}"/>
985                 <param name="project.compiler" value="${project.compiler}"/>
986                 <param name="debug" value="${debug}"/>
987                 <param name="projectsOnly" value="true"/>
988                 <param name="os.family" value="${os.family}"/>
989                 <param name="find" value="${find}"/>
990         </antcall>
991         <antcall target="build-examples">
992                 <param name="project.if" value="true"/>
993                 <param name="project.type" value="${project.type}"/>
994                 <param name="project.compiler" value="${project.compiler}"/>
995                 <param name="debug" value="${debug}"/>
996                 <param name="projectsOnly" value="true"/>
997                 <param name="os.family" value="${os.family}"/>
998                 <param name="find" value="${find}"/>
999         </antcall>
1000 </target>
1001
1002 <target name="build-projects-vc6" depends="init" 
1003           description="Builds project files for Microsoft Visual C++ 6">
1004     <antcall target="build-projects">
1005         <param name="project.type" value="msvc6"/>
1006         <param name="project.compiler" value="msvc"/>
1007         <param name="os.family" value="windows"/>
1008         <param name="debug" value="${debug}"/>
1009         <param name="find" value="${find}"/>
1010     </antcall>
1011 </target>
1012
1013 <target name="build-projects-vc7" depends="init" 
1014           description="Builds project files for Microsoft Visual Studio .NET">
1015     <antcall target="build-projects">
1016         <param name="project.type" value="msvc7"/>
1017         <param name="project.compiler" value="msvc"/>
1018         <param name="os.family" value="windows"/>
1019         <param name="debug" value="${debug}"/>
1020         <param name="find" value="${find}"/>
1021     </antcall>
1022 </target>
1023
1024 <target name="build-projects-vc8" depends="init"
1025          description="Builds project files for Microsoft Visual C++ 2005">
1026     <antcall target="build-projects">
1027       <param name="project.type" value="msvc8"/>
1028       <param name="project.compiler" value="msvc"/>
1029       <param name="os.family" value="windows"/>
1030       <param name="debug" value="${debug}"/>
1031       <param name="find" value="${find}"/>
1032     </antcall>
1033 </target>
1034
1035
1036 <target name="build-projects-vc9" depends="init"
1037            description="Builds project files for Microsoft Visual C++ 2008">
1038     <antcall target="build-projects">
1039       <param name="project.type" value="msvc9"/>
1040       <param name="project.compiler" value="msvc"/>
1041       <param name="os.family" value="windows"/>
1042       <param name="debug" value="${debug}"/>
1043       <param name="find" value="${find}"/>
1044     </antcall>
1045 </target>
1046
1047   <target name="build-projects-xcode" depends="init" 
1048           description="Builds project files for Apple Xcode">
1049     <antcall target="build-projects">
1050         <param name="project.type" value="xcode"/>
1051         <param name="project.compiler" value="gcc"/>
1052         <param name="os.family" value="mac"/>
1053         <param name="debug" value="${debug}"/>
1054         <param name="find" value="${find}"/>
1055     </antcall>
1056 </target>
1057
1058
1059 <target name="test-compile" depends="build-unittest, build-examples"/>
1060
1061
1062 <target name="check" depends="run-unittest, build-examples"
1063      description="Runs all diagnostic tests">
1064     <antcall target="run-example">
1065         <param name="example.name" value="trivial"/>
1066     </antcall>
1067     <antcall target="run-example">
1068         <param name="example.name" value="stream"/>
1069     </antcall>
1070 </target>
1071
1072
1073
1074 <target name="apidocs" depends="init" description="Build log4cxx manual">
1075   <copy file="src/site/doxy/Doxyfile.in" tofile="${target.dir}/Doxyfile" 
1076      overwrite="true"/>
1077   <replace file="${target.dir}/Doxyfile">
1078     <replacefilter token="@VERSION@" value="${version}"/>
1079     <replacefilter token="@base_dir@" value="${base.dir}"/>
1080     <replacefilter token="@manual_dest@" value="${base.dir}/target/site/apidocs"/>
1081   </replace>
1082   <mkdir dir="target/site/apidocs"/>
1083   <exec executable="${doxygen.exe}" dir="${target.dir}"/>
1084
1085     <!--  doxygen.css is GPL'd, looks better with it, but not intolerable without it -->
1086     <echo file="${target.dir}/site/apidocs/doxygen.css">
1087 /*
1088 &license;
1089 */
1090 /*  Minimal replacement for GPL'd doxygen.css  */
1091 </echo>
1092     <echo file="${target.dir}/site/apidocs/tabs.css">
1093 /*
1094 &license;
1095 */
1096 /*  Minimal replacement for GPL'd tabs.css  */
1097 DIV.tabs {
1098     display : none ;
1099 }
1100 </echo>
1101      <!--   fix for issue http://jira.codehaus.org/browse/MSKINS-2  -->
1102      <replace file="${target.dir}/site/css/maven-theme.css"
1103            token="font-size: normal;"
1104            value="font-size: medium;"/>
1105
1106 </target>
1107
1108
1109 <target name="site" depends="apidocs">
1110     <!-- generate Visual Studio and XCode project files -->
1111     <antcall target="build-projects-vc6">
1112         <param name="find" value="false"/>
1113     </antcall>
1114     <antcall target="build-projects-xcode">
1115     </antcall>
1116     
1117     <replaceregexp flags="ig"
1118         match="ADD LINK32 .*/NOLOGO"
1119         replace="ADD LINK32 ADVAPI32.LIB WS2_32.LIB MSWSOCK.LIB SHELL32.LIB ODBC32.LIB /NOLOGO">
1120         <fileset dir="${target.dir}" includes="**/*.dsp"/>        
1121     </replaceregexp>
1122     <replaceregexp flags="g"
1123         match=".\\apr.dsp"
1124         replace="..\\\\..\\\\apr\\\\apr.dsp">
1125         <fileset dir="${target.dir}" includes="**/*.dsw"/>        
1126     </replaceregexp>
1127     <replaceregexp flags="g"
1128         match=".\\aprutil.dsp"
1129         replace="..\\\\..\\\\apr-util\\\\aprutil.dsp">
1130         <fileset dir="${target.dir}" includes="**/*.dsw"/>        
1131     </replaceregexp>
1132     <replaceregexp flags="g"
1133         match=".\\xml.dsp"
1134         replace="..\\\\..\\\\apr-util\\\\xml\\\\expat\\\\lib\\\\xml.dsp">
1135         <fileset dir="${target.dir}" includes="**/*.dsw"/>        
1136     </replaceregexp>
1137     <!-- drop library search path -->
1138     <replaceregexp flags="g"
1139         match="&lt;string&gt;[\./]*/usr/lib&lt;/string&gt;"
1140         replace="">
1141         <fileset dir="${target.dir}" includes="**/*.pbxproj"/>
1142     </replaceregexp>
1143     <replace dir="${target.dir}" includes="**/*.pbxproj"
1144         token="/usr/include/apr-1.0"
1145         value="/usr/include/apr-1"/>
1146     <replace dir="${target.dir}" includes="**/*.pbxproj"
1147         token="MacOSX10.4u.sdk"
1148         value="MacOSX10.5.sdk"/>
1149     <replace dir="${target.dir}/site" includes="**/*.html">
1150         <replacetoken>&lt;html</replacetoken>
1151         <replacevalue>&lt;!--
1152 &license;
1153 --&gt;&lt;html</replacevalue>
1154     </replace>
1155     <replace dir="${target.dir}/site/css" includes="maven*.css">
1156         <replacetoken>body {</replacetoken>
1157         <replacevalue>/*
1158 &license;
1159 */
1160 body {</replacevalue>
1161     </replace>
1162     <replace dir="${target.dir}/site/css" includes="print.css">
1163         <replacetoken>#banner</replacetoken>
1164         <replacevalue>/*
1165 &license;
1166 */
1167 #banner</replacevalue>
1168     </replace>
1169     
1170 </target>
1171
1172 <target name="gump" depends="check, header-check"/>
1173
1174 <target name="fixcrlf" depends="init" description="repair end-of-line sequences">
1175    <fixcrlf srcDir="${base.dir}" tab="remove" tablength="3"
1176        eof="remove" fixlast="true" eol="unix" includes="*.xml **/*.cpp **/*.h" excludes="lib/**/*"/>
1177 </target>
1178
1179         <target name="prepare-changes" description="Prepares changes.xml from a JIRA issues list">
1180             <xslt style="src/changes/changes.xslt" 
1181                   in="issues.xml" 
1182                   out="src/changes/changes.xml"/>
1183         </target>
1184
1185    <target name="checkout-site" unless="svn-available">
1186       <exec executable="svn">
1187          <arg value="co"/>
1188          <arg value="${svnsite.url}"/>
1189          <arg value="target/site-deploy"/>
1190       </exec>
1191    </target>
1192
1193    <target name="update-site" if="svn-available">
1194       <exec executable="svn" dir="target/site-deploy" failonerror="true">
1195          <arg value="update"/>
1196       </exec>
1197    </target>
1198
1199    <target name="post-site" depends="checkout-site, update-site"/>
1200    
1201
1202         <target name="mime=html">
1203             <exec executable="svn">
1204       <arg value="propset"/>
1205                 <arg value="svn:mime-type"/>
1206                 <arg value="text/html"/>
1207                 <arg value="${src.html}"/>
1208             </exec>
1209         </target>
1210
1211         <target name="mime=css">
1212             <exec executable="svn">
1213       <arg value="propset"/>
1214                 <arg value="svn:mime-type"/>
1215                 <arg value="text/css"/>
1216                 <arg value="${src.css}"/>
1217             </exec>
1218         </target>
1219    
1220
1221    <target name="site-deploy">
1222       <!-- Add any new files (and generate innocuous warnings for the existing content)  -->
1223                 <delete file="target/site-deploy/svn-commit.tmp~"/>
1224       <exec executable="bash" dir="target/site-deploy" failonerror="true">
1225          <arg line='-c "svn add --force *"'/>
1226       </exec>
1227                 <taskdef name="foreach" classname="net.sf.antcontrib.logic.ForEach" />
1228                 <foreach target="mime=html" param="src.html">
1229                         <path>
1230                                 <fileset dir="target/site-deploy" includes="**/*.html"/>
1231                         </path>
1232                 </foreach>
1233                 <foreach target="mime=css" param="src.css">
1234                         <path>
1235                                 <fileset dir="target/site-deploy" includes="**/*.css"/>
1236                         </path>
1237                 </foreach>
1238       <!--  requires that SVN_EDITOR, VISUAL or EDITOR being set to edit commit description -->
1239       <exec executable="svn" dir="target/site-deploy" failonerror="true">
1240           <arg value="commit"/>
1241       </exec>
1242    </target>
1243
1244    <target name="autogen" depends="init" if="is-unix">
1245         <exec executable="sh">
1246                 <arg value="autogen.sh"/>
1247         </exec>
1248    </target>
1249
1250
1251 </project>