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