From a1ed7314137dfa5a96e7600ea1d3c6d127697d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Tue, 22 Mar 2016 05:49:00 +0000 Subject: Add ax_lib_socket_nsl.m4 macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add SOCKET_LIBS and NSL_LIBS to global LIBS variables on platforms where it is required. Make configure checks for getaddrinfo/gethostname unconditional, that is handled with #ifdefs if necessary. Change-Id: Ia874038454fb9cf3bdbf8e6fd829f319e331837e Reviewed-on: https://code.wireshark.org/review/14560 Reviewed-by: João Valverde --- acinclude.m4 | 99 ++++++++---------------------------------------------------- 1 file changed, 13 insertions(+), 86 deletions(-) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 6b04c4b7f3..4abf453805 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -177,77 +177,6 @@ fi ]) -# -# AC_WIRESHARK_GETADDRINFO_LIB_CHECK -# -# Checks whether we have "getaddrinfo()" and whether we need "-lnsl" to get it. -AC_DEFUN([AC_WIRESHARK_GETADDRINFO_LIB_CHECK], -[ - AC_CHECK_FUNCS(getaddrinfo, , - AC_CHECK_LIB(nsl, getaddrinfo, - [ - NSL_LIBS="-lnsl" - AC_DEFINE(HAVE_GETADDRINFO, 1, [Defined if we have getaddrinfo]) - ])) - AC_SUBST(NSL_LIBS) -]) - -# -# AC_WIRESHARK_GETHOSTBY_LIB_CHECK -# -# Checks whether we need "-lnsl" to get "gethostby*()", which we use -# in "resolv.c". -# -# Adapted from stuff in the AC_PATH_XTRA macro in "acspecific.m4" in -# GNU Autoconf 2.13; the comment came from there. -# Done by Guy Harris on 2000-01-14. -# -AC_DEFUN([AC_WIRESHARK_GETHOSTBY_LIB_CHECK], -[ - # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, - # to get the SysV transport functions. - # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4) - # needs -lnsl. - # The nsl library prevents programs from opening the X display - # on Irix 5.2, according to dickey@clark.net. - AC_CHECK_FUNCS(gethostbyname, , - AC_CHECK_LIB(nsl, gethostbyname, - [ - NSL_LIBS="-lnsl" - AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [Defined if we have gethostbyname]) - ])) - AC_SUBST(NSL_LIBS) -]) - -# -# AC_WIRESHARK_SOCKET_LIB_CHECK -# -# Checks whether we need "-lsocket" to get "socket()", which is used -# by libpcap on some platforms - and, in effect, "gethostbyname()" or -# "getaddrinfo()" on most if not all platforms (so that it can use NIS or -# DNS or... to look up host names). -# -# Adapted from stuff in the AC_PATH_XTRA macro in "acspecific.m4" in -# GNU Autoconf 2.13; the comment came from there. -# Done by Guy Harris on 2000-01-14. -# -# We use "connect" because that's what AC_PATH_XTRA did. -# -AC_DEFUN([AC_WIRESHARK_SOCKET_LIB_CHECK], -[ - # lieder@skyler.mavd.honeywell.com says without -lsocket, - # socket/setsockopt and other routines are undefined under SCO ODT - # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary - # on later versions), says simon@lia.di.epfl.ch: it contains - # gethostby* variants that don't use the nameserver (or something). - # -lsocket must be given before -lnsl if both are needed. - # We assume that if connect needs -lnsl, so does gethostbyname. - AC_CHECK_FUNC(connect, , - AC_CHECK_LIB(socket, connect, SOCKET_LIBS="-lsocket", - AC_MSG_ERROR(Function 'socket' not found.), $NSL_LIBS)) - AC_SUBST(SOCKET_LIBS) -]) - # # AC_WIRESHARK_BREAKLOOP_TRY_LINK # @@ -413,7 +342,7 @@ and did you also install that package?]])) for extras in "-lcfg -lodm" "-lpfring" do AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras]) - LIBS="-lpcap $extras" + LIBS="-lpcap $extras $ac_save_LIBS" # # XXX - can't we use AC_CHECK_LIB here? # @@ -443,7 +372,7 @@ and did you also install that package?]])) AC_MSG_ERROR([Can't link with library libpcap.]) fi LIBS=$ac_save_LIBS - ], $SOCKET_LIBS $NSL_LIBS) + ]) fi AC_SUBST(PCAP_LIBS) @@ -452,7 +381,7 @@ and did you also install that package?]])) # libpcap. # ac_save_LIBS="$LIBS" - LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS" + LIBS="$PCAP_LIBS $LIBS" AC_CHECK_FUNCS(pcap_open_dead pcap_freecode) # # pcap_breakloop may be present in the library but not declared @@ -572,7 +501,7 @@ install a newer version of the header file.]) AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK], [ ac_save_LIBS="$LIBS" - LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS" + LIBS="$PCAP_LIBS $LIBS" AC_DEFINE(HAVE_REMOTE, 1, [Define to 1 to enable remote capturing feature in WinPcap library]) AC_CHECK_FUNCS(pcap_open) @@ -810,8 +739,7 @@ AC_DEFUN([AC_WIRESHARK_LIBLUA_CHECK],[ # searches the specified directory. # # XXX - lib64? - wireshark_save_LIBS="$LIBS" - LIBS="$LIBS -L$lua_dir/lib" + LDFLAGS="-L$lua_dir/lib $LDFLAGS" AC_SEARCH_LIBS(luaL_openlibs, [lua-${lua_ver} lua${lua_ver} lua], [ LUA_LIBS="-L$lua_dir/lib $ac_cv_search_luaL_openlibs -lm" @@ -819,7 +747,6 @@ AC_DEFUN([AC_WIRESHARK_LIBLUA_CHECK],[ ],[ have_lua=no ], -lm) - LIBS="$wireshark_save_LIBS" fi fi fi @@ -993,10 +920,9 @@ AC_DEFUN([AC_WIRESHARK_C_ARES_CHECK], AC_CHECK_LIB(cares, ares_init, [ C_ARES_LIBS=-lcares - AC_DEFINE(HAVE_C_ARES, 1, [Define to use c-ares library]) - have_good_c_ares=yes - ],, $SOCKET_LIBS $NSL_LIBS - ) + AC_DEFINE(HAVE_C_ARES, 1, [Define to use c-ares library]) + have_good_c_ares=yes + ]) else AC_MSG_RESULT(not required) fi @@ -1158,7 +1084,7 @@ AC_DEFUN([AC_WIRESHARK_KRB5_CHECK], found_krb5_kt_resolve=no for extras in "" "-lresolv" do - LIBS="$KRB5_LIBS $extras" + LIBS="$KRB5_LIBS $extras $wireshark_save_LIBS" if test -z "$extras" then AC_MSG_CHECKING([whether $ac_krb5_version includes krb5_kt_resolve]) @@ -1173,11 +1099,12 @@ AC_DEFUN([AC_WIRESHARK_KRB5_CHECK], ], [ # - # We found "krb5_kt_resolve()", and required - # the libraries in extras as well. + # We found "krb5_kt_resolve()". # AC_MSG_RESULT(yes) - KRB5_LIBS="$LIBS" + if test -n "$extras"; then + KRB5_LIBS="$KRB5_LIBS $extras" + fi AC_DEFINE(HAVE_KERBEROS, 1, [Define to use kerberos]) if test "x$ac_krb5_version" = "xHEIMDAL" then -- cgit v1.2.3