configure.bat 29 KB

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