timeclock.el trivia.
[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
73b0cd50 4rem Copyright (C) 1999-2011 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
d429d8e9 100set fusercflags=\r
3a1ebd63 101set docflags=\r
f466241d 102set userldflags=\r
d429d8e9 103set fuserldflags=\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
507f5dce 134if "%1" == "--without-xpm" goto withoutxpm\r
8bc63b1a 135if "%1" == "--with-svg" goto withsvg\r
e3aef5c6 136if "%1" == "--distfiles" goto distfiles\r
f466241d 137if "%1" == "" goto checkutils\r
ee705a5c 138\r
f466241d
EZ
139:usage\r
140echo Usage: configure [options]\r
141echo Options:\r
142echo. --prefix PREFIX install Emacs in directory PREFIX\r
143echo. --with-gcc use GCC to compile Emacs\r
144echo. --with-msvc use MSVC to compile Emacs\r
145echo. --no-debug exclude debug info from executables\r
146echo. --no-opt disable optimization\r
7d0170c8 147echo. --enable-checking enable checks and assertions\r
75663c75 148echo. --profile enable profiling\r
f466241d
EZ
149echo. --no-cygwin use -mno-cygwin option with GCC\r
150echo. --cflags FLAG pass FLAG to compiler\r
151echo. --ldflags FLAG pass FLAG to compiler when linking\r
fd4af8d9 152echo. --lib LIB link to extra library LIB\r
f01e03d3
JB
153echo. --without-png do not use PNG library even if it is installed\r
154echo. --without-jpeg do not use JPEG library even if it is installed\r
155echo. --without-gif do not use GIF library even if it is installed\r
156echo. --without-tiff do not use TIFF library even if it is installed\r
157echo. --without-xpm do not use XPM library even if it is installed\r
fd4af8d9 158echo. --without-gnutls do not use GNUTLS library even if it is installed\r
8d67bc8e 159echo. --with-svg use the RSVG library (experimental)\r
e3aef5c6 160echo. --distfiles path to files for make dist, e.g. libXpm.dll\r
4a1a6b5b
BK
161if "%use_extensions%" == "0" goto end\r
162echo.\r
163echo. The cflags and ldflags arguments support parameters that include the =\r
164echo. character. However, since the = character is normally treated as a\r
165echo. separator character you will need to enclose any parameter that includes\r
166echo. the = character in quotes. For example, to include\r
167echo. -DSITELOAD_PURESIZE_EXTRA=100000 as one of the cflags you would run\r
168echo. configure.bat as follows:\r
169echo. configure.bat --cflags "-DSITELOAD_PURESIZE_EXTRA=100000"\r
170echo.\r
171echo. Note that this capability of processing parameters that include the =\r
172echo. character depends on command extensions. This batch file attempts to\r
173echo. enable command extensions. If command extensions cannot be enabled, a\r
174echo. warning message will be displayed.\r
f466241d 175goto end\r
ee705a5c 176\r
f466241d 177rem ----------------------------------------------------------------------\r
ee705a5c 178\r
f466241d
EZ
179:setprefix\r
180shift\r
181set prefix=%1\r
182shift\r
183goto again\r
ee705a5c 184\r
f466241d 185rem ----------------------------------------------------------------------\r
ee705a5c 186\r
f466241d
EZ
187:withgcc\r
188set COMPILER=gcc\r
189shift\r
190goto again\r
ee705a5c 191\r
f466241d 192rem ----------------------------------------------------------------------\r
ee705a5c 193\r
f466241d
EZ
194:withmsvc\r
195set COMPILER=cl\r
196shift\r
197goto again\r
ee705a5c 198\r
f466241d 199rem ----------------------------------------------------------------------\r
ee705a5c 200\r
f466241d
EZ
201:nodebug\r
202set nodebug=Y\r
203shift\r
204goto again\r
ee705a5c 205\r
f466241d 206rem ----------------------------------------------------------------------\r
ee705a5c 207\r
f466241d
EZ
208:noopt\r
209set noopt=Y\r
210shift\r
211goto again\r
ee705a5c 212\r
f466241d 213rem ----------------------------------------------------------------------\r
ee705a5c 214\r
7d0170c8
JB
215:enablechecking\r
216set enablechecking=Y\r
217shift\r
218goto again\r
ee705a5c 219\r
7d0170c8 220rem ----------------------------------------------------------------------\r
ee705a5c 221\r
75663c75
JR
222:profile\r
223set profile=Y\r
224shift\r
225goto again\r
ee705a5c 226\r
75663c75 227rem ----------------------------------------------------------------------\r
ee705a5c 228\r
f466241d
EZ
229:nocygwin\r
230set nocygwin=Y\r
231shift\r
232goto again\r
ee705a5c 233\r
f466241d 234rem ----------------------------------------------------------------------\r
ee705a5c 235\r
f466241d 236:usercflags\r
4a1a6b5b
BK
237if "%use_extensions%" == "1" goto ucflagex\r
238goto ucflagne\r
239\r
240:ucflagex\r
241shift\r
242set usercflags=%usercflags%%sep1%%~1\r
d429d8e9 243set fusercflags=%usercflags:"=\"%\r
4a1a6b5b
BK
244set sep1= %nothing%\r
245shift\r
246goto again\r
247\r
248:ucflagne\r
f466241d
EZ
249shift\r
250set usercflags=%usercflags%%sep1%%1\r
d429d8e9 251set fusercflags=%usercflags%\r
f466241d
EZ
252set sep1= %nothing%\r
253shift\r
254goto again\r
ee705a5c 255\r
fd4af8d9
TZ
256:extrauserlibs\r
257shift\r
258echo. extrauserlibs: %extrauserlibs%\r
259set extrauserlibs=%extrauserlibs%%sep4%%1\r
260set sep4= %nothing%\r
261shift\r
262goto again\r
263\r
f466241d 264rem ----------------------------------------------------------------------\r
ee705a5c 265\r
f466241d 266:userldflags\r
4a1a6b5b
BK
267if "%use_extensions%" == "1" goto ulflagex\r
268goto ulflagne\r
269\r
270:ulflagex\r
271shift\r
272set userldflags=%userldflags%%sep2%%~1\r
d429d8e9 273set fuserldflags=%userldflags:"=\"%\r
4a1a6b5b
BK
274set sep2= %nothing%\r
275shift\r
276goto again\r
277\r
278:ulflagne\r
f466241d
EZ
279shift\r
280set userldflags=%userldflags%%sep2%%1\r
d429d8e9 281set fuserldflags=%userldflags%\r
f466241d
EZ
282set sep2= %nothing%\r
283shift\r
284goto again\r
ee705a5c 285\r
e0006538
JR
286rem ----------------------------------------------------------------------\r
287\r
288:withoutpng\r
289set pngsupport=N\r
290set HAVE_PNG=\r
39bd0e03 291shift\r
e0006538 292goto again\r
f466241d 293\r
aad0eae4
JR
294rem ----------------------------------------------------------------------\r
295\r
296:withoutjpeg\r
297set jpegsupport=N\r
298set HAVE_JPEG=\r
39bd0e03 299shift\r
aad0eae4
JR
300goto again\r
301\r
12ff2dc5
JB
302rem ----------------------------------------------------------------------\r
303\r
304:withoutgif\r
305set gifsupport=N\r
306set HAVE_GIF=\r
307shift\r
308goto again\r
309\r
47c01e80
JB
310rem ----------------------------------------------------------------------\r
311\r
fd4af8d9
TZ
312:withoutgnutls\r
313set tlssupport=N\r
314set HAVE_GNUTLS=\r
315shift\r
316goto again\r
317\r
318rem ----------------------------------------------------------------------\r
319\r
47c01e80
JB
320:withouttiff\r
321set tiffsupport=N\r
322set HAVE_TIFF=\r
323shift\r
324goto again\r
325\r
507f5dce
JR
326rem ----------------------------------------------------------------------\r
327\r
328:withoutxpm\r
329set xpmsupport=N\r
330set HAVE_XPM=\r
331shift\r
332goto again\r
333\r
8bc63b1a
JR
334:withsvg\r
335shift\r
336set svgsupport=Y\r
337goto again\r
338\r
e3aef5c6
CS
339rem ----------------------------------------------------------------------\r
340\r
341:distfiles\r
342set HAVE_DISTFILES=1\r
343shift\r
344set distfiles=%distfiles%%sep3%%1\r
345set sep3= %nothing%\r
346shift\r
347goto again\r
348\r
f466241d
EZ
349rem ----------------------------------------------------------------------\r
350rem Check that necessary utilities (cp and rm) are present.\r
ee705a5c 351\r
f466241d
EZ
352:checkutils\r
353echo Checking for 'cp'...\r
354cp configure.bat junk.bat\r
355if not exist junk.bat goto needcp\r
356echo Checking for 'rm'...\r
357rm junk.bat\r
358if exist junk.bat goto needrm\r
359goto checkcompiler\r
ee705a5c 360\r
f466241d
EZ
361:needcp\r
362echo You need 'cp' (the Unix file copy program) to build Emacs.\r
363goto end\r
ee705a5c 364\r
f466241d
EZ
365:needrm\r
366del junk.bat\r
367echo You need 'rm' (the Unix file delete program) to build Emacs.\r
368goto end\r
369\r
370rem ----------------------------------------------------------------------\r
371rem Auto-detect compiler if not specified, and validate GCC if chosen.\r
ee705a5c 372\r
f466241d 373:checkcompiler\r
e0006538 374if (%COMPILER%)==(cl) goto compilercheckdone\r
f466241d
EZ
375if (%COMPILER%)==(gcc) goto checkgcc\r
376\r
f466241d 377echo Checking whether 'gcc' is available...\r
680d641f 378echo main(){} >junk.c\r
f466241d 379gcc -c junk.c\r
680d641f 380if exist junk.o goto checkgcc\r
f466241d 381\r
680d641f
JR
382echo Checking whether 'cl' is available...\r
383cl -nologo -c junk.c\r
384if exist junk.obj goto clOK\r
385goto nocompiler\r
386\r
f466241d 387:checkgcc\r
1046da1c 388if exist junk.o del junk.o\r
f466241d
EZ
389Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
390Rem 8 characters of a label. So do NOT be tempted to change\r
391Rem chkapi* into something fancier like checkw32api\r
392Rem You HAVE been warned!\r
1046da1c 393if (%nocygwin%) == (Y) goto chkapiN\r
f466241d
EZ
394echo Checking whether gcc requires '-mno-cygwin'...\r
395echo #include "cygwin/version.h" >junk.c\r
396echo main(){} >>junk.c\r
dbbdb507
EZ
397echo gcc -c junk.c >>config.log\r
398gcc -c junk.c >>config.log 2>&1\r
f466241d 399if not exist junk.o goto chkapi\r
dbbdb507
EZ
400echo gcc -mno-cygwin -c junk.c >>config.log\r
401gcc -mno-cygwin -c junk.c >>config.log 2>&1\r
f466241d 402if exist junk.o set nocygwin=Y\r
f466241d
EZ
403\r
404:chkapi\r
dbbdb507
EZ
405echo The failed program was: >>config.log\r
406type junk.c >>config.log\r
ee705a5c 407\r
1046da1c
EZ
408:chkapiN\r
409rm -f junk.c junk.o\r
f466241d
EZ
410rem ----------------------------------------------------------------------\r
411rem Older versions of the Windows API headers either don't have any of\r
412rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
413rem are like this), or have a typo in the definition of\r
414rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r
415rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros\r
416rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
892508a4 417rem Beginning with Emacs 23, we need usp10.h.\r
f466241d
EZ
418rem\r
419echo Checking whether W32 API headers are too old...\r
420echo #include "windows.h" >junk.c\r
892508a4 421echo #include "usp10.h" >>junk.c\r
f466241d
EZ
422echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
423echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
424if (%nocygwin%) == (Y) goto chkapi1\r
425set cf=%usercflags%\r
426goto chkapi2\r
ee705a5c 427\r
f466241d
EZ
428:chkapi1\r
429set cf=%usercflags% -mno-cygwin\r
ee705a5c 430\r
f466241d
EZ
431:chkapi2\r
432echo on\r
433gcc %cf% -c junk.c\r
dbbdb507
EZ
434@echo off\r
435@echo gcc %cf% -c junk.c >>config.log\r
436gcc %cf% -c junk.c >>config.log 2>&1\r
f466241d 437set cf=\r
05212154 438if exist junk.o goto chkuser\r
dbbdb507
EZ
439echo The failed program was: >>config.log\r
440type junk.c >>config.log\r
05212154
JB
441goto nocompiler\r
442\r
443:chkuser\r
444rm -f junk.o\r
445echo int main (int argc, char *argv[]) {>junk.c\r
d429d8e9 446echo char *usercflags = "%fusercflags%";>>junk.c\r
05212154
JB
447echo }>>junk.c\r
448echo gcc -Werror -c junk.c >>config.log\r
449gcc -Werror -c junk.c >>config.log 2>&1\r
450if exist junk.o goto gccOk\r
451echo.\r
452echo Error in --cflags argument: %usercflags%\r
453echo Backslashes and quotes cannot be used with --cflags. Please use forward\r
454echo slashes for filenames and paths (e.g. when passing directories to -I).\r
455rm -f junk.c\r
456goto end\r
f466241d
EZ
457\r
458:nocompiler\r
459echo.\r
460echo Configure failed.\r
461echo To configure Emacs for Windows, you need to have either\r
462echo gcc-2.95 or later with Mingw32 and the W32 API headers,\r
463echo or MSVC 2.x or later.\r
464del junk.c\r
465goto end\r
466\r
467:gccOk\r
468set COMPILER=gcc\r
f466241d 469echo Using 'gcc'\r
dbbdb507
EZ
470rm -f junk.c junk.o\r
471Rem It is not clear what GCC version began supporting -mtune\r
472Rem and pentium4 on x86, so check this explicitly.\r
473echo main(){} >junk.c\r
474echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log\r
475gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1\r
476if not errorlevel 1 goto gccMtuneOk\r
477echo The failed program was: >>config.log\r
478type junk.c >>config.log\r
479set mf=-mcpu=i686\r
480rm -f junk.c junk.o\r
540c2a33 481goto gccdebug\r
ee705a5c 482\r
dbbdb507
EZ
483:gccMtuneOk\r
484echo GCC supports -mtune=pentium4 >>config.log\r
485set mf=-mtune=pentium4\r
486rm -f junk.c junk.o\r
ee705a5c 487\r
540c2a33
JB
488:gccdebug\r
489rem Check for DWARF-2 debug info support, else default to stabs\r
490echo main(){} >junk.c\r
491echo gcc -c -gdwarf-2 -g3 junk.c >>config.log\r
492gcc -c -gdwarf-2 -g3 junk.c >>config.log 2>&1\r
493if not errorlevel 1 goto gccdwarf\r
494echo The failed program was: >>config.log\r
495type junk.c >>config.log\r
496set dbginfo=-gstabs+\r
497rm -f junk.c junk.o\r
498goto compilercheckdone\r
ee705a5c 499\r
540c2a33
JB
500:gccdwarf\r
501echo GCC supports DWARF-2 >>config.log\r
502set dbginfo=-gdwarf-2 -g3\r
503rm -f junk.c junk.o\r
e0006538 504goto compilercheckdone\r
f466241d
EZ
505\r
506:clOk\r
507set COMPILER=cl\r
508rm -f junk.c junk.obj\r
509echo Using 'MSVC'\r
e0006538
JR
510\r
511:compilercheckdone\r
512\r
513rem ----------------------------------------------------------------------\r
514rem Check for external image libraries. Since they are loaded\r
515rem dynamically, the libraries themselves do not need to be present\r
516rem at compile time, but the header files are required.\r
517\r
112dc8e1
JR
518set mingwflag=\r
519\r
520if (%nocygwin%) == (N) goto flagsOK\r
521set mingwflag=-mno-cygwin\r
522\r
523:flagsOK\r
524\r
e0006538
JR
525if (%pngsupport%) == (N) goto pngDone\r
526\r
527echo Checking for libpng...\r
528echo #include "png.h" >junk.c\r
529echo main (){} >>junk.c\r
530rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
531echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
532%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
e0006538
JR
533if exist junk.obj goto havePng\r
534\r
507f5dce 535echo ...png.h not found, building without PNG support.\r
dbbdb507
EZ
536echo The failed program was: >>config.log\r
537type junk.c >>config.log\r
e0006538
JR
538set HAVE_PNG=\r
539goto :pngDone\r
540\r
541:havePng\r
542echo ...PNG header available, building with PNG support.\r
543set HAVE_PNG=1\r
544\r
545:pngDone\r
546rm -f junk.c junk.obj\r
f466241d 547\r
fd4af8d9
TZ
548if (%tlssupport%) == (N) goto tlsDone\r
549\r
550rem this is a copy of the PNG detection\r
551echo Checking for libgnutls...\r
552echo #include "gnutls/gnutls.h" >junk.c\r
553echo main (){} >>junk.c\r
554rem -o option is ignored with cl, but allows result to be consistent.\r
555echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
556%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
557if exist junk.obj goto haveTls\r
558\r
559echo ...gnutls.h not found, building without TLS support.\r
560echo The failed program was: >>config.log\r
561type junk.c >>config.log\r
562set HAVE_GNUTLS=\r
563goto :tlsDone\r
564\r
565:haveTls\r
566echo ...GNUTLS header available, building with GNUTLS support.\r
567set HAVE_GNUTLS=1\r
568\r
569:tlsDone\r
570rm -f junk.c junk.obj\r
571\r
aad0eae4
JR
572if (%jpegsupport%) == (N) goto jpegDone\r
573\r
507f5dce 574echo Checking for jpeg-6b...\r
aad0eae4
JR
575echo #include "jconfig.h" >junk.c\r
576echo main (){} >>junk.c\r
577rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
578echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
579%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
aad0eae4
JR
580if exist junk.obj goto haveJpeg\r
581\r
507f5dce 582echo ...jconfig.h not found, building without JPEG support.\r
dbbdb507
EZ
583echo The failed program was: >>config.log\r
584type junk.c >>config.log\r
aad0eae4
JR
585set HAVE_JPEG=\r
586goto :jpegDone\r
587\r
588:haveJpeg\r
589echo ...JPEG header available, building with JPEG support.\r
590set HAVE_JPEG=1\r
591\r
592:jpegDone\r
593rm -f junk.c junk.obj\r
594\r
12ff2dc5
JB
595if (%gifsupport%) == (N) goto gifDone\r
596\r
507f5dce 597echo Checking for libgif...\r
12ff2dc5
JB
598echo #include "gif_lib.h" >junk.c\r
599echo main (){} >>junk.c\r
600rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
601echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
602%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
12ff2dc5
JB
603if exist junk.obj goto haveGif\r
604\r
507f5dce 605echo ...gif_lib.h not found, building without GIF support.\r
dbbdb507
EZ
606echo The failed program was: >>config.log\r
607type junk.c >>config.log\r
12ff2dc5
JB
608set HAVE_GIF=\r
609goto :gifDone\r
610\r
611:haveGif\r
612echo ...GIF header available, building with GIF support.\r
613set HAVE_GIF=1\r
614\r
615:gifDone\r
616rm -f junk.c junk.obj\r
617\r
47c01e80
JB
618if (%tiffsupport%) == (N) goto tiffDone\r
619\r
620echo Checking for tiff...\r
621echo #include "tiffio.h" >junk.c\r
622echo main (){} >>junk.c\r
623rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
624echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
625%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
47c01e80
JB
626if exist junk.obj goto haveTiff\r
627\r
507f5dce 628echo ...tiffio.h not found, building without TIFF support.\r
dbbdb507
EZ
629echo The failed program was: >>config.log\r
630type junk.c >>config.log\r
47c01e80
JB
631set HAVE_TIFF=\r
632goto :tiffDone\r
633\r
634:haveTiff\r
635echo ...TIFF header available, building with TIFF support.\r
636set HAVE_TIFF=1\r
637\r
638:tiffDone\r
639rm -f junk.c junk.obj\r
640\r
507f5dce
JR
641if (%xpmsupport%) == (N) goto xpmDone\r
642\r
643echo Checking for libXpm...\r
644echo #define FOR_MSW 1 >junk.c\r
645echo #include "X11/xpm.h" >>junk.c\r
646echo main (){} >>junk.c\r
647rem -o option is ignored with cl, but allows result to be consistent.\r
dbbdb507
EZ
648echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
649%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
507f5dce
JR
650if exist junk.obj goto haveXpm\r
651\r
652echo ...X11/xpm.h not found, building without XPM support.\r
dbbdb507
EZ
653echo The failed program was: >>config.log\r
654type junk.c >>config.log\r
507f5dce
JR
655set HAVE_XPM=\r
656goto :xpmDone\r
657\r
658:haveXpm\r
659echo ...XPM header available, building with XPM support.\r
660set HAVE_XPM=1\r
661\r
662:xpmDone\r
8bc63b1a
JR
663rm -f junk.c junk.obj\r
664\r
665if not (%svgsupport%) == (Y) goto :svgDone\r
666echo Checking for librsvg...\r
667echo #include "librsvg/rsvg.h" >junk.c\r
668echo main (){} >>junk.c\r
669rem -o option is ignored with cl, but allows result to be consistent.\r
670echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
671%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
672if exist junk.obj goto haveSvg\r
673\r
674echo ...librsvg/rsvg.h or dependencies not found, building without SVG support.\r
675echo The failed program was: >>config.log\r
676type junk.c >>config.log\r
677set HAVE_RSVG=\r
678goto :svgDone\r
679\r
680:haveSvg\r
681echo ...librsvg header available, building with SVG support (EXPERIMENTAL).\r
682set HAVE_RSVG=1\r
683\r
684:svgDone\r
507f5dce
JR
685rm -f junk.c junk.obj junk.err junk.out\r
686\r
e3aef5c6
CS
687rem Any distfiles provided for building distribution? If no, we're done.\r
688if "(%HAVE_DISTFILES%)"=="()" goto :distFilesDone\r
689\r
690rem Any arguments to --distfiles specified? If no, we're done.\r
691if not "%distfiles%"=="" goto :checkDistFiles\r
692set distFilesOk=0\r
693echo No arguments specified for option --distfiles!\r
694goto distfilesDone\r
695\r
696:checkDistFiles\r
697echo Checking for distfiles...\r
698rem Check if all specified distfiles exist\r
699set fileNotFound=\r
700for %%d in (%distfiles%) do if not exist %%d set fileNotFound=%%d\r
701if not "%fileNotFound%"=="" goto distFilesNotFound\r
702\r
703set distFilesOK=1\r
704echo ...all distfiles found.\r
705goto :distFilesDone\r
706\r
707:distFilesNotFound\r
708set distFilesOk=0\r
709echo ...%fileNotFound% not found.\r
710set distfiles=\r
711goto :distfilesDone\r
712\r
713:distFilesDone\r
714set fileNotFound=\r
715\r
f466241d 716rem ----------------------------------------------------------------------\r
ee705a5c 717\r
f466241d
EZ
718:genmakefiles\r
719echo Generating makefiles\r
720if %COMPILER% == gcc set MAKECMD=gmake\r
721if %COMPILER% == cl set MAKECMD=nmake\r
722\r
723rem Pass on chosen settings to makefiles.\r
724rem NB. Be very careful to not have a space before redirection symbols\r
725rem except when there is a preceding digit, when a space is required.\r
726rem\r
727echo # Start of settings from configure.bat >config.settings\r
728echo COMPILER=%COMPILER%>>config.settings\r
dbbdb507 729if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings\r
540c2a33 730if not "(%dbginfo%)" == "()" echo DEBUG_INFO=%dbginfo%>>config.settings\r
f466241d
EZ
731if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r
732if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r
7d0170c8 733if (%enablechecking%) == (Y) echo ENABLECHECKS=1 >>config.settings\r
75663c75 734if (%profile%) == (Y) echo PROFILE=1 >>config.settings\r
f466241d
EZ
735if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r
736if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings\r
e3aef5c6 737if not "(%distfiles%)" == "()" echo DIST_FILES=%distfiles%>>config.settings\r
3a1ebd63
EZ
738rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
739rem and the if command cannot cope with this\r
740for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
741if (%docflags%)==(Y) echo USER_CFLAGS=%usercflags%>>config.settings\r
742for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
743if (%doldflags%)==(Y) echo USER_LDFLAGS=%userldflags%>>config.settings\r
fd4af8d9
TZ
744for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
745if (%doextralibs%)==(Y) echo USER_LIBS=%extrauserlibs%>>config.settings\r
f466241d
EZ
746echo # End of settings from configure.bat>>config.settings\r
747echo. >>config.settings\r
748\r
c262c68c
EZ
749copy config.nt config.tmp\r
750echo. >>config.tmp\r
751echo /* Start of settings from configure.bat. */ >>config.tmp\r
8f978ca0
JB
752rem We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify\r
753rem processing of compiler options in w32.c:get_emacs_configuration_options\r
d429d8e9
BK
754if (%docflags%) == (Y) echo #define USER_CFLAGS " %fusercflags%">>config.tmp\r
755if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %fuserldflags%">>config.tmp\r
f179addc 756if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
c262c68c 757if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
fd4af8d9 758if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp\r
c262c68c
EZ
759if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r
760if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r
761if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r
762if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp\r
8bc63b1a
JR
763if "(%HAVE_RSVG%)" == "(1)" echo #define HAVE_RSVG 1 >>config.tmp\r
764\r
c262c68c
EZ
765echo /* End of settings from configure.bat. */ >>config.tmp\r
766\r
767Rem See if fc.exe returns a meaningful exit status. If it does, we\r
768Rem might as well avoid unnecessary overwriting of config.h and epaths.h,\r
769Rem since this forces recompilation of every source file.\r
770if exist foo.bar del foo.bar\r
771fc /b foo.bar foo.bar >nul 2>&1\r
772if not errorlevel 2 goto doCopy\r
773fc /b config.tmp ..\src\config.h >nul 2>&1\r
774if errorlevel 1 goto doCopy\r
775fc /b paths.h ..\src\epaths.h >nul 2>&1\r
252b4f5c 776if not errorlevel 1 goto dontCopy\r
ee705a5c 777\r
c262c68c
EZ
778:doCopy\r
779copy config.tmp ..\src\config.h\r
f466241d
EZ
780copy paths.h ..\src\epaths.h\r
781\r
c262c68c
EZ
782:dontCopy\r
783if exist config.tmp del config.tmp\r
f466241d 784copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
a392138f 785if exist ..\admin\unidata copy /b config.settings+%MAKECMD%.defs+..\admin\unidata\makefile.w32-in ..\admin\unidata\makefile\r
f466241d 786copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
f915f0f7 787copy /b config.settings+%MAKECMD%.defs+..\lib\makefile.w32-in ..\lib\makefile\r
f466241d 788copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
8aee12d0
GM
789copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in ..\doc\emacs\makefile\r
790copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in ..\doc\misc\makefile\r
791copy /b config.settings+%MAKECMD%.defs+..\doc\lispref\makefile.w32-in ..\doc\lispref\makefile\r
792copy /b config.settings+%MAKECMD%.defs+..\doc\lispintro\makefile.w32-in ..\doc\lispintro\makefile\r
f466241d
EZ
793if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
794copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
795rem Use the default (no-op) Makefile.in if the nt version is not present.\r
796if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r
797if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
798del config.settings\r
799\r
e44f8099
EZ
800Rem Some people use WinZip which doesn't create empty directories!\r
801if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
57a64408
JB
802Rem Update subdirs.el only if it is different or fc.exe doesn't work.\r
803if exist foo.bar del foo.bar\r
804fc /b foo.bar foo.bar >nul 2>&1\r
805if not errorlevel 2 goto doUpdateSubdirs\r
806fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1\r
807if not errorlevel 1 goto dontUpdateSubdirs\r
ee705a5c 808\r
57a64408
JB
809:doUpdateSubdirs\r
810if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el\r
811copy subdirs.el ..\site-lisp\subdirs.el\r
812\r
813:dontUpdateSubdirs\r
f466241d 814echo.\r
32154d10
JR
815\r
816rem check that we have all the libraries we need.\r
817set libsOK=1\r
818\r
819if not "(%HAVE_XPM%)" == "()" goto checkpng\r
820if (%xpmsupport%) == (N) goto checkpng\r
821 set libsOK=0\r
822 echo XPM support is missing. It is required for color icons in the toolbar.\r
823 echo Install libXpm development files or use --without-xpm\r
824\r
825:checkpng\r
826if not "(%HAVE_PNG%)" == "()" goto checkjpeg\r
827if (%pngsupport%) == (N) goto checkjpeg\r
828 set libsOK=0\r
829 echo PNG support is missing.\r
830 echo Install libpng development files or use --without-png\r
831\r
832:checkjpeg\r
833if not "(%HAVE_JPEG%)" == "()" goto checktiff\r
834if (%jpegsupport%) == (N) goto checktiff\r
835 set libsOK=0\r
836 echo JPEG support is missing.\r
837 echo Install jpeg development files or use --without-jpeg\r
838\r
839:checktiff\r
840if not "(%HAVE_TIFF%)" == "()" goto checkgif\r
841if (%tiffsupport%) == (N) goto checkgif\r
842 set libsOK=0\r
843 echo TIFF support is missing.\r
844 echo Install libtiff development files or use --without-tiff\r
845\r
846:checkgif\r
e3aef5c6
CS
847if not "(%HAVE_GIF%)" == "()" goto checkdistfiles\r
848if (%gifsupport%) == (N) goto checkdistfiles\r
32154d10
JR
849 set libsOK=0\r
850 echo GIF support is missing.\r
851 echo Install giflib or libungif development files or use --without-gif\r
852\r
e3aef5c6
CS
853:checkdistfiles\r
854if "(%HAVE_DISTFILES%)" == "()" goto donelibchecks\r
855if (%distFilesOk%) == (1) goto donelibchecks\r
856echo.\r
857echo Files specified with option --distfiles could not be found.\r
858echo Fix these issues before running make dist\r
859\r
32154d10
JR
860:donelibchecks\r
861if (%libsOK%) == (1) goto success\r
862echo.\r
863echo Important libraries are missing. Fix these issues before running make.\r
864goto end\r
865\r
866:success\r
f466241d 867echo Emacs successfully configured.\r
a27014fc 868echo Emacs successfully configured. >>config.log\r
361823f4 869if (%MAKECMD%) == (gmake) set MAKECMD=make\r
f466241d
EZ
870echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
871goto end\r
872\r
873:SmallEnv\r
874echo Your environment size is too small. Please enlarge it and rerun configure.\r
875echo For example, type "command.com /e:2048" to have 2048 bytes available.\r
876set $foo$=\r
ee705a5c 877\r
f466241d
EZ
878:end\r
879set prefix=\r
880set nodebug=\r
881set noopt=\r
7d0170c8 882set enablechecking=\r
75663c75 883set profile=\r
f466241d
EZ
884set nocygwin=\r
885set COMPILER=\r
886set MAKECMD=\r
887set usercflags=\r
3a1ebd63 888set docflags=\r
f466241d 889set userldflags=\r
3a1ebd63 890set doldflags=\r
112dc8e1 891set mingwflag=\r
dbbdb507 892set mf=\r
e3aef5c6
CS
893set distfiles=\r
894set HAVE_DISTFILES=\r
895set distFilesOk=\r
ca6e909c 896set pngsupport=\r
fd4af8d9 897set tlssupport=\r
ca6e909c
EZ
898set jpegsupport=\r
899set gifsupport=\r
900set tiffsupport=\r
901set xpmsupport=\r
902set svgsupport=\r
903set libsOK=\r
904set HAVE_GIF=\r
905set HAVE_JPEG=\r
906set HAVE_PNG=\r
907set HAVE_TIFF=\r
908set HAVE_XPM=\r
909set dbginfo=\r
a2fcf029 910\r