Fixed command calling crash
[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       ;;
167     *)
168       AC_MSG_RESULT(no)
169       ;;
170     esac
171   ],
172     AC_MSG_RESULT(no)
173   )
174 #endif SILC_DIST_TOOLKIT
175
176 #ifdef SILC_DIST_INPLACE
177 #
178 # Profiling options (never delivered to distributions)
179 #
180 AC_MSG_CHECKING(whether to enable gprof)
181 AC_ARG_ENABLE(gprof,
182   [  --enable-gprof          enable gprof profiling],
183   [
184     case "${enableval}" in
185       yes)
186         AC_MSG_RESULT(yes)
187         SILC_ADD_CFLAGS(-pg)
188         LIBS="$LIBS -pg"
189         ;;
190       *)
191         AC_MSG_RESULT(no)
192         ;;
193     esac
194   ],
195   [
196     AC_MSG_RESULT(no)
197   ])
198
199 AC_MSG_CHECKING(whether to enable gcov)
200 AC_ARG_ENABLE(gcov,
201   [  --enable-gcov           enable gcov],
202   [
203     case "${enableval}" in
204       yes)
205         AC_MSG_RESULT(yes)
206         SILC_ADD_CFLAGS(-fprofile-arcs)
207         LIBS="$LIBS -lgcov"
208         ;;
209       *)
210         AC_MSG_RESULT(no)
211         ;;
212     esac
213   ],
214   [
215     AC_MSG_RESULT(no)
216   ])
217 #endif SILC_DIST_INPLACE
218
219 #
220 # Makefile outputs
221 #
222 AC_CONFIG_FILES(
223 lib/Makefile
224 lib/contrib/Makefile
225 lib/silccore/Makefile
226 #ifdef SILC_DIST_SIM
227 lib/silcsim/Makefile
228 #endif SILC_DIST_SIM
229 lib/silcske/Makefile
230 lib/silcutil/Makefile
231 #ifdef SILC_DIST_TOOLKIT
232 lib/silcutil/unix/Makefile
233 lib/silcutil/win32/Makefile
234 lib/silcutil/symbian/Makefile
235 #else !SILC_DIST_TOOLKIT
236 #ifdef SILC_DIST_CLIENT
237 lib/silcutil/unix/Makefile
238 lib/silcutil/win32/Makefile
239 #else !SILC_DIST_CLIENT
240 #ifdef SILC_DIST_SERVER
241 lib/silcutil/unix/Makefile
242 #endif SILC_DIST_SERVER
243 #endif SILC_DIST_CLIENT
244 #endif SILC_DIST_TOOLKIT
245 lib/silcapputil/Makefile
246 #ifdef SILC_DIST_SFTP
247 lib/silcsftp/Makefile
248 #endif SILC_DIST_SFTP
249 #ifdef SILC_DIST_INPLACE
250 lib/silcutil/tests/Makefile
251 lib/silccore/tests/Makefile
252 lib/silcsftp/tests/Makefile
253 #endif SILC_DIST_INPLACE
254 )
255
256 #ifdef SILC_DIST_TOOLKIT
257 AC_CONFIG_FILES(
258 lib/silc.pc
259 lib/silcclient.pc
260 lib/silcserver.pc
261 )
262 #endif SILC_DIST_TOOLKIT
263
264 #ifdef SILC_DIST_CLIENTLIB
265 AC_CONFIG_FILES(
266 lib/silcclient/Makefile
267 lib/silcclient/tests/Makefile
268 )
269 #endif SILC_DIST_CLIENTLIB
270
271 #ifdef SILC_DIST_SERVERLIB
272 AC_CONFIG_FILES(
273 lib/silcserver/Makefile
274 lib/silcserver/tests/Makefile
275 )
276 #endif SILC_DIST_SERVERLIB
277
278 #ifdef SILC_DIST_ASN1
279 AC_CONFIG_FILES(
280 lib/silcasn1/Makefile
281 #ifdef SILC_DIST_INPLACE
282 lib/silcasn1/tests/Makefile
283 #endif SILC_DIST_INPLACE
284 )
285 #endif SILC_DIST_ASN1
286
287 #ifdef SILC_DIST_SKR
288 AC_CONFIG_FILES(
289 lib/silcskr/Makefile
290 #ifdef SILC_DIST_INPLACE
291 lib/silcskr/tests/Makefile
292 #endif SILC_DIST_INPLACE
293 )
294 #endif SILC_DIST_SKR
295
296 #ifdef SILC_DIST_HTTP
297 AC_CONFIG_FILES(
298 lib/silchttp/Makefile
299 #ifdef SILC_DIST_INPLACE
300 lib/silchttp/tests/Makefile
301 #endif SILC_DIST_INPLACE
302 )
303 #endif SILC_DIST_HTTP
304
305 #ifdef SILC_DIST_VCARD
306 AC_CONFIG_FILES(
307 lib/silcvcard/Makefile
308 )
309 #endif SILC_DIST_VCARD
310
311 fi      # compile_libs
312
313 #endif SILC_DIST_LIB