Fix build error with GCC6
[profile/ivi/log4cxx.git] / src / ant / esmtp-build.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE project [
3 <!ENTITY common SYSTEM 'common.xml'>
4 ]>
5 <!--
6  Licensed to the Apache Software Foundation (ASF) under one or more
7  contributor license agreements.  See the NOTICE file distributed with
8  this work for additional information regarding copyright ownership.
9  The ASF licenses this file to You under the Apache License, Version 2.0
10  (the "License"); you may not use this file except in compliance with
11  the License.  You may obtain a copy of the License at
12
13       http://www.apache.org/licenses/LICENSE-2.0
14
15  Unless required by applicable law or agreed to in writing, software
16  distributed under the License is distributed on an "AS IS" BASIS,
17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  See the License for the specific language governing permissions and
19  limitations under the License.
20
21 -->
22
23
24 <!--
25
26 This file builds libesmtp using Apache Ant (http://ant.apache.org)
27 and the C++ compilation tasks from http://ant-contrib.sourceforge.net.
28
29
30 -->
31 <project name="esmtp" default="build">
32
33 &common;
34
35 <property name="src.dir" location="${basedir}"/>
36 <property name="include.dir" location="${src.dir}"/>
37 <property name="test.dir" location="${src.dir}/test"/>
38 <property name="target.dir" location="${basedir}/target"/>
39 <property name="lib.type" value="shared"/>
40 <property name="projects.dir" location="${target.dir}"/>
41
42 <target name="usage" description="Displays usage notes on build">
43         <echo>
44         </echo>
45 </target>
46
47
48 <target name="init" depends="common-init">
49 </target>
50
51 <target name="clean" description="Removes build product files">
52         <delete dir="${target.dir}"/>
53 </target>
54
55
56 <target name="configure-check" depends="init">
57         <condition property="esmtp-configure-available" value="true">
58               <available file="${include.dir}/config.h"/>
59         </condition>
60 </target>
61
62
63 <target name="win-configure" depends="configure-check" if="is-windows">
64     <antcall target="copy-if-changed">
65         <param name="file" value="${include.dir}/config.h.in"/>
66         <param name="tofile" value="${include.dir}/config.h"/>
67     </antcall>
68 </target>
69
70 <target name="unix-configure" depends="configure-check" if="is-unix" unless="esmtp-configure-available">
71          <!--  shelling to configure allows cygwin to work  -->
72         <exec executable="sh" dir="${src.dir}">
73             <arg value="./configure"/>
74         </exec>
75 </target>
76
77
78 <target name="configure" depends="unix-configure, win-configure"/>
79
80
81 <target name="build" depends="configure" description="Build library">
82     <mkdir dir="${executable.dir}/libesmtp-ofiles"/>
83     <property name="project.compiler" value="${compiler}"/>
84     <cc name="${project.compiler}"
85         outfile="${executable.dir}/esmtp${lib-suffix}"
86         subsystem="console"
87         multithreaded="true"
88         outtype="${lib.type}"
89         objdir="${executable.dir}/libesmtp-ofiles"
90         outputfileproperty="esmtp.dll"
91         debug="${debug}"
92         projectsOnly="${projectsOnly}">
93         <fileset dir="${src.dir}">
94             <include name="*.c"/>
95             <exclude name="getaddrinfo.c"/>
96             <exclude name="gethostbyname.c" if="is-windows"/>
97             <exclude name="strdup.c" if="is-windows"/>
98             <exclude name="snprintf.c" if="is-windows"/>
99             <exclude name="auth-client.c" if="is-windows"/>
100             <!-- exclude name="siobuf.c" if="is-windows"/ -->
101         </fileset>
102         <includepath path="${include.dir}"/>
103         <defineset define="HAVE_CONFIG_H"/>
104         <compilerarg value="${pic-option}" if="pic-option"/>
105         <libset libs="advapi32 ws2_32 mswsock rpcrt4" if="is-windows"/>
106         <libset libs="ssl crypto" if="is-unix"/>
107         <libset libs="cw32mt" if="is-bcc"/>
108         <project type="${project.type}" outfile="${projects.dir}/libesmtp" if="project.if"/>
109     </cc>
110 </target>
111
112
113 <target name="build-projects">
114         <mkdir dir="${projects.dir}"/>
115         <antcall target="build">
116                 <param name="project.if" value="true"/>
117                 <param name="project.type" value="${project.type}"/>
118                 <param name="project.compiler" value="${project.compiler}"/>
119                 <param name="projects.dir" value="${projects.dir}"/>
120                 <param name="projectsOnly" value="true"/>
121         </antcall>
122 </target>
123
124 <target name="build-projects-vc6" description="Builds project files for Microsoft Visual C++ 6">
125     <antcall target="build-projects">
126         <param name="project.type" value="msvc6"/>
127         <param name="project.compiler" value="msvc"/>
128     </antcall>
129 </target>
130
131 <target name="build-projects-vc8" description="Builds project files for Microsoft Visual C++ 2005">
132   <antcall target="build-projects">
133     <param name="project.type" value="msvc8"/>
134     <param name="project.compiler" value="msvc"/>
135   </antcall>
136 </target>
137
138 <target name="build-projects-xcode" description="Builds project files for Apple Xcode">
139     <antcall target="build-projects">
140         <param name="project.type" value="xcode"/>
141         <param name="project.compiler" value="g++"/>
142     </antcall>
143 </target>
144
145
146 </project>