1 dnl Process this file with autoconf to produce a configure script.
7 AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
8 AC_ARG_WITH(with_newt, [ --with-newt use newt window library])
10 [ --with-ssl=PATH Specify path to OpenSSL installation ],
12 if test "x$withval" != "xno" ; then
17 dnl Set some system-specific variables which are OK to set before compiler
19 PTHREAD_DEFS=-D_REENTRANT
21 dnl Tru64 Unix requires we use -pthread instead of linking the threads
22 dnl libraries directly, and we can't build threaded programs with gcc
23 dnl due to header file problems.
25 test -z "$CC" && CC=cc
28 dnl FreeBSD is similar:
31 PTHREAD_DEFS=-D_THREAD_SAFE
34 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
37 AC_SUBST(PTHREAD_DEFS)
39 dnl Checks for programs.
42 dnl Configure compiler flags for GCC
43 if test "$GCC" = yes; then
46 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
49 CFLAGS="$CFLAGS -Wall"
54 missing_dir=`cd $ac_aux_dir && pwd`
55 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
57 dnl Checks for libraries.
58 if test "$LIBS" != -pthread; then
59 AC_CHECK_LIB(pthread, pthread_create)
60 AC_CHECK_LIB(pthreads, pthread_create)
62 AC_SEARCH_LIBS(gethostbyname, nsl)
63 AC_SEARCH_LIBS(connect, socket)
65 dnl Checks for header files.
67 dnl AC_HEADER_SYS_WAIT
68 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
70 dnl Checks for typedefs, structures, and compiler characteristics.
76 dnl Checks for library functions.
79 dnl AC_CHECK_FUNCS(strerror)
80 AC_REPLACE_FUNCS(snprintf)
82 dnl Checks for the libical calendaring library.
83 if test "x$with_libical" != xno ; then
84 AC_CHECK_HEADERS(ical.h,
85 [AC_CHECK_LIB(ical, icalcomponent_new,
90 if test "x$ok_libical" = xyes ; then
98 sscanf(ICAL_VERSION, "%f", &v);
99 printf("libical version: %0.2f\n", v);
103 printf("This version is ok.\n");
104 printf("WebCit will be built with calendar support.\n");
107 printf("libical 0.24 or newer is required.\n");
108 printf("WebCit will be built without calendar support.\n");
114 AC_DEFINE(HAVE_LIBICAL)
119 dnl Checks for the newt window library.
120 if test "x$with_newt" != xno ; then
121 AC_CHECK_HEADERS(newt.h,
122 [AC_CHECK_LIB(newt, newtInit,
127 if test "x$ok_newt" = xyes ; then
128 SETUP_LIBS="-lnewt $SETUP_LIBS"
132 # The big search for OpenSSL
133 if test "$with_ssl" != "no"; then
135 saved_LDFLAGS="$LDFLAGS"
136 saved_CFLAGS="$CFLAGS"
137 if test "x$prefix" != "xNONE"; then
138 tryssldir="$tryssldir $prefix"
140 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
141 for ssldir in $tryssldir "" /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
142 CFLAGS="$saved_CFLAGS"
143 LDFLAGS="$saved_LDFLAGS"
144 LIBS="$saved_LIBS -lssl -lcrypto"
146 # Skip directories if they don't exist
147 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
150 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
151 # Try to use $ssldir/lib if it exists, otherwise
153 if test -d "$ssldir/lib" ; then
154 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
155 if test ! -z "$need_dash_r" ; then
156 LDFLAGS="-R$ssldir/lib $LDFLAGS"
159 LDFLAGS="-L$ssldir $saved_LDFLAGS"
160 if test ! -z "$need_dash_r" ; then
161 LDFLAGS="-R$ssldir $LDFLAGS"
164 # Try to use $ssldir/include if it exists, otherwise
166 if test -d "$ssldir/include" ; then
167 CFLAGS="-I$ssldir/include $saved_CFLAGS"
169 CFLAGS="-I$ssldir $saved_CFLAGS"
173 # Basic test to check for compatible version and correct linking
174 # *does not* test for RSA - that comes later.
178 #include <openssl/rand.h>
182 memset(a, 0, sizeof(a));
183 RAND_add(a, sizeof(a), sizeof(a));
184 return(RAND_status() <= 0);
193 if test ! -z "$found_crypto" ; then
198 if test -z "$ssldir" ; then
202 if test ! -z "$found_crypto" ; then
203 ac_cv_openssldir=$ssldir
205 ac_cv_openssldir="no"
209 LDFLAGS="$saved_LDFLAGS"
210 CFLAGS="$saved_CFLAGS"
212 if test "x$ac_cv_openssldir" != "xno" ; then
213 AC_DEFINE(HAVE_OPENSSL)
214 LIBS="-lssl -lcrypto $LIBS"
215 dnl Need to recover ssldir - test above runs in subshell
216 ssldir=$ac_cv_openssldir
217 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
218 # Try to use $ssldir/lib if it exists, otherwise
220 if test -d "$ssldir/lib" ; then
221 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
222 if test ! -z "$need_dash_r" ; then
223 LDFLAGS="-R$ssldir/lib $LDFLAGS"
226 LDFLAGS="-L$ssldir $saved_LDFLAGS"
227 if test ! -z "$need_dash_r" ; then
228 LDFLAGS="-R$ssldir $LDFLAGS"
231 # Try to use $ssldir/include if it exists, otherwise
233 if test -d "$ssldir/include" ; then
234 CFLAGS="-I$ssldir/include $saved_CFLAGS"
236 CFLAGS="-I$ssldir $saved_CFLAGS"