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