Use only sleep if unistd.h is defined
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 30 Mar 2006 14:19:19 +0000 (14:19 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 30 Mar 2006 14:19:19 +0000 (14:19 +0000)
src/t-server.cpp
src/tstthreads.cpp
yaz.m4
yazpp.m4

index 3a4acef..e91049b 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 2005, Index Data.
  * See the file LICENSE for details.
  * 
  * 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 <stdlib.h>
  */
 
 #include <stdlib.h>
 #include <yazpp/gduqueue.h>
 #include <yazpp/socket-manager.h>
 
 #include <yazpp/gduqueue.h>
 #include <yazpp/socket-manager.h>
 
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 using namespace yazpp_1;
 
 class MyServer;
 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:
             ODR_MASK_SET(apdu->u.initResponse->options, Z_Options_present);
             break;
         case Z_APDU_searchRequest:
+#if HAVE_UNISTD_H
             sleep(5);
             sleep(5);
+#endif
             apdu = zget_APDU(odr, Z_APDU_searchResponse);
             break;
         case Z_APDU_triggerResourceControlRequest:
             apdu = zget_APDU(odr, Z_APDU_searchResponse);
             break;
         case Z_APDU_triggerResourceControlRequest:
index 433e772..ac78157 100644 (file)
@@ -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.
    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 <yaz/log.h>
 #include "msg-thread.h"
 
 #include <yaz/log.h>
 #include "msg-thread.h"
 
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 using namespace yazpp_1;
 
 class My_Msg : public IMsg_Thread {
 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);
 
     res->m_val = m_val;
     printf("My_Msg::handle val=%d sleep=%d\n", m_val, sl);
+#if HAVE_UNISTD_H
     sleep(sl);
     sleep(sl);
+#endif
     return res;
 }
 
     return res;
 }
 
diff --git a/yaz.m4 b/yaz.m4
index 2782a1d..796738e 100644 (file)
--- 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
                        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"
                        fi
                        if test "$req_yaz_version" -gt "2000028"; then
                                YAZINC="$YAZINC -DYAZ_USE_NEW_LOG=1"
index cf121a0..8512109 100644 (file)
--- 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
                        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
                        fi
                fi
        fi