Add GnuTLS support for W32.
authorTed Zlatanov <tzz@lifelogs.com>
Mon, 25 Apr 2011 01:29:31 +0000 (20:29 -0500)
committerTed Zlatanov <tzz@lifelogs.com>
Mon, 25 Apr 2011 01:29:31 +0000 (20:29 -0500)
* 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
nt/INSTALL
nt/configure.bat
nt/gmake.defs

index 19f71ba..255c2fd 100644 (file)
@@ -1,3 +1,11 @@
+2011-04-24  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * 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  <bkey76@gmail.com>
 
        * configure.bat: Modified the code that parses the --cflags and
index dfcfa8a..cadf6ba 100644 (file)
   `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.
index 699a33b..7642d82 100755 (executable)
@@ -99,10 +99,13 @@ set COMPILER=
 set usercflags=\r
 set docflags=\r
 set userldflags=\r
+set extrauserlibs=\r
 set doldflags=\r
+set doextralibs=\r
 set sep1=\r
 set sep2=\r
 set sep3=\r
+set sep4=\r
 set distfiles=\r
 \r
 rem ----------------------------------------------------------------------\r
@@ -120,10 +123,12 @@ if "%1" == "--profile" goto profile
 if "%1" == "--no-cygwin" goto nocygwin\r
 if "%1" == "--cflags" goto usercflags\r
 if "%1" == "--ldflags" goto userldflags\r
+if "%1" == "--lib" goto extrauserlibs\r
 if "%1" == "--without-png" goto withoutpng\r
 if "%1" == "--without-jpeg" goto withoutjpeg\r
 if "%1" == "--without-gif" goto withoutgif\r
 if "%1" == "--without-tiff" goto withouttiff\r
+if "%1" == "--without-gnutls" goto withoutgnutls\r
 if "%1" == "--without-xpm" goto withoutxpm\r
 if "%1" == "--with-svg" goto withsvg\r
 if "%1" == "--distfiles" goto distfiles\r
@@ -142,11 +147,13 @@ echo.   --profile               enable profiling
 echo.   --no-cygwin             use -mno-cygwin option with GCC\r
 echo.   --cflags FLAG           pass FLAG to compiler\r
 echo.   --ldflags FLAG          pass FLAG to compiler when linking\r
+echo.   --lib LIB               link to extra library LIB\r
 echo.   --without-png           do not use PNG library even if it is installed\r
 echo.   --without-jpeg          do not use JPEG library even if it is installed\r
 echo.   --without-gif           do not use GIF library even if it is installed\r
 echo.   --without-tiff          do not use TIFF library even if it is installed\r
 echo.   --without-xpm           do not use XPM library even if it is installed\r
+echo.   --without-gnutls        do not use GNUTLS library even if it is installed\r
 echo.   --with-svg              use the RSVG library (experimental)\r
 echo.   --distfiles             path to files for make dist, e.g. libXpm.dll\r
 if "%use_extensions%" == "0" goto end\r
@@ -242,6 +249,14 @@ set sep1= %nothing%
 shift\r
 goto again\r
 \r
+:extrauserlibs\r
+shift\r
+echo. extrauserlibs: %extrauserlibs%\r
+set extrauserlibs=%extrauserlibs%%sep4%%1\r
+set sep4= %nothing%\r
+shift\r
+goto again\r
+\r
 rem ----------------------------------------------------------------------\r
 \r
 :userldflags\r
@@ -288,6 +303,14 @@ goto again
 \r
 rem ----------------------------------------------------------------------\r
 \r
+:withoutgnutls\r
+set tlssupport=N\r
+set HAVE_GNUTLS=\r
+shift\r
+goto again\r
+\r
+rem ----------------------------------------------------------------------\r
+\r
 :withouttiff\r
 set tiffsupport=N\r
 set HAVE_TIFF=\r
@@ -516,6 +539,30 @@ set HAVE_PNG=1
 :pngDone\r
 rm -f junk.c junk.obj\r
 \r
+if (%tlssupport%) == (N) goto tlsDone\r
+\r
+rem this is a copy of the PNG detection\r
+echo Checking for libgnutls...\r
+echo #include "gnutls/gnutls.h" >junk.c\r
+echo main (){} >>junk.c\r
+rem   -o option is ignored with cl, but allows result to be consistent.\r
+echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
+%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
+if exist junk.obj goto haveTls\r
+\r
+echo ...gnutls.h not found, building without TLS support.\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
+set HAVE_GNUTLS=\r
+goto :tlsDone\r
+\r
+:haveTls\r
+echo ...GNUTLS header available, building with GNUTLS support.\r
+set HAVE_GNUTLS=1\r
+\r
+:tlsDone\r
+rm -f junk.c junk.obj\r
+\r
 if (%jpegsupport%) == (N) goto jpegDone\r
 \r
 echo Checking for jpeg-6b...\r
@@ -688,6 +735,8 @@ for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y
 if (%docflags%)==(Y) echo USER_CFLAGS=%usercflags%>>config.settings\r
 for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
 if (%doldflags%)==(Y) echo USER_LDFLAGS=%userldflags%>>config.settings\r
+for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
+if (%doextralibs%)==(Y) echo USER_LIBS=%extrauserlibs%>>config.settings\r
 echo # End of settings from configure.bat>>config.settings\r
 echo. >>config.settings\r
 \r
@@ -700,6 +749,7 @@ if (%docflags%) == (Y) echo #define USER_CFLAGS " %usercflags%">>config.tmp
 if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %userldflags%">>config.tmp\r
 if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
 if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
+if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp\r
 if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r
 if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r
 if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r
@@ -838,6 +888,7 @@ set distfiles=
 set HAVE_DISTFILES=\r
 set distFilesOk=\r
 set pngsupport=\r
+set tlssupport=\r
 set jpegsupport=\r
 set gifsupport=\r
 set tiffsupport=\r
index 3dbb97f..7af7fe4 100644 (file)
@@ -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)