* configure.bat: New option --enable-checking.
[bpt/emacs.git] / nt / configure.bat
CommitLineData
f466241d
EZ
1@echo off\r
2rem ----------------------------------------------------------------------\r
12ff2dc5 3rem Configuration script for MS Windows 95/98/Me and NT/2000/XP\r
ceb4c4d3 4rem Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,\r
114f9c96 5rem 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.\r
f466241d
EZ
6\r
7rem This file is part of GNU Emacs.\r
8\r
eef0be9e 9rem GNU Emacs is free software: you can redistribute it and/or modify\r
f466241d 10rem it under the terms of the GNU General Public License as published by\r
eef0be9e
GM
11rem the Free Software Foundation, either version 3 of the License, or\r
12rem (at your option) any later version.\r
f466241d
EZ
13\r
14rem GNU Emacs is distributed in the hope that it will be useful,\r
15rem but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
17rem GNU General Public License for more details.\r
18\r
19rem You should have received a copy of the GNU General Public License\r
eef0be9e
GM
20rem along with GNU Emacs. If not, see http://www.gnu.org/licenses/.\r
21\r
f466241d
EZ
22rem ----------------------------------------------------------------------\r
23rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r
24rem\r
12ff2dc5 25rem + MS Windows 95/98/Me or NT/2000/XP\r
361823f4 26rem + either MSVC 2.x or later, or gcc-2.95 or later (with GNU make 3.75\r
56a469c3
EZ
27rem or later) and the Mingw32 and W32 API headers and libraries.\r
28rem + Visual Studio 2005 is not supported at this time.\r
f466241d 29rem\r
361823f4 30rem For reference, here is a list of which builds of GNU make are known to\r
f466241d
EZ
31rem work or not, and whether they work in the presence and/or absence of\r
32rem sh.exe.\r
7019fb66 33rem\r
f466241d 34rem sh exists no sh\r
56a469c3 35rem cygwin b20.1 make (3.75): fails[1,5] fails[2,5]\r
f466241d
EZ
36rem MSVC compiled gmake 3.77: okay okay\r
37rem MSVC compiled gmake 3.78.1: okay okay\r
38rem MSVC compiled gmake 3.79.1: okay okay\r
56a469c3
EZ
39rem mingw32/gcc-2.92.2 make (3.77): okay okay[4]\r
40rem cygwin compiled gmake 3.77: fails[1,5] fails[2,5]\r
41rem cygwin compiled gmake 3.78.1: fails[5] fails[2,5]\r
42rem cygwin compiled gmake 3.79.1: fails[3,5] fails[2?,5]\r
17f55fae
EZ
43rem cygwin compiled make 3.80: okay[6] fails?[7]\r
44rem cygwin compiled make 3.81: fails fails?[7]\r
56a469c3 45rem mingw32 compiled make 3.79.1: okay okay\r
17f55fae
EZ
46rem mingw32 compiled make 3.80: okay okay?[7]\r
47rem mingw32 compiled make 3.81: okay okay[8]\r
f466241d
EZ
48rem\r
49rem [1] doesn't cope with makefiles with DOS line endings, so must mount\r
50rem emacs source with text!=binary.\r
51rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.\r
56a469c3
EZ
52rem [3] requires LC_MESSAGES support to build; cannot build with early\r
53rem versions of cygwin.\r
54rem [4] may fail on Windows 9X and Windows ME; if so, install Bash.\r
55rem [5] fails when building leim due to the use of cygwin style paths.\r
56rem May work if building emacs without leim.\r
17f55fae
EZ
57rem [6] need to uncomment 3 lines in nt/gmake.defs that invoke `cygpath';\r
58rem look for "cygpath" near line 85 of gmake.defs.\r
59rem [7] not recommended; please report if you try this combination.\r
60rem [8] tested only on Windows XP.\r
f466241d
EZ
61rem\r
62\r
dbbdb507
EZ
63if exist config.log del config.log\r
64\r
f466241d
EZ
65rem ----------------------------------------------------------------------\r
66rem See if the environment is large enough. We need 43 (?) bytes.\r
67set $foo$=123456789_123456789_123456789_123456789_123\r
68if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv\r
69set $foo$=\r
70\r
71rem ----------------------------------------------------------------------\r
72rem Make sure we are running in the nt subdir\r
73if exist configure.bat goto start\r
74echo You must run configure from the nt subdirectory.\r
75goto end\r
76\r
77:start\r
78rem ----------------------------------------------------------------------\r
79rem Default settings.\r
80set prefix=\r
81set nodebug=N\r
82set noopt=N\r
7d0170c8 83set enablechecking=N\r
75663c75 84set profile=N\r
f466241d
EZ
85set nocygwin=N\r
86set COMPILER=\r
87set usercflags=\r
3a1ebd63 88set docflags=\r
f466241d 89set userldflags=\r
3a1ebd63 90set doldflags=\r
f466241d
EZ
91set sep1=\r
92set sep2=\r
93\r
94rem ----------------------------------------------------------------------\r
95rem Handle arguments.\r
96:again\r
97if "%1" == "-h" goto usage\r
98if "%1" == "--help" goto usage\r
99if "%1" == "--prefix" goto setprefix\r
100if "%1" == "--with-gcc" goto withgcc\r
101if "%1" == "--with-msvc" goto withmsvc\r
102if "%1" == "--no-debug" goto nodebug\r
103if "%1" == "--no-opt" goto noopt\r
7d0170c8 104if "%1" == "--enable-checking" goto enablechecking\r
75663c75 105if "%1" == "--profile" goto profile\r
f466241d
EZ
106if "%1" == "--no-cygwin" goto nocygwin\r
107if "%1" == "--cflags" goto usercflags\r
108if "%1" == "--ldflags" goto userldflags\r
e0006538 109if "%1" == "--without-png" goto withoutpng\r
aad0eae4 110if "%1" == "--without-jpeg" goto withoutjpeg\r
12ff2dc5 111if "%1" == "--without-gif" goto withoutgif\r
47c01e80 112if "%1" == "--without-tiff" goto withouttiff\r
507f5dce 113if "%1" == "--without-xpm" goto withoutxpm\r
8bc63b1a 114if "%1" == "--with-svg" goto withsvg\r
f466241d
EZ
115if "%1" == "" goto checkutils\r
116:usage\r
117echo Usage: configure [options]\r
118echo Options:\r
119echo. --prefix PREFIX install Emacs in directory PREFIX\r
120echo. --with-gcc use GCC to compile Emacs\r
121echo. --with-msvc use MSVC to compile Emacs\r
122echo. --no-debug exclude debug info from executables\r
123echo. --no-opt disable optimization\r
7d0170c8 124echo. --enable-checking enable checks and assertions\r
75663c75 125echo. --profile enable profiling\r
f466241d
EZ
126echo. --no-cygwin use -mno-cygwin option with GCC\r
127echo. --cflags FLAG pass FLAG to compiler\r
128echo. --ldflags FLAG pass FLAG to compiler when linking\r
f01e03d3
JB
129echo. --without-png do not use PNG library even if it is installed\r
130echo. --without-jpeg do not use JPEG library even if it is installed\r
131echo. --without-gif do not use GIF library even if it is installed\r
132echo. --without-tiff do not use TIFF library even if it is installed\r
133echo. --without-xpm do not use XPM library even if it is installed\r
8d67bc8e 134echo. --with-svg use the RSVG library (experimental)\r
f466241d
EZ
135goto end\r
136rem ----------------------------------------------------------------------\r
137:setprefix\r
138shift\r
139set prefix=%1\r
140shift\r
141goto again\r
142rem ----------------------------------------------------------------------\r
143:withgcc\r
144set COMPILER=gcc\r
145shift\r
146goto again\r
147rem ----------------------------------------------------------------------\r
148:withmsvc\r
149set COMPILER=cl\r
150shift\r
151goto again\r
152rem ----------------------------------------------------------------------\r
153:nodebug\r
154set nodebug=Y\r
155shift\r
156goto again\r
157rem ----------------------------------------------------------------------\r
158:noopt\r
159set noopt=Y\r
160shift\r
161goto again\r
162rem ----------------------------------------------------------------------\r
7d0170c8
JB
163:enablechecking\r
164set enablechecking=Y\r
165shift\r
166goto again\r
167rem ----------------------------------------------------------------------\r
75663c75
JR
168:profile\r
169set profile=Y\r
170shift\r
171goto again\r
172rem ----------------------------------------------------------------------\r
f466241d
EZ
173:nocygwin\r
174set nocygwin=Y\r
175shift\r
176goto again\r
177rem ----------------------------------------------------------------------\r
178:usercflags\r
179shift\r
180set usercflags=%usercflags%%sep1%%1\r
181set sep1= %nothing%\r
182shift\r
183goto again\r
184rem ----------------------------------------------------------------------\r
185:userldflags\r
186shift\r
187set userldflags=%userldflags%%sep2%%1\r
188set sep2= %nothing%\r
189shift\r
190goto again\r
e0006538
JR
191rem ----------------------------------------------------------------------\r
192\r
193:withoutpng\r
194set pngsupport=N\r
195set HAVE_PNG=\r
39bd0e03 196shift\r
e0006538 197goto again\r
f466241d 198\r
aad0eae4
JR
199rem ----------------------------------------------------------------------\r
200\r
201:withoutjpeg\r
202set jpegsupport=N\r
203set HAVE_JPEG=\r
39bd0e03 204shift\r
aad0eae4
JR
205goto again\r
206\r
12ff2dc5
JB
207rem ----------------------------------------------------------------------\r
208\r
209:withoutgif\r
210set gifsupport=N\r
211set HAVE_GIF=\r
212shift\r
213goto again\r
214\r
47c01e80
JB
215rem ----------------------------------------------------------------------\r
216\r
217:withouttiff\r
218set tiffsupport=N\r
219set HAVE_TIFF=\r
220shift\r
221goto again\r
222\r
507f5dce
JR
223rem ----------------------------------------------------------------------\r
224\r
225:withoutxpm\r
226set xpmsupport=N\r
227set HAVE_XPM=\r
228shift\r
229goto again\r
230\r
8bc63b1a
JR
231:withsvg\r
232shift\r
233set svgsupport=Y\r
234goto again\r
235\r
f466241d
EZ
236rem ----------------------------------------------------------------------\r
237rem Check that necessary utilities (cp and rm) are present.\r
238:checkutils\r
239echo Checking for 'cp'...\r
240cp configure.bat junk.bat\r
241if not exist junk.bat goto needcp\r
242echo Checking for 'rm'...\r
243rm junk.bat\r
244if exist junk.bat goto needrm\r
245goto checkcompiler\r
246:needcp\r
247echo You need 'cp' (the Unix file copy program) to build Emacs.\r
248goto end\r
249:needrm\r
250del junk.bat\r
251echo You need 'rm' (the Unix file delete program) to build Emacs.\r
252goto end\r
253\r
254rem ----------------------------------------------------------------------\r
255rem Auto-detect compiler if not specified, and validate GCC if chosen.\r
256:checkcompiler\r
e0006538 257if (%COMPILER%)==(cl) goto compilercheckdone\r
f466241d
EZ
258if (%COMPILER%)==(gcc) goto checkgcc\r
259\r
f466241d 260echo Checking whether 'gcc' is available...\r
680d641f 261echo main(){} >junk.c\r
f466241d 262gcc -c junk.c\r
680d641f 263if exist junk.o goto checkgcc\r
f466241d 264\r
680d641f
JR
265echo Checking whether 'cl' is available...\r
266cl -nologo -c junk.c\r
267if exist junk.obj goto clOK\r
268goto nocompiler\r
269\r
f466241d 270:checkgcc\r
1046da1c 271if exist junk.o del junk.o\r
f466241d
EZ
272Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
273Rem 8 characters of a label. So do NOT be tempted to change\r
274Rem chkapi* into something fancier like checkw32api\r
275Rem You HAVE been warned!\r
1046da1c 276if (%nocygwin%) == (Y) goto chkapiN\r
f466241d
EZ
277echo Checking whether gcc requires '-mno-cygwin'...\r
278echo #include "cygwin/version.h" >junk.c\r
279echo main(){} >>junk.c\r
dbbdb507
EZ
280echo gcc -c junk.c >>config.log\r
281gcc -c junk.c >>config.log 2>&1\r
f466241d 282if not exist junk.o goto chkapi\r
dbbdb507
EZ
283echo gcc -mno-cygwin -c junk.c >>config.log\r
284gcc -mno-cygwin -c junk.c >>config.log 2>&1\r
f466241d 285if exist junk.o set nocygwin=Y\r
f466241d
EZ
286\r
287:chkapi\r
dbbdb507
EZ
288echo The failed program was: >>config.log\r
289type junk.c >>config.log\r
1046da1c
EZ
290:chkapiN\r
291rm -f junk.c junk.o\r
f466241d
EZ
292rem ----------------------------------------------------------------------\r
293rem Older versions of the Windows API headers either don't have any of\r
294rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
295rem are like this), or have a typo in the definition of\r
296rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r
297rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros\r
298rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
892508a4 299rem Beginning with Emacs 23, we need usp10.h.\r
f466241d
EZ
300rem\r
301echo Checking whether W32 API headers are too old...\r
302echo #include "windows.h" >junk.c\r
892508a4 303echo #include "usp10.h" >>junk.c\r
f466241d
EZ
304echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
305echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
306if (%nocygwin%) == (Y) goto chkapi1\r
307set cf=%usercflags%\r
308goto chkapi2\r
309:chkapi1\r
310set cf=%usercflags% -mno-cygwin\r
311:chkapi2\r
312echo on\r
313gcc %cf% -c junk.c\r
dbbdb507
EZ
314@echo off\r
315@echo gcc %cf% -c junk.c >>config.log\r
316gcc %cf% -c junk.c >>config.log 2>&1\r
f466241d
EZ
317set cf=\r
318if exist junk.o goto gccOk\r
dbbdb507
EZ
319echo The failed program was: >>config.log\r
320type junk.c >>config.log\r
f466241d
EZ
321\r
322:nocompiler\r
323echo.\r
324echo Configure failed.\r
325echo To configure Emacs for Windows, you need to have either\r
326echo gcc-2.95 or later with Mingw32 and the W32 API headers,\r
327echo or MSVC 2.x or later.\r
328del junk.c\r
329goto end\r
330\r
331:gccOk\r
332set COMPILER=gcc\r
f466241d 333echo Using 'gcc'\r
dbbdb507
EZ
334rm -f junk.c junk.o\r
335Rem It is not clear what GCC version began supporting -mtune\r
336Rem and pentium4 on x86, so check this explicitly.\r
337echo main(){} >junk.c\r
338echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log\r
339gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1\r
340if not errorlevel 1 goto gccMtuneOk\r
341echo The failed program was: >>config.log\r
342type junk.c >>config.log\r
343set mf=-mcpu=i686\r
344rm -f junk.c junk.o\r
540c2a33 345goto gccdebug\r
dbbdb507
EZ
346:gccMtuneOk\r
347echo GCC supports -mtune=pentium4 >>config.log\r
348set mf=-mtune=pentium4\r
349rm -f junk.c junk.o\r
540c2a33
JB
350:gccdebug\r
351rem Check for DWARF-2 debug info support, else default to stabs\r
352echo main(){} >junk.c\r
353echo gcc -c -gdwarf-2 -g3 junk.c >>config.log\r
354gcc -c -gdwarf-2 -g3 junk.c >>config.log 2>&1\r
355if not errorlevel 1 goto gccdwarf\r
356echo The failed program was: >>config.log\r
357type junk.c >>config.log\r
358set dbginfo=-gstabs+\r
359rm -f junk.c junk.o\r
360goto compilercheckdone\r
361:gccdwarf\r
362echo GCC supports DWARF-2 >>config.log\r
363set dbginfo=-gdwarf-2 -g3\r
364rm -f junk.c junk.o\r
e0006538 365goto compilercheckdone\r
f466241d
EZ
366\r
367:clOk\r
368set COMPILER=cl\r
369rm -f junk.c junk.obj\r
370echo Using 'MSVC'\r
e0006538
JR
371\r
372:compilercheckdone\r
373\r
374rem ----------------------------------------------------------------------\r
375rem Check for external image libraries. Since they are loaded\r
376rem dynamically, the libraries themselves do not need to be present\r
377rem at compile time, but the header files are required.\r
378\r
112dc8e1
JR
379set mingwflag=\r
380\r
381if (%nocygwin%) == (N) goto flagsOK\r
382set mingwflag=-mno-cygwin\r
383\r
384:flagsOK\r
385\r
e0006538
JR
386if (%pngsupport%) == (N) goto pngDone\r
387\r
388echo Checking for libpng...\r
389echo #include "png.h" >junk.c\r
390echo main (){} >>junk.c\r
391rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
392echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
393%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
e0006538
JR
394if exist junk.obj goto havePng\r
395\r
507f5dce 396echo ...png.h not found, building without PNG support.\r
dbbdb507
EZ
397echo The failed program was: >>config.log\r
398type junk.c >>config.log\r
e0006538
JR
399set HAVE_PNG=\r
400goto :pngDone\r
401\r
402:havePng\r
403echo ...PNG header available, building with PNG support.\r
404set HAVE_PNG=1\r
405\r
406:pngDone\r
407rm -f junk.c junk.obj\r
f466241d 408\r
aad0eae4
JR
409if (%jpegsupport%) == (N) goto jpegDone\r
410\r
507f5dce 411echo Checking for jpeg-6b...\r
aad0eae4
JR
412echo #include "jconfig.h" >junk.c\r
413echo main (){} >>junk.c\r
414rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
415echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
416%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
aad0eae4
JR
417if exist junk.obj goto haveJpeg\r
418\r
507f5dce 419echo ...jconfig.h not found, building without JPEG support.\r
dbbdb507
EZ
420echo The failed program was: >>config.log\r
421type junk.c >>config.log\r
aad0eae4
JR
422set HAVE_JPEG=\r
423goto :jpegDone\r
424\r
425:haveJpeg\r
426echo ...JPEG header available, building with JPEG support.\r
427set HAVE_JPEG=1\r
428\r
429:jpegDone\r
430rm -f junk.c junk.obj\r
431\r
12ff2dc5
JB
432if (%gifsupport%) == (N) goto gifDone\r
433\r
507f5dce 434echo Checking for libgif...\r
12ff2dc5
JB
435echo #include "gif_lib.h" >junk.c\r
436echo main (){} >>junk.c\r
437rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
438echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
439%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
12ff2dc5
JB
440if exist junk.obj goto haveGif\r
441\r
507f5dce 442echo ...gif_lib.h not found, building without GIF support.\r
dbbdb507
EZ
443echo The failed program was: >>config.log\r
444type junk.c >>config.log\r
12ff2dc5
JB
445set HAVE_GIF=\r
446goto :gifDone\r
447\r
448:haveGif\r
449echo ...GIF header available, building with GIF support.\r
450set HAVE_GIF=1\r
451\r
452:gifDone\r
453rm -f junk.c junk.obj\r
454\r
47c01e80
JB
455if (%tiffsupport%) == (N) goto tiffDone\r
456\r
457echo Checking for tiff...\r
458echo #include "tiffio.h" >junk.c\r
459echo main (){} >>junk.c\r
460rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
461echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
462%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
47c01e80
JB
463if exist junk.obj goto haveTiff\r
464\r
507f5dce 465echo ...tiffio.h not found, building without TIFF support.\r
dbbdb507
EZ
466echo The failed program was: >>config.log\r
467type junk.c >>config.log\r
47c01e80
JB
468set HAVE_TIFF=\r
469goto :tiffDone\r
470\r
471:haveTiff\r
472echo ...TIFF header available, building with TIFF support.\r
473set HAVE_TIFF=1\r
474\r
475:tiffDone\r
476rm -f junk.c junk.obj\r
477\r
507f5dce
JR
478if (%xpmsupport%) == (N) goto xpmDone\r
479\r
480echo Checking for libXpm...\r
481echo #define FOR_MSW 1 >junk.c\r
482echo #include "X11/xpm.h" >>junk.c\r
483echo main (){} >>junk.c\r
484rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
485echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
486%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
507f5dce
JR
487if exist junk.obj goto haveXpm\r
488\r
489echo ...X11/xpm.h not found, building without XPM support.\r
dbbdb507
EZ
490echo The failed program was: >>config.log\r
491type junk.c >>config.log\r
507f5dce
JR
492set HAVE_XPM=\r
493goto :xpmDone\r
494\r
495:haveXpm\r
496echo ...XPM header available, building with XPM support.\r
497set HAVE_XPM=1\r
498\r
499:xpmDone\r
8bc63b1a
JR
500rm -f junk.c junk.obj\r
501\r
502if not (%svgsupport%) == (Y) goto :svgDone\r
503echo Checking for librsvg...\r
504echo #include "librsvg/rsvg.h" >junk.c\r
505echo main (){} >>junk.c\r
506rem -o option is ignored with cl, but allows result to be consistent.\r
507echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
508%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
509if exist junk.obj goto haveSvg\r
510\r
511echo ...librsvg/rsvg.h or dependencies not found, building without SVG support.\r
512echo The failed program was: >>config.log\r
513type junk.c >>config.log\r
514set HAVE_RSVG=\r
515goto :svgDone\r
516\r
517:haveSvg\r
518echo ...librsvg header available, building with SVG support (EXPERIMENTAL).\r
519set HAVE_RSVG=1\r
520\r
521:svgDone\r
507f5dce
JR
522rm -f junk.c junk.obj junk.err junk.out\r
523\r
f466241d
EZ
524rem ----------------------------------------------------------------------\r
525:genmakefiles\r
526echo Generating makefiles\r
527if %COMPILER% == gcc set MAKECMD=gmake\r
528if %COMPILER% == cl set MAKECMD=nmake\r
529\r
530rem Pass on chosen settings to makefiles.\r
531rem NB. Be very careful to not have a space before redirection symbols\r
532rem except when there is a preceding digit, when a space is required.\r
533rem\r
534echo # Start of settings from configure.bat >config.settings\r
535echo COMPILER=%COMPILER%>>config.settings\r
dbbdb507 536if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings\r
540c2a33 537if not "(%dbginfo%)" == "()" echo DEBUG_INFO=%dbginfo%>>config.settings\r
f466241d
EZ
538if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r
539if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r
7d0170c8 540if (%enablechecking%) == (Y) echo ENABLECHECKS=1 >>config.settings\r
75663c75 541if (%profile%) == (Y) echo PROFILE=1 >>config.settings\r
f466241d
EZ
542if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r
543if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings\r
3a1ebd63
EZ
544rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
545rem and the if command cannot cope with this\r
546for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
547if (%docflags%)==(Y) echo USER_CFLAGS=%usercflags%>>config.settings\r
548for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
549if (%doldflags%)==(Y) echo USER_LDFLAGS=%userldflags%>>config.settings\r
f466241d
EZ
550echo # End of settings from configure.bat>>config.settings\r
551echo. >>config.settings\r
552\r
c262c68c
EZ
553copy config.nt config.tmp\r
554echo. >>config.tmp\r
555echo /* Start of settings from configure.bat. */ >>config.tmp\r
3a1ebd63
EZ
556if (%docflags%) == (Y) echo #define USER_CFLAGS " %usercflags%">>config.tmp\r
557if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %userldflags%">>config.tmp\r
f179addc 558if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
c262c68c
EZ
559if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
560if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r
561if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r
562if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r
563if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp\r
8bc63b1a
JR
564if "(%HAVE_RSVG%)" == "(1)" echo #define HAVE_RSVG 1 >>config.tmp\r
565\r
c262c68c
EZ
566echo /* End of settings from configure.bat. */ >>config.tmp\r
567\r
568Rem See if fc.exe returns a meaningful exit status. If it does, we\r
569Rem might as well avoid unnecessary overwriting of config.h and epaths.h,\r
570Rem since this forces recompilation of every source file.\r
571if exist foo.bar del foo.bar\r
572fc /b foo.bar foo.bar >nul 2>&1\r
573if not errorlevel 2 goto doCopy\r
574fc /b config.tmp ..\src\config.h >nul 2>&1\r
575if errorlevel 1 goto doCopy\r
576fc /b paths.h ..\src\epaths.h >nul 2>&1\r
577if errorlevel 0 goto dontCopy\r
578:doCopy\r
579copy config.tmp ..\src\config.h\r
f466241d
EZ
580copy paths.h ..\src\epaths.h\r
581\r
c262c68c
EZ
582:dontCopy\r
583if exist config.tmp del config.tmp\r
f466241d 584copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
a392138f 585if exist ..\admin\unidata copy /b config.settings+%MAKECMD%.defs+..\admin\unidata\makefile.w32-in ..\admin\unidata\makefile\r
f466241d
EZ
586copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
587copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
8aee12d0
GM
588copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in ..\doc\emacs\makefile\r
589copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in ..\doc\misc\makefile\r
590copy /b config.settings+%MAKECMD%.defs+..\doc\lispref\makefile.w32-in ..\doc\lispref\makefile\r
591copy /b config.settings+%MAKECMD%.defs+..\doc\lispintro\makefile.w32-in ..\doc\lispintro\makefile\r
f466241d
EZ
592if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
593copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
594rem Use the default (no-op) Makefile.in if the nt version is not present.\r
595if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r
596if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
597del config.settings\r
598\r
e44f8099
EZ
599Rem Some people use WinZip which doesn't create empty directories!\r
600if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
57a64408
JB
601Rem Update subdirs.el only if it is different or fc.exe doesn't work.\r
602if exist foo.bar del foo.bar\r
603fc /b foo.bar foo.bar >nul 2>&1\r
604if not errorlevel 2 goto doUpdateSubdirs\r
605fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1\r
606if not errorlevel 1 goto dontUpdateSubdirs\r
607:doUpdateSubdirs\r
608if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el\r
609copy subdirs.el ..\site-lisp\subdirs.el\r
610\r
611:dontUpdateSubdirs\r
f466241d 612echo.\r
32154d10
JR
613\r
614rem check that we have all the libraries we need.\r
615set libsOK=1\r
616\r
617if not "(%HAVE_XPM%)" == "()" goto checkpng\r
618if (%xpmsupport%) == (N) goto checkpng\r
619 set libsOK=0\r
620 echo XPM support is missing. It is required for color icons in the toolbar.\r
621 echo Install libXpm development files or use --without-xpm\r
622\r
623:checkpng\r
624if not "(%HAVE_PNG%)" == "()" goto checkjpeg\r
625if (%pngsupport%) == (N) goto checkjpeg\r
626 set libsOK=0\r
627 echo PNG support is missing.\r
628 echo Install libpng development files or use --without-png\r
629\r
630:checkjpeg\r
631if not "(%HAVE_JPEG%)" == "()" goto checktiff\r
632if (%jpegsupport%) == (N) goto checktiff\r
633 set libsOK=0\r
634 echo JPEG support is missing.\r
635 echo Install jpeg development files or use --without-jpeg\r
636\r
637:checktiff\r
638if not "(%HAVE_TIFF%)" == "()" goto checkgif\r
639if (%tiffsupport%) == (N) goto checkgif\r
640 set libsOK=0\r
641 echo TIFF support is missing.\r
642 echo Install libtiff development files or use --without-tiff\r
643\r
644:checkgif\r
645if not "(%HAVE_GIF%)" == "()" goto donelibchecks\r
646if (%gifsupport%) == (N) goto donelibchecks\r
647 set libsOK=0\r
648 echo GIF support is missing.\r
649 echo Install giflib or libungif development files or use --without-gif\r
650\r
651:donelibchecks\r
652if (%libsOK%) == (1) goto success\r
653echo.\r
654echo Important libraries are missing. Fix these issues before running make.\r
655goto end\r
656\r
657:success\r
f466241d 658echo Emacs successfully configured.\r
a27014fc 659echo Emacs successfully configured. >>config.log\r
361823f4 660if (%MAKECMD%) == (gmake) set MAKECMD=make\r
f466241d
EZ
661echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
662goto end\r
663\r
664:SmallEnv\r
665echo Your environment size is too small. Please enlarge it and rerun configure.\r
666echo For example, type "command.com /e:2048" to have 2048 bytes available.\r
667set $foo$=\r
668:end\r
669set prefix=\r
670set nodebug=\r
671set noopt=\r
7d0170c8 672set enablechecking=\r
75663c75 673set profile=\r
f466241d
EZ
674set nocygwin=\r
675set COMPILER=\r
676set MAKECMD=\r
677set usercflags=\r
3a1ebd63 678set docflags=\r
f466241d 679set userldflags=\r
3a1ebd63 680set doldflags=\r
112dc8e1 681set mingwflag=\r
dbbdb507 682set mf=\r
a2fcf029
MB
683\r
684goto skipArchTag\r
685 arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c\r
686:skipArchTag\r