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