summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>1997-10-28 16:56:29 +0000
committerEzra Peisach <epeisach@mit.edu>1997-10-28 16:56:29 +0000
commita3eb7b76ed121e7a560ac1189ef5bc699bcd2584 (patch)
tree15df9f106249be1d0837f0f5005bee9614553686 /src
parent769c254752590235bafdc1234f4c113a3c587257 (diff)
downloadkrb5-a3eb7b76ed121e7a560ac1189ef5bc699bcd2584.tar.gz
krb5-a3eb7b76ed121e7a560ac1189ef5bc699bcd2584.tar.xz
krb5-a3eb7b76ed121e7a560ac1189ef5bc699bcd2584.zip
* aclocal.m4 (WITH_NETLIB): Use AC_LIBRARY_NET.
(AC_LIBRARY_NET): Written by jhawk@mit.edu to better determine if libsocket and libnsl are needed. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10256 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/aclocal.m460
2 files changed, 62 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 90addf2b0..7db491195 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+Tue Oct 28 11:49:55 1997 Ezra Peisach <epeisach@mit.edu>
+
+ * aclocal.m4 (WITH_NETLIB): Use AC_LIBRARY_NET.
+ (AC_LIBRARY_NET): Written by jhawk@mit.edu to
+ better determine if libsocket and libnsl are needed.
+
Thu Oct 23 12:08:24 1997 Ezra Peisach <epeisach@mit.edu>
* aclocal.m4 (TCL_WITH): Check for libtcl8.0.
diff --git a/src/aclocal.m4 b/src/aclocal.m4
index da2219f25..df4b67a58 100644
--- a/src/aclocal.m4
+++ b/src/aclocal.m4
@@ -658,10 +658,7 @@ AC_ARG_WITH([netlib],
AC_MSG_RESULT("netlib will use \'$withval\'")
fi
,dnl
-[if test "`(uname) 2>/dev/null`" != IRIX ; then
- AC_CHECK_LIB(socket,main)
-fi
-AC_CHECK_LIB(nsl,main)]
+[AC_LIBRARY_NET]
)])dnl
dnl
dnl HAS_ANSI_VOLATILE
@@ -1373,3 +1370,58 @@ mips-*-netbsd*)
RUN_ENV='LIBPATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`:$(PROG_RPATH):/usr/lib:/usr/local/lib; export LIBPATH; '
esac])
+dnl
+dnl The following was written by jhawk@mit.edu
+dnl
+dnl AC_LIBRARY_NET: Id: net.m4,v 1.4 1997/10/25 20:49:53 jhawk Exp
+dnl
+dnl This test is for network applications that need socket() and
+dnl gethostbyname() -ish functions. Under Solaris, those applications need to
+dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
+dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
+dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
+dnl IRIX).
+dnl
+dnl Unfortunately, many application developers are not aware of this, and
+dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
+dnl also easy to write tests that cause -lnsl to be used under operating
+dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
+dnl uses -lnsl for TLI.
+dnl
+dnl This test exists so that every application developer does not test this in
+dnl a different, and subtly broken fashion.
+dnl
+dnl It has been argued that this test should be broken up into two seperate
+dnl tests, one for the resolver libraries, and one for the libraries necessary
+dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
+dnl allowing the autoconf user to use them independantly potentially results in
+dnl unfortunate ordering dependancies -- as such, such component macros would
+dnl have to carefully use indirection and be aware if the other components were
+dnl executed. Since other autoconf macros do not go to this trouble, and almost
+dnl no applications use sockets without the resolver, this complexity has not
+dnl been implemented.
+dnl
+dnl The check for libresolv is in case you are attempting to link statically
+dnl and happen to have a libresolv.a lying around (and no libnsl.a).
+dnl
+AC_DEFUN(AC_LIBRARY_NET, [
+ # Most operating systems have gethostbyname() in the default searched
+ # libraries (i.e. libc):
+ AC_CHECK_FUNC(gethostbyname, ,
+ # Some OSes (eg. Solaris) place it in libnsl:
+ AC_CHECK_LIB(nsl, gethostbyname, ,
+ # Some strange OSes (SINIX) have it in libsocket:
+ AC_CHECK_LIB(socket, gethostbyname, ,
+ # Unfortunately libsocket sometimes depends on libnsl.
+ # AC_CHECK_LIB's API is essentially broken so the following
+ # ugliness is necessary:
+ AC_CHECK_LIB(socket, gethostbyname,
+ LIBS="-lsocket -lnsl $LIBS",
+ AC_CHECK_LIB(resolv, gethostbyname),
+ -lnsl)
+ )
+ )
+ )
+ AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
+ AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
+ ])