summaryrefslogtreecommitdiff
path: root/m4/ax_lib_socket_nsl.m4
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2009-08-06 23:34:02 +0100
committerReuben Thomas <rrt@sc3d.org>2009-08-06 23:34:02 +0100
commit8f1b73ba23887f39470693408590ce2ef4836099 (patch)
tree12c2d986b6e4d1948ee39a2c3a82c83d922d34b8 /m4/ax_lib_socket_nsl.m4
parent0502033064924147297f5a91a182a50023ac1d9c (diff)
downloadautoconf-archive-8f1b73ba23887f39470693408590ce2ef4836099.tar.gz
Rename macros with no prefix to have an AX_ prefix.
Diffstat (limited to 'm4/ax_lib_socket_nsl.m4')
-rw-r--r--m4/ax_lib_socket_nsl.m436
1 files changed, 36 insertions, 0 deletions
diff --git a/m4/ax_lib_socket_nsl.m4 b/m4/ax_lib_socket_nsl.m4
new file mode 100644
index 0000000..6c60aeb
--- /dev/null
+++ b/m4/ax_lib_socket_nsl.m4
@@ -0,0 +1,36 @@
+# ===========================================================================
+# http://www.nongnu.org/autoconf-archive/ax_lib_socket_nsl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_LIB_SOCKET_NSL
+#
+# DESCRIPTION
+#
+# 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().
+#
+# LICENSE
+#
+# Copyright (c) 2008 Russ Allbery <rra@stanford.edu>
+# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
+# Copyright (c) 2008 Warren Young <warren@etr-usa.com>
+#
+# 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.
+
+AC_DEFUN([AX_LIB_SOCKET_NSL],
+[
+ AC_SEARCH_LIBS([gethostbyname], [nsl])
+ AC_SEARCH_LIBS([socket], [socket], [], [
+ AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
+ [], [-lnsl])])
+])