Merge from emacs-24; up to 2014-06-06T02:22:40Z!monnier@iro.umontreal.ca
[bpt/emacs.git] / nt / configure.bat
index 45d966f..5460f4c 100755 (executable)
@@ -1,7 +1,7 @@
 @echo off\r
 rem   ----------------------------------------------------------------------\r
 rem   Configuration script for MS Windows operating systems\r
 @echo off\r
 rem   ----------------------------------------------------------------------\r
 rem   Configuration script for MS Windows operating systems\r
-rem   Copyright (C) 1999-201 Free Software Foundation, Inc.\r
+rem   Copyright (C) 1999-2014 Free Software Foundation, Inc.\r
 \r
 rem   This file is part of GNU Emacs.\r
 \r
 \r
 rem   This file is part of GNU Emacs.\r
 \r
@@ -23,7 +23,7 @@ rem   YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:
 rem\r
 rem   + MS Windows 95, NT or later\r
 rem   + either MSVC 2.x or later, or gcc-2.95 or later (with GNU make 3.75\r
 rem\r
 rem   + MS Windows 95, NT or later\r
 rem   + either MSVC 2.x or later, or gcc-2.95 or later (with GNU make 3.75\r
-rem     or later) and the Mingw32 and W32 API headers and libraries.\r
+rem     or later) and the Mingw32 and Windows API headers and libraries.\r
 rem   + Visual Studio 2005 is not supported at this time.\r
 rem\r
 rem For reference, here is a list of which builds of GNU make are known to\r
 rem   + Visual Studio 2005 is not supported at this time.\r
 rem\r
 rem For reference, here is a list of which builds of GNU make are known to\r
@@ -58,7 +58,20 @@ rem          look for "cygpath" near line 85 of gmake.defs.
 rem [7] not recommended; please report if you try this combination.\r
 rem [8] tested only on Windows XP.\r
 rem\r
 rem [7] not recommended; please report if you try this combination.\r
 rem [8] tested only on Windows XP.\r
 rem\r
-\r
+echo ****************************************************************\r
+echo *** THIS METHOD OF BUILDING EMACS IS NO LONGER SUPPORTED.     **\r
+echo *** INSTEAD, FOLLOW THE INSTRUCTIONS FROM INSTALL.            **\r
+echo ****************************************************************\r
+:confirm_continue\r
+set /p answer=Continue running this script at your own risks ? (Y/N)\r
+if x%answer% == xy (goto confirm_continue_y)\r
+if x%answer% == xY (goto confirm_continue_y)\r
+if x%answer% == xn (goto end)\r
+if x%answer% == xN (goto end)\r
+echo Please answer by Y or N\r
+goto confirm_continue\r
+\r
+:confirm_continue_y\r
 if exist config.log del config.log\r
 \r
 rem ----------------------------------------------------------------------\r
 if exist config.log del config.log\r
 \r
 rem ----------------------------------------------------------------------\r
@@ -131,6 +144,7 @@ if "%1" == "--without-jpeg" goto withoutjpeg
 if "%1" == "--without-gif" goto withoutgif\r
 if "%1" == "--without-tiff" goto withouttiff\r
 if "%1" == "--without-gnutls" goto withoutgnutls\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-libxml2" goto withoutlibxml2\r
 if "%1" == "--without-xpm" goto withoutxpm\r
 if "%1" == "--with-svg" goto withsvg\r
 if "%1" == "--distfiles" goto distfiles\r
 if "%1" == "--without-xpm" goto withoutxpm\r
 if "%1" == "--with-svg" goto withsvg\r
 if "%1" == "--distfiles" goto distfiles\r
@@ -144,7 +158,7 @@ echo.   --with-gcc              use GCC to compile Emacs
 echo.   --with-msvc             use MSVC to compile Emacs\r
 echo.   --no-debug              exclude debug info from executables\r
 echo.   --no-opt                disable optimization\r
 echo.   --with-msvc             use MSVC to compile Emacs\r
 echo.   --no-debug              exclude debug info from executables\r
 echo.   --no-opt                disable optimization\r
-echo.   --enable-checking       enable checks and assertions\r
+echo.   --enable-checking       enable additional run-time checks\r
 echo.   --profile               enable profiling\r
 echo.   --no-cygwin             use -mno-cygwin option with GCC\r
 echo.   --cflags FLAG           pass FLAG to compiler\r
 echo.   --profile               enable profiling\r
 echo.   --no-cygwin             use -mno-cygwin option with GCC\r
 echo.   --cflags FLAG           pass FLAG to compiler\r
@@ -155,7 +169,8 @@ 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\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-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.   --without-gnutls        do not use GnuTLS library even if it is installed\r
+echo.   --without-libxml2       do not use libxml2 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
 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
@@ -172,6 +187,11 @@ echo. Note that this capability of processing parameters that include the =
 echo. character depends on command extensions.  This batch file attempts to\r
 echo. enable command extensions.  If command extensions cannot be enabled, a\r
 echo. warning message will be displayed.\r
 echo. character depends on command extensions.  This batch file attempts to\r
 echo. enable command extensions.  If command extensions cannot be enabled, a\r
 echo. warning message will be displayed.\r
+echo.\r
+echo. IMPORTANT: This method of building Emacs for MS-Windows is deprecated,\r
+echo. and could be removed in a future version of Emacs.  The preferred way\r
+echo  to build Emacs for MS-Windows from now on is using the MSYS environment\r
+echo. and MinGW development tools.  Please see nt/INSTALL for details.\r
 goto end\r
 \r
 rem ----------------------------------------------------------------------\r
 goto end\r
 \r
 rem ----------------------------------------------------------------------\r
@@ -317,6 +337,14 @@ goto again
 \r
 rem ----------------------------------------------------------------------\r
 \r
 \r
 rem ----------------------------------------------------------------------\r
 \r
+:withoutlibxml2\r
+set libxml2support=N\r
+set HAVE_LIBXML2=\r
+shift\r
+goto again\r
+\r
+rem ----------------------------------------------------------------------\r
+\r
 :withouttiff\r
 set tiffsupport=N\r
 set HAVE_TIFF=\r
 :withouttiff\r
 set tiffsupport=N\r
 set HAVE_TIFF=\r
@@ -416,10 +444,10 @@ rem   problem).  The gcc/mingw32 2.95.2 headers are okay, as are distros
 rem   of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
 rem   Beginning with Emacs 23, we need usp10.h.\r
 rem\r
 rem   of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
 rem   Beginning with Emacs 23, we need usp10.h.\r
 rem\r
-echo Checking whether W32 API headers are too old...\r
+echo Checking whether Windows API headers are too old...\r
 echo #include "windows.h" >junk.c\r
 echo #include "usp10.h" >>junk.c\r
 echo #include "windows.h" >junk.c\r
 echo #include "usp10.h" >>junk.c\r
-echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
+echo void test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
 echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
 if (%nocygwin%) == (Y) goto chkapi1\r
 set cf=%usercflags%\r
 echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
 if (%nocygwin%) == (Y) goto chkapi1\r
 set cf=%usercflags%\r
@@ -459,7 +487,7 @@ goto end
 echo.\r
 echo Configure failed.\r
 echo To configure Emacs for Windows, you need to have either\r
 echo.\r
 echo Configure failed.\r
 echo To configure Emacs for Windows, you need to have either\r
-echo gcc-2.95 or later with Mingw32 and the W32 API headers,\r
+echo gcc-2.95 or later with Mingw32 and the Windows API headers,\r
 echo or MSVC 2.x or later.\r
 del junk.c\r
 goto end\r
 echo or MSVC 2.x or later.\r
 del junk.c\r
 goto end\r
@@ -563,12 +591,34 @@ set HAVE_GNUTLS=
 goto :tlsDone\r
 \r
 :haveTls\r
 goto :tlsDone\r
 \r
 :haveTls\r
-echo ...GNUTLS header available, building with GNUTLS support.\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
 set HAVE_GNUTLS=1\r
 \r
 :tlsDone\r
 rm -f junk.c junk.obj\r
 \r
+if (%libxml2support%) == (N) goto xml2Done\r
+\r
+echo Checking for libxml2....\r
+echo #include "libxml/HTMLparser.h" >junk.c\r
+echo main(){} >>junk.c\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 havelibxml2\r
+\r
+echo ...libxml/HTMLparser.h not found, building without libxml2 support\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
+set HAVE_LIBXML2=\r
+goto xml2Done\r
+\r
+:havelibxml2\r
+echo ...libxml2 header available, building with libxml2 support\r
+set HAVE_LIBXML2=1\r
+\r
+:xml2Done\r
+rm -f junk.c junk.obj\r
+\r
 if (%jpegsupport%) == (N) goto jpegDone\r
 \r
 echo Checking for jpeg-6b...\r
 if (%jpegsupport%) == (N) goto jpegDone\r
 \r
 echo Checking for jpeg-6b...\r
@@ -595,7 +645,10 @@ rm -f junk.c junk.obj
 if (%gifsupport%) == (N) goto gifDone\r
 \r
 echo Checking for libgif...\r
 if (%gifsupport%) == (N) goto gifDone\r
 \r
 echo Checking for libgif...\r
-echo #include "gif_lib.h" >junk.c\r
+rem giflib-5.0.0 needs size_t defined before gif_lib.h is included\r
+rem redirection characters need to be protected from the shell\r
+echo #include ^<stddef.h^> >junk.c\r
+echo #include "gif_lib.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
 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
@@ -721,29 +774,35 @@ if %COMPILER% == gcc set MAKECMD=gmake
 if %COMPILER% == cl set MAKECMD=nmake\r
 \r
 rem   Pass on chosen settings to makefiles.\r
 if %COMPILER% == cl set MAKECMD=nmake\r
 \r
 rem   Pass on chosen settings to makefiles.\r
-rem   NB. Be very careful to not have a space before redirection symbols\r
-rem   except when there is a preceding digit, when a space is required.\r
 rem\r
 rem\r
+rem   The weird place we put the redirection is to make sure no extra\r
+rem   whitespace winds up at the end of the Make variables, since some\r
+rem   variables, e.g. INSTALL_DIR, cannot stand that.  Yes, echo will\r
+rem   write the blanks between the end of command arguments and the\r
+rem   redirection symbol to the file.  OTOH, we cannot put the\r
+rem   redirection immediately after the last character of the command,\r
+rem   because environment variable expansion can yield a digit there,\r
+rem   which will then be misinterpreted as the file descriptor to\r
+rem   redirect...\r
 echo # Start of settings from configure.bat >config.settings\r
 echo # Start of settings from configure.bat >config.settings\r
-echo COMPILER=%COMPILER%>>config.settings\r
-if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings\r
-if not "(%dbginfo%)" == "()" echo DEBUG_INFO=%dbginfo%>>config.settings\r
-if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r
-if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r
-if (%enablechecking%) == (Y) echo ENABLECHECKS=1 >>config.settings\r
-if (%profile%) == (Y) echo PROFILE=1 >>config.settings\r
-if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r
-if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings\r
-if not "(%distfiles%)" == "()" echo DIST_FILES=%distfiles%>>config.settings\r
+>>config.settings echo COMPILER=%COMPILER%\r
+if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%\r
+if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%\r
+if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1\r
+if (%noopt%) == (Y) >>config.settings echo NOOPT=1\r
+if (%profile%) == (Y) >>config.settings echo PROFILE=1\r
+if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1\r
+if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%\r
+if not "(%distfiles%)" == "()" >>config.settings echo DIST_FILES=%distfiles%\r
 rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
 rem and the if command cannot cope with this\r
 for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
 rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
 rem and the if command cannot cope with this\r
 for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
-if (%docflags%)==(Y) echo USER_CFLAGS=%usercflags%>>config.settings\r
-if (%docflags%)==(Y) echo ESC_USER_CFLAGS=%escusercflags%>>config.settings\r
+if (%docflags%)==(Y) >>config.settings echo USER_CFLAGS=%usercflags%\r
+if (%docflags%)==(Y) >>config.settings echo ESC_USER_CFLAGS=%escusercflags%\r
 for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
 for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
-if (%doldflags%)==(Y) echo USER_LDFLAGS=%userldflags%>>config.settings\r
+if (%doldflags%)==(Y) >>config.settings echo USER_LDFLAGS=%userldflags%\r
 for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
 for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
-if (%doextralibs%)==(Y) echo USER_LIBS=%extrauserlibs%>>config.settings\r
+if (%doextralibs%)==(Y) >>config.settings echo USER_LIBS=%extrauserlibs%\r
 echo # End of settings from configure.bat>>config.settings\r
 echo. >>config.settings\r
 \r
 echo # End of settings from configure.bat>>config.settings\r
 echo. >>config.settings\r
 \r
@@ -752,11 +811,13 @@ echo. >>config.tmp
 echo /* Start of settings from configure.bat.  */ >>config.tmp\r
 rem   We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify\r
 rem   processing of compiler options in w32.c:get_emacs_configuration_options\r
 echo /* Start of settings from configure.bat.  */ >>config.tmp\r
 rem   We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify\r
 rem   processing of compiler options in w32.c:get_emacs_configuration_options\r
-if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%">>config.tmp\r
-if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%">>config.tmp\r
+if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%" >>config.tmp\r
+if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%" >>config.tmp\r
 if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
 if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
+if (%enablechecking%) == (Y) echo #define ENABLE_CHECKING 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_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
 if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp\r
+if not "(%HAVE_LIBXML2%)" == "()" echo #define HAVE_LIBXML2 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
 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
@@ -896,6 +957,7 @@ set HAVE_DISTFILES=
 set distFilesOk=\r
 set pngsupport=\r
 set tlssupport=\r
 set distFilesOk=\r
 set pngsupport=\r
 set tlssupport=\r
+set libxml2support=\r
 set jpegsupport=\r
 set gifsupport=\r
 set tiffsupport=\r
 set jpegsupport=\r
 set gifsupport=\r
 set tiffsupport=\r
@@ -908,4 +970,5 @@ set HAVE_PNG=
 set HAVE_TIFF=\r
 set HAVE_XPM=\r
 set dbginfo=\r
 set HAVE_TIFF=\r
 set HAVE_XPM=\r
 set dbginfo=\r
-\r
+endlocal\r
+set use_extensions=\r