Separate SSL libs for yaz-config
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 18 Mar 2002 12:22:00 +0000 (12:22 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 18 Mar 2002 12:22:00 +0000 (12:22 +0000)
client/Makefile.am
configure.in
lib/Makefile.am
yaz-config.in
ztest/Makefile.am
ztest/ztest.pem [new file with mode: 0644]

index 8e6dcb3..da271df 100644 (file)
@@ -1,13 +1,19 @@
 ## Copyright (C) 1995-2000, Index Data
 ## All rights reserved.
-## $Id: Makefile.am,v 1.13 2002-02-03 09:04:55 adam Exp $
+## $Id: Makefile.am,v 1.14 2002-03-18 12:22:00 adam Exp $
 
-bin_PROGRAMS=yaz-client
+if ISSSL
+extra=yaz-client-ssl
+endif
+
+bin_PROGRAMS=yaz-client $(extra)
 
 EXTRA_DIST = default.bib
 
 yaz_client_SOURCES=client.c admin.c admin.h tabcomplete.c tabcomplete.h
+yaz_client_ssl_SOURCES=client.c admin.c admin.h tabcomplete.c tabcomplete.h
 
 yaz_client_LDADD = ../lib/libyaz.la $(READLINE_LIBS)
+yaz_client_ssl_LDADD = ../lib/libyazssl.la ../lib/libyaz.la $(READLINE_LIBS) $(SSL_LIBS)
 
 INCLUDES=-I$(top_srcdir)/include
index 831bffb..60411a1 100644 (file)
@@ -1,6 +1,6 @@
 dnl YAZ Toolkit, Index Data 1994-2001
 dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.63 2002-03-16 11:58:41 adam Exp $
+dnl $Id: configure.in,v 1.64 2002-03-18 12:22:00 adam Exp $
 AC_INIT(include/yaz/yaz-version.h)
 AM_INIT_AUTOMAKE(yaz, 1.8.6)
 dnl
@@ -49,22 +49,35 @@ dnl
 dnl ------ Open SSL
 openssl=no
 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    OpenSSL library in DIR], [openssl=$withval])
+AC_SUBST(SSL_CFLAGS)
+AC_SUBST(SSL_LIBS)
+AC_SUBST(SSL_DEFS)
+USE_SSL=0
+SSL_CFLAGS=""
+SSL_LIBS=""
+SSL_DEFS=""
 if test "$openssl" != "no"; then
-       xLDFLAGS="$LDFLAGS";
+       xLIBS="$LIBS";
        xCFLAGS="$CFLAGS";
        if test "$openssl" != "yes"; then
-               CFLAGS="-I$openssl/include -I$openssl/include/openssl $CFLAGS"
-               LDFLAGS="-L$openssl/lib $LDFLAGS"
+                SSL_CFLAGS="-I$openssl/include -I$openssl/include/openssl"
+                SSL_LIBS="-L$openssl/lib"
+               CFLAGS="$SSL_CFLAGS $CFLAGS"
+               LIBS="$SSL_LIBS $LIBS"
        fi
-       AC_CHECK_LIB(crypto, main)
+       AC_CHECK_LIB(crypto, main,[SSL_LIBS="$SSL_LIBS -lcrypto"])
+        LIBS="$LIBS $SSL_LIBS"
        AC_CHECK_LIB(ssl, SSL_new)
        if test "$ac_cv_lib_ssl_SSL_new" = "yes"; then
-               AC_CHECK_HEADERS(openssl/ssl.h)
-       else
-               LDFLAGS="$xLDFLAGS";
-               CFLAGS="$xCFLAGS";
+                SSL_LIBS="$SSL_LIBS -lssl"
+               AC_CHECK_HEADER(openssl/ssl.h,[SSL_DEFS="-DHAVE_OPENSSL_SSL_H=1"; USE_SSL=1])
+        else
+                SSL_LIBS=""
        fi
+       LIBS="$xLIBS"
+       CFLAGS="$xCFLAGS"
 fi
+AM_CONDITIONAL(ISSSL, test $USE_SSL = "1")
 dnl ------ GNU Readline
 READLINE_SHARED_LIBADD=""
 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
index 6fb0ce2..0daab0d 100644 (file)
@@ -1,14 +1,18 @@
-## $Id: Makefile.am,v 1.19 2002-02-28 13:21:16 adam Exp $
+## $Id: Makefile.am,v 1.20 2002-03-18 12:22:00 adam Exp $
 
 if ISTHR
 extra=libyazthread.la
 endif
 
+if ISSSL
+ssllib=libyazssl.la
+endif
+
 LDFLAGS=-version-info 1:0:0
 
 bin_SCRIPTS = yaz-config
 
-lib_LTLIBRARIES = libyaz.la $(extra) libyazmalloc.la
+lib_LTLIBRARIES = libyaz.la $(extra) $(ssllib) libyazmalloc.la
 
 # If the line below is omitted the LINK variable is
 # not set in Makefile.in and it will NOT work ..
@@ -23,6 +27,9 @@ libyazthread_la_SOURCES=
 libyazmalloc_la_LIBADD=xmalloc.lo
 libyazmalloc_la_SOURCES=
 
+libyazssl_la_LIBADD=tcpip.lo comstack.lo
+libyazssl_la_SOURCES=
+
 THREADED_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/server @CFLAGSTHREADS@
 
 XMALLOC_FLAGS = -DTRACE_XMALLOC=2 -I$(top_srcdir)/include
@@ -51,6 +58,18 @@ xmalloc.lo: $(top_srcdir)/util/xmalloc.c
 xmalloc.o: $(top_srcdir)/util/xmalloc.c
        $(COMPILE) $(XMALLOC_FLAGS) -c $(top_srcdir)/util/xmalloc.c
 
+comstack.lo: $(top_srcdir)/comstack/comstack.c
+       $(LTCOMPILE) $(SSL_DEFS) $(SSL_CFLAGS) -c $(top_srcdir)/comstack/comstack.c
+
+comstack.o: $(top_srcdir)/comstack/comstack.c
+       $(COMPILE) $(SSL_DEFS) $(SSL_CFLAGS) -c $(top_srcdir)/comstack/comstack.c
+
+tcpip.lo: $(top_srcdir)/comstack/tcpip.c
+       $(LTCOMPILE) $(SSL_DEFS) $(SSL_CFLAGS) -c $(top_srcdir)/comstack/tcpip.c
+
+tcpip.o: $(top_srcdir)/comstack/tcpip.c
+       $(COMPILE) $(SSL_DEFS) $(SSL_CFLAGS) -c $(top_srcdir)/comstack/tcpip.c
+
 libyaz_la_LIBADD=../odr/libodr.la \
  ../comstack/libcomstack.la ../server/libserver.la \
  ../util/libutil.la ../retrieval/libret.la \
index f0ec873..2c5f686 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: yaz-config.in,v 1.11 2001-11-13 23:00:42 adam Exp $
+# $Id: yaz-config.in,v 1.12 2002-03-18 12:22:00 adam Exp $
 yazprefix=@prefix@
 yaz_echo_cflags=no
 yaz_echo_libs=no
@@ -29,6 +29,7 @@ Options:
 Libraries:
        threads
         malloc
+        ssl
 EOF
        exit $1
 }
@@ -76,6 +77,9 @@ while test $# -gt 0; do
     malloc)
       lib_malloc=yes
       ;;
+    ssl)
+      lib_ssl=yes
+      ;;
     -*)
       yaz_echo_help=yes
       ;;
@@ -94,11 +98,19 @@ if test "$lib_malloc" = "yes"; then
     lyaz="-lyazmalloc $lyaz"
 fi
 
+if test "$lib_ssl" = "yes" -a -n "@SSL_LIBS@"; then
+    yazextralibs="@SSL_LIBS@ $yazextralibs"
+    lyaz="-lyazssl $lyaz"
+fi
+
 if test "$yaz_echo_source" = "yes"; then
     YAZTAB=${yaz_src_root}/tab
     YAZBIN=${yaz_build_root}/bin
     YAZLIB="-L${yaz_build_root}/lib/.libs $lyaz $yazextralibs"
     YAZLALIB="${yaz_build_root}/lib/libyaz.la $yazextralibs"
+    if test "$lib_ssl" = "yes" -a -n "$SSL_LIBS@"; then
+        YAZLALIB="${yaz_build_root}/lib/libyazssl.la"
+    fi
     if test "$lib_thread" = "yes" -a -n "@CFLAGSTHREADS@"; then
         YAZLALIB="${yaz_build_root}/lib/libyazthread.la $YAZLALIB"
     fi
@@ -129,6 +141,10 @@ if test "$lib_thread" = "yes"; then
     YAZINC="$YAZINC @CFLAGSTHREADS@"
 fi
 
+if test "$lib_ssl" = "yes"; then
+    YAZINC="$YAZINC @SSL_CFLAGS@"
+fi
+
 if test "$yaz_echo_help" = "yes"; then
        usage 1 1>&2
 fi
index 776a94e..04e3f7e 100644 (file)
@@ -1,15 +1,26 @@
-## $Id: Makefile.am,v 1.8 2001-11-19 09:16:37 adam Exp $
+## $Id: Makefile.am,v 1.9 2002-03-18 12:22:00 adam Exp $
 
-bin_PROGRAMS=yaz-ztest
+
+if ISSSL
+sslbin=yaz-ztest-ssl
+endif
+
+bin_PROGRAMS=yaz-ztest $(sslbin)
 
 yaz_ztest_SOURCES=ztest.c read-grs.c
+yaz_ztest_ssl_SOURCES=ztest.c read-grs.c
 
 EXTRA_DIST=dummy-records dummy-words dummy-grs
 
 if ISTHR
 extra=../lib/libyazthread.la
 endif
-yaz_ztest_LDADD=$(extra) ../lib/libyaz.la $(LIBTHREAD)
+
+yaz_ztest_LDADD=$(extra) ../lib/libyaz.la \
+ $(LIBTHREAD)
+
+yaz_ztest_ssl_LDADD=$(extra) ../lib/libyazssl.la ../lib/libyaz.la \
+ $(SSL_LIBS) $(LIBTHREAD)
 
 AM_CFLAGS=@CFLAGSTHREADS@
 
diff --git a/ztest/ztest.pem b/ztest/ztest.pem
new file mode 100644 (file)
index 0000000..b3b7044
--- /dev/null
@@ -0,0 +1,36 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQCotVYm6AcsMl5TTT11CKdUppTF2UrvO1HbuTb3fO1/o21QQROk
+BJOoHjhy450rvVNZAkV9eyEhYEjuJsq+SGpIaD+lQHSxwPgVzgmsMjES75q9dCEX
+XWz+4Q6HvI23BEmEqjlVOPQwMBUJ1218YBYlnEWmM87d8mlQbMIVnEOtRQIDAQAB
+AoGAYju0PlM8We+6HKcM8ehoBlI4rjsn9sSDlXzzFIgZggiWzfQWi5pen7V5COyf
+x6glr94yuC3JzLVTwde0lbd0qmJ7HUuOqUCwRt1WbdIrCXwveonEvxXbap+8H5kf
+h0whNjf29Z9dJ53tmP7vKnM7jG3UdViI8r89xcbNZUO4mMECQQDTgmb9w9DbTx8N
+AeMm1F2n+xeCoL8p1pYADbzSvsTO+6uVsKlapNiE0buVHQVpprC9sq4s0ytCT2Iq
+XwlgEjqPAkEAzDIioUhMqxjdwqicAyUi7ia9tdOUPUjopKJXD5jYXnbxRuTj9qgr
+zQoMYIdbykeHe7XVDi+uVuZ7fBz7lx9U6wJASi4dAvlPYetQ/5Xe3fpzUnvc1gKc
+qQbKmwA2bk9b5SAdIKXR76mLCqIoQPbptBEzQYTOU4hITrxauHOWbSxXfwJBAKJk
+XNYXQaHwrKxam3iE2Dq95LHuCj6S9TG5SbPFwo2d2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