# 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_PREREQ([2.63])
+AC_INIT([NeonServ], [5.6], [bugs@pk910.de], [neonserv], [http://neonserv.krypton-bouncer.de])
AC_PREFIX_DEFAULT([~/neonserv])
+AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([foreign subdir-objects])
+AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([config.h])
+LT_INIT([disable-static])
+
# Checks for programs.
AC_PROG_CC
AC_PROG_AWK
[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])
+AC_CHECK_LIB([ws2_32], [_head_libws2_32_a], [LIBS="$LIBS -lws2_32"])
+AC_CHECK_LIB([dl], [dlopen], [LIBS="$LIBS -ldl"])
+AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"])
+AC_CHECK_LIB([ssl], [SSL_read], [LIBS="$LIBS -lssl"])
+AC_CHECK_LIB([crypto], [X509_new], [LIBS="$LIBS -lcrypto"])
+
+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, [
+ AC_DEFINE([HAVE_SSL], 1, [Define if you are using SSL])
+ ])
+ ])
+])
+
+do_have_threads="no";
+AC_CHECK_LIB(pthread, pthread_create, [
+ AC_CHECK_HEADERS(pthread.h, [
+ do_have_threads="yes"
+ ])
+])
+
+AC_ARG_ENABLE([threads],
+ [AS_HELP_STRING([--enable-threads], [use threads if possible])],
+ [
+ if test x"$do_have_threads" = xyes; then
+ LIBS="$LIBS -lpthread"
+ AC_DEFINE([HAVE_THREADS], 1, [Define if you have Threads])
+ fi
+ ],
+ [])
+
+AC_ARG_ENABLE([memory-debug],
+ [AS_HELP_STRING([--enable-memory-debug], [run memory debugger])],
+ [
+ AC_DEFINE([ENABLE_MEMORY_DEBUG], 1, [Define if you enable memoryDebug.c])
+ ],
+ [])
+
+AC_ARG_ENABLE([mutex-debug],
+ [AS_HELP_STRING([--enable-mutex-debug], [run mutex debugger])],
+ [
+ AC_DEFINE([ENABLE_MUTEX_DEBUG], 1, [Define if you enable mutexDebug.c])
+ ],
+ [])
+
+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'])
+
+CFLAGS="$CFLAGS -D_GNU_SOURCE"
# Checks for header files.
-AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h windows.h winsock2.h])
+AC_CHECK_HEADERS([stdio.h stdlib.h string.h ctype.h windows.h winsock2.h malloc.h features.h sys/types.h sys/socket.h netinet/in.h netinet/tcp.h arpa/inet.h netdb.h sys/wait.h errno.h unistd.h getopt.h stdarg.h sys/time.h time.h signal.h sys/epoll.h sys/event.h ws2tcpip.h mysql.h mysql/errmsg.h errmsg.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([gethostbyname memset select socket strchr strdup strstr])
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES(Makefile)
AC_OUTPUT
\ No newline at end of file