2 rem ----------------------------------------------------------------------
\r
3 rem Configuration script for MS Windows 95/98/Me and NT/2000/XP
\r
4 rem Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
\r
5 rem Free Software Foundation, Inc.
\r
7 rem This file is part of GNU Emacs.
\r
9 rem GNU Emacs is free software; you can redistribute it and/or modify
\r
10 rem it under the terms of the GNU General Public License as published by
\r
11 rem the Free Software Foundation; either version 2, or (at your option)
\r
12 rem any later version.
\r
14 rem GNU Emacs is distributed in the hope that it will be useful,
\r
15 rem but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 rem GNU General Public License for more details.
\r
19 rem You should have received a copy of the GNU General Public License
\r
20 rem along with GNU Emacs; see the file COPYING. If not, write to the
\r
21 rem Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
\r
22 rem Boston, MA 02110-1301, USA.
\r
23 rem ----------------------------------------------------------------------
\r
24 rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:
\r
26 rem + MS Windows 95/98/Me or NT/2000/XP
\r
27 rem + either MSVC 2.x or later, or gcc-2.95 or later (with gmake 3.75
\r
28 rem or later) and the Mingw32 and W32 API headers and libraries
\r
30 rem For reference, here is a list of which builds of gmake are known to
\r
31 rem work or not, and whether they work in the presence and/or absence of
\r
35 rem cygwin b20.1 make (3.75): okay[1] fails[2]
\r
36 rem MSVC compiled gmake 3.77: okay okay
\r
37 rem MSVC compiled gmake 3.78.1: okay okay
\r
38 rem MSVC compiled gmake 3.79.1: okay okay
\r
39 rem mingw32/gcc-2.92.2 make (3.77): okay okay
\r
40 rem cygwin compiled gmake 3.77: okay[1] fails[2]
\r
41 rem cygwin compiled gmake 3.78.1: okay fails[2]
\r
42 rem cygwin compiled gmake 3.79.1: couldn't build make[3]
\r
44 rem [1] doesn't cope with makefiles with DOS line endings, so must mount
\r
45 rem emacs source with text!=binary.
\r
46 rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.
\r
47 rem [3] requires LC_MESSAGES support to build; maybe 2.95.x update to
\r
48 rem cygwin provides this?
\r
51 if exist config.log del config.log
\r
53 rem ----------------------------------------------------------------------
\r
54 rem See if the environment is large enough. We need 43 (?) bytes.
\r
55 set $foo$=123456789_123456789_123456789_123456789_123
\r
56 if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv
\r
59 rem ----------------------------------------------------------------------
\r
60 rem Make sure we are running in the nt subdir
\r
61 if exist configure.bat goto start
\r
62 echo You must run configure from the nt subdirectory.
\r
66 rem ----------------------------------------------------------------------
\r
67 rem Default settings.
\r
78 rem ----------------------------------------------------------------------
\r
79 rem Handle arguments.
\r
81 if "%1" == "-h" goto usage
\r
82 if "%1" == "--help" goto usage
\r
83 if "%1" == "--prefix" goto setprefix
\r
84 if "%1" == "--with-gcc" goto withgcc
\r
85 if "%1" == "--with-msvc" goto withmsvc
\r
86 if "%1" == "--no-debug" goto nodebug
\r
87 if "%1" == "--no-opt" goto noopt
\r
88 if "%1" == "--no-cygwin" goto nocygwin
\r
89 if "%1" == "--cflags" goto usercflags
\r
90 if "%1" == "--ldflags" goto userldflags
\r
91 if "%1" == "--without-png" goto withoutpng
\r
92 if "%1" == "--without-jpeg" goto withoutjpeg
\r
93 if "%1" == "--without-gif" goto withoutgif
\r
94 if "%1" == "--without-tiff" goto withouttiff
\r
95 if "%1" == "--without-xpm" goto withoutxpm
\r
96 if "%1" == "" goto checkutils
\r
98 echo Usage: configure [options]
\r
100 echo. --prefix PREFIX install Emacs in directory PREFIX
\r
101 echo. --with-gcc use GCC to compile Emacs
\r
102 echo. --with-msvc use MSVC to compile Emacs
\r
103 echo. --no-debug exclude debug info from executables
\r
104 echo. --no-opt disable optimization
\r
105 echo. --no-cygwin use -mno-cygwin option with GCC
\r
106 echo. --cflags FLAG pass FLAG to compiler
\r
107 echo. --ldflags FLAG pass FLAG to compiler when linking
\r
108 echo. --without-png do not use libpng even if it is installed
\r
109 echo. --without-jpeg do not use jpeg-6b even if it is installed
\r
110 echo. --without-gif do not use libungif even if it is installed
\r
111 echo. --without-tiff do not use libtiff even if it is installed
\r
112 echo. --without-xpm do not use libXpm even if it is installed
\r
114 rem ----------------------------------------------------------------------
\r
120 rem ----------------------------------------------------------------------
\r
125 rem ----------------------------------------------------------------------
\r
130 rem ----------------------------------------------------------------------
\r
135 rem ----------------------------------------------------------------------
\r
140 rem ----------------------------------------------------------------------
\r
145 rem ----------------------------------------------------------------------
\r
148 set usercflags=%usercflags%%sep1%%1
\r
149 set sep1= %nothing%
\r
152 rem ----------------------------------------------------------------------
\r
155 set userldflags=%userldflags%%sep2%%1
\r
156 set sep2= %nothing%
\r
159 rem ----------------------------------------------------------------------
\r
167 rem ----------------------------------------------------------------------
\r
175 rem ----------------------------------------------------------------------
\r
183 rem ----------------------------------------------------------------------
\r
191 rem ----------------------------------------------------------------------
\r
199 rem ----------------------------------------------------------------------
\r
200 rem Check that necessary utilities (cp and rm) are present.
\r
202 echo Checking for 'cp'...
\r
203 cp configure.bat junk.bat
\r
204 if not exist junk.bat goto needcp
\r
205 echo Checking for 'rm'...
\r
207 if exist junk.bat goto needrm
\r
210 echo You need 'cp' (the Unix file copy program) to build Emacs.
\r
214 echo You need 'rm' (the Unix file delete program) to build Emacs.
\r
217 rem ----------------------------------------------------------------------
\r
218 rem Auto-detect compiler if not specified, and validate GCC if chosen.
\r
220 if (%COMPILER%)==(cl) goto compilercheckdone
\r
221 if (%COMPILER%)==(gcc) goto checkgcc
\r
223 echo Checking whether 'cl' is available...
\r
224 echo main(){} >junk.c
\r
225 cl -nologo -c junk.c
\r
226 if exist junk.obj goto clOK
\r
228 echo Checking whether 'gcc' is available...
\r
230 if not exist junk.o goto nocompiler
\r
234 Rem WARNING -- COMMAND.COM on some systems only looks at the first
\r
235 Rem 8 characters of a label. So do NOT be tempted to change
\r
236 Rem chkapi* into something fancier like checkw32api
\r
237 Rem You HAVE been warned!
\r
238 if (%nocygwin%) == (Y) goto chkapi
\r
239 echo Checking whether gcc requires '-mno-cygwin'...
\r
240 echo #include "cygwin/version.h" >junk.c
\r
241 echo main(){} >>junk.c
\r
242 echo gcc -c junk.c >>config.log
\r
243 gcc -c junk.c >>config.log 2>&1
\r
244 if not exist junk.o goto chkapi
\r
245 echo gcc -mno-cygwin -c junk.c >>config.log
\r
246 gcc -mno-cygwin -c junk.c >>config.log 2>&1
\r
247 if exist junk.o set nocygwin=Y
\r
248 rm -f junk.c junk.o
\r
251 echo The failed program was: >>config.log
\r
252 type junk.c >>config.log
\r
253 rem ----------------------------------------------------------------------
\r
254 rem Older versions of the Windows API headers either don't have any of
\r
255 rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1
\r
256 rem are like this), or have a typo in the definition of
\r
257 rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this
\r
258 rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros
\r
259 rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.
\r
261 echo Checking whether W32 API headers are too old...
\r
262 echo #include "windows.h" >junk.c
\r
263 echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c
\r
264 echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c
\r
265 if (%nocygwin%) == (Y) goto chkapi1
\r
266 set cf=%usercflags%
\r
269 set cf=%usercflags% -mno-cygwin
\r
274 @echo gcc %cf% -c junk.c >>config.log
\r
275 gcc %cf% -c junk.c >>config.log 2>&1
\r
277 if exist junk.o goto gccOk
\r
278 echo The failed program was: >>config.log
\r
279 type junk.c >>config.log
\r
283 echo Configure failed.
\r
284 echo To configure Emacs for Windows, you need to have either
\r
285 echo gcc-2.95 or later with Mingw32 and the W32 API headers,
\r
286 echo or MSVC 2.x or later.
\r
293 rm -f junk.c junk.o
\r
294 Rem It is not clear what GCC version began supporting -mtune
\r
295 Rem and pentium4 on x86, so check this explicitly.
\r
296 echo main(){} >junk.c
\r
297 echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log
\r
298 gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1
\r
299 if not errorlevel 1 goto gccMtuneOk
\r
300 echo The failed program was: >>config.log
\r
301 type junk.c >>config.log
\r
303 rm -f junk.c junk.o
\r
304 goto compilercheckdone
\r
306 echo GCC supports -mtune=pentium4 >>config.log
\r
307 set mf=-mtune=pentium4
\r
308 rm -f junk.c junk.o
\r
309 goto compilercheckdone
\r
313 rm -f junk.c junk.obj
\r
318 rem ----------------------------------------------------------------------
\r
319 rem Check for external image libraries. Since they are loaded
\r
320 rem dynamically, the libraries themselves do not need to be present
\r
321 rem at compile time, but the header files are required.
\r
325 if (%nocygwin%) == (N) goto flagsOK
\r
326 set mingwflag=-mno-cygwin
\r
330 if (%pngsupport%) == (N) goto pngDone
\r
332 echo Checking for libpng...
\r
333 echo #include "png.h" >junk.c
\r
334 echo main (){} >>junk.c
\r
335 rem -o option is ignored with cl, but allows result to be consistent.
\r
336 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
\r
337 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log
\r
338 if exist junk.obj goto havePng
\r
340 echo ...png.h not found, building without PNG support.
\r
341 echo The failed program was: >>config.log
\r
342 type junk.c >>config.log
\r
347 echo ...PNG header available, building with PNG support.
\r
351 rm -f junk.c junk.obj
\r
353 if (%jpegsupport%) == (N) goto jpegDone
\r
355 echo Checking for jpeg-6b...
\r
356 echo #include "jconfig.h" >junk.c
\r
357 echo main (){} >>junk.c
\r
358 rem -o option is ignored with cl, but allows result to be consistent.
\r
359 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
\r
360 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log
\r
361 if exist junk.obj goto haveJpeg
\r
363 echo ...jconfig.h not found, building without JPEG support.
\r
364 echo The failed program was: >>config.log
\r
365 type junk.c >>config.log
\r
370 echo ...JPEG header available, building with JPEG support.
\r
374 rm -f junk.c junk.obj
\r
376 if (%gifsupport%) == (N) goto gifDone
\r
378 echo Checking for libgif...
\r
379 echo #include "gif_lib.h" >junk.c
\r
380 echo main (){} >>junk.c
\r
381 rem -o option is ignored with cl, but allows result to be consistent.
\r
382 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
\r
383 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log
\r
384 if exist junk.obj goto haveGif
\r
386 echo ...gif_lib.h not found, building without GIF support.
\r
387 echo The failed program was: >>config.log
\r
388 type junk.c >>config.log
\r
393 echo ...GIF header available, building with GIF support.
\r
397 rm -f junk.c junk.obj
\r
399 if (%tiffsupport%) == (N) goto tiffDone
\r
401 echo Checking for tiff...
\r
402 echo #include "tiffio.h" >junk.c
\r
403 echo main (){} >>junk.c
\r
404 rem -o option is ignored with cl, but allows result to be consistent.
\r
405 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
\r
406 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log
\r
407 if exist junk.obj goto haveTiff
\r
409 echo ...tiffio.h not found, building without TIFF support.
\r
410 echo The failed program was: >>config.log
\r
411 type junk.c >>config.log
\r
416 echo ...TIFF header available, building with TIFF support.
\r
420 rm -f junk.c junk.obj
\r
422 if (%xpmsupport%) == (N) goto xpmDone
\r
424 echo Checking for libXpm...
\r
425 echo #define FOR_MSW 1 >junk.c
\r
426 echo #include "X11/xpm.h" >>junk.c
\r
427 echo main (){} >>junk.c
\r
428 rem -o option is ignored with cl, but allows result to be consistent.
\r
429 echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
\r
430 %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log
\r
431 if exist junk.obj goto haveXpm
\r
433 echo ...X11/xpm.h not found, building without XPM support.
\r
434 echo The failed program was: >>config.log
\r
435 type junk.c >>config.log
\r
440 echo ...XPM header available, building with XPM support.
\r
444 rm -f junk.c junk.obj junk.err junk.out
\r
446 rem ----------------------------------------------------------------------
\r
448 echo Generating makefiles
\r
449 if %COMPILER% == gcc set MAKECMD=gmake
\r
450 if %COMPILER% == cl set MAKECMD=nmake
\r
452 rem Pass on chosen settings to makefiles.
\r
453 rem NB. Be very careful to not have a space before redirection symbols
\r
454 rem except when there is a preceding digit, when a space is required.
\r
456 echo # Start of settings from configure.bat >config.settings
\r
457 echo COMPILER=%COMPILER%>>config.settings
\r
458 if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings
\r
459 if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings
\r
460 if (%noopt%) == (Y) echo NOOPT=1 >>config.settings
\r
461 if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings
\r
462 if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings
\r
463 if not "(%usercflags%)" == "()" echo USER_CFLAGS=%usercflags%>>config.settings
\r
464 if not "(%userldflags%)" == "()" echo USER_LDFLAGS=%userldflags%>>config.settings
\r
465 echo # End of settings from configure.bat>>config.settings
\r
466 echo. >>config.settings
\r
468 copy config.nt config.tmp
\r
470 echo /* Start of settings from configure.bat. */ >>config.tmp
\r
471 if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>config.tmp
\r
472 if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>config.tmp
\r
473 if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp
\r
474 if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp
\r
475 if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp
\r
476 if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp
\r
477 if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp
\r
478 echo /* End of settings from configure.bat. */ >>config.tmp
\r
480 Rem See if fc.exe returns a meaningful exit status. If it does, we
\r
481 Rem might as well avoid unnecessary overwriting of config.h and epaths.h,
\r
482 Rem since this forces recompilation of every source file.
\r
483 if exist foo.bar del foo.bar
\r
484 fc /b foo.bar foo.bar >nul 2>&1
\r
485 if not errorlevel 2 goto doCopy
\r
486 fc /b config.tmp ..\src\config.h >nul 2>&1
\r
487 if errorlevel 1 goto doCopy
\r
488 fc /b paths.h ..\src\epaths.h >nul 2>&1
\r
489 if errorlevel 0 goto dontCopy
\r
491 copy config.tmp ..\src\config.h
\r
492 copy paths.h ..\src\epaths.h
\r
495 if exist config.tmp del config.tmp
\r
496 copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile
\r
497 copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile
\r
498 copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile
\r
499 copy /b config.settings+%MAKECMD%.defs+..\man\makefile.w32-in ..\man\makefile
\r
500 copy /b config.settings+%MAKECMD%.defs+..\lispref\makefile.w32-in ..\lispref\makefile
\r
501 copy /b config.settings+%MAKECMD%.defs+..\lispintro\makefile.w32-in ..\lispintro\makefile
\r
502 if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile
\r
503 copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile
\r
504 rem Use the default (no-op) Makefile.in if the nt version is not present.
\r
505 if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile
\r
506 if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile
\r
507 del config.settings
\r
509 Rem Some people use WinZip which doesn't create empty directories!
\r
510 if not exist ..\site-lisp\nul mkdir ..\site-lisp\
\r
511 if not exist ..\site-lisp\subdirs.el copy subdirs.el ..\site-lisp\subdirs.el
\r
514 echo Emacs successfully configured.
\r
515 echo Emacs successfully configured. >>config.log
\r
516 echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.
\r
520 echo Your environment size is too small. Please enlarge it and rerun configure.
\r
521 echo For example, type "command.com /e:2048" to have 2048 bytes available.
\r
536 arch-tag: 300d20a4-1675-4e75-b615-7ce1a8c5376c
\r