[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
correctly including -lnsl and -lsocket on Solaris without impacting othe
From: |
sol11x86 |
Subject: |
correctly including -lnsl and -lsocket on Solaris without impacting other OS's |
Date: |
Fri, 20 Apr 2007 13:10:22 +0000 |
I am working on wine for Solaris, and the configure.ac segment at the bottom of
the
post that searches for functions looks like this (I combined the single line
functions
in AC_CHECK_FUNCS to mulitple entries per line to be more readable).
I've found that the following functions are not found:
connect, getaddrinfo, gethostbyname, getnameinfo, getnetbyname, getprotobyname,
getprotobynumber, get servbyport, inet_aton, inet_network, sendmsg.
The three specific checks for "Solaris" find the libraries, but don't set the
appropriate HAVE_<function-name> variables in config.h.
After lots of trial and error, comments, and research, I came up with adding
the following before the AC_CHECK_FUNCS test.
AC_CHECK_LIB(resolv,inet_aton)
AC_CHECK_LIB(nsl,gethostent)
AC_SEARCH_LIBS(socket, socket, ,
[AC_CHECK_LIB(nsl, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)])
and then modify the post Solaris checks like:
- AC_CHECK_LIB(nsl,gethostbyname)
+ AC_CHECK_LIB(nsl,gethostbyname,[AC_DEFINE(HAVE_GETHOSTBYNAME,1)])
+ AC_CHECK_LIB(socket,connect)
+ AC_CHECK_LIB(socket,connect,[AC_DEFINE(HAVE_CONNECT,1)])
According to the config.log, gethostbyname and connect in the both original and
my modified configure.ac fail to define those funtions. The original
configure.ac
found -lnsl and -lsocket, but the functions were not enabled. So I modified the
post AC_CHECK_FUNCS solaris tests for gethostbyname and connect, and
this works.
The dilemma? One of the maintainer claims that the the AC_SEARCH_LIBS for
socket enables "-lsocket" for more than Solaris.
As I'm not an autoconf guru, someone suggested I post here for suggestions?
Thanks,
Ben
ORIGINAL Snippet:
-----------------------------------
AC_CHECK_FUNCS( _pclose _popen _snprintf _spawnvp _stricmp _strnicmp _vsnprintf
asctime_r chsize \
clone connect dlopen epoll_create ffs finite fork fpclass fstatfs
fstatvfs ftruncate futimes \
futimesat getaddrinfo getdirentries gethostbyname getnameinfo
getnetbyname getopt_long \
getpagesize getprotobyname getprotobynumber getpwuid getservbyport
gettid gettimeofday \
getuid inet_aton inet_network kqueue lstat memmove mmap pclose poll
popen prctl pread \
pwrite readlink rfork sched_yield select sendmsg setrlimit settimeofday
sigaltstack sigprocmask \
snprintf spawnvp statfs statvfs strcasecmp strerror strncasecmp strtold
tcgetattr timegm \
usleep vsnprintf wait4 waitpid
)
dnl Check for -ldl
if test "$ac_cv_func_dlopen" = no
then
AC_CHECK_LIB(dl,dlopen,[AC_DEFINE(HAVE_DLOPEN,1) AC_SUBST(LIBDL,"-ldl")])
fi
WINE_CHECK_LIB_FUNCS(dladdr,[$LIBDL])
dnl Check for -lpoll for Mac OS X/Darwin
if test "$ac_cv_func_poll" = no
then
AC_CHECK_LIB(poll,poll,[AC_DEFINE(HAVE_POLL,1) AC_SUBST(LIBPOLL,"-lpoll")])
fi
dnl Check for -lnsl for Solaris
if test "$ac_cv_func_gethostbyname" = no
then
AC_CHECK_LIB(nsl,gethostbyname)
fi
dnl Check for -lsocket for Solaris
if test "$ac_cv_func_connect" = no
then
AC_CHECK_LIB(socket,connect)
fi
dnl Check for -lresolv for Solaris
if test "$ac_cv_func_inet_aton" = no
then
AC_CHECK_LIB(resolv,inet_aton)
fi
- correctly including -lnsl and -lsocket on Solaris without impacting other OS's,
sol11x86 <=