From 52ea29045b79a5f996e454ac6c7f3bcd64aef572 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Sun, 14 Aug 2022 09:57:48 +1200 Subject: [PATCH] Remove configure probe for gethostbyname_r. It was only used by src/port/getaddrinfo.c, removed by the previous commit. Discussion: https://postgr.es/m/CA%2BhUKGJFLPCtAC58EAimF6a6GPw30TU_59FUY%3DGWB_kC%3DJEmVQ%40mail.gmail.com --- configure | 65 ++----------------------------- configure.ac | 3 +- src/include/pg_config.h.in | 3 -- src/interfaces/libpq/fe-connect.c | 2 +- src/tools/msvc/Solution.pm | 1 - 5 files changed, 6 insertions(+), 68 deletions(-) diff --git a/configure b/configure index 244495f052..176e0f9b00 100755 --- a/configure +++ b/configure @@ -11750,13 +11750,12 @@ fi -for ac_func in strerror_r gethostbyname_r +for ac_func in strerror_r do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" +if test "x$ac_cv_func_strerror_r" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_STRERROR_R 1 _ACEOF fi @@ -12431,62 +12430,6 @@ fi if test "$enable_thread_safety" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname_r" >&5 -$as_echo_n "checking for library containing gethostbyname_r... " >&6; } -if ${ac_cv_search_gethostbyname_r+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname_r (); -int -main () -{ -return gethostbyname_r (); - ; - return 0; -} -_ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_gethostbyname_r=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_gethostbyname_r+:} false; then : - break -fi -done -if ${ac_cv_search_gethostbyname_r+:} false; then : - -else - ac_cv_search_gethostbyname_r=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname_r" >&5 -$as_echo "$ac_cv_search_gethostbyname_r" >&6; } -ac_res=$ac_cv_search_gethostbyname_r -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_barrier_wait" >&5 $as_echo_n "checking for library containing pthread_barrier_wait... " >&6; } if ${ac_cv_search_pthread_barrier_wait+:} false; then : diff --git a/configure.ac b/configure.ac index e4156a78be..eed7019c4a 100644 --- a/configure.ac +++ b/configure.ac @@ -1214,7 +1214,7 @@ LIBS="$LIBS $PTHREAD_LIBS" AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([ pthread.h not found; use --disable-thread-safety to disable thread safety])]) -AC_CHECK_FUNCS([strerror_r gethostbyname_r]) +AC_CHECK_FUNCS([strerror_r]) # Do test here with the proper thread flags PGAC_FUNC_STRERROR_R_INT @@ -1260,7 +1260,6 @@ AC_SEARCH_LIBS(shmget, cygipc) AC_SEARCH_LIBS(backtrace_symbols, execinfo) if test "$enable_thread_safety" = yes; then - AC_SEARCH_LIBS(gethostbyname_r, nsl) AC_SEARCH_LIBS(pthread_barrier_wait, pthread) fi diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 17c1dbd165..3087883401 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -178,9 +178,6 @@ */ #undef HAVE_GCC__SYNC_INT64_CAS -/* Define to 1 if you have the `gethostbyname_r' function. */ -#undef HAVE_GETHOSTBYNAME_R - /* Define to 1 if you have the `getifaddrs' function. */ #undef HAVE_GETIFADDRS diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 0b8fabc7e8..1e057db336 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -2229,7 +2229,7 @@ connectDBComplete(PGconn *conn) * will not block. * o If you do not supply an IP address for the remote host (i.e. you * supply a host name instead) then PQconnectStart will block on - * gethostbyname. You will be fine if using Unix sockets (i.e. by + * getaddrinfo. You will be fine if using Unix sockets (i.e. by * supplying neither a host name nor a host address). * o If your backend wants to use Kerberos authentication then you must * supply both a host name and a host address, otherwise this function diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 17999d0698..92722a1271 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -256,7 +256,6 @@ sub GenerateFiles HAVE_GCC__SYNC_INT32_CAS => undef, HAVE_GCC__SYNC_INT32_TAS => undef, HAVE_GCC__SYNC_INT64_CAS => undef, - HAVE_GETHOSTBYNAME_R => undef, HAVE_GETIFADDRS => undef, HAVE_GETOPT => undef, HAVE_GETOPT_H => undef,