Makefile fixes for Toolkit.
[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=1               # prev = 0
87 LIBSILC_REVISION=0              # prev = 0
88 LIBSILC_AGE=0                   # prev = 0
89
90 # libsilcclient versions
91 LIBSILCCLIENT_CURRENT=1         # prev = 0
92 LIBSILCCLIENT_REVISION=0        # prev = 0
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 #ifdef SILC_DIST_SIM
137 # SIM modules directory
138 #
139 MODULESDIR="$silc_prefix/modules"
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_SUBST(MODULESDIR)
152 AC_DEFINE_UNQUOTED([SILC_MODULESDIR], "$MODULESDIR", [SILC_MODULESDIR])
153 #endif SILC_DIST_SIM
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 lib/silcutil/unix/Makefile
232 lib/silcutil/win32/Makefile
233 lib/silcutil/symbian/Makefile
234 lib/silcapputil/Makefile
235 #ifdef SILC_DIST_SFTP
236 lib/silcsftp/Makefile
237 #endif SILC_DIST_SFTP
238 #ifdef SILC_DIST_INPLACE
239 lib/silcutil/tests/Makefile
240 lib/silccore/tests/Makefile
241 lib/silcsftp/tests/Makefile
242 #endif SILC_DIST_INPLACE
243 )
244
245 #ifdef SILC_DIST_TOOLKIT
246 AC_CONFIG_FILES(
247 lib/silc.pc
248 lib/silcclient.pc
249 lib/silcserver.pc
250 )
251 #endif SILC_DIST_TOOLKIT
252
253 #ifdef SILC_DIST_CLIENTLIB
254 AC_CONFIG_FILES(
255 lib/silcclient/Makefile
256 lib/silcclient/tests/Makefile
257 )
258 #endif SILC_DIST_CLIENTLIB
259
260 #ifdef SILC_DIST_SERVERLIB
261 AC_CONFIG_FILES(
262 lib/silcserver/Makefile
263 lib/silcserver/tests/Makefile
264 )
265 #endif SILC_DIST_SERVERLIB
266
267 #ifdef SILC_DIST_ASN1
268 AC_CONFIG_FILES(
269 lib/silcasn1/Makefile
270 #ifdef SILC_DIST_INPLACE
271 lib/silcasn1/tests/Makefile
272 #endif SILC_DIST_INPLACE
273 )
274 #endif SILC_DIST_ASN1
275
276 #ifdef SILC_DIST_SKR
277 AC_CONFIG_FILES(
278 lib/silcskr/Makefile
279 #ifdef SILC_DIST_INPLACE
280 lib/silcskr/tests/Makefile
281 #endif SILC_DIST_INPLACE
282 )
283 #endif SILC_DIST_SKR
284
285 #ifdef SILC_DIST_HTTP
286 AC_CONFIG_FILES(
287 lib/silchttp/Makefile
288 lib/silchttp/tests/Makefile
289 )
290 #endif SILC_DIST_HTTP
291
292 #ifdef SILC_DIST_VCARD
293 AC_CONFIG_FILES(
294 lib/silcvcard/Makefile
295 )
296 #endif SILC_DIST_VCARD
297
298 fi      # compile_libs
299
300 #endif SILC_DIST_LIB