Commit | Line | Data |
---|---|---|
7605d081 GM |
1 | Building and Installing Emacs on MS-Windows |
2 | using the MSYS and MinGW tools | |
a4a9692d | 3 | |
7605d081 | 4 | Copyright (C) 2013 Free Software Foundation, Inc. |
7f6d64f8 | 5 | See the end of the file for license conditions. |
4b994b84 | 6 | |
7605d081 GM |
7 | The MSYS/MinGW build described here is supported on versions of |
8 | Windows starting with Windows 2000 and newer. Windows 9X are not | |
9 | supported (but the Emacs binary produced by this build will run on | |
10 | Windows 9X as well). | |
67aeda8d | 11 | |
7605d081 | 12 | * For the brave (a.k.a. "impatient"): |
0939da72 | 13 | |
7605d081 GM |
14 | For those who have a working MSYS/MinGW development environment and |
15 | are comfortable with running Posix configure scripts, here are the | |
16 | concise instructions for configuring and building the native Windows | |
17 | binary of Emacs with these tools. | |
0939da72 | 18 | |
7605d081 GM |
19 | Do not use this recipe with Cygwin. For building on Cygwin, use the |
20 | normal installation instructions, ../INSTALL. | |
029e4603 | 21 | |
7605d081 GM |
22 | 0. Start the MSYS Bash window. Everything else below is done from |
23 | that window's Bash prompt. | |
89559104 | 24 | |
7605d081 GM |
25 | 0a. If you are building from the development trunk (as opposed to a |
26 | release tarball), produce the configure script, by typing from | |
27 | the top-level Emacs source directory: | |
a8f91761 | 28 | |
7605d081 | 29 | ./autogen.sh |
0939da72 | 30 | |
7605d081 GM |
31 | 1. If you want to build Emacs outside of the source tree |
32 | (recommended), create the build directory and chdir there. | |
0939da72 | 33 | |
7605d081 | 34 | 2. Invoke the MSYS-specific configure script: |
a6fc3b5c | 35 | |
7605d081 | 36 | - If you are building outside the source tree: |
a6fc3b5c | 37 | |
7605d081 | 38 | /PATH/TO/EMACS/SOURCE/TREE/nt/msysconfig.sh --prefix=PREFIX ... |
a6fc3b5c | 39 | |
7605d081 | 40 | - If you are building in-place, i.e. inside the source tree: |
a6fc3b5c | 41 | |
7605d081 | 42 | ./nt/msysconfig.sh --prefix=PREFIX ... |
a6fc3b5c | 43 | |
7605d081 GM |
44 | It is always preferable to use --prefix to configure Emacs for |
45 | some specific location of its installed tree; the default | |
46 | /usr/local is not suitable for Windows (see the detailed | |
47 | instructions for the reasons). | |
a6fc3b5c | 48 | |
7605d081 GM |
49 | You can pass other options to the configure script. Here's a |
50 | typical example (for an in-place debug build): | |
0939da72 | 51 | |
7605d081 | 52 | CPPFLAGS='-DGLYPH_DEBUG=1' CFLAGS='-O0 -g3' ./nt/msysconfig.sh --prefix=/d/usr/emacs --enable-checking |
0939da72 | 53 | |
7605d081 GM |
54 | 3. After the configure script finishes, it should display the |
55 | resulting configuration. After that, type | |
0939da72 | 56 | |
7605d081 | 57 | make |
0939da72 | 58 | |
7605d081 GM |
59 | Use "make -j N" if your MSYS Make supports parallel execution; |
60 | the build will take significantly less time in that case. Here N | |
61 | is the number of simultaneous parallel jobs; use the number of | |
62 | the cores on your system. | |
0939da72 | 63 | |
7605d081 | 64 | 4. Install the produced binaries: |
0939da72 | 65 | |
7605d081 | 66 | make install |
0939da72 | 67 | |
7605d081 GM |
68 | If you want the installation tree to go to a place that is |
69 | different from the one specified by --prefix, say | |
0939da72 | 70 | |
7605d081 | 71 | make install prefix=/where/ever/you/want |
e84b63f1 | 72 | |
7605d081 | 73 | That's it! |
e84b63f1 | 74 | |
7605d081 GM |
75 | If these short instructions somehow fail, read the rest of this |
76 | file. | |
7a43121e | 77 | |
7605d081 | 78 | * Installing MinGW and MSYS |
7a43121e | 79 | |
7605d081 GM |
80 | Make sure you carefully read the following two sections in their |
81 | entirety and install/configure the various packages as instructed. | |
82 | A correct installation makes all the rest almost trivial; a botched | |
83 | installation will likely make you miserable for quite some time. | |
e84b63f1 | 84 | |
7605d081 GM |
85 | There are two alternative to installing MinGW + MSYS: using the GUI |
86 | installer, called mingw-get, provided by the MinGW project, or | |
87 | manual installation. The next two sections describe each one of | |
88 | these. | |
0939da72 | 89 | |
7605d081 | 90 | ** Installing MinGW and MSYS using mingw-get |
0939da72 | 91 | |
7605d081 GM |
92 | A nice installer, called mingw-get, is available for those who don't |
93 | like to mess with manual installations. You can download it from | |
94 | here: | |
0939da72 | 95 | |
7605d081 | 96 | https://sourceforge.net/projects/mingw/files/Installer/mingw-get/ |
0939da72 | 97 | |
7605d081 GM |
98 | (This installer only supports packages downloaded from the MinGW |
99 | site; for the rest you will still need the manual method.) | |
0939da72 | 100 | |
7605d081 GM |
101 | After installing mingw-get, invoke it to install the packages that |
102 | are already selected by default on the "Select Components" screen of | |
103 | its wizard. | |
0939da72 | 104 | |
7605d081 GM |
105 | After that, use "mingw-get install PACKAGE" to install the following |
106 | additional packages: | |
0939da72 | 107 | |
7605d081 GM |
108 | . msys-base |
109 | . mingw-developer-toolkit | |
0939da72 | 110 | |
7605d081 GM |
111 | (We recommend that you refrain from installing the MSYS Texinfo |
112 | package, which is part of msys-base, because it might produce mixed | |
113 | EOL format when installing Info files. Instead, install the MinGW | |
114 | port of Texinfo, see the ezwinports URL below. To uninstall the | |
115 | MSYS Texinfo, after installing it as part of msys-base, invoke the | |
116 | command "mingw-get remove msys-texinfo".) | |
0939da72 | 117 | |
7605d081 GM |
118 | At this point, you should be ready to configure and build Emacs in |
119 | its basic configuration. Skip to the "Generating the configure | |
120 | script" section for the build instructions. If you want to build it | |
121 | with image support and other optional libraries, read about the | |
122 | optional libraries near the end of this document, before you start | |
123 | the build. Also, consider installing additional MinGW packages that | |
124 | are required/recommended, especially if you are building from the | |
125 | Bazaar repository, as described in the next section. | |
195e32b7 | 126 | |
7605d081 GM |
127 | ** Installing MinGW and MSYS manually |
128 | ||
129 | *** MinGW | |
130 | ||
131 | You will need to install the MinGW port of GCC and Binutils, and the | |
132 | MinGW runtime and Windows API distributions, to compile Emacs. You | |
133 | can find these on the MinGW download/Base page: | |
134 | ||
135 | https://sourceforge.net/projects/mingw/files/MinGW/Base/ | |
136 | ||
137 | In general, install the latest stable versions of the following | |
138 | MinGW packages from that page: gcc, binutils, mingw-rt, w32api. You | |
139 | only need the 'bin' and the 'dll' tarballs of each of the above. | |
140 | ||
141 | MinGW packages are distributed as .tar.lzma compressed archives. To | |
142 | install the packages manually, we recommend to use the Windows port | |
143 | of the 'bsdtar' program to unpack the tarballs. 'bsdtar' is | |
144 | available as part of the 'libarchive' package from here: | |
12d70bbb | 145 | |
970b321f EZ |
146 | http://sourceforge.net/projects/ezwinports/files/ |
147 | ||
7605d081 GM |
148 | The recommended place to install these packages is a single tree |
149 | starting from some directory on a drive other than the system drive | |
150 | C:. A typical example would be D:\usr, with D:\usr\bin holding the | |
151 | binaries and DLLs (should be added to your Path environment | |
152 | variable), D:\usr\include holding the include files, D:\usr\lib | |
153 | holding the static and import libraries, D:\usr\share holding docs, | |
154 | message catalogs, and package-specific subdirectories, etc. | |
155 | ||
156 | Having all the headers and libraries in a single place will greatly | |
157 | reduce the number of -I and -L flags you will have to pass to the | |
158 | configure script (see below), as these files will be right where the | |
159 | compiler expects them. | |
160 | ||
161 | We specifically do NOT recommend installing packages below | |
162 | "C:\Program Files" or "C:\Program Files (x86)". These directories | |
163 | are protected on versions of Windows from Vista and on, and you will | |
164 | have difficulties updating and maintaining your installation later, | |
165 | due to UAC elevation prompts, file virtualization, etc. You *have* | |
166 | been warned! | |
167 | ||
168 | Additional MinGW packages are required/recommended, especially if | |
169 | you are building from the Bazaar repository: | |
170 | ||
171 | . Texinfo (needed to produce the Info manuals when building from | |
172 | bzr, and for "make install") | |
173 | ||
174 | Available from http://sourceforge.net/projects/ezwinports/files/. | |
175 | ||
176 | . gzip (needed to compress files during "make install") | |
177 | ||
178 | Available from http://gnuwin32.sourceforge.net/packages/gzip.htm. | |
179 | ||
180 | . pkg-config (needed for building with some optional libraries, | |
181 | such as GnuTLS and libxml2) | |
182 | ||
183 | Available from http://www.gtk.org/download/win32.php | |
184 | ||
185 | Each package might list other packages as prerequisites on its | |
186 | download page (under "Runtime requirements"); download those as | |
187 | well. (Using the mingw-get installer will fetch those prerequisites | |
188 | automatically for you.) A missing prerequisite will manifest itself | |
189 | by the program failing to run and presenting a pop-up dialog that | |
190 | states the missing or incompatible DLL; be sure to find and install | |
191 | these missing DLLs. | |
192 | ||
193 | Once you think you have MinGW installed, test the installation by | |
194 | building a trivial "hello, world!" program, and make sure that it | |
195 | builds without any error messages and the binary works when run. | |
196 | ||
197 | *** MSYS | |
198 | ||
199 | You will need a reasonably full MSYS installation. MSYS is an | |
200 | environment needed to run the Posix configure scripts and the | |
201 | resulting Makefile's, in order to produce native Windows binaries | |
202 | using the MinGW compiler and runtime libraries. Here's the list of | |
203 | MSYS packages that are required: | |
204 | ||
205 | . All the packages from the MSYS Base distribution, listed here: | |
206 | ||
207 | https://sourceforge.net/projects/mingw/files/MSYS/Base/ | |
208 | ||
209 | . Additional packages listed below, from the MSYS Extension | |
210 | distribution here: | |
211 | ||
212 | https://sourceforge.net/projects/mingw/files/MSYS/Extension/ | |
213 | ||
214 | - flex | |
215 | - bison | |
216 | - m4 | |
217 | - perl | |
218 | - mktemp | |
219 | ||
220 | These should only be needed if you intend to build development | |
221 | versions of Emacs from the Bazaar repository. | |
222 | ||
223 | . Additional packages (needed only if building from the Bazaar | |
224 | repository): Automake and Autoconf. They are available from | |
225 | here: | |
226 | ||
227 | http://sourceforge.net/projects/ezwinports/files/automake-1.11.6-msys-bin.zip/download | |
228 | http://sourceforge.net/projects/ezwinports/files/autoconf-2.65-msys-bin.zip/download | |
229 | ||
230 | MSYS packages are distributed as .tar.lzma compressed archives. To | |
231 | install the packages manually, we recommend to use the Windows port | |
232 | of the 'bsdtar' program, already mentioned above. | |
233 | ||
234 | If/when you are confident in your MinGW/MSYS installation, and want | |
235 | to speed up the builds, we recommend installing a pre-release | |
236 | version of Make from here: | |
237 | ||
238 | https://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/ | |
239 | ||
240 | These are snapshot builds of many packages, but you only need | |
241 | make.exe from there. The advantage of this make.exe is that it | |
242 | supports parallel builds, so you can use "make -j N" to considerably | |
243 | speed up your builds. | |
244 | ||
245 | Several users reported that MSYS 1.0.18 causes Make to hang in | |
246 | parallel builds. If you bump into this, we suggest to downgrade to | |
247 | MSYS 1.0.17, which doesn't have that problem. | |
248 | ||
249 | For each of these packages, install the 'bin' and 'dll' tarballs of | |
250 | their latest stable releases. If there's an 'ext' tarball (e.g., | |
251 | msysCORE and Coreutils have it), download and install those as well. | |
252 | ||
253 | Each package might list other packages as prerequisites on its | |
254 | download page (under "Runtime requirements"); download those as | |
255 | well. (Using the mingw-get installer will fetch those prerequisites | |
256 | automatically for you.) A missing prerequisite will manifest itself | |
257 | by the program failing to run and presenting a pop-up dialog that | |
258 | states the missing or incompatible DLL; be sure to find and install | |
259 | these missing DLLs. | |
260 | ||
261 | MSYS packages should be installed in a separate tree from MinGW. | |
262 | For example, use D:\MSYS or D:\usr\MSYS as the top-level directory | |
263 | from which you unpack all of the MSYS packages. | |
264 | ||
265 | Do NOT add the MSYS bin directory to your Windows Path! Only the | |
266 | MinGW bin directory should be on Path. When you install MSYS, it | |
267 | creates a shortcut on your desktop that invokes the MSYS Bash shell | |
268 | in a Command Prompt window; that shell is already set up so that the | |
269 | MSYS bin directory is on PATH ahead of any other directory. Thus, | |
270 | Bash will find MSYS executables first, which is exactly what you | |
271 | need. | |
272 | ||
273 | At this point, you are ready to build Emacs in its basic | |
274 | configuration. If you want to build it with image support and other | |
275 | optional libraries, read about that near the end of this document. | |
276 | ||
277 | * Generating the configure script | |
278 | ||
279 | If you are building a release or pretest tarball, skip this section, | |
280 | because the configure script is already present in the tarball. | |
281 | ||
282 | To build a development snapshot from the Emacs Bazaar repository, | |
283 | you will first need to generate the configure script and a few other | |
284 | auto-generated files. (If this step, described below, somehow | |
285 | fails, you can use the files in the autogen/ directory instead, but | |
286 | they might be outdated, and, most importantly, you are well advised | |
287 | not to disregard any failures in your local build procedures, as | |
288 | these are likely to be symptoms of incorrect installation that will | |
289 | bite you down the road.) | |
290 | ||
291 | To generate the configure script, type this at the MSYS Bash prompt | |
292 | from the top-level directory of the Emacs tree: | |
293 | ||
294 | ./autogen.sh | |
295 | ||
296 | If successful, this command should produce the following output: | |
297 | ||
298 | $ ./autogen.sh | |
299 | Checking whether you have the necessary tools... | |
300 | (Read INSTALL.BZR for more details on building Emacs) | |
301 | ||
302 | Checking for autoconf (need at least version 2.65)... | |
303 | ok | |
304 | Checking for automake (need at least version 1.11)... | |
305 | ok | |
306 | Your system has the required tools, running autoreconf... | |
307 | You can now run `./configure'. | |
308 | ||
309 | * Configuring Emacs for MinGW: | |
310 | ||
311 | Now it's time to run the configure script. You can do that either | |
312 | from a separate build directory that is outside of the Emacs source | |
313 | tree (recommended), or from inside the source tree. The former is | |
314 | recommended because it allows you to have several different builds, | |
315 | e.g., an optimized build and an unoptimized one, of the same | |
316 | revision of the source tree; the source tree will be left in its | |
317 | pristine state, without any build products. | |
318 | ||
319 | You invoke the configure script like this: | |
320 | ||
321 | /PATH/TO/EMACS/SOURCE/TREE/nt/msysconfig.sh --prefix=PREFIX ... | |
322 | ||
323 | or, if you are building in-place, i.e. inside the source tree: | |
324 | ||
325 | ./nt/msysconfig.sh --prefix=PREFIX ... | |
326 | ||
327 | Here PREFIX is the place where you eventually want to install Emacs | |
328 | once built, e.g. /d/usr. We recommend to always use --prefix when | |
329 | building Emacs on Windows, because the default '/usr/local' is not | |
330 | appropriate for Windows: it will be mapped by MSYS to something like | |
331 | C:\MSYS\local, and it will defeat the purpose of PREFIX, which is to | |
332 | install programs in a single coherent tree resembling Posix systems. | |
333 | Such a single-tree installation makes sure all the other programs | |
334 | and packages ported from GNU or Unix systems will work seamlessly | |
335 | together. Where exactly is the root of that tree on your system is | |
336 | something only you, the user who builds Emacs, can know, and the | |
337 | Emacs build process cannot guess, because usually there's no | |
338 | '/usr/local' directory on any drive on Windows systems. | |
339 | ||
340 | Do NOT use Windows-style x:/foo/bar file names on the configure | |
341 | script command line; use the MSYS-style /x/foo/bar instead. Using | |
342 | Windows-style file names was reported to cause subtle and hard to | |
343 | figure out problems during the build. This applies both to the | |
344 | command switches, such as --prefix=, and to the absolute file name | |
345 | of msysconfig.sh, if you are building outside of the source tree. | |
346 | ||
347 | You can pass additional options to the configure script, for the | |
348 | full list type | |
349 | ||
350 | ./nt/msysconfig.sh --help | |
351 | ||
352 | As explained in the help text, you may need to tell the script what | |
353 | are the optional flags to invoke the compiler. This is needed if | |
354 | some of your headers and libraries, e.g., those belonging to | |
355 | optional image libraries, are installed in places where the compiler | |
356 | normally doesn't look for them. (Remember that advice above to | |
357 | avoid such situations? here's is where you will start paying for | |
358 | disregarding that recommendation.) For example, if you have libpng | |
359 | headers in C:\emacs\libs\libpng-1.2.37-lib\include and jpeg library | |
360 | headers in C:\emacs\libs\jpeg-6b-4-lib\include, you will need to say | |
361 | something like this: | |
362 | ||
363 | CPPFLAGS='-I/c/emacs/libs/libpng-1.2.37-lib/include -I/c/emacs/libs/jpeg-6b-4-lib/include' ./nt/msysconfig.sh --prefix=PREFIX | |
364 | ||
365 | which is quite a mouth-full, especially if you have more directories | |
366 | to specify... Perhaps you may wish to revisit your installation | |
367 | decisions now. | |
368 | ||
369 | If you have a global site-lisp directory from previous Emacs | |
370 | installation, and you want Emacs to continue using it, specify it | |
371 | via the --enable-locallisppath switch to msysconfig.sh, like this: | |
372 | ||
373 | ./nt/msysconfig.sh --prefix=PREFIX --enable-locallisppath="/d/usr/share/emacs/VERSION/site-lisp:/d/wherever/site-lisp" | |
374 | ||
375 | Use the normal MSYS /d/foo/bar style to specify directories by their | |
376 | absolute file names. | |
377 | ||
378 | A few frequently used options are needed when you want to produce an | |
379 | unoptimized binary with runtime checks enabled: | |
380 | ||
381 | CPPFLAGS='-DGLYPH_DEBUG=1' CFLAGS='-O0 -g3' ./nt/msysconfig.sh --prefix=PREFIX --enable-checking | |
382 | ||
383 | Once invoked, the configure script will run for some time, and, if | |
384 | successful, will eventually produce a summary of the configuration | |
385 | like this: | |
386 | ||
387 | Configured for `i686-pc-mingw32'. | |
388 | ||
389 | Where should the build process find the source code? /path/to/emacs/sources | |
390 | What compiler should emacs be built with? gcc -std=gnu99 -O0 -g3 | |
391 | Should Emacs use the GNU version of malloc? yes | |
392 | Should Emacs use a relocating allocator for buffers? yes | |
393 | Should Emacs use mmap(2) for buffer allocation? no | |
394 | What window system should Emacs use? w32 | |
395 | What toolkit should Emacs use? none | |
396 | Where do we find X Windows header files? NONE | |
397 | Where do we find X Windows libraries? NONE | |
398 | Does Emacs use -lXaw3d? no | |
399 | Does Emacs use -lXpm? yes | |
400 | Does Emacs use -ljpeg? yes | |
401 | Does Emacs use -ltiff? yes | |
402 | Does Emacs use a gif library? yes | |
403 | Does Emacs use -lpng? yes | |
404 | Does Emacs use -lrsvg-2? no | |
405 | Does Emacs use imagemagick? no | |
406 | Does Emacs use -lgpm? no | |
407 | Does Emacs use -ldbus? no | |
408 | Does Emacs use -lgconf? no | |
409 | Does Emacs use GSettings? no | |
410 | Does Emacs use -lselinux? no | |
411 | Does Emacs use -lgnutls? yes | |
412 | Does Emacs use -lxml2? yes | |
413 | Does Emacs use -lfreetype? no | |
414 | Does Emacs use -lm17n-flt? no | |
415 | Does Emacs use -lotf? no | |
416 | Does Emacs use -lxft? no | |
417 | Does Emacs use toolkit scroll bars? yes | |
418 | ||
419 | You are almost there, hang on. | |
420 | ||
421 | If the output is significantly different, or if configure finishes | |
422 | prematurely and displays some error message, you should examine the | |
423 | configuration log in config.log and find the reason for the failure. | |
424 | ||
425 | Once you succeeded in configuring Emacs, and just want to rebuild it | |
426 | after updating your local repository from the main repository, you | |
427 | don't need to re-run the configure script manually, unless you want | |
428 | to change the configure-time options. Just typing "make" will | |
429 | re-run configure if necessary with the exact same options you | |
430 | specified originally, and then go on to invoking Make, described | |
431 | below. | |
432 | ||
433 | * Running Make. | |
434 | ||
435 | This is simple: just type "make" and sit back, watching the fun. | |
436 | ||
437 | If you installed a snapshot build of Make, the build will be much | |
438 | faster if you type "make -j N" instead, where N is the number of | |
439 | independent processing units on your machine. E.g., on a core i7 | |
440 | system try using N of 6 or even 8. (If this hangs, see the notes | |
441 | above about downgrading to MSYS 1.0.17.) | |
442 | ||
443 | When Make finishes, you can install the produced binaries: | |
444 | ||
445 | make install | |
446 | ||
447 | or, if you want the installed tree to go in a place different from | |
448 | the configured one, type | |
449 | ||
450 | make install prefix=WHEREVER | |
451 | ||
452 | Congrats! You have built and installed your own Emacs! | |
453 | ||
454 | * Make targets | |
455 | ||
456 | The following make targets may be used by users building the source | |
457 | distribution, or users who have checked out of Bazaar after | |
458 | an initial bootstrapping. | |
459 | ||
460 | make | |
461 | Builds Emacs from the available sources and pre-compiled lisp files. | |
462 | ||
463 | make install | |
464 | Installs the built programs and the auxiliary files. | |
465 | ||
466 | make clean | |
467 | Removes object and executable files produced by the build process in | |
468 | the current configuration. After "make clean", you can rebuild with | |
469 | the same configuration using make. useful when you want to be sure | |
470 | that all of the products are built from coherent sources. | |
471 | ||
472 | make distclean | |
473 | In addition to the files removed by make clean, this also removes | |
474 | Makefiles and other generated files to get back to the state of a | |
475 | freshly unpacked source distribution. After make distclean, it is | |
476 | necessary to run the configure script followed by "make", in order | |
477 | to rebuild. | |
478 | ||
479 | The following targets are intended only for use with the Bazaar sources. | |
480 | ||
481 | make bootstrap | |
482 | Removes all the auto-generated files and all the *.elc byte-compiled | |
483 | files, and builds Emacs from scratch. Useful when some change in | |
484 | basic Emacs functionality makes byte compilation of updated files | |
485 | fail. | |
486 | ||
487 | make maintainer-clean | |
488 | Removes everything that can be recreated, including compiled Lisp | |
489 | files, to get back to the state of a fresh Bazaar tree. After make | |
490 | maintainer-clean, it is necessary to run configure and "make" or | |
491 | "make bootstrap" to rebuild. Occasionally it may be necessary to | |
492 | run this target after an update. | |
591cbed1 | 493 | |
bfd889ed JR |
494 | * Optional image library support |
495 | ||
3dfbc6d8 | 496 | In addition to its "native" image formats (pbm and xbm), Emacs can |
8bc63b1a | 497 | handle other image types: xpm, tiff, gif, png, jpeg and experimental |
707a78b2 | 498 | support for svg. |
6d96d18f | 499 | |
8bc63b1a | 500 | To build Emacs with support for them, the corresponding headers must |
7605d081 GM |
501 | be in the include path and libraries should be where the linker |
502 | looks for them, when the configure script is run. If needed, this | |
503 | can be set up using the CPPFLAGS and CFLAGS variable specified on | |
504 | the configure command line. The configure script will report | |
505 | whether it was able to detect the headers and libraries. If the | |
506 | results of this testing appear to be incorrect, please look for | |
8bc63b1a JR |
507 | details in the file config.log: it will show the failed test |
508 | programs and compiler error messages that should explain what is | |
509 | wrong. (Usually, any such failures happen because some headers are | |
510 | missing due to bad packaging of the image support libraries.) | |
bfd889ed | 511 | |
a917e3f2 | 512 | Note that any file path passed to the compiler or linker must use |
7605d081 GM |
513 | forward slashes, or double each backslash, as that is how Bash |
514 | works. | |
515 | ||
516 | If the configure script finds the necessary headers and libraries, | |
517 | but they are for some reason incompatible, or if you want to omit | |
518 | support for some image library that is installed on your system for | |
519 | some other reason, use the --without-PACKAGE option to configure, | |
520 | such as --without-gif to omit GIF, --without-tiff to omit TIFF, etc. | |
521 | Passing the --help option to the configure script displays all of | |
522 | the supported --without-PACKAGE options. | |
a917e3f2 | 523 | |
3dfbc6d8 | 524 | To use the external image support, the DLLs implementing the |
bd7bdff8 JB |
525 | functionality must be found when Emacs first needs them, either on the |
526 | PATH, or in the same directory as emacs.exe. Failure to find a | |
527 | library is not an error; the associated image format will simply be | |
528 | unavailable. Note that once Emacs has determined that a library can | |
529 | not be found, there's no way to force it to try again, other than | |
2e288d54 | 530 | restarting. See the variable `dynamic-library-alist' to configure the |
bd7bdff8 | 531 | expected names of the libraries. |
3dfbc6d8 JB |
532 | |
533 | Some image libraries have dependencies on one another, or on zlib. | |
534 | For example, tiff support depends on the jpeg library. If you did not | |
535 | compile the libraries yourself, you must make sure that any dependency | |
5739d6f8 | 536 | is in the PATH or otherwise accessible and that the binaries are |
3dfbc6d8 JB |
537 | compatible (for example, that they were built with the same compiler). |
538 | ||
5be1c984 EZ |
539 | For PNG images, we recommend to use versions 1.4.x and later of |
540 | libpng, because previous versions had security issues. You can find | |
541 | precompiled libraries and headers on the GTK download page for | |
df6d30f3 | 542 | Windows (http://www.gtk.org/download/win32.php). |
5be1c984 EZ |
543 | |
544 | Versions 1.4.0 and later of libpng are binary incompatible with | |
545 | earlier versions, so Emacs will only look for libpng libraries which | |
546 | are compatible with the version it was compiled against. That | |
547 | version is given by the value of the Lisp variable `libpng-version'; | |
3d4cad2c | 548 | e.g., 10403 means version 1.4.3. The variable `dynamic-library-alist' |
5be1c984 EZ |
549 | is automatically set to name only those DLL names that are known to |
550 | be compatible with the version given by `libpng-version'. If PNG | |
551 | support does not work for you even though you have the support DLL | |
552 | installed, check the name of the installed DLL against | |
3d4cad2c | 553 | `dynamic-library-alist' and the value of `libpng-version', and |
5be1c984 EZ |
554 | download compatible DLLs if needed. |
555 | ||
71358845 EZ |
556 | For GIF images, we recommend to use versions 5.0.0 or later of |
557 | giflib, as it is much enhanced wrt previous versions. You can find | |
558 | precompiled binaries and headers for giflib on the ezwinports site, | |
559 | http://sourceforge.net/projects/ezwinports/files/. | |
560 | ||
561 | Version 5.0.0 and later of giflib are binary incompatible with | |
562 | previous versions (the signatures of several functions have | |
563 | changed), so Emacs will only look for giflib libraries that are | |
564 | compatible with the version it was compiled against. Similar to | |
565 | libpng, that version is given by the value of the Lisp variable | |
566 | `libgif-version'; e.g., 50005 means version 5.0.5. The variable | |
567 | `dynamic-library-alist' is automatically set to name only those DLL | |
568 | libraries that are known to be compatible with the version given by | |
569 | `libgif-version'. | |
570 | ||
571 | Binaries for the other image libraries can be found at the GnuWin32 | |
572 | project. Note specifically that, due to some packaging snafus in | |
573 | the GnuWin32-supplied image libraries, you will need to download | |
574 | _source_ packages for some of the libraries in order to get the | |
575 | header files necessary for building Emacs with image support. | |
576 | ||
fd4af8d9 TZ |
577 | * Optional GnuTLS support |
578 | ||
7605d081 GM |
579 | To compile with GnuTLS, you will need pkg-config to be installed, as |
580 | the configure script invokes pkg-config to find out which compiler | |
581 | switches to use for GnuTLS. See above for the URL where you can | |
582 | find pkg-config for Windows. | |
583 | ||
584 | You will also need to install the p11-kit package, which is a | |
585 | dependency of GnuTLS, and its header files are needed for | |
586 | compilation of programs that use GnuTLS. You can find p11-kit on | |
587 | the same site as GnuTLS, see the URL below. | |
588 | ||
589 | If the configure script finds the GnuTLS header files and libraries | |
590 | on your system, Emacs is built with GnuTLS support by default; to | |
591 | avoid that you can pass the argument --without-gnutls. | |
fd4af8d9 | 592 | |
0898ca10 JB |
593 | In order to support GnuTLS at runtime, a GnuTLS-enabled Emacs must |
594 | be able to find the relevant DLLs during startup; failure to do so | |
595 | is not an error, but GnuTLS won't be available to the running | |
596 | session. | |
597 | ||
598 | You can get pre-built binaries (including any required DLL and the | |
8dc96b40 | 599 | header files) at http://sourceforge.net/projects/ezwinports/files/. |
fd4af8d9 | 600 | |
9078ead6 EZ |
601 | * Optional libxml2 support |
602 | ||
7605d081 GM |
603 | To compile with libxml2, you will need pkg-config to be installed, |
604 | as the configure script invokes pkg-config to find out which | |
605 | compiler switches to use for libxml2. See above for the URL where | |
606 | you can find pkg-config for Windows. | |
607 | ||
608 | If the configure script finds the libxml2 header files and libraries | |
609 | on your system, Emacs is built with libxml2 support by default; to | |
610 | avoid that you can pass the argument --without-libxml2. | |
9078ead6 EZ |
611 | |
612 | In order to support libxml2 at runtime, a libxml2-enabled Emacs must | |
613 | be able to find the relevant DLLs during startup; failure to do so | |
614 | is not an error, but libxml2 features won't be available to the | |
615 | running session. | |
616 | ||
617 | One place where you can get pre-built Windows binaries of libxml2 | |
618 | (including any required DLL and the header files) is here: | |
619 | ||
620 | http://sourceforge.net/projects/ezwinports/files/ | |
621 | ||
7605d081 GM |
622 | For runtime support of libxml2, you will also need to install the |
623 | libiconv "development" tarball, because the libiconv headers need to | |
624 | be available to the compiler when you compile with libxml2 support. | |
625 | A MinGW port of libiconv can be found on the MinGW site: | |
9078ead6 EZ |
626 | |
627 | http://sourceforge.net/projects/mingw/files/MinGW/Base/libiconv/ | |
628 | ||
629 | You need the libiconv-X.Y.Z-N-mingw32-dev.tar.lzma tarball from that | |
630 | site. | |
631 | ||
8bc63b1a JR |
632 | * Experimental SVG support |
633 | ||
7605d081 GM |
634 | To compile with SVG, you will need pkg-config to be installed, as |
635 | the configure script invokes pkg-config to find out which compiler | |
636 | switches to use for SVG. See above for the URL where you can find | |
637 | pkg-config for Windows. | |
638 | ||
8bc63b1a | 639 | SVG support is currently experimental, and not built by default. |
7605d081 | 640 | Specify --with-rsvg and ensure you have all the dependencies in your |
1640b452 | 641 | include path. Unless you have built a minimalist librsvg yourself |
8bc63b1a | 642 | (untested), librsvg depends on a significant chunk of GTK+ to build, |
1640b452 | 643 | plus a few Gnome libraries, libxml2, libbz2 and zlib at runtime. The |
8bc63b1a JR |
644 | easiest way to obtain the dependencies required for building is to |
645 | download a pre-bundled GTK+ development environment for Windows. | |
8bc63b1a JR |
646 | |
647 | To use librsvg at runtime, ensure that librsvg and its dependencies | |
648 | are on your PATH. If you didn't build librsvg yourself, you will | |
649 | need to check with where you downloaded it from for the | |
650 | dependencies, as there are different build options. If it is a | |
651 | short list, then it most likely only lists the immediate | |
652 | dependencies of librsvg, but the dependencies themselves have | |
653 | dependencies - so don't download individual libraries from GTK+, | |
1640b452 | 654 | download and install the whole thing. If you think you've got all |
8bc63b1a JR |
655 | the dependencies and SVG support is still not working, check your |
656 | PATH for other libraries that shadow the ones you downloaded. | |
657 | Libraries of the same name from different sources may not be | |
658 | compatible, this problem was encountered with libbzip2 from GnuWin32 | |
659 | with libcroco from gnome.org. | |
660 | ||
661 | If you can see etc/images/splash.svg, then you have managed to get | |
662 | SVG support working. Congratulations for making it through DLL hell | |
1640b452 | 663 | to this point. You'll probably find that some SVG images crash |
8bc63b1a JR |
664 | Emacs. Problems have been observed in some images that contain |
665 | text, they seem to be a problem in the Windows port of Pango, or | |
666 | maybe a problem with the way Cairo or librsvg is using it that | |
667 | doesn't show up on other platforms. | |
668 | ||
7f6d64f8 GM |
669 | \f |
670 | This file is part of GNU Emacs. | |
4b994b84 | 671 | |
eef0be9e | 672 | GNU Emacs is free software: you can redistribute it and/or modify |
7f6d64f8 | 673 | it under the terms of the GNU General Public License as published by |
eef0be9e GM |
674 | the Free Software Foundation, either version 3 of the License, or |
675 | (at your option) any later version. | |
4b994b84 | 676 | |
7f6d64f8 GM |
677 | GNU Emacs is distributed in the hope that it will be useful, |
678 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
679 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
680 | GNU General Public License for more details. | |
681 | ||
682 | You should have received a copy of the GNU General Public License | |
eef0be9e | 683 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |