commit 9a9ae1ddc3ff759388edf070195f76021402c197
Author: David Goulet <dgou...@ev0ke.net>
Date:   Sun Oct 16 12:16:52 2016 -0400

    Use AC_USE_SYSTEM_EXTENSIONS to try to use POSIX extensions
    
    Signed-off-by: David Goulet <dgou...@ev0ke.net>
---
 configure.ac          | 5 ++++-
 src/common/compat.h   | 2 ++
 src/lib/torsocks.h    | 4 ++--
 tests/utils/tap/tap.c | 3 +++
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index ce263d8..a77a2de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,9 +10,12 @@ AC_CANONICAL_TARGET
 AC_CANONICAL_HOST
 AC_CONFIG_MACRO_DIR([config])
 
-# Create a config.g file to store defines generated by configure
+# Create a config.h file to store defines generated by configure
 AC_CONFIG_HEADER([include/config.h])
 
+# Try to enable the POSIX extensions.
+AC_USE_SYSTEM_EXTENSIONS
+
 # Automake initialization
 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
 
diff --git a/src/common/compat.h b/src/common/compat.h
index d8949e7..2d766e3 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -25,7 +25,9 @@
 #if (defined(__linux__) || defined(__GLIBC__) || defined(__FreeBSD__) || \
                defined(__darwin__) || defined(__NetBSD__))
 
+#ifndef RTLD_NEXT
 #define RTLD_NEXT      ((void *) -1)
+#endif
 
 #include <pthread.h>
 
diff --git a/src/lib/torsocks.h b/src/lib/torsocks.h
index bcaf92b..33da526 100644
--- a/src/lib/torsocks.h
+++ b/src/lib/torsocks.h
@@ -20,6 +20,8 @@
 #ifndef TORSOCKS_H
 #define TORSOCKS_H
 
+#include "config.h"
+
 #include <common/compat.h>
 #include <common/config-file.h>
 
@@ -233,8 +235,6 @@ struct hostent **result, int *h_errnop
 
 #if (defined(__linux__))
 
-#define _GNU_SOURCE
-
 /* syscall(2) */
 #define LIBC_SYSCALL_NAME syscall
 #define LIBC_SYSCALL_NAME_STR XSTR(LIBC_SYSCALL_NAME)
diff --git a/tests/utils/tap/tap.c b/tests/utils/tap/tap.c
index d52cb03..7481e99 100644
--- a/tests/utils/tap/tap.c
+++ b/tests/utils/tap/tap.c
@@ -24,7 +24,10 @@
  * SUCH DAMAGE.
  */
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
+
 #include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>

_______________________________________________
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to