]> code.citadel.org Git - citadel.git/blob - webcit/configure.in
73aa21989d3c602826cdd00b4c7440c11033ec42
[citadel.git] / webcit / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl $Id$
3 AC_INIT(webserver.c)
4
5 AC_CANONICAL_HOST
6
7 AC_ARG_WITH(with_libical, [  --with-libical          use libical calendaring library])
8
9 dnl Set some system-specific variables which are OK to set before compiler
10 dnl checks:
11 PTHREAD_DEFS=-D_REENTRANT
12 case "$host" in
13         dnl Tru64 Unix requires we use -pthread instead of linking the threads
14         dnl libraries directly, and we can't build threaded programs with gcc
15         dnl due to header file problems.
16         alpha*-dec-osf*)
17                 test -z "$CC" && CC=cc
18                 LIBS=-pthread
19         ;;
20         dnl FreeBSD is similar:
21         *-*-freebsd*)
22                 LIBS=-pthread
23                 PTHREAD_DEFS=-D_THREAD_SAFE
24         ;;
25         *-*-solaris*)
26                 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
27         ;;
28 esac
29 AC_SUBST(PTHREAD_DEFS)
30
31 dnl Checks for programs.
32 AC_PROG_CC
33
34 dnl Configure compiler flags for GCC
35 if test "$GCC" = yes; then
36         case "$host" in
37                 *-*-solaris*)
38                         CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
39                 ;;
40                 *)
41                         CFLAGS="$CFLAGS -Wall"
42                 ;;
43         esac
44 fi
45
46 missing_dir=`cd $ac_aux_dir && pwd`
47 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
48
49 dnl Checks for libraries.
50 if test "$LIBS" != -pthread; then
51         AC_CHECK_LIB(pthread, pthread_create)
52         AC_CHECK_LIB(pthreads, pthread_create)
53 fi
54 AC_SEARCH_LIBS(gethostbyname, nsl)
55 AC_SEARCH_LIBS(connect, socket)
56
57 dnl Checks for header files.
58 AC_HEADER_STDC
59 dnl AC_HEADER_SYS_WAIT
60 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
61
62 dnl Checks for typedefs, structures, and compiler characteristics.
63 AC_C_CONST
64 AC_TYPE_OFF_T
65 AC_TYPE_SIZE_T
66 dnl AC_HEADER_TIME
67
68 dnl Checks for library functions.
69 AC_TYPE_SIGNAL
70 dnl AC_FUNC_VPRINTF
71 dnl AC_CHECK_FUNCS(strerror)
72 AC_REPLACE_FUNCS(snprintf)
73
74 dnl Checks for the libical calendaring library.
75 if test "x$with_libical" != xno ; then
76         AC_CHECK_HEADERS(ical.h,
77                 [AC_CHECK_LIB(ical, icalcomponent_new,
78                         [ok_libical=yes],,
79         )])
80 fi
81
82 if test "x$ok_libical" = xyes ; then
83
84         AC_TRY_RUN(
85                 [
86 #include <ical.h>
87 main() {
88         float v;
89         int i;
90         sscanf(ICAL_VERSION, "%f", &v);
91         printf("libical version: %0.2f\n", v);
92         v = v * 100.0;
93         i = (int) v;
94         if (i >= 24) {
95                 printf("This version is ok.\n");
96                 printf("WebCit will be built with calendar support.\n");
97                 return(0);
98         }
99         printf("libical 0.24 or newer is required.\n");
100         printf("WebCit will be built without calendar support.\n");
101         return(1);
102 }
103                 ], 
104                 [
105                         LIBS="-lical $LIBS"
106                         AC_DEFINE(HAVE_LIBICAL)
107                 ]
108         )
109 fi
110
111 AC_OUTPUT(Makefile)
112