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