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