configure.bat 19.1 KB
Newer Older
Eli Zaretskii's avatar
Eli Zaretskii committed
1 2
@echo off
rem   ----------------------------------------------------------------------
3
rem   Configuration script for MS Windows 95/98/Me and NT/2000/XP
4
rem   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,
Glenn Morris's avatar
Glenn Morris committed
5
rem      2006, 2007 Free Software Foundation, Inc.
Eli Zaretskii's avatar
Eli Zaretskii committed
6 7 8 9 10

rem   This file is part of GNU Emacs.

rem   GNU Emacs is free software; you can redistribute it and/or modify
rem   it under the terms of the GNU General Public License as published by
11
rem   the Free Software Foundation; either version 3, or (at your option)
Eli Zaretskii's avatar
Eli Zaretskii committed
12 13 14 15 16 17 18 19 20
rem   any later version.

rem   GNU Emacs is distributed in the hope that it will be useful,
rem   but WITHOUT ANY WARRANTY; without even the implied warranty of
rem   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
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
Lute Kamstra's avatar
Lute Kamstra committed
21 22
rem   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
rem   Boston, MA 02110-1301, USA.
Eli Zaretskii's avatar
Eli Zaretskii committed
23 24 25
rem   ----------------------------------------------------------------------
rem   YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:
rem
26
rem   + MS Windows 95/98/Me or NT/2000/XP
Eli Zaretskii's avatar
Eli Zaretskii committed
27
rem   + either MSVC 2.x or later, or gcc-2.95 or later (with gmake 3.75
28 29
rem     or later) and the Mingw32 and W32 API headers and libraries.
rem   + Visual Studio 2005 is not supported at this time.
Eli Zaretskii's avatar
Eli Zaretskii committed
30 31 32 33
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.
Juanma Barranquero's avatar
Juanma Barranquero committed
34
rem
Eli Zaretskii's avatar
Eli Zaretskii committed
35
rem                                       sh exists     no sh
36
rem  cygwin b20.1 make (3.75):            fails[1,5]    fails[2,5]
Eli Zaretskii's avatar
Eli Zaretskii committed
37 38 39
rem  MSVC compiled gmake 3.77:            okay          okay
rem  MSVC compiled gmake 3.78.1:          okay          okay
rem  MSVC compiled gmake 3.79.1:          okay          okay
40 41 42 43
rem  mingw32/gcc-2.92.2 make (3.77):      okay          okay[4]
rem  cygwin compiled gmake 3.77:          fails[1,5]    fails[2,5]
rem  cygwin compiled gmake 3.78.1:        fails[5]      fails[2,5]
rem  cygwin compiled gmake 3.79.1:        fails[3,5]    fails[2?,5]
44 45
rem  cygwin compiled make 3.80:           okay[6]       fails?[7]
rem  cygwin compiled make 3.81:           fails         fails?[7]
46
rem  mingw32 compiled make 3.79.1:        okay          okay
47 48
rem  mingw32 compiled make 3.80:          okay          okay?[7]
rem  mingw32 compiled make 3.81:          okay          okay[8]
Eli Zaretskii's avatar
Eli Zaretskii committed
49 50 51 52
rem
rem [1] doesn't cope with makefiles with DOS line endings, so must mount
rem     emacs source with text!=binary.
rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.
53 54 55 56 57
rem [3] requires LC_MESSAGES support to build; cannot build with early
rem     versions of cygwin.
rem [4] may fail on Windows 9X and Windows ME; if so, install Bash.
rem [5] fails when building leim due to the use of cygwin style paths.
rem     May work if building emacs without leim.
58 59 60 61
rem [6] need to uncomment 3 lines in nt/gmake.defs that invoke `cygpath';
rem    	look for "cygpath" near line 85 of gmake.defs.
rem [7] not recommended; please report if you try this combination.
rem [8] tested only on Windows XP.
Eli Zaretskii's avatar
Eli Zaretskii committed
62 63
rem

Eli Zaretskii's avatar
Eli Zaretskii committed
64 65
if exist config.log del config.log

Eli Zaretskii's avatar
Eli Zaretskii committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
rem ----------------------------------------------------------------------
rem   See if the environment is large enough.  We need 43 (?) bytes.
set $foo$=123456789_123456789_123456789_123456789_123
if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv
set $foo$=

rem ----------------------------------------------------------------------
rem   Make sure we are running in the nt subdir
if exist configure.bat goto start
echo You must run configure from the nt subdirectory.
goto end

:start
rem ----------------------------------------------------------------------
rem   Default settings.
set prefix=
set nodebug=N
set noopt=N
set nocygwin=N
set COMPILER=
set usercflags=
set userldflags=
set sep1=
set sep2=

rem ----------------------------------------------------------------------
rem   Handle arguments.
:again
if "%1" == "-h" goto usage
if "%1" == "--help" goto usage
if "%1" == "--prefix" goto setprefix
if "%1" == "--with-gcc" goto withgcc
if "%1" == "--with-msvc" goto withmsvc
if "%1" == "--no-debug" goto nodebug
if "%1" == "--no-opt" goto noopt
if "%1" == "--no-cygwin" goto nocygwin
if "%1" == "--cflags" goto usercflags
if "%1" == "--ldflags" goto userldflags
Jason Rumney's avatar
Jason Rumney committed
104
if "%1" == "--without-png" goto withoutpng
Jason Rumney's avatar
Jason Rumney committed
105
if "%1" == "--without-jpeg" goto withoutjpeg
106
if "%1" == "--without-gif" goto withoutgif
107
if "%1" == "--without-tiff" goto withouttiff
Jason Rumney's avatar
Jason Rumney committed
108
if "%1" == "--without-xpm" goto withoutxpm
Eli Zaretskii's avatar
Eli Zaretskii committed
109 110 111 112 113 114 115 116 117 118 119 120
if "%1" == "" goto checkutils
:usage
echo Usage: configure [options]
echo Options:
echo.   --prefix PREFIX         install Emacs in directory PREFIX
echo.   --with-gcc              use GCC to compile Emacs
echo.   --with-msvc             use MSVC to compile Emacs
echo.   --no-debug              exclude debug info from executables
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
Juanma Barranquero's avatar
Juanma Barranquero committed
121
echo.   --without-png           do not use libpng even if it is installed
Jason Rumney's avatar
Jason Rumney committed
122 123
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
Juanma Barranquero's avatar
Juanma Barranquero committed
124 125
echo.   --without-tiff          do not use libtiff even if it is installed
echo.   --without-xpm           do not use libXpm even if it is installed
Eli Zaretskii's avatar
Eli Zaretskii committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
goto end
rem ----------------------------------------------------------------------
:setprefix
shift
set prefix=%1
shift
goto again
rem ----------------------------------------------------------------------
:withgcc
set COMPILER=gcc
shift
goto again
rem ----------------------------------------------------------------------
:withmsvc
set COMPILER=cl
shift
goto again
rem ----------------------------------------------------------------------
:nodebug
set nodebug=Y
shift
goto again
rem ----------------------------------------------------------------------
:noopt
set noopt=Y
shift
goto again
rem ----------------------------------------------------------------------
:nocygwin
set nocygwin=Y
shift
goto again
rem ----------------------------------------------------------------------
:usercflags
shift
set usercflags=%usercflags%%sep1%%1
set sep1= %nothing%
shift
goto again
rem ----------------------------------------------------------------------
:userldflags
shift
set userldflags=%userldflags%%sep2%%1
set sep2= %nothing%
shift
goto again
Jason Rumney's avatar
Jason Rumney committed
172 173 174 175 176
rem ----------------------------------------------------------------------

:withoutpng
set pngsupport=N
set HAVE_PNG=
177
shift
Jason Rumney's avatar
Jason Rumney committed
178
goto again
Eli Zaretskii's avatar
Eli Zaretskii committed
179

Jason Rumney's avatar
Jason Rumney committed
180 181 182 183 184
rem ----------------------------------------------------------------------

:withoutjpeg
set jpegsupport=N
set HAVE_JPEG=
185
shift
Jason Rumney's avatar
Jason Rumney committed
186 187
goto again

188 189 190 191 192 193 194 195
rem ----------------------------------------------------------------------

:withoutgif
set gifsupport=N
set HAVE_GIF=
shift
goto again

196 197 198 199 200 201 202 203
rem ----------------------------------------------------------------------

:withouttiff
set tiffsupport=N
set HAVE_TIFF=
shift
goto again

Jason Rumney's avatar
Jason Rumney committed
204 205 206 207 208 209 210 211
rem ----------------------------------------------------------------------

:withoutxpm
set xpmsupport=N
set HAVE_XPM=
shift
goto again

Eli Zaretskii's avatar
Eli Zaretskii committed
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
rem ----------------------------------------------------------------------
rem    Check that necessary utilities (cp and rm) are present.
:checkutils
echo Checking for 'cp'...
cp configure.bat junk.bat
if not exist junk.bat goto needcp
echo Checking for 'rm'...
rm junk.bat
if exist junk.bat goto needrm
goto checkcompiler
:needcp
echo You need 'cp' (the Unix file copy program) to build Emacs.
goto end
:needrm
del junk.bat
echo You need 'rm' (the Unix file delete program) to build Emacs.
goto end

rem ----------------------------------------------------------------------
rem   Auto-detect compiler if not specified, and validate GCC if chosen.
:checkcompiler
Jason Rumney's avatar
Jason Rumney committed
233
if (%COMPILER%)==(cl) goto compilercheckdone
Eli Zaretskii's avatar
Eli Zaretskii committed
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
if (%COMPILER%)==(gcc) goto checkgcc

echo Checking whether 'cl' is available...
echo main(){} >junk.c
cl -nologo -c junk.c
if exist junk.obj goto clOK

echo Checking whether 'gcc' is available...
gcc -c junk.c
if not exist junk.o goto nocompiler
del junk.o

:checkgcc
Rem WARNING -- COMMAND.COM on some systems only looks at the first
Rem            8 characters of a label.  So do NOT be tempted to change
Rem            chkapi* into something fancier like checkw32api
Rem You HAVE been warned!
if (%nocygwin%) == (Y) goto chkapi
echo Checking whether gcc requires '-mno-cygwin'...
echo #include "cygwin/version.h" >junk.c
echo main(){} >>junk.c
Eli Zaretskii's avatar
Eli Zaretskii committed
255 256
echo gcc -c junk.c >>config.log
gcc -c junk.c >>config.log 2>&1
Eli Zaretskii's avatar
Eli Zaretskii committed
257
if not exist junk.o goto chkapi
Eli Zaretskii's avatar
Eli Zaretskii committed
258 259
echo gcc -mno-cygwin -c junk.c >>config.log
gcc -mno-cygwin -c junk.c >>config.log 2>&1
Eli Zaretskii's avatar
Eli Zaretskii committed
260 261 262 263
if exist junk.o set nocygwin=Y
rm -f junk.c junk.o

:chkapi
Eli Zaretskii's avatar
Eli Zaretskii committed
264 265
echo The failed program was: >>config.log
type junk.c >>config.log
Eli Zaretskii's avatar
Eli Zaretskii committed
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
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
rem   are like this), or have a typo in the definition of
rem   IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this
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.
rem
echo Checking whether W32 API headers are too old...
echo #include "windows.h" >junk.c
echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c
echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c
if (%nocygwin%) == (Y) goto chkapi1
set cf=%usercflags%
goto chkapi2
:chkapi1
set cf=%usercflags% -mno-cygwin
:chkapi2
echo on
gcc %cf% -c junk.c
Eli Zaretskii's avatar
Eli Zaretskii committed
286 287 288
@echo off
@echo gcc %cf% -c junk.c >>config.log
gcc %cf% -c junk.c >>config.log 2>&1
Eli Zaretskii's avatar
Eli Zaretskii committed
289 290
set cf=
if exist junk.o goto gccOk
Eli Zaretskii's avatar
Eli Zaretskii committed
291 292
echo The failed program was: >>config.log
type junk.c >>config.log
Eli Zaretskii's avatar
Eli Zaretskii committed
293 294 295 296 297 298 299 300 301 302 303 304 305

:nocompiler
echo.
echo Configure failed.
echo To configure Emacs for Windows, you need to have either
echo gcc-2.95 or later with Mingw32 and the W32 API headers,
echo or MSVC 2.x or later.
del junk.c
goto end

:gccOk
set COMPILER=gcc
echo Using 'gcc'
Eli Zaretskii's avatar
Eli Zaretskii committed
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
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
Jason Rumney's avatar
Jason Rumney committed
322
goto compilercheckdone
Eli Zaretskii's avatar
Eli Zaretskii committed
323 324 325 326 327

:clOk
set COMPILER=cl
rm -f junk.c junk.obj
echo Using 'MSVC'
Jason Rumney's avatar
Jason Rumney committed
328 329 330 331 332 333 334 335

: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.

336 337 338 339 340 341 342
set mingwflag=

if (%nocygwin%) == (N) goto flagsOK
set mingwflag=-mno-cygwin

:flagsOK

Jason Rumney's avatar
Jason Rumney committed
343 344 345 346 347 348
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.
Eli Zaretskii's avatar
Eli Zaretskii committed
349 350
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
Jason Rumney's avatar
Jason Rumney committed
351 352
if exist junk.obj goto havePng

Jason Rumney's avatar
Jason Rumney committed
353
echo ...png.h not found, building without PNG support.
Eli Zaretskii's avatar
Eli Zaretskii committed
354 355
echo The failed program was: >>config.log
type junk.c >>config.log
Jason Rumney's avatar
Jason Rumney committed
356 357 358 359 360 361 362 363 364
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
Eli Zaretskii's avatar
Eli Zaretskii committed
365

Jason Rumney's avatar
Jason Rumney committed
366 367
if (%jpegsupport%) == (N) goto jpegDone

Jason Rumney's avatar
Jason Rumney committed
368
echo Checking for jpeg-6b...
Jason Rumney's avatar
Jason Rumney committed
369 370 371
echo #include "jconfig.h" >junk.c
echo main (){} >>junk.c
rem   -o option is ignored with cl, but allows result to be consistent.
Eli Zaretskii's avatar
Eli Zaretskii committed
372 373
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
Jason Rumney's avatar
Jason Rumney committed
374 375
if exist junk.obj goto haveJpeg

Jason Rumney's avatar
Jason Rumney committed
376
echo ...jconfig.h not found, building without JPEG support.
Eli Zaretskii's avatar
Eli Zaretskii committed
377 378
echo The failed program was: >>config.log
type junk.c >>config.log
Jason Rumney's avatar
Jason Rumney committed
379 380 381 382 383 384 385 386 387 388
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

389 390
if (%gifsupport%) == (N) goto gifDone

Jason Rumney's avatar
Jason Rumney committed
391
echo Checking for libgif...
392 393 394
echo #include "gif_lib.h" >junk.c
echo main (){} >>junk.c
rem   -o option is ignored with cl, but allows result to be consistent.
Eli Zaretskii's avatar
Eli Zaretskii committed
395 396
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
397 398
if exist junk.obj goto haveGif

Jason Rumney's avatar
Jason Rumney committed
399
echo ...gif_lib.h not found, building without GIF support.
Eli Zaretskii's avatar
Eli Zaretskii committed
400 401
echo The failed program was: >>config.log
type junk.c >>config.log
402 403 404 405 406 407 408 409 410 411
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

412 413 414 415 416 417
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.
Eli Zaretskii's avatar
Eli Zaretskii committed
418 419
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
420 421
if exist junk.obj goto haveTiff

Jason Rumney's avatar
Jason Rumney committed
422
echo ...tiffio.h not found, building without TIFF support.
Eli Zaretskii's avatar
Eli Zaretskii committed
423 424
echo The failed program was: >>config.log
type junk.c >>config.log
425 426 427 428 429 430 431 432 433 434
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

Jason Rumney's avatar
Jason Rumney committed
435 436 437 438 439 440 441
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.
Eli Zaretskii's avatar
Eli Zaretskii committed
442 443
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
Jason Rumney's avatar
Jason Rumney committed
444 445 446
if exist junk.obj goto haveXpm

echo ...X11/xpm.h not found, building without XPM support.
Eli Zaretskii's avatar
Eli Zaretskii committed
447 448
echo The failed program was: >>config.log
type junk.c >>config.log
Jason Rumney's avatar
Jason Rumney committed
449 450 451 452 453 454 455 456 457 458
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

Eli Zaretskii's avatar
Eli Zaretskii committed
459 460 461 462 463 464 465 466 467 468 469 470
rem ----------------------------------------------------------------------
:genmakefiles
echo Generating makefiles
if %COMPILER% == gcc set MAKECMD=gmake
if %COMPILER% == cl set MAKECMD=nmake

rem   Pass on chosen settings to makefiles.
rem   NB. Be very careful to not have a space before redirection symbols
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
Eli Zaretskii's avatar
Eli Zaretskii committed
471
if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings
Eli Zaretskii's avatar
Eli Zaretskii committed
472 473 474 475 476 477 478 479 480
if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings
if (%noopt%) == (Y) echo NOOPT=1 >>config.settings
if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings
if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings
if not "(%usercflags%)" == "()" echo USER_CFLAGS=%usercflags%>>config.settings
if not "(%userldflags%)" == "()" echo USER_LDFLAGS=%userldflags%>>config.settings
echo # End of settings from configure.bat>>config.settings
echo. >>config.settings

481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
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
Eli Zaretskii's avatar
Eli Zaretskii committed
505 506
copy paths.h ..\src\epaths.h

507 508
:dontCopy
if exist config.tmp del config.tmp
Eli Zaretskii's avatar
Eli Zaretskii committed
509 510 511
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
512 513 514
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
Eli Zaretskii's avatar
Eli Zaretskii committed
515 516 517 518 519 520 521
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.
if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile
if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile
del config.settings

522 523
Rem Some people use WinZip which doesn't create empty directories!
if not exist ..\site-lisp\nul mkdir ..\site-lisp\
524 525 526 527 528 529 530 531 532 533 534
Rem Update subdirs.el only if it is different or fc.exe doesn't work.
if exist foo.bar del foo.bar
fc /b foo.bar foo.bar >nul 2>&1
if not errorlevel 2 goto doUpdateSubdirs
fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1
if not errorlevel 1 goto dontUpdateSubdirs
:doUpdateSubdirs
if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el
copy subdirs.el ..\site-lisp\subdirs.el

:dontUpdateSubdirs
Eli Zaretskii's avatar
Eli Zaretskii committed
535 536
echo.
echo Emacs successfully configured.
537
echo Emacs successfully configured. >>config.log
Eli Zaretskii's avatar
Eli Zaretskii committed
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.
goto end

:SmallEnv
echo Your environment size is too small.  Please enlarge it and rerun configure.
echo For example, type "command.com /e:2048" to have 2048 bytes available.
set $foo$=
:end
set prefix=
set nodebug=
set noopt=
set nocygwin=
set COMPILER=
set MAKECMD=
set usercflags=
set userldflags=
554
set mingwflag=
Eli Zaretskii's avatar
Eli Zaretskii committed
555
set mf=
556 557 558 559

goto skipArchTag
   arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c
:skipArchTag