diff options
author | Raphael Kubo da Costa <rakuco@FreeBSD.org> | 2012-09-11 22:50:14 +0300 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2012-09-14 18:47:32 +0200 |
commit | 2d18f3cdcfa0bca29dd83720d311682269b7d813 (patch) | |
tree | 86692e341925405912096d59f0d14ab32e201d6c /configure.ac | |
parent | 4c148e5f74f764bccbe8b519494addb4aa0d79d0 (diff) | |
download | libtdevnc-2d18f3cdcfa0bca29dd83720d311682269b7d813.tar.gz libtdevnc-2d18f3cdcfa0bca29dd83720d311682269b7d813.zip |
Do not hardcode the need for libresolv.
libresolv is only present on systems which use glibc; platforms such as
FreeBSD have __b64_ntop as part of libc itself.
Improve the detection process and only link against libresolv if it exists
on the system, and remember to reset CMAKE_REQUIRED_LIBRARIES after
performing the necessary tests, since we do not always want to link against
libresolv.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 4873253..773d29a 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,16 @@ AC_ARG_WITH(tightvnc-filetransfer, # AC_DEFINE moved to after libpthread check. # WebSockets support -AC_CHECK_LIB(resolv, __b64_ntop, HAVE_B64="true", HAVE_B64="false") +AC_CHECK_FUNC(__b64_ntop, HAVE_B64_IN_LIBC="true", HAVE_B64_IN_LIBC="false") +if test "x$HAVE_B64_IN_LIBC" != "xtrue"; then + AC_CHECK_LIB(resolv, __b64_ntop, HAVE_B64_IN_LIBRESOLV="true", HAVE_B64_IN_LIBRESOLV="false") + if test "x$HAVE_B64_IN_LIBRESOLV" = "xtrue"; then + RESOLV_LIB="-lresolv" + HAVE_B64="true" + fi +else + HAVE_B64="true" +fi AH_TEMPLATE(WITH_WEBSOCKETS, [Disable WebSockets support]) AC_ARG_WITH(websockets, [ --without-websockets disable WebSockets support], @@ -760,7 +769,7 @@ if test "x$HAVE_B64" != "xtrue"; then with_websockets="" fi if test "x$with_websockets" = "xyes"; then - LIBS="$LIBS -lresolv $SSL_LIBS" + LIBS="$LIBS $RESOLV_LIB $SSL_LIBS" AC_DEFINE(WITH_WEBSOCKETS) fi AM_CONDITIONAL(WITH_WEBSOCKETS, test "$with_websockets" = "yes") |