operation.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-ir-assoc.h,v 1.7 1999-04-21 12:09:01 adam Exp $
+ * $Id: yaz-ir-assoc.h,v 1.8 1999-12-06 13:52:45 adam Exp $
*/
#include <yaz-z-assoc.h>
int m_preferredRecordSyntax;
Z_ElementSetNames *m_elementSetNames;
int m_lastReceived;
+ int m_log;
};
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-pdu-assoc.h,v 1.6 1999-11-10 10:02:34 adam Exp $
+ * $Id: yaz-pdu-assoc.h,v 1.7 1999-12-06 13:52:45 adam Exp $
*/
-#include <comstack.h>
+#include <yaz/comstack.h>
#include <yaz-socket-observer.h>
#include <yaz-pdu-observer.h>
*/
class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver {
private:
- enum { Connecting, Connected, Listen, Ready, Closed } m_state;
+ enum { Connecting, Listen, Ready, Closed } m_state;
class PDU_Queue {
public:
PDU_Queue(const char *buf, int len);
int Yaz_PDU_Assoc::flush_PDU();
int *m_destroyed;
int m_idleTime;
+ int m_log;
public:
/// Create object using specified socketObservable
- Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, COMSTACK cs = 0);
+ Yaz_PDU_Assoc(IYazSocketObservable *socketObservable);
/// Close socket and destroy object.
virtual ~Yaz_PDU_Assoc();
/// Clone the object
void connect(IYaz_PDU_Observer *observer, const char *addr);
/// listen for clients (server role)
void listen(IYaz_PDU_Observer *observer, const char *addr);
+ /// open with existing socket
+ void socket(IYaz_PDU_Observer *observer, int fd);
/// Socket notification
void socketNotify(int event);
/// Close socket
void destroy();
/// Set Idle Time
void idleTime (int timeout);
+ /// Child start...
+ virtual void childNotify(int fd);
};
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-pdu-observer.h,v 1.6 1999-04-20 10:30:05 adam Exp $
+ * $Id: yaz-pdu-observer.h,v 1.7 1999-12-06 13:52:45 adam Exp $
*/
#ifndef YAZ_PDU_OBSERVER_H
virtual void destroy() = 0;
/// Set Idle Time
virtual void idleTime (int timeout) = 0;
+ /// open with existing socket
+ virtual void socket(IYaz_PDU_Observer *observer, int fd) = 0;
};
/** Protocol Data Unit Observer.
public:
/// A PDU has been received
virtual void recv_PDU(const char *buf, int len) = 0;
- /// Called when Iyaz_PDU_Observabvle::connect was successful.
+ /// Called when Iyaz_PDU_Observable::connect was successful.
virtual void connectNotify() = 0;
/// Called whenever the connection was closed
virtual void failNotify() = 0;
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-proxy.h,v 1.8 1999-11-10 10:02:34 adam Exp $
+ * $Id: yaz-proxy.h,v 1.9 1999-12-06 13:52:45 adam Exp $
*/
#include <yaz-z-assoc.h>
~Yaz_ProxyClient();
void recv_Z_PDU(Z_APDU *apdu);
IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
+ void shutdown();
Yaz_Proxy *m_server;
void failNotify();
void timeoutNotify();
+ void connectNotify();
char m_cookie[32];
Yaz_ProxyClient *m_next;
Yaz_ProxyClient **m_prev;
/// Information Retrieval Proxy Server.
class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
- public:
- Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable);
- ~Yaz_Proxy();
- void recv_Z_PDU(Z_APDU *apdu);
- IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
- void failNotify();
- void timeoutNotify();
- void proxyTarget(const char *target);
private:
char *get_cookie(Z_OtherInformation **otherInfo);
char *get_proxy(Z_OtherInformation **otherInfo);
Yaz_ProxyClient *get_client(Z_APDU *apdu);
Z_APDU *result_set_optimize(Z_APDU *apdu);
+ void shutdown();
Yaz_ProxyClient *m_client;
IYaz_PDU_Observable *m_PDU_Observable;
int m_seqno;
int m_keepalive;
char *m_proxyTarget;
+ public:
+ Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable);
+ ~Yaz_Proxy();
+ void recv_Z_PDU(Z_APDU *apdu);
+ IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
+ void failNotify();
+ void timeoutNotify();
+ void connectNotify();
+ void set_proxyTarget(const char *target);
+ char *get_proxyTarget() { return m_proxyTarget; };
};
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-socket-manager.h,v 1.4 1999-04-20 10:30:05 adam Exp $
+ * $Id: yaz-socket-manager.h,v 1.5 1999-12-06 13:52:45 adam Exp $
*/
#include <yaz-socket-observer.h>
YazSocketEvent *Yaz_SocketManager::getEvent();
void putEvent(YazSocketEvent *event);
void removeEvent(IYazSocketObserver *observer);
+ int m_log;
public:
/// Add an observer
virtual void addObserver(int fd, IYazSocketObserver *observer);
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-z-assoc.h,v 1.4 1999-09-13 12:53:44 adam Exp $
+ * $Id: yaz-z-assoc.h,v 1.5 1999-12-06 13:52:45 adam Exp $
*/
-#include <proto.h>
-#include <odr.h>
+#include <yaz/proto.h>
+#include <yaz/odr.h>
#include <yaz-pdu-observer.h>
/** Z39.50 Assocation.
/// Receive PDU
void recv_PDU(const char *buf, int len);
/// Connect notification
- void connectNotify();
+ virtual void connectNotify() = 0;
/// Failure notification
- void failNotify();
+ virtual void failNotify() = 0;
/// Timeout notification
- void timeoutNotify();
+ virtual void timeoutNotify() = 0;
/// Timeout specify
void timeout(int timeout);
/// Begin Z39.50 client role
ODR m_odr_in;
ODR m_odr_out;
ODR m_odr_print;
+ int m_log;
};
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: yaz-z-query.h,v 1.5 1999-04-27 07:52:13 adam Exp $
+ * $Id: yaz-z-query.h,v 1.6 1999-12-06 13:52:45 adam Exp $
*/
-#include <proto.h>
+#include <yaz/proto.h>
#include <yaz-query.h>
/** Z39.50 Query
# Copyright (C) 1999, Index Data ApS
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile.in,v 1.5 1999-07-12 07:57:27 adam Exp $
+# $Id: Makefile.in,v 1.6 1999-12-06 13:52:45 adam Exp $
SHELL=/bin/sh
CDEFS=@DEFS@
LIBS=@LIBS@
-LIBDIR=../../yaz/lib
-
-INCLUDE=-I../../yaz/include -I../include
+YAZLIB=@YAZLIB@
+INCLUDE=-I../include @YAZINC@
DEFS=$(INCLUDE) $(CDEFS)
-YAZLIBS=$(LIBDIR)/libyaz.a
-PROG1=yaz-client
+PROG1=yaz-clientx
PROGO1=yaz-client.o
PROG2=yaz-server
PROGO2=yaz-server.o
ar qc $(LIB) $(PO)
$(RANLIB) $(LIB)
-$(PROG1): $(PROGO1) $(YAZLIBS) $(LIB)
- $(CXX) $(CXXFLAGS) -o $(PROG1) $(PROGO1) $(LIB) $(YAZLIBS) $(LIBS)
+$(PROG1): $(PROGO1) $(LIB)
+ $(CXX) $(CXXFLAGS) -o $(PROG1) $(PROGO1) $(LIB) $(YAZLIB) $(LIBS)
-$(PROG2): $(PROGO2) $(YAZLIBS) $(LIB)
- $(CXX) $(CXXFLAGS) -o $(PROG2) $(PROGO2) $(LIB) $(YAZLIBS) $(LIBS)
+$(PROG2): $(PROGO2) $(LIB)
+ $(CXX) $(CXXFLAGS) -o $(PROG2) $(PROGO2) $(LIB) $(YAZLIB) $(LIBS)
-$(PROG3): $(PROGO3) $(YAZLIBS) $(LIB)
- $(CXX) $(CXXFLAGS) -o $(PROG3) $(PROGO3) $(LIB) $(YAZLIBS) $(LIBS)
+$(PROG3): $(PROGO3) $(LIB)
+ $(CXX) $(CXXFLAGS) -o $(PROG3) $(PROGO3) $(LIB) $(YAZLIB) $(LIBS)
alll:
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-client.cpp,v $
- * Revision 1.8 1999-11-10 10:02:34 adam
+ * Revision 1.9 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.8 1999/11/10 10:02:34 adam
* Work on proxy.
*
* Revision 1.7 1999/04/21 12:09:01 adam
*
*/
-#include <log.h>
-#include <options.h>
-#include <diagbib1.h>
+#include <yaz/log.h>
+#include <yaz/options.h>
+#include <yaz/diagbib1.h>
#include <yaz-ir-assoc.h>
#include <yaz-pdu-assoc.h>
#include <yaz-socket-manager.h>
void recv_genericRecord(Z_GenericRecord *r);
void display_genericRecord(Z_GenericRecord *r, int level);
void display_variant(Z_Variant *v, int level);
+ void connectNotify();
+ void failNotify();
+ void timeoutNotify();
int processCommand(const char *cmd);
const char *MyClient::getCommand();
int cmd_open(char *host);
+ int cmd_connect(char *host);
int cmd_quit(char *args);
int cmd_close(char *args);
int cmd_find(char *args);
int cmd_show(char *args);
int cmd_cookie(char *args);
int cmd_init(char *args);
+ int cmd_format(char *args);
+ int cmd_proxy(char *args);
};
+
+void MyClient::connectNotify()
+{
+ printf ("Connection accepted by target\n");
+ set_lastReceived(-1);
+}
+
+void MyClient::timeoutNotify()
+{
+ printf ("Connection timeout\n");
+ close();
+}
+
+void MyClient::failNotify()
+{
+ printf ("Connection closed by target\n");
+ set_lastReceived(-1);
+}
+
IYaz_PDU_Observer *MyClient::clone(IYaz_PDU_Observable *the_PDU_Observable)
{
return new MyClient(the_PDU_Observable, m_socketManager);
#define C_PROMPT "Z>"
+int MyClient::cmd_connect(char *host)
+{
+ client (host);
+ timeout (10);
+ wait ();
+ timeout (0);
+ return 1;
+}
+
int MyClient::cmd_open(char *host)
{
client (host);
- m_socketManager->processEvent();
+ timeout (10);
+ wait ();
+ timeout (0);
+ send_initRequest();
+ wait ();
return 1;
}
}
if (send_searchRequest(&query) >= 0)
wait();
+ else
+ printf ("Not connected\n");
return 1;
}
m_setOffset = start;
if (send_presentRequest(start, number) >= 0)
wait();
+ else
+ printf ("Not connected\n");
return 1;
}
return 1;
}
+int MyClient::cmd_format(char *args)
+{
+ set_preferredRecordSyntax(args);
+ return 1;
+}
+
+int MyClient::cmd_proxy(char *args)
+{
+ set_proxy(args);
+ return 1;
+}
+
int MyClient::processCommand(const char *commandLine)
{
char cmdStr[1024], cmdArgs[1024];
char *ad;
} cmd[] = {
{"open", &cmd_open, "<host>[':'<port>][/<database>]"},
- {"quit", &cmd_quit, ""},
+ {"connect", &cmd_connect, "<host>[':'<port>][/<database>]"},
+ {"quit", &cmd_quit, ""},
{"close", &cmd_close, ""},
{"find", &cmd_find, "<query>"},
{"show", &cmd_show, "[<start> [<number>]]"},
{"cookie", &cmd_cookie, "<cookie>"},
{"init", &cmd_init, ""},
+ {"format", &cmd_format, "<record-syntax>"},
+ {"proxy", &cmd_proxy, "<host>:[':'<port>]"},
{0,0,0}
};
char *prog = argv[0];
int ret;
- while ((ret = options("p:v:q", argv, argc, &arg)) != -2)
+ while ((ret = options("c:p:v:q", argv, argc, &arg)) != -2)
{
switch (ret)
{
}
set_proxy(arg);
break;
+ case 'c':
+ set_cookie(arg);
+ break;
case 'v':
log_init_level (log_mask_str(arg));
break;
if (host)
{
client (host);
+ timeout (10);
+ wait ();
+ timeout (0);
send_initRequest();
wait ();
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-ir-assoc.cpp,v $
- * Revision 1.10 1999-04-29 07:33:28 adam
+ * Revision 1.11 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.10 1999/04/29 07:33:28 adam
* Changed setting of host in connect/proxy setting. YAZ' strtoaddr now
* ignores database part of host.
*
#include <assert.h>
-#include <log.h>
+#include <yaz/log.h>
#include <yaz-ir-assoc.h>
Yaz_IR_Assoc::Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable)
m_host = 0;
m_proxy = 0;
m_cookie = 0;
+ m_log = LOG_DEBUG;
const char *db = "Default";
set_databaseNames(1, &db);
}
void Yaz_IR_Assoc::set_databaseNames (int num, const char **list)
{
int i;
- logf (LOG_LOG, "Yaz_IR_Assoc::set_databaseNames num=%d", num);
+ logf (m_log, "Yaz_IR_Assoc::set_databaseNames num=%d", num);
for (i = 0; i<m_num_databaseNames; i++)
delete [] m_databaseNames[i];
delete [] m_databaseNames;
void Yaz_IR_Assoc::recv_Z_PDU(Z_APDU *apdu)
{
- logf (LOG_LOG, "recv_Z_PDU");
+ logf (m_log, "recv_Z_PDU");
m_lastReceived = apdu->which;
switch (apdu->which)
{
case Z_APDU_initResponse:
- logf (LOG_LOG, "recv InitResponse");
+ logf (m_log, "recv InitResponse");
recv_initResponse(apdu->u.initResponse);
break;
case Z_APDU_initRequest:
- logf (LOG_LOG, "recv InitRequest");
+ logf (m_log, "recv InitRequest");
recv_initRequest(apdu->u.initRequest);
break;
case Z_APDU_searchRequest:
- logf (LOG_LOG, "recv searchRequest");
+ logf (m_log, "recv searchRequest");
recv_searchRequest(apdu->u.searchRequest);
break;
case Z_APDU_searchResponse:
- logf (LOG_LOG, "recv searchResponse");
+ logf (m_log, "recv searchResponse");
recv_searchResponse(apdu->u.searchResponse);
break;
case Z_APDU_presentRequest:
- logf (LOG_LOG, "recv presentRequest");
+ logf (m_log, "recv presentRequest");
recv_presentRequest(apdu->u.presentRequest);
break;
case Z_APDU_presentResponse:
- logf (LOG_LOG, "recv presentResponse");
+ logf (m_log, "recv presentResponse");
recv_presentResponse(apdu->u.presentResponse);
break;
}
oid_ent_to_oid(&prefsyn, oid_syntax);
req->preferredRecordSyntax = oid_syntax;
}
- logf (LOG_LOG, "send_searchRequest");
+ logf (m_log, "send_searchRequest");
assert (req->otherInfo == 0);
if (m_cookie)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-pdu-assoc.cpp,v $
- * Revision 1.8 1999-04-28 13:04:03 adam
+ * Revision 1.9 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.8 1999/04/28 13:04:03 adam
* Fixed setting of proxy otherInfo so that database(s) are removed.
*
* Revision 1.7 1999/04/21 12:09:01 adam
#include <yaz-pdu-assoc.h>
-#include <log.h>
-#include <tcpip.h>
+#include <yaz/log.h>
+#include <yaz/tcpip.h>
-Yaz_PDU_Assoc::Yaz_PDU_Assoc(IYazSocketObservable *socketObservable,
- COMSTACK cs)
+Yaz_PDU_Assoc::Yaz_PDU_Assoc(IYazSocketObservable *socketObservable)
{
m_state = Closed;
- m_cs = cs;
+ m_cs = 0;
m_socketObservable = socketObservable;
m_PDU_Observer = 0;
m_queue_out = 0;
m_parent = 0;
m_next = 0;
m_destroyed = 0;
+ m_idleTime = 0;
+ m_log = LOG_DEBUG;
}
IYaz_PDU_Observable *Yaz_PDU_Assoc::clone()
{
- Yaz_PDU_Assoc *copy = new Yaz_PDU_Assoc(m_socketObservable, 0);
+ Yaz_PDU_Assoc *copy = new Yaz_PDU_Assoc(m_socketObservable);
return copy;
}
void Yaz_PDU_Assoc::socketNotify(int event)
{
- logf (LOG_LOG, "Yaz_PDU_Assoc::socketNotify p=%p event = %d", this, event);
- if (m_state == Connected)
+ logf (m_log, "Yaz_PDU_Assoc::socketNotify p=%p event = %d", this, event);
+ if (0 /* m_state == Connected */)
{
m_state = Ready;
m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
close();
m_PDU_Observer->failNotify();
}
- else
+ else if (event & YAZ_SOCKET_OBSERVE_TIMEOUT)
+ {
+ m_PDU_Observer->timeoutNotify();
+ }
+ else
{
m_state = Ready;
m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
if (!(new_line = cs_accept(m_cs)))
return;
- Yaz_PDU_Assoc *assoc = new Yaz_PDU_Assoc (m_socketObservable,
- new_line);
+ /* 1. create socket-manager
+ 2. create pdu-assoc
+ 3. create top-level object
+ setup observer for child fileid in pdu-assoc
+ 4. start thread
+ */
+ int fd = cs_fileno(new_line);
+ cs_fileno(new_line) = -1;
+ cs_close (new_line);
+#if 1
+ childNotify(fd);
+#else
+ Yaz_PDU_Assoc *assoc = new Yaz_PDU_Assoc (m_socketObservable);
assoc->m_parent = this;
assoc->m_next = m_children;
m_children = assoc;
-
+
assoc->m_PDU_Observer = m_PDU_Observer->clone(assoc);
- assoc->m_state = Ready;
- assoc->m_socketObservable->addObserver(cs_fileno(new_line), assoc);
- assoc->m_socketObservable->maskObserver(assoc,
- YAZ_SOCKET_OBSERVE_READ|
- YAZ_SOCKET_OBSERVE_EXCEPT);
- assoc->m_socketObservable->timeoutObserver(assoc,
- assoc->m_idleTime);
+ socket(fd);
+#endif
}
}
else if (m_state == Ready)
return;
else if (res <= 0)
{
- logf (LOG_LOG, "Connection closed by client");
+ logf (m_log, "Connection closed by peer");
close();
m_PDU_Observer->failNotify();
return;
m_state = Closed;
if (m_cs)
{
- logf (LOG_LOG, "Yaz_PDU_Assoc::close fd=%d", cs_fileno(m_cs));
+ logf (m_log, "Yaz_PDU_Assoc::close fd=%d", cs_fileno(m_cs));
cs_close (m_cs);
}
m_cs = 0;
{
int r;
- logf (LOG_LOG, "Yaz_PDU_Assoc::flush_PDU");
+ logf (m_log, "Yaz_PDU_Assoc::flush_PDU");
if (m_state != Ready)
{
+ logf (m_log, "YAZ_PDU_Assoc::flush_PDU, not ready");
return 1;
}
PDU_Queue *q = m_queue_out;
m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
YAZ_SOCKET_OBSERVE_EXCEPT|
YAZ_SOCKET_OBSERVE_WRITE);
- logf (LOG_LOG, "Yaz_PDU_Assoc::flush_PDU put %d bytes (incomplete)",
+ logf (m_log, "Yaz_PDU_Assoc::flush_PDU put %d bytes (incomplete)",
q->m_len);
return r;
}
- logf (LOG_LOG, "Yaz_PDU_Assoc::flush_PDU put %d bytes", q->m_len);
+ logf (m_log, "Yaz_PDU_Assoc::flush_PDU put %d bytes", q->m_len);
// whole packet sent... delete this and proceed to next ...
m_queue_out = q->m_next;
delete q;
int Yaz_PDU_Assoc::send_PDU(const char *buf, int len)
{
- logf (LOG_LOG, "Yaz_PDU_Assoc::send_PDU");
+ logf (m_log, "Yaz_PDU_Assoc::send_PDU");
PDU_Queue **pq = &m_queue_out;
int is_idle = (*pq ? 0 : 1);
if (!m_cs)
{
- logf (LOG_LOG, "Yaz_PDU_Assoc::send_PDU failed, m_cs == 0");
+ logf (m_log, "Yaz_PDU_Assoc::send_PDU failed, m_cs == 0");
return -1;
}
while (*pq)
if (is_idle)
return flush_PDU ();
else
- logf (LOG_LOG, "Yaz_PDU_Assoc::cannot send_PDU fd=%d",
+ logf (m_log, "Yaz_PDU_Assoc::cannot send_PDU fd=%d",
cs_fileno(m_cs));
return 0;
}
if (!m_cs)
{
CS_TYPE cs_type = tcpip_type;
- int protocol = PROTO_Z3950;
- m_cs = cs_create (cs_type, 0, protocol);
+ m_cs = cs_create (cs_type, 0, PROTO_Z3950);
}
return m_cs;
}
void *ap;
COMSTACK cs = comstack();
- logf (LOG_LOG, "Yaz_PDU_Assoc::listen %s", addr);
+ logf (m_log, "Yaz_PDU_Assoc::listen %s", addr);
m_PDU_Observer = observer;
if (!cs)
return;
void Yaz_PDU_Assoc::idleTime(int idleTime)
{
m_idleTime = idleTime;
- logf (LOG_LOG, "Yaz_PDU_Assoc::idleTime(%d)", idleTime);
+ logf (m_log, "Yaz_PDU_Assoc::idleTime(%d)", idleTime);
m_socketObservable->timeoutObserver(this, m_idleTime);
}
void Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer,
const char *addr)
{
- logf (LOG_LOG, "Yaz_PDU_Assoc::connect %s", addr);
+ logf (m_log, "Yaz_PDU_Assoc::connect %s", addr);
close();
m_PDU_Observer = observer;
COMSTACK cs = comstack();
void *ap = cs_straddr (cs, addr);
if (!ap)
{
- logf (LOG_LOG, "cs_straddr failed");
+ logf (m_log, "cs_straddr failed");
return;
}
int res = cs_connect (cs, ap);
- if (res < 0)
+ logf (m_log, "Yaz_PDU_Assoc::connect fd=%d res=%d", cs_fileno(cs), res);
+ m_socketObservable->addObserver(cs_fileno(cs), this);
+ m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
+ YAZ_SOCKET_OBSERVE_EXCEPT|
+ YAZ_SOCKET_OBSERVE_WRITE);
+ m_state = Connecting;
+}
+
+void Yaz_PDU_Assoc::socket(IYaz_PDU_Observer *observer, int fd)
+{
+ close();
+ m_PDU_Observer = observer;
+ if (fd >= 0)
{
- logf (LOG_LOG|LOG_ERRNO, "Yaz_PDU_Assoc::connect failed");
+ CS_TYPE cs_type = tcpip_type;
+ m_cs = cs_createbysocket(fd, cs_type, 0, PROTO_Z3950);
+ m_state = Ready;
+ m_socketObservable->addObserver(fd, this);
+ m_socketObservable->maskObserver(this,
+ YAZ_SOCKET_OBSERVE_READ|
+ YAZ_SOCKET_OBSERVE_EXCEPT);
+ m_socketObservable->timeoutObserver(this, m_idleTime);
+ }
+}
+
#if 1
- logf (LOG_LOG, "Yaz_PDU_Assoc::connect fd=%d", cs_fileno(cs));
- m_socketObservable->addObserver(cs_fileno(cs), this);
- m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
- YAZ_SOCKET_OBSERVE_EXCEPT|
- YAZ_SOCKET_OBSERVE_WRITE);
- m_state = Connecting;
+void Yaz_PDU_Assoc::childNotify(int fd)
+{
+ /// Clone PDU Observable (keep socket manager)
+ IYaz_PDU_Observable *new_observable = clone();
+
+ /// Clone PDU Observer
+ IYaz_PDU_Observer *observer = m_PDU_Observer->clone(new_observable);
+
+ /// Attach new socket to it
+ new_observable->socket(observer, fd);
+}
#else
- close ();
-#endif
- }
- else
- {
- logf (LOG_LOG, "Yaz_PDU_Assoc::connect fd=%d", cs_fileno(cs));
- m_socketObservable->addObserver(cs_fileno(cs), this);
- m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
- YAZ_SOCKET_OBSERVE_EXCEPT|
- YAZ_SOCKET_OBSERVE_WRITE);
- if (res == 1)
- {
- logf (LOG_LOG, "Yaz_PDU_Assoc::connect pending");
- m_state = Connecting;
- }
- else
- {
- logf (LOG_LOG, "Yaz_PDU_Assoc::Connect complete");
- m_state = Connected;
- }
- }
+
+#include <yaz-socket-manager.h>
+#include <pthread.h>
+
+class thread_info {
+ Yaz_SocketManager *socketManager;
+ IYaz_PDU_Observable *
+
+};
+
+static void *events(void *p)
+{
+ Yaz_SocketManager *s = (Yaz_SocketManager *) p;
+
+ while (s->processEvent() > 0)
+ ;
+ return 0;
}
+
+void Yaz_PDU_Assoc::childNotify(int fd)
+{
+ Yaz_SocketManager *socket_observable = new Yaz_SocketManager;
+ IYaz_PDU_Observable *new_observable = clone();
+
+ m_socketObservable = socket_observable;
+
+ /// Clone PDU Observer
+ IYaz_PDU_Observer *observer = m_PDU_Observer->clone(new_observable);
+
+ /// Attach new socket to it
+ new_observable->socket(observer, fd);
+
+ pthread_t type;
+
+ int id = pthread_create (&type, 0, events, socket_observable);
+ logf (LOG_LOG, "pthread_create returned id=%d", id);
+}
+#endif
+
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-proxy-main.cpp,v $
- * Revision 1.6 1999-11-10 10:02:34 adam
+ * Revision 1.7 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.6 1999/11/10 10:02:34 adam
* Work on proxy.
*
* Revision 1.5 1999/04/21 12:09:01 adam
*
*/
-#include <log.h>
-#include <options.h>
+#include <yaz/log.h>
+#include <yaz/options.h>
#include <yaz-socket-manager.h>
#include <yaz-pdu-assoc.h>
char *prog = argv[0];
int ret;
- while ((ret = options("p:v:q", argv, argc, &arg)) != -2)
+ while ((ret = options("t:v:", argv, argc, &arg)) != -2)
{
switch (ret)
{
addr = arg;
break;
case 't':
- proxy->proxyTarget(arg);
+ proxy->set_proxyTarget(arg);
break;
case 'v':
log_init_level (log_mask_str(arg));
{
proxy->server(addr);
}
+ else
+ {
+ usage(prog);
+ return 1;
+ }
return 0;
}
-
int main(int argc, char **argv)
{
Yaz_SocketManager mySocketManager;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-proxy.cpp,v $
- * Revision 1.10 1999-11-10 10:02:34 adam
+ * Revision 1.11 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.10 1999/11/10 10:02:34 adam
* Work on proxy.
*
* Revision 1.9 1999/09/13 12:53:44 adam
#include <assert.h>
-#include <log.h>
-
+#include <yaz/log.h>
#include <yaz-proxy.h>
Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable) :
}
-void Yaz_Proxy::proxyTarget(const char *target)
+void Yaz_Proxy::set_proxyTarget(const char *target)
{
xfree (m_proxyTarget);
m_proxyTarget = 0;
{
Yaz_Proxy *new_proxy = new Yaz_Proxy(the_PDU_Observable);
new_proxy->m_parent = this;
- new_proxy->timeout(120);
+ new_proxy->timeout(20);
+ new_proxy->set_proxyTarget(m_proxyTarget);
return new_proxy;
}
assert (*c->m_prev == c);
if (!strcmp(cookie,c->m_cookie))
{
- logf (LOG_LOG, "Yaz_Proxy::get_client cached");
+ logf (LOG_LOG, "Yaz_Proxy::get_client found cached target");
return c;
}
- }
-
+ }
}
if (!m_client)
{
- const char *proxy_host = 0;
if (apdu->which == Z_APDU_initRequest)
{
logf (LOG_LOG, "got InitRequest");
- char *proxy_host = get_proxy(&apdu->u.initRequest->otherInfo);
- if (!proxy_host)
- proxy_host = m_proxyTarget;
- if (!proxy_host)
- return 0;
+ const char *proxy_host =
+ get_proxy(&apdu->u.initRequest->otherInfo);
+ if (proxy_host)
+ set_proxyTarget(proxy_host);
+ logf (LOG_LOG, "proxy_host = %s", m_proxyTarget ?
+ m_proxyTarget:"none");
+ }
+ else
+ {
+ logf (LOG_LOG, "no first INIT!");
+ return 0;
}
+ if (!m_proxyTarget)
+ return 0;
logf (LOG_LOG, "Yaz_Proxy::get_client creating new");
c = new Yaz_ProxyClient(m_PDU_Observable->clone());
c->m_next = parent->m_clientPool;
sprintf (c->m_cookie, "%d", parent->m_seqno);
(parent->m_seqno)++;
- if (apdu->which == Z_APDU_initRequest)
- {
- logf (LOG_LOG, "got InitRequest");
-
- c->client(proxy_host);
- }
+ c->client(m_proxyTarget);
c->timeout(600);
}
return c;
}
}
-void Yaz_Proxy::failNotify()
+void Yaz_Proxy::connectNotify()
{
- logf (LOG_LOG, "failNotity server");
+}
+
+void Yaz_Proxy::shutdown()
+{
+ logf (LOG_LOG, "shutdown (client to proxy)");
if (m_keepalive)
{
// Tell client (if any) that no server connection is there..
delete this;
}
-void Yaz_ProxyClient::failNotify()
+void Yaz_ProxyClient::shutdown()
{
- logf (LOG_LOG, "failNotity client");
+ logf (LOG_LOG, "shutdown (proxy to server)");
delete m_server;
delete this;
}
+void Yaz_Proxy::failNotify()
+{
+ logf (LOG_LOG, "connection closed by client");
+ shutdown();
+}
+
+void Yaz_ProxyClient::failNotify()
+{
+ logf (LOG_LOG, "connection closed by server");
+ shutdown();
+}
+
+void Yaz_ProxyClient::connectNotify()
+{
+ logf (LOG_LOG, "connection accepted by target");
+}
+
IYaz_PDU_Observer *Yaz_ProxyClient::clone(IYaz_PDU_Observable
*the_PDU_Observable)
{
void Yaz_Proxy::timeoutNotify()
{
- failNotify();
+ logf (LOG_LOG, "timeout (client to proxy)");
+ shutdown();
}
void Yaz_ProxyClient::timeoutNotify()
{
- failNotify();
+ logf (LOG_LOG, "timeout (proxy to target)");
+ shutdown();
}
Yaz_ProxyClient::Yaz_ProxyClient(IYaz_PDU_Observable *the_PDU_Observable) :
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-server.cpp,v $
- * Revision 1.6 1999-04-21 12:09:01 adam
+ * Revision 1.7 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.6 1999/04/21 12:09:01 adam
* Many improvements. Modified to proxy server to work with "sessions"
* based on cookies.
*
*
*/
-#include <log.h>
+#include <yaz/log.h>
#include <yaz-z-assoc.h>
#include <yaz-pdu-assoc.h>
#include <yaz-socket-manager.h>
IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
void failNotify();
void timeoutNotify();
+ void connectNotify();
private:
int m_no;
};
delete this;
}
+void MyServer::connectNotify()
+{
+}
+
int main(int argc, char **argv)
{
Yaz_SocketManager mySocketManager;
- Yaz_PDU_Assoc *my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager, 0);
+ Yaz_PDU_Assoc *my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager);
MyServer z(my_PDU_Assoc);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-socket-manager.cpp,v $
- * Revision 1.7 1999-04-28 13:02:08 adam
+ * Revision 1.8 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.7 1999/04/28 13:02:08 adam
* Added include of string.h.
*
* Revision 1.6 1999/04/21 12:09:01 adam
#include <errno.h>
#include <string.h>
-#include <log.h>
+#include <yaz/log.h>
#include <yaz-socket-manager.h>
YazSocketEntry *p;
YazSocketEvent *event = getEvent();
unsigned timeout = 0;
- logf (LOG_LOG, "processEvent");
+ logf (m_log, "processEvent");
if (event)
{
event->observer->socketNotify(event->event);
}
if (!no)
{
- logf (LOG_LOG, "no pending events return 0");
+ logf (m_log, "no pending events return 0");
if (!m_observers)
- logf (LOG_LOG, "no observers");
+ logf (m_log, "no observers");
return 0;
}
to.tv_sec = timeout;
to.tv_usec = 0;
- logf (LOG_LOG, "timeout=%d", timeout);
+ logf (m_log, "select pending=%d timeout=%d", no, timeout);
while ((res = select(max + 1, &in, &out, &except, timeout ? &to : 0)) < 0)
if (errno != EINTR)
return -1;
m_observers = 0;
m_queue_front = 0;
m_queue_back = 0;
+ m_log = LOG_DEBUG;
}
Yaz_SocketManager::~Yaz_SocketManager()
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-z-assoc.cpp,v $
- * Revision 1.5 1999-11-10 10:02:34 adam
+ * Revision 1.6 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.5 1999/11/10 10:02:34 adam
* Work on proxy.
*
* Revision 1.4 1999/09/13 12:53:44 adam
#include <assert.h>
-#include <log.h>
+#include <yaz/log.h>
#include <yaz-z-assoc.h>
-#include <otherinfo.h>
+#include <yaz/otherinfo.h>
int Yaz_Z_Assoc::yaz_init_func()
{
- logf (LOG_LOG, "nmem_init");
nmem_init();
- logf (LOG_LOG, "done");
return 1;
}
m_odr_in = odr_createmem (ODR_DECODE);
m_odr_out = odr_createmem (ODR_ENCODE);
m_odr_print = odr_createmem (ODR_PRINT);
+ m_log = LOG_DEBUG;
}
Yaz_Z_Assoc::~Yaz_Z_Assoc()
void Yaz_Z_Assoc::recv_PDU(const char *buf, int len)
{
- logf (LOG_LOG, "recv_PDU len=%d", len);
+ logf (m_log, "recv_PDU len=%d", len);
Z_APDU *apdu = decode_Z_PDU (buf, len);
if (apdu)
{
{
char *buf;
int len;
- logf (LOG_LOG, "Yaz_Z_Assoc:send_Z_PDU");
if (encode_Z_PDU(apdu, &buf, &len) > 0)
return m_PDU_Observable->send_PDU(buf, len);
return -1;
return *len;
}
-void Yaz_Z_Assoc::connectNotify()
-{
- logf (LOG_LOG, "connectNotify");
-}
-
-void Yaz_Z_Assoc::failNotify()
-{
- logf (LOG_LOG, "failNotify");
-}
-
-void Yaz_Z_Assoc::timeoutNotify()
-{
- logf (LOG_LOG, "timeoutNotify");
-}
-
void Yaz_Z_Assoc::client(const char *addr)
{
m_PDU_Observable->connect (this, addr);
m_PDU_Observable->idleTime(timeout);
}
+
void Yaz_Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip)
{
switch (apdu->which)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-z-query.cpp,v $
- * Revision 1.5 1999-04-27 07:52:13 adam
+ * Revision 1.6 1999-12-06 13:52:45 adam
+ * Modified for new location of YAZ header files. Experimental threaded
+ * operation.
+ *
+ * Revision 1.5 1999/04/27 07:52:13 adam
* Improved proxy; added query match for result set re-use.
*
* Revision 1.4 1999/04/21 12:09:01 adam
*/
#include <yaz-z-query.h>
-#include <pquery.h>
+#include <yaz/pquery.h>
Yaz_Z_Query::Yaz_Z_Query()
{
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12
+# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- --enable-threads enable threads if available"
+ --with-yazconfig Path for yaz-config"
# Initialize some variables set by options.
# The variables have the same names as the options, with
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12"
+ echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
+ac_exeext=
+ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:527: checking for $ac_word" >&5
+echo "configure:530: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:556: checking for $ac_word" >&5
+echo "configure:560: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- for ac_dir in $PATH; do
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
echo "$ac_t""no" 1>&6
fi
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:611: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:604: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:643: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-cat > conftest.$ac_ext <<EOF
-#line 614 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 654 "configure"
#include "confdefs.h"
+
main(){return(0);}
EOF
-if { (eval echo configure:618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:638: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:685: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:643: checking whether we are using GNU C" >&5
+echo "configure:690: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
if test $ac_cv_prog_gcc = yes; then
GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:667: checking whether ${CC-cc} accepts -g" >&5
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:718: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
- CFLAGS="-O2"
+ CFLAGS="-g"
fi
else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
fi
-for ac_prog in $CCC c++ g++ gcc CC cxx cc++
+for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:699: checking for $ac_word" >&5
+echo "configure:754: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CXX="$ac_prog"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:730: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:786: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
-cat > conftest.$ac_ext <<EOF
-#line 740 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 797 "configure"
#include "confdefs.h"
-main(){return(0);}
+
+int main(){return(0);}
EOF
-if { (eval echo configure:744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:770: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:828: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:775: checking whether we are using GNU C++" >&5
+echo "configure:833: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
if test $ac_cv_prog_gxx = yes; then
GXX=yes
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS=
- echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:799: checking whether ${CXX-g++} accepts -g" >&5
+else
+ GXX=
+fi
+
+ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ac_save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS=
+echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
+echo "configure:861: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
- if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS="$ac_save_CXXFLAGS"
- elif test $ac_cv_prog_cxx_g = yes; then
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
else
- CXXFLAGS="-O2"
+ CXXFLAGS="-g"
fi
else
- GXX=
- test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:827: checking how to run the C preprocessor" >&5
+echo "configure:893: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 842 "configure"
+#line 908 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 859 "configure"
+#line 925 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 942 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
rm -f conftest*
fi
rm -f conftest*
+fi
+rm -f conftest*
ac_cv_prog_CPP="$CPP"
fi
CPP="$ac_cv_prog_CPP"
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:888: checking how to run the C++ preprocessor" >&5
+echo "configure:973: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 901 "configure"
+#line 986 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
fi
fi
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:960: checking for a BSD compatible install" >&5
+echo "configure:1046: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd scoinst install; do
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
- # OSF/1 installbsd also uses dspmsg, but is usable.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1012: checking for $ac_word" >&5
+echo "configure:1101: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_RANLIB="ranlib"
echo "$ac_t""no" 1>&6
fi
-checkBoth=0
-echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1040: checking for connect" >&5
-if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1045 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char connect(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-connect();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_connect=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_connect=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test "$ac_cv_func_connect" = "no"; then
- echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:1089: checking for main in -lsocket" >&5
-ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lsocket $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1097 "configure"
-#include "confdefs.h"
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:1104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lsocket"
-else
- echo "$ac_t""no" 1>&6
-checkBoth=1
+yazconfig=NONE
+yazpath=NONE
+# Check whether --with-yazconfig or --without-yazconfig was given.
+if test "${with_yazconfig+set}" = set; then
+ withval="$with_yazconfig"
+ yazpath=$withval
fi
-fi
-if test "$checkBoth" = "1"; then
- oldLibs=$LIBS
- LIBS="$LIBS -lsocket -lnsl"
- echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:1130: checking for accept" >&5
-if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test "x$yazpath" != "xNONE"; then
+ yazconfig=$yazpath/yaz-config
else
- cat > conftest.$ac_ext <<EOF
-#line 1135 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char accept(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char accept();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_accept) || defined (__stub___accept)
-choke me
-#else
-accept();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_accept=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_accept=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'accept`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-LIBS=$oldLibs
-fi
-
-fi
-echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1180: checking for gethostbyname" >&5
-if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1185 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char gethostbyname(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-gethostbyname();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_gethostbyname=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_gethostbyname=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:1226: checking for main in -lnsl" >&5
-ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lnsl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1234 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:1241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lnsl"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1264: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1269 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1277: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1294 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1312 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 1333 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-if test "$ac_cv_header_stdc" = "no"; then
- echo "configure: warning: Your system doesn't seem to support ANSI C" 1>&2
-fi
-# Check whether --enable-threads or --disable-threads was given.
-if test "${enable_threads+set}" = set; then
- enableval="$enable_threads"
- threads_ok=$enableval
-else
- threads_ok=no
-fi
-
-if test "$threads_ok" = "yes"; then
- for ac_hdr in pthread.h threads.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1383: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1388 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- echo $ac_n "checking for pthread_mutex_lock""... $ac_c" 1>&6
-echo "configure:1420: checking for pthread_mutex_lock" >&5
-if eval "test \"`echo '$''{'ac_cv_func_pthread_mutex_lock'+set}'`\" = set"; then
+ for i in ../../yaz* ../../yaz; do
+ if test -d $i; then
+ if test -r $i/include/yaz/yaz-version.h; then
+ yazconfig=$i/yaz-config
+ fi
+ fi
+ done
+ if test "x$yazconfig" = "xNONE"; then
+ # Extract the first word of "yaz-config", so it can be a program name with args.
+set dummy yaz-config; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1152: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_yazconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1425 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char pthread_mutex_lock(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_lock();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_pthread_mutex_lock) || defined (__stub___pthread_mutex_lock)
-choke me
-#else
-pthread_mutex_lock();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_pthread_mutex_lock=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_pthread_mutex_lock=no"
-fi
-rm -f conftest*
+ case "$yazconfig" in
+ /*)
+ ac_cv_path_yazconfig="$yazconfig" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_yazconfig="$yazconfig" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_yazconfig="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_yazconfig" && ac_cv_path_yazconfig="NONE"
+ ;;
+esac
fi
-
-if eval "test \"`echo '$ac_cv_func_'pthread_mutex_lock`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
+yazconfig="$ac_cv_path_yazconfig"
+if test -n "$yazconfig"; then
+ echo "$ac_t""$yazconfig" 1>&6
else
echo "$ac_t""no" 1>&6
fi
- if test "$ac_cv_func_pthread_mutex_lock" = "no"; then
- echo $ac_n "checking for main in -lpthread""... $ac_c" 1>&6
-echo "configure:1469: checking for main in -lpthread" >&5
-ac_lib_var=`echo pthread'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lpthread $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1477 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:1484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
+ fi
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lpthread $LIBS"
-
+echo $ac_n "checking for YAZ""... $ac_c" 1>&6
+echo "configure:1188: checking for YAZ" >&5
+if test -r $yazconfig; then
+ . $yazconfig
+ echo "$ac_t""$yazconfig" 1>&6
else
- echo "$ac_t""no" 1>&6
-fi
-
- fi
- cat >> confdefs.h <<\EOF
-#define _REENTRANT 1
-EOF
-
+ echo "$ac_t""Not found" 1>&6
fi
trap '' 1 2 15
cat > confcache <<\EOF
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
- case `(ac_space=' '; set) 2>&1` in
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.12"
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
+s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
s%@CPP@%$CPP%g
s%@CXXCPP@%$CXXCPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@RANLIB@%$RANLIB%g
+s%@YAZINC@%$YAZINC%g
+s%@YAZLIB@%$YAZLIB%g
+s%@yazconfig@%$yazconfig%g
CEOF
EOF
dnl YAZ++ Toolkit configure script.
dnl (c) Index Data ApS 1999
dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.2 1999-03-23 14:17:57 adam Exp $
+dnl $Id: configure.in,v 1.3 1999-12-06 13:52:45 adam Exp $
AC_INIT(../include/yaz-socket-manager.h)
dnl
dnl ------ Checking programs
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl
-dnl ----- Sockets
-checkBoth=0
-AC_CHECK_FUNC(connect)
-if test "$ac_cv_func_connect" = "no"; then
- AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
+dnl ------ Look for Yaz
+dnl See if user specified location of yaz-config; otherwise
+dnl use ../yaz if is a directory (internal development); otherwise
+dnl use yaz-config found in PATH.
+AC_SUBST(YAZINC)
+AC_SUBST(YAZLIB)
+yazconfig=NONE
+yazpath=NONE
+AC_ARG_WITH(yazconfig, [ --with-yazconfig Path for yaz-config], [yazpath=$withval])
+if test "x$yazpath" != "xNONE"; then
+ yazconfig=$yazpath/yaz-config
+else
+ for i in ../../yaz* ../../yaz; do
+ if test -d $i; then
+ if test -r $i/include/yaz/yaz-version.h; then
+ yazconfig=$i/yaz-config
+ fi
+ fi
+ done
+ if test "x$yazconfig" = "xNONE"; then
+ AC_PATH_PROG(yazconfig, yaz-config, NONE)
+ fi
fi
-if test "$checkBoth" = "1"; then
- oldLibs=$LIBS
- LIBS="$LIBS -lsocket -lnsl"
- AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
-fi
-AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
-dnl
-dnl ------ Headers
-AC_STDC_HEADERS
-if test "$ac_cv_header_stdc" = "no"; then
- AC_MSG_WARN(Your system doesn't seem to support ANSI C)
-fi
-dnl
-dnl ------ Threads
-AC_ARG_ENABLE(threads, [ --enable-threads enable threads if available],
- [threads_ok=$enableval], [threads_ok=no])
-if test "$threads_ok" = "yes"; then
- AC_CHECK_HEADERS(pthread.h threads.h)
- AC_CHECK_FUNC(pthread_mutex_lock)
- if test "$ac_cv_func_pthread_mutex_lock" = "no"; then
- AC_CHECK_LIB(pthread, main)
- fi
- AC_DEFINE(_REENTRANT)
+AC_MSG_CHECKING(for YAZ)
+if test -r $yazconfig; then
+ . $yazconfig
+ AC_MSG_RESULT($yazconfig)
+else
+ AC_MSG_RESULT(Not found)
fi
dnl
dnl ------ Makefiles