From 48101883a1ff0c121fcf0e7a09ba94e4b3932a5a Mon Sep 17 00:00:00 2001 From: dcoppa Date: Fri, 6 Apr 2012 14:33:41 +0000 Subject: [PATCH] Fix build with USE_SYSTRACE=Yes --- net/libtorrent/Makefile | 3 +- .../patches/patch-scripts_checks_m4 | 102 +++++++++--------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/net/libtorrent/Makefile b/net/libtorrent/Makefile index fca9aac97e8..a3d558de599 100644 --- a/net/libtorrent/Makefile +++ b/net/libtorrent/Makefile @@ -1,8 +1,9 @@ -# $OpenBSD: Makefile,v 1.28 2011/12/01 17:10:40 dcoppa Exp $ +# $OpenBSD: Makefile,v 1.29 2012/04/06 14:33:41 dcoppa Exp $ COMMENT= BitTorrent library written in C++ DISTNAME= libtorrent-0.12.9 +REVISION= 0 SHARED_LIBS += torrent 18.0 # .14.1 CATEGORIES= net devel diff --git a/net/libtorrent/patches/patch-scripts_checks_m4 b/net/libtorrent/patches/patch-scripts_checks_m4 index 7a548dc36a0..148fe6cb8ad 100644 --- a/net/libtorrent/patches/patch-scripts_checks_m4 +++ b/net/libtorrent/patches/patch-scripts_checks_m4 @@ -1,55 +1,55 @@ -$OpenBSD: patch-scripts_checks_m4,v 1.1 2008/11/25 16:21:28 naddy Exp $ ---- scripts/checks.m4.orig Tue Oct 7 14:48:07 2008 -+++ scripts/checks.m4 Sun Nov 23 21:04:40 2008 -@@ -94,14 +94,27 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE], [ - ]) - - AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [ -+ save_LIBS=$LIBS -+ AC_CHECK_FUNCS(posix_openpt, , [ -+ AC_SEARCH_LIBS(openpty, util, -+ AC_DEFINE(HAVE_OPENPTY, 1, -+ [Define to 1 if you have the `openpty' function.]) -+ ) -+ ]) -+ - AC_MSG_CHECKING(whether kqueue supports pipes and ptys) - - AC_RUN_IFELSE( -- [[#include -+ [[#include "confdefs.h" -+ #include - #include - #include - #include - #include -+ #if HAVE_OPENPTY -+ #include -+ #include -+ #endif - int main() { - struct kevent ev[2], ev_out[2]; - struct timespec ts = { 0, 0 }; -@@ -110,8 +123,14 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [ - if (pipe(pfd) == -1) return 1; - if (fcntl(pfd[1], F_SETFL, O_NONBLOCK) == -1) return 2; - while ((n = write(pfd[1], buffer, sizeof(buffer))) == sizeof(buffer)); -+ #if HAVE_POSIX_OPENPT - if ((pty[0]=posix_openpt(O_RDWR | O_NOCTTY)) == -1) return 3; - if ((pty[1]=grantpt(pty[0])) == -1) return 4; -+ #elif HAVE_OPENPTY -+ if (openpty(&pty[0], &pty[1], NULL, NULL, NULL) == -1) return 3; -+ #else -+ return 3; -+ #endif - EV_SET(ev+0, pfd[1], EVFILT_WRITE, EV_ADD | EV_ENABLE, 0, 0, NULL); - EV_SET(ev+1, pty[1], EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, NULL); - if ((kfd = kqueue()) == -1) return 5; -@@ -129,6 +148,7 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [ - AC_DEFINE(KQUEUE_SOCKET_ONLY, 1, kqueue only supports sockets.) - AC_MSG_RESULT(no) +$OpenBSD: patch-scripts_checks_m4,v 1.2 2012/04/06 14:33:41 dcoppa Exp $ +--- scripts/checks.m4.orig Fri Apr 6 15:17:41 2012 ++++ scripts/checks.m4 Fri Apr 6 15:19:11 2012 +@@ -93,51 +93,12 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE], [ ]) -+ LIBS=$save_LIBS ]) +-AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [ +- AC_MSG_CHECKING(whether kqueue supports pipes and ptys) +- +- AC_RUN_IFELSE( +- [[#include +- #include +- #include +- #include +- #include +- int main() { +- struct kevent ev[2], ev_out[2]; +- struct timespec ts = { 0, 0 }; +- int pfd[2], pty[2], kfd, n; +- char buffer[9001]; +- if (pipe(pfd) == -1) return 1; +- if (fcntl(pfd[1], F_SETFL, O_NONBLOCK) == -1) return 2; +- while ((n = write(pfd[1], buffer, sizeof(buffer))) == sizeof(buffer)); +- if ((pty[0]=posix_openpt(O_RDWR | O_NOCTTY)) == -1) return 3; +- if ((pty[1]=grantpt(pty[0])) == -1) return 4; +- EV_SET(ev+0, pfd[1], EVFILT_WRITE, EV_ADD | EV_ENABLE, 0, 0, NULL); +- EV_SET(ev+1, pty[1], EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, NULL); +- if ((kfd = kqueue()) == -1) return 5; +- if ((n = kevent(kfd, ev, 2, NULL, 0, NULL)) == -1) return 6; +- if (ev_out[0].flags & EV_ERROR) return 7; +- if (ev_out[1].flags & EV_ERROR) return 8; +- read(pfd[0], buffer, sizeof(buffer)); +- if ((n = kevent(kfd, NULL, 0, ev_out, 2, &ts)) < 1) return 9; +- return 0; +- } +- ]], +- [ +- AC_MSG_RESULT(yes) +- ], [ +- AC_DEFINE(KQUEUE_SOCKET_ONLY, 1, kqueue only supports sockets.) +- AC_MSG_RESULT(no) +- ]) +-]) +- AC_DEFUN([TORRENT_WITH_KQUEUE], [ + AC_ARG_WITH(kqueue, + [ --with-kqueue enable kqueue. [[default=no]]], + [ + if test "$withval" = "yes"; then + TORRENT_CHECK_KQUEUE +- TORRENT_CHECK_KQUEUE_SOCKET_ONLY + fi + ]) + ])