Commit 93bf7d52 authored by Paul Eggert's avatar Paul Eggert

Stop calling res_init

Emacs shouldn’t need to call res_init any more, now that nscd or
equivalent is everywhere.  On modern systems, calling res_init
simply slows Emacs down.  On ancient systems lacking nscd Emacs
will still work well enough with this change; it’s just that it
won’t respond to changes in /etc/resolv.conf.
* configure.ac (HAVE_RES_INIT): Remove.  Worry about -lresolv only
when configured --with-hesiod.  Hesiod is still used; see, e.g.:
https://soylentnews.org/meta/article.pl?sid=15/07/13/0255214
* src/Makefile.in (LIBRESOLV): Remove.  All uses removed.
parent 938f104f
...@@ -254,7 +254,6 @@ HAVE_RANDOM ...@@ -254,7 +254,6 @@ HAVE_RANDOM
HAVE_READLINK HAVE_READLINK
HAVE_READLINKAT HAVE_READLINKAT
HAVE_RECVFROM HAVE_RECVFROM
HAVE_RES_INIT
HAVE_RINT HAVE_RINT
HAVE_RSVG HAVE_RSVG
HAVE_SELECT HAVE_SELECT
......
...@@ -4000,44 +4000,13 @@ AC_CACHE_CHECK([whether signals can be handled on alternate stack], ...@@ -4000,44 +4000,13 @@ AC_CACHE_CHECK([whether signals can be handled on alternate stack],
[emacs_cv_alternate_stack=yes], [emacs_cv_alternate_stack=yes],
[emacs_cv_alternate_stack=no])]) [emacs_cv_alternate_stack=no])])
# Do we have res_init, for detecting changes in /etc/resolv.conf?
# On Darwin, res_init appears not to be useful: see bug#562 and
# http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html
resolv=no
if test $opsys != darwin; then
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>]],
[[return res_init();]])],
have_res_init=yes, have_res_init=no)
if test "$have_res_init" = no; then
OLIBS="$LIBS"
LIBS="$LIBS -lresolv"
AC_MSG_CHECKING(for res_init with -lresolv)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>]],
[[return res_init();]])],
have_res_init=yes, have_res_init=no)
AC_MSG_RESULT($have_res_init)
if test "$have_res_init" = yes ; then
resolv=yes
fi
LIBS="$OLIBS"
fi
if test "$have_res_init" = yes; then
AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
fi
fi dnl !darwin
# Do we need the Hesiod library to provide the support routines? # Do we need the Hesiod library to provide the support routines?
dnl FIXME? Should we be skipping this on Darwin too? dnl FIXME? Should we be skipping this on Darwin too?
LIBHESIOD= LIBHESIOD=
LIBRESOLV=
if test "$with_hesiod" != no ; then if test "$with_hesiod" != no ; then
# Don't set $LIBS here -- see comments above. FIXME which comments? # Don't set $LIBS here -- see comments above. FIXME which comments?
resolv=no
AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, , AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
[AC_CHECK_LIB(resolv, res_send, resolv=yes, [AC_CHECK_LIB(resolv, res_send, resolv=yes,
[AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])]) [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
...@@ -4046,21 +4015,16 @@ if test "$with_hesiod" != no ; then ...@@ -4046,21 +4015,16 @@ if test "$with_hesiod" != no ; then
else else
RESOLVLIB= RESOLVLIB=
fi fi
hesiod=no
AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost, AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
hesiod=yes, :, $RESOLVLIB)]) hesiod=yes, :, $RESOLVLIB)])
if test x"$hesiod" = xyes; then if test x"$hesiod" = xyes; then
LIBHESIOD=-lhesiod LIBHESIOD=-lhesiod
LIBRESOLV=$RESOLVLIB
fi fi
fi fi
AC_SUBST(LIBHESIOD) AC_SUBST(LIBHESIOD)
# Do we need libresolv (due to res_init or Hesiod)?
if test "$resolv" = yes && test $opsys != darwin; then
LIBRESOLV=-lresolv
else
LIBRESOLV=
fi
AC_SUBST(LIBRESOLV) AC_SUBST(LIBRESOLV)
# These tell us which Kerberos-related libraries to use. # These tell us which Kerberos-related libraries to use.
......
...@@ -302,9 +302,6 @@ CM_OBJ=@CM_OBJ@ ...@@ -302,9 +302,6 @@ CM_OBJ=@CM_OBJ@
LIBGPM = @LIBGPM@ LIBGPM = @LIBGPM@
## -lresolv, or empty.
LIBRESOLV = @LIBRESOLV@
LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ LIBSELINUX_LIBS = @LIBSELINUX_LIBS@
LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@ LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
...@@ -485,7 +482,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \ ...@@ -485,7 +482,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
$(WEBKIT_LIBS) \ $(WEBKIT_LIBS) \
$(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \ $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
$(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \ $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \
$(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) $(CAIRO_LIBS) \ $(LIBXML2_LIBS) $(LIBGPM) $(LIBS_SYSTEM) $(CAIRO_LIBS) \
$(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
$(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
$(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) \ $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) \
......
...@@ -75,11 +75,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -75,11 +75,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# include <sys/stropts.h> # include <sys/stropts.h>
#endif #endif
#ifdef HAVE_RES_INIT
#include <arpa/nameser.h>
#include <resolv.h>
#endif
#ifdef HAVE_UTIL_H #ifdef HAVE_UTIL_H
#include <util.h> #include <util.h>
#endif #endif
...@@ -3827,10 +3822,6 @@ usage: (make-network-process &rest ARGS) */) ...@@ -3827,10 +3822,6 @@ usage: (make-network-process &rest ARGS) */)
immediate_quit = 1; immediate_quit = 1;
QUIT; QUIT;
#ifdef HAVE_RES_INIT
res_init ();
#endif
struct addrinfo hints; struct addrinfo hints;
memset (&hints, 0, sizeof hints); memset (&hints, 0, sizeof hints);
hints.ai_family = family; hints.ai_family = family;
...@@ -3910,10 +3901,6 @@ usage: (make-network-process &rest ARGS) */) ...@@ -3910,10 +3901,6 @@ usage: (make-network-process &rest ARGS) */)
immediate_quit = 1; immediate_quit = 1;
QUIT; QUIT;
#ifdef HAVE_RES_INIT
res_init ();
#endif
host_info_ptr = gethostbyname ((const char *) SDATA (host)); host_info_ptr = gethostbyname ((const char *) SDATA (host));
immediate_quit = 0; immediate_quit = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment