summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2010-03-15 10:32:50 +0100
committerSimon Josefsson <simon@josefsson.org>2010-03-15 10:32:50 +0100
commit13836061caac4d5f3390d2cc6d4c04592541c497 (patch)
treeb21f469bdd7502539889d55f152429ce991028ac
parent760d050d213a792f87e728103f6788cf83a4fe5f (diff)
downloadgnutls-13836061caac4d5f3390d2cc6d4c04592541c497.tar.gz
Backport fix for inet_ntop/inet_pton link problem.
-rw-r--r--gl/m4/getaddrinfo.m425
-rw-r--r--gl/m4/inet_ntop.m419
-rw-r--r--gl/m4/inet_pton.m418
3 files changed, 41 insertions, 21 deletions
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index 4088671987..05fd2b6c4f 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,5 +1,5 @@
-# getaddrinfo.m4 serial 20
-dnl Copyright (C) 2004-2009 Free Software Foundation, Inc.
+# getaddrinfo.m4 serial 22
+dnl Copyright (C) 2004-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -25,7 +25,7 @@ AC_DEFUN([gl_GETADDRINFO],
LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
- AC_TRY_LINK([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
@@ -34,21 +34,21 @@ AC_DEFUN([gl_GETADDRINFO],
#include <netdb.h>
#endif
#include <stddef.h>
-], [getaddrinfo("", "", NULL, NULL);],
+]], [[getaddrinfo("", "", NULL, NULL);]])],
[gl_cv_func_getaddrinfo=yes],
[gl_cv_func_getaddrinfo=no])])
if test $gl_cv_func_getaddrinfo = no; then
AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
- gl_cv_w32_getaddrinfo, [
+ gl_cv_w32_getaddrinfo, [
gl_cv_w32_getaddrinfo=no
am_save_LIBS="$LIBS"
LIBS="$LIBS -lws2_32"
- AC_TRY_LINK([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
#include <stddef.h>
-], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes)
+]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes])
LIBS="$am_save_LIBS"
])
if test "$gl_cv_w32_getaddrinfo" = "yes"; then
@@ -64,7 +64,7 @@ AC_DEFUN([gl_GETADDRINFO],
# header included somehow.
AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
gl_cv_func_gai_strerror, [
- AC_TRY_LINK([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
@@ -76,7 +76,7 @@ AC_DEFUN([gl_GETADDRINFO],
#include <ws2tcpip.h>
#endif
#include <stddef.h>
-], [gai_strerror (NULL);],
+]], [[gai_strerror (NULL);]])],
[gl_cv_func_gai_strerror=yes],
[gl_cv_func_gai_strerror=no])])
if test $gl_cv_func_gai_strerror = no; then
@@ -96,6 +96,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
+ AC_REQUIRE([gl_INET_NTOP]) dnl for INET_NTOP_LIB
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_SOCKET_FAMILIES])
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
@@ -163,4 +164,10 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
*" $SERVENT_LIB "*) ;;
*) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;;
esac
+
+ dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
+ case " $GETADDRINFO_LIB " in
+ *" $INET_NTOP_LIB "*) ;;
+ *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;;
+ esac
])
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
index 2bbdca1088..20e8d7c52e 100644
--- a/gl/m4/inet_ntop.m4
+++ b/gl/m4/inet_ntop.m4
@@ -1,5 +1,5 @@
-# inet_ntop.m4 serial 9
-dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# inet_ntop.m4 serial 11
+dnl Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -11,17 +11,18 @@ AC_DEFUN([gl_INET_NTOP],
gl_REPLACE_ARPA_INET_H
- dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
- dnl find inet_ntop.
- dnl
- dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
- dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8,
- dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
- dnl isn't built on Solaris 8.
+ dnl Most platforms that provide inet_ntop define it in libc.
+ dnl Solaris 8..10 provide inet_ntop in libnsl instead.
gl_save_LIBS=$LIBS
AC_SEARCH_LIBS([inet_ntop], [nsl], [],
[AC_REPLACE_FUNCS([inet_ntop])])
LIBS=$gl_save_LIBS
+ INET_NTOP_LIB=
+ if test "$ac_cv_search_inet_ntop" != "no" &&
+ test "$ac_cv_search_inet_ntop" != "none required"; then
+ INET_NTOP_LIB="$ac_cv_search_inet_ntop"
+ fi
+ AC_SUBST([INET_NTOP_LIB])
gl_PREREQ_INET_NTOP
])
diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4
index e0ec432bc6..e0b794242f 100644
--- a/gl/m4/inet_pton.m4
+++ b/gl/m4/inet_pton.m4
@@ -1,5 +1,5 @@
-# inet_pton.m4 serial 7
-dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
+# inet_pton.m4 serial 9
+dnl Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,19 @@ AC_DEFUN([gl_INET_PTON],
gl_REPLACE_ARPA_INET_H
- AC_REPLACE_FUNCS([inet_pton])
+ dnl Most platforms that provide inet_pton define it in libc.
+ dnl Solaris 8..10 provide inet_pton in libnsl instead.
+ gl_save_LIBS=$LIBS
+ AC_SEARCH_LIBS([inet_pton], [nsl], [],
+ [AC_REPLACE_FUNCS([inet_pton])])
+ LIBS=$gl_save_LIBS
+ INET_PTON_LIB=
+ if test "$ac_cv_search_inet_pton" != "no" &&
+ test "$ac_cv_search_inet_pton" != "none required"; then
+ INET_PTON_LIB="$ac_cv_search_inet_pton"
+ fi
+ AC_SUBST([INET_PTON_LIB])
+
gl_PREREQ_INET_PTON
])