Auto-commit of generated files.
[emacs.git] / nt / configure.bat
blob484fb83d9015a07fa610e735f35b094a8023ca62
1 @echo off\r
2 rem   ----------------------------------------------------------------------\r
3 rem   Configuration script for MS Windows operating systems\r
4 rem   Copyright (C) 1999-2013 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 Windows 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 escusercflags=\r
101 set docflags=\r
102 set userldflags=\r
103 set escuserldflags=\r
104 set extrauserlibs=\r
105 set doldflags=\r
106 set doextralibs=\r
107 set sep1=\r
108 set sep2=\r
109 set sep3=\r
110 set sep4=\r
111 set distfiles=\r
113 rem ----------------------------------------------------------------------\r
114 rem   Handle arguments.\r
115 :again\r
116 if "%1" == "-h" goto usage\r
117 if "%1" == "--help" goto usage\r
118 if "%1" == "--prefix" goto setprefix\r
119 if "%1" == "--with-gcc" goto withgcc\r
120 if "%1" == "--with-msvc" goto withmsvc\r
121 if "%1" == "--no-debug" goto nodebug\r
122 if "%1" == "--no-opt" goto noopt\r
123 if "%1" == "--enable-checking" goto enablechecking\r
124 if "%1" == "--profile" goto profile\r
125 if "%1" == "--no-cygwin" goto nocygwin\r
126 if "%1" == "--cflags" goto usercflags\r
127 if "%1" == "--ldflags" goto userldflags\r
128 if "%1" == "--lib" goto extrauserlibs\r
129 if "%1" == "--without-png" goto withoutpng\r
130 if "%1" == "--without-jpeg" goto withoutjpeg\r
131 if "%1" == "--without-gif" goto withoutgif\r
132 if "%1" == "--without-tiff" goto withouttiff\r
133 if "%1" == "--without-gnutls" goto withoutgnutls\r
134 if "%1" == "--without-libxml2" goto withoutlibxml2\r
135 if "%1" == "--without-xpm" goto withoutxpm\r
136 if "%1" == "--with-svg" goto withsvg\r
137 if "%1" == "--distfiles" goto distfiles\r
138 if "%1" == "" goto checkutils\r
140 :usage\r
141 echo Usage: configure [options]\r
142 echo Options:\r
143 echo.   --prefix PREFIX         install Emacs in directory PREFIX\r
144 echo.   --with-gcc              use GCC to compile Emacs\r
145 echo.   --with-msvc             use MSVC to compile Emacs\r
146 echo.   --no-debug              exclude debug info from executables\r
147 echo.   --no-opt                disable optimization\r
148 echo.   --enable-checking       enable additional run-time checks\r
149 echo.   --profile               enable profiling\r
150 echo.   --no-cygwin             use -mno-cygwin option with GCC\r
151 echo.   --cflags FLAG           pass FLAG to compiler\r
152 echo.   --ldflags FLAG          pass FLAG to compiler when linking\r
153 echo.   --lib LIB               link to extra library LIB\r
154 echo.   --without-png           do not use PNG library even if it is installed\r
155 echo.   --without-jpeg          do not use JPEG library even if it is installed\r
156 echo.   --without-gif           do not use GIF library even if it is installed\r
157 echo.   --without-tiff          do not use TIFF library even if it is installed\r
158 echo.   --without-xpm           do not use XPM library even if it is installed\r
159 echo.   --without-gnutls        do not use GnuTLS library even if it is installed\r
160 echo.   --without-libxml2       do not use libxml2 library even if it is installed\r
161 echo.   --with-svg              use the RSVG library (experimental)\r
162 echo.   --distfiles             path to files for make dist, e.g. libXpm.dll\r
163 if "%use_extensions%" == "0" goto end\r
164 echo.\r
165 echo. The cflags and ldflags arguments support parameters that include the =\r
166 echo. character.  However, since the = character is normally treated as a\r
167 echo. separator character you will need to enclose any parameter that includes\r
168 echo. the = character in quotes.  For example, to include\r
169 echo. -DSITELOAD_PURESIZE_EXTRA=100000 as one of the cflags you would run\r
170 echo. configure.bat as follows:\r
171 echo. configure.bat --cflags "-DSITELOAD_PURESIZE_EXTRA=100000"\r
172 echo.\r
173 echo. Note that this capability of processing parameters that include the =\r
174 echo. character depends on command extensions.  This batch file attempts to\r
175 echo. enable command extensions.  If command extensions cannot be enabled, a\r
176 echo. warning message will be displayed.\r
177 echo.\r
178 echo. IMPORTANT: This method of building Emacs for MS-Windows is deprecated,\r
179 echo. and could be removed in a future version of Emacs.  The preferred way\r
180 echo  to build Emacs for MS-Windows from now on is using the MSYS environment\r
181 echo. and MinGW development tools.  Please see nt/INSTALL.MSYS for details.\r
182 goto end\r
184 rem ----------------------------------------------------------------------\r
186 :setprefix\r
187 shift\r
188 set prefix=%1\r
189 shift\r
190 goto again\r
192 rem ----------------------------------------------------------------------\r
194 :withgcc\r
195 set COMPILER=gcc\r
196 shift\r
197 goto again\r
199 rem ----------------------------------------------------------------------\r
201 :withmsvc\r
202 set COMPILER=cl\r
203 shift\r
204 goto again\r
206 rem ----------------------------------------------------------------------\r
208 :nodebug\r
209 set nodebug=Y\r
210 shift\r
211 goto again\r
213 rem ----------------------------------------------------------------------\r
215 :noopt\r
216 set noopt=Y\r
217 shift\r
218 goto again\r
220 rem ----------------------------------------------------------------------\r
222 :enablechecking\r
223 set enablechecking=Y\r
224 shift\r
225 goto again\r
227 rem ----------------------------------------------------------------------\r
229 :profile\r
230 set profile=Y\r
231 shift\r
232 goto again\r
234 rem ----------------------------------------------------------------------\r
236 :nocygwin\r
237 set nocygwin=Y\r
238 shift\r
239 goto again\r
241 rem ----------------------------------------------------------------------\r
243 :usercflags\r
244 if "%use_extensions%" == "1" goto ucflagex\r
245 goto ucflagne\r
247 :ucflagex\r
248 shift\r
249 set usercflags=%usercflags%%sep1%%~1\r
250 set escusercflags=%usercflags:"=\"%\r
251 set sep1= %nothing%\r
252 shift\r
253 goto again\r
255 :ucflagne\r
256 shift\r
257 set usercflags=%usercflags%%sep1%%1\r
258 set escusercflags=%usercflags%\r
259 set sep1= %nothing%\r
260 shift\r
261 goto again\r
263 :extrauserlibs\r
264 shift\r
265 echo. extrauserlibs: %extrauserlibs%\r
266 set extrauserlibs=%extrauserlibs%%sep4%%1\r
267 set sep4= %nothing%\r
268 shift\r
269 goto again\r
271 rem ----------------------------------------------------------------------\r
273 :userldflags\r
274 if "%use_extensions%" == "1" goto ulflagex\r
275 goto ulflagne\r
277 :ulflagex\r
278 shift\r
279 set userldflags=%userldflags%%sep2%%~1\r
280 set escuserldflags=%userldflags:"=\"%\r
281 set sep2= %nothing%\r
282 shift\r
283 goto again\r
285 :ulflagne\r
286 shift\r
287 set userldflags=%userldflags%%sep2%%1\r
288 set escuserldflags=%userldflags%\r
289 set sep2= %nothing%\r
290 shift\r
291 goto again\r
293 rem ----------------------------------------------------------------------\r
295 :withoutpng\r
296 set pngsupport=N\r
297 set HAVE_PNG=\r
298 shift\r
299 goto again\r
301 rem ----------------------------------------------------------------------\r
303 :withoutjpeg\r
304 set jpegsupport=N\r
305 set HAVE_JPEG=\r
306 shift\r
307 goto again\r
309 rem ----------------------------------------------------------------------\r
311 :withoutgif\r
312 set gifsupport=N\r
313 set HAVE_GIF=\r
314 shift\r
315 goto again\r
317 rem ----------------------------------------------------------------------\r
319 :withoutgnutls\r
320 set tlssupport=N\r
321 set HAVE_GNUTLS=\r
322 shift\r
323 goto again\r
325 rem ----------------------------------------------------------------------\r
327 :withoutlibxml2\r
328 set libxml2support=N\r
329 set HAVE_LIBXML2=\r
330 shift\r
331 goto again\r
333 rem ----------------------------------------------------------------------\r
335 :withouttiff\r
336 set tiffsupport=N\r
337 set HAVE_TIFF=\r
338 shift\r
339 goto again\r
341 rem ----------------------------------------------------------------------\r
343 :withoutxpm\r
344 set xpmsupport=N\r
345 set HAVE_XPM=\r
346 shift\r
347 goto again\r
349 :withsvg\r
350 shift\r
351 set svgsupport=Y\r
352 goto again\r
354 rem ----------------------------------------------------------------------\r
356 :distfiles\r
357 set HAVE_DISTFILES=1\r
358 shift\r
359 set distfiles=%distfiles%%sep3%%1\r
360 set sep3= %nothing%\r
361 shift\r
362 goto again\r
364 rem ----------------------------------------------------------------------\r
365 rem    Check that necessary utilities (cp and rm) are present.\r
367 :checkutils\r
368 echo Checking for 'cp'...\r
369 cp configure.bat junk.bat\r
370 if not exist junk.bat goto needcp\r
371 echo Checking for 'rm'...\r
372 rm junk.bat\r
373 if exist junk.bat goto needrm\r
374 goto checkcompiler\r
376 :needcp\r
377 echo You need 'cp' (the Unix file copy program) to build Emacs.\r
378 goto end\r
380 :needrm\r
381 del junk.bat\r
382 echo You need 'rm' (the Unix file delete program) to build Emacs.\r
383 goto end\r
385 rem ----------------------------------------------------------------------\r
386 rem   Auto-detect compiler if not specified, and validate GCC if chosen.\r
388 :checkcompiler\r
389 if (%COMPILER%)==(cl) goto compilercheckdone\r
390 if (%COMPILER%)==(gcc) goto checkgcc\r
392 echo Checking whether 'gcc' is available...\r
393 echo main(){} >junk.c\r
394 gcc -c junk.c\r
395 if exist junk.o goto checkgcc\r
397 echo Checking whether 'cl' is available...\r
398 cl -nologo -c junk.c\r
399 if exist junk.obj goto clOK\r
400 goto nocompiler\r
402 :checkgcc\r
403 if exist junk.o del junk.o\r
404 Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
405 Rem            8 characters of a label.  So do NOT be tempted to change\r
406 Rem            chkapi* into something fancier like checkw32api\r
407 Rem You HAVE been warned!\r
408 if (%nocygwin%) == (Y) goto chkapiN\r
409 echo Checking whether gcc requires '-mno-cygwin'...\r
410 echo #include "cygwin/version.h" >junk.c\r
411 echo main(){} >>junk.c\r
412 echo gcc -c junk.c >>config.log\r
413 gcc -c junk.c >>config.log 2>&1\r
414 if not exist junk.o goto chkapi\r
415 echo gcc -mno-cygwin -c junk.c >>config.log\r
416 gcc -mno-cygwin -c junk.c >>config.log 2>&1\r
417 if exist junk.o set nocygwin=Y\r
419 :chkapi\r
420 echo The failed program was: >>config.log\r
421 type junk.c >>config.log\r
423 :chkapiN\r
424 rm -f junk.c junk.o\r
425 rem ----------------------------------------------------------------------\r
426 rem   Older versions of the Windows API headers either don't have any of\r
427 rem   the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
428 rem   are like this), or have a typo in the definition of\r
429 rem   IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r
430 rem   problem).  The gcc/mingw32 2.95.2 headers are okay, as are distros\r
431 rem   of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
432 rem   Beginning with Emacs 23, we need usp10.h.\r
433 rem\r
434 echo Checking whether Windows API headers are too old...\r
435 echo #include "windows.h" >junk.c\r
436 echo #include "usp10.h" >>junk.c\r
437 echo void test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
438 echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
439 if (%nocygwin%) == (Y) goto chkapi1\r
440 set cf=%usercflags%\r
441 goto chkapi2\r
443 :chkapi1\r
444 set cf=%usercflags% -mno-cygwin\r
446 :chkapi2\r
447 echo on\r
448 gcc %cf% -c junk.c\r
449 @echo off\r
450 @echo gcc %cf% -c junk.c >>config.log\r
451 gcc %cf% -c junk.c >>config.log 2>&1\r
452 set cf=\r
453 if exist junk.o goto chkuser\r
454 echo The failed program was: >>config.log\r
455 type junk.c >>config.log\r
456 goto nocompiler\r
458 :chkuser\r
459 rm -f junk.o\r
460 echo int main (int argc, char *argv[]) {>junk.c\r
461 echo char *usercflags = "%escusercflags%";>>junk.c\r
462 echo }>>junk.c\r
463 echo gcc -Werror -c junk.c >>config.log\r
464 gcc -Werror -c junk.c >>config.log 2>&1\r
465 if exist junk.o goto gccOk\r
466 echo.\r
467 echo Error in --cflags argument: %usercflags%\r
468 echo Backslashes and quotes cannot be used with --cflags.  Please use forward\r
469 echo slashes for filenames and paths (e.g. when passing directories to -I).\r
470 rm -f junk.c\r
471 goto end\r
473 :nocompiler\r
474 echo.\r
475 echo Configure failed.\r
476 echo To configure Emacs for Windows, you need to have either\r
477 echo gcc-2.95 or later with Mingw32 and the Windows API headers,\r
478 echo or MSVC 2.x or later.\r
479 del junk.c\r
480 goto end\r
482 :gccOk\r
483 set COMPILER=gcc\r
484 echo Using 'gcc'\r
485 rm -f junk.c junk.o\r
486 Rem It is not clear what GCC version began supporting -mtune\r
487 Rem and pentium4 on x86, so check this explicitly.\r
488 echo main(){} >junk.c\r
489 echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log\r
490 gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1\r
491 if not errorlevel 1 goto gccMtuneOk\r
492 echo The failed program was: >>config.log\r
493 type junk.c >>config.log\r
494 set mf=-mcpu=i686\r
495 rm -f junk.c junk.o\r
496 goto gccdebug\r
498 :gccMtuneOk\r
499 echo GCC supports -mtune=pentium4 >>config.log\r
500 set mf=-mtune=pentium4\r
501 rm -f junk.c junk.o\r
503 :gccdebug\r
504 rem Check for DWARF-2 debug info support, else default to stabs\r
505 echo main(){} >junk.c\r
506 echo gcc -c -gdwarf-2 -g3 junk.c >>config.log\r
507 gcc -c -gdwarf-2 -g3 junk.c >>config.log 2>&1\r
508 if not errorlevel 1 goto gccdwarf\r
509 echo The failed program was: >>config.log\r
510 type junk.c >>config.log\r
511 set dbginfo=-gstabs+\r
512 rm -f junk.c junk.o\r
513 goto compilercheckdone\r
515 :gccdwarf\r
516 echo GCC supports DWARF-2 >>config.log\r
517 set dbginfo=-gdwarf-2 -g3\r
518 rm -f junk.c junk.o\r
519 goto compilercheckdone\r
521 :clOk\r
522 set COMPILER=cl\r
523 rm -f junk.c junk.obj\r
524 echo Using 'MSVC'\r
526 :compilercheckdone\r
528 rem ----------------------------------------------------------------------\r
529 rem   Check for external image libraries. Since they are loaded\r
530 rem   dynamically, the libraries themselves do not need to be present\r
531 rem   at compile time, but the header files are required.\r
533 set mingwflag=\r
535 if (%nocygwin%) == (N) goto flagsOK\r
536 set mingwflag=-mno-cygwin\r
538 :flagsOK\r
540 if (%pngsupport%) == (N) goto pngDone\r
542 echo Checking for libpng...\r
543 echo #include "png.h" >junk.c\r
544 echo main (){} >>junk.c\r
545 rem   -o option is ignored with cl, but allows result to be consistent.\r
546 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
547 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
548 if exist junk.obj goto havePng\r
550 echo ...png.h not found, building without PNG support.\r
551 echo The failed program was: >>config.log\r
552 type junk.c >>config.log\r
553 set HAVE_PNG=\r
554 goto :pngDone\r
556 :havePng\r
557 echo ...PNG header available, building with PNG support.\r
558 set HAVE_PNG=1\r
560 :pngDone\r
561 rm -f junk.c junk.obj\r
563 if (%tlssupport%) == (N) goto tlsDone\r
565 rem this is a copy of the PNG detection\r
566 echo Checking for libgnutls...\r
567 echo #include "gnutls/gnutls.h" >junk.c\r
568 echo main (){} >>junk.c\r
569 rem   -o option is ignored with cl, but allows result to be consistent.\r
570 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
571 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
572 if exist junk.obj goto haveTls\r
574 echo ...gnutls.h not found, building without TLS support.\r
575 echo The failed program was: >>config.log\r
576 type junk.c >>config.log\r
577 set HAVE_GNUTLS=\r
578 goto :tlsDone\r
580 :haveTls\r
581 echo ...GnuTLS header available, building with GnuTLS support.\r
582 set HAVE_GNUTLS=1\r
584 :tlsDone\r
585 rm -f junk.c junk.obj\r
587 if (%libxml2support%) == (N) goto xml2Done\r
589 echo Checking for libxml2....\r
590 echo #include "libxml/HTMLparser.h" >junk.c\r
591 echo main(){} >>junk.c\r
592 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
593 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
594 if exist junk.obj goto havelibxml2\r
596 echo ...libxml/HTMLparser.h not found, building without libxml2 support\r
597 echo The failed program was: >>config.log\r
598 type junk.c >>config.log\r
599 set HAVE_LIBXML2=\r
600 goto xml2Done\r
602 :havelibxml2\r
603 echo ...libxml2 header available, building with libxml2 support\r
604 set HAVE_LIBXML2=1\r
606 :xml2Done\r
607 rm -f junk.c junk.obj\r
609 if (%jpegsupport%) == (N) goto jpegDone\r
611 echo Checking for jpeg-6b...\r
612 echo #include "jconfig.h" >junk.c\r
613 echo main (){} >>junk.c\r
614 rem   -o option is ignored with cl, but allows result to be consistent.\r
615 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
616 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
617 if exist junk.obj goto haveJpeg\r
619 echo ...jconfig.h not found, building without JPEG support.\r
620 echo The failed program was: >>config.log\r
621 type junk.c >>config.log\r
622 set HAVE_JPEG=\r
623 goto :jpegDone\r
625 :haveJpeg\r
626 echo ...JPEG header available, building with JPEG support.\r
627 set HAVE_JPEG=1\r
629 :jpegDone\r
630 rm -f junk.c junk.obj\r
632 if (%gifsupport%) == (N) goto gifDone\r
634 echo Checking for libgif...\r
635 rem giflib-5.0.0 needs size_t defined before gif_lib.h is included\r
636 rem redirection characters need to be protected from the shell\r
637 echo #include ^<stddef.h^> >junk.c\r
638 echo #include "gif_lib.h" >>junk.c\r
639 echo main (){} >>junk.c\r
640 rem   -o option is ignored with cl, but allows result to be consistent.\r
641 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
642 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
643 if exist junk.obj goto haveGif\r
645 echo ...gif_lib.h not found, building without GIF support.\r
646 echo The failed program was: >>config.log\r
647 type junk.c >>config.log\r
648 set HAVE_GIF=\r
649 goto :gifDone\r
651 :haveGif\r
652 echo ...GIF header available, building with GIF support.\r
653 set HAVE_GIF=1\r
655 :gifDone\r
656 rm -f junk.c junk.obj\r
658 if (%tiffsupport%) == (N) goto tiffDone\r
660 echo Checking for tiff...\r
661 echo #include "tiffio.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 haveTiff\r
668 echo ...tiffio.h not found, building without TIFF support.\r
669 echo The failed program was: >>config.log\r
670 type junk.c >>config.log\r
671 set HAVE_TIFF=\r
672 goto :tiffDone\r
674 :haveTiff\r
675 echo ...TIFF header available, building with TIFF support.\r
676 set HAVE_TIFF=1\r
678 :tiffDone\r
679 rm -f junk.c junk.obj\r
681 if (%xpmsupport%) == (N) goto xpmDone\r
683 echo Checking for libXpm...\r
684 echo #define FOR_MSW 1 >junk.c\r
685 echo #include "X11/xpm.h" >>junk.c\r
686 echo main (){} >>junk.c\r
687 rem   -o option is ignored with cl, but allows result to be consistent.\r
688 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
689 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
690 if exist junk.obj goto haveXpm\r
692 echo ...X11/xpm.h not found, building without XPM support.\r
693 echo The failed program was: >>config.log\r
694 type junk.c >>config.log\r
695 set HAVE_XPM=\r
696 goto :xpmDone\r
698 :haveXpm\r
699 echo ...XPM header available, building with XPM support.\r
700 set HAVE_XPM=1\r
702 :xpmDone\r
703 rm -f junk.c junk.obj\r
705 if not (%svgsupport%) == (Y) goto :svgDone\r
706 echo Checking for librsvg...\r
707 echo #include "librsvg/rsvg.h" >junk.c\r
708 echo main (){} >>junk.c\r
709 rem   -o option is ignored with cl, but allows result to be consistent.\r
710 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
711 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
712 if exist junk.obj goto haveSvg\r
714 echo ...librsvg/rsvg.h or dependencies not found, building without SVG support.\r
715 echo The failed program was: >>config.log\r
716 type junk.c >>config.log\r
717 set HAVE_RSVG=\r
718 goto :svgDone\r
720 :haveSvg\r
721 echo ...librsvg header available, building with SVG support (EXPERIMENTAL).\r
722 set HAVE_RSVG=1\r
724 :svgDone\r
725 rm -f junk.c junk.obj junk.err junk.out\r
727 rem Any distfiles provided for building distribution? If no, we're done.\r
728 if "(%HAVE_DISTFILES%)"=="()" goto :distFilesDone\r
730 rem Any arguments to --distfiles specified? If no, we're done.\r
731 if not "%distfiles%"=="" goto :checkDistFiles\r
732 set distFilesOk=0\r
733 echo No arguments specified for option --distfiles!\r
734 goto distfilesDone\r
736 :checkDistFiles\r
737 echo Checking for distfiles...\r
738 rem Check if all specified distfiles exist\r
739 set fileNotFound=\r
740 for %%d in (%distfiles%) do if not exist %%d set fileNotFound=%%d\r
741 if not "%fileNotFound%"=="" goto distFilesNotFound\r
743 set distFilesOK=1\r
744 echo ...all distfiles found.\r
745 goto :distFilesDone\r
747 :distFilesNotFound\r
748 set distFilesOk=0\r
749 echo ...%fileNotFound% not found.\r
750 set distfiles=\r
751 goto :distfilesDone\r
753 :distFilesDone\r
754 set fileNotFound=\r
756 rem ----------------------------------------------------------------------\r
758 :genmakefiles\r
759 echo Generating makefiles\r
760 if %COMPILER% == gcc set MAKECMD=gmake\r
761 if %COMPILER% == cl set MAKECMD=nmake\r
763 rem   Pass on chosen settings to makefiles.\r
764 rem\r
765 rem   The weird place we put the redirection is to make sure no extra\r
766 rem   whitespace winds up at the end of the Make variables, since some\r
767 rem   variables, e.g. INSTALL_DIR, cannot stand that.  Yes, echo will\r
768 rem   write the blanks between the end of command arguments and the\r
769 rem   redirection symbol to the file.  OTOH, we cannot put the\r
770 rem   redirection immediately after the last character of the command,\r
771 rem   because environment variable expansion can yield a digit there,\r
772 rem   which will then be misinterpreted as the file descriptor to\r
773 rem   redirect...\r
774 echo # Start of settings from configure.bat >config.settings\r
775 >>config.settings echo COMPILER=%COMPILER%\r
776 if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%\r
777 if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%\r
778 if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1\r
779 if (%noopt%) == (Y) >>config.settings echo NOOPT=1\r
780 if (%profile%) == (Y) >>config.settings echo PROFILE=1\r
781 if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1\r
782 if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%\r
783 if not "(%distfiles%)" == "()" >>config.settings echo DIST_FILES=%distfiles%\r
784 rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
785 rem and the if command cannot cope with this\r
786 for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
787 if (%docflags%)==(Y) >>config.settings echo USER_CFLAGS=%usercflags%\r
788 if (%docflags%)==(Y) >>config.settings echo ESC_USER_CFLAGS=%escusercflags%\r
789 for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
790 if (%doldflags%)==(Y) >>config.settings echo USER_LDFLAGS=%userldflags%\r
791 for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
792 if (%doextralibs%)==(Y) >>config.settings echo USER_LIBS=%extrauserlibs%\r
793 echo # End of settings from configure.bat>>config.settings\r
794 echo. >>config.settings\r
796 copy config.nt config.tmp\r
797 echo. >>config.tmp\r
798 echo /* Start of settings from configure.bat.  */ >>config.tmp\r
799 rem   We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify\r
800 rem   processing of compiler options in w32.c:get_emacs_configuration_options\r
801 if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%" >>config.tmp\r
802 if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%" >>config.tmp\r
803 if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
804 if (%enablechecking%) == (Y) echo #define ENABLE_CHECKING 1 >>config.tmp\r
805 if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
806 if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp\r
807 if not "(%HAVE_LIBXML2%)" == "()" echo #define HAVE_LIBXML2 1 >>config.tmp\r
808 if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r
809 if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r
810 if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r
811 if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp\r
812 if "(%HAVE_RSVG%)" == "(1)" echo #define HAVE_RSVG 1 >>config.tmp\r
814 echo /* End of settings from configure.bat.  */ >>config.tmp\r
816 Rem See if fc.exe returns a meaningful exit status.  If it does, we\r
817 Rem might as well avoid unnecessary overwriting of config.h and epaths.h,\r
818 Rem since this forces recompilation of every source file.\r
819 if exist foo.bar del foo.bar\r
820 fc /b foo.bar foo.bar >nul 2>&1\r
821 if not errorlevel 2 goto doCopy\r
822 fc /b config.tmp ..\src\config.h >nul 2>&1\r
823 if errorlevel 1 goto doCopy\r
824 fc /b paths.h ..\src\epaths.h >nul 2>&1\r
825 if not errorlevel 1 goto dontCopy\r
827 :doCopy\r
828 copy config.tmp ..\src\config.h\r
829 copy paths.h ..\src\epaths.h\r
831 :dontCopy\r
832 if exist config.tmp del config.tmp\r
833 copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
834 if exist ..\admin\unidata copy /b config.settings+%MAKECMD%.defs+..\admin\unidata\makefile.w32-in ..\admin\unidata\makefile\r
835 copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
836 copy /b config.settings+%MAKECMD%.defs+..\lib\makefile.w32-in ..\lib\makefile\r
837 copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
838 copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in ..\doc\emacs\makefile\r
839 copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in ..\doc\misc\makefile\r
840 copy /b config.settings+%MAKECMD%.defs+..\doc\lispref\makefile.w32-in ..\doc\lispref\makefile\r
841 copy /b config.settings+%MAKECMD%.defs+..\doc\lispintro\makefile.w32-in ..\doc\lispintro\makefile\r
842 if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
843 copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
844 rem   Use the default (no-op) Makefile.in if the nt version is not present.\r
845 if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r
846 if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
847 del config.settings\r
849 Rem Some people use WinZip which doesn't create empty directories!\r
850 if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
851 Rem Update subdirs.el only if it is different or fc.exe doesn't work.\r
852 if exist foo.bar del foo.bar\r
853 fc /b foo.bar foo.bar >nul 2>&1\r
854 if not errorlevel 2 goto doUpdateSubdirs\r
855 fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1\r
856 if not errorlevel 1 goto dontUpdateSubdirs\r
858 :doUpdateSubdirs\r
859 if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el\r
860 copy subdirs.el ..\site-lisp\subdirs.el\r
862 :dontUpdateSubdirs\r
863 echo.\r
865 rem check that we have all the libraries we need.\r
866 set libsOK=1\r
868 if not "(%HAVE_XPM%)" == "()" goto checkpng\r
869 if (%xpmsupport%) == (N) goto checkpng\r
870  set libsOK=0\r
871  echo XPM support is missing. It is required for color icons in the toolbar.\r
872  echo   Install libXpm development files or use --without-xpm\r
874 :checkpng\r
875 if not "(%HAVE_PNG%)" == "()" goto checkjpeg\r
876 if (%pngsupport%) == (N) goto checkjpeg\r
877  set libsOK=0\r
878  echo PNG support is missing.\r
879  echo   Install libpng development files or use --without-png\r
881 :checkjpeg\r
882 if not "(%HAVE_JPEG%)" == "()" goto checktiff\r
883 if (%jpegsupport%) == (N) goto checktiff\r
884  set libsOK=0\r
885  echo JPEG support is missing.\r
886  echo   Install jpeg development files or use --without-jpeg\r
888 :checktiff\r
889 if not "(%HAVE_TIFF%)" == "()" goto checkgif\r
890 if (%tiffsupport%) == (N) goto checkgif\r
891  set libsOK=0\r
892  echo TIFF support is missing.\r
893  echo   Install libtiff development files or use --without-tiff\r
895 :checkgif\r
896 if not "(%HAVE_GIF%)" == "()" goto checkdistfiles\r
897 if (%gifsupport%) == (N) goto checkdistfiles\r
898  set libsOK=0\r
899  echo GIF support is missing.\r
900  echo   Install giflib or libungif development files or use --without-gif\r
902 :checkdistfiles\r
903 if "(%HAVE_DISTFILES%)" == "()" goto donelibchecks\r
904 if (%distFilesOk%) == (1) goto donelibchecks\r
905 echo.\r
906 echo Files specified with option --distfiles could not be found.\r
907 echo   Fix these issues before running make dist\r
909 :donelibchecks\r
910 if (%libsOK%) == (1) goto success\r
911 echo.\r
912 echo Important libraries are missing. Fix these issues before running make.\r
913 goto end\r
915 :success\r
916 echo Emacs successfully configured.\r
917 echo Emacs successfully configured. >>config.log\r
918 if (%MAKECMD%) == (gmake) set MAKECMD=make\r
919 echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
920 goto end\r
922 :SmallEnv\r
923 echo Your environment size is too small.  Please enlarge it and rerun configure.\r
924 echo For example, type "command.com /e:2048" to have 2048 bytes available.\r
925 set $foo$=\r
927 :end\r
928 set prefix=\r
929 set nodebug=\r
930 set noopt=\r
931 set enablechecking=\r
932 set profile=\r
933 set nocygwin=\r
934 set COMPILER=\r
935 set MAKECMD=\r
936 set usercflags=\r
937 set docflags=\r
938 set userldflags=\r
939 set doldflags=\r
940 set mingwflag=\r
941 set mf=\r
942 set distfiles=\r
943 set HAVE_DISTFILES=\r
944 set distFilesOk=\r
945 set pngsupport=\r
946 set tlssupport=\r
947 set libxml2support=\r
948 set jpegsupport=\r
949 set gifsupport=\r
950 set tiffsupport=\r
951 set xpmsupport=\r
952 set svgsupport=\r
953 set libsOK=\r
954 set HAVE_GIF=\r
955 set HAVE_JPEG=\r
956 set HAVE_PNG=\r
957 set HAVE_TIFF=\r
958 set HAVE_XPM=\r
959 set dbginfo=\r
960 endlocal\r
961 set use_extensions=\r