Add m4/pc_from_ucontext.m4. It supports NetBSD and OpenBSD as well.
Also, update the version of acx_pthread.m4 git-svn-id: https://google-glog.googlecode.com/svn/trunk@55 eb4d4688-79bd-11dd-afb4-1d65580434c0
This commit is contained in:
parent
424c6fc5c2
commit
4cd8381429
@ -67,6 +67,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_have_attribute.m4 \
|
|||||||
$(top_srcdir)/m4/ac_rwlock.m4 $(top_srcdir)/m4/acx_pthread.m4 \
|
$(top_srcdir)/m4/ac_rwlock.m4 $(top_srcdir)/m4/acx_pthread.m4 \
|
||||||
$(top_srcdir)/m4/google_namespace.m4 \
|
$(top_srcdir)/m4/google_namespace.m4 \
|
||||||
$(top_srcdir)/m4/namespaces.m4 \
|
$(top_srcdir)/m4/namespaces.m4 \
|
||||||
|
$(top_srcdir)/m4/pc_from_ucontext.m4 \
|
||||||
$(top_srcdir)/m4/stl_namespace.m4 \
|
$(top_srcdir)/m4/stl_namespace.m4 \
|
||||||
$(top_srcdir)/m4/using_operator.m4 $(top_srcdir)/configure.ac
|
$(top_srcdir)/m4/using_operator.m4 $(top_srcdir)/configure.ac
|
||||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
|||||||
1
aclocal.m4
vendored
1
aclocal.m4
vendored
@ -7537,5 +7537,6 @@ m4_include([m4/ac_rwlock.m4])
|
|||||||
m4_include([m4/acx_pthread.m4])
|
m4_include([m4/acx_pthread.m4])
|
||||||
m4_include([m4/google_namespace.m4])
|
m4_include([m4/google_namespace.m4])
|
||||||
m4_include([m4/namespaces.m4])
|
m4_include([m4/namespaces.m4])
|
||||||
|
m4_include([m4/pc_from_ucontext.m4])
|
||||||
m4_include([m4/stl_namespace.m4])
|
m4_include([m4/stl_namespace.m4])
|
||||||
m4_include([m4/using_operator.m4])
|
m4_include([m4/using_operator.m4])
|
||||||
|
|||||||
205
configure
vendored
205
configure
vendored
@ -23531,30 +23531,13 @@ test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}"
|
|||||||
# configurations, when -shared is specified, GCC "forgets" to
|
# configurations, when -shared is specified, GCC "forgets" to
|
||||||
# internally use various flags which are still necessary.
|
# internally use various flags which are still necessary.
|
||||||
|
|
||||||
{ echo "$as_me:$LINENO: checking whether to check for GCC pthread/shared inconsistencies" >&5
|
|
||||||
echo $ECHO_N "checking whether to check for GCC pthread/shared inconsistencies... $ECHO_C" >&6; }
|
|
||||||
check_inconsistencies=yes
|
|
||||||
case "${host_cpu}-${host_os}" in
|
|
||||||
*-darwin*) check_inconsistencies=no ;;
|
|
||||||
esac
|
|
||||||
if test x"$GCC" != xyes -o "x$check_inconsistencies" != xyes ; then
|
|
||||||
{ echo "$as_me:$LINENO: result: no" >&5
|
|
||||||
echo "${ECHO_T}no" >&6; }
|
|
||||||
else
|
|
||||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
|
||||||
echo "${ECHO_T}yes" >&6; }
|
|
||||||
|
|
||||||
# In order not to create several levels of indentation, we test
|
|
||||||
# the value of "$ok" until we find out the cure or run out of
|
|
||||||
# ideas.
|
|
||||||
ok="no"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Prepare the flags
|
# Prepare the flags
|
||||||
#
|
#
|
||||||
save_CFLAGS="$CFLAGS"
|
save_CFLAGS="$CFLAGS"
|
||||||
save_LIBS="$LIBS"
|
save_LIBS="$LIBS"
|
||||||
save_CC="$CC"
|
save_CC="$CC"
|
||||||
|
|
||||||
# Try with the flags determined by the earlier checks.
|
# Try with the flags determined by the earlier checks.
|
||||||
#
|
#
|
||||||
# -Wl,-z,defs forces link-time symbol resolution, so that the
|
# -Wl,-z,defs forces link-time symbol resolution, so that the
|
||||||
@ -23567,6 +23550,70 @@ echo "${ECHO_T}yes" >&6; }
|
|||||||
LIBS="$PTHREAD_LIBS $LIBS"
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
CC="$PTHREAD_CC"
|
CC="$PTHREAD_CC"
|
||||||
|
|
||||||
|
# In order not to create several levels of indentation, we test
|
||||||
|
# the value of "$done" until we find the cure or run out of ideas.
|
||||||
|
done="no"
|
||||||
|
|
||||||
|
# First, make sure the CFLAGS we added are actually accepted by our
|
||||||
|
# compiler. If not (and OS X's ld, for instance, does not accept -z),
|
||||||
|
# then we can't do this test.
|
||||||
|
if test x"$done" = xno; then
|
||||||
|
{ echo "$as_me:$LINENO: checking whether to check for GCC pthread/shared inconsistencies" >&5
|
||||||
|
echo $ECHO_N "checking whether to check for GCC pthread/shared inconsistencies... $ECHO_C" >&6; }
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||||
|
if { (ac_try="$ac_link"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_link") 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } && {
|
||||||
|
test -z "$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
} && test -s conftest$ac_exeext &&
|
||||||
|
$as_test_x conftest$ac_exeext; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
done=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
|
||||||
|
if test "x$done" = xyes ; then
|
||||||
|
{ echo "$as_me:$LINENO: result: no" >&5
|
||||||
|
echo "${ECHO_T}no" >&6; }
|
||||||
|
else
|
||||||
|
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||||
|
echo "${ECHO_T}yes" >&6; }
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$done" = xno; then
|
||||||
{ echo "$as_me:$LINENO: checking whether -pthread is sufficient with -shared" >&5
|
{ echo "$as_me:$LINENO: checking whether -pthread is sufficient with -shared" >&5
|
||||||
echo $ECHO_N "checking whether -pthread is sufficient with -shared... $ECHO_C" >&6; }
|
echo $ECHO_N "checking whether -pthread is sufficient with -shared... $ECHO_C" >&6; }
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
@ -23604,7 +23651,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
|||||||
test ! -s conftest.err
|
test ! -s conftest.err
|
||||||
} && test -s conftest$ac_exeext &&
|
} && test -s conftest$ac_exeext &&
|
||||||
$as_test_x conftest$ac_exeext; then
|
$as_test_x conftest$ac_exeext; then
|
||||||
ok=yes
|
done=yes
|
||||||
else
|
else
|
||||||
echo "$as_me: failed program was:" >&5
|
echo "$as_me: failed program was:" >&5
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
@ -23615,19 +23662,20 @@ fi
|
|||||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
|
||||||
if test "x$ok" = xyes; then
|
if test "x$done" = xyes; then
|
||||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||||
echo "${ECHO_T}yes" >&6; }
|
echo "${ECHO_T}yes" >&6; }
|
||||||
else
|
else
|
||||||
{ echo "$as_me:$LINENO: result: no" >&5
|
{ echo "$as_me:$LINENO: result: no" >&5
|
||||||
echo "${ECHO_T}no" >&6; }
|
echo "${ECHO_T}no" >&6; }
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Linux gcc on some architectures such as mips/mipsel forgets
|
# Linux gcc on some architectures such as mips/mipsel forgets
|
||||||
# about -lpthread
|
# about -lpthread
|
||||||
#
|
#
|
||||||
if test x"$ok" = xno; then
|
if test x"$done" = xno; then
|
||||||
{ echo "$as_me:$LINENO: checking whether -lpthread fixes that" >&5
|
{ echo "$as_me:$LINENO: checking whether -lpthread fixes that" >&5
|
||||||
echo $ECHO_N "checking whether -lpthread fixes that... $ECHO_C" >&6; }
|
echo $ECHO_N "checking whether -lpthread fixes that... $ECHO_C" >&6; }
|
||||||
LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
|
LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
|
||||||
@ -23666,7 +23714,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
|||||||
test ! -s conftest.err
|
test ! -s conftest.err
|
||||||
} && test -s conftest$ac_exeext &&
|
} && test -s conftest$ac_exeext &&
|
||||||
$as_test_x conftest$ac_exeext; then
|
$as_test_x conftest$ac_exeext; then
|
||||||
ok=yes
|
done=yes
|
||||||
else
|
else
|
||||||
echo "$as_me: failed program was:" >&5
|
echo "$as_me: failed program was:" >&5
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
@ -23677,7 +23725,7 @@ fi
|
|||||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
|
||||||
if test "x$ok" = xyes; then
|
if test "x$done" = xyes; then
|
||||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||||
echo "${ECHO_T}yes" >&6; }
|
echo "${ECHO_T}yes" >&6; }
|
||||||
PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
|
PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
|
||||||
@ -23689,7 +23737,7 @@ echo "${ECHO_T}no" >&6; }
|
|||||||
#
|
#
|
||||||
# FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
|
# FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
|
||||||
#
|
#
|
||||||
if test x"$ok" = xno; then
|
if test x"$done" = xno; then
|
||||||
{ echo "$as_me:$LINENO: checking whether -lc_r fixes that" >&5
|
{ echo "$as_me:$LINENO: checking whether -lc_r fixes that" >&5
|
||||||
echo $ECHO_N "checking whether -lc_r fixes that... $ECHO_C" >&6; }
|
echo $ECHO_N "checking whether -lc_r fixes that... $ECHO_C" >&6; }
|
||||||
LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
|
LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
|
||||||
@ -23728,7 +23776,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
|||||||
test ! -s conftest.err
|
test ! -s conftest.err
|
||||||
} && test -s conftest$ac_exeext &&
|
} && test -s conftest$ac_exeext &&
|
||||||
$as_test_x conftest$ac_exeext; then
|
$as_test_x conftest$ac_exeext; then
|
||||||
ok=yes
|
done=yes
|
||||||
else
|
else
|
||||||
echo "$as_me: failed program was:" >&5
|
echo "$as_me: failed program was:" >&5
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
@ -23739,7 +23787,7 @@ fi
|
|||||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
|
||||||
if test "x$ok" = xyes; then
|
if test "x$done" = xyes; then
|
||||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||||
echo "${ECHO_T}yes" >&6; }
|
echo "${ECHO_T}yes" >&6; }
|
||||||
PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
|
PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
|
||||||
@ -23748,7 +23796,7 @@ echo "${ECHO_T}yes" >&6; }
|
|||||||
echo "${ECHO_T}no" >&6; }
|
echo "${ECHO_T}no" >&6; }
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test x"$ok" = xno; then
|
if test x"$done" = xno; then
|
||||||
# OK, we have run out of ideas
|
# OK, we have run out of ideas
|
||||||
{ echo "$as_me:$LINENO: WARNING: Impossible to determine how to use pthreads with shared libraries" >&5
|
{ echo "$as_me:$LINENO: WARNING: Impossible to determine how to use pthreads with shared libraries" >&5
|
||||||
echo "$as_me: WARNING: Impossible to determine how to use pthreads with shared libraries" >&2;}
|
echo "$as_me: WARNING: Impossible to determine how to use pthreads with shared libraries" >&2;}
|
||||||
@ -23760,7 +23808,6 @@ echo "$as_me: WARNING: Impossible to determine how to use pthreads with shared l
|
|||||||
CFLAGS="$save_CFLAGS"
|
CFLAGS="$save_CFLAGS"
|
||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
CC="$save_CC"
|
CC="$save_CC"
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
PTHREAD_CC="$CC"
|
PTHREAD_CC="$CC"
|
||||||
fi
|
fi
|
||||||
@ -24527,29 +24574,27 @@ _ACEOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We want to access the "PC" (Program Counter) register from a struct
|
|
||||||
# ucontext. Every system has its own way of doing that. We try all the
|
|
||||||
# possibilities we know about. Note REG_PC should come first (REG_RIP
|
|
||||||
# is also defined on solaris, but does the wrong thing).
|
|
||||||
{ echo "$as_me:$LINENO: checking how to access the program counter from a struct ucontext" >&5
|
{ echo "$as_me:$LINENO: checking how to access the program counter from a struct ucontext" >&5
|
||||||
echo $ECHO_N "checking how to access the program counter from a struct ucontext... $ECHO_C" >&6; }
|
echo $ECHO_N "checking how to access the program counter from a struct ucontext... $ECHO_C" >&6; }
|
||||||
pc_fields=" uc_mcontext.gregs[REG_PC]" # Solaris x86 (32 + 64 bit)
|
pc_fields=" uc_mcontext.gregs[REG_PC]" # Solaris x86 (32 + 64 bit)
|
||||||
pc_fields="$pc_fields uc_mcontext.gregs[REG_EIP]" # Linux (i386)
|
pc_fields="$pc_fields uc_mcontext.gregs[REG_EIP]" # Linux (i386)
|
||||||
pc_fields="$pc_fields uc_mcontext.gregs[REG_RIP]" # Linux (x86_64)
|
pc_fields="$pc_fields uc_mcontext.gregs[REG_RIP]" # Linux (x86_64)
|
||||||
pc_fields="$pc_fields uc_mcontext.sc_ip" # Linux (ia64)
|
pc_fields="$pc_fields uc_mcontext.sc_ip" # Linux (ia64)
|
||||||
pc_fields="$pc_fields uc_mcontext.uc_regs->gregs[PT_NIP]" # Linux (ppc)
|
pc_fields="$pc_fields uc_mcontext.uc_regs->gregs[PT_NIP]" # Linux (ppc)
|
||||||
pc_fields="$pc_fields uc_mcontext.gregs[R15]" # Linux (arm old [untested])
|
pc_fields="$pc_fields uc_mcontext.gregs[R15]" # Linux (arm old [untested])
|
||||||
pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm new [untested])
|
pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm new [untested])
|
||||||
pc_fields="$pc_fields uc_mcontext.mc_eip" # FreeBSD (i386)
|
pc_fields="$pc_fields uc_mcontext.mc_eip" # FreeBSD (i386)
|
||||||
pc_fields="$pc_fields uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested])
|
pc_fields="$pc_fields uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested])
|
||||||
pc_fields="$pc_fields uc_mcontext->ss.eip" # OS X (i386, <=10.4)
|
pc_fields="$pc_fields uc_mcontext.__gregs[_REG_EIP]" # NetBSD (i386)
|
||||||
pc_fields="$pc_fields uc_mcontext->__ss.__eip" # OS X (i386, >=10.5)
|
pc_fields="$pc_fields uc_mcontext.__gregs[_REG_RIP]" # NetBSD (x86_64)
|
||||||
pc_fields="$pc_fields uc_mcontext->ss.rip" # OS X (x86_64)
|
pc_fields="$pc_fields uc_mcontext->ss.eip" # OS X (i386, <=10.4)
|
||||||
pc_fields="$pc_fields uc_mcontext->__ss.__rip" # OS X (>=10.5 [untested])
|
pc_fields="$pc_fields uc_mcontext->__ss.__eip" # OS X (i386, >=10.5)
|
||||||
pc_fields="$pc_fields uc_mcontext->ss.srr0" # OS X (ppc, ppc64 [untested])
|
pc_fields="$pc_fields uc_mcontext->ss.rip" # OS X (x86_64)
|
||||||
pc_fields="$pc_fields uc_mcontext->__ss.__srr0" # OS X (>=10.5 [untested])
|
pc_fields="$pc_fields uc_mcontext->__ss.__rip" # OS X (>=10.5 [untested])
|
||||||
pc_field_found=false
|
pc_fields="$pc_fields uc_mcontext->ss.srr0" # OS X (ppc, ppc64 [untested])
|
||||||
for pc_field in $pc_fields; do
|
pc_fields="$pc_fields uc_mcontext->__ss.__srr0" # OS X (>=10.5 [untested])
|
||||||
|
pc_field_found=false
|
||||||
|
for pc_field in $pc_fields; do
|
||||||
if ! $pc_field_found; then
|
if ! $pc_field_found; then
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
/* confdefs.h. */
|
/* confdefs.h. */
|
||||||
@ -24601,11 +24646,67 @@ fi
|
|||||||
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if ! $pc_field_found; then
|
if ! $pc_field_found; then
|
||||||
|
pc_fields=" sc_eip" # OpenBSD (i386)
|
||||||
|
pc_fields="$pc_fields sc_rip" # OpenBSD (x86_64)
|
||||||
|
for pc_field in $pc_fields; do
|
||||||
|
if ! $pc_field_found; then
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <signal.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
ucontext_t u; return u.$pc_field == 0;
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (ac_try="$ac_compile"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_compile") 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } && {
|
||||||
|
test -z "$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
} && test -s conftest.$ac_objext; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define PC_FROM_UCONTEXT $pc_field
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
{ echo "$as_me:$LINENO: result: $pc_field" >&5
|
||||||
|
echo "${ECHO_T}$pc_field" >&6; }
|
||||||
|
pc_field_found=true
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if ! $pc_field_found; then
|
||||||
{ echo "$as_me:$LINENO: WARNING: Could not find the PC. Will not output failed addresses..." >&5
|
{ echo "$as_me:$LINENO: WARNING: Could not find the PC. Will not output failed addresses..." >&5
|
||||||
echo "$as_me: WARNING: Could not find the PC. Will not output failed addresses..." >&2;}
|
echo "$as_me: WARNING: Could not find the PC. Will not output failed addresses..." >&2;}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# These are what's needed by logging.h.in and raw_logging.h.in
|
# These are what's needed by logging.h.in and raw_logging.h.in
|
||||||
|
|
||||||
|
|||||||
36
configure.ac
36
configure.ac
@ -172,41 +172,7 @@ AC_DEFINE_GOOGLE_NAMESPACE(google)
|
|||||||
|
|
||||||
AC_CXX_USING_OPERATOR
|
AC_CXX_USING_OPERATOR
|
||||||
|
|
||||||
# We want to access the "PC" (Program Counter) register from a struct
|
AC_PC_FROM_UCONTEXT(AC_MSG_WARN(Could not find the PC. Will not output failed addresses...))
|
||||||
# ucontext. Every system has its own way of doing that. We try all the
|
|
||||||
# possibilities we know about. Note REG_PC should come first (REG_RIP
|
|
||||||
# is also defined on solaris, but does the wrong thing).
|
|
||||||
AC_MSG_CHECKING([how to access the program counter from a struct ucontext])
|
|
||||||
pc_fields=" uc_mcontext.gregs[[REG_PC]]" # Solaris x86 (32 + 64 bit)
|
|
||||||
pc_fields="$pc_fields uc_mcontext.gregs[[REG_EIP]]" # Linux (i386)
|
|
||||||
pc_fields="$pc_fields uc_mcontext.gregs[[REG_RIP]]" # Linux (x86_64)
|
|
||||||
pc_fields="$pc_fields uc_mcontext.sc_ip" # Linux (ia64)
|
|
||||||
pc_fields="$pc_fields uc_mcontext.uc_regs->gregs[[PT_NIP]]" # Linux (ppc)
|
|
||||||
pc_fields="$pc_fields uc_mcontext.gregs[[R15]]" # Linux (arm old [untested])
|
|
||||||
pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm new [untested])
|
|
||||||
pc_fields="$pc_fields uc_mcontext.mc_eip" # FreeBSD (i386)
|
|
||||||
pc_fields="$pc_fields uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested])
|
|
||||||
pc_fields="$pc_fields uc_mcontext->ss.eip" # OS X (i386, <=10.4)
|
|
||||||
pc_fields="$pc_fields uc_mcontext->__ss.__eip" # OS X (i386, >=10.5)
|
|
||||||
pc_fields="$pc_fields uc_mcontext->ss.rip" # OS X (x86_64)
|
|
||||||
pc_fields="$pc_fields uc_mcontext->__ss.__rip" # OS X (>=10.5 [untested])
|
|
||||||
pc_fields="$pc_fields uc_mcontext->ss.srr0" # OS X (ppc, ppc64 [untested])
|
|
||||||
pc_fields="$pc_fields uc_mcontext->__ss.__srr0" # OS X (>=10.5 [untested])
|
|
||||||
pc_field_found=false
|
|
||||||
for pc_field in $pc_fields; do
|
|
||||||
if ! $pc_field_found; then
|
|
||||||
AC_TRY_COMPILE([#define _GNU_SOURCE 1
|
|
||||||
#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)
|
|
||||||
AC_MSG_RESULT([$pc_field])
|
|
||||||
pc_field_found=true)
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if ! $pc_field_found; then
|
|
||||||
AC_MSG_WARN(Could not find the PC. Will not output failed addresses...)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# These are what's needed by logging.h.in and raw_logging.h.in
|
# These are what's needed by logging.h.in and raw_logging.h.in
|
||||||
AC_SUBST(ac_google_start_namespace)
|
AC_SUBST(ac_google_start_namespace)
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
# This was retrieved from
|
# This was retrieved from
|
||||||
# http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/common/acx_pthread.m4?rev=1227
|
# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi
|
||||||
# See also (perhaps for new versions?)
|
# See also (perhaps for new versions?)
|
||||||
# http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/common/acx_pthread.m4
|
# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi
|
||||||
|
#
|
||||||
|
# We've rewritten the inconsistency check code (from avahi), to work
|
||||||
|
# more broadly. In particular, it no longer assumes ld accepts -zdefs.
|
||||||
|
# This caused a restructing of the code, but the functionality has only
|
||||||
|
# changed a little.
|
||||||
|
|
||||||
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||||
dnl
|
dnl
|
||||||
@ -236,27 +241,13 @@ if test "x$acx_pthread_ok" = xyes; then
|
|||||||
# configurations, when -shared is specified, GCC "forgets" to
|
# configurations, when -shared is specified, GCC "forgets" to
|
||||||
# internally use various flags which are still necessary.
|
# internally use various flags which are still necessary.
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
|
|
||||||
check_inconsistencies=yes
|
|
||||||
case "${host_cpu}-${host_os}" in
|
|
||||||
*-darwin*) check_inconsistencies=no ;;
|
|
||||||
esac
|
|
||||||
if test x"$GCC" != xyes -o "x$check_inconsistencies" != xyes ; then
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
|
|
||||||
# In order not to create several levels of indentation, we test
|
|
||||||
# the value of "$ok" until we find out the cure or run out of
|
|
||||||
# ideas.
|
|
||||||
ok="no"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Prepare the flags
|
# Prepare the flags
|
||||||
#
|
#
|
||||||
save_CFLAGS="$CFLAGS"
|
save_CFLAGS="$CFLAGS"
|
||||||
save_LIBS="$LIBS"
|
save_LIBS="$LIBS"
|
||||||
save_CC="$CC"
|
save_CC="$CC"
|
||||||
|
|
||||||
# Try with the flags determined by the earlier checks.
|
# Try with the flags determined by the earlier checks.
|
||||||
#
|
#
|
||||||
# -Wl,-z,defs forces link-time symbol resolution, so that the
|
# -Wl,-z,defs forces link-time symbol resolution, so that the
|
||||||
@ -269,33 +260,53 @@ if test "x$acx_pthread_ok" = xyes; then
|
|||||||
LIBS="$PTHREAD_LIBS $LIBS"
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
CC="$PTHREAD_CC"
|
CC="$PTHREAD_CC"
|
||||||
|
|
||||||
|
# In order not to create several levels of indentation, we test
|
||||||
|
# the value of "$done" until we find the cure or run out of ideas.
|
||||||
|
done="no"
|
||||||
|
|
||||||
|
# First, make sure the CFLAGS we added are actually accepted by our
|
||||||
|
# compiler. If not (and OS X's ld, for instance, does not accept -z),
|
||||||
|
# then we can't do this test.
|
||||||
|
if test x"$done" = xno; then
|
||||||
|
AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
|
||||||
|
AC_TRY_LINK(,, , [done=yes])
|
||||||
|
|
||||||
|
if test "x$done" = xyes ; then
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$done" = xno; then
|
||||||
AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
|
AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
|
||||||
AC_TRY_LINK([#include <pthread.h>],
|
AC_TRY_LINK([#include <pthread.h>],
|
||||||
[pthread_t th; pthread_join(th, 0);
|
[pthread_t th; pthread_join(th, 0);
|
||||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
||||||
[ok=yes])
|
[done=yes])
|
||||||
|
|
||||||
if test "x$ok" = xyes; then
|
if test "x$done" = xyes; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Linux gcc on some architectures such as mips/mipsel forgets
|
# Linux gcc on some architectures such as mips/mipsel forgets
|
||||||
# about -lpthread
|
# about -lpthread
|
||||||
#
|
#
|
||||||
if test x"$ok" = xno; then
|
if test x"$done" = xno; then
|
||||||
AC_MSG_CHECKING([whether -lpthread fixes that])
|
AC_MSG_CHECKING([whether -lpthread fixes that])
|
||||||
LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
|
LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
|
||||||
AC_TRY_LINK([#include <pthread.h>],
|
AC_TRY_LINK([#include <pthread.h>],
|
||||||
[pthread_t th; pthread_join(th, 0);
|
[pthread_t th; pthread_join(th, 0);
|
||||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
||||||
[ok=yes])
|
[done=yes])
|
||||||
|
|
||||||
if test "x$ok" = xyes; then
|
if test "x$done" = xyes; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
|
PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
|
||||||
else
|
else
|
||||||
@ -305,23 +316,23 @@ if test "x$acx_pthread_ok" = xyes; then
|
|||||||
#
|
#
|
||||||
# FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
|
# FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
|
||||||
#
|
#
|
||||||
if test x"$ok" = xno; then
|
if test x"$done" = xno; then
|
||||||
AC_MSG_CHECKING([whether -lc_r fixes that])
|
AC_MSG_CHECKING([whether -lc_r fixes that])
|
||||||
LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
|
LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
|
||||||
AC_TRY_LINK([#include <pthread.h>],
|
AC_TRY_LINK([#include <pthread.h>],
|
||||||
[pthread_t th; pthread_join(th, 0);
|
[pthread_t th; pthread_join(th, 0);
|
||||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
||||||
[ok=yes])
|
[done=yes])
|
||||||
|
|
||||||
if test "x$ok" = xyes; then
|
if test "x$done" = xyes; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
|
PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test x"$ok" = xno; then
|
if test x"$done" = xno; then
|
||||||
# OK, we have run out of ideas
|
# OK, we have run out of ideas
|
||||||
AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
|
AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
|
||||||
|
|
||||||
@ -332,7 +343,6 @@ if test "x$acx_pthread_ok" = xyes; then
|
|||||||
CFLAGS="$save_CFLAGS"
|
CFLAGS="$save_CFLAGS"
|
||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
CC="$save_CC"
|
CC="$save_CC"
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
PTHREAD_CC="$CC"
|
PTHREAD_CC="$CC"
|
||||||
fi
|
fi
|
||||||
|
|||||||
56
m4/pc_from_ucontext.m4
Normal file
56
m4/pc_from_ucontext.m4
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# We want to access the "PC" (Program Counter) register from a struct
|
||||||
|
# ucontext. Every system has its own way of doing that. We try all the
|
||||||
|
# possibilities we know about. Note REG_PC should come first (REG_RIP
|
||||||
|
# is also defined on solaris, but does the wrong thing).
|
||||||
|
|
||||||
|
# OpenBSD doesn't have ucontext.h, but we can get PC from ucontext_t
|
||||||
|
# by using signal.h.
|
||||||
|
|
||||||
|
AC_DEFUN([AC_PC_FROM_UCONTEXT],
|
||||||
|
[AC_MSG_CHECKING([how to access the program counter from a struct ucontext])
|
||||||
|
pc_fields=" uc_mcontext.gregs[[REG_PC]]" # Solaris x86 (32 + 64 bit)
|
||||||
|
pc_fields="$pc_fields uc_mcontext.gregs[[REG_EIP]]" # Linux (i386)
|
||||||
|
pc_fields="$pc_fields uc_mcontext.gregs[[REG_RIP]]" # Linux (x86_64)
|
||||||
|
pc_fields="$pc_fields uc_mcontext.sc_ip" # Linux (ia64)
|
||||||
|
pc_fields="$pc_fields uc_mcontext.uc_regs->gregs[[PT_NIP]]" # Linux (ppc)
|
||||||
|
pc_fields="$pc_fields uc_mcontext.gregs[[R15]]" # Linux (arm old [untested])
|
||||||
|
pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm new [untested])
|
||||||
|
pc_fields="$pc_fields uc_mcontext.mc_eip" # FreeBSD (i386)
|
||||||
|
pc_fields="$pc_fields uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested])
|
||||||
|
pc_fields="$pc_fields uc_mcontext.__gregs[[_REG_EIP]]" # NetBSD (i386)
|
||||||
|
pc_fields="$pc_fields uc_mcontext.__gregs[[_REG_RIP]]" # NetBSD (x86_64)
|
||||||
|
pc_fields="$pc_fields uc_mcontext->ss.eip" # OS X (i386, <=10.4)
|
||||||
|
pc_fields="$pc_fields uc_mcontext->__ss.__eip" # OS X (i386, >=10.5)
|
||||||
|
pc_fields="$pc_fields uc_mcontext->ss.rip" # OS X (x86_64)
|
||||||
|
pc_fields="$pc_fields uc_mcontext->__ss.__rip" # OS X (>=10.5 [untested])
|
||||||
|
pc_fields="$pc_fields uc_mcontext->ss.srr0" # OS X (ppc, ppc64 [untested])
|
||||||
|
pc_fields="$pc_fields uc_mcontext->__ss.__srr0" # OS X (>=10.5 [untested])
|
||||||
|
pc_field_found=false
|
||||||
|
for pc_field in $pc_fields; do
|
||||||
|
if ! $pc_field_found; then
|
||||||
|
AC_TRY_COMPILE([#define _GNU_SOURCE 1
|
||||||
|
#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)
|
||||||
|
AC_MSG_RESULT([$pc_field])
|
||||||
|
pc_field_found=true)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if ! $pc_field_found; then
|
||||||
|
pc_fields=" sc_eip" # OpenBSD (i386)
|
||||||
|
pc_fields="$pc_fields sc_rip" # OpenBSD (x86_64)
|
||||||
|
for pc_field in $pc_fields; do
|
||||||
|
if ! $pc_field_found; then
|
||||||
|
AC_TRY_COMPILE([#include <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)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if ! $pc_field_found; then
|
||||||
|
AC_MSG_WARN(Could not find the PC. Will not output failed addresses...)
|
||||||
|
fi])
|
||||||
Loading…
Reference in New Issue
Block a user