(init_jpeg_functions, jpeg_resync_to_restart_wrapper):
[bpt/emacs.git] / nt / configure.bat
CommitLineData
f466241d
EZ
1@echo off\r
2rem ----------------------------------------------------------------------\r
3rem Configuration script for MS Windows 95/98 and NT/2000\r
4rem Copyright (C) 1999-2001 Free Software Foundation, Inc.\r
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
25rem + MS Windows 95/98 or NT/2000\r
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
32rem \r
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
f466241d
EZ
89if "%1" == "" goto checkutils\r
90:usage\r
91echo Usage: configure [options]\r
92echo Options:\r
93echo. --prefix PREFIX install Emacs in directory PREFIX\r
94echo. --with-gcc use GCC to compile Emacs\r
95echo. --with-msvc use MSVC to compile Emacs\r
96echo. --no-debug exclude debug info from executables\r
97echo. --no-opt disable optimization\r
98echo. --no-cygwin use -mno-cygwin option with GCC\r
99echo. --cflags FLAG pass FLAG to compiler\r
100echo. --ldflags FLAG pass FLAG to compiler when linking\r
e0006538 101echo. --without-png do not use libpng even if it is installed \r
f466241d
EZ
102goto end\r
103rem ----------------------------------------------------------------------\r
104:setprefix\r
105shift\r
106set prefix=%1\r
107shift\r
108goto again\r
109rem ----------------------------------------------------------------------\r
110:withgcc\r
111set COMPILER=gcc\r
112shift\r
113goto again\r
114rem ----------------------------------------------------------------------\r
115:withmsvc\r
116set COMPILER=cl\r
117shift\r
118goto again\r
119rem ----------------------------------------------------------------------\r
120:nodebug\r
121set nodebug=Y\r
122shift\r
123goto again\r
124rem ----------------------------------------------------------------------\r
125:noopt\r
126set noopt=Y\r
127shift\r
128goto again\r
129rem ----------------------------------------------------------------------\r
130:nocygwin\r
131set nocygwin=Y\r
132shift\r
133goto again\r
134rem ----------------------------------------------------------------------\r
135:usercflags\r
136shift\r
137set usercflags=%usercflags%%sep1%%1\r
138set sep1= %nothing%\r
139shift\r
140goto again\r
141rem ----------------------------------------------------------------------\r
142:userldflags\r
143shift\r
144set userldflags=%userldflags%%sep2%%1\r
145set sep2= %nothing%\r
146shift\r
147goto again\r
e0006538
JR
148rem ----------------------------------------------------------------------\r
149\r
150:withoutpng\r
151set pngsupport=N\r
152set HAVE_PNG=\r
153goto again\r
f466241d
EZ
154\r
155rem ----------------------------------------------------------------------\r
156rem Check that necessary utilities (cp and rm) are present.\r
157:checkutils\r
158echo Checking for 'cp'...\r
159cp configure.bat junk.bat\r
160if not exist junk.bat goto needcp\r
161echo Checking for 'rm'...\r
162rm junk.bat\r
163if exist junk.bat goto needrm\r
164goto checkcompiler\r
165:needcp\r
166echo You need 'cp' (the Unix file copy program) to build Emacs.\r
167goto end\r
168:needrm\r
169del junk.bat\r
170echo You need 'rm' (the Unix file delete program) to build Emacs.\r
171goto end\r
172\r
173rem ----------------------------------------------------------------------\r
174rem Auto-detect compiler if not specified, and validate GCC if chosen.\r
175:checkcompiler\r
e0006538 176if (%COMPILER%)==(cl) goto compilercheckdone\r
f466241d
EZ
177if (%COMPILER%)==(gcc) goto checkgcc\r
178\r
179echo Checking whether 'cl' is available...\r
180echo main(){} >junk.c\r
181cl -nologo -c junk.c\r
182if exist junk.obj goto clOK\r
183\r
184echo Checking whether 'gcc' is available...\r
185gcc -c junk.c\r
186if not exist junk.o goto nocompiler\r
187del junk.o\r
188\r
189:checkgcc\r
190Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
191Rem 8 characters of a label. So do NOT be tempted to change\r
192Rem chkapi* into something fancier like checkw32api\r
193Rem You HAVE been warned!\r
194if (%nocygwin%) == (Y) goto chkapi\r
195echo Checking whether gcc requires '-mno-cygwin'...\r
196echo #include "cygwin/version.h" >junk.c\r
197echo main(){} >>junk.c\r
198gcc -c junk.c\r
199if not exist junk.o goto chkapi\r
200gcc -mno-cygwin -c junk.c\r
201if exist junk.o set nocygwin=Y\r
202rm -f junk.c junk.o\r
203\r
204:chkapi\r
205rem ----------------------------------------------------------------------\r
206rem Older versions of the Windows API headers either don't have any of\r
207rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
208rem are like this), or have a typo in the definition of\r
209rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r
210rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros\r
211rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
212rem\r
213echo Checking whether W32 API headers are too old...\r
214echo #include "windows.h" >junk.c\r
215echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
216echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
217if (%nocygwin%) == (Y) goto chkapi1\r
218set cf=%usercflags%\r
219goto chkapi2\r
220:chkapi1\r
221set cf=%usercflags% -mno-cygwin\r
222:chkapi2\r
223echo on\r
224gcc %cf% -c junk.c\r
225echo off\r
226set cf=\r
227if exist junk.o goto gccOk\r
228\r
229:nocompiler\r
230echo.\r
231echo Configure failed.\r
232echo To configure Emacs for Windows, you need to have either\r
233echo gcc-2.95 or later with Mingw32 and the W32 API headers,\r
234echo or MSVC 2.x or later.\r
235del junk.c\r
236goto end\r
237\r
238:gccOk\r
239set COMPILER=gcc\r
240rm -f junk.c junk.o\r
241echo Using 'gcc'\r
e0006538 242goto compilercheckdone\r
f466241d
EZ
243\r
244:clOk\r
245set COMPILER=cl\r
246rm -f junk.c junk.obj\r
247echo Using 'MSVC'\r
e0006538
JR
248\r
249:compilercheckdone\r
250\r
251rem ----------------------------------------------------------------------\r
252rem Check for external image libraries. Since they are loaded\r
253rem dynamically, the libraries themselves do not need to be present\r
254rem at compile time, but the header files are required.\r
255\r
256if (%pngsupport%) == (N) goto pngDone\r
257\r
258echo Checking for libpng...\r
259echo #include "png.h" >junk.c\r
260echo main (){} >>junk.c\r
261rem -o option is ignored with cl, but allows result to be consistent.\r
262%COMPILER% %usercflags% -c junk.c -o junk.obj\r
263if exist junk.obj goto havePng\r
264\r
265echo ...building without PNG support.\r
266set HAVE_PNG=\r
267goto :pngDone\r
268\r
269:havePng\r
270echo ...PNG header available, building with PNG support.\r
271set HAVE_PNG=1\r
272\r
273:pngDone\r
274rm -f junk.c junk.obj\r
f466241d
EZ
275\r
276rem ----------------------------------------------------------------------\r
277:genmakefiles\r
278echo Generating makefiles\r
279if %COMPILER% == gcc set MAKECMD=gmake\r
280if %COMPILER% == cl set MAKECMD=nmake\r
281\r
282rem Pass on chosen settings to makefiles.\r
283rem NB. Be very careful to not have a space before redirection symbols\r
284rem except when there is a preceding digit, when a space is required.\r
285rem\r
286echo # Start of settings from configure.bat >config.settings\r
287echo COMPILER=%COMPILER%>>config.settings\r
288if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r
289if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r
290if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r
291if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings\r
292if not "(%usercflags%)" == "()" echo USER_CFLAGS=%usercflags%>>config.settings\r
293if not "(%userldflags%)" == "()" echo USER_LDFLAGS=%userldflags%>>config.settings\r
294echo # End of settings from configure.bat>>config.settings\r
295echo. >>config.settings\r
296\r
297copy config.nt ..\src\config.h\r
e0006538
JR
298echo. >>..\src\config.h\r
299echo /* Start of settings from configure.bat. */ >>..\src\config.h\r
f466241d
EZ
300if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h\r
301if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h\r
e0006538
JR
302if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>..\src\config.h\r
303echo /* End of settings from configure.bat. */ >>..\src\config.h\r
304\r
f466241d
EZ
305copy paths.h ..\src\epaths.h\r
306\r
307copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
308copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
309copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
310if not exist ..\lisp\Makefile.unix rename ..\lisp\Makefile.in Makefile.unix\r
311if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
312copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
313rem Use the default (no-op) Makefile.in if the nt version is not present.\r
314if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r
315if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
316del config.settings\r
317\r
e44f8099
EZ
318Rem Some people use WinZip which doesn't create empty directories!\r
319if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
f466241d
EZ
320if not exist ..\site-lisp\subdirs.el copy subdirs.el ..\site-lisp\subdirs.el\r
321\r
322echo.\r
323echo Emacs successfully configured.\r
324echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
325goto end\r
326\r
327:SmallEnv\r
328echo Your environment size is too small. Please enlarge it and rerun configure.\r
329echo For example, type "command.com /e:2048" to have 2048 bytes available.\r
330set $foo$=\r
331:end\r
332set prefix=\r
333set nodebug=\r
334set noopt=\r
335set nocygwin=\r
336set COMPILER=\r
337set MAKECMD=\r
338set usercflags=\r
339set userldflags=\r