]> code.delx.au - gnu-emacs/blobdiff - nt/configure.bat
(xscheme-insert-expression): Use add-to-history.
[gnu-emacs] / nt / configure.bat
index 8b7d442a347ac3532c865e1717df49fff6671824..ffc11542ce0c042010776a1f7ede2896593a4198 100755 (executable)
@@ -1,7 +1,8 @@
 @echo off\r
 rem   ----------------------------------------------------------------------\r
 rem   Configuration script for MS Windows 95/98/Me and NT/2000/XP\r
-rem   Copyright (C) 1999-2003 Free Software Foundation, Inc.\r
+rem   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,\r
+rem      2006 Free Software Foundation, Inc.\r
 \r
 rem   This file is part of GNU Emacs.\r
 \r
@@ -17,8 +18,8 @@ rem   GNU General Public License for more details.
 \r
 rem   You should have received a copy of the GNU General Public License\r
 rem   along with GNU Emacs; see the file COPYING.  If not, write to the\r
-rem   Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r
-rem   Boston, MA 02111-1307, USA.\r
+rem   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\r
+rem   Boston, MA 02110-1301, USA.\r
 rem   ----------------------------------------------------------------------\r
 rem   YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r
 rem\r
@@ -47,6 +48,8 @@ rem [3] requires LC_MESSAGES support to build; maybe 2.95.x update to
 rem     cygwin provides this?\r
 rem\r
 \r
+if exist config.log del config.log\r
+\r
 rem ----------------------------------------------------------------------\r
 rem   See if the environment is large enough.  We need 43 (?) bytes.\r
 set $foo$=123456789_123456789_123456789_123456789_123\r
@@ -105,8 +108,8 @@ echo.   --ldflags FLAG          pass FLAG to compiler when linking
 echo.   --without-png           do not use libpng even if it is installed\r
 echo.   --without-jpeg          do not use jpeg-6b even if it is installed\r
 echo.   --without-gif           do not use libungif even if it is installed\r
-echo.   --without-tiff          do not use tiff even if it is installed\r
-echo.   --without-xpm          do not use libXpm even if it is installed\r
+echo.   --without-tiff          do not use libtiff even if it is installed\r
+echo.   --without-xpm           do not use libXpm even if it is installed\r
 goto end\r
 rem ----------------------------------------------------------------------\r
 :setprefix\r
@@ -236,13 +239,17 @@ if (%nocygwin%) == (Y) goto chkapi
 echo Checking whether gcc requires '-mno-cygwin'...\r
 echo #include "cygwin/version.h" >junk.c\r
 echo main(){} >>junk.c\r
-gcc -c junk.c\r
+echo gcc -c junk.c >>config.log\r
+gcc -c junk.c >>config.log 2>&1\r
 if not exist junk.o goto chkapi\r
-gcc -mno-cygwin -c junk.c\r
+echo gcc -mno-cygwin -c junk.c >>config.log\r
+gcc -mno-cygwin -c junk.c >>config.log 2>&1\r
 if exist junk.o set nocygwin=Y\r
 rm -f junk.c junk.o\r
 \r
 :chkapi\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
 rem ----------------------------------------------------------------------\r
 rem   Older versions of the Windows API headers either don't have any of\r
 rem   the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
@@ -263,9 +270,13 @@ set cf=%usercflags% -mno-cygwin
 :chkapi2\r
 echo on\r
 gcc %cf% -c junk.c\r
-echo off\r
+@echo off\r
+@echo gcc %cf% -c junk.c >>config.log\r
+gcc %cf% -c junk.c >>config.log 2>&1\r
 set cf=\r
 if exist junk.o goto gccOk\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
 \r
 :nocompiler\r
 echo.\r
@@ -278,8 +289,23 @@ goto end
 \r
 :gccOk\r
 set COMPILER=gcc\r
-rm -f junk.c junk.o\r
 echo Using 'gcc'\r
+rm -f junk.c junk.o\r
+Rem It is not clear what GCC version began supporting -mtune\r
+Rem and pentium4 on x86, so check this explicitly.\r
+echo main(){} >junk.c\r
+echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log\r
+gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1\r
+if not errorlevel 1 goto gccMtuneOk\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
+set mf=-mcpu=i686\r
+rm -f junk.c junk.o\r
+goto compilercheckdone\r
+:gccMtuneOk\r
+echo GCC supports -mtune=pentium4 >>config.log\r
+set mf=-mtune=pentium4\r
+rm -f junk.c junk.o\r
 goto compilercheckdone\r
 \r
 :clOk\r
@@ -294,16 +320,26 @@ rem   Check for external image libraries. Since they are loaded
 rem   dynamically, the libraries themselves do not need to be present\r
 rem   at compile time, but the header files are required.\r
 \r
+set mingwflag=\r
+\r
+if (%nocygwin%) == (N) goto flagsOK\r
+set mingwflag=-mno-cygwin\r
+\r
+:flagsOK\r
+\r
 if (%pngsupport%) == (N) goto pngDone\r
 \r
 echo Checking for libpng...\r
 echo #include "png.h" >junk.c\r
 echo main (){} >>junk.c\r
 rem   -o option is ignored with cl, but allows result to be consistent.\r
-%COMPILER% %usercflags% -c junk.c -o junk.obj >junk.out 2>junk.err\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 havePng\r
 \r
 echo ...png.h not found, building without PNG support.\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
 set HAVE_PNG=\r
 goto :pngDone\r
 \r
@@ -320,10 +356,13 @@ echo Checking for jpeg-6b...
 echo #include "jconfig.h" >junk.c\r
 echo main (){} >>junk.c\r
 rem   -o option is ignored with cl, but allows result to be consistent.\r
-%COMPILER% %usercflags% -c junk.c -o junk.obj >junk.out 2>junk.err\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 haveJpeg\r
 \r
 echo ...jconfig.h not found, building without JPEG support.\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
 set HAVE_JPEG=\r
 goto :jpegDone\r
 \r
@@ -340,10 +379,13 @@ echo Checking for libgif...
 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
-%COMPILER% %usercflags% -c junk.c -o junk.obj >junk.out 2>junk.err\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 haveGif\r
 \r
 echo ...gif_lib.h not found, building without GIF support.\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
 set HAVE_GIF=\r
 goto :gifDone\r
 \r
@@ -360,10 +402,13 @@ echo Checking for tiff...
 echo #include "tiffio.h" >junk.c\r
 echo main (){} >>junk.c\r
 rem   -o option is ignored with cl, but allows result to be consistent.\r
-%COMPILER% %usercflags% -c junk.c -o junk.obj >junk.out 2>junk.err\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 haveTiff\r
 \r
 echo ...tiffio.h not found, building without TIFF support.\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
 set HAVE_TIFF=\r
 goto :tiffDone\r
 \r
@@ -381,10 +426,13 @@ echo #define FOR_MSW 1 >junk.c
 echo #include "X11/xpm.h" >>junk.c\r
 echo main (){} >>junk.c\r
 rem   -o option is ignored with cl, but allows result to be consistent.\r
-%COMPILER% %usercflags% -c junk.c -o junk.obj >junk.out 2>junk.err\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 haveXpm\r
 \r
 echo ...X11/xpm.h not found, building without XPM support.\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
 set HAVE_XPM=\r
 goto :xpmDone\r
 \r
@@ -407,6 +455,7 @@ rem   except when there is a preceding digit, when a space is required.
 rem\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 (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r
 if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r
 if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r
@@ -416,24 +465,40 @@ if not "(%userldflags%)" == "()" echo USER_LDFLAGS=%userldflags%>>config.setting
 echo # End of settings from configure.bat>>config.settings\r
 echo. >>config.settings\r
 \r
-copy config.nt ..\src\config.h\r
-echo. >>..\src\config.h\r
-echo /* Start of settings from configure.bat.  */ >>..\src\config.h\r
-if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h\r
-if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h\r
-if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>..\src\config.h\r
-if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>..\src\config.h\r
-if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>..\src\config.h\r
-if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>..\src\config.h\r
-if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>..\src\config.h\r
-echo /* End of settings from configure.bat.  */ >>..\src\config.h\r
-\r
+copy config.nt config.tmp\r
+echo. >>config.tmp\r
+echo /* Start of settings from configure.bat.  */ >>config.tmp\r
+if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>config.tmp\r
+if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>config.tmp\r
+if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 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_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp\r
+echo /* End of settings from configure.bat.  */ >>config.tmp\r
+\r
+Rem See if fc.exe returns a meaningful exit status.  If it does, we\r
+Rem might as well avoid unnecessary overwriting of config.h and epaths.h,\r
+Rem since this forces recompilation of every source file.\r
+if exist foo.bar del foo.bar\r
+fc /b foo.bar foo.bar >nul 2>&1\r
+if not errorlevel 2 goto doCopy\r
+fc /b config.tmp ..\src\config.h >nul 2>&1\r
+if errorlevel 1 goto doCopy\r
+fc /b paths.h ..\src\epaths.h >nul 2>&1\r
+if errorlevel 0 goto dontCopy\r
+:doCopy\r
+copy config.tmp ..\src\config.h\r
 copy paths.h ..\src\epaths.h\r
 \r
+:dontCopy\r
+if exist config.tmp del config.tmp\r
 copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
 copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
 copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
-if not exist ..\lisp\Makefile.unix rename ..\lisp\Makefile.in Makefile.unix\r
+copy /b config.settings+%MAKECMD%.defs+..\man\makefile.w32-in ..\man\makefile\r
+copy /b config.settings+%MAKECMD%.defs+..\lispref\makefile.w32-in ..\lispref\makefile\r
+copy /b config.settings+%MAKECMD%.defs+..\lispintro\makefile.w32-in ..\lispintro\makefile\r
 if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
 copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
 rem   Use the default (no-op) Makefile.in if the nt version is not present.\r
@@ -447,6 +512,7 @@ if not exist ..\site-lisp\subdirs.el copy subdirs.el ..\site-lisp\subdirs.el
 \r
 echo.\r
 echo Emacs successfully configured.\r
+echo Emacs successfully configured. >>config.log\r
 echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
 goto end\r
 \r
@@ -463,3 +529,9 @@ set COMPILER=
 set MAKECMD=\r
 set usercflags=\r
 set userldflags=\r
+set mingwflag=\r
+set mf=\r
+\r
+goto skipArchTag\r
+   arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c\r
+:skipArchTag\r