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