mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Remove some useless code in the configure script.
Almost ten years ago, commit e48322a6d6
broke
the logic in ACX_PTHREAD by looping through all the possible flags rather
than stopping with the first one that would work. This meant that
$acx_pthread_ok was no longer meaningful after the loop; it would usually
be "no", whether or not we'd found working thread flags. The reason nobody
noticed is that Postgres doesn't actually use any of the symbols set up
by the code after the loop. Rather than complicate things some more to
make it work as designed, let's just remove all that dead code, and thereby
save a few cycles in each configure run.
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
dnl PGSGL: When updating, comment out port-specific part below;
|
||||
dnl see the comment below with the word "PostgreSQL".
|
||||
dnl
|
||||
dnl Available from the GNU Autoconf Macro Archive at:
|
||||
dnl This is based on an old macro from the GNU Autoconf Macro Archive at:
|
||||
dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
|
||||
dnl but it's been rather heavily hacked --- beware of blindly dropping in
|
||||
dnl upstream changes!
|
||||
dnl
|
||||
AC_DEFUN([ACX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
@ -144,8 +143,9 @@ _ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
# Check both linking and compiling, because they might tolerate different options.
|
||||
if test "`(eval $ac_link 2>&1 1>&5)`" = "" && test "`(eval $ac_compile 2>&1 1>&5)`" = ""; then
|
||||
# we continue with more flags because Linux needs -lpthread
|
||||
# for libpq builds on PostgreSQL. The test above only
|
||||
# The original macro breaks out of the loop at this point,
|
||||
# but we continue trying flags because Linux needs -lpthread
|
||||
# too to build libpq successfully. The test above only
|
||||
# tests for building binaries, not shared libraries.
|
||||
PTHREAD_LIBS=" $tryPTHREAD_LIBS $PTHREAD_LIBS"
|
||||
PTHREAD_CFLAGS="$PTHREAD_CFLAGS $tryPTHREAD_CFLAGS"
|
||||
@ -160,69 +160,12 @@ _ACEOF
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: threads are created detached by default
|
||||
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[int attr=PTHREAD_CREATE_JOINABLE;],
|
||||
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
|
||||
if test x"$ok" = xunknown; then
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[int attr=PTHREAD_CREATE_UNDETACHED;],
|
||||
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
|
||||
fi
|
||||
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
|
||||
[Define to the necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
AC_MSG_RESULT(${ok})
|
||||
if test x"$ok" = xunknown; then
|
||||
AC_MSG_WARN([we do not know how to create joinable pthreads])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
# We always add these in PostgreSQL
|
||||
# case "${host_cpu}-${host_os}" in
|
||||
# *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
|
||||
# *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
|
||||
# esac
|
||||
AC_MSG_RESULT(${flag})
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# Supporting cc_r would require a special CC in all places that
|
||||
# use libpq, and that is ugly, so we don't do it. Users can still
|
||||
# define their compiler as cc_r to do thread builds of everything.
|
||||
# More AIX lossage: must compile with cc_r
|
||||
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
|
||||
else
|
||||
PTHREAD_CC="$CC"
|
||||
fi
|
||||
# The original macro has a bunch of other tests here, which we have removed
|
||||
# because (a) Postgres doesn't need them, and (b) $acx_pthread_ok is not
|
||||
# meaningful at this point.
|
||||
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(PTHREAD_CFLAGS)
|
||||
AC_SUBST(PTHREAD_CC)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$acx_pthread_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||
:
|
||||
else
|
||||
acx_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_RESTORE
|
||||
])dnl ACX_PTHREAD
|
||||
|
Reference in New Issue
Block a user