mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-23 20:03:31 +01:00
Use the Autoconf macro AC_USE_SYSTEM_EXTENSIONS
The Autoconf macro AC_USE_SYSTEM_EXTENSIONS defines preprocessor macros which turn on extensions to C and POSIX. The macro also makes it easier for developers to use the extensions without needing (or forgetting) to define them manually. The macro can be safely used because it was introduced in Autoconf 2.60 and Tor requires Autoconf 2.63 and above.
This commit is contained in:
parent
9a63f059b9
commit
94762e37b9
3
changes/bug19139
Normal file
3
changes/bug19139
Normal file
@ -0,0 +1,3 @@
|
||||
o Minor features (build):
|
||||
- Use the Autoconf macro AC_USE_SYSTEM_EXTENSIONS to automatically
|
||||
turn on C and POSIX extensions. Closes ticket 19139.
|
@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
AC_CONFIG_HEADERS([orconfig.h])
|
||||
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
@ -1552,9 +1553,6 @@ int main(int c, char **v) { puts(__FUNCTION__); }])],
|
||||
AC_CACHE_CHECK([whether we have extern char **environ already declared],
|
||||
tor_cv_have_environ_declared,
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
/* We define _GNU_SOURCE here because it is also defined in compat.c.
|
||||
* Without it environ doesn't get declared. */
|
||||
#define _GNU_SOURCE
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -79,24 +79,21 @@ AC_DEFUN([AC_PC_FROM_UCONTEXT],
|
||||
if ! $pc_field_found; then
|
||||
# Prefer sys/ucontext.h to ucontext.h, for OS X's sake.
|
||||
if test "x$ac_cv_header_cygwin_signal_h" = xyes; then
|
||||
AC_TRY_COMPILE([#define _GNU_SOURCE 1
|
||||
#include <cygwin/signal.h>],
|
||||
AC_TRY_COMPILE([#include <cygwin/signal.h>],
|
||||
[ucontext_t u; return u.$pc_field == 0;],
|
||||
AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field,
|
||||
How to access the PC from a struct ucontext)
|
||||
AC_MSG_RESULT([$pc_field])
|
||||
pc_field_found=true)
|
||||
elif test "x$ac_cv_header_sys_ucontext_h" = xyes; then
|
||||
AC_TRY_COMPILE([#define _GNU_SOURCE 1
|
||||
#include <sys/ucontext.h>],
|
||||
AC_TRY_COMPILE([#include <sys/ucontext.h>],
|
||||
[ucontext_t u; return u.$pc_field == 0;],
|
||||
AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field,
|
||||
How to access the PC from a struct ucontext)
|
||||
AC_MSG_RESULT([$pc_field])
|
||||
pc_field_found=true)
|
||||
elif test "x$ac_cv_header_ucontext_h" = xyes; then
|
||||
AC_TRY_COMPILE([#define _GNU_SOURCE 1
|
||||
#include <ucontext.h>],
|
||||
AC_TRY_COMPILE([#include <ucontext.h>],
|
||||
[ucontext_t u; return u.$pc_field == 0;],
|
||||
AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field,
|
||||
How to access the PC from a struct ucontext)
|
||||
|
@ -13,9 +13,6 @@
|
||||
* detect crashes.
|
||||
*/
|
||||
|
||||
#define __USE_GNU
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
#include "orconfig.h"
|
||||
#include "compat.h"
|
||||
#include "util.h"
|
||||
|
@ -12,18 +12,6 @@
|
||||
* the platform.
|
||||
**/
|
||||
|
||||
/* This is required on rh7 to make strptime not complain.
|
||||
* We also need it to make memmem get defined (where available)
|
||||
*/
|
||||
|
||||
/* XXXX We should just use AC_USE_SYSTEM_EXTENSIONS in our autoconf,
|
||||
* and get this (and other important stuff!) automatically. Once we do that,
|
||||
* make sure to also change the extern char **environ detection in
|
||||
* configure.ac, because whether that is declared or not depends on whether
|
||||
* we have _GNU_SOURCE defined! Maybe that means that once we take this out,
|
||||
* we can also take out the configure check. */
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#define COMPAT_PRIVATE
|
||||
#include "compat.h"
|
||||
|
||||
|
@ -10,8 +10,6 @@
|
||||
* functions.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "orconfig.h"
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
@ -11,8 +11,6 @@
|
||||
* modules.)
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "orconfig.h"
|
||||
#include <stdlib.h>
|
||||
#include "compat.h"
|
||||
|
@ -56,7 +56,6 @@ ENABLE_GCC_WARNING(redundant-decls)
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#define _GNU_SOURCE
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
#if defined(USE_LIBSECCOMP)
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -39,12 +39,6 @@ typedef struct sandbox_cfg_elem sandbox_cfg_t;
|
||||
*/
|
||||
#ifdef USE_LIBSECCOMP
|
||||
|
||||
#ifndef __USE_GNU
|
||||
#define __USE_GNU
|
||||
#endif
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <sys/ucontext.h>
|
||||
#include <seccomp.h>
|
||||
#include <netdb.h>
|
||||
|
@ -9,10 +9,6 @@
|
||||
* process control.
|
||||
**/
|
||||
|
||||
/* This is required on rh7 to make strptime not complain.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "orconfig.h"
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
|
@ -50,9 +50,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* #define _POSIX_C_SOURCE 200507 */
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#ifdef DNS_USE_CPU_CLOCK_FOR_ID
|
||||
#ifdef DNS_USE_OPENSSL_FOR_ID
|
||||
#error Multiple id options selected
|
||||
|
Loading…
Reference in New Issue
Block a user