(edebug-eval-mode-map): Don't copy lisp-interaction-mode-map but make
[bpt/emacs.git] / nt / configure.bat
CommitLineData
f466241d
EZ
1@echo off\r
2rem ----------------------------------------------------------------------\r
12ff2dc5
JB
3rem Configuration script for MS Windows 95/98/Me and NT/2000/XP\r
4rem Copyright (C) 1999-2003 Free Software Foundation, Inc.\r
f466241d
EZ
5\r
6rem This file is part of GNU Emacs.\r
7\r
8rem GNU Emacs is free software; you can redistribute it and/or modify\r
9rem it under the terms of the GNU General Public License as published by\r
10rem the Free Software Foundation; either version 2, or (at your option)\r
11rem any later version.\r
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
19rem along with GNU Emacs; see the file COPYING. If not, write to the\r
20rem Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r
21rem Boston, MA 02111-1307, USA.\r
22rem ----------------------------------------------------------------------\r
23rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r
24rem\r
12ff2dc5 25rem + MS Windows 95/98/Me or NT/2000/XP\r
f466241d
EZ
26rem + either MSVC 2.x or later, or gcc-2.95 or later (with gmake 3.75\r
27rem or later) and the Mingw32 and W32 API headers and libraries\r
28rem\r
29rem For reference, here is a list of which builds of gmake are known to\r
30rem work or not, and whether they work in the presence and/or absence of\r
31rem sh.exe.\r
7019fb66 32rem\r
f466241d
EZ
33rem sh exists no sh\r
34rem cygwin b20.1 make (3.75): okay[1] fails[2]\r
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
38rem mingw32/gcc-2.92.2 make (3.77): okay okay\r
39rem cygwin compiled gmake 3.77: okay[1] fails[2]\r
40rem cygwin compiled gmake 3.78.1: okay fails[2]\r
41rem cygwin compiled gmake 3.79.1: couldn't build make[3]\r
42rem\r
43rem [1] doesn't cope with makefiles with DOS line endings, so must mount\r
44rem emacs source with text!=binary.\r
45rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.\r
46rem [3] requires LC_MESSAGES support to build; maybe 2.95.x update to\r
47rem cygwin provides this?\r
48rem\r
49\r
50rem ----------------------------------------------------------------------\r
51rem See if the environment is large enough. We need 43 (?) bytes.\r
52set $foo$=123456789_123456789_123456789_123456789_123\r
53if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv\r
54set $foo$=\r
55\r
56rem ----------------------------------------------------------------------\r
57rem Make sure we are running in the nt subdir\r
58if exist configure.bat goto start\r
59echo You must run configure from the nt subdirectory.\r
60goto end\r
61\r
62:start\r
63rem ----------------------------------------------------------------------\r
64rem Default settings.\r
65set prefix=\r
66set nodebug=N\r
67set noopt=N\r
68set nocygwin=N\r
69set COMPILER=\r
70set usercflags=\r
71set userldflags=\r
72set sep1=\r
73set sep2=\r
74\r
75rem ----------------------------------------------------------------------\r
76rem Handle arguments.\r
77:again\r
78if "%1" == "-h" goto usage\r
79if "%1" == "--help" goto usage\r
80if "%1" == "--prefix" goto setprefix\r
81if "%1" == "--with-gcc" goto withgcc\r
82if "%1" == "--with-msvc" goto withmsvc\r
83if "%1" == "--no-debug" goto nodebug\r
84if "%1" == "--no-opt" goto noopt\r
85if "%1" == "--no-cygwin" goto nocygwin\r
86if "%1" == "--cflags" goto usercflags\r
87if "%1" == "--ldflags" goto userldflags\r
e0006538 88if "%1" == "--without-png" goto withoutpng\r
aad0eae4 89if "%1" == "--without-jpeg" goto withoutjpeg\r
12ff2dc5 90if "%1" == "--without-gif" goto withoutgif\r
47c01e80 91if "%1" == "--without-tiff" goto withouttiff\r
507f5dce 92if "%1" == "--without-xpm" goto withoutxpm\r
f466241d
EZ
93if "%1" == "" goto checkutils\r
94:usage\r
95echo Usage: configure [options]\r
96echo Options:\r
97echo. --prefix PREFIX install Emacs in directory PREFIX\r
98echo. --with-gcc use GCC to compile Emacs\r
99echo. --with-msvc use MSVC to compile Emacs\r
100echo. --no-debug exclude debug info from executables\r
101echo. --no-opt disable optimization\r
102echo. --no-cygwin use -mno-cygwin option with GCC\r
103echo. --cflags FLAG pass FLAG to compiler\r
104echo. --ldflags FLAG pass FLAG to compiler when linking\r
7019fb66 105echo. --without-png do not use libpng even if it is installed\r
507f5dce
JR
106echo. --without-jpeg do not use jpeg-6b even if it is installed\r
107echo. --without-gif do not use libungif even if it is installed\r
6ed82072
JB
108echo. --without-tiff do not use libtiff even if it is installed\r
109echo. --without-xpm do not use libXpm even if it is installed\r
f466241d
EZ
110goto end\r
111rem ----------------------------------------------------------------------\r
112:setprefix\r
113shift\r
114set prefix=%1\r
115shift\r
116goto again\r
117rem ----------------------------------------------------------------------\r
118:withgcc\r
119set COMPILER=gcc\r
120shift\r
121goto again\r
122rem ----------------------------------------------------------------------\r
123:withmsvc\r
124set COMPILER=cl\r
125shift\r
126goto again\r
127rem ----------------------------------------------------------------------\r
128:nodebug\r
129set nodebug=Y\r
130shift\r
131goto again\r
132rem ----------------------------------------------------------------------\r
133:noopt\r
134set noopt=Y\r
135shift\r
136goto again\r
137rem ----------------------------------------------------------------------\r
138:nocygwin\r
139set nocygwin=Y\r
140shift\r
141goto again\r
142rem ----------------------------------------------------------------------\r
143:usercflags\r
144shift\r
145set usercflags=%usercflags%%sep1%%1\r
146set sep1= %nothing%\r
147shift\r
148goto again\r
149rem ----------------------------------------------------------------------\r
150:userldflags\r
151shift\r
152set userldflags=%userldflags%%sep2%%1\r
153set sep2= %nothing%\r
154shift\r
155goto again\r
e0006538
JR
156rem ----------------------------------------------------------------------\r
157\r
158:withoutpng\r
159set pngsupport=N\r
160set HAVE_PNG=\r
39bd0e03 161shift\r
e0006538 162goto again\r
f466241d 163\r
aad0eae4
JR
164rem ----------------------------------------------------------------------\r
165\r
166:withoutjpeg\r
167set jpegsupport=N\r
168set HAVE_JPEG=\r
39bd0e03 169shift\r
aad0eae4
JR
170goto again\r
171\r
12ff2dc5
JB
172rem ----------------------------------------------------------------------\r
173\r
174:withoutgif\r
175set gifsupport=N\r
176set HAVE_GIF=\r
177shift\r
178goto again\r
179\r
47c01e80
JB
180rem ----------------------------------------------------------------------\r
181\r
182:withouttiff\r
183set tiffsupport=N\r
184set HAVE_TIFF=\r
185shift\r
186goto again\r
187\r
507f5dce
JR
188rem ----------------------------------------------------------------------\r
189\r
190:withoutxpm\r
191set xpmsupport=N\r
192set HAVE_XPM=\r
193shift\r
194goto again\r
195\r
f466241d
EZ
196rem ----------------------------------------------------------------------\r
197rem Check that necessary utilities (cp and rm) are present.\r
198:checkutils\r
199echo Checking for 'cp'...\r
200cp configure.bat junk.bat\r
201if not exist junk.bat goto needcp\r
202echo Checking for 'rm'...\r
203rm junk.bat\r
204if exist junk.bat goto needrm\r
205goto checkcompiler\r
206:needcp\r
207echo You need 'cp' (the Unix file copy program) to build Emacs.\r
208goto end\r
209:needrm\r
210del junk.bat\r
211echo You need 'rm' (the Unix file delete program) to build Emacs.\r
212goto end\r
213\r
214rem ----------------------------------------------------------------------\r
215rem Auto-detect compiler if not specified, and validate GCC if chosen.\r
216:checkcompiler\r
e0006538 217if (%COMPILER%)==(cl) goto compilercheckdone\r
f466241d
EZ
218if (%COMPILER%)==(gcc) goto checkgcc\r
219\r
220echo Checking whether 'cl' is available...\r
221echo main(){} >junk.c\r
222cl -nologo -c junk.c\r
223if exist junk.obj goto clOK\r
224\r
225echo Checking whether 'gcc' is available...\r
226gcc -c junk.c\r
227if not exist junk.o goto nocompiler\r
228del junk.o\r
229\r
230:checkgcc\r
231Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
232Rem 8 characters of a label. So do NOT be tempted to change\r
233Rem chkapi* into something fancier like checkw32api\r
234Rem You HAVE been warned!\r
235if (%nocygwin%) == (Y) goto chkapi\r
236echo Checking whether gcc requires '-mno-cygwin'...\r
237echo #include "cygwin/version.h" >junk.c\r
238echo main(){} >>junk.c\r
239gcc -c junk.c\r
240if not exist junk.o goto chkapi\r
241gcc -mno-cygwin -c junk.c\r
242if exist junk.o set nocygwin=Y\r
243rm -f junk.c junk.o\r
244\r
245:chkapi\r
246rem ----------------------------------------------------------------------\r
247rem Older versions of the Windows API headers either don't have any of\r
248rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
249rem are like this), or have a typo in the definition of\r
250rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r
251rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros\r
252rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
253rem\r
254echo Checking whether W32 API headers are too old...\r
255echo #include "windows.h" >junk.c\r
256echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
257echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
258if (%nocygwin%) == (Y) goto chkapi1\r
259set cf=%usercflags%\r
260goto chkapi2\r
261:chkapi1\r
262set cf=%usercflags% -mno-cygwin\r
263:chkapi2\r
264echo on\r
265gcc %cf% -c junk.c\r
266echo off\r
267set cf=\r
268if exist junk.o goto gccOk\r
269\r
270:nocompiler\r
271echo.\r
272echo Configure failed.\r
273echo To configure Emacs for Windows, you need to have either\r
274echo gcc-2.95 or later with Mingw32 and the W32 API headers,\r
275echo or MSVC 2.x or later.\r
276del junk.c\r
277goto end\r
278\r
279:gccOk\r
280set COMPILER=gcc\r
281rm -f junk.c junk.o\r
282echo Using 'gcc'\r
e0006538 283goto compilercheckdone\r
f466241d
EZ
284\r
285:clOk\r
286set COMPILER=cl\r
287rm -f junk.c junk.obj\r
288echo Using 'MSVC'\r
e0006538
JR
289\r
290:compilercheckdone\r
291\r
292rem ----------------------------------------------------------------------\r
293rem Check for external image libraries. Since they are loaded\r
294rem dynamically, the libraries themselves do not need to be present\r
295rem at compile time, but the header files are required.\r
296\r
112dc8e1
JR
297set mingwflag=\r
298\r
299if (%nocygwin%) == (N) goto flagsOK\r
300set mingwflag=-mno-cygwin\r
301\r
302:flagsOK\r
303\r
e0006538
JR
304if (%pngsupport%) == (N) goto pngDone\r
305\r
306echo Checking for libpng...\r
307echo #include "png.h" >junk.c\r
308echo main (){} >>junk.c\r
309rem -o option is ignored with cl, but allows result to be consistent.\r
112dc8e1 310%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>junk.err\r
e0006538
JR
311if exist junk.obj goto havePng\r
312\r
507f5dce 313echo ...png.h not found, building without PNG support.\r
e0006538
JR
314set HAVE_PNG=\r
315goto :pngDone\r
316\r
317:havePng\r
318echo ...PNG header available, building with PNG support.\r
319set HAVE_PNG=1\r
320\r
321:pngDone\r
322rm -f junk.c junk.obj\r
f466241d 323\r
aad0eae4
JR
324if (%jpegsupport%) == (N) goto jpegDone\r
325\r
507f5dce 326echo Checking for jpeg-6b...\r
aad0eae4
JR
327echo #include "jconfig.h" >junk.c\r
328echo main (){} >>junk.c\r
329rem -o option is ignored with cl, but allows result to be consistent.\r
112dc8e1 330%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>junk.err\r
aad0eae4
JR
331if exist junk.obj goto haveJpeg\r
332\r
507f5dce 333echo ...jconfig.h not found, building without JPEG support.\r
aad0eae4
JR
334set HAVE_JPEG=\r
335goto :jpegDone\r
336\r
337:haveJpeg\r
338echo ...JPEG header available, building with JPEG support.\r
339set HAVE_JPEG=1\r
340\r
341:jpegDone\r
342rm -f junk.c junk.obj\r
343\r
12ff2dc5
JB
344if (%gifsupport%) == (N) goto gifDone\r
345\r
507f5dce 346echo Checking for libgif...\r
12ff2dc5
JB
347echo #include "gif_lib.h" >junk.c\r
348echo main (){} >>junk.c\r
349rem -o option is ignored with cl, but allows result to be consistent.\r
112dc8e1 350%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>junk.err\r
12ff2dc5
JB
351if exist junk.obj goto haveGif\r
352\r
507f5dce 353echo ...gif_lib.h not found, building without GIF support.\r
12ff2dc5
JB
354set HAVE_GIF=\r
355goto :gifDone\r
356\r
357:haveGif\r
358echo ...GIF header available, building with GIF support.\r
359set HAVE_GIF=1\r
360\r
361:gifDone\r
362rm -f junk.c junk.obj\r
363\r
47c01e80
JB
364if (%tiffsupport%) == (N) goto tiffDone\r
365\r
366echo Checking for tiff...\r
367echo #include "tiffio.h" >junk.c\r
368echo main (){} >>junk.c\r
369rem -o option is ignored with cl, but allows result to be consistent.\r
112dc8e1 370%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>junk.err\r
47c01e80
JB
371if exist junk.obj goto haveTiff\r
372\r
507f5dce 373echo ...tiffio.h not found, building without TIFF support.\r
47c01e80
JB
374set HAVE_TIFF=\r
375goto :tiffDone\r
376\r
377:haveTiff\r
378echo ...TIFF header available, building with TIFF support.\r
379set HAVE_TIFF=1\r
380\r
381:tiffDone\r
382rm -f junk.c junk.obj\r
383\r
507f5dce
JR
384if (%xpmsupport%) == (N) goto xpmDone\r
385\r
386echo Checking for libXpm...\r
387echo #define FOR_MSW 1 >junk.c\r
388echo #include "X11/xpm.h" >>junk.c\r
389echo main (){} >>junk.c\r
390rem -o option is ignored with cl, but allows result to be consistent.\r
112dc8e1 391%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>junk.err\r
507f5dce
JR
392if exist junk.obj goto haveXpm\r
393\r
394echo ...X11/xpm.h not found, building without XPM support.\r
395set HAVE_XPM=\r
396goto :xpmDone\r
397\r
398:haveXpm\r
399echo ...XPM header available, building with XPM support.\r
400set HAVE_XPM=1\r
401\r
402:xpmDone\r
403rm -f junk.c junk.obj junk.err junk.out\r
404\r
f466241d
EZ
405rem ----------------------------------------------------------------------\r
406:genmakefiles\r
407echo Generating makefiles\r
408if %COMPILER% == gcc set MAKECMD=gmake\r
409if %COMPILER% == cl set MAKECMD=nmake\r
410\r
411rem Pass on chosen settings to makefiles.\r
412rem NB. Be very careful to not have a space before redirection symbols\r
413rem except when there is a preceding digit, when a space is required.\r
414rem\r
415echo # Start of settings from configure.bat >config.settings\r
416echo COMPILER=%COMPILER%>>config.settings\r
417if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r
418if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r
419if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r
420if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings\r
421if not "(%usercflags%)" == "()" echo USER_CFLAGS=%usercflags%>>config.settings\r
422if not "(%userldflags%)" == "()" echo USER_LDFLAGS=%userldflags%>>config.settings\r
423echo # End of settings from configure.bat>>config.settings\r
424echo. >>config.settings\r
425\r
426copy config.nt ..\src\config.h\r
e0006538
JR
427echo. >>..\src\config.h\r
428echo /* Start of settings from configure.bat. */ >>..\src\config.h\r
f466241d
EZ
429if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h\r
430if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h\r
e0006538 431if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>..\src\config.h\r
aad0eae4 432if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>..\src\config.h\r
12ff2dc5 433if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>..\src\config.h\r
47c01e80 434if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>..\src\config.h\r
507f5dce 435if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>..\src\config.h\r
e0006538
JR
436echo /* End of settings from configure.bat. */ >>..\src\config.h\r
437\r
f466241d
EZ
438copy paths.h ..\src\epaths.h\r
439\r
440copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
441copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
442copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
80c164ec
JR
443copy /b config.settings+%MAKECMD%.defs+..\man\makefile.w32-in ..\man\makefile\r
444copy /b config.settings+%MAKECMD%.defs+..\lispref\makefile.w32-in ..\lispref\makefile\r
445copy /b config.settings+%MAKECMD%.defs+..\lispintro\makefile.w32-in ..\lispintro\makefile\r
f466241d
EZ
446if not exist ..\lisp\Makefile.unix rename ..\lisp\Makefile.in Makefile.unix\r
447if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
448copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
449rem Use the default (no-op) Makefile.in if the nt version is not present.\r
450if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r
451if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
452del config.settings\r
453\r
e44f8099
EZ
454Rem Some people use WinZip which doesn't create empty directories!\r
455if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
f466241d
EZ
456if not exist ..\site-lisp\subdirs.el copy subdirs.el ..\site-lisp\subdirs.el\r
457\r
458echo.\r
459echo Emacs successfully configured.\r
460echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
461goto end\r
462\r
463:SmallEnv\r
464echo Your environment size is too small. Please enlarge it and rerun configure.\r
465echo For example, type "command.com /e:2048" to have 2048 bytes available.\r
466set $foo$=\r
467:end\r
468set prefix=\r
469set nodebug=\r
470set noopt=\r
471set nocygwin=\r
472set COMPILER=\r
473set MAKECMD=\r
474set usercflags=\r
475set userldflags=\r
112dc8e1 476set mingwflag=\r
a2fcf029
MB
477\r
478goto skipArchTag\r
479 arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c\r
480:skipArchTag\r