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