Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7f06c70

Browse files
committed
Revert changes to pthread configure tests on REL9_5_STABLE.
Some buildfarm animals are still unhappy. These changes are becoming tooinvasive for backpatch, for little benefit. This reverts commits080c4da andce0da62.
1 parentc1fb421 commit7f06c70

File tree

5 files changed

+2092
-2446
lines changed

5 files changed

+2092
-2446
lines changed

‎aclocal.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl aclocal.m4
22
m4_include([config/ac_func_accept_argtypes.m4])
3-
m4_include([config/ax_pthread.m4])
3+
m4_include([config/acx_pthread.m4])
44
m4_include([config/c-compiler.m4])
55
m4_include([config/c-library.m4])
66
m4_include([config/docbook.m4])

‎config/acx_pthread.m4

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
dnl This is based on an old macro from the GNU Autoconf Macro Archive at:
2+
dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
3+
dnl but it's been rather heavily hacked --- beware of blindly dropping in
4+
dnl upstream changes!
5+
dnl
6+
AC_DEFUN([ACX_PTHREAD],[
7+
AC_REQUIRE([AC_CANONICAL_HOST])
8+
AC_LANG_SAVE
9+
AC_LANG_C
10+
acx_pthread_ok=no
11+
12+
# We used to check for pthread.h first, but this fails if pthread.h
13+
# requires special compiler flags (e.g. on True64 or Sequent).
14+
# It gets checked for in the link test anyway.
15+
16+
# First of all, check if the user has set any of the PTHREAD_LIBS,
17+
# etcetera environment variables, and if threads linking works using
18+
# them:
19+
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
20+
save_CFLAGS="$CFLAGS"
21+
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
22+
save_LIBS="$LIBS"
23+
LIBS="$PTHREAD_LIBS $LIBS"
24+
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
25+
AC_TRY_LINK_FUNC(pthread_join,acx_pthread_ok=yes)
26+
AC_MSG_RESULT($acx_pthread_ok)
27+
if test x"$acx_pthread_ok" = xno; then
28+
PTHREAD_LIBS=""
29+
PTHREAD_CFLAGS=""
30+
fi
31+
LIBS="$save_LIBS"
32+
CFLAGS="$save_CFLAGS"
33+
fi
34+
35+
# We must check for the threads library under a number of different
36+
# names; the ordering is very important because some systems
37+
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
38+
# libraries is broken (non-POSIX).
39+
40+
# Create a list of thread flags to try. Items starting with a "-" are
41+
# C compiler flags, and other items are library names, except for "none"
42+
# which indicates that we try without any flags at all, and "pthread-config"
43+
# which is a program returning the flags for the Pth emulation library.
44+
45+
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config pthreadGC2"
46+
47+
# The ordering *is* (sometimes) important. Some notes on the
48+
# individual items follow:
49+
50+
# pthreads: AIX (must check this before -lpthread)
51+
# none: in case threads are in libc; should be tried before -Kthread and
52+
# other compiler flags to prevent continual compiler warnings
53+
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
54+
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
55+
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
56+
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
57+
# -pthreads: Solaris/gcc
58+
# -mthreads: Mingw32/gcc, Lynx/gcc
59+
# -mt: Sun Workshop C (may only link SunOS threads[-lthread], but it
60+
# doesn't hurt to check since this sometimes defines pthreads too;
61+
# also defines -D_REENTRANT)
62+
# pthread: Linux, etcetera
63+
# --thread-safe: KAI C++
64+
# pthread-config: use pthread-config program (for GNU Pth library)
65+
66+
case "${host_cpu}-${host_os}" in
67+
*solaris*)
68+
69+
# On Solaris (at least, for some versions), libc contains stubbed
70+
# (non-functional) versions of the pthreads routines, so link-based
71+
# tests will erroneously succeed. (We need to link with -pthread or
72+
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
73+
# a function called by this macro, so we could check for that, but
74+
# who knows whether they'll stub that too in a future libc.) So,
75+
# we'll just look for -pthreads and -lpthread first:
76+
77+
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
78+
;;
79+
esac
80+
81+
if test x"$acx_pthread_ok" = xno; then
82+
for flag in $acx_pthread_flags; do
83+
84+
tryPTHREAD_CFLAGS=""
85+
tryPTHREAD_LIBS=""
86+
case $flag in
87+
none)
88+
AC_MSG_CHECKING([whether pthreads work without any flags])
89+
;;
90+
91+
-*)
92+
AC_MSG_CHECKING([whether pthreads work with $flag])
93+
tryPTHREAD_CFLAGS="$flag"
94+
;;
95+
96+
pthread-config)
97+
# skip this if we already have flags defined, for PostgreSQL
98+
if test x"$PTHREAD_CFLAGS" != x -o x"$PTHREAD_LIBS" != x; then continue; fi
99+
AC_CHECK_PROG(acx_pthread_config,pthread-config,yes,no)
100+
if test x"$acx_pthread_config" = xno; then continue; fi
101+
tryPTHREAD_CFLAGS="`pthread-config --cflags`"
102+
tryPTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
103+
;;
104+
105+
*)
106+
AC_MSG_CHECKING([for the pthreads library -l$flag])
107+
tryPTHREAD_LIBS="-l$flag"
108+
;;
109+
esac
110+
111+
save_LIBS="$LIBS"
112+
save_CFLAGS="$CFLAGS"
113+
LIBS="$tryPTHREAD_LIBS $PTHREAD_LIBS $LIBS"
114+
CFLAGS="$CFLAGS $PTHREAD_CFLAGS $tryPTHREAD_CFLAGS"
115+
116+
# Check for various functions. We must include pthread.h,
117+
# since some functions may be macros. (On the Sequent, we
118+
# need a special flag -Kthread to make this header compile.)
119+
# We check for pthread_join because it is in -lpthread on IRIX
120+
# while pthread_create is in libc. We check for pthread_attr_init
121+
# due to DEC craziness with -lpthreads. We check for
122+
# pthread_cleanup_push because it is one of the few pthread
123+
# functions on Solaris that doesn't have a non-functional libc stub.
124+
# We try pthread_create on general principles.
125+
AC_TRY_LINK([#include <pthread.h>],
126+
[pthread_t th; pthread_join(th, 0);
127+
pthread_attr_init(0); pthread_cleanup_push(0, 0);
128+
pthread_create(0,0,0,0); pthread_cleanup_pop(0);],
129+
[acx_pthread_ok=yes],[acx_pthread_ok=no])
130+
131+
if test "x$acx_pthread_ok" = xyes; then
132+
# Don't use options that are ignored by the compiler.
133+
# We find them by checking stderror.
134+
cat >conftest.$ac_ext <<_ACEOF
135+
int
136+
main (int argc, char **argv)
137+
{
138+
(void) argc;
139+
(void) argv;
140+
return 0;
141+
}
142+
_ACEOF
143+
rm -f conftest.$ac_objext conftest$ac_exeext
144+
# Check both linking and compiling, because they might tolerate different options.
145+
if test "`(eval $ac_link 2>&1 1>&5)`" = "" && test "`(eval $ac_compile 2>&1 1>&5)`" = ""; then
146+
# The original macro breaks out of the loop at this point,
147+
# but we continue trying flags because Linux needs -lpthread
148+
# too to build libpq successfully. The test above only
149+
# tests for building binaries, not shared libraries.
150+
PTHREAD_LIBS=" $tryPTHREAD_LIBS $PTHREAD_LIBS"
151+
PTHREAD_CFLAGS="$PTHREAD_CFLAGS $tryPTHREAD_CFLAGS"
152+
else acx_pthread_ok=no
153+
fi
154+
fi
155+
156+
LIBS="$save_LIBS"
157+
CFLAGS="$save_CFLAGS"
158+
159+
AC_MSG_RESULT($acx_pthread_ok)
160+
done
161+
fi
162+
163+
# The original macro has a bunch of other tests here, which we have removed
164+
# because (a) Postgres doesn't need them, and (b) $acx_pthread_ok is not
165+
# meaningful at this point.
166+
167+
AC_SUBST(PTHREAD_LIBS)
168+
AC_SUBST(PTHREAD_CFLAGS)
169+
170+
AC_LANG_RESTORE
171+
])dnl ACX_PTHREAD

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp