Alexandre Julliard : configure: Add a check for sys/ ucontext.h and include it where appropriate.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jul 23 14:44:09 CDT 2014


Module: wine
Branch: master
Commit: 8d817997cea784bcf784759e1d3aa93c571c500e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8d817997cea784bcf784759e1d3aa93c571c500e

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jul 23 16:30:13 2014 +0200

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 97a3d08..4b8f784 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 <signal.h>
+  ac_fn_c_check_header_compile "$LINENO" "sys/ucontext.h" "ac_cv_header_sys_ucontext_h" "#include <signal.h>
 "
-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 <sys/types.h>
-#ifdef HAVE_UCONTEXT_H
-#include <ucontext.h>
+#ifdef HAVE_SYS_UCONTEXT_H
+#include <sys/ucontext.h>
 #endif
 "
 if test "x$ac_cv_header_sys_thr_h" = xyes; then :
diff --git a/configure.ac b/configure.ac
index 872d97a..a56cda0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -631,12 +631,12 @@ AC_CHECK_HEADERS([resolv.h],,,
 
 AC_CHECK_HEADERS([ifaddrs.h],,,[#include <sys/types.h>])
 
-AC_CHECK_HEADERS(ucontext.h,,,[#include <signal.h>])
+AC_CHECK_HEADERS(sys/ucontext.h,,,[#include <signal.h>])
 
 AC_CHECK_HEADERS([sys/thr.h],,,
 [#include <sys/types.h>
-#ifdef HAVE_UCONTEXT_H
-#include <ucontext.h>
+#ifdef HAVE_SYS_UCONTEXT_H
+#include <sys/ucontext.h>
 #endif])
 
 AC_CHECK_HEADERS([pthread_np.h],,,
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index f3c6b38..aabda4f 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -63,8 +63,10 @@
 #ifdef HAVE_SYS_UIO_H
 #include <sys/uio.h>
 #endif
+#ifdef HAVE_SYS_UCONTEXT_H
+# include <sys/ucontext.h>
+#endif
 #ifdef HAVE_SYS_THR_H
-#include <sys/ucontext.h>
 #include <sys/thr.h>
 #endif
 #ifdef HAVE_UNISTD_H
diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c
index 0eb7ce0..4671b6d 100644
--- a/dlls/ntdll/signal_arm.c
+++ b/dlls/ntdll/signal_arm.c
@@ -32,7 +32,6 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-
 #ifdef HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
@@ -46,6 +45,9 @@
 #ifdef HAVE_SYS_SIGNAL_H
 # include <sys/signal.h>
 #endif
+#ifdef HAVE_SYS_UCONTEXT_H
+# include <sys/ucontext.h>
+#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 2b82952..69bc806 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -31,7 +31,6 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-
 #ifdef HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
@@ -45,6 +44,9 @@
 #ifdef HAVE_SYS_SIGNAL_H
 # include <sys/signal.h>
 #endif
+#ifdef HAVE_SYS_UCONTEXT_H
+# include <sys/ucontext.h>
+#endif
 
 #include "ntstatus.h"
 #define WIN32_NO_STATUS
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 7b4bc72..3180138 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -32,7 +32,6 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-
 #ifdef HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
@@ -43,17 +42,18 @@
 #  include <sys/syscall.h>
 # endif
 #endif
-
 #ifdef HAVE_SYS_VM86_H
 # include <sys/vm86.h>
 #endif
-
 #ifdef HAVE_SYS_SIGNAL_H
 # include <sys/signal.h>
 #endif
 #ifdef HAVE_SYS_SYSCTL_H
 # include <sys/sysctl.h>
 #endif
+#ifdef HAVE_SYS_UCONTEXT_H
+# include <sys/ucontext.h>
+#endif
 
 #include "ntstatus.h"
 #define WIN32_NO_STATUS
@@ -313,7 +313,6 @@ typedef struct sigcontext SIGCONTEXT;
 #ifdef _SCO_DS
 #include <sys/regset.h>
 #endif
-#include <sys/ucontext.h>
 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 <sys/ucontext.h>
 
 typedef ucontext_t SIGCONTEXT;
 
@@ -407,9 +405,6 @@ typedef ucontext_t SIGCONTEXT;
 #endif
 
 #elif defined(__NetBSD__)
-# include <sys/ucontext.h>
-# include <sys/types.h>
-# include <signal.h>
 
 typedef ucontext_t SIGCONTEXT;
 
diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c
index a457bdf..0fca342 100644
--- a/dlls/ntdll/signal_powerpc.c
+++ b/dlls/ntdll/signal_powerpc.c
@@ -28,10 +28,10 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-
 #ifdef HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
@@ -42,10 +42,12 @@
 #  include <sys/syscall.h>
 # endif
 #endif
-
 #ifdef HAVE_SYS_SIGNAL_H
 # include <sys/signal.h>
 #endif
+#ifdef HAVE_SYS_UCONTEXT_H
+# include <sys/ucontext.h>
+#endif
 
 #include "ntstatus.h"
 #define WIN32_NO_STATUS
@@ -94,9 +96,6 @@ static pthread_key_t teb_key;
 
 #ifdef __APPLE__
 
-# include <sys/ucontext.h>
-# include <sys/types.h>
-
 /* 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 7007db0..5658537 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -28,25 +28,22 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
-
-#ifdef HAVE_UCONTEXT_H
-# include <ucontext.h>
-#endif
-
+#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-
 #ifdef HAVE_MACHINE_SYSARCH_H
 # include <machine/sysarch.h>
 #endif
-
 #ifdef HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
 #ifdef HAVE_SYS_SIGNAL_H
 # include <sys/signal.h>
 #endif
+#ifdef HAVE_SYS_UCONTEXT_H
+# include <sys/ucontext.h>
+#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 <sys/ucontext.h>
 
 #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 <sys/ucontext.h>
-#include <sys/types.h>
-#include <signal.h>
 
 #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 79f8b45..50cfcb8 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1038,6 +1038,9 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <sys/ucontext.h> header file. */
+#undef HAVE_SYS_UCONTEXT_H
+
 /* Define to 1 if you have the <sys/uio.h> 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 <ucontext.h> header file. */
-#undef HAVE_UCONTEXT_H
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
diff --git a/server/ptrace.c b/server/ptrace.c
index aea821d..cb436b6 100644
--- a/server/ptrace.c
+++ b/server/ptrace.c
@@ -40,8 +40,10 @@
 #ifdef HAVE_SYS_SYSCALL_H
 # include <sys/syscall.h>
 #endif
-#ifdef HAVE_SYS_THR_H
+#ifdef HAVE_SYS_UCONTEXT_H
 # include <sys/ucontext.h>
+#endif
+#ifdef HAVE_SYS_THR_H
 # include <sys/thr.h>
 #endif
 #include <unistd.h>




More information about the wine-cvs mailing list