update
[silc.git] / configure.in.pre
1 #
2 #  configure.in
3 #
4 #  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
5 #
6 #  Copyright (C) 2000 - 2001 Pekka Riikonen
7 #
8 #  This program is free software; you can redistribute it and/or modify
9 #  it under the terms of the GNU General Public License as published by
10 #  the Free Software Foundation; either version 2 of the License, or
11 #  (at your option) any later version.
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 AC_INIT(includes/version.h)
20
21 # Compiler settings
22 CFLAGS="-Wall $CFLAGS"
23
24 #
25 # Put here any platform specific stuff
26 #
27 AC_CANONICAL_SYSTEM
28 case "$target" in
29   *-*-linux*|*-*-mklinux*)
30     CFLAGS="-D_GNU_SOURCE $CFLAGS"
31     ;;
32   *)
33     ;;
34 esac
35
36 # ./prepare script will automatically put the correct date. Do not edit!
37 AM_INIT_AUTOMAKE(silc, YYYYMMDD)
38 AC_PREREQ(2.3)
39 AM_CONFIG_HEADER(includes/silcdefs.h)
40
41 AC_PROG_CC
42 AC_C_INLINE
43 AC_C_CONST
44 AC_ARG_PROGRAM
45
46 AC_PROG_LN_S
47 AC_SUBST(LN_S)
48
49 # XXX
50 # Compiler flags
51 if test "$GCC"; then
52   CFLAGS="-finline-functions $CFLAGS"
53 else
54   # Currently GCC is only supported compiler
55   AC_MSG_ERROR(GCC is only supported compiler currently)
56 fi
57
58 # Program checking
59 AC_PROG_INSTALL
60 AC_PROG_RANLIB
61 AC_PROG_MAKE_SET
62
63 # Header checking
64 AC_HEADER_STDC
65 AC_HEADER_TIME
66 AC_HEADER_STAT
67
68 # More header checking
69 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
70 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h)
71 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h netdb.h)
72 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
73 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h)
74 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h)
75
76 # Data type checking
77 AC_TYPE_SIGNAL
78 AC_TYPE_SIZE_T
79 AC_TYPE_MODE_T
80 AC_TYPE_UID_T
81 AC_TYPE_PID_T
82
83 # Function checking
84 AC_CHECK_FUNCS(chmod stat fstat getenv putenv strerror ctime gettimeofday)
85 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
86 AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove)
87 AC_CHECK_FUNCS(gethostname gethostbyname gethostbyaddr)
88 AC_CHECK_FUNCS(select socket listen bind shutdown close connect)
89 AC_CHECK_FUNCS(fcntl setsockopt)
90 AC_CHECK_FUNCS(getservbyname getservbyport)
91 AC_CHECK_FUNCS(getopt_long time)
92 AC_CHECK_FUNCS(mlock munlock)
93
94 # SIM support checking
95 # XXX These needs to be changed as more supported platforms appear.
96 # XXX This probably needs to be made platform dependant check.
97 AC_CHECKING(for SIM support)
98 AC_CHECK_HEADERS(dlfcn.h, 
99   AC_CHECK_LIB(dl, dlopen, 
100     AC_DEFINE(SILC_SIM) 
101     AC_MSG_RESULT(enabled SIM support)
102     LIBS="$LIBS -ldl",
103     AC_MSG_RESULT(no SIM support found)),
104   AC_MSG_RESULT(no SIM support found))
105
106 # Debug checking
107 AC_MSG_CHECKING(for enabled debugging)
108 AC_ARG_ENABLE(debug,
109 [  --enable-debug          Enable debugging (warning: it is heavy!)],
110 [ case "${enableval}" in
111   yes) 
112     AC_MSG_RESULT(yes)
113     AC_DEFINE(SILC_DEBUG)
114     CFLAGS="-O -g $CFLAGS"
115     ;;
116   *)
117     AC_MSG_RESULT(no)
118     CFLAGS="-O2 -g $CFLAGS"
119     ;;
120 esac ], CFLAGS="-O2 -g $CFLAGS"
121         AC_MSG_RESULT(no))
122
123 # SOCKS4 support checking
124 AC_MSG_CHECKING(whether to support SOCKS4)
125 AC_ARG_WITH(socks4,
126 [  --with-socks4[=PATH]    Compile with SOCKS4 support.],
127 [ case "$withval" in
128   no)
129     AC_MSG_RESULT(no)
130     ;;
131   *)
132     AC_MSG_RESULT(yes)
133     socks=4
134
135     if test -d "$withval/include"; then
136       CFLAGS="$CFLAGS -I$withval/include"
137     else
138       CFLAGS="$CFLAGS -I$withval"
139     fi
140     if test -d "$withval/lib"; then
141       withval="-L$withval/lib -lsocks"
142     else
143       withval="-L$withval -lsocks"
144     fi
145
146     LIBS="$withval $LIBS"
147
148     AC_TRY_LINK([],
149                 [ Rconnect(); ],
150                 [],
151                 [ AC_MSG_ERROR(Could not find SOCKS4 library.)])
152       ;;
153   esac ],
154   AC_MSG_RESULT(no)
155 )   
156
157 # SOCKS5 support checking
158 AC_MSG_CHECKING(whether to support SOCKS5)
159 AC_ARG_WITH(socks5,
160 [  --with-socks5[=PATH]    Compile with SOCKS5 support.],
161 [ case "$withval" in
162   no)
163     AC_MSG_RESULT(no)
164     ;;
165   *)
166     AC_MSG_RESULT(yes)
167     socks=5
168
169     if test -d "$withval/include"; then
170       CFLAGS="$CFLAGS -I$withval/include"
171     else
172       CFLAGS="$CFLAGS -I$withval"
173     fi
174     if test -d "$withval/lib"; then
175       withval="-L$withval/lib -lsocks5"
176     else
177       withval="-L$withval -lsocks5"
178     fi 
179
180     LIBS="$withval $LIBS"
181
182     AC_TRY_LINK([],
183                 [ SOCKSconnect(); ],
184                 [],
185                 [ AC_MSG_ERROR(Could not find SOCKS5 library.)])
186       ;;
187   esac ],
188   AC_MSG_RESULT(no)
189 )   
190
191 if test "x$socks" = "x4"; then
192   AC_DEFINE(SOCKS)
193   CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
194 fi
195
196 if test "x$socks" = "x5"; then
197   AC_DEFINE(SOCKS)
198   AC_DEFINE(SOCKS5)
199   AC_DEFINE(Rconnect, SOCKSconnect)
200   AC_DEFINE(Rgetsockname, SOCKSgetsockname)
201   AC_DEFINE(Rgetpeername, SOCKSgetpeername)
202   AC_DEFINE(Rbind, SOCKSbind)
203   AC_DEFINE(Raccept, SOCKSaccept)
204   AC_DEFINE(Rlisten, SOCKSlisten)
205   AC_DEFINE(Rselect, SOCKSselect)
206   AC_DEFINE(Rrecvfrom, SOCKSrecvfrom)
207   AC_DEFINE(Rsendto, SOCKSsendto)
208   AC_DEFINE(Rrecv, SOCKSrecv)
209   AC_DEFINE(Rsend, SOCKSsend)
210   AC_DEFINE(Rread, SOCKSread)
211   AC_DEFINE(Rwrite, SOCKSwrite)
212   AC_DEFINE(Rrresvport, SOCKSrresvport)
213   AC_DEFINE(Rshutdown, SOCKSshutdown)
214   AC_DEFINE(Rlisten, SOCKSlisten)
215   AC_DEFINE(Rclose, SOCKSclose)
216   AC_DEFINE(Rdup, SOCKSdup)
217   AC_DEFINE(Rdup2, SOCKSdup2)
218   AC_DEFINE(Rfclose, SOCKSfclose)
219   AC_DEFINE(Rgethostbyname, SOCKSgethostbyname)
220 fi
221
222
223 AC_ARG_WITH(silcd-config-file,
224 [  --with-silcd-config-file[=PATH]
225                           Use PATH as default configuration file in SILC
226                           server.],
227 [ AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval") ])
228
229 # XXX
230 #LIBS="$LIBS -lefence"
231
232 # Other configure scripts
233 #AC_CONFIG_SUBDIRS(lib/zlib)
234 AC_CONFIG_SUBDIRS(lib/dotconf)
235 AC_CONFIG_SUBDIRS(lib/silcmath/gmp)
236 AC_CONFIG_SUBDIRS(lib/trq)
237
238 AC_OUTPUT( \
239 Makefile
240 doc/Makefile
241 includes/Makefile
242 lib/Makefile
243 lib/contrib/Makefile
244 lib/silcclient/Makefile
245 lib/silccore/Makefile
246 lib/silccrypt/Makefile
247 lib/silcmath/Makefile
248 lib/silcsim/Makefile
249 lib/silcsim/modules/Makefile
250 lib/silcske/Makefile
251 lib/silcutil/Makefile
252 silc/Makefile
253 silcd/Makefile)