Fixed bug #172: RPM builds does not enable SSL.
[yaz-moved-to-github.git] / configure.in
index d1e0474..9062693 100644 (file)
@@ -1,8 +1,8 @@
 dnl YAZ Toolkit, Index Data 1994-2004
 dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.138 2004-04-30 19:34:05 adam Exp $
+dnl $Id: configure.in,v 1.157 2004-10-09 08:03:26 adam Exp $
 AC_INIT(include/yaz/yaz-version.h)
-AM_INIT_AUTOMAKE(yaz, 2.0.19)
+AM_INIT_AUTOMAKE(yaz, 2.0.26)
 AM_MAINTAINER_MODE
 dnl
 AC_SUBST(READLINE_LIBS)
@@ -15,7 +15,7 @@ test -z "$YACC" && AC_MSG_WARN([GNU bison not found])
 AC_PROG_INSTALL
 AM_DISABLE_SHARED
 AM_PROG_LIBTOOL
-AC_PATH_PROG(pkgconfig, pkg-config, NONE)
+AC_PATH_PROG(pkgconfigpath, pkg-config, NONE)
 dnl
 YAZ_DOC
 dnl 
@@ -33,56 +33,60 @@ fi
 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
 dnl
 dnl ------ OpenSSL
-openssl=no
-AC_ARG_WITH(openssl, [  --with-openssl[=PREFIX] OpenSSL library in PREFIX], [openssl=$withval])
 AC_SUBST(SSL_CFLAGS)
-AC_SUBST(SSL_LIBS)
-AC_SUBST(SSL_DEFS)
-USE_SSL=0
+openssl=no
+AC_ARG_WITH(openssl, [  --with-openssl[=PREFIX]   OpenSSL library in PREFIX], [openssl=$withval])
 SSL_CFLAGS=""
-SSL_LIBS=""
-SSL_DEFS=""
+SSL_LIBPATH=""
 if test "$openssl" != "no"; then
        sslver=no
-       xLIBS="$LIBS";
-       xCFLAGS="$CFLAGS";
        if test "$openssl" != "yes"; then
-               if $openssl/bin/pkg-config --exists openssl; then
-                       SSL_CFLAGS=`$openssl/bin/pkg-config --cflags openssl`
-                       SSL_LIBS=`$openssl/bin/pkg-config --libs openssl`
-                       sslver=`$openssl/bin/pkg-config --modversion openssl`
-               else
+               if test -x $openssl/bin/pkg-config; then
+                       if $openssl/bin/pkg-config --exists openssl; then
+                               SSL_CFLAGS=`$openssl/bin/pkg-config --cflags openssl`
+                               LIBS="$LIBS `$openssl/bin/pkg-config --libs openssl`"
+                               sslver=`$openssl/bin/pkg-config --modversion openssl`
+                       fi
+               fi
+               if test "$sslver" = "no"; then
                        SSL_CFLAGS="-I$openssl/include -I$openssl/include/openssl"
-                       SSL_LIBS="-L$openssl/lib"
-                       CFLAGS="$SSL_CFLAGS $CFLAGS"
-                       LIBS="$SSL_LIBS $LIBS"
+                       SSL_LIBPATH="-L$openssl/lib"
                fi
        else
-               if $pkgconfig --exists openssl; then
-                       SSL_CFLAGS=`$pkgconfig --cflags openssl`
-                       SSL_LIBS=`$pkgconfig --libs openssl`
-                       sslver=`$pkgconfig --modversion openssl`
-               fi      
+               if test "$pkgconfigpath" != "NONE"; then
+                       if $pkgconfigpath --exists openssl; then
+                               SSL_CFLAGS=`$pkgconfigpath --cflags openssl`
+                               LIBS="$LIBS `$pkgconfigpath --libs openssl`"
+                               sslver=`$pkgconfigpath --modversion openssl`
+                       fi
+               fi
+               if test "$sslver" = "no"; then
+                       SSL_CFLAGS="-I/usr/include/openssl"
+               fi
        fi
        if test "$sslver" = "no"; then
-               AC_CHECK_LIB(crypto, main,[SSL_LIBS="$SSL_LIBS -lcrypto"])
-               LIBS="$LIBS $SSL_LIBS"
+               xLIBS="$LIBS";
+               xCPPFLAGS="$CPPFLAGS";
+               CPPFLAGS="$CPPFLAGS $SSL_CFLAGS $SSL_LIBPATH"
+               AC_CHECK_LIB(crypto, main)
                AC_CHECK_LIB(ssl, SSL_new)
                if test "$ac_cv_lib_ssl_SSL_new" = "yes"; then
                        AC_CHECK_HEADER(openssl/ssl.h,[sslver=yes])
+                       LIBS="$SSL_LIBPATH $LIBS"
                fi
-               if test "$sslver" = "yes"; then
-                       SSL_LIBS="-lssl $SSL_LIBS"
+               if test "$sslver" != "yes"; then
+                       LIBS="$xLIBS"
                fi
+               CPPFLAGS="$xCPPFLAGS"
        fi
+       AC_MSG_CHECKING([for SSL])
        if test "$sslver" != "no"; then
-               SSL_DEFS="-DHAVE_OPENSSL_SSL_H=1"
-               USE_SSL=1
+               SSL_CFLAGS="-DHAVE_OPENSSL_SSL_H=1 $SSL_CFLAGS"
+               AC_MSG_RESULT([$sslver])
+       else
+               SSL_CFLAGS=""
+               AC_MSG_RESULT([None])
        fi
-       AC_MSG_CHECKING([for SSL])
-       AC_MSG_RESULT($sslver)
-       LIBS="$xLIBS"
-       CFLAGS="$xCFLAGS"
 fi
 dnl
 dnl ------ GNU Readline
@@ -101,24 +105,18 @@ if test "$ac_cv_lib_readline_readline" = "yes"; then
        #include <stdio.h>
        #include <readline/readline.h>
        ],[
-        static void f()
-        {
                 rl_attempted_completion_over = 0;
-        }
         ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
         AC_TRY_LINK([
        #include <stdio.h>
        #include <readline/readline.h>
        ],[
-        static void f()
-        {
                 rl_completion_matches (0, 0);
-        }
-        ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
+        ],[AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES)])
         LIBS=$xLIBS
 fi
 dnl ------ iconv
-AC_ARG_WITH(iconv, [  --with-iconv[=PREFIX]   iconv library in PREFIX])
+AC_ARG_WITH(iconv, [  --with-iconv[=PREFIX]     iconv library in PREFIX])
 if test "$with_iconv" != "no"; then
         AC_MSG_CHECKING(for iconv)
        oldLIBS="$LIBS"
@@ -130,7 +128,7 @@ if test "$with_iconv" != "no"; then
         AC_TRY_LINK([
                #include <iconv.h>
        ],[
-               static void f() {iconv_t t = iconv_open("", ""); }
+               iconv_t t = iconv_open("", "");
        ],[
                AC_DEFINE(HAVE_ICONV_H)
                AC_MSG_RESULT(yes)
@@ -139,7 +137,7 @@ if test "$with_iconv" != "no"; then
                AC_TRY_LINK([
                        #include <iconv.h>
                ],[
-                       static void f() {iconv_t t = iconv_open("", ""); }
+                       iconv_t t = iconv_open("", "");
                ],[
                        AC_DEFINE(HAVE_ICONV_H)
                        AC_MSG_RESULT(yes)
@@ -207,7 +205,7 @@ AC_DEFINE_UNQUOTED(YAZ_SOCKLEN_T,$ac_cv_check_socklen_t)
 dnl
 dnl ------ tcpd
 AC_ARG_ENABLE(tcpd,[  --enable-tcpd[=PREFIX]  enable TCP wrapper for server if available])
-if test "$enable_tcpd" != "" && test "$enable_tcpd" != "no"; then
+if test "$enable_tcpd" -a "$enable_tcpd" != "no"; then
        oldLibs=$LIBS
        oldCPPFLAGS=$CPPFLAGS
        if test "$enable_tcpd" != "yes"; then
@@ -225,6 +223,7 @@ if test "$enable_tcpd" != "" && test "$enable_tcpd" != "no"; then
        tcpd_ok=1, tcpd_ok=0)
        if test "$tcpd_ok" = "0"; then
                AC_MSG_RESULT(no)
+               AC_MSG_ERROR([tcpd development libraries missing])
                LIBS=$oldLibs
                CPPFLAGS=$oldCPPFLAGS
        else
@@ -307,9 +306,9 @@ dnl
 dnl ----- libXML2
 AC_SUBST(XML2_LIBS)
 AC_SUBST(XML2_CFLAGS)
-xml2dir=yes
-AC_ARG_WITH(xml2, [  --with-xml2[=PREFIX]    use libxml2 in PREFIX],[xml2dir=$withval])
-if test "$xml2dir" = "yes"; then
+xml2dir=default
+AC_ARG_WITH(xml2, [  --with-xml2[=PREFIX]      use libxml2 in PREFIX],[xml2dir=$withval])
+if test "$xml2dir" = "yes" -o "$xml2dir" = "default"; then
        for d in /usr /usr/local; do
                if test -x $d/bin/xml2-config; then
                        xml2dir=$d
@@ -326,7 +325,10 @@ if test "$xml2dir" != "no"; then
                AC_MSG_RESULT($XML2_VER)
                AC_DEFINE(HAVE_XML2)
        else
-               AC_MSG_RESULT(Not found)
+               AC_MSG_RESULT([Not found])
+               if test "$xml2dir" != "default"; then
+                       AC_MSG_ERROR([libXML2 development libraries missing])
+               fi
        fi
 fi
 dnl
@@ -366,4 +368,5 @@ doc/tkl.xsl
 doc/yazhtml.xsl
 etc/Makefile
 yaz-config
+Doxyfile
 ],[sed s%yaz_echo_source=yes%yaz_echo_source=no%g < yaz-config > util/yaz-config && chmod +x yaz-config util/yaz-config])