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