Solaris needs -lsocket and -lnsl and does not support gethostbyname2()

With these changes we build and work on solaris
This commit is contained in:
Ronnie Sahlberg
2011-01-03 10:57:35 +11:00
parent e7c24af75e
commit adfb7326e3
3 changed files with 9 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
bindir = @bindir@
LIBS="-lpopt"
LIBS=-lpopt @LIBS@
CC=gcc
CFLAGS=-g -O2 -fPIC -Wall -W -I. -I./include "-D_U_=__attribute__((unused))"
LIBISCSI_OBJ = lib/connect.o lib/crc32c.o lib/discovery.o lib/init.o lib/login.o lib/md5.o lib/nop.o lib/pdu.o lib/scsi-command.o lib/scsi-lowlevel.o lib/socket.o lib/sync.o

View File

@@ -15,9 +15,13 @@ fi
case `uname` in
Linux*)
AC_DEFINE(HAVE_GETHOSTBYNAME2,1,[Whether we have gethostbyname2 or not])
;;
AIX*)
;;
SunOS)
LIBS="$LIBS -lsocket -lnsl"
;;
*)
;;
esac

View File

@@ -84,7 +84,11 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal,
if (inet_pton(AF_INET, addr, &sin->sin_addr) != 1) {
struct hostent *he;
#ifdef HAVE_GETHOSTBYNAME2
he = gethostbyname2(addr, AF_INET);
#else
he = gethostbyname(addr);
#endif
if (he == NULL) {
iscsi_set_error(iscsi, "Invalid target:%s "
"Failed to resolve hostname.", addr);