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