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