deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150)
[bpt/emacs.git] / nt / configure.bat
CommitLineData
f466241d
EZ
1@echo off\r
2rem ----------------------------------------------------------------------\r
ee705a5c 3rem Configuration script for MS Windows operating systems\r
acaf905b 4rem Copyright (C) 1999-2012 Free Software Foundation, Inc.\r
f466241d
EZ
5\r
6rem This file is part of GNU Emacs.\r
7\r
eef0be9e 8rem GNU Emacs is free software: you can redistribute it and/or modify\r
f466241d 9rem it under the terms of the GNU General Public License as published by\r
eef0be9e
GM
10rem the Free Software Foundation, either version 3 of the License, or\r
11rem (at your option) any later version.\r
f466241d
EZ
12\r
13rem GNU Emacs is distributed in the hope that it will be useful,\r
14rem but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
16rem GNU General Public License for more details.\r
17\r
18rem You should have received a copy of the GNU General Public License\r
eef0be9e
GM
19rem along with GNU Emacs. If not, see http://www.gnu.org/licenses/.\r
20\r
f466241d
EZ
21rem ----------------------------------------------------------------------\r
22rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r
23rem\r
ee705a5c 24rem + MS Windows 95, NT or later\r
361823f4 25rem + either MSVC 2.x or later, or gcc-2.95 or later (with GNU make 3.75\r
56a469c3
EZ
26rem or later) and the Mingw32 and W32 API headers and libraries.\r
27rem + Visual Studio 2005 is not supported at this time.\r
f466241d 28rem\r
361823f4 29rem For reference, here is a list of which builds of GNU make are known to\r
f466241d
EZ
30rem work or not, and whether they work in the presence and/or absence of\r
31rem sh.exe.\r
7019fb66 32rem\r
f466241d 33rem sh exists no sh\r
56a469c3 34rem cygwin b20.1 make (3.75): fails[1,5] fails[2,5]\r
f466241d
EZ
35rem MSVC compiled gmake 3.77: okay okay\r
36rem MSVC compiled gmake 3.78.1: okay okay\r
37rem MSVC compiled gmake 3.79.1: okay okay\r
56a469c3
EZ
38rem mingw32/gcc-2.92.2 make (3.77): okay okay[4]\r
39rem cygwin compiled gmake 3.77: fails[1,5] fails[2,5]\r
40rem cygwin compiled gmake 3.78.1: fails[5] fails[2,5]\r
41rem cygwin compiled gmake 3.79.1: fails[3,5] fails[2?,5]\r
17f55fae
EZ
42rem cygwin compiled make 3.80: okay[6] fails?[7]\r
43rem cygwin compiled make 3.81: fails fails?[7]\r
56a469c3 44rem mingw32 compiled make 3.79.1: okay okay\r
17f55fae
EZ
45rem mingw32 compiled make 3.80: okay okay?[7]\r
46rem mingw32 compiled make 3.81: okay okay[8]\r
f466241d
EZ
47rem\r
48rem [1] doesn't cope with makefiles with DOS line endings, so must mount\r
49rem emacs source with text!=binary.\r
50rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.\r
56a469c3
EZ
51rem [3] requires LC_MESSAGES support to build; cannot build with early\r
52rem versions of cygwin.\r
53rem [4] may fail on Windows 9X and Windows ME; if so, install Bash.\r
54rem [5] fails when building leim due to the use of cygwin style paths.\r
55rem May work if building emacs without leim.\r
17f55fae
EZ
56rem [6] need to uncomment 3 lines in nt/gmake.defs that invoke `cygpath';\r
57rem look for "cygpath" near line 85 of gmake.defs.\r
58rem [7] not recommended; please report if you try this combination.\r
59rem [8] tested only on Windows XP.\r
f466241d
EZ
60rem\r
61\r
dbbdb507
EZ
62if exist config.log del config.log\r
63\r
f466241d
EZ
64rem ----------------------------------------------------------------------\r
65rem See if the environment is large enough. We need 43 (?) bytes.\r
66set $foo$=123456789_123456789_123456789_123456789_123\r
67if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv\r
68set $foo$=\r
69\r
70rem ----------------------------------------------------------------------\r
71rem Make sure we are running in the nt subdir\r
72if exist configure.bat goto start\r
73echo You must run configure from the nt subdirectory.\r
74goto end\r
75\r
76:start\r
4a1a6b5b
BK
77rem ----------------------------------------------------------------------\r
78rem Attempt to enable command extensions. Set use_extensions to 1 if\r
79rem they are available and 0 if they are not available.\r
80set use_extensions=1\r
81setlocal ENABLEEXTENSIONS\r
82if "%CMDEXTVERSION%" == "" set use_extensions=0\r
83if "%use_extensions%" == "1" goto afterext\r
84\r
85echo. Command extensions are not available. Using parameters that include the =\r
86echo. character by enclosing them in quotes will not be supported.\r
87\r
88:afterext\r
89\r
f466241d
EZ
90rem ----------------------------------------------------------------------\r
91rem Default settings.\r
92set prefix=\r
93set nodebug=N\r
94set noopt=N\r
7d0170c8 95set enablechecking=N\r
75663c75 96set profile=N\r
f466241d
EZ
97set nocygwin=N\r
98set COMPILER=\r
99set usercflags=\r
4d3fcc8e 100set escusercflags=\r
3a1ebd63 101set docflags=\r
f466241d 102set userldflags=\r
4d3fcc8e 103set escuserldflags=\r
fd4af8d9 104set extrauserlibs=\r
3a1ebd63 105set doldflags=\r
fd4af8d9 106set doextralibs=\r
f466241d
EZ
107set sep1=\r
108set sep2=\r
e3aef5c6 109set sep3=\r
fd4af8d9 110set sep4=\r
e3aef5c6 111set distfiles=\r
f466241d
EZ
112\r
113rem ----------------------------------------------------------------------\r
114rem Handle arguments.\r
115:again\r
116if "%1" == "-h" goto usage\r
117if "%1" == "--help" goto usage\r
118if "%1" == "--prefix" goto setprefix\r
119if "%1" == "--with-gcc" goto withgcc\r
120if "%1" == "--with-msvc" goto withmsvc\r
121if "%1" == "--no-debug" goto nodebug\r
122if "%1" == "--no-opt" goto noopt\r
7d0170c8 123if "%1" == "--enable-checking" goto enablechecking\r
75663c75 124if "%1" == "--profile" goto profile\r
f466241d
EZ
125if "%1" == "--no-cygwin" goto nocygwin\r
126if "%1" == "--cflags" goto usercflags\r
127if "%1" == "--ldflags" goto userldflags\r
fd4af8d9 128if "%1" == "--lib" goto extrauserlibs\r
e0006538 129if "%1" == "--without-png" goto withoutpng\r
aad0eae4 130if "%1" == "--without-jpeg" goto withoutjpeg\r
12ff2dc5 131if "%1" == "--without-gif" goto withoutgif\r
47c01e80 132if "%1" == "--without-tiff" goto withouttiff\r
fd4af8d9 133if "%1" == "--without-gnutls" goto withoutgnutls\r
9078ead6 134if "%1" == "--without-libxml2" goto withoutlibxml2\r
507f5dce 135if "%1" == "--without-xpm" goto withoutxpm\r
8bc63b1a 136if "%1" == "--with-svg" goto withsvg\r
e3aef5c6 137if "%1" == "--distfiles" goto distfiles\r
f466241d 138if "%1" == "" goto checkutils\r
ee705a5c 139\r
f466241d
EZ
140:usage\r
141echo Usage: configure [options]\r
142echo Options:\r
143echo. --prefix PREFIX install Emacs in directory PREFIX\r
144echo. --with-gcc use GCC to compile Emacs\r
145echo. --with-msvc use MSVC to compile Emacs\r
146echo. --no-debug exclude debug info from executables\r
147echo. --no-opt disable optimization\r
0566bc95 148echo. --enable-checking enable additional run-time checks\r
75663c75 149echo. --profile enable profiling\r
f466241d
EZ
150echo. --no-cygwin use -mno-cygwin option with GCC\r
151echo. --cflags FLAG pass FLAG to compiler\r
152echo. --ldflags FLAG pass FLAG to compiler when linking\r
fd4af8d9 153echo. --lib LIB link to extra library LIB\r
f01e03d3
JB
154echo. --without-png do not use PNG library even if it is installed\r
155echo. --without-jpeg do not use JPEG library even if it is installed\r
156echo. --without-gif do not use GIF library even if it is installed\r
157echo. --without-tiff do not use TIFF library even if it is installed\r
158echo. --without-xpm do not use XPM library even if it is installed\r
e9fce1ac 159echo. --without-gnutls do not use GnuTLS library even if it is installed\r
9078ead6 160echo. --without-libxml2 do not use libxml2 library even if it is installed\r
8d67bc8e 161echo. --with-svg use the RSVG library (experimental)\r
e3aef5c6 162echo. --distfiles path to files for make dist, e.g. libXpm.dll\r
4a1a6b5b
BK
163if "%use_extensions%" == "0" goto end\r
164echo.\r
165echo. The cflags and ldflags arguments support parameters that include the =\r
166echo. character. However, since the = character is normally treated as a\r
167echo. separator character you will need to enclose any parameter that includes\r
168echo. the = character in quotes. For example, to include\r
169echo. -DSITELOAD_PURESIZE_EXTRA=100000 as one of the cflags you would run\r
170echo. configure.bat as follows:\r
171echo. configure.bat --cflags "-DSITELOAD_PURESIZE_EXTRA=100000"\r
172echo.\r
173echo. Note that this capability of processing parameters that include the =\r
174echo. character depends on command extensions. This batch file attempts to\r
175echo. enable command extensions. If command extensions cannot be enabled, a\r
176echo. warning message will be displayed.\r
f466241d 177goto end\r
ee705a5c 178\r
f466241d 179rem ----------------------------------------------------------------------\r
ee705a5c 180\r
f466241d
EZ
181:setprefix\r
182shift\r
183set prefix=%1\r
184shift\r
185goto again\r
ee705a5c 186\r
f466241d 187rem ----------------------------------------------------------------------\r
ee705a5c 188\r
f466241d
EZ
189:withgcc\r
190set COMPILER=gcc\r
191shift\r
192goto again\r
ee705a5c 193\r
f466241d 194rem ----------------------------------------------------------------------\r
ee705a5c 195\r
f466241d
EZ
196:withmsvc\r
197set COMPILER=cl\r
198shift\r
199goto again\r
ee705a5c 200\r
f466241d 201rem ----------------------------------------------------------------------\r
ee705a5c 202\r
f466241d
EZ
203:nodebug\r
204set nodebug=Y\r
205shift\r
206goto again\r
ee705a5c 207\r
f466241d 208rem ----------------------------------------------------------------------\r
ee705a5c 209\r
f466241d
EZ
210:noopt\r
211set noopt=Y\r
212shift\r
213goto again\r
ee705a5c 214\r
f466241d 215rem ----------------------------------------------------------------------\r
ee705a5c 216\r
7d0170c8
JB
217:enablechecking\r
218set enablechecking=Y\r
219shift\r
220goto again\r
ee705a5c 221\r
7d0170c8 222rem ----------------------------------------------------------------------\r
ee705a5c 223\r
75663c75
JR
224:profile\r
225set profile=Y\r
226shift\r
227goto again\r
ee705a5c 228\r
75663c75 229rem ----------------------------------------------------------------------\r
ee705a5c 230\r
f466241d
EZ
231:nocygwin\r
232set nocygwin=Y\r
233shift\r
234goto again\r
ee705a5c 235\r
f466241d 236rem ----------------------------------------------------------------------\r
ee705a5c 237\r
f466241d 238:usercflags\r
4a1a6b5b
BK
239if "%use_extensions%" == "1" goto ucflagex\r
240goto ucflagne\r
241\r
242:ucflagex\r
243shift\r
244set usercflags=%usercflags%%sep1%%~1\r
4d3fcc8e 245set escusercflags=%usercflags:"=\"%\r
4a1a6b5b
BK
246set sep1= %nothing%\r
247shift\r
248goto again\r
249\r
250:ucflagne\r
f466241d
EZ
251shift\r
252set usercflags=%usercflags%%sep1%%1\r
4d3fcc8e 253set escusercflags=%usercflags%\r
f466241d
EZ
254set sep1= %nothing%\r
255shift\r
256goto again\r
ee705a5c 257\r
fd4af8d9
TZ
258:extrauserlibs\r
259shift\r
260echo. extrauserlibs: %extrauserlibs%\r
261set extrauserlibs=%extrauserlibs%%sep4%%1\r
262set sep4= %nothing%\r
263shift\r
264goto again\r
265\r
f466241d 266rem ----------------------------------------------------------------------\r
ee705a5c 267\r
f466241d 268:userldflags\r
4a1a6b5b
BK
269if "%use_extensions%" == "1" goto ulflagex\r
270goto ulflagne\r
271\r
272:ulflagex\r
273shift\r
274set userldflags=%userldflags%%sep2%%~1\r
4d3fcc8e 275set escuserldflags=%userldflags:"=\"%\r
4a1a6b5b
BK
276set sep2= %nothing%\r
277shift\r
278goto again\r
279\r
280:ulflagne\r
f466241d
EZ
281shift\r
282set userldflags=%userldflags%%sep2%%1\r
4d3fcc8e 283set escuserldflags=%userldflags%\r
f466241d
EZ
284set sep2= %nothing%\r
285shift\r
286goto again\r
ee705a5c 287\r
e0006538
JR
288rem ----------------------------------------------------------------------\r
289\r
290:withoutpng\r
291set pngsupport=N\r
292set HAVE_PNG=\r
39bd0e03 293shift\r
e0006538 294goto again\r
f466241d 295\r
aad0eae4
JR
296rem ----------------------------------------------------------------------\r
297\r
298:withoutjpeg\r
299set jpegsupport=N\r
300set HAVE_JPEG=\r
39bd0e03 301shift\r
aad0eae4
JR
302goto again\r
303\r
12ff2dc5
JB
304rem ----------------------------------------------------------------------\r
305\r
306:withoutgif\r
307set gifsupport=N\r
308set HAVE_GIF=\r
309shift\r
310goto again\r
311\r
47c01e80
JB
312rem ----------------------------------------------------------------------\r
313\r
fd4af8d9
TZ
314:withoutgnutls\r
315set tlssupport=N\r
316set HAVE_GNUTLS=\r
317shift\r
318goto again\r
319\r
320rem ----------------------------------------------------------------------\r
321\r
9078ead6
EZ
322:withoutlibxml2\r
323set libxml2support=N\r
324set HAVE_LIBXML2=\r
325shift\r
326goto again\r
327\r
328rem ----------------------------------------------------------------------\r
329\r
47c01e80
JB
330:withouttiff\r
331set tiffsupport=N\r
332set HAVE_TIFF=\r
333shift\r
334goto again\r
335\r
507f5dce
JR
336rem ----------------------------------------------------------------------\r
337\r
338:withoutxpm\r
339set xpmsupport=N\r
340set HAVE_XPM=\r
341shift\r
342goto again\r
343\r
8bc63b1a
JR
344:withsvg\r
345shift\r
346set svgsupport=Y\r
347goto again\r
348\r
e3aef5c6
CS
349rem ----------------------------------------------------------------------\r
350\r
351:distfiles\r
352set HAVE_DISTFILES=1\r
353shift\r
354set distfiles=%distfiles%%sep3%%1\r
355set sep3= %nothing%\r
356shift\r
357goto again\r
358\r
f466241d
EZ
359rem ----------------------------------------------------------------------\r
360rem Check that necessary utilities (cp and rm) are present.\r
ee705a5c 361\r
f466241d
EZ
362:checkutils\r
363echo Checking for 'cp'...\r
364cp configure.bat junk.bat\r
365if not exist junk.bat goto needcp\r
366echo Checking for 'rm'...\r
367rm junk.bat\r
368if exist junk.bat goto needrm\r
369goto checkcompiler\r
ee705a5c 370\r
f466241d
EZ
371:needcp\r
372echo You need 'cp' (the Unix file copy program) to build Emacs.\r
373goto end\r
ee705a5c 374\r
f466241d
EZ
375:needrm\r
376del junk.bat\r
377echo You need 'rm' (the Unix file delete program) to build Emacs.\r
378goto end\r
379\r
380rem ----------------------------------------------------------------------\r
381rem Auto-detect compiler if not specified, and validate GCC if chosen.\r
ee705a5c 382\r
f466241d 383:checkcompiler\r
e0006538 384if (%COMPILER%)==(cl) goto compilercheckdone\r
f466241d
EZ
385if (%COMPILER%)==(gcc) goto checkgcc\r
386\r
f466241d 387echo Checking whether 'gcc' is available...\r
680d641f 388echo main(){} >junk.c\r
f466241d 389gcc -c junk.c\r
680d641f 390if exist junk.o goto checkgcc\r
f466241d 391\r
680d641f
JR
392echo Checking whether 'cl' is available...\r
393cl -nologo -c junk.c\r
394if exist junk.obj goto clOK\r
395goto nocompiler\r
396\r
f466241d 397:checkgcc\r
1046da1c 398if exist junk.o del junk.o\r
f466241d
EZ
399Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
400Rem 8 characters of a label. So do NOT be tempted to change\r
401Rem chkapi* into something fancier like checkw32api\r
402Rem You HAVE been warned!\r
1046da1c 403if (%nocygwin%) == (Y) goto chkapiN\r
f466241d
EZ
404echo Checking whether gcc requires '-mno-cygwin'...\r
405echo #include "cygwin/version.h" >junk.c\r
406echo main(){} >>junk.c\r
dbbdb507
EZ
407echo gcc -c junk.c >>config.log\r
408gcc -c junk.c >>config.log 2>&1\r
f466241d 409if not exist junk.o goto chkapi\r
dbbdb507
EZ
410echo gcc -mno-cygwin -c junk.c >>config.log\r
411gcc -mno-cygwin -c junk.c >>config.log 2>&1\r
f466241d 412if exist junk.o set nocygwin=Y\r
f466241d
EZ
413\r
414:chkapi\r
dbbdb507
EZ
415echo The failed program was: >>config.log\r
416type junk.c >>config.log\r
ee705a5c 417\r
1046da1c
EZ
418:chkapiN\r
419rm -f junk.c junk.o\r
f466241d
EZ
420rem ----------------------------------------------------------------------\r
421rem Older versions of the Windows API headers either don't have any of\r
422rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
423rem are like this), or have a typo in the definition of\r
424rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r
425rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros\r
426rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
892508a4 427rem Beginning with Emacs 23, we need usp10.h.\r
f466241d
EZ
428rem\r
429echo Checking whether W32 API headers are too old...\r
430echo #include "windows.h" >junk.c\r
892508a4 431echo #include "usp10.h" >>junk.c\r
f466241d
EZ
432echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
433echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
434if (%nocygwin%) == (Y) goto chkapi1\r
435set cf=%usercflags%\r
436goto chkapi2\r
ee705a5c 437\r
f466241d
EZ
438:chkapi1\r
439set cf=%usercflags% -mno-cygwin\r
ee705a5c 440\r
f466241d
EZ
441:chkapi2\r
442echo on\r
443gcc %cf% -c junk.c\r
dbbdb507
EZ
444@echo off\r
445@echo gcc %cf% -c junk.c >>config.log\r
446gcc %cf% -c junk.c >>config.log 2>&1\r
f466241d 447set cf=\r
05212154 448if exist junk.o goto chkuser\r
dbbdb507
EZ
449echo The failed program was: >>config.log\r
450type junk.c >>config.log\r
05212154
JB
451goto nocompiler\r
452\r
453:chkuser\r
454rm -f junk.o\r
455echo int main (int argc, char *argv[]) {>junk.c\r
4d3fcc8e 456echo char *usercflags = "%escusercflags%";>>junk.c\r
05212154
JB
457echo }>>junk.c\r
458echo gcc -Werror -c junk.c >>config.log\r
459gcc -Werror -c junk.c >>config.log 2>&1\r
460if exist junk.o goto gccOk\r
461echo.\r
462echo Error in --cflags argument: %usercflags%\r
463echo Backslashes and quotes cannot be used with --cflags. Please use forward\r
464echo slashes for filenames and paths (e.g. when passing directories to -I).\r
465rm -f junk.c\r
466goto end\r
f466241d
EZ
467\r
468:nocompiler\r
469echo.\r
470echo Configure failed.\r
471echo To configure Emacs for Windows, you need to have either\r
472echo gcc-2.95 or later with Mingw32 and the W32 API headers,\r
473echo or MSVC 2.x or later.\r
474del junk.c\r
475goto end\r
476\r
477:gccOk\r
478set COMPILER=gcc\r
f466241d 479echo Using 'gcc'\r
dbbdb507
EZ
480rm -f junk.c junk.o\r
481Rem It is not clear what GCC version began supporting -mtune\r
482Rem and pentium4 on x86, so check this explicitly.\r
483echo main(){} >junk.c\r
484echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log\r
485gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1\r
486if not errorlevel 1 goto gccMtuneOk\r
487echo The failed program was: >>config.log\r
488type junk.c >>config.log\r
489set mf=-mcpu=i686\r
490rm -f junk.c junk.o\r
540c2a33 491goto gccdebug\r
ee705a5c 492\r
dbbdb507
EZ
493:gccMtuneOk\r
494echo GCC supports -mtune=pentium4 >>config.log\r
495set mf=-mtune=pentium4\r
496rm -f junk.c junk.o\r
ee705a5c 497\r
540c2a33
JB
498:gccdebug\r
499rem Check for DWARF-2 debug info support, else default to stabs\r
500echo main(){} >junk.c\r
501echo gcc -c -gdwarf-2 -g3 junk.c >>config.log\r
502gcc -c -gdwarf-2 -g3 junk.c >>config.log 2>&1\r
503if not errorlevel 1 goto gccdwarf\r
504echo The failed program was: >>config.log\r
505type junk.c >>config.log\r
506set dbginfo=-gstabs+\r
507rm -f junk.c junk.o\r
508goto compilercheckdone\r
ee705a5c 509\r
540c2a33
JB
510:gccdwarf\r
511echo GCC supports DWARF-2 >>config.log\r
512set dbginfo=-gdwarf-2 -g3\r
513rm -f junk.c junk.o\r
e0006538 514goto compilercheckdone\r
f466241d
EZ
515\r
516:clOk\r
517set COMPILER=cl\r
518rm -f junk.c junk.obj\r
519echo Using 'MSVC'\r
e0006538
JR
520\r
521:compilercheckdone\r
522\r
523rem ----------------------------------------------------------------------\r
524rem Check for external image libraries. Since they are loaded\r
525rem dynamically, the libraries themselves do not need to be present\r
526rem at compile time, but the header files are required.\r
527\r
112dc8e1
JR
528set mingwflag=\r
529\r
530if (%nocygwin%) == (N) goto flagsOK\r
531set mingwflag=-mno-cygwin\r
532\r
533:flagsOK\r
534\r
e0006538
JR
535if (%pngsupport%) == (N) goto pngDone\r
536\r
537echo Checking for libpng...\r
538echo #include "png.h" >junk.c\r
539echo main (){} >>junk.c\r
540rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
541echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
542%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
e0006538
JR
543if exist junk.obj goto havePng\r
544\r
507f5dce 545echo ...png.h not found, building without PNG support.\r
dbbdb507
EZ
546echo The failed program was: >>config.log\r
547type junk.c >>config.log\r
e0006538
JR
548set HAVE_PNG=\r
549goto :pngDone\r
550\r
551:havePng\r
552echo ...PNG header available, building with PNG support.\r
553set HAVE_PNG=1\r
554\r
555:pngDone\r
556rm -f junk.c junk.obj\r
f466241d 557\r
fd4af8d9
TZ
558if (%tlssupport%) == (N) goto tlsDone\r
559\r
560rem this is a copy of the PNG detection\r
561echo Checking for libgnutls...\r
562echo #include "gnutls/gnutls.h" >junk.c\r
563echo main (){} >>junk.c\r
564rem -o option is ignored with cl, but allows result to be consistent.\r
565echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
566%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
567if exist junk.obj goto haveTls\r
568\r
569echo ...gnutls.h not found, building without TLS support.\r
570echo The failed program was: >>config.log\r
571type junk.c >>config.log\r
572set HAVE_GNUTLS=\r
573goto :tlsDone\r
574\r
575:haveTls\r
e9fce1ac 576echo ...GnuTLS header available, building with GnuTLS support.\r
fd4af8d9
TZ
577set HAVE_GNUTLS=1\r
578\r
579:tlsDone\r
580rm -f junk.c junk.obj\r
581\r
9078ead6
EZ
582if (%libxml2support%) == (N) goto xml2Done\r
583\r
584echo Checking for libxml2....\r
585echo #include "libxml/HTMLparser.h" >junk.c\r
586echo main(){} >>junk.c\r
587echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
588%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
589if exist junk.obj goto havelibxml2\r
590\r
591echo ...libxml/HTMLparser.h not found, building without libxml2 support\r
592echo The failed program was: >>config.log\r
593type junk.c >>config.log\r
594set HAVE_LIBXML2=\r
595goto xml2Done\r
596\r
597:havelibxml2\r
598echo ...libxml2 header available, building with libxml2 support\r
599set HAVE_LIBXML2=1\r
600\r
601:xml2Done\r
602rm -f junk.c junk.obj\r
603\r
aad0eae4
JR
604if (%jpegsupport%) == (N) goto jpegDone\r
605\r
507f5dce 606echo Checking for jpeg-6b...\r
aad0eae4
JR
607echo #include "jconfig.h" >junk.c\r
608echo main (){} >>junk.c\r
609rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
610echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
611%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
aad0eae4
JR
612if exist junk.obj goto haveJpeg\r
613\r
507f5dce 614echo ...jconfig.h not found, building without JPEG support.\r
dbbdb507
EZ
615echo The failed program was: >>config.log\r
616type junk.c >>config.log\r
aad0eae4
JR
617set HAVE_JPEG=\r
618goto :jpegDone\r
619\r
620:haveJpeg\r
621echo ...JPEG header available, building with JPEG support.\r
622set HAVE_JPEG=1\r
623\r
624:jpegDone\r
625rm -f junk.c junk.obj\r
626\r
12ff2dc5
JB
627if (%gifsupport%) == (N) goto gifDone\r
628\r
507f5dce 629echo Checking for libgif...\r
12ff2dc5
JB
630echo #include "gif_lib.h" >junk.c\r
631echo main (){} >>junk.c\r
632rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
633echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
634%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
12ff2dc5
JB
635if exist junk.obj goto haveGif\r
636\r
507f5dce 637echo ...gif_lib.h not found, building without GIF support.\r
dbbdb507
EZ
638echo The failed program was: >>config.log\r
639type junk.c >>config.log\r
12ff2dc5
JB
640set HAVE_GIF=\r
641goto :gifDone\r
642\r
643:haveGif\r
644echo ...GIF header available, building with GIF support.\r
645set HAVE_GIF=1\r
646\r
647:gifDone\r
648rm -f junk.c junk.obj\r
649\r
47c01e80
JB
650if (%tiffsupport%) == (N) goto tiffDone\r
651\r
652echo Checking for tiff...\r
653echo #include "tiffio.h" >junk.c\r
654echo main (){} >>junk.c\r
655rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
656echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
657%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
47c01e80
JB
658if exist junk.obj goto haveTiff\r
659\r
507f5dce 660echo ...tiffio.h not found, building without TIFF support.\r
dbbdb507
EZ
661echo The failed program was: >>config.log\r
662type junk.c >>config.log\r
47c01e80
JB
663set HAVE_TIFF=\r
664goto :tiffDone\r
665\r
666:haveTiff\r
667echo ...TIFF header available, building with TIFF support.\r
668set HAVE_TIFF=1\r
669\r
670:tiffDone\r
671rm -f junk.c junk.obj\r
672\r
507f5dce
JR
673if (%xpmsupport%) == (N) goto xpmDone\r
674\r
675echo Checking for libXpm...\r
676echo #define FOR_MSW 1 >junk.c\r
677echo #include "X11/xpm.h" >>junk.c\r
678echo main (){} >>junk.c\r
679rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
680echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
681%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
507f5dce
JR
682if exist junk.obj goto haveXpm\r
683\r
684echo ...X11/xpm.h not found, building without XPM support.\r
dbbdb507
EZ
685echo The failed program was: >>config.log\r
686type junk.c >>config.log\r
507f5dce
JR
687set HAVE_XPM=\r
688goto :xpmDone\r
689\r
690:haveXpm\r
691echo ...XPM header available, building with XPM support.\r
692set HAVE_XPM=1\r
693\r
694:xpmDone\r
8bc63b1a
JR
695rm -f junk.c junk.obj\r
696\r
697if not (%svgsupport%) == (Y) goto :svgDone\r
698echo Checking for librsvg...\r
699echo #include "librsvg/rsvg.h" >junk.c\r
700echo main (){} >>junk.c\r
701rem -o option is ignored with cl, but allows result to be consistent.\r
702echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
703%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
704if exist junk.obj goto haveSvg\r
705\r
706echo ...librsvg/rsvg.h or dependencies not found, building without SVG support.\r
707echo The failed program was: >>config.log\r
708type junk.c >>config.log\r
709set HAVE_RSVG=\r
710goto :svgDone\r
711\r
712:haveSvg\r
713echo ...librsvg header available, building with SVG support (EXPERIMENTAL).\r
714set HAVE_RSVG=1\r
715\r
716:svgDone\r
507f5dce
JR
717rm -f junk.c junk.obj junk.err junk.out\r
718\r
e3aef5c6
CS
719rem Any distfiles provided for building distribution? If no, we're done.\r
720if "(%HAVE_DISTFILES%)"=="()" goto :distFilesDone\r
721\r
722rem Any arguments to --distfiles specified? If no, we're done.\r
723if not "%distfiles%"=="" goto :checkDistFiles\r
724set distFilesOk=0\r
725echo No arguments specified for option --distfiles!\r
726goto distfilesDone\r
727\r
728:checkDistFiles\r
729echo Checking for distfiles...\r
730rem Check if all specified distfiles exist\r
731set fileNotFound=\r
732for %%d in (%distfiles%) do if not exist %%d set fileNotFound=%%d\r
733if not "%fileNotFound%"=="" goto distFilesNotFound\r
734\r
735set distFilesOK=1\r
736echo ...all distfiles found.\r
737goto :distFilesDone\r
738\r
739:distFilesNotFound\r
740set distFilesOk=0\r
741echo ...%fileNotFound% not found.\r
742set distfiles=\r
743goto :distfilesDone\r
744\r
745:distFilesDone\r
746set fileNotFound=\r
747\r
f466241d 748rem ----------------------------------------------------------------------\r
ee705a5c 749\r
f466241d
EZ
750:genmakefiles\r
751echo Generating makefiles\r
752if %COMPILER% == gcc set MAKECMD=gmake\r
753if %COMPILER% == cl set MAKECMD=nmake\r
754\r
755rem Pass on chosen settings to makefiles.\r
f466241d 756rem\r
e383e32d
EZ
757rem The weird place we put the redirection is to make sure no extra\r
758rem whitespace winds up at the end of the Make variables, since some\r
759rem variables, e.g. INSTALL_DIR, cannot stand that. Yes, echo will\r
760rem write the blanks between the end of command arguments and the\r
761rem redirection symbol to the file. OTOH, we cannot put the\r
762rem redirection immediately after the last character of the command,\r
763rem because environment variable expansion can yield a digit there,\r
764rem which will then be misinterpreted as the file descriptor to\r
765rem redirect...\r
f466241d 766echo # Start of settings from configure.bat >config.settings\r
e383e32d
EZ
767>>config.settings echo COMPILER=%COMPILER%\r
768if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%\r
769if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%\r
770if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1\r
771if (%noopt%) == (Y) >>config.settings echo NOOPT=1\r
e383e32d
EZ
772if (%profile%) == (Y) >>config.settings echo PROFILE=1\r
773if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1\r
774if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%\r
775if not "(%distfiles%)" == "()" >>config.settings echo DIST_FILES=%distfiles%\r
3a1ebd63
EZ
776rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
777rem and the if command cannot cope with this\r
778for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
e383e32d
EZ
779if (%docflags%)==(Y) >>config.settings echo USER_CFLAGS=%usercflags%\r
780if (%docflags%)==(Y) >>config.settings echo ESC_USER_CFLAGS=%escusercflags%\r
3a1ebd63 781for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
e383e32d 782if (%doldflags%)==(Y) >>config.settings echo USER_LDFLAGS=%userldflags%\r
fd4af8d9 783for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
e383e32d 784if (%doextralibs%)==(Y) >>config.settings echo USER_LIBS=%extrauserlibs%\r
f466241d
EZ
785echo # End of settings from configure.bat>>config.settings\r
786echo. >>config.settings\r
787\r
c262c68c
EZ
788copy config.nt config.tmp\r
789echo. >>config.tmp\r
790echo /* Start of settings from configure.bat. */ >>config.tmp\r
8f978ca0
JB
791rem We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify\r
792rem processing of compiler options in w32.c:get_emacs_configuration_options\r
ce128722
EZ
793if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%" >>config.tmp\r
794if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%" >>config.tmp\r
f179addc 795if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
0566bc95 796if (%enablechecking%) == (Y) echo #define ENABLE_CHECKING 1 >>config.tmp\r
c262c68c 797if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
fd4af8d9 798if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp\r
9078ead6 799if not "(%HAVE_LIBXML2%)" == "()" echo #define HAVE_LIBXML2 1 >>config.tmp\r
c262c68c
EZ
800if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r
801if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r
802if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r
803if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp\r
8bc63b1a
JR
804if "(%HAVE_RSVG%)" == "(1)" echo #define HAVE_RSVG 1 >>config.tmp\r
805\r
c262c68c
EZ
806echo /* End of settings from configure.bat. */ >>config.tmp\r
807\r
808Rem See if fc.exe returns a meaningful exit status. If it does, we\r
809Rem might as well avoid unnecessary overwriting of config.h and epaths.h,\r
810Rem since this forces recompilation of every source file.\r
811if exist foo.bar del foo.bar\r
812fc /b foo.bar foo.bar >nul 2>&1\r
813if not errorlevel 2 goto doCopy\r
814fc /b config.tmp ..\src\config.h >nul 2>&1\r
815if errorlevel 1 goto doCopy\r
816fc /b paths.h ..\src\epaths.h >nul 2>&1\r
252b4f5c 817if not errorlevel 1 goto dontCopy\r
ee705a5c 818\r
c262c68c
EZ
819:doCopy\r
820copy config.tmp ..\src\config.h\r
f466241d
EZ
821copy paths.h ..\src\epaths.h\r
822\r
c262c68c
EZ
823:dontCopy\r
824if exist config.tmp del config.tmp\r
f466241d 825copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
a392138f 826if exist ..\admin\unidata copy /b config.settings+%MAKECMD%.defs+..\admin\unidata\makefile.w32-in ..\admin\unidata\makefile\r
f466241d 827copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
f915f0f7 828copy /b config.settings+%MAKECMD%.defs+..\lib\makefile.w32-in ..\lib\makefile\r
f466241d 829copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
8aee12d0
GM
830copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in ..\doc\emacs\makefile\r
831copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in ..\doc\misc\makefile\r
832copy /b config.settings+%MAKECMD%.defs+..\doc\lispref\makefile.w32-in ..\doc\lispref\makefile\r
833copy /b config.settings+%MAKECMD%.defs+..\doc\lispintro\makefile.w32-in ..\doc\lispintro\makefile\r
f466241d
EZ
834if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
835copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
836rem Use the default (no-op) Makefile.in if the nt version is not present.\r
837if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r
838if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
839del config.settings\r
840\r
e44f8099
EZ
841Rem Some people use WinZip which doesn't create empty directories!\r
842if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
57a64408
JB
843Rem Update subdirs.el only if it is different or fc.exe doesn't work.\r
844if exist foo.bar del foo.bar\r
845fc /b foo.bar foo.bar >nul 2>&1\r
846if not errorlevel 2 goto doUpdateSubdirs\r
847fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1\r
848if not errorlevel 1 goto dontUpdateSubdirs\r
ee705a5c 849\r
57a64408
JB
850:doUpdateSubdirs\r
851if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el\r
852copy subdirs.el ..\site-lisp\subdirs.el\r
853\r
854:dontUpdateSubdirs\r
f466241d 855echo.\r
32154d10
JR
856\r
857rem check that we have all the libraries we need.\r
858set libsOK=1\r
859\r
860if not "(%HAVE_XPM%)" == "()" goto checkpng\r
861if (%xpmsupport%) == (N) goto checkpng\r
862 set libsOK=0\r
863 echo XPM support is missing. It is required for color icons in the toolbar.\r
864 echo Install libXpm development files or use --without-xpm\r
865\r
866:checkpng\r
867if not "(%HAVE_PNG%)" == "()" goto checkjpeg\r
868if (%pngsupport%) == (N) goto checkjpeg\r
869 set libsOK=0\r
870 echo PNG support is missing.\r
871 echo Install libpng development files or use --without-png\r
872\r
873:checkjpeg\r
874if not "(%HAVE_JPEG%)" == "()" goto checktiff\r
875if (%jpegsupport%) == (N) goto checktiff\r
876 set libsOK=0\r
877 echo JPEG support is missing.\r
878 echo Install jpeg development files or use --without-jpeg\r
879\r
880:checktiff\r
881if not "(%HAVE_TIFF%)" == "()" goto checkgif\r
882if (%tiffsupport%) == (N) goto checkgif\r
883 set libsOK=0\r
884 echo TIFF support is missing.\r
885 echo Install libtiff development files or use --without-tiff\r
886\r
887:checkgif\r
e3aef5c6
CS
888if not "(%HAVE_GIF%)" == "()" goto checkdistfiles\r
889if (%gifsupport%) == (N) goto checkdistfiles\r
32154d10
JR
890 set libsOK=0\r
891 echo GIF support is missing.\r
892 echo Install giflib or libungif development files or use --without-gif\r
893\r
e3aef5c6
CS
894:checkdistfiles\r
895if "(%HAVE_DISTFILES%)" == "()" goto donelibchecks\r
896if (%distFilesOk%) == (1) goto donelibchecks\r
897echo.\r
898echo Files specified with option --distfiles could not be found.\r
899echo Fix these issues before running make dist\r
900\r
32154d10
JR
901:donelibchecks\r
902if (%libsOK%) == (1) goto success\r
903echo.\r
904echo Important libraries are missing. Fix these issues before running make.\r
905goto end\r
906\r
907:success\r
f466241d 908echo Emacs successfully configured.\r
a27014fc 909echo Emacs successfully configured. >>config.log\r
361823f4 910if (%MAKECMD%) == (gmake) set MAKECMD=make\r
f466241d
EZ
911echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
912goto end\r
913\r
914:SmallEnv\r
915echo Your environment size is too small. Please enlarge it and rerun configure.\r
916echo For example, type "command.com /e:2048" to have 2048 bytes available.\r
917set $foo$=\r
ee705a5c 918\r
f466241d
EZ
919:end\r
920set prefix=\r
921set nodebug=\r
922set noopt=\r
7d0170c8 923set enablechecking=\r
75663c75 924set profile=\r
f466241d
EZ
925set nocygwin=\r
926set COMPILER=\r
927set MAKECMD=\r
928set usercflags=\r
3a1ebd63 929set docflags=\r
f466241d 930set userldflags=\r
3a1ebd63 931set doldflags=\r
112dc8e1 932set mingwflag=\r
dbbdb507 933set mf=\r
e3aef5c6
CS
934set distfiles=\r
935set HAVE_DISTFILES=\r
936set distFilesOk=\r
ca6e909c 937set pngsupport=\r
fd4af8d9 938set tlssupport=\r
9078ead6 939set libxml2support=\r
ca6e909c
EZ
940set jpegsupport=\r
941set gifsupport=\r
942set tiffsupport=\r
943set xpmsupport=\r
944set svgsupport=\r
945set libsOK=\r
946set HAVE_GIF=\r
947set HAVE_JPEG=\r
948set HAVE_PNG=\r
949set HAVE_TIFF=\r
950set HAVE_XPM=\r
951set dbginfo=\r
a2fcf029 952\r