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