1dnl configure.ac --- food for -*-autoconf-*- et al
2dnl
3dnl Copyright (C) 2011-2013 Thien-Thi Nguyen
4dnl Copyright (C) 2000, 2001, 2002, 2003, 2004 Stefan Jahn <stefan@lkcc.org>
5dnl Copyright (C) 2000, 2001 Raimund Jacob <raimi@lkcc.org>
6dnl Copyright (C) 1999 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
7dnl
8dnl This is free software; you can redistribute it and/or modify
9dnl it under the terms of the GNU General Public License as published by
10dnl the Free Software Foundation; either version 3, or (at your option)
11dnl any later version.
12dnl
13dnl This software is distributed in the hope that it will be useful,
14dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16dnl GNU General Public License for more details.
17dnl
18dnl You should have received a copy of the GNU General Public License
19dnl along with this package.  If not, see <http://www.gnu.org/licenses/>.
20dnl
21
22dnl ----------------------------------------------------------------------
23dnl init
24
25AC_PREREQ([2.64])
26AC_INIT([GNU Serveez],[0.2.2],[bug-serveez@gnu.org])
27AC_CONFIG_HEADERS([src/config.h src/svzconfig.h src/guile-missing.h])
28AC_CONFIG_AUX_DIR([build-aux])
29AC_CONFIG_MACRO_DIR([m4])
30AC_CANONICAL_BUILD
31AC_CANONICAL_HOST
32AC_CANONICAL_TARGET
33AM_INIT_AUTOMAKE([1.12.2 no-define no-dist-gzip dist-lzip dist-xz serial-tests])
34AM_MAINTAINER_MODE
35
36dnl ----------------------------------------------------------------------
37dnl information on the package
38
39PROGRAM_VERSION='1.4'
40## 1.3  -- new option: --solitary
41## 1.2  -- new option: --daemon
42## 1.1  -- drop option: --port PORT
43## 1.0  -- initial revision
44AC_SUBST([PROGRAM_VERSION])
45AC_DEFINE_UNQUOTED([PROGRAM_VERSION],["$PROGRAM_VERSION"],
46  [Version of serveez(1).])
47
48LIBSERVEEZ_INTERFACE='2:0:1'
49## 2:0:1       -- new typedef: svz_sock_prefree_fn
50##                new func: svz_sock_prefree
51## 1:0:0       -- initial
52AC_SUBST([LIBSERVEEZ_INTERFACE])
53AC_DEFINE_UNQUOTED([LIBSERVEEZ_INTERFACE],["$LIBSERVEEZ_INTERFACE"],
54  [The triple CUR:REV:AGE describing the libserveez API.])
55
56dnl
57dnl Check whether debug output should be included.
58dnl
59SVZ_FLAG([whether to enable debug output],
60         [yes],[debug],[Include debug output],[
61AC_DEFINE([ENABLE_DEBUG], 1,
62  [Define if debug output should be supported.])
63])
64
65dnl
66dnl Check whether to include support for heap counters.
67dnl
68SVZ_FLAG([whether to enable heap counters],
69         [yes],[heap-count],[Include support for heap counters],[
70AC_DEFINE([ENABLE_HEAP_COUNT], 1,
71  [Define if heap counters should be enabled.])
72])
73
74dnl
75dnl Check whether we try to list local interfaces.
76dnl
77SVZ_FLAG([whether to enable list of local interfaces],
78         [yes],[iflist],[List local interfaces],[
79AC_DEFINE([ENABLE_IFLIST], 1,
80  [Define if we are able to list local network interfaces.])
81])
82
83dnl
84dnl Check whether poll loop should be supported.
85dnl
86SVZ_FLAG([whether to enable poll loop],
87         [yes],[poll],[Include poll(2) server loop],[
88AC_DEFINE([ENABLE_POLL], 1,
89  [Define if poll(2) should be supported if possible.])
90])
91
92dnl
93dnl Check whether ‘sendfile’ should be supported.
94dnl
95SVZ_FLAG([whether to use sendfile(2) if possible],
96         [yes],[sendfile],[Include sendfile(2) support],[
97AC_DEFINE([ENABLE_SENDFILE], 1,
98  [Define if sendfile(2) should be supported if possible.])
99])
100
101dnl
102dnl Check whether the SNTP server should be included.
103dnl
104SVZ_FLAG([whether to enable the SNTP server],
105         [yes],[sntp-proto],[Include the SNTP server],[
106AC_DEFINE([ENABLE_SNTP_PROTO], 1,
107  [Define if the SNTP server should be included.])
108])
109AM_CONDITIONAL([SNTP],[SVZ_Y([enable_sntp_proto])])
110
111dnl
112dnl Check whether the Gnutella server should be included.
113dnl
114SVZ_FLAG([whether to enable the Gnutella spider],
115         [yes],[gnutella],[Include the Gnutella spider],[
116AC_DEFINE([ENABLE_GNUTELLA], 1,
117  [Define if the Gnutella spider should be included.])
118])
119AM_CONDITIONAL([GNUTELLA],[SVZ_Y([enable_gnutella])])
120
121dnl
122dnl Check whether the Tunnel server should be included.
123dnl
124SVZ_FLAG([whether to enable the port forwarder],
125         [yes],[tunnel],[Include port forwarder],[
126AC_DEFINE([ENABLE_TUNNEL], 1,
127  [Define if the port forwarder should be included.])
128])
129AM_CONDITIONAL([TUNNEL],[SVZ_Y([enable_tunnel])])
130
131dnl
132dnl Check whether the control protocol should be included.
133dnl
134SVZ_FLAG([whether to enable support for the control protocol],
135         [yes],[control-proto],[Include the control protocol],[
136AC_DEFINE([ENABLE_CONTROL_PROTO], 1,
137  [Define if the control protocol should be supported.])
138])
139AM_CONDITIONAL([CONTROL],[SVZ_Y([enable_control_proto])])
140
141dnl
142dnl Check whether the IRC protocol should be included.
143dnl
144SVZ_FLAG([whether to enable support for the IRC protocol],
145         [yes],[irc-proto],[Include the IRC protocol],[
146AC_DEFINE([ENABLE_IRC_PROTO], 1,
147  [Define if the IRC protocol should be supported.])
148])
149AM_CONDITIONAL([IRC],[SVZ_Y([enable_irc_proto])])
150
151dnl
152dnl Check whether the IRC protocol "TimeStamp" extension should be included.
153dnl
154SVZ_FLAG([whether to enable TimeStamp for the IRC protocol],
155         [yes],[irc-ts],[Include TimeStamp in IRC protocol],[
156AC_DEFINE([ENABLE_TIMESTAMP], 1,
157  [Define if the IRC protocol TimeStamp extension should be supported.])
158])
159
160dnl
161dnl Check whether the password encryption should be included.
162dnl
163SVZ_FLAG([whether to enable password encryption],
164         [no],[crypt],[Include password encryption])
165
166dnl
167dnl Check whether the HTTP protocol should be included.
168dnl
169SVZ_FLAG([whether to enable support for the HTTP protocol],
170         [yes],[http-proto],[Include the HTTP protocol],[
171AC_DEFINE([ENABLE_HTTP_PROTO], 1,
172  [Define if the HTTP protocol should be supported.])
173])
174AM_CONDITIONAL([HTTP],[SVZ_Y([enable_http_proto])])
175
176dnl
177dnl Check whether the Fake Ident Server should be included.
178dnl
179SVZ_FLAG([whether to enable the fake ident server],
180         [yes],[fakeident],[Include the fake ident server],[
181AC_DEFINE([ENABLE_FAKEIDENT], 1,
182  [Define if the Fake Ident Server should be included.])
183])
184AM_CONDITIONAL([FAKEIDENT],[SVZ_Y([enable_fakeident])])
185
186dnl
187dnl Check whether the passthrough server should be included.
188dnl
189SVZ_FLAG([whether to enable the passthrough server],
190         [yes],[passthrough],[Include the passthrough server],[
191AC_DEFINE([ENABLE_PROG_SERVER], 1,
192  [Define if the program passthrough server should be included.])
193])
194AM_CONDITIONAL([PROG],[SVZ_Y([enable_passthrough])])
195
196dnl
197dnl Check whether the flood protection should be included.
198dnl
199SVZ_FLAG([whether to enable support for flood protection],
200         [yes],[flood],[Include flood protection],[
201AC_DEFINE([ENABLE_FLOOD_PROTECTION], 1,
202  [Define if flood protection should be supported.])
203])
204
205dnl
206dnl Check if guile servers should be included.
207dnl
208SVZ_FLAG([whether to include guile server support],
209         [yes],[guile-server],[Include guile servers],[
210AC_DEFINE([ENABLE_GUILE_SERVER], 1,
211  [Define if guile servers should be supported.])
212])
213
214dnl
215dnl Check for additional searchpath for MinGW32 headers and libraries.
216dnl
217SVZ_WITH([/usr/local/mingw],[mingw],[DIR],[MinGW32 files are in DIR],
218         [no],[/usr/local/mingw],["$withval"])
219MINGDIR="$with_mingw"
220
221dnl
222dnl Check if this is Win32 (CYGWIN/MINGW32).
223dnl
224AS_CASE([$host_os],
225[*mingw32*],[MINGW32=yes CYGWIN=no],
226[*cygwin*],[MINGW32=no CYGWIN=yes])
227AM_CONDITIONAL([MINGW32],[SVZ_Y([MINGW32])]) dnl FIXME: What about ‘CYGWIN’?
228
229dnl
230dnl Check courage.
231dnl
232SVZ_FLAG([whether to install libserveez and headers],
233         [no],[libserveez-install],[Install libserveez and headers],[
234AC_DEFINE([INSTALL_LIBSERVEEZ_AND_HEADERS], 1,
235  [Define if configure enabled installation of libserveez and headers.])
236])
237AM_CONDITIONAL([COURAGEOUS],[SVZ_Y([enable_libserveez_install])])
238
239dnl ----------------------------------------------------------------------
240dnl before doing any compilation
241dnl (e.g., ‘AM_PROG_AR’ does ‘AC_COMPILE_IFELSE’, sigh)
242
243AC_USE_SYSTEM_EXTENSIONS
244
245dnl ----------------------------------------------------------------------
246dnl checks for programs
247
248AC_PROG_INSTALL
249AC_PROG_GREP
250AC_PROG_SED
251AC_PROG_AWK
252AM_PROG_AR
253AC_CHECK_PROG([SOELIM],[soelim],[soelim],
254  [\${top_builddir}/build-aux/fake-soelim])
255AC_CHECK_PROG([WINDRES],[windres],[windres],[:])
256
257dnl
258dnl Check for a proper C compiler.
259dnl
260AC_PROG_CC_C99
261AS_IF([test xno = x"$ac_cv_prog_cc_c99"],
262[AC_MSG_ERROR([No C99 capable compiler found -- see README.])])
263
264dnl
265dnl Libtool.  FIXME: Is this the right place?
266dnl
267AC_MSG_NOTICE([beg: libtool stuff])
268LT_PREREQ([2.4])
269LT_INIT([win32-dll])dnl FIXME: Add ‘dlopen’.
270AC_MSG_NOTICE([end: libtool stuff])
271
272dnl
273dnl Check Guile installation.
274dnl
275SVZ_GUILE_FLAGS
276
277SVZ_CHECK_GUILE_MISSING([
278 ntohs ntohl htons htonl
279 inet-aton inet-ntoa
280])
281
282dnl ----------------------------------------------------------------------
283dnl checks for libraries
284
285dnl
286dnl Check for codec libraries.
287dnl
288AC_CHECK_LIB([z],[zlibVersion])
289AC_CHECK_LIB([bz2],[BZ2_bzCompress],,
290[AC_CHECK_LIB([bz2],[bzCompress])])
291
292AS_IF([SVZ_Y([ac_cv_lib_bz2_BZ2_bzCompress])],[
293AC_DEFINE([HAVE_BZ2LIB_PREFIX], 1,
294 [Define if you have a prefixed bz2 library (>= v1.0)])
295])
296
297dnl
298dnl Check whether extra net libraries are required.
299dnl
300SVZ_LIBS_MAYBE([socketpair],[socket])
301
302dnl
303dnl Check for Solaris nsl and resolv library.
304dnl
305SVZ_LIBS_MAYBE([gethostbyaddr],[nsl])
306SVZ_LIBS_MAYBE([inet_aton],[resolv])
307
308dnl Solaris.
309AC_CHECK_LIB([kstat],[kstat_open])
310
311# woe
312
313resource_FILES=""
314dnl
315dnl WARNING: Possible breakage!
316dnl
317dnl Each AC_CHECK_LIB used to explicitly append to shell var ‘EXTRALIBS’
318dnl (growing left to right).  Now, by omitting the ACTION-IF-FOUND, they
319dnl implicitly prepend to shell var ‘LIBS’ (growing right to left).
320dnl To preserve the original ordering, we have reversed the order in
321dnl each group of sequential AC_CHECK_LIB calls, as well as the order
322dnl of the groups.  This introduces a change in ‘CFLAGS’ and ‘LDFLAGS’
323dnl from the pov of ‘user32’, ‘shell32’ and ‘advapi32’, however:
324dnl previously, they did not have ‘-mno-cygwin’ (etc); now, they do.
325dnl
326dnl Furthermore, these system-level libraries should probably find
327dnl themselves at the end of ‘LIBS’.  To effect that, this woe32 block
328dnl should probably be done earliest (before zlib).
329dnl
330dnl Summary: This (presumably functioning previously) code might now be
331dnl broken.  We say "might" because the maintainers thoroughly avoid
332dnl woe, so this change will go untested until someone complains.
333dnl
334AS_IF([SVZ_Y([CYGWIN]) || SVZ_Y([MINGW32])],[
335  AC_DEFINE([FD_SETSIZE], 4096, [Make CygWin / MinGW32 use large FD sets.])
336  AC_DEFINE([WIN32_LEAN_AND_MEAN], 1, [Define for faster code generation.])
337  resource_FILES="serveez.rc"
338  AS_IF([SVZ_Y([MINGW32])],[
339    AC_CHECK_LIB([mswsock],[main])
340    AC_CHECK_LIB([ws2_32],[main])
341  ])
342  AS_IF([test xno != x"$MINGDIR" && SVZ_NOT_Y([MINGW32])],[
343    CFLAGS="$CFLAGS -mno-cygwin -I${MINGDIR}/include"
344    LDFLAGS="$LDFLAGS -mno-cygwin -L${MINGDIR}/lib"
345    AC_CHECK_LIB([mswsock],[main])
346    AC_CHECK_LIB([ws2_32],[main])
347    AC_MSG_RESULT([using MinGW32 headers and libraries in ${MINGDIR}])
348  ])
349  AC_CHECK_LIB([user32],[main])
350  AC_CHECK_LIB([shell32],[main])
351  AC_CHECK_LIB([advapi32],[main])
352])
353AC_SUBST([resource_FILES])
354
355dnl ----------------------------------------------------------------------
356dnl checks for header files
357
358AC_HEADER_DIRENT
359
360dnl There is no <wait.h> on AIX, but <sys/wait.h>.
361AC_HEADER_SYS_WAIT
362
363AC_CHECK_HEADERS_ONCE([wait.h])
364
365AC_CHECK_HEADERS_ONCE([sys/utsname.h])
366
367AC_CHECK_HEADERS_ONCE([
368  netinet/in.h arpa/inet.h
369  sys/time.h sys/poll.h pwd.h varargs.h
370  getopt.h sys/sockio.h sys/resource.h sys/sendfile.h sys/uio.h
371  ws2tcpip.h dirent.h sys/dirent.h direct.h dl.h dld.h grp.h
372  mach-o/dyld.h zlib.h bzlib.h rpc/rpcent.h rpc/rpc.h rpc/pmap_clnt.h
373  rpc/pmap_prot.h rpc/clnt_soc.h sys/ioctl.h pthread.h floss.h
374])
375
376AC_CHECK_HEADERS_ONCE([netinet/tcp.h])
377AC_CHECK_HEADERS_ONCE([netdb.h])
378
379dnl HP-UX.
380AC_CHECK_HEADERS_ONCE([sys/param.h sys/pstat.h])
381dnl IRIX.
382AC_CHECK_HEADERS_ONCE([sys/sysget.h sys/sysinfo.h])
383
384AS_IF([SVZ_Y([enable_crypt])],[AC_CHECK_HEADERS([crypt.h])])
385
386AC_CHECK_HEADERS([guile/gh.h],,,[
387#include <libguile.h>
388])
389
390dnl woe
391AC_CHECK_HEADERS_ONCE([winsock2.h])
392AC_CHECK_HEADERS([mswsock.h], [], [],[
393#if HAVE_WINSOCK2_H
394# include <winsock2.h>
395#endif
396])
397
398dnl ----------------------------------------------------------------------
399dnl checks for types
400
401AC_TYPE_SIZE_T
402AC_TYPE_OFF_T
403AC_TYPE_MODE_T
404AC_TYPE_UID_T
405
406dnl
407dnl Check for ‘scm_t_bits’ or ‘scm_bits_t’ (sigh).
408dnl
409AC_CHECK_TYPE([scm_t_bits],[smobtag=scm_t_bits],[],[[
410#include <libguile.h>
411]])
412AS_IF([SVZ_NOT_Y([ac_cv_type_scm_t_bits])],
413[AC_CHECK_TYPE([scm_bits_t],[smobtag=scm_bits_t],[smobtag=long],[[
414#include <libguile.h>
415]])])
416AC_DEFINE_UNQUOTED([svz_smob_tag_t],[$smobtag],
417  [Define to the type of a smob tag.])
418AS_UNSET([smobtag])
419
420dnl
421dnl Check for typedef socklen_t in <sys/socket.h>.
422dnl
423AC_CHECK_TYPE([socklen_t], [],
424 [AC_DEFINE([socklen_t], int,
425   [Define to 'int' if <sys/socket.h> does not define.])],
426 [[#include <sys/socket.h>]])
427
428dnl
429dnl Check for the typedef ‘SOCKET’ and ‘HANDLE’ in <winsock2.h>.
430dnl
431socket_defined="int"
432handle_defined="int"
433
434AS_IF([test no != "$MINGDIR"],
435[AS_IF([SVZ_Y([ac_cv_header_winsock2_h])],[
436  socket_defined="SOCKET"
437  handle_defined="HANDLE"
438  AC_DEFINE([Win32_Winsock], 1,
439   [Define if you are using Windows Socket-API (not CYGWIN).])])])
440
441AC_DEFINE_UNQUOTED([svz_t_socket],[$socket_defined],
442  [Define to 'int' if <winsock2.h> does not define 'SOCKET'.])
443
444AC_DEFINE_UNQUOTED([svz_t_handle],[$handle_defined],
445  [Define to 'int' if <winsock2.h> does not define 'HANDLE'.])
446
447AS_UNSET([socket_defined])
448AS_UNSET([handle_defined])
449
450dnl ----------------------------------------------------------------------
451dnl checks for structures
452
453dnl ----------------------------------------------------------------------
454dnl checks for compiler characteristics
455
456AC_C_BIGENDIAN
457
458AC_CHECK_SIZEOF([long], 4)
459AC_CHECK_SIZEOF([void *], 4)
460AS_IF([test $ac_cv_sizeof_long -lt $ac_cv_sizeof_void_p],
461[AC_MSG_ERROR([A 'void *' value does not fit into a 'long' value.])])
462
463dnl
464dnl Check for "hidden visibility" attribute support in GCC.
465dnl
466AS_IF([SVZ_Y([GCC])],
467[AC_CACHE_CHECK([for "hidden visibility" attribute in GCC],
468  [svz_cv_gcc_hvis],
469  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
470    [[__attribute__ ((__visibility__ ("hidden"))) int i;]])],
471      [svz_cv_gcc_hvis=yes],
472      [svz_cv_gcc_hvis=no])])])
473AS_IF([SVZ_Y([svz_cv_gcc_hvis])],
474[AC_DEFINE([GCC_HAS_ATTRIBUTE_VISIBILITY],[1],
475  [Define if gcc supports "hidden visibility" attribute.])])
476
477dnl
478dnl Create additional CFLAGS for MinGW32 and CygWin.
479dnl
480SERVEEZ_CFLAGS=""
481AS_IF([SVZ_Y([CYGWIN]) || SVZ_Y([MINGW32])],
482[AS_IF([SVZ_Y([enable_shared])],
483  [SERVEEZ_CFLAGS="-D__SERVEEZ_IMPORT__"])])
484AC_SUBST([SERVEEZ_CFLAGS])
485
486dnl ----------------------------------------------------------------------
487dnl checks for library functions
488
489AS_IF([SVZ_Y([ac_cv_header_sys_time_h])],
490[AC_CHECK_DECLS([gettimeofday],[],[],[[
491#include <sys/time.h>
492]])])
493
494AC_CHECK_FUNCS([inet_pton])
495AC_CHECK_FUNCS([fwrite_unlocked])
496
497AC_CHECK_FUNCS([mkfifo mknod sendfile])
498AC_CHECK_FUNCS([times poll waitpid])
499AC_CHECK_FUNCS([uname])
500
501AC_CHECK_FUNCS([getrlimit getdtablesize getpwnam seteuid setegid geteuid \
502  getegid shl_load NSAddImage])
503
504dnl
505dnl Check for ‘crypt’ function.
506dnl
507AS_IF([SVZ_Y([enable_crypt])],
508[SVZ_LIBS_MAYBE([crypt],[descrypt crypt])])
509AS_IF([test xno = x"$ac_cv_search_crypt"],
510[AC_MSG_ERROR([--enable-crypt specified but crypt(3) not available
511               (i.e., not in: libc, libdescrypt, libcrypt)])])
512
513dnl MacOS.
514AC_CHECK_FUNCS([host_statistics])
515
516dnl
517dnl Check for ‘getopt’ and ‘getopt_long’ functions and headers.
518dnl
519SVZ_LIBS_MAYBE([getopt_long],[iberty])
520AS_IF([test no = "$ac_cv_search_getopt_long"],
521[SVZ_LIBS_MAYBE([getopt],[iberty])])
522
523dnl
524dnl We might declare getopt_long ourselves if the headers do not.
525dnl
526AS_IF([test xno != x"$ac_cv_search_getopt_long"],[
527  AC_CHECK_DECLS([getopt_long], [], [], [[#include <getopt.h>]])])
528
529dnl
530dnl Check for ‘timezone’ and ‘daylight’ variables
531dnl (FreeBSD and NetBSD do not provide).
532dnl
533AC_CHECK_DECLS([timezone, daylight],,,[[
534#include <time.h>
535]])
536
537dnl
538dnl Check if ‘alphasort’ is declared.  Also check for ‘alphasort’,
539dnl ‘strsignal’ and ‘scandir’ in -liberty.
540dnl
541AC_CHECK_FUNCS([alphasort scandir strsignal])
542
543AS_IF([SVZ_Y([ac_cv_header_dirent_h])],
544[AC_CHECK_DECLS([alphasort], [], [], [[#include <dirent.h>]])])
545
546dnl
547dnl Check for shared library loading interface.
548dnl FIXME: Abrogate; libtool to the rescue!
549dnl
550SVZ_LIBS_MAYBE([dlopen],[dl svld])
551AS_IF([test no = "$ac_cv_search_dlopen"],
552[SVZ_LIBS_MAYBE([dld_link],[dld])])
553
554dnl
555dnl Check for thread libraries.
556dnl
557threadsp=false
558AC_DEFUN([SVZ_SET_THREADSP],[AS_IF([$1],[threadsp=true])])
559AS_IF([SVZ_NOT_Y([ac_cv_func_fwrite_unlocked])],[
560  SVZ_SET_THREADSP([SVZ_Y([MINGW32])])
561  # libpthread for POSIX, libc_r for FreeBSD
562  AS_IF([! $threadsp],[SVZ_LIBS_MAYBE([pthread_create],[pthread c_r])])
563  SVZ_SET_THREADSP([test no != "$ac_cv_search_pthread_create"])
564])
565AS_IF([$threadsp],
566[AC_DEFINE([ENABLE_LOG_MUTEX], 1,
567  [Define to 1 if svz_log should use a mutex around its stdio calls.])])
568AS_UNSET([threadsp])
569
570dnl
571dnl Check for ‘hstrerror’, ‘h_errno’ and ‘strsignal’ functions.
572dnl
573AC_CHECK_DECLS([strsignal], [], [], [[
574    #include <string.h>
575]])
576
577SVZ_LIBS_MAYBE([hstrerror],[resolv])
578
579AS_IF([test no != "$ac_cv_search_hstrerror"],
580[AC_CHECK_DECLS([hstrerror, h_errno], [], [], [[#include <netdb.h>]])])
581
582dnl
583dnl Checks for RPC services.
584dnl
585SVZ_LIBS_MAYBE([getrpcent],[nsl])dnl libnsl for HP-UX.
586AC_CHECK_FUNCS([getrpcbyname getrpcbynumber setrpcent endrpcent \
587  pmap_set pmap_unset pmap_getmaps get_myaddress])
588
589AC_CHECK_DECLS([setrpcent, endrpcent], [], [], [[
590     #ifdef HAVE_NETDB_H
591     # include <netdb.h>
592     #endif
593     #ifdef HAVE_RPC_RPCENT_H
594     # include <rpc/rpcent.h>
595     #endif
596]])
597
598dnl ----------------------------------------------------------------------
599dnl checks for system services
600
601dnl
602dnl Check for the '/proc/stat' file under Linux.
603dnl
604AC_CACHE_CHECK([whether /proc/stat exists],[svz_cv_sys_proc_stat],
605[AS_IF([grep 'cpu  ' /proc/stat >/dev/null 2>&1],
606       [svz_cv_sys_proc_stat=yes],
607       [svz_cv_sys_proc_stat=no])])
608
609AS_IF([SVZ_Y([svz_cv_sys_proc_stat])],
610[AS_CASE([$host_os],
611 [linux*],[AC_DEFINE([HAVE_PROC_STAT], 1,
612            [Define if Linux supports the /proc/stat file.])],
613 [AC_MSG_WARN([disabled '/proc/stat' since '$host_os' is not 'linux'])])])
614
615dnl ----------------------------------------------------------------------
616dnl miscellaneous checks
617
618AC_DEFINE_UNQUOTED([SIZEOF_UINT16],[2],[Number of bytes for uint16_t.])
619AC_DEFINE_UNQUOTED([SIZEOF_UINT32],[4],[Number of bytes for uint32_t.])
620
621dnl ----------------------------------------------------------------------
622dnl write it out
623
624dnl These two are here because their components are computed in two
625dnl sections: "checks for libraries" and "checks for header files".
626AM_CONDITIONAL([WITH_BZLIB],[SVZ_Y([ac_cv_header_bzlib_h]) &&
627                             SVZ_Y([ac_cv_lib_bz2_BZ2_bzCompress]) ||
628                             SVZ_Y([ac_cv_lib_bz2_bzCompress])])
629
630AM_CONDITIONAL([WITH_ZLIB],[SVZ_Y([ac_cv_header_zlib_h]) &&
631                            SVZ_Y([ac_cv_lib_z_zlibVersion])])
632
633dnl
634dnl Setup configuration variables.
635dnl
636SERVEEZ_CONFIG_CFLAGS="-I$prefix/include"
637AS_IF([test x != "x$SERVEEZ_CFLAGS"],
638[SERVEEZ_CONFIG_CFLAGS="$SERVEEZ_CONFIG_CFLAGS $SERVEEZ_CFLAGS"])
639AS_IF([SVZ_Y([enable_shared])],
640[SERVEEZ_CONFIG_LDFLAGS="-L$prefix/lib -lserveez"],
641[SERVEEZ_CONFIG_LDFLAGS="$prefix/lib/libserveez.a"])
642AC_SUBST([SERVEEZ_CONFIG_CFLAGS])
643AC_SUBST([SERVEEZ_CONFIG_LDFLAGS])
644
645dnl
646dnl Output files.
647dnl
648AC_CONFIG_FILES([build-aux/fake-soelim],[chmod +x build-aux/fake-soelim])
649AC_CONFIG_FILES([
650    Makefile src/Makefile src/libserveez/Makefile
651    src/libserveez/coserver/Makefile
652    src/libserveez/codec/Makefile
653    src/serveez-config
654    src/ctrl-server/Makefile
655    src/http-server/Makefile
656    src/irc-core/Makefile
657    src/irc-server/Makefile
658    src/foo-server/Makefile
659    src/sntp-server/Makefile
660    src/nut-server/Makefile
661    src/tunnel-server/Makefile
662    src/fakeident-server/Makefile
663    src/prog-server/Makefile
664    src/guile-server/Makefile
665    doc/Makefile
666    test/Makefile
667])
668
669AC_OUTPUT
670
671AC_MSG_NOTICE([$PACKAGE_STRING successfully configured -- cool!])
672AS_IF([grep "^$host" $srcdir/data/PLATFORMS 1>/dev/null 2>&1],[:],
673[AC_MSG_NOTICE([Welcome!
674  $PACKAGE_NAME has never been compiled or run on this platform.
675  Please send an email to <$PACKAGE_BUGREPORT> including
676  your compiler version and whether it worked correctly or not.
677  '$host' will then be added to the file data/PLATFORMS.])])
678
679dnl ----------------------------------------------------------------------
680dnl configure.ac ends here
681