added small memory debugger to detect memory leaks
[NeonServV5.git] / configure.ac
index 27747ca10b933858b1428ef83c3f20f20e623617..eb160e597fa517d1a7fe71ff4268c62b145204df 100644 (file)
@@ -45,11 +45,37 @@ if test x"$do_have_ssl" = xyes; then
   AC_DEFINE([HAVE_SSL], 1, [Define if you are using SSL])
 fi
 
+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([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])