From 4e0e40e289553f9c52a921132da6e1746278d517 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 30 Mar 2006 14:19:19 +0000 Subject: [PATCH] Use only sleep if unistd.h is defined --- src/t-server.cpp | 8 +++++++- src/tstthreads.cpp | 8 +++++++- yaz.m4 | 2 +- yazpp.m4 | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/t-server.cpp b/src/t-server.cpp index 3a4acef..e91049b 100644 --- a/src/t-server.cpp +++ b/src/t-server.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2005, Index Data. * See the file LICENSE for details. * - * $Id: t-server.cpp,v 1.8 2006-03-29 13:33:47 adam Exp $ + * $Id: t-server.cpp,v 1.9 2006-03-30 14:19:19 adam Exp $ */ #include @@ -17,6 +17,10 @@ #include #include +#if HAVE_UNISTD_H +#include +#endif + using namespace yazpp_1; class MyServer; @@ -64,7 +68,9 @@ IMsg_Thread *Auth_Msg::handle() ODR_MASK_SET(apdu->u.initResponse->options, Z_Options_present); break; case Z_APDU_searchRequest: +#if HAVE_UNISTD_H sleep(5); +#endif apdu = zget_APDU(odr, Z_APDU_searchResponse); break; case Z_APDU_triggerResourceControlRequest: diff --git a/src/tstthreads.cpp b/src/tstthreads.cpp index 433e772..ac78157 100644 --- a/src/tstthreads.cpp +++ b/src/tstthreads.cpp @@ -1,4 +1,4 @@ -/* $Id: tstthreads.cpp,v 1.10 2006-03-30 10:32:16 adam Exp $ +/* $Id: tstthreads.cpp,v 1.11 2006-03-30 14:19:19 adam Exp $ Copyright (c) 1998-2006, Index Data. This file is part of the yazproxy. @@ -27,6 +27,10 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include "msg-thread.h" +#if HAVE_UNISTD_H +#include +#endif + using namespace yazpp_1; class My_Msg : public IMsg_Thread { @@ -43,7 +47,9 @@ IMsg_Thread *My_Msg::handle() res->m_val = m_val; printf("My_Msg::handle val=%d sleep=%d\n", m_val, sl); +#if HAVE_UNISTD_H sleep(sl); +#endif return res; } diff --git a/yaz.m4 b/yaz.m4 index 2782a1d..796738e 100644 --- a/yaz.m4 +++ b/yaz.m4 @@ -126,7 +126,7 @@ AC_DEFUN([YAZ_INIT], have_yaz_version=`echo "$YAZVERSION" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'` req_yaz_version=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'` if test "$have_yaz_version" -lt "$req_yaz_version"; then - AC_MSG_ERROR([$YAZVERSION. Requires $2 or later]) + AC_MSG_ERROR([$YAZVERSION. Requires YAZ $2 or later]) fi if test "$req_yaz_version" -gt "2000028"; then YAZINC="$YAZINC -DYAZ_USE_NEW_LOG=1" diff --git a/yazpp.m4 b/yazpp.m4 index cf121a0..8512109 100644 --- a/yazpp.m4 +++ b/yazpp.m4 @@ -44,7 +44,7 @@ AC_DEFUN([YAZPP_INIT], have_yaz_version=`echo "$YAZPPVERSION" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'` req_yaz_version=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'` if test "$have_yaz_version" -lt "$req_yaz_version"; then - AC_MSG_ERROR([$YAZPPVERSION. Requires $2 or later]) + AC_MSG_ERROR([$YAZPPVERSION. Requires YAZ++ $2 or later]) fi fi fi -- 1.7.10.4