Fix build error with GCC6
[profile/ivi/log4cxx.git] / src / ant / apr-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 common SYSTEM 'common.xml'>
21 <!ENTITY license '
22  Licensed to the Apache Software Foundation (ASF) under one or more
23  contributor license agreements.  See the NOTICE file distributed with
24  this work for additional information regarding copyright ownership.
25  The ASF licenses this file to You under the Apache License, Version 2.0
26  (the "License"); you may not use this file except in compliance with
27  the License.  You may obtain a copy of the License at
28
29       http://www.apache.org/licenses/LICENSE-2.0
30
31  Unless required by applicable law or agreed to in writing, software
32  distributed under the License is distributed on an "AS IS" BASIS,
33  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34  See the License for the specific language governing permissions and
35  limitations under the License.
36 '>
37 ]>
38 <!--
39
40 This file builds APR using Apache Ant (http://ant.apache.org)
41 and the C++ compilation tasks from http://ant-contrib.sourceforge.net.
42
43
44 -->
45 <project name="apr" default="check">
46
47 &common;
48
49 <property name="src.dir" location="${basedir}"/>
50 <property name="include.dir" location="${src.dir}/include"/>
51 <property name="test.dir" location="${src.dir}/test"/>
52 <property name="target.dir" location="${basedir}/target"/>
53 <property name="lib.name" value="apr-1"/>
54 <property name="lib.prefix" value=""/>
55
56 <target name="usage" description="Displays usage notes on build">
57         <echo>
58         </echo>
59 </target>
60
61 <target name="clean" description="Removes build product files">
62         <delete dir="${target.dir}"/>
63 </target>
64
65 <target name="win-configure" if="is-windows">
66     <copy file="${include.dir}/apr.hw" tofile="${include.dir}/apr.tmp" overwrite="true"/>
67     <replaceregexp file="${include.dir}/apr.tmp"
68          match="typedef *int *uid_t;" replace="/* typedef int uid_t */"/>  
69     <replaceregexp file="${include.dir}/apr.tmp"
70          match="typedef *int *gid_t;" replace="/* typedef int gid_t */"/>  
71     <antcall target="copy-if-changed">
72         <param name="file" value="${include.dir}/apr.tmp"/>
73         <param name="tofile" value="${include.dir}/apr.h"/>
74     </antcall>
75 </target>
76
77
78 <target name="check-configure" if="is-unix">
79     <condition property="force-configure" value="1">
80         <not><available file="${include.dir}/apr.h"/></not>
81     </condition>
82 </target>
83
84 <target name="unix-configure" depends="check-configure" if="force-configure">
85          <!--  shelling to configure allows cygwin to work  -->
86         <exec executable="sh" dir="${src.dir}">
87             <arg value="./configure"/>
88         </exec>
89 </target>
90
91
92 <target name="init" depends="common-init">
93     <condition property="arch" value="win32">
94         <isset property="is-windows"/>
95     </condition>
96     <property name="arch" value="unix"/>
97 </target>
98
99 <target name="configure" depends="init, unix-configure, win-configure"/>
100
101
102
103 <target name="build" depends="configure" description="Build library">
104     <mkdir dir="${executable.dir}/apr-ofiles"/>
105     <property name="project.compiler" value="${compiler}"/>
106         <property name="project.type" value="msvc6"/>
107     
108     <cc name="${project.compiler}"
109         outfile="${executable.dir}/${lib.prefix}${lib.name}${lib.suffix}"
110         subsystem="console"
111         multithreaded="true"
112         runtime="${runtime}"
113         outtype="${lib.type}"
114         objdir="${executable.dir}/apr-ofiles"
115         outputfileproperty="apr-1.dll"
116         debug="${debug}"
117         projectsOnly="${projectsOnly}">
118         <!--  suppressing misc/win32/rand.c since it needs to include rpc.h  -->
119         <fileset dir="${src.dir}" includes="**/${arch}/*.c" excludes="**/apr_app.c misc/win32/rand.c"/>
120         <fileset dir="${src.dir}" includes="**/${arch}/apr_app.c" if="is-static"/>
121         <fileset dir="${src.dir}/file_io/unix"
122             includes="copy.c fileacc.c filepath_util.c fullrw.c mktemp.c tempdir.c"/>
123         <fileset dir="${src.dir}/memory/unix" includes="*.c"/>
124         <fileset dir="${src.dir}/misc/unix"
125             includes="errorcodes.c getopt.c otherchild.c version.c"/>
126         <fileset dir="${src.dir}/mmap/unix" includes="common.c"/>
127         <fileset dir="${src.dir}/network_io/unix"
128             includes="inet_ntop.c inet_pton.c sockaddr.c"/>
129         <fileset dir="${src.dir}/poll/unix" includes="select.c"/>
130         <fileset dir="${src.dir}/random/unix" includes="*.c"/>
131         <fileset dir="${src.dir}/strings" includes="*.c"/>
132         <fileset dir="${src.dir}/tables" includes="*.c"/>
133         <fileset dir="${include.dir}" includes="*.h"/>
134         <fileset dir="${include.dir}/arch" includes="*.h"/>
135         <fileset dir="${include.dir}/arch/${arch}" includes="*.h"/>
136         <fileset dir="${include.dir}/arch/unix" includes="*.h"/>
137         <fileset dir="${src.dir}/support/unix" includes="waitio.c"/>
138         <includepath path="${include.dir}"/>
139         <includepath path="${include.dir}/arch"/>
140         <includepath path="${include.dir}/arch/${arch}"/>
141         <includepath path="${include.dir}/arch/unix"/>
142         <defineset define="APR_DECLARE_EXPORT" if="is-shared"/>
143         <defineset define="APR_DECLARE_STATIC" unless="is-shared"/>
144         <defineset if="is-windows">
145             <define name="WIN32" value="1"/>
146         </defineset>
147         <defineset define="_HAVE_CONFIG_H _REENTRANT _GNU_SOURCE" if="is-gcc"/>
148         <defineset define="HAVE_CONFIG_H DARWIN SIGPROCMASK_SETS_THREAD_MASK" if="is-mac"/>
149         <compilerarg value="${pic-option}" if="pic-option"/>
150         <libset libs="advapi32 ws2_32 mswsock rpcrt4" if="is-windows"/>
151         <libset libs="pthread dl" if="is-unix"/>
152         <libset libs="cw32mt" if="is-bcc"/>
153         <project type="${project.type}" outfile="${projects.dir}/apr" if="project.if">
154                         <comment>&license;</comment>
155                 </project>
156
157     </cc>
158     <property name="apr.lib.dir" location="${executable.dir}"/>
159 </target>
160
161 <target name="build-test">
162     <mkdir dir="${executable.dir}/apr-test-ofiles"/>
163     <property name="project.compiler" value="${compiler}"/>
164         <property name="project.type" value="msvc6"/>
165     <cc name="${project.compiler}"
166         outfile="${executable.dir}/${test}"
167         subsystem="console"
168         multithreaded="true"
169         runtime="${runtime}"
170         outtype="executable"
171         objdir="${executable.dir}/apr-test-ofiles"
172         debug="${debug}"
173         projectsOnly="${projectsOnly}">
174         <fileset dir="${test.dir}" includes="${testfiles}"/>
175         <includepath path="${include.dir}"/>
176         <defineset if="is-windows">
177             <define name="WIN32" value="1"/>
178         </defineset>
179         <defineset define="_HAVE_CONFIG_H _REENTRANT _GNU_SOURCE" if="is-gcc"/>
180         <defineset define="APR_DECLARE_STATIC" unless="is-shared"/>
181         <defineset define="HAVE_CONFIG_H DARWIN SIGPROCMASK_SETS_THREAD_MASK" if="is-mac"/>
182         <compilerarg value="${pic-option}" if="pic-option"/>
183         <libset dir="${apr.lib.dir}" libs="${lib.prefix}${lib.name}${lib.suffix}"/>
184         <libset libs="cw32mt" if="is-bcc"/>
185         <libset libs="pthread dl" if="is-unix"/>
186         <libset libs="advapi32 ws2_32 mswsock rpcrt4" if="is-windows"/>
187         <project type="${project.type}" outfile="${projects.dir}/${test}" if="project.if">
188                         <comment>&license;</comment>
189                         <dependency file="${projects.dir}/apr"/>
190                 </project>
191     </cc>
192 </target>
193
194 <target name="run-test">
195     <exec executable="${apr.lib.dir}/${test}"
196           dir="${apr.lib.dir}"
197           failonerror="true">
198         <env key="DYLD_LIBRARY_PATH"
199            value="${apr.lib.dir}:${env.DYLD_LIBRARY_PATH}"/>
200         <env key="LD_LIBRARY_PATH"
201            value="${apr.lib.dir}:${env.LD_LIBRARY_PATH}"/>
202     </exec>
203 </target>
204
205
206 <target name="build-testlockperf" depends="build">
207     <antcall target="build-test">
208         <param name="test" value="testlockperf"/>
209         <param name="testfiles" value="testlockperf.c"/>
210     </antcall>
211 </target>
212
213 <target name="run-testlockperf" depends="build-testlockperf">
214     <antcall target="run-test">
215         <param name="test" value="testlockperf"/>
216     </antcall>
217 </target>
218
219 <target name="build-testshmproducer" depends="build">
220     <antcall target="build-test">
221         <param name="test" value="testshmproducer"/>
222         <param name="testfiles" value="testshmproducer.c"/>
223     </antcall>
224 </target>
225
226 <target name="build-testshmconsumer" depends="build">
227     <antcall target="build-test">
228         <param name="test" value="testshmconsumer"/>
229         <param name="testfiles" value="testshmconsumer.c"/>
230     </antcall>
231 </target>
232
233
234 <target name="build-testmutexscope" depends="build">
235     <antcall target="build-test">
236         <param name="test" value="testmutexscope"/>
237         <param name="testfiles" value="testmutexscope.c"/>
238     </antcall>
239 </target>
240
241 <target name="run-testmutexscope" depends="build-testmutexscope">
242     <antcall target="run-test">
243         <param name="test" value="testmutexscope"/>
244     </antcall>
245 </target>
246
247 <target name="build-occhild" depends="build">
248     <antcall target="build-test">
249         <param name="test" value="occhild"/>
250         <param name="testfiles" value="occhild.c"/>
251     </antcall>
252 </target>
253
254 <target name="build-sockchild" depends="build">
255     <antcall target="build-test">
256         <param name="test" value="sockchild"/>
257         <param name="testfiles" value="sockchild.c"/>
258     </antcall>
259 </target>
260
261
262 <target name="build-readchild" depends="build">
263     <antcall target="build-test">
264         <param name="test" value="readchild"/>
265         <param name="testfiles" value="readchild.c"/>
266     </antcall>
267 </target>
268
269
270 <target name="build-globalmutexchild" depends="build">
271     <antcall target="build-test">
272         <param name="test" value="globalmutexchild"/>
273         <param name="testfiles" value="globalmutexchild.c"/>
274     </antcall>
275 </target>
276
277 <target name="build-tryread" depends="build">
278     <antcall target="build-test">
279         <param name="test" value="tryread"/>
280         <param name="testfiles" value="tryread.c"/>
281     </antcall>
282 </target>
283
284 <target name="build-proc_child" depends="build">
285     <antcall target="build-test">
286         <param name="test" value="proc_child"/>
287         <param name="testfiles" value="proc_child.c"/>
288     </antcall>
289 </target>
290
291
292 <target name="build-sendfile" depends="build">
293     <antcall target="build-test">
294         <param name="test" value="sendfile"/>
295         <param name="testfiles" value="sendfile.c"/>
296     </antcall>
297 </target>
298
299
300 <target name="build-mod_test" depends="build">
301     <mkdir dir="${executable.dir}/test-ofiles"/>
302     <mkdir dir="${executable.dir}/.libs"/>
303     <property name="project.compiler" value="${compiler}"/>
304         <property name="project.type" value="msvc6"/>
305     <cc name="${project.compiler}"
306         outfile="${executable.dir}/.libs/mod_test"
307         subsystem="console"
308         multithreaded="true"
309         runtime="${runtime}"
310         outtype="shared"
311         objdir="${executable.dir}/test-ofiles"
312         outputfileproperty="libmod_test.so"
313         debug="${debug}"
314         projectsOnly="${projectsOnly}">
315         <fileset dir="${test.dir}" includes="mod_test.c"/>
316         <includepath path="${include.dir}"/>
317         <defineset if="is-windows">
318             <define name="WIN32" value="1"/>
319         </defineset>
320         <defineset define="_HAVE_CONFIG_H _REENTRANT _GNU_SOURCE" if="is-gcc"/>
321         <defineset define="APR_DECLARE_STATIC" unless="is-shared"/>
322         <defineset define="HAVE_CONFIG_H DARWIN SIGPROCMASK_SETS_THREAD_MASK" if="is-mac"/>
323         <compilerarg value="${pic-option}" if="pic-option"/>
324         <libset dir="${apr.lib.dir}" libs="${lib.prefix}${lib.name}${lib.suffix}"/>
325         <libset libs="cw32mt" if="is-bcc"/>
326         <libset libs="advapi32 ws2_32 mswsock rpcrt4" if="is-windows"/>
327         <project type="${project.type}" outfile="${projects.dir}/mod_test" if="project.if">
328                         <comment>&license;</comment>
329                         <dependency file="${projects.dir}/apr-1"/>
330                 </project>
331
332     </cc>
333     <copy file="${libmod_test.so}" tofile="${executable.dir}/.libs/mod_test.so"/>
334 </target>
335
336
337 <target name="build-testall" depends="build">
338     <mkdir dir="${executable.dir}/test-ofiles"/>
339     <property name="project.compiler" value="${compiler}"/>
340         <property name="project.type" value="msvc6"/>
341     <cc name="${project.compiler}"
342         outfile="${executable.dir}/testall"
343         subsystem="console"
344         multithreaded="true"
345         runtime="${runtime}"        
346         outtype="executable"
347         objdir="${executable.dir}/test-ofiles"
348         debug="${debug}"
349         projectsOnly="${projectsOnly}">
350         <fileset dir="${test.dir}" includes="*.c">
351             <exclude name="nw_misc.c"/>
352             <exclude name="testlockperf.c"/>
353             <exclude name="occhild.c"/>
354             <exclude name="sockchild.c"/>
355             <exclude name="sockperf.c"/>
356             <exclude name="echod.c"/>
357             <exclude name="mockchild.c"/>
358             <exclude name="readchild.c"/>
359             <exclude name="globalmutexchild.c"/>
360             <exclude name="tryread.c"/>
361             <exclude name="proc_child.c"/>
362             <exclude name="sendfile.c"/>
363             <exclude name="testshmproducer.c"/>
364             <exclude name="testshmconsumer.c"/>
365             <exclude name="testmutexscope.c"/>
366             <exclude name="testapp.c"/>
367         </fileset>
368         <includepath path="${include.dir}"/>
369         <defineset if="is-windows">
370             <define name="WIN32" value="1"/>
371         </defineset>
372         <defineset define="_HAVE_CONFIG_H _REENTRANT _GNU_SOURCE" if="is-gcc"/>
373         <defineset define="APR_DECLARE_STATIC" unless="is-shared"/>
374         <defineset define="HAVE_CONFIG_H DARWIN SIGPROCMASK_SETS_THREAD_MASK" if="is-mac"/>
375         <compilerarg value="${pic-option}" if="pic-option"/>
376         <libset dir="${apr.lib.dir}" libs="${lib.prefix}${lib.name}${lib.suffix}"/>
377         <libset libs="cw32mt" if="is-bcc"/>
378         <libset libs="pthread dl" if="is-unix"/>
379         <libset libs="advapi32 ws2_32 mswsock rpcrt4" if="is-windows"/>
380         <project type="${project.type}" outfile="${projects.dir}/testall" if="project.if">
381                         <comment>&license;</comment>
382                         <dependency file="${projects.dir}/apr-1"/>
383                 </project>
384     </cc>
385 </target>
386
387 <target name="run-testall" depends="build-testall, build-mod_test, build-tryread, build-readchild, build-globalmutexchild, build-occhild, build-proc_child, build-testshmconsumer, build-testshmproducer, build-sockchild">
388     <mkdir dir="${executable.dir}/data"/>
389     <copy todir="${executable.dir}/data">
390         <fileset dir="${test.dir}/data" includes="*"/>
391     </copy>
392     <exec executable="${executable.dir}/testall"
393           dir="${executable.dir}"
394           failonerror="true">
395         <env key="DYLD_LIBRARY_PATH"
396            value="${apr.lib.dir}:${executable.dir}/.libs:${env.DYLD_LIBRARY_PATH}"/>
397         <env key="LD_LIBRARY_PATH"
398            value="${apr.lib.dir}:${executable.dir}/.libs:${env.LD_LIBRARY_PATH}"/>
399     </exec>
400 </target>
401
402
403
404 <target name="build-check"
405      depends="build-testlockperf,
406               build-testshmproducer,
407               build-testshmconsumer,
408               build-testmutexscope,
409               build-testall"
410      description="Builds all test applications"/>
411
412 <target name="check"
413       depends="run-testlockperf,
414                run-testall"
415       description="Runs all test applications">
416 </target>
417
418 <target name="build-projects">
419         <mkdir dir="${projects.dir}"/>
420         <antcall target="build">
421                 <param name="project.if" value="true"/>
422                 <param name="project.type" value="${project.type}"/>
423                 <param name="project.compiler" value="${project.compiler}"/>
424                 <param name="projects.dir" value="${projects.dir}"/>
425                 <param name="debug" value="${debug}"/>
426                 <param name="projectsOnly" value="true"/>
427                 <param name="arch" value="${arch}"/>
428         </antcall>
429         <antcall target="build-check">
430                 <param name="project.if" value="true"/>
431                 <param name="project.type" value="${project.type}"/>
432                 <param name="project.compiler" value="${project.compiler}"/>
433                 <param name="projects.dir" value="${projects.dir}"/>
434                 <param name="debug" value="${debug}"/>
435                 <param name="projectsOnly" value="true"/>
436                 <param name="arch" value="${arch}"/>
437         </antcall>
438 </target>
439
440 <target name="build-projects-vc6" depends="init"
441      description="Builds project files for Microsoft Visual C++ 6">
442     <antcall target="build-projects">
443         <param name="project.type" value="msvc6"/>
444         <param name="project.compiler" value="msvc"/>
445         <param name="os.family" value="windows"/>
446         <param name="debug" value="${debug}"/>
447         <param name="projects.dir" value="${projects.dir}"/>        
448     </antcall>
449 </target>
450
451
452 <target name="build-projects-vc7" depends="init"
453      description="Builds project files for Microsoft Visual Studio .NET">
454     <antcall target="build-projects">
455         <param name="project.type" value="msvc7"/>
456         <param name="project.compiler" value="msvc"/>
457         <param name="os.family" value="windows"/>
458         <param name="debug" value="${debug}"/>
459         <param name="projects.dir" value="${projects.dir}"/>        
460     </antcall>
461 </target>
462
463 <target name="build-projects-vc8" depends="init"
464      description="Builds project files for Microsoft Visual C++ 2005">
465   <antcall target="build-projects">
466         <param name="project.type" value="msvc8"/>
467         <param name="project.compiler" value="msvc"/>
468         <param name="os.family" value="windows"/>
469         <param name="debug" value="${debug}"/>
470         <param name="projects.dir" value="${projects.dir}"/>        
471   </antcall>
472 </target>
473
474   <target name="build-projects-vc9" depends="init"
475        description="Builds project files for Microsoft Visual C++ 2008">
476     <antcall target="build-projects">
477       <param name="project.type" value="msvc9"/>
478       <param name="project.compiler" value="msvc"/>
479       <param name="os.family" value="windows"/>
480       <param name="debug" value="${debug}"/>
481       <param name="projects.dir" value="${projects.dir}"/>
482     </antcall>
483   </target>
484
485   <target name="build-projects-xcode" depends="init" 
486       description="Builds project files for Apple Xcode">
487     <antcall target="build-projects">
488         <param name="project.type" value="xcode"/>
489         <param name="project.compiler" value="${compiler}"/>
490         <param name="os.family" value="mac"/>
491         <param name="debug" value="${debug}"/>
492         <param name="projects.dir" value="${projects.dir}"/>
493     </antcall>
494 </target>
495
496
497
498 </project>