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