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