added SSL backend for IOMultiplexer
[TransparentIRC.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ([2.67])
4 AC_INIT([TransparentIRC], [0.1], [bugs@pk910.de], [transirc], [http://no.url])
5 AC_PREFIX_DEFAULT([~/transirc])
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE([foreign subdir-objects])
8 AM_SILENT_RULES([yes])
9 AC_CONFIG_HEADERS([config.h])
10
11 LT_INIT([disable-static])
12
13 # Checks for programs.
14 AC_PROG_CC
15 AC_PROG_AWK
16
17 # Checks for libraries.
18 # Get MySQL library and include locations
19 AC_ARG_WITH([mysql],
20   [AS_HELP_STRING([--with-mysql=DIR],
21     [location of the MySQL headers, defaults to /usr/include/mysql])],
22   [MYSQL_CFLAGS="-I$withval"],
23   [MYSQL_CFLAGS='-I/usr/include/mysql'])
24 AC_SUBST([MYSQL_CFLAGS])
25
26 AC_ARG_WITH([mysql-lib],
27   [AS_HELP_STRING([--with-mysql-lib=DIR], [location of the MySQL libraries])],
28   [MYSQL_LIBS="-L$withval -lmysqlclient"],
29   [MYSQL_LIBS='-lmysqlclient'])
30 AC_SUBST([MYSQL_LIBS])
31
32 AC_ARG_WITH([winsock],
33   [AS_HELP_STRING([--with-winsock], [use winsock (WIN32 systems)])],
34   [SYSTEM_LIBS='-lws2_32'],
35   [SYSTEM_LIBS='-ldl'])
36 AC_SUBST([SYSTEM_LIBS])
37
38 do_have_ssl="no";
39 AC_CHECK_LIB(ssl, SSL_read, [
40   AC_CHECK_LIB(crypto, X509_new, [
41     AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h openssl/rand.h, [
42       do_have_ssl="yes";
43     ])
44   ])
45 ])
46
47 if test x"$do_have_ssl" = xyes; then
48   LIBS="$LIBS -lssl -lcrypto"
49   AC_DEFINE([HAVE_SSL], 1, [Define if you are using SSL])
50 fi
51
52 AC_ARG_ENABLE([debug],
53   [AS_HELP_STRING([--enable-debug], [debug mode (compile using -O0 -Wall -Wshadow -Werror)])],
54   [CFLAGS='-g -O0 -Wall -Wshadow -Werror'],
55   [CFLAGS='-g -O2'])
56
57 CFLAGS="$CFLAGS -D_GNU_SOURCE"
58
59 # Checks for header files.
60 AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h windows.h winsock2.h sys/epoll.h sys/event.h])
61
62 # Checks for typedefs, structures, and compiler characteristics.
63
64 # Checks for library functions.
65 AC_FUNC_MALLOC
66 AC_CHECK_FUNCS([gethostbyname memset select socket strchr strdup strstr])
67
68 AC_CONFIG_FILES(Makefile)
69 AC_OUTPUT