1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Ignore libedit/libreadline while probing for standard functions.

Some versions of libedit expose bogus definitions of setproctitle(),
optreset, and perhaps other symbols that we don't want configure to pick up
on.  There was a previous report of similar problems with strlcpy(), which
we addressed in commit 59cf88da91, but the
problem has evidently grown in scope since then.  In hopes of not having to
deal with it again in future, rearrange configure's tests for supplied
functions so that we ignore libedit/libreadline except when probing
specifically for functions we expect them to provide.

Per report from Christoph Berg, though this is slightly more aggressive
than his proposed patch.
This commit is contained in:
Tom Lane
2012-12-18 16:22:31 -05:00
parent 60f95d0596
commit e5e8ad3df5
2 changed files with 295 additions and 293 deletions

View File

@ -1171,6 +1171,13 @@ PGAC_VAR_INT_TIMEZONE
AC_FUNC_ACCEPT_ARGTYPES
PGAC_FUNC_GETTIMEOFDAY_1ARG
# Some versions of libedit contain strlcpy(), setproctitle(), and other
# symbols that that library has no business exposing to the world. Pending
# acquisition of a clue by those developers, ignore libedit (including its
# possible alias of libreadline) while checking for everything else.
LIBS_including_readline="$LIBS"
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getifaddrs getpeereid getpeerucred getrlimit memmove poll pstat readlink scandir setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs])
AC_REPLACE_FUNCS(fseeko)
@ -1285,11 +1292,6 @@ else
AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
fi
# Some versions of libedit contain strlcpy(); so disregard that library while
# checking for these standard libc functions.
pgac_save_LIBS="$LIBS"
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
AC_REPLACE_FUNCS([crypt erand48 getopt getrusage inet_aton random rint srandom strdup strerror strlcat strlcpy strtol strtoul])
case $host_os in
@ -1303,9 +1305,6 @@ case $host_os in
;;
esac
LIBS="$pgac_save_LIBS"
# System's version of getaddrinfo(), if any, may be used only if we found
# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h.
# (Note: the AC_REPLACE_FUNCS probe fails on Windows, where the available
@ -1354,13 +1353,6 @@ if test "$PORTNAME" = "win32"; then
[Define to 1 if you have the `symlink' function.])
fi
if test "$with_readline" = yes; then
PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
AC_CHECK_FUNCS([append_history history_truncate_file])
fi
dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
dnl (especially on GNU libc)
dnl See also comments in c.h.
@ -1414,6 +1406,15 @@ if test x"$pgac_cv_gcc_int_atomics" = x"yes"; then
AC_DEFINE(HAVE_GCC_INT_ATOMICS, 1, [Define to 1 if you have __sync_lock_test_and_set(int *) and friends.])
fi
# Lastly, restore full LIBS list and check for readline/libedit symbols
LIBS="$LIBS_including_readline"
if test "$with_readline" = yes; then
PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
AC_CHECK_FUNCS([append_history history_truncate_file])
fi
#
# Pthreads