fefae05bbf48b3636ee5fe9082a59e1463db0c51
[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 #ifdef SILC_DIST_ACC
63 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcacc"
64 #endif SILC_DIST_ACC
65 #ifdef SILC_DIST_PGP
66 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcpgp"
67 #endif SILC_DIST_PGP
68 #ifdef SILC_DIST_SSH
69 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcssh"
70 #endif SILC_DIST_SSH
71
72 ##
73 ## Library versioning.
74 ##
75 # Do the releases and library versioning according to following rules:
76 #
77 #  - If any code has changed in library, increment [LIB]_REVISION
78 #  - If functions were added, removed or changed, set [LIB]_REVISION to 0
79 #  - If functions were added, removed or changed, increment [LIB]_CURRENT
80 #  - If functions were added, increment [LIB]_AGE
81 #  - If functions were removed, set [LIB]_AGE to 0
82 #
83 # where [LIB] is LIBSILC, LIBSILCCLIENT or LIBSILCSERVER, and where
84 # "functions" means functions public interfaces (API).
85 #
86 # The LIB_BASE_VERSION defines the SILC software major.minor version and
87 # it is increment only when these version numbers actually change.
88 #
89
90 # Base version for libraries.  Do not change this unless SILC version
91 # changes too.
92 LIB_BASE_VERSION=1.1
93
94 # libsilc versions
95 LIBSILC_CURRENT=2               # prev = 1
96 LIBSILC_REVISION=0              # prev = 0
97 LIBSILC_AGE=0                   # prev = 0
98
99 # libsilcclient versions
100 LIBSILCCLIENT_CURRENT=2         # prev = 1
101 LIBSILCCLIENT_REVISION=0        # prev = 0
102 LIBSILCCLIENT_AGE=0             # prev = 0
103
104 # libsilcserver versions
105 LIBSILCSERVER_CURRENT=1         # prev = 0
106 LIBSILCSERVER_REVISION=0        # prev = 0
107 LIBSILCSERVER_AGE=0             # prev = 0
108
109 # Substitute the version numbers
110 AC_SUBST(LIB_BASE_VERSION)
111 AC_SUBST(LIBSILC_CURRENT)
112 AC_SUBST(LIBSILC_REVISION)
113 AC_SUBST(LIBSILC_AGE)
114 AC_SUBST(LIBSILCCLIENT_CURRENT)
115 AC_SUBST(LIBSILCCLIENT_REVISION)
116 AC_SUBST(LIBSILCCLIENT_AGE)
117 AC_SUBST(LIBSILCSERVER_CURRENT)
118 AC_SUBST(LIBSILCSERVER_REVISION)
119 AC_SUBST(LIBSILCSERVER_AGE)
120
121 # Check for big-endian machines
122 AC_C_BIGENDIAN
123
124 # Check for epoll_wait and verify that epoll_create works
125 AC_CHECK_FUNC(epoll_wait,
126   [
127     AC_RUN_IFELSE(
128       [
129         #include <sys/epoll.h>
130         int main()
131         {
132           int ret = epoll_create(5);
133           if (ret < 0)
134             return 1;
135           close(ret);
136           return 0;
137         }
138       ],
139       [
140         AC_DEFINE([HAVE_EPOLL_WAIT], [1], [HAVE_EPOLL_WAIT])
141       ],
142     )
143   ])
144
145 MODULESDIR="$silc_prefix/lib/modules"
146 #ifdef SILC_DIST_SIM
147 # SIM modules directory
148 #
149 AC_ARG_WITH(simdir,
150   [[  --with-simdir=DIR       directory for SIM modules [PREFIX/modules]]],
151   [
152     case "$withval" in
153       no|yes)
154         ;;
155       *)
156         MODULESDIR="$withval"
157         ;;
158     esac
159   ])
160 AC_DEFINE_UNQUOTED([SILC_MODULESDIR], "$MODULESDIR", [SILC_MODULESDIR])
161 #endif SILC_DIST_SIM
162 AC_SUBST(MODULESDIR)
163
164 #ifdef SILC_DIST_TOOLKIT
165 # Stack trace checking
166 #
167 AC_MSG_CHECKING(whether to enable stack tracing)
168 AC_ARG_ENABLE(stack-trace,
169   [  --enable-stack-trace    enable memory stack trace],
170   [
171     case "${enableval}" in
172     yes)
173       AC_MSG_RESULT(yes)
174       AC_DEFINE([SILC_STACKTRACE], [], [SILC_STACKTRACE])
175       ;;
176     *)
177       AC_MSG_RESULT(no)
178       ;;
179     esac
180   ],
181     AC_MSG_RESULT(no)
182   )
183 #endif SILC_DIST_TOOLKIT
184
185 #ifdef SILC_DIST_INPLACE
186 #
187 # Profiling options (never delivered to distributions)
188 #
189 AC_MSG_CHECKING(whether to enable gprof)
190 AC_ARG_ENABLE(gprof,
191   [  --enable-gprof          enable gprof profiling],
192   [
193     case "${enableval}" in
194       yes)
195         AC_MSG_RESULT(yes)
196         SILC_ADD_CFLAGS(-pg)
197         LIBS="$LIBS -pg"
198         ;;
199       *)
200         AC_MSG_RESULT(no)
201         ;;
202     esac
203   ],
204   [
205     AC_MSG_RESULT(no)
206   ])
207
208 AC_MSG_CHECKING(whether to enable gcov)
209 AC_ARG_ENABLE(gcov,
210   [  --enable-gcov           enable gcov],
211   [
212     case "${enableval}" in
213       yes)
214         AC_MSG_RESULT(yes)
215         SILC_ADD_CFLAGS(-fprofile-arcs)
216         LIBS="$LIBS -lgcov"
217         ;;
218       *)
219         AC_MSG_RESULT(no)
220         ;;
221     esac
222   ],
223   [
224     AC_MSG_RESULT(no)
225   ])
226 #endif SILC_DIST_INPLACE
227
228 #
229 # Makefile outputs
230 #
231 AC_CONFIG_FILES(
232 lib/Makefile
233 lib/contrib/Makefile
234 lib/silccore/Makefile
235 #ifdef SILC_DIST_SIM
236 lib/silcsim/Makefile
237 #endif SILC_DIST_SIM
238 lib/silcske/Makefile
239 lib/silcutil/Makefile
240 #ifdef SILC_DIST_TOOLKIT
241 lib/silcutil/unix/Makefile
242 lib/silcutil/win32/Makefile
243 lib/silcutil/symbian/Makefile
244 #else !SILC_DIST_TOOLKIT
245 #ifdef SILC_DIST_CLIENT
246 lib/silcutil/unix/Makefile
247 lib/silcutil/win32/Makefile
248 #else !SILC_DIST_CLIENT
249 #ifdef SILC_DIST_SERVER
250 lib/silcutil/unix/Makefile
251 #endif SILC_DIST_SERVER
252 #endif SILC_DIST_CLIENT
253 #endif SILC_DIST_TOOLKIT
254 lib/silcapputil/Makefile
255 #ifdef SILC_DIST_SFTP
256 lib/silcsftp/Makefile
257 #endif SILC_DIST_SFTP
258 #ifdef SILC_DIST_INPLACE
259 lib/silcutil/tests/Makefile
260 lib/silccore/tests/Makefile
261 lib/silcsftp/tests/Makefile
262 #endif SILC_DIST_INPLACE
263 )
264
265 #ifdef SILC_DIST_TOOLKIT
266 AC_CONFIG_FILES(
267 lib/silc.pc
268 lib/silcclient.pc
269 lib/silcserver.pc
270 )
271 #endif SILC_DIST_TOOLKIT
272
273 #ifdef SILC_DIST_CLIENTLIB
274 AC_CONFIG_FILES(
275 lib/silcclient/Makefile
276 lib/silcclient/tests/Makefile
277 )
278 #endif SILC_DIST_CLIENTLIB
279
280 #ifdef SILC_DIST_SERVERLIB
281 AC_CONFIG_FILES(
282 lib/silcserver/Makefile
283 lib/silcserver/tests/Makefile
284 )
285 #endif SILC_DIST_SERVERLIB
286
287 #ifdef SILC_DIST_ASN1
288 AC_CONFIG_FILES(
289 lib/silcasn1/Makefile
290 #ifdef SILC_DIST_INPLACE
291 lib/silcasn1/tests/Makefile
292 #endif SILC_DIST_INPLACE
293 )
294 #endif SILC_DIST_ASN1
295
296 #ifdef SILC_DIST_SKR
297 AC_CONFIG_FILES(
298 lib/silcskr/Makefile
299 #ifdef SILC_DIST_INPLACE
300 lib/silcskr/tests/Makefile
301 #endif SILC_DIST_INPLACE
302 )
303 #endif SILC_DIST_SKR
304
305 #ifdef SILC_DIST_HTTP
306 AC_CONFIG_FILES(
307 lib/silchttp/Makefile
308 #ifdef SILC_DIST_INPLACE
309 lib/silchttp/tests/Makefile
310 #endif SILC_DIST_INPLACE
311 )
312 #endif SILC_DIST_HTTP
313
314 #ifdef SILC_DIST_VCARD
315 AC_CONFIG_FILES(
316 lib/silcvcard/Makefile
317 )
318 #endif SILC_DIST_VCARD
319
320 #ifdef SILC_DIST_ACC
321 AC_CONFIG_FILES(
322 lib/silcacc/Makefile
323 #ifdef SILC_DIST_INPLACE
324 lib/silcacc/tests/Makefile
325 #endif SILC_DIST_INPLACE
326 )
327 #endif SILC_DIST_ACC
328
329 #ifdef SILC_DIST_PGP
330 AC_CONFIG_FILES(
331 lib/silcpgp/Makefile
332 #ifdef SILC_DIST_INPLACE
333 lib/silcpgp/tests/Makefile
334 #endif SILC_DIST_INPLACE
335 )
336 #endif SILC_DIST_PGP
337
338 #ifdef SILC_DIST_SSH
339 AC_CONFIG_FILES(
340 lib/silcssh/Makefile
341 #ifdef SILC_DIST_INPLACE
342 lib/silcssh/tests/Makefile
343 #endif SILC_DIST_INPLACE
344 )
345 #endif SILC_DIST_SSH
346
347 fi      # compile_libs
348
349 #endif SILC_DIST_LIB