From 27a7e4e28f12acb9f69ff2c4b087bfde39aea4dd Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Fri, 23 Nov 2018 17:42:35 +0000 Subject: [PATCH] Attempt minimal autoconf changes to use GnuTLS instead of OpenSSL. I could waste the rest of the available time trying to turn configure.ac into something that cleanly ignores OpenSSL, uses GnuTLS instead and retains all the options. Or even better scrap the whole autoconf mess and start again. But in the interests of prototyping, do something quick and dirty. This means GnuTLS must for now be configured thus: $ CFLAGS="-g" ../configure --enable-stub-only --with-gnutls --disable-gost --disable-ecdsa --disable-edns-cookies to evade other items with hardcoded OpenSSL checks in them. --- configure.ac | 19 +++++++++++++++++-- src/Makefile.in | 11 ++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index cc80080e..a16100e3 100644 --- a/configure.ac +++ b/configure.ac @@ -399,11 +399,26 @@ yes) ;; esac +# Which TLS and crypto libs to use. +AC_ARG_WITH([gnutls], + [AS_HELP_STRING([--with-gnutls], + [use GnuTLS instead of OpenSSL])], + [ + PKG_CHECK_MODULES([libgnutls], [gnutls >= 3.5.0]) + LIBS="$libgnutls_LIBS $LIBS" + CFLAGS="$libgnutls_CFLAGS $CFLAGS" + AC_SUBST([TLSDIR], 'gnutls') + AC_DEFINE([USE_GNUTLS], [1], [Use the GnuTLS library]) + ], + [ + ACX_WITH_SSL_OPTIONAL + ACX_LIB_SSL + AC_SUBST([TLSDIR], 'openssl') + ]) + USE_NSS="no" # openssl if test $USE_NSS = "no"; then -ACX_WITH_SSL_OPTIONAL -ACX_LIB_SSL AC_MSG_CHECKING([for LibreSSL]) if grep VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then AC_MSG_RESULT([yes]) diff --git a/src/Makefile.in b/src/Makefile.in index ed5c95bf..88a239ac 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -52,11 +52,12 @@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ srcdir = @srcdir@ +tlsdir = @TLSDIR@ stubbysrcdir = $(srcdir)/../stubby LIBTOOL = ../libtool CC=@CC@ -CFLAGS=-I$(srcdir) -I. -I$(srcdir)/util/auxiliary -I$(srcdir)/openssl -I$(stubbysrcdir)/src @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS) +CFLAGS=-I$(srcdir) -I. -I$(srcdir)/util/auxiliary -I$(srcdir)/$(tlsdir) -I$(stubbysrcdir)/src @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS) WPEDANTICFLAG=@WPEDANTICFLAG@ WNOERRORFLAG=@WNOERRORFLAG@ LDFLAGS=@LDFLAGS@ @LIBS@ @@ -134,7 +135,7 @@ $(JSMN_OBJ): $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -DJSMN_GETDNS -c $(srcdir)/jsmn/$(@:.lo=.c) -o $@ $(TLS_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/openssl/$(@:.lo=.c) -o $@ + $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(tlsdir)/$(@:.lo=.c) -o $@ $(YAML_OBJ): $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(stubbysrcdir)/src/yaml/$(@:.lo=.c) -o $@ @@ -146,7 +147,7 @@ $(EXTENSION_OBJ): $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/extension/$(@:.lo=.c) -o $@ anchor.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/openssl/anchor.c -o anchor.lo + $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/$(tlsdir)/anchor.c -o anchor.lo context.lo: $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/context.c -o context.lo @@ -271,14 +272,14 @@ Makefile: $(srcdir)/Makefile.in ../config.status depend: (cd $(srcdir) ; awk 'BEGIN{P=1}{if(P)print}/^# Dependencies/{P=0}' Makefile.in > Makefile.in.new ) - (blddir=`pwd`; cd $(srcdir) ; gcc -MM -I. -I"$$blddir" -Iopenssl -Iyxml -Iutil/auxiliary -I../stubby/src *.c gldns/*.c compat/*.c util/*.c jsmn/*.c openssl/*.c yxml/*.c extension/*.c ../stubby/src/*.c | \ + (blddir=`pwd`; cd $(srcdir) ; gcc -MM -I. -I"$$blddir" -I$(tlsdir) -Iyxml -Iutil/auxiliary -I../stubby/src *.c gldns/*.c compat/*.c util/*.c jsmn/*.c $(tlsdir)/*.c yxml/*.c extension/*.c ../stubby/src/*.c | \ sed -e "s? $$blddir/? ?g" \ -e 's? gldns/? $$(srcdir)/gldns/?g' \ -e 's? compat/? $$(srcdir)/compat/?g' \ -e 's? util/auxiliary/util/? $$(srcdir)/util/auxiliary/util/?g' \ -e 's? util/? $$(srcdir)/util/?g' \ -e 's? jsmn/? $$(srcdir)/jsmn/?g' \ - -e 's? openssl/? $$(srcdir)/openssl/?g' \ + -e 's? $$(tlsdir)/? $$(srcdir)/$$(tlsdir)/?g' \ -e 's? yxml/? $$(srcdir)/yxml/?g' \ -e 's? extension/? $$(srcdir)/extension/?g' \ -e 's? \.\./stubby/? $$(stubbysrcdir)/?g' \