Please check the GNU Autoconf Macro Archive for Updates
AC-Archive
Autoconf Macro Archive

ac-archive.sf.net: - Project CVS - Download
Macro Index
- AM Support
- C++ Support
- C Support
- Fortran Support
- Java Support
- Cross Compilation
- Installed Packages
- Miscellaneous
- LaTeX Support
- Uncategorized
- archive macros
- adl's macros
- bkorb's macros
- guidod's macros
- latex's macros
- other's macros
- rleigh's macros
- obsoleted macros
- released macros
- search index

Documentation
- Contribute!
- History
- acincludedir m4
- acinclude (tool)
- macro howto
- ax tricks
- maintainers
- License
- Topics

generated...
2007-08-05

(C) 2007 guidod
Download the M4 Source.

lib_socket_nsl

Back to the Main Page.

Synopsis
LIB_SOCKET_NSL
, 
, 
, 
Version

2005-09-06

Author

Russ Allbery <rra@stanford.edu> Stepan Kasal <kasal@ucw.cz> Warren Young <warren@etr-usa.com>

License

AllPermissive
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Users of this software should generally follow the principles of the MIT License includings its disclaimer.

Category

cryp.to ac-archive's Miscellaneous (released)

Documentation

This macro figures out what libraries are required on this platform to link sockets programs.

The common cases are not to need any extra libraries, or to need -lsocket and -lnsl. We need to avoid linking with libnsl unless we need it, though, since on some OSes where it isn't necessary it will totally break networking. Unisys also includes gethostbyname() in libsocket but needs libnsl for socket().

M4 Source Code
AC_DEFUN([LIB_SOCKET_NSL],
[
	AC_SEARCH_LIBS([gethostbyname], [nsl])
	AC_SEARCH_LIBS([socket], [socket], [], [
		AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
		[], [-lnsl])])
])