Merge from emacs-24; up to 2014-06-12T14:55:48Z!monnier@iro.umontreal.ca
[bpt/emacs.git] / nt / configure.bat
... / ...
CommitLineData
1@echo off\r
2rem ----------------------------------------------------------------------\r
3rem Configuration script for MS Windows operating systems\r
4rem Copyright (C) 1999-2014 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 3 of the License, or\r
11rem (at your option) 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. If not, see http://www.gnu.org/licenses/.\r
20\r
21rem ----------------------------------------------------------------------\r
22rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r
23rem\r
24rem + MS Windows 95, NT or later\r
25rem + either MSVC 2.x or later, or gcc-2.95 or later (with GNU make 3.75\r
26rem or later) and the Mingw32 and Windows API headers and libraries.\r
27rem + Visual Studio 2005 is not supported at this time.\r
28rem\r
29rem For reference, here is a list of which builds of GNU make 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): fails[1,5] fails[2,5]\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[4]\r
39rem cygwin compiled gmake 3.77: fails[1,5] fails[2,5]\r
40rem cygwin compiled gmake 3.78.1: fails[5] fails[2,5]\r
41rem cygwin compiled gmake 3.79.1: fails[3,5] fails[2?,5]\r
42rem cygwin compiled make 3.80: okay[6] fails?[7]\r
43rem cygwin compiled make 3.81: fails fails?[7]\r
44rem mingw32 compiled make 3.79.1: okay okay\r
45rem mingw32 compiled make 3.80: okay okay?[7]\r
46rem mingw32 compiled make 3.81: okay okay[8]\r
47rem\r
48rem [1] doesn't cope with makefiles with DOS line endings, so must mount\r
49rem emacs source with text!=binary.\r
50rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.\r
51rem [3] requires LC_MESSAGES support to build; cannot build with early\r
52rem versions of cygwin.\r
53rem [4] may fail on Windows 9X and Windows ME; if so, install Bash.\r
54rem [5] fails when building leim due to the use of cygwin style paths.\r
55rem May work if building emacs without leim.\r
56rem [6] need to uncomment 3 lines in nt/gmake.defs that invoke `cygpath';\r
57rem look for "cygpath" near line 85 of gmake.defs.\r
58rem [7] not recommended; please report if you try this combination.\r
59rem [8] tested only on Windows XP.\r
60rem\r
61echo ****************************************************************\r
62echo *** THIS METHOD OF BUILDING EMACS IS NO LONGER SUPPORTED. **\r
63echo *** INSTEAD, FOLLOW THE INSTRUCTIONS FROM INSTALL. **\r
64echo ****************************************************************\r
65:confirm_continue\r
66set /p answer=Continue running this script at your own risks ? (Y/N)\r
67if x%answer% == xy (goto confirm_continue_y)\r
68if x%answer% == xY (goto confirm_continue_y)\r
69if x%answer% == xn (goto end)\r
70if x%answer% == xN (goto end)\r
71echo Please answer by Y or N\r
72goto confirm_continue\r
73\r
74:confirm_continue_y\r
75if exist config.log del config.log\r
76\r
77rem ----------------------------------------------------------------------\r
78rem See if the environment is large enough. We need 43 (?) bytes.\r
79set $foo$=123456789_123456789_123456789_123456789_123\r
80if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv\r
81set $foo$=\r
82\r
83rem ----------------------------------------------------------------------\r
84rem Make sure we are running in the nt subdir\r
85if exist configure.bat goto start\r
86echo You must run configure from the nt subdirectory.\r
87goto end\r
88\r
89:start\r
90rem ----------------------------------------------------------------------\r
91rem Attempt to enable command extensions. Set use_extensions to 1 if\r
92rem they are available and 0 if they are not available.\r
93set use_extensions=1\r
94setlocal ENABLEEXTENSIONS\r
95if "%CMDEXTVERSION%" == "" set use_extensions=0\r
96if "%use_extensions%" == "1" goto afterext\r
97\r
98echo. Command extensions are not available. Using parameters that include the =\r
99echo. character by enclosing them in quotes will not be supported.\r
100\r
101:afterext\r
102\r
103rem ----------------------------------------------------------------------\r
104rem Default settings.\r
105set prefix=\r
106set nodebug=N\r
107set noopt=N\r
108set enablechecking=N\r
109set profile=N\r
110set nocygwin=N\r
111set COMPILER=\r
112set usercflags=\r
113set escusercflags=\r
114set docflags=\r
115set userldflags=\r
116set escuserldflags=\r
117set extrauserlibs=\r
118set doldflags=\r
119set doextralibs=\r
120set sep1=\r
121set sep2=\r
122set sep3=\r
123set sep4=\r
124set distfiles=\r
125\r
126rem ----------------------------------------------------------------------\r
127rem Handle arguments.\r
128:again\r
129if "%1" == "-h" goto usage\r
130if "%1" == "--help" goto usage\r
131if "%1" == "--prefix" goto setprefix\r
132if "%1" == "--with-gcc" goto withgcc\r
133if "%1" == "--with-msvc" goto withmsvc\r
134if "%1" == "--no-debug" goto nodebug\r
135if "%1" == "--no-opt" goto noopt\r
136if "%1" == "--enable-checking" goto enablechecking\r
137if "%1" == "--profile" goto profile\r
138if "%1" == "--no-cygwin" goto nocygwin\r
139if "%1" == "--cflags" goto usercflags\r
140if "%1" == "--ldflags" goto userldflags\r
141if "%1" == "--lib" goto extrauserlibs\r
142if "%1" == "--without-png" goto withoutpng\r
143if "%1" == "--without-jpeg" goto withoutjpeg\r
144if "%1" == "--without-gif" goto withoutgif\r
145if "%1" == "--without-tiff" goto withouttiff\r
146if "%1" == "--without-gnutls" goto withoutgnutls\r
147if "%1" == "--without-libxml2" goto withoutlibxml2\r
148if "%1" == "--without-xpm" goto withoutxpm\r
149if "%1" == "--with-svg" goto withsvg\r
150if "%1" == "--distfiles" goto distfiles\r
151if "%1" == "" goto checkutils\r
152\r
153:usage\r
154echo Usage: configure [options]\r
155echo Options:\r
156echo. --prefix PREFIX install Emacs in directory PREFIX\r
157echo. --with-gcc use GCC to compile Emacs\r
158echo. --with-msvc use MSVC to compile Emacs\r
159echo. --no-debug exclude debug info from executables\r
160echo. --no-opt disable optimization\r
161echo. --enable-checking enable additional run-time checks\r
162echo. --profile enable profiling\r
163echo. --no-cygwin use -mno-cygwin option with GCC\r
164echo. --cflags FLAG pass FLAG to compiler\r
165echo. --ldflags FLAG pass FLAG to compiler when linking\r
166echo. --lib LIB link to extra library LIB\r
167echo. --without-png do not use PNG library even if it is installed\r
168echo. --without-jpeg do not use JPEG library even if it is installed\r
169echo. --without-gif do not use GIF library even if it is installed\r
170echo. --without-tiff do not use TIFF library even if it is installed\r
171echo. --without-xpm do not use XPM library even if it is installed\r
172echo. --without-gnutls do not use GnuTLS library even if it is installed\r
173echo. --without-libxml2 do not use libxml2 library even if it is installed\r
174echo. --with-svg use the RSVG library (experimental)\r
175echo. --distfiles path to files for make dist, e.g. libXpm.dll\r
176if "%use_extensions%" == "0" goto end\r
177echo.\r
178echo. The cflags and ldflags arguments support parameters that include the =\r
179echo. character. However, since the = character is normally treated as a\r
180echo. separator character you will need to enclose any parameter that includes\r
181echo. the = character in quotes. For example, to include\r
182echo. -DSITELOAD_PURESIZE_EXTRA=100000 as one of the cflags you would run\r
183echo. configure.bat as follows:\r
184echo. configure.bat --cflags "-DSITELOAD_PURESIZE_EXTRA=100000"\r
185echo.\r
186echo. Note that this capability of processing parameters that include the =\r
187echo. character depends on command extensions. This batch file attempts to\r
188echo. enable command extensions. If command extensions cannot be enabled, a\r
189echo. warning message will be displayed.\r
190echo.\r
191echo. IMPORTANT: This method of building Emacs for MS-Windows is deprecated,\r
192echo. and could be removed in a future version of Emacs. The preferred way\r
193echo to build Emacs for MS-Windows from now on is using the MSYS environment\r
194echo. and MinGW development tools. Please see nt/INSTALL for details.\r
195goto end\r
196\r
197rem ----------------------------------------------------------------------\r
198\r
199:setprefix\r
200shift\r
201set prefix=%1\r
202shift\r
203goto again\r
204\r
205rem ----------------------------------------------------------------------\r
206\r
207:withgcc\r
208set COMPILER=gcc\r
209shift\r
210goto again\r
211\r
212rem ----------------------------------------------------------------------\r
213\r
214:withmsvc\r
215set COMPILER=cl\r
216shift\r
217goto again\r
218\r
219rem ----------------------------------------------------------------------\r
220\r
221:nodebug\r
222set nodebug=Y\r
223shift\r
224goto again\r
225\r
226rem ----------------------------------------------------------------------\r
227\r
228:noopt\r
229set noopt=Y\r
230shift\r
231goto again\r
232\r
233rem ----------------------------------------------------------------------\r
234\r
235:enablechecking\r
236set enablechecking=Y\r
237shift\r
238goto again\r
239\r
240rem ----------------------------------------------------------------------\r
241\r
242:profile\r
243set profile=Y\r
244shift\r
245goto again\r
246\r
247rem ----------------------------------------------------------------------\r
248\r
249:nocygwin\r
250set nocygwin=Y\r
251shift\r
252goto again\r
253\r
254rem ----------------------------------------------------------------------\r
255\r
256:usercflags\r
257if "%use_extensions%" == "1" goto ucflagex\r
258goto ucflagne\r
259\r
260:ucflagex\r
261shift\r
262set usercflags=%usercflags%%sep1%%~1\r
263set escusercflags=%usercflags:"=\"%\r
264set sep1= %nothing%\r
265shift\r
266goto again\r
267\r
268:ucflagne\r
269shift\r
270set usercflags=%usercflags%%sep1%%1\r
271set escusercflags=%usercflags%\r
272set sep1= %nothing%\r
273shift\r
274goto again\r
275\r
276:extrauserlibs\r
277shift\r
278echo. extrauserlibs: %extrauserlibs%\r
279set extrauserlibs=%extrauserlibs%%sep4%%1\r
280set sep4= %nothing%\r
281shift\r
282goto again\r
283\r
284rem ----------------------------------------------------------------------\r
285\r
286:userldflags\r
287if "%use_extensions%" == "1" goto ulflagex\r
288goto ulflagne\r
289\r
290:ulflagex\r
291shift\r
292set userldflags=%userldflags%%sep2%%~1\r
293set escuserldflags=%userldflags:"=\"%\r
294set sep2= %nothing%\r
295shift\r
296goto again\r
297\r
298:ulflagne\r
299shift\r
300set userldflags=%userldflags%%sep2%%1\r
301set escuserldflags=%userldflags%\r
302set sep2= %nothing%\r
303shift\r
304goto again\r
305\r
306rem ----------------------------------------------------------------------\r
307\r
308:withoutpng\r
309set pngsupport=N\r
310set HAVE_PNG=\r
311shift\r
312goto again\r
313\r
314rem ----------------------------------------------------------------------\r
315\r
316:withoutjpeg\r
317set jpegsupport=N\r
318set HAVE_JPEG=\r
319shift\r
320goto again\r
321\r
322rem ----------------------------------------------------------------------\r
323\r
324:withoutgif\r
325set gifsupport=N\r
326set HAVE_GIF=\r
327shift\r
328goto again\r
329\r
330rem ----------------------------------------------------------------------\r
331\r
332:withoutgnutls\r
333set tlssupport=N\r
334set HAVE_GNUTLS=\r
335shift\r
336goto again\r
337\r
338rem ----------------------------------------------------------------------\r
339\r
340:withoutlibxml2\r
341set libxml2support=N\r
342set HAVE_LIBXML2=\r
343shift\r
344goto again\r
345\r
346rem ----------------------------------------------------------------------\r
347\r
348:withouttiff\r
349set tiffsupport=N\r
350set HAVE_TIFF=\r
351shift\r
352goto again\r
353\r
354rem ----------------------------------------------------------------------\r
355\r
356:withoutxpm\r
357set xpmsupport=N\r
358set HAVE_XPM=\r
359shift\r
360goto again\r
361\r
362:withsvg\r
363shift\r
364set svgsupport=Y\r
365goto again\r
366\r
367rem ----------------------------------------------------------------------\r
368\r
369:distfiles\r
370set HAVE_DISTFILES=1\r
371shift\r
372set distfiles=%distfiles%%sep3%%1\r
373set sep3= %nothing%\r
374shift\r
375goto again\r
376\r
377rem ----------------------------------------------------------------------\r
378rem Check that necessary utilities (cp and rm) are present.\r
379\r
380:checkutils\r
381echo Checking for 'cp'...\r
382cp configure.bat junk.bat\r
383if not exist junk.bat goto needcp\r
384echo Checking for 'rm'...\r
385rm junk.bat\r
386if exist junk.bat goto needrm\r
387goto checkcompiler\r
388\r
389:needcp\r
390echo You need 'cp' (the Unix file copy program) to build Emacs.\r
391goto end\r
392\r
393:needrm\r
394del junk.bat\r
395echo You need 'rm' (the Unix file delete program) to build Emacs.\r
396goto end\r
397\r
398rem ----------------------------------------------------------------------\r
399rem Auto-detect compiler if not specified, and validate GCC if chosen.\r
400\r
401:checkcompiler\r
402if (%COMPILER%)==(cl) goto compilercheckdone\r
403if (%COMPILER%)==(gcc) goto checkgcc\r
404\r
405echo Checking whether 'gcc' is available...\r
406echo main(){} >junk.c\r
407gcc -c junk.c\r
408if exist junk.o goto checkgcc\r
409\r
410echo Checking whether 'cl' is available...\r
411cl -nologo -c junk.c\r
412if exist junk.obj goto clOK\r
413goto nocompiler\r
414\r
415:checkgcc\r
416if exist junk.o del junk.o\r
417Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
418Rem 8 characters of a label. So do NOT be tempted to change\r
419Rem chkapi* into something fancier like checkw32api\r
420Rem You HAVE been warned!\r
421if (%nocygwin%) == (Y) goto chkapiN\r
422echo Checking whether gcc requires '-mno-cygwin'...\r
423echo #include "cygwin/version.h" >junk.c\r
424echo main(){} >>junk.c\r
425echo gcc -c junk.c >>config.log\r
426gcc -c junk.c >>config.log 2>&1\r
427if not exist junk.o goto chkapi\r
428echo gcc -mno-cygwin -c junk.c >>config.log\r
429gcc -mno-cygwin -c junk.c >>config.log 2>&1\r
430if exist junk.o set nocygwin=Y\r
431\r
432:chkapi\r
433echo The failed program was: >>config.log\r
434type junk.c >>config.log\r
435\r
436:chkapiN\r
437rm -f junk.c junk.o\r
438rem ----------------------------------------------------------------------\r
439rem Older versions of the Windows API headers either don't have any of\r
440rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
441rem are like this), or have a typo in the definition of\r
442rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this\r
443rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros\r
444rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.\r
445rem Beginning with Emacs 23, we need usp10.h.\r
446rem\r
447echo Checking whether Windows API headers are too old...\r
448echo #include "windows.h" >junk.c\r
449echo #include "usp10.h" >>junk.c\r
450echo void test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
451echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
452if (%nocygwin%) == (Y) goto chkapi1\r
453set cf=%usercflags%\r
454goto chkapi2\r
455\r
456:chkapi1\r
457set cf=%usercflags% -mno-cygwin\r
458\r
459:chkapi2\r
460echo on\r
461gcc %cf% -c junk.c\r
462@echo off\r
463@echo gcc %cf% -c junk.c >>config.log\r
464gcc %cf% -c junk.c >>config.log 2>&1\r
465set cf=\r
466if exist junk.o goto chkuser\r
467echo The failed program was: >>config.log\r
468type junk.c >>config.log\r
469goto nocompiler\r
470\r
471:chkuser\r
472rm -f junk.o\r
473echo int main (int argc, char *argv[]) {>junk.c\r
474echo char *usercflags = "%escusercflags%";>>junk.c\r
475echo }>>junk.c\r
476echo gcc -Werror -c junk.c >>config.log\r
477gcc -Werror -c junk.c >>config.log 2>&1\r
478if exist junk.o goto gccOk\r
479echo.\r
480echo Error in --cflags argument: %usercflags%\r
481echo Backslashes and quotes cannot be used with --cflags. Please use forward\r
482echo slashes for filenames and paths (e.g. when passing directories to -I).\r
483rm -f junk.c\r
484goto end\r
485\r
486:nocompiler\r
487echo.\r
488echo Configure failed.\r
489echo To configure Emacs for Windows, you need to have either\r
490echo gcc-2.95 or later with Mingw32 and the Windows API headers,\r
491echo or MSVC 2.x or later.\r
492del junk.c\r
493goto end\r
494\r
495:gccOk\r
496set COMPILER=gcc\r
497echo Using 'gcc'\r
498rm -f junk.c junk.o\r
499Rem It is not clear what GCC version began supporting -mtune\r
500Rem and pentium4 on x86, so check this explicitly.\r
501echo main(){} >junk.c\r
502echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log\r
503gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1\r
504if not errorlevel 1 goto gccMtuneOk\r
505echo The failed program was: >>config.log\r
506type junk.c >>config.log\r
507set mf=-mcpu=i686\r
508rm -f junk.c junk.o\r
509goto gccdebug\r
510\r
511:gccMtuneOk\r
512echo GCC supports -mtune=pentium4 >>config.log\r
513set mf=-mtune=pentium4\r
514rm -f junk.c junk.o\r
515\r
516:gccdebug\r
517rem Check for DWARF-2 debug info support, else default to stabs\r
518echo main(){} >junk.c\r
519echo gcc -c -gdwarf-2 -g3 junk.c >>config.log\r
520gcc -c -gdwarf-2 -g3 junk.c >>config.log 2>&1\r
521if not errorlevel 1 goto gccdwarf\r
522echo The failed program was: >>config.log\r
523type junk.c >>config.log\r
524set dbginfo=-gstabs+\r
525rm -f junk.c junk.o\r
526goto compilercheckdone\r
527\r
528:gccdwarf\r
529echo GCC supports DWARF-2 >>config.log\r
530set dbginfo=-gdwarf-2 -g3\r
531rm -f junk.c junk.o\r
532goto compilercheckdone\r
533\r
534:clOk\r
535set COMPILER=cl\r
536rm -f junk.c junk.obj\r
537echo Using 'MSVC'\r
538\r
539:compilercheckdone\r
540\r
541rem ----------------------------------------------------------------------\r
542rem Check for external image libraries. Since they are loaded\r
543rem dynamically, the libraries themselves do not need to be present\r
544rem at compile time, but the header files are required.\r
545\r
546set mingwflag=\r
547\r
548if (%nocygwin%) == (N) goto flagsOK\r
549set mingwflag=-mno-cygwin\r
550\r
551:flagsOK\r
552\r
553if (%pngsupport%) == (N) goto pngDone\r
554\r
555echo Checking for libpng...\r
556echo #include "png.h" >junk.c\r
557echo main (){} >>junk.c\r
558rem -o option is ignored with cl, but allows result to be consistent.\r
559echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
560%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
561if exist junk.obj goto havePng\r
562\r
563echo ...png.h not found, building without PNG support.\r
564echo The failed program was: >>config.log\r
565type junk.c >>config.log\r
566set HAVE_PNG=\r
567goto :pngDone\r
568\r
569:havePng\r
570echo ...PNG header available, building with PNG support.\r
571set HAVE_PNG=1\r
572\r
573:pngDone\r
574rm -f junk.c junk.obj\r
575\r
576if (%tlssupport%) == (N) goto tlsDone\r
577\r
578rem this is a copy of the PNG detection\r
579echo Checking for libgnutls...\r
580echo #include "gnutls/gnutls.h" >junk.c\r
581echo main (){} >>junk.c\r
582rem -o option is ignored with cl, but allows result to be consistent.\r
583echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
584%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
585if exist junk.obj goto haveTls\r
586\r
587echo ...gnutls.h not found, building without TLS support.\r
588echo The failed program was: >>config.log\r
589type junk.c >>config.log\r
590set HAVE_GNUTLS=\r
591goto :tlsDone\r
592\r
593:haveTls\r
594echo ...GnuTLS header available, building with GnuTLS support.\r
595set HAVE_GNUTLS=1\r
596\r
597:tlsDone\r
598rm -f junk.c junk.obj\r
599\r
600if (%libxml2support%) == (N) goto xml2Done\r
601\r
602echo Checking for libxml2....\r
603echo #include "libxml/HTMLparser.h" >junk.c\r
604echo main(){} >>junk.c\r
605echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
606%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
607if exist junk.obj goto havelibxml2\r
608\r
609echo ...libxml/HTMLparser.h not found, building without libxml2 support\r
610echo The failed program was: >>config.log\r
611type junk.c >>config.log\r
612set HAVE_LIBXML2=\r
613goto xml2Done\r
614\r
615:havelibxml2\r
616echo ...libxml2 header available, building with libxml2 support\r
617set HAVE_LIBXML2=1\r
618\r
619:xml2Done\r
620rm -f junk.c junk.obj\r
621\r
622if (%jpegsupport%) == (N) goto jpegDone\r
623\r
624echo Checking for jpeg-6b...\r
625echo #include "jconfig.h" >junk.c\r
626echo main (){} >>junk.c\r
627rem -o option is ignored with cl, but allows result to be consistent.\r
628echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
629%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
630if exist junk.obj goto haveJpeg\r
631\r
632echo ...jconfig.h not found, building without JPEG support.\r
633echo The failed program was: >>config.log\r
634type junk.c >>config.log\r
635set HAVE_JPEG=\r
636goto :jpegDone\r
637\r
638:haveJpeg\r
639echo ...JPEG header available, building with JPEG support.\r
640set HAVE_JPEG=1\r
641\r
642:jpegDone\r
643rm -f junk.c junk.obj\r
644\r
645if (%gifsupport%) == (N) goto gifDone\r
646\r
647echo Checking for libgif...\r
648rem giflib-5.0.0 needs size_t defined before gif_lib.h is included\r
649rem redirection characters need to be protected from the shell\r
650echo #include ^<stddef.h^> >junk.c\r
651echo #include "gif_lib.h" >>junk.c\r
652echo main (){} >>junk.c\r
653rem -o option is ignored with cl, but allows result to be consistent.\r
654echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
655%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
656if exist junk.obj goto haveGif\r
657\r
658echo ...gif_lib.h not found, building without GIF support.\r
659echo The failed program was: >>config.log\r
660type junk.c >>config.log\r
661set HAVE_GIF=\r
662goto :gifDone\r
663\r
664:haveGif\r
665echo ...GIF header available, building with GIF support.\r
666set HAVE_GIF=1\r
667\r
668:gifDone\r
669rm -f junk.c junk.obj\r
670\r
671if (%tiffsupport%) == (N) goto tiffDone\r
672\r
673echo Checking for tiff...\r
674echo #include "tiffio.h" >junk.c\r
675echo main (){} >>junk.c\r
676rem -o option is ignored with cl, but allows result to be consistent.\r
677echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
678%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
679if exist junk.obj goto haveTiff\r
680\r
681echo ...tiffio.h not found, building without TIFF support.\r
682echo The failed program was: >>config.log\r
683type junk.c >>config.log\r
684set HAVE_TIFF=\r
685goto :tiffDone\r
686\r
687:haveTiff\r
688echo ...TIFF header available, building with TIFF support.\r
689set HAVE_TIFF=1\r
690\r
691:tiffDone\r
692rm -f junk.c junk.obj\r
693\r
694if (%xpmsupport%) == (N) goto xpmDone\r
695\r
696echo Checking for libXpm...\r
697echo #define FOR_MSW 1 >junk.c\r
698echo #include "X11/xpm.h" >>junk.c\r
699echo main (){} >>junk.c\r
700rem -o option is ignored with cl, but allows result to be consistent.\r
701echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
702%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
703if exist junk.obj goto haveXpm\r
704\r
705echo ...X11/xpm.h not found, building without XPM support.\r
706echo The failed program was: >>config.log\r
707type junk.c >>config.log\r
708set HAVE_XPM=\r
709goto :xpmDone\r
710\r
711:haveXpm\r
712echo ...XPM header available, building with XPM support.\r
713set HAVE_XPM=1\r
714\r
715:xpmDone\r
716rm -f junk.c junk.obj\r
717\r
718if not (%svgsupport%) == (Y) goto :svgDone\r
719echo Checking for librsvg...\r
720echo #include "librsvg/rsvg.h" >junk.c\r
721echo main (){} >>junk.c\r
722rem -o option is ignored with cl, but allows result to be consistent.\r
723echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
724%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
725if exist junk.obj goto haveSvg\r
726\r
727echo ...librsvg/rsvg.h or dependencies not found, building without SVG support.\r
728echo The failed program was: >>config.log\r
729type junk.c >>config.log\r
730set HAVE_RSVG=\r
731goto :svgDone\r
732\r
733:haveSvg\r
734echo ...librsvg header available, building with SVG support (EXPERIMENTAL).\r
735set HAVE_RSVG=1\r
736\r
737:svgDone\r
738rm -f junk.c junk.obj junk.err junk.out\r
739\r
740rem Any distfiles provided for building distribution? If no, we're done.\r
741if "(%HAVE_DISTFILES%)"=="()" goto :distFilesDone\r
742\r
743rem Any arguments to --distfiles specified? If no, we're done.\r
744if not "%distfiles%"=="" goto :checkDistFiles\r
745set distFilesOk=0\r
746echo No arguments specified for option --distfiles!\r
747goto distfilesDone\r
748\r
749:checkDistFiles\r
750echo Checking for distfiles...\r
751rem Check if all specified distfiles exist\r
752set fileNotFound=\r
753for %%d in (%distfiles%) do if not exist %%d set fileNotFound=%%d\r
754if not "%fileNotFound%"=="" goto distFilesNotFound\r
755\r
756set distFilesOK=1\r
757echo ...all distfiles found.\r
758goto :distFilesDone\r
759\r
760:distFilesNotFound\r
761set distFilesOk=0\r
762echo ...%fileNotFound% not found.\r
763set distfiles=\r
764goto :distfilesDone\r
765\r
766:distFilesDone\r
767set fileNotFound=\r
768\r
769rem ----------------------------------------------------------------------\r
770\r
771:genmakefiles\r
772echo Generating makefiles\r
773if %COMPILER% == gcc set MAKECMD=gmake\r
774if %COMPILER% == cl set MAKECMD=nmake\r
775\r
776rem Pass on chosen settings to makefiles.\r
777rem\r
778rem The weird place we put the redirection is to make sure no extra\r
779rem whitespace winds up at the end of the Make variables, since some\r
780rem variables, e.g. INSTALL_DIR, cannot stand that. Yes, echo will\r
781rem write the blanks between the end of command arguments and the\r
782rem redirection symbol to the file. OTOH, we cannot put the\r
783rem redirection immediately after the last character of the command,\r
784rem because environment variable expansion can yield a digit there,\r
785rem which will then be misinterpreted as the file descriptor to\r
786rem redirect...\r
787echo # Start of settings from configure.bat >config.settings\r
788>>config.settings echo COMPILER=%COMPILER%\r
789if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%\r
790if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%\r
791if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1\r
792if (%noopt%) == (Y) >>config.settings echo NOOPT=1\r
793if (%profile%) == (Y) >>config.settings echo PROFILE=1\r
794if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1\r
795if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%\r
796if not "(%distfiles%)" == "()" >>config.settings echo DIST_FILES=%distfiles%\r
797rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
798rem and the if command cannot cope with this\r
799for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
800if (%docflags%)==(Y) >>config.settings echo USER_CFLAGS=%usercflags%\r
801if (%docflags%)==(Y) >>config.settings echo ESC_USER_CFLAGS=%escusercflags%\r
802for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
803if (%doldflags%)==(Y) >>config.settings echo USER_LDFLAGS=%userldflags%\r
804for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
805if (%doextralibs%)==(Y) >>config.settings echo USER_LIBS=%extrauserlibs%\r
806echo # End of settings from configure.bat>>config.settings\r
807echo. >>config.settings\r
808\r
809copy config.nt config.tmp\r
810echo. >>config.tmp\r
811echo /* Start of settings from configure.bat. */ >>config.tmp\r
812rem We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify\r
813rem processing of compiler options in w32.c:get_emacs_configuration_options\r
814if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%" >>config.tmp\r
815if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%" >>config.tmp\r
816if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
817if (%enablechecking%) == (Y) echo #define ENABLE_CHECKING 1 >>config.tmp\r
818if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
819if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp\r
820if not "(%HAVE_LIBXML2%)" == "()" echo #define HAVE_LIBXML2 1 >>config.tmp\r
821if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r
822if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r
823if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r
824if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp\r
825if "(%HAVE_RSVG%)" == "(1)" echo #define HAVE_RSVG 1 >>config.tmp\r
826\r
827echo /* End of settings from configure.bat. */ >>config.tmp\r
828\r
829Rem See if fc.exe returns a meaningful exit status. If it does, we\r
830Rem might as well avoid unnecessary overwriting of config.h and epaths.h,\r
831Rem since this forces recompilation of every source file.\r
832if exist foo.bar del foo.bar\r
833fc /b foo.bar foo.bar >nul 2>&1\r
834if not errorlevel 2 goto doCopy\r
835fc /b config.tmp ..\src\config.h >nul 2>&1\r
836if errorlevel 1 goto doCopy\r
837fc /b paths.h ..\src\epaths.h >nul 2>&1\r
838if not errorlevel 1 goto dontCopy\r
839\r
840:doCopy\r
841copy config.tmp ..\src\config.h\r
842copy paths.h ..\src\epaths.h\r
843\r
844:dontCopy\r
845if exist config.tmp del config.tmp\r
846copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
847if exist ..\admin\unidata copy /b config.settings+%MAKECMD%.defs+..\admin\unidata\makefile.w32-in ..\admin\unidata\makefile\r
848copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
849copy /b config.settings+%MAKECMD%.defs+..\lib\makefile.w32-in ..\lib\makefile\r
850copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
851copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in ..\doc\emacs\makefile\r
852copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in ..\doc\misc\makefile\r
853copy /b config.settings+%MAKECMD%.defs+..\doc\lispref\makefile.w32-in ..\doc\lispref\makefile\r
854copy /b config.settings+%MAKECMD%.defs+..\doc\lispintro\makefile.w32-in ..\doc\lispintro\makefile\r
855if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile\r
856copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile\r
857rem Use the default (no-op) Makefile.in if the nt version is not present.\r
858if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile\r
859if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
860del config.settings\r
861\r
862Rem Some people use WinZip which doesn't create empty directories!\r
863if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
864Rem Update subdirs.el only if it is different or fc.exe doesn't work.\r
865if exist foo.bar del foo.bar\r
866fc /b foo.bar foo.bar >nul 2>&1\r
867if not errorlevel 2 goto doUpdateSubdirs\r
868fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1\r
869if not errorlevel 1 goto dontUpdateSubdirs\r
870\r
871:doUpdateSubdirs\r
872if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el\r
873copy subdirs.el ..\site-lisp\subdirs.el\r
874\r
875:dontUpdateSubdirs\r
876echo.\r
877\r
878rem check that we have all the libraries we need.\r
879set libsOK=1\r
880\r
881if not "(%HAVE_XPM%)" == "()" goto checkpng\r
882if (%xpmsupport%) == (N) goto checkpng\r
883 set libsOK=0\r
884 echo XPM support is missing. It is required for color icons in the toolbar.\r
885 echo Install libXpm development files or use --without-xpm\r
886\r
887:checkpng\r
888if not "(%HAVE_PNG%)" == "()" goto checkjpeg\r
889if (%pngsupport%) == (N) goto checkjpeg\r
890 set libsOK=0\r
891 echo PNG support is missing.\r
892 echo Install libpng development files or use --without-png\r
893\r
894:checkjpeg\r
895if not "(%HAVE_JPEG%)" == "()" goto checktiff\r
896if (%jpegsupport%) == (N) goto checktiff\r
897 set libsOK=0\r
898 echo JPEG support is missing.\r
899 echo Install jpeg development files or use --without-jpeg\r
900\r
901:checktiff\r
902if not "(%HAVE_TIFF%)" == "()" goto checkgif\r
903if (%tiffsupport%) == (N) goto checkgif\r
904 set libsOK=0\r
905 echo TIFF support is missing.\r
906 echo Install libtiff development files or use --without-tiff\r
907\r
908:checkgif\r
909if not "(%HAVE_GIF%)" == "()" goto checkdistfiles\r
910if (%gifsupport%) == (N) goto checkdistfiles\r
911 set libsOK=0\r
912 echo GIF support is missing.\r
913 echo Install giflib or libungif development files or use --without-gif\r
914\r
915:checkdistfiles\r
916if "(%HAVE_DISTFILES%)" == "()" goto donelibchecks\r
917if (%distFilesOk%) == (1) goto donelibchecks\r
918echo.\r
919echo Files specified with option --distfiles could not be found.\r
920echo Fix these issues before running make dist\r
921\r
922:donelibchecks\r
923if (%libsOK%) == (1) goto success\r
924echo.\r
925echo Important libraries are missing. Fix these issues before running make.\r
926goto end\r
927\r
928:success\r
929echo Emacs successfully configured.\r
930echo Emacs successfully configured. >>config.log\r
931if (%MAKECMD%) == (gmake) set MAKECMD=make\r
932echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r
933goto end\r
934\r
935:SmallEnv\r
936echo Your environment size is too small. Please enlarge it and rerun configure.\r
937echo For example, type "command.com /e:2048" to have 2048 bytes available.\r
938set $foo$=\r
939\r
940:end\r
941set prefix=\r
942set nodebug=\r
943set noopt=\r
944set enablechecking=\r
945set profile=\r
946set nocygwin=\r
947set COMPILER=\r
948set MAKECMD=\r
949set usercflags=\r
950set docflags=\r
951set userldflags=\r
952set doldflags=\r
953set mingwflag=\r
954set mf=\r
955set distfiles=\r
956set HAVE_DISTFILES=\r
957set distFilesOk=\r
958set pngsupport=\r
959set tlssupport=\r
960set libxml2support=\r
961set jpegsupport=\r
962set gifsupport=\r
963set tiffsupport=\r
964set xpmsupport=\r
965set svgsupport=\r
966set libsOK=\r
967set HAVE_GIF=\r
968set HAVE_JPEG=\r
969set HAVE_PNG=\r
970set HAVE_TIFF=\r
971set HAVE_XPM=\r
972set dbginfo=\r
973endlocal\r
974set use_extensions=\r