added experimental multi thread support
[NeonServV5.git] / configure.ac
index 308d5f4284472e475e8ca63bec8dd089e5de5dcc..9dc6e4f2b1539a034ca5bf2192da1fb2b0719a8a 100644 (file)
@@ -1,7 +1,8 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.67])
-AC_INIT([NeonServ], [5.0], [bugs@pk910.de], [neonserv], [http://neonserv.krypton-bouncer.de])
+AC_INIT([NeonServ], [5.3], [bugs@pk910.de], [neonserv], [http://neonserv.krypton-bouncer.de])
+AC_PREFIX_DEFAULT([~/neonserv])
 AM_INIT_AUTOMAKE([foreign subdir-objects])
 AC_CONFIG_HEADERS([config.h])
 
@@ -11,21 +12,53 @@ AC_PROG_AWK
 
 # Checks for libraries.
 # Get MySQL library and include locations
-AC_ARG_WITH([mysql-include-path],
-  [AS_HELP_STRING([--with-mysql-include-path],
+AC_ARG_WITH([mysql],
+  [AS_HELP_STRING([--with-mysql=DIR],
     [location of the MySQL headers, defaults to /usr/include/mysql])],
   [MYSQL_CFLAGS="-I$withval"],
   [MYSQL_CFLAGS='-I/usr/include/mysql'])
 AC_SUBST([MYSQL_CFLAGS])
 
-AC_ARG_WITH([mysql-lib-path],
-  [AS_HELP_STRING([--with-mysql-lib-path], [location of the MySQL libraries])],
+AC_ARG_WITH([mysql-lib],
+  [AS_HELP_STRING([--with-mysql-lib=DIR], [location of the MySQL libraries])],
   [MYSQL_LIBS="-L$withval -lmysqlclient"],
   [MYSQL_LIBS='-lmysqlclient'])
 AC_SUBST([MYSQL_LIBS])
 
+AC_ARG_WITH([winsock],
+  [AS_HELP_STRING([--with-winsock], [use winsock (WIN32 systems)])],
+  [WINSOCK_LIBS='-lws2_32'],
+  [WINSOCK_LIBS=''])
+AC_SUBST([WINSOCK_LIBS])
+
+do_have_ssl="no";
+AC_CHECK_LIB(ssl, SSL_read, [
+  AC_CHECK_LIB(crypto, X509_new, [
+    AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h openssl/rand.h, [
+      do_have_ssl="yes";
+    ])
+  ])
+])
+
+if test x"$do_have_ssl" = xyes; then
+  LIBS="$LIBS -lssl -lcrypto"
+  AC_DEFINE([HAVE_SSL], 1, [Define if you are using SSL])
+fi
+
+AC_CHECK_LIB(pthread, pthread_create, [
+  AC_CHECK_HEADERS(pthread.h, [
+    LIBS="$LIBS -lpthread"
+    AC_DEFINE([HAVE_THREADS], 1, [Define if you have Threads])
+  ])
+])
+
+AC_ARG_ENABLE([debug],
+  [AS_HELP_STRING([--enable-debug], [debug mode (compile using -O0 -Wall -Wshadow -Werror)])],
+  [CFLAGS='-g -O0 -Wall -Wshadow -Werror'],
+  [CFLAGS='-g -O2'])
+
 # Checks for header files.
-AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
+AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h windows.h winsock2.h])
 
 # Checks for typedefs, structures, and compiler characteristics.