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