silcd: fixed memory leaks
[silc.git] / lib / configure.ad
1 #ifdef SILC_DIST_LIB
2 #
3 #  lib/configure.ad
4 #
5 #  Author: Pekka Riikonen <priikone@silcnet.org>
6 #
7 #  Copyright (C) 2005, 2007 Pekka Riikonen
8 #
9 #  This program is free software; you can redistribute it and/or modify
10 #  it under the terms of the GNU General Public License as published by
11 #  the Free Software Foundation; version 2 of the License.
12 #
13 #  This program is distributed in the hope that it will be useful,
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #  GNU General Public License for more details.
17 #
18
19 if test x$compile_libs = xtrue; then
20
21 ##
22 ## Will compile included libs
23 ##
24 AC_MSG_NOTICE([Configuring SILC libraries])
25
26 # SILC Library directories
27 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/contrib"
28 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silccore"
29 #ifdef SILC_DIST_CRYPTO
30 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silccrypt"
31 #endif SILC_DIST_CRYPTO
32 #ifdef SILC_DIST_MATH
33 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcmath"
34 #endif SILC_DIST_MATH
35 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcutil"
36 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcapputil"
37 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcske"
38 #ifdef SILC_DIST_SFTP
39 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsftp"
40 #endif SILC_DIST_SFTP
41 #ifdef SILC_DIST_SIM
42 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsim"
43 #endif SILC_DIST_SIM
44 #ifdef SILC_DIST_CLIENTLIB
45 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient"
46 #endif SILC_DIST_CLIENTLIB
47 #ifdef SILC_DIST_ASN1
48 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcasn1"
49 #endif SILC_DIST_ASN1
50 #ifdef SILC_DIST_SKR
51 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcskr"
52 #endif SILC_DIST_SKR
53 #ifdef SILC_DIST_SERVERLIB
54 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcserver"
55 #endif SILC_DIST_SERVERLIB
56 #ifdef SILC_DIST_HTTP
57 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silchttp"
58 #endif SILC_DIST_HTTP
59 #ifdef SILC_DIST_VCARD
60 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcvcard"
61 #endif SILC_DIST_VCARD
62
63 ##
64 ## Library versioning.
65 ##
66 # Do the releases and library versioning according to following rules:
67 #
68 #  - If any code has changed in library, increment [LIB]_REVISION
69 #  - If functions were added, removed or changed, set [LIB]_REVISION to 0
70 #  - If functions were added, removed or changed, increment [LIB]_CURRENT
71 #  - If functions were added, increment [LIB]_AGE
72 #  - If functions were removed, set [LIB]_AGE to 0
73 #
74 # where [LIB] is LIBSILC, LIBSILCCLIENT or LIBSILCSERVER, and where
75 # "functions" means functions public interfaces (API).
76 #
77 # The LIB_BASE_VERSION defines the SILC software major.minor version and
78 # it is increment only when these version numbers actually change.
79 #
80
81 # Base version for libraries.  Do not change this unless SILC version
82 # changes too.
83 LIB_BASE_VERSION=1.1
84
85 # libsilc versions
86 LIBSILC_CURRENT=3               # prev = 2
87 LIBSILC_REVISION=0              # prev = 1
88 LIBSILC_AGE=1                   # prev = 1
89
90 # libsilcclient versions
91 LIBSILCCLIENT_CURRENT=2         # prev = 1
92 LIBSILCCLIENT_REVISION=1        # prev = 1
93 LIBSILCCLIENT_AGE=0             # prev = 0
94
95 # libsilcserver versions
96 LIBSILCSERVER_CURRENT=1         # prev = 0
97 LIBSILCSERVER_REVISION=0        # prev = 0
98 LIBSILCSERVER_AGE=0             # prev = 0
99
100 # Substitute the version numbers
101 AC_SUBST(LIB_BASE_VERSION)
102 AC_SUBST(LIBSILC_CURRENT)
103 AC_SUBST(LIBSILC_REVISION)
104 AC_SUBST(LIBSILC_AGE)
105 AC_SUBST(LIBSILCCLIENT_CURRENT)
106 AC_SUBST(LIBSILCCLIENT_REVISION)
107 AC_SUBST(LIBSILCCLIENT_AGE)
108 AC_SUBST(LIBSILCSERVER_CURRENT)
109 AC_SUBST(LIBSILCSERVER_REVISION)
110 AC_SUBST(LIBSILCSERVER_AGE)
111
112 # Check for big-endian machines
113 AC_C_BIGENDIAN
114
115 # Check for epoll_wait and verify that epoll_create works
116 AC_CHECK_FUNC(epoll_wait,
117   [
118     AC_RUN_IFELSE(
119       [
120         #include <sys/epoll.h>
121         int main()
122         {
123           int ret = epoll_create(5);
124           if (ret < 0)
125             return 1;
126           close(ret);
127           return 0;
128         }
129       ],
130       [
131         AC_DEFINE([HAVE_EPOLL_WAIT], [1], [HAVE_EPOLL_WAIT])
132       ],
133     )
134   ])
135
136 MODULESDIR="$silc_prefix/lib/modules"
137 #ifdef SILC_DIST_SIM
138 # SIM modules directory
139 #
140 AC_ARG_WITH(simdir,
141   [[  --with-simdir=DIR       directory for SIM modules [PREFIX/modules]]],
142   [
143     case "$withval" in
144       no|yes)
145         ;;
146       *)
147         MODULESDIR="$withval"
148         ;;
149     esac
150   ])
151 AC_DEFINE_UNQUOTED([SILC_MODULESDIR], "$MODULESDIR", [SILC_MODULESDIR])
152 #endif SILC_DIST_SIM
153 AC_SUBST(MODULESDIR)
154
155 #ifdef SILC_DIST_TOOLKIT
156 # Stack trace checking
157 #
158 AC_MSG_CHECKING(whether to enable stack tracing)
159 AC_ARG_ENABLE(stack-trace,
160   [  --enable-stack-trace    enable memory stack trace],
161   [
162     case "${enableval}" in
163     yes)
164       AC_MSG_RESULT(yes)
165       AC_DEFINE([SILC_STACKTRACE], [], [SILC_STACKTRACE])
166       CFLAGS="$CFLAGS -rdynamic"
167       PC_CFLAGS="$PC_CFLAGS -rdynamic"
168       ;;
169     *)
170       AC_MSG_RESULT(no)
171       ;;
172     esac
173   ],
174     AC_MSG_RESULT(no)
175   )
176 #endif SILC_DIST_TOOLKIT
177
178 #ifdef SILC_DIST_INPLACE
179 #
180 # Profiling options (never delivered to distributions)
181 #
182 AC_MSG_CHECKING(whether to enable gprof)
183 AC_ARG_ENABLE(gprof,
184   [  --enable-gprof          enable gprof profiling],
185   [
186     case "${enableval}" in
187       yes)
188         AC_MSG_RESULT(yes)
189         SILC_ADD_CFLAGS(-pg)
190         LIBS="$LIBS -pg"
191         ;;
192       *)
193         AC_MSG_RESULT(no)
194         ;;
195     esac
196   ],
197   [
198     AC_MSG_RESULT(no)
199   ])
200
201 AC_MSG_CHECKING(whether to enable gcov)
202 AC_ARG_ENABLE(gcov,
203   [  --enable-gcov           enable gcov],
204   [
205     case "${enableval}" in
206       yes)
207         AC_MSG_RESULT(yes)
208         SILC_ADD_CFLAGS(-fprofile-arcs)
209         LIBS="$LIBS -lgcov"
210         ;;
211       *)
212         AC_MSG_RESULT(no)
213         ;;
214     esac
215   ],
216   [
217     AC_MSG_RESULT(no)
218   ])
219 #endif SILC_DIST_INPLACE
220
221 #
222 # Makefile outputs
223 #
224 AC_CONFIG_FILES(
225 lib/Makefile
226 lib/contrib/Makefile
227 lib/silccore/Makefile
228 #ifdef SILC_DIST_SIM
229 lib/silcsim/Makefile
230 #endif SILC_DIST_SIM
231 lib/silcske/Makefile
232 lib/silcutil/Makefile
233 #ifdef SILC_DIST_TOOLKIT
234 lib/silcutil/unix/Makefile
235 lib/silcutil/win32/Makefile
236 lib/silcutil/symbian/Makefile
237 #else !SILC_DIST_TOOLKIT
238 #ifdef SILC_DIST_CLIENT
239 lib/silcutil/unix/Makefile
240 lib/silcutil/win32/Makefile
241 #else !SILC_DIST_CLIENT
242 #ifdef SILC_DIST_SERVER
243 lib/silcutil/unix/Makefile
244 #endif SILC_DIST_SERVER
245 #endif SILC_DIST_CLIENT
246 #endif SILC_DIST_TOOLKIT
247 lib/silcapputil/Makefile
248 #ifdef SILC_DIST_SFTP
249 lib/silcsftp/Makefile
250 #endif SILC_DIST_SFTP
251 #ifdef SILC_DIST_INPLACE
252 lib/silcutil/tests/Makefile
253 lib/silccore/tests/Makefile
254 lib/silcsftp/tests/Makefile
255 #endif SILC_DIST_INPLACE
256 )
257
258 #ifdef SILC_DIST_TOOLKIT
259 AC_CONFIG_FILES(
260 lib/silc.pc
261 lib/silcclient.pc
262 lib/silcserver.pc
263 )
264 #endif SILC_DIST_TOOLKIT
265
266 #ifdef SILC_DIST_CLIENTLIB
267 AC_CONFIG_FILES(
268 lib/silcclient/Makefile
269 lib/silcclient/tests/Makefile
270 )
271 #endif SILC_DIST_CLIENTLIB
272
273 #ifdef SILC_DIST_SERVERLIB
274 AC_CONFIG_FILES(
275 lib/silcserver/Makefile
276 lib/silcserver/tests/Makefile
277 )
278 #endif SILC_DIST_SERVERLIB
279
280 #ifdef SILC_DIST_ASN1
281 AC_CONFIG_FILES(
282 lib/silcasn1/Makefile
283 #ifdef SILC_DIST_INPLACE
284 lib/silcasn1/tests/Makefile
285 #endif SILC_DIST_INPLACE
286 )
287 #endif SILC_DIST_ASN1
288
289 #ifdef SILC_DIST_SKR
290 AC_CONFIG_FILES(
291 lib/silcskr/Makefile
292 #ifdef SILC_DIST_INPLACE
293 lib/silcskr/tests/Makefile
294 #endif SILC_DIST_INPLACE
295 )
296 #endif SILC_DIST_SKR
297
298 #ifdef SILC_DIST_HTTP
299 AC_CONFIG_FILES(
300 lib/silchttp/Makefile
301 #ifdef SILC_DIST_INPLACE
302 lib/silchttp/tests/Makefile
303 #endif SILC_DIST_INPLACE
304 )
305 #endif SILC_DIST_HTTP
306
307 #ifdef SILC_DIST_VCARD
308 AC_CONFIG_FILES(
309 lib/silcvcard/Makefile
310 )
311 #endif SILC_DIST_VCARD
312
313 fi      # compile_libs
314
315 #endif SILC_DIST_LIB