Continuation of previous change.
[bpt/emacs.git] / configure.ac
1 dnl Autoconf script for GNU Emacs
2 dnl To rebuild the `configure' script from this, execute the command
3 dnl autoconf
4 dnl in the directory containing this script.
5 dnl If you changed any AC_DEFINES, also run autoheader.
6 dnl
7 dnl Copyright (C) 1994-1996, 1999-2013 Free Software Foundation, Inc.
8 dnl
9 dnl This file is part of GNU Emacs.
10 dnl
11 dnl GNU Emacs is free software: you can redistribute it and/or modify
12 dnl it under the terms of the GNU General Public License as published by
13 dnl the Free Software Foundation, either version 3 of the License, or
14 dnl (at your option) any later version.
15 dnl
16 dnl GNU Emacs is distributed in the hope that it will be useful,
17 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
18 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 dnl GNU General Public License for more details.
20 dnl
21 dnl You should have received a copy of the GNU General Public License
22 dnl along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24 AC_PREREQ(2.65)
25 AC_INIT(emacs, 24.3.50)
26
27 dnl Set emacs_config_options to the options of 'configure', quoted for the shell,
28 dnl and then quoted again for a C string. Separate options with spaces.
29 dnl Add some environment variables, if they were passed via the environment
30 dnl rather than on the command-line.
31 emacs_config_options=
32 optsep=
33 dnl This is the documented way to record the args passed to configure,
34 dnl rather than $ac_configure_args.
35 for opt in ${1+"$@"} CFLAGS CPPFLAGS LDFLAGS; do
36 case $opt in
37 -n | --no-create | --no-recursion)
38 continue ;;
39 CFLAGS | CPPFLAGS | LDFLAGS)
40 eval 'test "${'$opt'+set}" = set' || continue
41 case " $*" in
42 *" $opt="*) continue ;;
43 esac
44 eval opt=$opt=\$$opt ;;
45 esac
46
47 emacs_shell_specials=$IFS\''"#$&()*;<>?@<:@\\`{|~'
48 case $opt in
49 *[["$emacs_shell_specials"]]*)
50 case $opt in
51 *\'*)
52 emacs_quote_apostrophes="s/'/'\\\\''/g"
53 opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_apostrophes"` ;;
54 esac
55 opt="'$opt'"
56 case $opt in
57 *[['"\\']]*)
58 emacs_quote_for_c='s/[["\\]]/\\&/g; $!s/$/\\n\\/'
59 opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_for_c"` ;;
60 esac ;;
61 esac
62 AS_VAR_APPEND([emacs_config_options], ["$optsep$opt"])
63 optsep=' '
64 done
65
66 AC_CONFIG_HEADER(src/config.h:src/config.in)
67 AC_CONFIG_SRCDIR(src/lisp.h)
68 AC_CONFIG_AUX_DIR(build-aux)
69 dnl Fairly arbitrary, older versions might work too.
70 AM_INIT_AUTOMAKE(1.11)
71
72 dnl Support for --program-prefix, --program-suffix and
73 dnl --program-transform-name options
74 AC_ARG_PROGRAM
75
76 dnl http://debbugs.gnu.org/15260
77 dnl Note that abs_srcdir and abs_builddir are not yet defined. :(
78
79 dnl "`cd \"$srcdir\"`" is not portable.
80 dnl See autoconf manual "Shell Substitutions":
81 dnl "There is just no portable way to use double-quoted strings inside
82 dnl double-quoted back-quoted expressions (pfew!)."
83 temp_srcdir=`cd "$srcdir"; pwd`
84
85 for var in "`pwd`" "$temp_srcdir"; do
86
87 dnl configure sets LC_ALL=C early on, so this range should work.
88 case "$var" in
89 *[[^\ -~]]*) AC_MSG_ERROR([Emacs cannot be built in a directory whose name contains non-ASCII characters: $var]) ;;
90 esac
91
92 done
93
94 dnl It is important that variables on the RHS not be expanded here,
95 dnl hence the single quotes. This is per the GNU coding standards, see
96 dnl (autoconf) Installation Directory Variables
97 dnl See also epaths.h below.
98 lispdir='${datadir}/emacs/${version}/lisp'
99 leimdir='${datadir}/emacs/${version}/leim'
100 standardlisppath='${lispdir}:${leimdir}'
101 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
102 '${datadir}/emacs/site-lisp'
103 lisppath='${locallisppath}:${standardlisppath}'
104 etcdir='${datadir}/emacs/${version}/etc'
105 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
106 etcdocdir='${datadir}/emacs/${version}/etc'
107 gamedir='${localstatedir}/games/emacs'
108
109 dnl Special option to disable the most of other options.
110 AC_ARG_WITH(all,
111 [AS_HELP_STRING([--without-all],
112 [omit almost all features and build
113 small executable with minimal dependencies])],
114 with_features=$withval,
115 with_features=yes)
116
117 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
118 dnl Create a new --with option that defaults to being disabled.
119 dnl NAME is the base name of the option. The shell variable with_NAME
120 dnl will be set to either the user's value (if the option is
121 dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
122 dnl option is not specified). Note that the shell variable name is
123 dnl constructed as autoconf does, by replacing non-alphanumeric
124 dnl characters with "_".
125 dnl HELP-STRING is the help text for the option.
126 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
127 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
128 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
129 ])dnl
130
131 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
132 dnl Create a new --with option that defaults to $with_features.
133 dnl NAME is the base name of the option. The shell variable with_NAME
134 dnl will be set either to 'no' (for a plain --without-NAME) or to
135 dnl 'yes' (if the option is not specified). Note that the shell
136 dnl variable name is constructed as autoconf does, by replacing
137 dnl non-alphanumeric characters with "_".
138 dnl HELP-STRING is the help text for the option.
139 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
140 AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
141 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=$with_features])dnl
142 ])dnl
143
144 OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
145 if test "$with_pop" = yes; then
146 AC_DEFINE(MAIL_USE_POP)
147 fi
148 AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
149
150 OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
151 if test "$with_kerberos" != no; then
152 AC_DEFINE(KERBEROS)
153 fi
154 AH_TEMPLATE(KERBEROS,
155 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
156
157 OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
158 if test "${with_kerberos5}" != no; then
159 if test "${with_kerberos}" = no; then
160 with_kerberos=yes
161 AC_DEFINE(KERBEROS)
162 fi
163 AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
164 fi
165
166 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
167 dnl FIXME hesiod support may not be present, so it seems like an error
168 dnl to define, or at least use, this unconditionally.
169 if test "$with_hesiod" != no; then
170 AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
171 fi
172
173 OPTION_DEFAULT_OFF([mmdf],[support MMDF mailboxes])
174 if test "$with_mmdf" != no; then
175 AC_DEFINE(MAIL_USE_MMDF, 1, [Define to support MMDF mailboxes in movemail.])
176 fi
177
178 OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
179 if test "$with_mail_unlink" != no; then
180 AC_DEFINE(MAIL_UNLINK_SPOOL, 1, [Define to unlink, rather than empty, mail spool after reading.])
181 fi
182
183 AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
184 [string giving default POP mail host])],
185 AC_DEFINE_UNQUOTED(MAILHOST, ["$withval"], [String giving fallback POP mail host.]))
186
187 AC_ARG_WITH([sound],[AS_HELP_STRING([--with-sound=VALUE],
188 [compile with sound support (VALUE one of: yes, alsa, oss, bsd-ossaudio, no;
189 default yes). Only for GNU/Linux, FreeBSD, NetBSD, MinGW.])],
190 [ case "${withval}" in
191 yes|no|alsa|oss|bsd-ossaudio) val=$withval ;;
192 *) AC_MSG_ERROR([`--with-sound=$withval' is invalid;
193 this option's value should be `yes', `no', `alsa', `oss', or `bsd-ossaudio'.])
194 ;;
195 esac
196 with_sound=$val
197 ],
198 [with_sound=$with_features])
199
200 dnl FIXME currently it is not the last.
201 dnl This should be the last --with option, because --with-x is
202 dnl added later on when we find the file name of X, and it's best to
203 dnl keep them together visually.
204 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
205 [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, motif, no)])],
206 [ case "${withval}" in
207 y | ye | yes ) val=gtk ;;
208 n | no ) val=no ;;
209 l | lu | luc | luci | lucid ) val=lucid ;;
210 a | at | ath | athe | athen | athena ) val=athena ;;
211 m | mo | mot | moti | motif ) val=motif ;;
212 g | gt | gtk ) val=gtk ;;
213 gtk2 ) val=gtk2 ;;
214 gtk3 ) val=gtk3 ;;
215 * )
216 AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
217 this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk',
218 `gtk2' or `gtk3'. `yes' and `gtk' are synonyms.
219 `athena' and `lucid' are synonyms.])
220 ;;
221 esac
222 with_x_toolkit=$val
223 ])
224
225 OPTION_DEFAULT_OFF([wide-int], [prefer wide Emacs integers (typically 62-bit)])
226 if test "$with_wide_int" = yes; then
227 AC_DEFINE([WIDE_EMACS_INT], 1, [Use long long for EMACS_INT if available.])
228 fi
229
230 dnl _ON results in a '--without' option in the --help output, so
231 dnl the help text should refer to "don't compile", etc.
232 OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
233 OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
234 OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
235 OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
236 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
237 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
238 OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
239 OPTION_DEFAULT_ON([imagemagick],[don't compile with ImageMagick image support])
240
241 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
242 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
243 OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
244
245 OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
246 OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
247 OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
248 OPTION_DEFAULT_OFF([ns],[use NeXTstep (Cocoa or GNUstep) windowing system])
249 OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build])
250
251 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
252 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
253 OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
254 OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
255 OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
256 OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
257 OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support])
258
259 AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB],
260 [use a file notification library (LIB one of: yes, gfile, inotify, w32, no)])],
261 [ case "${withval}" in
262 y | ye | yes ) val=yes ;;
263 n | no ) val=no ;;
264 g | gf | gfi | gfil | gfile ) val=gfile ;;
265 i | in | ino | inot | inoti | inotif | inotify ) val=inotify ;;
266 w | w3 | w32 ) val=w32 ;;
267 * ) AC_MSG_ERROR([`--with-file-notification=$withval' is invalid;
268 this option's value should be `yes', `no', `gfile', `inotify' or `w32'.
269 `yes' is a synonym for `w32' on MS-Windows, for `no' on Nextstep,
270 otherwise for the first of `gfile' or `inotify' that is usable.])
271 ;;
272 esac
273 with_file_notification=$val
274 ],
275 [with_file_notification=$with_features])
276
277 ## For the times when you want to build Emacs but don't have
278 ## a suitable makeinfo, and can live without the manuals.
279 dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
280 OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
281
282 ## Makefile.in needs the cache file name.
283 AC_SUBST(cache_file)
284
285 ## This is an option because I do not know if all info/man support
286 ## compressed files, nor how to test if they do so.
287 OPTION_DEFAULT_ON([compress-install],
288 [don't compress some files (.el, .info, etc.) when installing. Equivalent to:
289 make GZIP_PROG= install])
290
291 AC_ARG_WITH([pkg-config-prog],dnl
292 [AS_HELP_STRING([--with-pkg-config-prog=FILENAME],
293 [file name of pkg-config for finding GTK and librsvg])])
294 if test "X${with_pkg_config_prog}" != X; then
295 if test "${with_pkg_config_prog}" != yes; then
296 PKG_CONFIG="${with_pkg_config_prog}"
297 fi
298 fi
299
300 AC_ARG_WITH(gameuser,dnl
301 [AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])])
302 test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \
303 && gameuser="${with_gameuser}"
304 test "X$gameuser" = X && gameuser=games
305
306 AC_ARG_WITH([gnustep-conf],dnl
307 [AS_HELP_STRING([--with-gnustep-conf=FILENAME],
308 [name of GNUstep.conf; default $GNUSTEP_CONFIG_FILE, or /etc/GNUstep/GNUstep.conf])])
309 test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
310 GNUSTEP_CONFIG_FILE="${with_gnustep_conf}"
311 test "X$GNUSTEP_CONFIG_FILE" = "X" && \
312 GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
313
314 AC_ARG_ENABLE(ns-self-contained,
315 [AS_HELP_STRING([--disable-ns-self-contained],
316 [disable self contained build under NeXTstep])],
317 EN_NS_SELF_CONTAINED=$enableval,
318 EN_NS_SELF_CONTAINED=yes)
319
320 AC_ARG_ENABLE(locallisppath,
321 [AS_HELP_STRING([--enable-locallisppath=PATH],
322 [directories Emacs should search for lisp files specific
323 to this site])],
324 if test "${enableval}" = "no"; then
325 locallisppath=
326 elif test "${enableval}" != "yes"; then
327 locallisppath=${enableval}
328 fi)
329
330 AC_ARG_ENABLE(checking,
331 [AS_HELP_STRING([--enable-checking@<:@=LIST@:>@],
332 [enable expensive run-time checks. With LIST,
333 enable only specific categories of checks.
334 Categories are: all,yes,no.
335 Flags are: stringbytes, stringoverrun, stringfreelist,
336 xmallocoverrun, conslist, glyphs])],
337 [ac_checking_flags="${enableval}"],[])
338 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
339 for check in $ac_checking_flags
340 do
341 case $check in
342 # these set all the flags to specific states
343 yes) ac_enable_checking=1 ;;
344 no) ac_enable_checking= ;
345 ac_gc_check_stringbytes= ;
346 ac_gc_check_string_overrun= ;
347 ac_gc_check_string_free_list= ;
348 ac_xmalloc_overrun= ;
349 ac_gc_check_cons_list= ;
350 ac_glyphs_debug= ;;
351 all) ac_enable_checking=1 ;
352 ac_gc_check_stringbytes=1 ;
353 ac_gc_check_string_overrun=1 ;
354 ac_gc_check_string_free_list=1 ;
355 ac_xmalloc_overrun=1 ;
356 ac_gc_check_cons_list=1 ;
357 ac_glyphs_debug=1 ;;
358 # these enable particular checks
359 stringbytes) ac_gc_check_stringbytes=1 ;;
360 stringoverrun) ac_gc_check_string_overrun=1 ;;
361 stringfreelist) ac_gc_check_string_free_list=1 ;;
362 xmallocoverrun) ac_xmalloc_overrun=1 ;;
363 conslist) ac_gc_check_cons_list=1 ;;
364 glyphs) ac_glyphs_debug=1 ;;
365 *) AC_MSG_ERROR(unknown check category $check) ;;
366 esac
367 done
368 IFS="$ac_save_IFS"
369
370 if test x$ac_enable_checking != x ; then
371 AC_DEFINE(ENABLE_CHECKING, 1,
372 [Define to 1 if expensive run-time data type and consistency checks are enabled.])
373 fi
374 if test x$ac_gc_check_stringbytes != x ; then
375 AC_DEFINE(GC_CHECK_STRING_BYTES, 1,
376 [Define this temporarily to hunt a bug. If defined, the size of
377 strings is redundantly recorded in sdata structures so that it can
378 be compared to the sizes recorded in Lisp strings.])
379 fi
380 if test x$ac_gc_check_string_overrun != x ; then
381 AC_DEFINE(GC_CHECK_STRING_OVERRUN, 1,
382 [Define this to check for short string overrun.])
383 fi
384 if test x$ac_gc_check_string_free_list != x ; then
385 AC_DEFINE(GC_CHECK_STRING_FREE_LIST, 1,
386 [Define this to check the string free list.])
387 fi
388 if test x$ac_xmalloc_overrun != x ; then
389 AC_DEFINE(XMALLOC_OVERRUN_CHECK, 1,
390 [Define this to check for malloc buffer overrun.])
391 fi
392 if test x$ac_gc_check_cons_list != x ; then
393 AC_DEFINE(GC_CHECK_CONS_LIST, 1,
394 [Define this to check for errors in cons list.])
395 fi
396 if test x$ac_glyphs_debug != x ; then
397 AC_DEFINE(GLYPH_DEBUG, 1,
398 [Define this to enable glyphs debugging code.])
399 fi
400
401 AC_ARG_ENABLE(check-lisp-object-type,
402 [AS_HELP_STRING([--enable-check-lisp-object-type],
403 [enable compile time checks for the Lisp_Object data type.
404 This is useful for development for catching certain types of bugs.])],
405 if test "${enableval}" != "no"; then
406 AC_DEFINE(CHECK_LISP_OBJECT_TYPE, 1,
407 [Define this to enable compile time checks for the Lisp_Object data type.])
408 fi)
409
410
411 dnl The name of this option is unfortunate. It predates, and has no
412 dnl relation to, the "sampling-based elisp profiler" added in 24.3.
413 dnl Actually, it stops it working.
414 dnl http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00393.html
415 AC_ARG_ENABLE(profiling,
416 [AS_HELP_STRING([--enable-profiling],
417 [build emacs with low-level, gprof profiling support.
418 Mainly useful for debugging Emacs itself. May not work on
419 all platforms. Stops profiler.el working.])],
420 [ac_enable_profiling="${enableval}"],[])
421 if test x$ac_enable_profiling != x ; then
422 PROFILING_CFLAGS="-DPROFILING=1 -pg"
423 else
424 PROFILING_CFLAGS=
425 fi
426 AC_SUBST(PROFILING_CFLAGS)
427
428 AC_ARG_ENABLE(autodepend,
429 [AS_HELP_STRING([--enable-autodepend],
430 [automatically generate dependencies to .h-files.
431 Requires GNU Make and Gcc. Enabled if GNU Make and Gcc is
432 found])],
433 [ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes])
434
435 AC_ARG_ENABLE(gtk-deprecation-warnings,
436 [AS_HELP_STRING([--enable-gtk-deprecation-warnings],
437 [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])],
438 [ac_enable_gtk_deprecation_warnings="${enableval}"],[])
439
440 #### When building with MinGW inside the MSYS tree, 'pwd' produces
441 #### directories relative to the root of the MSYS tree,
442 #### e.g. '/home/user/foo' instead of '/d/MSYS/home/user/foo'. When
443 #### such a value of srcdir is written to the top-level Makefile, it
444 #### gets propagated to src/epaths.h, and that causes temacs to fail,
445 #### because, being a MinGW program that knows nothing of MSYS root
446 #### substitution, it cannot find the data directory. "pwd -W"
447 #### produces Windows-style 'd:/foo/bar' absolute directory names, so
448 #### we use it here to countermand that lossage.
449 test "$MSYSTEM" = "MINGW32" && abs_srcdir=`(cd "$abs_srcdir"; pwd -W | sed -e 's,^\([[A-Za-z]]\):,/\1,')`
450
451 ### Canonicalize the configuration name.
452
453 AC_CANONICAL_HOST
454 canonical=$host
455 configuration=${host_alias-${build_alias-$host}}
456
457 dnl This used to use changequote, but, apart from `changequote is evil'
458 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
459 dnl the great gob of text. Thus it's not processed for possible expansion.
460 dnl Just make sure the brackets remain balanced.
461 dnl
462 dnl Since Emacs can't find matching pairs of quotes, boundaries are
463 dnl indicated by comments.
464 dnl quotation begins
465 [
466
467 ### If you add support for a new configuration, add code to this
468 ### switch statement to recognize your configuration name and select
469 ### the appropriate operating system file.
470
471 ### You would hope that you could choose an s/*.h
472 ### file based on the operating system portion. However, it turns out
473 ### that each s/*.h file is pretty manufacturer-specific.
474 ### So we basically have to have a special case for each
475 ### configuration name.
476 ###
477 ### As far as handling version numbers on operating systems is
478 ### concerned, make sure things will fail in a fixable way. If
479 ### /etc/MACHINES doesn't say anything about version numbers, be
480 ### prepared to handle anything reasonably. If version numbers
481 ### matter, be sure /etc/MACHINES says something about it.
482
483 opsys='' unported=no
484 case "${canonical}" in
485
486 ## GNU/Linux and similar ports
487 *-*-linux* )
488 opsys=gnu-linux
489 ;;
490
491 ## FreeBSD ports
492 *-*-freebsd* )
493 opsys=freebsd
494 ;;
495
496 ## DragonFly ports
497 *-*-dragonfly* )
498 opsys=dragonfly
499 ;;
500
501 ## FreeBSD kernel + glibc based userland
502 *-*-kfreebsd*gnu* )
503 opsys=gnu-kfreebsd
504 ;;
505
506 ## NetBSD ports
507 *-*-netbsd* )
508 opsys=netbsd
509 ;;
510
511 ## OpenBSD ports
512 *-*-openbsd* )
513 opsys=openbsd
514 ;;
515
516 ## Apple Darwin / Mac OS X
517 *-apple-darwin* )
518 case "${canonical}" in
519 i[3456]86-* ) ;;
520 powerpc-* ) ;;
521 x86_64-* ) ;;
522 * ) unported=yes ;;
523 esac
524 opsys=darwin
525 ## Use fink packages if available.
526 ## FIXME find a better way to do this: http://debbugs.gnu.org/11507
527 ## if test -d /sw/include && test -d /sw/lib; then
528 ## GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
529 ## NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
530 ## fi
531 ;;
532
533 ## Cygwin ports
534 *-*-cygwin )
535 opsys=cygwin
536 ;;
537
538 ## HP 9000 series 700 and 800, running HP/UX
539 hppa*-hp-hpux10.2* )
540 opsys=hpux10-20
541 ;;
542 hppa*-hp-hpux1[1-9]* )
543 opsys=hpux11
544 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
545 ;;
546
547 ## IBM machines
548 rs6000-ibm-aix4.[23]* )
549 opsys=aix4-2
550 ;;
551 powerpc-ibm-aix4.[23]* )
552 opsys=aix4-2
553 ;;
554 rs6000-ibm-aix[56]* )
555 opsys=aix4-2
556 ;;
557 powerpc-ibm-aix[56]* )
558 opsys=aix4-2
559 ;;
560
561 ## Silicon Graphics machines
562 ## Iris 4D
563 mips-sgi-irix6.5 )
564 opsys=irix6-5
565 # Without defining _LANGUAGE_C, things get masked out in the headers
566 # so that, for instance, grepping for `free' in stdlib.h fails and
567 # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
568 NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
569 ;;
570
571 ## Suns
572 *-sun-solaris* \
573 | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
574 | x86_64-*-solaris2* | x86_64-*-sunos5*)
575 case "${canonical}" in
576 i[3456]86-*-* ) ;;
577 amd64-*-*|x86_64-*-*) ;;
578 sparc* ) ;;
579 * ) unported=yes ;;
580 esac
581 case "${canonical}" in
582 *-sunos5.6* | *-solaris2.6* )
583 opsys=sol2-6
584 RANLIB="ar -ts"
585 ;;
586 *-sunos5.[7-9]* | *-solaris2.[7-9]* )
587 opsys=sol2-6
588 emacs_check_sunpro_c=yes
589 ;;
590 *-sunos5* | *-solaris* )
591 opsys=sol2-10
592 emacs_check_sunpro_c=yes
593 ;;
594 esac
595 ## Watch out for a compiler that we know will not work.
596 case "${canonical}" in
597 *-solaris* | *-sunos5* )
598 if [ "x$CC" = x/usr/ucb/cc ]; then
599 ## /usr/ucb/cc doesn't work;
600 ## we should find some other compiler that does work.
601 unset CC
602 fi
603 ;;
604 *) ;;
605 esac
606 ;;
607
608 ## Intel 386 machines where we don't care about the manufacturer.
609 i[3456]86-*-* )
610 case "${canonical}" in
611 *-darwin* ) opsys=darwin ;;
612 *-mingw32 )
613 opsys=mingw32
614 # MinGW overrides and adds some system headers in nt/inc.
615 GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
616 ;;
617 *-sysv4.2uw* ) opsys=unixware ;;
618 *-sysv5uw* ) opsys=unixware ;;
619 *-sysv5OpenUNIX* ) opsys=unixware ;;
620 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
621 esac
622 ;;
623
624 * )
625 unported=yes
626 ;;
627 esac
628
629 ### If the code above didn't choose an operating system, just choose
630 ### an operating system based on the configuration name. You really
631 ### only want to use this when you have no idea what the right
632 ### operating system is; if you know what operating systems a machine
633 ### runs, it's cleaner to make it explicit in the case statement
634 ### above.
635 if test x"${opsys}" = x; then
636 case "${canonical}" in
637 *-gnu* ) opsys=gnu ;;
638 * )
639 unported=yes
640 ;;
641 esac
642 fi
643
644 ]
645 dnl quotation ends
646
647 if test $unported = yes; then
648 AC_MSG_ERROR([Emacs hasn't been ported to `${canonical}' systems.
649 Check `etc/MACHINES' for recognized configuration names.])
650 fi
651
652
653 #### Choose a compiler.
654
655 dnl Sets GCC=yes if using gcc.
656 AC_PROG_CC
657 AM_PROG_CC_C_O
658
659 if test x$GCC = xyes; then
660 test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
661 else
662 test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
663 fi
664
665 dnl This is used in lib/Makefile.am to use nt/gnulib.mk, the
666 dnl alternative to lib/gnulib.mk, so as to avoid generating header files
667 dnl that clash with MinGW.
668 AM_CONDITIONAL([BUILDING_FOR_WINDOWSNT], [test "x$opsys" = "xmingw32"])
669
670 # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
671 # as we don't use them.
672 AC_DEFUN([gl_FCNTL_O_FLAGS])
673 # Avoid gnulib's threadlib module, as we do threads our own way.
674 AC_DEFUN([gl_THREADLIB])
675
676 # Initialize gnulib right after choosing the compiler.
677 dnl Amongst other things, this sets AR and ARFLAGS.
678 gl_EARLY
679
680 if test "$ac_test_CFLAGS" != set; then
681 # It's helpful to have C macros available to GDB, so prefer -g3 to -g
682 # if -g3 works and the user does not specify CFLAGS.
683 # This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
684 case $CFLAGS in
685 '-g')
686 emacs_g3_CFLAGS='-g3';;
687 '-g -O2')
688 emacs_g3_CFLAGS='-g3 -O2';;
689 *)
690 emacs_g3_CFLAGS='';;
691 esac
692 if test -n "$emacs_g3_CFLAGS"; then
693 emacs_save_CFLAGS=$CFLAGS
694 CFLAGS=$emacs_g3_CFLAGS
695 AC_CACHE_CHECK([whether $CC accepts $emacs_g3_CFLAGS],
696 [emacs_cv_prog_cc_g3],
697 [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
698 [emacs_cv_prog_cc_g3=yes],
699 [emacs_cv_prog_cc_g3=no])])
700 if test $emacs_cv_prog_cc_g3 != yes; then
701 CFLAGS=$emacs_save_CFLAGS
702 fi
703 if test $opsys = mingw32; then
704 CFLAGS="$CFLAGS -gdwarf-2"
705 fi
706 fi
707
708 case $CFLAGS in
709 *-O*) ;;
710 *)
711 # No optimization flag was inferred for this non-GCC compiler.
712 # Try -O. This is needed for xlc on AIX; see Bug#14258.
713 emacs_save_CFLAGS=$CFLAGS
714 test -z "$CFLAGS" || CFLAGS="$CFLAGS "
715 CFLAGS=${CFLAGS}-O
716 AC_CACHE_CHECK([whether $CC accepts -O],
717 [emacs_cv_prog_cc_o],
718 [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
719 [emacs_cv_prog_cc_o=yes],
720 [emacs_cv_prog_cc_o=no])])
721 if test $emacs_cv_prog_cc_o != yes; then
722 CFLAGS=$emacs_save_CFLAGS
723 fi ;;
724 esac
725 fi
726
727 AC_ARG_ENABLE([gcc-warnings],
728 [AS_HELP_STRING([--enable-gcc-warnings],
729 [turn on lots of GCC warnings/errors. This is intended for
730 developers, and may generate false alarms when used
731 with older or non-GNU development tools.])],
732 [case $enableval in
733 yes|no) ;;
734 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
735 esac
736 gl_gcc_warnings=$enableval],
737 [gl_gcc_warnings=no]
738 )
739
740 AC_ARG_ENABLE(link-time-optimization,
741 [AS_HELP_STRING([--enable-link-time-optimization],
742 [build emacs with link-time optimization.
743 This is supported only for GCC since 4.5.0.])],
744 if test "${enableval}" != "no"; then
745 AC_MSG_CHECKING([whether link-time optimization is supported])
746 ac_lto_supported=no
747 if test x$GCC = xyes; then
748 CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
749 if test x$CPUS != x; then
750 LTO="-flto=$CPUS"
751 else
752 LTO="-flto"
753 fi
754 old_CFLAGS=$CFLAGS
755 CFLAGS="$CFLAGS $LTO"
756 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
757 [ac_lto_supported=yes], [ac_lto_supported=no])
758 CFLAGS="$old_CFLAGS"
759 fi
760 AC_MSG_RESULT([$ac_lto_supported])
761 if test "$ac_lto_supported" = "yes"; then
762 CFLAGS="$CFLAGS $LTO"
763 fi
764 fi)
765
766 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
767 # ------------------------------------------------
768 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
769 # Otherwise, run RUN-IF-NOT-FOUND.
770 AC_DEFUN([gl_GCC_VERSION_IFELSE],
771 [AC_PREPROC_IFELSE(
772 [AC_LANG_PROGRAM(
773 [[
774 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
775 /* ok */
776 #else
777 # error "your version of gcc is older than $1.$2"
778 #endif
779 ]]),
780 ], [$3], [$4])
781 ]
782 )
783
784 # clang is unduly picky about some things.
785 AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
786 [AC_COMPILE_IFELSE(
787 [AC_LANG_PROGRAM([[
788 #ifndef __clang__
789 #error "not clang"
790 #endif
791 ]])],
792 [emacs_cv_clang=yes],
793 [emacs_cv_clang=no])])
794
795 # When compiling with GCC, prefer -isystem to -I when including system
796 # include files, to avoid generating useless diagnostics for the files.
797 if test "$gl_gcc_warnings" != yes; then
798 isystem='-I'
799 if test "$emacs_cv_clang" = yes
800 then
801 # Turn off some warnings if supported.
802 gl_WARN_ADD([-Wno-switch])
803 gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
804 gl_WARN_ADD([-Wno-pointer-sign])
805 fi
806 else
807 isystem='-isystem '
808
809 # This, $nw, is the list of warnings we disable.
810 nw=
811
812 case $with_x_toolkit in
813 lucid | athena | motif)
814 # Old toolkits mishandle 'const'.
815 nw="$nw -Wwrite-strings"
816 ;;
817 *)
818 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
819 ;;
820 esac
821 AC_SUBST([WERROR_CFLAGS])
822
823 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
824 nw="$nw -Woverlength-strings" # Not a problem these days
825 nw="$nw -Wlogical-op" # any use of fwrite provokes this
826 nw="$nw -Wformat-nonliteral" # we do this a lot
827 nw="$nw -Wvla" # warnings in gettext.h
828 nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
829 nw="$nw -Wswitch-default" # Too many warnings for now
830 nw="$nw -Winline" # OK to ignore 'inline'
831 nw="$nw -Wjump-misses-init" # We sometimes safely jump over init.
832 nw="$nw -Wstrict-overflow" # OK to optimize assuming that
833 # signed overflow has undefined behavior
834 nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
835 nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
836 nw="$nw -Wbad-function-cast" # These casts are no worse than others.
837
838 # Emacs doesn't care about shadowing; see
839 # <http://lists.gnu.org/archive/html/emacs-diffs/2011-11/msg00265.html>.
840 nw="$nw -Wshadow"
841
842 # Emacs's use of alloca inhibits protecting the stack.
843 nw="$nw -Wstack-protector"
844
845 # The following line should be removable at some point.
846 nw="$nw -Wsuggest-attribute=pure"
847
848 # This part is merely for shortening the command line,
849 # since -Wno-FOO needs to be added below regardless.
850 nw="$nw -Wmissing-field-initializers"
851 nw="$nw -Wswitch"
852 nw="$nw -Wtype-limits"
853 nw="$nw -Wunused-parameter"
854
855 if test $emacs_cv_clang = yes; then
856 nw="$nw -Wcast-align"
857 fi
858
859 gl_MANYWARN_ALL_GCC([ws])
860 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
861 for w in $ws; do
862 gl_WARN_ADD([$w])
863 done
864 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
865 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
866 gl_WARN_ADD([-Wno-type-limits]) # Too many warnings for now
867 gl_WARN_ADD([-Wno-switch]) # Too many warnings for now
868 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
869 gl_WARN_ADD([-Wno-format-nonliteral])
870
871 # In spite of excluding -Wlogical-op above, it is enabled, as of
872 # gcc 4.5.0 20090517.
873 gl_WARN_ADD([-Wno-logical-op])
874
875 # More things that clang is unduly picky about.
876 if test $emacs_cv_clang = yes; then
877 gl_WARN_ADD([-Wno-format-extra-args])
878 gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
879 gl_WARN_ADD([-Wno-unused-command-line-argument])
880 gl_WARN_ADD([-Wno-unused-value])
881 fi
882
883 AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
884 AH_VERBATIM([FORTIFY_SOURCE],
885 [/* Enable compile-time and run-time bounds-checking, and some warnings,
886 without upsetting glibc 2.15+. */
887 #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
888 # define _FORTIFY_SOURCE 2
889 #endif
890 ])
891 AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
892
893 # We use a slightly smaller set of warning options for lib/.
894 # Remove the following and save the result in GNULIB_WARN_CFLAGS.
895 nw=
896 nw="$nw -Wunused-macros"
897
898 gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
899 AC_SUBST([GNULIB_WARN_CFLAGS])
900 fi
901
902
903
904 dnl Some other nice autoconf tests.
905 dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
906 dnl AC_PROG_INSTALL
907 dnl AC_PROG_MKDIR_P
908 dnl if test "x$RANLIB" = x; then
909 dnl AC_PROG_RANLIB
910 dnl fi
911
912
913 dnl Sadly, AC_PROG_LN_S is too restrictive. It also tests whether links
914 dnl can be made to directories. This is not relevant for our usage, and
915 dnl excludes some cases that work fine for us. Eg MS Windows or files
916 dnl hosted on AFS, both examples where simple links work, but links to
917 dnl directories fail. We use a cut-down version instead.
918 dnl AC_PROG_LN_S
919
920 AC_MSG_CHECKING([whether ln -s works for files in the same directory])
921 rm -f conf$$ conf$$.file
922
923 LN_S_FILEONLY='cp -p'
924
925 if (echo >conf$$.file) 2>/dev/null; then
926 if ln -s conf$$.file conf$$ 2>/dev/null; then
927 LN_S_FILEONLY='ln -s'
928 elif ln conf$$.file conf$$ 2>/dev/null; then
929 LN_S_FILEONLY=ln
930 fi
931 fi
932
933 rm -f conf$$ conf$$.file
934
935 if test "$LN_S_FILEONLY" = "ln -s"; then
936 AC_MSG_RESULT([yes])
937 else
938 AC_MSG_RESULT([no, using $LN_S_FILEONLY])
939 fi
940
941 AC_SUBST(LN_S_FILEONLY)
942
943
944 dnl AC_PROG_LN_S sets LN_S to 'cp -pR' for MinGW, on the premise that 'ln'
945 dnl doesn't support links to directories, as in "ln file dir". But that
946 dnl use is non-portable, and OTOH MinGW wants to use hard links for Emacs
947 dnl executables at "make install" time.
948 dnl See http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00475.html
949 dnl for more details.
950 if test "$opsys" = "mingw32"; then
951 LN_S="ln"
952 fi
953
954 AC_PATH_PROG(INSTALL_INFO, install-info, :,
955 $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
956 dnl Don't use GZIP, which is used by gzip for additional parameters.
957 AC_PATH_PROG(GZIP_PROG, gzip)
958
959 test $with_compress_install != yes && test -n "$GZIP_PROG" && \
960 GZIP_PROG=" # $GZIP_PROG # (disabled by configure --without-compress-install)"
961
962 if test $opsys = gnu-linux; then
963 AC_PATH_PROG(PAXCTL, paxctl,,
964 [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
965 if test "X$PAXCTL" != X; then
966 AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header])
967 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
968 [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then AC_MSG_RESULT(yes)
969 else AC_MSG_RESULT(no); PAXCTL=""; fi])
970 fi
971 fi
972
973 ## Need makeinfo >= 4.7 (?) to build the manuals.
974 AC_PATH_PROG(MAKEINFO, makeinfo, no)
975 dnl By this stage, configure has already checked for egrep and set EGREP,
976 dnl or exited with an error if no egrep was found.
977 if test "$MAKEINFO" != "no"; then
978 case `
979 $MAKEINFO --version 2> /dev/null |
980 $EGREP 'texinfo[[^0-9]]*([[1-4]][[0-9]]+|[[5-9]]|4\.[[7-9]]|4\.[[1-6]][[0-9]]+)'
981 ` in
982 '') MAKEINFO=no;;
983 esac
984 fi
985
986 ## Makeinfo is unusual. For a released Emacs, the manuals are
987 ## pre-built, and not deleted by the normal clean rules. makeinfo is
988 ## therefore in the category of "special tools" not normally required, which
989 ## configure does not have to check for (eg autoconf itself).
990 ## In a Bazaar checkout on the other hand, the manuals are not included.
991 ## So makeinfo is a requirement to build from Bazaar, and configure
992 ## should test for it as it does for any other build requirement.
993 ## We use the presence of $srcdir/info/emacs to distinguish a release,
994 ## with pre-built manuals, from a Bazaar checkout.
995 HAVE_MAKEINFO=yes
996
997 if test "$MAKEINFO" = "no"; then
998 MAKEINFO=makeinfo
999 if test "x${with_makeinfo}" = "xno"; then
1000 HAVE_MAKEINFO=no
1001 elif test ! -e "$srcdir/info/emacs" && test ! -e "$srcdir/info/emacs.info"; then
1002 AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.7, and your
1003 source tree does not seem to have pre-built manuals in the `info' directory.
1004 Either install a suitable version of makeinfo, or re-run configure
1005 with the `--without-makeinfo' option to build without the manuals.] )
1006 fi
1007 fi
1008 AC_SUBST(HAVE_MAKEINFO)
1009
1010 dnl Just so that there is only a single place we need to edit.
1011 INFO_EXT=.info
1012 INFO_OPTS=--no-split
1013 AC_SUBST(INFO_EXT)
1014 AC_SUBST(INFO_OPTS)
1015
1016 if test $opsys = mingw32; then
1017 DOCMISC_W32=efaq-w32
1018 else
1019 DOCMISC_W32=
1020 fi
1021 AC_SUBST(DOCMISC_W32)
1022
1023 dnl Add our options to ac_link now, after it is set up.
1024
1025 if test x$GCC = xyes; then
1026 test "x$GCC_LINK_TEST_OPTIONS" != x && \
1027 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
1028 else
1029 test "x$NON_GCC_LINK_TEST_OPTIONS" != x && \
1030 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
1031 fi
1032
1033 dnl We need -znocombreloc if we're using a relatively recent GNU ld.
1034 dnl If we can link with the flag, it shouldn't do any harm anyhow.
1035 dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
1036 dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
1037 dnl if not built to support GNU ld.
1038
1039 dnl For a long time, -znocombreloc was added to LDFLAGS rather than
1040 dnl LD_SWITCH_SYSTEM_TEMACS. That is:
1041 dnl * inappropriate, as LDFLAGS is a user option but this is essential.
1042 dnl Eg "make LDFLAGS=... all" could run into problems,
1043 dnl http://bugs.debian.org/684788
1044 dnl * unnecessary, since temacs is the only thing that actually needs it.
1045 dnl Indeed this is where it was originally, prior to:
1046 dnl http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-03/msg00170.html
1047 late_LDFLAGS="$LDFLAGS"
1048 if test x$GCC = xyes; then
1049 LDFLAGS_NOCOMBRELOC="-Wl,-znocombreloc"
1050 else
1051 LDFLAGS_NOCOMBRELOC="-znocombreloc"
1052 fi
1053
1054 LDFLAGS="$LDFLAGS $LDFLAGS_NOCOMBRELOC"
1055
1056 AC_MSG_CHECKING([for -znocombreloc])
1057 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
1058 [AC_MSG_RESULT(yes)],
1059 LDFLAGS_NOCOMBRELOC=
1060 [AC_MSG_RESULT(no)])
1061
1062 LDFLAGS="$late_LDFLAGS"
1063
1064 dnl The function dump-emacs will not be defined and temacs will do
1065 dnl (load "loadup") automatically unless told otherwise.
1066 test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no
1067 case "$opsys" in
1068 your-opsys-here) CANNOT_DUMP=yes ;;
1069 esac
1070
1071 test "$CANNOT_DUMP" = "yes" && \
1072 AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs cannot be dumped on your system.])
1073
1074 AC_SUBST(CANNOT_DUMP)
1075
1076
1077 UNEXEC_OBJ=unexelf.o
1078 case "$opsys" in
1079 # MSDOS uses unexcoff.o
1080 aix4-2)
1081 UNEXEC_OBJ=unexaix.o
1082 ;;
1083 cygwin)
1084 UNEXEC_OBJ=unexcw.o
1085 ;;
1086 darwin)
1087 UNEXEC_OBJ=unexmacosx.o
1088 ;;
1089 hpux10-20 | hpux11)
1090 UNEXEC_OBJ=unexhp9k800.o
1091 ;;
1092 mingw32)
1093 UNEXEC_OBJ=unexw32.o
1094 ;;
1095 sol2-10)
1096 # Use the Solaris dldump() function, called from unexsol.c, to dump
1097 # emacs, instead of the generic ELF dump code found in unexelf.c.
1098 # The resulting binary has a complete symbol table, and is better
1099 # for debugging and other observability tools (debuggers, pstack, etc).
1100 #
1101 # If you encounter a problem using dldump(), please consider sending
1102 # a message to the OpenSolaris tools-linking mailing list:
1103 # http://mail.opensolaris.org/mailman/listinfo/tools-linking
1104 #
1105 # It is likely that dldump() works with older Solaris too, but this has
1106 # not been tested, so for now this change is for Solaris 10 or newer.
1107 UNEXEC_OBJ=unexsol.o
1108 ;;
1109 esac
1110
1111 LD_SWITCH_SYSTEM=
1112 case "$opsys" in
1113 freebsd|dragonfly)
1114 ## Let `ld' find image libs and similar things in /usr/local/lib.
1115 ## The system compiler, GCC, has apparently been modified to not
1116 ## look there, contrary to what a stock GCC would do.
1117 ### It's not our place to do this. See bug#10313#17.
1118 ### LD_SWITCH_SYSTEM=-L/usr/local/lib
1119 :
1120 ;;
1121
1122 gnu-linux)
1123 ## cpp test was "ifdef __mips__", but presumably this is equivalent...
1124 case $host_cpu in mips*) LD_SWITCH_SYSTEM="-G 0";; esac
1125 ;;
1126
1127 netbsd)
1128 ### It's not our place to do this. See bug#10313#17.
1129 ### LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
1130 :
1131 ;;
1132
1133 openbsd)
1134 ## Han Boetes <han@boetes.org> says this is necessary,
1135 ## otherwise Emacs dumps core on elf systems.
1136 LD_SWITCH_SYSTEM="-Z"
1137 ;;
1138 esac
1139 AC_SUBST(LD_SWITCH_SYSTEM)
1140
1141 ac_link="$ac_link $LD_SWITCH_SYSTEM"
1142
1143 ## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
1144 ## which has not been defined yet. When this was handled with cpp,
1145 ## it was expanded to null when configure sourced the s/*.h file.
1146 ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
1147 ## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
1148 ## (or somesuch), but because it is supposed to go at the _front_
1149 ## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
1150 ## Compare with the gnu-linux case below, which added to the end
1151 ## of LD_SWITCH_SYSTEM, and so can instead go at the front of
1152 ## LD_SWITCH_SYSTEM_TEMACS.
1153 case "$opsys" in
1154 netbsd|openbsd)
1155 LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
1156 esac
1157
1158
1159 C_SWITCH_MACHINE=
1160 case $canonical in
1161 alpha*)
1162 AC_CHECK_DECL([__ELF__])
1163 if test "$ac_cv_have_decl___ELF__" = "yes"; then
1164 ## With ELF, make sure that all common symbols get allocated to in the
1165 ## data section. Otherwise, the dump of temacs may miss variables in
1166 ## the shared library that have been initialized. For example, with
1167 ## GNU libc, __malloc_initialized would normally be resolved to the
1168 ## shared library's .bss section, which is fatal.
1169 if test "x$GCC" = "xyes"; then
1170 C_SWITCH_MACHINE="-fno-common"
1171 else
1172 AC_MSG_ERROR([Non-GCC compilers are not supported.])
1173 fi
1174 else
1175 dnl This was the unexalpha.c case. Removed in 24.1, 2010-07-24,
1176 dnl albeit under the mistaken assumption that said file
1177 dnl was no longer used.
1178 AC_MSG_ERROR([Non-ELF systems are not supported since Emacs 24.1.])
1179 fi
1180 ;;
1181 esac
1182 AC_SUBST(C_SWITCH_MACHINE)
1183
1184 AC_SUBST(UNEXEC_OBJ)
1185
1186 C_SWITCH_SYSTEM=
1187 ## Some programs in src produce warnings saying certain subprograms
1188 ## are too complex and need a MAXMEM value greater than 2000 for
1189 ## additional optimization. --nils@exp-math.uni-essen.de
1190 test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
1191 C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
1192 test "$opsys" = "mingw32" && C_SWITCH_SYSTEM="-mtune=pentium4"
1193 ## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
1194 ## It is redundant in glibc2, since we define _GNU_SOURCE.
1195 AC_SUBST(C_SWITCH_SYSTEM)
1196
1197
1198 LIBS_SYSTEM=
1199 case "$opsys" in
1200 ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
1201 aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
1202
1203 freebsd|dragonfly) LIBS_SYSTEM="-lutil" ;;
1204
1205 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
1206
1207 sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
1208
1209 ## Motif needs -lgen.
1210 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
1211 esac
1212
1213 AC_SUBST(LIBS_SYSTEM)
1214
1215 ### Make sure subsequent tests use flags consistent with the build flags.
1216
1217 if test x"${OVERRIDE_CPPFLAGS}" != x; then
1218 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
1219 else
1220 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
1221 fi
1222
1223 # Suppress obsolescent Autoconf test for size_t; Emacs assumes C89 or better.
1224 AC_DEFUN([AC_TYPE_SIZE_T])
1225 # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
1226 AC_DEFUN([AC_TYPE_UID_T])
1227
1228
1229 LIB_MATH=-lm
1230 dnl Current possibilities handled by sed (aix4-2 -> aix,
1231 dnl gnu-linux -> gnu/linux, etc.):
1232 dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix.
1233 dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
1234 SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
1235
1236 case $opsys in
1237 cygwin )
1238 LIB_MATH=
1239 ;;
1240 darwin )
1241 ## Adding -lm confuses the dynamic linker, so omit it.
1242 LIB_MATH=
1243 ;;
1244 freebsd | dragonfly )
1245 SYSTEM_TYPE=berkeley-unix
1246 ;;
1247 gnu-linux | gnu-kfreebsd )
1248 ;;
1249 hpux10-20 | hpux11 )
1250 ;;
1251 mingw32 )
1252 LIB_MATH=
1253 SYSTEM_TYPE=windows-nt
1254 ;;
1255 dnl NB this may be adjusted below.
1256 netbsd | openbsd )
1257 SYSTEM_TYPE=berkeley-unix
1258 ;;
1259
1260 sol2* | unixware )
1261 SYSTEM_TYPE=usg-unix-v
1262 ;;
1263
1264 esac
1265
1266 AC_SUBST(LIB_MATH)
1267 AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
1268 [The type of system you are compiling for; sets `system-type'.])
1269
1270
1271 pre_PKG_CONFIG_CFLAGS=$CFLAGS
1272 pre_PKG_CONFIG_LIBS=$LIBS
1273
1274 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1275
1276 dnl This function definition taken from Gnome 2.0
1277 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1278 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1279 dnl also defines GSTUFF_PKG_ERRORS on error
1280 AC_DEFUN([PKG_CHECK_MODULES], [
1281 succeeded=no
1282
1283 if test "$PKG_CONFIG" = "no" ; then
1284 ifelse([$4], , [AC_MSG_ERROR([
1285 *** The pkg-config script could not be found. Make sure it is in your path, or give the full name of pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog. Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.])], [$4])
1286 else
1287 PKG_CONFIG_MIN_VERSION=0.9.0
1288 if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1289 AC_MSG_CHECKING(for $2)
1290
1291 if "$PKG_CONFIG" --exists "$2" 2>&AS_MESSAGE_LOG_FD &&
1292 $1_CFLAGS=`"$PKG_CONFIG" --cflags "$2" 2>&AS_MESSAGE_LOG_FD` &&
1293 $1_LIBS=`"$PKG_CONFIG" --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then
1294 edit_cflags="
1295 s,///*,/,g
1296 s/^/ /
1297 s/ -I/ $isystem/g
1298 s/^ //
1299 "
1300 $1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
1301 $1_LIBS=`AS_ECHO(["$$1_LIBS"]) | sed -e 's,///*,/,g'`
1302 AC_MSG_RESULT([yes CFLAGS='$$1_CFLAGS' LIBS='$$1_LIBS'])
1303 succeeded=yes
1304 else
1305 AC_MSG_RESULT(no)
1306 $1_CFLAGS=""
1307 $1_LIBS=""
1308 ## If we have a custom action on failure, don't print errors, but
1309 ## do set a variable so people can do so. Do it in a subshell
1310 ## to capture any diagnostics in invoking pkg-config.
1311 $1_PKG_ERRORS=`("$PKG_CONFIG" --print-errors "$2") 2>&1`
1312 ifelse([$4], ,echo "$$1_PKG_ERRORS",)
1313 fi
1314
1315 AC_SUBST($1_CFLAGS)
1316 AC_SUBST($1_LIBS)
1317 else
1318 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1319 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1320 fi
1321 fi
1322
1323 if test $succeeded = yes; then
1324 ifelse([$3], , :, [$3])
1325 else
1326 ifelse([$4], , [AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])], [$4])
1327 fi
1328 ])
1329
1330 HAVE_SOUND=no
1331 if test "${with_sound}" != "no"; then
1332 # Sound support for GNU/Linux, the free BSDs, and MinGW.
1333 AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h],
1334 have_sound_header=yes, [], [
1335 #ifdef __MINGW32__
1336 #define WIN32_LEAN_AND_MEAN
1337 #include <windows.h>
1338 #endif
1339 ])
1340 test "${with_sound}" = "oss" && test "${have_sound_header}" != "yes" && \
1341 AC_MSG_ERROR([OSS sound support requested but not found.])
1342
1343 if test "${with_sound}" = "bsd-ossaudio" || test "${with_sound}" = "yes"; then
1344 # Emulation library used on NetBSD.
1345 AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
1346 test "${with_sound}" = "bsd-ossaudio" && test -z "$LIBSOUND" && \
1347 AC_MSG_ERROR([bsd-ossaudio sound support requested but not found.])
1348 dnl FIXME? If we did find ossaudio, should we set with_sound=bsd-ossaudio?
1349 dnl Traditionally, we go on to check for alsa too. Does that make sense?
1350 fi
1351 AC_SUBST(LIBSOUND)
1352
1353 if test "${with_sound}" = "alsa" || test "${with_sound}" = "yes"; then
1354 ALSA_REQUIRED=1.0.0
1355 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
1356 PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
1357 if test $HAVE_ALSA = yes; then
1358 SAVE_CFLAGS="$CFLAGS"
1359 SAVE_LIBS="$LIBS"
1360 CFLAGS="$ALSA_CFLAGS $CFLAGS"
1361 LIBS="$ALSA_LIBS $LIBS"
1362 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <asoundlib.h>]], [[snd_lib_error_set_handler (0);]])],
1363 emacs_alsa_normal=yes,
1364 emacs_alsa_normal=no)
1365 if test "$emacs_alsa_normal" != yes; then
1366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alsa/asoundlib.h>]],
1367 [[snd_lib_error_set_handler (0);]])],
1368 emacs_alsa_subdir=yes,
1369 emacs_alsa_subdir=no)
1370 if test "$emacs_alsa_subdir" != yes; then
1371 AC_MSG_ERROR([pkg-config found alsa, but it does not compile. See config.log for error messages.])
1372 fi
1373 ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
1374 fi
1375
1376 CFLAGS="$SAVE_CFLAGS"
1377 LIBS="$SAVE_LIBS"
1378 LIBSOUND="$LIBSOUND $ALSA_LIBS"
1379 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
1380 AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
1381 elif test "${with_sound}" = "alsa"; then
1382 AC_MSG_ERROR([ALSA sound support requested but not found.])
1383 fi
1384 fi dnl with_sound = alsa|yes
1385
1386 dnl Define HAVE_SOUND if we have sound support. We know it works and
1387 dnl compiles only on the specified platforms. For others, it
1388 dnl probably doesn't make sense to try.
1389 dnl FIXME So surely we should bypass this whole section if not using
1390 dnl one of these platforms?
1391 if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
1392 case "$opsys" in
1393 dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
1394 dnl Adjust the --with-sound help text if you change this.
1395 gnu-linux|freebsd|netbsd|mingw32)
1396 AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.])
1397 HAVE_SOUND=yes
1398 ;;
1399 esac
1400 fi
1401
1402 AC_SUBST(CFLAGS_SOUND)
1403 fi
1404
1405 dnl checks for header files
1406 AC_CHECK_HEADERS_ONCE(
1407 sys/systeminfo.h
1408 coff.h pty.h
1409 sys/resource.h
1410 sys/utsname.h pwd.h utmp.h util.h)
1411
1412 AC_MSG_CHECKING(if personality LINUX32 can be set)
1413 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/personality.h>]], [[personality (PER_LINUX32)]])],
1414 emacs_cv_personality_linux32=yes,
1415 emacs_cv_personality_linux32=no)
1416 AC_MSG_RESULT($emacs_cv_personality_linux32)
1417
1418 if test $emacs_cv_personality_linux32 = yes; then
1419 AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
1420 [Define to 1 if personality LINUX32 can be set.])
1421 fi
1422
1423 dnl On Solaris 8 there's a compilation warning for term.h because
1424 dnl it doesn't define `bool'.
1425 AC_CHECK_HEADERS(term.h, , , -)
1426 AC_HEADER_TIME
1427 AC_CHECK_DECLS([sys_siglist], [], [], [[#include <signal.h>
1428 ]])
1429 if test $ac_cv_have_decl_sys_siglist != yes; then
1430 # For Tru64, at least:
1431 AC_CHECK_DECLS([__sys_siglist], [], [], [[#include <signal.h>
1432 ]])
1433 fi
1434 AC_HEADER_SYS_WAIT
1435
1436 AC_CHECK_HEADERS_ONCE(sys/socket.h)
1437 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1438 #if HAVE_SYS_SOCKET_H
1439 #include <sys/socket.h>
1440 #endif])
1441 AC_CHECK_HEADERS(ifaddrs.h, , , [AC_INCLUDES_DEFAULT
1442 #if HAVE_SYS_SOCKET_H
1443 #include <sys/socket.h>
1444 #endif])
1445 AC_CHECK_HEADERS(net/if_dl.h, , , [AC_INCLUDES_DEFAULT
1446 #if HAVE_SYS_SOCKET_H
1447 #include <sys/socket.h>
1448 #endif])
1449
1450 dnl checks for structure members
1451 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
1452 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
1453 struct ifreq.ifr_addr,
1454 struct ifreq.ifr_addr.sa_len], , ,
1455 [AC_INCLUDES_DEFAULT
1456 #if HAVE_SYS_SOCKET_H
1457 #include <sys/socket.h>
1458 #endif
1459 #if HAVE_NET_IF_H
1460 #include <net/if.h>
1461 #endif])
1462
1463 dnl Check for endianness.
1464 dnl AC_C_BIGENDIAN is done by gnulib.
1465
1466 dnl check for Make feature
1467 dnl AC_PROG_MAKE_SET is done by Automake.
1468
1469 DEPFLAGS=
1470 MKDEPDIR=":"
1471 deps_frag=deps.mk
1472 dnl check for GNU Make if we have GCC and autodepend is on.
1473 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
1474 AC_MSG_CHECKING([whether we are using GNU Make])
1475 HAVE_GNU_MAKE=no
1476 testval=`${MAKE-make} --version 2>/dev/null | grep 'GNU Make'`
1477 if test "x$testval" != x; then
1478 HAVE_GNU_MAKE=yes
1479 else
1480 ac_enable_autodepend=no
1481 fi
1482 AC_MSG_RESULT([$HAVE_GNU_MAKE])
1483 if test $HAVE_GNU_MAKE = yes; then
1484 AC_MSG_CHECKING([whether gcc understands -MMD -MF])
1485 SAVE_CFLAGS="$CFLAGS"
1486 CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
1487 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], , ac_enable_autodepend=no)
1488 CFLAGS="$SAVE_CFLAGS"
1489 test -f deps.d || ac_enable_autodepend=no
1490 rm -rf deps.d
1491 AC_MSG_RESULT([$ac_enable_autodepend])
1492 fi
1493 if test $ac_enable_autodepend = yes; then
1494 DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d -MP'
1495 ## MKDIR_P is documented (see AC_PROG_MKDIR_P) to be parallel-safe.
1496 MKDEPDIR='${MKDIR_P} ${DEPDIR}'
1497 deps_frag=autodeps.mk
1498 fi
1499 fi
1500 deps_frag=$srcdir/src/$deps_frag
1501 AC_SUBST(MKDEPDIR)
1502 AC_SUBST(DEPFLAGS)
1503 AC_SUBST_FILE(deps_frag)
1504
1505
1506 lisp_frag=$srcdir/src/lisp.mk
1507 AC_SUBST_FILE(lisp_frag)
1508
1509
1510 dnl checks for operating system services
1511 AC_SYS_LONG_FILE_NAMES
1512
1513 #### Choose a window system.
1514
1515 ## We leave window_system equal to none if
1516 ## we end up building without one. Any new window system should
1517 ## set window_system to an appropriate value and add objects to
1518 ## window-system-specific substs.
1519
1520 window_system=none
1521 AC_PATH_X
1522 if test "$no_x" != yes; then
1523 window_system=x11
1524 fi
1525
1526 LD_SWITCH_X_SITE_RPATH=
1527 if test "${x_libraries}" != NONE; then
1528 if test -n "${x_libraries}"; then
1529 LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
1530 LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`echo ${x_libraries} | sed -e "s/:/ -Wl,-rpath,/g"`
1531 fi
1532 x_default_search_path=""
1533 x_search_path=${x_libraries}
1534 if test -z "${x_search_path}"; then
1535 x_search_path=/usr/lib
1536 fi
1537 for x_library in `echo ${x_search_path}: | \
1538 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
1539 x_search_path="\
1540 ${x_library}/X11/%L/%T/%N%C%S:\
1541 ${x_library}/X11/%l/%T/%N%C%S:\
1542 ${x_library}/X11/%T/%N%C%S:\
1543 ${x_library}/X11/%L/%T/%N%S:\
1544 ${x_library}/X11/%l/%T/%N%S:\
1545 ${x_library}/X11/%T/%N%S"
1546 if test x"${x_default_search_path}" = x; then
1547 x_default_search_path=${x_search_path}
1548 else
1549 x_default_search_path="${x_search_path}:${x_default_search_path}"
1550 fi
1551 done
1552 fi
1553 AC_SUBST(LD_SWITCH_X_SITE_RPATH)
1554
1555 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
1556 C_SWITCH_X_SITE="$isystem"`echo ${x_includes} | sed -e "s/:/ $isystem/g"`
1557 fi
1558
1559 if test x"${x_includes}" = x; then
1560 bitmapdir=/usr/include/X11/bitmaps
1561 else
1562 # accumulate include directories that have X11 bitmap subdirectories
1563 bmd_acc="dummyval"
1564 for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
1565 if test -d "${bmd}/X11/bitmaps"; then
1566 bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
1567 fi
1568 if test -d "${bmd}/bitmaps"; then
1569 bmd_acc="${bmd_acc}:${bmd}/bitmaps"
1570 fi
1571 done
1572 if test ${bmd_acc} != "dummyval"; then
1573 bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
1574 fi
1575 fi
1576
1577 HAVE_NS=no
1578 NS_IMPL_COCOA=no
1579 NS_IMPL_GNUSTEP=no
1580 tmp_CPPFLAGS="$CPPFLAGS"
1581 tmp_CFLAGS="$CFLAGS"
1582 CPPFLAGS="$CPPFLAGS -x objective-c"
1583 CFLAGS="$CFLAGS -x objective-c"
1584 GNU_OBJC_CFLAGS=
1585 LIBS_GNUSTEP=
1586 if test "${with_ns}" != no; then
1587 if test "${opsys}" = darwin; then
1588 NS_IMPL_COCOA=yes
1589 ns_appdir=`pwd`/nextstep/Emacs.app
1590 ns_appbindir=${ns_appdir}/Contents/MacOS
1591 ns_appresdir=${ns_appdir}/Contents/Resources
1592 ns_appsrc=Cocoa/Emacs.base
1593 elif test -f $GNUSTEP_CONFIG_FILE; then
1594 NS_IMPL_GNUSTEP=yes
1595 ns_appdir=`pwd`/nextstep/Emacs.app
1596 ns_appbindir=${ns_appdir}
1597 ns_appresdir=${ns_appdir}/Resources
1598 ns_appsrc=GNUstep/Emacs.base
1599 dnl FIXME sourcing this several times in subshells seems inefficient.
1600 GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
1601 GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
1602 dnl I seemed to need these as well with GNUstep-startup 0.25.
1603 GNUSTEP_LOCAL_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_HEADERS)"
1604 GNUSTEP_LOCAL_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_LIBRARIES)"
1605 test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
1606 GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
1607 test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
1608 GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
1609 CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1610 CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1611 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
1612 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
1613 dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
1614 dnl If they had chosen to either define it or not, we could have
1615 dnl just used AC_CHECK_DECL here.
1616 AC_CACHE_CHECK(if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS,
1617 emacs_cv_objc_exceptions,
1618 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <GNUstepBase/GSConfig.h>]],
1619 [[#if defined BASE_NATIVE_OBJC_EXCEPTIONS && BASE_NATIVE_OBJC_EXCEPTIONS > 0
1620 1;
1621 #else
1622 fail;
1623 #endif]])], emacs_cv_objc_exceptions=yes, emacs_cv_objc_exceptions=no ) )
1624 if test $emacs_cv_objc_exceptions = yes; then
1625 dnl _NATIVE_OBJC_EXCEPTIONS is used by the GNUstep headers.
1626 AC_DEFINE(_NATIVE_OBJC_EXCEPTIONS, 1,
1627 [Define if GNUstep uses ObjC exceptions.])
1628 GNU_OBJC_CFLAGS="-fobjc-exceptions"
1629 fi
1630 fi
1631
1632 dnl This is only used while we test the NS headers, it gets reset below.
1633 CFLAGS="$CFLAGS $GNU_OBJC_CFLAGS"
1634
1635 AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
1636 [AC_MSG_ERROR([`--with-ns' was specified, but the include
1637 files are missing or cannot be compiled.])])
1638
1639 macfont_file=""
1640 if test "${NS_IMPL_COCOA}" = "yes"; then
1641 AC_MSG_CHECKING([for OSX 10.4 or newer])
1642 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>],
1643 [
1644 #ifdef MAC_OS_X_VERSION_MAX_ALLOWED
1645 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
1646 ; /* OK */
1647 #else
1648 #error "OSX 10.4 or newer required"
1649 #endif
1650 #endif
1651 ])],
1652 ns_osx_have_104=yes,
1653 ns_osx_have_104=no)
1654 AC_MSG_RESULT([$ns_osx_have_104])
1655
1656 if test $ns_osx_have_104 = no; then
1657 AC_MSG_ERROR([`OSX 10.4 or newer is required']);
1658 fi
1659 AC_MSG_CHECKING([for OSX 10.5 or newer])
1660 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>],
1661 [
1662 #ifdef MAC_OS_X_VERSION_MAX_ALLOWED
1663 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
1664 ; /* OK */
1665 #else
1666 #error "OSX 10.5 not found"
1667 #endif
1668 #endif
1669 ])],
1670 ns_osx_have_105=yes,
1671 ns_osx_have_105=no)
1672 AC_MSG_RESULT([$ns_osx_have_105])
1673 if test $ns_osx_have_105 = yes; then
1674 macfont_file="macfont.o"
1675 fi
1676 fi
1677 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <Foundation/NSObjCRuntime.h>],
1678 [NSInteger i;])],
1679 ns_have_nsinteger=yes,
1680 ns_have_nsinteger=no)
1681 if test $ns_have_nsinteger = yes; then
1682 AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.])
1683 fi
1684 fi
1685
1686 AC_SUBST(LIBS_GNUSTEP)
1687
1688 INSTALL_ARCH_INDEP_EXTRA=install-etc
1689 ns_self_contained=no
1690 NS_OBJ=
1691 NS_OBJC_OBJ=
1692 if test "${HAVE_NS}" = yes; then
1693 if test "$with_toolkit_scroll_bars" = "no"; then
1694 AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for Nextstep.])
1695 fi
1696
1697 window_system=nextstep
1698 # set up packaging dirs
1699 if test "${EN_NS_SELF_CONTAINED}" = yes; then
1700 ns_self_contained=yes
1701 prefix=${ns_appresdir}
1702 exec_prefix=${ns_appbindir}
1703 dnl This one isn't really used, only archlibdir is.
1704 libexecdir="\${ns_appbindir}/libexec"
1705 archlibdir="\${ns_appbindir}/libexec"
1706 etcdocdir="\${ns_appresdir}/etc"
1707 etcdir="\${ns_appresdir}/etc"
1708 dnl FIXME maybe set datarootdir instead.
1709 dnl That would also get applications, icons, man.
1710 infodir="\${ns_appresdir}/info"
1711 mandir="\${ns_appresdir}/man"
1712 lispdir="\${ns_appresdir}/lisp"
1713 leimdir="\${ns_appresdir}/leim"
1714 INSTALL_ARCH_INDEP_EXTRA=
1715 fi
1716
1717 NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o $macfont_file"
1718 fi
1719 CFLAGS="$tmp_CFLAGS"
1720 CPPFLAGS="$tmp_CPPFLAGS"
1721 AC_SUBST(INSTALL_ARCH_INDEP_EXTRA)
1722 AC_SUBST(ns_self_contained)
1723 AC_SUBST(NS_OBJ)
1724 AC_SUBST(NS_OBJC_OBJ)
1725
1726 HAVE_W32=no
1727 W32_OBJ=
1728 W32_LIBS=
1729 EMACSRES=
1730 CLIENTRES=
1731 CLIENTW=
1732 W32_RES_LINK=
1733 EMACS_MANIFEST=
1734 UPDATE_MANIFEST=
1735 if test "${with_w32}" != no; then
1736 case "${opsys}" in
1737 cygwin)
1738 AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
1739 [AC_MSG_ERROR([`--with-w32' was specified, but windows.h
1740 cannot be found.])])
1741 ;;
1742 mingw32)
1743 ## Using --with-w32 with MinGW is a no-op, but we allow it.
1744 ;;
1745 *)
1746 AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin and MinGW32.])
1747 ;;
1748 esac
1749 fi
1750
1751 if test "${opsys}" = "mingw32"; then
1752 AC_MSG_CHECKING([whether Windows API headers are recent enough])
1753 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1754 #include <windows.h>
1755 #include <usp10.h>]],
1756 [[PIMAGE_NT_HEADERS pHeader;
1757 PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader)]])],
1758 [emacs_cv_w32api=yes
1759 HAVE_W32=yes],
1760 emacs_cv_w32api=no)
1761 AC_MSG_RESULT($emacs_cv_w32api)
1762 if test "${emacs_cv_w32api}" = "no"; then
1763 AC_MSG_ERROR([the Windows API headers are too old to support this build.])
1764 fi
1765 fi
1766
1767 FIRSTFILE_OBJ=
1768 NTDIR=
1769 LIBS_ECLIENT=
1770 LIB_WSOCK32=
1771 NTLIB=
1772 CM_OBJ="cm.o"
1773 XARGS_LIMIT=
1774 if test "${HAVE_W32}" = "yes"; then
1775 AC_DEFINE(HAVE_NTGUI, 1, [Define to use native MS Windows GUI.])
1776 AC_CHECK_TOOL(WINDRES, [windres],
1777 [AC_MSG_ERROR([No resource compiler found.])])
1778 W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
1779 W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o"
1780 EMACSRES="emacs.res"
1781 case "$canonical" in
1782 x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;;
1783 *) EMACS_MANIFEST="emacs-x86.manifest" ;;
1784 esac
1785 UPDATE_MANIFEST=update-game-score.exe.manifest
1786 if test "${opsys}" = "cygwin"; then
1787 W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32"
1788 W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool"
1789 # Tell the linker that emacs.res is an object (which we compile from
1790 # the rc file), not a linker script.
1791 W32_RES_LINK="-Wl,emacs.res"
1792 else
1793 W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
1794 W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32"
1795 W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10"
1796 W32_RES_LINK="\$(EMACSRES)"
1797 CLIENTRES="emacsclient.res"
1798 CLIENTW="emacsclientw\$(EXEEXT)"
1799 FIRSTFILE_OBJ=firstfile.o
1800 NTDIR=nt
1801 CM_OBJ=
1802 LIBS_ECLIENT="-lcomctl32"
1803 LIB_WSOCK32="-lwsock32"
1804 NTLIB="ntlib.$ac_objext"
1805 XARGS_LIMIT="-s 10000"
1806 fi
1807 fi
1808 AC_SUBST(W32_OBJ)
1809 AC_SUBST(W32_LIBS)
1810 AC_SUBST(EMACSRES)
1811 AC_SUBST(EMACS_MANIFEST)
1812 AC_SUBST(UPDATE_MANIFEST)
1813 AC_SUBST(CLIENTRES)
1814 AC_SUBST(CLIENTW)
1815 AC_SUBST(W32_RES_LINK)
1816 AC_SUBST(FIRSTFILE_OBJ)
1817 AC_SUBST(NTDIR)
1818 AC_SUBST(CM_OBJ)
1819 AC_SUBST(LIBS_ECLIENT)
1820 AC_SUBST(LIB_WSOCK32)
1821 AC_SUBST(NTLIB)
1822 AC_SUBST(XARGS_LIMIT)
1823
1824 if test "${HAVE_W32}" = "yes"; then
1825 window_system=w32
1826 with_xft=no
1827 fi
1828
1829 ## $window_system is now set to the window system we will
1830 ## ultimately use.
1831
1832 if test "$window_system" = none && test "$gl_gcc_warnings" = yes; then
1833 # Too many warnings for now.
1834 nw=
1835 nw="$nw -Wsuggest-attribute=const"
1836 nw="$nw -Wsuggest-attribute=noreturn"
1837 gl_MANYWARN_COMPLEMENT([WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
1838
1839 gl_WARN_ADD([-Wno-unused-variable])
1840 gl_WARN_ADD([-Wno-unused-but-set-variable])
1841 gl_WARN_ADD([-Wno-unused-but-set-parameter])
1842 fi
1843
1844 term_header=
1845 HAVE_X_WINDOWS=no
1846 HAVE_X11=no
1847 USE_X_TOOLKIT=none
1848
1849 case "${window_system}" in
1850 x11 )
1851 HAVE_X_WINDOWS=yes
1852 HAVE_X11=yes
1853 term_header=xterm.h
1854 case "${with_x_toolkit}" in
1855 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
1856 motif ) USE_X_TOOLKIT=MOTIF ;;
1857 gtk ) with_gtk=yes
1858 term_header=gtkutil.h
1859 dnl Don't set this for GTK. A lot of tests below assumes Xt when
1860 dnl USE_X_TOOLKIT is set.
1861 USE_X_TOOLKIT=none ;;
1862 gtk2 ) with_gtk2=yes
1863 term_header=gtkutil.h
1864 USE_X_TOOLKIT=none ;;
1865 gtk3 ) with_gtk3=yes
1866 term_header=gtkutil.h
1867 USE_X_TOOLKIT=none ;;
1868 no ) USE_X_TOOLKIT=none ;;
1869 dnl If user did not say whether to use a toolkit, make this decision later:
1870 dnl use the toolkit if we have gtk, or X11R5 or newer.
1871 * ) USE_X_TOOLKIT=maybe ;;
1872 esac
1873 ;;
1874 nextstep )
1875 term_header=nsterm.h
1876 ;;
1877 w32 )
1878 term_header=w32term.h
1879 ;;
1880 esac
1881
1882 if test "$window_system" = none && test "X$with_x" != "Xno"; then
1883 AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
1884 if test "$HAVE_XSERVER" = true ||
1885 test -n "$DISPLAY" ||
1886 test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then
1887 AC_MSG_ERROR([You seem to be running X, but no X development libraries
1888 were found. You should install the relevant development files for X
1889 and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make
1890 sure you have development files for image handling, i.e.
1891 tiff, gif, jpeg, png and xpm.
1892 If you are sure you want Emacs compiled without X window support, pass
1893 --without-x
1894 to configure.])
1895 fi
1896 fi
1897
1898 ### We always support menus.
1899 HAVE_MENUS=yes
1900
1901 # Does the opsystem file prohibit the use of the GNU malloc?
1902 # Assume not, until told otherwise.
1903 GNU_MALLOC=yes
1904
1905 AC_CACHE_CHECK(
1906 [whether malloc is Doug Lea style],
1907 [emacs_cv_var_doug_lea_malloc],
1908 [AC_LINK_IFELSE(
1909 [AC_LANG_PROGRAM(
1910 [[#include <malloc.h>
1911 static void hook (void) {}]],
1912 [[malloc_set_state (malloc_get_state ());
1913 __after_morecore_hook = hook;
1914 __malloc_initialize_hook = hook;]])],
1915 [emacs_cv_var_doug_lea_malloc=yes],
1916 [emacs_cv_var_doug_lea_malloc=no])])
1917 doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
1918
1919
1920 dnl See comments in aix4-2.h about maybe using system malloc there.
1921 system_malloc=no
1922 case "$opsys" in
1923 ## darwin ld insists on the use of malloc routines in the System framework.
1924 darwin|sol2-10) system_malloc=yes ;;
1925 esac
1926
1927 if test "${system_malloc}" = "yes"; then
1928 AC_DEFINE(SYSTEM_MALLOC, 1, [Define to use system malloc.])
1929 GNU_MALLOC=no
1930 GNU_MALLOC_reason="
1931 (The GNU allocators don't work with this system configuration.)"
1932 GMALLOC_OBJ=
1933 VMLIMIT_OBJ=
1934 else
1935 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
1936 VMLIMIT_OBJ=vm-limit.o
1937
1938 AC_CHECK_HEADERS([sys/vlimit.h])
1939 AC_CACHE_CHECK([for data_start], [emacs_cv_data_start],
1940 [AC_LINK_IFELSE(
1941 [AC_LANG_PROGRAM(
1942 [[extern char data_start[]; char ch;]],
1943 [[return data_start < &ch;]])],
1944 [emacs_cv_data_start=yes],
1945 [emacs_cv_data_start=no])])
1946 if test $emacs_cv_data_start = yes; then
1947 AC_DEFINE([HAVE_DATA_START], 1,
1948 [Define to 1 if data_start is the address of the start
1949 of the main data segment.])
1950 fi
1951 fi
1952 AC_SUBST(GMALLOC_OBJ)
1953 AC_SUBST(VMLIMIT_OBJ)
1954
1955 if test "$doug_lea_malloc" = "yes" ; then
1956 if test "$GNU_MALLOC" = yes ; then
1957 GNU_MALLOC_reason="
1958 (Using Doug Lea's new malloc from the GNU C Library.)"
1959 fi
1960 AC_DEFINE(DOUG_LEA_MALLOC, 1,
1961 [Define to 1 if you are using the GNU C Library.])
1962
1963 ## Use mmap directly for allocating larger buffers.
1964 ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
1965 ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
1966 ## Does the AC_FUNC_MMAP test below make this check unnecessary?
1967 case "$opsys" in
1968 gnu*) REL_ALLOC=no ;;
1969 esac
1970 fi
1971
1972 if test x"${REL_ALLOC}" = x; then
1973 REL_ALLOC=${GNU_MALLOC}
1974 fi
1975
1976 use_mmap_for_buffers=no
1977 case "$opsys" in
1978 cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
1979 esac
1980
1981 AC_FUNC_MMAP
1982 if test $use_mmap_for_buffers = yes; then
1983 AC_DEFINE(USE_MMAP_FOR_BUFFERS, 1, [Define to use mmap to allocate buffer text.])
1984 REL_ALLOC=no
1985 fi
1986
1987 LIBS="$LIBS_SYSTEM $LIBS"
1988
1989 dnl If found, this adds -ldnet to LIBS, which Autoconf uses for checks.
1990 AC_CHECK_LIB(dnet, dnet_ntoa)
1991 dnl This causes -lresolv to get used in subsequent tests,
1992 dnl which causes failures on some systems such as HPUX 9.
1993 dnl AC_CHECK_LIB(resolv, gethostbyname)
1994
1995 dnl FIXME replace main with a function we actually want from this library.
1996 AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
1997
1998 dnl Check if pthreads is available.
1999 LIB_PTHREAD=
2000 AC_CHECK_HEADERS_ONCE(pthread.h)
2001 if test "$ac_cv_header_pthread_h"; then
2002 dnl gmalloc.c uses pthread_atfork, which is not available on older-style
2003 dnl hosts such as MirBSD 10, so test for pthread_atfork instead of merely
2004 dnl testing for pthread_self if Emacs uses gmalloc.c.
2005 if test "$GMALLOC_OBJ" = gmalloc.o; then
2006 emacs_pthread_function=pthread_atfork
2007 else
2008 emacs_pthread_function=pthread_self
2009 fi
2010 AC_CHECK_LIB(pthread, $emacs_pthread_function, HAVE_PTHREAD=yes)
2011 fi
2012 if test "$HAVE_PTHREAD" = yes; then
2013 case "${canonical}" in
2014 *-hpux*) ;;
2015 *) LIB_PTHREAD="-lpthread"
2016 LIBS="$LIB_PTHREAD $LIBS" ;;
2017 esac
2018 AC_DEFINE(HAVE_PTHREAD, 1, [Define to 1 if you have pthread (-lpthread).])
2019 fi
2020 AC_SUBST([LIB_PTHREAD])
2021
2022 AC_CHECK_LIB(pthreads, cma_open)
2023
2024 ## Note: when using cpp in s/aix4.2.h, this definition depended on
2025 ## HAVE_LIBPTHREADS. That was not defined earlier in configure when
2026 ## the system file was sourced. Hence the value of LIBS_SYSTEM
2027 ## added to LIBS in configure would never contain the pthreads part,
2028 ## but the value used in Makefiles might. FIXME?
2029 ##
2030 ## -lpthreads seems to be necessary for Xlib in X11R6, and should
2031 ## be harmless on older versions of X where it happens to exist.
2032 test "$opsys" = "aix4-2" && \
2033 test $ac_cv_lib_pthreads_cma_open = yes && \
2034 LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads"
2035
2036 dnl Check for need for bigtoc support on IBM AIX
2037
2038 case ${host_os} in
2039 aix*)
2040 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
2041 case $GCC in
2042 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
2043 *) gdb_cv_bigtoc=-bbigtoc ;;
2044 esac
2045
2046 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
2047 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], [], [gdb_cv_bigtoc=])
2048 ])
2049 ;;
2050 esac
2051
2052 # Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets
2053 # used for the tests that follow. We set them back to REAL_CFLAGS and
2054 # REAL_CPPFLAGS later on.
2055
2056 REAL_CFLAGS="$CFLAGS"
2057 REAL_CPPFLAGS="$CPPFLAGS"
2058
2059 if test "${HAVE_X11}" = "yes"; then
2060 DEFS="$C_SWITCH_X_SITE $DEFS"
2061 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
2062 LIBS="-lX11 $LIBS"
2063 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
2064 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
2065
2066 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
2067 # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
2068 # but it's more convenient here to set LD_RUN_PATH since this
2069 # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
2070 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
2071 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
2072 export LD_RUN_PATH
2073 fi
2074
2075 if test "${opsys}" = "gnu-linux"; then
2076 AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
2077 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
2078 [[XOpenDisplay ("foo");]])],
2079 [xgnu_linux_first_failure=no],
2080 [xgnu_linux_first_failure=yes])
2081 if test "${xgnu_linux_first_failure}" = "yes"; then
2082 OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
2083 OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
2084 OLD_CPPFLAGS="$CPPFLAGS"
2085 OLD_LIBS="$LIBS"
2086 LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
2087 C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
2088 CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
2089 LIBS="$LIBS -b i486-linuxaout"
2090 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
2091 [[XOpenDisplay ("foo");]])],
2092 [xgnu_linux_second_failure=no],
2093 [xgnu_linux_second_failure=yes])
2094 if test "${xgnu_linux_second_failure}" = "yes"; then
2095 # If we get the same failure with -b, there is no use adding -b.
2096 # So take it out. This plays safe.
2097 LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
2098 C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
2099 CPPFLAGS="$OLD_CPPFLAGS"
2100 LIBS="$OLD_LIBS"
2101 AC_MSG_RESULT(no)
2102 else
2103 AC_MSG_RESULT(yes)
2104 fi
2105 else
2106 AC_MSG_RESULT(no)
2107 fi
2108 fi
2109
2110 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
2111 # header files included from there.
2112 AC_MSG_CHECKING(for Xkb)
2113 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
2114 #include <X11/XKBlib.h>]],
2115 [[XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);]])],
2116 emacs_xkb=yes, emacs_xkb=no)
2117 AC_MSG_RESULT($emacs_xkb)
2118 if test $emacs_xkb = yes; then
2119 AC_DEFINE(HAVE_XKB, 1, [Define to 1 if you have the Xkb extension.])
2120 fi
2121
2122 AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
2123 XScreenNumberOfScreen)
2124 fi
2125
2126 if test "${window_system}" = "x11"; then
2127 AC_MSG_CHECKING(X11 version 6)
2128 AC_CACHE_VAL(emacs_cv_x11_version_6,
2129 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
2130 [[#if XlibSpecificationRelease < 6
2131 fail;
2132 #endif
2133 ]])], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
2134 if test $emacs_cv_x11_version_6 = yes; then
2135 AC_MSG_RESULT(6 or newer)
2136 AC_DEFINE(HAVE_X11R6, 1,
2137 [Define to 1 if you have the X11R6 or newer version of Xlib.])
2138 AC_DEFINE(HAVE_X_I18N, 1, [Define if you have usable i18n support.])
2139 ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
2140 ## XIM support.
2141 case "$opsys" in
2142 sol2-*) : ;;
2143 *) AC_DEFINE(HAVE_X11R6_XIM, 1,
2144 [Define if you have usable X11R6-style XIM support.])
2145 ;;
2146 esac
2147 else
2148 AC_MSG_RESULT(before 6)
2149 fi
2150 fi
2151
2152
2153 ### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
2154 HAVE_RSVG=no
2155 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${opsys}" = "mingw32"; then
2156 if test "${with_rsvg}" != "no"; then
2157 RSVG_REQUIRED=2.11.0
2158 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
2159
2160 PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, HAVE_RSVG=yes, :)
2161 AC_SUBST(RSVG_CFLAGS)
2162 AC_SUBST(RSVG_LIBS)
2163
2164 if test $HAVE_RSVG = yes; then
2165 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
2166 CFLAGS="$CFLAGS $RSVG_CFLAGS"
2167 LIBS="$RSVG_LIBS $LIBS"
2168 fi
2169 fi
2170 fi
2171
2172 HAVE_IMAGEMAGICK=no
2173 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
2174 if test "${with_imagemagick}" != "no"; then
2175 ## 6.2.8 is the earliest version known to work, but earlier versions
2176 ## might work - let us know if you find one.
2177 ## 6.0.7 does not work. See bug#7955.
2178 ## 6.8.2 makes Emacs crash; see Bug#13867.
2179 IMAGEMAGICK_MODULE="Wand >= 6.2.8 Wand != 6.8.2"
2180 PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, :)
2181 AC_SUBST(IMAGEMAGICK_CFLAGS)
2182 AC_SUBST(IMAGEMAGICK_LIBS)
2183
2184 if test $HAVE_IMAGEMAGICK = yes; then
2185 AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.])
2186 CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
2187 LIBS="$IMAGEMAGICK_LIBS $LIBS"
2188 AC_CHECK_FUNCS(MagickExportImagePixels MagickMergeImageLayers)
2189 fi
2190 fi
2191 fi
2192
2193
2194 HAVE_GTK=no
2195 GTK_OBJ=
2196 gtk_term_header=$term_header
2197 check_gtk2=no
2198 gtk3_pkg_errors=
2199 if test "${opsys}" != "mingw32"; then
2200 if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
2201 GLIB_REQUIRED=2.28
2202 GTK_REQUIRED=3.0
2203 GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
2204
2205 dnl Checks for libraries.
2206 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
2207 if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
2208 AC_MSG_ERROR($GTK_PKG_ERRORS)
2209 fi
2210 if test "$pkg_check_gtk" = "yes"; then
2211 AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
2212 GTK_OBJ=emacsgtkfixed.o
2213 gtk_term_header=gtkutil.h
2214 USE_GTK_TOOLKIT="GTK3"
2215 if test "x$ac_enable_gtk_deprecation_warnings" = x; then
2216 GTK_CFLAGS="$GTK_CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS"
2217 GTK_CFLAGS="$GTK_CFLAGS -DGLIB_DISABLE_DEPRECATION_WARNINGS"
2218 fi
2219 else
2220 check_gtk2=yes
2221 gtk3_pkg_errors="$GTK_PKG_ERRORS "
2222 fi
2223 fi
2224
2225 if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
2226 GLIB_REQUIRED=2.10
2227 GTK_REQUIRED=2.10
2228 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
2229
2230 dnl Checks for libraries.
2231 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
2232 if test "$pkg_check_gtk" = "no" &&
2233 { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
2234 then
2235 AC_MSG_ERROR($gtk3_pkg_errors$GTK_PKG_ERRORS)
2236 fi
2237 test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
2238 fi
2239 fi
2240
2241 if test x"$pkg_check_gtk" = xyes; then
2242
2243 AC_SUBST(GTK_CFLAGS)
2244 AC_SUBST(GTK_LIBS)
2245 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
2246 CFLAGS="$CFLAGS $GTK_CFLAGS"
2247 LIBS="$GTK_LIBS $LIBS"
2248 dnl Try to compile a simple GTK program.
2249 AC_MSG_CHECKING([whether GTK compiles])
2250 GTK_COMPILES=no
2251 AC_LINK_IFELSE(
2252 [AC_LANG_PROGRAM(
2253 [[/* Check the Gtk and Glib APIs. */
2254 #include <gtk/gtk.h>
2255 #include <glib-object.h>
2256 static void
2257 callback (GObject *go, GParamSpec *spec, gpointer user_data)
2258 {}
2259 ]],
2260 [[
2261 GtkSettings *gs = 0;
2262 /* Use G_CALLBACK to make sure function pointers can be cast to void *;
2263 strict C prohibits this. Use gtk_main_iteration to test that the
2264 libraries are there. */
2265 if (g_signal_handler_find (G_OBJECT (gs), G_SIGNAL_MATCH_FUNC,
2266 0, 0, 0, G_CALLBACK (callback), 0))
2267 gtk_main_iteration ();
2268 ]])],
2269 [GTK_COMPILES=yes])
2270 AC_MSG_RESULT([$GTK_COMPILES])
2271 if test "${GTK_COMPILES}" != "yes"; then
2272 GTK_OBJ=
2273 if test "$USE_X_TOOLKIT" != "maybe"; then
2274 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
2275 fi
2276 else
2277 HAVE_GTK=yes
2278 AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
2279 GTK_OBJ="gtkutil.o $GTK_OBJ"
2280 term_header=$gtk_term_header
2281 USE_X_TOOLKIT=none
2282 if "$PKG_CONFIG" --atleast-version=2.10 gtk+-2.0; then
2283 :
2284 else
2285 AC_MSG_WARN([[Your version of Gtk+ will have problems with
2286 closing open displays. This is no problem if you just use
2287 one display, but if you use more than one and close one of them
2288 Emacs may crash.]])
2289 sleep 3
2290 fi
2291 fi
2292
2293 fi
2294 AC_SUBST(GTK_OBJ)
2295
2296
2297 if test "${HAVE_GTK}" = "yes"; then
2298
2299 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
2300 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
2301 if test "$with_toolkit_scroll_bars" != no; then
2302 with_toolkit_scroll_bars=yes
2303 fi
2304
2305 dnl Check if we have the old file selection dialog declared and
2306 dnl in the link library. In 2.x it may be in the library,
2307 dnl but not declared if deprecated featured has been selected out.
2308 dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
2309 HAVE_GTK_FILE_SELECTION=no
2310 AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
2311 HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
2312 #include <gtk/gtk.h>])
2313 if test "$HAVE_GTK_FILE_SELECTION" = yes; then
2314 AC_CHECK_FUNCS(gtk_file_selection_new)
2315 fi
2316
2317 dnl Same as above for gtk_handle_box.
2318 HAVE_GTK_HANDLE_BOX=no
2319 AC_CHECK_DECL(GTK_TYPE_HANDLE_BOX, HAVE_GTK_HANDLE_BOX=yes,
2320 HAVE_GTK_HANDLE_BOX=no, [AC_INCLUDES_DEFAULT
2321 #include <gtk/gtk.h>])
2322 if test "$HAVE_GTK_HANDLE_BOX" = yes; then
2323 AC_CHECK_FUNCS(gtk_handle_box_new)
2324 fi
2325
2326 dnl Same as above for gtk_tearoff_menu_item.
2327 HAVE_GTK_TEAROFF_MENU_ITEM=no
2328 AC_CHECK_DECL(GTK_TYPE_TEAROFF_MENU_ITEM, HAVE_GTK_TEAROFF_MENU_ITEM=yes,
2329 HAVE_GTK_TEAROFF_MENU_ITEM=no, [AC_INCLUDES_DEFAULT
2330 #include <gtk/gtk.h>])
2331 if test "$HAVE_GTK_TEAROFF_MENU_ITEM" = yes; then
2332 AC_CHECK_FUNCS(gtk_tearoff_menu_item_new)
2333 fi
2334
2335 dnl Check for functions introduced in 2.14 and later.
2336 AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
2337 gtk_dialog_get_action_area gtk_widget_get_sensitive \
2338 gtk_widget_get_mapped gtk_adjustment_get_page_size \
2339 gtk_orientable_set_orientation \
2340 gtk_window_set_has_resize_grip)
2341
2342 term_header=gtkutil.h
2343 fi
2344
2345 dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
2346 dnl other platforms.
2347 HAVE_DBUS=no
2348 DBUS_OBJ=
2349 if test "${with_dbus}" = "yes"; then
2350 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
2351 if test "$HAVE_DBUS" = yes; then
2352 LIBS="$LIBS $DBUS_LIBS"
2353 AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
2354 dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1.
2355 dnl dbus_type_is_valid and dbus_validate_* have been introduced in
2356 dnl D-Bus 1.5.12.
2357 AC_CHECK_FUNCS(dbus_watch_get_unix_fd \
2358 dbus_type_is_valid \
2359 dbus_validate_bus_name \
2360 dbus_validate_path \
2361 dbus_validate_interface \
2362 dbus_validate_member)
2363 DBUS_OBJ=dbusbind.o
2364 fi
2365 fi
2366 AC_SUBST(DBUS_OBJ)
2367
2368 dnl GSettings has been tested under GNU/Linux only.
2369 HAVE_GSETTINGS=no
2370 if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then
2371 PKG_CHECK_MODULES(GSETTINGS, gio-2.0 >= 2.26, HAVE_GSETTINGS=yes, HAVE_GSETTINGS=no)
2372 if test "$HAVE_GSETTINGS" = "yes"; then
2373 AC_DEFINE(HAVE_GSETTINGS, 1, [Define to 1 if using GSettings.])
2374 SETTINGS_CFLAGS="$GSETTINGS_CFLAGS"
2375 SETTINGS_LIBS="$GSETTINGS_LIBS"
2376 fi
2377 fi
2378
2379 dnl GConf has been tested under GNU/Linux only.
2380 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
2381 HAVE_GCONF=no
2382 if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
2383 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no)
2384 if test "$HAVE_GCONF" = yes; then
2385 AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
2386 dnl Newer GConf doesn't link with g_objects, so this is not defined.
2387 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
2388 SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
2389 fi
2390 fi
2391
2392 if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
2393 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.0, HAVE_GOBJECT=yes, HAVE_GOBJECT=no)
2394 if test "$HAVE_GOBJECT" = "yes"; then
2395 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS"
2396 SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS"
2397 fi
2398 SAVE_CFLAGS="$CFLAGS"
2399 SAVE_LIBS="$LIBS"
2400 CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
2401 LIBS="$SETTINGS_LIBS $LIBS"
2402 CFLAGS="$SAVE_CFLAGS"
2403 LIBS="$SAVE_LIBS"
2404 fi
2405 AC_SUBST(SETTINGS_CFLAGS)
2406 AC_SUBST(SETTINGS_LIBS)
2407
2408
2409 dnl SELinux is available for GNU/Linux only.
2410 HAVE_LIBSELINUX=no
2411 LIBSELINUX_LIBS=
2412 if test "${with_selinux}" = "yes"; then
2413 AC_CHECK_LIB([selinux], [lgetfilecon], HAVE_LIBSELINUX=yes, HAVE_LIBSELINUX=no)
2414 if test "$HAVE_LIBSELINUX" = yes; then
2415 AC_DEFINE(HAVE_LIBSELINUX, 1, [Define to 1 if using SELinux.])
2416 LIBSELINUX_LIBS=-lselinux
2417 fi
2418 fi
2419 AC_SUBST(LIBSELINUX_LIBS)
2420
2421 HAVE_GNUTLS=no
2422 HAVE_GNUTLS3=no
2423 if test "${with_gnutls}" = "yes" ; then
2424 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.0.0], HAVE_GNUTLS3=yes, HAVE_GNUTLS3=no)
2425 if test "${HAVE_GNUTLS3}" = "yes"; then
2426 AC_DEFINE(HAVE_GNUTLS3, 1, [Define if using GnuTLS v3.])
2427 HAVE_GNUTLS="yes"
2428 else
2429 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no)
2430 fi
2431 if test "${HAVE_GNUTLS}" = "yes"; then
2432 AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
2433 fi
2434
2435 # Windows loads GnuTLS dynamically
2436 if test "${opsys}" = "mingw32"; then
2437 LIBGNUTLS_LIBS=
2438 else
2439 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
2440 LIBS="$LIBGNUTLS_LIBS $LIBS"
2441 fi
2442 fi
2443
2444 AC_SUBST(LIBGNUTLS_LIBS)
2445 AC_SUBST(LIBGNUTLS_CFLAGS)
2446
2447 NOTIFY_OBJ=
2448 NOTIFY_SUMMARY=no
2449
2450 dnl FIXME? Don't auto-detect on NS, but do allow someone to specify
2451 dnl a particular library. This doesn't make much sense?
2452 if test "${with_ns}" = yes && test ${with_file_notification} = yes; then
2453 with_file_notification=no
2454 fi
2455
2456 dnl MS Windows native file monitor is available for mingw32 only.
2457 case $with_file_notification,$opsys in
2458 w32,* | yes,mingw32)
2459 AC_CHECK_HEADER(windows.h)
2460 if test "$ac_cv_header_windows_h" = yes ; then
2461 AC_DEFINE(HAVE_W32NOTIFY, 1, [Define to 1 to use w32notify.])
2462 NOTIFY_OBJ=w32notify.o
2463 NOTIFY_SUMMARY="yes (w32)"
2464 fi ;;
2465 esac
2466
2467 dnl g_file_monitor exists since glib 2.18. G_FILE_MONITOR_EVENT_MOVED
2468 dnl has been added in glib 2.24. It has been tested under
2469 dnl GNU/Linux only. We take precedence over inotify, but this makes
2470 dnl only sense when glib has been compiled with inotify support. How
2471 dnl to check?
2472 case $with_file_notification,$NOTIFY_OBJ in
2473 gfile, | yes,)
2474 PKG_CHECK_MODULES(GFILENOTIFY, gio-2.0 >= 2.24, HAVE_GFILENOTIFY=yes, HAVE_GFILENOTIFY=no)
2475 if test "$HAVE_GFILENOTIFY" = "yes"; then
2476 AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.])
2477 NOTIFY_OBJ=gfilenotify.o
2478 NOTIFY_SUMMARY="yes -lgio (gfile)"
2479 fi ;;
2480 esac
2481
2482 dnl inotify is only available on GNU/Linux.
2483 case $with_file_notification,$NOTIFY_OBJ in
2484 inotify, | yes,)
2485 AC_CHECK_HEADER(sys/inotify.h)
2486 if test "$ac_cv_header_sys_inotify_h" = yes ; then
2487 AC_CHECK_FUNC(inotify_init1)
2488 if test "$ac_cv_func_inotify_init1" = yes; then
2489 AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.])
2490 NOTIFY_OBJ=inotify.o
2491 NOTIFY_SUMMARY="yes -lglibc (inotify)"
2492 fi
2493 fi ;;
2494 esac
2495
2496 case $with_file_notification,$NOTIFY_OBJ in
2497 yes,* | no,* | *,?*) ;;
2498 *) AC_MSG_ERROR([File notification `$with_file_notification' requested but requirements not found.]) ;;
2499 esac
2500
2501 if test -n "$NOTIFY_OBJ"; then
2502 AC_DEFINE(USE_FILE_NOTIFY, 1, [Define to 1 if using file notifications.])
2503 fi
2504 AC_SUBST(NOTIFY_OBJ)
2505 AC_SUBST(GFILENOTIFY_CFLAGS)
2506 AC_SUBST(GFILENOTIFY_LIBS)
2507
2508 dnl Do not put whitespace before the #include statements below.
2509 dnl Older compilers (eg sunos4 cc) choke on it.
2510 HAVE_XAW3D=no
2511 LUCID_LIBW=
2512 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
2513 if test "$with_xaw3d" != no; then
2514 AC_CACHE_VAL(emacs_cv_xaw3d,
2515 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2516 #include <X11/Intrinsic.h>
2517 #include <X11/Xaw3d/Simple.h>]],
2518 [[]])],
2519 [AC_CHECK_LIB(Xaw3d, XawScrollbarSetThumb,
2520 emacs_cv_xaw3d=yes, emacs_cv_xaw3d=no)],
2521 emacs_cv_xaw3d=no)])
2522 else
2523 emacs_cv_xaw3d=no
2524 fi
2525 if test $emacs_cv_xaw3d = yes; then
2526 AC_MSG_CHECKING(for xaw3d)
2527 AC_MSG_RESULT([yes; using Lucid toolkit])
2528 USE_X_TOOLKIT=LUCID
2529 HAVE_XAW3D=yes
2530 LUCID_LIBW=-lXaw3d
2531 AC_DEFINE(HAVE_XAW3D, 1,
2532 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
2533 else
2534 AC_MSG_CHECKING(for xaw3d)
2535 AC_MSG_RESULT(no)
2536 AC_MSG_CHECKING(for libXaw)
2537 AC_CACHE_VAL(emacs_cv_xaw,
2538 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2539 #include <X11/Intrinsic.h>
2540 #include <X11/Xaw/Simple.h>]],
2541 [[]])],
2542 emacs_cv_xaw=yes,
2543 emacs_cv_xaw=no)])
2544 if test $emacs_cv_xaw = yes; then
2545 AC_MSG_RESULT([yes; using Lucid toolkit])
2546 USE_X_TOOLKIT=LUCID
2547 LUCID_LIBW=-lXaw
2548 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
2549 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
2550 else
2551 AC_MSG_ERROR([No X toolkit could be found.
2552 If you are sure you want Emacs compiled without an X toolkit, pass
2553 --with-x-toolkit=no
2554 to configure. Otherwise, install the development libraries for the toolkit
2555 that you want to use (e.g. Gtk+) and re-run configure.])
2556 fi
2557 fi
2558 fi
2559
2560 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
2561
2562 LIBXTR6=
2563 if test "${USE_X_TOOLKIT}" != "none"; then
2564 AC_MSG_CHECKING(X11 toolkit version)
2565 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
2566 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Intrinsic.h>]],
2567 [[#if XtSpecificationRelease < 6
2568 fail;
2569 #endif
2570 ]])], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
2571 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
2572 if test $emacs_cv_x11_toolkit_version_6 = yes; then
2573 AC_MSG_RESULT(6 or newer)
2574 AC_DEFINE(HAVE_X11XTR6, 1,
2575 [Define to 1 if you have the X11R6 or newer version of Xt.])
2576 LIBXTR6="-lSM -lICE"
2577 case "$opsys" in
2578 ## Use libw.a along with X11R6 Xt.
2579 unixware) LIBXTR6="$LIBXTR6 -lw" ;;
2580 esac
2581 else
2582 AC_MSG_RESULT(before 6)
2583 fi
2584
2585 dnl If using toolkit, check whether libXmu.a exists.
2586 dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
2587 OLDLIBS="$LIBS"
2588 if test x$HAVE_X11XTR6 = xyes; then
2589 LIBS="-lXt -lSM -lICE $LIBS"
2590 else
2591 LIBS="-lXt $LIBS"
2592 fi
2593 AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
2594 test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
2595 dnl ac_cv_lib_Xmu_XmuConvertStandardSelection is also referenced below.
2596 fi
2597 AC_SUBST(LIBXTR6)
2598
2599 dnl FIXME the logic here seems weird, but this is what cpp was doing.
2600 dnl Why not just test for libxmu in the normal way?
2601 LIBXMU=-lXmu
2602 case $opsys in
2603 ## These systems don't supply Xmu.
2604 hpux* | aix4-2 )
2605 test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU=
2606 ;;
2607 mingw32 )
2608 LIBXMU=
2609 ;;
2610 esac
2611 AC_SUBST(LIBXMU)
2612
2613 # On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
2614 if test "${HAVE_X11}" = "yes"; then
2615 if test "${USE_X_TOOLKIT}" != "none"; then
2616 AC_CHECK_LIB(Xext, XShapeQueryExtension)
2617 fi
2618 fi
2619
2620 LIBXP=
2621 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
2622 # OpenMotif may be installed in such a way on some GNU/Linux systems.
2623 if test -d /usr/include/openmotif; then
2624 CPPFLAGS="-I/usr/include/openmotif $CPPFLAGS"
2625 emacs_cv_openmotif=yes
2626 case "$canonical" in
2627 x86_64-*-linux-gnu* | powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*)
2628 test -d /usr/lib64/openmotif && LDFLAGS="-L/usr/lib64/openmotif $LDFLAGS"
2629 ;;
2630 *)
2631 test -d /usr/lib/openmotif && LDFLAGS="-L/usr/lib/openmotif $LDFLAGS"
2632 esac
2633 else
2634 emacs_cv_openmotif=no
2635 fi
2636 AC_CACHE_CHECK(for (Open)Motif version 2.1, emacs_cv_motif_version_2_1,
2637 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Xm/Xm.h>]],
2638 [[#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
2639 int x = 5;
2640 #else
2641 Motif version prior to 2.1.
2642 #endif]])],
2643 emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
2644 if test $emacs_cv_motif_version_2_1 = yes; then
2645 AC_CHECK_LIB(Xp, XpCreateContext, LIBXP=-lXp)
2646 if test x$emacs_cv_openmotif = xyes; then
2647 REAL_CPPFLAGS="-I/usr/include/openmotif $REAL_CPPFLAGS"
2648 fi
2649 else
2650 AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
2651 # We put this in CFLAGS temporarily to precede other -I options
2652 # that might be in CFLAGS temporarily.
2653 # We put this in CPPFLAGS where it precedes the other -I options.
2654 OLD_CPPFLAGS=$CPPFLAGS
2655 OLD_CFLAGS=$CFLAGS
2656 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
2657 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
2658 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>]],
2659 [[int x = 5;]])],
2660 emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
2661 if test $emacs_cv_lesstif = yes; then
2662 # Make sure this -I option remains in CPPFLAGS after it is set
2663 # back to REAL_CPPFLAGS.
2664 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
2665 # have those other -I options anyway. Ultimately, having this
2666 # directory ultimately in CPPFLAGS will be enough.
2667 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
2668 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
2669 else
2670 CFLAGS=$OLD_CFLAGS
2671 CPPFLAGS=$OLD_CPPFLAGS
2672 fi
2673 fi
2674 AC_CHECK_HEADER([Xm/BulletinB.h], [],
2675 [AC_MSG_ERROR([Motif toolkit requested but requirements not found.])])
2676 fi
2677
2678 dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
2679 dnl using Motif or Xaw3d is available, and unless
2680 dnl --with-toolkit-scroll-bars=no was specified.
2681
2682 AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
2683 [Define to 1 if we should use toolkit scroll bars.])dnl
2684 USE_TOOLKIT_SCROLL_BARS=no
2685 if test "${with_toolkit_scroll_bars}" != "no"; then
2686 if test "${USE_X_TOOLKIT}" != "none"; then
2687 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
2688 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2689 HAVE_XAW3D=no
2690 USE_TOOLKIT_SCROLL_BARS=yes
2691 elif test "${HAVE_XAW3D}" = "yes" || test "${USE_X_TOOLKIT}" = "LUCID"; then
2692 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2693 USE_TOOLKIT_SCROLL_BARS=yes
2694 fi
2695 elif test "${HAVE_GTK}" = "yes"; then
2696 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2697 USE_TOOLKIT_SCROLL_BARS=yes
2698 elif test "${HAVE_NS}" = "yes"; then
2699 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2700 USE_TOOLKIT_SCROLL_BARS=yes
2701 elif test "${HAVE_W32}" = "yes"; then
2702 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2703 USE_TOOLKIT_SCROLL_BARS=yes
2704 fi
2705 fi
2706
2707 dnl See if XIM is available.
2708 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2709 #include <X11/Xlib.h>
2710 #include <X11/Xresource.h>]],
2711 [[XIMProc callback;]])],
2712 [HAVE_XIM=yes
2713 AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
2714 HAVE_XIM=no)
2715
2716 dnl `--with-xim' now controls only the initial value of use_xim at run time.
2717
2718 if test "${with_xim}" != "no"; then
2719 AC_DEFINE(USE_XIM, 1,
2720 [Define to 1 if we should use XIM, if it is available.])
2721 fi
2722
2723
2724 if test "${HAVE_XIM}" != "no"; then
2725 late_CFLAGS=$CFLAGS
2726 if test "$GCC" = yes; then
2727 CFLAGS="$CFLAGS --pedantic-errors"
2728 fi
2729 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2730 #include <X11/Xlib.h>
2731 #include <X11/Xresource.h>]],
2732 [[Display *display;
2733 XrmDatabase db;
2734 char *res_name;
2735 char *res_class;
2736 XIMProc callback;
2737 XPointer *client_data;
2738 #ifndef __GNUC__
2739 /* If we're not using GCC, it's probably not XFree86, and this is
2740 probably right, but we can't use something like --pedantic-errors. */
2741 extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
2742 char*, XIMProc, XPointer*);
2743 #endif
2744 (void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
2745 client_data);]])],
2746 [emacs_cv_arg6_star=yes])
2747 AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
2748 [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
2749 either XPointer or XPointer*.])dnl
2750 if test "$emacs_cv_arg6_star" = yes; then
2751 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
2752 else
2753 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
2754 fi
2755 CFLAGS=$late_CFLAGS
2756 fi
2757
2758 ### Start of font-backend (under any platform) section.
2759 # (nothing here yet -- this is a placeholder)
2760 ### End of font-backend (under any platform) section.
2761
2762 ### Start of font-backend (under X11) section.
2763 if test "${HAVE_X11}" = "yes"; then
2764 PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, HAVE_FC=yes, HAVE_FC=no)
2765
2766 ## Use -lXft if available, unless `--with-xft=no'.
2767 HAVE_XFT=maybe
2768 if test "${HAVE_FC}" = "no" || test "x${with_x}" = "xno"; then
2769 with_xft="no";
2770 fi
2771 if test "x${with_xft}" != "xno"; then
2772
2773 PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
2774 ## Because xftfont.c uses XRenderQueryExtension, we also
2775 ## need to link to -lXrender.
2776 HAVE_XRENDER=no
2777 AC_CHECK_LIB(Xrender, XRenderQueryExtension, HAVE_XRENDER=yes)
2778 if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
2779 OLD_CPPFLAGS="$CPPFLAGS"
2780 OLD_CFLAGS="$CFLAGS"
2781 OLD_LIBS="$LIBS"
2782 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
2783 CFLAGS="$CFLAGS $XFT_CFLAGS"
2784 XFT_LIBS="-lXrender $XFT_LIBS"
2785 LIBS="$XFT_LIBS $LIBS"
2786 AC_CHECK_HEADER(X11/Xft/Xft.h,
2787 AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS) , ,
2788 [[#include <X11/X.h>]])
2789
2790 if test "${HAVE_XFT}" = "yes"; then
2791 AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
2792 AC_SUBST(XFT_LIBS)
2793 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
2794 else
2795 CPPFLAGS="$OLD_CPPFLAGS"
2796 CFLAGS="$OLD_CFLAGS"
2797 LIBS="$OLD_LIBS"
2798 fi # "${HAVE_XFT}" = "yes"
2799 fi # "$HAVE_XFT" != no
2800 fi # "x${with_xft}" != "xno"
2801
2802 ## We used to allow building with FreeType and without Xft.
2803 ## However, the ftx font backend driver is not in good shape.
2804 if test "$HAVE_XFT" != "yes"; then
2805 dnl For the "Does Emacs use" message at the end.
2806 HAVE_XFT=no
2807 HAVE_FREETYPE=no
2808 else
2809 dnl Strict linkers fail with
2810 dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
2811 dnl if -lfreetype is not specified.
2812 dnl The following is needed to set FREETYPE_LIBS.
2813 PKG_CHECK_MODULES(FREETYPE, freetype2, HAVE_FREETYPE=yes,
2814 HAVE_FREETYPE=no)
2815
2816 test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(libxft requires libfreetype)
2817 fi
2818
2819 HAVE_LIBOTF=no
2820 if test "${HAVE_FREETYPE}" = "yes"; then
2821 AC_DEFINE(HAVE_FREETYPE, 1,
2822 [Define to 1 if using the freetype and fontconfig libraries.])
2823 if test "${with_libotf}" != "no"; then
2824 PKG_CHECK_MODULES(LIBOTF, libotf, HAVE_LIBOTF=yes,
2825 HAVE_LIBOTF=no)
2826 if test "$HAVE_LIBOTF" = "yes"; then
2827 AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
2828 AC_CHECK_LIB(otf, OTF_get_variation_glyphs,
2829 HAVE_OTF_GET_VARIATION_GLYPHS=yes,
2830 HAVE_OTF_GET_VARIATION_GLYPHS=no)
2831 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
2832 AC_DEFINE(HAVE_OTF_GET_VARIATION_GLYPHS, 1,
2833 [Define to 1 if libotf has OTF_get_variation_glyphs.])
2834 fi
2835 fi
2836 fi
2837 dnl FIXME should there be an error if HAVE_FREETYPE != yes?
2838 dnl Does the new font backend require it, or can it work without it?
2839 fi
2840
2841 HAVE_M17N_FLT=no
2842 if test "${HAVE_LIBOTF}" = yes; then
2843 if test "${with_m17n_flt}" != "no"; then
2844 PKG_CHECK_MODULES(M17N_FLT, m17n-flt, HAVE_M17N_FLT=yes, HAVE_M17N_FLT=no)
2845 if test "$HAVE_M17N_FLT" = "yes"; then
2846 AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.])
2847 fi
2848 fi
2849 fi
2850 else
2851 HAVE_XFT=no
2852 HAVE_FREETYPE=no
2853 HAVE_LIBOTF=no
2854 HAVE_M17N_FLT=no
2855 fi
2856
2857 ### End of font-backend (under X11) section.
2858
2859 AC_SUBST(FREETYPE_CFLAGS)
2860 AC_SUBST(FREETYPE_LIBS)
2861 AC_SUBST(FONTCONFIG_CFLAGS)
2862 AC_SUBST(FONTCONFIG_LIBS)
2863 AC_SUBST(LIBOTF_CFLAGS)
2864 AC_SUBST(LIBOTF_LIBS)
2865 AC_SUBST(M17N_FLT_CFLAGS)
2866 AC_SUBST(M17N_FLT_LIBS)
2867
2868 ### Use -lXpm if available, unless `--with-xpm=no'.
2869 ### mingw32 doesn't use -lXpm, since it loads the library dynamically.
2870 HAVE_XPM=no
2871 LIBXPM=
2872 if test "${HAVE_W32}" = "yes" && test "${opsys}" = "cygwin"; then
2873 if test "${with_xpm}" != "no"; then
2874 SAVE_CPPFLAGS="$CPPFLAGS"
2875 SAVE_LDFLAGS="$LDFLAGS"
2876 CPPFLAGS="$CPPFLAGS -I/usr/include/noX"
2877 LDFLAGS="$LDFLAGS -L/usr/lib/noX"
2878 AC_CHECK_HEADER(X11/xpm.h,
2879 [AC_CHECK_LIB(Xpm, XpmReadFileToImage, HAVE_XPM=yes)])
2880 if test "${HAVE_XPM}" = "yes"; then
2881 AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
2882 AC_EGREP_CPP(no_return_alloc_pixels,
2883 [#include "X11/xpm.h"
2884 #ifndef XpmReturnAllocPixels
2885 no_return_alloc_pixels
2886 #endif
2887 ], HAVE_XPM=no, HAVE_XPM=yes)
2888
2889 if test "${HAVE_XPM}" = "yes"; then
2890 REAL_CPPFLAGS="$REAL_CPPFLAGS -I/usr/include/noX"
2891 AC_MSG_RESULT(yes)
2892 else
2893 AC_MSG_RESULT(no)
2894 CPPFLAGS="$SAVE_CPPFLAGS"
2895 LDFLAGS="$SAVE_LDFLAGS"
2896 fi
2897 fi
2898 fi
2899
2900 if test "${HAVE_XPM}" = "yes"; then
2901 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
2902 LIBXPM=-lXpm
2903 fi
2904 fi
2905
2906 if test "${HAVE_X11}" = "yes"; then
2907 if test "${with_xpm}" != "no"; then
2908 AC_CHECK_HEADER(X11/xpm.h,
2909 [AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11)])
2910 if test "${HAVE_XPM}" = "yes"; then
2911 AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
2912 AC_EGREP_CPP(no_return_alloc_pixels,
2913 [#include "X11/xpm.h"
2914 #ifndef XpmReturnAllocPixels
2915 no_return_alloc_pixels
2916 #endif
2917 ], HAVE_XPM=no, HAVE_XPM=yes)
2918
2919 if test "${HAVE_XPM}" = "yes"; then
2920 AC_MSG_RESULT(yes)
2921 else
2922 AC_MSG_RESULT(no)
2923 fi
2924 fi
2925 fi
2926
2927 if test "${HAVE_XPM}" = "yes"; then
2928 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
2929 LIBXPM=-lXpm
2930 fi
2931 fi
2932
2933 ### FIXME: Perhaps regroup to minimize code duplication due to MinGW's
2934 ### slightly different requirements wrt image libraries (it doesn't
2935 ### use -lXpm because it loads the xpm shared library dynamically at
2936 ### run time).
2937 if test "${opsys}" = "mingw32"; then
2938 if test "${with_xpm}" != "no"; then
2939 AC_CHECK_HEADER(X11/xpm.h, HAVE_XPM=yes, HAVE_XPM=no, [
2940 #define FOR_MSW 1])
2941 fi
2942
2943 if test "${HAVE_XPM}" = "yes"; then
2944 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
2945 fi
2946 fi
2947
2948 AC_SUBST(LIBXPM)
2949
2950 ### Use -ljpeg if available, unless `--with-jpeg=no'.
2951 ### mingw32 doesn't use -ljpeg, since it loads the library dynamically.
2952 HAVE_JPEG=no
2953 LIBJPEG=
2954 if test "${opsys}" = "mingw32"; then
2955 if test "${with_jpeg}" != "no"; then
2956 dnl Checking for jpeglib.h can lose because of a redefinition of
2957 dnl HAVE_STDLIB_H.
2958 AC_CHECK_HEADER(jerror.h, HAVE_JPEG=yes, HAVE_JPEG=no)
2959 fi
2960 AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
2961 if test "${HAVE_JPEG}" = "yes"; then
2962 AC_DEFINE(HAVE_JPEG)
2963 AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
2964 [#include <jpeglib.h>
2965 version=JPEG_LIB_VERSION
2966 ],
2967 [AC_DEFINE(HAVE_JPEG)],
2968 [AC_MSG_WARN([libjpeg found, but not version 6b or later])
2969 HAVE_JPEG=no])
2970 fi
2971 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
2972 if test "${with_jpeg}" != "no"; then
2973 dnl Checking for jpeglib.h can lose because of a redefinition of
2974 dnl HAVE_STDLIB_H.
2975 AC_CHECK_HEADER(jerror.h,
2976 [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
2977 fi
2978
2979 AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
2980 if test "${HAVE_JPEG}" = "yes"; then
2981 AC_DEFINE(HAVE_JPEG)
2982 AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
2983 [#include <jpeglib.h>
2984 version=JPEG_LIB_VERSION
2985 ],
2986 [AC_DEFINE(HAVE_JPEG)],
2987 [AC_MSG_WARN([libjpeg found, but not version 6b or later])
2988 HAVE_JPEG=no])
2989 fi
2990 if test "${HAVE_JPEG}" = "yes"; then
2991 LIBJPEG=-ljpeg
2992 fi
2993 fi
2994 AC_SUBST(LIBJPEG)
2995
2996 ### Use -lpng if available, unless `--with-png=no'.
2997 ### mingw32 doesn't use -lpng, since it loads the library dynamically.
2998 HAVE_PNG=no
2999 LIBPNG=
3000 if test "${opsys}" = "mingw32"; then
3001 if test "${with_png}" != "no"; then
3002 AC_CHECK_HEADER(png.h, HAVE_PNG=yes, HAVE_PNG=no)
3003 fi
3004 if test "${HAVE_PNG}" = "yes"; then
3005 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
3006
3007 AC_CHECK_DECL(png_longjmp,
3008 [],
3009 [AC_DEFINE(PNG_DEPSTRUCT, [],
3010 [Define to empty to suppress deprecation warnings when building
3011 with --enable-gcc-warnings and with libpng versions before 1.5,
3012 which lack png_longjmp.])],
3013 [[#ifdef HAVE_LIBPNG_PNG_H
3014 # include <libpng/png.h>
3015 #else
3016 # include <png.h>
3017 #endif
3018 ]])
3019 fi
3020 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
3021 if test "${with_png}" != "no"; then
3022 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
3023 # in /usr/include/libpng.
3024 AC_CHECK_HEADERS(png.h libpng/png.h, break)
3025 if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
3026 AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
3027 fi
3028 fi
3029
3030 if test "${HAVE_PNG}" = "yes"; then
3031 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
3032 LIBPNG="-lpng -lz -lm"
3033
3034 AC_CHECK_DECL(png_longjmp,
3035 [],
3036 [AC_DEFINE(PNG_DEPSTRUCT, [],
3037 [Define to empty to suppress deprecation warnings when building
3038 with --enable-gcc-warnings and with libpng versions before 1.5,
3039 which lack png_longjmp.])],
3040 [[#ifdef HAVE_LIBPNG_PNG_H
3041 # include <libpng/png.h>
3042 #else
3043 # include <png.h>
3044 #endif
3045 ]])
3046 fi
3047 fi
3048 AC_SUBST(LIBPNG)
3049
3050 HAVE_ZLIB=no
3051 LIBZ=
3052 if test "${with_zlib}" != "no"; then
3053 OLIBS=$LIBS
3054 AC_SEARCH_LIBS([inflateEnd], [z], [HAVE_ZLIB=yes])
3055 LIBS=$OLIBS
3056 case $ac_cv_search_inflateEnd in
3057 -*) LIBZ=$ac_cv_search_inflateEnd ;;
3058 esac
3059 fi
3060 if test "${HAVE_ZLIB}" = "yes"; then
3061 AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if you have the zlib library (-lz).])
3062 ### mingw32 doesn't use -lz, since it loads the library dynamically.
3063 if test "${opsys}" = "mingw32"; then
3064 LIBZ=
3065 fi
3066 fi
3067 AC_SUBST(LIBZ)
3068
3069
3070 ### Use -ltiff if available, unless `--with-tiff=no'.
3071 ### mingw32 doesn't use -ltiff, since it loads the library dynamically.
3072 HAVE_TIFF=no
3073 LIBTIFF=
3074 if test "${opsys}" = "mingw32"; then
3075 if test "${with_tiff}" != "no"; then
3076 AC_CHECK_HEADER(tiffio.h, HAVE_TIFF=yes, HAVE_TIFF=no)
3077 fi
3078 if test "${HAVE_TIFF}" = "yes"; then
3079 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
3080 fi
3081 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
3082 if test "${with_tiff}" != "no"; then
3083 AC_CHECK_HEADER(tiffio.h,
3084 [tifflibs="-lz -lm"
3085 # At least one tiff package requires the jpeg library.
3086 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
3087 AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs)])
3088 fi
3089
3090 if test "${HAVE_TIFF}" = "yes"; then
3091 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
3092 dnl FIXME -lz -lm, as per libpng?
3093 LIBTIFF=-ltiff
3094 fi
3095 fi
3096 AC_SUBST(LIBTIFF)
3097
3098 ### Use -lgif or -lungif if available, unless `--with-gif=no'.
3099 ### mingw32 doesn't use -lgif/-lungif, since it loads the library dynamically.
3100 HAVE_GIF=no
3101 LIBGIF=
3102 if test "${opsys}" = "mingw32"; then
3103 if test "${with_gif}" != "no"; then
3104 AC_CHECK_HEADER(gif_lib.h, HAVE_GIF=yes, HAVE_GIF=no)
3105 fi
3106 if test "${HAVE_GIF}" = "yes"; then
3107 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
3108 fi
3109 elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
3110 || test "${HAVE_W32}" = "yes"; then
3111 AC_CHECK_HEADER(gif_lib.h,
3112 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
3113 # Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
3114 [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes,
3115 [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])])
3116
3117 if test "$HAVE_GIF" = yes; then
3118 LIBGIF=-lgif
3119 elif test "$HAVE_GIF" = maybe; then
3120 # If gif_lib.h but no libgif, try libungif.
3121 AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
3122 test "$HAVE_GIF" = yes && LIBGIF=-lungif
3123 fi
3124
3125 if test "${HAVE_GIF}" = "yes"; then
3126 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
3127 fi
3128 fi
3129 AC_SUBST(LIBGIF)
3130
3131 dnl Check for required libraries.
3132 if test "${HAVE_X11}" = "yes"; then
3133 MISSING=""
3134 WITH_NO=""
3135 test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
3136 MISSING="libXpm" && WITH_NO="--with-xpm=no"
3137 test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
3138 MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
3139 test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
3140 MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
3141 test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
3142 MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
3143 test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
3144 MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
3145
3146 if test "X${MISSING}" != X; then
3147 AC_MSG_ERROR([The following required libraries were not found:
3148 $MISSING
3149 Maybe some development libraries/packages are missing?
3150 If you don't want to link with them give
3151 $WITH_NO
3152 as options to configure])
3153 fi
3154 fi
3155
3156 ### Use -lgpm if available, unless `--with-gpm=no'.
3157 HAVE_GPM=no
3158 LIBGPM=
3159 if test "${with_gpm}" != "no"; then
3160 AC_CHECK_HEADER(gpm.h,
3161 [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
3162
3163 if test "${HAVE_GPM}" = "yes"; then
3164 AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
3165 LIBGPM=-lgpm
3166 fi
3167 fi
3168 AC_SUBST(LIBGPM)
3169
3170 dnl Check for malloc/malloc.h on darwin
3171 AC_CHECK_HEADERS_ONCE(malloc/malloc.h)
3172
3173 GNUSTEP_CFLAGS=
3174 ### Use NeXTstep API to implement GUI.
3175 if test "${HAVE_NS}" = "yes"; then
3176 AC_DEFINE(HAVE_NS, 1, [Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on Mac OS X.])
3177 if test "${NS_IMPL_COCOA}" = "yes"; then
3178 AC_DEFINE(NS_IMPL_COCOA, 1, [Define to 1 if you are using NS windowing under MacOS X.])
3179 fi
3180 if test "${NS_IMPL_GNUSTEP}" = "yes"; then
3181 AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.])
3182 # See also .m.o rule in Makefile.in */
3183 # FIXME: are all these flags really needed? Document here why. */
3184 GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
3185 ## Extra CFLAGS applied to src/*.m files.
3186 GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE"
3187 fi
3188 OTHER_FILES=ns-app
3189 fi
3190
3191 ### Use session management (-lSM -lICE) if available
3192 HAVE_X_SM=no
3193 LIBXSM=
3194 if test "${HAVE_X11}" = "yes"; then
3195 AC_CHECK_HEADER(X11/SM/SMlib.h,
3196 [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
3197
3198 if test "${HAVE_X_SM}" = "yes"; then
3199 AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
3200 LIBXSM="-lSM -lICE"
3201 case "$LIBS" in
3202 *-lSM*) ;;
3203 *) LIBS="$LIBXSM $LIBS" ;;
3204 esac
3205 fi
3206 fi
3207 AC_SUBST(LIBXSM)
3208
3209 ### Use XRandr (-lXrandr) if available
3210 HAVE_XRANDR=no
3211 if test "${HAVE_X11}" = "yes"; then
3212 XRANDR_REQUIRED=1.2.2
3213 XRANDR_MODULES="xrandr >= $XRANDR_REQUIRED"
3214 PKG_CHECK_MODULES(XRANDR, $XRANDR_MODULES, HAVE_XRANDR=yes, HAVE_XRANDR=no)
3215 if test $HAVE_XRANDR = no; then
3216 # Test old way in case pkg-config doesn't have it (older machines).
3217 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
3218 [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)])
3219 if test $HAVE_XRANDR = yes; then
3220 XRANDR_LIBS=-lXrandr
3221 AC_SUBST(XRANDR_LIBS)
3222 fi
3223 fi
3224 if test $HAVE_XRANDR = yes; then
3225 SAVE_CFLAGS="$CFLAGS"
3226 SAVE_LIBS="$LIBS"
3227 CFLAGS="$XRANDR_CFLAGS $CFLAGS"
3228 LIBS="$XRANDR_LIBS $LIBS"
3229 AC_CHECK_FUNCS(XRRGetOutputPrimary XRRGetScreenResourcesCurrent)
3230 CFLAGS="$SAVE_CFLAGS"
3231 LIBS="$SAVE_LIBS"
3232
3233 AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the XRandr extension.])
3234 fi
3235 fi
3236
3237 ### Use Xinerama (-lXinerama) if available
3238 HAVE_XINERAMA=no
3239 if test "${HAVE_X11}" = "yes"; then
3240 XINERAMA_REQUIRED=1.0.2
3241 XINERAMA_MODULES="xinerama >= $XINERAMA_REQUIRED"
3242 PKG_CHECK_MODULES(XINERAMA, $XINERAMA_MODULES, HAVE_XINERAMA=yes,
3243 HAVE_XINERAMA=no)
3244 if test $HAVE_XINERAMA = no; then
3245 # Test old way in case pkg-config doesn't have it (older machines).
3246 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
3247 [AC_CHECK_LIB(Xinerama, XineramaQueryExtension, HAVE_XINERAMA=yes)])
3248 if test $HAVE_XINERAMA = yes; then
3249 XINERAMA_LIBS=-lXinerama
3250 AC_SUBST(XINERAMA_LIBS)
3251 fi
3252 fi
3253 if test $HAVE_XINERAMA = yes; then
3254 AC_DEFINE(HAVE_XINERAMA, 1, [Define to 1 if you have the Xinerama extension.])
3255 fi
3256 fi
3257
3258
3259 ### Use libxml (-lxml2) if available
3260 ### mingw32 doesn't use -lxml2, since it loads the library dynamically.
3261 HAVE_LIBXML2=no
3262 if test "${with_xml2}" != "no"; then
3263 ### I'm not sure what the version number should be, so I just guessed.
3264 PKG_CHECK_MODULES(LIBXML2, libxml-2.0 > 2.6.17, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
3265 # Built-in libxml2 on OS X 10.8 lacks libxml-2.0.pc.
3266 if test "${HAVE_LIBXML2}" != "yes" -a "$opsys" = "darwin"; then
3267 SAVE_CPPFLAGS="$CPPFLAGS"
3268 CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2"
3269 AC_CHECK_HEADER(libxml/HTMLparser.h,
3270 [AC_CHECK_DECL(HTML_PARSE_RECOVER, HAVE_LIBXML2=yes, ,
3271 [#include <libxml/HTMLparser.h>])])
3272 CPPFLAGS="$SAVE_CPPFLAGS"
3273 if test "${HAVE_LIBXML2}" = "yes"; then
3274 LIBXML2_LIBS="-lxml2"
3275 LIBXML2_CFLAGS="-I/usr/include/libxml2"
3276 fi
3277 fi
3278 if test "${HAVE_LIBXML2}" = "yes"; then
3279 if test "${opsys}" != "mingw32"; then
3280 LIBS="$LIBXML2_LIBS $LIBS"
3281 AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
3282 else
3283 LIBXML2_LIBS=""
3284 fi
3285 if test "${HAVE_LIBXML2}" = "yes"; then
3286 AC_DEFINE(HAVE_LIBXML2, 1, [Define to 1 if you have the libxml library (-lxml2).])
3287 else
3288 LIBXML2_LIBS=""
3289 LIBXML2_CFLAGS=""
3290 fi
3291 fi
3292 fi
3293 AC_SUBST(LIBXML2_LIBS)
3294 AC_SUBST(LIBXML2_CFLAGS)
3295
3296 # If netdb.h doesn't declare h_errno, we must declare it by hand.
3297 # On MinGW, that is provided by nt/inc/sys/socket.h and w32.c.
3298 if test "${opsys}" = "mingw32"; then
3299 emacs_cv_netdb_declares_h_errno=yes
3300 fi
3301 AC_CACHE_CHECK(whether netdb declares h_errno,
3302 emacs_cv_netdb_declares_h_errno,
3303 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
3304 [[return h_errno;]])],
3305 emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
3306 if test $emacs_cv_netdb_declares_h_errno = yes; then
3307 AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.])
3308 fi
3309
3310 # sqrt and other floating-point functions such as fmod and frexp
3311 # are found in -lm on most systems, but mingw32 doesn't use -lm.
3312 if test "${opsys}" != "mingw32"; then
3313 AC_CHECK_LIB(m, sqrt)
3314 fi
3315
3316 # Check for mail-locking functions in a "mail" library. Probably this should
3317 # have the same check as for liblockfile below.
3318 AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no)
3319 if test $have_mail = yes; then
3320 LIBS_MAIL=-lmail
3321 LIBS="$LIBS_MAIL $LIBS"
3322 AC_DEFINE(HAVE_LIBMAIL, 1, [Define to 1 if you have the `mail' library (-lmail).])
3323 else
3324 LIBS_MAIL=
3325 fi
3326 dnl Debian, at least:
3327 AC_CHECK_LIB(lockfile, maillock, have_lockfile=yes, have_lockfile=no)
3328 if test $have_lockfile = yes; then
3329 LIBS_MAIL=-llockfile
3330 LIBS="$LIBS_MAIL $LIBS"
3331 AC_DEFINE(HAVE_LIBLOCKFILE, 1, [Define to 1 if you have the `lockfile' library (-llockfile).])
3332 else
3333 # If we have the shared liblockfile, assume we must use it for mail
3334 # locking (e.g. Debian). If we couldn't link against liblockfile
3335 # (no liblockfile.a installed), ensure that we don't need to.
3336 dnl This works for files generally, not just executables.
3337 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
3338 AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
3339 /usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH)
3340 if test $ac_cv_prog_liblockfile = yes; then
3341 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
3342 This probably means that movemail could lose mail.
3343 There may be a `development' package to install containing liblockfile.])
3344 fi
3345 fi
3346 AC_CHECK_HEADERS_ONCE(maillock.h)
3347 AC_SUBST(LIBS_MAIL)
3348
3349 ## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
3350 ## interlock access to the mail spool. The alternative is a lock file named
3351 ## /usr/spool/mail/$USER.lock.
3352 mail_lock=no
3353 case "$opsys" in
3354 aix4-2) mail_lock="lockf" ;;
3355
3356 gnu|freebsd|dragonfly|netbsd|openbsd|darwin|irix6-5) mail_lock="flock" ;;
3357
3358 ## On GNU/Linux systems, both methods are used by various mail programs.
3359 ## I assume most people are using newer mailers that have heard of flock.
3360 ## Change this if you need to.
3361 ## Debian contains a patch which says: ``On Debian/GNU/Linux systems,
3362 ## configure gets the right answers, and that means *NOT* using flock.
3363 ## Using flock is guaranteed to be the wrong thing. See Debian Policy
3364 ## for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the
3365 ## Debian maintainer hasn't provided a clean fix for Emacs.
3366 ## movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
3367 ## HAVE_MAILLOCK_H are defined, so the following appears to be the
3368 ## correct logic. -- fx
3369 ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
3370 ## liblockfile is a Free Software replacement for libmail, used on
3371 ## Debian systems and elsewhere. -rfr.
3372 gnu-*)
3373 mail_lock="flock"
3374 if test $have_mail = yes || test $have_lockfile = yes; then
3375 test $ac_cv_header_maillock_h = yes && mail_lock=no
3376 fi
3377 ;;
3378
3379 mingw32)
3380 mail_lock="none-needed" ;;
3381 esac
3382
3383 BLESSMAIL_TARGET=
3384 case "$mail_lock" in
3385 flock) AC_DEFINE(MAIL_USE_FLOCK, 1, [Define if the mailer uses flock to interlock the mail spool.]) ;;
3386
3387 lockf) AC_DEFINE(MAIL_USE_LOCKF, 1, [Define if the mailer uses lockf to interlock the mail spool.]) ;;
3388
3389 none-needed) ;;
3390
3391 *) BLESSMAIL_TARGET="need-blessmail" ;;
3392 esac
3393 AC_SUBST(BLESSMAIL_TARGET)
3394
3395
3396 AC_CHECK_FUNCS(accept4 gethostname \
3397 getrusage get_current_dir_name \
3398 lrand48 \
3399 select getpagesize setlocale \
3400 getrlimit setrlimit shutdown getaddrinfo \
3401 strsignal setitimer \
3402 sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
3403 gai_strerror getline getdelim sync \
3404 difftime posix_memalign \
3405 getpwent endpwent getgrent endgrent \
3406 touchlock \
3407 cfmakeraw cfsetspeed copysign __executable_start log2)
3408
3409 ## Eric Backus <ericb@lsid.hp.com> says, HP-UX 9.x on HP 700 machines
3410 ## has a broken `rint' in some library versions including math library
3411 ## version number A.09.05.
3412 ## You can fix the math library by installing patch number PHSS_4630.
3413 ## But we can fix it more reliably for Emacs by just not using rint.
3414 ## We also skip HAVE_RANDOM - see comments in src/conf_post.h.
3415 case $opsys in
3416 hpux*) : ;;
3417 *) AC_CHECK_FUNCS(random rint) ;;
3418 esac
3419
3420 dnl Cannot use AC_CHECK_FUNCS
3421 AC_CACHE_CHECK([for __builtin_unwind_init],
3422 emacs_cv_func___builtin_unwind_init,
3423 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_unwind_init ();])],
3424 emacs_cv_func___builtin_unwind_init=yes,
3425 emacs_cv_func___builtin_unwind_init=no)])
3426 if test $emacs_cv_func___builtin_unwind_init = yes; then
3427 AC_DEFINE(HAVE___BUILTIN_UNWIND_INIT, 1,
3428 [Define to 1 if you have the `__builtin_unwind_init' function.])
3429 fi
3430
3431 AC_CHECK_HEADERS_ONCE(sys/un.h)
3432
3433 AC_FUNC_FSEEKO
3434
3435 # UNIX98 PTYs.
3436 AC_CHECK_FUNCS(grantpt)
3437
3438 # PTY-related GNU extensions.
3439 AC_CHECK_FUNCS(getpt posix_openpt)
3440
3441 # Check this now, so that we will NOT find the above functions in ncurses.
3442 # That is because we have not set up to link ncurses in lib-src.
3443 # It's better to believe a function is not available
3444 # than to expect to find it in ncurses.
3445 # Also we need tputs and friends to be able to build at all.
3446 AC_MSG_CHECKING([for library containing tputs])
3447 # Run a test program that contains a call to tputs, a call that is
3448 # never executed. This tests whether a pre-'main' dynamic linker
3449 # works with the library. It's too much trouble to actually call
3450 # tputs in the test program, due to portability hassles. When
3451 # cross-compiling, assume the test program will run if it links.
3452 AC_DEFUN([tputs_link_source], [
3453 AC_LANG_SOURCE(
3454 [[extern void tputs (const char *, int, int (*)(int));
3455 int main (int argc, char **argv)
3456 {
3457 if (argc == 10000)
3458 tputs (argv[0], 0, 0);
3459 return 0;
3460 }]])
3461 ])
3462 if test "${opsys}" = "mingw32"; then
3463 msg='none required'
3464 else
3465 # Maybe curses should be tried earlier?
3466 # See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
3467 for tputs_library in '' tinfo ncurses terminfo termcap curses; do
3468 OLIBS=$LIBS
3469 if test -z "$tputs_library"; then
3470 LIBS_TERMCAP=
3471 msg='none required'
3472 else
3473 LIBS_TERMCAP=-l$tputs_library
3474 msg=$LIBS_TERMCAP
3475 LIBS="$LIBS_TERMCAP $LIBS"
3476 fi
3477 AC_RUN_IFELSE([tputs_link_source], [], [msg=no],
3478 [AC_LINK_IFELSE([tputs_link_source], [], [msg=no])])
3479 LIBS=$OLIBS
3480 if test "X$msg" != Xno; then
3481 break
3482 fi
3483 done
3484 fi
3485 AC_MSG_RESULT([$msg])
3486 if test "X$msg" = Xno; then
3487 AC_MSG_ERROR([The required function `tputs' was not found in any library.
3488 The following libraries were tried (in order):
3489 libtinfo, libncurses, libterminfo, libtermcap, libcurses
3490 Please try installing whichever of these libraries is most appropriate
3491 for your system, together with its header files.
3492 For example, a libncurses-dev(el) or similar package.])
3493 fi
3494
3495 ## Use termcap instead of terminfo?
3496 ## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
3497 TERMINFO=yes
3498 ## FIXME? In the cases below where we unconditionally set
3499 ## LIBS_TERMCAP="-lncurses", this overrides LIBS_TERMCAP = -ltinfo,
3500 ## if that was found above to have tputs.
3501 ## Should we use the gnu* logic everywhere?
3502 case "$opsys" in
3503 ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
3504 ## The ncurses library has been moved out of the System framework in
3505 ## Mac OS X 10.2. So if configure detects it, set the command-line
3506 ## option to use it.
3507 darwin) LIBS_TERMCAP="-lncurses" ;;
3508
3509 gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
3510
3511 freebsd)
3512 AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
3513 AC_CACHE_VAL(emacs_cv_freebsd_terminfo,
3514 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <osreldate.h>]],
3515 [[#if __FreeBSD_version < 400000
3516 fail;
3517 #endif
3518 ]])], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)])
3519
3520 AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
3521
3522 if test $emacs_cv_freebsd_terminfo = yes; then
3523 LIBS_TERMCAP="-lncurses"
3524 else
3525 TERMINFO=no
3526 LIBS_TERMCAP="-ltermcap"
3527 fi
3528 ;;
3529
3530 mingw32)
3531 TERMINFO=no
3532 LIBS_TERMCAP=
3533 ;;
3534
3535 netbsd)
3536 if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
3537 TERMINFO=no
3538 LIBS_TERMCAP="-ltermcap"
3539 fi
3540 ;;
3541
3542 openbsd | dragonfly) LIBS_TERMCAP="-lncurses" ;;
3543
3544 ## hpux: Make sure we get select from libc rather than from libcurses
3545 ## because libcurses on HPUX 10.10 has a broken version of select.
3546 ## We used to use -lc -lcurses, but this may be cleaner.
3547 ## FIXME? But TERMINFO = yes on hpux (it used to be explicitly
3548 # set that way, now it uses the default). Isn't this a contradiction?
3549 hpux*) LIBS_TERMCAP="-ltermcap" ;;
3550
3551 esac
3552
3553 TERMCAP_OBJ=tparam.o
3554 if test $TERMINFO = yes; then
3555 AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
3556 TERMCAP_OBJ=terminfo.o
3557 fi
3558 if test "X$LIBS_TERMCAP" = "X-lncurses"; then
3559 AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.])
3560 fi
3561 AC_SUBST(LIBS_TERMCAP)
3562 AC_SUBST(TERMCAP_OBJ)
3563
3564
3565 # Do we have res_init, for detecting changes in /etc/resolv.conf?
3566 # On Darwin, res_init appears not to be useful: see bug#562 and
3567 # http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html
3568 resolv=no
3569
3570 if test $opsys != darwin; then
3571
3572 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
3573 #include <arpa/nameser.h>
3574 #include <resolv.h>]],
3575 [[return res_init();]])],
3576 have_res_init=yes, have_res_init=no)
3577 if test "$have_res_init" = no; then
3578 OLIBS="$LIBS"
3579 LIBS="$LIBS -lresolv"
3580 AC_MSG_CHECKING(for res_init with -lresolv)
3581 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
3582 #include <arpa/nameser.h>
3583 #include <resolv.h>]],
3584 [[return res_init();]])],
3585 have_res_init=yes, have_res_init=no)
3586 AC_MSG_RESULT($have_res_init)
3587 if test "$have_res_init" = yes ; then
3588 resolv=yes
3589 fi
3590 LIBS="$OLIBS"
3591 fi
3592
3593 if test "$have_res_init" = yes; then
3594 AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
3595 fi
3596 fi dnl !darwin
3597
3598 # Do we need the Hesiod library to provide the support routines?
3599 dnl FIXME? Should we be skipping this on Darwin too?
3600 LIBHESIOD=
3601 if test "$with_hesiod" != no ; then
3602 # Don't set $LIBS here -- see comments above. FIXME which comments?
3603 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
3604 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
3605 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
3606 if test "$resolv" = yes ; then
3607 RESOLVLIB=-lresolv
3608 else
3609 RESOLVLIB=
3610 fi
3611 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
3612 hesiod=yes, :, $RESOLVLIB)])
3613
3614 if test x"$hesiod" = xyes; then
3615 LIBHESIOD=-lhesiod
3616 fi
3617 fi
3618 AC_SUBST(LIBHESIOD)
3619
3620 # Do we need libresolv (due to res_init or Hesiod)?
3621 if test "$resolv" = yes && test $opsys != darwin; then
3622 LIBRESOLV=-lresolv
3623 else
3624 LIBRESOLV=
3625 fi
3626 AC_SUBST(LIBRESOLV)
3627
3628 # These tell us which Kerberos-related libraries to use.
3629 COM_ERRLIB=
3630 CRYPTOLIB=
3631 KRB5LIB=
3632 DESLIB=
3633 KRB4LIB=
3634
3635 if test "${with_kerberos}" != no; then
3636 AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no)
3637 if test $have_com_err = yes; then
3638 COM_ERRLIB=-lcom_err
3639 LIBS="$COM_ERRLIB $LIBS"
3640 fi
3641 AC_CHECK_LIB(crypto, mit_des_cbc_encrypt, have_crypto=yes, have_crypto=no)
3642 if test $have_crypto = yes; then
3643 CRYPTOLIB=-lcrypto
3644 LIBS="$CRYPTOLIB $LIBS"
3645 fi
3646 AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt, have_k5crypto=yes, have_k5crypto=no)
3647 if test $have_k5crypto = yes; then
3648 CRYPTOLIB=-lk5crypto
3649 LIBS="$CRYPTOLIB $LIBS"
3650 fi
3651 AC_CHECK_LIB(krb5, krb5_init_context, have_krb5=yes, have_krb5=no)
3652 if test $have_krb5=yes; then
3653 KRB5LIB=-lkrb5
3654 LIBS="$KRB5LIB $LIBS"
3655 fi
3656 dnl FIXME Simplify. Does not match 22 logic, thanks to default_off?
3657 if test "${with_kerberos5}" = no; then
3658 AC_CHECK_LIB(des425, des_cbc_encrypt, have_des425=yes, have_des425=no )
3659 if test $have_des425 = yes; then
3660 DESLIB=-ldes425
3661 LIBS="$DESLIB $LIBS"
3662 else
3663 AC_CHECK_LIB(des, des_cbc_encrypt, have_des=yes, have_des=no)
3664 if test $have_des = yes; then
3665 DESLIB=-ldes
3666 LIBS="$DESLIB $LIBS"
3667 fi
3668 fi
3669 AC_CHECK_LIB(krb4, krb_get_cred, have_krb4=yes, have_krb4=no)
3670 if test $have_krb4 = yes; then
3671 KRB4LIB=-lkrb4
3672 LIBS="$KRB4LIB $LIBS"
3673 else
3674 AC_CHECK_LIB(krb, krb_get_cred, have_krb=yes, have_krb=no)
3675 if test $have_krb = yes; then
3676 KRB4LIB=-lkrb
3677 LIBS="$KRB4LIB $LIBS"
3678 fi
3679 fi
3680 fi
3681
3682 if test "${with_kerberos5}" != no; then
3683 AC_CHECK_HEADERS(krb5.h,
3684 [AC_CHECK_MEMBERS([krb5_error.text, krb5_error.e_text],,,
3685 [#include <krb5.h>])])
3686 else
3687 AC_CHECK_HEADERS(krb.h,,
3688 [AC_CHECK_HEADERS(kerberosIV/krb.h,,
3689 [AC_CHECK_HEADERS(kerberos/krb.h)])])
3690 fi
3691 AC_CHECK_HEADERS(com_err.h)
3692 fi
3693
3694 AC_SUBST(COM_ERRLIB)
3695 AC_SUBST(CRYPTOLIB)
3696 AC_SUBST(KRB5LIB)
3697 AC_SUBST(DESLIB)
3698 AC_SUBST(KRB4LIB)
3699
3700 AC_CHECK_HEADERS(valgrind/valgrind.h)
3701
3702 AC_CHECK_FUNCS_ONCE(tzset)
3703 AC_MSG_CHECKING(whether localtime caches TZ)
3704 AC_CACHE_VAL(emacs_cv_localtime_cache,
3705 [if test x$ac_cv_func_tzset = xyes; then
3706 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
3707 char TZ_GMT0[] = "TZ=GMT0";
3708 char TZ_PST8[] = "TZ=PST8";
3709 main()
3710 {
3711 time_t now = time ((time_t *) 0);
3712 int hour_GMT0, hour_unset;
3713 if (putenv (TZ_GMT0) != 0)
3714 exit (1);
3715 hour_GMT0 = localtime (&now)->tm_hour;
3716 unsetenv("TZ");
3717 hour_unset = localtime (&now)->tm_hour;
3718 if (putenv (TZ_PST8) != 0)
3719 exit (1);
3720 if (localtime (&now)->tm_hour == hour_GMT0)
3721 exit (1);
3722 unsetenv("TZ");
3723 if (localtime (&now)->tm_hour != hour_unset)
3724 exit (1);
3725 exit (0);
3726 }]])], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
3727 [# If we have tzset, assume the worst when cross-compiling.
3728 emacs_cv_localtime_cache=yes])
3729 else
3730 # If we lack tzset, report that localtime does not cache TZ,
3731 # since we can't invalidate the cache if we don't have tzset.
3732 emacs_cv_localtime_cache=no
3733 fi])dnl
3734 AC_MSG_RESULT($emacs_cv_localtime_cache)
3735 if test $emacs_cv_localtime_cache = yes; then
3736 AC_DEFINE(LOCALTIME_CACHE, 1,
3737 [Define to 1 if localtime caches TZ.])
3738 fi
3739
3740 ok_so_far=yes
3741 AC_CHECK_FUNC(socket, , ok_so_far=no)
3742 if test $ok_so_far = yes; then
3743 AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
3744 fi
3745 if test $ok_so_far = yes; then
3746 AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
3747 fi
3748 if test $ok_so_far = yes; then
3749 dnl Fixme: Not used. Should this be HAVE_SOCKETS?
3750 AC_DEFINE(HAVE_INET_SOCKETS, 1,
3751 [Define to 1 if you have inet sockets.])
3752 fi
3753
3754 dnl Check for a Solaris 2.4 vfork bug that Autoconf misses (through 2.69).
3755 dnl This can be removed once we assume Autoconf 2.70.
3756 case $canonical in
3757 *-solaris2.4 | *-solaris2.4.*)
3758 dnl Disable the Autoconf-generated vfork test.
3759 : ${ac_cv_func_vfork_works=no};;
3760 esac
3761
3762 AC_FUNC_FORK
3763
3764 AC_CHECK_FUNCS(snprintf)
3765
3766 dnl Check this late. It depends on what other libraries (lrsvg, Gtk+ etc)
3767 dnl Emacs uses.
3768 XGSELOBJ=
3769 AC_MSG_CHECKING([whether GLib is linked in])
3770 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3771 [[#include <glib.h>
3772 ]],
3773 [[g_print ("Hello world");]])],
3774 [links_glib=yes],
3775 [links_glib=no])
3776 AC_MSG_RESULT([$links_glib])
3777 if test "${links_glib}" = "yes"; then
3778 AC_DEFINE(HAVE_GLIB, 1, [Define to 1 if GLib is linked in.])
3779 if test "$HAVE_NS" = no;then
3780 XGSELOBJ=xgselect.o
3781 fi
3782 fi
3783 AC_SUBST(XGSELOBJ)
3784
3785 dnl Adapted from Haible's version.
3786 AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
3787 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
3788 [[char* cs = nl_langinfo(CODESET);]])],
3789 emacs_cv_langinfo_codeset=yes,
3790 emacs_cv_langinfo_codeset=no)
3791 ])
3792 if test $emacs_cv_langinfo_codeset = yes; then
3793 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
3794 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
3795 fi
3796
3797 AC_TYPE_MBSTATE_T
3798
3799 AC_CACHE_CHECK([for C restricted array declarations], emacs_cv_c_restrict_arr,
3800 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void fred (int x[__restrict]);]], [[]])],
3801 emacs_cv_c_restrict_arr=yes, emacs_cv_c_restrict_arr=no)])
3802 if test "$emacs_cv_c_restrict_arr" = yes; then
3803 AC_DEFINE(__restrict_arr, __restrict,
3804 [Define to compiler's equivalent of C99 restrict keyword in array
3805 declarations. Define as empty for no equivalent.])
3806 fi
3807
3808 dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
3809 dnl how the tty code is related to POSIX and/or other versions of termios.
3810 dnl The following looks like a useful start.
3811 dnl
3812 dnl AC_SYS_POSIX_TERMIOS
3813 dnl if test $ac_cv_sys_posix_termios = yes; then
3814 dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
3815 dnl and macros for terminal control.])
3816 dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
3817 dnl fi
3818
3819 dnl Turned on June 1996 supposing nobody will mind it.
3820 dnl MinGW emulates passwd database, so this feature doesn't make sense there.
3821 if test "${opsys}" != "mingw32"; then
3822 AC_DEFINE(AMPERSAND_FULL_NAME, 1, [Define to use the convention that &
3823 in the full name stands for the login id.])
3824 fi
3825
3826 dnl Every platform that uses configure supports this.
3827 dnl There is a create-lockfiles option you can
3828 dnl customize if you do not want the lock files to be written.
3829 dnl So it is not clear that this #define still needs to exist.
3830 AC_DEFINE(CLASH_DETECTION, 1, [Define if you want lock files to be written,
3831 so that Emacs can tell instantly when you try to modify a file that
3832 someone else has modified in his/her Emacs.])
3833
3834 dnl Everybody supports this, except MS.
3835 dnl Seems like the kind of thing we should be testing for, though.
3836 ## Note: PTYs are broken on darwin <6. Use at your own risk.
3837 if test "${opsys}" != "mingw32"; then
3838 AC_DEFINE(HAVE_PTYS, 1, [Define if the system supports pty devices.])
3839 fi
3840
3841 dnl Everybody supports this, except MS-DOS.
3842 dnl Seems like the kind of thing we should be testing for, though.
3843 dnl Compare with HAVE_INET_SOCKETS (which is unused...) above.
3844 AC_DEFINE(HAVE_SOCKETS, 1, [Define if the system supports
3845 4.2-compatible sockets.])
3846
3847 AH_TEMPLATE(INTERNAL_TERMINAL, [This is substituted when $TERM is "internal".])
3848
3849 AH_TEMPLATE(NULL_DEVICE, [Name of the file to open to get
3850 a null file, or a data sink.])
3851 if test "${opsys}" = "mingw32"; then
3852 AC_DEFINE(NULL_DEVICE, ["NUL:"])
3853 else
3854 AC_DEFINE(NULL_DEVICE, ["/dev/null"])
3855 fi
3856
3857 AH_TEMPLATE(SEPCHAR, [Character that separates PATH elements.])
3858 if test "${opsys}" = "mingw32"; then
3859 AC_DEFINE(SEPCHAR, [';'])
3860 else
3861 AC_DEFINE(SEPCHAR, [':'])
3862 fi
3863
3864 dnl Everybody supports this, except MS-DOS.
3865 AC_DEFINE(subprocesses, 1, [Define to enable asynchronous subprocesses.])
3866
3867 AC_DEFINE(USER_FULL_NAME, [pw->pw_gecos], [How to get a user's full name.])
3868
3869
3870 AC_DEFINE(DIRECTORY_SEP, ['/'],
3871 [Character that separates directories in a file name.])
3872
3873 if test "${opsys}" = "mingw32"; then
3874 AC_DEFINE(IS_DEVICE_SEP(_c_), [((_c_) == ':')],
3875 [Returns true if character is a device separator.])
3876
3877 AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == '/' || (_c_) == '\\')],
3878 [Returns true if character is a directory separator.])
3879
3880 AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP(_c_))],
3881 [Returns true if character is any form of separator.])
3882 else
3883 AC_DEFINE(IS_DEVICE_SEP(_c_), 0,
3884 [Returns true if character is a device separator.])
3885
3886 AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == DIRECTORY_SEP)],
3887 [Returns true if character is a directory separator.])
3888
3889 AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_))],
3890 [Returns true if character is any form of separator.])
3891 fi
3892
3893 AH_TEMPLATE(NO_EDITRES, [Define if XEditRes should not be used.])
3894
3895 case $opsys in
3896 aix4-2)
3897 dnl Unfortunately without libXmu we cannot support EditRes.
3898 if test x$ac_cv_lib_Xmu_XmuConvertStandardSelection != xyes; then
3899 AC_DEFINE(NO_EDITRES, 1)
3900 fi
3901 ;;
3902
3903 hpux*)
3904 dnl Assar Westerlund <assar@sics.se> says this is necessary for
3905 dnl HP-UX 10.20, and that it works for HP-UX 0 as well.
3906 AC_DEFINE(NO_EDITRES, 1)
3907 ;;
3908 esac
3909
3910
3911 case $opsys in
3912 irix6-5 | sol2* | unixware )
3913 dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
3914 dnl instead, there's a system variable _sys_nsig. Unfortunately, we
3915 dnl need the constant to dimension an array. So wire in the appropriate
3916 dnl value here.
3917 AC_DEFINE(NSIG_MINIMUM, 32, [Minimum value of NSIG.])
3918 ;;
3919 esac
3920
3921 emacs_broken_SIGIO=no
3922
3923 case $opsys in
3924 dnl SIGIO exists, but the feature doesn't work in the way Emacs needs.
3925 dnl See eg <http://article.gmane.org/gmane.os.openbsd.ports/46831>.
3926 hpux* | irix6-5 | openbsd | sol2* | unixware )
3927 emacs_broken_SIGIO=yes
3928 ;;
3929
3930 aix4-2)
3931 dnl On AIX Emacs uses the gmalloc.c malloc implementation. But given
3932 dnl the way this system works, libc functions that return malloced
3933 dnl memory use the libc malloc implementation. Calling xfree or
3934 dnl xrealloc on the results of such functions results in a crash.
3935 dnl
3936 dnl One solution for this could be to define SYSTEM_MALLOC in configure,
3937 dnl but that does not currently work on this system.
3938 dnl
3939 dnl It is possible to completely override the malloc implementation on
3940 dnl AIX, but that involves putting the malloc functions in a shared
3941 dnl library and setting the MALLOCTYPE environment variable to point to
3942 dnl that shared library.
3943 dnl
3944 dnl Emacs currently calls xrealloc on the results of get_current_dir name,
3945 dnl to avoid a crash just use the Emacs implementation for that function.
3946 dnl
3947 dnl FIXME We could change the AC_CHECK_FUNCS call near the start
3948 dnl of this file, so that we do not check for get_current_dir_name
3949 dnl on AIX. But that might be fragile if something else ends
3950 dnl up testing for get_current_dir_name as a dependency.
3951 AC_DEFINE(BROKEN_GET_CURRENT_DIR_NAME, 1, [Define if
3952 get_current_dir_name should not be used.])
3953 ;;
3954
3955 freebsd)
3956 dnl Circumvent a bug in FreeBSD. In the following sequence of
3957 dnl writes/reads on a PTY, read(2) returns bogus data:
3958 dnl
3959 dnl write(2) 1022 bytes
3960 dnl write(2) 954 bytes, get EAGAIN
3961 dnl read(2) 1024 bytes in process_read_output
3962 dnl read(2) 11 bytes in process_read_output
3963 dnl
3964 dnl That is, read(2) returns more bytes than have ever been written
3965 dnl successfully. The 1033 bytes read are the 1022 bytes written
3966 dnl successfully after processing (for example with CRs added if the
3967 dnl terminal is set up that way which it is here). The same bytes will
3968 dnl be seen again in a later read(2), without the CRs.
3969 AC_DEFINE(BROKEN_PTY_READ_AFTER_EAGAIN, 1, [Define on FreeBSD to
3970 work around an issue when reading from a PTY.])
3971 ;;
3972 esac
3973
3974 case $opsys in
3975 gnu-* | sol2-10 )
3976 dnl FIXME Can't we test if this exists (eg /proc/$$)?
3977 AC_DEFINE(HAVE_PROCFS, 1, [Define if you have the /proc filesystem.])
3978 ;;
3979 esac
3980
3981 case $opsys in
3982 darwin | dragonfly | freebsd | netbsd | openbsd )
3983 AC_DEFINE(DONT_REOPEN_PTY, 1, [Define if process.c does not need to
3984 close a pty to make it a controlling terminal (it is already a
3985 controlling terminal of the subprocess, because we did ioctl TIOCSCTTY).])
3986 ;;
3987 esac
3988
3989 dnl FIXME Surely we can test for this rather than hard-code it.
3990 case $opsys in
3991 netbsd | openbsd) sound_device="/dev/audio" ;;
3992 *) sound_device="/dev/dsp" ;;
3993 esac
3994
3995 dnl Used in sound.c
3996 AC_DEFINE_UNQUOTED(DEFAULT_SOUND_DEVICE, "$sound_device",
3997 [Name of the default sound device.])
3998
3999
4000 dnl Emacs can read input using SIGIO and buffering characters itself,
4001 dnl or using CBREAK mode and making C-g cause SIGINT.
4002 dnl The choice is controlled by the variable interrupt_input.
4003 dnl
4004 dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
4005 dnl
4006 dnl Emacs uses the presence of the USABLE_SIGIO macro
4007 dnl to indicate whether or not signal-driven I/O is possible. It uses
4008 dnl INTERRUPT_INPUT to decide whether to use it by default.
4009 dnl
4010 dnl SIGIO can be used only on systems that implement it (4.2 and 4.3).
4011 dnl CBREAK mode has two disadvantages
4012 dnl 1) At least in 4.2, it is impossible to handle the Meta key properly.
4013 dnl I hear that in system V this problem does not exist.
4014 dnl 2) Control-G causes output to be discarded.
4015 dnl I do not know whether this can be fixed in system V.
4016 dnl
4017 dnl Another method of doing input is planned but not implemented.
4018 dnl It would have Emacs fork off a separate process
4019 dnl to read the input and send it to the true Emacs process
4020 dnl through a pipe.
4021 case $opsys in
4022 darwin | gnu-linux | gnu-kfreebsd )
4023 AC_DEFINE(INTERRUPT_INPUT, 1, [Define to read input using SIGIO.])
4024 ;;
4025 esac
4026
4027
4028 dnl If the system's imake configuration file defines `NeedWidePrototypes'
4029 dnl as `NO', we must define NARROWPROTO manually. Such a define is
4030 dnl generated in the Makefile generated by `xmkmf'. If we don't define
4031 dnl NARROWPROTO, we will see the wrong function prototypes for X functions
4032 dnl taking float or double parameters.
4033 case $opsys in
4034 cygwin|gnu|gnu-linux|gnu-kfreebsd|irix6-5|freebsd|netbsd|openbsd)
4035 AC_DEFINE(NARROWPROTO, 1, [Define if system's imake configuration
4036 file defines `NeedWidePrototypes' as `NO'.])
4037 ;;
4038 esac
4039
4040
4041 dnl Used in process.c, this must be a loop, even if it only runs once.
4042 dnl (Except on SGI; see below. Take that, clarity and consistency!)
4043 AH_TEMPLATE(PTY_ITERATION, [How to iterate over PTYs.])
4044 dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
4045 dnl trying suffixes 0-16.
4046 AH_TEMPLATE(FIRST_PTY_LETTER, [Letter to use in finding device name of
4047 first PTY, if PTYs are supported.])
4048 AH_TEMPLATE(PTY_OPEN, [How to open a PTY, if non-standard.])
4049 AH_TEMPLATE(PTY_NAME_SPRINTF, [How to get the device name of the control
4050 end of a PTY, if non-standard.])
4051 AH_TEMPLATE(PTY_TTY_NAME_SPRINTF, [How to get device name of the tty
4052 end of a PTY, if non-standard.])
4053
4054 case $opsys in
4055 aix4-2 )
4056 AC_DEFINE(PTY_ITERATION, [int c; for (c = 0; !c ; c++)])
4057 dnl You allocate a pty by opening /dev/ptc to get the master side.
4058 dnl To get the name of the slave side, you just ttyname() the master side.
4059 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
4060 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));])
4061 ;;
4062
4063 cygwin )
4064 AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
4065 dnl multi-line AC_DEFINEs are hard. :(
4066 AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)])
4067 AC_DEFINE(PTY_NAME_SPRINTF, [])
4068 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
4069 ;;
4070
4071 dnl FIXME? Maybe use same as freebsd - see bug#12040.
4072 darwin )
4073 AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
4074 dnl Not used, because PTY_ITERATION is defined.
4075 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
4076 dnl Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
4077 dnl But we don't have to block SIGCHLD because it is blocked in the
4078 dnl implementation of grantpt.
4079 AC_DEFINE(PTY_OPEN, [ do { int slave; if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (0)])
4080 AC_DEFINE(PTY_NAME_SPRINTF, [])
4081 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
4082 ;;
4083
4084 gnu | openbsd )
4085 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
4086 ;;
4087
4088 gnu-linux | gnu-kfreebsd | dragonfly | freebsd | netbsd )
4089 dnl if HAVE_GRANTPT
4090 if test "x$ac_cv_func_grantpt" = xyes; then
4091 AC_DEFINE(UNIX98_PTYS, 1, [Define if the system has Unix98 PTYs.])
4092 AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
4093 dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD
4094 dnl to prevent sigchld_handler from intercepting the child's death.
4095 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
4096 dnl if HAVE_POSIX_OPENPT
4097 if test "x$ac_cv_func_posix_openpt" = xyes; then
4098 AC_DEFINE(PTY_OPEN, [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (0)])
4099 AC_DEFINE(PTY_NAME_SPRINTF, [])
4100 dnl if HAVE_GETPT
4101 elif test "x$ac_cv_func_getpt" = xyes; then
4102 AC_DEFINE(PTY_OPEN, [fd = getpt ()])
4103 AC_DEFINE(PTY_NAME_SPRINTF, [])
4104 else
4105 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
4106 fi
4107 else
4108 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
4109 fi
4110 ;;
4111
4112 hpux*)
4113 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
4114 AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])
4115 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])
4116 ;;
4117
4118 irix6-5 )
4119 dnl It looks like this cannot be right, because it is not a loop.
4120 dnl However, process.c actually does this:
4121 dnl # ifndef __sgi
4122 dnl continue;
4123 dnl # else
4124 dnl return -1;
4125 dnl # endif
4126 dnl which presumably makes it OK, since irix == sgi (?).
4127 dnl FIXME it seems like this special treatment is unnecessary?
4128 dnl Why can't irix use a single-trip loop like eg cygwin?
4129 AC_DEFINE(PTY_ITERATION, [])
4130 dnl Not used, because PTY_ITERATION is defined.
4131 AC_DEFINE(FIRST_PTY_LETTER, ['q'])
4132 AC_DEFINE(PTY_OPEN, [ { struct sigaction ocstat, cstat; struct stat stb; char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; cstat.sa_flags = 0; sigaction(SIGCHLD, &cstat, &ocstat); name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCHLD, &ocstat, (struct sigaction *)0); if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) return -1; strcpy (pty_name, name); }])
4133 dnl No need to get the pty name at all.
4134 AC_DEFINE(PTY_NAME_SPRINTF, [])
4135 dnl No need to use sprintf to get the tty name--we get that from _getpty.
4136 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
4137 ;;
4138
4139 sol2* )
4140 dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler()
4141 dnl from intercepting that death. If any child but grantpt's should die
4142 dnl within, it should be caught after sigrelse(2).
4143 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
4144 ;;
4145
4146 unixware )
4147 dnl Comments are as per sol2*.
4148 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
4149 ;;
4150 esac
4151
4152
4153 case $opsys in
4154 sol2* | unixware )
4155 dnl This change means that we don't loop through allocate_pty too
4156 dnl many times in the (rare) event of a failure.
4157 AC_DEFINE(FIRST_PTY_LETTER, ['z'])
4158 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
4159 dnl Push various streams modules onto a PTY channel. Used in process.c.
4160 AC_DEFINE(SETUP_SLAVE_PTY, [if (ioctl (xforkin, I_PUSH, "ptem") == -1) fatal ("ioctl I_PUSH ptem"); if (ioctl (xforkin, I_PUSH, "ldterm") == -1) fatal ("ioctl I_PUSH ldterm"); if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) fatal ("ioctl I_PUSH ttcompat");], [How to set up a slave PTY, if needed.])
4161 ;;
4162 esac
4163
4164
4165 AH_TEMPLATE(SIGNALS_VIA_CHARACTERS, [Make process_send_signal work by
4166 "typing" a signal character on the pty.])
4167
4168 case $opsys in
4169 dnl Perry Smith <pedz@ddivt1.austin.ibm.com> says this is correct for AIX.
4170 dnl thomas@mathematik.uni-bremen.de says this is needed for IRIX.
4171 aix4-2 | cygwin | gnu | irix6-5 | dragonfly | freebsd | netbsd | openbsd | darwin )
4172 AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
4173 ;;
4174
4175 dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.
4176 dnl FIXME Does gnu-kfreebsd have linux/version.h? It seems unlikely...
4177 gnu-linux | gnu-kfreebsd )
4178
4179 AC_MSG_CHECKING([for signals via characters])
4180 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
4181 #include <linux/version.h>
4182 #if LINUX_VERSION_CODE < 0x20400
4183 # error "Linux version too old"
4184 #endif
4185 ]], [[]])], emacs_signals_via_chars=yes, emacs_signals_via_chars=no)
4186
4187 AC_MSG_RESULT([$emacs_signals_via_chars])
4188 test $emacs_signals_via_chars = yes && AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
4189 ;;
4190 esac
4191
4192
4193 dnl Used in lisp.h, emacs.c, vm-limit.c
4194 dnl NEWS.18 describes this as "a number which contains
4195 dnl the high bits to be inclusive or'ed with pointers that are unpacked."
4196 AH_TEMPLATE(DATA_SEG_BITS, [Extra bits to be or'd in with any pointers
4197 stored in a Lisp_Object.])
4198 dnl if Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT.
4199
4200 case $opsys in
4201 aix*)
4202 dnl This works with 32-bit executables; Emacs doesn't support 64-bit.
4203 AC_DEFINE(DATA_SEG_BITS, [0x20000000])
4204 ;;
4205 hpux*)
4206 dnl The data segment on this machine always starts at address 0x40000000.
4207 AC_DEFINE(DATA_SEG_BITS, [0x40000000])
4208 ;;
4209 irix6-5)
4210 AC_DEFINE(DATA_SEG_BITS, [0x10000000])
4211 ;;
4212 esac
4213
4214
4215 AH_TEMPLATE(TAB3, [Undocumented.])
4216
4217 case $opsys in
4218 darwin) AC_DEFINE(TAB3, OXTABS) ;;
4219
4220 gnu | dragonfly | freebsd | netbsd | openbsd )
4221 AC_DEFINE(TABDLY, OXTABS, [Undocumented.])
4222 AC_DEFINE(TAB3, OXTABS)
4223 ;;
4224
4225 gnu-linux | gnu-kfreebsd )
4226 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
4227 #ifndef __ia64__
4228 # error "not ia64"
4229 #endif
4230 ]], [[]])], AC_DEFINE(GC_MARK_SECONDARY_STACK(),
4231 [do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (0)],
4232 [Mark a secondary stack, like the register stack on the ia64.]), [])
4233 ;;
4234
4235 hpux*)
4236 AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call
4237 run_time_remap; for HPUX.])
4238 ;;
4239 esac
4240
4241
4242 dnl This won't be used automatically yet. We also need to know, at least,
4243 dnl that the stack is continuous.
4244 AH_TEMPLATE(GC_SETJMP_WORKS, [Define if setjmp is known to save all
4245 registers relevant for conservative garbage collection in the jmp_buf.])
4246
4247
4248 case $opsys in
4249 dnl Not all the architectures are tested, but there are Debian packages
4250 dnl for SCM and/or Guile on them, so the technique must work. See also
4251 dnl comments in alloc.c concerning setjmp and gcc.
4252 dnl Fixme: it's probably safe to just use the GCC conditional below.
4253 gnu-linux | gnu-kfreebsd )
4254 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
4255 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
4256 || defined __alpha__ || defined __mips__ || defined __s390__ \
4257 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
4258 || defined __ia64__ || defined __sh__
4259 /* ok */
4260 #else
4261 # error "setjmp not known to work on this arch"
4262 #endif
4263 ]], [[]])], AC_DEFINE(GC_SETJMP_WORKS, 1))
4264 ;;
4265 esac
4266
4267
4268 if test x$GCC = xyes; then
4269 dnl GC_SETJMP_WORKS is nearly always appropriate for GCC.
4270 AC_DEFINE(GC_SETJMP_WORKS, 1)
4271 else
4272 case $opsys in
4273 dnl irix: Tested on Irix 6.5. SCM worked on earlier versions.
4274 dragonfly | freebsd | netbsd | openbsd | irix6-5 | sol2* )
4275 AC_DEFINE(GC_SETJMP_WORKS, 1)
4276 ;;
4277 esac
4278 fi dnl GCC?
4279
4280 dnl In a weird quirk, MS runtime uses _setjmp and longjmp.
4281 AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
4282 [AC_LINK_IFELSE(
4283 [AC_LANG_PROGRAM(
4284 [[#include <setjmp.h>
4285 #ifdef __MINGW32__
4286 # define _longjmp longjmp
4287 #endif
4288 ]],
4289 [[jmp_buf j;
4290 if (! _setjmp (j))
4291 _longjmp (j, 1);]])],
4292 [emacs_cv_func__setjmp=yes],
4293 [emacs_cv_func__setjmp=no])])
4294 if test $emacs_cv_func__setjmp = yes; then
4295 AC_DEFINE([HAVE__SETJMP], 1, [Define to 1 if _setjmp and _longjmp work.])
4296 else
4297 AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp],
4298 [AC_LINK_IFELSE(
4299 [AC_LANG_PROGRAM(
4300 [[#include <setjmp.h>
4301 ]],
4302 [[sigjmp_buf j;
4303 if (! sigsetjmp (j, 1))
4304 siglongjmp (j, 1);]])],
4305 [emacs_cv_func_sigsetjmp=yes],
4306 [emacs_cv_func_sigsetjmp=no])])
4307 if test $emacs_cv_func_sigsetjmp = yes; then
4308 AC_DEFINE([HAVE_SIGSETJMP], 1,
4309 [Define to 1 if sigsetjmp and siglongjmp work.
4310 The value of this symbol is irrelevant if HAVE__SETJMP is defined.])
4311 fi
4312 fi
4313
4314 case $opsys in
4315 sol2* | unixware )
4316 dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
4317 dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs,
4318 dnl and this is all we need.
4319 AC_DEFINE(TIOCSIGSEND, TIOCSIGNAL, [Some platforms redefine this.])
4320 ;;
4321 esac
4322
4323
4324 case $opsys in
4325 hpux* | sol2* )
4326 dnl Used in xfaces.c.
4327 AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on
4328 some systems, where it requires time.h.])
4329 ;;
4330 esac
4331
4332
4333 dnl Define symbols to identify the version of Unix this is.
4334 dnl Define all the symbols that apply correctly.
4335 AH_TEMPLATE(DOS_NT, [Define if the system is MS DOS or MS Windows.])
4336 AH_TEMPLATE(MSDOS, [Define if the system is MS DOS.])
4337 AH_TEMPLATE(USG, [Define if the system is compatible with System III.])
4338 AH_TEMPLATE(USG5_4, [Define if the system is compatible with System V Release 4.])
4339
4340 case $opsys in
4341 aix4-2)
4342 AC_DEFINE(USG, [])
4343 dnl This symbol should be defined on AIX Version 3 ???????
4344 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
4345 #ifndef _AIX
4346 # error "_AIX not defined"
4347 #endif
4348 ]], [[]])], [], AC_DEFINE(_AIX, [], [Define if the system is AIX.]))
4349 ;;
4350
4351 cygwin)
4352 AC_DEFINE(CYGWIN, 1, [Define if the system is Cygwin.])
4353 ;;
4354
4355 darwin)
4356 dnl Not __APPLE__, as this may not be defined on non-OSX Darwin.
4357 dnl Not DARWIN, because Panther and lower CoreFoundation.h use DARWIN to
4358 dnl distinguish OS X from pure Darwin.
4359 AC_DEFINE(DARWIN_OS, [], [Define if the system is Darwin.])
4360 ;;
4361
4362 gnu-linux | gnu-kfreebsd )
4363 AC_DEFINE(USG, [])
4364 AC_DEFINE(GNU_LINUX, [], [Define if ths system is compatible with GNU/Linux.])
4365 ;;
4366
4367 hpux*)
4368 AC_DEFINE(USG, [])
4369 AC_DEFINE(HPUX, [], [Define if the system is HPUX.])
4370 ;;
4371
4372 irix6-5)
4373 AC_DEFINE(USG, [])
4374 AC_DEFINE(USG5_4, [])
4375 AC_DEFINE(IRIX6_5, [], [Define if the system is IRIX.])
4376 ;;
4377
4378 mingw32)
4379 AC_DEFINE(DOS_NT, [])
4380 AC_DEFINE(WINDOWSNT, 1, [Define if compiling for native MS Windows.])
4381 if test "x$ac_enable_checking" != "x" ; then
4382 AC_DEFINE(EMACSDEBUG, 1, [Define to 1 to enable w32 debug facilities.])
4383 fi
4384 ;;
4385
4386 sol2*)
4387 AC_DEFINE(USG, [])
4388 AC_DEFINE(USG5_4, [])
4389 AC_DEFINE(SOLARIS2, [], [Define if the system is Solaris.])
4390 ;;
4391
4392 unixware)
4393 AC_DEFINE(USG, [])
4394 AC_DEFINE(USG5_4, [])
4395 ;;
4396 esac
4397
4398 AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
4399 [case $opsys in
4400 aix4-2)
4401 dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
4402 emacs_cv_usable_FIONREAD=no
4403 ;;
4404
4405 mingw32)
4406 emacs_cv_usable_FIONREAD=yes
4407 ;;
4408
4409 *)
4410 AC_COMPILE_IFELSE(
4411 [AC_LANG_PROGRAM([[#include <sys/types.h>
4412 #include <sys/ioctl.h>
4413 #ifdef USG5_4
4414 # include <sys/filio.h>
4415 #endif
4416 ]],
4417 [[int foo = ioctl (0, FIONREAD, &foo);]])],
4418 [emacs_cv_usable_FIONREAD=yes],
4419 [emacs_cv_usable_FIONREAD=no])
4420 ;;
4421 esac])
4422 if test $emacs_cv_usable_FIONREAD = yes; then
4423 AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.])
4424
4425 if test $emacs_broken_SIGIO = no; then
4426 AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO],
4427 [AC_COMPILE_IFELSE(
4428 [AC_LANG_PROGRAM([[#include <fcntl.h>
4429 #include <signal.h>
4430 ]],
4431 [[int foo = SIGIO | F_SETFL | FASYNC;]])],
4432 [emacs_cv_usable_SIGIO=yes],
4433 [emacs_cv_usable_SIGIO=no])],
4434 [emacs_cv_usable_SIGIO=yes],
4435 [emacs_cv_usable_SIGIO=no])
4436 if test $emacs_cv_usable_SIGIO = yes; then
4437 AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.])
4438 fi
4439 fi
4440 fi
4441
4442
4443 case $opsys in
4444 dnl Emacs supplies its own malloc, but glib calls posix_memalign,
4445 dnl and on Cygwin prior to version 1.7.24 that becomes the
4446 dnl Cygwin-supplied posix_memalign. As malloc is not the Cygwin
4447 dnl malloc, the Cygwin posix_memalign always returns ENOSYS. A
4448 dnl workaround is to set G_SLICE=always-malloc. This is no longer
4449 dnl needed starting with cygwin-1.7.24, and it is no longer
4450 dnl effective starting with glib-2.36. */
4451 cygwin)
4452 AC_DEFINE(G_SLICE_ALWAYS_MALLOC, 1, [Define to set the
4453 G_SLICE environment variable to "always-malloc" at startup.])
4454 ;;
4455
4456 hpux11)
4457 dnl It works to open the pty's tty in the parent (Emacs), then
4458 dnl close and reopen it in the child.
4459 AC_DEFINE(USG_SUBTTY_WORKS, 1, [Define for USG systems where it
4460 works to open a pty's tty in the parent process, then close and
4461 reopen it in the child.])
4462 ;;
4463
4464 irix6-5)
4465 AC_DEFINE(PREFER_VSUSP, 1, [Define if process_send_signal should
4466 use VSUSP instead of VSWTCH.])
4467 ;;
4468
4469 sol2-10)
4470 AC_DEFINE(_STRUCTURED_PROC, 1, [Needed for system_process_attributes
4471 on Solaris.])
4472 ;;
4473 esac
4474
4475 # Set up the CFLAGS for real compilation, so we can substitute it.
4476 CFLAGS="$REAL_CFLAGS"
4477 CPPFLAGS="$REAL_CPPFLAGS"
4478
4479 ## Hack to detect a buggy GCC version.
4480 if test "x$GCC" = xyes \
4481 && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \
4482 && test x"`echo $CFLAGS | grep '\-O@<:@23@:>@'`" != x \
4483 && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then
4484 AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'.])
4485 fi
4486
4487 version=$PACKAGE_VERSION
4488
4489 copyright="Copyright (C) 2013 Free Software Foundation, Inc."
4490 AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"],
4491 [Short copyright string for this version of Emacs.])
4492 AC_SUBST(copyright)
4493
4494 ### Specify what sort of things we'll be editing into Makefile and config.h.
4495 ### Use configuration here uncanonicalized to avoid exceeding size limits.
4496 AC_SUBST(version)
4497 AC_SUBST(configuration)
4498 ## Unused?
4499 AC_SUBST(canonical)
4500 AC_SUBST(srcdir)
4501 AC_SUBST(prefix)
4502 AC_SUBST(exec_prefix)
4503 AC_SUBST(bindir)
4504 AC_SUBST(datadir)
4505 AC_SUBST(sharedstatedir)
4506 AC_SUBST(libexecdir)
4507 AC_SUBST(mandir)
4508 AC_SUBST(infodir)
4509 AC_SUBST(lispdir)
4510 AC_SUBST(leimdir)
4511 AC_SUBST(standardlisppath)
4512 AC_SUBST(locallisppath)
4513 AC_SUBST(lisppath)
4514 AC_SUBST(x_default_search_path)
4515 AC_SUBST(etcdir)
4516 AC_SUBST(archlibdir)
4517 AC_SUBST(etcdocdir)
4518 AC_SUBST(bitmapdir)
4519 AC_SUBST(gamedir)
4520 AC_SUBST(gameuser)
4521 ## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
4522 ## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
4523 ## end of LIBX_BASE, but nothing ever set it.
4524 AC_SUBST(LD_SWITCH_X_SITE)
4525 AC_SUBST(C_SWITCH_X_SITE)
4526 AC_SUBST(GNUSTEP_CFLAGS)
4527 AC_SUBST(CFLAGS)
4528 ## Used in lwlib/Makefile.in.
4529 AC_SUBST(X_TOOLKIT_TYPE)
4530 AC_SUBST(ns_appdir)
4531 AC_SUBST(ns_appbindir)
4532 AC_SUBST(ns_appresdir)
4533 AC_SUBST(ns_appsrc)
4534 AC_SUBST(GNU_OBJC_CFLAGS)
4535 AC_SUBST(OTHER_FILES)
4536
4537 if test -n "${term_header}"; then
4538 AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}",
4539 [Define to the header for the built-in window system.])
4540 fi
4541
4542 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
4543 [Define to the canonical Emacs configuration name.])
4544 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}",
4545 [Define to the options passed to configure.])
4546 AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure
4547 define this to include extra configuration information.])
4548
4549 case $opsys in
4550 mingw32)
4551 AC_DEFINE(config_opsysfile, <ms-w32.h>, [])
4552 ;;
4553 esac
4554
4555 XMENU_OBJ=
4556 XOBJ=
4557 FONT_OBJ=
4558 if test "${HAVE_X_WINDOWS}" = "yes" ; then
4559 AC_DEFINE(HAVE_X_WINDOWS, 1,
4560 [Define to 1 if you want to use the X window system.])
4561 XMENU_OBJ=xmenu.o
4562 XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o"
4563 FONT_OBJ=xfont.o
4564 if test "$HAVE_XFT" = "yes"; then
4565 FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
4566 elif test "$HAVE_FREETYPE" = "yes"; then
4567 FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
4568 fi
4569 AC_SUBST(FONT_OBJ)
4570 fi
4571 AC_SUBST(XMENU_OBJ)
4572 AC_SUBST(XOBJ)
4573 AC_SUBST(FONT_OBJ)
4574
4575 WIDGET_OBJ=
4576 MOTIF_LIBW=
4577 if test "${USE_X_TOOLKIT}" != "none" ; then
4578 WIDGET_OBJ=widget.o
4579 AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
4580 if test "${USE_X_TOOLKIT}" = "LUCID"; then
4581 AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.])
4582 elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
4583 AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.])
4584 MOTIF_LIBW=-lXm
4585 case "$opsys" in
4586 gnu-linux)
4587 ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
4588 MOTIF_LIBW="$MOTIF_LIBW -lXpm"
4589 ;;
4590
4591 unixware)
4592 ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
4593 ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
4594 MOTIF_LIBW="MOTIF_LIBW -lXimp"
4595 ;;
4596
4597 aix4-2)
4598 ## olson@mcs.anl.gov says -li18n is needed by -lXm.
4599 MOTIF_LIBW="$MOTIF_LIBW -li18n"
4600 ;;
4601 esac
4602 MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
4603 fi
4604 fi
4605 AC_SUBST(WIDGET_OBJ)
4606
4607 TOOLKIT_LIBW=
4608 case "$USE_X_TOOLKIT" in
4609 MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
4610 LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
4611 none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
4612 esac
4613 AC_SUBST(TOOLKIT_LIBW)
4614
4615 if test "${opsys}" != "mingw32"; then
4616 if test "$USE_X_TOOLKIT" = "none"; then
4617 LIBXT_OTHER="\$(LIBXSM)"
4618 OLDXMENU_TARGET="really-oldXMenu"
4619 else
4620 LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
4621 OLDXMENU_TARGET="really-lwlib"
4622 fi
4623 fi
4624 AC_SUBST(LIBXT_OTHER)
4625
4626 ## The X Menu stuff is present in the X10 distribution, but missing
4627 ## from X11. If we have X10, just use the installed library;
4628 ## otherwise, use our own copy.
4629 if test "${HAVE_X11}" = "yes" ; then
4630 AC_DEFINE(HAVE_X11, 1,
4631 [Define to 1 if you want to use version 11 of X windows.
4632 Otherwise, Emacs expects to use version 10.])
4633
4634 if test "$USE_X_TOOLKIT" = "none"; then
4635 OLDXMENU="\${oldXMenudir}/libXMenu11.a"
4636 else
4637 OLDXMENU="\${lwlibdir}/liblw.a"
4638 fi
4639 LIBXMENU="\$(OLDXMENU)"
4640 LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
4641 OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
4642 else
4643 ## For a syntactically valid Makefile; not actually used for anything.
4644 ## See comments in src/Makefile.in.
4645 OLDXMENU=nothing
4646 ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
4647 if test "${HAVE_X_WINDOWS}" = "yes"; then
4648 LIBXMENU="-lXMenu"
4649 else
4650 LIBXMENU=
4651 fi
4652 LIBX_OTHER=
4653 OLDXMENU_DEPS=
4654 fi
4655
4656 if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
4657 OLDXMENU_TARGET=
4658 OLDXMENU=nothing
4659 LIBXMENU=
4660 OLDXMENU_DEPS=
4661 fi
4662
4663 AC_SUBST(OLDXMENU_TARGET)
4664 AC_SUBST(OLDXMENU)
4665 AC_SUBST(LIBXMENU)
4666 AC_SUBST(LIBX_OTHER)
4667 AC_SUBST(OLDXMENU_DEPS)
4668
4669 if test "${HAVE_MENUS}" = "yes" ; then
4670 AC_DEFINE(HAVE_MENUS, 1,
4671 [Define to 1 if you have mouse menus. (This is supported in all configurations, but the option to specify it remains.)])
4672 fi
4673
4674 if test "${GNU_MALLOC}" = "yes" ; then
4675 AC_DEFINE(GNU_MALLOC, 1,
4676 [Define to 1 if you want to use the GNU memory allocator.])
4677 fi
4678
4679 RALLOC_OBJ=
4680 if test "${REL_ALLOC}" = "yes" ; then
4681 AC_DEFINE(REL_ALLOC, 1,
4682 [Define REL_ALLOC if you want to use the relocating allocator for
4683 buffer space.])
4684
4685 test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
4686 fi
4687 AC_SUBST(RALLOC_OBJ)
4688
4689 if test "$opsys" = "cygwin"; then
4690 CYGWIN_OBJ="sheap.o cygw32.o"
4691 ## Cygwin differs because of its unexec().
4692 PRE_ALLOC_OBJ=
4693 POST_ALLOC_OBJ=lastfile.o
4694 elif test "$opsys" = "mingw32"; then
4695 CYGWIN_OBJ=
4696 PRE_ALLOC_OBJ=
4697 POST_ALLOC_OBJ=lastfile.o
4698 else
4699 CYGWIN_OBJ=
4700 PRE_ALLOC_OBJ=lastfile.o
4701 POST_ALLOC_OBJ=
4702 fi
4703 AC_SUBST(CYGWIN_OBJ)
4704 AC_SUBST(PRE_ALLOC_OBJ)
4705 AC_SUBST(POST_ALLOC_OBJ)
4706
4707 dnl Call this 'FORTIFY_SOUR' so that it sorts before the 'FORTIFY_SOURCE'
4708 dnl verbatim defined above. The tricky name is apropos, as this hack
4709 dnl makes Fortify go sour!
4710 AH_VERBATIM([FORTIFY_SOUR],
4711 [/* Without the following workaround, Emacs runs slowly on OS X 10.8.
4712 The workaround disables some useful run-time checking, so it
4713 should be conditional to the platforms with the performance bug.
4714 Perhaps Apple will fix this some day; also see m4/extern-inline.m4. */
4715 #if defined __APPLE__ && defined __GNUC__
4716 # ifndef _DONT_USE_CTYPE_INLINE_
4717 # define _DONT_USE_CTYPE_INLINE_
4718 # endif
4719 # ifndef _FORTIFY_SOURCE
4720 # define _FORTIFY_SOURCE 0
4721 # endif
4722 #endif
4723 ])
4724
4725 # Configure gnulib. Although this does not affect CFLAGS or LIBS permanently.
4726 # it temporarily reverts them to their pre-pkg-config values,
4727 # because gnulib needs to work with both src (which uses the
4728 # pkg-config stuff) and lib-src (which does not). For example, gnulib
4729 # may need to determine whether LIB_CLOCK_GETTIME should contain -lrt,
4730 # and it therefore needs to run in an environment where LIBS does not
4731 # already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
4732 # for some package unrelated to lib-src.
4733 SAVE_CFLAGS=$CFLAGS
4734 SAVE_LIBS=$LIBS
4735 CFLAGS=$pre_PKG_CONFIG_CFLAGS
4736 LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
4737 gl_ASSERT_NO_GNULIB_POSIXCHECK
4738 gl_ASSERT_NO_GNULIB_TESTS
4739 gl_INIT
4740 CFLAGS=$SAVE_CFLAGS
4741 LIBS=$SAVE_LIBS
4742
4743 if test "${opsys}" = "mingw32"; then
4744 CPPFLAGS="$CPPFLAGS -DUSE_CRT_DLL=1 -I \${abs_top_srcdir}/nt/inc"
4745 # Remove unneeded switches from the value of CC that goes to Makefiles
4746 CC=`echo $CC | sed -e "s,$GCC_TEST_OPTIONS,,"`
4747 fi
4748
4749 case "$opsys" in
4750 aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
4751
4752 darwin)
4753 ## The -headerpad option tells ld (see man page) to leave room at the
4754 ## end of the header for adding load commands. Needed for dumping.
4755 ## 0x690 is the total size of 30 segment load commands (at 56
4756 ## each); under Cocoa 31 commands are required.
4757 if test "$HAVE_NS" = "yes"; then
4758 libs_nsgui="-framework AppKit"
4759 if test "$NS_IMPL_COCOA" = "yes"; then
4760 libs_nsgui="$libs_nsgui -framework IOKit"
4761 fi
4762 headerpad_extra=6C8
4763 else
4764 libs_nsgui=
4765 headerpad_extra=690
4766 fi
4767 LD_SWITCH_SYSTEM_TEMACS="-fno-pie -prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra"
4768
4769 ## This is here because src/Makefile.in did some extra fiddling around
4770 ## with LD_SWITCH_SYSTEM. It seems cleaner to put this in
4771 ## LD_SWITCH_SYSTEM_TEMACS instead,
4772 test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
4773 LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
4774 ;;
4775
4776 ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
4777 ## find X at run-time.
4778 ## When handled by cpp, this was in LD_SWITCH_SYSTEM. However, at the
4779 ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
4780 ## had not yet been defined and was expanded to null. Hence LD_SWITCH_SYSTEM
4781 ## had different values in configure (in ac_link) and src/Makefile.in.
4782 ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
4783 gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
4784
4785 mingw32)
4786 ## MinGW64 does not prepend an underscore to symbols, so we must
4787 ## pass a different -entry switch to linker. FIXME: It is better
4788 ## to make the entry points the same by changing unexw32.c.
4789 case "$canonical" in
4790 x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,_start -Wl,-Map,./temacs.map" ;;
4791 *) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
4792 esac
4793 ;;
4794
4795 openbsd) LD_SWITCH_SYSTEM_TEMACS='-nopie' ;;
4796
4797 *) LD_SWITCH_SYSTEM_TEMACS= ;;
4798 esac
4799
4800 if test x$ac_enable_profiling != x ; then
4801 case $opsys in
4802 *freebsd | gnu-linux) ;;
4803 *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -pg" ;;
4804 esac
4805 fi
4806
4807 LD_SWITCH_SYSTEM_TEMACS="$LDFLAGS_NOCOMBRELOC $LD_SWITCH_SYSTEM_TEMACS"
4808
4809 AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
4810
4811 ## MinGW-specific post-link processing of temacs.
4812 TEMACS_POST_LINK=":"
4813 ADDSECTION=
4814 EMACS_HEAPSIZE=
4815 if test "${opsys}" = "mingw32"; then
4816 TEMACS_POST_LINK="\$(MINGW_TEMACS_POST_LINK)"
4817 ADDSECTION="../nt/addsection\$(EXEEXT)"
4818 ## Preload heap size of temacs.exe in MB.
4819 case "$canonical" in
4820 x86_64-*-*) EMACS_HEAPSIZE=42 ;;
4821 *) EMACS_HEAPSIZE=27 ;;
4822 esac
4823 fi
4824
4825 AC_SUBST(ADDSECTION)
4826 AC_SUBST(TEMACS_POST_LINK)
4827 AC_SUBST(EMACS_HEAPSIZE)
4828
4829 ## Common for all window systems
4830 if test "$window_system" != "none"; then
4831 AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
4832 WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o"
4833 fi
4834
4835 AC_SUBST(WINDOW_SYSTEM_OBJ)
4836
4837 AH_TOP([/* GNU Emacs site configuration template file.
4838
4839 Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2013
4840 Free Software Foundation, Inc.
4841
4842 This file is part of GNU Emacs.
4843
4844 GNU Emacs is free software: you can redistribute it and/or modify
4845 it under the terms of the GNU General Public License as published by
4846 the Free Software Foundation, either version 3 of the License, or
4847 (at your option) any later version.
4848
4849 GNU Emacs is distributed in the hope that it will be useful,
4850 but WITHOUT ANY WARRANTY; without even the implied warranty of
4851 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4852 GNU General Public License for more details.
4853
4854 You should have received a copy of the GNU General Public License
4855 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
4856
4857
4858 /* No code in Emacs #includes config.h twice, but some bits of code
4859 intended to work with other packages as well (like gmalloc.c)
4860 think they can include it as many times as they like. */
4861 #ifndef EMACS_CONFIG_H
4862 #define EMACS_CONFIG_H
4863 ])dnl
4864
4865 AH_BOTTOM([#include <conf_post.h>
4866
4867 #endif /* EMACS_CONFIG_H */
4868
4869 /*
4870 Local Variables:
4871 mode: c
4872 End:
4873 */
4874 ])dnl
4875
4876 #### Report on what we decided to do.
4877 #### Report GTK as a toolkit, even if it doesn't use Xt.
4878 #### It makes printing result more understandable as using GTK sets
4879 #### toolkit_scroll_bars to yes by default.
4880 if test "${HAVE_GTK}" = "yes"; then
4881 USE_X_TOOLKIT="$USE_GTK_TOOLKIT"
4882 fi
4883
4884 if test $USE_ACL -ne 0; then
4885 acl_summary="yes $LIB_ACL"
4886 else
4887 acl_summary=no
4888 fi
4889
4890 echo "
4891 Configured for \`${canonical}'.
4892
4893 Where should the build process find the source code? ${srcdir}
4894 What compiler should emacs be built with? ${CC} ${CFLAGS}
4895 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
4896 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
4897 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
4898 What window system should Emacs use? ${window_system}
4899 What toolkit should Emacs use? ${USE_X_TOOLKIT}"
4900
4901 if test -n "${x_includes}"; then
4902 echo " Where do we find X Windows header files? ${x_includes}"
4903 else
4904 echo " Where do we find X Windows header files? Standard dirs"
4905 fi
4906 if test -n "${x_libraries}"; then
4907 echo " Where do we find X Windows libraries? ${x_libraries}"
4908 else
4909 echo " Where do we find X Windows libraries? Standard dirs"
4910 fi
4911
4912 echo " Does Emacs use -lXaw3d? ${HAVE_XAW3D}"
4913 echo " Does Emacs use -lXpm? ${HAVE_XPM}"
4914 echo " Does Emacs use -ljpeg? ${HAVE_JPEG}"
4915 echo " Does Emacs use -ltiff? ${HAVE_TIFF}"
4916 echo " Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF"
4917 echo " Does Emacs use -lpng? ${HAVE_PNG}"
4918 echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
4919 echo " Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}"
4920
4921 echo " Does Emacs support sound? ${HAVE_SOUND}"
4922
4923 echo " Does Emacs use -lgpm? ${HAVE_GPM}"
4924 echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
4925 echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
4926 echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}"
4927 echo " Does Emacs use a file notification library? ${NOTIFY_SUMMARY}"
4928 echo " Does Emacs use access control lists? ${acl_summary}"
4929 echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
4930 echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
4931 echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
4932
4933 echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
4934 echo " Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}"
4935 echo " Does Emacs use -lotf? ${HAVE_LIBOTF}"
4936 echo " Does Emacs use -lxft? ${HAVE_XFT}"
4937 echo " Does Emacs directly use zlib? ${HAVE_ZLIB}"
4938
4939 echo " Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
4940 echo
4941
4942 if test -n "${EMACSDATA}"; then
4943 echo " Environment variable EMACSDATA set to: $EMACSDATA"
4944 fi
4945 if test -n "${EMACSDOC}"; then
4946 echo " Environment variable EMACSDOC set to: $EMACSDOC"
4947 fi
4948
4949 echo
4950
4951 if test "$HAVE_NS" = "yes"; then
4952 echo
4953 echo "You must run \"${MAKE-make} install\" in order to test the built application.
4954 The installed application will go to nextstep/Emacs.app and can be
4955 run or moved from there."
4956 if test "$EN_NS_SELF_CONTAINED" = "yes"; then
4957 echo "The application will be fully self-contained."
4958 else
4959 echo "The lisp resources for the application will be installed under ${prefix}.
4960 You may need to run \"${MAKE-make} install\" with sudo. The application will fail
4961 to run if these resources are not installed."
4962 fi
4963 echo
4964 fi
4965
4966 if test "${opsys}" = "cygwin"; then
4967 case `uname -r` in
4968 1.5.*) AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]])
4969 echo
4970 ;;
4971 esac
4972 fi
4973
4974 # Remove any trailing slashes in these variables.
4975 [test "${prefix}" != NONE &&
4976 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
4977 test "${exec_prefix}" != NONE &&
4978 exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
4979
4980 if test "$HAVE_NS" = "yes"; then
4981 if test "$NS_IMPL_GNUSTEP" = yes; then
4982 AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \
4983 nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in])
4984 ns_check_file=Resources/Info-gnustep.plist
4985 else
4986 AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \
4987 nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in])
4988 ns_check_file=Contents/Info.plist
4989 fi
4990 AC_SUBST(ns_check_file)
4991 fi
4992
4993 dnl Obviously there is duplication here wrt $SUBDIR_MAKEFILES.
4994 dnl You _can_ use that variable in AC_CONFIG_FILES, so long as any directory
4995 dnl using automake (ie lib/) is explicitly listed and not "hidden" in a variable
4996 dnl (else you get "no `Makefile.am' found for any configure output").
4997 dnl This will work, but you get a config.status that is not quite right
4998 dnl (see http://lists.gnu.org/archive/html/bug-autoconf/2008-08/msg00028.html).
4999 dnl That doesn't have any obvious consequences for Emacs, but on the whole
5000 dnl it seems better to just live with the duplication.
5001 SUBDIR_MAKEFILES="lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile nextstep/Makefile nt/Makefile"
5002
5003 AC_CONFIG_FILES([Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile \
5004 doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
5005 doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile \
5006 leim/Makefile nextstep/Makefile nt/Makefile])
5007
5008 dnl test/ is not present in release tarfiles.
5009 opt_makefile=test/automated/Makefile
5010
5011 if test -f "$srcdir/$opt_makefile.in"; then
5012 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
5013 dnl Again, it's best not to use a variable. Though you can add
5014 dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
5015 AC_CONFIG_FILES([test/automated/Makefile])
5016 fi
5017
5018
5019 dnl admin/ may or may not be present.
5020 opt_makefile=admin/unidata/Makefile
5021
5022 if test -f "$srcdir/$opt_makefile.in"; then
5023 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
5024 AC_CONFIG_FILES([admin/unidata/Makefile])
5025 fi
5026
5027
5028 SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
5029
5030 AC_SUBST(SUBDIR_MAKEFILES_IN)
5031
5032 dnl You might wonder (I did) why epaths.h is generated by running make,
5033 dnl rather than just letting configure generate it from epaths.in.
5034 dnl One reason is that the various paths are not fully expanded (see above);
5035 dnl eg gamedir=${prefix}/var/games/emacs.
5036 dnl Secondly, the GNU Coding standards require that one should be able
5037 dnl to run `make prefix=/some/where/else' and override the values set
5038 dnl by configure. This also explains the `move-if-change' test and
5039 dnl the use of force in the `epaths-force' rule in Makefile.in.
5040 AC_CONFIG_COMMANDS([src/epaths.h], [
5041 if test "${opsys}" = "mingw32"; then
5042 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force-w32
5043 else
5044 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
5045 fi
5046 ], [GCC="$GCC" CPPFLAGS="$CPPFLAGS" opsys="$opsys"])
5047
5048 dnl NB we have to cheat and use the ac_... version because abs_top_srcdir
5049 dnl is not yet set, sigh. Or we could use ../$srcdir/src/.gdbinit,
5050 dnl or a symlink?
5051 AC_CONFIG_COMMANDS([src/.gdbinit], [
5052 if test ! -f src/.gdbinit && test -f "$srcdir/src/.gdbinit"; then
5053 echo "source $ac_abs_top_srcdir/src/.gdbinit" > src/.gdbinit
5054 fi
5055 ])
5056
5057 AC_OUTPUT