From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5887 invoked from network); 22 Aug 2000 13:15:53 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 22 Aug 2000 13:15:53 -0000 Received: (qmail 6199 invoked by alias); 22 Aug 2000 13:15:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12686 Received: (qmail 6192 invoked from network); 22 Aug 2000 13:15:35 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: "ZSH workers mailing list" Cc: "Roland Jesse" , "Danek Duvall" Subject: PATCH: test for network libraries (for test only)/problems with name resolution Date: Tue, 22 Aug 2000 17:15:18 +0400 Message-ID: <001501c00c3b$044cce00$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0016_01C00C5C.8B5E6E00" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <20000821092904.A32199@lorien.emufarm.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 This is a multi-part message in MIME format. ------=_NextPart_000_0016_01C00C5C.8B5E6E00 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit [ Moved to zsh-workers ] This patch tries more intellegent test for needed network libraries. In my case it correctly finds -lresolv and related functions. I'm a bit confused about Solaris. Up to Solaris 7 there is no gethostbyname2; Solaris 7 has it as LOCAL in -lresolv and Solaris 8 has it in -lnsl (actually Solaris 8 has everything there, this is the reason why it builds smoothly). Roland, what version was it that had problem? If it is Solaris 7, either it has some magic or broken headers. The patch is against current CVS; it should apply to 3.1.9 with some fuzz, if not, I can send generated configure. I do not commit it for two reasons: - I'd like to know, that it does not break some other system - I'm trapped on my own system. The problem is, now, when gethostbyname2 is correctly found, name resolution goes via resolver library. But this is using /etc/hosts only as fallback "if nameserver is not running" (at least in original bind implemetation as found here). Due to our infrastructure, it is unacceptable to me. If I understand it correctly, gethostbyname2 and getipnodebyname are needed to support IPv6. Which means, that as long as it is NOT supported, they are not needed and we may fallback to good old gethostbyname. I can just hope that if IPv6 will ever be suppored here, there will be some reasonable name-to-address translation support as well. Any ideas? -andrej ------=_NextPart_000_0016_01C00C5C.8B5E6E00 Content-Type: application/octet-stream; name="zsh-netlibs.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="zsh-netlibs.diff" ? .configure.in.swp=0A= Index: aczsh.m4=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvsroot/zsh/zsh/aczsh.m4,v=0A= retrieving revision 1.3=0A= diff -u -r1.3 aczsh.m4=0A= --- aczsh.m4 2000/08/14 04:46:29 1.3=0A= +++ aczsh.m4 2000/08/22 12:58:35=0A= @@ -646,3 +646,33 @@=0A= then LIBS=3D"$4"=0A= else LIBS=3D"$enable_libs"=0A= fi)])=0A= +=0A= +# zsh_SEARCH_LIBS(FUNCTION, SEARCH-LIBS,=0A= +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])=0A= +# This is derived from autoconf 2.49a AC_SEARCH_LIBS=0A= +# with the following differences:=0A= +# - no extra libs argument=0A= +# - SEARCH-LIBS are taken literally - use -lfoo not foo. That=0A= +# makes it possible to pass several libs, e.g. "-lsocket -lnsl"=0A= +# --------------------------------------------------------=0A= +# Search for a library defining FUNC, if it's not already available.=0A= +AC_DEFUN([zsh_SEARCH_LIBS],=0A= +[AC_CACHE_CHECK([for library containing $1], [zsh_cv_search_$1],=0A= +[zsh_func_search_save_LIBS=3D"$LIBS"=0A= +zsh_cv_search_$1=3Dno=0A= +AC_TRY_LINK_FUNC([$1], [zsh_cv_search_$1=3D"none required"])=0A= +test "$zsh_cv_search_$1" =3D no && for zsh_lib in $2; do=0A= +LIBS=3D"$zsh_lib $zsh_func_search_save_LIBS"=0A= +AC_TRY_LINK_FUNC([$1],=0A= +[zsh_cv_search_$1=3D"$zsh_lib"=0A= +break])=0A= +done=0A= +LIBS=3D"$zsh_func_search_save_LIBS"])=0A= +if test "$zsh_cv_search_$1" =3D no; then=0A= + ifelse([$4], , :, [$4])=0A= +else=0A= + test "$zsh_cv_search_$1" =3D "none required" || = LIBS=3D"$zsh_cv_search_$1 $LIBS"=0A= + ifelse([$3], , , [$3])=0A= +fi=0A= +])=0A= +=0A= Index: configure.in=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvsroot/zsh/zsh/configure.in,v=0A= retrieving revision 1.26=0A= diff -u -r1.26 configure.in=0A= --- configure.in 2000/08/16 13:23:37 1.26=0A= +++ configure.in 2000/08/22 12:58:37=0A= @@ -512,7 +512,9 @@=0A= dnl On some systems, modules need to be linked against libc explicitly,=0A= dnl in case they require objects that exist only in the static version=0A= dnl and might not be compiled into the zsh executable.=0A= -AC_CHECK_LIB(c, printf)=0A= +dnl Also, on SINIX -lc MUST BE after -lsocket, so this test=0A= +dnl adds -lc as the last library=0A= +AC_CHECK_LIB(c, printf, [LIBS=3D"$LIBS -lc"])=0A= =0A= AC_CHECK_LIB(m, pow)=0A= =0A= @@ -528,12 +530,43 @@=0A= AC_CHECK_LIB(${lib}, tgetent, [LIBS=3D"-l$lib $LIBS"; break])=0A= done=0A= =0A= -dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require=0A= -dnl libnsl (Network Services Library) to find yp_all=0A= -AC_CHECK_FUNCS(yp_all)=0A= -if test $ac_cv_func_yp_all =3D no; then=0A= - AC_CHECK_LIB(nsl, yp_all)=0A= -fi=0A= +dnl Check for network libraries.=0A= +dnl This is really sad and messy story=0A= +dnl Zsh needs three groups of functions:=0A= +dnl NIS (a.k.a. Yellow Pages)=0A= +dnl socket=0A= +dnl resolver=0A= +dnl Depending on particlular OS (or even on particular OS version)=0A= +dnl these function may be found in -lc, -lnsl, -lresolv, -lsocket.=0A= +dnl Sometimes libraries depend on other (notorious -lnsl that is needed=0A= +dnl on SVR4-derived systems to get any network functionality at all)=0A= +dnl or must follow particular order (SINIX, that has two incompatible=0A= +dnl versions of gethostbyname() in -lsocket and -lresolv).=0A= +dnl So, this test tries to find minimal set of needed libraries;=0A= +dnl it tries to preserve user settings (if needed libs were explcitly=0A= +dnl specified) and -lresolv after -lsocket order.=0A= +=0A= +#=0A= +# First check for -lnsl. Good chances, that if it exists, it=0A= +# will be neeeded anyway.=0A= +#=0A= +zsh_SEARCH_LIBS(yp_all, -lnsl)=0A= +=0A= +#=0A= +# Check for resolver functions to make sure, that =0A= +# -lresolv will be after -lsocket on SINIX=0A= +#=0A= +=0A= +zsh_SEARCH_LIBS(inet_aton, -lnsl -lresolv "-lresolv -lnsl")=0A= +zsh_SEARCH_LIBS(inet_pton, -lnsl -lresolv "-lresolv -lnsl")=0A= +zsh_SEARCH_LIBS(inet_ntop, -lnsl -lresolv "-lresolv -lnsl")=0A= +zsh_SEARCH_LIBS(gethostbyname2, -lnsl -lresolv "-lresolv -lnsl")=0A= +=0A= +#=0A= +# ... and check for socket support=0A= +#=0A= +=0A= +zsh_SEARCH_LIBS(socket, -lnsl -lsocket "-lsocket -lnsl")=0A= =0A= dnl I am told that told that unicos reqire these for nis_list=0A= if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` =3D unicos; then=0A= @@ -546,8 +579,6 @@=0A= =0A= AC_CHECK_LIB(cap, cap_get_proc)=0A= =0A= -AC_CHECK_LIB(socket, socket)=0A= -=0A= dnl ---------------------=0A= dnl CHECK TERMCAP LIBRARY=0A= dnl ---------------------=0A= @@ -857,7 +888,7 @@=0A= gethostname gethostbyname2 getipnodebyname \=0A= inet_aton inet_pton inet_ntop \=0A= getlogin getpwent getpwnam getpwuid getgrgid getgrnam \=0A= - initgroups nis_list \=0A= + initgroups yp_all nis_list \=0A= setuid seteuid setreuid setresuid setsid \=0A= memcpy memmove strstr strerror \=0A= cap_get_proc \=0A= ------=_NextPart_000_0016_01C00C5C.8B5E6E00--