textclient: OpenSSL detection in conf-IG-ure
authorArt Cancro <ajc@citadel.org>
Tue, 19 Jun 2018 21:55:54 +0000 (17:55 -0400)
committerArt Cancro <ajc@citadel.org>
Tue, 19 Jun 2018 21:55:54 +0000 (17:55 -0400)
textclient/configure

index 46ee9f40364465c481d88c6e5d4c1dbbfab15c3b..c6f893664e58073c31a8b96d305602a2a6f72a4a 100755 (executable)
@@ -22,6 +22,12 @@ do
                --ctdldir)
                        CTDLDIR=$v
                ;;
+               --with-ssl)
+                       SSL=yes
+               ;;
+               --without-ssl)
+                       SSL=no
+               ;;
                *)
                        echo $0 : unknown option $k
                        echo
@@ -29,6 +35,8 @@ do
                        echo '  --prefix=PREFIX         Install files in PREFIX [/usr/local]'
                        echo '  --bindir=DIR            Install executables in DIR [PREFIX/bin]'
                        echo '  --ctdldir=DIR           Look for Citadel server in DIR [/usr/local/citadel]'
+                       echo '  --with-ssl              Force build with OpenSSL support [normally autodetected'
+                       echo '  --without-ssl           Force build without OpenSSL support [normally autodetected'
                        exit 1
                ;;
        esac
@@ -43,6 +51,29 @@ done
 [ "$CFLAGS" = "" ]     && CFLAGS='-ggdb'
 [ "$LDFLAGS" = "" ]    && LDFLAGS=''
 
+# Test for OpenSSL
+[ "$SSL" != "yes" ] && [ "$SSL" != "no" ] && {
+       echo Testing for OpenSSL...
+       tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
+       tempcc=${tempfile}.c
+       cat >$tempcc <<!
+#include <openssl/ssl.h>
+int main(int argc, char **argv) {
+       SSL_load_error_strings();
+       exit(0);
+}
+!
+       SSL='no';
+       cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && SSL='yes'
+       rm -f $tempfile 2>/dev/null
+       rm -f $tempcc 2>/dev/null
+}
+echo SSL: $SSL
+[ "$SSL" = "yes" ] && {
+       CFLAGS=${CFLAGS}' -DHAVE_OPENSSL'
+       LDFLAGS=${LDFLAGS}' -lssl -lcrypto'
+}
+
 # Output the config.mk
 
 (