1 dnl Autoconf script for GNU Emacs
2 dnl To rebuild the 'configure' script from this, execute the command
4 dnl in the directory containing this script.
5 dnl If you changed any AC_DEFINES, also run autoheader.
7 dnl Copyright (C) 1994-1996, 1999-2021 Free Software Foundation, Inc.
9 dnl This file is part of GNU Emacs.
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.
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.
21 dnl You should have received a copy of the GNU General Public License
22 dnl along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
25 dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el.
26 AC_INIT(GNU Emacs, 28.0.50, bug-gnu-emacs@gnu.org, , https://www.gnu.org/software/emacs/)
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.
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 "$@" CFLAGS CPPFLAGS LDFLAGS; do
38 -n | --no-create | --no-recursion)
40 CFLAGS | CPPFLAGS | LDFLAGS)
41 eval 'test "${'$opt'+set}" = set' || continue
43 *" $opt="*) continue ;;
45 eval opt=$opt=\$$opt ;;
48 emacs_shell_specials=$IFS\''"#$&()*;<>?@<:@\\`{|~'
50 *[["$emacs_shell_specials"]]*)
53 emacs_quote_apostrophes="s/'/'\\\\''/g"
54 opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_apostrophes"` ;;
59 emacs_quote_for_c='s/[["\\]]/\\&/g; $!s/$/\\n\\/'
60 opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_for_c"` ;;
63 AS_VAR_APPEND([emacs_config_options], ["$optsep$opt"])
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 AC_CONFIG_MACRO_DIR(m4)
73 AC_CHECK_PROGS(XCRUN, [xcrun])
74 if test -n "$XCRUN"; then
75 if test -z "$MAKE"; then
76 dnl Call the variable MAKE_PROG, not MAKE, to avoid confusion with
77 dnl the usual MAKE variable that 'make' itself uses.
78 AC_CHECK_PROG([MAKE_PROG], [make], [yes])
79 if test -z "$MAKE_PROG"; then
82 xcsdkdir=`$XCRUN --show-sdk-path 2>/dev/null`
87 dnl Check for GNU Make and possibly set MAKE.
88 [emacs_check_gnu_make ()
90 emacs_makeout=`($1 --version) 2>/dev/null` &&
91 case $emacs_makeout in
92 'GNU Make '3.8[1-9]* | 'GNU Make '3.9[0-9]* | \
93 'GNU Make '3.[1-9][0-9][0-9]* | 'GNU Make '[4-9]* | 'GNU Make '[1-9][0-9]* )
94 ac_path_MAKE_found=:;;
97 AC_CACHE_CHECK([for GNU Make], [ac_cv_path_MAKE],
98 [ac_path_MAKE_found=false
99 if test -n "$MAKE"; then
100 emacs_check_gnu_make "$MAKE"
101 ac_cv_path_MAKE=$MAKE
103 emacs_tried_make=false
104 emacs_tried_gmake=false
105 emacs_tried_gnumake=false
106 AC_PATH_PROGS_FEATURE_CHECK([MAKE], [make gmake gnumake],
107 [[emacs_check_gnu_make "$ac_path_MAKE"
108 if $ac_path_MAKE_found; then
109 # Use the fully-qualified program name only if the basename
110 # would not resolve to it.
111 if eval \$emacs_tried_$ac_prog; then
112 ac_cv_path_MAKE=$ac_path_MAKE
114 ac_cv_path_MAKE=$ac_prog
117 eval emacs_tried_$ac_prog=:]])
119 $ac_path_MAKE_found || {
120 AC_MSG_ERROR([[Building Emacs requires GNU Make, at least version 3.81.
121 If you have it installed under another name, configure with 'MAKE=...'.
122 For example, run '$0 MAKE=gnu-make'.]])
124 MAKE=$ac_cv_path_MAKE
127 dnl Canonicalize the configuration name.
133 if test -z "$host_alias"; then
135 # No --host argument was given to 'configure'; therefore $host
136 # was set to a default value based on the build platform. But
137 # this default value may be wrong if we are building from a
138 # 64-bit MSYS[2] pre-configured to build 32-bit MinGW programs.
139 # Therefore, we'll try to get the right host platform from the
142 AC_MSG_CHECKING([the compiler's target])
143 if test -z "$CC"; then
148 cc_target=`$cc -v 2>&1 | sed -n 's/Target: //p'`
152 "") AC_MSG_ERROR([Impossible to obtain $cc compiler target.
153 Please explicitly provide --host.])
155 *) AC_MSG_WARN([Compiler reported non-standard target.
156 Defaulting to $host.])
159 AC_MSG_RESULT([$host])
162 . $srcdir/nt/mingw-cfg.site
166 # srcdir is an absolute path. In this case, force the format
167 # "/c/foo/bar", to simplify later conversions to native Windows
168 # format ("c:/foo/bar").
169 srcdir=`cd "${srcdir}" && pwd -W`
170 # 'eval' pacifies strict POSIX non-MinGW shells (Bug#18612).
171 # We downcase the drive letter to avoid warnings when
172 # generating autoloads.
173 eval 'srcdir=/`echo ${srcdir:0:1} | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"`"${srcdir:2}"'
179 configuration=${host_alias-${build_alias-$host}}
180 emacs_uname_r=`uname -r`
182 dnl Support for --program-prefix, --program-suffix and
183 dnl --program-transform-name options
186 dnl It is important that variables on the RHS not be expanded here,
187 dnl hence the single quotes. This is per the GNU coding standards, see
188 dnl (autoconf) Installation Directory Variables
189 dnl See also epaths.h below.
190 lispdir='${datadir}/emacs/${version}/lisp'
191 standardlisppath='${lispdir}'
192 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
193 '${datadir}/emacs/site-lisp'
194 lisppath='${locallisppath}:${standardlisppath}'
195 etcdir='${datadir}/emacs/${version}/etc'
196 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
197 etcdocdir='${datadir}/emacs/${version}/etc'
198 gamedir='${localstatedir}/games/emacs'
200 dnl Special option to disable the most of other options.
202 [AS_HELP_STRING([--without-all],
203 [omit almost all features and build
204 small executable with minimal dependencies])],
205 [with_features=$withval],
208 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
209 dnl Create a new --with option that defaults to being disabled.
210 dnl NAME is the base name of the option. The shell variable with_NAME
211 dnl will be set to either the user's value (if the option is
212 dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
213 dnl option is not specified). Note that the shell variable name is
214 dnl constructed as autoconf does, by replacing non-alphanumeric
215 dnl characters with "_".
216 dnl HELP-STRING is the help text for the option.
217 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
218 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
219 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
222 dnl OPTION_DEFAULT_IFAVAILABLE(NAME, HELP-STRING)
223 dnl Create a new --with option that defaults to 'ifavailable'.
224 dnl NAME is the base name of the option. The shell variable with_NAME
225 dnl will be set to either the user's value (if the option is
226 dnl specified; 'yes' for a plain --with-NAME) or to 'ifavailable' (if the
227 dnl option is not specified). Note that the shell variable name is
228 dnl constructed as autoconf does, by replacing non-alphanumeric
229 dnl characters with "_".
230 dnl HELP-STRING is the help text for the option.
231 AC_DEFUN([OPTION_DEFAULT_IFAVAILABLE], [dnl
232 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
233 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=ifavailable])dnl
237 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
238 dnl Create a new --with option that defaults to $with_features.
239 dnl NAME is the base name of the option. The shell variable with_NAME
240 dnl will be set either to 'no' (for a plain --without-NAME) or to
241 dnl 'yes' (if the option is not specified). Note that the shell
242 dnl variable name is constructed as autoconf does, by replacing
243 dnl non-alphanumeric characters with "_".
244 dnl HELP-STRING is the help text for the option.
245 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
246 AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
247 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=$with_features])dnl
250 # For retrieving mail, unencrypted network connections are the default
251 # only on native MS-Windows platforms. (FIXME: These platforms should
252 # also be secure by default.)
254 AC_ARG_WITH([mailutils],
255 [AS_HELP_STRING([--with-mailutils],
256 [rely on GNU Mailutils, so that the --without-pop through --with-mailhost
257 options are irrelevant; this is the default if GNU Mailutils is
260 [with_mailutils=$with_features
261 if test "$with_mailutils" = yes; then
262 (movemail --version) >/dev/null 2>&1 || with_mailutils=no
264 if test "$with_mailutils" = no; then
267 AC_SUBST([with_mailutils])
270 [AS_HELP_STRING([--with-pop],
271 [Support POP mail retrieval if Emacs movemail is used (not recommended,
272 as Emacs movemail POP is insecure). This is the default only on
273 native MS-Windows.])],
276 *-mingw*) with_pop=yes;;
277 *) with_pop=no-by-default;;
279 if test "$with_pop" = yes; then
280 AC_DEFINE(MAIL_USE_POP)
282 AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
284 OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
285 if test "$with_kerberos" != no; then
288 AH_TEMPLATE(KERBEROS,
289 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
291 OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
292 if test "${with_kerberos5}" != no; then
293 if test "${with_kerberos}" = no; then
297 AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
300 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
301 dnl FIXME hesiod support may not be present, so it seems like an error
302 dnl to define, or at least use, this unconditionally.
303 if test "$with_hesiod" != no; then
304 AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
307 OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
308 if test "$with_mail_unlink" != no; then
309 AC_DEFINE(MAIL_UNLINK_SPOOL, 1, [Define to unlink, rather than empty, mail spool after reading.])
312 AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
313 [string giving default POP mail host])],
314 AC_DEFINE_UNQUOTED(MAILHOST, ["$withval"], [String giving fallback POP mail host.]))
316 AC_ARG_WITH([sound],[AS_HELP_STRING([--with-sound=VALUE],
317 [compile with sound support (VALUE one of: yes, alsa, oss, bsd-ossaudio, no;
318 default yes). Only for GNU/Linux, FreeBSD, NetBSD, MinGW, Cygwin.])],
319 [ case "${withval}" in
320 yes|no|alsa|oss|bsd-ossaudio) val=$withval ;;
321 *) AC_MSG_ERROR(['--with-sound=$withval' is invalid;
322 this option's value should be 'yes', 'no', 'alsa', 'oss', or 'bsd-ossaudio'.])
327 [with_sound=$with_features])
329 AC_ARG_WITH([pdumper],
331 [--with-pdumper=VALUE],
332 [enable pdumper support unconditionally
333 ('yes', 'no', or 'auto': default 'auto')]),
334 [ case "${withval}" in
335 yes|no|auto) val=$withval ;;
337 ['--with-pdumper=$withval' is invalid;
338 this option's value should be 'yes' or 'no'.]) ;;
344 AC_ARG_WITH([unexec],
346 [--with-unexec=VALUE],
347 [enable unexec support unconditionally
348 ('yes', 'no', or 'auto': default 'auto')]),
349 [ case "${withval}" in
350 yes|no|auto) val=$withval ;;
352 ['--with-unexec=$withval' is invalid;
353 this option's value should be 'yes' or 'no'.]) ;;
359 AC_ARG_WITH([dumping],[AS_HELP_STRING([--with-dumping=VALUE],
360 [kind of dumping to use for initial Emacs build
361 (VALUE one of: pdumper, unexec, none; default pdumper)])],
362 [ case "${withval}" in
363 pdumper|unexec|none) val=$withval ;;
364 *) AC_MSG_ERROR(['--with-dumping=$withval is invalid;
365 this option's value should be 'pdumper', 'unexec', or 'none'.])
370 [with_dumping=pdumper])
372 if test "$with_pdumper" = "auto"; then
373 if test "$with_dumping" = "pdumper"; then
380 if test "$with_unexec" = "auto"; then
381 if test "$with_dumping" = "unexec"; then
388 if test "$with_dumping" = "pdumper" && test "$with_pdumper" = "no"; then
389 AC_MSG_ERROR(['--with-dumping=pdumper' requires pdumper support])
392 if test "$with_dumping" = "unexec" && test "$with_unexec" = "no"; then
393 AC_MSG_ERROR(['--with-dumping=unexec' requires unexec support])
396 if test "$with_pdumper" = "yes"; then
397 AC_DEFINE([HAVE_PDUMPER], 1, [Define to build with portable dumper support])
402 AC_SUBST([HAVE_PDUMPER])
404 DUMPING=$with_dumping
407 dnl FIXME currently it is not the last.
408 dnl This should be the last --with option, because --with-x is
409 dnl added later on when we find the file name of X, and it's best to
410 dnl keep them together visually.
411 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
412 [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, no)])],
413 [ case "${withval}" in
414 y | ye | yes ) val=gtk ;;
416 l | lu | luc | luci | lucid ) val=lucid ;;
417 a | at | ath | athe | athen | athena ) val=athena ;;
418 g | gt | gtk ) val=gtk ;;
422 AC_MSG_ERROR(['--with-x-toolkit=$withval' is invalid;
423 this option's value should be 'yes', 'no', 'lucid', 'athena', 'gtk',
424 'gtk2' or 'gtk3'. 'yes' and 'gtk' are synonyms.
425 'athena' and 'lucid' are synonyms.])
431 OPTION_DEFAULT_OFF([wide-int],
432 [prefer wide Emacs integers (typically 62-bit);
433 on 32-bit hosts, this allows buffer and string size up to 2GB,
434 at the cost of 10% to 30% slowdown of Lisp interpreter
435 and larger memory footprint])
436 if test "$with_wide_int" = yes; then
437 AC_DEFINE([WIDE_EMACS_INT], 1, [Use long long for EMACS_INT if available.])
440 dnl _ON results in a '--without' option in the --help output, so
441 dnl the help text should refer to "don't compile", etc.
442 with_xpm_set=${with_xpm+set}
443 OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
444 OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
445 OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
446 OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
447 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
448 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
449 OPTION_DEFAULT_ON([lcms2],[don't compile with Little CMS support])
450 OPTION_DEFAULT_ON([libsystemd],[don't compile with libsystemd support])
451 OPTION_DEFAULT_ON([cairo],[don't compile with Cairo drawing])
452 OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
453 OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support])
454 OPTION_DEFAULT_ON([native-image-api], [don't use native image APIs (GDI+ on Windows)])
455 OPTION_DEFAULT_IFAVAILABLE([json], [compile with native JSON support])
457 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
458 OPTION_DEFAULT_ON([harfbuzz],[don't use HarfBuzz for text shaping])
459 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
460 OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
462 OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Xaw3d/GTK toolkit scroll bars])
463 OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
464 OPTION_DEFAULT_ON([xim],[at runtime, default X11 XIM to off])
465 OPTION_DEFAULT_ON([xdbe],[don't use X11 double buffering support])
466 AC_ARG_WITH([ns],[AS_HELP_STRING([--with-ns],
467 [use Nextstep (macOS Cocoa or GNUstep) windowing system.
468 On by default on macOS.])],[],[with_ns=maybe])
469 OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build])
471 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
472 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
473 AC_ARG_WITH([gconf],[AS_HELP_STRING([--with-gconf],
474 [compile with Gconf support (Gsettings replaces this)])],[],
475 [if test $with_features = yes; then
480 OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
481 OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
482 OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
483 OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support])
484 OPTION_DEFAULT_ON([modules],[don't compile with dynamic modules support])
485 OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support])
487 AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB],
488 [use a file notification library (LIB one of: yes, inotify, kqueue, gfile, w32, no)])],
489 [ case "${withval}" in
490 y | ye | yes ) val=yes ;;
492 i | in | ino | inot | inoti | inotif | inotify ) val=inotify ;;
493 k | kq | kqu | kque | kqueu | kqueue ) val=kqueue ;;
494 g | gf | gfi | gfil | gfile ) val=gfile ;;
495 w | w3 | w32 ) val=w32 ;;
496 * ) AC_MSG_ERROR(['--with-file-notification=$withval' is invalid;
497 this option's value should be 'yes', 'no', 'inotify', 'kqueue', 'gfile' or 'w32'.
498 'yes' is a synonym for 'w32' on MS-Windows, for 'no' on Nextstep,
499 otherwise for the first of 'inotify', 'kqueue' or 'gfile' that is usable.])
502 with_file_notification=$val
504 [with_file_notification=$with_features])
506 OPTION_DEFAULT_OFF([xwidgets],
507 [enable use of xwidgets in Emacs buffers (requires gtk3 or macOS Cocoa)])
509 ## Makefile.in needs the cache file name.
512 ## This is an option because I do not know if all info/man support
513 ## compressed files, nor how to test if they do so.
514 OPTION_DEFAULT_ON([compress-install],
515 [don't compress some files (.el, .info, etc.) when installing. Equivalent to:
516 make GZIP_PROG= install])
518 AC_ARG_WITH(gameuser,dnl
519 [AS_HELP_STRING([--with-gameuser=USER_OR_GROUP],
520 [user for shared game score files.
521 An argument prefixed by ':' specifies a group instead.])])
524 case ${with_gameuser} in
526 yes) gamegroup=games ;;
527 :*) gamegroup=${with_gameuser#:} ;;
528 *) gameuser=${with_gameuser} ;;
531 AC_ARG_WITH([gnustep-conf],dnl
532 [AS_HELP_STRING([--with-gnustep-conf=FILENAME],
533 [name of GNUstep configuration file to use on systems where the command
534 'gnustep-config' does not work; default $GNUSTEP_CONFIG_FILE, or
535 /etc/GNUstep/GNUstep.conf])])
536 test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
537 GNUSTEP_CONFIG_FILE="${with_gnustep_conf}"
538 test "X$GNUSTEP_CONFIG_FILE" = "X" && \
539 GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
541 AC_ARG_ENABLE(ns-self-contained,
542 [AS_HELP_STRING([--disable-ns-self-contained],
543 [disable self contained build under NeXTstep])],
544 EN_NS_SELF_CONTAINED=$enableval,
545 EN_NS_SELF_CONTAINED=yes)
548 AC_ARG_ENABLE(locallisppath,
549 [AS_HELP_STRING([--enable-locallisppath=PATH],
550 [directories Emacs should search for lisp files specific
552 if test "${enableval}" = "no"; then
554 elif test "${enableval}" != "yes"; then
555 locallisppath=${enableval} locallisppathset=yes
558 AC_ARG_ENABLE(checking,
559 [AS_HELP_STRING([--enable-checking@<:@=LIST@:>@],
560 [enable expensive checks. With LIST,
561 enable only specific categories of checks.
562 Categories are: all,yes,no.
563 Flags are: stringbytes, stringoverrun, stringfreelist,
565 [ac_checking_flags="${enableval}"],[])
566 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
568 for check in $ac_checking_flags
571 # these set all the flags to specific states
572 yes) ac_enable_checking=1 ;;
573 no) ac_enable_checking= ;
575 ac_gc_check_stringbytes= ;
576 ac_gc_check_string_overrun= ;
577 ac_gc_check_string_free_list= ;
579 all) ac_enable_checking=1 ;
581 ac_gc_check_stringbytes=1 ;
582 ac_gc_check_string_overrun=1 ;
583 ac_gc_check_string_free_list=1 ;
585 # these enable particular checks
586 stringbytes) ac_gc_check_stringbytes=1 ;;
587 stringoverrun) ac_gc_check_string_overrun=1 ;;
588 stringfreelist) ac_gc_check_string_free_list=1 ;;
589 structs) CHECK_STRUCTS=true ;;
590 glyphs) ac_glyphs_debug=1 ;;
591 *) AC_MSG_ERROR(unknown check category $check) ;;
596 if test x$ac_enable_checking != x ; then
597 AC_DEFINE(ENABLE_CHECKING, 1,
598 [Define to 1 if expensive run-time data type and consistency checks are enabled.])
600 if $CHECK_STRUCTS; then
601 AC_DEFINE([CHECK_STRUCTS], 1,
602 [Define this to check whether someone updated the portable dumper
603 code after changing the layout of a structure that it uses.
604 If you change one of these structures, check that the pdumper.c
605 code is still valid, and update the pertinent hash in pdumper.c
606 by manually copying the hash from the newly-generated dmpstruct.h.])
608 AC_SUBST([CHECK_STRUCTS])
609 if test x$ac_gc_check_stringbytes != x ; then
610 AC_DEFINE(GC_CHECK_STRING_BYTES, 1,
611 [Define this temporarily to hunt a bug. If defined, the size of
612 strings is redundantly recorded in sdata structures so that it can
613 be compared to the sizes recorded in Lisp strings.])
615 if test x$ac_gc_check_string_overrun != x ; then
616 AC_DEFINE(GC_CHECK_STRING_OVERRUN, 1,
617 [Define this to check for short string overrun.])
619 if test x$ac_gc_check_string_free_list != x ; then
620 AC_DEFINE(GC_CHECK_STRING_FREE_LIST, 1,
621 [Define this to check the string free list.])
623 if test x$ac_glyphs_debug != x ; then
624 AC_DEFINE(GLYPH_DEBUG, 1,
625 [Define this to enable glyphs debugging code.])
628 dnl The name of this option is unfortunate. It predates, and has no
629 dnl relation to, the "sampling-based elisp profiler" added in 24.3.
630 dnl Actually, it stops it working.
631 dnl https://lists.gnu.org/r/emacs-devel/2012-11/msg00393.html
632 AC_ARG_ENABLE(profiling,
633 [AS_HELP_STRING([--enable-profiling],
634 [build emacs with low-level, gprof profiling support.
635 Mainly useful for debugging Emacs itself. May not work on
636 all platforms. Stops profiler.el working.])],
637 [ac_enable_profiling="${enableval}"],[])
638 if test x$ac_enable_profiling != x ; then
639 PROFILING_CFLAGS="-DPROFILING=1 -pg"
643 AC_SUBST(PROFILING_CFLAGS)
645 AC_ARG_ENABLE(autodepend,
646 [AS_HELP_STRING([--enable-autodepend],
647 [automatically generate dependencies to .h-files.
648 Requires gcc, enabled if found.])],
649 [ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes])
651 AC_ARG_ENABLE(gtk-deprecation-warnings,
652 [AS_HELP_STRING([--enable-gtk-deprecation-warnings],
653 [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])],
654 [ac_enable_gtk_deprecation_warnings="${enableval}"],[])
657 AC_ARG_ENABLE([build-details],
658 [AS_HELP_STRING([--disable-build-details],
659 [Make the build more deterministic by omitting host
660 names, time stamps, etc. from the output.])],
661 [test "$enableval" = no && BUILD_DETAILS=--no-build-details])
662 AC_SUBST([BUILD_DETAILS])
664 dnl This used to use changequote, but, apart from 'changequote is evil'
665 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
666 dnl the great gob of text. Thus it's not processed for possible expansion.
667 dnl Just make sure the brackets remain balanced.
669 dnl Since Emacs can't find matching pairs of quotes, boundaries are
670 dnl indicated by comments.
674 ### If you add support for a new configuration, add code to this
675 ### switch statement to recognize your configuration name and select
676 ### the appropriate opsys.
678 ### As far as handling version numbers on operating systems is
679 ### concerned, make sure things will fail in a fixable way. If
680 ### /etc/MACHINES doesn't say anything about version numbers, be
681 ### prepared to handle anything reasonably. If version numbers
682 ### matter, be sure /etc/MACHINES says something about it.
685 case "${canonical}" in
687 ## GNU/Linux and similar ports
702 ## FreeBSD kernel + glibc based userland
713 *-*-openbsd* | *-*-mirbsd* )
717 ## Apple Darwin / macOS
719 case "${canonical}" in
720 *-apple-darwin[0-9].*) unported=yes ;;
721 i[3456]86-* | x86_64-* | arm-* | aarch64-* ) ;;
725 ## FIXME: Find a way to use Fink if available (Bug#11507).
728 ## Chromium Native Client
738 ## HP 9000 series 700 and 800, running HP/UX
742 hppa*-hp-hpux1[1-9]* )
744 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
748 rs6000-ibm-aix4.[23]* )
751 powerpc-ibm-aix4.[23]* )
754 rs6000-ibm-aix[56]* )
757 powerpc-ibm-aix[5-9]* | powerpc-ibm-aix[1-9][0-9]* )
762 *-*-solaris* | *-*-sunos*)
763 case "${canonical}" in
765 amd64-*-*|x86_64-*-*) ;;
770 ## Watch out for a compiler that we know will not work.
771 if [ "$CC" = /usr/ucb/cc ]; then
772 ## /usr/ucb/cc doesn't work;
773 ## we should find some other compiler that does work.
781 test -z "$CC" && CC=qcc
782 LDFLAGS="-N2M $LDFLAGS"
785 ## Intel 386 machines where we don't care about the manufacturer.
787 case "${canonical}" in
788 *-darwin* ) opsys=darwin ;;
791 # MinGW overrides and adds some system headers in nt/inc.
792 GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
794 *-sysv4.2uw* ) opsys=unixware ;;
795 *-sysv5uw* ) opsys=unixware ;;
796 *-sysv5OpenUNIX* ) opsys=unixware ;;
797 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
803 case "${canonical}" in
806 # MinGW overrides and adds some system headers in nt/inc.
807 GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
809 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
818 ### If the code above didn't choose an operating system, just choose
819 ### an operating system based on the configuration name. You really
820 ### only want to use this when you have no idea what the right
821 ### operating system is; if you know what operating systems a machine
822 ### runs, it's cleaner to make it explicit in the case statement
824 if test x"${opsys}" = x; then
825 case "${canonical}" in
826 *-gnu* ) opsys=gnu ;;
836 if test $unported = yes; then
837 AC_MSG_ERROR([Emacs does not support '${canonical}' systems.
838 If you think it should, please send a report to ${PACKAGE_BUGREPORT}.
839 Check 'etc/MACHINES' for recognized configuration names.])
842 #### Choose a compiler.
844 dnl Don't bother to test for C89.
845 AC_DEFUN([_AC_PROG_CC_C89], [$2])
847 dnl Sets GCC=yes if using gcc.
848 AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"])
849 if test -n "$XCRUN"; then
850 AC_CHECK_PROGS(AR, [ar "$XCRUN ar"])
851 test -n "$AR" && export AR
854 dnl Emacs needs C99 or later.
859 if test x$GCC = xyes; then
860 test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
863 # Avoid gnulib's tests for -lcrypto, so that there's no static dependency on it.
864 AC_DEFUN([gl_CRYPTO_CHECK])
865 # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
866 # as we don't use them.
867 AC_DEFUN([gl_FCNTL_O_FLAGS])
868 # Avoid gnulib's test for pthread_sigmask.
870 for func in $ac_func_list; do
871 test $func = pthread_sigmask || AS_VAR_APPEND([funcs], [" $func"])
874 # Emacs does not use the wchar or wctype-h modules.
875 AC_DEFUN([gt_TYPE_WINT_T],
876 [GNULIB_OVERRIDES_WINT_T=0
877 AC_SUBST([GNULIB_OVERRIDES_WINT_T])])
879 # Initialize gnulib right after choosing the compiler.
880 dnl Amongst other things, this sets AR and ARFLAGS.
883 if test "$ac_test_CFLAGS" != set; then
884 # It's helpful to have C macros available to GDB, so prefer -g3 to -g
885 # if -g3 works and the user does not specify CFLAGS.
886 # This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
889 emacs_g3_CFLAGS='-g3';;
891 emacs_g3_CFLAGS='-g3 -O2';;
895 if test -n "$emacs_g3_CFLAGS"; then
896 emacs_save_CFLAGS=$CFLAGS
897 CFLAGS=$emacs_g3_CFLAGS
898 AC_CACHE_CHECK([whether $CC accepts $emacs_g3_CFLAGS],
899 [emacs_cv_prog_cc_g3],
900 [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
901 [emacs_cv_prog_cc_g3=yes],
902 [emacs_cv_prog_cc_g3=no])])
903 if test $emacs_cv_prog_cc_g3 != yes; then
904 CFLAGS=$emacs_save_CFLAGS
906 if test $opsys = mingw32; then
907 CFLAGS="$CFLAGS -gdwarf-2"
914 # No optimization flag was inferred for this non-GCC compiler.
915 # Try -O. This is needed for xlc on AIX; see Bug#14258.
916 emacs_save_CFLAGS=$CFLAGS
917 test -z "$CFLAGS" || CFLAGS="$CFLAGS "
919 AC_CACHE_CHECK([whether $CC accepts -O],
920 [emacs_cv_prog_cc_o],
921 [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
922 [emacs_cv_prog_cc_o=yes],
923 [emacs_cv_prog_cc_o=no])])
924 if test $emacs_cv_prog_cc_o != yes; then
925 CFLAGS=$emacs_save_CFLAGS
930 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
931 # ---------------------------------------------------------------------------
932 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
933 # Otherwise, run RUN-IF-NOT-FOUND.
934 AC_DEFUN([gl_GCC_VERSION_IFELSE],
938 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
941 # error "your version of gcc is older than $1.$2"
948 AC_ARG_ENABLE([gcc-warnings],
949 [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@],
950 [control generation of GCC warnings. The TYPE 'yes'
951 means to fail if any warnings are issued; 'warn-only'
952 means issue warnings without failing (default for
953 developer builds); 'no' means disable warnings
954 (default for non-developer builds).])],
957 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
959 gl_gcc_warnings=$enableval],
960 [# By default, use 'warn-only' if it looks like the invoker of 'configure'
961 # is a developer as opposed to a builder. This is most likely true
962 # if GCC is recent enough and there is a .git directory or file;
963 # however, if there is also a .tarball-version file it is probably
964 # just a release imported into Git for patch management.
966 if test -e "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version; then
967 gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only])
970 AC_ARG_ENABLE([check-lisp-object-type],
971 [AS_HELP_STRING([--enable-check-lisp-object-type],
972 [Enable compile time checks for the Lisp_Object data type,
973 which can catch some bugs during development.])])
974 if test "$enable_check_lisp_object_type" = yes; then
975 AC_DEFINE([CHECK_LISP_OBJECT_TYPE], 1,
976 [Define to enable compile-time checks for the Lisp_Object data type.])
979 # clang is unduly picky about some things.
980 AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
987 [emacs_cv_clang=yes],
988 [emacs_cv_clang=no])])
991 # When compiling with GCC, prefer -isystem to -I when including system
992 # include files, to avoid generating useless diagnostics for the files.
993 AS_IF([test $gl_gcc_warnings = no],
996 AS_IF([test "$emacs_cv_clang" = yes],
998 # Turn off some warnings if supported.
999 gl_WARN_ADD([-Wno-switch])
1000 gl_WARN_ADD([-Wno-pointer-sign])
1001 gl_WARN_ADD([-Wno-string-plus-int])
1002 gl_WARN_ADD([-Wno-unknown-attributes])
1007 # This, $nw, is the list of warnings we disable.
1010 case $with_x_toolkit in
1011 lucid | athena | motif)
1012 # Old toolkits mishandle 'const'.
1013 nw="$nw -Wwrite-strings"
1016 AS_IF([test $gl_gcc_warnings = yes],
1017 [WERROR_CFLAGS=-Werror],
1018 [# Use -fanalyzer and related options only if --enable-gcc-warnings,
1019 # as they slow GCC considerably.
1020 nw="$nw -fanalyzer -Wno-analyzer-double-free -Wno-analyzer-malloc-leak"
1021 nw="$nw -Wno-analyzer-null-dereference -Wno-analyzer-use-after-free"
1022 # Use -Wsuggest-attribute=malloc only if --enable-gcc-warnings,
1023 # as it doesn't flag code that is wrong in any way.
1024 nw="$nw -Wsuggest-attribute=malloc"])
1026 nw="$nw -Wcast-align=strict" # Emacs is tricky with pointers.
1027 nw="$nw -Wduplicated-branches" # Too many false alarms
1028 nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 80776
1029 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
1030 nw="$nw -Woverlength-strings" # Not a problem these days
1031 nw="$nw -Wvla" # Emacs uses <vla.h>.
1032 nw="$nw -Wunused-const-variable=2" # lisp.h declares const objects.
1033 nw="$nw -Winline" # OK to ignore 'inline'
1034 nw="$nw -Wstrict-overflow" # OK to optimize assuming that
1035 # signed overflow has undefined behavior
1036 nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
1037 nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
1038 nw="$nw -Wbad-function-cast" # These casts are no worse than others.
1040 # Emacs doesn't care about shadowing; see
1041 # <https://lists.gnu.org/r/emacs-diffs/2011-11/msg00265.html>.
1044 # Emacs's use of alloca inhibits protecting the stack.
1045 nw="$nw -Wstack-protector"
1047 # Emacs's use of __attribute__ ((cold)) causes false alarms with this option.
1048 nw="$nw -Wsuggest-attribute=cold"
1050 # Emacs's use of partly-const functions such as Fgnutls_available_p
1051 # make this option problematic.
1052 nw="$nw -Wsuggest-attribute=const"
1054 # Emacs's use of partly-pure functions such as CHECK_TYPE make this
1055 # option problematic.
1056 nw="$nw -Wsuggest-attribute=pure"
1058 if test "$emacs_cv_clang" = yes; then
1059 nw="$nw -Wdouble-promotion"
1062 # This causes too much noise in the MinGW build.
1063 if test $opsys = mingw32; then
1064 nw="$nw -Wsuggest-attribute=format"
1067 gl_MANYWARN_ALL_GCC([ws])
1068 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
1072 gl_WARN_ADD([-Wredundant-decls]) # Prefer this, as we don't use Bison.
1073 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
1074 gl_WARN_ADD([-Wno-override-init]) # More trouble than it is worth
1075 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
1076 gl_WARN_ADD([-Wno-type-limits]) # Too many warnings for now
1077 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
1078 gl_WARN_ADD([-Wno-format-nonliteral])
1080 # clang is unduly picky about some things.
1081 if test "$emacs_cv_clang" = yes; then
1082 gl_WARN_ADD([-Wno-missing-braces])
1083 gl_WARN_ADD([-Wno-null-pointer-arithmetic])
1086 # This causes too much noise in the MinGW build
1087 if test $opsys = mingw32; then
1088 gl_WARN_ADD([-Wno-pointer-sign])
1091 AC_DEFINE([GCC_LINT], [1], [Define to 1 if --enable-gcc-warnings.])
1092 AS_IF([test $gl_gcc_warnings = yes],
1093 [AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
1094 AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE],
1095 [/* Enable compile-time and run-time bounds-checking, and some warnings,
1096 without upsetting glibc 2.15+. */
1097 #if (defined GNULIB_PORTCHECK && !defined _FORTIFY_SOURCE \
1098 && defined __OPTIMIZE__ && __OPTIMIZE__)
1099 # define _FORTIFY_SOURCE 2
1104 # clang is picky about these regardless of whether
1105 # --enable-gcc-warnings is specified.
1106 if test "$emacs_cv_clang" = yes; then
1107 gl_WARN_ADD([-Wno-initializer-overrides])
1108 gl_WARN_ADD([-Wno-tautological-compare])
1109 gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
1112 # Use a slightly smaller set of warning options for lib/.
1114 nw="$nw -Wunused-macros"
1115 gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
1117 AC_SUBST([WERROR_CFLAGS])
1118 AC_SUBST([GNULIB_WARN_CFLAGS])
1127 AC_ARG_ENABLE(link-time-optimization,
1128 [AS_HELP_STRING([--enable-link-time-optimization],
1129 [build with link-time optimization
1130 (experimental; see INSTALL)])],
1131 if test "${enableval}" != "no"; then
1133 if test "$emacs_cv_clang" = yes; then
1134 AC_MSG_CHECKING([whether link-time optimization is supported by clang])
1135 GOLD_PLUGIN=`$CC -print-file-name=LLVMgold.so 2>/dev/null`
1136 if test -x "$GOLD_PLUGIN"; then
1139 elif test x$GCC = xyes; then
1140 AC_MSG_CHECKING([whether link-time optimization is supported by gcc])
1141 CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
1142 if test x$CPUS != x; then
1148 AC_MSG_ERROR([Link-time optimization is not supported with your compiler.])
1150 if test -z "$LTO"; then
1154 CFLAGS="$CFLAGS $LTO"
1155 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1156 [ac_lto_supported=yes], [ac_lto_supported=no])
1157 CFLAGS="$old_CFLAGS"
1159 AC_MSG_RESULT([$ac_lto_supported])
1160 if test "$ac_lto_supported" = "yes"; then
1161 CFLAGS="$CFLAGS $LTO"
1162 if test "$emacs_cv_clang" = yes; then
1163 AC_MSG_WARN([Please read INSTALL before using link-time optimization with clang])
1164 # WARNING: 'ar --plugin ...' doesn't work without
1165 # command, so plugin name is appended to ARFLAGS.
1166 ARFLAGS="cru --plugin $GOLD_PLUGIN"
1167 RANLIB="$RANLIB --plugin $GOLD_PLUGIN"
1169 dnl The following is needed for GCC 4.9.0. The GCC 4.9.0 release notes
1170 dnl suggest that instead of -ffat-lto-objects we should use gcc-ar and
1171 dnl gcc-ranlib in place of ar and ranlib, but gcc-ar makes /usr/bin/ar
1172 dnl dump core on Fedora 20, so play it safe for now.
1173 gl_COMPILER_OPTION_IF([-ffat-lto-objects],
1174 [CFLAGS="$CFLAGS -ffat-lto-objects"])
1180 dnl Automake replacements.
1181 AC_DEFUN([AM_CONDITIONAL],
1185 dnl Prefer silent make output. For verbose output, use
1186 dnl 'configure --disable-silent-rules' or 'make V=1' .
1187 AC_ARG_ENABLE([silent-rules],
1189 [--disable-silent-rules],
1190 [verbose build output (undo: "make V=0")])])
1191 if test "$enable_silent_rules" = no; then
1192 AM_DEFAULT_VERBOSITY=1
1194 AM_DEFAULT_VERBOSITY=0
1196 AC_SUBST([AM_DEFAULT_VERBOSITY])
1197 AC_CONFIG_FILES([src/verbose.mk])
1199 dnl Some other nice autoconf tests.
1201 dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
1203 dnl if test "x$RANLIB" = x; then
1208 dnl Sadly, AC_PROG_LN_S is too restrictive. It also tests whether links
1209 dnl can be made to directories. This is not relevant for our usage, and
1210 dnl excludes some cases that work fine for us. Eg MS Windows or files
1211 dnl hosted on AFS, both examples where simple links work, but links to
1212 dnl directories fail. We use a cut-down version instead.
1215 AC_CACHE_CHECK([command to symlink files in the same directory], [emacs_cv_ln_s_fileonly],
1216 [rm -f conf$$ conf$$.file
1218 emacs_cv_ln_s_fileonly='cp -p'
1220 dnl On MinGW, ensure we will call the MSYS /bin/ln.exe, not some
1221 dnl random program in the current directory.
1222 if (echo >conf$$.file) 2>/dev/null; then
1223 if test "$opsys" = "mingw32"; then
1224 emacs_cv_ln_s_fileonly=/bin/ln
1225 elif ln -s conf$$.file conf$$ 2>/dev/null; then
1226 emacs_cv_ln_s_fileonly='ln -s'
1227 elif ln conf$$.file conf$$ 2>/dev/null; then
1228 emacs_cv_ln_s_fileonly=ln
1232 rm -f conf$$ conf$$.file])
1233 LN_S_FILEONLY=$emacs_cv_ln_s_fileonly
1235 AC_SUBST(LN_S_FILEONLY)
1238 dnl AC_PROG_LN_S sets LN_S to 'cp -pR' for MinGW, on the premise that 'ln'
1239 dnl doesn't support links to directories, as in "ln file dir". But that
1240 dnl use is non-portable, and OTOH MinGW wants to use hard links for Emacs
1241 dnl executables at "make install" time.
1242 dnl See https://lists.gnu.org/r/emacs-devel/2013-04/msg00475.html
1243 dnl for more details.
1244 if test "$opsys" = "mingw32"; then
1248 dnl On some Debian versions, "install-info" prints irritating messages
1249 dnl "This is not dpkg install-info anymore, but GNU install-info"
1250 dnl if called via an absolute file name.
1251 dnl Use the entirely-identical-but-quieter ginstall-info instead if present.
1252 dnl Sadly some people may have an old ginstall-info installed on
1253 dnl non-Debian systems, so we can't use this.
1254 dnl AC_PATH_PROGS(INSTALL_INFO, [ginstall-info install-info], :,
1255 dnl $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
1257 AC_PATH_PROG(INSTALL_INFO, install-info, :,
1258 $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
1259 dnl Don't use GZIP, which is used by gzip for additional parameters.
1260 AC_PATH_PROG(GZIP_PROG, gzip)
1262 test $with_compress_install != yes && test -n "$GZIP_PROG" && \
1263 GZIP_PROG=" # $GZIP_PROG # (disabled by configure --without-compress-install)"
1265 if test "$with_dumping" = "unexec" && test "$opsys" = "nacl"; then
1266 AC_MSG_ERROR([nacl is not compatible with --with-dumping=unexec])
1269 AC_CACHE_CHECK([for 'find' args to delete a file],
1270 [emacs_cv_find_delete],
1271 [if touch conftest.tmp && find conftest.tmp -delete 2>/dev/null &&
1272 test ! -f conftest.tmp
1273 then emacs_cv_find_delete="-delete"
1274 else emacs_cv_find_delete="-exec rm -f {} ';'"
1276 FIND_DELETE=$emacs_cv_find_delete
1277 AC_SUBST([FIND_DELETE])
1281 if test $with_unexec = yes && test $opsys = gnu-linux; then
1282 if test "${SETFATTR+set}" != set; then
1283 AC_CACHE_CHECK([for setfattr],
1284 [emacs_cv_prog_setfattr],
1286 if (setfattr -n user.pax.flags conftest.tmp) >/dev/null 2>&1; then
1287 emacs_cv_prog_setfattr=yes
1289 emacs_cv_prog_setfattr=no
1291 if test "$emacs_cv_prog_setfattr" = yes; then
1292 PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er'
1298 case $opsys,$PAXCTL_notdumped,$emacs_uname_r in
1299 gnu-linux,,* | netbsd,,[0-7].*)
1300 AC_PATH_PROG([PAXCTL], [paxctl], [],
1301 [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
1302 if test -n "$PAXCTL"; then
1303 if test "$opsys" = netbsd; then
1304 PAXCTL_dumped='$(PAXCTL) +a'
1305 PAXCTL_notdumped=$PAXCTL_dumped
1307 AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header])
1308 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
1309 [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then
1310 AC_MSG_RESULT([yes])
1315 if test -n "$PAXCTL"; then
1316 PAXCTL_dumped='$(PAXCTL) -zex'
1317 PAXCTL_notdumped='$(PAXCTL) -r'
1323 AC_SUBST([PAXCTL_dumped])
1324 AC_SUBST([PAXCTL_notdumped])
1325 AC_SUBST([SETFATTR])
1327 # Makeinfo on macOS is ancient, check whether there is a more recent
1328 # version installed by Homebrew.
1329 AC_CHECK_PROGS(BREW, [brew])
1330 if test -n "$BREW"; then
1331 AC_PATH_PROG([MAKEINFO], [makeinfo], [],
1332 [`$BREW --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH])
1335 ## Require makeinfo >= 4.13 (last of the 4.x series) to build the manuals.
1336 : ${MAKEINFO:=makeinfo}
1337 case `($MAKEINFO --version) 2>/dev/null` in
1338 *' (GNU texinfo) '4.1[[3-9]]* | \
1339 *' (GNU texinfo) '[[5-9]]* | \
1340 *' (GNU texinfo) '[[1-9][0-9]]* ) ;;
1344 ## Makeinfo is unusual. For a released Emacs, the manuals are
1345 ## pre-built, and not deleted by the normal clean rules. makeinfo is
1346 ## therefore in the category of "special tools" not normally required, which
1347 ## configure does not have to check for (eg autoconf itself).
1348 ## In a repository checkout on the other hand, the manuals are not included.
1349 ## So makeinfo is a requirement to build from the repository, and configure
1350 ## should test for it as it does for any other build requirement.
1351 ## We use the presence of $srcdir/info/emacs to distinguish a release,
1352 ## with pre-built manuals, from a repository checkout.
1353 if test "$MAKEINFO" = "no"; then
1355 if test ! -e "$srcdir/info/emacs" && test ! -e "$srcdir/info/emacs.info"; then
1356 AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.13, and your
1357 source tree does not seem to have pre-built manuals in the 'info' directory.
1358 Please install a suitable version of makeinfo.] )
1360 AC_MSG_WARN( [You do not seem to have makeinfo >= 4.13.
1361 You will not be able to rebuild the manuals if you delete them or change
1365 AC_SUBST([MAKEINFO])
1367 if test $opsys = mingw32; then
1368 DOCMISC_W32=efaq-w32
1372 AC_SUBST(DOCMISC_W32)
1374 dnl Add our options to ac_link now, after it is set up.
1376 if test x$GCC = xyes; then
1377 test "x$GCC_LINK_TEST_OPTIONS" != x && \
1378 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
1380 test "x$NON_GCC_LINK_TEST_OPTIONS" != x && \
1381 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
1384 dnl On some platforms using GNU ld, linking temacs needs -znocombreloc.
1385 dnl Although this has something to do with dumping, the details are unknown.
1386 dnl If the flag is used but not needed,
1387 dnl Emacs should still work (albeit a bit more slowly),
1388 dnl so use the flag everywhere that it is supported.
1389 dnl When testing whether the flag works, treat GCC specially
1390 dnl since it just gives a non-fatal 'unrecognized option'
1391 dnl if not built to support GNU ld.
1392 if test "$GCC" = yes; then
1393 LDFLAGS_NOCOMBRELOC="-Wl,-znocombreloc"
1395 LDFLAGS_NOCOMBRELOC="-znocombreloc"
1398 AC_CACHE_CHECK([for -znocombreloc], [emacs_cv_znocombreloc],
1399 [if test $with_unexec = no; then
1400 emacs_cv_znocombreloc='not needed'
1402 save_LDFLAGS=$LDFLAGS
1403 LDFLAGS="$LDFLAGS $LDFLAGS_NOCOMBRELOC"
1404 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
1405 [emacs_cv_znocombreloc=yes], [emacs_cv_znocombreloc=no])
1406 LDFLAGS=$save_LDFLAGS
1409 case $emacs_cv_znocombreloc in
1411 LDFLAGS_NOCOMBRELOC= ;;
1415 AC_CACHE_CHECK([whether addresses are sanitized],
1416 [emacs_cv_sanitize_address],
1419 [[#ifndef __has_feature
1420 #define __has_feature(f) 0
1422 #if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
1424 error "Addresses are not sanitized.";
1427 [emacs_cv_sanitize_address=yes],
1428 [emacs_cv_sanitize_address=no])])
1430 if test $with_unexec = yes; then
1431 AC_DEFINE([HAVE_UNEXEC], 1, [Define if Emacs supports unexec.])
1432 if test "$emacs_cv_sanitize_address" = yes; then
1433 AC_MSG_WARN([[Addresses are sanitized; suggest --without-unexec]])
1439 test $with_unexec = yes &&
1441 # MSDOS uses unexcoff.o
1443 UNEXEC_OBJ=unexaix.o
1449 UNEXEC_OBJ=unexmacosx.o
1452 UNEXEC_OBJ=unexhp9k800.o
1455 UNEXEC_OBJ=unexw32.o
1458 # Use the Solaris dldump() function, called from unexsol.c, to dump
1459 # emacs, instead of the generic ELF dump code found in unexelf.c.
1460 # The resulting binary has a complete symbol table, and is better
1461 # for debugging and other observability tools (debuggers, pstack, etc).
1462 UNEXEC_OBJ=unexsol.o
1465 UNEXEC_OBJ=unexelf.o
1468 AC_SUBST(UNEXEC_OBJ)
1471 test "$with_unexec" = no || case "$opsys" in
1473 ## Let 'ld' find image libs and similar things in /usr/local/lib.
1474 ## The system compiler, GCC, has apparently been modified to not
1475 ## look there, contrary to what a stock GCC would do.
1476 ### It's not our place to do this. See bug#10313#17.
1477 ### LD_SWITCH_SYSTEM=-L/usr/local/lib
1482 ## cpp test was "ifdef __mips__", but presumably this is equivalent...
1483 case $host_cpu in mips*) LD_SWITCH_SYSTEM="-G 0";; esac
1487 ### It's not our place to do this. See bug#10313#17.
1488 ### LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
1493 ## Han Boetes <han@boetes.org> says this is necessary,
1494 ## otherwise Emacs dumps core on elf systems.
1495 LD_SWITCH_SYSTEM="-Z"
1498 AC_SUBST(LD_SWITCH_SYSTEM)
1500 ac_link="$ac_link $LD_SWITCH_SYSTEM"
1502 ## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
1503 ## which has not been defined yet. When this was handled with cpp,
1504 ## it was expanded to null when configure sourced the s/*.h file.
1505 ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
1506 ## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
1507 ## (or somesuch), but because it is supposed to go at the _front_
1508 ## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
1509 ## Compare with the gnu-linux case below, which added to the end
1510 ## of LD_SWITCH_SYSTEM, and so can instead go at the front of
1511 ## LD_SWITCH_SYSTEM_TEMACS.
1514 LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
1519 test $with_unexec = yes &&
1522 ## With ELF, make sure that all common symbols get allocated to in the
1523 ## data section. Otherwise, the dump of temacs may miss variables in
1524 ## the shared library that have been initialized. For example, with
1525 ## GNU libc, __malloc_initialized would normally be resolved to the
1526 ## shared library's .bss section, which is fatal.
1527 if test "x$GCC" = "xyes"; then
1528 C_SWITCH_MACHINE="-fno-common"
1530 AC_MSG_ERROR([Non-GCC compilers are not supported.])
1534 AC_SUBST(C_SWITCH_MACHINE)
1537 ## Some programs in src produce warnings saying certain subprograms
1538 ## are too complex and need a MAXMEM value greater than 2000 for
1539 ## additional optimization. --nils@exp-math.uni-essen.de
1540 test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
1541 C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
1542 if test "$opsys" = "mingw32"; then
1543 case "$canonical" in
1544 x86_64-*-mingw*) C_SWITCH_SYSTEM="-mtune=generic" ;;
1545 *) C_SWITCH_SYSTEM="-mtune=pentium4" ;;
1548 ## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
1549 ## It is redundant in glibc2, since we define _GNU_SOURCE.
1550 AC_SUBST(C_SWITCH_SYSTEM)
1555 ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
1556 aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
1558 freebsd|dragonfly) LIBS_SYSTEM="-lutil" ;;
1560 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
1562 qnxnto) LIBS_SYSTEM="-lsocket" ;;
1564 solaris) LIBS_SYSTEM="-lsocket -lnsl" ;;
1566 ## Motif needs -lgen.
1567 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
1570 AC_SUBST(LIBS_SYSTEM)
1572 ### Make sure subsequent tests use flags consistent with the build flags.
1574 if test x"${OVERRIDE_CPPFLAGS}" != x; then
1575 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
1577 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
1580 # Suppress obsolescent Autoconf test for size_t; Emacs assumes C99 or better.
1581 AC_DEFUN([AC_TYPE_SIZE_T])
1582 # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
1583 AC_DEFUN([AC_TYPE_UID_T])
1585 # sqrt and other floating-point functions such as fmod and frexp
1586 # are found in -lm on many systems.
1588 AC_SEARCH_LIBS([sqrt], [m])
1589 if test "X$LIBS" = "X$OLD_LIBS"; then
1592 LIB_MATH=$ac_cv_search_sqrt
1596 dnl Current possibilities handled by sed (aix4-2 -> aix,
1597 dnl gnu-linux -> gnu/linux, etc.):
1598 dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux.
1599 dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
1600 SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
1607 ## Adding -lm confuses the dynamic linker, so omit it.
1610 freebsd | dragonfly )
1611 SYSTEM_TYPE=berkeley-unix
1613 gnu-linux | gnu-kfreebsd )
1615 hpux10-20 | hpux11 )
1619 SYSTEM_TYPE=windows-nt
1622 SYSTEM_TYPE=berkeley-unix
1625 solaris | unixware )
1626 SYSTEM_TYPE=usg-unix-v
1632 AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
1633 [The type of system you are compiling for; sets 'system-type'.])
1634 AC_SUBST([SYSTEM_TYPE])
1637 pre_PKG_CONFIG_CFLAGS=$CFLAGS
1638 pre_PKG_CONFIG_LIBS=$LIBS
1640 PKG_PROG_PKG_CONFIG(0.9.0)
1642 dnl EMACS_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4)
1643 dnl acts like PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4,
1644 dnl HAVE_GSTUFF=yes, HAVE_GSTUFF=no) -- see pkg-config man page --
1645 dnl except that it postprocesses CFLAGS as needed for --enable-gcc-warnings.
1646 dnl EMACS_CHECK_MODULES accepts optional 3rd and 4th arguments that
1647 dnl can take the place of the default HAVE_GSTUFF=yes and HAVE_GSTUFF=no
1649 AC_DEFUN([EMACS_CHECK_MODULES],
1650 [PKG_CHECK_MODULES([$1], [$2],
1651 [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
1652 m4_default([$3], [HAVE_$1=yes])],
1653 [m4_default([$4], [HAVE_$1=no])])])
1656 if test "${with_sound}" != "no"; then
1657 # Sound support for GNU/Linux, the free BSDs, MinGW, and Cygwin.
1658 AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h mmsystem.h],
1659 have_sound_header=yes, [], [
1661 #define WIN32_LEAN_AND_MEAN
1662 #include <windows.h>
1665 test "${with_sound}" = "oss" && test "${have_sound_header}" != "yes" && \
1666 AC_MSG_ERROR([OSS sound support requested but not found.])
1668 if test "${with_sound}" = "bsd-ossaudio" || test "${with_sound}" = "yes"; then
1669 # Emulation library used on NetBSD.
1670 AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
1671 test "${with_sound}" = "bsd-ossaudio" && test -z "$LIBSOUND" && \
1672 AC_MSG_ERROR([bsd-ossaudio sound support requested but not found.])
1673 dnl FIXME? If we did find ossaudio, should we set with_sound=bsd-ossaudio?
1674 dnl Traditionally, we go on to check for alsa too. Does that make sense?
1678 if test "${with_sound}" = "alsa" || test "${with_sound}" = "yes"; then
1680 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
1681 EMACS_CHECK_MODULES([ALSA], [$ALSA_MODULES])
1682 if test $HAVE_ALSA = yes; then
1683 LIBSOUND="$LIBSOUND $ALSA_LIBS"
1684 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
1685 AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
1686 elif test "${with_sound}" = "alsa"; then
1687 AC_MSG_ERROR([ALSA sound support requested but not found.])
1689 fi dnl with_sound = alsa|yes
1691 dnl Define HAVE_SOUND if we have sound support. We know it works and
1692 dnl compiles only on the specified platforms. For others, it
1693 dnl probably doesn't make sense to try.
1694 dnl FIXME So surely we should bypass this whole section if not using
1695 dnl one of these platforms?
1696 if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
1698 dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
1699 dnl Adjust the --with-sound help text if you change this.
1700 gnu-linux|freebsd|netbsd|mingw32|cygwin)
1701 AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.])
1707 AC_SUBST(CFLAGS_SOUND)
1710 dnl checks for header files
1711 AC_CHECK_HEADERS_ONCE(
1718 sys/utsname.h pwd.h utmp.h util.h
1719 sanitizer/lsan_interface.h)
1721 AC_CACHE_CHECK([for ADDR_NO_RANDOMIZE],
1722 [emacs_cv_personality_addr_no_randomize],
1724 [AC_LANG_PROGRAM([[#include <sys/personality.h>]],
1725 [[personality (personality (0xffffffff)
1726 | ADDR_NO_RANDOMIZE)]])],
1727 [emacs_cv_personality_addr_no_randomize=yes],
1728 [emacs_cv_personality_addr_no_randomize=no])])
1729 if test $emacs_cv_personality_addr_no_randomize = yes; then
1730 AC_DEFINE([HAVE_PERSONALITY_ADDR_NO_RANDOMIZE], [1],
1731 [Define to 1 if personality flag ADDR_NO_RANDOMIZE exists.])
1734 # Note that Solaris has sys/sysinfo.h which defines struct
1735 # sysinfo as well. To make sure that we're using GNU/Linux
1736 # sysinfo, we explicitly set one of its fields.
1737 if test "$ac_cv_header_sys_sysinfo_h" = yes; then
1738 AC_CACHE_CHECK([if Linux sysinfo may be used], [emacs_cv_linux_sysinfo],
1739 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sysinfo.h>]],
1740 [[struct sysinfo si;
1743 emacs_cv_linux_sysinfo=yes, emacs_cv_linux_sysinfo=no)])
1745 if test $emacs_cv_linux_sysinfo = yes; then
1746 AC_DEFINE([HAVE_LINUX_SYSINFO], 1, [Define to 1 if you have Linux sysinfo function.])
1747 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sysinfo.h>]],
1748 [[struct sysinfo si; return si.mem_unit]])],
1749 AC_DEFINE(LINUX_SYSINFO_UNIT, 1,
1750 [Define to 1 if Linux sysinfo sizes are in multiples of mem_unit bytes.]))
1754 dnl On Solaris 8 there's a compilation warning for term.h because
1755 dnl it doesn't define 'bool'.
1756 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <term.h>]],[[]])],
1757 AC_DEFINE(HAVE_TERM_H, 1, [Define to 1 if you have the <term.h> header file.]))
1760 AC_CHECK_HEADERS_ONCE(sys/socket.h)
1761 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1762 #if HAVE_SYS_SOCKET_H
1763 #include <sys/socket.h>
1765 AC_CHECK_HEADERS(ifaddrs.h, , , [AC_INCLUDES_DEFAULT
1766 #if HAVE_SYS_SOCKET_H
1767 #include <sys/socket.h>
1769 AC_CHECK_HEADERS(net/if_dl.h, , , [AC_INCLUDES_DEFAULT
1770 #if HAVE_SYS_SOCKET_H
1771 #include <sys/socket.h>
1774 dnl checks for structure members
1775 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
1776 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
1777 struct ifreq.ifr_addr,
1778 struct ifreq.ifr_addr.sa_len], , ,
1779 [AC_INCLUDES_DEFAULT
1780 #if HAVE_SYS_SOCKET_H
1781 #include <sys/socket.h>
1787 dnl Check for endianness.
1788 dnl AC_C_BIGENDIAN is done by gnulib.
1790 dnl check for Make feature
1793 AUTODEPEND_PARENTS='lib src'
1794 dnl check if we have GCC and autodepend is on.
1795 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
1796 AC_CACHE_CHECK([whether gcc understands -MMD -MF], [emacs_cv_autodepend],
1797 [SAVE_CFLAGS="$CFLAGS"
1798 CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
1799 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1800 [emacs_cv_autodepend=yes], [emacs_cv_autodepend=no])
1801 CFLAGS="$SAVE_CFLAGS"
1802 test -f deps.d || emacs_cv_autodepend=no
1804 if test $emacs_cv_autodepend = yes; then
1808 AC_SUBST(AUTO_DEPEND)
1810 #### Choose a window system.
1812 ## We leave window_system equal to none if
1813 ## we end up building without one. Any new window system should
1814 ## set window_system to an appropriate value and add objects to
1815 ## window-system-specific substs.
1819 if test "$no_x" != yes; then
1823 LD_SWITCH_X_SITE_RPATH=
1824 if test "${x_libraries}" != NONE; then
1825 if test -n "${x_libraries}"; then
1826 LD_SWITCH_X_SITE=-L`AS_ECHO(["$x_libraries"]) | sed -e 's/:/ -L/g'`
1827 LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`
1828 AS_ECHO(["$x_libraries"]) | sed -e 's/:/ -Wl,-rpath,/g'
1831 x_default_search_path=""
1832 x_search_path=${x_libraries}
1833 if test -z "${x_search_path}"; then
1834 x_search_path=/usr/lib
1836 for x_library in `AS_ECHO(["$x_search_path:"]) | \
1837 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
1839 ${x_library}/X11/%L/%T/%N%C%S:\
1840 ${x_library}/X11/%l/%T/%N%C%S:\
1841 ${x_library}/X11/%T/%N%C%S:\
1842 ${x_library}/X11/%L/%T/%N%S:\
1843 ${x_library}/X11/%l/%T/%N%S:\
1844 ${x_library}/X11/%T/%N%S"
1845 if test x"${x_default_search_path}" = x; then
1846 x_default_search_path=${x_search_path}
1848 x_default_search_path="${x_search_path}:${x_default_search_path}"
1852 AC_SUBST(LD_SWITCH_X_SITE_RPATH)
1854 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
1855 C_SWITCH_X_SITE=$isystem`AS_ECHO(["$x_includes"]) | sed -e "s/:/ $isystem/g"`
1858 if test x"${x_includes}" = x; then
1859 bitmapdir=/usr/include/X11/bitmaps
1861 # accumulate include directories that have X11 bitmap subdirectories
1863 for bmd in `AS_ECHO(["$x_includes"]) | sed -e 's/:/ /g'`; do
1864 if test -d "${bmd}/X11/bitmaps"; then
1865 bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
1867 if test -d "${bmd}/bitmaps"; then
1868 bmd_acc="${bmd_acc}:${bmd}/bitmaps"
1871 bitmapdir=${bmd_acc#:}
1876 test "${with_ns}" = maybe && test "${opsys}" != darwin && with_ns=no
1878 NS_GNUSTEP_CONFIG=no
1881 tmp_CPPFLAGS="$CPPFLAGS"
1882 tmp_CFLAGS="$CFLAGS"
1883 CPPFLAGS="$CPPFLAGS -x objective-c"
1884 CFLAGS="$CFLAGS -x objective-c"
1887 if test "${with_ns}" != no; then
1888 # macfont.o requires macuvs.h which is absent after 'make extraclean',
1889 # so avoid NS_IMPL_COCOA if macuvs.h is absent.
1890 # Even a headless Emacs can build macuvs.h, so this should let you bootstrap.
1891 if test "${opsys}" = darwin && test -f "$srcdir/src/macuvs.h"; then
1893 ns_appdir=`pwd`/nextstep/Emacs.app
1894 ns_appbindir=${ns_appdir}/Contents/MacOS
1895 ns_appresdir=${ns_appdir}/Contents/Resources
1896 ns_appsrc=Cocoa/Emacs.base
1897 ns_fontfile=macfont.o
1898 elif flags=$( (gnustep-config --objc-flags) 2>/dev/null); then
1900 NS_GNUSTEP_CONFIG=yes
1901 GNU_OBJC_CFLAGS="$flags"
1902 LIBS_GNUSTEP=$(gnustep-config --gui-libs) || exit
1903 elif test -f $GNUSTEP_CONFIG_FILE; then
1905 dnl FIXME sourcing this several times in subshells seems inefficient.
1906 GNUSTEP_SYSTEM_HEADERS=$(
1907 . $GNUSTEP_CONFIG_FILE
1908 AS_ECHO(["$GNUSTEP_SYSTEM_HEADERS"])
1910 GNUSTEP_SYSTEM_LIBRARIES=$(
1911 . $GNUSTEP_CONFIG_FILE
1912 AS_ECHO(["$GNUSTEP_SYSTEM_LIBRARIES"])
1914 dnl I seemed to need these as well with GNUstep-startup 0.25.
1915 GNUSTEP_LOCAL_HEADERS=$(
1916 . $GNUSTEP_CONFIG_FILE
1917 AS_ECHO(["$GNUSTEP_LOCAL_HEADERS"])
1919 GNUSTEP_LOCAL_LIBRARIES=$(
1920 . $GNUSTEP_CONFIG_FILE
1921 AS_ECHO(["$GNUSTEP_LOCAL_LIBRARIES"])
1923 test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
1924 GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
1925 test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
1926 GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
1927 CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1928 CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1929 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
1930 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
1931 dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
1932 dnl If they had chosen to either define it or not, we could have
1933 dnl just used AC_CHECK_DECL here.
1934 AC_CACHE_CHECK(if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS,
1935 emacs_cv_objc_exceptions,
1936 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <GNUstepBase/GSConfig.h>]],
1937 [[#if defined BASE_NATIVE_OBJC_EXCEPTIONS && BASE_NATIVE_OBJC_EXCEPTIONS > 0
1941 #endif]])], emacs_cv_objc_exceptions=yes, emacs_cv_objc_exceptions=no ) )
1942 if test $emacs_cv_objc_exceptions = yes; then
1943 dnl _NATIVE_OBJC_EXCEPTIONS is used by the GNUstep headers.
1944 AC_DEFINE(_NATIVE_OBJC_EXCEPTIONS, 1,
1945 [Define if GNUstep uses ObjC exceptions.])
1946 GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fobjc-exceptions"
1949 if test $NS_IMPL_GNUSTEP = yes; then
1950 ns_appdir=`pwd`/nextstep/Emacs.app
1951 ns_appbindir=${ns_appdir}
1952 ns_appresdir=${ns_appdir}/Resources
1953 ns_appsrc=GNUstep/Emacs.base
1954 ns_fontfile=nsfont.o
1957 dnl This is only used while we test the NS headers, it gets reset below.
1958 CPPFLAGS="$CPPFLAGS $GNU_OBJC_CFLAGS"
1959 CFLAGS="$CFLAGS $GNU_OBJC_CFLAGS"
1961 AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
1962 [AC_MSG_ERROR([The include files (AppKit/AppKit.h etc) that
1963 are required for a Nextstep build are missing or cannot be compiled.
1964 Either fix this, or re-configure with the option '--without-ns'.])])
1967 if test "${NS_IMPL_COCOA}" = "yes"; then
1968 AC_MSG_CHECKING([for Mac OS X 10.6 or newer])
1969 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>],
1971 #ifdef MAC_OS_X_VERSION_MAX_ALLOWED
1972 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
1975 error "Mac OS X 10.6 or newer required";
1979 ns_osx_have_106=yes,
1981 AC_MSG_RESULT([$ns_osx_have_106])
1983 if test $ns_osx_have_106 = no; then
1984 AC_MSG_ERROR([Mac OS X 10.6 or newer is required]);
1988 if test "${with_native_image_api}" = yes; then
1989 AC_DEFINE(HAVE_NATIVE_IMAGE_API, 1, [Define to use native OS APIs for images.])
1990 NATIVE_IMAGE_API="yes (ns)"
1994 AC_SUBST(LIBS_GNUSTEP)
1996 INSTALL_ARCH_INDEP_EXTRA=install-etc
1997 ns_self_contained=no
2000 if test "${HAVE_NS}" = yes; then
2001 if test "$with_toolkit_scroll_bars" = "no"; then
2002 AC_MSG_WARN([Non-toolkit scroll bars are not implemented for Nextstep.])
2005 window_system=nextstep
2006 # set up packaging dirs
2007 if test "${EN_NS_SELF_CONTAINED}" = yes; then
2008 ns_self_contained=yes
2009 prefix=${ns_appresdir}
2010 exec_prefix=${ns_appbindir}
2011 dnl This one isn't really used, only archlibdir is.
2012 libexecdir="\${ns_appbindir}/libexec"
2013 archlibdir="\${ns_appbindir}/libexec"
2014 etcdocdir="\${ns_appresdir}/etc"
2015 etcdir="\${ns_appresdir}/etc"
2016 dnl FIXME maybe set datarootdir instead.
2017 dnl That would also get applications, icons, man.
2018 infodir="\${ns_appresdir}/info"
2019 mandir="\${ns_appresdir}/man"
2020 lispdir="\${ns_appresdir}/lisp"
2021 test "$locallisppathset" = no && locallisppath=""
2022 INSTALL_ARCH_INDEP_EXTRA=
2025 NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o $ns_fontfile"
2027 CFLAGS="$tmp_CFLAGS"
2028 CPPFLAGS="$tmp_CPPFLAGS"
2029 AC_SUBST(INSTALL_ARCH_INDEP_EXTRA)
2030 AC_SUBST(ns_self_contained)
2032 AC_SUBST(NS_OBJC_OBJ)
2034 if test "${HAVE_NS}" = yes; then
2036 [if the Objective C compiler supports instancetype],
2037 [emacs_cv_objc_instancetype],
2038 [AC_LANG_PUSH([Objective C])
2040 [AC_LANG_SOURCE([[@interface Test
2041 + (instancetype)test;
2043 emacs_cv_objc_instancetype=yes,
2044 emacs_cv_objc_instancetype=no)
2045 AC_LANG_POP([Objective C])])
2047 if test x$emacs_cv_objc_instancetype = xyes ; then
2048 AC_DEFINE(NATIVE_OBJC_INSTANCETYPE, 1,
2049 [Define if ObjC compiler supports instancetype natively.])
2053 [if the Objective C compiler defaults to C99],
2054 [emacs_cv_objc_c99],
2055 [AC_LANG_PUSH([Objective C])
2057 [AC_LANG_PROGRAM([], [[for (int i = 0;;);]])],
2058 emacs_cv_objc_c99=yes,
2059 emacs_cv_objc_c99=no)
2060 AC_LANG_POP([Objective C])])
2062 if test x$emacs_cv_objc_c99 = xno ; then
2063 GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -std=c99"
2075 if test "${with_w32}" != no; then
2078 AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
2079 [AC_MSG_ERROR(['--with-w32' was specified, but windows.h
2080 cannot be found.])])
2083 ## Using --with-w32 with MinGW is a no-op, but we allow it.
2086 AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin and MinGW32.])
2091 if test "${opsys}" = "mingw32"; then
2092 AC_CACHE_CHECK([whether Windows API headers are recent enough], [emacs_cv_w32api],
2093 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2094 #include <windows.h>
2095 #include <usp10.h>]],
2096 [[PIMAGE_NT_HEADERS pHeader;
2097 PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader)]])],
2098 [emacs_cv_w32api=yes], [emacs_cv_w32api=no])])
2099 if test "${emacs_cv_w32api}" = "no"; then
2100 AC_MSG_ERROR([the Windows API headers are too old to support this build.])
2102 HAVE_W32=${emacs_cv_w32api}
2112 if test "${HAVE_W32}" = "yes"; then
2113 AC_DEFINE(HAVE_NTGUI, 1, [Define to use native MS Windows GUI.])
2114 if test "$with_toolkit_scroll_bars" = "no"; then
2115 AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for w32 build.])
2117 AC_CHECK_TOOL(WINDRES, [windres],
2118 [AC_MSG_ERROR([No resource compiler found.])])
2119 W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
2120 W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o w32cygwinx.o"
2121 EMACSRES="emacs.res"
2122 case "$canonical" in
2123 x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;;
2124 *) EMACS_MANIFEST="emacs-x86.manifest" ;;
2126 dnl Construct something of the form "24,4,0,0" with 4 components.
2127 comma_version=`echo "${PACKAGE_VERSION}.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'`
2129 comma_space_version=`echo "$comma_version" | sed 's/,/, /g'`
2130 AC_SUBST(comma_version)
2131 AC_SUBST(comma_space_version)
2132 AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc])
2133 if test "${opsys}" = "cygwin"; then
2134 W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lusp10 -lgdi32"
2135 W32_LIBS="$W32_LIBS -lole32 -lcomdlg32 -lcomctl32 -lwinspool"
2136 # Tell the linker that emacs.res is an object (which we compile from
2137 # the rc file), not a linker script.
2138 W32_RES_LINK="-Wl,emacs.res"
2140 W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
2141 dnl FIXME: This should probably be supported for Cygwin/w32 as
2142 dnl well, but the Cygwin build needs to link against -lgdiplus
2143 if test "${with_native_image_api}" = yes; then
2144 AC_DEFINE(HAVE_NATIVE_IMAGE_API, 1, [Define to use native OS APIs for images.])
2145 NATIVE_IMAGE_API="yes (w32)"
2146 W32_OBJ="$W32_OBJ w32image.o"
2148 W32_LIBS="$W32_LIBS -lwinmm -lusp10 -lgdi32 -lcomdlg32"
2149 W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32"
2150 W32_RES_LINK="\$(EMACSRES)"
2151 CLIENTRES="emacsclient.res"
2152 CLIENTW="emacsclientw\$(EXEEXT)"
2153 FIRSTFILE_OBJ=firstfile.o
2156 LIBS_ECLIENT="-lcomctl32"
2157 LIB_WSOCK32="-lwsock32"
2158 NTLIB="ntlib.$ac_objext"
2159 XARGS_LIMIT="-s 10000"
2163 if test "${HAVE_W32}" = "no" && test "${opsys}" = "cygwin"; then
2164 W32_LIBS="-lkernel32"
2165 W32_OBJ="w32cygwinx.o"
2171 AC_SUBST(EMACS_MANIFEST)
2174 AC_SUBST(W32_RES_LINK)
2175 AC_SUBST(FIRSTFILE_OBJ)
2178 AC_SUBST(LIBS_ECLIENT)
2179 AC_SUBST(LIB_WSOCK32)
2181 AC_SUBST(XARGS_LIMIT)
2183 if test "${HAVE_W32}" = "yes"; then
2188 ## $window_system is now set to the window system we will
2196 case "${window_system}" in
2201 case "${with_x_toolkit}" in
2202 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
2203 motif ) USE_X_TOOLKIT=MOTIF ;;
2205 term_header=gtkutil.h
2206 dnl Don't set this for GTK. A lot of tests below assumes Xt when
2207 dnl USE_X_TOOLKIT is set.
2208 USE_X_TOOLKIT=none ;;
2209 gtk2 ) with_gtk2=yes
2210 term_header=gtkutil.h
2211 USE_X_TOOLKIT=none ;;
2212 gtk3 ) with_gtk3=yes
2213 term_header=gtkutil.h
2214 USE_X_TOOLKIT=none ;;
2215 no ) USE_X_TOOLKIT=none ;;
2216 dnl If user did not say whether to use a toolkit, make this decision later:
2217 dnl use the toolkit if we have gtk, or X11R5 or newer.
2218 * ) USE_X_TOOLKIT=maybe ;;
2222 term_header=nsterm.h
2225 term_header=w32term.h
2229 if test "$window_system" = none && test "X$with_x" != "Xno"; then
2230 AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
2231 if test "$HAVE_XSERVER" = true ||
2232 test -n "$DISPLAY" ||
2234 for emacs_libX11 in /usr/lib/libX11.*; do break; done
2235 test "$emacs_libX11" != '/usr/lib/libX11.*'
2238 AC_MSG_ERROR([You seem to be running X, but no X development libraries
2239 were found. You should install the relevant development files for X
2240 and for the toolkit you want, such as Gtk+. Also make
2241 sure you have development files for image handling, i.e.
2242 tiff, gif, jpeg, png and xpm.
2243 If you are sure you want Emacs compiled without X window support, pass
2249 # Does the opsystem file prohibit the use of the GNU malloc?
2250 # Assume not, until told otherwise.
2254 [whether malloc is Doug Lea style],
2255 [emacs_cv_var_doug_lea_malloc],
2256 [emacs_cv_var_doug_lea_malloc=no
2257 dnl Hooks do not work with address sanitization.
2258 if test "$emacs_cv_sanitize_address" != yes; then
2261 [[#include <malloc.h>
2262 static void hook (void) {}]],
2263 [[malloc_set_state (malloc_get_state ());
2264 __after_morecore_hook = hook;
2265 __malloc_initialize_hook = hook;]])],
2266 [emacs_cv_var_doug_lea_malloc=yes])
2268 doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
2273 test $with_unexec = yes &&
2275 ## darwin ld insists on the use of malloc routines in the System framework.
2276 darwin | mingw32 | nacl | solaris) ;;
2277 cygwin | qnxnto | freebsd)
2280 *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
2283 if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \
2284 && test "${UNEXEC_OBJ}" = unexelf.o; then
2290 if test "${system_malloc}" = "yes"; then
2291 AC_DEFINE([SYSTEM_MALLOC], 1,
2292 [Define to 1 to use the system memory allocator, even if it is not
2296 (The GNU allocators don't work with this system configuration.)"
2298 elif test "$hybrid_malloc" = yes; then
2299 AC_DEFINE(HYBRID_MALLOC, 1,
2300 [Define to use gmalloc before dumping and the system malloc after.])
2303 GNU_MALLOC_reason=" (only before dumping)"
2304 GMALLOC_OBJ=gmalloc.o
2307 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
2308 VMLIMIT_OBJ=vm-limit.o
2310 AC_CHECK_HEADERS([sys/vlimit.h])
2311 AC_CACHE_CHECK([for data_start], [emacs_cv_data_start],
2314 [[extern char data_start[]; char ch;]],
2315 [[return data_start < &ch;]])],
2316 [emacs_cv_data_start=yes],
2317 [emacs_cv_data_start=no])])
2318 if test $emacs_cv_data_start = yes; then
2319 AC_DEFINE([HAVE_DATA_START], 1,
2320 [Define to 1 if data_start is the address of the start
2321 of the main data segment.])
2324 AC_SUBST([HYBRID_MALLOC])
2325 AC_SUBST(GMALLOC_OBJ)
2326 AC_SUBST(VMLIMIT_OBJ)
2328 if test "$doug_lea_malloc" = "yes" && test "$hybrid_malloc" != yes; then
2329 if test "$GNU_MALLOC" = yes ; then
2331 (Using Doug Lea's new malloc from the GNU C Library.)"
2333 AC_DEFINE(DOUG_LEA_MALLOC, 1,
2334 [Define to 1 if the system memory allocator is Doug Lea style,
2335 with malloc hooks and malloc_set_state.])
2337 ## Use mmap directly for allocating larger buffers.
2338 ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
2339 ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
2340 ## Does the AC_FUNC_MMAP test below make this check unnecessary?
2342 mingw32|gnu*) REL_ALLOC=no ;;
2346 if test x"${REL_ALLOC}" = x; then
2347 REL_ALLOC=${GNU_MALLOC}
2350 use_mmap_for_buffers=no
2352 mingw32) use_mmap_for_buffers=yes ;;
2356 if test $use_mmap_for_buffers = yes; then
2357 AC_DEFINE(USE_MMAP_FOR_BUFFERS, 1, [Define to use mmap to allocate buffer text.])
2361 LIBS="$LIBS_SYSTEM $LIBS"
2363 dnl FIXME replace main with a function we actually want from this library.
2364 AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
2366 dnl Check for the POSIX thread library.
2368 AC_CHECK_HEADERS_ONCE(pthread.h)
2369 if test "$ac_cv_header_pthread_h" && test "$opsys" != "mingw32"; then
2370 AC_CACHE_CHECK([for pthread library],
2371 [emacs_cv_pthread_lib],
2372 [emacs_cv_pthread_lib=no
2374 for emacs_pthread_lib in 'none needed' -lpthread; do
2375 case $emacs_pthread_lib in
2376 -*) LIBS="$OLD_LIBS $emacs_pthread_lib";;
2380 [[#include <pthread.h>
2382 sigset_t old_mask, new_mask;
2383 void noop (void) {}]],
2384 [[pthread_t th = pthread_self ();
2386 status += pthread_create (&th, 0, 0, 0);
2387 status += pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask);
2388 status += pthread_kill (th, 0);
2389 #if ! (defined SYSTEM_MALLOC || defined HYBRID_MALLOC \
2390 || defined DOUG_LEA_MALLOC)
2391 /* Test for pthread_atfork only if gmalloc uses it,
2392 as older-style hosts like MirBSD 10 lack it. */
2393 status += pthread_atfork (noop, noop, noop);
2396 [emacs_cv_pthread_lib=$emacs_pthread_lib])
2398 if test "$emacs_cv_pthread_lib" != no; then
2402 if test "$emacs_cv_pthread_lib" != no; then
2403 AC_DEFINE([HAVE_PTHREAD], 1, [Define to 1 if you have POSIX threads.])
2404 case $emacs_cv_pthread_lib in
2405 -*) LIB_PTHREAD=$emacs_cv_pthread_lib;;
2407 ac_cv_func_pthread_sigmask=yes
2408 # Some systems optimize for single-threaded programs by default, and
2409 # need special flags to disable these optimizations. For example, the
2410 # definition of 'errno' in <errno.h>.
2413 AC_DEFINE([_REENTRANT], 1,
2414 [Define to 1 if your system requires this in multithreaded code.]);;
2416 AC_DEFINE([_THREAD_SAFE], 1,
2417 [Define to 1 if your system requires this in multithreaded code.]);;
2421 AC_SUBST([LIB_PTHREAD])
2423 AC_MSG_CHECKING([for thread support])
2425 if test "$with_threads" = yes; then
2426 if test "$emacs_cv_pthread_lib" != no; then
2427 AC_DEFINE(THREADS_ENABLED, 1,
2428 [Define to 1 if you want elisp thread support.])
2430 elif test "${opsys}" = "mingw32"; then
2431 dnl MinGW can do native Windows threads even without pthreads
2432 AC_DEFINE(THREADS_ENABLED, 1,
2433 [Define to 1 if you want elisp thread support.])
2437 AC_MSG_RESULT([$threads_enabled])
2439 dnl Check for need for bigtoc support on IBM AIX
2443 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
2445 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
2446 *) gdb_cv_bigtoc=-bbigtoc ;;
2449 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
2450 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], [], [gdb_cv_bigtoc=])
2455 # Change CFLAGS, CPPFLAGS, and LIBS temporarily so that C_SWITCH_X_SITE
2456 # is for the tests that follow. We set them back later on.
2458 REAL_CFLAGS="$CFLAGS"
2459 REAL_CPPFLAGS="$CPPFLAGS"
2462 if test "${HAVE_X11}" = "yes"; then
2463 DEFS="$C_SWITCH_X_SITE $DEFS"
2464 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
2466 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
2467 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
2469 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
2470 # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
2471 # but it's more convenient here to set LD_RUN_PATH since this
2472 # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
2473 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
2474 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
2478 if test "${opsys}" = "gnu-linux"; then
2479 AC_CACHE_CHECK([whether X on GNU/Linux needs -b to link], [emacs_cv_b_link],
2480 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
2481 [[XOpenDisplay ("foo");]])],
2482 [xgnu_linux_first_failure=no],
2483 [xgnu_linux_first_failure=yes])
2484 if test "${xgnu_linux_first_failure}" = "yes"; then
2485 OLD_CPPFLAGS="$CPPFLAGS"
2487 CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
2488 LIBS="$LIBS -b i486-linuxaout"
2489 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
2490 [[XOpenDisplay ("foo");]])],
2491 [xgnu_linux_second_failure=no],
2492 [xgnu_linux_second_failure=yes])
2493 if test "${xgnu_linux_second_failure}" = "yes"; then
2494 # If we get the same failure with -b, there is no use adding -b.
2495 # So leave it out. This plays safe.
2500 CPPFLAGS=$OLD_CPPFLAGS
2505 if test "x$emacs_cv_b_link" = xyes ; then
2506 LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
2507 C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
2511 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
2512 # header files included from there.
2513 AC_CACHE_CHECK([for Xkb], [emacs_cv_xkb],
2514 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
2515 #include <X11/XKBlib.h>]],
2516 [[XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);]])],
2517 emacs_cv_xkb=yes, emacs_cv_xkb=no)])
2518 if test $emacs_cv_xkb = yes; then
2519 AC_DEFINE(HAVE_XKB, 1, [Define to 1 if you have the Xkb extension.])
2522 AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
2523 XScreenNumberOfScreen)
2526 if test "${window_system}" = "x11"; then
2527 AC_MSG_CHECKING(X11 version 6)
2528 AC_CACHE_VAL(emacs_cv_x11_version_6,
2529 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
2530 [[#if XlibSpecificationRelease < 6
2533 ]])], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
2534 if test $emacs_cv_x11_version_6 = yes; then
2535 AC_MSG_RESULT(6 or newer)
2536 AC_DEFINE(HAVE_X11R6, 1,
2537 [Define to 1 if you have the X11R6 or newer version of Xlib.])
2538 AC_DEFINE(HAVE_X_I18N, 1, [Define if you have usable i18n support.])
2539 ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
2543 *) AC_DEFINE(HAVE_X11R6_XIM, 1,
2544 [Define if you have usable X11R6-style XIM support.])
2548 AC_MSG_RESULT(before 6)
2553 ### Use -lrsvg-2 if available, unless '--with-rsvg=no' is specified.
2555 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${opsys}" = "mingw32"; then
2556 if test "${with_rsvg}" != "no"; then
2557 RSVG_REQUIRED=2.14.0
2558 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
2560 EMACS_CHECK_MODULES([RSVG], [$RSVG_MODULE])
2561 AC_SUBST(RSVG_CFLAGS)
2564 if test $HAVE_RSVG = yes; then
2565 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
2566 CFLAGS="$CFLAGS $RSVG_CFLAGS"
2567 # Windows loads librsvg dynamically
2568 if test "${opsys}" = "mingw32"; then
2576 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes"; then
2577 if test "${with_imagemagick}" != "no"; then
2578 if test -n "$BREW"; then
2579 # Homebrew doesn't link ImageMagick 6 by default, so make sure
2580 # pkgconfig can find it.
2581 export PKG_CONFIG_PATH="$PKG_CONFIG_PATH$PATH_SEPARATOR`$BREW --prefix imagemagick@6 2>/dev/null`/lib/pkgconfig"
2584 EMACS_CHECK_MODULES([IMAGEMAGICK], [MagickWand >= 7])
2585 if test $HAVE_IMAGEMAGICK = yes; then
2586 AC_DEFINE([HAVE_IMAGEMAGICK7], 1, [Define to 1 if using ImageMagick7.])
2588 ## 6.3.5 is the earliest version known to work; see Bug#17339.
2589 ## 6.8.2 makes Emacs crash; see Bug#13867.
2590 EMACS_CHECK_MODULES([IMAGEMAGICK], [Wand >= 6.3.5 Wand != 6.8.2])
2593 if test $HAVE_IMAGEMAGICK = yes; then
2596 CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
2597 LIBS="$IMAGEMAGICK_LIBS $LIBS"
2598 AC_CHECK_FUNCS([MagickRelinquishMemory MagickExportImagePixels \
2599 MagickMergeImageLayers MagickAutoOrientImage])
2602 # Check that ImageMagick links. It does not link on Fedora 25
2603 # with './configure CC=clang', as pkg-config outputs flags like
2604 # -lomp that work for GCC but not Clang.
2605 if test "$ac_cv_func_MagickRelinquishMemory" != yes; then
2609 if test $HAVE_IMAGEMAGICK = yes; then
2610 AC_DEFINE([HAVE_IMAGEMAGICK], 1, [Define to 1 if using ImageMagick.])
2612 if test "${with_imagemagick}" != "no"; then
2613 AC_MSG_ERROR([ImageMagick wanted, but it does not compile. Maybe some library files are missing?]);
2618 AC_SUBST([IMAGEMAGICK_CFLAGS])
2619 AC_SUBST([IMAGEMAGICK_LIBS])
2623 AC_CHECK_LIB(anl, getaddrinfo_a, HAVE_GETADDRINFO_A=yes)
2624 if test "${HAVE_GETADDRINFO_A}" = "yes"; then
2625 AC_DEFINE(HAVE_GETADDRINFO_A, 1,
2626 [Define to 1 if you have getaddrinfo_a for asynchronous DNS resolution.])
2627 GETADDRINFO_A_LIBS="-lanl"
2628 AC_SUBST(GETADDRINFO_A_LIBS)
2633 gtk_term_header=$term_header
2636 if test "${opsys}" != "mingw32"; then
2637 if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
2638 GLIB_REQUIRED=2.37.5
2640 GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
2642 dnl Checks for libraries.
2643 EMACS_CHECK_MODULES([GTK], [$GTK_MODULES],
2644 [pkg_check_gtk=yes], [pkg_check_gtk=no])
2645 if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
2646 AC_MSG_ERROR($GTK_PKG_ERRORS)
2648 if test "$pkg_check_gtk" = "yes"; then
2649 AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
2650 GTK_OBJ=emacsgtkfixed.o
2651 gtk_term_header=gtkutil.h
2652 USE_GTK_TOOLKIT="GTK3"
2653 if test "x$ac_enable_gtk_deprecation_warnings" = x; then
2654 AC_DEFINE([GDK_DISABLE_DEPRECATION_WARNINGS], [1],
2655 [Define to 1 to disable GTK+/GDK deprecation warnings.])
2656 AC_DEFINE([GLIB_DISABLE_DEPRECATION_WARNINGS], [1],
2657 [Define to 1 to disable Glib deprecation warnings.])
2661 gtk3_pkg_errors="$GTK_PKG_ERRORS "
2665 if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
2668 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
2670 dnl Checks for libraries.
2671 EMACS_CHECK_MODULES([GTK], [$GTK_MODULES],
2672 [pkg_check_gtk=yes], [pkg_check_gtk=no])
2673 if test "$pkg_check_gtk" = "no" &&
2674 { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
2676 AC_MSG_ERROR($gtk3_pkg_errors$GTK_PKG_ERRORS)
2678 test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
2685 if test x"$pkg_check_gtk" = xyes; then
2688 CFLAGS="$CFLAGS $GTK_CFLAGS"
2689 LIBS="$GTK_LIBS $LIBS"
2690 dnl Try to compile a simple GTK program.
2691 AC_CACHE_CHECK([whether GTK compiles], [emacs_cv_gtk_compiles],
2694 [[/* Check the Gtk and Glib APIs. */
2695 #include <gtk/gtk.h>
2696 #include <glib-object.h>
2698 callback (GObject *go, GParamSpec *spec, gpointer user_data)
2702 GtkSettings *gs = 0;
2703 /* Use G_CALLBACK to make sure function pointers can be cast to void *;
2704 strict C prohibits this. Use gtk_main_iteration to test that the
2705 libraries are there. */
2706 if (g_signal_handler_find (G_OBJECT (gs), G_SIGNAL_MATCH_FUNC,
2707 0, 0, 0, G_CALLBACK (callback), 0))
2708 gtk_main_iteration ();
2710 [emacs_cv_gtk_compiles=yes], [emacs_cv_gtk_compiles=no])])
2711 if test "${emacs_cv_gtk_compiles}" != "yes"; then
2713 if test "$USE_X_TOOLKIT" != "maybe"; then
2714 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
2717 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
2719 AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
2720 GTK_OBJ="gtkutil.o $GTK_OBJ"
2721 term_header=$gtk_term_header
2723 AC_MSG_WARN([[Your version of Gtk+ will have problems with
2724 closing open displays. This is no problem if you just use
2725 one display, but if you use more than one and close one of them
2727 See https://gitlab.gnome.org/GNOME/gtk/issues/221]])
2734 if test "${HAVE_GTK}" = "yes"; then
2736 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
2737 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
2738 if test "$with_toolkit_scroll_bars" != no; then
2739 with_toolkit_scroll_bars=yes
2742 term_header=gtkutil.h
2744 if test "${USE_GTK_TOOLKIT}" = GTK2; then
2746 dnl Check if we have the old file selection dialog declared and
2747 dnl in the link library. In 2.x it may be in the library,
2748 dnl but not declared if deprecated featured has been selected out.
2749 dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
2750 HAVE_GTK_FILE_SELECTION=no
2751 AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
2752 HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
2753 #include <gtk/gtk.h>])
2754 if test "$HAVE_GTK_FILE_SELECTION" = yes; then
2755 AC_CHECK_FUNCS(gtk_file_selection_new)
2758 dnl This procedure causes a bug on certain Ubuntu GTK+2 builds
2759 AC_CHECK_FUNCS(gtk_window_set_has_resize_grip)
2764 dnl Enable xwidgets if GTK3 and WebKitGTK+ are available.
2765 dnl Enable xwidgets if macOS Cocoa and WebKit framework are available.
2768 if test "$with_xwidgets" != "no"; then
2769 if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then
2770 WEBKIT_REQUIRED=2.12
2771 WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
2772 EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
2773 HAVE_XWIDGETS=$HAVE_WEBKIT
2774 XWIDGETS_OBJ="xwidget.o"
2775 elif test "${NS_IMPL_COCOA}" = "yes"; then
2776 dnl FIXME: Check framework WebKit2
2777 dnl WEBKIT_REQUIRED=M.m.p
2778 WEBKIT_LIBS="-Wl,-framework -Wl,WebKit"
2779 WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers"
2781 HAVE_XWIDGETS=$HAVE_WEBKIT
2782 XWIDGETS_OBJ="xwidget.o"
2783 NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o"
2784 dnl Update NS_OBJC_OBJ with added nsxwidget.o
2785 AC_SUBST(NS_OBJC_OBJ)
2787 AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or macOS Cocoa as window system.])
2790 test $HAVE_XWIDGETS = yes ||
2791 AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not found.])
2793 AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.])
2795 AC_SUBST(XWIDGETS_OBJ)
2800 dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
2801 dnl other platforms.
2804 if test "${with_dbus}" = "yes"; then
2805 EMACS_CHECK_MODULES([DBUS], [dbus-1 >= 1.0])
2806 if test "$HAVE_DBUS" = yes; then
2807 AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
2808 dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1.
2809 dnl dbus_type_is_valid and dbus_validate_* have been introduced in
2812 LIBS="$LIBS $DBUS_LIBS"
2813 AC_CHECK_FUNCS(dbus_watch_get_unix_fd \
2814 dbus_type_is_valid \
2815 dbus_validate_bus_name \
2816 dbus_validate_path \
2817 dbus_validate_interface \
2818 dbus_validate_member)
2823 AC_SUBST(DBUS_CFLAGS)
2827 dnl GSettings has been tested under GNU/Linux only.
2829 if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then
2830 EMACS_CHECK_MODULES([GSETTINGS], [gio-2.0 >= 2.26])
2831 if test "$HAVE_GSETTINGS" = "yes"; then
2833 CFLAGS="$CFLAGS $GSETTINGS_CFLAGS"
2835 LIBS="$LIBS $GSETTINGS_LIBS"
2836 AC_CACHE_CHECK([whether GSettings is in gio], [emacs_cv_gsettings_in_gio],
2839 [[/* Check that gsettings really is present. */
2840 #include <glib-object.h>
2841 #include <gio/gio.h>
2844 GSettings *settings;
2845 GVariant *val = g_settings_get_value (settings, "");
2847 [emacs_cv_gsettings_in_gio=yes], [emacs_cv_gsettings_in_gio=no])])
2849 if test "$emacs_cv_gsettings_in_gio" = "yes"; then
2850 AC_DEFINE(HAVE_GSETTINGS, 1, [Define to 1 if using GSettings.])
2851 SETTINGS_CFLAGS="$GSETTINGS_CFLAGS"
2852 SETTINGS_LIBS="$GSETTINGS_LIBS"
2853 test "$with_gconf" = "yes" || with_gconf=no
2860 dnl GConf has been tested under GNU/Linux only.
2861 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
2863 if test "${HAVE_X11}" = "yes" && test "${with_gconf}" != "no"; then
2864 EMACS_CHECK_MODULES([GCONF], [gconf-2.0 >= 2.13])
2865 if test "$HAVE_GCONF" = yes; then
2866 AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
2867 dnl Newer GConf doesn't link with g_objects, so this is not defined.
2868 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
2869 SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
2873 if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
2874 EMACS_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0])
2875 if test "$HAVE_GOBJECT" = "yes"; then
2876 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS"
2877 SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS"
2879 SAVE_CFLAGS="$CFLAGS"
2881 CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
2882 LIBS="$SETTINGS_LIBS $LIBS"
2883 CFLAGS="$SAVE_CFLAGS"
2886 AC_SUBST(SETTINGS_CFLAGS)
2887 AC_SUBST(SETTINGS_LIBS)
2890 dnl SELinux is available for GNU/Linux only.
2893 if test "${with_selinux}" = "yes"; then
2894 AC_CHECK_LIB([selinux], [lgetfilecon], HAVE_LIBSELINUX=yes, HAVE_LIBSELINUX=no)
2895 if test "$HAVE_LIBSELINUX" = yes; then
2896 AC_DEFINE(HAVE_LIBSELINUX, 1, [Define to 1 if using SELinux.])
2897 LIBSELINUX_LIBS=-lselinux
2900 AC_SUBST(LIBSELINUX_LIBS)
2903 if test "${with_gnutls}" != "no" ; then
2904 EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.2],
2905 [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no])
2906 if test "${HAVE_GNUTLS}" = "yes"; then
2907 AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
2910 # Windows loads GnuTLS dynamically
2911 if test "${opsys}" = "mingw32"; then
2916 AC_SUBST(LIBGNUTLS_LIBS)
2917 AC_SUBST(LIBGNUTLS_CFLAGS)
2920 if test "${with_libsystemd}" = "yes" ; then
2921 dnl This code has been tested with libsystemd 222 and later.
2922 dnl FIXME: Find the earliest version number for which Emacs should work,
2923 dnl and change '222' to that number.
2924 EMACS_CHECK_MODULES([LIBSYSTEMD], [libsystemd >= 222],
2925 [HAVE_LIBSYSTEMD=yes], [HAVE_LIBSYSTEMD=no])
2926 if test "${HAVE_LIBSYSTEMD}" = "yes"; then
2927 AC_DEFINE(HAVE_LIBSYSTEMD, 1, [Define if using libsystemd.])
2931 AC_SUBST(LIBSYSTEMD_LIBS)
2932 AC_SUBST(LIBSYSTEMD_CFLAGS)
2937 if test "${with_json}" != no; then
2938 EMACS_CHECK_MODULES([JSON], [jansson >= 2.7],
2939 [HAVE_JSON=yes], [HAVE_JSON=no])
2940 if test "${HAVE_JSON}" = yes; then
2941 AC_DEFINE(HAVE_JSON, 1, [Define if using Jansson.])
2945 # Windows loads libjansson dynamically
2946 if test "${opsys}" = "mingw32"; then
2952 AC_SUBST(JSON_CFLAGS)
2958 dnl MS Windows native file monitor is available for mingw32 only.
2959 case $with_file_notification,$opsys in
2961 AC_MSG_ERROR(['--with-file-notification=w32' was specified, but
2962 this is only supported on MS-Windows native and MinGW32 builds.
2963 Consider using gfile instead.])
2965 w32,* | yes,mingw32)
2966 AC_CHECK_HEADER(windows.h)
2967 if test "$ac_cv_header_windows_h" = yes ; then
2968 AC_DEFINE(HAVE_W32NOTIFY, 1, [Define to 1 to use w32notify.])
2969 NOTIFY_OBJ=w32notify.o
2970 NOTIFY_SUMMARY="yes (w32)"
2974 dnl inotify is available only on GNU/Linux.
2975 case $with_file_notification,$NOTIFY_OBJ in
2977 AC_CHECK_HEADER(sys/inotify.h)
2978 if test "$ac_cv_header_sys_inotify_h" = yes ; then
2979 AC_CHECK_FUNC(inotify_init1)
2980 if test "$ac_cv_func_inotify_init1" = yes; then
2981 AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.])
2982 NOTIFY_OBJ=inotify.o
2983 NOTIFY_SUMMARY="yes -lglibc (inotify)"
2988 dnl kqueue is available on BSD-like systems.
2989 case $with_file_notification,$NOTIFY_OBJ in
2991 EMACS_CHECK_MODULES([KQUEUE], [libkqueue])
2992 if test "$HAVE_KQUEUE" = "yes"; then
2993 AC_DEFINE(HAVE_KQUEUE, 1, [Define to 1 to use kqueue.])
2994 CPPFLAGS="$CPPFLAGS -I/usr/include/kqueue"
2995 NOTIFY_CFLAGS=$KQUEUE_CFLAGS
2996 NOTIFY_LIBS=$KQUEUE_LIBS
2998 NOTIFY_SUMMARY="yes -lkqueue"
3000 AC_SEARCH_LIBS(kqueue, [])
3001 if test "$ac_cv_search_kqueue" != no; then
3002 AC_DEFINE(HAVE_KQUEUE, 1, [Define to 1 to use kqueue.])
3004 NOTIFY_SUMMARY="yes (kqueue)"
3009 dnl g_file_monitor exists since glib 2.18. G_FILE_MONITOR_EVENT_MOVED
3010 dnl has been added in glib 2.24. It has been tested under
3012 case $with_file_notification,$NOTIFY_OBJ in
3014 if test "${HAVE_NS}" = yes; then
3015 AC_MSG_ERROR(['--with-file-notification=gfile' is not supported in NextStep builds.
3016 Consider kqueue instead.])
3018 EMACS_CHECK_MODULES([GFILENOTIFY], [gio-2.0 >= 2.24])
3019 if test "$HAVE_GFILENOTIFY" = "yes"; then
3020 AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.])
3021 NOTIFY_CFLAGS=$GFILENOTIFY_CFLAGS
3022 NOTIFY_LIBS=$GFILENOTIFY_LIBS
3023 NOTIFY_OBJ=gfilenotify.o
3024 NOTIFY_SUMMARY="yes -lgio (gfile)"
3029 case $with_file_notification,$NOTIFY_OBJ in
3030 yes,* | no,* | *,?*) ;;
3031 *) AC_MSG_ERROR([File notification '$with_file_notification' requested but requirements not found.]) ;;
3034 if test -n "$NOTIFY_OBJ"; then
3035 AC_DEFINE(USE_FILE_NOTIFY, 1, [Define to 1 if using file notifications.])
3037 AC_SUBST(NOTIFY_CFLAGS)
3038 AC_SUBST(NOTIFY_LIBS)
3039 AC_SUBST(NOTIFY_OBJ)
3041 dnl Do not put whitespace before the #include statements below.
3042 dnl Older compilers (eg sunos4 cc) choke on it.
3045 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
3046 if test "$with_xaw3d" != no; then
3047 AC_CACHE_VAL(emacs_cv_xaw3d,
3048 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3049 #include <X11/Intrinsic.h>
3050 #include <X11/Xaw3d/Simple.h>]],
3052 [AC_CHECK_LIB(Xaw3d, XawScrollbarSetThumb,
3053 emacs_cv_xaw3d=yes, emacs_cv_xaw3d=no)],
3054 emacs_cv_xaw3d=no)])
3058 if test $emacs_cv_xaw3d = yes; then
3059 AC_MSG_CHECKING(for xaw3d)
3060 AC_MSG_RESULT([yes; using Lucid toolkit])
3064 AC_DEFINE(HAVE_XAW3D, 1,
3065 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
3067 AC_MSG_CHECKING(for xaw3d)
3069 AC_MSG_CHECKING(for libXaw)
3070 AC_CACHE_VAL(emacs_cv_xaw,
3071 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3072 #include <X11/Intrinsic.h>
3073 #include <X11/Xaw/Simple.h>]],
3077 if test $emacs_cv_xaw = yes; then
3078 AC_MSG_RESULT([yes; using Lucid toolkit])
3081 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
3082 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
3084 AC_MSG_ERROR([No X toolkit could be found.
3085 If you are sure you want Emacs compiled without an X toolkit, pass
3087 to configure. Otherwise, install the development libraries for the toolkit
3088 that you want to use (e.g. Gtk+) and re-run configure.])
3093 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
3097 if test "${USE_X_TOOLKIT}" != "none"; then
3098 AC_MSG_CHECKING(X11 toolkit version)
3099 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
3100 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Intrinsic.h>]],
3101 [[#if XtSpecificationRelease < 6
3104 ]])], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
3105 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
3106 if test $emacs_cv_x11_toolkit_version_6 = yes; then
3107 AC_MSG_RESULT(6 or newer)
3108 AC_DEFINE(HAVE_X11XTR6, 1,
3109 [Define to 1 if you have the X11R6 or newer version of Xt.])
3110 LIBXTR6="-lSM -lICE"
3112 ## Use libw.a along with X11R6 Xt.
3113 unixware) LIBXTR6="$LIBXTR6 -lw" ;;
3116 AC_MSG_RESULT(before 6)
3119 dnl If using toolkit, check whether libXmu.a exists.
3120 dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
3122 if test x$HAVE_X11XTR6 = xyes; then
3123 OTHERLIBS='-lXt -lSM -lICE'
3127 AC_SEARCH_LIBS([XmuConvertStandardSelection], [Xmu], [], [], [$OTHERLIBS])
3128 if test "X$LIBS" != "X$OLDLIBS"; then
3129 LIBXMU=$ac_cv_search_XmuConvertStandardSelection
3132 dnl ac_cv_search_XmuConvertStandardSelection is also referenced below.
3138 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
3139 # OpenMotif may be installed in such a way on some GNU/Linux systems.
3140 if test -d /usr/include/openmotif; then
3141 CPPFLAGS="-I/usr/include/openmotif $CPPFLAGS"
3142 emacs_cv_openmotif=yes
3143 case "$canonical" in
3144 x86_64-*-linux-gnu* | powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*)
3145 test -d /usr/lib64/openmotif && LDFLAGS="-L/usr/lib64/openmotif $LDFLAGS"
3148 test -d /usr/lib/openmotif && LDFLAGS="-L/usr/lib/openmotif $LDFLAGS"
3151 emacs_cv_openmotif=no
3153 AC_CACHE_CHECK(for (Open)Motif version 2.1, emacs_cv_motif_version_2_1,
3154 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Xm/Xm.h>]],
3155 [[#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
3158 Motif version prior to 2.1.
3160 emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
3161 if test $emacs_cv_motif_version_2_1 = yes; then
3162 AC_CHECK_LIB(Xp, XpCreateContext, LIBXP=-lXp)
3163 if test x$emacs_cv_openmotif = xyes; then
3164 REAL_CPPFLAGS="-I/usr/include/openmotif $REAL_CPPFLAGS"
3167 AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
3168 # We put this in CFLAGS temporarily to precede other -I options
3169 # that might be in CFLAGS temporarily.
3170 # We put this in CPPFLAGS where it precedes the other -I options.
3171 OLD_CPPFLAGS=$CPPFLAGS
3173 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
3174 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
3175 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>]],
3177 emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
3178 if test $emacs_cv_lesstif = yes; then
3179 # Make sure this -I option remains in CPPFLAGS after it is set
3180 # back to REAL_CPPFLAGS.
3181 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
3182 # have those other -I options anyway. Ultimately, having this
3183 # directory ultimately in CPPFLAGS will be enough.
3184 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
3185 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
3188 CPPFLAGS=$OLD_CPPFLAGS
3191 AC_CHECK_HEADER([Xm/BulletinB.h], [],
3192 [AC_MSG_ERROR([Motif toolkit requested but requirements not found.])])
3195 dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
3196 dnl using Motif or Xaw3d is available, and unless
3197 dnl --with-toolkit-scroll-bars=no was specified.
3199 AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
3200 [Define to 1 if we should use toolkit scroll bars.])dnl
3201 USE_TOOLKIT_SCROLL_BARS=no
3202 if test "${with_toolkit_scroll_bars}" != "no"; then
3203 if test "${USE_X_TOOLKIT}" != "none"; then
3204 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
3205 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
3207 USE_TOOLKIT_SCROLL_BARS=yes
3208 elif test "${HAVE_XAW3D}" = "yes" || test "${USE_X_TOOLKIT}" = "LUCID"; then
3209 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
3210 USE_TOOLKIT_SCROLL_BARS=yes
3212 elif test "${HAVE_GTK}" = "yes"; then
3213 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
3214 USE_TOOLKIT_SCROLL_BARS=yes
3215 elif test "${HAVE_NS}" = "yes"; then
3216 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
3217 USE_TOOLKIT_SCROLL_BARS=yes
3218 elif test "${HAVE_W32}" = "yes"; then
3219 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
3220 USE_TOOLKIT_SCROLL_BARS=yes
3224 dnl See if XIM is available.
3225 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3226 #include <X11/Xlib.h>
3227 #include <X11/Xresource.h>]],
3228 [[XIMProc callback;]])],
3230 AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
3233 dnl Note this is non-standard. --with-xim does not control whether
3234 dnl XIM support is compiled in, it only affects the runtime default of
3235 dnl use_xim in xterm.c.
3236 if test "${with_xim}" != "no"; then
3237 AC_DEFINE(USE_XIM, 1,
3238 [Define to 1 to default runtime use of XIM to on.])
3242 if test "${HAVE_XIM}" != "no"; then
3244 if test "$GCC" = yes; then
3245 CFLAGS="$CFLAGS --pedantic-errors"
3247 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3248 #include <X11/Xlib.h>
3249 #include <X11/Xresource.h>]],
3255 XPointer *client_data;
3257 /* If we're not using GCC, it's probably not XFree86, and this is
3258 probably right, but we can't use something like --pedantic-errors. */
3259 extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
3260 char*, XIMProc, XPointer*);
3262 (void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
3264 [emacs_cv_arg6_star=yes])
3265 AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
3266 [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
3267 either XPointer or XPointer*.])dnl
3268 if test "$emacs_cv_arg6_star" = yes; then
3269 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
3271 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
3278 if test "${HAVE_X11}" = "yes"; then
3281 [[#include <X11/Intrinsic.h>
3282 #include <X11/extensions/Xrender.h>
3284 [[return !XRenderQueryExtension;]])],
3285 [AC_CHECK_LIB([Xrender], [XRenderQueryExtension], [HAVE_XRENDER=yes])])
3286 if test $HAVE_XRENDER = yes; then
3287 XRENDER_LIBS="-lXrender"
3288 AC_SUBST(XRENDER_LIBS)
3289 AC_DEFINE([HAVE_XRENDER], 1, [Define to 1 if XRender is available.])
3294 if test "${HAVE_X11}" = "yes"; then
3295 if test "${with_cairo}" != "no"; then
3296 CAIRO_REQUIRED=1.8.0
3297 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
3298 EMACS_CHECK_MODULES(CAIRO, $CAIRO_MODULE)
3299 if test $HAVE_CAIRO = yes; then
3300 AC_DEFINE(USE_CAIRO, 1, [Define to 1 if using cairo.])
3301 CFLAGS="$CFLAGS $CAIRO_CFLAGS"
3302 LIBS="$LIBS $CAIRO_LIBS"
3303 AC_SUBST(CAIRO_CFLAGS)
3304 AC_SUBST(CAIRO_LIBS)
3306 AC_MSG_WARN([cairo requested but not found.])
3311 ### Start of font-backend (under any platform) section.
3312 # (nothing here yet -- this is a placeholder)
3313 ### End of font-backend (under any platform) section.
3315 ### Start of font-backend (under X11) section.
3316 if test "${HAVE_X11}" = "yes"; then
3317 if test $HAVE_CAIRO = yes; then
3318 dnl Strict linkers fail with
3319 dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
3320 dnl if -lfreetype is not specified.
3321 dnl The following is needed to set FREETYPE_LIBS.
3322 EMACS_CHECK_MODULES([FREETYPE], [freetype2])
3324 test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(cairo requires libfreetype)
3326 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
3328 test "$HAVE_FONTCONFIG" = "no" && AC_MSG_ERROR(cairo requires libfontconfig)
3329 dnl For the "Does Emacs use" message at the end.
3332 ## Use -lXft if available, unless '--with-xft=no'.
3334 if test "x${with_x}" = "xno"; then
3338 if test "$with_xft" != no; then
3339 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
3340 with_xft=$HAVE_FONTCONFIG
3343 if test "x${with_xft}" != "xno"; then
3345 EMACS_CHECK_MODULES([XFT], [xft >= 0.13.0], [], [HAVE_XFT=no])
3346 ## Because xterm.c uses XRenderQueryExtension when XFT is
3347 ## enabled, we also need to link to -lXrender.
3348 if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
3349 OLD_CPPFLAGS="$CPPFLAGS"
3350 OLD_CFLAGS="$CFLAGS"
3352 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
3353 CFLAGS="$CFLAGS $XFT_CFLAGS"
3354 LIBS="$XFT_LIBS $LIBS"
3355 AC_CHECK_HEADER(X11/Xft/Xft.h,
3356 AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS) , ,
3357 [[#include <X11/X.h>]])
3359 if test "${HAVE_XFT}" = "yes"; then
3360 AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
3362 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
3363 fi # "${HAVE_XFT}" = "yes"
3364 CPPFLAGS=$OLD_CPPFLAGS
3368 # Make sure XFT is disabled if we found XFT but not XRender
3370 fi # "$HAVE_XFT" != no
3371 fi # "x${with_xft}" != "xno"
3373 if test "$HAVE_XFT" != "yes"; then
3374 dnl For the "Does Emacs use" message at the end.
3378 dnl Strict linkers fail with
3379 dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
3380 dnl if -lfreetype is not specified.
3381 dnl The following is needed to set FREETYPE_LIBS.
3382 EMACS_CHECK_MODULES([FREETYPE], [freetype2])
3384 test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(libxft requires libfreetype)
3386 fi # $HAVE_CAIRO != yes
3389 if test "${HAVE_FREETYPE}" = "yes"; then
3390 AC_DEFINE(HAVE_FREETYPE, 1,
3391 [Define to 1 if using the freetype and fontconfig libraries.])
3394 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
3395 LIBS="$FREETYPE_LIBS $LIBS"
3396 AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
3399 if test "${with_libotf}" != "no"; then
3400 EMACS_CHECK_MODULES([LIBOTF], [libotf])
3401 if test "$HAVE_LIBOTF" = "yes"; then
3402 AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
3403 AC_CHECK_LIB(otf, OTF_get_variation_glyphs,
3404 HAVE_OTF_GET_VARIATION_GLYPHS=yes,
3405 HAVE_OTF_GET_VARIATION_GLYPHS=no)
3406 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
3407 AC_DEFINE(HAVE_OTF_GET_VARIATION_GLYPHS, 1,
3408 [Define to 1 if libotf has OTF_get_variation_glyphs.])
3410 if ! $PKG_CONFIG --atleast-version=0.9.16 libotf; then
3411 AC_DEFINE(HAVE_OTF_KANNADA_BUG, 1,
3412 [Define to 1 if libotf is affected by https://debbugs.gnu.org/28110.])
3416 dnl FIXME should there be an error if HAVE_FREETYPE != yes?
3417 dnl Does the new font backend require it, or can it work without it?
3421 if test "${HAVE_LIBOTF}" = yes; then
3422 if test "${with_m17n_flt}" != "no"; then
3423 EMACS_CHECK_MODULES([M17N_FLT], [m17n-flt])
3424 if test "$HAVE_M17N_FLT" = "yes"; then
3425 AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.])
3429 else # "${HAVE_X11}" != "yes"
3434 fi # "${HAVE_X11}" != "yes"
3437 ### On MS-Windows we use hb_font_get_nominal_glyph, which appeared
3438 ### in HarfBuzz version 1.2.3
3439 if test "${HAVE_W32}" = "yes"; then
3440 harfbuzz_required_ver=1.2.3
3442 harfbuzz_required_ver=0.9.42
3444 if test "${HAVE_X11}" = "yes" && test "${HAVE_FREETYPE}" = "yes" \
3445 || test "${HAVE_W32}" = "yes"; then
3446 if test "${with_harfbuzz}" != "no"; then
3447 EMACS_CHECK_MODULES([HARFBUZZ], [harfbuzz >= $harfbuzz_required_ver])
3448 if test "$HAVE_HARFBUZZ" = "yes"; then
3449 AC_DEFINE(HAVE_HARFBUZZ, 1, [Define to 1 if using HarfBuzz.])
3450 ### mingw32 and Cygwin-w32 don't use -lharfbuzz, since they load
3451 ### the library dynamically.
3452 if test "${HAVE_W32}" = "yes"; then
3459 ### End of font-backend section.
3461 AC_SUBST(FREETYPE_CFLAGS)
3462 AC_SUBST(FREETYPE_LIBS)
3463 AC_SUBST(FONTCONFIG_CFLAGS)
3464 AC_SUBST(FONTCONFIG_LIBS)
3465 AC_SUBST(HARFBUZZ_CFLAGS)
3466 AC_SUBST(HARFBUZZ_LIBS)
3467 AC_SUBST(LIBOTF_CFLAGS)
3468 AC_SUBST(LIBOTF_LIBS)
3469 AC_SUBST(M17N_FLT_CFLAGS)
3470 AC_SUBST(M17N_FLT_LIBS)
3472 if test "${HAVE_X11}" = "yes"; then
3473 AC_CHECK_HEADER(X11/Xlib-xcb.h,
3474 AC_CHECK_LIB(xcb, xcb_translate_coordinates, HAVE_XCB=yes))
3475 if test "${HAVE_XCB}" = "yes"; then
3476 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, HAVE_X11_XCB=yes)
3477 if test "${HAVE_X11_XCB}" = "yes"; then
3478 AC_DEFINE(USE_XCB, 1,
3479 [Define to 1 if you have the XCB library and X11-XCB library for mixed
3480 X11/XCB programming.])
3481 XCB_LIBS="-lX11-xcb -lxcb"
3487 ### Use -lXpm if available, unless '--with-xpm=no'.
3488 ### mingw32 doesn't use -lXpm, since it loads the library dynamically.
3489 ### The Cygwin-w32 build uses <noX/xpm.h> instead of <X11/xpm.h>, so
3490 ### we need to set LDFLAGS accordingly.
3493 if test "${HAVE_W32}" = "yes" && test "${opsys}" = "cygwin"; then
3494 if test "${with_xpm}" != "no"; then
3495 SAVE_LDFLAGS="$LDFLAGS"
3496 LDFLAGS="$LDFLAGS -L/usr/lib/noX"
3497 AC_CHECK_HEADER(noX/xpm.h,
3498 [AC_CHECK_LIB(Xpm, XpmReadFileToImage, HAVE_XPM=yes)])
3499 if test "${HAVE_XPM}" = "yes"; then
3500 AC_CACHE_CHECK([for XpmReturnAllocPixels preprocessor define],
3501 [emacs_cv_cpp_xpm_return_alloc_pixels],
3502 [AC_EGREP_CPP(no_return_alloc_pixels,
3503 [#include "noX/xpm.h"
3504 #ifndef XpmReturnAllocPixels
3505 no_return_alloc_pixels
3507 ], emacs_cv_cpp_xpm_return_alloc_pixels=no,
3508 emacs_cv_cpp_xpm_return_alloc_pixels=yes)])
3510 if test "$emacs_cv_cpp_xpm_return_alloc_pixels" = "no"; then
3512 LDFLAGS="$SAVE_LDFLAGS"
3517 if test "${HAVE_XPM}" = "yes"; then
3518 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
3523 if test "${HAVE_X11}" = "yes"; then
3524 dnl Avoid Xpm on AIX unless requested, as it crashes; see Bug#17598.
3525 case $opsys,$with_xpm_set,$with_xpm in
3527 aix4-2,*) with_xpm=no;;
3530 if test "${with_xpm}" != "no"; then
3531 AC_CHECK_HEADER(X11/xpm.h,
3532 [AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11)])
3533 if test "${HAVE_XPM}" = "yes"; then
3534 AC_CACHE_CHECK([for XpmReturnAllocPixels preprocessor define],
3535 [emacs_cv_cpp_xpm_return_alloc_pixels],
3536 [AC_EGREP_CPP(no_return_alloc_pixels,
3537 [#include "X11/xpm.h"
3538 #ifndef XpmReturnAllocPixels
3539 no_return_alloc_pixels
3541 ], emacs_cv_cpp_xpm_return_alloc_pixels=no,
3542 emacs_cv_cpp_xpm_return_alloc_pixels=yes)])
3544 if test "$emacs_cv_cpp_xpm_return_alloc_pixels" = "no"; then
3550 if test "${HAVE_XPM}" = "yes"; then
3551 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
3553 elif test "$opsys,$LUCID_LIBW" = aix4-2,-lXaw; then
3554 dnl AIX -lXaw needs -lXpm linked too; see Bug#17598 Message#152.
3559 ### FIXME: Perhaps regroup to minimize code duplication due to MinGW's
3560 ### slightly different requirements wrt image libraries (it doesn't
3561 ### use -lXpm because it loads the xpm shared library dynamically at
3563 if test "${opsys}" = "mingw32"; then
3564 if test "${with_xpm}" != "no"; then
3565 AC_CHECK_HEADER(X11/xpm.h, HAVE_XPM=yes, HAVE_XPM=no, [
3569 if test "${HAVE_XPM}" = "yes"; then
3570 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
3576 ### Use -ljpeg if available, unless '--with-jpeg=no'.
3579 if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
3580 || test "${HAVE_NS}" = "yes"; then
3581 if test "${with_jpeg}" != "no"; then
3582 AC_CACHE_CHECK([for jpeglib 6b or later],
3585 for emacs_cv_jpeglib in yes -ljpeg no; do
3586 case $emacs_cv_jpeglib in
3589 *) LIBS="$LIBS $emacs_cv_jpeglib";;
3593 [[#undef HAVE_STDLIB_H /* Avoid config.h/jpeglib.h collision. */
3594 #include <stdio.h> /* jpeglib.h needs FILE and size_t. */
3595 #include <jpeglib.h>
3597 char verify[JPEG_LIB_VERSION < 62 ? -1 : 1];
3598 struct jpeg_decompress_struct cinfo;
3601 jpeg_create_decompress (&cinfo);
3602 WARNMS (&cinfo, JWRN_JPEG_EOF);
3603 jpeg_destroy_decompress (&cinfo);
3605 [emacs_link_ok=yes],
3608 test $emacs_link_ok = yes && break
3610 if test "$emacs_cv_jpeglib" != no; then
3612 AC_DEFINE([HAVE_JPEG], 1,
3613 [Define to 1 if you have the jpeg library (typically -ljpeg).])
3614 ### mingw32 doesn't use -ljpeg, since it loads the library
3615 ### dynamically when needed, and doesn't want a run-time
3616 ### dependency on the jpeglib DLL.
3617 test "$emacs_cv_jpeglib" != yes && test "${opsys}" != "mingw32" \
3618 && LIBJPEG=$emacs_cv_jpeglib
3627 if test "${with_lcms2}" != "no"; then
3628 EMACS_CHECK_MODULES([LCMS2], [lcms2])
3630 if test "${HAVE_LCMS2}" = "yes"; then
3631 AC_DEFINE([HAVE_LCMS2], 1, [Define to 1 if you have the lcms2 library (-llcms2).])
3632 ### mingw32 doesn't use -llcms2, since it loads the library dynamically.
3633 if test "${opsys}" = "mingw32"; then
3637 AC_SUBST(LCMS2_CFLAGS)
3638 AC_SUBST(LCMS2_LIBS)
3642 if test "${with_zlib}" != "no"; then
3644 AC_SEARCH_LIBS([inflateEnd], [z], [HAVE_ZLIB=yes])
3646 case $ac_cv_search_inflateEnd in
3647 -*) LIBZ=$ac_cv_search_inflateEnd ;;
3650 if test "${HAVE_ZLIB}" = "yes"; then
3651 AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if you have the zlib library (-lz).])
3652 ### mingw32 doesn't use -lz, since it loads the library dynamically.
3653 if test "${opsys}" = "mingw32"; then
3659 ### Dynamic modules support
3664 cygwin|mingw32) MODULES_SUFFIX=".dll" ;;
3665 darwin) MODULES_SUFFIX=".dylib" ;;
3666 *) MODULES_SUFFIX=".so" ;;
3669 darwin) MODULES_SECONDARY_SUFFIX='.so' ;;
3670 *) MODULES_SECONDARY_SUFFIX='' ;;
3672 if test "${with_modules}" != "no"; then
3678 cygwin|mingw32|darwin)
3682 # BSD systems have dlopen in libc.
3683 AC_CHECK_FUNC([dlopen], [HAVE_MODULES=yes])
3687 if test "${HAVE_MODULES}" = no; then
3688 AC_MSG_ERROR([Dynamic modules are not supported on your system])
3691 LIBS="$LIBS $LIBMODULES"
3692 AC_CHECK_FUNCS([dladdr dlfunc])
3697 if test "${HAVE_MODULES}" = yes; then
3698 MODULES_OBJ="dynlib.o emacs-module.o"
3699 AC_DEFINE(HAVE_MODULES, 1, [Define to 1 if dynamic modules are enabled])
3700 AC_DEFINE_UNQUOTED(MODULES_SUFFIX, "$MODULES_SUFFIX",
3701 [System extension for dynamic libraries])
3702 if test -n "${MODULES_SECONDARY_SUFFIX}"; then
3703 AC_DEFINE_UNQUOTED(MODULES_SECONDARY_SUFFIX, "$MODULES_SECONDARY_SUFFIX",
3704 [Alternative system extension for dynamic libraries.])
3707 AC_SUBST(MODULES_OBJ)
3708 AC_SUBST(LIBMODULES)
3709 AC_SUBST(HAVE_MODULES)
3710 AC_SUBST(MODULES_SUFFIX)
3711 AC_SUBST(MODULES_SECONDARY_SUFFIX)
3713 AC_CONFIG_FILES([src/emacs-module.h])
3714 AC_SUBST_FILE([module_env_snippet_25])
3715 AC_SUBST_FILE([module_env_snippet_26])
3716 AC_SUBST_FILE([module_env_snippet_27])
3717 AC_SUBST_FILE([module_env_snippet_28])
3718 module_env_snippet_25="$srcdir/src/module-env-25.h"
3719 module_env_snippet_26="$srcdir/src/module-env-26.h"
3720 module_env_snippet_27="$srcdir/src/module-env-27.h"
3721 module_env_snippet_28="$srcdir/src/module-env-28.h"
3722 emacs_major_version="${PACKAGE_VERSION%%.*}"
3723 AC_SUBST(emacs_major_version)
3725 ### Use -lpng if available, unless '--with-png=no'.
3729 if test "${with_png}" != no; then
3730 # mingw32 loads the library dynamically.
3731 if test "$opsys" = mingw32; then
3732 AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
3733 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
3734 || test "${HAVE_NS}" = "yes"; then
3735 EMACS_CHECK_MODULES([PNG], [libpng >= 1.0.0])
3736 if test $HAVE_PNG = yes; then
3739 # Test old way in case pkg-config doesn't have it (older machines).
3740 AC_MSG_CHECKING([for libpng not configured by pkg-config])
3742 png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
3743 png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {
3744 # libpng-config does not work; configure by hand.
3745 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
3746 # in /usr/include/libpng.
3747 if test -r /usr/include/libpng/png.h &&
3748 test ! -r /usr/include/png.h; then
3749 png_cflags=-I/usr/include/libpng
3757 CFLAGS="$CFLAGS $png_cflags"
3758 LIBS="$png_ldflags -lz -lm $LIBS"
3760 [AC_LANG_PROGRAM([[#include <png.h>]],
3761 [[return !png_get_channels (0, 0);]])],
3763 PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
3764 LIBPNG=$png_ldflags])
3767 AC_MSG_RESULT([$HAVE_PNG])
3770 # $LIBPNG requires explicit -lz in some cases.
3771 # We don't know what those cases are, exactly, so play it safe and
3772 # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
3773 case " $LIBPNG ",$LIBZ in
3774 *' -lz '*, | *' ',?*) ;;
3775 *) LIBPNG="$LIBPNG -lz" ;;
3779 if test $HAVE_PNG = yes; then
3780 AC_DEFINE([HAVE_PNG], [1], [Define to 1 if you have the png library.])
3783 CFLAGS="$CFLAGS $PNG_CFLAGS"
3784 AC_CHECK_DECL([png_longjmp],
3786 [AC_DEFINE([PNG_DEPSTRUCT], [],
3787 [Define to empty to suppress deprecation warnings when building
3788 with --enable-gcc-warnings and with libpng versions before 1.5,
3789 which lack png_longjmp.])],
3795 AC_SUBST(PNG_CFLAGS)
3797 ### Use -ltiff if available, unless '--with-tiff=no'.
3798 ### mingw32 doesn't use -ltiff, since it loads the library dynamically.
3801 if test "${opsys}" = "mingw32"; then
3802 if test "${with_tiff}" != "no"; then
3803 AC_CHECK_HEADER(tiffio.h, HAVE_TIFF=yes, HAVE_TIFF=no)
3805 if test "${HAVE_TIFF}" = "yes"; then
3806 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
3808 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
3809 || test "${HAVE_NS}" = "yes"; then
3810 if test "${with_tiff}" != "no"; then
3811 AC_CHECK_HEADER(tiffio.h,
3813 # At least one tiff package requires the jpeg library.
3814 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
3815 AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs)])
3818 if test "${HAVE_TIFF}" = "yes"; then
3819 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
3820 dnl FIXME -lz -lm, as per libpng?
3826 ### Use -lgif or -lungif if available, unless '--with-gif=no'.
3827 ### mingw32 doesn't use -lgif/-lungif, since it loads the library dynamically.
3830 if test "${opsys}" = "mingw32"; then
3831 if test "${with_gif}" != "no"; then
3832 AC_CHECK_HEADER(gif_lib.h, HAVE_GIF=yes, HAVE_GIF=no)
3834 if test "${HAVE_GIF}" = "yes"; then
3835 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
3837 elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
3838 || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes"; then
3839 AC_CHECK_HEADER(gif_lib.h,
3840 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
3841 # Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
3842 [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes,
3843 [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])])
3845 if test "$HAVE_GIF" = yes; then
3847 elif test "$HAVE_GIF" = maybe; then
3848 # If gif_lib.h but no libgif, try libungif.
3849 AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
3850 test "$HAVE_GIF" = yes && LIBGIF=-lungif
3853 if test "${HAVE_GIF}" = "yes"; then
3854 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
3859 dnl Check for required libraries.
3862 if test "${HAVE_X11}" = "yes"; then
3863 case $with_xpm,$HAVE_XPM in
3864 no,* | ifavailable,* | *,yes) ;;
3866 WITH_IFAVAILABLE="--with-xpm=ifavailable";;
3868 case $with_jpeg,$HAVE_JPEG in
3869 no,* | ifavailable,* | *,yes) ;;
3870 *) MISSING="$MISSING libjpeg"
3871 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-jpeg=ifavailable";;
3873 case $with_png,$HAVE_PNG in
3874 no,* | ifavailable,* | *,yes) ;;
3875 *) MISSING="$MISSING libpng"
3876 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-png=ifavailable";;
3878 case $with_gif,$HAVE_GIF in
3879 no,* | ifavailable,* | *,yes) ;;
3880 *) MISSING="$MISSING libgif/libungif"
3881 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gif=ifavailable";;
3883 case $with_tiff,$HAVE_TIFF in
3884 no,* | ifavailable,* | *,yes) ;;
3885 *) MISSING="$MISSING libtiff"
3886 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-tiff=ifavailable";;
3889 case $with_gnutls,$HAVE_GNUTLS in
3890 no,* | ifavailable,* | *,yes) ;;
3891 *) MISSING="$MISSING gnutls"
3892 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gnutls=ifavailable";;
3894 case $with_json,$HAVE_JSON in
3895 no,* | ifavailable,* | *,yes) ;;
3896 *) MISSING="$MISSING json"
3897 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-json=ifavailable";;
3899 if test "X${MISSING}" != X; then
3900 # If we have a missing library, and we don't have pkg-config installed,
3901 # the missing pkg-config may be the reason. Give the user a hint.
3902 if test "X${PKG_CONFIG}" = X; then
3903 AC_MSG_WARN([Unable to locate a usable pkg-config])
3905 AC_MSG_ERROR([The following required libraries were not found:
3907 Maybe some development libraries/packages are missing?
3908 To build anyway, give:
3910 as options to configure.])
3913 ### Use -lgpm if available, unless '--with-gpm=no'.
3916 if test "${with_gpm}" != "no"; then
3917 AC_CHECK_HEADER(gpm.h,
3918 [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
3920 if test "${HAVE_GPM}" = "yes"; then
3921 AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
3927 dnl Check for malloc/malloc.h on darwin
3928 AC_CHECK_HEADERS_ONCE(malloc/malloc.h)
3931 ### Use NeXTstep API to implement GUI.
3932 if test "${HAVE_NS}" = "yes"; then
3933 AC_DEFINE(HAVE_NS, 1, [Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on macOS.])
3934 if test "${NS_IMPL_COCOA}" = "yes"; then
3935 AC_DEFINE(NS_IMPL_COCOA, 1, [Define to 1 if you are using NS windowing under macOS.])
3937 if test "${NS_IMPL_GNUSTEP}" = "yes"; then
3938 AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.])
3939 if test $NS_GNUSTEP_CONFIG != yes; then
3940 # See also .m.o rule in src/Makefile.in. */
3941 # FIXME: are all these flags really needed? Document here why. */
3942 GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
3943 ## Extra CFLAGS applied to src/*.m files.
3944 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"
3950 ### Use session management (-lSM -lICE) if available
3953 if test "${HAVE_X11}" = "yes"; then
3954 AC_CHECK_HEADER(X11/SM/SMlib.h,
3955 [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
3957 if test "${HAVE_X_SM}" = "yes"; then
3958 AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
3964 ### Use XRandr (-lXrandr) if available
3966 if test "${HAVE_X11}" = "yes"; then
3967 XRANDR_REQUIRED=1.2.2
3968 XRANDR_MODULES="xrandr >= $XRANDR_REQUIRED"
3969 EMACS_CHECK_MODULES([XRANDR], [$XRANDR_MODULES])
3970 if test $HAVE_XRANDR = no; then
3971 # Test old way in case pkg-config doesn't have it (older machines).
3972 # Include Xrender.h by hand to work around bug in older Xrandr.h
3973 # (e.g. RHEL5) and silence (harmless) configure warning (bug#18465).
3974 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
3975 [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)],
3976 [], [AC_INCLUDES_DEFAULT
3977 #include <X11/extensions/Xrender.h>])
3978 if test $HAVE_XRANDR = yes; then
3979 XRANDR_LIBS=-lXrandr
3982 if test $HAVE_XRANDR = yes; then
3983 AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the XRandr extension.])
3986 AC_SUBST(XRANDR_CFLAGS)
3987 AC_SUBST(XRANDR_LIBS)
3989 ### Use Xinerama (-lXinerama) if available
3991 if test "${HAVE_X11}" = "yes"; then
3992 XINERAMA_REQUIRED=1.0.2
3993 XINERAMA_MODULES="xinerama >= $XINERAMA_REQUIRED"
3994 EMACS_CHECK_MODULES([XINERAMA], [$XINERAMA_MODULES])
3995 if test $HAVE_XINERAMA = no; then
3996 # Test old way in case pkg-config doesn't have it (older machines).
3997 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
3998 [AC_CHECK_LIB(Xinerama, XineramaQueryExtension, HAVE_XINERAMA=yes)])
3999 if test $HAVE_XINERAMA = yes; then
4000 XINERAMA_LIBS=-lXinerama
4003 if test $HAVE_XINERAMA = yes; then
4004 AC_DEFINE(HAVE_XINERAMA, 1, [Define to 1 if you have the Xinerama extension.])
4007 AC_SUBST(XINERAMA_CFLAGS)
4008 AC_SUBST(XINERAMA_LIBS)
4010 ### Use Xfixes (-lXfixes) if available
4012 if test "${HAVE_X11}" = "yes"; then
4013 XFIXES_REQUIRED=4.0.0
4014 XFIXES_MODULES="xfixes >= $XFIXES_REQUIRED"
4015 EMACS_CHECK_MODULES([XFIXES], [$XFIXES_MODULES])
4016 if test $HAVE_XFIXES = no; then
4017 # Test old way in case pkg-config doesn't have it (older machines).
4018 AC_CHECK_HEADER(X11/extensions/Xfixes.h,
4019 [AC_CHECK_LIB(Xfixes, XFixesHideCursor, HAVE_XFIXES=yes)])
4020 if test $HAVE_XFIXES = yes; then
4021 XFIXES_LIBS=-lXfixes
4024 if test $HAVE_XFIXES = yes; then
4025 AC_DEFINE(HAVE_XFIXES, 1, [Define to 1 if you have the Xfixes extension.])
4028 AC_SUBST(XFIXES_CFLAGS)
4029 AC_SUBST(XFIXES_LIBS)
4031 ### Use Xdbe (-lXdbe) if available
4033 if test "${HAVE_X11}" = "yes"; then
4034 if test "${with_xdbe}" != "no"; then
4035 AC_CHECK_HEADER(X11/extensions/Xdbe.h,
4036 [AC_CHECK_LIB(Xext, XdbeAllocateBackBufferName, HAVE_XDBE=yes)],
4038 [#include <X11/Xlib.h>
4041 if test $HAVE_XDBE = yes; then
4044 if test $HAVE_XDBE = yes; then
4045 AC_DEFINE(HAVE_XDBE, 1, [Define to 1 if you have the Xdbe extension.])
4048 AC_SUBST(XDBE_CFLAGS)
4051 ### Use libxml (-lxml2) if available
4052 ### mingw32 doesn't use -lxml2, since it loads the library dynamically.
4054 if test "${with_xml2}" != "no"; then
4055 ### I'm not sure what the version number should be, so I just guessed.
4056 EMACS_CHECK_MODULES([LIBXML2], [libxml-2.0 > 2.6.17])
4057 # Built-in libxml2 on OS X 10.8 lacks libxml-2.0.pc.
4058 if test "${HAVE_LIBXML2}" != "yes" && test "$opsys" = "darwin"; then
4059 SAVE_CPPFLAGS="$CPPFLAGS"
4060 if test -z "$xcsdkdir" -a -n "$XCRUN" -a ! -d /usr/include; then
4061 dnl /usr/include is not found. Try Xcode SDK dir if it is sane.
4062 xcsdkdir=`$XCRUN --show-sdk-path 2>/dev/null`
4064 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
4068 CPPFLAGS="$CPPFLAGS -isystem${xcsdkdir}/usr/include/libxml2"
4069 AC_CHECK_HEADER(libxml/HTMLparser.h,
4070 [AC_CHECK_DECL(HTML_PARSE_RECOVER, HAVE_LIBXML2=yes, ,
4071 [#include <libxml/HTMLparser.h>])])
4072 CPPFLAGS="$SAVE_CPPFLAGS"
4073 if test "${HAVE_LIBXML2}" = "yes"; then
4074 LIBXML2_CFLAGS="-isystem${xcsdkdir}/usr/include/libxml2"
4075 LIBXML2_LIBS="-lxml2"
4078 if test "${HAVE_LIBXML2}" = "yes"; then
4079 if test "${opsys}" != "mingw32"; then
4080 AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no,
4085 if test "${HAVE_LIBXML2}" = "yes"; then
4086 AC_DEFINE(HAVE_LIBXML2, 1, [Define to 1 if you have the libxml library (-lxml2).])
4093 AC_SUBST(LIBXML2_LIBS)
4094 AC_SUBST(LIBXML2_CFLAGS)
4098 if test ! "$with_mailutils"; then
4099 # Check for mail-locking functions in a "mail" library. Probably this should
4100 # have the same check as for liblockfile below.
4101 AC_CHECK_LIB([mail], [maillock], [have_mail=yes], [have_mail=no])
4102 if test $have_mail = yes; then
4104 AC_DEFINE([HAVE_LIBMAIL], [1],
4105 [Define to 1 if you have the 'mail' library (-lmail).])
4108 LIBS="$LIBS_MAIL $LIBS"
4109 AC_CHECK_FUNCS([touchlock])
4112 dnl Debian, at least:
4113 AC_CHECK_LIB([lockfile], [maillock], [have_lockfile=yes], [have_lockfile=no])
4114 if test $have_lockfile = yes; then
4115 LIBS_MAIL=-llockfile
4116 AC_DEFINE([HAVE_LIBLOCKFILE], [1],
4117 [Define to 1 if you have the 'lockfile' library (-llockfile).])
4119 # If we have the shared liblockfile, assume we must use it for mail
4120 # locking (e.g. Debian). If we couldn't link against liblockfile
4121 # (no liblockfile.a installed), ensure that we don't need to.
4122 dnl This works for files generally, not just executables.
4123 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
4124 AC_CHECK_PROG([liblockfile], [liblockfile.so], [yes], [no],
4125 [/usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH])
4126 if test "$ac_cv_prog_liblockfile" = yes; then
4127 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
4128 This probably means that movemail could lose mail.
4129 There may be a 'development' package to install containing liblockfile.])
4132 AC_CHECK_HEADERS([maillock.h])
4134 ## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
4135 ## interlock access to the mail spool. The alternative is a lock file named
4136 ## /usr/spool/mail/$USER.lock.
4139 aix4-2) mail_lock="lockf" ;;
4141 gnu|freebsd|dragonfly|netbsd|openbsd|darwin) mail_lock="flock" ;;
4143 ## On GNU/Linux systems, both methods are used by various mail programs.
4144 ## I assume most people are using newer mailers that have heard of flock.
4145 ## Change this if you need to.
4146 ## Debian contains a patch which says: "On Debian/GNU/Linux systems,
4147 ## configure gets the right answers, and that means *NOT* using flock.
4148 ## Using flock is guaranteed to be the wrong thing. See Debian Policy
4149 ## for details." and then uses '#ifdef DEBIAN'. Unfortunately the
4150 ## Debian maintainer hasn't provided a clean fix for Emacs.
4151 ## movemail.c will use 'maillock' when MAILDIR, HAVE_LIBMAIL and
4152 ## HAVE_MAILLOCK_H are defined, so the following appears to be the
4153 ## correct logic. -- fx
4154 ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
4155 ## liblockfile is a Free Software replacement for libmail, used on
4156 ## Debian systems and elsewhere. -rfr.
4159 if test $have_mail = yes || test $have_lockfile = yes; then
4160 test $ac_cv_header_maillock_h = yes && mail_lock=no
4164 mail_lock="none-needed" ;;
4168 flock) AC_DEFINE([MAIL_USE_FLOCK], [1],
4169 [Define if the mailer uses flock to interlock the mail spool.]);;
4171 lockf) AC_DEFINE([MAIL_USE_LOCKF], [1],
4172 [Define if the mailer uses lockf to interlock the mail spool.]);;
4176 *) BLESSMAIL_TARGET="need-blessmail" ;;
4179 AC_SUBST([BLESSMAIL_TARGET])
4180 AC_SUBST([LIBS_MAIL])
4183 LIBS="$LIB_PTHREAD $LIB_MATH $LIBS"
4184 AC_CHECK_FUNCS(accept4 fchdir gethostname \
4185 getrusage get_current_dir_name \
4186 lrand48 random rint trunc \
4187 select getpagesize setlocale newlocale \
4188 getrlimit setrlimit shutdown \
4189 pthread_sigmask strsignal setitimer timer_getoverrun \
4190 sendto recvfrom getsockname getifaddrs freeifaddrs \
4192 getpwent endpwent getgrent endgrent \
4193 cfmakeraw cfsetspeed __executable_start log2 pthread_setname_np \
4194 pthread_set_name_np)
4197 if test "$ac_cv_func_pthread_setname_np" = "yes"; then
4199 [whether pthread_setname_np takes a single argument],
4200 [emacs_cv_pthread_setname_np_1arg],
4203 [[#include <pthread.h>]],
4204 [[pthread_setname_np ("a");]])],
4205 [emacs_cv_pthread_setname_np_1arg=yes],
4206 [emacs_cv_pthread_setname_np_1arg=no])])
4207 if test "$emacs_cv_pthread_setname_np_1arg" = "yes"; then
4209 HAVE_PTHREAD_SETNAME_NP_1ARG, 1,
4210 [Define to 1 if pthread_setname_np takes a single argument.])
4213 [whether pthread_setname_np takes three arguments],
4214 [emacs_cv_pthread_setname_np_3arg],
4217 [[#include <pthread.h>]],
4218 [[pthread_setname_np (0, "%s", "a");]])],
4219 [emacs_cv_pthread_setname_np_3arg=yes],
4220 [emacs_cv_pthread_setname_np_3arg=no])])
4221 if test "$emacs_cv_pthread_setname_np_3arg" = "yes"; then
4223 HAVE_PTHREAD_SETNAME_NP_3ARG, 1,
4224 [Define to 1 if pthread_setname_np takes three arguments.])
4229 dnl No need to check for posix_memalign if aligned_alloc works.
4230 AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
4231 AC_CHECK_DECLS([aligned_alloc], [], [], [[#include <stdlib.h>]])
4233 case $with_unexec,$canonical in
4235 AC_CHECK_DECL([__ELF__], [],
4236 [AC_MSG_ERROR([Non-ELF systems are not supported on this platform.])]);;
4240 AC_CHECK_FUNCS([posix_madvise])
4242 dnl Cannot use AC_CHECK_FUNCS
4243 AC_CACHE_CHECK([for __builtin_frame_address],
4244 [emacs_cv_func___builtin_frame_address],
4245 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_frame_address (0);])],
4246 [emacs_cv_func___builtin_frame_address=yes],
4247 [emacs_cv_func___builtin_frame_address=no])])
4248 if test $emacs_cv_func___builtin_frame_address = yes; then
4249 AC_DEFINE([HAVE___BUILTIN_FRAME_ADDRESS], 1,
4250 [Define to 1 if you have the '__builtin_frame_address' function.])
4252 AC_CACHE_CHECK([for __builtin_unwind_init],
4253 emacs_cv_func___builtin_unwind_init,
4254 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_unwind_init ();])],
4255 emacs_cv_func___builtin_unwind_init=yes,
4256 emacs_cv_func___builtin_unwind_init=no)])
4257 if test $emacs_cv_func___builtin_unwind_init = yes; then
4258 AC_DEFINE(HAVE___BUILTIN_UNWIND_INIT, 1,
4259 [Define to 1 if you have the '__builtin_unwind_init' function.])
4262 AC_CHECK_HEADERS_ONCE(sys/un.h)
4267 AC_CHECK_FUNCS(grantpt)
4269 # PTY-related GNU extensions.
4270 AC_CHECK_FUNCS(getpt posix_openpt)
4272 dnl Run a test program that contains a call to tputs, a call that is
4273 dnl never executed. This tests whether a pre-'main' dynamic linker
4274 dnl works with the library. It's too much trouble to actually call
4275 dnl tputs in the test program, due to portability hassles. When
4276 dnl cross-compiling, assume the test program will run if it links.
4277 AC_DEFUN([tputs_link_source], [
4279 [[extern void tputs (const char *, int, int (*)(int));
4280 int main (int argc, char **argv)
4283 tputs (argv[0], 0, 0);
4287 # Check this now, so that we will NOT find the above functions in ncurses.
4288 # That is because we have not set up to link ncurses in lib-src.
4289 # It's better to believe a function is not available
4290 # than to expect to find it in ncurses.
4291 # Also we need tputs and friends to be able to build at all.
4292 AC_CACHE_CHECK([for library containing tputs], [emacs_cv_tputs_lib],
4293 [if test "${opsys}" = "mingw32"; then
4294 emacs_cv_tputs_lib='none required'
4296 # curses precedes termcap because of AIX (Bug#9736#35) and OpenIndiana.
4297 tputs_libraries='tinfo ncurses terminfo curses termcap tinfow ncursesw'
4298 for tputs_library in '' $tputs_libraries; do
4300 if test -z "$tputs_library"; then
4301 emacs_cv_tputs_lib='none required'
4303 emacs_cv_tputs_lib=-l$tputs_library
4304 LIBS="$emacs_cv_tputs_lib $LIBS"
4306 AC_RUN_IFELSE([tputs_link_source], [], [emacs_cv_tputs_lib=no],
4307 [AC_LINK_IFELSE([tputs_link_source], [], [emacs_cv_tputs_lib=no])])
4309 if test "X$emacs_cv_tputs_lib" != Xno; then
4314 AS_CASE(["$emacs_cv_tputs_lib"],
4315 [no], [AC_MSG_ERROR([The required function 'tputs' was not found in any library.
4316 The following libraries were tried (in order):
4317 libtinfo, libncurses, libterminfo, libcurses, libtermcap
4318 Please try installing whichever of these libraries is most appropriate
4319 for your system, together with its header files.
4320 For example, a libncurses-dev(el) or similar package.])],
4321 [-l*], [LIBS_TERMCAP=$emacs_cv_tputs_lib],
4322 [*], [LIBS_TERMCAP=])
4324 ## Use termcap instead of terminfo?
4325 ## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
4327 ## FIXME? In the cases below where we unconditionally set
4328 ## LIBS_TERMCAP="-lncurses", this overrides LIBS_TERMCAP = -ltinfo,
4329 ## if that was found above to have tputs.
4330 ## Should we use the gnu* logic everywhere?
4332 ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
4333 ## The ncurses library has been moved out of the System framework in
4334 ## Mac OS X 10.2. So if configure detects it, set the command-line
4335 ## option to use it.
4336 darwin) LIBS_TERMCAP="-lncurses" ;;
4338 gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
4341 AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
4342 AC_CACHE_VAL(emacs_cv_freebsd_terminfo,
4343 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <osreldate.h>]],
4344 [[#if __FreeBSD_version < 400000
4347 ]])], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)])
4349 AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
4351 if test $emacs_cv_freebsd_terminfo = yes; then
4352 LIBS_TERMCAP="-lncurses"
4355 LIBS_TERMCAP="-ltermcap"
4365 if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
4367 LIBS_TERMCAP="-ltermcap"
4371 openbsd | dragonfly) LIBS_TERMCAP="-lncurses" ;;
4373 ## hpux: Make sure we get select from libc rather than from libcurses
4374 ## because libcurses on HPUX 10.10 has a broken version of select.
4375 ## We used to use -lc -lcurses, but this may be cleaner.
4376 ## FIXME? But TERMINFO = yes on hpux (it used to be explicitly
4377 # set that way, now it uses the default). Isn't this a contradiction?
4378 hpux*) LIBS_TERMCAP="-ltermcap" ;;
4382 TERMCAP_OBJ=tparam.o
4383 if test $TERMINFO = yes; then
4384 AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
4385 TERMCAP_OBJ=terminfo.o
4386 AC_CACHE_CHECK([whether $LIBS_TERMCAP library defines BC],
4387 [emacs_cv_terminfo_defines_BC],
4389 LIBS="$LIBS $LIBS_TERMCAP"
4390 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *BC;]], [[return !*BC;]])],
4391 [emacs_cv_terminfo_defines_BC=yes],
4392 [emacs_cv_terminfo_defines_BC=no])
4394 if test "$emacs_cv_terminfo_defines_BC" = yes; then
4395 AC_DEFINE([TERMINFO_DEFINES_BC], 1, [Define to 1 if the
4396 terminfo library defines the variables BC, PC, and UP.])
4399 if test "X$LIBS_TERMCAP" = "X-lncurses"; then
4400 AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.])
4402 AC_SUBST(LIBS_TERMCAP)
4403 AC_SUBST(TERMCAP_OBJ)
4405 # GNU/Linux-specific timer functions.
4406 AC_CACHE_CHECK([for timerfd interface], [emacs_cv_have_timerfd],
4408 [AC_LANG_PROGRAM([[#include <sys/timerfd.h>
4410 [[timerfd_create (CLOCK_REALTIME,
4411 TFD_CLOEXEC | TFD_NONBLOCK);
4412 timerfd_settime (0, TFD_TIMER_ABSTIME, 0, 0);]])],
4413 [emacs_cv_have_timerfd=yes],
4414 [emacs_cv_have_timerfd=no])])
4415 if test "$emacs_cv_have_timerfd" = yes; then
4416 AC_DEFINE([HAVE_TIMERFD], 1,
4417 [Define to 1 if timerfd functions are supported as in GNU/Linux.])
4420 # Alternate stack for signal handlers.
4421 AC_CACHE_CHECK([whether signals can be handled on alternate stack],
4422 [emacs_cv_alternate_stack],
4424 [AC_LANG_PROGRAM([[#include <signal.h>
4427 struct sigaction sa;
4428 ss.ss_sp = malloc (SIGSTKSZ);
4429 ss.ss_size = SIGSTKSZ;
4430 sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
4431 sigaltstack (&ss, 0);
4432 sigaction (SIGSEGV, &sa, 0);]])],
4433 [emacs_cv_alternate_stack=yes],
4434 [emacs_cv_alternate_stack=no])])
4436 # Do we need the Hesiod library to provide the support routines?
4437 dnl FIXME? Should we be skipping this on Darwin too?
4440 if test "$with_hesiod" != no ; then
4441 # Don't set $LIBS here -- see comments above. FIXME which comments?
4443 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
4444 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
4445 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
4446 if test "$resolv" = yes ; then
4452 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
4453 hesiod=yes, :, $RESOLVLIB)])
4455 if test x"$hesiod" = xyes; then
4457 LIBRESOLV=$RESOLVLIB
4463 # These tell us which Kerberos-related libraries to use.
4470 if test "${with_kerberos}" != no; then
4472 AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no)
4473 if test $have_com_err = yes; then
4474 COM_ERRLIB=-lcom_err
4475 LIBS="$COM_ERRLIB $LIBS"
4477 AC_CHECK_LIB(crypto, mit_des_cbc_encrypt, have_crypto=yes, have_crypto=no)
4478 if test $have_crypto = yes; then
4480 LIBS="$CRYPTOLIB $LIBS"
4482 AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt, have_k5crypto=yes, have_k5crypto=no)
4483 if test $have_k5crypto = yes; then
4484 CRYPTOLIB=-lk5crypto
4485 LIBS="$CRYPTOLIB $LIBS"
4487 AC_CHECK_LIB(krb5, krb5_init_context, have_krb5=yes, have_krb5=no)
4488 if test $have_krb5=yes; then
4490 LIBS="$KRB5LIB $LIBS"
4492 dnl FIXME Simplify. Does not match 22 logic, thanks to default_off?
4493 if test "${with_kerberos5}" = no; then
4494 AC_CHECK_LIB(des425, des_cbc_encrypt, have_des425=yes, have_des425=no )
4495 if test $have_des425 = yes; then
4497 LIBS="$DESLIB $LIBS"
4499 AC_CHECK_LIB(des, des_cbc_encrypt, have_des=yes, have_des=no)
4500 if test $have_des = yes; then
4502 LIBS="$DESLIB $LIBS"
4505 AC_CHECK_LIB(krb4, krb_get_cred, have_krb4=yes, have_krb4=no)
4506 if test $have_krb4 = yes; then
4508 LIBS="$KRB4LIB $LIBS"
4510 AC_CHECK_LIB(krb, krb_get_cred, have_krb=yes, have_krb=no)
4511 if test $have_krb = yes; then
4513 LIBS="$KRB4LIB $LIBS"
4518 if test "${with_kerberos5}" != no; then
4519 AC_CHECK_HEADERS(krb5.h,
4520 [AC_CHECK_MEMBERS([krb5_error.text, krb5_error.e_text],,,
4521 [#include <krb5.h>])])
4523 AC_CHECK_HEADERS(krb.h,,
4524 [AC_CHECK_HEADERS(kerberosIV/krb.h,,
4525 [AC_CHECK_HEADERS(kerberos/krb.h)])])
4527 AC_CHECK_HEADERS(com_err.h)
4531 AC_SUBST(COM_ERRLIB)
4537 AC_CHECK_HEADERS(valgrind/valgrind.h)
4539 AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
4541 AC_CHECK_FUNCS_ONCE([__lsan_ignore_object sbrk])
4545 dnl AC_CHECK_FUNCS_ONCE wouldn’t be right for snprintf, which needs
4546 dnl the current CFLAGS etc.
4547 AC_CHECK_FUNCS(snprintf)
4549 dnl Check for glib. This differs from other library checks in that
4550 dnl Emacs need not link to glib unless some other library is already
4551 dnl linking to glib. Although glib provides no facilities that Emacs
4552 dnl needs for its own purposes, when glib is present Emacs needs to
4553 dnl use primitives like g_main_context_query to avoid clashing with
4554 dnl glib at a low level.
4556 dnl Check this late, since it depends on $GTK_CFLAGS etc.
4558 AC_CACHE_CHECK([whether GLib is linked in], [emacs_cv_links_glib],
4559 [OLDCFLAGS="$CFLAGS"
4561 CFLAGS="$CFLAGS $GTK_CFLAGS $RSVG_CFLAGS $DBUS_CFLAGS $SETTINGS_CFLAGS"
4562 LIBS="$LIBS $GTK_LIBS $RSVG_LIBS $DBUS_LIBS $SETTINGS_LIBS"
4563 CFLAGS="$CFLAGS $NOTIFY_CFLAGS $CAIRO_CFLAGS"
4564 LIBS="$LIBS $NOTIFY_LIBS $CAIRO_LIBS"
4565 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4568 [[g_print ("Hello world");]])],
4569 [emacs_cv_links_glib=yes],
4570 [emacs_cv_links_glib=no])
4573 if test "${emacs_cv_links_glib}" = "yes"; then
4574 AC_DEFINE(HAVE_GLIB, 1, [Define to 1 if GLib is linked in.])
4575 if test "$HAVE_NS" = no;then
4581 dnl Adapted from Haible's version.
4582 AC_CACHE_CHECK([for nl_langinfo and CODESET], [emacs_cv_langinfo_codeset],
4583 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
4584 [[char *cs = nl_langinfo(CODESET);]])],
4585 [emacs_cv_langinfo_codeset=yes],
4586 [emacs_cv_langinfo_codeset=no])
4588 if test "$emacs_cv_langinfo_codeset" = yes; then
4589 AC_DEFINE([HAVE_LANGINFO_CODESET], 1,
4590 [Define if you have <langinfo.h> and nl_langinfo (CODESET).])
4592 AC_CACHE_CHECK([for nl_langinfo and _NL_PAPER_WIDTH],
4593 [emacs_cv_langinfo__nl_paper_width],
4594 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
4595 [[char *cs = nl_langinfo (_NL_PAPER_WIDTH);]])],
4596 [emacs_cv_langinfo__nl_paper_width=yes],
4597 [emacs_cv_langinfo__nl_paper_width=no])
4599 if test "$emacs_cv_langinfo__nl_paper_width" = yes; then
4600 AC_DEFINE([HAVE_LANGINFO__NL_PAPER_WIDTH], 1,
4601 [Define if you have <langinfo.h> and nl_langinfo (_NL_PAPER_WIDTH).])
4607 dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
4608 dnl how the tty code is related to POSIX and/or other versions of termios.
4609 dnl The following looks like a useful start.
4611 dnl AC_SYS_POSIX_TERMIOS
4612 dnl if test $ac_cv_sys_posix_termios = yes; then
4613 dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
4614 dnl and macros for terminal control.])
4615 dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
4618 dnl Turned on June 1996 supposing nobody will mind it.
4619 dnl MinGW emulates passwd database, so this feature doesn't make sense there.
4620 if test "${opsys}" != "mingw32"; then
4621 AC_DEFINE(AMPERSAND_FULL_NAME, 1, [Define to use the convention that &
4622 in the full name stands for the login id.])
4625 dnl Everybody supports this, except MS.
4626 dnl Seems like the kind of thing we should be testing for, though.
4627 ## Note: PTYs are broken on darwin <6. Use at your own risk.
4628 if test "${opsys}" != "mingw32"; then
4629 AC_DEFINE(HAVE_PTYS, 1, [Define if the system supports pty devices.])
4632 dnl Everybody supports this, except MS-DOS.
4633 dnl Seems like the kind of thing we should be testing for, though.
4634 AC_DEFINE(HAVE_SOCKETS, 1, [Define if the system supports
4635 4.2-compatible sockets.])
4637 AH_TEMPLATE(INTERNAL_TERMINAL, [This is substituted when $TERM is "internal".])
4639 AH_TEMPLATE(NULL_DEVICE, [Name of the file to open to get
4640 a null file, or a data sink.])
4641 if test "${opsys}" = "mingw32"; then
4642 AC_DEFINE(NULL_DEVICE, ["NUL:"])
4644 AC_DEFINE(NULL_DEVICE, ["/dev/null"])
4647 if test "${opsys}" = "mingw32"; then
4652 AC_DEFINE_UNQUOTED(SEPCHAR, ['$SEPCHAR'], [Character that separates PATH elements.])
4653 dnl This is for MinGW, and is used in test/Makefile.in.
4654 dnl The MSYS Bash has heuristics for replacing ':' with ';' when it
4655 dnl decides that a command-line argument to be passed to a MinGW program
4656 dnl is a PATH-style list of directories. But that heuristics plays it
4657 dnl safe, and only does the replacement when it is _absolutely_ sure it
4658 dnl sees a colon-separated list of file names; e.g. ":." is left alone,
4659 dnl which breaks in-tree builds. So we do this manually instead.
4660 dnl Note that we cannot rely on PATH_SEPARATOR, as that one will always
4661 dnl be computed as ':' in MSYS Bash.
4664 dnl Everybody supports this, except MS-DOS.
4665 AC_DEFINE(subprocesses, 1, [Define to enable asynchronous subprocesses.])
4667 AC_DEFINE(USER_FULL_NAME, [pw->pw_gecos], [How to get a user's full name.])
4670 AC_DEFINE(DIRECTORY_SEP, ['/'],
4671 [Character that separates directories in a file name.])
4673 if test "${opsys}" = "mingw32"; then
4674 AC_DEFINE(IS_DEVICE_SEP(_c_), [((_c_) == ':')],
4675 [Returns true if character is a device separator.])
4677 AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == '/' || (_c_) == '\\')],
4678 [Returns true if character is a directory separator.])
4680 AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP(_c_))],
4681 [Returns true if character is any form of separator.])
4683 AC_DEFINE(IS_DEVICE_SEP(_c_), 0,
4684 [Returns true if character is a device separator.])
4686 AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == DIRECTORY_SEP)],
4687 [Returns true if character is a directory separator.])
4689 AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_))],
4690 [Returns true if character is any form of separator.])
4693 if test "$USE_X_TOOLKIT" != "none"; then
4697 dnl Assar Westerlund <assar@sics.se> says this is necessary
4698 dnl for HP-UX 10.20, and that it works for HP-UX 0 as well.
4702 if test "$have_editres" != no && test ! -z "$LIBXMU"; then
4704 dnl See libXmu.a check above.
4705 if test x$HAVE_X11XTR6 = xyes; then
4706 LIBS="-lXt -lSM -lICE $LIBXMU"
4708 OTHERLIBS="-lXt -$LIBXMU"
4710 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4711 [[#include <X11/Intrinsic.h>
4712 #include <X11/Xmu/Editres.h>]],
4713 [[_XEditResCheckMessages (0, 0, 0, 0);]])],
4714 [AC_DEFINE([X_TOOLKIT_EDITRES], 1,
4715 [Define to 1 if we should use XEditRes.])])
4721 solaris | unixware )
4722 dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
4723 dnl instead, there's a system variable _sys_nsig. Unfortunately, we
4724 dnl need the constant to dimension an array. So wire in the appropriate
4726 AC_DEFINE(NSIG_MINIMUM, 32, [Minimum value of NSIG.])
4730 emacs_broken_SIGIO=no
4733 dnl SIGIO exists, but the feature doesn't work in the way Emacs needs.
4734 hpux* | nacl | openbsd | solaris | unixware )
4735 emacs_broken_SIGIO=yes
4739 dnl On AIX Emacs uses the gmalloc.c malloc implementation. But given
4740 dnl the way this system works, libc functions that return malloced
4741 dnl memory use the libc malloc implementation. Calling xfree or
4742 dnl xrealloc on the results of such functions results in a crash.
4744 dnl One solution for this could be to define SYSTEM_MALLOC in configure,
4745 dnl but that does not currently work on this system.
4747 dnl It is possible to completely override the malloc implementation on
4748 dnl AIX, but that involves putting the malloc functions in a shared
4749 dnl library and setting the MALLOCTYPE environment variable to point to
4750 dnl that shared library.
4752 dnl Emacs currently calls xrealloc on the results of get_current_dir name,
4753 dnl to avoid a crash just use the Emacs implementation for that function.
4755 dnl FIXME We could change the AC_CHECK_FUNCS call near the start
4756 dnl of this file, so that we do not check for get_current_dir_name
4757 dnl on AIX. But that might be fragile if something else ends
4758 dnl up testing for get_current_dir_name as a dependency.
4759 AC_DEFINE(BROKEN_GET_CURRENT_DIR_NAME, 1, [Define if
4760 get_current_dir_name should not be used.])
4764 dnl Circumvent a bug in FreeBSD. In the following sequence of
4765 dnl writes/reads on a PTY, read(2) returns bogus data:
4767 dnl write(2) 1022 bytes
4768 dnl write(2) 954 bytes, get EAGAIN
4769 dnl read(2) 1024 bytes in process_read_output
4770 dnl read(2) 11 bytes in process_read_output
4772 dnl That is, read(2) returns more bytes than have ever been written
4773 dnl successfully. The 1033 bytes read are the 1022 bytes written
4774 dnl successfully after processing (for example with CRs added if the
4775 dnl terminal is set up that way which it is here). The same bytes will
4776 dnl be seen again in a later read(2), without the CRs.
4777 AC_DEFINE(BROKEN_PTY_READ_AFTER_EAGAIN, 1, [Define on FreeBSD to
4778 work around an issue when reading from a PTY.])
4784 dnl FIXME Can't we test if this exists (eg /proc/$$)?
4785 AC_DEFINE(HAVE_PROCFS, 1, [Define if you have the /proc filesystem.])
4790 darwin | dragonfly | freebsd | netbsd | openbsd )
4791 AC_DEFINE(DONT_REOPEN_PTY, 1, [Define if process.c does not need to
4792 close a pty to make it a controlling terminal (it is already a
4793 controlling terminal of the subprocess, because we did ioctl TIOCSCTTY).])
4797 dnl FIXME Surely we can test for this rather than hard-code it.
4799 netbsd | openbsd) sound_device="/dev/audio" ;;
4800 *) sound_device="/dev/dsp" ;;
4804 AC_DEFINE_UNQUOTED(DEFAULT_SOUND_DEVICE, "$sound_device",
4805 [Name of the default sound device.])
4808 dnl Emacs can read input using SIGIO and buffering characters itself,
4809 dnl or using CBREAK mode and making C-g cause SIGINT.
4810 dnl The choice is controlled by the variable interrupt_input.
4812 dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
4814 dnl Emacs uses the presence of the USABLE_SIGIO macro
4815 dnl to indicate whether or not signal-driven I/O is possible. It uses
4816 dnl INTERRUPT_INPUT to decide whether to use it by default.
4818 dnl SIGIO can be used only on systems that implement it (4.2 and 4.3).
4819 dnl CBREAK mode has two disadvantages
4820 dnl 1) At least in 4.2, it is impossible to handle the Meta key properly.
4821 dnl I hear that in system V this problem does not exist.
4822 dnl 2) Control-G causes output to be discarded.
4823 dnl I do not know whether this can be fixed in system V.
4825 dnl Another method of doing input is planned but not implemented.
4826 dnl It would have Emacs fork off a separate process
4827 dnl to read the input and send it to the true Emacs process
4830 darwin | gnu-linux | gnu-kfreebsd )
4831 AC_DEFINE(INTERRUPT_INPUT, 1, [Define to read input using SIGIO.])
4836 dnl If the system's imake configuration file defines 'NeedWidePrototypes'
4837 dnl as 'NO', we must define NARROWPROTO manually. Such a define is
4838 dnl generated in the Makefile generated by 'xmkmf'. If we don't define
4839 dnl NARROWPROTO, we will see the wrong function prototypes for X functions
4840 dnl taking float or double parameters.
4842 cygwin|gnu|gnu-linux|gnu-kfreebsd|freebsd|netbsd|openbsd)
4843 AC_DEFINE(NARROWPROTO, 1, [Define if system's imake configuration
4844 file defines 'NeedWidePrototypes' as 'NO'.])
4849 dnl Used in process.c, this must be a loop, even if it only runs once.
4850 AH_TEMPLATE(PTY_ITERATION, [How to iterate over PTYs.])
4851 dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
4852 dnl trying suffixes 0-16.
4853 AH_TEMPLATE(FIRST_PTY_LETTER, [Letter to use in finding device name of
4854 first PTY, if PTYs are supported.])
4855 AH_TEMPLATE(PTY_OPEN, [How to open a PTY, if non-standard.])
4856 AH_TEMPLATE(PTY_NAME_SPRINTF, [How to get the device name of the control
4857 end of a PTY, if non-standard.])
4858 AH_TEMPLATE(PTY_TTY_NAME_SPRINTF, [How to get device name of the tty
4859 end of a PTY, if non-standard.])
4863 AC_DEFINE(PTY_ITERATION, [int c; for (c = 0; !c ; c++)])
4864 dnl You allocate a pty by opening /dev/ptc to get the master side.
4865 dnl To get the name of the slave side, you just ttyname() the master side.
4866 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
4867 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));])
4871 AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
4872 dnl multi-line AC_DEFINEs are hard. :(
4873 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)])
4874 AC_DEFINE(PTY_NAME_SPRINTF, [])
4875 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
4879 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
4882 gnu-linux | gnu-kfreebsd | dragonfly | freebsd | openbsd | netbsd | darwin | nacl )
4884 if test "x$ac_cv_func_grantpt" = xyes; then
4885 AC_DEFINE(UNIX98_PTYS, 1, [Define if the system has Unix98 PTYs.])
4886 AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
4887 dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD
4888 dnl to prevent sigchld_handler from intercepting the child's death.
4889 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); }])
4890 dnl if HAVE_POSIX_OPENPT
4891 if test "x$ac_cv_func_posix_openpt" = xyes; then
4892 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)])
4893 AC_DEFINE(PTY_NAME_SPRINTF, [])
4895 elif test "x$ac_cv_func_getpt" = xyes; then
4896 AC_DEFINE(PTY_OPEN, [fd = getpt ()])
4897 AC_DEFINE(PTY_NAME_SPRINTF, [])
4899 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
4902 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
4907 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
4908 AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])
4909 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])
4913 dnl On SysVr4, grantpt(3) forks a subprocess, so do not use
4914 dnl O_CLOEXEC when opening the pty, and keep the SIGCHLD handler
4915 dnl from intercepting that death. If any child but grantpt's should die
4916 dnl within, it should be caught after sigrelse(2).
4917 AC_DEFINE(PTY_OPEN, [fd = open (pty_name, O_RDWR | O_NONBLOCK)])
4918 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); }])
4922 dnl Comments are as per solaris.
4923 AC_DEFINE(PTY_OPEN, [fd = open (pty_name, O_RDWR | O_NONBLOCK)])
4924 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); }])
4930 solaris | unixware )
4931 dnl This change means that we don't loop through allocate_pty too
4932 dnl many times in the (rare) event of a failure.
4933 AC_DEFINE(FIRST_PTY_LETTER, ['z'])
4934 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
4935 dnl Push various streams modules onto a PTY channel. Used in process.c.
4936 AC_DEFINE(SETUP_SLAVE_PTY, [if (ioctl (std_in, I_PUSH, "ptem") == -1) fatal ("ioctl I_PUSH ptem"); if (ioctl (std_in, I_PUSH, "ldterm") == -1) fatal ("ioctl I_PUSH ldterm"); if (ioctl (std_in, I_PUSH, "ttcompat") == -1) fatal ("ioctl I_PUSH ttcompat");], [How to set up a slave PTY, if needed.])
4941 AH_TEMPLATE(SIGNALS_VIA_CHARACTERS, [Make process_send_signal work by
4942 "typing" a signal character on the pty.])
4945 dnl Perry Smith <pedz@ddivt1.austin.ibm.com> says this is correct for AIX.
4946 aix4-2 | cygwin | gnu | dragonfly | freebsd | netbsd | openbsd | darwin )
4947 AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
4950 dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.
4951 dnl FIXME Does gnu-kfreebsd have linux/version.h? It seems unlikely...
4952 gnu-linux | gnu-kfreebsd )
4954 AC_CACHE_CHECK([for signals via characters], [emacs_cv_signals_via_chars],
4955 [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
4956 #include <linux/version.h>
4957 #if LINUX_VERSION_CODE < 0x20400
4958 # error "Linux version too old"
4960 ]], [[]])], emacs_cv_signals_via_chars=yes, emacs_cv_signals_via_chars=no)])
4962 test "$emacs_cv_signals_via_chars" = yes && AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
4967 AH_TEMPLATE(TAB3, [Undocumented.])
4970 darwin) AC_DEFINE(TAB3, OXTABS) ;;
4972 gnu | dragonfly | freebsd | netbsd | openbsd )
4973 AC_DEFINE(TABDLY, OXTABS, [Undocumented.])
4974 AC_DEFINE(TAB3, OXTABS)
4977 gnu-linux | gnu-kfreebsd )
4978 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
4982 ]], [[]])], AC_DEFINE(GC_MARK_SECONDARY_STACK(),
4983 [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)],
4984 [Mark a secondary stack, like the register stack on the ia64.]), [])
4988 AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call
4989 run_time_remap; for HPUX.])
4994 dnl This won't be used automatically yet. We also need to know, at least,
4995 dnl that the stack is continuous.
4996 AH_TEMPLATE(GC_SETJMP_WORKS, [Define if setjmp is known to save all
4997 registers relevant for conservative garbage collection in the jmp_buf.])
5001 dnl Not all the architectures are tested, but there are Debian packages
5002 dnl for SCM and/or Guile on them, so the technique must work. See also
5003 dnl comments in alloc.c concerning setjmp and gcc.
5004 dnl Fixme: it's probably safe to just use the GCC conditional below.
5005 gnu-linux | gnu-kfreebsd )
5006 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5007 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
5008 || defined __alpha__ || defined __mips__ || defined __s390__ \
5009 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
5010 || defined __ia64__ || defined __sh__
5013 # error "setjmp not known to work on this arch"
5015 ]], [[]])], AC_DEFINE(GC_SETJMP_WORKS, 1))
5020 if test x$GCC = xyes; then
5021 dnl GC_SETJMP_WORKS is nearly always appropriate for GCC.
5022 AC_DEFINE(GC_SETJMP_WORKS, 1)
5025 aix* | dragonfly | freebsd | netbsd | openbsd | solaris )
5026 AC_DEFINE(GC_SETJMP_WORKS, 1)
5031 dnl In a weird quirk, MS runtime uses _setjmp and longjmp.
5032 AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
5035 [[#include <setjmp.h>
5037 # define _longjmp longjmp
5042 _longjmp (j, 1);]])],
5043 [emacs_cv_func__setjmp=yes],
5044 [emacs_cv_func__setjmp=no])])
5045 if test $emacs_cv_func__setjmp = yes; then
5046 AC_DEFINE([HAVE__SETJMP], 1, [Define to 1 if _setjmp and _longjmp work.])
5049 # We need to preserve signal mask to handle C stack overflows.
5050 AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp],
5053 [[#include <setjmp.h>
5056 if (! sigsetjmp (j, 1))
5057 siglongjmp (j, 1);]])],
5058 [emacs_cv_func_sigsetjmp=yes],
5059 [emacs_cv_func_sigsetjmp=no])])
5060 if test $emacs_cv_func_sigsetjmp = yes; then
5061 AC_DEFINE([HAVE_SIGSETJMP], 1,
5062 [Define to 1 if sigsetjmp and siglongjmp work.])
5065 case $emacs_cv_func_sigsetjmp,$emacs_cv_alternate_stack,$opsys in
5066 yes,yes,* | *,*,mingw32)
5067 AC_DEFINE([HAVE_STACK_OVERFLOW_HANDLING], 1,
5068 [Define to 1 if C stack overflow can be handled in some cases.]);;
5072 solaris | unixware )
5073 dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
5074 dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs,
5075 dnl and this is all we need.
5076 AC_DEFINE(TIOCSIGSEND, TIOCSIGNAL, [Some platforms redefine this.])
5083 dnl Used in xfaces.c.
5084 AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on
5085 some systems, where it requires time.h.])
5090 dnl Define symbols to identify the version of Unix this is.
5091 dnl Define all the symbols that apply correctly.
5092 AH_TEMPLATE(DOS_NT, [Define if the system is MS DOS or MS Windows.])
5093 AH_TEMPLATE(MSDOS, [Define if the system is MS DOS.])
5094 AH_TEMPLATE(USG, [Define if the system is compatible with System III.])
5095 AH_TEMPLATE(USG5_4, [Define if the system is compatible with System V Release 4.])
5100 dnl This symbol should be defined on AIX Version 3 ???????
5101 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5103 # error "_AIX not defined"
5105 ]], [[]])], [], AC_DEFINE(_AIX, [], [Define if the system is AIX.]))
5109 AC_DEFINE(CYGWIN, 1, [Define if the system is Cygwin.])
5113 dnl Not __APPLE__, as this may not be defined on non-macOS Darwin.
5114 dnl Not DARWIN, because Panther and lower CoreFoundation.h use DARWIN to
5115 dnl distinguish macOS from pure Darwin.
5116 AC_DEFINE(DARWIN_OS, [], [Define if the system is Darwin.])
5119 gnu-linux | gnu-kfreebsd )
5121 AC_DEFINE(GNU_LINUX, [], [Define if ths system is compatible with GNU/Linux.])
5126 AC_DEFINE(HPUX, [], [Define if the system is HPUX.])
5130 AC_DEFINE(DOS_NT, [])
5131 AC_DEFINE(WINDOWSNT, 1, [Define if compiling for native MS Windows.])
5132 if test "x$ac_enable_checking" != "x" ; then
5133 AC_DEFINE(EMACSDEBUG, 1, [Define to 1 to enable w32 debug facilities.])
5139 AC_DEFINE(USG5_4, [])
5140 AC_DEFINE(SOLARIS2, [], [Define if the system is Solaris.])
5145 AC_DEFINE(USG5_4, [])
5149 AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
5152 dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
5153 emacs_cv_usable_FIONREAD=no
5157 emacs_cv_usable_FIONREAD=yes
5162 [AC_LANG_PROGRAM([[#include <sys/types.h>
5163 #include <sys/ioctl.h>
5165 # include <sys/filio.h>
5168 [[int foo = ioctl (0, FIONREAD, &foo);]])],
5169 [emacs_cv_usable_FIONREAD=yes],
5170 [emacs_cv_usable_FIONREAD=no])
5173 if test $emacs_cv_usable_FIONREAD = yes; then
5174 AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.])
5176 if test $emacs_broken_SIGIO = no; then
5177 AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO],
5179 [AC_LANG_PROGRAM([[#include <fcntl.h>
5182 [[int foo = SIGIO | F_SETFL | FASYNC;]])],
5183 [emacs_cv_usable_SIGIO=yes],
5184 [emacs_cv_usable_SIGIO=no])],
5185 [emacs_cv_usable_SIGIO=yes],
5186 [emacs_cv_usable_SIGIO=no])
5187 if test $emacs_cv_usable_SIGIO = yes; then
5188 AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.])
5195 dnl It works to open the pty's tty in the parent (Emacs), then
5196 dnl close and reopen it in the child.
5197 AC_DEFINE(USG_SUBTTY_WORKS, 1, [Define for USG systems where it
5198 works to open a pty's tty in the parent process, then close and
5199 reopen it in the child.])
5203 AC_DEFINE(_STRUCTURED_PROC, 1, [Needed for system_process_attributes
5208 # Set up the CFLAGS for real compilation, so we can substitute it.
5209 CFLAGS="$REAL_CFLAGS"
5210 CPPFLAGS="$REAL_CPPFLAGS"
5213 ## Hack to detect a buggy GCC version.
5214 if test "$GCC" = yes && \
5215 $CC --version 2> /dev/null | grep 'gcc.* 4.5.0' >/dev/null; then
5217 *-fno-optimize-sibling-calls*) ;;
5219 AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS.]);;
5223 version=$PACKAGE_VERSION
5225 copyright="Copyright (C) 2021 Free Software Foundation, Inc."
5226 AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"],
5227 [Short copyright string for this version of Emacs.])
5230 ### Specify what sort of things we'll be editing into Makefile and config.h.
5231 ### Use configuration here uncanonicalized to avoid exceeding size limits.
5233 AC_SUBST(configuration)
5238 AC_SUBST(exec_prefix)
5241 AC_SUBST(sharedstatedir)
5242 AC_SUBST(libexecdir)
5246 AC_SUBST(standardlisppath)
5247 AC_SUBST(locallisppath)
5249 AC_SUBST(x_default_search_path)
5251 AC_SUBST(archlibdir)
5257 ## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
5258 ## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
5259 ## end of LIBX_BASE, but nothing ever set it.
5260 AC_SUBST(LD_SWITCH_X_SITE)
5261 AC_SUBST(C_SWITCH_X_SITE)
5262 AC_SUBST(GNUSTEP_CFLAGS)
5264 ## Used in lwlib/Makefile.in.
5265 AC_SUBST(X_TOOLKIT_TYPE)
5267 AC_SUBST(ns_appbindir)
5268 AC_SUBST(ns_appresdir)
5270 AC_SUBST(GNU_OBJC_CFLAGS)
5271 AC_SUBST(OTHER_FILES)
5273 if test -n "${term_header}"; then
5274 AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}",
5275 [Define to the header for the built-in window system.])
5278 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
5279 [Define to the canonical Emacs configuration name.])
5280 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}",
5281 [Define to the options passed to configure.])
5286 if test "${HAVE_X_WINDOWS}" = "yes" ; then
5287 AC_DEFINE(HAVE_X_WINDOWS, 1,
5288 [Define to 1 if you want to use the X window system.])
5290 XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o"
5292 if test "$HAVE_CAIRO" = "yes"; then
5293 FONT_OBJ="$FONT_OBJ ftfont.o ftcrfont.o"
5294 elif test "$HAVE_XFT" = "yes"; then
5295 FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o"
5296 elif test "$HAVE_FREETYPE" = "yes"; then
5297 FONT_OBJ="$FONT_OBJ ftfont.o"
5300 if test "${HAVE_HARFBUZZ}" = "yes" ; then
5301 FONT_OBJ="$FONT_OBJ hbfont.o"
5310 if test "${USE_X_TOOLKIT}" != "none" ; then
5312 AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
5313 if test "${USE_X_TOOLKIT}" = "LUCID"; then
5314 AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.])
5315 elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
5316 AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.])
5320 ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
5321 MOTIF_LIBW="$MOTIF_LIBW -lXpm"
5325 ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
5326 ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
5327 MOTIF_LIBW="MOTIF_LIBW -lXimp"
5331 ## olson@mcs.anl.gov says -li18n is needed by -lXm.
5332 MOTIF_LIBW="$MOTIF_LIBW -li18n"
5335 MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
5338 AC_SUBST(WIDGET_OBJ)
5341 case "$USE_X_TOOLKIT" in
5342 MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
5343 LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
5344 none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
5346 if test "$HAVE_XWIDGETS" = "yes"; then
5347 TOOLKIT_LIBW="$TOOLKIT_LIBW -lXcomposite"
5349 AC_SUBST(TOOLKIT_LIBW)
5351 if test "${opsys}" != "mingw32"; then
5352 if test "$USE_X_TOOLKIT" = "none"; then
5353 LIBXT_OTHER="\$(LIBXSM)"
5355 LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
5358 AC_SUBST(LIBXT_OTHER)
5360 if test "${HAVE_X11}" = "yes" ; then
5361 AC_DEFINE(HAVE_X11, 1,
5362 [Define to 1 if you want to use version 11 of X windows.])
5363 LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
5367 AC_SUBST(LIBX_OTHER)
5370 if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then
5372 elif test "$USE_X_TOOLKIT" = none; then
5374 LIBXMENU='$(oldXMenudir)/libXMenu11.a'
5375 AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu"
5377 LIBXMENU='$(lwlibdir)/liblw.a'
5378 AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib"
5382 AC_CACHE_CHECK([for struct alignment],
5383 [emacs_cv_struct_alignment],
5385 [AC_LANG_PROGRAM([[#include <stddef.h>
5386 struct s { char c; } __attribute__ ((aligned (8)));
5387 struct t { char c; struct s s; };
5388 char verify[offsetof (struct t, s) == 8 ? 1 : -1];
5390 [emacs_cv_struct_alignment=yes],
5391 [emacs_cv_struct_alignment=no])])
5392 if test "$emacs_cv_struct_alignment" = yes; then
5393 AC_DEFINE([HAVE_STRUCT_ATTRIBUTE_ALIGNED], 1,
5394 [Define to 1 if 'struct __attribute__ ((aligned (N)))' aligns the
5395 structure to an N-byte boundary.])
5400 AC_CACHE_CHECK([for statement expressions],
5401 [emacs_cv_statement_expressions],
5403 [AC_LANG_PROGRAM([], [[return ({ int x = 5; x-x; });]])],
5404 [emacs_cv_statement_expressions=yes],
5405 [emacs_cv_statement_expressions=no])])
5406 if test "$emacs_cv_statement_expressions" = yes; then
5407 AC_DEFINE([HAVE_STATEMENT_EXPRESSIONS], 1,
5408 [Define to 1 if statement expressions work.])
5411 if test "${GNU_MALLOC}" = "yes" ; then
5412 AC_DEFINE(GNU_MALLOC, 1,
5413 [Define to 1 if you want to use the GNU memory allocator.])
5417 if test "${REL_ALLOC}" = "yes" ; then
5418 AC_DEFINE(REL_ALLOC, 1,
5419 [Define REL_ALLOC if you want to use the relocating allocator for
5422 test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
5424 AC_SUBST(RALLOC_OBJ)
5426 if test "$opsys" = "cygwin"; then
5427 CYGWIN_OBJ="cygw32.o"
5428 ## Cygwin differs because of its unexec().
5430 POST_ALLOC_OBJ=lastfile.o
5431 elif test "$opsys" = "mingw32"; then
5434 POST_ALLOC_OBJ=lastfile.o
5437 PRE_ALLOC_OBJ=lastfile.o
5440 AC_SUBST(CYGWIN_OBJ)
5441 AC_SUBST(PRE_ALLOC_OBJ)
5442 AC_SUBST(POST_ALLOC_OBJ)
5444 dnl Call this 'FORTIFY_SOUR' so that it sorts before the 'FORTIFY_SOURCE'
5445 dnl verbatim defined above. The tricky name is apropos, as this hack
5446 dnl makes Fortify go sour!
5447 AH_VERBATIM([FORTIFY_SOUR],
5448 [/* Without the following workaround, Emacs runs slowly on OS X 10.8.
5449 The workaround disables some useful run-time checking, so it
5450 should be conditional to the platforms with the performance bug.
5451 Perhaps Apple will fix this some day; also see m4/extern-inline.m4. */
5452 #if defined __APPLE__ && defined __GNUC__
5453 # ifndef _DONT_USE_CTYPE_INLINE_
5454 # define _DONT_USE_CTYPE_INLINE_
5456 # ifndef _FORTIFY_SOURCE
5457 # define _FORTIFY_SOURCE 0
5462 # If user asks to omit features, disable optional features that gnulib
5463 # might otherwise enable.
5464 if test "$with_features" = no && test "$enable_acl" != yes; then
5468 # Configure gnulib. Although this does not affect CFLAGS or LIBS permanently.
5469 # it temporarily reverts them to their pre-pkg-config values,
5470 # because gnulib needs to work with both src (which uses the
5471 # pkg-config stuff) and lib-src (which does not). For example, gnulib
5472 # may need to determine whether LIB_CLOCK_GETTIME should contain -lrt,
5473 # and it therefore needs to run in an environment where LIBS does not
5474 # already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
5475 # for some package unrelated to lib-src.
5478 CFLAGS=$pre_PKG_CONFIG_CFLAGS
5479 LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
5480 gl_ASSERT_NO_GNULIB_POSIXCHECK
5481 gl_ASSERT_NO_GNULIB_TESTS
5486 if test "${opsys}" = "mingw32"; then
5487 CPPFLAGS="$CPPFLAGS -DUSE_CRT_DLL=1 -I \${abs_top_srcdir}/nt/inc"
5488 # Remove unneeded switches from the value of CC that goes to Makefiles
5489 CC=`AS_ECHO(["$CC"]) | sed -e "s,$GCC_TEST_OPTIONS,,"`
5493 aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
5495 cygwin) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000" ;;
5498 if test "$HAVE_NS" = "yes"; then
5499 libs_nsgui="-framework AppKit"
5500 if test "$NS_IMPL_COCOA" = "yes"; then
5501 libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon -framework IOSurface"
5506 LD_SWITCH_SYSTEM_TEMACS=$libs_nsgui
5507 ## The -headerpad option tells ld (see man page) to leave room at the
5508 ## end of the header for adding load commands. Needed for dumping.
5509 ## 0x1000 is enough for roughly 52 load commands on the x86_64
5510 ## architecture (where they are 78 bytes each). The actual number of
5511 ## load commands added is not consistent but normally ranges from
5512 ## about 14 to about 34. Setting it high gets us plenty of slop and
5513 ## only costs about 1.5K of wasted binary space.
5514 headerpad_extra=1000
5515 if test "$with_unexec" = yes; then
5516 LD_SWITCH_SYSTEM_TEMACS="-fno-pie $LD_SWITCH_SYSTEM_TEMACS -Xlinker -headerpad -Xlinker $headerpad_extra"
5519 ## This is here because src/Makefile.in did some extra fiddling around
5520 ## with LD_SWITCH_SYSTEM. It seems cleaner to put this in
5521 ## LD_SWITCH_SYSTEM_TEMACS instead,
5522 test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
5523 LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
5526 ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
5527 ## find X at run-time.
5528 ## When handled by cpp, this was in LD_SWITCH_SYSTEM. However, at the
5529 ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
5530 ## had not yet been defined and was expanded to null. Hence LD_SWITCH_SYSTEM
5531 ## had different values in configure (in ac_link) and src/Makefile.in.
5532 ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
5533 gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
5536 ## Is it any better under MinGW64 to relocate emacs into higher addresses?
5537 case "$canonical" in
5538 x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x400000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
5539 *) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
5543 *) LD_SWITCH_SYSTEM_TEMACS= ;;
5546 # -no-pie or -nopie fixes a temacs segfault on Gentoo, OpenBSD,
5547 # Ubuntu, and other systems with "hardened" GCC configurations for
5548 # some reason (Bug#18784). We don't know why this works, but not
5549 # segfaulting is better than segfaulting. Use ac_c_werror_flag=yes
5550 # when trying the option, otherwise clang keeps warning that it does
5551 # not understand it, and pre-4.6 GCC has a similar problem
5552 # (Bug#20338). Prefer -no-pie to -nopie, as -no-pie is the
5553 # spelling used by GCC 6.1.0 and later (Bug#24682).
5555 [for $CC option to disable position independent executables],
5556 [emacs_cv_prog_cc_no_pie],
5557 [if test $with_unexec = no; then
5558 emacs_cv_prog_cc_no_pie='not needed'
5560 emacs_save_c_werror_flag=$ac_c_werror_flag
5561 emacs_save_LDFLAGS=$LDFLAGS
5562 ac_c_werror_flag=yes
5563 for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do
5564 test $emacs_cv_prog_cc_no_pie = no && break
5565 LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie"
5566 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break])
5568 ac_c_werror_flag=$emacs_save_c_werror_flag
5569 LDFLAGS=$emacs_save_LDFLAGS
5571 case $emacs_cv_prog_cc_no_pie in
5573 LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie"
5577 if test x$ac_enable_profiling != x ; then
5579 *freebsd | gnu-linux) ;;
5580 *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -pg" ;;
5584 LD_SWITCH_SYSTEM_TEMACS="$LDFLAGS_NOCOMBRELOC $LD_SWITCH_SYSTEM_TEMACS"
5586 AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
5588 ## Common for all window systems
5589 if test "$window_system" != "none"; then
5590 AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
5591 AC_DEFINE(POLL_FOR_INPUT, 1, [Define if you poll periodically to detect C-g.])
5592 WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o"
5595 AC_SUBST(WINDOW_SYSTEM_OBJ)
5597 AH_TOP([/* GNU Emacs site configuration template file.
5599 Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2021
5600 Free Software Foundation, Inc.
5602 This file is part of GNU Emacs.
5604 GNU Emacs is free software: you can redistribute it and/or modify
5605 it under the terms of the GNU General Public License as published by
5606 the Free Software Foundation, either version 3 of the License, or (at
5607 your option) any later version.
5609 GNU Emacs is distributed in the hope that it will be useful,
5610 but WITHOUT ANY WARRANTY; without even the implied warranty of
5611 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5612 GNU General Public License for more details.
5614 You should have received a copy of the GNU General Public License
5615 along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
5618 /* No code in Emacs #includes config.h twice, but some bits of code
5619 intended to work with other packages as well (like gmalloc.c)
5620 think they can include it as many times as they like. */
5621 #ifndef EMACS_CONFIG_H
5622 #define EMACS_CONFIG_H
5625 AH_BOTTOM([#include <conf_post.h>
5627 #endif /* EMACS_CONFIG_H */
5636 #### Report on what we decided to do.
5637 #### Report GTK as a toolkit, even if it doesn't use Xt.
5638 #### It makes printing result more understandable as using GTK sets
5639 #### toolkit_scroll_bars to yes by default.
5640 if test "${HAVE_GTK}" = "yes"; then
5641 USE_X_TOOLKIT="$USE_GTK_TOOLKIT"
5644 if test $USE_ACL -ne 0; then
5645 ACL_SUMMARY="yes $LIB_ACL"
5650 if test -z "$GMP_H"; then
5656 emacs_standard_dirs='Standard dirs'
5658 Configured for '${canonical}'.
5660 Where should the build process find the source code? ${srcdir}
5661 What compiler should emacs be built with? ${CC} ${CFLAGS}
5662 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
5663 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
5664 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
5665 What window system should Emacs use? ${window_system}
5666 What toolkit should Emacs use? ${USE_X_TOOLKIT}
5667 Where do we find X Windows header files? ${x_includes:-$emacs_standard_dirs}
5668 Where do we find X Windows libraries? ${x_libraries:-$emacs_standard_dirs}"])
5670 #### Please respect alphabetical ordering when making additions.
5672 emacs_config_features=
5673 for opt in ACL CAIRO DBUS FREETYPE GCONF GIF GLIB GMP GNUTLS GPM GSETTINGS \
5674 HARFBUZZ IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 \
5675 M17N_FLT MODULES NOTIFY NS OLDXMENU PDUMPER PNG RSVG SOUND THREADS TIFF \
5676 TOOLKIT_SCROLL_BARS UNEXEC X11 XAW3D XDBE XFT XIM XPM XWIDGETS X_TOOLKIT \
5680 PDUMPER) val=${with_pdumper} ;;
5681 UNEXEC) val=${with_unexec} ;;
5682 GLIB) val=${emacs_cv_links_glib} ;;
5683 NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;;
5684 TOOLKIT_SCROLL_BARS|X_TOOLKIT) eval val=\${USE_$opt} ;;
5685 THREADS) val=${threads_enabled} ;;
5686 *) eval val=\${HAVE_$opt} ;;
5689 xno|xnone|x) continue ;;
5694 GTK*|LUCID|MOTIF) opt=$val ;;
5700 *lkqueue*) opt="$opt LIBKQUEUE" ;;
5701 *kqueue*) opt="$opt KQUEUE" ;;
5702 *inotify*) opt="$opt INOTIFY" ;;
5703 *gfile*) opt="$opt GFILENOTIFY" ;;
5704 *w32*) opt="$opt W32NOTIFY" ;;
5708 AS_VAR_APPEND([emacs_config_features], ["$optsep$opt"])
5711 AC_DEFINE_UNQUOTED(EMACS_CONFIG_FEATURES, "${emacs_config_features}",
5712 [Summary of some of the main features enabled by configure.])
5714 AS_ECHO([" Does Emacs use -lXaw3d? ${HAVE_XAW3D}
5715 Does Emacs use -lXpm? ${HAVE_XPM}
5716 Does Emacs use -ljpeg? ${HAVE_JPEG}
5717 Does Emacs use -ltiff? ${HAVE_TIFF}
5718 Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF
5719 Does Emacs use a png library? ${HAVE_PNG} $LIBPNG
5720 Does Emacs use -lrsvg-2? ${HAVE_RSVG}
5721 Does Emacs use cairo? ${HAVE_CAIRO}
5722 Does Emacs use -llcms2? ${HAVE_LCMS2}
5723 Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}
5724 Does Emacs use native APIs for images? ${NATIVE_IMAGE_API}
5725 Does Emacs support sound? ${HAVE_SOUND}
5726 Does Emacs use -lgpm? ${HAVE_GPM}
5727 Does Emacs use -ldbus? ${HAVE_DBUS}
5728 Does Emacs use -lgconf? ${HAVE_GCONF}
5729 Does Emacs use GSettings? ${HAVE_GSETTINGS}
5730 Does Emacs use a file notification library? ${NOTIFY_SUMMARY}
5731 Does Emacs use access control lists? ${ACL_SUMMARY}
5732 Does Emacs use -lselinux? ${HAVE_LIBSELINUX}
5733 Does Emacs use -lgnutls? ${HAVE_GNUTLS}
5734 Does Emacs use -lxml2? ${HAVE_LIBXML2}
5735 Does Emacs use -lfreetype? ${HAVE_FREETYPE}
5736 Does Emacs use HarfBuzz? ${HAVE_HARFBUZZ}
5737 Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}
5738 Does Emacs use -lotf? ${HAVE_LIBOTF}
5739 Does Emacs use -lxft? ${HAVE_XFT}
5740 Does Emacs use -lsystemd? ${HAVE_LIBSYSTEMD}
5741 Does Emacs use -ljansson? ${HAVE_JSON}
5742 Does Emacs use the GMP library? ${HAVE_GMP}
5743 Does Emacs directly use zlib? ${HAVE_ZLIB}
5744 Does Emacs have dynamic modules support? ${HAVE_MODULES}
5745 Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}
5746 Does Emacs support Xwidgets? ${HAVE_XWIDGETS}
5747 Does Emacs have threading support in lisp? ${threads_enabled}
5748 Does Emacs support the portable dumper? ${with_pdumper}
5749 Does Emacs support legacy unexec dumping? ${with_unexec}
5750 Which dumping strategy does Emacs use? ${with_dumping}
5753 if test -n "${EMACSDATA}"; then
5754 AS_ECHO([" Environment variable EMACSDATA set to: $EMACSDATA"])
5756 if test -n "${EMACSDOC}"; then
5757 AS_ECHO([" Environment variable EMACSDOC set to: $EMACSDOC"])
5762 if test "$HAVE_NS" = "yes"; then
5764 AS_ECHO(["Run '${MAKE-make}' to build Emacs, then run 'src/emacs' to test it.
5765 Run '${MAKE-make} install' in order to build an application bundle.
5766 The application will go to nextstep/Emacs.app and can be run or moved
5768 if test "$EN_NS_SELF_CONTAINED" = "yes"; then
5769 echo "The application will be fully self-contained."
5771 AS_ECHO(["The lisp resources for the application will be installed under ${prefix}.
5772 You may need to run \"${MAKE-make} install\" with sudo. The application will fail
5773 to run if these resources are not installed."])
5778 case $opsys,$emacs_uname_r in
5780 AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]])
5783 cygwin,3.0.[[0-7]]'('* | cygwin,3.1.[[0-2]]'('*)
5784 AC_DEFINE([HAVE_CYGWIN_O_PATH_BUG], 1,
5785 [Define to 1 if opening a FIFO, socket, or symlink with O_PATH is buggy.]);;
5788 # Remove any trailing slashes in these variables.
5790 */) prefix=`AS_DIRNAME(["$prefix."])`;;
5792 case $exec_prefix in
5793 */) exec_prefix=`AS_DIRNAME(["$exec_prefix."])`;;
5796 if test "$HAVE_NS" = "yes"; then
5797 if test "$NS_IMPL_GNUSTEP" = yes; then
5798 AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \
5799 nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in])
5800 ns_check_file=Resources/Info-gnustep.plist
5802 AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \
5803 nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in])
5804 ns_check_file=Contents/Info.plist
5806 AC_SUBST(ns_check_file)
5809 AC_CONFIG_FILES([Makefile lib/gnulib.mk])
5811 dnl config.status treats $srcdir specially, so I think this is ok...
5812 AC_CONFIG_FILES([$srcdir/doc/man/emacs.1])
5814 m4_define([subdir_makefiles],
5815 [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])
5816 SUBDIR_MAKEFILES="subdir_makefiles"
5817 AC_CONFIG_FILES(subdir_makefiles)
5819 dnl The test/ directory is missing if './make-dist --no-tests' was used.
5820 opt_makefile=test/Makefile
5821 if test -f "$srcdir/$opt_makefile.in"; then
5822 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
5823 dnl Again, it's best not to use a variable. Though you can add
5824 dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
5825 AC_CONFIG_FILES([test/Makefile])
5829 dnl The admin/ directory used to be excluded from tarfiles.
5830 if test -d $srcdir/admin; then
5831 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES admin/charsets/Makefile admin/unidata/Makefile admin/grammars/Makefile"
5832 AC_CONFIG_FILES([admin/charsets/Makefile])
5833 AC_CONFIG_FILES([admin/unidata/Makefile])
5834 AC_CONFIG_FILES([admin/grammars/Makefile])
5838 SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
5840 AC_SUBST(SUBDIR_MAKEFILES_IN)
5842 dnl You might wonder (I did) why epaths.h is generated by running make,
5843 dnl rather than just letting configure generate it from epaths.in.
5844 dnl One reason is that the various paths are not fully expanded (see above);
5845 dnl e.g., gamedir='${localstatedir}/games/emacs'.
5846 dnl Secondly, the GNU Coding standards require that one should be able
5847 dnl to run 'make prefix=/some/where/else' and override the values set
5848 dnl by configure. This also explains the 'move-if-change' test and
5849 dnl the use of force in the 'epaths-force' rule in Makefile.in.
5850 AC_CONFIG_COMMANDS([src/epaths.h], [
5851 if test "${opsys}" = "mingw32"; then
5852 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force-w32
5854 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
5855 fi || AC_MSG_ERROR(['src/epaths.h' could not be made.])
5856 ], [GCC="$GCC" CPPFLAGS="$CPPFLAGS" opsys="$opsys"])
5858 dnl NB we have to cheat and use the ac_... version because abs_top_srcdir
5859 dnl is not yet set, sigh. Or we could use ../$srcdir/src/.gdbinit,
5861 AC_CONFIG_COMMANDS([src/.gdbinit], [
5862 if test ! -f src/.gdbinit && test -f "$srcdir/src/.gdbinit"; then
5863 AS_ECHO(["source $ac_abs_top_srcdir/src/.gdbinit"]) > src/.gdbinit
5867 dnl Perhaps this would be better named doc-emacs-emacsver.texi?
5868 dnl See comments for etc-refcards-emacsver.tex.
5869 dnl Since we get a doc/emacs directory generated anyway, for the Makefile,
5870 dnl it is not quite the same. But we are generating in $srcdir.
5871 AC_CONFIG_COMMANDS([doc/emacs/emacsver.texi], [
5872 ${MAKE-make} -s --no-print-directory -C doc/emacs doc-emacsver || \
5873 AC_MSG_ERROR(['doc/emacs/emacsver.texi' could not be made.])
5876 dnl If we give this the more natural name, etc/refcards/emacsver.texi,
5877 dnl then a directory etc/refcards is created in the build directory,
5878 dnl which is probably harmless, but confusing (in out-of-tree builds).
5879 dnl (If we were to generate etc/refcards/Makefile, this might change.)
5880 dnl It is really $srcdir/etc/refcards/emacsver.tex that we generate.
5881 AC_CONFIG_COMMANDS([etc-refcards-emacsver.tex], [
5882 ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \
5883 AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.])
5886 if test $AUTO_DEPEND = yes; then
5887 for dir in $AUTODEPEND_PARENTS; do
5888 AS_MKDIR_P([$dir/deps])
5891 if $gl_gnulib_enabled_dynarray || $gl_gnulib_enabled_scratch_buffer; then
5892 AS_MKDIR_P([lib/malloc])
5893 if test $AUTO_DEPEND = yes; then
5894 AS_MKDIR_P([lib/deps/malloc])
5900 if test ! "$with_mailutils"; then
5901 if test "$with_pop" = yes; then
5902 AC_MSG_WARN([This configuration installs a 'movemail' program
5903 that retrieves POP3 email via only insecure channels.
5904 To omit insecure POP3, you can use '$0 --without-pop'.])
5905 elif test "$with_pop" = no-by-default; then
5906 AC_MSG_WARN([This configuration installs a 'movemail' program
5907 that does not retrieve POP3 email. By default, Emacs 25 and earlier
5908 installed a 'movemail' program that retrieved POP3 email via only
5909 insecure channels, a practice that is no longer recommended but that
5910 you can continue to support by using '$0 --with-pop'.])
5915 # Don't suggest GNU Mailutils, as it hasn't been ported.
5918 emacs_fix_movemail="use '$0 --with-mailutils'"
5919 case `(movemail --version) 2>/dev/null` in
5921 *) emacs_fix_movemail="install GNU Mailutils
5922 <https://mailutils.org> and $emacs_fix_movemail";;
5924 AC_MSG_NOTICE([You might want to $emacs_fix_movemail.]);;
5928 if test "${HAVE_XFT}" = yes; then
5929 AC_MSG_WARN([This configuration uses libXft, which has a number of
5930 font rendering issues, and is being considered for removal in the
5931 next release of Emacs. Please consider using Cairo graphics +
5932 HarfBuzz text shaping instead (they are auto-detected if the
5933 relevant development headers are installed).])
5936 if test "${HAVE_CAIRO}" = "yes" && test "${HAVE_HARFBUZZ}" = no; then
5937 AC_MSG_WARN([This configuration uses the Cairo graphics library,
5938 but not the HarfBuzz font shaping library (minimum version $harfbuzz_required_ver).
5939 We recommend the use of HarfBuzz when using Cairo, please install
5940 appropriate HarfBuzz development packages.])
5943 # Let plain 'make' work.
5944 test "$MAKE" = make || test -f makefile || cat >makefile <<EOF
5948 \$(MAKE) -f Makefile \$?
5950 \$(MAKE) -f Makefile \$<