2 rem ----------------------------------------------------------------------
3 rem Configuration script for MS Windows 95/98/Me and NT/2000/XP
4 rem Copyright (C) 1999-2003 Free Software Foundation, Inc.
6 rem This file is part of GNU Emacs.
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.
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.
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:
25 rem + MS Windows 95/98/Me or NT/2000/XP
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
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
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]
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?
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
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.
63 rem ----------------------------------------------------------------------
75 rem ----------------------------------------------------------------------
78 if "%1" == "-h" goto usage
79 if "%1" == "--help" goto usage
80 if "%1" == "--prefix" goto setprefix
81 if "%1" == "--with-gcc" goto withgcc
82 if "%1" == "--with-msvc" goto withmsvc
83 if "%1" == "--no-debug" goto nodebug
84 if "%1" == "--no-opt" goto noopt
85 if "%1" == "--no-cygwin" goto nocygwin
86 if "%1" == "--cflags" goto usercflags
87 if "%1" == "--ldflags" goto userldflags
88 if "%1" == "--without-png" goto withoutpng
89 if "%1" == "--without-jpeg" goto withoutjpeg
90 if "%1" == "--without-gif" goto withoutgif
91 if "%1" == "--without-tiff" goto withouttiff
92 if "%1" == "--without-xpm" goto withoutxpm
93 if "%1" == "" goto checkutils
95 echo Usage
: configure
[options
]
97 echo.
--prefix PREFIX install Emacs in directory PREFIX
98 echo.
--with
-gcc
use GCC to compile Emacs
99 echo.
--with
-msvc
use MSVC to compile Emacs
100 echo.
--no
-debug exclude
debug info from executables
101 echo.
--no
-opt disable optimization
102 echo.
--no
-cygwin
use -mno
-cygwin option with GCC
103 echo.
--cflags FLAG pass FLAG to compiler
104 echo.
--ldflags FLAG pass FLAG to compiler
when linking
105 echo.
--without
-png
do not use libpng even
if it is installed
106 echo.
--without
-jpeg
do not use jpeg
-6b even
if it is installed
107 echo.
--without
-gif
do not use libungif even
if it is installed
108 echo.
--without
-tiff
do not use libtiff even
if it is installed
109 echo.
--without
-xpm
do not use libXpm even
if it is installed
111 rem ----------------------------------------------------------------------
117 rem ----------------------------------------------------------------------
122 rem ----------------------------------------------------------------------
127 rem ----------------------------------------------------------------------
132 rem ----------------------------------------------------------------------
137 rem ----------------------------------------------------------------------
142 rem ----------------------------------------------------------------------
145 set usercflags
=%usercflags%%sep1%%1
149 rem ----------------------------------------------------------------------
152 set userldflags
=%userldflags%%sep2%%1
156 rem ----------------------------------------------------------------------
164 rem ----------------------------------------------------------------------
172 rem ----------------------------------------------------------------------
180 rem ----------------------------------------------------------------------
188 rem ----------------------------------------------------------------------
196 rem ----------------------------------------------------------------------
197 rem Check that necessary utilities (cp and rm) are present.
199 echo Checking
for 'cp'...
200 cp configure.bat junk.bat
201 if not exist junk.bat
goto needcp
202 echo Checking
for 'rm'...
204 if exist junk.bat
goto needrm
207 echo You need
'cp' (the Unix file
copy program
) to build Emacs.
211 echo You need
'rm' (the Unix file delete program
) to build Emacs.
214 rem ----------------------------------------------------------------------
215 rem Auto-detect compiler if not specified, and validate GCC if chosen.
217 if (%COMPILER%)==(cl
) goto compilercheckdone
218 if (%COMPILER%)==(gcc
) goto checkgcc
220 echo Checking whether
'cl' is available...
221 echo main
(){} >junk.c
223 if exist junk.obj
goto clOK
225 echo Checking whether
'gcc' is available...
227 if not exist junk.o
goto nocompiler
231 Rem WARNING -- COMMAND.COM on some systems only looks at the first
232 Rem 8 characters of a label. So do NOT be tempted to change
233 Rem chkapi* into something fancier like checkw32api
234 Rem You HAVE been warned!
235 if (%nocygwin%) == (Y
) goto chkapi
236 echo Checking whether gcc requires
'-mno-cygwin'...
237 echo #include
"cygwin/version.h" >junk.c
238 echo main
(){} >>junk.c
240 if not exist junk.o
goto chkapi
241 gcc
-mno
-cygwin
-c junk.c
242 if exist junk.o
set nocygwin
=Y
246 rem ----------------------------------------------------------------------
247 rem Older versions of the Windows API headers either don't have any of
248 rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1
249 rem are like this), or have a typo in the definition of
250 rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this
251 rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros
252 rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.
254 echo Checking whether W32 API headers are too old...
255 echo #include
"windows.h" >junk.c
256 echo test
(PIMAGE_NT_HEADERS pHeader
) >>junk.c
257 echo {PIMAGE_SECTION_HEADER pSection
= IMAGE_FIRST_SECTION
(pHeader
);} >>junk.c
258 if (%nocygwin%) == (Y
) goto chkapi1
262 set cf
=%usercflags% -mno
-cygwin
268 if exist junk.o
goto gccOk
272 echo Configure failed.
273 echo To configure Emacs
for Windows
, you need to have either
274 echo gcc
-2.95 or later with Mingw32 and the W32 API headers
,
275 echo or MSVC
2.x or later.
283 goto compilercheckdone
287 rm
-f junk.c junk.obj
292 rem ----------------------------------------------------------------------
293 rem Check for external image libraries. Since they are loaded
294 rem dynamically, the libraries themselves do not need to be present
295 rem at compile time, but the header files are required.
299 if (%nocygwin%) == (N
) goto flagsOK
300 set mingwflag
=-mno
-cygwin
304 if (%pngsupport%) == (N
) goto pngDone
306 echo Checking
for libpng...
307 echo #include
"png.h" >junk.c
308 echo main
(){} >>junk.c
309 rem -o option is ignored with cl, but allows result to be consistent.
310 %COMPILER% %usercflags% %mingwflag% -c junk.c
-o junk.obj
>junk.out
2>junk.err
311 if exist junk.obj
goto havePng
313 echo ...png.h
not found
, building without PNG support.
318 echo ...PNG header available
, building with PNG support.
322 rm
-f junk.c junk.obj
324 if (%jpegsupport%) == (N
) goto jpegDone
326 echo Checking
for jpeg
-6b...
327 echo #include
"jconfig.h" >junk.c
328 echo main
(){} >>junk.c
329 rem -o option is ignored with cl, but allows result to be consistent.
330 %COMPILER% %usercflags% %mingwflag% -c junk.c
-o junk.obj
>junk.out
2>junk.err
331 if exist junk.obj
goto haveJpeg
333 echo ...jconfig.h
not found
, building without JPEG support.
338 echo ...JPEG header available
, building with JPEG support.
342 rm
-f junk.c junk.obj
344 if (%gifsupport%) == (N
) goto gifDone
346 echo Checking
for libgif...
347 echo #include
"gif_lib.h" >junk.c
348 echo main
(){} >>junk.c
349 rem -o option is ignored with cl, but allows result to be consistent.
350 %COMPILER% %usercflags% %mingwflag% -c junk.c
-o junk.obj
>junk.out
2>junk.err
351 if exist junk.obj
goto haveGif
353 echo ...gif_lib.h
not found
, building without GIF support.
358 echo ...GIF header available
, building with GIF support.
362 rm
-f junk.c junk.obj
364 if (%tiffsupport%) == (N
) goto tiffDone
366 echo Checking
for tiff...
367 echo #include
"tiffio.h" >junk.c
368 echo main
(){} >>junk.c
369 rem -o option is ignored with cl, but allows result to be consistent.
370 %COMPILER% %usercflags% %mingwflag% -c junk.c
-o junk.obj
>junk.out
2>junk.err
371 if exist junk.obj
goto haveTiff
373 echo ...tiffio.h
not found
, building without TIFF support.
378 echo ...TIFF header available
, building with TIFF support.
382 rm
-f junk.c junk.obj
384 if (%xpmsupport%) == (N
) goto xpmDone
386 echo Checking
for libXpm...
387 echo #define FOR_MSW
1 >junk.c
388 echo #include
"X11/xpm.h" >>junk.c
389 echo main
(){} >>junk.c
390 rem -o option is ignored with cl, but allows result to be consistent.
391 %COMPILER% %usercflags% %mingwflag% -c junk.c
-o junk.obj
>junk.out
2>junk.err
392 if exist junk.obj
goto haveXpm
394 echo ...X11
/xpm.h
not found
, building without XPM support.
399 echo ...XPM header available
, building with XPM support.
403 rm
-f junk.c junk.obj junk.err junk.out
405 rem ----------------------------------------------------------------------
407 echo Generating makefiles
408 if %COMPILER% == gcc
set MAKECMD
=gmake
409 if %COMPILER% == cl
set MAKECMD
=nmake
411 rem Pass on chosen settings to makefiles.
412 rem NB. Be very careful to not have a space before redirection symbols
413 rem except when there is a preceding digit, when a space is required.
415 echo #
Start of settings from configure.bat
>config.settings
416 echo COMPILER
=%COMPILER%>>config.settings
417 if (%nodebug%) == (Y
) echo NODEBUG
=1 >>config.settings
418 if (%noopt%) == (Y
) echo NOOPT
=1 >>config.settings
419 if (%nocygwin%) == (Y
) echo NOCYGWIN
=1 >>config.settings
420 if not "(%prefix%)" == "()" echo INSTALL_DIR
=%prefix%>>config.settings
421 if not "(%usercflags%)" == "()" echo USER_CFLAGS
=%usercflags%>>config.settings
422 if not "(%userldflags%)" == "()" echo USER_LDFLAGS
=%userldflags%>>config.settings
423 echo #
End of settings from configure.bat
>>config.settings
424 echo.
>>config.settings
426 copy config.nt ..\src\config.h
427 echo.
>>..\src\config.h
428 echo /* Start of settings from configure.bat.
*/ >>..\src\config.h
429 if not "(%usercflags%)" == "()" echo #define USER_CFLAGS
" %usercflags%">>..\src\config.h
430 if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS
" %userldflags%">>..\src\config.h
431 if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG
1 >>..\src\config.h
432 if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG
1 >>..\src\config.h
433 if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF
1 >>..\src\config.h
434 if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF
1 >>..\src\config.h
435 if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM
1 >>..\src\config.h
436 echo /* End of settings from configure.bat.
*/ >>..\src\config.h
438 copy paths.h ..\src\epaths.h
440 copy /b config.settings
+%MAKECMD%.defs
+..
\nt\makefile.w32
-in ..
\nt\makefile
441 copy /b config.settings
+%MAKECMD%.defs
+..\lib
-src\makefile.w32
-in ..\lib
-src\makefile
442 copy /b config.settings
+%MAKECMD%.defs
+..\src\makefile.w32
-in ..\src\makefile
443 copy /b config.settings
+%MAKECMD%.defs
+..\man\makefile.w32
-in ..\man\makefile
444 copy /b config.settings
+%MAKECMD%.defs
+..\lispref\makefile.w32
-in ..\lispref\makefile
445 copy /b config.settings
+%MAKECMD%.defs
+..\lispintro\makefile.w32
-in ..\lispintro\makefile
446 if not exist ..\lisp\Makefile.unix
rename ..\lisp\Makefile.in Makefile.unix
447 if exist ..\lisp\makefile rm
-f ..
/lisp
/[Mm
]akefile
448 copy /b config.settings
+%MAKECMD%.defs
+..\lisp\makefile.w32
-in ..\lisp\makefile
449 rem Use the default (no-op) Makefile.in if the nt version is not present.
450 if exist ..\leim\makefile.w32
-in
copy /b config.settings
+%MAKECMD%.defs
+..\leim\makefile.w32
-in ..\leim\makefile
451 if not exist ..\leim\makefile.w32
-in
copy /b config.settings
+%MAKECMD%.defs
+..\leim\Makefile.in ..\leim\makefile
454 Rem Some people use WinZip which doesn't create empty directories!
455 if not exist ..\site
-lisp
\nul
mkdir ..\site
-lisp\
456 if not exist ..\site
-lisp\subdirs.el
copy subdirs.el ..\site
-lisp\subdirs.el
459 echo Emacs successfully configured.
460 echo Run `
%MAKECMD%' to build, then run `%MAKECMD% install' to install.
464 echo Your environment size is too small. Please enlarge it and rerun configure.
465 echo For example
, type "command.com /e:2048" to have
2048 bytes available.
479 arch
-tag
: 300d20a4
-1675-4e75
-b615
-7ce1a8c5376c