From 8d817997cea784bcf784759e1d3aa93c571c500e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 23 Jul 2014 16:30:13 +0200 Subject: [PATCH] configure: Add a check for sys/ucontext.h and include it where appropriate. --- configure | 12 ++++++------ configure.ac | 6 +++--- dlls/ntdll/server.c | 4 +++- dlls/ntdll/signal_arm.c | 6 ++++-- dlls/ntdll/signal_arm64.c | 4 +++- dlls/ntdll/signal_i386.c | 11 +++-------- dlls/ntdll/signal_powerpc.c | 9 ++++----- dlls/ntdll/signal_x86_64.c | 15 ++++----------- include/config.h.in | 6 +++--- server/ptrace.c | 4 +++- 10 files changed, 36 insertions(+), 41 deletions(-) diff --git a/configure b/configure index 97a3d08b5b4..4b8f7846347 100755 --- a/configure +++ b/configure @@ -6812,13 +6812,13 @@ fi done -for ac_header in ucontext.h +for ac_header in sys/ucontext.h do : - ac_fn_c_check_header_compile "$LINENO" "ucontext.h" "ac_cv_header_ucontext_h" "#include + ac_fn_c_check_header_compile "$LINENO" "sys/ucontext.h" "ac_cv_header_sys_ucontext_h" "#include " -if test "x$ac_cv_header_ucontext_h" = xyes; then : +if test "x$ac_cv_header_sys_ucontext_h" = xyes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_UCONTEXT_H 1 +#define HAVE_SYS_UCONTEXT_H 1 _ACEOF fi @@ -6829,8 +6829,8 @@ done for ac_header in sys/thr.h do : ac_fn_c_check_header_compile "$LINENO" "sys/thr.h" "ac_cv_header_sys_thr_h" "#include -#ifdef HAVE_UCONTEXT_H -#include +#ifdef HAVE_SYS_UCONTEXT_H +#include #endif " if test "x$ac_cv_header_sys_thr_h" = xyes; then : diff --git a/configure.ac b/configure.ac index 872d97a6581..a56cda0e5bd 100644 --- a/configure.ac +++ b/configure.ac @@ -631,12 +631,12 @@ AC_CHECK_HEADERS([resolv.h],,, AC_CHECK_HEADERS([ifaddrs.h],,,[#include ]) -AC_CHECK_HEADERS(ucontext.h,,,[#include ]) +AC_CHECK_HEADERS(sys/ucontext.h,,,[#include ]) AC_CHECK_HEADERS([sys/thr.h],,, [#include -#ifdef HAVE_UCONTEXT_H -#include +#ifdef HAVE_SYS_UCONTEXT_H +#include #endif]) AC_CHECK_HEADERS([pthread_np.h],,, diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c index f3c6b38e91f..aabda4fff4e 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -63,8 +63,10 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_SYS_UCONTEXT_H +# include +#endif #ifdef HAVE_SYS_THR_H -#include #include #endif #ifdef HAVE_UNISTD_H diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c index 0eb7ce06438..4671b6d2e6f 100644 --- a/dlls/ntdll/signal_arm.c +++ b/dlls/ntdll/signal_arm.c @@ -32,7 +32,6 @@ #ifdef HAVE_UNISTD_H # include #endif - #ifdef HAVE_SYS_PARAM_H # include #endif @@ -46,6 +45,9 @@ #ifdef HAVE_SYS_SIGNAL_H # include #endif +#ifdef HAVE_SYS_UCONTEXT_H +# include +#endif #define NONAMELESSUNION #define NONAMELESSSTRUCT @@ -68,7 +70,7 @@ static pthread_key_t teb_key; */ #ifdef linux -#ifdef __ANDROID__ +#if defined(__ANDROID__) && !defined(HAVE_SYS_UCONTEXT_H) typedef struct ucontext { unsigned long uc_flags; diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index 2b829520935..69bc806a1fe 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -31,7 +31,6 @@ #ifdef HAVE_UNISTD_H # include #endif - #ifdef HAVE_SYS_PARAM_H # include #endif @@ -45,6 +44,9 @@ #ifdef HAVE_SYS_SIGNAL_H # include #endif +#ifdef HAVE_SYS_UCONTEXT_H +# include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 7b4bc72da0f..318013884a3 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -32,7 +32,6 @@ #ifdef HAVE_UNISTD_H # include #endif - #ifdef HAVE_SYS_PARAM_H # include #endif @@ -43,17 +42,18 @@ # include # endif #endif - #ifdef HAVE_SYS_VM86_H # include #endif - #ifdef HAVE_SYS_SIGNAL_H # include #endif #ifdef HAVE_SYS_SYSCTL_H # include #endif +#ifdef HAVE_SYS_UCONTEXT_H +# include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -313,7 +313,6 @@ typedef struct sigcontext SIGCONTEXT; #ifdef _SCO_DS #include #endif -#include typedef struct ucontext SIGCONTEXT; #ifdef _SCO_DS @@ -357,7 +356,6 @@ typedef struct ucontext SIGCONTEXT; #define FPUX_sig(context) NULL /* FIXME */ #elif defined (__APPLE__) -# include typedef ucontext_t SIGCONTEXT; @@ -407,9 +405,6 @@ typedef ucontext_t SIGCONTEXT; #endif #elif defined(__NetBSD__) -# include -# include -# include typedef ucontext_t SIGCONTEXT; diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c index a457bdf3b44..0fca3424a04 100644 --- a/dlls/ntdll/signal_powerpc.c +++ b/dlls/ntdll/signal_powerpc.c @@ -28,10 +28,10 @@ #include #include #include +#include #ifdef HAVE_UNISTD_H # include #endif - #ifdef HAVE_SYS_PARAM_H # include #endif @@ -42,10 +42,12 @@ # include # endif #endif - #ifdef HAVE_SYS_SIGNAL_H # include #endif +#ifdef HAVE_SYS_UCONTEXT_H +# include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -94,9 +96,6 @@ static pthread_key_t teb_key; #ifdef __APPLE__ -# include -# include - /* All Registers access - only for local access */ # define REG_sig(reg_name, context) ((context)->uc_mcontext->ss.reg_name) # define FLOATREG_sig(reg_name, context) ((context)->uc_mcontext->fs.reg_name) diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 7007db0a00e..5658537eeed 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -28,25 +28,22 @@ #include #include #include - -#ifdef HAVE_UCONTEXT_H -# include -#endif - +#include #ifdef HAVE_UNISTD_H # include #endif - #ifdef HAVE_MACHINE_SYSARCH_H # include #endif - #ifdef HAVE_SYS_PARAM_H # include #endif #ifdef HAVE_SYS_SIGNAL_H # include #endif +#ifdef HAVE_SYS_UCONTEXT_H +# include +#endif #define NONAMELESSUNION #define NONAMELESSSTRUCT @@ -165,7 +162,6 @@ extern int arch_prctl(int func, void *ptr); #define FPU_sig(context) ((XMM_SAVE_AREA32 *)((context)->uc_mcontext.fpregs)) #elif defined(__FreeBSD__) || defined (__FreeBSD_kernel__) -#include #define RAX_sig(context) ((context)->uc_mcontext.mc_rax) #define RBX_sig(context) ((context)->uc_mcontext.mc_rbx) @@ -200,9 +196,6 @@ extern int arch_prctl(int func, void *ptr); #define FPU_sig(context) ((XMM_SAVE_AREA32 *)((context)->uc_mcontext.mc_fpstate)) #elif defined(__NetBSD__) -#include -#include -#include #define RAX_sig(context) ((context)->uc_mcontext.__gregs[_REG_RAX]) #define RBX_sig(context) ((context)->uc_mcontext.__gregs[_REG_RBX]) diff --git a/include/config.h.in b/include/config.h.in index 79f8b45085c..50cfcb8658f 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1038,6 +1038,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UCONTEXT_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UIO_H @@ -1077,9 +1080,6 @@ /* Define if you have the timezone variable */ #undef HAVE_TIMEZONE -/* Define to 1 if you have the header file. */ -#undef HAVE_UCONTEXT_H - /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/server/ptrace.c b/server/ptrace.c index aea821d25d1..cb436b6f08f 100644 --- a/server/ptrace.c +++ b/server/ptrace.c @@ -40,8 +40,10 @@ #ifdef HAVE_SYS_SYSCALL_H # include #endif -#ifdef HAVE_SYS_THR_H +#ifdef HAVE_SYS_UCONTEXT_H # include +#endif +#ifdef HAVE_SYS_THR_H # include #endif #include -- 2.11.4.GIT