root/branches/2.1/nt/configure.meadow.bat

Revision 3634, 11.7 kB (checked in by kit, 4 years ago)

- Sync up with Emacs 21.4.
- some cleanups.
- add package/lisp directory to EMACSLOADPATH.
- do not use MEADOW_VERSION for install directory.

  • Property svn:eol-style set to CRLF
  • Property svn:executable set to
Line 
1 @echo off
2 rem   ----------------------------------------------------------------------
3 rem   Configuration script for MS Windows 95/98 and NT/2000
4 rem   Copyright (C) 1999-2001 Free Software Foundation, Inc.
5
6 rem   This file is part of GNU Emacs.
7
8 rem   GNU Emacs is free software; you can redistribute it and/or modify
9 rem   it under the terms of the GNU General Public License as published by
10 rem   the Free Software Foundation; either version 2, or (at your option)
11 rem   any later version.
12
13 rem   GNU Emacs is distributed in the hope that it will be useful,
14 rem   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 rem   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 rem   GNU General Public License for more details.
17
18 rem   You should have received a copy of the GNU General Public License
19 rem   along with GNU Emacs; see the file COPYING.  If not, write to the
20 rem   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 rem   Boston, MA 02111-1307, USA.
22 rem   ----------------------------------------------------------------------
23 rem   YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:
24 rem
25 rem   + MS Windows 95/98 or NT/2000
26 rem   + either MSVC 2.x or later, or gcc-2.95 or later (with gmake 3.75
27 rem     or later) and the Mingw32 and W32 API headers and libraries
28 rem
29 rem For reference, here is a list of which builds of gmake are known to
30 rem work or not, and whether they work in the presence and/or absence of
31 rem sh.exe.
32 rem 
33 rem                                       sh exists     no sh
34 rem  cygwin b20.1 make (3.75):            okay[1]       fails[2]
35 rem  MSVC compiled gmake 3.77:            okay          okay
36 rem  MSVC compiled gmake 3.78.1:          okay          okay
37 rem  MSVC compiled gmake 3.79.1:          okay          okay
38 rem  mingw32/gcc-2.92.2 make (3.77):      okay          okay
39 rem  cygwin compiled gmake 3.77:          okay[1]       fails[2]
40 rem  cygwin compiled gmake 3.78.1:        okay          fails[2]
41 rem  cygwin compiled gmake 3.79.1:        couldn't build make[3]
42 rem
43 rem [1] doesn't cope with makefiles with DOS line endings, so must mount
44 rem     emacs source with text!=binary.
45 rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.
46 rem [3] requires LC_MESSAGES support to build; maybe 2.95.x update to
47 rem     cygwin provides this?
48 rem
49
50 rem ----------------------------------------------------------------------
51 rem   See if the environment is large enough.  We need 43 (?) bytes.
52 set $foo$=123456789_123456789_123456789_123456789_123
53 if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv
54 set $foo$=
55
56 rem ----------------------------------------------------------------------
57 rem   Make sure we are running in the nt subdir
58 if exist configure.bat goto start
59 echo You must run configure from the nt subdirectory.
60 goto end
61
62 :start
63 rem ----------------------------------------------------------------------
64 rem   Default settings.
65 set prefix=
66 set magick=
67 set nodebug=N
68 set noopt=N
69 set nocygwin=N
70 set COMPILER=
71 set usercflags=
72 set userldflags=
73 set sep1=
74 set sep2=
75
76 rem ----------------------------------------------------------------------
77 rem   Handle arguments.
78 :again
79 if "%1" == "-h" goto usage
80 if "%1" == "--help" goto usage
81 if "%1" == "--prefix" goto setprefix
82 if "%1" == "--magick" goto setmagick
83 if "%1" == "--with-gcc" goto withgcc
84 if "%1" == "--with-msvc" goto withmsvc
85 if "%1" == "--no-debug" goto nodebug
86 if "%1" == "--no-opt" goto noopt
87 if "%1" == "--no-cygwin" goto nocygwin
88 if "%1" == "--cflags" goto usercflags
89 if "%1" == "--ldflags" goto userldflags
90 if "%1" == "" goto checkutils
91 :usage
92 echo Usage: configure [options]
93 echo Options:
94 echo.   --prefix PREFIX         install Emacs in directory PREFIX
95 echo.   --magick DIRECTORY      ImageMagick directory
96 echo.   --with-gcc              use GCC to compile Emacs
97 echo.   --with-msvc             use MSVC to compile Emacs
98 echo.   --no-debug              exclude debug info from executables
99 echo.   --no-opt                disable optimization
100 echo.   --no-cygwin             use -mno-cygwin option with GCC
101 echo.   --cflags FLAG           pass FLAG to compiler
102 echo.   --ldflags FLAG          pass FLAG to compiler when linking
103 goto end
104 rem ----------------------------------------------------------------------
105 :setprefix
106 shift
107 set prefix=%1
108 shift
109 goto again
110 rem ----------------------------------------------------------------------
111 :setmagick
112 shift
113 set magick=%1
114 shift
115 goto again
116 rem ----------------------------------------------------------------------
117 :withgcc
118 set COMPILER=gcc
119 shift
120 goto again
121 rem ----------------------------------------------------------------------
122 :withmsvc
123 set COMPILER=cl
124 shift
125 goto again
126 rem ----------------------------------------------------------------------
127 :nodebug
128 set nodebug=Y
129 shift
130 goto again
131 rem ----------------------------------------------------------------------
132 :noopt
133 set noopt=Y
134 shift
135 goto again
136 rem ----------------------------------------------------------------------
137 :nocygwin
138 set nocygwin=Y
139 shift
140 goto again
141 rem ----------------------------------------------------------------------
142 :usercflags
143 shift
144 set usercflags=%usercflags%%sep1%%1
145 set sep1= %nothing%
146 shift
147 goto again
148 rem ----------------------------------------------------------------------
149 :userldflags
150 shift
151 set userldflags=%userldflags%%sep2%%1
152 set sep2= %nothing%
153 shift
154 goto again
155
156 rem ----------------------------------------------------------------------
157 rem    Check that necessary utilities (cp and rm) are present.
158 :checkutils
159 rem In case of cl and nmake, cp and rm are not required.
160 rem So this test is skipped.
161 if (%COMPILER%)==(cl) goto checkcompiler
162 echo Checking for 'cp'...
163 cp configure.bat junk.bat
164 if not exist junk.bat goto needcp
165 echo Checking for 'rm'...
166 rm junk.bat
167 if exist junk.bat goto needrm
168 goto checkcompiler
169 :needcp
170 echo You need 'cp' (the Unix file copy program) to build Emacs.
171 goto end
172 :needrm
173 del junk.bat
174 echo You need 'rm' (the Unix file delete program) to build Emacs.
175 goto end
176
177 rem ----------------------------------------------------------------------
178 rem   Auto-detect compiler if not specified, and validate GCC if chosen.
179 :checkcompiler
180 if (%COMPILER%)==(cl) goto genmakefiles
181 if (%COMPILER%)==(gcc) goto checkgcc
182
183 echo Checking whether 'cl' is available...
184 echo main(){} >junk.c
185 cl -nologo -c junk.c
186 if exist junk.obj goto clOK
187
188 echo Checking whether 'gcc' is available...
189 gcc -c junk.c
190 if not exist junk.o goto nocompiler
191 del junk.o
192
193 :checkgcc
194 Rem WARNING -- COMMAND.COM on some systems only looks at the first
195 Rem            8 characters of a label.  So do NOT be tempted to change
196 Rem            chkapi* into something fancier like checkw32api
197 Rem You HAVE been warned!
198 if (%nocygwin%) == (Y) goto chkapi
199 echo Checking whether gcc requires '-mno-cygwin'...
200 echo #include "cygwin/version.h" >junk.c
201 echo main(){} >>junk.c
202 gcc -c junk.c
203 if not exist junk.o goto chkapi
204 gcc -mno-cygwin -c junk.c
205 if exist junk.o set nocygwin=Y
206 rm -f junk.c junk.o
207
208 :chkapi
209 rem ----------------------------------------------------------------------
210 rem   Older versions of the Windows API headers either don't have any of
211 rem   the IMAGE_xxx definitions (the headers that come with Cygwin b20.1
212 rem   are like this), or have a typo in the definition of
213 rem   IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this
214 rem   problem).  The gcc/mingw32 2.95.2 headers are okay, as are distros
215 rem   of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.
216 rem
217 echo Checking whether W32 API headers are too old...
218 echo #include "windows.h" >junk.c
219 echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c
220 echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c
221 if (%nocygwin%) == (Y) goto chkapi1
222 set cf=%usercflags%
223 goto chkapi2
224 :chkapi1
225 set cf=%usercflags% -mno-cygwin
226 :chkapi2
227 echo on
228 gcc %cf% -c junk.c
229 echo off
230 set cf=
231 if exist junk.o goto gccOk
232
233 :nocompiler
234 echo.
235 echo Configure failed.
236 echo To configure Emacs for Windows, you need to have either
237 echo gcc-2.95 or later with Mingw32 and the W32 API headers,
238 echo or MSVC 2.x or later.
239 del junk.c
240 goto end
241
242 :gccOk
243 set COMPILER=gcc
244 rm -f junk.c junk.o
245 echo Using 'gcc'
246 goto genmakefiles
247
248 :clOk
249 set COMPILER=cl
250 rm -f junk.c junk.obj
251 echo Using 'MSVC'
252 goto genmakefiles
253
254 rem ----------------------------------------------------------------------
255 :genmakefiles
256 if not (%magick%) == () goto genmakefiles2
257 echo Error: --magick is not specified.
258 goto end
259
260 :genmakefiles2
261 echo Generating makefiles
262
263 rem   Pass on chosen settings to makefiles.
264 rem   NB. Be very careful to not have a space before redirection symbols
265 rem   except when there is a preceding digit, when a space is required.
266 rem
267 echo # Start of settings from configure.bat >config.settings
268 echo COMPILER=%COMPILER%>>config.settings
269 if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings
270 if (%noopt%) == (Y) echo NOOPT=1 >>config.settings
271 if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings
272 if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings
273 echo MAGICKDIR=%magick%>>config.settings
274 if not "(%usercflags%)" == "()" echo USER_CFLAGS=%usercflags%>>config.settings
275 if not "(%userldflags%)" == "()" echo USER_LDFLAGS=%userldflags%>>config.settings
276 echo # End of settings from configure.bat>>config.settings
277 echo. >>config.settings
278
279 if %COMPILER% == gcc goto generate_makefiles_for_gmake
280
281 rem
282 rem   Generating makefiles for nmake.
283 rem
284
285 set MAKECMD=nmake
286
287 copy /b config.settings+..\nt\makefile.nmake.mw32-in ..\nt\makefile
288 copy /b config.settings+..\lib-src\makefile.nt ..\lib-src\makefile
289 copy /b config.settings+..\src\makefile.nt ..\src\makefile
290 copy /b config.settings+..\lisp\makefile.nt ..\lisp\makefile
291 copy /b config.settings+..\leim\makefile.nt ..\leim\makefile
292 copy /b config.settings+..\leim\Makefile.nt ..\leim\makefile
293
294 goto generate_makefile_end
295
296 :generate_makefiles_for_gmake
297
298 set MAKECMD=gmake
299
300 copy config.nt ..\src\config.h
301 if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h
302 if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h
303 copy paths.h ..\src\epaths.h
304
305 copy /b config.settings+%MAKECMD%.meadow.defs+..\nt\makefile.meadow.w32-in ..\nt\makefile
306 copy /b config.settings+%MAKECMD%.meadow.defs+..\lib-src\makefile.meadow.w32-in ..\lib-src\makefile
307 copy /b config.settings+%MAKECMD%.meadow.defs+..\src\makefile.meadow.w32-in ..\src\makefile
308 if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile
309 copy /b config.settings+%MAKECMD%.meadow.defs+..\lisp\makefile.meadow.w32-in ..\lisp\makefile
310 rem   Use the default (no-op) Makefile.in if the nt version is not present.
311 if exist ..\leim\makefile.meadow.w32-in copy /b config.settings+%MAKECMD%.meadow.defs+..\leim\makefile.meadow.w32-in ..\leim\makefile
312 if not exist ..\leim\makefile.meadow.w32-in copy /b config.settings+%MAKECMD%.meadow.defs+..\leim\Makefile.in ..\leim\makefile
313
314 :generate_makefile_end
315
316 del config.settings
317
318 Rem Some people use WinZip which doesn't create empty directories!
319 if not exist ..\site-lisp\nul mkdir ..\site-lisp\
320 if not exist ..\site-lisp\subdirs.el copy subdirs.el ..\site-lisp\subdirs.el
321
322
323 echo.
324 echo Emacs successfully configured.
325 echo Run `%MAKECMD% bootstrap' and '%MAKECMD% all' to build,
326 echo then run `%MAKECMD% install INSTALL_DIR=X:/...' to install.
327 goto end
328
329 :SmallEnv
330 echo Your environment size is too small.  Please enlarge it and rerun configure.
331 echo For example, type "command.com /e:2048" to have 2048 bytes available.
332 set $foo$=
333 :end
334 set prefix=
335 set magick=
336 set nodebug=
337 set noopt=
338 set nocygwin=
339 set COMPILER=
340 set MAKECMD=
341 set usercflags=
342 set userldflags=
Note: See TracBrowser for help on using the browser.