X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/f466241d472a4db93178989b377228a82e86f0fb..80d0edae927b550944eb54eb49a70cb7f5353b68:/nt/configure.bat diff --git a/nt/configure.bat b/nt/configure.bat index 4ee9b46a2b..b5f78f2ab5 100755 --- a/nt/configure.bat +++ b/nt/configure.bat @@ -1,7 +1,8 @@ @echo off rem ---------------------------------------------------------------------- -rem Configuration script for MS Windows 95/98 and NT/2000 -rem Copyright (C) 1999-2001 Free Software Foundation, Inc. +rem Configuration script for MS Windows 95/98/Me and NT/2000/XP +rem Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +rem Free Software Foundation, Inc. rem This file is part of GNU Emacs. @@ -17,19 +18,19 @@ rem GNU General Public License for more details. rem You should have received a copy of the GNU General Public License rem along with GNU Emacs; see the file COPYING. If not, write to the -rem Free Software Foundation, Inc., 59 Temple Place - Suite 330, -rem Boston, MA 02111-1307, USA. +rem Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +rem Boston, MA 02110-1301, USA. rem ---------------------------------------------------------------------- rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS: rem -rem + MS Windows 95/98 or NT/2000 +rem + MS Windows 95/98/Me or NT/2000/XP rem + either MSVC 2.x or later, or gcc-2.95 or later (with gmake 3.75 rem or later) and the Mingw32 and W32 API headers and libraries rem rem For reference, here is a list of which builds of gmake are known to rem work or not, and whether they work in the presence and/or absence of rem sh.exe. -rem +rem rem sh exists no sh rem cygwin b20.1 make (3.75): okay[1] fails[2] rem MSVC compiled gmake 3.77: okay okay @@ -47,6 +48,8 @@ rem [3] requires LC_MESSAGES support to build; maybe 2.95.x update to rem cygwin provides this? rem +if exist config.log del config.log + rem ---------------------------------------------------------------------- rem See if the environment is large enough. We need 43 (?) bytes. set $foo$=123456789_123456789_123456789_123456789_123 @@ -85,6 +88,11 @@ if "%1" == "--no-opt" goto noopt if "%1" == "--no-cygwin" goto nocygwin if "%1" == "--cflags" goto usercflags if "%1" == "--ldflags" goto userldflags +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-xpm" goto withoutxpm if "%1" == "" goto checkutils :usage echo Usage: configure [options] @@ -97,6 +105,11 @@ echo. --no-opt disable optimization 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. --without-png do not use libpng even if it is installed +echo. --without-jpeg do not use jpeg-6b even if it is installed +echo. --without-gif do not use libungif even if it is installed +echo. --without-tiff do not use libtiff even if it is installed +echo. --without-xpm do not use libXpm even if it is installed goto end rem ---------------------------------------------------------------------- :setprefix @@ -143,6 +156,45 @@ set userldflags=%userldflags%%sep2%%1 set sep2= %nothing% shift goto again +rem ---------------------------------------------------------------------- + +:withoutpng +set pngsupport=N +set HAVE_PNG= +shift +goto again + +rem ---------------------------------------------------------------------- + +:withoutjpeg +set jpegsupport=N +set HAVE_JPEG= +shift +goto again + +rem ---------------------------------------------------------------------- + +:withoutgif +set gifsupport=N +set HAVE_GIF= +shift +goto again + +rem ---------------------------------------------------------------------- + +:withouttiff +set tiffsupport=N +set HAVE_TIFF= +shift +goto again + +rem ---------------------------------------------------------------------- + +:withoutxpm +set xpmsupport=N +set HAVE_XPM= +shift +goto again rem ---------------------------------------------------------------------- rem Check that necessary utilities (cp and rm) are present. @@ -165,7 +217,7 @@ goto end rem ---------------------------------------------------------------------- rem Auto-detect compiler if not specified, and validate GCC if chosen. :checkcompiler -if (%COMPILER%)==(cl) goto genmakefiles +if (%COMPILER%)==(cl) goto compilercheckdone if (%COMPILER%)==(gcc) goto checkgcc echo Checking whether 'cl' is available... @@ -187,13 +239,17 @@ if (%nocygwin%) == (Y) goto chkapi echo Checking whether gcc requires '-mno-cygwin'... echo #include "cygwin/version.h" >junk.c echo main(){} >>junk.c -gcc -c junk.c +echo gcc -c junk.c >>config.log +gcc -c junk.c >>config.log 2>&1 if not exist junk.o goto chkapi -gcc -mno-cygwin -c junk.c +echo gcc -mno-cygwin -c junk.c >>config.log +gcc -mno-cygwin -c junk.c >>config.log 2>&1 if exist junk.o set nocygwin=Y rm -f junk.c junk.o :chkapi +echo The failed program was: >>config.log +type junk.c >>config.log rem ---------------------------------------------------------------------- rem Older versions of the Windows API headers either don't have any of rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1 @@ -214,9 +270,13 @@ set cf=%usercflags% -mno-cygwin :chkapi2 echo on gcc %cf% -c junk.c -echo off +@echo off +@echo gcc %cf% -c junk.c >>config.log +gcc %cf% -c junk.c >>config.log 2>&1 set cf= if exist junk.o goto gccOk +echo The failed program was: >>config.log +type junk.c >>config.log :nocompiler echo. @@ -229,15 +289,159 @@ goto end :gccOk set COMPILER=gcc -rm -f junk.c junk.o echo Using 'gcc' -goto genmakefiles +rm -f junk.c junk.o +Rem It is not clear what GCC version began supporting -mtune +Rem and pentium4 on x86, so check this explicitly. +echo main(){} >junk.c +echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log +gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1 +if not errorlevel 1 goto gccMtuneOk +echo The failed program was: >>config.log +type junk.c >>config.log +set mf=-mcpu=i686 +rm -f junk.c junk.o +goto compilercheckdone +:gccMtuneOk +echo GCC supports -mtune=pentium4 >>config.log +set mf=-mtune=pentium4 +rm -f junk.c junk.o +goto compilercheckdone :clOk set COMPILER=cl rm -f junk.c junk.obj echo Using 'MSVC' -goto genmakefiles + +:compilercheckdone + +rem ---------------------------------------------------------------------- +rem Check for external image libraries. Since they are loaded +rem dynamically, the libraries themselves do not need to be present +rem at compile time, but the header files are required. + +set mingwflag= + +if (%nocygwin%) == (N) goto flagsOK +set mingwflag=-mno-cygwin + +:flagsOK + +if (%pngsupport%) == (N) goto pngDone + +echo Checking for libpng... +echo #include "png.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 havePng + +echo ...png.h not found, building without PNG support. +echo The failed program was: >>config.log +type junk.c >>config.log +set HAVE_PNG= +goto :pngDone + +:havePng +echo ...PNG header available, building with PNG support. +set HAVE_PNG=1 + +:pngDone +rm -f junk.c junk.obj + +if (%jpegsupport%) == (N) goto jpegDone + +echo Checking for jpeg-6b... +echo #include "jconfig.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 haveJpeg + +echo ...jconfig.h not found, building without JPEG support. +echo The failed program was: >>config.log +type junk.c >>config.log +set HAVE_JPEG= +goto :jpegDone + +:haveJpeg +echo ...JPEG header available, building with JPEG support. +set HAVE_JPEG=1 + +:jpegDone +rm -f junk.c junk.obj + +if (%gifsupport%) == (N) goto gifDone + +echo Checking for libgif... +echo #include "gif_lib.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 haveGif + +echo ...gif_lib.h not found, building without GIF support. +echo The failed program was: >>config.log +type junk.c >>config.log +set HAVE_GIF= +goto :gifDone + +:haveGif +echo ...GIF header available, building with GIF support. +set HAVE_GIF=1 + +:gifDone +rm -f junk.c junk.obj + +if (%tiffsupport%) == (N) goto tiffDone + +echo Checking for tiff... +echo #include "tiffio.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 haveTiff + +echo ...tiffio.h not found, building without TIFF support. +echo The failed program was: >>config.log +type junk.c >>config.log +set HAVE_TIFF= +goto :tiffDone + +:haveTiff +echo ...TIFF header available, building with TIFF support. +set HAVE_TIFF=1 + +:tiffDone +rm -f junk.c junk.obj + +if (%xpmsupport%) == (N) goto xpmDone + +echo Checking for libXpm... +echo #define FOR_MSW 1 >junk.c +echo #include "X11/xpm.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 haveXpm + +echo ...X11/xpm.h not found, building without XPM support. +echo The failed program was: >>config.log +type junk.c >>config.log +set HAVE_XPM= +goto :xpmDone + +:haveXpm +echo ...XPM header available, building with XPM support. +set HAVE_XPM=1 + +:xpmDone +rm -f junk.c junk.obj junk.err junk.out rem ---------------------------------------------------------------------- :genmakefiles @@ -251,6 +455,7 @@ rem except when there is a preceding digit, when a space is required. rem echo # Start of settings from configure.bat >config.settings echo COMPILER=%COMPILER%>>config.settings +if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings if (%noopt%) == (Y) echo NOOPT=1 >>config.settings if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings @@ -260,15 +465,40 @@ if not "(%userldflags%)" == "()" echo USER_LDFLAGS=%userldflags%>>config.setting echo # End of settings from configure.bat>>config.settings echo. >>config.settings -copy config.nt ..\src\config.h -if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h -if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h +copy config.nt config.tmp +echo. >>config.tmp +echo /* Start of settings from configure.bat. */ >>config.tmp +if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>config.tmp +if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>config.tmp +if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 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 +if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp +echo /* End of settings from configure.bat. */ >>config.tmp + +Rem See if fc.exe returns a meaningful exit status. If it does, we +Rem might as well avoid unnecessary overwriting of config.h and epaths.h, +Rem since this forces recompilation of every source file. +if exist foo.bar del foo.bar +fc /b foo.bar foo.bar >nul 2>&1 +if not errorlevel 2 goto doCopy +fc /b config.tmp ..\src\config.h >nul 2>&1 +if errorlevel 1 goto doCopy +fc /b paths.h ..\src\epaths.h >nul 2>&1 +if errorlevel 0 goto dontCopy +:doCopy +copy config.tmp ..\src\config.h copy paths.h ..\src\epaths.h +:dontCopy +if exist config.tmp del config.tmp copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile -if not exist ..\lisp\Makefile.unix rename ..\lisp\Makefile.in Makefile.unix +copy /b config.settings+%MAKECMD%.defs+..\man\makefile.w32-in ..\man\makefile +copy /b config.settings+%MAKECMD%.defs+..\lispref\makefile.w32-in ..\lispref\makefile +copy /b config.settings+%MAKECMD%.defs+..\lispintro\makefile.w32-in ..\lispintro\makefile if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile rem Use the default (no-op) Makefile.in if the nt version is not present. @@ -276,10 +506,13 @@ if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\ if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile del config.settings +Rem Some people use WinZip which doesn't create empty directories! +if not exist ..\site-lisp\nul mkdir ..\site-lisp\ if not exist ..\site-lisp\subdirs.el copy subdirs.el ..\site-lisp\subdirs.el echo. echo Emacs successfully configured. +echo Emacs successfully configured. >>config.log echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install. goto end @@ -296,3 +529,9 @@ set COMPILER= set MAKECMD= set usercflags= set userldflags= +set mingwflag= +set mf= + +goto skipArchTag + arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c +:skipArchTag