Backport the :end-of-capability fix
[emacs.git] / nt / configure.bat
blobf6ac8fccc77fceff6641ca7138a6db1fa1e90d6b
1 @echo off\r
2 rem   ----------------------------------------------------------------------\r
3 rem   Configuration script for MS Windows operating systems\r
4 rem   Copyright (C) 1999-2015 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
61 echo ****************************************************************\r
62 echo *** THIS METHOD OF BUILDING EMACS IS NO LONGER SUPPORTED.     **\r
63 echo *** INSTEAD, FOLLOW THE INSTRUCTIONS FROM INSTALL.            **\r
64 echo ****************************************************************\r
65 :confirm_continue\r
66 set /p answer=Continue running this script at your own risks ? (Y/N)\r
67 if x%answer% == xy (goto confirm_continue_y)\r
68 if x%answer% == xY (goto confirm_continue_y)\r
69 if x%answer% == xn (goto end)\r
70 if x%answer% == xN (goto end)\r
71 echo Please answer by Y or N\r
72 goto confirm_continue\r
74 :confirm_continue_y\r
75 if exist config.log del config.log\r
77 rem ----------------------------------------------------------------------\r
78 rem   See if the environment is large enough.  We need 43 (?) bytes.\r
79 set $foo$=123456789_123456789_123456789_123456789_123\r
80 if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv\r
81 set $foo$=\r
83 rem ----------------------------------------------------------------------\r
84 rem   Make sure we are running in the nt subdir\r
85 if exist configure.bat goto start\r
86 echo You must run configure from the nt subdirectory.\r
87 goto end\r
89 :start\r
90 rem ----------------------------------------------------------------------\r
91 rem   Attempt to enable command extensions.  Set use_extensions to 1 if\r
92 rem   they are available and 0 if they are not available.\r
93 set use_extensions=1\r
94 setlocal ENABLEEXTENSIONS\r
95 if "%CMDEXTVERSION%" == "" set use_extensions=0\r
96 if "%use_extensions%" == "1" goto afterext\r
98 echo. Command extensions are not available.  Using parameters that include the =\r
99 echo. character by enclosing them in quotes will not be supported.\r
101 :afterext\r
103 rem ----------------------------------------------------------------------\r
104 rem   Default settings.\r
105 set prefix=\r
106 set nodebug=N\r
107 set noopt=N\r
108 set enablechecking=N\r
109 set profile=N\r
110 set nocygwin=N\r
111 set COMPILER=\r
112 set usercflags=\r
113 set escusercflags=\r
114 set docflags=\r
115 set userldflags=\r
116 set escuserldflags=\r
117 set extrauserlibs=\r
118 set doldflags=\r
119 set doextralibs=\r
120 set sep1=\r
121 set sep2=\r
122 set sep3=\r
123 set sep4=\r
124 set distfiles=\r
126 rem ----------------------------------------------------------------------\r
127 rem   Handle arguments.\r
128 :again\r
129 if "%1" == "-h" goto usage\r
130 if "%1" == "--help" goto usage\r
131 if "%1" == "--prefix" goto setprefix\r
132 if "%1" == "--with-gcc" goto withgcc\r
133 if "%1" == "--with-msvc" goto withmsvc\r
134 if "%1" == "--no-debug" goto nodebug\r
135 if "%1" == "--no-opt" goto noopt\r
136 if "%1" == "--enable-checking" goto enablechecking\r
137 if "%1" == "--profile" goto profile\r
138 if "%1" == "--no-cygwin" goto nocygwin\r
139 if "%1" == "--cflags" goto usercflags\r
140 if "%1" == "--ldflags" goto userldflags\r
141 if "%1" == "--lib" goto extrauserlibs\r
142 if "%1" == "--without-png" goto withoutpng\r
143 if "%1" == "--without-jpeg" goto withoutjpeg\r
144 if "%1" == "--without-gif" goto withoutgif\r
145 if "%1" == "--without-tiff" goto withouttiff\r
146 if "%1" == "--without-gnutls" goto withoutgnutls\r
147 if "%1" == "--without-libxml2" goto withoutlibxml2\r
148 if "%1" == "--without-xpm" goto withoutxpm\r
149 if "%1" == "--with-svg" goto withsvg\r
150 if "%1" == "--distfiles" goto distfiles\r
151 if "%1" == "" goto checkutils\r
153 :usage\r
154 echo Usage: configure [options]\r
155 echo Options:\r
156 echo.   --prefix PREFIX         install Emacs in directory PREFIX\r
157 echo.   --with-gcc              use GCC to compile Emacs\r
158 echo.   --with-msvc             use MSVC to compile Emacs\r
159 echo.   --no-debug              exclude debug info from executables\r
160 echo.   --no-opt                disable optimization\r
161 echo.   --enable-checking       enable additional run-time checks\r
162 echo.   --profile               enable profiling\r
163 echo.   --no-cygwin             use -mno-cygwin option with GCC\r
164 echo.   --cflags FLAG           pass FLAG to compiler\r
165 echo.   --ldflags FLAG          pass FLAG to compiler when linking\r
166 echo.   --lib LIB               link to extra library LIB\r
167 echo.   --without-png           do not use PNG library even if it is installed\r
168 echo.   --without-jpeg          do not use JPEG library even if it is installed\r
169 echo.   --without-gif           do not use GIF library even if it is installed\r
170 echo.   --without-tiff          do not use TIFF library even if it is installed\r
171 echo.   --without-xpm           do not use XPM library even if it is installed\r
172 echo.   --without-gnutls        do not use GnuTLS library even if it is installed\r
173 echo.   --without-libxml2       do not use libxml2 library even if it is installed\r
174 echo.   --with-svg              use the RSVG library (experimental)\r
175 echo.   --distfiles             path to files for make dist, e.g. libXpm.dll\r
176 if "%use_extensions%" == "0" goto end\r
177 echo.\r
178 echo. The cflags and ldflags arguments support parameters that include the =\r
179 echo. character.  However, since the = character is normally treated as a\r
180 echo. separator character you will need to enclose any parameter that includes\r
181 echo. the = character in quotes.  For example, to include\r
182 echo. -DSITELOAD_PURESIZE_EXTRA=100000 as one of the cflags you would run\r
183 echo. configure.bat as follows:\r
184 echo. configure.bat --cflags "-DSITELOAD_PURESIZE_EXTRA=100000"\r
185 echo.\r
186 echo. Note that this capability of processing parameters that include the =\r
187 echo. character depends on command extensions.  This batch file attempts to\r
188 echo. enable command extensions.  If command extensions cannot be enabled, a\r
189 echo. warning message will be displayed.\r
190 echo.\r
191 echo. IMPORTANT: This method of building Emacs for MS-Windows is deprecated,\r
192 echo. and could be removed in a future version of Emacs.  The preferred way\r
193 echo  to build Emacs for MS-Windows from now on is using the MSYS environment\r
194 echo. and MinGW development tools.  Please see nt/INSTALL for details.\r
195 goto end\r
197 rem ----------------------------------------------------------------------\r
199 :setprefix\r
200 shift\r
201 set prefix=%1\r
202 shift\r
203 goto again\r
205 rem ----------------------------------------------------------------------\r
207 :withgcc\r
208 set COMPILER=gcc\r
209 shift\r
210 goto again\r
212 rem ----------------------------------------------------------------------\r
214 :withmsvc\r
215 set COMPILER=cl\r
216 shift\r
217 goto again\r
219 rem ----------------------------------------------------------------------\r
221 :nodebug\r
222 set nodebug=Y\r
223 shift\r
224 goto again\r
226 rem ----------------------------------------------------------------------\r
228 :noopt\r
229 set noopt=Y\r
230 shift\r
231 goto again\r
233 rem ----------------------------------------------------------------------\r
235 :enablechecking\r
236 set enablechecking=Y\r
237 shift\r
238 goto again\r
240 rem ----------------------------------------------------------------------\r
242 :profile\r
243 set profile=Y\r
244 shift\r
245 goto again\r
247 rem ----------------------------------------------------------------------\r
249 :nocygwin\r
250 set nocygwin=Y\r
251 shift\r
252 goto again\r
254 rem ----------------------------------------------------------------------\r
256 :usercflags\r
257 if "%use_extensions%" == "1" goto ucflagex\r
258 goto ucflagne\r
260 :ucflagex\r
261 shift\r
262 set usercflags=%usercflags%%sep1%%~1\r
263 set escusercflags=%usercflags:"=\"%\r
264 set sep1= %nothing%\r
265 shift\r
266 goto again\r
268 :ucflagne\r
269 shift\r
270 set usercflags=%usercflags%%sep1%%1\r
271 set escusercflags=%usercflags%\r
272 set sep1= %nothing%\r
273 shift\r
274 goto again\r
276 :extrauserlibs\r
277 shift\r
278 echo. extrauserlibs: %extrauserlibs%\r
279 set extrauserlibs=%extrauserlibs%%sep4%%1\r
280 set sep4= %nothing%\r
281 shift\r
282 goto again\r
284 rem ----------------------------------------------------------------------\r
286 :userldflags\r
287 if "%use_extensions%" == "1" goto ulflagex\r
288 goto ulflagne\r
290 :ulflagex\r
291 shift\r
292 set userldflags=%userldflags%%sep2%%~1\r
293 set escuserldflags=%userldflags:"=\"%\r
294 set sep2= %nothing%\r
295 shift\r
296 goto again\r
298 :ulflagne\r
299 shift\r
300 set userldflags=%userldflags%%sep2%%1\r
301 set escuserldflags=%userldflags%\r
302 set sep2= %nothing%\r
303 shift\r
304 goto again\r
306 rem ----------------------------------------------------------------------\r
308 :withoutpng\r
309 set pngsupport=N\r
310 set HAVE_PNG=\r
311 shift\r
312 goto again\r
314 rem ----------------------------------------------------------------------\r
316 :withoutjpeg\r
317 set jpegsupport=N\r
318 set HAVE_JPEG=\r
319 shift\r
320 goto again\r
322 rem ----------------------------------------------------------------------\r
324 :withoutgif\r
325 set gifsupport=N\r
326 set HAVE_GIF=\r
327 shift\r
328 goto again\r
330 rem ----------------------------------------------------------------------\r
332 :withoutgnutls\r
333 set tlssupport=N\r
334 set HAVE_GNUTLS=\r
335 shift\r
336 goto again\r
338 rem ----------------------------------------------------------------------\r
340 :withoutlibxml2\r
341 set libxml2support=N\r
342 set HAVE_LIBXML2=\r
343 shift\r
344 goto again\r
346 rem ----------------------------------------------------------------------\r
348 :withouttiff\r
349 set tiffsupport=N\r
350 set HAVE_TIFF=\r
351 shift\r
352 goto again\r
354 rem ----------------------------------------------------------------------\r
356 :withoutxpm\r
357 set xpmsupport=N\r
358 set HAVE_XPM=\r
359 shift\r
360 goto again\r
362 :withsvg\r
363 shift\r
364 set svgsupport=Y\r
365 goto again\r
367 rem ----------------------------------------------------------------------\r
369 :distfiles\r
370 set HAVE_DISTFILES=1\r
371 shift\r
372 set distfiles=%distfiles%%sep3%%1\r
373 set sep3= %nothing%\r
374 shift\r
375 goto again\r
377 rem ----------------------------------------------------------------------\r
378 rem    Check that necessary utilities (cp and rm) are present.\r
380 :checkutils\r
381 echo Checking for 'cp'...\r
382 cp configure.bat junk.bat\r
383 if not exist junk.bat goto needcp\r
384 echo Checking for 'rm'...\r
385 rm junk.bat\r
386 if exist junk.bat goto needrm\r
387 goto checkcompiler\r
389 :needcp\r
390 echo You need 'cp' (the Unix file copy program) to build Emacs.\r
391 goto end\r
393 :needrm\r
394 del junk.bat\r
395 echo You need 'rm' (the Unix file delete program) to build Emacs.\r
396 goto end\r
398 rem ----------------------------------------------------------------------\r
399 rem   Auto-detect compiler if not specified, and validate GCC if chosen.\r
401 :checkcompiler\r
402 if (%COMPILER%)==(cl) goto compilercheckdone\r
403 if (%COMPILER%)==(gcc) goto checkgcc\r
405 echo Checking whether 'gcc' is available...\r
406 echo main(){} >junk.c\r
407 gcc -c junk.c\r
408 if exist junk.o goto checkgcc\r
410 echo Checking whether 'cl' is available...\r
411 cl -nologo -c junk.c\r
412 if exist junk.obj goto clOK\r
413 goto nocompiler\r
415 :checkgcc\r
416 if exist junk.o del junk.o\r
417 Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
418 Rem            8 characters of a label.  So do NOT be tempted to change\r
419 Rem            chkapi* into something fancier like checkw32api\r
420 Rem You HAVE been warned!\r
421 if (%nocygwin%) == (Y) goto chkapiN\r
422 echo Checking whether gcc requires '-mno-cygwin'...\r
423 echo #include "cygwin/version.h" >junk.c\r
424 echo main(){} >>junk.c\r
425 echo gcc -c junk.c >>config.log\r
426 gcc -c junk.c >>config.log 2>&1\r
427 if not exist junk.o goto chkapi\r
428 echo gcc -mno-cygwin -c junk.c >>config.log\r
429 gcc -mno-cygwin -c junk.c >>config.log 2>&1\r
430 if exist junk.o set nocygwin=Y\r
432 :chkapi\r
433 echo The failed program was: >>config.log\r
434 type junk.c >>config.log\r
436 :chkapiN\r
437 rm -f junk.c junk.o\r
438 rem ----------------------------------------------------------------------\r
439 rem   Older versions of the Windows API headers either don't have any of\r
440 rem   the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
441 rem   are like this), or have a typo in the definition of\r
442 rem   IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r
443 rem   problem).  The gcc/mingw32 2.95.2 headers are okay, as are distros\r
444 rem   of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
445 rem   Beginning with Emacs 23, we need usp10.h.\r
446 rem\r
447 echo Checking whether Windows API headers are too old...\r
448 echo #include "windows.h" >junk.c\r
449 echo #include "usp10.h" >>junk.c\r
450 echo void test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
451 echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
452 if (%nocygwin%) == (Y) goto chkapi1\r
453 set cf=%usercflags%\r
454 goto chkapi2\r
456 :chkapi1\r
457 set cf=%usercflags% -mno-cygwin\r
459 :chkapi2\r
460 echo on\r
461 gcc %cf% -c junk.c\r
462 @echo off\r
463 @echo gcc %cf% -c junk.c >>config.log\r
464 gcc %cf% -c junk.c >>config.log 2>&1\r
465 set cf=\r
466 if exist junk.o goto chkuser\r
467 echo The failed program was: >>config.log\r
468 type junk.c >>config.log\r
469 goto nocompiler\r
471 :chkuser\r
472 rm -f junk.o\r
473 echo int main (int argc, char *argv[]) {>junk.c\r
474 echo char *usercflags = "%escusercflags%";>>junk.c\r
475 echo }>>junk.c\r
476 echo gcc -Werror -c junk.c >>config.log\r
477 gcc -Werror -c junk.c >>config.log 2>&1\r
478 if exist junk.o goto gccOk\r
479 echo.\r
480 echo Error in --cflags argument: %usercflags%\r
481 echo Backslashes and quotes cannot be used with --cflags.  Please use forward\r
482 echo slashes for filenames and paths (e.g. when passing directories to -I).\r
483 rm -f junk.c\r
484 goto end\r
486 :nocompiler\r
487 echo.\r
488 echo Configure failed.\r
489 echo To configure Emacs for Windows, you need to have either\r
490 echo gcc-2.95 or later with Mingw32 and the Windows API headers,\r
491 echo or MSVC 2.x or later.\r
492 del junk.c\r
493 goto end\r
495 :gccOk\r
496 set COMPILER=gcc\r
497 echo Using 'gcc'\r
498 rm -f junk.c junk.o\r
499 Rem It is not clear what GCC version began supporting -mtune\r
500 Rem and pentium4 on x86, so check this explicitly.\r
501 echo main(){} >junk.c\r
502 echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log\r
503 gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1\r
504 if not errorlevel 1 goto gccMtuneOk\r
505 echo The failed program was: >>config.log\r
506 type junk.c >>config.log\r
507 set mf=-mcpu=i686\r
508 rm -f junk.c junk.o\r
509 goto gccdebug\r
511 :gccMtuneOk\r
512 echo GCC supports -mtune=pentium4 >>config.log\r
513 set mf=-mtune=pentium4\r
514 rm -f junk.c junk.o\r
516 :gccdebug\r
517 rem Check for DWARF-2 debug info support, else default to stabs\r
518 echo main(){} >junk.c\r
519 echo gcc -c -gdwarf-2 -g3 junk.c >>config.log\r
520 gcc -c -gdwarf-2 -g3 junk.c >>config.log 2>&1\r
521 if not errorlevel 1 goto gccdwarf\r
522 echo The failed program was: >>config.log\r
523 type junk.c >>config.log\r
524 set dbginfo=-gstabs+\r
525 rm -f junk.c junk.o\r
526 goto compilercheckdone\r
528 :gccdwarf\r
529 echo GCC supports DWARF-2 >>config.log\r
530 set dbginfo=-gdwarf-2 -g3\r
531 rm -f junk.c junk.o\r
532 goto compilercheckdone\r
534 :clOk\r
535 set COMPILER=cl\r
536 rm -f junk.c junk.obj\r
537 echo Using 'MSVC'\r
539 :compilercheckdone\r
541 rem ----------------------------------------------------------------------\r
542 rem   Check for external image libraries. Since they are loaded\r
543 rem   dynamically, the libraries themselves do not need to be present\r
544 rem   at compile time, but the header files are required.\r
546 set mingwflag=\r
548 if (%nocygwin%) == (N) goto flagsOK\r
549 set mingwflag=-mno-cygwin\r
551 :flagsOK\r
553 if (%pngsupport%) == (N) goto pngDone\r
555 echo Checking for libpng...\r
556 echo #include "png.h" >junk.c\r
557 echo main (){} >>junk.c\r
558 rem   -o option is ignored with cl, but allows result to be consistent.\r
559 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
560 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
561 if exist junk.obj goto havePng\r
563 echo ...png.h not found, building without PNG support.\r
564 echo The failed program was: >>config.log\r
565 type junk.c >>config.log\r
566 set HAVE_PNG=\r
567 goto :pngDone\r
569 :havePng\r
570 echo ...PNG header available, building with PNG support.\r
571 set HAVE_PNG=1\r
573 :pngDone\r
574 rm -f junk.c junk.obj\r
576 if (%tlssupport%) == (N) goto tlsDone\r
578 rem this is a copy of the PNG detection\r
579 echo Checking for libgnutls...\r
580 echo #include "gnutls/gnutls.h" >junk.c\r
581 echo main (){} >>junk.c\r
582 rem   -o option is ignored with cl, but allows result to be consistent.\r
583 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
584 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
585 if exist junk.obj goto haveTls\r
587 echo ...gnutls.h not found, building without TLS support.\r
588 echo The failed program was: >>config.log\r
589 type junk.c >>config.log\r
590 set HAVE_GNUTLS=\r
591 goto :tlsDone\r
593 :haveTls\r
594 echo ...GnuTLS header available, building with GnuTLS support.\r
595 set HAVE_GNUTLS=1\r
597 :tlsDone\r
598 rm -f junk.c junk.obj\r
600 if (%libxml2support%) == (N) goto xml2Done\r
602 echo Checking for libxml2....\r
603 echo #include "libxml/HTMLparser.h" >junk.c\r
604 echo main(){} >>junk.c\r
605 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
606 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
607 if exist junk.obj goto havelibxml2\r
609 echo ...libxml/HTMLparser.h not found, building without libxml2 support\r
610 echo The failed program was: >>config.log\r
611 type junk.c >>config.log\r
612 set HAVE_LIBXML2=\r
613 goto xml2Done\r
615 :havelibxml2\r
616 echo ...libxml2 header available, building with libxml2 support\r
617 set HAVE_LIBXML2=1\r
619 :xml2Done\r
620 rm -f junk.c junk.obj\r
622 if (%jpegsupport%) == (N) goto jpegDone\r
624 echo Checking for jpeg-6b...\r
625 echo #include "jconfig.h" >junk.c\r
626 echo main (){} >>junk.c\r
627 rem   -o option is ignored with cl, but allows result to be consistent.\r
628 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
629 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
630 if exist junk.obj goto haveJpeg\r
632 echo ...jconfig.h not found, building without JPEG support.\r
633 echo The failed program was: >>config.log\r
634 type junk.c >>config.log\r
635 set HAVE_JPEG=\r
636 goto :jpegDone\r
638 :haveJpeg\r
639 echo ...JPEG header available, building with JPEG support.\r
640 set HAVE_JPEG=1\r
642 :jpegDone\r
643 rm -f junk.c junk.obj\r
645 if (%gifsupport%) == (N) goto gifDone\r
647 echo Checking for libgif...\r
648 rem giflib-5.0.0 needs size_t defined before gif_lib.h is included\r
649 rem redirection characters need to be protected from the shell\r
650 echo #include ^<stddef.h^> >junk.c\r
651 echo #include "gif_lib.h" >>junk.c\r
652 echo main (){} >>junk.c\r
653 rem   -o option is ignored with cl, but allows result to be consistent.\r
654 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
655 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
656 if exist junk.obj goto haveGif\r
658 echo ...gif_lib.h not found, building without GIF support.\r
659 echo The failed program was: >>config.log\r
660 type junk.c >>config.log\r
661 set HAVE_GIF=\r
662 goto :gifDone\r
664 :haveGif\r
665 echo ...GIF header available, building with GIF support.\r
666 set HAVE_GIF=1\r
668 :gifDone\r
669 rm -f junk.c junk.obj\r
671 if (%tiffsupport%) == (N) goto tiffDone\r
673 echo Checking for tiff...\r
674 echo #include "tiffio.h" >junk.c\r
675 echo main (){} >>junk.c\r
676 rem   -o option is ignored with cl, but allows result to be consistent.\r
677 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
678 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
679 if exist junk.obj goto haveTiff\r
681 echo ...tiffio.h not found, building without TIFF support.\r
682 echo The failed program was: >>config.log\r
683 type junk.c >>config.log\r
684 set HAVE_TIFF=\r
685 goto :tiffDone\r
687 :haveTiff\r
688 echo ...TIFF header available, building with TIFF support.\r
689 set HAVE_TIFF=1\r
691 :tiffDone\r
692 rm -f junk.c junk.obj\r
694 if (%xpmsupport%) == (N) goto xpmDone\r
696 echo Checking for libXpm...\r
697 echo #define FOR_MSW 1 >junk.c\r
698 echo #include "X11/xpm.h" >>junk.c\r
699 echo main (){} >>junk.c\r
700 rem   -o option is ignored with cl, but allows result to be consistent.\r
701 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
702 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
703 if exist junk.obj goto haveXpm\r
705 echo ...X11/xpm.h not found, building without XPM support.\r
706 echo The failed program was: >>config.log\r
707 type junk.c >>config.log\r
708 set HAVE_XPM=\r
709 goto :xpmDone\r
711 :haveXpm\r
712 echo ...XPM header available, building with XPM support.\r
713 set HAVE_XPM=1\r
715 :xpmDone\r
716 rm -f junk.c junk.obj\r
718 if not (%svgsupport%) == (Y) goto :svgDone\r
719 echo Checking for librsvg...\r
720 echo #include "librsvg/rsvg.h" >junk.c\r
721 echo main (){} >>junk.c\r
722 rem   -o option is ignored with cl, but allows result to be consistent.\r
723 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
724 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
725 if exist junk.obj goto haveSvg\r
727 echo ...librsvg/rsvg.h or dependencies not found, building without SVG support.\r
728 echo The failed program was: >>config.log\r
729 type junk.c >>config.log\r
730 set HAVE_RSVG=\r
731 goto :svgDone\r
733 :haveSvg\r
734 echo ...librsvg header available, building with SVG support (EXPERIMENTAL).\r
735 set HAVE_RSVG=1\r
737 :svgDone\r
738 rm -f junk.c junk.obj junk.err junk.out\r
740 rem Any distfiles provided for building distribution? If no, we're done.\r
741 if "(%HAVE_DISTFILES%)"=="()" goto :distFilesDone\r
743 rem Any arguments to --distfiles specified? If no, we're done.\r
744 if not "%distfiles%"=="" goto :checkDistFiles\r
745 set distFilesOk=0\r
746 echo No arguments specified for option --distfiles!\r
747 goto distfilesDone\r
749 :checkDistFiles\r
750 echo Checking for distfiles...\r
751 rem Check if all specified distfiles exist\r
752 set fileNotFound=\r
753 for %%d in (%distfiles%) do if not exist %%d set fileNotFound=%%d\r
754 if not "%fileNotFound%"=="" goto distFilesNotFound\r
756 set distFilesOK=1\r
757 echo ...all distfiles found.\r
758 goto :distFilesDone\r
760 :distFilesNotFound\r
761 set distFilesOk=0\r
762 echo ...%fileNotFound% not found.\r
763 set distfiles=\r
764 goto :distfilesDone\r
766 :distFilesDone\r
767 set fileNotFound=\r
769 rem ----------------------------------------------------------------------\r
771 :genmakefiles\r
772 echo Generating makefiles\r
773 if %COMPILER% == gcc set MAKECMD=gmake\r
774 if %COMPILER% == cl set MAKECMD=nmake\r
776 rem   Pass on chosen settings to makefiles.\r
777 rem\r
778 rem   The weird place we put the redirection is to make sure no extra\r
779 rem   whitespace winds up at the end of the Make variables, since some\r
780 rem   variables, e.g. INSTALL_DIR, cannot stand that.  Yes, echo will\r
781 rem   write the blanks between the end of command arguments and the\r
782 rem   redirection symbol to the file.  OTOH, we cannot put the\r
783 rem   redirection immediately after the last character of the command,\r
784 rem   because environment variable expansion can yield a digit there,\r
785 rem   which will then be misinterpreted as the file descriptor to\r
786 rem   redirect...\r
787 echo # Start of settings from configure.bat >config.settings\r
788 >>config.settings echo COMPILER=%COMPILER%\r
789 if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%\r
790 if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%\r
791 if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1\r
792 if (%noopt%) == (Y) >>config.settings echo NOOPT=1\r
793 if (%profile%) == (Y) >>config.settings echo PROFILE=1\r
794 if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1\r
795 if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%\r
796 if not "(%distfiles%)" == "()" >>config.settings echo DIST_FILES=%distfiles%\r
797 rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
798 rem and the if command cannot cope with this\r
799 for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
800 if (%docflags%)==(Y) >>config.settings echo USER_CFLAGS=%usercflags%\r
801 if (%docflags%)==(Y) >>config.settings echo ESC_USER_CFLAGS=%escusercflags%\r
802 for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
803 if (%doldflags%)==(Y) >>config.settings echo USER_LDFLAGS=%userldflags%\r
804 for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
805 if (%doextralibs%)==(Y) >>config.settings echo USER_LIBS=%extrauserlibs%\r
806 echo # End of settings from configure.bat>>config.settings\r
807 echo. >>config.settings\r
809 copy config.nt config.tmp\r
810 echo. >>config.tmp\r
811 echo /* Start of settings from configure.bat.  */ >>config.tmp\r
812 rem   We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify\r
813 rem   processing of compiler options in w32.c:get_emacs_configuration_options\r
814 if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%" >>config.tmp\r
815 if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%" >>config.tmp\r
816 if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
817 if (%enablechecking%) == (Y) echo #define ENABLE_CHECKING 1 >>config.tmp\r
818 if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
819 if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp\r
820 if not "(%HAVE_LIBXML2%)" == "()" echo #define HAVE_LIBXML2 1 >>config.tmp\r
821 if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r
822 if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r
823 if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r
824 if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp\r
825 if "(%HAVE_RSVG%)" == "(1)" echo #define HAVE_RSVG 1 >>config.tmp\r
827 echo /* End of settings from configure.bat.  */ >>config.tmp\r
829 Rem See if fc.exe returns a meaningful exit status.  If it does, we\r
830 Rem might as well avoid unnecessary overwriting of config.h and epaths.h,\r
831 Rem since this forces recompilation of every source file.\r
832 if exist foo.bar del foo.bar\r
833 fc /b foo.bar foo.bar >nul 2>&1\r
834 if not errorlevel 2 goto doCopy\r
835 fc /b config.tmp ..\src\config.h >nul 2>&1\r
836 if errorlevel 1 goto doCopy\r
837 fc /b paths.h ..\src\epaths.h >nul 2>&1\r
838 if not errorlevel 1 goto dontCopy\r
840 :doCopy\r
841 copy config.tmp ..\src\config.h\r
842 copy paths.h ..\src\epaths.h\r
844 :dontCopy\r
845 if exist config.tmp del config.tmp\r
846 copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
847 if exist ..\admin\unidata copy /b config.settings+%MAKECMD%.defs+..\admin\unidata\makefile.w32-in ..\admin\unidata\makefile\r
848 copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
849 copy /b config.settings+%MAKECMD%.defs+..\lib\makefile.w32-in ..\lib\makefile\r
850 copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
851 copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in ..\doc\emacs\makefile\r
852 copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in ..\doc\misc\makefile\r
853 copy /b config.settings+%MAKECMD%.defs+..\doc\lispref\makefile.w32-in ..\doc\lispref\makefile\r
854 copy /b config.settings+%MAKECMD%.defs+..\doc\lispintro\makefile.w32-in ..\doc\lispintro\makefile\r
855 if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
856 copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
857 rem   Use the default (no-op) Makefile.in if the nt version is not present.\r
858 if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r
859 if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
860 del config.settings\r
862 Rem Some people use WinZip which doesn't create empty directories!\r
863 if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
864 Rem Update subdirs.el only if it is different or fc.exe doesn't work.\r
865 if exist foo.bar del foo.bar\r
866 fc /b foo.bar foo.bar >nul 2>&1\r
867 if not errorlevel 2 goto doUpdateSubdirs\r
868 fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1\r
869 if not errorlevel 1 goto dontUpdateSubdirs\r
871 :doUpdateSubdirs\r
872 if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el\r
873 copy subdirs.el ..\site-lisp\subdirs.el\r
875 :dontUpdateSubdirs\r
876 echo.\r
878 rem check that we have all the libraries we need.\r
879 set libsOK=1\r
881 if not "(%HAVE_XPM%)" == "()" goto checkpng\r
882 if (%xpmsupport%) == (N) goto checkpng\r
883  set libsOK=0\r
884  echo XPM support is missing. It is required for color icons in the toolbar.\r
885  echo   Install libXpm development files or use --without-xpm\r
887 :checkpng\r
888 if not "(%HAVE_PNG%)" == "()" goto checkjpeg\r
889 if (%pngsupport%) == (N) goto checkjpeg\r
890  set libsOK=0\r
891  echo PNG support is missing.\r
892  echo   Install libpng development files or use --without-png\r
894 :checkjpeg\r
895 if not "(%HAVE_JPEG%)" == "()" goto checktiff\r
896 if (%jpegsupport%) == (N) goto checktiff\r
897  set libsOK=0\r
898  echo JPEG support is missing.\r
899  echo   Install jpeg development files or use --without-jpeg\r
901 :checktiff\r
902 if not "(%HAVE_TIFF%)" == "()" goto checkgif\r
903 if (%tiffsupport%) == (N) goto checkgif\r
904  set libsOK=0\r
905  echo TIFF support is missing.\r
906  echo   Install libtiff development files or use --without-tiff\r
908 :checkgif\r
909 if not "(%HAVE_GIF%)" == "()" goto checkdistfiles\r
910 if (%gifsupport%) == (N) goto checkdistfiles\r
911  set libsOK=0\r
912  echo GIF support is missing.\r
913  echo   Install giflib or libungif development files or use --without-gif\r
915 :checkdistfiles\r
916 if "(%HAVE_DISTFILES%)" == "()" goto donelibchecks\r
917 if (%distFilesOk%) == (1) goto donelibchecks\r
918 echo.\r
919 echo Files specified with option --distfiles could not be found.\r
920 echo   Fix these issues before running make dist\r
922 :donelibchecks\r
923 if (%libsOK%) == (1) goto success\r
924 echo.\r
925 echo Important libraries are missing. Fix these issues before running make.\r
926 goto end\r
928 :success\r
929 echo Emacs successfully configured.\r
930 echo Emacs successfully configured. >>config.log\r
931 if (%MAKECMD%) == (gmake) set MAKECMD=make\r
932 echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
933 goto end\r
935 :SmallEnv\r
936 echo Your environment size is too small.  Please enlarge it and rerun configure.\r
937 echo For example, type "command.com /e:2048" to have 2048 bytes available.\r
938 set $foo$=\r
940 :end\r
941 set prefix=\r
942 set nodebug=\r
943 set noopt=\r
944 set enablechecking=\r
945 set profile=\r
946 set nocygwin=\r
947 set COMPILER=\r
948 set MAKECMD=\r
949 set usercflags=\r
950 set docflags=\r
951 set userldflags=\r
952 set doldflags=\r
953 set mingwflag=\r
954 set mf=\r
955 set distfiles=\r
956 set HAVE_DISTFILES=\r
957 set distFilesOk=\r
958 set pngsupport=\r
959 set tlssupport=\r
960 set libxml2support=\r
961 set jpegsupport=\r
962 set gifsupport=\r
963 set tiffsupport=\r
964 set xpmsupport=\r
965 set svgsupport=\r
966 set libsOK=\r
967 set HAVE_GIF=\r
968 set HAVE_JPEG=\r
969 set HAVE_PNG=\r
970 set HAVE_TIFF=\r
971 set HAVE_XPM=\r
972 set dbginfo=\r
973 endlocal\r
974 set use_extensions=\r