1
0

lib_socket_nsl.m4 869 B

12345678910111213141516171819202122232425
  1. dnl @synopsis LIB_SOCKET_NSL
  2. dnl
  3. dnl This macro figures out what libraries are required on this platform
  4. dnl to link sockets programs.
  5. dnl
  6. dnl The common cases are not to need any extra libraries, or to need
  7. dnl -lsocket and -lnsl. We need to avoid linking with libnsl unless we
  8. dnl need it, though, since on some OSes where it isn't necessary it
  9. dnl will totally break networking. Unisys also includes gethostbyname()
  10. dnl in libsocket but needs libnsl for socket().
  11. dnl
  12. dnl @category Misc
  13. dnl @author Russ Allbery <rra@stanford.edu>
  14. dnl @author Stepan Kasal <kasal@ucw.cz>
  15. dnl @author Warren Young <warren@etr-usa.com>
  16. dnl @version 2005-09-06
  17. dnl @license AllPermissive
  18. AC_DEFUN([LIB_SOCKET_NSL],
  19. [
  20. AC_SEARCH_LIBS([gethostbyname], [nsl])
  21. AC_SEARCH_LIBS([socket], [socket], [], [
  22. AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
  23. [], [-lnsl])])
  24. ])