summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-04-06 21:39:02 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-04-06 21:39:02 +1000
commit4398cf59279b0216e1b7b958d678b8cf00e6cd5c (patch)
tree81d31903b0d2052e4643b1be5655c3644ec63079 /configure.ac
parent8db9a0ffd86d387e5362c5ecf7fdb225bd6f71bf (diff)
- (dtucker) [configure.ac] Bug #816, #748 (again): Attempt to detect
broken getaddrinfo and friends on HP-UX. ok djm@
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac77
1 files changed, 72 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 2d2147518..3f515c453 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.208 2004/04/06 11:31:13 dtucker Exp $ 1# $Id: configure.ac,v 1.209 2004/04/06 11:39:02 dtucker Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -209,10 +209,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
209 AC_DEFINE(DISABLE_UTMP) 209 AC_DEFINE(DISABLE_UTMP)
210 AC_DEFINE(LOCKED_PASSWD_STRING, "*") 210 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
211 AC_DEFINE(SPT_TYPE,SPT_PSTAT) 211 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
212 case "$host" in 212 check_for_hpux_broken_getaddrinfo=1
213 *-*-hpux11.11*)
214 AC_DEFINE(BROKEN_GETADDRINFO);;
215 esac
216 LIBS="$LIBS -lsec" 213 LIBS="$LIBS -lsec"
217 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])) 214 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
218 ;; 215 ;;
@@ -985,6 +982,76 @@ main()
985 ) 982 )
986fi 983fi
987 984
985check_for_hpux_broken_getaddrinfo=1
986
987if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
988 AC_MSG_CHECKING(if getaddrinfo seems to work)
989 AC_TRY_RUN(
990 [
991#include <stdio.h>
992#include <sys/socket.h>
993#include <netdb.h>
994#include <errno.h>
995#include <netinet/in.h>
996
997#define TEST_PORT "2222"
998
999int
1000main(void)
1001{
1002 int err, sock;
1003 struct addrinfo *gai_ai, *ai, hints;
1004 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1005
1006 memset(&hints, 0, sizeof(hints));
1007 hints.ai_family = PF_UNSPEC;
1008 hints.ai_socktype = SOCK_STREAM;
1009 hints.ai_flags = AI_PASSIVE;
1010
1011 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1012 if (err != 0) {
1013 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1014 exit(1);
1015 }
1016
1017 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1018 if (ai->ai_family != AF_INET6)
1019 continue;
1020
1021 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1022 sizeof(ntop), strport, sizeof(strport),
1023 NI_NUMERICHOST|NI_NUMERICSERV);
1024
1025 if (err != 0) {
1026 if (err == EAI_SYSTEM)
1027 perror("getnameinfo EAI_SYSTEM");
1028 else
1029 fprintf(stderr, "getnameinfo failed: %s\n",
1030 gai_strerror(err));
1031 exit(2);
1032 }
1033
1034 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1035 if (sock < 0)
1036 perror("socket");
1037 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1038 if (errno == EBADF)
1039 exit(3);
1040 }
1041 }
1042 exit(0);
1043}
1044 ],
1045 [
1046 AC_MSG_RESULT(yes)
1047 ],
1048 [
1049 AC_MSG_RESULT(no)
1050 AC_DEFINE(BROKEN_GETADDRINFO)
1051 ]
1052 )
1053fi
1054
988AC_FUNC_GETPGRP 1055AC_FUNC_GETPGRP
989 1056
990# Check for PAM libs 1057# Check for PAM libs