Commit | Line | Data |
---|---|---|
f466241d EZ |
1 | @echo off\r |
2 | rem ----------------------------------------------------------------------\r | |
12ff2dc5 | 3 | rem Configuration script for MS Windows 95/98/Me and NT/2000/XP\r |
ceb4c4d3 | 4 | rem Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,\r |
6d344054 | 5 | rem 2006, 2007, 2008 Free Software Foundation, Inc.\r |
f466241d EZ |
6 | \r |
7 | rem This file is part of GNU Emacs.\r | |
8 | \r | |
9 | rem GNU Emacs is free software; you can redistribute it and/or modify\r | |
10 | rem it under the terms of the GNU General Public License as published by\r | |
4a9f99bd | 11 | rem the Free Software Foundation; either version 3, or (at your option)\r |
f466241d EZ |
12 | rem any later version.\r |
13 | \r | |
14 | rem GNU Emacs is distributed in the hope that it will be useful,\r | |
15 | rem but WITHOUT ANY WARRANTY; without even the implied warranty of\r | |
16 | rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r | |
17 | rem GNU General Public License for more details.\r | |
18 | \r | |
19 | rem You should have received a copy of the GNU General Public License\r | |
20 | rem along with GNU Emacs; see the file COPYING. If not, write to the\r | |
364c38d3 LK |
21 | rem Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\r |
22 | rem Boston, MA 02110-1301, USA.\r | |
f466241d EZ |
23 | rem ----------------------------------------------------------------------\r |
24 | rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r | |
25 | rem\r | |
12ff2dc5 | 26 | rem + MS Windows 95/98/Me or NT/2000/XP\r |
f466241d | 27 | rem + either MSVC 2.x or later, or gcc-2.95 or later (with gmake 3.75\r |
56a469c3 EZ |
28 | rem or later) and the Mingw32 and W32 API headers and libraries.\r |
29 | rem + Visual Studio 2005 is not supported at this time.\r | |
f466241d EZ |
30 | rem\r |
31 | rem For reference, here is a list of which builds of gmake are known to\r | |
32 | rem work or not, and whether they work in the presence and/or absence of\r | |
33 | rem sh.exe.\r | |
7019fb66 | 34 | rem\r |
f466241d | 35 | rem sh exists no sh\r |
56a469c3 | 36 | rem cygwin b20.1 make (3.75): fails[1,5] fails[2,5]\r |
f466241d EZ |
37 | rem MSVC compiled gmake 3.77: okay okay\r |
38 | rem MSVC compiled gmake 3.78.1: okay okay\r | |
39 | rem MSVC compiled gmake 3.79.1: okay okay\r | |
56a469c3 EZ |
40 | rem mingw32/gcc-2.92.2 make (3.77): okay okay[4]\r |
41 | rem cygwin compiled gmake 3.77: fails[1,5] fails[2,5]\r | |
42 | rem cygwin compiled gmake 3.78.1: fails[5] fails[2,5]\r | |
43 | rem cygwin compiled gmake 3.79.1: fails[3,5] fails[2?,5]\r | |
17f55fae EZ |
44 | rem cygwin compiled make 3.80: okay[6] fails?[7]\r |
45 | rem cygwin compiled make 3.81: fails fails?[7]\r | |
56a469c3 | 46 | rem mingw32 compiled make 3.79.1: okay okay\r |
17f55fae EZ |
47 | rem mingw32 compiled make 3.80: okay okay?[7]\r |
48 | rem mingw32 compiled make 3.81: okay okay[8]\r | |
f466241d EZ |
49 | rem\r |
50 | rem [1] doesn't cope with makefiles with DOS line endings, so must mount\r | |
51 | rem emacs source with text!=binary.\r | |
52 | rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.\r | |
56a469c3 EZ |
53 | rem [3] requires LC_MESSAGES support to build; cannot build with early\r |
54 | rem versions of cygwin.\r | |
55 | rem [4] may fail on Windows 9X and Windows ME; if so, install Bash.\r | |
56 | rem [5] fails when building leim due to the use of cygwin style paths.\r | |
57 | rem May work if building emacs without leim.\r | |
17f55fae EZ |
58 | rem [6] need to uncomment 3 lines in nt/gmake.defs that invoke `cygpath';\r |
59 | rem look for "cygpath" near line 85 of gmake.defs.\r | |
60 | rem [7] not recommended; please report if you try this combination.\r | |
61 | rem [8] tested only on Windows XP.\r | |
f466241d EZ |
62 | rem\r |
63 | \r | |
dbbdb507 EZ |
64 | if exist config.log del config.log\r |
65 | \r | |
f466241d EZ |
66 | rem ----------------------------------------------------------------------\r |
67 | rem See if the environment is large enough. We need 43 (?) bytes.\r | |
68 | set $foo$=123456789_123456789_123456789_123456789_123\r | |
69 | if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv\r | |
70 | set $foo$=\r | |
71 | \r | |
72 | rem ----------------------------------------------------------------------\r | |
73 | rem Make sure we are running in the nt subdir\r | |
74 | if exist configure.bat goto start\r | |
75 | echo You must run configure from the nt subdirectory.\r | |
76 | goto end\r | |
77 | \r | |
78 | :start\r | |
79 | rem ----------------------------------------------------------------------\r | |
80 | rem Default settings.\r | |
81 | set prefix=\r | |
82 | set nodebug=N\r | |
83 | set noopt=N\r | |
84 | set nocygwin=N\r | |
85 | set COMPILER=\r | |
86 | set usercflags=\r | |
3a1ebd63 | 87 | set docflags=\r |
f466241d | 88 | set userldflags=\r |
3a1ebd63 | 89 | set doldflags=\r |
f466241d EZ |
90 | set sep1=\r |
91 | set sep2=\r | |
92 | \r | |
93 | rem ----------------------------------------------------------------------\r | |
94 | rem Handle arguments.\r | |
95 | :again\r | |
96 | if "%1" == "-h" goto usage\r | |
97 | if "%1" == "--help" goto usage\r | |
98 | if "%1" == "--prefix" goto setprefix\r | |
99 | if "%1" == "--with-gcc" goto withgcc\r | |
100 | if "%1" == "--with-msvc" goto withmsvc\r | |
101 | if "%1" == "--no-debug" goto nodebug\r | |
102 | if "%1" == "--no-opt" goto noopt\r | |
103 | if "%1" == "--no-cygwin" goto nocygwin\r | |
104 | if "%1" == "--cflags" goto usercflags\r | |
105 | if "%1" == "--ldflags" goto userldflags\r | |
e0006538 | 106 | if "%1" == "--without-png" goto withoutpng\r |
aad0eae4 | 107 | if "%1" == "--without-jpeg" goto withoutjpeg\r |
12ff2dc5 | 108 | if "%1" == "--without-gif" goto withoutgif\r |
47c01e80 | 109 | if "%1" == "--without-tiff" goto withouttiff\r |
507f5dce | 110 | if "%1" == "--without-xpm" goto withoutxpm\r |
53a4961c | 111 | if "%1" == "--enable-font-backend" goto withfont\r |
f466241d EZ |
112 | if "%1" == "" goto checkutils\r |
113 | :usage\r | |
114 | echo Usage: configure [options]\r | |
115 | echo Options:\r | |
116 | echo. --prefix PREFIX install Emacs in directory PREFIX\r | |
117 | echo. --with-gcc use GCC to compile Emacs\r | |
118 | echo. --with-msvc use MSVC to compile Emacs\r | |
119 | echo. --no-debug exclude debug info from executables\r | |
120 | echo. --no-opt disable optimization\r | |
121 | echo. --no-cygwin use -mno-cygwin option with GCC\r | |
122 | echo. --cflags FLAG pass FLAG to compiler\r | |
123 | echo. --ldflags FLAG pass FLAG to compiler when linking\r | |
32154d10 JR |
124 | echo. --without-png do not use libpng\r |
125 | echo. --without-jpeg do not use jpeg-6b\r | |
126 | echo. --without-gif do not use giflib or libungif\r | |
127 | echo. --without-tiff do not use libtiff\r | |
128 | echo. --without-xpm do not use libXpm\r | |
53a4961c | 129 | echo. --enable-font-backend build with font backend support\r |
f466241d EZ |
130 | goto end\r |
131 | rem ----------------------------------------------------------------------\r | |
132 | :setprefix\r | |
133 | shift\r | |
134 | set prefix=%1\r | |
135 | shift\r | |
136 | goto again\r | |
137 | rem ----------------------------------------------------------------------\r | |
138 | :withgcc\r | |
139 | set COMPILER=gcc\r | |
140 | shift\r | |
141 | goto again\r | |
142 | rem ----------------------------------------------------------------------\r | |
143 | :withmsvc\r | |
144 | set COMPILER=cl\r | |
145 | shift\r | |
146 | goto again\r | |
147 | rem ----------------------------------------------------------------------\r | |
148 | :nodebug\r | |
149 | set nodebug=Y\r | |
150 | shift\r | |
151 | goto again\r | |
152 | rem ----------------------------------------------------------------------\r | |
153 | :noopt\r | |
154 | set noopt=Y\r | |
155 | shift\r | |
156 | goto again\r | |
157 | rem ----------------------------------------------------------------------\r | |
158 | :nocygwin\r | |
159 | set nocygwin=Y\r | |
160 | shift\r | |
161 | goto again\r | |
162 | rem ----------------------------------------------------------------------\r | |
163 | :usercflags\r | |
164 | shift\r | |
165 | set usercflags=%usercflags%%sep1%%1\r | |
166 | set sep1= %nothing%\r | |
167 | shift\r | |
168 | goto again\r | |
169 | rem ----------------------------------------------------------------------\r | |
170 | :userldflags\r | |
171 | shift\r | |
172 | set userldflags=%userldflags%%sep2%%1\r | |
173 | set sep2= %nothing%\r | |
174 | shift\r | |
175 | goto again\r | |
e0006538 JR |
176 | rem ----------------------------------------------------------------------\r |
177 | \r | |
178 | :withoutpng\r | |
179 | set pngsupport=N\r | |
180 | set HAVE_PNG=\r | |
39bd0e03 | 181 | shift\r |
e0006538 | 182 | goto again\r |
f466241d | 183 | \r |
aad0eae4 JR |
184 | rem ----------------------------------------------------------------------\r |
185 | \r | |
186 | :withoutjpeg\r | |
187 | set jpegsupport=N\r | |
188 | set HAVE_JPEG=\r | |
39bd0e03 | 189 | shift\r |
aad0eae4 JR |
190 | goto again\r |
191 | \r | |
12ff2dc5 JB |
192 | rem ----------------------------------------------------------------------\r |
193 | \r | |
194 | :withoutgif\r | |
195 | set gifsupport=N\r | |
196 | set HAVE_GIF=\r | |
197 | shift\r | |
198 | goto again\r | |
199 | \r | |
47c01e80 JB |
200 | rem ----------------------------------------------------------------------\r |
201 | \r | |
202 | :withouttiff\r | |
203 | set tiffsupport=N\r | |
204 | set HAVE_TIFF=\r | |
205 | shift\r | |
206 | goto again\r | |
207 | \r | |
507f5dce JR |
208 | rem ----------------------------------------------------------------------\r |
209 | \r | |
210 | :withoutxpm\r | |
211 | set xpmsupport=N\r | |
212 | set HAVE_XPM=\r | |
213 | shift\r | |
214 | goto again\r | |
215 | \r | |
2cd47384 JR |
216 | :withfont\r |
217 | set usercflags=%usercflags%%sep1%-DUSE_FONT_BACKEND\r | |
ef59ca67 | 218 | set sep1= %nothing%\r |
2cd47384 JR |
219 | set usefontbackend=Y\r |
220 | shift\r | |
221 | goto again\r | |
222 | \r | |
f466241d EZ |
223 | rem ----------------------------------------------------------------------\r |
224 | rem Check that necessary utilities (cp and rm) are present.\r | |
225 | :checkutils\r | |
226 | echo Checking for 'cp'...\r | |
227 | cp configure.bat junk.bat\r | |
228 | if not exist junk.bat goto needcp\r | |
229 | echo Checking for 'rm'...\r | |
230 | rm junk.bat\r | |
231 | if exist junk.bat goto needrm\r | |
232 | goto checkcompiler\r | |
233 | :needcp\r | |
234 | echo You need 'cp' (the Unix file copy program) to build Emacs.\r | |
235 | goto end\r | |
236 | :needrm\r | |
237 | del junk.bat\r | |
238 | echo You need 'rm' (the Unix file delete program) to build Emacs.\r | |
239 | goto end\r | |
240 | \r | |
241 | rem ----------------------------------------------------------------------\r | |
242 | rem Auto-detect compiler if not specified, and validate GCC if chosen.\r | |
243 | :checkcompiler\r | |
e0006538 | 244 | if (%COMPILER%)==(cl) goto compilercheckdone\r |
f466241d EZ |
245 | if (%COMPILER%)==(gcc) goto checkgcc\r |
246 | \r | |
247 | echo Checking whether 'cl' is available...\r | |
248 | echo main(){} >junk.c\r | |
249 | cl -nologo -c junk.c\r | |
250 | if exist junk.obj goto clOK\r | |
251 | \r | |
252 | echo Checking whether 'gcc' is available...\r | |
253 | gcc -c junk.c\r | |
254 | if not exist junk.o goto nocompiler\r | |
255 | del junk.o\r | |
256 | \r | |
257 | :checkgcc\r | |
258 | Rem WARNING -- COMMAND.COM on some systems only looks at the first\r | |
259 | Rem 8 characters of a label. So do NOT be tempted to change\r | |
260 | Rem chkapi* into something fancier like checkw32api\r | |
261 | Rem You HAVE been warned!\r | |
262 | if (%nocygwin%) == (Y) goto chkapi\r | |
263 | echo Checking whether gcc requires '-mno-cygwin'...\r | |
264 | echo #include "cygwin/version.h" >junk.c\r | |
265 | echo main(){} >>junk.c\r | |
dbbdb507 EZ |
266 | echo gcc -c junk.c >>config.log\r |
267 | gcc -c junk.c >>config.log 2>&1\r | |
f466241d | 268 | if not exist junk.o goto chkapi\r |
dbbdb507 EZ |
269 | echo gcc -mno-cygwin -c junk.c >>config.log\r |
270 | gcc -mno-cygwin -c junk.c >>config.log 2>&1\r | |
f466241d EZ |
271 | if exist junk.o set nocygwin=Y\r |
272 | rm -f junk.c junk.o\r | |
273 | \r | |
274 | :chkapi\r | |
dbbdb507 EZ |
275 | echo The failed program was: >>config.log\r |
276 | type junk.c >>config.log\r | |
f466241d EZ |
277 | rem ----------------------------------------------------------------------\r |
278 | rem Older versions of the Windows API headers either don't have any of\r | |
279 | rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r | |
280 | rem are like this), or have a typo in the definition of\r | |
281 | rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r | |
282 | rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros\r | |
283 | rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r | |
284 | rem\r | |
285 | echo Checking whether W32 API headers are too old...\r | |
286 | echo #include "windows.h" >junk.c\r | |
287 | echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r | |
288 | echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r | |
289 | if (%nocygwin%) == (Y) goto chkapi1\r | |
290 | set cf=%usercflags%\r | |
291 | goto chkapi2\r | |
292 | :chkapi1\r | |
293 | set cf=%usercflags% -mno-cygwin\r | |
294 | :chkapi2\r | |
295 | echo on\r | |
296 | gcc %cf% -c junk.c\r | |
dbbdb507 EZ |
297 | @echo off\r |
298 | @echo gcc %cf% -c junk.c >>config.log\r | |
299 | gcc %cf% -c junk.c >>config.log 2>&1\r | |
f466241d EZ |
300 | set cf=\r |
301 | if exist junk.o goto gccOk\r | |
dbbdb507 EZ |
302 | echo The failed program was: >>config.log\r |
303 | type junk.c >>config.log\r | |
f466241d EZ |
304 | \r |
305 | :nocompiler\r | |
306 | echo.\r | |
307 | echo Configure failed.\r | |
308 | echo To configure Emacs for Windows, you need to have either\r | |
309 | echo gcc-2.95 or later with Mingw32 and the W32 API headers,\r | |
310 | echo or MSVC 2.x or later.\r | |
311 | del junk.c\r | |
312 | goto end\r | |
313 | \r | |
314 | :gccOk\r | |
315 | set COMPILER=gcc\r | |
f466241d | 316 | echo Using 'gcc'\r |
dbbdb507 EZ |
317 | rm -f junk.c junk.o\r |
318 | Rem It is not clear what GCC version began supporting -mtune\r | |
319 | Rem and pentium4 on x86, so check this explicitly.\r | |
320 | echo main(){} >junk.c\r | |
321 | echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log\r | |
322 | gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1\r | |
323 | if not errorlevel 1 goto gccMtuneOk\r | |
324 | echo The failed program was: >>config.log\r | |
325 | type junk.c >>config.log\r | |
326 | set mf=-mcpu=i686\r | |
327 | rm -f junk.c junk.o\r | |
328 | goto compilercheckdone\r | |
329 | :gccMtuneOk\r | |
330 | echo GCC supports -mtune=pentium4 >>config.log\r | |
331 | set mf=-mtune=pentium4\r | |
332 | rm -f junk.c junk.o\r | |
e0006538 | 333 | goto compilercheckdone\r |
f466241d EZ |
334 | \r |
335 | :clOk\r | |
336 | set COMPILER=cl\r | |
337 | rm -f junk.c junk.obj\r | |
338 | echo Using 'MSVC'\r | |
e0006538 JR |
339 | \r |
340 | :compilercheckdone\r | |
341 | \r | |
342 | rem ----------------------------------------------------------------------\r | |
343 | rem Check for external image libraries. Since they are loaded\r | |
344 | rem dynamically, the libraries themselves do not need to be present\r | |
345 | rem at compile time, but the header files are required.\r | |
346 | \r | |
112dc8e1 JR |
347 | set mingwflag=\r |
348 | \r | |
349 | if (%nocygwin%) == (N) goto flagsOK\r | |
350 | set mingwflag=-mno-cygwin\r | |
351 | \r | |
352 | :flagsOK\r | |
353 | \r | |
e0006538 JR |
354 | if (%pngsupport%) == (N) goto pngDone\r |
355 | \r | |
356 | echo Checking for libpng...\r | |
357 | echo #include "png.h" >junk.c\r | |
358 | echo main (){} >>junk.c\r | |
359 | rem -o option is ignored with cl, but allows result to be consistent.\r | |
dbbdb507 EZ |
360 | echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r |
361 | %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r | |
e0006538 JR |
362 | if exist junk.obj goto havePng\r |
363 | \r | |
507f5dce | 364 | echo ...png.h not found, building without PNG support.\r |
dbbdb507 EZ |
365 | echo The failed program was: >>config.log\r |
366 | type junk.c >>config.log\r | |
e0006538 JR |
367 | set HAVE_PNG=\r |
368 | goto :pngDone\r | |
369 | \r | |
370 | :havePng\r | |
371 | echo ...PNG header available, building with PNG support.\r | |
372 | set HAVE_PNG=1\r | |
373 | \r | |
374 | :pngDone\r | |
375 | rm -f junk.c junk.obj\r | |
f466241d | 376 | \r |
aad0eae4 JR |
377 | if (%jpegsupport%) == (N) goto jpegDone\r |
378 | \r | |
507f5dce | 379 | echo Checking for jpeg-6b...\r |
aad0eae4 JR |
380 | echo #include "jconfig.h" >junk.c\r |
381 | echo main (){} >>junk.c\r | |
382 | rem -o option is ignored with cl, but allows result to be consistent.\r | |
dbbdb507 EZ |
383 | echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r |
384 | %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r | |
aad0eae4 JR |
385 | if exist junk.obj goto haveJpeg\r |
386 | \r | |
507f5dce | 387 | echo ...jconfig.h not found, building without JPEG support.\r |
dbbdb507 EZ |
388 | echo The failed program was: >>config.log\r |
389 | type junk.c >>config.log\r | |
aad0eae4 JR |
390 | set HAVE_JPEG=\r |
391 | goto :jpegDone\r | |
392 | \r | |
393 | :haveJpeg\r | |
394 | echo ...JPEG header available, building with JPEG support.\r | |
395 | set HAVE_JPEG=1\r | |
396 | \r | |
397 | :jpegDone\r | |
398 | rm -f junk.c junk.obj\r | |
399 | \r | |
12ff2dc5 JB |
400 | if (%gifsupport%) == (N) goto gifDone\r |
401 | \r | |
507f5dce | 402 | echo Checking for libgif...\r |
12ff2dc5 JB |
403 | echo #include "gif_lib.h" >junk.c\r |
404 | echo main (){} >>junk.c\r | |
405 | rem -o option is ignored with cl, but allows result to be consistent.\r | |
dbbdb507 EZ |
406 | echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r |
407 | %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r | |
12ff2dc5 JB |
408 | if exist junk.obj goto haveGif\r |
409 | \r | |
507f5dce | 410 | echo ...gif_lib.h not found, building without GIF support.\r |
dbbdb507 EZ |
411 | echo The failed program was: >>config.log\r |
412 | type junk.c >>config.log\r | |
12ff2dc5 JB |
413 | set HAVE_GIF=\r |
414 | goto :gifDone\r | |
415 | \r | |
416 | :haveGif\r | |
417 | echo ...GIF header available, building with GIF support.\r | |
418 | set HAVE_GIF=1\r | |
419 | \r | |
420 | :gifDone\r | |
421 | rm -f junk.c junk.obj\r | |
422 | \r | |
47c01e80 JB |
423 | if (%tiffsupport%) == (N) goto tiffDone\r |
424 | \r | |
425 | echo Checking for tiff...\r | |
426 | echo #include "tiffio.h" >junk.c\r | |
427 | echo main (){} >>junk.c\r | |
428 | rem -o option is ignored with cl, but allows result to be consistent.\r | |
dbbdb507 EZ |
429 | echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r |
430 | %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r | |
47c01e80 JB |
431 | if exist junk.obj goto haveTiff\r |
432 | \r | |
507f5dce | 433 | echo ...tiffio.h not found, building without TIFF support.\r |
dbbdb507 EZ |
434 | echo The failed program was: >>config.log\r |
435 | type junk.c >>config.log\r | |
47c01e80 JB |
436 | set HAVE_TIFF=\r |
437 | goto :tiffDone\r | |
438 | \r | |
439 | :haveTiff\r | |
440 | echo ...TIFF header available, building with TIFF support.\r | |
441 | set HAVE_TIFF=1\r | |
442 | \r | |
443 | :tiffDone\r | |
444 | rm -f junk.c junk.obj\r | |
445 | \r | |
507f5dce JR |
446 | if (%xpmsupport%) == (N) goto xpmDone\r |
447 | \r | |
448 | echo Checking for libXpm...\r | |
449 | echo #define FOR_MSW 1 >junk.c\r | |
450 | echo #include "X11/xpm.h" >>junk.c\r | |
451 | echo main (){} >>junk.c\r | |
452 | rem -o option is ignored with cl, but allows result to be consistent.\r | |
dbbdb507 EZ |
453 | echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r |
454 | %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r | |
507f5dce JR |
455 | if exist junk.obj goto haveXpm\r |
456 | \r | |
457 | echo ...X11/xpm.h not found, building without XPM support.\r | |
dbbdb507 EZ |
458 | echo The failed program was: >>config.log\r |
459 | type junk.c >>config.log\r | |
507f5dce JR |
460 | set HAVE_XPM=\r |
461 | goto :xpmDone\r | |
462 | \r | |
463 | :haveXpm\r | |
464 | echo ...XPM header available, building with XPM support.\r | |
465 | set HAVE_XPM=1\r | |
466 | \r | |
467 | :xpmDone\r | |
468 | rm -f junk.c junk.obj junk.err junk.out\r | |
469 | \r | |
f466241d EZ |
470 | rem ----------------------------------------------------------------------\r |
471 | :genmakefiles\r | |
472 | echo Generating makefiles\r | |
473 | if %COMPILER% == gcc set MAKECMD=gmake\r | |
474 | if %COMPILER% == cl set MAKECMD=nmake\r | |
475 | \r | |
476 | rem Pass on chosen settings to makefiles.\r | |
477 | rem NB. Be very careful to not have a space before redirection symbols\r | |
478 | rem except when there is a preceding digit, when a space is required.\r | |
479 | rem\r | |
480 | echo # Start of settings from configure.bat >config.settings\r | |
481 | echo COMPILER=%COMPILER%>>config.settings\r | |
dbbdb507 | 482 | if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings\r |
f466241d EZ |
483 | if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r |
484 | if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r | |
485 | if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r | |
486 | if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings\r | |
3a1ebd63 EZ |
487 | rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r |
488 | rem and the if command cannot cope with this\r | |
489 | for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r | |
490 | if (%docflags%)==(Y) echo USER_CFLAGS=%usercflags%>>config.settings\r | |
491 | for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r | |
492 | if (%doldflags%)==(Y) echo USER_LDFLAGS=%userldflags%>>config.settings\r | |
2cd47384 | 493 | if (%usefontbackend%) == (Y) echo USE_FONTBACKEND=1 >>config.settings\r |
f466241d EZ |
494 | echo # End of settings from configure.bat>>config.settings\r |
495 | echo. >>config.settings\r | |
496 | \r | |
c262c68c EZ |
497 | copy config.nt config.tmp\r |
498 | echo. >>config.tmp\r | |
499 | echo /* Start of settings from configure.bat. */ >>config.tmp\r | |
3a1ebd63 EZ |
500 | if (%docflags%) == (Y) echo #define USER_CFLAGS " %usercflags%">>config.tmp\r |
501 | if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %userldflags%">>config.tmp\r | |
c262c68c EZ |
502 | if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r |
503 | if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r | |
504 | if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r | |
505 | if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r | |
506 | if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp\r | |
507 | echo /* End of settings from configure.bat. */ >>config.tmp\r | |
508 | \r | |
509 | Rem See if fc.exe returns a meaningful exit status. If it does, we\r | |
510 | Rem might as well avoid unnecessary overwriting of config.h and epaths.h,\r | |
511 | Rem since this forces recompilation of every source file.\r | |
512 | if exist foo.bar del foo.bar\r | |
513 | fc /b foo.bar foo.bar >nul 2>&1\r | |
514 | if not errorlevel 2 goto doCopy\r | |
515 | fc /b config.tmp ..\src\config.h >nul 2>&1\r | |
516 | if errorlevel 1 goto doCopy\r | |
517 | fc /b paths.h ..\src\epaths.h >nul 2>&1\r | |
518 | if errorlevel 0 goto dontCopy\r | |
519 | :doCopy\r | |
520 | copy config.tmp ..\src\config.h\r | |
f466241d EZ |
521 | copy paths.h ..\src\epaths.h\r |
522 | \r | |
c262c68c EZ |
523 | :dontCopy\r |
524 | if exist config.tmp del config.tmp\r | |
f466241d EZ |
525 | copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r |
526 | copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r | |
527 | copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r | |
8aee12d0 GM |
528 | copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in ..\doc\emacs\makefile\r |
529 | copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in ..\doc\misc\makefile\r | |
530 | copy /b config.settings+%MAKECMD%.defs+..\doc\lispref\makefile.w32-in ..\doc\lispref\makefile\r | |
531 | copy /b config.settings+%MAKECMD%.defs+..\doc\lispintro\makefile.w32-in ..\doc\lispintro\makefile\r | |
f466241d EZ |
532 | if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r |
533 | copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r | |
534 | rem Use the default (no-op) Makefile.in if the nt version is not present.\r | |
535 | if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r | |
536 | if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r | |
537 | del config.settings\r | |
538 | \r | |
e44f8099 EZ |
539 | Rem Some people use WinZip which doesn't create empty directories!\r |
540 | if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r | |
57a64408 JB |
541 | Rem Update subdirs.el only if it is different or fc.exe doesn't work.\r |
542 | if exist foo.bar del foo.bar\r | |
543 | fc /b foo.bar foo.bar >nul 2>&1\r | |
544 | if not errorlevel 2 goto doUpdateSubdirs\r | |
545 | fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1\r | |
546 | if not errorlevel 1 goto dontUpdateSubdirs\r | |
547 | :doUpdateSubdirs\r | |
548 | if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el\r | |
549 | copy subdirs.el ..\site-lisp\subdirs.el\r | |
550 | \r | |
551 | :dontUpdateSubdirs\r | |
f466241d | 552 | echo.\r |
32154d10 JR |
553 | \r |
554 | rem check that we have all the libraries we need.\r | |
555 | set libsOK=1\r | |
556 | \r | |
557 | if not "(%HAVE_XPM%)" == "()" goto checkpng\r | |
558 | if (%xpmsupport%) == (N) goto checkpng\r | |
559 | set libsOK=0\r | |
560 | echo XPM support is missing. It is required for color icons in the toolbar.\r | |
561 | echo Install libXpm development files or use --without-xpm\r | |
562 | \r | |
563 | :checkpng\r | |
564 | if not "(%HAVE_PNG%)" == "()" goto checkjpeg\r | |
565 | if (%pngsupport%) == (N) goto checkjpeg\r | |
566 | set libsOK=0\r | |
567 | echo PNG support is missing.\r | |
568 | echo Install libpng development files or use --without-png\r | |
569 | \r | |
570 | :checkjpeg\r | |
571 | if not "(%HAVE_JPEG%)" == "()" goto checktiff\r | |
572 | if (%jpegsupport%) == (N) goto checktiff\r | |
573 | set libsOK=0\r | |
574 | echo JPEG support is missing.\r | |
575 | echo Install jpeg development files or use --without-jpeg\r | |
576 | \r | |
577 | :checktiff\r | |
578 | if not "(%HAVE_TIFF%)" == "()" goto checkgif\r | |
579 | if (%tiffsupport%) == (N) goto checkgif\r | |
580 | set libsOK=0\r | |
581 | echo TIFF support is missing.\r | |
582 | echo Install libtiff development files or use --without-tiff\r | |
583 | \r | |
584 | :checkgif\r | |
585 | if not "(%HAVE_GIF%)" == "()" goto donelibchecks\r | |
586 | if (%gifsupport%) == (N) goto donelibchecks\r | |
587 | set libsOK=0\r | |
588 | echo GIF support is missing.\r | |
589 | echo Install giflib or libungif development files or use --without-gif\r | |
590 | \r | |
591 | :donelibchecks\r | |
592 | if (%libsOK%) == (1) goto success\r | |
593 | echo.\r | |
594 | echo Important libraries are missing. Fix these issues before running make.\r | |
595 | goto end\r | |
596 | \r | |
597 | :success\r | |
f466241d | 598 | echo Emacs successfully configured.\r |
a27014fc | 599 | echo Emacs successfully configured. >>config.log\r |
f466241d EZ |
600 | echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r |
601 | goto end\r | |
602 | \r | |
603 | :SmallEnv\r | |
604 | echo Your environment size is too small. Please enlarge it and rerun configure.\r | |
605 | echo For example, type "command.com /e:2048" to have 2048 bytes available.\r | |
606 | set $foo$=\r | |
607 | :end\r | |
608 | set prefix=\r | |
609 | set nodebug=\r | |
610 | set noopt=\r | |
611 | set nocygwin=\r | |
612 | set COMPILER=\r | |
613 | set MAKECMD=\r | |
614 | set usercflags=\r | |
3a1ebd63 | 615 | set docflags=\r |
f466241d | 616 | set userldflags=\r |
3a1ebd63 | 617 | set doldflags=\r |
112dc8e1 | 618 | set mingwflag=\r |
dbbdb507 | 619 | set mf=\r |
a2fcf029 MB |
620 | \r |
621 | goto skipArchTag\r | |
622 | arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c\r | |
623 | :skipArchTag\r |