From fd4af8d90220585aa10753735760bc396f089102 Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Sun, 24 Apr 2011 20:29:31 -0500 Subject: [PATCH] Add GnuTLS support for W32. * nt/configure.bat: New options --without-gnutls and --lib, new build variable USER_LIBS, automatically detect GnuTLS. Copies the PNG library setup with trivial modifications. * nt/INSTALL: Add instructions for GnuTLS support. * nt/gmake.defs: Prefix USER_LIBS with -l. --- nt/ChangeLog | 8 ++++++++ nt/INSTALL | 9 +++++++++ nt/configure.bat | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ nt/gmake.defs | 4 ++++ 4 files changed, 72 insertions(+) diff --git a/nt/ChangeLog b/nt/ChangeLog index 19f71ba0af..255c2fd479 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,11 @@ +2011-04-24 Teodor Zlatanov + + * configure.bat: New options --without-gnutls and --lib, new build + variable USER_LIBS, automatically detect GnuTLS. Copies the PNG + library setup with trivial modifications. + * INSTALL: Add instructions for GnuTLS support. + * gmake.defs: Prefix USER_LIBS with -l. + 2011-04-15 Ben Key * configure.bat: Modified the code that parses the --cflags and diff --git a/nt/INSTALL b/nt/INSTALL index dfcfa8a205..cadf6ba690 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -316,6 +316,15 @@ `dynamic-library-alist' and the value of `libpng-version', and download compatible DLLs if needed. +* Optional GnuTLS support + + You can build Emacs with GnuTLS support. Put the gnutls/gnutls.h header in + the include path and link to the appropriate libraries (gnutls.dll and + gcrypt.dll) with the --lib option. + + You can get pre-built binaries and an installer at + http://josefsson.org/gnutls4win/. + * Experimental SVG support SVG support is currently experimental, and not built by default. diff --git a/nt/configure.bat b/nt/configure.bat index 699a33bc2e..7642d8244f 100755 --- a/nt/configure.bat +++ b/nt/configure.bat @@ -99,10 +99,13 @@ set COMPILER= set usercflags= set docflags= set userldflags= +set extrauserlibs= set doldflags= +set doextralibs= set sep1= set sep2= set sep3= +set sep4= set distfiles= rem ---------------------------------------------------------------------- @@ -120,10 +123,12 @@ if "%1" == "--profile" goto profile if "%1" == "--no-cygwin" goto nocygwin if "%1" == "--cflags" goto usercflags if "%1" == "--ldflags" goto userldflags +if "%1" == "--lib" goto extrauserlibs if "%1" == "--without-png" goto withoutpng if "%1" == "--without-jpeg" goto withoutjpeg if "%1" == "--without-gif" goto withoutgif if "%1" == "--without-tiff" goto withouttiff +if "%1" == "--without-gnutls" goto withoutgnutls if "%1" == "--without-xpm" goto withoutxpm if "%1" == "--with-svg" goto withsvg if "%1" == "--distfiles" goto distfiles @@ -142,11 +147,13 @@ echo. --profile enable profiling echo. --no-cygwin use -mno-cygwin option with GCC echo. --cflags FLAG pass FLAG to compiler echo. --ldflags FLAG pass FLAG to compiler when linking +echo. --lib LIB link to extra library LIB echo. --without-png do not use PNG library even if it is installed echo. --without-jpeg do not use JPEG library even if it is installed echo. --without-gif do not use GIF library even if it is installed echo. --without-tiff do not use TIFF library even if it is installed echo. --without-xpm do not use XPM library even if it is installed +echo. --without-gnutls do not use GNUTLS library even if it is installed echo. --with-svg use the RSVG library (experimental) echo. --distfiles path to files for make dist, e.g. libXpm.dll if "%use_extensions%" == "0" goto end @@ -242,6 +249,14 @@ set sep1= %nothing% shift goto again +:extrauserlibs +shift +echo. extrauserlibs: %extrauserlibs% +set extrauserlibs=%extrauserlibs%%sep4%%1 +set sep4= %nothing% +shift +goto again + rem ---------------------------------------------------------------------- :userldflags @@ -288,6 +303,14 @@ goto again rem ---------------------------------------------------------------------- +:withoutgnutls +set tlssupport=N +set HAVE_GNUTLS= +shift +goto again + +rem ---------------------------------------------------------------------- + :withouttiff set tiffsupport=N set HAVE_TIFF= @@ -516,6 +539,30 @@ set HAVE_PNG=1 :pngDone rm -f junk.c junk.obj +if (%tlssupport%) == (N) goto tlsDone + +rem this is a copy of the PNG detection +echo Checking for libgnutls... +echo #include "gnutls/gnutls.h" >junk.c +echo main (){} >>junk.c +rem -o option is ignored with cl, but allows result to be consistent. +echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log +%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log +if exist junk.obj goto haveTls + +echo ...gnutls.h not found, building without TLS support. +echo The failed program was: >>config.log +type junk.c >>config.log +set HAVE_GNUTLS= +goto :tlsDone + +:haveTls +echo ...GNUTLS header available, building with GNUTLS support. +set HAVE_GNUTLS=1 + +:tlsDone +rm -f junk.c junk.obj + if (%jpegsupport%) == (N) goto jpegDone echo Checking for jpeg-6b... @@ -688,6 +735,8 @@ for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y if (%docflags%)==(Y) echo USER_CFLAGS=%usercflags%>>config.settings for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y if (%doldflags%)==(Y) echo USER_LDFLAGS=%userldflags%>>config.settings +for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y +if (%doextralibs%)==(Y) echo USER_LIBS=%extrauserlibs%>>config.settings echo # End of settings from configure.bat>>config.settings echo. >>config.settings @@ -700,6 +749,7 @@ if (%docflags%) == (Y) echo #define USER_CFLAGS " %usercflags%">>config.tmp if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %userldflags%">>config.tmp if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp +if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp @@ -838,6 +888,7 @@ set distfiles= set HAVE_DISTFILES= set distFilesOk= set pngsupport= +set tlssupport= set jpegsupport= set gifsupport= set tiffsupport= diff --git a/nt/gmake.defs b/nt/gmake.defs index 3dbb97ff65..7af7fe4ab6 100644 --- a/nt/gmake.defs +++ b/nt/gmake.defs @@ -279,6 +279,10 @@ ifdef NOCYGWIN NOCYGWIN = -mno-cygwin endif +ifdef USER_LIBS +USER_LIBS := $(patsubst %,-l%,$(USER_LIBS)) +endif + ifeq "$(ARCH)" "i386" ifdef NOOPT ARCH_CFLAGS = -c $(DEBUG_FLAG) $(NOCYGWIN) -- 2.20.1