aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-02-29 09:39:45 -0800
committerPaul Eggert2016-02-29 09:40:58 -0800
commit93bf7d52841c60ffc10e0c9c789a7987812ce55e (patch)
tree443f8b37cf01441daab1a3e3a932417a3449a4c2
parent938f104f1b8de0a082f4736aaf504cea4f65765e (diff)
downloademacs-93bf7d52841c60ffc10e0c9c789a7987812ce55e.tar.gz
emacs-93bf7d52841c60ffc10e0c9c789a7987812ce55e.zip
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.
-rw-r--r--admin/CPP-DEFINES1
-rw-r--r--configure.ac44
-rw-r--r--src/Makefile.in5
-rw-r--r--src/process.c13
4 files changed, 5 insertions, 58 deletions
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 796b57db3d8..86f2fa5a414 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -254,7 +254,6 @@ HAVE_RANDOM
254HAVE_READLINK 254HAVE_READLINK
255HAVE_READLINKAT 255HAVE_READLINKAT
256HAVE_RECVFROM 256HAVE_RECVFROM
257HAVE_RES_INIT
258HAVE_RINT 257HAVE_RINT
259HAVE_RSVG 258HAVE_RSVG
260HAVE_SELECT 259HAVE_SELECT
diff --git a/configure.ac b/configure.ac
index e750a438165..48d9df14263 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4000,44 +4000,13 @@ AC_CACHE_CHECK([whether signals can be handled on alternate stack],
4000 [emacs_cv_alternate_stack=yes], 4000 [emacs_cv_alternate_stack=yes],
4001 [emacs_cv_alternate_stack=no])]) 4001 [emacs_cv_alternate_stack=no])])
4002 4002
4003# Do we have res_init, for detecting changes in /etc/resolv.conf?
4004# On Darwin, res_init appears not to be useful: see bug#562 and
4005# http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html
4006resolv=no
4007
4008if test $opsys != darwin; then
4009
4010 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
4011#include <arpa/nameser.h>
4012#include <resolv.h>]],
4013 [[return res_init();]])],
4014 have_res_init=yes, have_res_init=no)
4015 if test "$have_res_init" = no; then
4016 OLIBS="$LIBS"
4017 LIBS="$LIBS -lresolv"
4018 AC_MSG_CHECKING(for res_init with -lresolv)
4019 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
4020#include <arpa/nameser.h>
4021#include <resolv.h>]],
4022 [[return res_init();]])],
4023 have_res_init=yes, have_res_init=no)
4024 AC_MSG_RESULT($have_res_init)
4025 if test "$have_res_init" = yes ; then
4026 resolv=yes
4027 fi
4028 LIBS="$OLIBS"
4029 fi
4030
4031 if test "$have_res_init" = yes; then
4032 AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
4033 fi
4034fi dnl !darwin
4035
4036# Do we need the Hesiod library to provide the support routines? 4003# Do we need the Hesiod library to provide the support routines?
4037dnl FIXME? Should we be skipping this on Darwin too? 4004dnl FIXME? Should we be skipping this on Darwin too?
4038LIBHESIOD= 4005LIBHESIOD=
4006LIBRESOLV=
4039if test "$with_hesiod" != no ; then 4007if test "$with_hesiod" != no ; then
4040 # Don't set $LIBS here -- see comments above. FIXME which comments? 4008 # Don't set $LIBS here -- see comments above. FIXME which comments?
4009 resolv=no
4041 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, , 4010 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
4042 [AC_CHECK_LIB(resolv, res_send, resolv=yes, 4011 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
4043 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])]) 4012 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
@@ -4046,21 +4015,16 @@ if test "$with_hesiod" != no ; then
4046 else 4015 else
4047 RESOLVLIB= 4016 RESOLVLIB=
4048 fi 4017 fi
4018 hesiod=no
4049 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost, 4019 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
4050 hesiod=yes, :, $RESOLVLIB)]) 4020 hesiod=yes, :, $RESOLVLIB)])
4051 4021
4052 if test x"$hesiod" = xyes; then 4022 if test x"$hesiod" = xyes; then
4053 LIBHESIOD=-lhesiod 4023 LIBHESIOD=-lhesiod
4024 LIBRESOLV=$RESOLVLIB
4054 fi 4025 fi
4055fi 4026fi
4056AC_SUBST(LIBHESIOD) 4027AC_SUBST(LIBHESIOD)
4057
4058# Do we need libresolv (due to res_init or Hesiod)?
4059if test "$resolv" = yes && test $opsys != darwin; then
4060 LIBRESOLV=-lresolv
4061else
4062 LIBRESOLV=
4063fi
4064AC_SUBST(LIBRESOLV) 4028AC_SUBST(LIBRESOLV)
4065 4029
4066# These tell us which Kerberos-related libraries to use. 4030# These tell us which Kerberos-related libraries to use.
diff --git a/src/Makefile.in b/src/Makefile.in
index 99394ac57cf..8dcaf7e4759 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -302,9 +302,6 @@ CM_OBJ=@CM_OBJ@
302 302
303LIBGPM = @LIBGPM@ 303LIBGPM = @LIBGPM@
304 304
305## -lresolv, or empty.
306LIBRESOLV = @LIBRESOLV@
307
308LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ 305LIBSELINUX_LIBS = @LIBSELINUX_LIBS@
309 306
310LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@ 307LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
@@ -485,7 +482,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
485 $(WEBKIT_LIBS) \ 482 $(WEBKIT_LIBS) \
486 $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \ 483 $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
487 $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \ 484 $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \
488 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) $(CAIRO_LIBS) \ 485 $(LIBXML2_LIBS) $(LIBGPM) $(LIBS_SYSTEM) $(CAIRO_LIBS) \
489 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ 486 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
490 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 487 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
491 $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) \ 488 $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) \
diff --git a/src/process.c b/src/process.c
index f40e8e53a24..85a4885bbf4 100644
--- a/src/process.c
+++ b/src/process.c
@@ -75,11 +75,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
75# include <sys/stropts.h> 75# include <sys/stropts.h>
76#endif 76#endif
77 77
78#ifdef HAVE_RES_INIT
79#include <arpa/nameser.h>
80#include <resolv.h>
81#endif
82
83#ifdef HAVE_UTIL_H 78#ifdef HAVE_UTIL_H
84#include <util.h> 79#include <util.h>
85#endif 80#endif
@@ -3827,10 +3822,6 @@ usage: (make-network-process &rest ARGS) */)
3827 immediate_quit = 1; 3822 immediate_quit = 1;
3828 QUIT; 3823 QUIT;
3829 3824
3830#ifdef HAVE_RES_INIT
3831 res_init ();
3832#endif
3833
3834 struct addrinfo hints; 3825 struct addrinfo hints;
3835 memset (&hints, 0, sizeof hints); 3826 memset (&hints, 0, sizeof hints);
3836 hints.ai_family = family; 3827 hints.ai_family = family;
@@ -3910,10 +3901,6 @@ usage: (make-network-process &rest ARGS) */)
3910 immediate_quit = 1; 3901 immediate_quit = 1;
3911 QUIT; 3902 QUIT;
3912 3903
3913#ifdef HAVE_RES_INIT
3914 res_init ();
3915#endif
3916
3917 host_info_ptr = gethostbyname ((const char *) SDATA (host)); 3904 host_info_ptr = gethostbyname ((const char *) SDATA (host));
3918 immediate_quit = 0; 3905 immediate_quit = 0;
3919 3906