123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- AC_DEFUN([AC_PC_FROM_UCONTEXT],
- [AC_CHECK_HEADERS(ucontext.h)
-
-
- if grep "Red Hat Linux release 7" /etc/redhat-release >/dev/null 2>&1; then
- AC_DEFINE(HAVE_SYS_UCONTEXT_H, 0, [<sys/ucontext.h> is broken on redhat 7])
- ac_cv_header_sys_ucontext_h=no
- else
- AC_CHECK_HEADERS(sys/ucontext.h)
- fi
- AC_CHECK_HEADERS(cygwin/signal.h)
- AC_MSG_CHECKING([how to access the program counter from a struct ucontext])
- pc_fields=" uc_mcontext.gregs[[REG_PC]]"
- pc_fields="$pc_fields uc_mcontext.gregs[[REG_EIP]]"
- pc_fields="$pc_fields uc_mcontext.gregs[[REG_RIP]]"
- pc_fields="$pc_fields uc_mcontext.sc_ip"
- pc_fields="$pc_fields uc_mcontext.uc_regs->gregs[[PT_NIP]]"
- pc_fields="$pc_fields uc_mcontext.gregs[[R15]]"
- pc_fields="$pc_fields uc_mcontext.arm_pc"
- pc_fields="$pc_fields uc_mcontext.gp_regs[[PT_NIP]]"
- pc_fields="$pc_fields uc_mcontext.mc_eip"
- pc_fields="$pc_fields uc_mcontext.mc_rip"
- pc_fields="$pc_fields uc_mcontext.__gregs[[_REG_EIP]]"
- pc_fields="$pc_fields uc_mcontext.__gregs[[_REG_RIP]]"
- pc_fields="$pc_fields uc_mcontext->ss.eip"
- pc_fields="$pc_fields uc_mcontext->__ss.__eip"
- pc_fields="$pc_fields uc_mcontext->ss.rip"
- pc_fields="$pc_fields uc_mcontext->__ss.__rip"
- pc_fields="$pc_fields uc_mcontext->ss.srr0"
- pc_fields="$pc_fields uc_mcontext->__ss.__srr0"
- pc_field_found=false
- for pc_field in $pc_fields; do
- if ! $pc_field_found; then
-
- if test "x$ac_cv_header_cygwin_signal_h" = xyes; then
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- [[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_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- [[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_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- [[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)
- else
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
- [[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)
- fi
- fi
- done
- if ! $pc_field_found; then
- pc_fields=" sc_eip"
- pc_fields="$pc_fields sc_rip"
- for pc_field in $pc_fields; do
- if ! $pc_field_found; then
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- [[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)
- fi
- done
- fi
- if ! $pc_field_found; then
- [$1]
- fi])
|