mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08: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:
parent
f23425fa95
commit
2e8ce9ae46
@ -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
|
||||
|
152
configure
vendored
152
configure
vendored
@ -652,7 +652,6 @@ LDAP_LIBS_BE
|
||||
LDAP_LIBS_FE
|
||||
PTHREAD_CFLAGS
|
||||
PTHREAD_LIBS
|
||||
PTHREAD_CC
|
||||
acx_pthread_config
|
||||
have_win32_dbghelp
|
||||
HAVE_IPV6
|
||||
@ -12437,8 +12436,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"
|
||||
@ -12454,144 +12454,13 @@ $as_echo "$acx_pthread_ok" >&6; }
|
||||
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).
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
|
||||
$as_echo_n "checking for joinable pthread attribute... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <pthread.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int attr=PTHREAD_CREATE_JOINABLE;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ok=PTHREAD_CREATE_JOINABLE
|
||||
else
|
||||
ok=unknown
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
if test x"$ok" = xunknown; then
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <pthread.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int attr=PTHREAD_CREATE_UNDETACHED;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ok=PTHREAD_CREATE_UNDETACHED
|
||||
else
|
||||
ok=unknown
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
|
||||
|
||||
$as_echo "#define PTHREAD_CREATE_JOINABLE \$ok" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ok}" >&5
|
||||
$as_echo "${ok}" >&6; }
|
||||
if test x"$ok" = xunknown; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: we do not know how to create joinable pthreads" >&5
|
||||
$as_echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;}
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5
|
||||
$as_echo_n "checking if more special flags are required for pthreads... " >&6; }
|
||||
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
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5
|
||||
$as_echo "${flag}" >&6; }
|
||||
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
|
||||
# Extract the first word of "cc_r", so it can be a program name with args.
|
||||
set dummy cc_r; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_PTHREAD_CC+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$PTHREAD_CC"; then
|
||||
ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_PTHREAD_CC="cc_r"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}"
|
||||
fi
|
||||
fi
|
||||
PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
|
||||
if test -n "$PTHREAD_CC"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5
|
||||
$as_echo "$PTHREAD_CC" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$acx_pthread_ok" = xyes; then
|
||||
|
||||
$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
|
||||
|
||||
:
|
||||
else
|
||||
acx_pthread_ok=no
|
||||
|
||||
fi
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@ -12605,15 +12474,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
# enables 5-arg getpwuid_r, among other things.
|
||||
PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
|
||||
|
||||
|
||||
# At this point, we don't want to muck with the compiler name for threading.
|
||||
# Let's see who fails, perhaps AIX. 2004-04-23
|
||||
if test "$PTHREAD_CC" != "$CC"; then
|
||||
as_fn_error $? "
|
||||
PostgreSQL does not support platforms that require a special compiler
|
||||
for thread safety; use --disable-thread-safety to disable thread safety." "$LINENO" 5
|
||||
fi
|
||||
|
||||
# Check for *_r functions
|
||||
_CFLAGS="$CFLAGS"
|
||||
_LIBS="$LIBS"
|
||||
|
@ -1502,15 +1502,6 @@ ACX_PTHREAD # set thread flags
|
||||
# enables 5-arg getpwuid_r, among other things.
|
||||
PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
|
||||
|
||||
|
||||
# At this point, we don't want to muck with the compiler name for threading.
|
||||
# Let's see who fails, perhaps AIX. 2004-04-23
|
||||
if test "$PTHREAD_CC" != "$CC"; then
|
||||
AC_MSG_ERROR([
|
||||
PostgreSQL does not support platforms that require a special compiler
|
||||
for thread safety; use --disable-thread-safety to disable thread safety.])
|
||||
fi
|
||||
|
||||
# Check for *_r functions
|
||||
_CFLAGS="$CFLAGS"
|
||||
_LIBS="$LIBS"
|
||||
|
@ -369,9 +369,6 @@
|
||||
/* Define to 1 if the PS_STRINGS thing exists. */
|
||||
#undef HAVE_PS_STRINGS
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
@ -710,10 +707,6 @@
|
||||
process. */
|
||||
#undef PROFILE_PID_DIR
|
||||
|
||||
/* Define to the necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
|
||||
/* RELSEG_SIZE is the maximum number of blocks allowed in one disk file. Thus,
|
||||
the maximum size of a single file is RELSEG_SIZE * BLCKSZ; relations bigger
|
||||
than that are divided into multiple files. RELSEG_SIZE * BLCKSZ must be
|
||||
|
@ -276,9 +276,6 @@
|
||||
/* Define to 1 if the PS_STRINGS thing exists. */
|
||||
/* #undef HAVE_PS_STRINGS */
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
/* #undef HAVE_PTHREAD */
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#define HAVE_PWD_H 1
|
||||
|
||||
@ -578,10 +575,6 @@
|
||||
/* A string containing the version number, platform, and C compiler */
|
||||
#define PG_VERSION_STR "Uninitialized version string (win32)"
|
||||
|
||||
/* Define to the necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
/* #undef PTHREAD_CREATE_JOINABLE */
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user