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-2024 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], [31.0.50], [bug-gnu-emacs@gnu.org], [],
27 [https://www.gnu.org/software/emacs/])
29 if test "$XCONFIGURE" = "android"; then
30 # configure is being called recursively to configure Emacs for
32 AC_MSG_NOTICE([called to recursively configure Emacs for Android.])
33 # Set CC to ANDROID_CC and CFLAGS to ANDROID_CFLAGS.
35 # Set -Wno-implicit-function-declaration. Building Emacs for older
36 # versions of Android requires configure tests to fail if the
37 # functions are not defined, as the Android library in the NDK
38 # defines subroutines that are not available in the headers being
40 CFLAGS="$ANDROID_CFLAGS -Werror=implicit-function-declaration"
41 # Don't explicitly enable support for large files unless Emacs is
42 # being built for API 21 or later. Otherwise, mmap does not work.
44 # Moreover, 64-bit variants of file IO functions in the C library are
45 # liable to fail with ENOSYS or EINVAL on earlier API versions, and as
46 # such their definitions must be explicitly disabled on NDK releases
47 # that enable them by default.
48 AS_IF([test "$ANDROID_SDK" -lt "21"], [
49 CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=32"
54 dnl Set emacs_config_options to the options of 'configure', quoted for the shell,
55 dnl and then quoted again for a C string. Separate options with spaces.
56 dnl Add some environment variables, if they were passed via the environment
57 dnl rather than on the command-line.
60 dnl This is the documented way to record the args passed to configure,
61 dnl rather than $ac_configure_args.
62 for opt in "$@" CFLAGS CPPFLAGS LDFLAGS; do
64 -n | --no-create | --no-recursion)
66 CFLAGS | CPPFLAGS | LDFLAGS)
67 eval 'test "${'$opt'+set}" = set' || continue
69 *" $opt="*) continue ;;
71 eval opt=$opt=\$$opt ;;
74 emacs_shell_specials=$IFS\''"#$&()*;<>?@<:@\\`{|~'
76 *[["$emacs_shell_specials"]]*)
79 emacs_quote_apostrophes="s/'/'\\\\''/g"
80 opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_apostrophes"` ;;
85 emacs_quote_for_c='s/[["\\]]/\\&/g; $!s/$/\\n\\/'
86 opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_for_c"` ;;
89 AS_VAR_APPEND([emacs_config_options], ["$optsep$opt"])
93 AC_CONFIG_HEADERS([src/config.h:src/config.in])
94 AC_CONFIG_SRCDIR([src/lisp.h])
95 AC_CONFIG_AUX_DIR([build-aux])
96 AC_CONFIG_MACRO_DIR([m4])
99 AC_CHECK_PROGS([XCRUN], [xcrun])
100 if test -n "$XCRUN"; then
101 if test -z "$MAKE"; then
102 dnl Call the variable MAKE_PROG, not MAKE, to avoid confusion with
103 dnl the usual MAKE variable that 'make' itself uses.
104 AC_CHECK_PROG([MAKE_PROG], [make], [yes])
105 if test -z "$MAKE_PROG"; then
108 xcsdkdir=`$XCRUN --show-sdk-path 2>/dev/null`
113 dnl Check for GNU Make and possibly set MAKE.
114 [emacs_check_gnu_make ()
116 emacs_makeout=`($1 --version) 2>/dev/null` &&
117 case $emacs_makeout in
118 'GNU Make '3.8[1-9]* | 'GNU Make '3.9[0-9]* | \
119 'GNU Make '3.[1-9][0-9][0-9]* | 'GNU Make '[4-9]* | 'GNU Make '[1-9][0-9]* )
120 ac_path_MAKE_found=:;;
123 AC_CACHE_CHECK([for GNU Make], [ac_cv_path_MAKE],
124 [ac_path_MAKE_found=false
125 if test -n "$MAKE"; then
126 emacs_check_gnu_make "$MAKE"
127 ac_cv_path_MAKE=$MAKE
129 emacs_tried_make=false
130 emacs_tried_gmake=false
131 emacs_tried_gnumake=false
132 AC_PATH_PROGS_FEATURE_CHECK([MAKE], [make gmake gnumake],
133 [[emacs_check_gnu_make "$ac_path_MAKE"
134 if $ac_path_MAKE_found; then
135 # Use the fully-qualified program name only if the basename
136 # would not resolve to it.
137 if eval \$emacs_tried_$ac_prog; then
138 ac_cv_path_MAKE=$ac_path_MAKE
140 ac_cv_path_MAKE=$ac_prog
143 eval emacs_tried_$ac_prog=:]])
145 $ac_path_MAKE_found || {
146 AC_MSG_ERROR([[Building Emacs requires GNU Make, at least version 3.81.
147 If you have it installed under another name, configure with 'MAKE=...'.
148 For example, run '$0 MAKE=gnu-make'.]])
150 MAKE=$ac_cv_path_MAKE
153 dnl Canonicalize the configuration name.
154 if test "$XCONFIGURE" = "android"; then
155 dnl Set host to whatever Android system Emacs is being configured
156 dnl for. Determine this by looking at the output of ANDROID_CC.
158 AC_MSG_CHECKING([the cross-compiler's target])
159 cc_target=`${CC} -v 2>&1 | sed -n 's/Target: //p'`
161 *android*) host_alias=$cc_target
163 *) AC_MSG_ERROR([The cross compiler does not compile for Android.
164 Please verify that you specified the correct compiler in the ANDROID_CC
165 variable when you ran configure.])
168 AC_MSG_RESULT([$host_alias])
174 AS_IF([test "$XCONFIGURE" = "android"],[
175 # Initialize the Android NDK build system. Make sure to use the
176 # passed through NDK path.
177 # Make sure to pass through the CFLAGS, as older versions of the
178 # NDK require them to be able to find system includes.
179 with_ndk_path="$android_ndk_path"
180 with_ndk_cxx="$android_ndk_cxx"
181 ndk_INIT([$android_abi], [$ANDROID_SDK], [cross/ndk-build],
184 # At the same time, configure libexec with the build directory
188 # Enter exec and configure it, using the C compiler as both the
189 # assembler and the linker. Determine the absolute name of the
191 # N.B. that the linker is actually cc, so pass -nostdlib, lest
192 # the crt be linked in. Likewise for as.
194 AS_CASE([$srcdir], [.], [emacs_srcdir=`pwd`],
195 [[[\\/]* | ?:[\\/]*]], [emacs_srcdir=$srcdir],
196 [*], [emacs_srcdir=`pwd`/$srcdir])
198 AC_MSG_NOTICE([configuring in `exec'])
200 # Derive a name for a cache file for this configure script from the
201 # current, if specified.
203 AS_CASE([$cache_file], [/dev/null | ""], [],
204 [[[\\/]* | ?:[\\/]*]], [exec_cache_file="--cache-file=$cache_file.2"],
205 [*], [exec_cache_file="--cache-file=../$cache_file.2"])
208 $CONFIG_SHELL $emacs_srcdir/exec/configure \
209 --host=$host "CC=$CC" "LD=$CC" "AS=$CC" \
210 "AR=$AR" "CFLAGS=$CFLAGS" $exec_cache_file
214 AS_IF([test "$emacs_val" != "0"],
215 [AC_MSG_ERROR([failed to configure in `exec'])])
221 if test -z "$host_alias"; then
223 # No --host argument was given to 'configure'; therefore $host
224 # was set to a default value based on the build platform. But
225 # this default value may be wrong if we are building from a
226 # 64-bit MSYS[2] pre-configured to build 32-bit MinGW programs.
227 # Therefore, we'll try to get the right host platform from the
230 AC_MSG_CHECKING([the compiler's target])
231 if test -z "$CC"; then
236 cc_target=`$cc -v 2>&1 | sed -n 's/Target: //p'`
240 "") AC_MSG_ERROR([Impossible to obtain $cc compiler target.
241 Please explicitly provide --host.])
243 *) AC_MSG_WARN([Compiler reported non-standard target.
244 Defaulting to $host.])
247 AC_MSG_RESULT([$host])
250 . $srcdir/nt/mingw-cfg.site
254 # srcdir is an absolute path. In this case, force the format
255 # "/c/foo/bar", to simplify later conversions to native Windows
256 # format ("c:/foo/bar").
257 srcdir=`cd "${srcdir}" && pwd -W`
258 # 'eval' pacifies strict POSIX non-MinGW shells (Bug#18612).
259 # We downcase the drive letter to avoid warnings when
260 # generating autoloads.
261 eval 'srcdir=/`echo ${srcdir:0:1} | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"`"${srcdir:2}"'
267 configuration=${host_alias-${build_alias-$host}}
268 emacs_uname_r=`uname -r`
270 dnl Support for --program-prefix, --program-suffix and
271 dnl --program-transform-name options
274 dnl It is important that variables on the RHS not be expanded here,
275 dnl hence the single quotes. This is per the GNU coding standards, see
276 dnl (autoconf) Installation Directory Variables
277 dnl See also epaths.h below.
278 lispdirrel='${version}/lisp'
279 lispdir='${datadir}/emacs/'${lispdirrel}
280 standardlisppath='${lispdir}'
281 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
282 '${datadir}/emacs/site-lisp'
283 lisppath='${locallisppath}:${standardlisppath}'
284 etcdir='${datadir}/emacs/${version}/etc'
285 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
286 etcdocdir='${datadir}/emacs/${version}/etc'
287 gamedir='${localstatedir}/games/emacs'
289 dnl Special option to disable the most of other options.
291 [AS_HELP_STRING([--without-all],
292 [omit almost all features and build
293 small executable with minimal dependencies])],
294 [with_features=$withval],
297 dnl ARCH_INDEPENDENT_CONFIG_FILES(FILE...)
298 dnl Like AC_CONFIG_FILES(FILE). However, do not generate this
299 dnl if configure is being called recursively in preparation
300 dnl for cross-compilation.
301 AC_DEFUN([ARCH_INDEPENDENT_CONFIG_FILES], [
302 AS_IF([test "$XCONFIGURE" != "android"], [AC_CONFIG_FILES([$1])])])
304 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
305 dnl Create a new --with option that defaults to being disabled.
306 dnl NAME is the base name of the option. The shell variable with_NAME
307 dnl will be set to either the user's value (if the option is
308 dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
309 dnl option is not specified). Note that the shell variable name is
310 dnl constructed as autoconf does, by replacing non-alphanumeric
311 dnl characters with "_".
312 dnl HELP-STRING is the help text for the option.
313 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
314 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
315 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
318 dnl OPTION_DEFAULT_IFAVAILABLE(NAME, HELP-STRING)
319 dnl Create a new --with option that defaults to 'ifavailable',
320 dnl unless it is overridden by $with_features being equal to 'no'.
321 dnl NAME is the base name of the option. The shell variable with_NAME
322 dnl will be set to either the user's value (if the option is
323 dnl specified; 'yes' for a plain --with-NAME) or to 'ifavailable' (if the
324 dnl option is not specified). Note that the shell variable name is
325 dnl constructed as autoconf does, by replacing non-alphanumeric
326 dnl characters with "_".
327 dnl HELP-STRING is the help text for the option.
328 AC_DEFUN([OPTION_DEFAULT_IFAVAILABLE], [dnl
329 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
330 AS_IF([test "$with_features" != no],
331 [m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=ifavailable],
332 [m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
336 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
337 dnl Create a new --with option that defaults to $with_features.
338 dnl NAME is the base name of the option. The shell variable with_NAME
339 dnl will be set either to 'no' (for a plain --without-NAME) or to
340 dnl 'yes' (if the option is not specified). Note that the shell
341 dnl variable name is constructed as autoconf does, by replacing
342 dnl non-alphanumeric characters with "_".
343 dnl HELP-STRING is the help text for the option.
344 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
345 AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
346 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=$with_features])dnl
349 # For retrieving mail, unencrypted network connections are the default
350 # only on native MS-Windows platforms. (FIXME: These platforms should
351 # also be secure by default.)
353 AC_ARG_WITH([mailutils],
354 [AS_HELP_STRING([--with-mailutils],
355 [rely on GNU Mailutils, so that the --without-pop through --with-mailhost
356 options are irrelevant; this is the default if GNU Mailutils is
359 [AS_IF([test "$with_features" != "no"],
360 [with_mailutils=yes-unless-android
361 AS_IF([test "x$XCONFIGURE" != "xandroid"],
362 [(movemail --version) >/dev/null 2>&1 || with_mailutils=no],
363 [dnl Don't check for movemail if cross-compiling.
364 dnl instead, default to false.
365 with_mailutils=no])])])
368 [AS_HELP_STRING([--with-pop],
369 [Support POP mail retrieval if Emacs movemail is used (not recommended,
370 as Emacs movemail POP is insecure). This is the default only on
371 native MS-Windows and Android.])],
373 dnl Enable movemail POP support on Android as GNU Mailutils is
374 dnl normally unavailable on that platform.
376 [*-mingw*|*android*], [with_pop=yes],
377 [with_pop=no-by-default])])
378 if test "$with_pop" = yes; then
379 AC_DEFINE([MAIL_USE_POP])
381 AH_TEMPLATE([MAIL_USE_POP], [Define to support POP mail retrieval.])dnl
383 OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
384 if test "$with_kerberos" != no; then
385 AC_DEFINE([KERBEROS])
387 AH_TEMPLATE([KERBEROS],
388 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
390 OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
391 if test "${with_kerberos5}" != no; then
392 if test "${with_kerberos}" = no; then
394 AC_DEFINE([KERBEROS])
396 AC_DEFINE([KERBEROS5], [1],
397 [Define to use Kerberos 5 instead of Kerberos 4.])
400 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
401 dnl FIXME hesiod support may not be present, so it seems like an error
402 dnl to define, or at least use, this unconditionally.
403 if test "$with_hesiod" != no; then
404 AC_DEFINE([HESIOD], [1],
405 [Define to support using a Hesiod database to find the POP server.])
408 OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
409 if test "$with_mail_unlink" != no; then
410 AC_DEFINE([MAIL_UNLINK_SPOOL], [1],
411 [Define to unlink, rather than empty, mail spool after reading.])
414 AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
415 [string giving default POP mail host])],
416 AC_DEFINE_UNQUOTED([MAILHOST], ["$withval"],
417 [String giving fallback POP mail host.]))
419 AC_ARG_WITH([sound],[AS_HELP_STRING([--with-sound=VALUE],
420 [compile with sound support (VALUE one of: yes, alsa, oss, bsd-ossaudio, no;
421 default yes). Only for GNU/Linux, FreeBSD, NetBSD, MinGW, Cygwin.])],
422 [ case "${withval}" in
423 yes|no|alsa|oss|bsd-ossaudio) val=$withval ;;
424 *) AC_MSG_ERROR(['--with-sound=$withval' is invalid;
425 this option's value should be 'yes', 'no', 'alsa', 'oss', or 'bsd-ossaudio'.])
430 [with_sound=$with_features])
432 AC_ARG_WITH([pdumper],
434 [--with-pdumper=VALUE],
435 [enable pdumper support unconditionally
436 ('yes', 'no', or 'auto': default 'auto')]),
437 [ case "${withval}" in
438 yes|no|auto) val=$withval ;;
440 ['--with-pdumper=$withval' is invalid;
441 this option's value should be 'yes' or 'no'.]) ;;
447 AC_ARG_WITH([unexec],
449 [--with-unexec=VALUE],
450 [enable unexec support unconditionally
451 ('yes', 'no', or 'auto': default 'auto')]),
452 [ case "${withval}" in
453 yes|no|auto) val=$withval ;;
455 ['--with-unexec=$withval' is invalid;
456 this option's value should be 'yes' or 'no'.]) ;;
462 AC_ARG_WITH([dumping],[AS_HELP_STRING([--with-dumping=VALUE],
463 [kind of dumping to use for initial Emacs build
464 (VALUE one of: pdumper, unexec, none; default pdumper)])],
465 [ case "${withval}" in
466 pdumper|unexec|none) val=$withval ;;
467 *) AC_MSG_ERROR(['--with-dumping=$withval is invalid;
468 this option's value should be 'pdumper', 'unexec', or 'none'.])
473 [with_dumping=pdumper])
475 if test "$with_pdumper" = "auto"; then
476 if test "$with_dumping" = "pdumper"; then
483 if test "$with_unexec" = "auto"; then
484 if test "$with_dumping" = "unexec"; then
491 if test "$with_dumping" = "pdumper" && test "$with_pdumper" = "no"; then
492 AC_MSG_ERROR(['--with-dumping=pdumper' requires pdumper support])
495 if test "$with_dumping" = "unexec" && test "$with_unexec" = "no"; then
496 AC_MSG_ERROR(['--with-dumping=unexec' requires unexec support])
499 if test "$with_pdumper" = "yes"; then
500 AC_DEFINE([HAVE_PDUMPER], [1],
501 [Define to build with portable dumper support])
506 AC_SUBST([HAVE_PDUMPER])
508 DUMPING=$with_dumping
511 dnl FIXME currently it is not the last.
512 dnl This should be the last --with option, because --with-x is
513 dnl added later on when we find the file name of X, and it's best to
514 dnl keep them together visually.
515 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
516 [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, motif, no)])],
517 [ case "${withval}" in
518 y | ye | yes ) val=gtk ;;
520 l | lu | luc | luci | lucid ) val=lucid ;;
521 a | at | ath | athe | athen | athena ) val=athena ;;
522 m | mo | mot | moti | motif ) val=motif ;;
523 g | gt | gtk ) val=gtk ;;
527 AC_MSG_ERROR(['--with-x-toolkit=$withval' is invalid;
528 this option's value should be 'yes', 'no', 'lucid', 'athena', 'motif', 'gtk',
529 'gtk2' or 'gtk3'. 'yes' and 'gtk' are synonyms.
530 'athena' and 'lucid' are synonyms.])
536 OPTION_DEFAULT_OFF([wide-int],
537 [prefer wide Emacs integers (typically 62-bit);
538 on 32-bit hosts, this allows buffer and string size up to 2GB,
539 at the cost of 10% to 30% slowdown of Lisp interpreter
540 and larger memory footprint])
541 if test "$with_wide_int" = yes; then
542 AC_DEFINE([WIDE_EMACS_INT], [1], [Use long long for EMACS_INT if available.])
545 dnl _ON results in a '--without' option in the --help output, so
546 dnl the help text should refer to "don't compile", etc.
547 with_xpm_set=${with_xpm+set}
548 OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
549 OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
550 OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
551 OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
552 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
553 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
554 OPTION_DEFAULT_ON([webp],[don't compile with WebP image support])
555 OPTION_DEFAULT_ON([sqlite3],[don't compile with sqlite3 support])
556 OPTION_DEFAULT_ON([lcms2],[don't compile with Little CMS support])
557 OPTION_DEFAULT_ON([libsystemd],[don't compile with libsystemd support])
558 OPTION_DEFAULT_ON([cairo],[don't compile with Cairo drawing])
559 OPTION_DEFAULT_OFF([cairo-xcb], [use XCB surfaces for Cairo support])
560 OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
561 OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support])
562 OPTION_DEFAULT_ON([native-image-api], [don't use native image APIs (GDI+ on Windows)])
563 OPTION_DEFAULT_IFAVAILABLE([tree-sitter], [compile with tree-sitter])
565 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
566 OPTION_DEFAULT_ON([harfbuzz],[don't use HarfBuzz for text shaping])
567 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
568 OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
570 OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif/Xaw3d/GTK toolkit scroll bars])
571 OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
572 OPTION_DEFAULT_ON([xim],[at runtime, default X11 XIM to off])
573 OPTION_DEFAULT_ON([xdbe],[don't use X11 double buffering support])
574 AC_ARG_WITH([ns],[AS_HELP_STRING([--with-ns],
575 [use Nextstep (macOS Cocoa or GNUstep) windowing system.
576 On by default on macOS.])],[],[with_ns=maybe])
577 OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build])
578 OPTION_DEFAULT_OFF([pgtk], [use GTK to support window systems other than X])
580 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
581 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
582 AC_ARG_WITH([gconf],[AS_HELP_STRING([--with-gconf],
583 [compile with Gconf support (Gsettings replaces this)])],[],
584 [if test $with_features = yes; then
589 OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
590 OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
591 OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
592 OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support])
593 OPTION_DEFAULT_ON([modules],[don't compile with dynamic modules support])
594 OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support])
595 OPTION_DEFAULT_OFF([cygwin32-native-compilation],[use native compilation on 32-bit Cygwin])
596 OPTION_DEFAULT_ON([xinput2],[don't use version 2 of the X Input Extension for input])
597 OPTION_DEFAULT_OFF([small-ja-dic],[generate a smaller-size Japanese dictionary])
598 OPTION_DEFAULT_OFF([android],[cross-compile Android application package])
599 OPTION_DEFAULT_ON([android-debug],[don't build Emacs as a debug package on Android])
601 # Find out of Android support is enabled and mailutils has defaulted
602 # to `yes-unless-android'. Disable it if so.
604 AS_IF([test "x$with_mailutils" = "xyes-unless-android"],
605 [AS_IF([test "x$with_android" != "xno"],
607 [with_mailutils=yes])])
609 # Clear with_mailutils if it's set to no.
611 AS_IF([test "$with_mailutils" = no],
614 AS_IF([test x"$with_mailutils" = xyes],
615 [AC_DEFINE([HAVE_MAILUTILS], [1],
616 [Define to 1 if Emacs was configured with mailutils])])
618 AC_SUBST([with_mailutils])
620 AC_ARG_WITH([shared-user-id],
621 [AS_HELP_STRING([--with-shared-user-id=ID],
622 [use the given shared user ID in Android builds])])
624 AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB],
625 [use a file notification library (LIB one of: yes, inotify, kqueue, gfile, w32, no)])],
626 [ case "${withval}" in
627 y | ye | yes ) val=yes ;;
629 i | in | ino | inot | inoti | inotif | inotify ) val=inotify ;;
630 k | kq | kqu | kque | kqueu | kqueue ) val=kqueue ;;
631 g | gf | gfi | gfil | gfile ) val=gfile ;;
632 w | w3 | w32 ) val=w32 ;;
633 * ) AC_MSG_ERROR(['--with-file-notification=$withval' is invalid;
634 this option's value should be 'yes', 'no', 'inotify', 'kqueue', 'gfile' or 'w32'.
635 'yes' is a synonym for 'w32' on MS-Windows, for 'no' on Nextstep,
636 otherwise for the first of 'inotify', 'kqueue' or 'gfile' that is usable.])
639 with_file_notification=$val
641 [with_file_notification=$with_features])
643 OPTION_DEFAULT_OFF([xwidgets],
644 [enable use of xwidgets in Emacs buffers (requires gtk3 or macOS Cocoa)])
646 OPTION_DEFAULT_OFF([be-app],
647 [enable use of Haiku's Application Kit as a window system])
649 OPTION_DEFAULT_OFF([be-cairo],
650 [enable use of cairo under Haiku's Application Kit])
652 ## Makefile.in needs the cache file name.
653 AC_SUBST([cache_file])
655 ## This is an option because I do not know if all info/man support
656 ## compressed files, nor how to test if they do so.
657 OPTION_DEFAULT_ON([compress-install],
658 [don't compress some files (.el, .info, etc.) when installing. Equivalent to:
659 make GZIP_PROG= install])
661 AC_ARG_WITH([gameuser],
662 [AS_HELP_STRING([--with-gameuser=USER_OR_GROUP],
663 [user for shared game score files.
664 An argument prefixed by ':' specifies a group instead.])])
667 case ${with_gameuser} in
669 yes) gamegroup=games ;;
670 :*) gamegroup=${with_gameuser#:} ;;
671 *) gameuser=${with_gameuser} ;;
674 AC_ARG_WITH([gnustep-conf],
675 [AS_HELP_STRING([--with-gnustep-conf=FILENAME],
676 [name of GNUstep configuration file to use on systems where the command
677 'gnustep-config' does not work; default $GNUSTEP_CONFIG_FILE, or
678 /etc/GNUstep/GNUstep.conf])])
679 test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
680 GNUSTEP_CONFIG_FILE="${with_gnustep_conf}"
681 test "X$GNUSTEP_CONFIG_FILE" = "X" && \
682 GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
684 AC_ARG_ENABLE([ns-self-contained],
685 [AS_HELP_STRING([--disable-ns-self-contained],
686 [disable self contained build under NeXTstep])],
687 [EN_NS_SELF_CONTAINED=$enableval],
688 [EN_NS_SELF_CONTAINED=yes])
691 AC_ARG_ENABLE([locallisppath],
692 [AS_HELP_STRING([--enable-locallisppath=PATH],
693 [directories Emacs should search for lisp files specific
695 [if test "${enableval}" = "no"; then
697 elif test "${enableval}" != "yes"; then
698 locallisppath=${enableval} locallisppathset=yes
701 AC_ARG_ENABLE([checking],
702 [AS_HELP_STRING([--enable-checking@<:@=LIST@:>@],
703 [enable expensive checks. With LIST,
704 enable only specific categories of checks.
705 Categories are: all,yes,no.
706 Flags are: stringbytes, stringoverrun, stringfreelist,
708 [ac_checking_flags="${enableval}"],[])
709 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
711 for check in $ac_checking_flags
714 # these set all the flags to specific states
715 yes) ac_enable_checking=1 ;;
716 no) ac_enable_checking= ;
718 ac_gc_check_stringbytes= ;
719 ac_gc_check_string_overrun= ;
720 ac_gc_check_string_free_list= ;
722 all) ac_enable_checking=1 ;
724 ac_gc_check_stringbytes=1 ;
725 ac_gc_check_string_overrun=1 ;
726 ac_gc_check_string_free_list=1 ;
728 # these enable particular checks
729 stringbytes) ac_gc_check_stringbytes=1 ;;
730 stringoverrun) ac_gc_check_string_overrun=1 ;;
731 stringfreelist) ac_gc_check_string_free_list=1 ;;
732 structs) CHECK_STRUCTS=true ;;
733 glyphs) ac_glyphs_debug=1 ;;
734 *) AC_MSG_ERROR([unknown check category $check]) ;;
739 # This environment variable is used to signal that checking should be
740 # enabled on Android. When that happens, simply enable checking for
741 # the cross-compiled Android binary.
743 AS_IF([test "x$XCONFIGURE" = "xandroid" \
744 && test "x$android_enable_checking" = "xyes"],
745 [ac_enable_checking=yes])
747 # There is little point in enabling checking in the build machine if
748 # cross-compiling for Android.
749 AS_IF([test "$with_android" = no || test -n "$XCONFIGURE"],[
750 if test x$ac_enable_checking != x ; then
751 AC_DEFINE([ENABLE_CHECKING], [1],
752 [Define to 1 if expensive run-time data type and consistency checks are enabled.])
754 if $CHECK_STRUCTS; then
755 AC_DEFINE([CHECK_STRUCTS], [1],
756 [Define this to check whether someone updated the portable dumper
757 code after changing the layout of a structure that it uses.
758 If you change one of these structures, check that the pdumper.c
759 code is still valid, and update the pertinent hash in pdumper.c
760 by manually copying the hash from the newly-generated dmpstruct.h.])
762 AC_SUBST([CHECK_STRUCTS])
763 if test x$ac_gc_check_stringbytes != x ; then
764 AC_DEFINE([GC_CHECK_STRING_BYTES], [1],
765 [Define this temporarily to hunt a bug. If defined, the size of
766 strings is redundantly recorded in sdata structures so that it can
767 be compared to the sizes recorded in Lisp strings.])
769 if test x$ac_gc_check_string_overrun != x ; then
770 AC_DEFINE([GC_CHECK_STRING_OVERRUN], [1],
771 [Define this to check for short string overrun.])
773 if test x$ac_gc_check_string_free_list != x ; then
774 AC_DEFINE([GC_CHECK_STRING_FREE_LIST], [1],
775 [Define this to check the string free list.])
777 if test x$ac_glyphs_debug != x ; then
778 AC_DEFINE([GLYPH_DEBUG], [1],
779 [Define this to enable glyphs debugging code.])
781 ],[AS_IF([test "x$ac_enable_checking" != x],
782 [android_enable_checking=yes
783 export android_enable_checking])])
785 dnl The name of this option is unfortunate. It predates, and has no
786 dnl relation to, the "sampling-based elisp profiler" added in 24.3.
787 dnl Actually, it stops it working.
788 dnl https://lists.gnu.org/r/emacs-devel/2012-11/msg00393.html
789 AC_ARG_ENABLE([profiling],
790 [AS_HELP_STRING([--enable-profiling],
791 [build emacs with low-level, gprof profiling support.
792 Mainly useful for debugging Emacs itself. May not work on
793 all platforms. Stops profiler.el working.])],
794 [ac_enable_profiling="${enableval}"],[])
795 if test x$ac_enable_profiling != x ; then
796 PROFILING_CFLAGS="-DPROFILING=1 -pg"
800 AC_SUBST([PROFILING_CFLAGS])
802 AC_ARG_ENABLE([autodepend],
803 [AS_HELP_STRING([--enable-autodepend],
804 [automatically generate dependencies to .h-files.
805 Requires gcc, enabled if found.])],
806 [ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes])
808 AC_ARG_ENABLE([gtk-deprecation-warnings],
809 [AS_HELP_STRING([--enable-gtk-deprecation-warnings],
810 [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])],
811 [ac_enable_gtk_deprecation_warnings="${enableval}"],[])
814 AC_ARG_ENABLE([build-details],
815 [AS_HELP_STRING([--disable-build-details],
816 [Make the build more deterministic by omitting host
817 names, time stamps, etc. from the output.])],
818 [test "$enableval" = no && BUILD_DETAILS=--no-build-details])
819 AC_SUBST([BUILD_DETAILS])
821 # JAVA_PUSH_LINT(OPT)
822 # -------------------
823 # Check if javac supports the diagnostic flag -Xlint:OPT.
824 # If it does, add it to WARN_JAVAFLAGS.
826 AC_DEFUN([JAVA_PUSH_LINT],
828 AC_CACHE_CHECK([whether Java compiler accepts -Xlint:$1],
829 [emacs_cv_javac_knows_lint_$1],
830 AS_IF([rm -f conftest.class
831 cat << EOF > conftest.java
839 ("$JAVAC" -Xlint:$1 conftest.java 2>&AS_MESSAGE_LOG_FD) \
840 && rm -f conftest.class], [emacs_cv_javac_knows_lint_$1=yes],
841 [emacs_cv_javac_knows_lint_$1=no]))
843 AS_IF([test "$emacs_cv_javac_knows_lint_$1" = "yes"],
844 [WARN_JAVAFLAGS="$WARN_JAVAFLAGS -Xlint:$1"])
847 # Start Android configuration. This is done in three steps:
849 # First, the SDK tools needed to build the Android package on the host
852 # Then, configure is called inside itself with the NDK C and C++
853 # compilers, and the Makefiles generated, along with config.h, are
854 # renamed to end with .android.
856 # Finally, configure continues to configure the Emacs binary that will
869 ANDROID_SHARED_USER_ID=
870 ANDROID_SHARED_USER_NAME=
873 # This is a list of Makefiles that have alternative versions for
875 android_makefiles="lib/Makefile lib/gnulib.mk lib-src/Makefile src/Makefile"
877 # This is whether or not to package mailutils into the executable.
880 AC_ARG_VAR([ANDROID_CC], [The Android C cross-compiler.])
881 AC_ARG_VAR([SDK_BUILD_TOOLS], [Name of directory holding Android SDK build-tools.])
882 AC_ARG_VAR([ANDROID_CFLAGS], [Flags given to the Android C cross-compiler.])
883 AC_ARG_VAR([JAVAC], [Java compiler path. Used for Android.])
884 AC_ARG_VAR([JARSIGNER], [Java package signer path. Used for Android.])
885 AC_ARG_VAR([APKSIGNER], [Android package signer path. Used for Android.])
886 AC_ARG_VAR([SDK_BUILD_TOOLS], [Path to the Android SDK build tools.])
887 AC_ARG_VAR([ZIP], [Path to the `zip' utility.])
889 if test "$with_android" = "yes"; then
890 AC_MSG_ERROR([Please specify the path to the Android.jar file, like so:
892 ./configure --with-android=/path/to/android.jar
894 along with the path to the SDK build-tools (this is the directory with
895 tools such as aapt, dx, and aidl):
897 SDK_BUILD_TOOLS=/path/to/sdk-build-tools
899 The cross-compiler should then be specified:
901 ANDROID_CC=/path/to/armv7a-linux-androideabi19-clang
903 In addition, you may pass any special arguments to the cross-compiler
904 via the ANDROID_CFLAGS environment variable.])
905 elif test "$with_android" = "no" || test "$with_android" = ""; then
908 AC_CHECK_PROGS([JAVAC], [javac])
909 if test "$JAVAC" = ""; then
910 AC_MSG_ERROR([The Java compiler required to build Emacs was not found.
911 Please make sure `javac' can be found on your path, or alternatively specify
912 the path to your Java compiler before configuring Emacs, like so:
914 JAVAC=/opt/jdk/bin/javac ./configure --with-android])
917 AC_CHECK_PROGS([JARSIGNER], [jarsigner])
918 if test "$JARSIGNER" = ""; then
919 AC_MSG_ERROR([The Java package signing utility was not found.
920 Please make sure `jarsigner' can be found on your path, or alternatively
921 specify its location before configuring Emacs, like so:
923 JARSIGNER=/opt/jdk/bin/jarsigner ./configure --with-android])
926 AC_CACHE_CHECK([whether the Java compiler works],
927 [emacs_cv_working_javac],
928 AS_IF([rm -f conftest.class
929 cat << EOF > conftest.java
931 import android.app.Activity;
932 import android.os.Bundle;
934 class conftest extends Activity
938 onCreate (Bundle savedInstanceState)
940 super.onCreate (savedInstanceState);
945 ("$JAVAC" -classpath "$with_android" -target 1.7 -source 1.7 conftest.java \
946 -d . >&AS_MESSAGE_LOG_FD 2>&1) && test -s conftest.class && rm -f conftest.class],
947 [emacs_cv_working_javac=yes],
948 [emacs_cv_working_javac=no]))
950 if test "$emacs_cv_working_javac" = "no"; then
951 AC_MSG_ERROR([The Java compiler does not work, or you did not specify
952 a valid path to android.jar. See config.log for more details.])
955 AC_CACHE_CHECK([whether android.jar is new enough],
956 [emacs_cv_android_v_or_later],
957 AS_IF([rm -f conftest.class
958 cat << EOF > conftest.java
960 import android.os.Build;
964 private static int test = Build.VERSION_CODES.VANILLA_ICE_CREAM;
968 ("$JAVAC" -classpath "$with_android" -target 1.7 -source 1.7 conftest.java \
969 -d . >&AS_MESSAGE_LOG_FD 2>&1) && test -s conftest.class && rm -f conftest.class],
970 [emacs_cv_android_v_or_later=yes],
971 [emacs_cv_android_v_or_later=no]))
973 if test "$emacs_cv_android_v_or_later" = "no"; then
974 AC_MSG_ERROR([Emacs must be built with an android.jar file produced for \
975 Android 15 (Vanilla Ice Cream) or later.])
978 dnl See if the Java compiler supports the `--release' option which
979 dnl makes it check for and prevent using features introduced after
982 AC_CACHE_CHECK([whether javac accepts --release 7],
983 [emacs_cv_javac_release_7], AS_IF([rm -f conftest.class
984 cat << EOF > conftest.java
992 ("$JAVAC" --release 7 conftest.java 2>&AS_MESSAGE_LOG_FD) \
993 && rm -f conftest.class],
994 [emacs_cv_javac_release_7=yes],
995 [emacs_cv_javac_release_7=no]))
997 if test "$emacs_cv_javac_release_7" = "yes"; then
998 WARN_JAVAFLAGS="$WARN_JAVAFLAGS --release 7"
1000 dnl If not, just make sure the generated bytecode is correct.
1001 WARN_JAVAFLAGS="$WARN_JAVAFLAGS -target 1.7 -source 1.7"
1004 dnl Enable some useful Java linting options.
1005 JAVA_PUSH_LINT([deprecation])
1006 JAVA_PUSH_LINT([cast])
1007 JAVA_PUSH_LINT([divzero])
1008 JAVA_PUSH_LINT([nonempty])
1009 JAVA_PUSH_LINT([empty])
1010 JAVA_PUSH_LINT([finally])
1011 JAVA_PUSH_LINT([overrides])
1012 JAVA_PUSH_LINT([path])
1013 JAVA_PUSH_LINT([serial])
1014 JAVA_PUSH_LINT([unchecked])
1016 # Get the name of the android.jar file.
1017 ANDROID_JAR="$with_android"
1019 # Substitute this into java/Makefile.
1020 AC_SUBST([WARN_JAVAFLAGS])
1022 AC_PATH_PROGS([AAPT], [aapt], [], "${SDK_BUILD_TOOLS}:$PATH")
1023 if test "$AAPT" = ""; then
1024 AC_MSG_ERROR([The Android asset packaging tool was not found.
1025 Please verify that the path to the SDK build tools you specified is correct])
1028 AC_PATH_PROGS([APKSIGNER], [apksigner], [], "${SDK_BUILD_TOOLS}:$PATH")
1029 if test "$APKSIGNER" = ""; then
1030 AC_MSG_ERROR([The Android package signing tool was not found.
1031 Please verify that the path to the SDK build tools you specified is correct])
1034 AC_PATH_PROGS([D8], [d8], [], "${SDK_BUILD_TOOLS}:$PATH")
1035 if test "$D8" = ""; then
1036 AC_MSG_ERROR([The Android dexer was not found.
1037 Please verify that the path to the SDK build tools you specified is correct])
1040 # Locate any d8.jar within the SDK build tools directory. The R8
1041 # optimizing compiler is also present in this bundle, and it generates
1042 # far superior code.
1043 emacs_val=`which $D8`
1044 emacs_val=`AS_DIRNAME([$emacs_val])`/lib/d8.jar
1045 AS_IF([test -f "$emacs_val"],
1046 [AC_CACHE_CHECK([whether d8.jar coresident with d8 binary provides r8],
1047 [emacs_cv_d8_provides_r8],
1048 [AS_IF([java -cp "$emacs_val" com.android.tools.r8.R8 --help &>/dev/null],
1049 [emacs_cv_d8_provides_r8=yes], [emacs_cv_d8_provides_r8=no])])])
1050 AS_IF([test "$emacs_cv_d8_provides_r8" = "yes"],
1051 # And substitute it for D8 if present.
1052 [D8="java -cp $emacs_val com.android.tools.r8.R8"
1055 AC_PATH_PROGS([ZIPALIGN], [zipalign], [], "${SDK_BUILD_TOOLS}:$PATH")
1056 if test "ZIPALIGN" = ""; then
1057 AC_MSG_ERROR([The Android ZIP archive alignment utility was not found.
1058 Please verify that the path to the SDK build tools you specified is correct]);
1061 dnl Now configure Emacs to generate binaries for Android. After the
1062 dnl configuration completes, move the generated Makefiles.
1064 if test "$ANDROID_CC" = ""; then
1065 AC_MSG_ERROR([Please specify the path to the Android cross-compiler
1066 for your machine. For example:
1068 ANDROID_CC=/path/to/armv7a-linux-androideabi19-clang \\
1069 ./configure --with-android])
1072 dnl Obtain the cross compiler's target to find out where binaries go
1073 dnl in the resulting package.
1075 AC_MSG_CHECKING([for the kind of Android system Emacs is being built for])
1076 cc_target=`${ANDROID_CC} -v 2>&1 | sed -n 's/Target: //p'`
1077 case "$cc_target" in
1079 *i[3-6]86*) android_abi=x86
1081 *x86_64*) android_abi=x86_64
1083 *aarch64*) android_abi=arm64-v8a
1085 *arm*v7a*) android_abi=armeabi-v7a
1087 *mips64*) android_abi=mips64
1089 *mips*) android_abi=mips
1091 *arm*) android_abi=armeabi
1094 *) AC_MSG_ERROR([configure could not determine the type of Android \
1095 binary Emacs is being configured for. Please port this configure script \
1096 to your Android system, or verify that you specified the correct compiler \
1097 in the ANDROID_CC variable when you ran configure.
1099 The compiler target is: $cc_target])
1102 AC_MSG_RESULT([$android_abi])
1104 ANDROID_ABI=$android_abi
1106 dnl Obtain the minimum SDK version of the resulting Emacs binary
1107 dnl built with this NDK.
1110 AC_MSG_CHECKING([for the lowest Android version Emacs can run on])
1111 [android_sdk=`echo "$cc_target" | grep -oE 'android([0-9][0-9]?)'`]
1113 if test -n "$android_sdk"; then
1114 android_sdk=`echo "$android_sdk" | sed -n 's/android//p'`
1115 AC_MSG_RESULT([$android_sdk])
1116 ANDROID_MIN_SDK=$android_sdk
1118 # This is probably GCC.
1119 [ cat << EOF > conftest.c
1120 #include <android/api-level.h>
1121 extern const char *foo;
1126 #if __ANDROID_API__ < 7
1127 foo = "emacs_api_6";
1128 #elif __ANDROID_API__ < 8
1129 foo = "emacs_api_7";
1130 #elif __ANDROID_API__ < 9
1131 foo = "emacs_api_8";
1132 #elif __ANDROID_API__ < 10
1133 foo = "emacs_api_9";
1134 #elif __ANDROID_API__ < 11
1135 foo = "emacs_api_10";
1136 #elif __ANDROID_API__ < 12
1137 foo = "emacs_api_11";
1138 #elif __ANDROID_API__ < 13
1139 foo = "emacs_api_12";
1140 #elif __ANDROID_API__ < 14
1141 foo = "emacs_api_13";
1142 #elif __ANDROID_API__ < 15
1143 foo = "emacs_api_14";
1144 #elif __ANDROID_API__ < 16
1145 foo = "emacs_api_15";
1146 #elif __ANDROID_API__ < 17
1147 foo = "emacs_api_16";
1148 #elif __ANDROID_API__ < 18
1149 foo = "emacs_api_17";
1150 #elif __ANDROID_API__ < 19
1151 foo = "emacs_api_18";
1152 #elif __ANDROID_API__ < 20
1153 foo = "emacs_api_19";
1154 #elif __ANDROID_API__ < 21
1155 foo = "emacs_api_20";
1156 #elif __ANDROID_API__ < 22
1157 foo = "emacs_api_21";
1158 #elif __ANDROID_API__ < 23
1159 foo = "emacs_api_22";
1160 #elif __ANDROID_API__ < 24
1161 foo = "emacs_api_23";
1162 #elif __ANDROID_API__ < 25
1163 foo = "emacs_api_24";
1164 #elif __ANDROID_API__ < 26
1165 foo = "emacs_api_25";
1166 #elif __ANDROID_API__ < 27
1167 foo = "emacs_api_26";
1168 #elif __ANDROID_API__ < 28
1169 foo = "emacs_api_27";
1170 #elif __ANDROID_API__ < 29
1171 foo = "emacs_api_28";
1172 #elif __ANDROID_API__ < 30
1173 foo = "emacs_api_29";
1174 #elif __ANDROID_API__ < 31
1175 foo = "emacs_api_30";
1176 #elif __ANDROID_API__ < 32
1177 foo = "emacs_api_31";
1178 #elif __ANDROID_API__ < 33
1179 foo = "emacs_api_32";
1180 #elif __ANDROID_API__ < 34
1181 foo = "emacs_api_33";
1182 #elif __ANDROID_API__ < 35
1183 foo = "emacs_api_34";
1184 #elif __ANDROID_API__ < 36
1185 foo = "emacs_api_35";
1187 foo = "emacs_api_future";
1192 AC_CACHE_VAL([emacs_cv_android_api],
1193 [$ANDROID_CC $ANDROID_CFLAGS -c conftest.c -o conftest.o \
1194 && emacs_cv_android_api=`grep -ao -E \
1195 "emacs_api_([[0-9][0-9]]?|future)" conftest.o`])
1196 android_sdk="$emacs_cv_android_api"
1197 rm -rf conftest.c conftest.o
1199 # If this version of the NDK requires __ANDROID_API__ to be
1200 # specified, then complain to the user.
1201 if test "$android_sdk" = "emacs_api_future"; then
1202 AC_MSG_ERROR([The version of Android to build for was not specified.
1203 You must tell the Android compiler what version of Android to build for,
1204 by defining the __ANDROID_API__ preprocessor macro in ANDROID_CC, like so:
1206 ANDROID_CC="/path/to/ndk/arm-linux-android-gcc -D__ANDROID_API__=8"])
1209 if test -n "$android_sdk"; then
1210 android_sdk=`echo $android_sdk | sed -n 's/emacs_api_//p'`
1211 AC_MSG_RESULT([$android_sdk])
1212 ANDROID_MIN_SDK=$android_sdk
1214 AC_MSG_RESULT([unknown ($cc_target); assuming 8])
1215 AC_MSG_ERROR([configure could not determine the versions of Android \
1216 a binary built with this compiler will run on. The generated application \
1217 package will likely install on older systems but crash on startup.])
1221 AC_SUBST([ANDROID_MIN_SDK])
1223 # Now tell java/Makefile if Emacs is being built for Android 4.3 or
1225 ANDROID_SDK_18_OR_EARLIER=
1226 if test "$android_sdk" -le "18"; then
1227 ANDROID_SDK_18_OR_EARLIER=yes
1229 AC_SUBST([ANDROID_SDK_18_OR_EARLIER])
1231 # Likewise for Android 2.2.
1232 ANDROID_SDK_8_OR_EARLIER=
1233 if test "$android_sdk" -le "8"; then
1234 ANDROID_SDK_8_OR_EARLIER=yes
1235 AC_CHECK_PROGS([ZIP], [zip])
1236 AS_IF([test -z "$ZIP"],
1237 [AC_MSG_ERROR([The `zip' utility is required for generating \
1238 packages targeting Android 2.2.])])
1240 AC_SUBST([ANDROID_SDK_8_OR_EARLIER])
1243 # Save confdefs.h and config.log for now.
1244 mv -f confdefs.h _confdefs.h
1245 mv -f config.log _config.log
1247 # Make sure these files are removed upon exit.
1248 trap "rm -rf _confdefs.h _config.log" 0
1250 # Figure out what --with-FOO options to pass through.
1251 passthrough="$passthrough --with-png=$with_png"
1252 passthrough="$passthrough --with-webp=$with_webp"
1253 passthrough="$passthrough --with-gif=$with_gif"
1254 passthrough="$passthrough --with-jpeg=$with_jpeg"
1255 passthrough="$passthrough --with-xml2=$with_xml2"
1256 passthrough="$passthrough --with-sqlite3=$with_sqlite3"
1257 passthrough="$passthrough --with-gnutls=$with_gnutls"
1258 passthrough="$passthrough --with-tiff=$with_tiff"
1259 passthrough="$passthrough --with-selinux=$with_selinux"
1260 passthrough="$passthrough --with-modules=$with_modules"
1261 passthrough="$passthrough --with-tree-sitter=$with_tree_sitter"
1262 passthrough="$passthrough --with-imagemagick=$with_imagemagick"
1263 passthrough="$passthrough --with-lcms2=$with_lcms2"
1264 passthrough="$passthrough --with-mailutils=$with_mailutils"
1265 passthrough="$passthrough --with-pop=$with_pop"
1266 passthrough="$passthrough --with-harfbuzz=$with_harfbuzz"
1267 passthrough="$passthrough --with-threads=$with_threads"
1268 passthrough="$passthrough --with-rsvg=$with_rsvg"
1270 # Now pass through some checking-related options.
1271 emacs_val="--enable-check-lisp-object-type=$enable_check_lisp_object_type"
1272 passthrough="$passthrough $emacs_val"
1274 # And derive a name for the recursive configure invocation's cache
1275 # file if one should be specified for this.
1276 AS_IF([test -n "$cache_file" && test "$cache_file" != "/dev/null"],
1277 [passthrough="$passthrough --cache-file=$cache_file.1"])
1279 AS_IF([test "x$with_mailutils" = "xyes"], [emacs_use_mailutils=yes])
1280 AC_SUBST([emacs_use_mailutils])
1282 AS_IF([XCONFIGURE=android ANDROID_CC="$ANDROID_CC" \
1283 ANDROID_SDK="$android_sdk" android_abi=$android_abi \
1284 android_ndk_path="$with_ndk_path" \
1285 android_ndk_cxx="$android_ndk_cxx" \
1286 $CONFIG_SHELL $0 $passthrough], [],
1287 [AC_MSG_ERROR([Failed to cross-configure Emacs for android.])])
1289 # Now set ANDROID to yes.
1292 for makefile in $android_makefiles; do
1293 AC_MSG_NOTICE([Generating $makefile.android])
1294 mv -f "$makefile" "$makefile.android"
1297 AC_MSG_NOTICE([Generating src/config.h.android])
1298 mv -f src/config.h src/config.h.android
1300 # Tell AndroidManifest.xml whether or not Emacs should be built
1302 ANDROID_DEBUGGABLE=false
1303 if test "$with_android_debug" = "yes"; then
1304 ANDROID_DEBUGGABLE=true
1306 AC_SUBST([ANDROID_DEBUGGABLE])
1308 # Move confdefs.h back now that the recursive call to configure is
1310 mv -f _confdefs.h confdefs.h
1312 # Move the Android config.log to config.log.android. */
1313 mv -f config.log config.log.android
1315 # And _config.log back.
1316 mv -f _config.log config.log
1323 AC_SUBST([ZIPALIGN])
1324 AC_SUBST([ANDROID_JAR])
1325 AC_SUBST([ANDROID_ABI])
1326 AC_SUBST([IS_D8_R8])
1328 if test "$XCONFIGURE" = "android"; then
1331 # Enable cross compiling.
1335 AC_SUBST([XCONFIGURE])
1337 if test "$ANDROID" = "yes"; then
1338 # When --with-android is specified, almost all build options must be
1339 # disabled, both within the recursive invocation of configure and
1343 # Some of these dependencies are now supported within Android, so
1344 # they can be enabled.
1345 if test "$XCONFIGURE" != "android"; then
1362 with_native_compilation=no
1376 # zlib is available in android.
1379 dnl This used to use changequote, but, apart from 'changequote is evil'
1380 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
1381 dnl the great gob of text. Thus it's not processed for possible expansion.
1382 dnl Just make sure the brackets remain balanced.
1384 dnl Since Emacs can't find matching pairs of quotes, boundaries are
1385 dnl indicated by comments.
1386 dnl quotation begins
1389 ### If you add support for a new configuration, add code to this
1390 ### switch statement to recognize your configuration name and select
1391 ### the appropriate opsys.
1393 ### As far as handling version numbers on operating systems is
1394 ### concerned, make sure things will fail in a fixable way. If
1395 ### /etc/MACHINES doesn't say anything about version numbers, be
1396 ### prepared to handle anything reasonably. If version numbers
1397 ### matter, be sure /etc/MACHINES says something about it.
1399 opsys='' unported=no
1400 case "${canonical}" in
1407 ## GNU/Linux and similar ports
1422 ## FreeBSD kernel + glibc based userland
1433 *-*-openbsd* | *-*-mirbsd* )
1437 ## Apple Darwin / macOS
1439 case "${canonical}" in
1440 *-apple-darwin[0-9].*) unported=yes ;;
1441 i[3456]86-* | x86_64-* | arm-* | aarch64-* ) ;;
1445 ## FIXME: Find a way to use Fink if available (Bug#11507).
1448 ## Chromium Native Client
1458 ## HP 9000 series 700 and 800, running HP/UX
1459 hppa*-hp-hpux10.2* )
1462 hppa*-hp-hpux1[1-9]* )
1464 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
1468 rs6000-ibm-aix4.[23]* )
1471 powerpc-ibm-aix4.[23]* )
1474 rs6000-ibm-aix[56]* )
1477 powerpc-ibm-aix[5-9]* | powerpc-ibm-aix[1-9][0-9]* )
1482 *-*-solaris* | *-*-sunos*)
1483 case "${canonical}" in
1485 amd64-*-*|x86_64-*-*) ;;
1490 ## Watch out for a compiler that we know will not work.
1491 if [ "$CC" = /usr/ucb/cc ]; then
1492 ## /usr/ucb/cc doesn't work;
1493 ## we should find some other compiler that does work.
1501 test -z "$CC" && CC=qcc
1502 LDFLAGS="-N2M $LDFLAGS"
1509 ## Intel 386 machines where we don't care about the manufacturer.
1511 case "${canonical}" in
1512 *-darwin* ) opsys=darwin ;;
1515 # MinGW overrides and adds some system headers in nt/inc.
1516 # Also, GCC 14 turns on implicit-function-declaration
1517 # error by default, which fails configure tests where our
1518 # emulation of Posix headers defines only the minimal
1519 # stuff we actually need.
1520 GCC_TEST_OPTIONS="-I $srcdir/nt/inc -Wno-error=implicit-function-declaration"
1522 *-sysv4.2uw* ) opsys=unixware ;;
1523 *-sysv5uw* ) opsys=unixware ;;
1524 *-sysv5OpenUNIX* ) opsys=unixware ;;
1525 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
1531 case "${canonical}" in
1534 # MinGW overrides and adds some system headers in nt/inc.
1535 GCC_TEST_OPTIONS="-I $srcdir/nt/inc -Wno-error=implicit-function-declaration"
1537 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
1546 ### If the code above didn't choose an operating system, just choose
1547 ### an operating system based on the configuration name. You really
1548 ### only want to use this when you have no idea what the right
1549 ### operating system is; if you know what operating systems a machine
1550 ### runs, it's cleaner to make it explicit in the case statement
1552 if test x"${opsys}" = x; then
1553 case "${canonical}" in
1554 *-gnu* ) opsys=gnu ;;
1564 if test $unported = yes; then
1565 AC_MSG_ERROR([Emacs does not support '${canonical}' systems.
1566 If you think it should, please send a report to ${PACKAGE_BUGREPORT}.
1567 Check 'etc/MACHINES' for recognized configuration names.])
1570 #### Choose a compiler.
1572 dnl Don't bother to test for C89.
1573 AC_DEFUN([_AC_PROG_CC_C89], [$2])
1575 dnl Sets GCC=yes if using gcc.
1576 AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"])
1578 if test -n "$XCRUN"; then
1579 AC_CHECK_PROGS([AR], [ar "$XCRUN ar"])
1580 test -n "$AR" && export AR
1583 dnl Emacs needs C99 or later.
1588 if test x$GCC = xyes; then
1589 test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
1592 # Avoid gnulib's tests for -lcrypto, so that there's no static dependency on it.
1593 AC_DEFUN([gl_CRYPTO_CHECK])
1594 # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
1595 # as we don't use them.
1596 AC_DEFUN([gl_FCNTL_O_FLAGS])
1597 # Avoid gnulib's test for pthread_sigmask.
1599 for func in $ac_func_list; do
1600 test $func = pthread_sigmask || AS_VAR_APPEND([funcs], [" $func"])
1603 # Emacs does not use the wchar or wctype-h modules.
1604 AC_DEFUN([gt_TYPE_WINT_T],
1605 [GNULIBHEADERS_OVERRIDE_WINT_T=0
1606 AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])])
1607 # Emacs does not need precise checks for the Solaris 10 MB_CUR_MAX bug.
1608 AC_DEFUN_ONCE([gl_STDLIB_H],
1609 [AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
1610 gl_NEXT_HEADERS([stdlib.h])])
1611 # Emacs does not need to check for off64_t.
1612 AC_DEFUN([gl_TYPE_OFF64_T],
1614 AC_SUBST([HAVE_OFF64_T])])
1616 # Initialize gnulib right after choosing the compiler.
1617 dnl Amongst other things, this sets AR and ARFLAGS.
1620 # ndk_LATE must be enclosed in this conditional to prevent the
1621 # AC_PROG_CXX it indirectly requires from being expanded at top level.
1622 if test "$ndk_INITIALIZED" = "yes"; then
1627 if test "$ac_test_CFLAGS" != set; then
1628 # It's helpful to have C macros available to GDB, so prefer -g3 to -g
1629 # if -g3 works and the user does not specify CFLAGS.
1630 # This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
1633 emacs_g3_CFLAGS='-g3';;
1635 emacs_g3_CFLAGS='-g3 -O2';;
1637 emacs_g3_CFLAGS='';;
1639 if test -n "$emacs_g3_CFLAGS"; then
1640 emacs_save_CFLAGS=$CFLAGS
1641 CFLAGS=$emacs_g3_CFLAGS
1642 AC_CACHE_CHECK([whether $CC accepts $emacs_g3_CFLAGS],
1643 [emacs_cv_prog_cc_g3],
1644 [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1645 [emacs_cv_prog_cc_g3=yes],
1646 [emacs_cv_prog_cc_g3=no])])
1647 if test $emacs_cv_prog_cc_g3 != yes; then
1648 CFLAGS=$emacs_save_CFLAGS
1650 # Haiku also needs -gdwarf-2 because its GDB is too old
1651 # to understand newer formats.
1652 if test $opsys = mingw32 || test $opsys = haiku; then
1653 CFLAGS="$CFLAGS -gdwarf-2"
1660 # No optimization flag was inferred for this non-GCC compiler.
1661 # Try -O. This is needed for xlc on AIX; see Bug#14258.
1662 emacs_save_CFLAGS=$CFLAGS
1663 test -z "$CFLAGS" || CFLAGS="$CFLAGS "
1665 AC_CACHE_CHECK([whether $CC accepts -O],
1666 [emacs_cv_prog_cc_o],
1667 [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1668 [emacs_cv_prog_cc_o=yes],
1669 [emacs_cv_prog_cc_o=no])])
1670 if test $emacs_cv_prog_cc_o != yes; then
1671 CFLAGS=$emacs_save_CFLAGS
1676 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
1677 # ---------------------------------------------------------------------------
1678 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
1679 # Otherwise, run RUN-IF-NOT-FOUND.
1680 AC_DEFUN([gl_GCC_VERSION_IFELSE],
1684 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
1687 # error "your version of gcc is older than $1.$2"
1694 # clang is unduly picky about some things.
1695 AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
1702 [emacs_cv_clang=yes],
1703 [emacs_cv_clang=no])])
1705 AC_ARG_ENABLE([gcc-warnings],
1706 [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@],
1707 [control generation of GCC warnings. The TYPE 'yes'
1708 means to fail if any warnings are issued; 'warn-only'
1709 means issue warnings without failing (default for
1710 developer builds); 'no' means disable warnings
1711 (default for non-developer builds).])],
1713 yes|no|warn-only) ;;
1714 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
1716 gl_gcc_warnings=$enableval],
1717 [# By default, use 'warn-only' if it looks like the invoker of 'configure'
1718 # is a developer as opposed to a builder. This is most likely true
1719 # if GCC is recent enough and there is a .git directory or file;
1720 # however, if there is also a .tarball-version file it is probably
1721 # just a release imported into Git for patch management.
1723 AS_IF([test -d "$srcdir"/.git || test -f "$srcdir"/.git],
1724 [AS_IF([test -f "$srcdir"/.tarball-version], [],
1725 # Clang typically identifies itself as GCC 4.2 or something similar
1726 # even if it is recent enough to accept the warnings we enable.
1727 [AS_IF([test "$emacs_cv_clang" = yes],
1728 [gl_gcc_warnings=warn-only],
1729 [gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only])])])])])
1731 NATIVE_COMPILATION_AOT=no
1732 AC_ARG_WITH([native-compilation],
1733 [AS_HELP_STRING([--with-native-compilation@<:@=TYPE@:>@],
1734 [compile with Emacs Lisp native compiler support. The TYPE
1735 'yes' (or empty) means to enable it and compile natively
1736 preloaded Lisp files; 'no' means to disable it;
1737 'aot' will make the build process compile all the Lisp
1738 files in the tree natively ahead of time. (This will
1739 usually be quite slow.)])],
1744 NATIVE_COMPILATION_AOT=yes
1747 *) AC_MSG_ERROR([bad value $withval for native-compilation option]) ;;
1749 with_native_compilation=$withval],
1750 [with_native_compilation=default]
1752 AC_SUBST([NATIVE_COMPILATION_AOT])
1754 AC_ARG_ENABLE([check-lisp-object-type],
1755 [AS_HELP_STRING([--enable-check-lisp-object-type],
1756 [Enable compile time checks for the Lisp_Object data type,
1757 which can catch some bugs during development.])])
1758 if test "$enable_check_lisp_object_type" = yes; then
1759 AC_DEFINE([CHECK_LISP_OBJECT_TYPE], [1],
1760 [Define to enable compile-time checks for the Lisp_Object data type.])
1764 # When compiling with GCC, prefer -isystem to -I when including system
1765 # include files, to avoid generating useless diagnostics for the files.
1766 AS_IF([test $gl_gcc_warnings = no],
1769 AS_IF([test "$emacs_cv_clang" = yes],
1771 # Turn off some warnings if supported.
1772 gl_WARN_ADD([-Wno-pointer-sign])
1773 gl_WARN_ADD([-Wno-string-plus-int])
1774 gl_WARN_ADD([-Wno-unknown-attributes])
1775 gl_WARN_ADD([-Wno-unknown-pragmas])
1780 # This, $nw, is the list of warnings we disable.
1783 case $with_x_toolkit in
1784 lucid | athena | motif)
1785 # Old toolkits mishandle 'const'.
1786 nw="$nw -Wwrite-strings"
1789 AS_IF([test $gl_gcc_warnings = yes],
1790 [WERROR_CFLAGS=-Werror],
1791 [# Use -fanalyzer and related options only if --enable-gcc-warnings,
1792 # as they slow GCC considerably.
1793 nw="$nw -fanalyzer -Wno-analyzer-double-free -Wno-analyzer-malloc-leak"
1794 nw="$nw -Wno-analyzer-null-dereference -Wno-analyzer-use-after-free"
1795 # Use -Wsuggest-attribute=malloc only if --enable-gcc-warnings,
1796 # as it doesn't flag code that is wrong in any way.
1797 nw="$nw -Wsuggest-attribute=malloc"])
1799 nw="$nw -Wcast-align=strict" # Emacs is tricky with pointers.
1800 nw="$nw -Wduplicated-branches" # Too many false alarms
1801 nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 110333
1802 nw="$nw -Woverlength-strings" # Not a problem these days
1803 nw="$nw -Wvla" # Emacs uses <vla.h>.
1804 nw="$nw -Wunused-const-variable=2" # lisp.h declares const objects.
1805 nw="$nw -Winline" # OK to ignore 'inline'
1806 nw="$nw -Wstrict-overflow" # OK to optimize assuming that
1807 # signed overflow has undefined behavior
1808 nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
1809 nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
1810 nw="$nw -Wbad-function-cast" # These casts are no worse than others.
1812 # Emacs doesn't care about shadowing; see
1813 # <https://lists.gnu.org/r/emacs-diffs/2011-11/msg00265.html>.
1816 # Emacs's use of alloca inhibits protecting the stack.
1817 nw="$nw -Wstack-protector"
1819 # Emacs's use of __attribute__ ((cold)) causes false alarms with this option.
1820 nw="$nw -Wsuggest-attribute=cold"
1822 # Emacs's use of partly-const functions such as Fgnutls_available_p
1823 # make this option problematic.
1824 nw="$nw -Wsuggest-attribute=const"
1826 # Emacs's use of partly-pure functions such as CHECK_TYPE make this
1827 # option problematic.
1828 nw="$nw -Wsuggest-attribute=pure"
1830 # Emacs doesn't need this paranoia.
1831 nw="$nw -Wbidi-chars=any,ucn"
1833 if test "$emacs_cv_clang" = yes; then
1834 nw="$nw -Wdouble-promotion"
1835 nm="$nm -Wunknown-pragmas"
1838 # This causes too much noise in the MinGW build.
1839 if test $opsys = mingw32; then
1840 nw="$nw -Wsuggest-attribute=format"
1843 # If Emacs is being built for Android and many functions are
1844 # currently stubbed out for operation on the build machine, disable
1845 # -Wsuggest-attribute=noreturn.
1847 AS_IF([test "$ANDROID" = "yes"],
1848 [nw="$nw -Wsuggest-attribute=noreturn"])
1850 gl_MANYWARN_ALL_GCC([ws])
1851 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
1855 gl_WARN_ADD([-Wredundant-decls]) # Prefer this, as we don't use Bison.
1856 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
1857 gl_WARN_ADD([-Wno-override-init]) # More trouble than it is worth
1858 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
1859 gl_WARN_ADD([-Wno-type-limits]) # Too many warnings for now
1860 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
1861 gl_WARN_ADD([-Wno-format-nonliteral])
1862 gl_WARN_ADD([-Wno-bidi-chars])
1863 AS_IF([test $gl_gcc_warnings = yes],
1864 [gl_WARN_ADD([-Wno-analyzer-fd-leak])]) # GCC bug 109839
1866 # clang is unduly picky about some things.
1867 if test "$emacs_cv_clang" = yes; then
1868 gl_WARN_ADD([-Wno-bitwise-instead-of-logical])
1869 gl_WARN_ADD([-Wno-missing-braces])
1870 gl_WARN_ADD([-Wno-null-pointer-arithmetic])
1871 gl_WARN_ADD([-Wno-implicit-const-int-float-conversion])
1872 gl_WARN_ADD([-Wno-int-in-bool-context])
1873 gl_WARN_ADD([-Wno-shift-overflow])
1876 # This causes too much noise in the MinGW build
1877 if test $opsys = mingw32; then
1878 gl_WARN_ADD([-Wno-pointer-sign])
1881 AC_DEFINE([GCC_LINT], [1], [Define to 1 if --enable-gcc-warnings.])
1882 AS_IF([test $gl_gcc_warnings = yes],
1883 [AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
1884 AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE],
1885 [/* Enable compile-time and run-time bounds-checking, and some warnings,
1886 without upsetting glibc 2.15+. */
1887 #if (defined GNULIB_PORTCHECK && !defined _FORTIFY_SOURCE \
1888 && defined __OPTIMIZE__ && __OPTIMIZE__)
1889 # define _FORTIFY_SOURCE 2
1894 # clang is picky about these regardless of whether
1895 # --enable-gcc-warnings is specified.
1896 if test "$emacs_cv_clang" = yes; then
1897 gl_WARN_ADD([-Wno-initializer-overrides])
1898 gl_WARN_ADD([-Wno-tautological-compare])
1899 gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
1902 # Suppress deprecation warnings from using sprintf variants,
1903 # starting with Xcode 14.1 on macOS 13.
1904 # These warnings are false alarms, as Emacs usage of sprintf is safe.
1905 if test $opsys = darwin; then
1906 gl_WARN_ADD([-Wno-deprecated-declarations])
1909 # Use a slightly smaller set of warning options for lib/.
1911 nw="$nw -Wunused-macros"
1912 gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
1914 AC_SUBST([WERROR_CFLAGS])
1915 AC_SUBST([GNULIB_WARN_CFLAGS])
1924 AC_ARG_ENABLE([link-time-optimization],
1925 [AS_HELP_STRING([--enable-link-time-optimization],
1926 [build with link-time optimization
1927 (experimental; see INSTALL)])],
1928 if test "${enableval}" != "no"; then
1930 if test "$emacs_cv_clang" = yes; then
1931 AC_MSG_CHECKING([whether link-time optimization is supported by clang])
1932 GOLD_PLUGIN=`$CC -print-file-name=LLVMgold.so 2>/dev/null`
1933 if test -x "$GOLD_PLUGIN"; then
1936 elif test x$GCC = xyes; then
1937 AC_MSG_CHECKING([whether link-time optimization is supported by gcc])
1938 CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
1939 if test x$CPUS != x; then
1945 AC_MSG_ERROR([Link-time optimization is not supported with your compiler.])
1947 if test -z "$LTO"; then
1951 CFLAGS="$CFLAGS $LTO"
1952 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1953 [ac_lto_supported=yes], [ac_lto_supported=no])
1954 CFLAGS="$old_CFLAGS"
1956 AC_MSG_RESULT([$ac_lto_supported])
1957 if test "$ac_lto_supported" = "yes"; then
1958 CFLAGS="$CFLAGS $LTO"
1959 if test "$emacs_cv_clang" = yes; then
1960 AC_MSG_WARN([Please read INSTALL before using link-time optimization with clang])
1961 # WARNING: 'ar --plugin ...' doesn't work without
1962 # command, so plugin name is appended to ARFLAGS.
1963 ARFLAGS="cru --plugin $GOLD_PLUGIN"
1964 RANLIB="$RANLIB --plugin $GOLD_PLUGIN"
1966 dnl The following is needed for GCC 4.9.0. The GCC 4.9.0 release notes
1967 dnl suggest that instead of -ffat-lto-objects we should use gcc-ar and
1968 dnl gcc-ranlib in place of ar and ranlib, but gcc-ar makes /usr/bin/ar
1969 dnl dump core on Fedora 20, so play it safe for now.
1970 gl_COMPILER_OPTION_IF([-ffat-lto-objects],
1971 [CFLAGS="$CFLAGS -ffat-lto-objects"])
1977 dnl Automake replacements.
1978 AC_DEFUN([AM_CONDITIONAL],
1979 [$2 && $1_CONDITION=1 || $1_CONDITION=
1980 AC_SUBST([$1_CONDITION])])
1981 AC_DEFUN([AM_COND_IF],
1982 [AS_IF([test "$$1_CONDITION"], [$2], [$3])])
1984 dnl Prefer silent make output. For verbose output, use
1985 dnl 'configure --disable-silent-rules' or 'make V=1' .
1986 AC_ARG_ENABLE([silent-rules],
1988 [--disable-silent-rules],
1989 [verbose build output (undo: "make V=0")])])
1990 if test "$enable_silent_rules" = no; then
1991 AM_DEFAULT_VERBOSITY=1
1993 AM_DEFAULT_VERBOSITY=0
1995 AC_SUBST([AM_DEFAULT_VERBOSITY])
1996 ARCH_INDEPENDENT_CONFIG_FILES([src/verbose.mk])
1998 dnl Some other nice autoconf tests.
2000 dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
2002 dnl if test "x$RANLIB" = x; then
2007 dnl Sadly, AC_PROG_LN_S is too restrictive. It also tests whether links
2008 dnl can be made to directories. This is not relevant for our usage, and
2009 dnl excludes some cases that work fine for us. Eg MS Windows or files
2010 dnl hosted on AFS, both examples where simple links work, but links to
2011 dnl directories fail. We use a cut-down version instead.
2014 AC_CACHE_CHECK([command to symlink files in the same directory], [emacs_cv_ln_s_fileonly],
2015 [rm -f conf$$ conf$$.file
2017 emacs_cv_ln_s_fileonly='cp -p'
2019 dnl On MinGW, ensure we will call the MSYS /bin/ln.exe, not some
2020 dnl random program in the current directory.
2021 if (echo >conf$$.file) 2>/dev/null; then
2022 if test "$opsys" = "mingw32"; then
2023 emacs_cv_ln_s_fileonly=/bin/ln
2024 elif ln -s conf$$.file conf$$ 2>/dev/null; then
2025 emacs_cv_ln_s_fileonly='ln -s'
2026 elif ln conf$$.file conf$$ 2>/dev/null; then
2027 emacs_cv_ln_s_fileonly=ln
2031 rm -f conf$$ conf$$.file])
2032 LN_S_FILEONLY=$emacs_cv_ln_s_fileonly
2034 AC_SUBST([LN_S_FILEONLY])
2037 dnl AC_PROG_LN_S sets LN_S to 'cp -pR' for MinGW, on the premise that 'ln'
2038 dnl doesn't support links to directories, as in "ln file dir". But that
2039 dnl use is non-portable, and OTOH MinGW wants to use hard links for Emacs
2040 dnl executables at "make install" time.
2041 dnl See https://lists.gnu.org/r/emacs-devel/2013-04/msg00475.html
2042 dnl for more details.
2043 if test "$opsys" = "mingw32"; then
2047 dnl On some Debian versions, "install-info" prints irritating messages
2048 dnl "This is not dpkg install-info anymore, but GNU install-info"
2049 dnl if called via an absolute file name.
2050 dnl Use the entirely-identical-but-quieter ginstall-info instead if present.
2051 dnl Sadly some people may have an old ginstall-info installed on
2052 dnl non-Debian systems, so we can't use this.
2053 dnl AC_PATH_PROGS([INSTALL_INFO], [ginstall-info install-info], [:],
2054 dnl [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
2056 AC_PATH_PROG([INSTALL_INFO], [install-info], [:],
2057 [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
2058 dnl Don't use GZIP, which is used by gzip for additional parameters.
2059 AC_PATH_PROG([GZIP_PROG], [gzip])
2061 test $with_compress_install != yes && test -n "$GZIP_PROG" && \
2062 GZIP_PROG=" # $GZIP_PROG # (disabled by configure --without-compress-install)"
2064 if test "$with_dumping" = "unexec" && test "$opsys" = "nacl"; then
2065 AC_MSG_ERROR([nacl is not compatible with --with-dumping=unexec])
2068 AC_CACHE_CHECK([for 'find' args to delete a file],
2069 [emacs_cv_find_delete],
2070 [if touch conftest.tmp && find conftest.tmp -delete 2>/dev/null &&
2071 test ! -f conftest.tmp
2072 then emacs_cv_find_delete="-delete"
2073 else emacs_cv_find_delete="-exec rm -f {} +"
2075 FIND_DELETE=$emacs_cv_find_delete
2076 AC_SUBST([FIND_DELETE])
2080 if test $with_unexec = yes && test $opsys = gnu-linux; then
2081 if test "${SETFATTR+set}" != set; then
2082 AC_CACHE_CHECK([for setfattr],
2083 [emacs_cv_prog_setfattr],
2085 if (setfattr -n user.pax.flags conftest.tmp) >/dev/null 2>&1; then
2086 emacs_cv_prog_setfattr=yes
2088 emacs_cv_prog_setfattr=no
2090 if test "$emacs_cv_prog_setfattr" = yes; then
2091 PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er'
2097 case $opsys,$PAXCTL_notdumped,$emacs_uname_r in
2098 gnu-linux,,* | netbsd,,[0-7].*)
2099 AC_PATH_PROG([PAXCTL], [paxctl], [],
2100 [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
2101 if test -n "$PAXCTL"; then
2102 if test "$opsys" = netbsd; then
2103 PAXCTL_dumped='$(PAXCTL) +a'
2104 PAXCTL_notdumped=$PAXCTL_dumped
2106 AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header])
2107 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
2108 [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then
2109 AC_MSG_RESULT([yes])
2114 if test -n "$PAXCTL"; then
2115 PAXCTL_dumped='$(PAXCTL) -zex'
2116 PAXCTL_notdumped='$(PAXCTL) -r'
2122 AC_SUBST([PAXCTL_dumped])
2123 AC_SUBST([PAXCTL_notdumped])
2124 AC_SUBST([SETFATTR])
2126 # Makeinfo on macOS is ancient, check whether there is a more recent
2127 # version installed by Homebrew.
2128 AC_CHECK_PROGS([BREW], [brew])
2129 if test -n "$BREW"; then
2130 AC_PATH_PROG([MAKEINFO], [makeinfo], [],
2131 [`$BREW --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH])
2134 # Check MacPorts on macOS.
2135 if test $opsys = darwin; then
2136 AC_PATH_PROG([HAVE_MACPORTS], [port])
2139 ## Require makeinfo >= 4.13 (last of the 4.x series) to build the manuals.
2140 : ${MAKEINFO:=makeinfo}
2141 case `($MAKEINFO --version) 2>/dev/null` in
2142 *' (GNU texinfo) '4.1[[3-9]]* | \
2143 *' (GNU texinfo) '[[5-9]]* | \
2144 *' (GNU texinfo) '[[1-9][0-9]]* ) ;;
2148 ## Makeinfo is unusual. For a released Emacs, the manuals are
2149 ## pre-built, and not deleted by the normal clean rules. makeinfo is
2150 ## therefore in the category of "special tools" not normally required, which
2151 ## configure does not have to check for (eg autoconf itself).
2152 ## In a repository checkout on the other hand, the manuals are not included.
2153 ## So makeinfo is a requirement to build from the repository, and configure
2154 ## should test for it as it does for any other build requirement.
2155 ## We use the presence of $srcdir/info/emacs to distinguish a release,
2156 ## with pre-built manuals, from a repository checkout.
2157 if test "$MAKEINFO" = "no"; then
2159 if test ! -e "$srcdir/info/emacs" && test ! -e "$srcdir/info/emacs.info"; then
2160 AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.13, and your
2161 source tree does not seem to have pre-built manuals in the 'info' directory.
2162 Please install a suitable version of makeinfo.] )
2164 AC_MSG_WARN( [You do not seem to have makeinfo >= 4.13.
2165 You will not be able to rebuild the manuals if you delete them or change
2169 AC_SUBST([MAKEINFO])
2171 if test $opsys = mingw32; then
2172 DOCMISC_W32=efaq-w32
2176 AC_SUBST([DOCMISC_W32])
2178 dnl Add our options to ac_link now, after it is set up.
2180 if test x$GCC = xyes; then
2181 test "x$GCC_LINK_TEST_OPTIONS" != x && \
2182 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
2184 test "x$NON_GCC_LINK_TEST_OPTIONS" != x && \
2185 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
2188 dnl On some platforms using GNU ld, linking temacs needs -znocombreloc.
2189 dnl Although this has something to do with dumping, the details are unknown.
2190 dnl If the flag is used but not needed,
2191 dnl Emacs should still work (albeit a bit more slowly),
2192 dnl so use the flag everywhere that it is supported.
2193 dnl When testing whether the flag works, treat GCC specially
2194 dnl since it just gives a non-fatal 'unrecognized option'
2195 dnl if not built to support GNU ld.
2196 if test "$GCC" = yes; then
2197 LDFLAGS_NOCOMBRELOC="-Wl,-znocombreloc"
2199 LDFLAGS_NOCOMBRELOC="-znocombreloc"
2202 AC_CACHE_CHECK([for -znocombreloc], [emacs_cv_znocombreloc],
2203 [if test $with_unexec = no; then
2204 emacs_cv_znocombreloc='not needed'
2206 save_LDFLAGS=$LDFLAGS
2207 LDFLAGS="$LDFLAGS $LDFLAGS_NOCOMBRELOC"
2208 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
2209 [emacs_cv_znocombreloc=yes], [emacs_cv_znocombreloc=no])
2210 LDFLAGS=$save_LDFLAGS
2213 case $emacs_cv_znocombreloc in
2215 LDFLAGS_NOCOMBRELOC= ;;
2219 AC_CACHE_CHECK([whether addresses are sanitized],
2220 [emacs_cv_sanitize_address],
2223 [[#ifndef __has_feature
2224 #define __has_feature(f) 0
2226 #if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
2228 error "Addresses are not sanitized.";
2231 [emacs_cv_sanitize_address=yes],
2232 [emacs_cv_sanitize_address=no])])
2234 if test $with_unexec = yes; then
2235 AC_DEFINE([HAVE_UNEXEC], [1], [Define if Emacs supports unexec.])
2236 if test "$emacs_cv_sanitize_address" = yes; then
2237 AC_MSG_WARN([[Addresses are sanitized; suggest --without-unexec]])
2243 test $with_unexec = yes &&
2245 # MSDOS uses unexcoff.o
2247 UNEXEC_OBJ=unexaix.o
2253 UNEXEC_OBJ=unexmacosx.o
2256 UNEXEC_OBJ=unexhp9k800.o
2259 UNEXEC_OBJ=unexw32.o
2262 # Use the Solaris dldump() function, called from unexsol.c, to dump
2263 # emacs, instead of the generic ELF dump code found in unexelf.c.
2264 # The resulting binary has a complete symbol table, and is better
2265 # for debugging and other observability tools (debuggers, pstack, etc).
2266 UNEXEC_OBJ=unexsol.o
2269 UNEXEC_OBJ=unexelf.o
2272 AC_SUBST([UNEXEC_OBJ])
2275 test "$with_unexec" = no || case "$opsys" in
2277 ## Let 'ld' find image libs and similar things in /usr/local/lib.
2278 ## The system compiler, GCC, has apparently been modified to not
2279 ## look there, contrary to what a stock GCC would do.
2280 ### It's not our place to do this. See bug#10313#17.
2281 ### LD_SWITCH_SYSTEM=-L/usr/local/lib
2286 ## cpp test was "ifdef __mips__", but presumably this is equivalent...
2287 case $host_cpu in mips*) LD_SWITCH_SYSTEM="-G 0";; esac
2291 ### It's not our place to do this. See bug#10313#17.
2292 ### LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
2297 ## Han Boetes <han@boetes.org> says this is necessary,
2298 ## otherwise Emacs dumps core on elf systems.
2299 LD_SWITCH_SYSTEM="-Z"
2302 AC_SUBST([LD_SWITCH_SYSTEM])
2304 ac_link="$ac_link $LD_SWITCH_SYSTEM"
2306 ## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
2307 ## which has not been defined yet. When this was handled with cpp,
2308 ## it was expanded to null when configure sourced the s/*.h file.
2309 ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
2310 ## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
2311 ## (or somesuch), but because it is supposed to go at the _front_
2312 ## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
2313 ## Compare with the gnu-linux case below, which added to the end
2314 ## of LD_SWITCH_SYSTEM, and so can instead go at the front of
2315 ## LD_SWITCH_SYSTEM_TEMACS.
2318 LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
2323 test $with_unexec = yes &&
2326 ## With ELF, make sure that all common symbols get allocated to in the
2327 ## data section. Otherwise, the dump of temacs may miss variables in
2328 ## the shared library that have been initialized. For example, with
2329 ## GNU libc, __malloc_initialized would normally be resolved to the
2330 ## shared library's .bss section, which is fatal.
2331 if test "x$GCC" = "xyes"; then
2332 C_SWITCH_MACHINE="-fno-common"
2334 AC_MSG_ERROR([Non-GCC compilers are not supported.])
2339 AC_CACHE_CHECK([for flags to work around GCC bug 58416],
2340 [emacs_cv_gcc_bug_58416_CFLAGS],
2341 [emacs_cv_gcc_bug_58416_CFLAGS='none needed'
2342 AS_CASE([$canonical],
2343 [[i[3456]86-* | x86_64-*]],
2344 [AS_IF([test "$GCC" = yes],
2346 # If no flags are needed (e.g., not GCC 4+), don't use any.
2347 # Otherwise, use -mfpmath=sse if already assuming SSE2.
2348 # Otherwise, use -fno-tree-sra.
2349 for emacs_cv_gcc_bug_58416_CFLAGS in \
2350 'none needed' -mfpmath=sse -fno-tree-sra
2352 AS_CASE([$emacs_cv_gcc_bug_58416_CFLAGS],
2353 ['none needed'], [],
2354 [-fno-tree-sra], [break],
2355 [CFLAGS="$old_CFLAGS $emacs_cv_gcc_bug_58416_CFLAGS"])
2357 [AC_LANG_DEFINES_PROVIDED
2358 [/* Work around GCC bug with double in unions on x86,
2359 where the generated insns copy non-floating-point data
2360 via fldl/fstpl instruction pairs. This can misbehave
2361 the data's bit pattern looks like a NaN. See, e.g.:
2362 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58416#c10
2363 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71460
2364 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93271
2365 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114659
2366 Problem observed with 'gcc -m32' with GCC 14.1.1
2367 20240607 (Red Hat 14.1.1-5) on x86-64. */
2370 (4 <= __GNUC__ && __GNUC__ <= 14 && !defined __clang__ \
2371 && (defined __i386__ || defined __x86_64__) \
2372 && ! (0 <= FLT_EVAL_METHOD && FLT_EVAL_METHOD <= 1))
2373 # error "GCC bug 58416 is possibly present"
2378 CFLAGS=$old_CFLAGS])])])
2379 AS_CASE([$emacs_cv_gcc_bug_58416_CFLAGS],
2381 [C_SWITCH_MACHINE="$C_SWITCH_MACHINE $emacs_cv_gcc_bug_58416_CFLAGS"])
2383 AC_SUBST([C_SWITCH_MACHINE])
2386 ## Some programs in src produce warnings saying certain subprograms
2387 ## are too complex and need a MAXMEM value greater than 2000 for
2388 ## additional optimization. --nils@exp-math.uni-essen.de
2389 test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
2390 C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
2391 if test "$opsys" = "mingw32"; then
2392 case "$canonical" in
2393 x86_64-*-mingw*) C_SWITCH_SYSTEM="-mtune=generic" ;;
2394 *) C_SWITCH_SYSTEM="-mtune=pentium4" ;;
2397 ## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
2398 ## It is redundant in glibc2, since we define _GNU_SOURCE.
2399 AC_SUBST([C_SWITCH_SYSTEM])
2404 ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
2405 aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
2407 freebsd|dragonfly) LIBS_SYSTEM="-lutil" ;;
2409 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
2411 qnxnto) LIBS_SYSTEM="-lsocket" ;;
2413 solaris) LIBS_SYSTEM="-lsocket -lnsl" ;;
2415 ## Motif needs -lgen.
2416 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
2418 # Haiku needs -lbsd for cfsetspeed.
2419 haiku) LIBS_SYSTEM="-lnetwork -lbsd" ;;
2422 AC_SUBST([LIBS_SYSTEM])
2424 ### Make sure subsequent tests use flags consistent with the build flags.
2426 if test x"${OVERRIDE_CPPFLAGS}" != x; then
2427 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
2429 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
2432 # Suppress obsolescent Autoconf test for size_t; Emacs assumes C99 or better.
2433 AC_DEFUN([AC_TYPE_SIZE_T])
2434 # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
2435 AC_DEFUN([AC_TYPE_UID_T])
2436 ac_cv_type_gid_t=yes # AC_TYPE_GETGROUPS needs this in Autoconf 2.72.
2438 # Check for all math.h functions that Emacs uses; on some platforms,
2439 # -lm is needed for some of these functions.
2440 AC_CACHE_CHECK([for math library],
2441 [emacs_cv_lib_math],
2447 main (int argc, char **argv)
2458 d = copysign (d, d);
2481 return d == f && i == l;
2484 [emacs_cv_lib_math='none required'],
2487 [emacs_cv_lib_math=-lm],
2488 [AC_MSG_ERROR([Math library (-lm) not found])])])
2490 case $emacs_cv_lib_math in
2491 -*) LIB_MATH=$emacs_cv_lib_math;;
2495 dnl Current possibilities handled by sed (aix4-2 -> aix,
2496 dnl gnu-linux -> gnu/linux, etc.):
2497 dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux.
2498 dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
2499 SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
2506 ## Adding -lm confuses the dynamic linker, so omit it.
2509 freebsd | dragonfly )
2510 SYSTEM_TYPE=berkeley-unix
2512 gnu-linux | gnu-kfreebsd )
2514 hpux10-20 | hpux11 )
2518 SYSTEM_TYPE=windows-nt
2521 SYSTEM_TYPE=berkeley-unix
2524 solaris | unixware )
2525 SYSTEM_TYPE=usg-unix-v
2530 AC_SUBST([LIB_MATH])
2531 AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
2532 [The type of system you are compiling for; sets 'system-type'.])
2533 AC_SUBST([SYSTEM_TYPE])
2535 pre_PKG_CONFIG_CFLAGS=$CFLAGS
2536 pre_PKG_CONFIG_LIBS=$LIBS
2538 dnl pkg-config does not work when cross-compiling for Android.
2539 if test "${ANDROID}" != "yes"; then
2540 PKG_PROG_PKG_CONFIG([0.9.0])
2543 dnl EMACS_CHECK_MODULES([GSTUFF], [gtk+-2.0 >= 1.3 glib = 1.3.4])
2544 dnl acts like PKG_CHECK_MODULES([GSTUFF], [gtk+-2.0 >= 1.3 glib = 1.3.4],
2545 dnl [HAVE_GSTUFF=yes], [HAVE_GSTUFF=no]) -- see pkg-config man page --
2546 dnl except that it postprocesses CFLAGS as needed for --enable-gcc-warnings.
2547 dnl EMACS_CHECK_MODULES accepts optional 3rd and 4th arguments that
2548 dnl can take the place of the default HAVE_GSTUFF=yes and HAVE_GSTUFF=no
2550 AC_DEFUN([EMACS_CHECK_MODULES],
2551 [AS_IF([test -n "$ndk_INITIALIZED"],
2552 [ndk_CHECK_MODULES([$1], [$2], m4_default([$3], [HAVE_$1=yes]),
2553 m4_default([$4],[HAVE_$1=no]))],
2554 [PKG_CHECK_MODULES([$1], [$2],
2555 [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
2556 m4_default([$3], [HAVE_$1=yes])],
2557 [m4_default([$4], [HAVE_$1=no])])])])
2559 dnl EMACS_CHECK_LIB(NAME, FUNCTION, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND,
2560 dnl OTHER-LIBRARIES, INCLUDES)
2561 dnl ---------------------------------------------------------------------
2562 dnl This is like AC_CHECK_LIB; however, there is no default action, and
2563 dnl when cross-configuring for Android, AC_CHECK_DECLS is called with NAME
2564 dnl and INCLUDES instead, as the library being checked against will likely
2565 dnl be built together with Emacs.
2566 AC_DEFUN([EMACS_CHECK_LIB],
2567 [AS_IF([test -n "$ndk_INITIALIZED"],
2568 [AC_CHECK_DECL([$2], [$3], [$4], [$6])],
2569 [AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])])])
2572 if test "${with_sound}" != "no"; then
2573 # Sound support for GNU/Linux, the free BSDs, MinGW, and Cygwin.
2574 AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h mmsystem.h],
2575 [have_sound_header=yes], [], [
2577 #define WIN32_LEAN_AND_MEAN
2578 #include <windows.h>
2581 test "${with_sound}" = "oss" && test "${have_sound_header}" != "yes" && \
2582 AC_MSG_ERROR([OSS sound support requested but not found.])
2584 if test "${with_sound}" = "bsd-ossaudio" || test "${with_sound}" = "yes"; then
2585 # OSS emulation library used on NetBSD and OpenBSD.
2586 AC_CHECK_LIB([ossaudio], [_oss_ioctl], [LIBSOUND=-lossaudio], [LIBSOUND=])
2587 test "${with_sound}" = "bsd-ossaudio" && test -z "$LIBSOUND" && \
2588 AC_MSG_ERROR([bsd-ossaudio sound support requested but not found.])
2589 # On {Net,Open}BSD use the system audio library instead of
2590 # potentially switching to ALSA below, as ALSA on these appears to
2591 # just wrap system libraries.
2592 test "${with_sound}" = "yes" && test "$LIBSOUND" = "-lossaudio" && \
2593 with_sound="bsd-ossaudio"
2595 AC_SUBST([LIBSOUND])
2597 if test "${with_sound}" = "alsa" || test "${with_sound}" = "yes"; then
2599 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
2600 EMACS_CHECK_MODULES([ALSA], [$ALSA_MODULES])
2601 if test $HAVE_ALSA = yes; then
2602 LIBSOUND="$LIBSOUND $ALSA_LIBS"
2603 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
2604 AC_DEFINE([HAVE_ALSA], [1], [Define to 1 if ALSA is available.])
2605 elif test "${with_sound}" = "alsa"; then
2606 AC_MSG_ERROR([ALSA sound support requested but not found.])
2608 fi dnl with_sound = alsa|yes
2610 dnl Define HAVE_SOUND if we have sound support. We know it works and
2611 dnl compiles only on the specified platforms. For others, it
2612 dnl probably doesn't make sense to try.
2613 dnl FIXME So surely we should bypass this whole section if not using
2614 dnl one of these platforms?
2615 if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
2617 dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
2618 dnl Adjust the --with-sound help text if you change this.
2619 gnu-linux|freebsd|netbsd|mingw32|cygwin)
2620 AC_DEFINE([HAVE_SOUND], [1], [Define to 1 if you have sound support.])
2626 AC_SUBST([CFLAGS_SOUND])
2629 dnl checks for header files
2630 AC_CHECK_HEADERS_ONCE(
2637 sys/utsname.h pwd.h util.h
2638 sanitizer/lsan_interface.h
2639 sanitizer/asan_interface.h
2640 sanitizer/common_interface_defs.h])
2642 AC_CACHE_CHECK([for ADDR_NO_RANDOMIZE],
2643 [emacs_cv_personality_addr_no_randomize],
2645 [AC_LANG_PROGRAM([[#include <sys/personality.h>]],
2646 [[personality (personality (0xffffffff)
2647 | ADDR_NO_RANDOMIZE)]])],
2648 [emacs_cv_personality_addr_no_randomize=yes],
2649 [emacs_cv_personality_addr_no_randomize=no])])
2650 if test $emacs_cv_personality_addr_no_randomize = yes; then
2651 AC_DEFINE([HAVE_PERSONALITY_ADDR_NO_RANDOMIZE], [1],
2652 [Define to 1 if personality flag ADDR_NO_RANDOMIZE exists.])
2655 # Note that Solaris has sys/sysinfo.h which defines struct
2656 # sysinfo as well. To make sure that we're using GNU/Linux
2657 # sysinfo, we explicitly set one of its fields.
2658 if test "$ac_cv_header_sys_sysinfo_h" = yes; then
2659 AC_CACHE_CHECK([if Linux sysinfo may be used], [emacs_cv_linux_sysinfo],
2660 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sysinfo.h>]],
2661 [[struct sysinfo si;
2664 emacs_cv_linux_sysinfo=yes, emacs_cv_linux_sysinfo=no)])
2666 if test $emacs_cv_linux_sysinfo = yes; then
2667 AC_DEFINE([HAVE_LINUX_SYSINFO], [1],
2668 [Define to 1 if you have Linux sysinfo function.])
2669 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sysinfo.h>]],
2670 [[struct sysinfo si; return si.mem_unit]])],
2671 AC_DEFINE([LINUX_SYSINFO_UNIT], [1],
2672 [Define to 1 if Linux sysinfo sizes are in multiples of mem_unit bytes.]))
2676 dnl On Solaris 8 there's a compilation warning for term.h because
2677 dnl it doesn't define 'bool'.
2678 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <term.h>]],[[]])],
2679 [AC_DEFINE([HAVE_TERM_H], [1],
2680 [Define to 1 if you have the <term.h> header file.])])
2683 AC_CHECK_HEADERS_ONCE([sys/socket.h])
2684 AC_CHECK_HEADERS([net/if.h], [], [], [AC_INCLUDES_DEFAULT
2685 #if HAVE_SYS_SOCKET_H
2686 #include <sys/socket.h>
2688 AC_CHECK_HEADERS([ifaddrs.h], [], [], [AC_INCLUDES_DEFAULT
2689 #if HAVE_SYS_SOCKET_H
2690 #include <sys/socket.h>
2692 AC_CHECK_HEADERS([net/if_dl.h], [], [], [AC_INCLUDES_DEFAULT
2693 #if HAVE_SYS_SOCKET_H
2694 #include <sys/socket.h>
2697 dnl checks for structure members
2698 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
2699 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
2700 struct ifreq.ifr_addr,
2701 struct ifreq.ifr_addr.sa_len], [], [],
2702 [AC_INCLUDES_DEFAULT
2703 #if HAVE_SYS_SOCKET_H
2704 #include <sys/socket.h>
2710 dnl Check for endianness.
2711 dnl AC_C_BIGENDIAN is done by gnulib.
2713 dnl check for Make feature
2716 AUTODEPEND_PARENTS='lib src'
2717 dnl check if we have GCC and autodepend is on.
2718 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
2719 AC_CACHE_CHECK([whether gcc understands -MMD -MF], [emacs_cv_autodepend],
2720 [SAVE_CFLAGS="$CFLAGS"
2721 CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
2722 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
2723 [emacs_cv_autodepend=yes], [emacs_cv_autodepend=no])
2724 CFLAGS="$SAVE_CFLAGS"
2725 test -f deps.d || emacs_cv_autodepend=no
2727 if test $emacs_cv_autodepend = yes; then
2731 AC_SUBST([AUTO_DEPEND])
2733 #### Choose a window system.
2735 ## We leave window_system equal to none if
2736 ## we end up building without one. Any new window system should
2737 ## set window_system to an appropriate value and add objects to
2738 ## window-system-specific substs.
2744 # ANDROID_CFLAGS is a precious variable used to pass information to
2745 # the cross-compiler.
2746 ANDROID_BUILD_CFLAGS=
2750 AS_IF([test "$ANDROID" = "yes"],[
2751 window_system=android
2753 ANDROID_OBJ="androidterm.o androidfns.o androidfont.o androidmenu.o"
2754 ANDROID_OBJ="$ANDROID_OBJ android.o"
2758 AC_DEFINE([HAVE_ANDROID], [1], [Define to 1 if Emacs is being built
2759 with Android support])
2761 AS_IF([test "$XCONFIGURE" != "android"], [
2762 AC_DEFINE([ANDROID_STUBIFY], [1], [Define to 1 if Emacs is being built
2763 for Android, but all API calls need to be stubbed out])
2765 # Now set any shared user ID that was specified.
2766 AS_IF([test -n "$with_shared_user_id"],
2767 [emacs_val=$with_shared_user_id
2768 emacs_val=`AS_ECHO(["$with_shared_user_id"]) \
2769 | sed -e 's/"/\\"/'`
2770 emacs_val="\"$emacs_val\""
2771 ANDROID_SHARED_USER_ID="android:sharedUserId=$emacs_val"
2772 # `android:sharedUserName' is required for sharedUserID to work
2773 # on recent Android releases. It does not otherwise affect the
2774 # behavior of any code.
2775 emacs_val="\"@string/shared_user_name\""
2776 ANDROID_SHARED_USER_NAME="android:sharedUserLabel=$emacs_val"])],[
2777 # Emacs will be built as a shared library, and a wrapper around it
2778 # will also be built for the benefit of applications. This
2779 # requires Emacs be built as a position independent executable.
2780 ANDROID_BUILD_CFLAGS="-fPIC -fvisibility=hidden"
2782 # Graphics code in sfntfont-android.c benefits heavily from
2784 ANDROID_BUILD_CFLAGS="$ANDROID_BUILD_CFLAGS -ftree-vectorize"
2786 # Link with libraries required for Android support.
2787 # API 9 and later require `-landroid' for the asset manager.
2788 # API 8 uses an emulation via the JNI.
2789 AS_IF([test "$ANDROID_SDK" -lt "9"],
2790 [ANDROID_LIBS="-llog -ljnigraphics"],
2791 [ANDROID_LIBS="-landroid -llog -ljnigraphics"])
2793 # This is required to make the system load emacs.apk's libpng
2794 # (among others) instead of the system's own. But it doesn't work
2795 # on all Android versions yet, so for now just suffix shared
2796 # libraries with _emacs.
2797 # ANDROID_LDFLAGS="-Wl,-rpath,'\$\$ORIGIN'"
2799 # Link with the sfnt font library and sfntfont.o, along with
2800 # sfntfont-android.o.
2801 ANDROID_OBJ="$ANDROID_OBJ sfnt.o sfntfont.o sfntfont-android.o"
2803 # Build androidselect.o and androidvfs.o.
2804 ANDROID_OBJ="$ANDROID_OBJ androidselect.o androidvfs.o"
2806 # Check for some functions not always present in the NDK.
2807 AC_CHECK_DECLS([android_get_device_api_level])
2809 # Mention this build is really for Android.
2810 REALLY_ANDROID=yes])])
2813 AC_SUBST([ANDROID_OBJ])
2814 AC_SUBST([ANDROID_LIBS])
2815 AC_SUBST([ANDROID_LDFLAGS])
2816 AC_SUBST([ANDROID_BUILD_CFLAGS])
2817 AC_SUBST([ANDROID_SHARED_USER_ID])
2818 AC_SUBST([ANDROID_SHARED_USER_NAME])
2820 # Check for pw_gecos in struct passwd; this is known to be missing on
2823 AH_TEMPLATE([USER_FULL_NAME], [How to get a user's full name.])
2824 AC_CHECK_MEMBERS([struct passwd.pw_gecos], [], [], [#include <pwd.h>])
2825 AS_IF([test x"$REALLY_ANDROID" = "xyes"],
2826 [AC_DEFINE([USER_FULL_NAME], [android_user_full_name (pw)])],
2827 [AS_IF([test x"$ac_cv_member_struct_passwd_pw_gecos" = "xyes"],
2828 [AC_DEFINE([USER_FULL_NAME], [pw->pw_gecos])],
2829 [AC_DEFINE([USER_FULL_NAME], [NULL])])])
2831 if test "${with_pgtk}" = "yes"; then
2835 if test "${ANDROID}" != "yes"; then
2837 if test "$no_x" != yes && test "${with_pgtk}" != "yes"; then
2842 LD_SWITCH_X_SITE_RPATH=
2843 if test "${x_libraries}" != NONE; then
2844 if test -n "${x_libraries}"; then
2845 LD_SWITCH_X_SITE=-L`AS_ECHO(["$x_libraries"]) | sed -e 's/:/ -L/g'`
2846 LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`
2847 AS_ECHO(["$x_libraries"]) | sed -e 's/:/ -Wl,-rpath,/g'
2850 x_default_search_path=""
2851 x_search_path=${x_libraries}
2852 if test -z "${x_search_path}"; then
2853 x_search_path=/usr/lib
2855 for x_library in `AS_ECHO(["$x_search_path:"]) | \
2856 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
2858 ${x_library}/X11/%L/%T/%N%C%S:\
2859 ${x_library}/X11/%l/%T/%N%C%S:\
2860 ${x_library}/X11/%T/%N%C%S:\
2861 ${x_library}/X11/%L/%T/%N%S:\
2862 ${x_library}/X11/%l/%T/%N%S:\
2863 ${x_library}/X11/%T/%N%S"
2864 if test x"${x_default_search_path}" = x; then
2865 x_default_search_path=${x_search_path}
2867 x_default_search_path="${x_search_path}:${x_default_search_path}"
2871 AC_SUBST([LD_SWITCH_X_SITE_RPATH])
2873 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
2874 C_SWITCH_X_SITE=$isystem`AS_ECHO(["$x_includes"]) | sed -e "s/:/ $isystem/g"`
2877 if test x"${x_includes}" = x; then
2878 bitmapdir=/usr/include/X11/bitmaps
2880 # accumulate include directories that have X11 bitmap subdirectories
2882 for bmd in `AS_ECHO(["$x_includes"]) | sed -e 's/:/ /g'`; do
2883 if test -d "${bmd}/X11/bitmaps"; then
2884 bmd_acc="${bmd_acc+$bmd_acc:}${bmd}/X11/bitmaps"
2886 if test -d "${bmd}/bitmaps"; then
2887 bmd_acc="${bmd_acc+$bmd_acc:}${bmd}/bitmaps"
2895 test "${with_ns}" = maybe && test "${opsys}" != darwin && with_ns=no
2897 NS_GNUSTEP_CONFIG=no
2900 tmp_CPPFLAGS="$CPPFLAGS"
2901 tmp_CFLAGS="$CFLAGS"
2902 CPPFLAGS="$CPPFLAGS -x objective-c"
2903 CFLAGS="$CFLAGS -x objective-c"
2906 if test "${with_ns}" != no; then
2907 # macfont.o requires macuvs.h which is absent after 'make extraclean',
2908 # so avoid NS_IMPL_COCOA if macuvs.h is absent.
2909 # Even a headless Emacs can build macuvs.h, so this should let you bootstrap.
2910 if test "${opsys}" = darwin && test -f "$srcdir/src/macuvs.h"; then
2912 ns_appdir=`pwd`/nextstep/Emacs.app
2913 ns_appbindir=${ns_appdir}/Contents/MacOS
2914 ns_applibexecdir=${ns_appdir}/Contents/MacOS/libexec
2915 ns_applibdir=${ns_appdir}/Contents/Frameworks
2916 ns_appresdir=${ns_appdir}/Contents/Resources
2917 ns_appsrc=Cocoa/Emacs.base
2918 ns_fontfile=macfont.o
2919 elif flags=`(gnustep-config --objc-flags) 2>/dev/null`; then
2921 NS_GNUSTEP_CONFIG=yes
2922 GNU_OBJC_CFLAGS="$flags"
2923 LIBS_GNUSTEP=`gnustep-config --gui-libs || exit`
2924 elif test -f $GNUSTEP_CONFIG_FILE; then
2926 dnl FIXME sourcing this several times in subshells seems inefficient.
2927 GNUSTEP_SYSTEM_HEADERS=`. $GNUSTEP_CONFIG_FILE \
2928 && AS_ECHO(["$GNUSTEP_SYSTEM_HEADERS"])`
2929 GNUSTEP_SYSTEM_LIBRARIES=` . $GNUSTEP_CONFIG_FILE \
2930 && AS_ECHO(["$GNUSTEP_SYSTEM_LIBRARIES"])`
2931 dnl I seemed to need these as well with GNUstep-startup 0.25.
2932 GNUSTEP_LOCAL_HEADERS=`. $GNUSTEP_CONFIG_FILE \
2933 && AS_ECHO(["$GNUSTEP_LOCAL_HEADERS"])`
2934 GNUSTEP_LOCAL_LIBRARIES=`. $GNUSTEP_CONFIG_FILE \
2935 && AS_ECHO(["$GNUSTEP_LOCAL_LIBRARIES"])`
2936 test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
2937 GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
2938 test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
2939 GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
2940 CPPFLAGS="$CPPFLAGS -isystem ${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
2941 CFLAGS="$CFLAGS -isystem ${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
2942 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
2943 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
2944 dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
2945 dnl If they had chosen to either define it or not, we could have
2946 dnl just used AC_CHECK_DECL here.
2947 AC_CACHE_CHECK([if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS],
2948 [emacs_cv_objc_exceptions],
2950 [AC_LANG_PROGRAM([[#include <GNUstepBase/GSConfig.h>]],
2951 [[#if defined BASE_NATIVE_OBJC_EXCEPTIONS && BASE_NATIVE_OBJC_EXCEPTIONS > 0
2956 [emacs_cv_objc_exceptions=yes],
2957 [emacs_cv_objc_exceptions=no])])
2958 if test $emacs_cv_objc_exceptions = yes; then
2959 dnl _NATIVE_OBJC_EXCEPTIONS is used by the GNUstep headers.
2960 AC_DEFINE([_NATIVE_OBJC_EXCEPTIONS], [1],
2961 [Define if GNUstep uses ObjC exceptions.])
2962 GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fobjc-exceptions"
2965 if test $NS_IMPL_GNUSTEP = yes; then
2966 ns_appdir=`pwd`/nextstep/Emacs.app
2967 ns_appbindir=${ns_appdir}
2968 ns_applibexecdir=${ns_appdir}/libexec
2969 ns_applibdir=${ns_appdir}/Frameworks
2970 ns_appresdir=${ns_appdir}/Resources
2971 ns_appsrc=GNUstep/Emacs.base
2972 ns_fontfile=nsfont.o
2975 dnl This is only used while we test the NS headers, it gets reset below.
2976 CPPFLAGS="$CPPFLAGS $GNU_OBJC_CFLAGS"
2977 CFLAGS="$CFLAGS $GNU_OBJC_CFLAGS"
2979 AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
2980 [AC_MSG_ERROR([The include files (AppKit/AppKit.h etc) that
2981 are required for a Nextstep build are missing or cannot be compiled.
2982 Either fix this, or re-configure with the option '--without-ns'.])])
2985 if test "${NS_IMPL_COCOA}" = "yes"; then
2986 AC_MSG_CHECKING([for Mac OS X 10.6 or newer])
2987 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>],
2989 #ifdef MAC_OS_X_VERSION_MAX_ALLOWED
2990 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
2993 error "Mac OS X 10.6 or newer required";
2997 [ns_osx_have_106=yes],
2998 [ns_osx_have_106=no])
2999 AC_MSG_RESULT([$ns_osx_have_106])
3001 if test $ns_osx_have_106 = no; then
3002 AC_MSG_ERROR([Mac OS X 10.6 or newer is required]);
3006 AC_CACHE_CHECK([for Mac OS X 12.0 or later],
3007 [emacs_cv_macosx_12_0],
3008 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3009 #include <AvailabilityMacros.h>
3010 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
3011 Mac OS X 12.x or later.
3013 ]])], [emacs_cv_macosx_12_0=no],
3014 [emacs_cv_macosx_12_0=yes]))
3016 if test "${with_native_image_api}" = yes; then
3017 AC_DEFINE([HAVE_NATIVE_IMAGE_API], [1],
3018 [Define to use native OS APIs for images.])
3019 NATIVE_IMAGE_API="yes (ns)"
3023 AC_SUBST([LIBS_GNUSTEP])
3025 INSTALL_ARCH_INDEP_EXTRA=install-etc
3026 ns_self_contained=no
3029 if test "${HAVE_NS}" = yes; then
3030 if test "$with_toolkit_scroll_bars" = "no"; then
3031 AC_MSG_WARN([Non-toolkit scroll bars are not implemented for Nextstep.])
3034 window_system=nextstep
3035 # set up packaging dirs
3036 if test "${EN_NS_SELF_CONTAINED}" = yes; then
3037 AC_DEFINE([NS_SELF_CONTAINED], [1], [Build an NS bundled app])
3038 ns_self_contained=yes
3039 prefix=${ns_appresdir}
3040 exec_prefix=${ns_appbindir}
3041 dnl This one isn't really used, only archlibdir is.
3042 libexecdir="\${ns_applibexecdir}"
3043 archlibdir="\${ns_applibexecdir}"
3044 etcdocdir="\${ns_appresdir}/etc"
3045 etcdir="\${ns_appresdir}/etc"
3046 dnl FIXME maybe set datarootdir instead.
3047 dnl That would also get applications, icons, man.
3048 infodir="\${ns_appresdir}/info"
3049 mandir="\${ns_appresdir}/man"
3050 lispdir="\${ns_appresdir}/lisp"
3051 lispdirrel="\${ns_appresdir}/lisp"
3052 test "$locallisppathset" = no && locallisppath="\${ns_appresdir}/site-lisp"
3053 INSTALL_ARCH_INDEP_EXTRA=
3056 NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o $ns_fontfile"
3058 CFLAGS="$tmp_CFLAGS"
3059 CPPFLAGS="$tmp_CPPFLAGS"
3060 AC_SUBST([INSTALL_ARCH_INDEP_EXTRA])
3061 AC_SUBST([ns_self_contained])
3063 AC_SUBST([NS_OBJC_OBJ])
3065 if test "${HAVE_NS}" = yes; then
3066 AC_LANG_PUSH([Objective C])
3068 [if the Objective C compiler supports instancetype],
3069 [emacs_cv_objc_instancetype],
3071 [AC_LANG_SOURCE([[@interface Test
3072 + (instancetype)test;
3074 [emacs_cv_objc_instancetype=yes],
3075 [emacs_cv_objc_instancetype=no])])
3077 if test x$emacs_cv_objc_instancetype = xyes ; then
3078 AC_DEFINE([NATIVE_OBJC_INSTANCETYPE], [1],
3079 [Define if ObjC compiler supports instancetype natively.])
3083 [if the Objective C compiler defaults to C99],
3084 [emacs_cv_objc_c99],
3086 [AC_LANG_PROGRAM([], [[for (int i = 0;;);]])],
3087 [emacs_cv_objc_c99=yes],
3088 [emacs_cv_objc_c99=no])])
3090 if test x$emacs_cv_objc_c99 = xno ; then
3091 GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -std=c99"
3093 AC_LANG_POP([Objective C])
3097 if test "${opsys}" = "haiku" && test "${with_be_app}" = "yes"; then
3098 dnl Only GCC is supported. Clang might work, but it's
3099 dnl not reliable, so don't check for it here.
3100 AC_PROG_CXX([gcc g++])
3101 CXXFLAGS="$CXXFLAGS $emacs_g3_CFLAGS"
3103 AC_CHECK_HEADER([app/Application.h], [HAVE_BE_APP=yes],
3104 [AC_MSG_ERROR([The Application Kit headers required for building
3105 with the Application Kit were not found or cannot be compiled. Either fix this, or
3106 re-configure with the option '--without-be-app'.])])
3110 AC_SUBST([HAVE_BE_APP])
3120 if test "${with_w32}" != no; then
3123 AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
3124 [AC_MSG_ERROR(['--with-w32' was specified, but windows.h
3125 cannot be found.])])
3128 ## Using --with-w32 with MinGW is a no-op, but we allow it.
3131 AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin and MinGW32.])
3136 if test "${opsys}" = "mingw32"; then
3137 AC_CACHE_CHECK([whether Windows API headers are recent enough], [emacs_cv_w32api],
3138 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3139 #include <windows.h>
3140 #include <usp10.h>]],
3141 [[PIMAGE_NT_HEADERS pHeader;
3142 PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader)]])],
3143 [emacs_cv_w32api=yes], [emacs_cv_w32api=no])])
3144 if test "${emacs_cv_w32api}" = "no"; then
3145 AC_MSG_ERROR([the Windows API headers are too old to support this build.])
3147 HAVE_W32=${emacs_cv_w32api}
3156 if test "${HAVE_W32}" = "yes"; then
3157 AC_DEFINE([HAVE_NTGUI], [1], [Define to use native MS Windows GUI.])
3158 if test "$with_toolkit_scroll_bars" = "no"; then
3159 AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for w32 build.])
3161 AC_CHECK_TOOL([WINDRES], [windres],
3162 [AC_MSG_ERROR([No resource compiler found.])])
3163 W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
3164 W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o w32cygwinx.o"
3165 EMACSRES="emacs.res"
3166 case "$canonical" in
3167 x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;;
3168 *) EMACS_MANIFEST="emacs-x86.manifest" ;;
3170 dnl Construct something of the form "24,4,0,0" with 4 components.
3171 comma_version=`echo "${PACKAGE_VERSION}.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'`
3173 comma_space_version=`echo "$comma_version" | sed 's/,/, /g'`
3174 AC_SUBST([comma_version])
3175 AC_SUBST([comma_space_version])
3176 AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc])
3177 if test "${opsys}" = "cygwin"; then
3178 W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lusp10 -lgdi32"
3179 W32_LIBS="$W32_LIBS -lole32 -lcomdlg32 -lcomctl32 -lwinspool"
3180 # Tell the linker that emacs.res is an object (which we compile from
3181 # the rc file), not a linker script.
3182 W32_RES_LINK="-Wl,emacs.res"
3184 W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
3185 dnl FIXME: This should probably be supported for Cygwin/w32 as
3186 dnl well, but the Cygwin build needs to link against -lgdiplus
3187 if test "${with_native_image_api}" = yes; then
3188 AC_DEFINE([HAVE_NATIVE_IMAGE_API], [1],
3189 [Define to use native OS APIs for images.])
3190 NATIVE_IMAGE_API="yes (w32)"
3191 W32_OBJ="$W32_OBJ w32image.o"
3193 W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32"
3194 W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32"
3195 W32_RES_LINK="\$(EMACSRES)"
3196 CLIENTRES="emacsclient.res"
3197 CLIENTW="emacsclientw\$(EXEEXT)"
3198 FIRSTFILE_OBJ=firstfile.o
3201 LIBS_ECLIENT="-lcomctl32"
3202 LIB_WSOCK32="-lwsock32"
3203 NTLIB="ntlib.$ac_objext"
3204 XARGS_LIMIT="-s 10000"
3208 if test "${HAVE_W32}" = "no" && test "${opsys}" = "cygwin"; then
3209 W32_LIBS="-lkernel32"
3210 W32_OBJ="w32cygwinx.o"
3214 AC_SUBST([W32_LIBS])
3215 AC_SUBST([EMACSRES])
3216 AC_SUBST([EMACS_MANIFEST])
3217 AC_SUBST([CLIENTRES])
3219 AC_SUBST([W32_RES_LINK])
3220 AC_SUBST([FIRSTFILE_OBJ])
3223 AC_SUBST([LIBS_ECLIENT])
3224 AC_SUBST([LIB_WSOCK32])
3226 AC_SUBST([XARGS_LIMIT])
3228 if test "${HAVE_W32}" = "yes"; then
3238 if test "$opsys" = "haiku"; then
3239 HAIKU_OBJ="$HAIKU_OBJ haiku.o"
3242 if test "${HAVE_BE_APP}" = "yes"; then
3243 AC_DEFINE([HAVE_HAIKU], [1],
3244 [Define if Emacs will be built with Haiku windowing support])
3247 if test "${HAVE_BE_APP}" = "yes"; then
3250 HAIKU_OBJ="$HAIKU_OBJ haikufns.o haikuterm.o haikumenu.o haikufont.o haikuselect.o haiku_io.o"
3251 HAIKU_CXX_OBJ="haiku_support.o haiku_font_support.o haiku_draw_support.o haiku_select.o"
3252 HAIKU_LIBS="-lbe -lgame -ltranslation -ltracker" # -lgame is needed for set_mouse_position.
3254 if test "${with_native_image_api}" = yes; then
3255 AC_DEFINE([HAVE_NATIVE_IMAGE_API], [1],
3256 [Define to use native OS APIs for images.])
3257 NATIVE_IMAGE_API="yes (haiku)"
3258 HAIKU_OBJ="$HAIKU_OBJ haikuimage.o"
3262 AC_SUBST([HAIKU_LIBS])
3263 AC_SUBST([HAIKU_OBJ])
3264 AC_SUBST([HAIKU_CXX_OBJ])
3265 AC_SUBST([HAIKU_CFLAGS])
3267 ## $window_system is now set to the window system we will
3276 case "${window_system}" in
3281 case "${with_x_toolkit}" in
3282 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
3283 motif ) USE_X_TOOLKIT=MOTIF ;;
3285 term_header=gtkutil.h
3286 dnl Don't set this for GTK. A lot of tests below assumes Xt when
3287 dnl USE_X_TOOLKIT is set.
3288 USE_X_TOOLKIT=none ;;
3289 gtk2 ) with_gtk2=yes
3290 term_header=gtkutil.h
3291 USE_X_TOOLKIT=none ;;
3292 gtk3 ) with_gtk3=yes
3293 term_header=gtkutil.h
3294 USE_X_TOOLKIT=none ;;
3295 no ) USE_X_TOOLKIT=none ;;
3296 dnl If user did not say whether to use a toolkit, make this decision later:
3297 dnl use the toolkit if we have gtk, or X11R5 or newer.
3298 * ) USE_X_TOOLKIT=maybe ;;
3302 term_header=nsterm.h
3305 term_header=w32term.h
3308 term_header=pgtkterm.h
3312 AC_DEFINE([HAVE_PGTK], [1], [Define to 1 if you have pure Gtk+-3.])
3315 term_header=haikuterm.h
3318 term_header=androidterm.h
3322 AC_SUBST([HAVE_PGTK])
3324 if test "$window_system" = none && test "X$with_x" != "Xno"; then
3325 AC_CHECK_PROG([HAVE_XSERVER], [X], [true], [false])
3326 if test "$HAVE_XSERVER" = true ||
3327 test -n "$DISPLAY" ||
3329 for emacs_libX11 in /usr/lib/libX11.*; do break; done
3330 test "$emacs_libX11" != '/usr/lib/libX11.*'
3333 AC_MSG_ERROR([You seem to be running X, but no X development libraries
3334 were found. You should install the relevant development files for X
3335 and for the toolkit you want, such as Gtk+ or Motif. Also make
3336 sure you have development files for image handling, i.e.
3337 tiff, gif, jpeg, png and xpm.
3338 If you are sure you want Emacs compiled without X window support, pass
3344 # Does the opsystem file prohibit the use of the GNU malloc?
3345 # Assume not, until told otherwise.
3349 [whether malloc is Doug Lea style],
3350 [emacs_cv_var_doug_lea_malloc],
3351 [emacs_cv_var_doug_lea_malloc=no
3352 dnl Hooks do not work with address sanitization.
3353 if test "$emacs_cv_sanitize_address" != yes; then
3356 [[#include <malloc.h>
3357 static void hook (void) {}]],
3358 [[malloc_set_state (malloc_get_state ());
3359 __after_morecore_hook = hook;
3360 __malloc_initialize_hook = hook;]])],
3361 [emacs_cv_var_doug_lea_malloc=yes])
3363 doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
3368 dnl This must be before the test of $ac_cv_func_sbrk below.
3369 AC_CHECK_FUNCS_ONCE([sbrk])
3371 test $with_unexec = yes &&
3373 ## darwin ld insists on the use of malloc routines in the System framework.
3374 darwin | mingw32 | nacl | solaris) ;;
3375 cygwin | qnxnto | freebsd)
3378 *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
3381 if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \
3382 && test "${UNEXEC_OBJ}" = unexelf.o; then
3388 if test "${system_malloc}" = "yes"; then
3389 AC_DEFINE([SYSTEM_MALLOC], [1],
3390 [Define to 1 to use the system memory allocator, even if it is not
3394 (The GNU allocators don't work with this system configuration.)"
3396 elif test "$hybrid_malloc" = yes; then
3397 AC_DEFINE([HYBRID_MALLOC], [1],
3398 [Define to use gmalloc before dumping and the system malloc after.])
3401 GNU_MALLOC_reason=" (only before dumping)"
3402 GMALLOC_OBJ=gmalloc.o
3405 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
3406 VMLIMIT_OBJ=vm-limit.o
3408 AC_CHECK_HEADERS([sys/vlimit.h])
3409 AC_CACHE_CHECK([for data_start], [emacs_cv_data_start],
3412 [[extern char data_start[]; char ch;]],
3413 [[return data_start < &ch;]])],
3414 [emacs_cv_data_start=yes],
3415 [emacs_cv_data_start=no])])
3416 if test $emacs_cv_data_start = yes; then
3417 AC_DEFINE([HAVE_DATA_START], [1],
3418 [Define to 1 if data_start is the address of the start
3419 of the main data segment.])
3422 AC_SUBST([HYBRID_MALLOC])
3423 AC_SUBST([GMALLOC_OBJ])
3424 AC_SUBST([VMLIMIT_OBJ])
3426 if test "$doug_lea_malloc" = "yes" && test "$hybrid_malloc" != yes; then
3427 if test "$GNU_MALLOC" = yes ; then
3429 (Using Doug Lea's new malloc from the GNU C Library.)"
3431 AC_DEFINE([DOUG_LEA_MALLOC], [1],
3432 [Define to 1 if the system memory allocator is Doug Lea style,
3433 with malloc hooks and malloc_set_state.])
3435 ## Use mmap directly for allocating larger buffers.
3436 ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
3437 ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
3438 ## Does the AC_FUNC_MMAP test below make this check unnecessary?
3440 mingw32|gnu*) REL_ALLOC=no ;;
3444 if test x"${REL_ALLOC}" = x; then
3445 REL_ALLOC=${GNU_MALLOC}
3448 use_mmap_for_buffers=no
3450 mingw32) use_mmap_for_buffers=yes ;;
3454 if test $use_mmap_for_buffers = yes; then
3455 AC_DEFINE([USE_MMAP_FOR_BUFFERS], [1],
3456 [Define to use mmap to allocate buffer text.])
3460 LIBS="$LIBS_SYSTEM $LIBS"
3462 dnl FIXME replace main with a function we actually want from this library.
3463 AC_CHECK_LIB([Xbsd], [main], [LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd"])
3465 dnl Check for the POSIX thread library.
3467 AC_CHECK_HEADERS_ONCE([pthread.h])
3468 if test "$ac_cv_header_pthread_h" && test "$opsys" != "mingw32"; then
3469 AC_CACHE_CHECK([for pthread library],
3470 [emacs_cv_pthread_lib],
3471 [emacs_cv_pthread_lib=no
3473 for emacs_pthread_lib in 'none needed' -lpthread; do
3474 case $emacs_pthread_lib in
3475 -*) LIBS="$OLD_LIBS $emacs_pthread_lib";;
3479 [[#include <pthread.h>
3481 sigset_t old_mask, new_mask;
3482 void noop (void) {}]],
3483 [[pthread_t th = pthread_self ();
3485 status += pthread_create (&th, 0, 0, 0);
3486 status += pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask);
3487 status += pthread_kill (th, 0);
3488 #if ! (defined SYSTEM_MALLOC || defined HYBRID_MALLOC \
3489 || defined DOUG_LEA_MALLOC)
3490 /* Test for pthread_atfork only if gmalloc uses it,
3491 as older-style hosts like MirBSD 10 lack it. */
3492 status += pthread_atfork (noop, noop, noop);
3495 [emacs_cv_pthread_lib=$emacs_pthread_lib])
3497 if test "$emacs_cv_pthread_lib" != no; then
3501 if test "$emacs_cv_pthread_lib" != no; then
3502 AC_DEFINE([HAVE_PTHREAD], [1], [Define to 1 if you have POSIX threads.])
3503 case $emacs_cv_pthread_lib in
3504 -*) LIB_PTHREAD=$emacs_cv_pthread_lib;;
3506 ac_cv_func_pthread_sigmask=yes
3507 # Some systems optimize for single-threaded programs by default, and
3508 # need special flags to disable these optimizations. For example, the
3509 # definition of 'errno' in <errno.h>.
3512 AC_DEFINE([_REENTRANT], [1],
3513 [Define to 1 if your system requires this in multithreaded code.]);;
3515 AC_DEFINE([_THREAD_SAFE], [1],
3516 [Define to 1 if your system requires this in multithreaded code.]);;
3520 AC_SUBST([LIB_PTHREAD])
3522 AC_MSG_CHECKING([for thread support])
3524 if test "$with_threads" = yes; then
3525 if test "$emacs_cv_pthread_lib" != no; then
3526 AC_DEFINE([THREADS_ENABLED], [1],
3527 [Define to 1 if you want elisp thread support.])
3529 elif test "${opsys}" = "mingw32"; then
3530 dnl MinGW can do native Windows threads even without pthreads
3531 AC_DEFINE([THREADS_ENABLED], [1],
3532 [Define to 1 if you want elisp thread support.])
3536 AC_MSG_RESULT([$threads_enabled])
3538 dnl Check for need for bigtoc support on IBM AIX
3542 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
3544 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
3545 *) gdb_cv_bigtoc=-bbigtoc ;;
3548 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
3549 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], [], [gdb_cv_bigtoc=])
3554 # Change CFLAGS, CPPFLAGS, and LIBS temporarily so that C_SWITCH_X_SITE
3555 # is for the tests that follow. We set them back later on.
3557 REAL_CFLAGS="$CFLAGS"
3558 REAL_CPPFLAGS="$CPPFLAGS"
3561 if test "${HAVE_X11}" = "yes"; then
3562 DEFS="$C_SWITCH_X_SITE $DEFS"
3563 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
3565 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
3566 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
3568 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
3569 # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
3570 # but it's more convenient here to set LD_RUN_PATH since this
3571 # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
3572 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
3573 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
3577 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
3578 # header files included from there.
3579 AC_CACHE_CHECK([for Xkb], [emacs_cv_xkb],
3580 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
3581 #include <X11/XKBlib.h>]],
3582 [[XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);]])],
3584 [emacs_cv_xkb=no])])
3585 if test $emacs_cv_xkb = yes; then
3586 AC_DEFINE([HAVE_XKB], [1], [Define to 1 if you have the Xkb extension.])
3587 AC_CHECK_FUNCS([XkbRefreshKeyboardMapping XkbFreeNames])
3590 AC_CHECK_FUNCS([XrmSetDatabase XScreenResourceString XScreenNumberOfScreen])
3591 AC_CHECK_FUNCS([XDisplayCells XDestroySubwindows])
3594 if test "${window_system}" = "x11"; then
3595 AC_MSG_CHECKING([X11 version 6])
3596 AC_CACHE_VAL([emacs_cv_x11_version_6],
3597 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
3598 [[#if XlibSpecificationRelease < 6
3601 ]])], [emacs_cv_x11_version_6=yes],
3602 [emacs_cv_x11_version_6=no])])
3603 if test $emacs_cv_x11_version_6 = yes; then
3604 AC_MSG_RESULT([6 or newer])
3605 AC_DEFINE([HAVE_X11R6], [1],
3606 [Define to 1 if you have the X11R6 or newer version of Xlib.])
3607 AC_DEFINE([HAVE_X_I18N], [1], [Define if you have usable i18n support.])
3608 AC_CHECK_MEMBERS([XICCallback.callback], [], [], [#include <X11/Xlib.h>])
3609 ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
3613 *) AC_DEFINE([HAVE_X11R6_XIM], [1],
3614 [Define if you have usable X11R6-style XIM support.])
3618 AC_MSG_RESULT([before 6])
3622 ### Use -lrsvg-2 if available, unless '--with-rsvg=no' is specified.
3624 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" \
3625 || test "${opsys}" = "mingw32" || test "${HAVE_BE_APP}" = "yes" \
3626 || test "${window_system}" = "pgtk" \
3627 || test "${REALLY_ANDROID}" = "yes"; then
3628 if test "${with_rsvg}" != "no"; then
3629 RSVG_REQUIRED=2.14.0
3630 AS_IF([test "${REALLY_ANDROID}" = "yes"],
3631 [RSVG_MODULE="librsvg"],
3632 [RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"])
3634 EMACS_CHECK_MODULES([RSVG], [$RSVG_MODULE])
3635 AC_SUBST([RSVG_CFLAGS])
3636 AC_SUBST([RSVG_LIBS])
3638 if test $HAVE_RSVG = yes; then
3639 AC_DEFINE([HAVE_RSVG], [1], [Define to 1 if using librsvg.])
3640 CFLAGS="$CFLAGS $RSVG_CFLAGS"
3641 # Windows loads librsvg dynamically
3642 if test "${opsys}" = "mingw32"; then
3649 ### Use -lwebp if available, unless '--with-webp=no'
3651 if test "${with_webp}" != "no"; then
3652 if test "${HAVE_X11}" = "yes" || test "${opsys}" = "mingw32" \
3653 || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes" \
3654 || test "${HAVE_BE_APP}" = "yes" || test "${HAVE_PGTK}" = "yes" \
3655 || test "${REALLY_ANDROID}" = "yes"; then
3657 WEBP_MODULE="libwebpdemux >= $WEBP_REQUIRED"
3659 EMACS_CHECK_MODULES([WEBP], [$WEBP_MODULE])
3661 # WebPGetInfo is sometimes not present inside libwebpdemux, so
3662 # if it does not link, also check for libwebpdecoder.
3666 CFLAGS="$CFLAGS $WEBP_CFLAGS"
3667 LIBS="$LIBS $WEBP_LIBS"
3669 AS_IF([test "$REALLY_ANDROID" != "yes"], [
3670 AC_CHECK_FUNC([WebPGetInfo], [],
3671 [WEBP_MODULE="$WEBP_MODULE libwebpdecoder >= $WEBP_REQUIRED"
3673 AS_UNSET([WEBP_LIBS])
3674 AS_UNSET([WEBP_CFLAGS])
3675 EMACS_CHECK_MODULES([WEBP], [$WEBP_MODULE])])])
3680 AC_SUBST([WEBP_CFLAGS])
3681 AC_SUBST([WEBP_LIBS])
3683 if test $HAVE_WEBP = yes; then
3684 AC_DEFINE([HAVE_WEBP], [1], [Define to 1 if using libwebp.])
3685 # Windows loads libwebp dynamically
3686 if test "${opsys}" = "mingw32"; then
3692 ### Use -lsqlite3 if available, unless '--with-sqlite3=no'
3696 if test "${with_sqlite3}" != "no"; then
3697 if test "${REALLY_ANDROID}" = "yes"; then
3698 ndk_SEARCH_MODULE([sqlite3], [SQLITE3], [HAVE_SQLITE3=yes])
3700 if test "$HAVE_SQLITE3" = "yes"; then
3701 SAVE_CFLAGS="$CFLAGS"
3702 CFLAGS="$CFLAGS $SQLITE3_CFLAGS"
3703 AC_CHECK_DECL([sqlite3_open_v2], [HAVE_SQLITE=yes],
3704 [HAVE_SQLITE3=no], [#include <sqlite3.h>])
3705 CFLAGS="$SAVE_CFLAGS"
3708 AC_CHECK_LIB([sqlite3], [sqlite3_open_v2],
3711 if test "$HAVE_SQLITE3" = "yes"; then
3712 SQLITE3_LIBS=-lsqlite3
3713 LIBS="$SQLITE3_LIBS $LIBS"
3714 # Windows loads libsqlite dynamically
3715 if test "${opsys}" = "mingw32"; then
3718 AC_CHECK_LIB([sqlite3], [sqlite3_load_extension],
3719 [HAVE_SQLITE3_LOAD_EXTENSION=yes],
3720 [HAVE_SQLITE3_LOAD_EXTENSION=no])
3721 if test "$HAVE_SQLITE3_LOAD_EXTENSION" = "yes"; then
3722 AC_DEFINE([HAVE_SQLITE3_LOAD_EXTENSION], [1],
3723 [Define to 1 if sqlite3 supports loading extensions.])
3728 if test "$HAVE_SQLITE3" = "yes"; then
3729 AC_DEFINE([HAVE_SQLITE3], [1],
3730 [Define to 1 if you have the libsqlite3 library (-lsqlite).])
3734 AC_SUBST([SQLITE3_LIBS])
3735 AC_SUBST([SQLITE3_CFLAGS])
3738 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes" || \
3739 test "${HAVE_BE_APP}" = "yes" || test "${window_system}" = "pgtk" || \
3740 test "${REALLY_ANDROID}" = "yes"; then
3741 if test "${with_imagemagick}" != "no"; then
3742 if test -n "$BREW"; then
3743 # Homebrew doesn't link ImageMagick 6 by default, so make sure
3744 # pkgconfig can find it.
3745 export PKG_CONFIG_PATH="$PKG_CONFIG_PATH$PATH_SEPARATOR`$BREW --prefix imagemagick@6 2>/dev/null`/lib/pkgconfig"
3748 EMACS_CHECK_MODULES([IMAGEMAGICK], [MagickWand >= 7])
3749 if test $HAVE_IMAGEMAGICK = yes; then
3750 AC_DEFINE([HAVE_IMAGEMAGICK7], [1],
3751 [Define to 1 if using ImageMagick7.])
3753 ## 6.3.5 is the earliest version known to work; see Bug#17339.
3754 ## 6.8.2 makes Emacs crash; see Bug#13867.
3755 EMACS_CHECK_MODULES([IMAGEMAGICK], [Wand >= 6.3.5 Wand != 6.8.2])
3758 if test $HAVE_IMAGEMAGICK = yes; then
3761 CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
3762 LIBS="$IMAGEMAGICK_LIBS $LIBS"
3763 if test "$REALLY_ANDROID" != "yes"; then
3764 AC_CHECK_FUNCS([MagickRelinquishMemory MagickExportImagePixels \
3765 MagickMergeImageLayers MagickAutoOrientImage])
3767 # AC_CHECK_FUNCS doesn't work for Android dependencies because
3768 # they are built alongside Emacs.
3769 AC_CHECK_DECLS([MagickRelinquishMemory,MagickExportImagePixels,
3770 MagickMergeImageLayers,MagickAutoOrientImage],
3771 [], [], [#include <MagickWand/MagickWand.h>])
3775 # Check that ImageMagick links. It does not link on Fedora 25
3776 # with './configure CC=clang', as pkg-config outputs flags like
3777 # -lomp that work for GCC but not Clang.
3778 if test "$ac_cv_func_MagickRelinquishMemory" != yes \
3779 && test "$REALLY_ANDROID" != "yes"; then
3783 if test $HAVE_IMAGEMAGICK = yes; then
3784 AC_DEFINE([HAVE_IMAGEMAGICK], [1], [Define to 1 if using ImageMagick.])
3786 if test "${with_imagemagick}" != "no"; then
3787 AC_MSG_ERROR([ImageMagick wanted, but it does not compile. Maybe some library files are missing?]);
3792 AC_SUBST([IMAGEMAGICK_CFLAGS])
3793 AC_SUBST([IMAGEMAGICK_LIBS])
3797 AC_CHECK_LIB([anl], [getaddrinfo_a], [HAVE_GETADDRINFO_A=yes])
3798 if test "${HAVE_GETADDRINFO_A}" = "yes"; then
3799 AC_DEFINE([HAVE_GETADDRINFO_A], [1],
3800 [Define to 1 if you have getaddrinfo_a for asynchronous DNS resolution.])
3801 GETADDRINFO_A_LIBS="-lanl"
3802 AC_SUBST([GETADDRINFO_A_LIBS])
3807 gtk_term_header=$term_header
3810 if test "${opsys}" != "mingw32"; then
3811 if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
3812 GLIB_REQUIRED=2.37.5
3813 if test "${window_system}" = "x11"; then
3816 GTK_REQUIRED=3.22.23
3818 GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
3820 dnl Checks for libraries.
3821 EMACS_CHECK_MODULES([GTK], [$GTK_MODULES],
3822 [pkg_check_gtk=yes], [pkg_check_gtk=no])
3823 if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
3824 AC_MSG_ERROR([$GTK_PKG_ERRORS])
3826 if test "$pkg_check_gtk" = "yes"; then
3827 AC_DEFINE([HAVE_GTK3], [1], [Define to 1 if using GTK 3 or later.])
3828 GTK_OBJ=emacsgtkfixed.o
3829 gtk_term_header=gtkutil.h
3830 USE_GTK_TOOLKIT="GTK3"
3831 if test "x$ac_enable_gtk_deprecation_warnings" = x; then
3832 AC_DEFINE([GDK_DISABLE_DEPRECATION_WARNINGS], [1],
3833 [Define to 1 to disable GTK+/GDK deprecation warnings.])
3834 AC_DEFINE([GLIB_DISABLE_DEPRECATION_WARNINGS], [1],
3835 [Define to 1 to disable Glib deprecation warnings.])
3839 gtk3_pkg_errors="$GTK_PKG_ERRORS "
3843 if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
3846 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
3848 dnl Checks for libraries.
3849 EMACS_CHECK_MODULES([GTK], [$GTK_MODULES],
3850 [pkg_check_gtk=yes], [pkg_check_gtk=no])
3851 if test "$pkg_check_gtk" = "no" &&
3852 { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
3854 AC_MSG_ERROR([$gtk3_pkg_errors$GTK_PKG_ERRORS])
3856 test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
3863 if test x"$pkg_check_gtk" = xyes; then
3865 AC_SUBST([GTK_LIBS])
3866 CFLAGS="$CFLAGS $GTK_CFLAGS"
3867 LIBS="$GTK_LIBS $LIBS"
3868 dnl Try to compile a simple GTK program.
3869 AC_CACHE_CHECK([whether GTK compiles], [emacs_cv_gtk_compiles],
3872 [[/* Check the Gtk and Glib APIs. */
3873 #include <gtk/gtk.h>
3874 #include <glib-object.h>
3876 callback (GObject *go, GParamSpec *spec, gpointer user_data)
3880 GtkSettings *gs = 0;
3881 /* Use G_CALLBACK to make sure function pointers can be cast to void *;
3882 strict C prohibits this. Use gtk_main_iteration to test that the
3883 libraries are there. */
3884 if (g_signal_handler_find (G_OBJECT (gs), G_SIGNAL_MATCH_FUNC,
3885 0, 0, 0, G_CALLBACK (callback), 0))
3886 gtk_main_iteration ();
3888 [emacs_cv_gtk_compiles=yes], [emacs_cv_gtk_compiles=no])])
3889 if test "${emacs_cv_gtk_compiles}" != "yes"; then
3891 if test "$USE_X_TOOLKIT" != "maybe"; then
3892 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
3895 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
3897 AC_DEFINE([USE_GTK], [1], [Define to 1 if using GTK.])
3898 GTK_OBJ="gtkutil.o $GTK_OBJ"
3899 term_header=$gtk_term_header
3901 AC_MSG_WARN([[Your version of Gtk+ will have problems with
3902 closing open displays. This is no problem if you just use
3903 one display, but if you use more than one and close one of them
3905 See https://gitlab.gnome.org/GNOME/gtk/issues/221]])
3912 if test "${HAVE_GTK}" = "yes"; then
3914 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
3915 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
3916 if test "$with_toolkit_scroll_bars" != no; then
3917 with_toolkit_scroll_bars=yes
3920 term_header=gtkutil.h
3922 if test "${USE_GTK_TOOLKIT}" = GTK2; then
3924 dnl Check if we have the old file selection dialog declared and
3925 dnl in the link library. In 2.x it may be in the library,
3926 dnl but not declared if deprecated featured has been selected out.
3927 dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
3928 HAVE_GTK_FILE_SELECTION=no
3929 AC_CHECK_DECL([GTK_TYPE_FILE_SELECTION],
3930 [HAVE_GTK_FILE_SELECTION=yes],
3931 [HAVE_GTK_FILE_SELECTION=no],
3932 [AC_INCLUDES_DEFAULT
3933 #include <gtk/gtk.h>])
3934 if test "$HAVE_GTK_FILE_SELECTION" = yes; then
3935 AC_CHECK_FUNCS([gtk_file_selection_new])
3938 dnl This procedure causes a bug on certain Ubuntu GTK+2 builds
3939 AC_CHECK_FUNCS([gtk_window_set_has_resize_grip])
3948 if test "$window_system" = "pgtk"; then
3949 PGTK_OBJ="pgtkfns.o pgtkterm.o pgtkselect.o pgtkmenu.o pgtkim.o xsettings.o"
3950 PGTK_LIBS="$GTK_LIBS"
3952 AC_SUBST([PGTK_OBJ])
3953 AC_SUBST([PGTK_LIBS])
3955 AC_CHECK_FUNCS([malloc_trim])
3957 dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
3958 dnl other platforms.
3961 if test "${with_dbus}" = "yes"; then
3962 EMACS_CHECK_MODULES([DBUS], [dbus-1 >= 1.0])
3963 if test "$HAVE_DBUS" = yes; then
3964 AC_DEFINE([HAVE_DBUS], [1], [Define to 1 if using D-Bus.])
3965 dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1.
3966 dnl dbus_type_is_valid and dbus_validate_* have been introduced in
3968 dnl dbus_message_set_allow_interactive_authorization was introduced
3969 dnl in D-Bus 1.8.10.
3971 LIBS="$LIBS $DBUS_LIBS"
3972 AC_CHECK_FUNCS([dbus_watch_get_unix_fd \
3973 dbus_type_is_valid \
3974 dbus_validate_bus_name \
3975 dbus_validate_path \
3976 dbus_validate_interface \
3977 dbus_validate_member \
3978 dbus_message_set_allow_interactive_authorization])
3983 AC_SUBST([DBUS_CFLAGS])
3984 AC_SUBST([DBUS_LIBS])
3985 AC_SUBST([DBUS_OBJ])
3987 dnl GSettings has been tested under GNU/Linux only.
3989 if test "${HAVE_X11}" = "yes" -o "${window_system}" = "pgtk" && test "${with_gsettings}" = "yes"; then
3990 EMACS_CHECK_MODULES([GSETTINGS], [gio-2.0 >= 2.26])
3991 if test "$HAVE_GSETTINGS" = "yes"; then
3993 CFLAGS="$CFLAGS $GSETTINGS_CFLAGS"
3995 LIBS="$LIBS $GSETTINGS_LIBS"
3996 AC_CACHE_CHECK([whether GSettings is in gio], [emacs_cv_gsettings_in_gio],
3999 [[/* Check that gsettings really is present. */
4000 #include <glib-object.h>
4001 #include <gio/gio.h>
4004 GSettings *settings;
4005 GVariant *val = g_settings_get_value (settings, "");
4007 [emacs_cv_gsettings_in_gio=yes], [emacs_cv_gsettings_in_gio=no])])
4009 if test "$emacs_cv_gsettings_in_gio" = "yes"; then
4010 AC_DEFINE([HAVE_GSETTINGS], [1], [Define to 1 if using GSettings.])
4011 SETTINGS_CFLAGS="$GSETTINGS_CFLAGS"
4012 SETTINGS_LIBS="$GSETTINGS_LIBS"
4013 test "$with_gconf" = "yes" || with_gconf=no
4019 AC_SUBST([HAVE_GSETTINGS])
4021 dnl GConf has been tested under GNU/Linux only.
4022 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
4024 if test "${HAVE_X11}" = "yes" -o "${window_system}" = "pgtk" && test "${with_gconf}" != "no"; then
4025 EMACS_CHECK_MODULES([GCONF], [gconf-2.0 >= 2.13])
4026 if test "$HAVE_GCONF" = yes; then
4027 AC_DEFINE([HAVE_GCONF], [1], [Define to 1 if using GConf.])
4028 dnl Newer GConf doesn't link with g_objects, so this is not defined.
4029 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
4030 SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
4034 if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
4035 EMACS_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0])
4036 if test "$HAVE_GOBJECT" = "yes"; then
4037 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS"
4038 SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS"
4040 SAVE_CFLAGS="$CFLAGS"
4042 CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
4043 LIBS="$SETTINGS_LIBS $LIBS"
4044 CFLAGS="$SAVE_CFLAGS"
4047 AC_SUBST([SETTINGS_CFLAGS])
4048 AC_SUBST([SETTINGS_LIBS])
4050 USE_STARTUP_NOTIFICATION=no
4051 if test "${HAVE_GTK}" = "yes"; then
4052 USE_STARTUP_NOTIFICATION=yes
4054 AC_SUBST([USE_STARTUP_NOTIFICATION])
4056 dnl SELinux is available for Linux kernel based systems only.
4057 dnl These include GNU/Linux and Android.
4061 if test "${with_selinux}" = "yes"; then
4062 if test "$REALLY_ANDROID" = "yes"; then
4063 ndk_SEARCH_MODULE([libselinux], [LIBSELINUX],
4064 [HAVE_LIBSELINUX=yes])
4066 AC_CHECK_LIB([selinux], [lgetfilecon],
4067 [HAVE_LIBSELINUX=yes],
4068 [HAVE_LIBSELINUX=no])
4070 if test "$HAVE_LIBSELINUX" = yes; then
4071 AC_DEFINE([HAVE_LIBSELINUX], [1], [Define to 1 if using SELinux.])
4072 if test "$REALLY_ANDROID" != "yes"; then
4073 LIBSELINUX_LIBS=-lselinux
4077 AC_SUBST([LIBSELINUX_LIBS])
4078 AC_SUBST([LIBSELINUX_CFLAGS])
4081 if test "${with_gnutls}" != "no" ; then
4082 EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.2],
4083 [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no])
4084 if test "${HAVE_GNUTLS}" = "yes"; then
4085 AC_DEFINE([HAVE_GNUTLS], [1], [Define if using GnuTLS.])
4088 # Windows loads GnuTLS dynamically
4089 if test "${opsys}" = "mingw32"; then
4094 AC_SUBST([LIBGNUTLS_LIBS])
4095 AC_SUBST([LIBGNUTLS_CFLAGS])
4098 if test "${with_libsystemd}" = "yes" ; then
4099 dnl This code has been tested with libsystemd 222 and later.
4100 dnl FIXME: Find the earliest version number for which Emacs should work,
4101 dnl and change '222' to that number.
4102 EMACS_CHECK_MODULES([LIBSYSTEMD], [libsystemd >= 222],
4103 [HAVE_LIBSYSTEMD=yes], [HAVE_LIBSYSTEMD=no])
4104 if test "${HAVE_LIBSYSTEMD}" = "yes"; then
4105 AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define if using libsystemd.])
4109 AC_SUBST([LIBSYSTEMD_LIBS])
4110 AC_SUBST([LIBSYSTEMD_CFLAGS])
4116 if test "${with_tree_sitter}" != "no"; then
4117 dnl Tree-sitter 0.20.2 added support to change the malloc it uses
4118 dnl at runtime, we need that feature. However, tree-sitter's
4119 dnl Makefile has problems, until that's fixed, all tree-sitter
4120 dnl libraries distributed are versioned 0.6.3. We try to
4121 dnl accept a tree-sitter library that has incorrect version as long
4122 dnl as it supports changing malloc.
4123 EMACS_CHECK_MODULES([TREE_SITTER], [tree-sitter >= 0.20.2],
4124 [HAVE_TREE_SITTER=yes], [HAVE_TREE_SITTER=no])
4125 if test "${HAVE_TREE_SITTER}" = yes; then
4126 AC_DEFINE(HAVE_TREE_SITTER, 1, [Define if using tree-sitter.])
4129 EMACS_CHECK_MODULES([TREE_SITTER], [tree-sitter >= 0.6.3],
4130 [HAVE_TREE_SITTER=yes], [HAVE_TREE_SITTER=no])
4131 if test "${HAVE_TREE_SITTER}" = yes; then
4134 CFLAGS="$CFLAGS $TREE_SITTER_CFLAGS"
4135 LIBS="$TREE_SITTER_LIBS $LIBS"
4136 AC_CHECK_FUNCS([ts_set_allocator])
4139 if test "$ac_cv_func_ts_set_allocator" = yes; then
4140 AC_DEFINE(HAVE_TREE_SITTER, 1, [Define if using tree-sitter.])
4143 AC_MSG_ERROR([Tree-sitter library exists but its version is too old]);
4150 # Windows loads tree-sitter dynamically
4151 if test "${opsys}" = "mingw32"; then
4156 AC_SUBST(TREE_SITTER_LIBS)
4157 AC_SUBST(TREE_SITTER_CFLAGS)
4162 dnl MS Windows native file monitor is available for mingw32 only.
4163 case $with_file_notification,$opsys in
4165 AC_MSG_ERROR(['--with-file-notification=w32' was specified, but
4166 this is only supported on MS-Windows native and MinGW32 builds.
4167 Consider using gfile instead.])
4169 w32,* | yes,mingw32)
4170 AC_CHECK_HEADER([windows.h])
4171 if test "$ac_cv_header_windows_h" = yes ; then
4172 AC_DEFINE([HAVE_W32NOTIFY], [1], [Define to 1 to use w32notify.])
4173 NOTIFY_OBJ=w32notify.o
4174 NOTIFY_SUMMARY="yes (w32)"
4178 dnl inotify is available only on Linux-kernel based systems.
4179 case $with_file_notification,$NOTIFY_OBJ in
4181 AC_CHECK_HEADER([sys/inotify.h])
4182 if test "$ac_cv_header_sys_inotify_h" = yes ; then
4183 AC_CHECK_FUNCS([inotify_init inotify_init1])
4184 if test "$ac_cv_func_inotify_init" = yes; then
4185 AC_DEFINE([HAVE_INOTIFY], [1], [Define to 1 to use inotify.])
4186 NOTIFY_OBJ=inotify.o
4187 NOTIFY_SUMMARY="yes (inotify)"
4192 AS_IF([test "$opsys" != "haiku"], [
4193 dnl kqueue is available on BSD-like systems and Haiku, but Haiku's
4194 dnl implementation cannot monitor filesystem activity.
4195 case $with_file_notification,$NOTIFY_OBJ in
4197 EMACS_CHECK_MODULES([KQUEUE], [libkqueue])
4198 if test "$HAVE_KQUEUE" = "yes"; then
4199 AC_DEFINE([HAVE_KQUEUE], [1], [Define to 1 to use kqueue.])
4200 CPPFLAGS="$CPPFLAGS -I/usr/include/kqueue"
4201 NOTIFY_CFLAGS=$KQUEUE_CFLAGS
4202 NOTIFY_LIBS=$KQUEUE_LIBS
4204 NOTIFY_SUMMARY="yes -lkqueue"
4206 AC_SEARCH_LIBS([kqueue], [])
4207 if test "$ac_cv_search_kqueue" != no; then
4208 AC_DEFINE([HAVE_KQUEUE], [1], [Define to 1 to use kqueue.])
4210 NOTIFY_SUMMARY="yes (kqueue)"
4215 dnl g_file_monitor exists since glib 2.18. G_FILE_MONITOR_EVENT_MOVED
4216 dnl has been added in glib 2.24. It has been tested under
4218 case $with_file_notification,$NOTIFY_OBJ in
4220 if test "${HAVE_NS}" = yes; then
4221 AC_MSG_ERROR(['--with-file-notification=gfile' is not supported in NextStep builds.
4222 Consider kqueue instead.])
4224 EMACS_CHECK_MODULES([GFILENOTIFY], [gio-2.0 >= 2.24])
4225 if test "$HAVE_GFILENOTIFY" = "yes"; then
4226 AC_DEFINE([HAVE_GFILENOTIFY], [1], [Define to 1 if using GFile.])
4227 NOTIFY_CFLAGS=$GFILENOTIFY_CFLAGS
4228 NOTIFY_LIBS=$GFILENOTIFY_LIBS
4229 NOTIFY_OBJ=gfilenotify.o
4230 NOTIFY_SUMMARY="yes -lgio (gfile)"
4235 case $with_file_notification,$NOTIFY_OBJ in
4236 yes,* | no,* | *,?*) ;;
4237 *) AC_MSG_ERROR([File notification '$with_file_notification' requested but requirements not found.]) ;;
4240 if test -n "$NOTIFY_OBJ"; then
4241 AC_DEFINE([USE_FILE_NOTIFY], [1],
4242 [Define to 1 if using file notifications.])
4244 AC_SUBST([NOTIFY_CFLAGS])
4245 AC_SUBST([NOTIFY_LIBS])
4246 AC_SUBST([NOTIFY_OBJ])
4248 dnl Do not put whitespace before the #include statements below.
4249 dnl Older compilers (eg sunos4 cc) choke on it.
4252 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
4253 if test "$with_xaw3d" != no; then
4254 AC_CACHE_VAL([emacs_cv_xaw3d],
4255 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4256 #include <X11/Intrinsic.h>
4257 #include <X11/Xaw3d/Simple.h>]],
4259 [AC_CHECK_LIB([Xaw3d], [XawScrollbarSetThumb],
4260 [emacs_cv_xaw3d=yes],
4261 [emacs_cv_xaw3d=no])],
4262 [emacs_cv_xaw3d=no])])
4266 if test $emacs_cv_xaw3d = yes; then
4267 AC_MSG_CHECKING([for xaw3d])
4268 AC_MSG_RESULT([yes; using Lucid toolkit])
4272 AC_DEFINE([HAVE_XAW3D], [1],
4273 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
4275 AC_MSG_CHECKING([for xaw3d])
4277 AC_MSG_CHECKING([for libXaw])
4278 AC_CACHE_VAL([emacs_cv_xaw],
4279 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4280 #include <X11/Intrinsic.h>
4281 #include <X11/Xaw/Simple.h>]],
4284 [emacs_cv_xaw=no])])
4285 if test $emacs_cv_xaw = yes; then
4286 AC_MSG_RESULT([yes; using Lucid toolkit])
4289 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
4290 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
4292 AC_MSG_ERROR([No X toolkit could be found.
4293 If you are sure you want Emacs compiled without an X toolkit, pass
4295 to configure. Otherwise, install the development libraries for the toolkit
4296 that you want to use (e.g. Gtk+) and re-run configure.])
4301 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
4305 if test "${USE_X_TOOLKIT}" != "none"; then
4306 AC_MSG_CHECKING([X11 toolkit version])
4307 AC_CACHE_VAL([emacs_cv_x11_toolkit_version_6],
4308 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Intrinsic.h>]],
4309 [[#if XtSpecificationRelease < 6
4312 ]])], [emacs_cv_x11_toolkit_version_6=yes],
4313 [emacs_cv_x11_toolkit_version_6=no])])
4314 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
4315 if test $emacs_cv_x11_toolkit_version_6 = yes; then
4316 AC_MSG_RESULT([6 or newer])
4317 AC_DEFINE([HAVE_X11XTR6], [1],
4318 [Define to 1 if you have the X11R6 or newer version of Xt.])
4319 LIBXTR6="-lSM -lICE"
4321 ## Use libw.a along with X11R6 Xt.
4322 unixware) LIBXTR6="$LIBXTR6 -lw" ;;
4325 AC_MSG_RESULT([before 6])
4328 dnl If using toolkit, check whether libXmu.a exists.
4329 dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
4331 if test x$HAVE_X11XTR6 = xyes; then
4332 OTHERLIBS='-lXt -lSM -lICE'
4336 AC_SEARCH_LIBS([XmuConvertStandardSelection], [Xmu], [], [], [$OTHERLIBS])
4337 if test "X$LIBS" != "X$OLDLIBS"; then
4338 LIBXMU=$ac_cv_search_XmuConvertStandardSelection
4341 dnl ac_cv_search_XmuConvertStandardSelection is also referenced below.
4347 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
4348 # OpenMotif may be installed in such a way on some GNU/Linux systems.
4349 if test -d /usr/include/openmotif; then
4350 CPPFLAGS="-I/usr/include/openmotif $CPPFLAGS"
4351 emacs_cv_openmotif=yes
4352 case "$canonical" in
4353 x86_64-*-linux-gnu* | powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*)
4354 test -d /usr/lib64/openmotif && LDFLAGS="-L/usr/lib64/openmotif $LDFLAGS"
4357 test -d /usr/lib/openmotif && LDFLAGS="-L/usr/lib/openmotif $LDFLAGS"
4360 emacs_cv_openmotif=no
4362 AC_CACHE_CHECK([for (Open)Motif version 2.1], [emacs_cv_motif_version_2_1],
4363 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Xm/Xm.h>]],
4364 [[#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
4367 Motif version prior to 2.1.
4369 [emacs_cv_motif_version_2_1=yes],
4370 [emacs_cv_motif_version_2_1=no])])
4371 if test $emacs_cv_motif_version_2_1 = yes; then
4372 AC_CHECK_LIB([Xp], [XpCreateContext], [LIBXP=-lXp])
4373 if test x$emacs_cv_openmotif = xyes; then
4374 REAL_CPPFLAGS="-I/usr/include/openmotif $REAL_CPPFLAGS"
4377 # We put this in CFLAGS temporarily to precede other -I options
4378 # that might be in CFLAGS temporarily.
4379 # We put this in CPPFLAGS where it precedes the other -I options.
4380 OLD_CPPFLAGS=$CPPFLAGS
4382 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
4383 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
4384 AC_CACHE_CHECK([for LessTif where some systems put it], [emacs_cv_lesstif],
4387 [[#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>
4390 [emacs_cv_lesstif=yes],
4391 [emacs_cv_lesstif=no])])
4392 if test $emacs_cv_lesstif = yes; then
4393 # Make sure this -I option remains in CPPFLAGS after it is set
4394 # back to REAL_CPPFLAGS.
4395 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
4396 # have those other -I options anyway. Ultimately, having this
4397 # directory ultimately in CPPFLAGS will be enough.
4398 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
4399 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
4402 CPPFLAGS=$OLD_CPPFLAGS
4405 AC_CHECK_HEADER([Xm/BulletinB.h], [],
4406 [AC_MSG_ERROR([Motif toolkit requested but requirements not found.])])
4409 dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
4410 dnl using Motif or Xaw3d is available, and unless
4411 dnl --with-toolkit-scroll-bars=no was specified.
4413 AH_TEMPLATE([USE_TOOLKIT_SCROLL_BARS],
4414 [Define to 1 if we should use toolkit scroll bars.])dnl
4415 USE_TOOLKIT_SCROLL_BARS=no
4416 if test "${with_toolkit_scroll_bars}" != "no"; then
4417 if test "${USE_X_TOOLKIT}" != "none"; then
4418 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
4419 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4421 USE_TOOLKIT_SCROLL_BARS=yes
4422 elif test "${HAVE_XAW3D}" = "yes" || test "${USE_X_TOOLKIT}" = "LUCID"; then
4423 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4424 USE_TOOLKIT_SCROLL_BARS=yes
4426 elif test "${HAVE_GTK}" = "yes"; then
4427 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4428 USE_TOOLKIT_SCROLL_BARS=yes
4429 elif test "${HAVE_NS}" = "yes"; then
4430 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4431 USE_TOOLKIT_SCROLL_BARS=yes
4432 elif test "${HAVE_W32}" = "yes"; then
4433 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4434 USE_TOOLKIT_SCROLL_BARS=yes
4435 elif test "${HAVE_BE_APP}" = "yes"; then
4436 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4437 USE_TOOLKIT_SCROLL_BARS=yes
4439 elif test "${window_system}" != "x11" && test "${window_system}" != "none"; then
4440 AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for your system])
4443 dnl See if XIM is available.
4444 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4445 #include <X11/Xlib.h>
4446 #include <X11/Xresource.h>]],
4447 [[XIMProc callback;]])],
4449 AC_DEFINE([HAVE_XIM], [1], [Define to 1 if XIM is available])],
4452 dnl Note this is non-standard. --with-xim does not control whether
4453 dnl XIM support is compiled in, it only affects the runtime default of
4454 dnl use_xim in xterm.c.
4455 if test "${with_xim}" != "no"; then
4456 AC_DEFINE([USE_XIM], [1],
4457 [Define to 1 to default runtime use of XIM to on.])
4462 if test "${HAVE_X11}" = "yes"; then
4465 [[#include <X11/Intrinsic.h>
4466 #include <X11/extensions/Xrender.h>
4468 [[return !XRenderQueryExtension;]])],
4469 [AC_CHECK_LIB([Xrender], [XRenderQueryExtension], [HAVE_XRENDER=yes])])
4470 if test $HAVE_XRENDER = yes; then
4471 XRENDER_LIBS="-lXrender"
4472 AC_SUBST([XRENDER_LIBS])
4473 AC_DEFINE([HAVE_XRENDER], [1], [Define to 1 if XRender is available.])
4478 if test "${HAVE_X11}" = "yes"; then
4479 if test "${with_cairo}" != "no"; then
4480 CAIRO_REQUIRED=1.8.0
4481 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
4482 EMACS_CHECK_MODULES([CAIRO], [$CAIRO_MODULE])
4483 if test $HAVE_CAIRO = yes; then
4484 AS_IF([test "x$with_cairo_xcb" = "xyes"], [
4485 CAIRO_XCB_MODULE="cairo-xcb >= $CAIRO_REQUIRED"
4486 EMACS_CHECK_MODULES([CAIRO_XCB], [$CAIRO_XCB_MODULE])
4487 AS_IF([test "x$HAVE_CAIRO_XCB" = "xyes"], [
4488 CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_XCB_CFLAGS"
4489 CAIRO_LIBS="$CAIRO_LIBS $CAIRO_XCB_LIBS"
4490 AC_DEFINE([USE_CAIRO_XCB], [1],
4491 [Define to 1 if cairo XCB surfaces are available.])])])
4492 AC_DEFINE([USE_CAIRO], [1], [Define to 1 if using cairo.])
4493 CFLAGS="$CFLAGS $CAIRO_CFLAGS"
4494 LIBS="$LIBS $CAIRO_LIBS"
4495 AC_SUBST([CAIRO_CFLAGS])
4496 AC_SUBST([CAIRO_LIBS])
4498 AC_MSG_WARN([cairo requested but not found.])
4503 dnl Enable xwidgets if GTK3 and WebKitGTK+ are available.
4504 dnl Enable xwidgets if macOS Cocoa and WebKit framework are available.
4507 if test "$with_xwidgets" != "no"; then
4508 if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then
4509 WEBKIT_REQUIRED=2.12
4510 WEBKIT_MODULES="webkit2gtk-4.1 >= $WEBKIT_REQUIRED"
4511 EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
4512 if test "$HAVE_WEBKIT" = "no"; then
4513 WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
4514 EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
4516 HAVE_XWIDGETS=$HAVE_WEBKIT
4517 XWIDGETS_OBJ="xwidget.o"
4518 if test "$HAVE_X_WINDOWS" = "yes" && test "${with_cairo}" = "no"; then
4519 CAIRO_XLIB_MODULES="cairo >= 1.8.0 cairo-xlib >= 1.8.0"
4520 EMACS_CHECK_MODULES([CAIRO_XLIB], [$CAIRO_XLIB_MODULES])
4521 if test $HAVE_CAIRO_XLIB = "yes"; then
4522 CAIRO_CFLAGS="$CAIRO_XLIB_CFLAGS"
4523 CAIRO_LIBS="$CAIRO_XLIB_LIBS"
4524 AC_SUBST([CAIRO_CFLAGS])
4525 AC_SUBST([CAIRO_LIBS])
4527 AC_MSG_ERROR([xwidgets requested, but a suitable cairo installation wasn't found])
4530 elif test "${NS_IMPL_COCOA}" = "yes"; then
4531 dnl FIXME: Check framework WebKit2
4532 dnl WEBKIT_REQUIRED=M.m.p
4533 WEBKIT_LIBS="-Wl,-framework -Wl,WebKit"
4534 WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers"
4536 HAVE_XWIDGETS=$HAVE_WEBKIT
4537 XWIDGETS_OBJ="xwidget.o"
4538 NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o"
4539 dnl Update NS_OBJC_OBJ with added nsxwidget.o
4540 AC_SUBST([NS_OBJC_OBJ])
4542 AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or macOS Cocoa as window system.])
4545 test $HAVE_XWIDGETS = yes ||
4546 AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not found.])
4548 AC_DEFINE([HAVE_XWIDGETS], [1], [Define to 1 if you have xwidgets support.])
4550 AC_SUBST([XWIDGETS_OBJ])
4552 if test "$window_system" = "pgtk"; then
4553 CAIRO_REQUIRED=1.12.0
4554 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
4555 EMACS_CHECK_MODULES([CAIRO], [$CAIRO_MODULE])
4556 if test $HAVE_CAIRO = yes; then
4557 AC_DEFINE([USE_CAIRO], [1], [Define to 1 if using cairo.])
4559 AC_MSG_ERROR([cairo required but not found.])
4562 CFLAGS="$CFLAGS $CAIRO_CFLAGS"
4563 LIBS="$LIBS $CAIRO_LIBS"
4564 AC_SUBST([CAIRO_CFLAGS])
4565 AC_SUBST([CAIRO_LIBS])
4568 if test "${HAVE_BE_APP}" = "yes"; then
4569 if test "${with_be_cairo}" != "no"; then
4570 CAIRO_REQUIRED=1.8.0
4571 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
4572 EMACS_CHECK_MODULES([CAIRO], [$CAIRO_MODULE])
4573 if test $HAVE_CAIRO = yes; then
4574 AC_DEFINE([USE_BE_CAIRO], [1], [Define to 1 if using cairo on Haiku.])
4575 CFLAGS="$CFLAGS $CAIRO_CFLAGS"
4576 LIBS="$LIBS $CAIRO_LIBS"
4577 AC_SUBST([CAIRO_CFLAGS])
4578 AC_SUBST([CAIRO_LIBS])
4580 AC_MSG_WARN([cairo requested but not found.])
4585 ### Start of font-backend (under any platform) section.
4586 # (nothing here yet -- this is a placeholder)
4587 ### End of font-backend (under any platform) section.
4589 ### Start of font-backend (under X11) section.
4590 if test "${HAVE_X11}" = "yes"; then
4591 if test $HAVE_CAIRO = yes; then
4592 dnl Strict linkers fail with
4593 dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
4594 dnl if -lfreetype is not specified.
4595 dnl The following is needed to set FREETYPE_LIBS.
4596 EMACS_CHECK_MODULES([FREETYPE], [freetype2])
4598 test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR([cairo requires libfreetype])
4600 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4602 test "$HAVE_FONTCONFIG" = "no" &&
4603 AC_MSG_ERROR([cairo requires libfontconfig])
4604 dnl For the "Does Emacs use" message at the end.
4607 ## Use -lXft if available, unless '--with-xft=no'.
4609 if test "x${with_x}" = "xno"; then
4613 if test "$with_xft" != no; then
4614 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4615 with_xft=$HAVE_FONTCONFIG
4618 if test "x${with_xft}" != "xno"; then
4620 EMACS_CHECK_MODULES([XFT], [xft >= 0.13.0], [], [HAVE_XFT=no])
4621 ## Because xterm.c uses XRenderQueryExtension when XFT is
4622 ## enabled, we also need to link to -lXrender.
4623 if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
4624 OLD_CPPFLAGS="$CPPFLAGS"
4625 OLD_CFLAGS="$CFLAGS"
4627 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
4628 CFLAGS="$CFLAGS $XFT_CFLAGS"
4629 LIBS="$XFT_LIBS $LIBS"
4630 AC_CHECK_HEADER([X11/Xft/Xft.h],
4631 [AC_CHECK_LIB([Xft], [XftFontOpen], [HAVE_XFT=yes],
4634 [[#include <X11/X.h>]])
4636 if test "${HAVE_XFT}" = "yes"; then
4637 AC_DEFINE([HAVE_XFT], [1], [Define to 1 if you have the Xft library.])
4638 AC_SUBST([XFT_LIBS])
4639 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
4640 fi # "${HAVE_XFT}" = "yes"
4641 CPPFLAGS=$OLD_CPPFLAGS
4645 # Make sure XFT is disabled if we found XFT but not XRender
4647 fi # "$HAVE_XFT" != no
4648 fi # "x${with_xft}" != "xno"
4650 if test "$HAVE_XFT" != "yes"; then
4651 dnl For the "Does Emacs use" message at the end.
4655 dnl Strict linkers fail with
4656 dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
4657 dnl if -lfreetype is not specified.
4658 dnl The following is needed to set FREETYPE_LIBS.
4659 EMACS_CHECK_MODULES([FREETYPE], [freetype2])
4661 test "$HAVE_FREETYPE" = "no" &&
4662 AC_MSG_ERROR([libxft requires libfreetype])
4664 fi # $HAVE_CAIRO != yes
4667 if test "${HAVE_FREETYPE}" = "yes"; then
4668 AC_DEFINE([HAVE_FREETYPE], [1],
4669 [Define to 1 if using the freetype and fontconfig libraries.])
4672 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
4673 LIBS="$FREETYPE_LIBS $LIBS"
4674 AC_CHECK_FUNCS([FT_Face_GetCharVariantIndex])
4677 if test "${with_libotf}" != "no"; then
4678 EMACS_CHECK_MODULES([LIBOTF], [libotf])
4679 if test "$HAVE_LIBOTF" = "yes"; then
4680 AC_DEFINE([HAVE_LIBOTF], [1], [Define to 1 if using libotf.])
4681 AC_CHECK_LIB([otf], [OTF_get_variation_glyphs],
4682 [HAVE_OTF_GET_VARIATION_GLYPHS=yes],
4683 [HAVE_OTF_GET_VARIATION_GLYPHS=no])
4684 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
4685 AC_DEFINE([HAVE_OTF_GET_VARIATION_GLYPHS], [1],
4686 [Define to 1 if libotf has OTF_get_variation_glyphs.])
4688 if $PKG_CONFIG --atleast-version=0.9.16 libotf; then :; else
4689 AC_DEFINE([HAVE_OTF_KANNADA_BUG], [1],
4690 [Define to 1 if libotf is affected by https://debbugs.gnu.org/28110.])
4694 dnl FIXME should there be an error if HAVE_FREETYPE != yes?
4695 dnl Does the new font backend require it, or can it work without it?
4699 if test "${HAVE_LIBOTF}" = yes; then
4700 if test "${with_m17n_flt}" != "no"; then
4701 EMACS_CHECK_MODULES([M17N_FLT], [m17n-flt])
4702 if test "$HAVE_M17N_FLT" = "yes"; then
4703 AC_DEFINE([HAVE_M17N_FLT], [1], [Define to 1 if using libm17n-flt.])
4707 else # "${HAVE_X11}" != "yes"
4708 if test $window_system = pgtk; then
4709 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4710 EMACS_CHECK_MODULES([FREETYPE], [freetype2])
4711 if test "$HAVE_FONTCONFIG" != yes -o "$HAVE_FREETYPE" != yes; then
4712 AC_MSG_ERROR([fontconfig and freetype is required.])
4715 AC_DEFINE([HAVE_FREETYPE], [1],
4716 [Define to 1 if using the freetype and fontconfig libraries.])
4717 if test "${with_libotf}" != "no"; then
4718 EMACS_CHECK_MODULES([LIBOTF], [libotf])
4719 if test "$HAVE_LIBOTF" = "yes"; then
4720 AC_DEFINE([HAVE_LIBOTF], [1], [Define to 1 if using libotf.])
4721 AC_CHECK_LIB([otf], [OTF_get_variation_glyphs],
4722 [HAVE_OTF_GET_VARIATION_GLYPHS=yes],
4723 [HAVE_OTF_GET_VARIATION_GLYPHS=no])
4724 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
4725 AC_DEFINE([HAVE_OTF_GET_VARIATION_GLYPHS], [1],
4726 [Define to 1 if libotf has OTF_get_variation_glyphs.])
4736 fi # "${HAVE_X11}" != "yes"
4739 ### On MS-Windows we use hb_font_get_nominal_glyph, which appeared
4740 ### in HarfBuzz version 1.2.3
4741 if test "${HAVE_W32}" = "yes"; then
4742 harfbuzz_required_ver=1.2.3
4744 harfbuzz_required_ver=0.9.42
4746 if test "${HAVE_X11}" = "yes" && test "${HAVE_FREETYPE}" = "yes" \
4747 || test "$window_system" = "pgtk" \
4748 || test "${HAVE_W32}" = "yes" \
4749 || test "$REALLY_ANDROID" = "yes"; then
4750 if test "${with_harfbuzz}" != "no"; then
4751 EMACS_CHECK_MODULES([HARFBUZZ], [harfbuzz >= $harfbuzz_required_ver])
4752 AS_IF([test "$HAVE_HARFBUZZ" = "yes"],[
4753 AC_DEFINE([HAVE_HARFBUZZ], [1], [Define to 1 if using HarfBuzz.])
4754 ### mingw32 and Cygwin-w32 don't use -lharfbuzz, since they load
4755 ### the library dynamically.
4756 AS_IF([test "${HAVE_W32}" = "yes"], [HARFBUZZ_LIBS=])
4757 ## Now check for `hb_font_set_var_named_instance'.
4759 CFLAGS="$HARFBUZZ_CFLAGS $CFLAGS"
4760 EMACS_CHECK_LIB([harfbuzz], [hb_font_set_var_named_instance],
4761 [AC_DEFINE([HAVE_HB_FONT_SET_VAR_NAMED_INSTANCE], [1],
4762 [Define to 1 if `hb_font_set_var_named_instance' is present.])],
4763 [], [$HARFBUZZ_LIBS], [#include <hb.h>])
4764 CFLAGS=$OLD_CFLAGS])
4768 ### Start of font-backend (under Haiku) selectionn.
4769 if test "${HAVE_BE_APP}" = "yes"; then
4770 if test $HAVE_CAIRO = "yes"; then
4771 EMACS_CHECK_MODULES([FREETYPE], [freetype2 >= 2.5.0])
4772 test "$HAVE_FREETYPE" = "no" &&
4773 AC_MSG_ERROR([cairo on Haiku requires libfreetype])
4774 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4775 test "$HAVE_FONTCONFIG" = "no" &&
4776 AC_MSG_ERROR([cairo on Haiku requires libfontconfig])
4781 if test "${HAVE_FREETYPE}" = "yes"; then
4782 AC_DEFINE([HAVE_FREETYPE], [1],
4783 [Define to 1 if using the freetype and fontconfig libraries.])
4786 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
4787 LIBS="$FREETYPE_LIBS $LIBS"
4788 AC_CHECK_FUNCS([FT_Face_GetCharVariantIndex])
4791 if test "${with_libotf}" != "no"; then
4792 EMACS_CHECK_MODULES([LIBOTF], [libotf])
4793 if test "$HAVE_LIBOTF" = "yes"; then
4794 AC_DEFINE([HAVE_LIBOTF], [1], [Define to 1 if using libotf.])
4795 AC_CHECK_LIB([otf], [OTF_get_variation_glyphs],
4796 [HAVE_OTF_GET_VARIATION_GLYPHS=yes],
4797 [HAVE_OTF_GET_VARIATION_GLYPHS=no])
4798 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
4799 AC_DEFINE([HAVE_OTF_GET_VARIATION_GLYPHS], [1],
4800 [Define to 1 if libotf has OTF_get_variation_glyphs.])
4802 if $PKG_CONFIG --atleast-version=0.9.16 libotf; then :; else
4803 AC_DEFINE([HAVE_OTF_KANNADA_BUG], [1],
4804 [Define to 1 if libotf is affected by https://debbugs.gnu.org/28110.])
4808 dnl FIXME should there be an error if HAVE_FREETYPE != yes?
4809 dnl Does the new font backend require it, or can it work without it?
4813 if test "${HAVE_BE_APP}" = "yes" && test "${HAVE_FREETYPE}" = "yes"; then
4814 if test "${with_harfbuzz}" != "no"; then
4815 EMACS_CHECK_MODULES([HARFBUZZ], [harfbuzz >= $harfbuzz_required_ver])
4816 if test "$HAVE_HARFBUZZ" = "yes"; then
4817 AC_DEFINE([HAVE_HARFBUZZ], [1], [Define to 1 if using HarfBuzz.])
4822 ### End of font-backend section.
4824 AC_SUBST([FREETYPE_CFLAGS])
4825 AC_SUBST([FREETYPE_LIBS])
4826 AC_SUBST([FONTCONFIG_CFLAGS])
4827 AC_SUBST([FONTCONFIG_LIBS])
4828 AC_SUBST([HARFBUZZ_CFLAGS])
4829 AC_SUBST([HARFBUZZ_LIBS])
4830 AC_SUBST([LIBOTF_CFLAGS])
4831 AC_SUBST([LIBOTF_LIBS])
4832 AC_SUBST([M17N_FLT_CFLAGS])
4833 AC_SUBST([M17N_FLT_LIBS])
4836 if test "${HAVE_X11}" = "yes"; then
4837 AC_CHECK_HEADER([X11/Xlib-xcb.h],
4838 [AC_CHECK_LIB([xcb], [xcb_translate_coordinates], [HAVE_XCB=yes])])
4839 if test "${HAVE_XCB}" = "yes"; then
4840 AC_CHECK_LIB([X11-xcb], [XGetXCBConnection], [HAVE_X11_XCB=yes])
4841 if test "${HAVE_X11_XCB}" = "yes"; then
4842 AC_DEFINE([USE_XCB], [1],
4843 [Define to 1 if you have the XCB library and X11-XCB library for mixed
4844 X11/XCB programming.])
4845 XCB_LIBS="-lX11-xcb -lxcb"
4849 AC_SUBST([XCB_LIBS])
4851 ### Use -lXpm if available, unless '--with-xpm=no'.
4852 ### mingw32 doesn't use -lXpm, since it loads the library dynamically.
4853 ### The Cygwin-w32 build uses <noX/xpm.h> instead of <X11/xpm.h>, so
4854 ### we need to set LDFLAGS accordingly.
4857 if test "${HAVE_W32}" = "yes" && test "${opsys}" = "cygwin"; then
4858 if test "${with_xpm}" != "no"; then
4859 SAVE_LDFLAGS="$LDFLAGS"
4860 LDFLAGS="$LDFLAGS -L/usr/lib/noX"
4861 AC_CHECK_HEADER([noX/xpm.h],
4862 [AC_CHECK_LIB([Xpm], [XpmReadFileToImage], [HAVE_XPM=yes])])
4863 if test "${HAVE_XPM}" = "yes"; then
4864 AC_CACHE_CHECK([for XpmReturnAllocPixels preprocessor define],
4865 [emacs_cv_cpp_xpm_return_alloc_pixels],
4866 [AC_EGREP_CPP([no_return_alloc_pixels],
4867 [#include "noX/xpm.h"
4868 #ifndef XpmReturnAllocPixels
4869 no_return_alloc_pixels
4871 ], [emacs_cv_cpp_xpm_return_alloc_pixels=no],
4872 [emacs_cv_cpp_xpm_return_alloc_pixels=yes])])
4874 if test "$emacs_cv_cpp_xpm_return_alloc_pixels" = "no"; then
4876 LDFLAGS="$SAVE_LDFLAGS"
4881 if test "${HAVE_XPM}" = "yes"; then
4882 AC_DEFINE([HAVE_XPM], [1],
4883 [Define to 1 if you have the Xpm library (-lXpm).])
4888 if test "${HAVE_X11}" = "yes"; then
4889 dnl Avoid Xpm on AIX unless requested, as it crashes; see Bug#17598.
4890 case $opsys,$with_xpm_set,$with_xpm in
4892 aix4-2,*) with_xpm=no;;
4895 if test "${with_xpm}" != "no"; then
4896 AC_CHECK_HEADER([X11/xpm.h],
4897 [AC_CHECK_LIB([Xpm], [XpmReadFileToPixmap],
4898 [HAVE_XPM=yes], [], [-lX11])])
4899 if test "${HAVE_XPM}" = "yes"; then
4900 AC_CACHE_CHECK([for XpmReturnAllocPixels preprocessor define],
4901 [emacs_cv_cpp_xpm_return_alloc_pixels],
4902 [AC_EGREP_CPP([no_return_alloc_pixels],
4903 [#include "X11/xpm.h"
4904 #ifndef XpmReturnAllocPixels
4905 no_return_alloc_pixels
4907 ], [emacs_cv_cpp_xpm_return_alloc_pixels=no],
4908 [emacs_cv_cpp_xpm_return_alloc_pixels=yes])])
4910 if test "$emacs_cv_cpp_xpm_return_alloc_pixels" = "no"; then
4916 if test "${HAVE_XPM}" = "yes"; then
4917 AC_DEFINE([HAVE_XPM], [1],
4918 [Define to 1 if you have the Xpm library (-lXpm).])
4920 elif test "$opsys,$LUCID_LIBW" = aix4-2,-lXaw; then
4921 dnl AIX -lXaw needs -lXpm linked too; see Bug#17598 Message#152.
4926 ### FIXME: Perhaps regroup to minimize code duplication due to MinGW's
4927 ### slightly different requirements wrt image libraries (it doesn't
4928 ### use -lXpm because it loads the xpm shared library dynamically at
4930 if test "${opsys}" = "mingw32"; then
4931 if test "${with_xpm}" != "no"; then
4932 AC_CHECK_HEADER([X11/xpm.h], [HAVE_XPM=yes], [HAVE_XPM=no], [
4936 if test "${HAVE_XPM}" = "yes"; then
4937 AC_DEFINE([HAVE_XPM], [1],
4938 [Define to 1 if you have the Xpm library (-lXpm).])
4944 ### Use -ljpeg if available, unless '--with-jpeg=no'.
4948 if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
4949 || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
4950 || test "$window_system" = "pgtk" \
4951 || test "${REALLY_ANDROID}" = "yes"; then
4952 if test "${with_jpeg}" != "no"; then
4953 if test "${REALLY_ANDROID}" = "yes"; then
4954 # Look for libjpeg using the NDK.
4955 ndk_SEARCH_MODULE([libjpeg], [JPEG], [HAVE_JPEG=yes])
4957 if test "$HAVE_JPEG" = "yes"; then
4958 LIBJPEG="$JPEG_LIBS"
4960 AC_DEFINE([HAVE_JPEG], [1],
4961 [Define to 1 if you have the jpeg library (typically -ljpeg).])
4964 AC_CACHE_CHECK([for jpeglib 6b or later],
4967 for emacs_cv_jpeglib in yes -ljpeg no; do
4968 case $emacs_cv_jpeglib in
4971 *) LIBS="$LIBS $emacs_cv_jpeglib";;
4975 [[#undef HAVE_STDLIB_H /* Avoid config.h/jpeglib.h collision. */
4976 #include <stdio.h> /* jpeglib.h needs FILE and size_t. */
4977 #include <jpeglib.h>
4979 char verify[JPEG_LIB_VERSION < 62 ? -1 : 1];
4980 struct jpeg_decompress_struct cinfo;
4983 jpeg_create_decompress (&cinfo);
4984 WARNMS (&cinfo, JWRN_JPEG_EOF);
4985 jpeg_destroy_decompress (&cinfo);
4987 [emacs_link_ok=yes],
4990 test $emacs_link_ok = yes && break
4992 if test "$emacs_cv_jpeglib" != no; then
4994 AC_DEFINE([HAVE_JPEG], [1],
4995 [Define to 1 if you have the jpeg library (typically -ljpeg).])
4996 ### mingw32 doesn't use -ljpeg, since it loads the library
4997 ### dynamically when needed, and doesn't want a run-time
4998 ### dependency on the jpeglib DLL.
4999 test "$emacs_cv_jpeglib" != yes && test "${opsys}" != "mingw32" \
5000 && LIBJPEG=$emacs_cv_jpeglib
5006 AC_SUBST([JPEG_CFLAGS])
5011 if test "${with_lcms2}" != "no"; then
5012 EMACS_CHECK_MODULES([LCMS2], [lcms2])
5014 if test "${HAVE_LCMS2}" = "yes"; then
5015 AC_DEFINE([HAVE_LCMS2], [1],
5016 [Define to 1 if you have the lcms2 library (-llcms2).])
5017 ### mingw32 doesn't use -llcms2, since it loads the library dynamically.
5018 if test "${opsys}" = "mingw32"; then
5022 AC_SUBST([LCMS2_CFLAGS])
5023 AC_SUBST([LCMS2_LIBS])
5027 if test "${with_zlib}" != "no"; then
5029 AC_SEARCH_LIBS([inflateEnd], [z], [HAVE_ZLIB=yes])
5031 case $ac_cv_search_inflateEnd in
5032 -*) LIBZ=$ac_cv_search_inflateEnd ;;
5035 if test "${HAVE_ZLIB}" = "yes"; then
5036 AC_DEFINE([HAVE_ZLIB], [1],
5037 [Define to 1 if you have the zlib library (-lz).])
5038 ### mingw32 doesn't use -lz, since it loads the library dynamically.
5039 if test "${opsys}" = "mingw32"; then
5045 ### Dynamic library support
5047 cygwin|mingw32) DYNAMIC_LIB_SUFFIX=".dll" ;;
5048 darwin) DYNAMIC_LIB_SUFFIX=".dylib" ;;
5049 *) DYNAMIC_LIB_SUFFIX=".so" ;;
5052 darwin) DYNAMIC_LIB_SECONDARY_SUFFIX='.so' ;;
5053 *) DYNAMIC_LIB_SECONDARY_SUFFIX='' ;;
5055 AC_DEFINE_UNQUOTED(DYNAMIC_LIB_SUFFIX, "$DYNAMIC_LIB_SUFFIX",
5056 [System extension for dynamic libraries])
5057 AC_DEFINE_UNQUOTED(DYNAMIC_LIB_SECONDARY_SUFFIX, "$DYNAMIC_LIB_SECONDARY_SUFFIX",
5058 [Alternative system extension for dynamic libraries.])
5060 AC_SUBST(DYNAMIC_LIB_SUFFIX)
5061 AC_SUBST(DYNAMIC_LIB_SECONDARY_SUFFIX)
5063 ### Dynamic modules support
5067 MODULES_SUFFIX="${DYNAMIC_LIB_SUFFIX}"
5068 MODULES_SECONDARY_SUFFIX="${DYNAMIC_LIB_SECONDARY_SUFFIX}"
5070 # pgtkterm.c uses dlsym
5071 if test $window_system = pgtk; then
5079 AS_IF([test "x$with_modules" != "xno"],
5080 [AS_CASE(["$opsys"],
5084 [cygwin|mingw32|darwin],
5086 # BSD systems have dlopen in libc.
5087 [AC_CHECK_FUNC([dlopen], [HAVE_MODULES=yes])])
5089 AS_IF([test "x$HAVE_MODULES" = "xno"],
5090 [AS_IF([test "$with_modules" = "ifavailable"],
5091 [AC_MSG_WARN([Dynamic modules are not supported on your system])],
5092 [AC_MSG_ERROR([Dynamic modules are not supported on your system])])],
5094 LIBS="$LIBS $LIBMODULES"
5095 AC_CHECK_FUNCS([dladdr dlfunc])
5098 AS_IF([test "x$HAVE_MODULES" = xyes],
5099 [MODULES_OBJ="emacs-module.o"
5101 AC_DEFINE([HAVE_MODULES], [1], [Define to 1 if dynamic modules are enabled])
5102 AC_DEFINE_UNQUOTED([MODULES_SUFFIX], ["$MODULES_SUFFIX"],
5103 [System extension for dynamic libraries])
5104 AS_IF([test -n "$MODULES_SECONDARY_SUFFIX"],
5105 [AC_DEFINE_UNQUOTED([MODULES_SECONDARY_SUFFIX],
5106 ["$MODULES_SECONDARY_SUFFIX"],
5107 [Alternative system extension for dynamic libraries.])])])
5109 AC_SUBST([MODULES_OBJ])
5110 AC_SUBST([LIBMODULES])
5111 AC_SUBST([HAVE_MODULES])
5112 AC_SUBST([MODULES_SUFFIX])
5113 AC_SUBST([MODULES_SECONDARY_SUFFIX])
5115 ARCH_INDEPENDENT_CONFIG_FILES([src/emacs-module.h])
5116 AC_SUBST_FILE([module_env_snippet_25])
5117 AC_SUBST_FILE([module_env_snippet_26])
5118 AC_SUBST_FILE([module_env_snippet_27])
5119 AC_SUBST_FILE([module_env_snippet_28])
5120 AC_SUBST_FILE([module_env_snippet_29])
5121 AC_SUBST_FILE([module_env_snippet_30])
5122 AC_SUBST_FILE([module_env_snippet_31])
5123 module_env_snippet_25="$srcdir/src/module-env-25.h"
5124 module_env_snippet_26="$srcdir/src/module-env-26.h"
5125 module_env_snippet_27="$srcdir/src/module-env-27.h"
5126 module_env_snippet_28="$srcdir/src/module-env-28.h"
5127 module_env_snippet_29="$srcdir/src/module-env-29.h"
5128 module_env_snippet_30="$srcdir/src/module-env-30.h"
5129 module_env_snippet_31="$srcdir/src/module-env-31.h"
5130 emacs_major_version=`AS_ECHO([$PACKAGE_VERSION]) | sed 's/[[.]].*//'`
5131 AC_SUBST([emacs_major_version])
5133 ### Emacs Lisp native compiler support
5135 AC_DEFUN([libgccjit_smoke_test], [
5137 [[#include <libgccjit.h>
5141 main (int argc, char **argv)
5143 gcc_jit_context *ctxt;
5144 gcc_jit_result *result;
5145 ctxt = gcc_jit_context_acquire ();
5148 gcc_jit_type *int_type =
5149 gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
5150 gcc_jit_function *func =
5151 gcc_jit_context_new_function (ctxt, NULL,
5152 GCC_JIT_FUNCTION_EXPORTED,
5153 int_type, "foo", 0, NULL, 0);
5154 gcc_jit_block *block = gcc_jit_function_new_block (func, "foo");
5155 gcc_jit_block_end_with_return (
5158 gcc_jit_context_new_rvalue_from_int (ctxt, int_type, 1));
5159 result = gcc_jit_context_compile (ctxt);
5162 typedef int (*fn_type) (void);
5164 (fn_type)gcc_jit_result_get_code (result, "foo");
5169 gcc_jit_context_release (ctxt);
5170 gcc_jit_result_release (result);
5174 AC_DEFUN([libgccjit_not_found_err], [
5175 AC_MSG_ERROR([ELisp native compiler was requested, but libgccjit was not found.
5176 Please try installing libgccjit or a similar package.
5177 If you are sure you want Emacs be compiled without ELisp native compiler,
5178 pass the --without-native-compilation option to configure.])])
5180 AC_DEFUN([libgccjit_dev_not_found_err], [
5181 AC_MSG_ERROR([ELisp native compiler was requested, but libgccjit header files were
5183 Please try installing libgccjit-dev or a similar package.
5184 If you are sure you want Emacs be compiled without ELisp native compiler,
5185 pass the --without-native-compilation option to configure.])])
5187 AC_DEFUN([libgccjit_broken_err], [
5188 AC_MSG_ERROR([The installed libgccjit failed to compile and run a test program using
5189 the libgccjit library; see config.log for the details of the failure.
5190 The test program can be found here:
5191 <https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
5192 You can try compiling it yourself to investigate the issues.
5193 Please report the issue to your distribution if libgccjit was installed
5195 You can find the instructions on how to compile and install libgccjit from
5196 source on this site:
5197 <https://gcc.gnu.org/wiki/JIT>.])])
5202 if test "$canonical" = i686-pc-cygwin; then
5203 if test "${with_cygwin32_native_compilation}" = yes; then
5204 with_native_compilation=yes
5205 elif test "${with_native_compilation}" != no; then
5206 AC_MSG_ERROR([Native compilation is not supported on 32-bit Cygwin.
5207 If you really want to try it anyway, use the configure option
5208 '--with-cygwin32-native-compilation'.])
5212 AC_DEFUN([libgccjit_not_found], [
5213 AC_MSG_WARN([Elisp native compiler can't be enabled as libgccjit was not
5215 Please try installing libgccjit or a similar package if you want to have it
5218 with_native_compilation=no
5221 AC_DEFUN([libgccjit_dev_not_found], [
5222 AC_MSG_WARN([Elisp native compiler can't be enabled as libgccjit header files
5224 Please try installing libgccjit-dev or a similar package if you want to have it
5227 with_native_compilation=no
5230 AC_DEFUN([libgccjit_broken], [
5231 AC_MSG_WARN([Elisp native compiler can't be enabled as the installed libgccjit
5232 failed to compile and run a test program using the libgccjit library; see
5233 config.log for the details of the failure.
5234 The test program can be found here:
5235 <https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
5236 You can try compiling it yourself to investigate the issues.
5237 Please report the issue to your distribution if libgccjit was installed
5239 You can find the instructions on how to compile and install libgccjit from
5240 source on this site:
5241 <https://gcc.gnu.org/wiki/JIT>.])
5243 with_native_compilation=no])
5245 if test "$with_features" = "no" \
5246 && test "${with_native_compilation}" = "default"; then
5247 with_native_compilation=no
5250 if test "${with_native_compilation}" = "default"; then
5251 # Check if libgccjit is available.
5252 AC_CHECK_LIB([gccjit], [gcc_jit_context_acquire],
5253 [], [libgccjit_not_found])
5254 AC_CHECK_HEADERS([libgccjit.h], [], [libgccjit_dev_not_found])
5255 if test "${with_native_compilation}" != "no"; then
5256 # Check if libgccjit really works.
5257 AC_RUN_IFELSE([libgccjit_smoke_test], [], [libgccjit_broken])
5259 if test "$with_unexec" = yes; then
5260 with_native_compilation=no
5264 if test "${with_native_compilation}" != "no"; then
5265 if test "$with_unexec" = yes; then
5266 AC_MSG_ERROR(['--with-native-compilation' is not compatible with unexec])
5268 if test "${HAVE_ZLIB}" = no; then
5269 AC_MSG_ERROR(['--with-native-compilation' requires zlib])
5275 if test "${opsys}" = "darwin"; then
5276 # Ensure libgccjit installed by Homebrew or macports can be found.
5277 if test -n "$BREW"; then
5278 if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then
5279 MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \
5281 MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit \
5282 | grep -m1 -E 'libgccjit\.(so|dylib)$'))"
5286 if test -n "$HAVE_MACPORTS"; then
5287 # Determine which gcc version has been installed (gcc11, for
5288 # instance). Use the latest version, if more than one is
5289 # available. (We filter out the gcc4 packages, because they
5290 # don't support jit, and they have names like "gcc49" that
5291 # sort later than "gcc11".)
5292 PORT_PACKAGE=`port installed active | grep '^ *gcc@<:@0-9@:>@* ' | \
5293 awk '{ print $1; }' | grep -v 'gcc4@<:@0-9@:>@' | \
5294 sort -V | tail -n 1`
5295 if test -n "$PORT_PACKAGE"; then
5296 emacs_val=`port contents $PORT_PACKAGE | grep libgccjit.h`
5297 emacs_val=`dirname $emacs_val`
5298 MAC_CFLAGS="-I$emacs_val"
5299 emacs_val=`port contents $PORT_PACKAGE | grep libgccjit.dylib`
5300 emacs_val=`dirname $emacs_val`
5301 MAC_LIBS="-L$emacs_val"
5305 if test -n "$MAC_CFLAGS" && test -n "$MAC_LIBS"; then
5306 CFLAGS="$CFLAGS ${MAC_CFLAGS}"
5307 LIBS="$LIBS ${MAC_LIBS}"
5311 # In the default case we already checked
5312 if test "${with_native_compilation}" != "default"; then
5313 # Check if libgccjit is available.
5314 AC_CHECK_LIB([gccjit], [gcc_jit_context_acquire],
5315 [], [libgccjit_not_found_err])
5316 AC_CHECK_HEADERS([libgccjit.h], [], [libgccjit_dev_not_found_err])
5317 # Check if libgccjit really works.
5318 AC_RUN_IFELSE([libgccjit_smoke_test], [], [libgccjit_broken_err])
5320 HAVE_NATIVE_COMP=yes
5322 # mingw32 loads the library dynamically.
5324 # Neither NetBSD, OpenBSD nor Haiku have libdl, with all dynamic
5325 # linker functions placed within libc.
5326 netbsd|openbsd|haiku)
5327 LIBGCCJIT_LIBS="-lgccjit" ;;
5329 LIBGCCJIT_CFLAGS="${MAC_CFLAGS}"
5330 LIBGCCJIT_LIBS="${MAC_LIBS} -lgccjit -ldl";;
5332 LIBGCCJIT_LIBS="-lgccjit -ldl" ;;
5335 AC_DEFINE([HAVE_NATIVE_COMP], [1],
5336 [Define to 1 if native compiler is available.])
5341 AC_DEFINE_UNQUOTED([NATIVE_ELISP_SUFFIX], [".eln"],
5342 [System extension for native compiled elisp])
5343 AC_SUBST([HAVE_NATIVE_COMP])
5344 AC_SUBST([LIBGCCJIT_CFLAGS])
5345 AC_SUBST([LIBGCCJIT_LIBS])
5348 if test "${NEED_DYNLIB}" = yes; then
5349 DYNLIB_OBJ="dynlib.o"
5351 AC_SUBST([DYNLIB_OBJ])
5353 ### Use -lpng if available, unless '--with-png=no'.
5357 if test "${with_png}" != no; then
5358 # mingw32 loads the library dynamically.
5359 if test "$opsys" = mingw32; then
5360 AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
5361 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
5362 || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
5363 || test "$window_system" = "pgtk" \
5364 || test "${REALLY_ANDROID}" = "yes"; then
5365 EMACS_CHECK_MODULES([PNG], [libpng >= 1.0.0])
5366 if test $HAVE_PNG = yes; then
5369 # Test old way in case pkg-config doesn't have it (older machines).
5370 AC_MSG_CHECKING([for libpng not configured by pkg-config])
5372 png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
5373 png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {
5374 # libpng-config does not work; configure by hand.
5375 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
5376 # in /usr/include/libpng.
5377 if test -r /usr/include/libpng/png.h &&
5378 test ! -r /usr/include/png.h; then
5379 png_cflags=-I/usr/include/libpng
5387 CFLAGS="$CFLAGS $png_cflags"
5388 LIBS="$png_ldflags -lz -lm $LIBS"
5390 [AC_LANG_PROGRAM([[#include <png.h>]],
5391 [[return !png_get_channels (0, 0);]])],
5393 PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
5394 LIBPNG=$png_ldflags])
5397 AC_MSG_RESULT([$HAVE_PNG])
5400 # $LIBPNG requires explicit -lz in some cases.
5401 # We don't know what those cases are, exactly, so play it safe and
5402 # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
5403 case " $LIBPNG ",$LIBZ in
5404 *' -lz '*, | *' ',?*) ;;
5405 *) LIBPNG="$LIBPNG -lz" ;;
5409 if test $HAVE_PNG = yes; then
5410 AC_DEFINE([HAVE_PNG], [1], [Define to 1 if you have the png library.])
5413 CFLAGS="$CFLAGS $PNG_CFLAGS"
5414 AC_CHECK_DECL([png_longjmp],
5416 [AC_DEFINE([PNG_DEPSTRUCT], [],
5417 [Define to empty to suppress deprecation warnings when building
5418 with --enable-gcc-warnings and with libpng versions before 1.5,
5419 which lack png_longjmp.])],
5425 AC_SUBST([PNG_CFLAGS])
5427 ### Use -ltiff if available, unless '--with-tiff=no'.
5428 ### mingw32 doesn't use -ltiff, since it loads the library dynamically.
5432 if test "${opsys}" = "mingw32"; then
5433 if test "${with_tiff}" != "no"; then
5434 AC_CHECK_HEADER([tiffio.h], [HAVE_TIFF=yes], [HAVE_TIFF=no])
5436 if test "${HAVE_TIFF}" = "yes"; then
5437 AC_DEFINE([HAVE_TIFF], [1],
5438 [Define to 1 if you have the tiff library (-ltiff).])
5440 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
5441 || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
5442 || test "$window_system" = "pgtk" \
5443 || test "${REALLY_ANDROID}" = "yes"; then
5444 if test "${with_tiff}" != "no"; then
5445 if test "${REALLY_ANDROID}" != "yes"; then
5446 AC_CHECK_HEADER([tiffio.h],
5448 # At least one tiff package requires the jpeg library.
5449 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
5450 AC_CHECK_LIB([tiff], [TIFFGetVersion], [HAVE_TIFF=yes], [],
5453 ndk_SEARCH_MODULE([libtiff], [TIFF], [HAVE_TIFF=yes])
5455 if test "$HAVE_TIFF" = "yes"; then
5456 LIBTIFF="$TIFF_LIBS"
5461 if test "${HAVE_TIFF}" = "yes"; then
5462 AC_DEFINE([HAVE_TIFF], [1],
5463 [Define to 1 if you have the tiff library (-ltiff).])
5465 if test "$REALLY_ANDROID" != "yes"; then
5466 dnl FIXME -lz -lm, as per libpng?
5472 AC_SUBST([TIFF_CFLAGS])
5474 ### Use -lgif or -lungif if available, unless '--with-gif=no'.
5475 ### mingw32 doesn't use -lgif/-lungif, since it loads the library dynamically.
5479 if test "${opsys}" = "mingw32"; then
5480 if test "${with_gif}" != "no"; then
5481 AC_CHECK_HEADER([gif_lib.h], [HAVE_GIF=yes], [HAVE_GIF=no])
5483 if test "${HAVE_GIF}" = "yes"; then
5484 AC_DEFINE([HAVE_GIF], [1],
5485 [Define to 1 if you have a gif (or ungif) library.])
5487 elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
5488 || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes" \
5489 || test "${HAVE_BE_APP}" = "yes" || test "$window_system" = "pgtk" \
5490 || test "${REALLY_ANDROID}" = "yes" \
5491 && test "${with_gif}" != "no"; then
5492 AC_CHECK_HEADER([gif_lib.h],
5493 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
5494 # Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
5495 [AC_CHECK_LIB([gif], [GifMakeMapObject], [HAVE_GIF=yes],
5496 [AC_CHECK_LIB([gif], [EGifPutExtensionLast],
5498 [HAVE_GIF=maybe])])])
5500 if test "$HAVE_GIF" = yes; then
5502 elif test "$HAVE_GIF" = maybe; then
5503 # If gif_lib.h but no libgif, try libungif.
5504 AC_CHECK_LIB([ungif], [EGifPutExtensionLast],
5507 test "$HAVE_GIF" = yes && LIBGIF=-lungif
5510 # Finally, try ndk-build on Android.
5511 if test "$REALLY_ANDROID" = "yes"; then
5512 ndk_SEARCH_MODULE([libgif], [GIF], [HAVE_GIF=yes],
5514 test "$HAVE_GIF" = yes && LIBGIF="$GIF_LIBS"
5517 if test "${HAVE_GIF}" = "yes"; then
5518 AC_DEFINE([HAVE_GIF], [1],
5519 [Define to 1 if you have a gif (or ungif) library.])
5523 AC_SUBST([GIF_CFLAGS])
5525 dnl Check for required libraries.
5528 if test "${HAVE_X11}" = "yes"; then
5529 case $with_xpm,$HAVE_XPM in
5530 no,* | ifavailable,* | *,yes) ;;
5532 WITH_IFAVAILABLE="--with-xpm=ifavailable";;
5534 case $with_jpeg,$HAVE_JPEG in
5535 no,* | ifavailable,* | *,yes) ;;
5536 *) MISSING="$MISSING libjpeg"
5537 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-jpeg=ifavailable";;
5539 case $with_png,$HAVE_PNG in
5540 no,* | ifavailable,* | *,yes) ;;
5541 *) MISSING="$MISSING libpng"
5542 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-png=ifavailable";;
5544 case $with_gif,$HAVE_GIF in
5545 no,* | ifavailable,* | *,yes) ;;
5546 *) MISSING="$MISSING libgif/libungif"
5547 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gif=ifavailable";;
5549 case $with_tiff,$HAVE_TIFF in
5550 no,* | ifavailable,* | *,yes) ;;
5551 *) MISSING="$MISSING libtiff"
5552 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-tiff=ifavailable";;
5555 case $with_gnutls,$HAVE_GNUTLS in
5556 no,* | ifavailable,* | *,yes) ;;
5557 *) MISSING="$MISSING gnutls"
5558 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gnutls=ifavailable";;
5560 case $with_tree_sitter,$HAVE_TREE_SITTER in
5561 no,* | ifavailable,* | *,yes) ;;
5562 *) MISSING="$MISSING tree-sitter"
5563 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-tree-sitter=ifavailable";;
5566 if test "X${MISSING}" != X; then
5567 # If we have a missing library, and we don't have pkg-config installed,
5568 # the missing pkg-config may be the reason. Give the user a hint.
5569 if test "X${PKG_CONFIG}" = X; then
5570 AC_MSG_WARN([Unable to locate a usable pkg-config])
5572 AC_MSG_ERROR([The following required libraries were not found:
5574 Maybe some development libraries/packages are missing?
5575 To build anyway, give:
5577 as options to configure.])
5580 ### Use -lgpm if available, unless '--with-gpm=no'.
5583 if test "${with_gpm}" != "no"; then
5584 AC_CHECK_HEADER([gpm.h],
5585 [AC_CHECK_LIB([gpm], [Gpm_Open], [HAVE_GPM=yes])])
5587 if test "${HAVE_GPM}" = "yes"; then
5588 AC_DEFINE([HAVE_GPM], [1],
5589 [Define to 1 if you have the gpm library (-lgpm).])
5595 dnl Check for malloc/malloc.h on darwin
5596 AC_CHECK_HEADERS_ONCE([malloc/malloc.h])
5599 ### Use NeXTstep API to implement GUI.
5600 if test "${HAVE_NS}" = "yes"; then
5601 AC_DEFINE([HAVE_NS], [1],
5602 [Define to 1 if you are using the NeXTstep API,
5603 either GNUstep or Cocoa on macOS.])
5604 if test "${NS_IMPL_COCOA}" = "yes"; then
5605 AC_DEFINE([NS_IMPL_COCOA], [1],
5606 [Define to 1 if you are using NS windowing under macOS.])
5608 if test "${NS_IMPL_GNUSTEP}" = "yes"; then
5609 AC_DEFINE([NS_IMPL_GNUSTEP], [1],
5610 [Define to 1 if you are using NS windowing under GNUstep.])
5611 if test $NS_GNUSTEP_CONFIG != yes; then
5612 # See also .m.o rule in src/Makefile.in. */
5613 # FIXME: are all these flags really needed? Document here why. */
5614 GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
5615 ## Extra CFLAGS applied to src/*.m files.
5616 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"
5622 ### Use session management (-lSM -lICE) if available
5625 if test "${HAVE_X11}" = "yes"; then
5626 AC_CHECK_HEADER([X11/SM/SMlib.h],
5627 [AC_CHECK_LIB([SM], [SmcOpenConnection], [HAVE_X_SM=yes], [], [-lICE])])
5629 if test "${HAVE_X_SM}" = "yes"; then
5630 AC_DEFINE([HAVE_X_SM], [1],
5631 [Define to 1 if you have the SM library (-lSM).])
5637 ### Use XRandr (-lXrandr) if available
5639 if test "${HAVE_X11}" = "yes"; then
5640 XRANDR_REQUIRED=1.2.2
5641 XRANDR_MODULES="xrandr >= $XRANDR_REQUIRED"
5642 EMACS_CHECK_MODULES([XRANDR], [$XRANDR_MODULES])
5643 if test $HAVE_XRANDR = no; then
5644 # Test old way in case pkg-config doesn't have it (older machines).
5645 # Include Xrender.h by hand to work around bug in older Xrandr.h
5646 # (e.g. RHEL5) and silence (harmless) configure warning (bug#18465).
5647 AC_CHECK_HEADER([X11/extensions/Xrandr.h],
5648 [AC_CHECK_LIB([Xrandr], [XRRGetScreenResources], [HAVE_XRANDR=yes])],
5649 [], [AC_INCLUDES_DEFAULT
5650 #include <X11/extensions/Xrender.h>])
5651 if test $HAVE_XRANDR = yes; then
5652 XRANDR_LIBS=-lXrandr
5655 if test $HAVE_XRANDR = yes; then
5656 AC_DEFINE([HAVE_XRANDR], [1],
5657 [Define to 1 if you have the XRandr extension.])
5660 AC_SUBST([XRANDR_CFLAGS])
5661 AC_SUBST([XRANDR_LIBS])
5663 ### Use Xinerama (-lXinerama) if available
5665 if test "${HAVE_X11}" = "yes"; then
5666 XINERAMA_REQUIRED=1.0.2
5667 XINERAMA_MODULES="xinerama >= $XINERAMA_REQUIRED"
5668 EMACS_CHECK_MODULES([XINERAMA], [$XINERAMA_MODULES])
5669 if test $HAVE_XINERAMA = no; then
5670 # Test old way in case pkg-config doesn't have it (older machines).
5671 AC_CHECK_HEADER([X11/extensions/Xinerama.h],
5672 [AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
5673 [HAVE_XINERAMA=yes])])
5674 if test $HAVE_XINERAMA = yes; then
5675 XINERAMA_LIBS=-lXinerama
5678 if test $HAVE_XINERAMA = yes; then
5679 AC_DEFINE([HAVE_XINERAMA], [1],
5680 [Define to 1 if you have the Xinerama extension.])
5683 AC_SUBST([XINERAMA_CFLAGS])
5684 AC_SUBST([XINERAMA_LIBS])
5686 ### Use Xfixes (-lXfixes) if available
5688 if test "${HAVE_X11}" = "yes"; then
5689 XFIXES_REQUIRED=1.0.0
5690 XFIXES_MODULES="xfixes >= $XFIXES_REQUIRED"
5691 EMACS_CHECK_MODULES([XFIXES], [$XFIXES_MODULES])
5692 if test $HAVE_XFIXES = no; then
5693 # Test old way in case pkg-config doesn't have it (older machines).
5694 AC_CHECK_HEADER([X11/extensions/Xfixes.h],
5695 [AC_CHECK_LIB([Xfixes], [XFixesHideCursor], [HAVE_XFIXES=yes])])
5696 if test $HAVE_XFIXES = yes; then
5697 XFIXES_LIBS=-lXfixes
5700 if test $HAVE_XFIXES = yes; then
5701 AC_DEFINE([HAVE_XFIXES], [1],
5702 [Define to 1 if you have the Xfixes extension.])
5705 AC_SUBST([XFIXES_CFLAGS])
5706 AC_SUBST([XFIXES_LIBS])
5708 ## Use XInput 2.0 if available
5710 if test "${HAVE_X11}" = "yes" && test "${with_xinput2}" != "no"; then
5711 EMACS_CHECK_MODULES([XINPUT], [xi])
5712 if test $HAVE_XINPUT = yes; then
5713 # Now check for XInput2.h
5714 AC_CHECK_HEADER([X11/extensions/XInput2.h],
5715 [AC_CHECK_LIB([Xi], [XIGrabButton], [HAVE_XINPUT2=yes])])
5717 if test $HAVE_XINPUT2 = yes; then
5718 AC_DEFINE([HAVE_XINPUT2], [1],
5719 [Define to 1 if the X Input Extension version 2.0 or later is present.])
5720 if test "$USE_GTK_TOOLKIT" = "GTK2"; then
5721 AC_MSG_WARN([You are building Emacs with GTK+ 2 and the X Input Extension version 2.
5722 This might lead to problems if your version of GTK+ is not built with support for XInput 2.])
5725 # Now check for some members (which used in conjunction with
5726 # protocol definitions) can be used to determine the version of
5728 AC_CHECK_MEMBERS([XIScrollClassInfo.type, XITouchClassInfo.type,
5729 XIBarrierReleasePointerInfo.deviceid, XIGestureClassInfo.type],
5730 [], [], [#include <X11/extensions/XInput2.h>])
5733 AC_SUBST([XINPUT_CFLAGS])
5734 AC_SUBST([XINPUT_LIBS])
5739 if test "${HAVE_X11}" = "yes"; then
5740 AC_CHECK_HEADER([X11/extensions/sync.h],
5741 [AC_CHECK_LIB([Xext], [XSyncQueryExtension], [HAVE_XSYNC=yes])],
5742 [], [#include <X11/Xlib.h>])
5744 if test "${HAVE_XSYNC}" = "yes"; then
5745 AC_DEFINE([HAVE_XSYNC], [1],
5746 [Define to 1 if the X Synchronization Extension is available.])
5749 LIBS="-lXext $LIBS" # Set this temporarily for AC_CHECK_FUNC
5750 AC_CHECK_FUNCS([XSyncTriggerFence]) # Check for version 3.1
5754 AC_SUBST([XSYNC_LIBS])
5755 AC_SUBST([XSYNC_CFLAGS])
5757 ### Use Xdbe (-lXdbe) if available
5759 if test "${HAVE_X11}" = "yes"; then
5760 if test "${with_xdbe}" != "no"; then
5761 AC_CHECK_HEADER([X11/extensions/Xdbe.h],
5762 [AC_CHECK_LIB([Xext], [XdbeAllocateBackBufferName], [HAVE_XDBE=yes])],
5764 [#include <X11/Xlib.h>
5767 if test $HAVE_XDBE = yes; then
5770 if test $HAVE_XDBE = yes; then
5771 AC_DEFINE([HAVE_XDBE], [1], [Define to 1 if you have the Xdbe extension.])
5774 AC_SUBST([XDBE_CFLAGS])
5775 AC_SUBST([XDBE_LIBS])
5777 ### Use the Nonrectangular Window Shape extension if available.
5780 if test "${HAVE_X11}" = "yes"; then
5781 AC_CHECK_HEADER([X11/extensions/shape.h],
5782 [AC_CHECK_LIB([Xext], [XShapeQueryVersion], [HAVE_XSHAPE=yes])],
5784 [#include <X11/extensions/shape.h>
5786 if test $HAVE_XSHAPE = yes; then
5788 AC_CHECK_HEADER([xcb/shape.h],
5789 [AC_CHECK_LIB([xcb-shape], [xcb_shape_combine], [HAVE_XCB_SHAPE=yes])],
5791 [#include <xcb/shape.h>])
5793 if test $HAVE_XCB_SHAPE = yes && test "$XCB_LIBS" != ""; then
5794 XSHAPE_LIBS="$XSHAPE_LIBS -lxcb-shape"
5795 AC_DEFINE([HAVE_XCB_SHAPE], [1],
5796 [Define to 1 if XCB supports the
5797 Nonrectangular Window Shape extension.])
5800 if test $HAVE_XSHAPE = yes; then
5801 AC_DEFINE([HAVE_XSHAPE], [1],
5802 [Define to 1 if you have the Nonrectangular Window Shape extension.])
5805 AC_SUBST([XSHAPE_CFLAGS])
5806 AC_SUBST([XSHAPE_LIBS])
5808 ### Use Xcomposite (-lXcomposite) if available
5810 if test "${HAVE_X11}" = "yes"; then
5811 AC_CHECK_HEADER([X11/extensions/Xcomposite.h],
5812 [AC_CHECK_LIB([Xcomposite], [XCompositeRedirectWindow],
5813 [HAVE_XCOMPOSITE=yes])],
5815 [#include <X11/extensions/Xcomposite.h>
5817 if test $HAVE_XCOMPOSITE = yes; then
5818 XCOMPOSITE_LIBS=-lXcomposite
5820 if test $HAVE_XCOMPOSITE = yes; then
5821 AC_DEFINE([HAVE_XCOMPOSITE], [1],
5822 [Define to 1 if you have the XCOMPOSITE extension.])
5825 AC_SUBST([XCOMPOSITE_CFLAGS])
5826 AC_SUBST([XCOMPOSITE_LIBS])
5828 ### Use libxml (-lxml2) if available
5829 ### mingw32 doesn't use -lxml2, since it loads the library dynamically.
5831 if test "${with_xml2}" != "no"; then
5832 ### I'm not sure what the version number should be, so I just guessed.
5833 EMACS_CHECK_MODULES([LIBXML2], [libxml-2.0 > 2.6.17])
5834 # Built-in libxml2 on OS X 10.8 lacks libxml-2.0.pc.
5835 if test "${HAVE_LIBXML2}" != "yes" && test "$opsys" = "darwin"; then
5836 SAVE_CPPFLAGS="$CPPFLAGS"
5837 if test -z "$xcsdkdir" -a -n "$XCRUN" -a ! -d /usr/include; then
5838 dnl /usr/include is not found. Try Xcode SDK dir if it is sane.
5839 xcsdkdir=`$XCRUN --show-sdk-path 2>/dev/null`
5841 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
5845 CPPFLAGS="$CPPFLAGS -isystem${xcsdkdir}/usr/include/libxml2"
5846 AC_CHECK_HEADER([libxml/HTMLparser.h],
5847 [AC_CHECK_DECL([HTML_PARSE_RECOVER], [HAVE_LIBXML2=yes], [],
5848 [#include <libxml/HTMLparser.h>])])
5849 CPPFLAGS="$SAVE_CPPFLAGS"
5850 if test "${HAVE_LIBXML2}" = "yes"; then
5851 LIBXML2_CFLAGS="-isystem${xcsdkdir}/usr/include/libxml2"
5852 LIBXML2_LIBS="-lxml2"
5855 if test "${HAVE_LIBXML2}" = "yes"; then
5856 if test "${opsys}" != "mingw32"; then
5858 CFLAGS="$CFLAGS $LIBXML2_CFLAGS"
5859 EMACS_CHECK_LIB([xml2], [htmlReadMemory],
5862 [$LIBXML2_LIBS], [#include <libxml/HTMLparser.h>])
5863 CFLAGS="$SAVE_CFLAGS"
5867 if test "${HAVE_LIBXML2}" = "yes"; then
5868 AC_DEFINE([HAVE_LIBXML2], [1],
5869 [Define to 1 if you have the libxml library (-lxml2).])
5876 AC_SUBST([LIBXML2_LIBS])
5877 AC_SUBST([LIBXML2_CFLAGS])
5881 if test ! "$with_mailutils"; then
5882 # Check for mail-locking functions in a "mail" library. Probably this should
5883 # have the same check as for liblockfile below.
5884 AC_CHECK_LIB([mail], [maillock], [have_mail=yes], [have_mail=no])
5885 if test $have_mail = yes; then
5887 AC_DEFINE([HAVE_LIBMAIL], [1],
5888 [Define to 1 if you have the 'mail' library (-lmail).])
5891 LIBS="$LIBS_MAIL $LIBS"
5892 AC_CHECK_FUNCS([touchlock])
5895 dnl Debian, at least:
5896 AC_CHECK_LIB([lockfile], [maillock], [have_lockfile=yes], [have_lockfile=no])
5897 if test $have_lockfile = yes; then
5898 LIBS_MAIL=-llockfile
5899 AC_DEFINE([HAVE_LIBLOCKFILE], [1],
5900 [Define to 1 if you have the 'lockfile' library (-llockfile).])
5902 # If we have the shared liblockfile, assume we must use it for mail
5903 # locking (e.g. Debian). If we couldn't link against liblockfile
5904 # (no liblockfile.a installed), ensure that we don't need to.
5905 dnl This works for files generally, not just executables.
5906 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
5907 AC_CHECK_PROG([liblockfile], [liblockfile.so], [yes], [no],
5908 [/usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH])
5909 if test "$ac_cv_prog_liblockfile" = yes; then
5910 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
5911 This probably means that movemail could lose mail.
5912 There may be a 'development' package to install containing liblockfile.])
5915 AC_CHECK_HEADERS([maillock.h])
5917 ## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
5918 ## interlock access to the mail spool. The alternative is a lock file named
5919 ## /usr/spool/mail/$USER.lock.
5922 aix4-2) mail_lock="lockf" ;;
5924 gnu|freebsd|dragonfly|netbsd|openbsd|darwin) mail_lock="flock" ;;
5926 ## On GNU/Linux systems, both methods are used by various mail programs.
5927 ## I assume most people are using newer mailers that have heard of flock.
5928 ## Change this if you need to.
5929 ## Debian contains a patch which says: "On Debian/GNU/Linux systems,
5930 ## configure gets the right answers, and that means *NOT* using flock.
5931 ## Using flock is guaranteed to be the wrong thing. See Debian Policy
5932 ## for details." and then uses '#ifdef DEBIAN'. Unfortunately the
5933 ## Debian maintainer hasn't provided a clean fix for Emacs.
5934 ## movemail.c will use 'maillock' when MAILDIR, HAVE_LIBMAIL and
5935 ## HAVE_MAILLOCK_H are defined, so the following appears to be the
5936 ## correct logic. -- fx
5937 ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
5938 ## liblockfile is a Free Software replacement for libmail, used on
5939 ## Debian systems and elsewhere. -rfr.
5942 if test $have_mail = yes || test $have_lockfile = yes; then
5943 test $ac_cv_header_maillock_h = yes && mail_lock=no
5947 mail_lock="none-needed" ;;
5951 flock) AC_DEFINE([MAIL_USE_FLOCK], [1],
5952 [Define if the mailer uses flock to interlock the mail spool.]);;
5954 lockf) AC_DEFINE([MAIL_USE_LOCKF], [1],
5955 [Define if the mailer uses lockf to interlock the mail spool.]);;
5959 *) BLESSMAIL_TARGET="need-blessmail" ;;
5962 AC_SUBST([BLESSMAIL_TARGET])
5963 AC_SUBST([LIBS_MAIL])
5967 [linux/seccomp.h linux/filter.h],
5969 [SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_TSYNC],
5970 [HAVE_SECCOMP=yes], [],
5972 #include <linux/seccomp.h>
5974 AC_SUBST([HAVE_SECCOMP])
5976 EMACS_CHECK_MODULES([LIBSECCOMP], [libseccomp >= 2.5.2])
5977 AC_SUBST([HAVE_LIBSECCOMP])
5978 AC_SUBST([LIBSECCOMP_LIBS])
5979 AC_SUBST([LIBSECCOMP_CFLAGS])
5981 AC_CHECK_SIZEOF([long])
5982 SIZEOF_LONG="$ac_cv_sizeof_long"
5983 AC_SUBST([SIZEOF_LONG])
5986 LIBS="$LIB_PTHREAD $LIB_MATH $LIBS"
5987 AC_CHECK_FUNCS([accept4 fchdir gethostname \
5988 getrusage get_current_dir_name \
5989 lrand48 random rint tcdrain trunc \
5990 select getpagesize newlocale \
5991 getrlimit setrlimit shutdown \
5992 pthread_sigmask strsignal setitimer \
5993 sendto recvfrom getsockname getifaddrs freeifaddrs \
5995 endpwent getgrent endgrent \
5996 cfmakeraw cfsetspeed __executable_start log2 pthread_setname_np \
5997 pthread_set_name_np])
5999 # getpwent is not present in older versions of Android. (bug#65319)
6000 gl_CHECK_FUNCS_ANDROID([getpwent], [[#include <pwd.h>]])
6002 # renameat2 is not present in older versions of Android.
6003 gl_CHECK_FUNCS_ANDROID([renameat2], [[#include <stdio.h>]])
6005 if test "$ac_cv_func_cfmakeraw" != "yes"; then
6006 # On some systems (Android), cfmakeraw is inline, so AC_CHECK_FUNCS
6007 # cannot find it. Check if some code including termios.h and using
6009 AC_CACHE_CHECK([whether cfmakeraw is inline],
6010 [emacs_cv_func_cfmakeraw_inline],
6011 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
6012 [[#include <termios.h>]],
6014 [emacs_cv_func_cfmakeraw_inline=yes],
6015 [emacs_cv_func_cfmakeraw_inline=no])])
6017 if test "$emacs_cv_func_cfmakeraw_inline" = "yes"; then
6018 # Define HAVE_CFMAKERAW again.
6019 AC_DEFINE([HAVE_CFMAKERAW], [1])
6023 if test "$ac_cv_func_cfsetspeed" != "yes"; then
6024 AC_CACHE_CHECK([whether cfsetspeed is inline],
6025 [emacs_cv_func_cfsetspeed_inline],
6026 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
6027 [[#include <termios.h>]],
6029 [emacs_cv_func_cfsetspeed_inline=yes],
6030 [emacs_cv_func_cfsetspeed_inline=no])])
6032 if test "$emacs_cv_func_cfsetspeed_inline" = "yes"; then
6033 # Define HAVE_CFSETSPEED again.
6034 AC_DEFINE([HAVE_CFSETSPEED], [1])
6040 if test "$ac_cv_func_pthread_setname_np" = "yes"; then
6042 [whether pthread_setname_np takes a single argument],
6043 [emacs_cv_pthread_setname_np_1arg],
6046 [[#include <pthread.h>]],
6047 [[pthread_setname_np ("a");]])],
6048 [emacs_cv_pthread_setname_np_1arg=yes],
6049 [emacs_cv_pthread_setname_np_1arg=no])])
6050 if test "$emacs_cv_pthread_setname_np_1arg" = "yes"; then
6052 [HAVE_PTHREAD_SETNAME_NP_1ARG], [1],
6053 [Define to 1 if pthread_setname_np takes a single argument.])
6056 [whether pthread_setname_np takes three arguments],
6057 [emacs_cv_pthread_setname_np_3arg],
6060 [[#include <pthread.h>]],
6061 [[pthread_setname_np (0, "%s", "a");]])],
6062 [emacs_cv_pthread_setname_np_3arg=yes],
6063 [emacs_cv_pthread_setname_np_3arg=no])])
6064 if test "$emacs_cv_pthread_setname_np_3arg" = "yes"; then
6066 [HAVE_PTHREAD_SETNAME_NP_3ARG], [1],
6067 [Define to 1 if pthread_setname_np takes three arguments.])
6072 dnl No need to check for posix_memalign if aligned_alloc works.
6073 AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
6074 AC_CHECK_DECLS([aligned_alloc], [], [], [[#include <stdlib.h>]])
6076 case $with_unexec,$canonical in
6078 AC_CHECK_DECL([__ELF__], [],
6079 [AC_MSG_ERROR([Non-ELF systems are not supported on this platform.])]);;
6082 if test "$with_unexec" = yes && test "$opsys" = "haiku"; then
6083 dnl A serious attempt was actually made to port unexec to Haiku.
6084 dnl Something in libstdc++ seems to prevent it from working.
6085 AC_MSG_ERROR([Haiku is not supported by the legacy unexec dumper.
6086 Please use the portable dumper instead.])
6089 # Dump loading. Android lacks posix_madvise.
6090 AC_CHECK_FUNCS([posix_madvise madvise])
6092 dnl Cannot use AC_CHECK_FUNCS
6093 AC_CACHE_CHECK([for __builtin_frame_address],
6094 [emacs_cv_func___builtin_frame_address],
6095 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_frame_address (0);])],
6096 [emacs_cv_func___builtin_frame_address=yes],
6097 [emacs_cv_func___builtin_frame_address=no])])
6098 if test $emacs_cv_func___builtin_frame_address = yes; then
6099 AC_DEFINE([HAVE___BUILTIN_FRAME_ADDRESS], [1],
6100 [Define to 1 if you have the '__builtin_frame_address' function.])
6102 AC_CACHE_CHECK([for __builtin_unwind_init],
6103 [emacs_cv_func___builtin_unwind_init],
6104 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_unwind_init ();])],
6105 [emacs_cv_func___builtin_unwind_init=yes],
6106 [emacs_cv_func___builtin_unwind_init=no])])
6107 if test $emacs_cv_func___builtin_unwind_init = yes; then
6108 AC_DEFINE([HAVE___BUILTIN_UNWIND_INIT], [1],
6109 [Define to 1 if you have the '__builtin_unwind_init' function.])
6112 AC_CHECK_HEADERS_ONCE([sys/un.h])
6117 AC_CHECK_FUNCS([grantpt])
6119 # PTY-related GNU extensions.
6120 AC_CHECK_FUNCS([getpt posix_openpt])
6122 dnl Run a test program that contains a call to tputs, a call that is
6123 dnl never executed. This tests whether a pre-'main' dynamic linker
6124 dnl works with the library. It's too much trouble to actually call
6125 dnl tputs in the test program, due to portability hassles. When
6126 dnl cross-compiling, assume the test program will run if it links.
6127 AC_DEFUN([tputs_link_source], [
6129 [[extern void tputs (const char *, int, int (*)(int));
6130 int main (int argc, char **argv)
6133 tputs (argv[0], 0, 0);
6137 # Check this now, so that we will NOT find the above functions in ncurses.
6138 # That is because we have not set up to link ncurses in lib-src.
6139 # It's better to believe a function is not available
6140 # than to expect to find it in ncurses.
6141 # Also we need tputs and friends to be able to build at all.
6142 AC_CACHE_CHECK([for library containing tputs], [emacs_cv_tputs_lib],
6143 [if test "${opsys}" = "mingw32" || test x"$REALLY_ANDROID" = "xyes"; then
6144 emacs_cv_tputs_lib='none required'
6146 # curses precedes termcap because of AIX (Bug#9736#35) and OpenIndiana.
6147 tputs_libraries='tinfo ncurses terminfo curses termcap tinfow ncursesw'
6148 for tputs_library in '' $tputs_libraries; do
6150 if test -z "$tputs_library"; then
6151 emacs_cv_tputs_lib='none required'
6153 emacs_cv_tputs_lib=-l$tputs_library
6154 LIBS="$emacs_cv_tputs_lib $LIBS"
6156 AC_RUN_IFELSE([tputs_link_source], [], [emacs_cv_tputs_lib=no],
6157 [AC_LINK_IFELSE([tputs_link_source], [], [emacs_cv_tputs_lib=no])])
6159 if test "X$emacs_cv_tputs_lib" != Xno; then
6164 AS_CASE(["$emacs_cv_tputs_lib"],
6165 [no], [AC_MSG_ERROR([The required function 'tputs' was not found in any library.
6166 The following libraries were tried (in order):
6167 libtinfo, libncurses, libterminfo, libcurses, libtermcap
6168 Please try installing whichever of these libraries is most appropriate
6169 for your system, together with its header files.
6170 For example, a libncurses-dev(el) or similar package.])],
6171 [-l*], [LIBS_TERMCAP=$emacs_cv_tputs_lib],
6172 [*], [LIBS_TERMCAP=])
6174 ## Use termcap instead of terminfo?
6175 ## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
6177 ## FIXME? In the cases below where we unconditionally set
6178 ## LIBS_TERMCAP="-lncurses", this overrides LIBS_TERMCAP = -ltinfo,
6179 ## if that was found above to have tputs.
6180 ## Should we use the gnu* logic everywhere?
6181 case "$opsys$REALLY_ANDROID" in
6182 ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
6183 ## The ncurses library has been moved out of the System framework in
6184 ## Mac OS X 10.2. So if configure detects it, set the command-line
6185 ## option to use it.
6186 darwin) LIBS_TERMCAP="-lncurses" ;;
6188 gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
6191 AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
6192 AC_CACHE_VAL([emacs_cv_freebsd_terminfo],
6193 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <osreldate.h>]],
6194 [[#if __FreeBSD_version < 400000
6197 ]])], [emacs_cv_freebsd_terminfo=yes],
6198 [emacs_cv_freebsd_terminfo=no])])
6200 AC_MSG_RESULT([$emacs_cv_freebsd_terminfo])
6202 if test $emacs_cv_freebsd_terminfo = yes; then
6203 LIBS_TERMCAP="-lncurses"
6206 LIBS_TERMCAP="-ltermcap"
6210 # The case condition is a concatenation of both $opsys and
6211 # $REALLY_ANDROID. Only disable termcap if building a GUI program.
6213 mingw32 | androidyes)
6219 # NetBSD versions prior to 6.0 lack native terminfo, but have a
6220 # tputs() built on top of termcap in these libraries. Use native
6221 # termcap instead in this case. NetBSD >= 6.0 has native terminfo
6222 # implementation in -lterminfo.
6223 if test "x$LIBS_TERMCAP" = "x-ltermcap" -o "x$LIBS_TERMCAP" = "x-lcurses"; then
6225 LIBS_TERMCAP="-ltermcap"
6229 openbsd | dragonfly) LIBS_TERMCAP="-lncurses" ;;
6231 ## hpux: Make sure we get select from libc rather than from libcurses
6232 ## because libcurses on HPUX 10.10 has a broken version of select.
6233 ## We used to use -lc -lcurses, but this may be cleaner.
6234 ## FIXME? But TERMINFO = yes on hpux (it used to be explicitly
6235 # set that way, now it uses the default). Isn't this a contradiction?
6236 hpux*) LIBS_TERMCAP="-ltermcap" ;;
6240 TERMCAP_OBJ=tparam.o
6241 if test $TERMINFO = yes; then
6242 AC_DEFINE([TERMINFO], [1],
6243 [Define to 1 if you use terminfo instead of termcap.])
6244 TERMCAP_OBJ=terminfo.o
6245 AC_CACHE_CHECK([whether $LIBS_TERMCAP library defines BC],
6246 [emacs_cv_terminfo_defines_BC],
6248 LIBS="$LIBS $LIBS_TERMCAP"
6249 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *BC;]], [[return !*BC;]])],
6250 [emacs_cv_terminfo_defines_BC=yes],
6251 [emacs_cv_terminfo_defines_BC=no])
6253 if test "$emacs_cv_terminfo_defines_BC" = yes; then
6254 AC_DEFINE([TERMINFO_DEFINES_BC], [1], [Define to 1 if the
6255 terminfo library defines the variables BC, PC, and UP.])
6258 if test "X$LIBS_TERMCAP" = "X-lncurses"; then
6259 AC_DEFINE([USE_NCURSES], [1], [Define to 1 if you use ncurses.])
6261 AC_SUBST([LIBS_TERMCAP])
6262 AC_SUBST([TERMCAP_OBJ])
6264 # GNU/Linux-specific timer functions.
6265 AC_CACHE_CHECK([for timerfd interface], [emacs_cv_have_timerfd],
6267 [AC_LANG_PROGRAM([[#include <sys/timerfd.h>
6269 [[timerfd_create (CLOCK_REALTIME,
6270 TFD_CLOEXEC | TFD_NONBLOCK);
6271 timerfd_settime (0, TFD_TIMER_ABSTIME, 0, 0);]])],
6272 [emacs_cv_have_timerfd=yes],
6273 [emacs_cv_have_timerfd=no])])
6274 if test "$emacs_cv_have_timerfd" = yes; then
6275 AC_DEFINE([HAVE_TIMERFD], [1],
6276 [Define to 1 if timerfd functions are supported as in GNU/Linux.])
6279 # Alternate stack for signal handlers.
6280 AC_CACHE_CHECK([whether signals can be handled on alternate stack],
6281 [emacs_cv_alternate_stack],
6283 [AC_LANG_PROGRAM([[#include <signal.h>
6287 struct sigaction sa;
6288 ss.ss_sp = malloc (SIGSTKSZ);
6289 ss.ss_size = SIGSTKSZ;
6290 sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
6291 sigaltstack (&ss, 0);
6292 sigaction (SIGSEGV, &sa, 0);]])],
6293 [emacs_cv_alternate_stack=yes],
6294 [emacs_cv_alternate_stack=no])])
6296 # Do we need the Hesiod library to provide the support routines?
6297 dnl FIXME? Should we be skipping this on Darwin too?
6300 if test "$with_hesiod" != no ; then
6301 # Don't set $LIBS here -- see comments above. FIXME which comments?
6303 AC_CHECK_FUNC([res_send], [], [AC_CHECK_FUNC([__res_send], [],
6304 [AC_CHECK_LIB([resolv], [res_send], [resolv=yes],
6305 [AC_CHECK_LIB([resolv], [__res_send], [resolv=yes])])])])
6306 if test "$resolv" = yes ; then
6312 AC_CHECK_FUNC([hes_getmailhost], [],
6313 [AC_CHECK_LIB([hesiod], [hes_getmailhost],
6314 [hesiod=yes], [:], [$RESOLVLIB])])
6316 if test x"$hesiod" = xyes; then
6318 LIBRESOLV=$RESOLVLIB
6321 AC_SUBST([LIBHESIOD])
6322 AC_SUBST([LIBRESOLV])
6324 # These tell us which Kerberos-related libraries to use.
6331 if test "${with_kerberos}" != no; then
6333 AC_CHECK_LIB([com_err], [com_err], [have_com_err=yes], [have_com_err=no])
6334 if test $have_com_err = yes; then
6335 COM_ERRLIB=-lcom_err
6336 LIBS="$COM_ERRLIB $LIBS"
6338 AC_CHECK_LIB([crypto], [mit_des_cbc_encrypt],
6341 if test $have_crypto = yes; then
6343 LIBS="$CRYPTOLIB $LIBS"
6345 AC_CHECK_LIB([k5crypto], [mit_des_cbc_encrypt],
6346 [have_k5crypto=yes],
6348 if test $have_k5crypto = yes; then
6349 CRYPTOLIB=-lk5crypto
6350 LIBS="$CRYPTOLIB $LIBS"
6352 AC_CHECK_LIB([krb5], [krb5_init_context], [have_krb5=yes], [have_krb5=no])
6353 if test $have_krb5=yes; then
6355 LIBS="$KRB5LIB $LIBS"
6357 dnl FIXME Simplify. Does not match 22 logic, thanks to default_off?
6358 if test "${with_kerberos5}" = no; then
6359 AC_CHECK_LIB([des425], [des_cbc_encrypt],
6362 if test $have_des425 = yes; then
6364 LIBS="$DESLIB $LIBS"
6366 AC_CHECK_LIB([des], [des_cbc_encrypt], [have_des=yes], [have_des=no])
6367 if test $have_des = yes; then
6369 LIBS="$DESLIB $LIBS"
6372 AC_CHECK_LIB([krb4], [krb_get_cred], [have_krb4=yes], [have_krb4=no])
6373 if test $have_krb4 = yes; then
6375 LIBS="$KRB4LIB $LIBS"
6377 AC_CHECK_LIB([krb], [krb_get_cred], [have_krb=yes], [have_krb=no])
6378 if test $have_krb = yes; then
6380 LIBS="$KRB4LIB $LIBS"
6385 if test "${with_kerberos5}" != no; then
6386 AC_CHECK_HEADERS([krb5.h],
6387 [AC_CHECK_MEMBERS([krb5_error.text, krb5_error.e_text], [], [],
6388 [#include <krb5.h>])])
6390 AC_CHECK_HEADERS([krb.h], [],
6391 [AC_CHECK_HEADERS([kerberosIV/krb.h], [],
6392 [AC_CHECK_HEADERS([kerberos/krb.h])])])
6394 AC_CHECK_HEADERS([com_err.h])
6398 AC_SUBST([COM_ERRLIB])
6399 AC_SUBST([CRYPTOLIB])
6404 AC_CHECK_HEADERS([valgrind/valgrind.h])
6406 AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
6408 AC_CHECK_FUNCS_ONCE([__lsan_ignore_object])
6412 dnl AC_CHECK_FUNCS_ONCE wouldn’t be right for snprintf, which needs
6413 dnl the current CFLAGS etc.
6414 AC_CHECK_FUNCS([snprintf open_memstream])
6416 dnl posix_spawn. The chdir and setsid functionality is relatively
6417 dnl recent, so we check for it specifically.
6418 AC_CHECK_HEADERS([spawn.h])
6419 AC_SUBST([HAVE_SPAWN_H])
6420 AC_CHECK_FUNCS([posix_spawn \
6421 posix_spawn_file_actions_addchdir \
6422 posix_spawn_file_actions_addchdir_np \
6423 posix_spawnattr_setflags])
6424 AC_SUBST([HAVE_POSIX_SPAWN])
6425 AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR])
6426 AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP])
6427 AC_SUBST([HAVE_POSIX_SPAWNATTR_SETFLAGS])
6428 AC_CHECK_DECLS([POSIX_SPAWN_SETSID], [], [], [[
6431 AC_SUBST([HAVE_DECL_POSIX_SPAWN_SETSID])
6433 dnl Check for glib. This differs from other library checks in that
6434 dnl Emacs need not link to glib unless some other library is already
6435 dnl linking to glib. Although glib provides no facilities that Emacs
6436 dnl needs for its own purposes, when glib is present Emacs needs to
6437 dnl use primitives like g_main_context_query to avoid clashing with
6438 dnl glib at a low level.
6440 dnl Check this late, since it depends on $GTK_CFLAGS etc.
6442 AC_CACHE_CHECK([whether GLib is linked in], [emacs_cv_links_glib],
6443 [OLDCFLAGS="$CFLAGS"
6445 CFLAGS="$CFLAGS $GTK_CFLAGS $RSVG_CFLAGS $DBUS_CFLAGS $SETTINGS_CFLAGS"
6446 LIBS="$LIBS $GTK_LIBS $RSVG_LIBS $DBUS_LIBS $SETTINGS_LIBS"
6447 CFLAGS="$CFLAGS $NOTIFY_CFLAGS $CAIRO_CFLAGS"
6448 LIBS="$LIBS $NOTIFY_LIBS $CAIRO_LIBS"
6449 AC_LINK_IFELSE([AC_LANG_PROGRAM(
6452 [[g_print ("Hello world");]])],
6453 [emacs_cv_links_glib=yes],
6454 [emacs_cv_links_glib=no])
6457 if test "${emacs_cv_links_glib}" = "yes"; then
6458 AC_DEFINE([HAVE_GLIB], [1], [Define to 1 if GLib is linked in.])
6459 if test "$HAVE_NS" = no ; then
6463 AC_SUBST([XGSELOBJ])
6465 AC_DEFUN([EMACS_PAPER_WIDTH],
6466 [AC_REQUIRE([AM_LANGINFO_CODESET])
6467 AS_IF([test "$am_cv_langinfo_codeset" = yes],
6468 [AC_CACHE_CHECK([for nl_langinfo and _NL_PAPER_WIDTH],
6469 [emacs_cv_langinfo__nl_paper_width],
6470 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
6471 [[char *cs = nl_langinfo (_NL_PAPER_WIDTH);]])],
6472 [emacs_cv_langinfo__nl_paper_width=yes],
6473 [emacs_cv_langinfo__nl_paper_width=no])
6475 AS_IF([test "$emacs_cv_langinfo__nl_paper_width" = yes],
6476 [AC_DEFINE([HAVE_LANGINFO__NL_PAPER_WIDTH], [1],
6477 [Define if you have <langinfo.h>
6478 and nl_langinfo (_NL_PAPER_WIDTH).])])])])
6483 dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
6484 dnl how the tty code is related to POSIX and/or other versions of termios.
6485 dnl The following looks like a useful start.
6487 dnl AC_SYS_POSIX_TERMIOS
6488 dnl if test $ac_cv_sys_posix_termios = yes; then
6489 dnl AC_DEFINE([HAVE_TERMIOS], [1],
6490 dnl [Define to 1 if you have POSIX-style
6491 dnl functions and macros for terminal control.])
6492 dnl AC_DEFINE([HAVE_TCATTR], [1],
6493 dnl [Define to 1 if you have tcgetattr and tcsetattr.])
6496 dnl Turned on June 1996 supposing nobody will mind it.
6497 dnl MinGW emulates passwd database, so this feature doesn't make sense there.
6498 if test "${opsys}" != "mingw32"; then
6499 AC_DEFINE([AMPERSAND_FULL_NAME], [1], [Define to use the convention that &
6500 in the full name stands for the login id.])
6503 dnl Everybody supports this, except MS.
6504 dnl Seems like the kind of thing we should be testing for, though.
6505 ## Note: PTYs are broken on darwin <6. Use at your own risk.
6506 if test "${opsys}" != "mingw32"; then
6507 AC_DEFINE([HAVE_PTYS], [1], [Define if the system supports pty devices.])
6510 dnl Everybody supports this, except MS-DOS.
6511 dnl Seems like the kind of thing we should be testing for, though.
6512 AC_DEFINE([HAVE_SOCKETS], [1], [Define if the system supports
6513 4.2-compatible sockets.])
6515 AH_TEMPLATE([INTERNAL_TERMINAL],
6516 [This is substituted when $TERM is "internal".])
6518 AH_TEMPLATE([NULL_DEVICE], [Name of the file to open to get
6519 a null file, or a data sink.])
6520 if test "${opsys}" = "mingw32"; then
6521 AC_DEFINE([NULL_DEVICE], ["NUL:"])
6523 AC_DEFINE([NULL_DEVICE], ["/dev/null"])
6526 if test "${opsys}" = "mingw32"; then
6531 AC_DEFINE_UNQUOTED([SEPCHAR], ['$SEPCHAR'],
6532 [Character that separates PATH elements.])
6533 dnl This is for MinGW, and is used in test/Makefile.in.
6534 dnl The MSYS Bash has heuristics for replacing ':' with ';' when it
6535 dnl decides that a command-line argument to be passed to a MinGW program
6536 dnl is a PATH-style list of directories. But that heuristics plays it
6537 dnl safe, and only does the replacement when it is _absolutely_ sure it
6538 dnl sees a colon-separated list of file names; e.g. ":." is left alone,
6539 dnl which breaks in-tree builds. So we do this manually instead.
6540 dnl Note that we cannot rely on PATH_SEPARATOR, as that one will always
6541 dnl be computed as ':' in MSYS Bash.
6544 dnl Everybody supports this, except MS-DOS.
6545 AC_DEFINE([subprocesses], [1], [Define to enable asynchronous subprocesses.])
6547 AC_DEFINE([DIRECTORY_SEP], ['/'],
6548 [Character that separates directories in a file name.])
6550 if test "${opsys}" = "mingw32"; then
6551 AC_DEFINE([IS_DEVICE_SEP(_c_)], [((_c_) == ':')],
6552 [Returns true if character is a device separator.])
6554 AC_DEFINE([IS_DIRECTORY_SEP(_c_)], [((_c_) == '/' || (_c_) == '\\')],
6555 [Returns true if character is a directory separator.])
6557 AC_DEFINE([IS_ANY_SEP(_c_)],
6558 [(IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))],
6559 [Returns true if character is any form of separator.])
6561 AC_DEFINE([IS_DEVICE_SEP(_c_)], 0,
6562 [Returns true if character is a device separator.])
6564 AC_DEFINE([IS_DIRECTORY_SEP(_c_)], [((_c_) == DIRECTORY_SEP)],
6565 [Returns true if character is a directory separator.])
6567 AC_DEFINE([IS_ANY_SEP(_c_)], [(IS_DIRECTORY_SEP (_c_))],
6568 [Returns true if character is any form of separator.])
6571 if test "$USE_X_TOOLKIT" != "none"; then
6575 dnl Assar Westerlund <assar@sics.se> says this is necessary
6576 dnl for HP-UX 10.20, and that it works for HP-UX 0 as well.
6580 if test "$have_editres" != no && test ! -z "$LIBXMU"; then
6582 dnl See libXmu.a check above.
6583 if test x$HAVE_X11XTR6 = xyes; then
6584 LIBS="-lXt -lSM -lICE $LIBXMU"
6586 OTHERLIBS="-lXt -$LIBXMU"
6588 AC_LINK_IFELSE([AC_LANG_PROGRAM(
6589 [[#include <X11/Intrinsic.h>
6590 #include <X11/Xmu/Editres.h>]],
6591 [[_XEditResCheckMessages (0, 0, 0, 0);]])],
6592 [AC_DEFINE([X_TOOLKIT_EDITRES], [1],
6593 [Define to 1 if we should use XEditRes.])])
6599 solaris | unixware )
6600 dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
6601 dnl instead, there's a system variable _sys_nsig. Unfortunately, we
6602 dnl need the constant to dimension an array. So wire in the appropriate
6604 AC_DEFINE([NSIG_MINIMUM], [32], [Minimum value of NSIG.])
6608 emacs_broken_SIGIO=no
6611 dnl SIGIO exists, but the feature doesn't work in the way Emacs needs.
6612 hpux* | nacl | solaris | unixware )
6613 emacs_broken_SIGIO=yes
6617 dnl On AIX Emacs uses the gmalloc.c malloc implementation. But given
6618 dnl the way this system works, libc functions that return malloced
6619 dnl memory use the libc malloc implementation. Calling xfree or
6620 dnl xrealloc on the results of such functions results in a crash.
6622 dnl One solution for this could be to define SYSTEM_MALLOC in configure,
6623 dnl but that does not currently work on this system.
6625 dnl It is possible to completely override the malloc implementation on
6626 dnl AIX, but that involves putting the malloc functions in a shared
6627 dnl library and setting the MALLOCTYPE environment variable to point to
6628 dnl that shared library.
6630 dnl Emacs currently calls xrealloc on the results of get_current_dir name,
6631 dnl to avoid a crash just use the Emacs implementation for that function.
6633 dnl FIXME We could change the AC_CHECK_FUNCS call near the start
6634 dnl of this file, so that we do not check for get_current_dir_name
6635 dnl on AIX. But that might be fragile if something else ends
6636 dnl up testing for get_current_dir_name as a dependency.
6637 AC_DEFINE([BROKEN_GET_CURRENT_DIR_NAME], [1], [Define if
6638 get_current_dir_name should not be used.])
6642 dnl Circumvent a bug in FreeBSD. In the following sequence of
6643 dnl writes/reads on a PTY, read(2) returns bogus data:
6645 dnl write(2) 1022 bytes
6646 dnl write(2) 954 bytes, get EAGAIN
6647 dnl read(2) 1024 bytes in process_read_output
6648 dnl read(2) 11 bytes in process_read_output
6650 dnl That is, read(2) returns more bytes than have ever been written
6651 dnl successfully. The 1033 bytes read are the 1022 bytes written
6652 dnl successfully after processing (for example with CRs added if the
6653 dnl terminal is set up that way which it is here). The same bytes will
6654 dnl be seen again in a later read(2), without the CRs.
6655 AC_DEFINE([BROKEN_PTY_READ_AFTER_EAGAIN], [1], [Define on FreeBSD to
6656 work around an issue when reading from a PTY.])
6661 gnu-* | android | solaris | cygwin )
6662 dnl FIXME Can't we test if this exists (eg /proc/$$)?
6663 AC_DEFINE([HAVE_PROCFS], [1], [Define if you have the /proc filesystem.])
6668 darwin | dragonfly | freebsd | netbsd | openbsd )
6669 AC_DEFINE([DONT_REOPEN_PTY], [1], [Define if process.c does not need to
6670 close a pty to make it a controlling terminal (it is already a
6671 controlling terminal of the subprocess, because we did ioctl TIOCSCTTY).])
6675 dnl FIXME Surely we can test for this rather than hard-code it.
6677 netbsd | openbsd) sound_device="/dev/audio" ;;
6678 *) sound_device="/dev/dsp" ;;
6682 AC_DEFINE_UNQUOTED([DEFAULT_SOUND_DEVICE], ["$sound_device"],
6683 [Name of the default sound device.])
6686 dnl Emacs can read input using SIGIO and buffering characters itself,
6687 dnl or using CBREAK mode and making C-g cause SIGINT.
6688 dnl The choice is controlled by the variable interrupt_input.
6690 dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
6692 dnl Emacs uses the presence of the USABLE_SIGIO macro
6693 dnl to indicate whether or not signal-driven I/O is possible. It uses
6694 dnl INTERRUPT_INPUT to decide whether to use it by default.
6696 dnl SIGIO can be used only on systems that implement it (4.2 and 4.3).
6697 dnl CBREAK mode has two disadvantages
6698 dnl 1) At least in 4.2, it is impossible to handle the Meta key properly.
6699 dnl I hear that in system V this problem does not exist.
6700 dnl 2) Control-G causes output to be discarded.
6701 dnl I do not know whether this can be fixed in system V.
6703 dnl Another method of doing input is planned but not implemented.
6704 dnl It would have Emacs fork off a separate process
6705 dnl to read the input and send it to the true Emacs process
6708 darwin | gnu-linux | gnu-kfreebsd)
6709 AC_DEFINE([INTERRUPT_INPUT], [1], [Define to read input using SIGIO.])
6714 dnl If the system's imake configuration file defines 'NeedWidePrototypes'
6715 dnl as 'NO', we must define NARROWPROTO manually. Such a define is
6716 dnl generated in the Makefile generated by 'xmkmf'. If we don't define
6717 dnl NARROWPROTO, we will see the wrong function prototypes for X functions
6718 dnl taking float or double parameters.
6720 cygwin|gnu|gnu-linux|gnu-kfreebsd|freebsd|netbsd|openbsd)
6721 AC_DEFINE([NARROWPROTO], [1], [Define if system's imake configuration
6722 file defines 'NeedWidePrototypes' as 'NO'.])
6727 dnl Used in process.c, this must be a loop, even if it only runs once.
6728 AH_TEMPLATE([PTY_ITERATION], [How to iterate over PTYs.])
6729 dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
6730 dnl trying suffixes 0-16.
6731 AH_TEMPLATE([FIRST_PTY_LETTER], [Letter to use in finding device name of
6732 first PTY, if PTYs are supported.])
6733 AH_TEMPLATE([PTY_OPEN], [How to open a PTY, if non-standard.])
6734 AH_TEMPLATE([PTY_NAME_SPRINTF], [How to get the device name of the control
6735 end of a PTY, if non-standard.])
6736 AH_TEMPLATE([PTY_TTY_NAME_SPRINTF], [How to get device name of the tty
6737 end of a PTY, if non-standard.])
6741 AC_DEFINE([PTY_ITERATION], [int c; for (c = 0; !c ; c++)])
6742 dnl You allocate a pty by opening /dev/ptc to get the master side.
6743 dnl To get the name of the slave side, you just ttyname() the master side.
6744 AC_DEFINE([PTY_NAME_SPRINTF], [strcpy (pty_name, "/dev/ptc");])
6745 AC_DEFINE([PTY_TTY_NAME_SPRINTF], [strcpy (pty_name, ttyname (fd));])
6749 AC_DEFINE([PTY_ITERATION], [int i; for (i = 0; i < 1; i++)])
6750 dnl multi-line AC_DEFINEs are hard. :(
6751 AC_DEFINE([PTY_OPEN],
6752 [ 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)])
6753 AC_DEFINE([PTY_NAME_SPRINTF], [])
6754 AC_DEFINE([PTY_TTY_NAME_SPRINTF], [])
6758 AC_DEFINE([FIRST_PTY_LETTER], ['p'])
6762 AC_DEFINE([PTY_ITERATION], [int i; for (i = 0; i < 1; ++i)])
6763 dnl grantpt may be defined in libc but not declared. The same
6764 dnl goes for posix_openpt. When that is the case, it means that
6765 dnl grantpt or posix_openpt cannot actually be used.
6766 AC_CHECK_DECLS([grantpt, posix_openpt])
6767 AS_IF([test "x$ac_cv_have_decl_grantpt" = xyes],
6768 [AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6769 [{ 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); }])],
6770 [AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6771 [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (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); }])])
6772 AS_IF([test "x$ac_cv_have_decl_posix_openpt" = xyes],
6773 [AC_DEFINE([PTY_OPEN],
6774 [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (false)])
6775 AC_DEFINE([PTY_NAME_SPRINTF], [])],
6776 [AC_DEFINE([PTY_NAME_SPRINTF], [])
6777 AC_DEFINE([PTY_OPEN], [fd = getpt ()])])
6780 gnu-linux | gnu-kfreebsd | dragonfly | freebsd | openbsd | netbsd | darwin | nacl )
6782 if test "x$ac_cv_func_grantpt" = xyes; then
6783 AC_DEFINE([UNIX98_PTYS], [1], [Define if the system has Unix98 PTYs.])
6784 AC_DEFINE([PTY_ITERATION], [int i; for (i = 0; i < 1; i++)])
6785 dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD
6786 dnl to prevent sigchld_handler from intercepting the child's death.
6787 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6788 [{ 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); }])
6789 dnl if HAVE_POSIX_OPENPT
6790 if test "x$ac_cv_func_posix_openpt" = xyes; then
6791 AC_DEFINE([PTY_OPEN],
6792 [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (false)])
6793 AC_DEFINE([PTY_NAME_SPRINTF], [])
6795 elif test "x$ac_cv_func_getpt" = xyes; then
6796 AC_DEFINE([PTY_OPEN], [fd = getpt ()])
6797 AC_DEFINE([PTY_NAME_SPRINTF], [])
6799 AC_DEFINE([PTY_NAME_SPRINTF], [strcpy (pty_name, "/dev/ptmx");])
6802 AC_DEFINE([FIRST_PTY_LETTER], ['p'])
6807 AC_DEFINE([FIRST_PTY_LETTER], ['p'])
6808 AC_DEFINE([PTY_NAME_SPRINTF],
6809 [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])
6810 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6811 [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])
6815 dnl On SysVr4, grantpt(3) forks a subprocess, so do not use
6816 dnl O_CLOEXEC when opening the pty, and keep the SIGCHLD handler
6817 dnl from intercepting that death. If any child but grantpt's should die
6818 dnl within, it should be caught after sigrelse(2).
6819 AC_DEFINE([PTY_OPEN], [fd = open (pty_name, O_RDWR | O_NONBLOCK)])
6820 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6821 [{ 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); }])
6825 dnl Comments are as per solaris.
6826 AC_DEFINE([PTY_OPEN], [fd = open (pty_name, O_RDWR | O_NONBLOCK)])
6827 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6828 [{ 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); }])
6832 AC_DEFINE([FIRST_PTY_LETTER], ['s'])
6833 AC_DEFINE([PTY_NAME_SPRINTF], [])
6834 dnl on Haiku pty names aren't distinctive, thus the use of posix_openpt
6835 AC_DEFINE([PTY_OPEN], [fd = posix_openpt (O_RDWR | O_NONBLOCK)])
6836 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6837 [{ char *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); }])
6843 solaris | unixware )
6844 dnl This change means that we don't loop through allocate_pty too
6845 dnl many times in the (rare) event of a failure.
6846 AC_DEFINE([FIRST_PTY_LETTER], ['z'])
6847 AC_DEFINE([PTY_NAME_SPRINTF], [strcpy (pty_name, "/dev/ptmx");])
6848 dnl Push various streams modules onto a PTY channel. Used in process.c.
6849 AC_DEFINE([SETUP_SLAVE_PTY],
6850 [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.])
6855 AH_TEMPLATE([SIGNALS_VIA_CHARACTERS], [Make process_send_signal work by
6856 "typing" a signal character on the pty.])
6859 dnl Perry Smith <pedz@ddivt1.austin.ibm.com> says this is correct for AIX.
6860 aix4-2 | cygwin | gnu | dragonfly | freebsd | netbsd | openbsd | darwin )
6861 AC_DEFINE([SIGNALS_VIA_CHARACTERS], [1])
6864 dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.
6865 dnl FIXME Does gnu-kfreebsd have linux/version.h? It seems unlikely...
6866 gnu-linux | gnu-kfreebsd )
6868 AC_CACHE_CHECK([for signals via characters], [emacs_cv_signals_via_chars],
6869 [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6870 #include <linux/version.h>
6871 #if LINUX_VERSION_CODE < 0x20400
6872 # error "Linux version too old"
6875 [emacs_cv_signals_via_chars=yes],
6876 [emacs_cv_signals_via_chars=no])])
6878 test "$emacs_cv_signals_via_chars" = yes &&
6879 AC_DEFINE([SIGNALS_VIA_CHARACTERS], [1])
6884 AH_TEMPLATE([TAB3], [Undocumented.])
6887 darwin) AC_DEFINE([TAB3], [OXTABS]) ;;
6889 gnu | dragonfly | freebsd | netbsd | openbsd )
6890 AC_DEFINE([TABDLY], [OXTABS], [Undocumented.])
6891 AC_DEFINE([TAB3], [OXTABS])
6894 gnu-linux | gnu-kfreebsd )
6902 [AC_DEFINE([GC_MARK_SECONDARY_STACK()],
6903 [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)],
6904 [Mark a secondary stack, like the register stack on the ia64.])], [])
6908 AC_DEFINE([RUN_TIME_REMAP], [1], [Define if emacs.c needs to call
6909 run_time_remap; for HPUX.])
6914 dnl This won't be used automatically yet. We also need to know, at least,
6915 dnl that the stack is continuous.
6916 AH_TEMPLATE([GC_SETJMP_WORKS], [Define if setjmp is known to save all
6917 registers relevant for conservative garbage collection in the jmp_buf.])
6921 dnl Not all the architectures are tested, but there are Debian packages
6922 dnl for SCM and/or Guile on them, so the technique must work. See also
6923 dnl comments in alloc.c concerning setjmp and gcc.
6924 dnl Fixme: it's probably safe to just use the GCC conditional below.
6925 gnu-linux | gnu-kfreebsd )
6926 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6927 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
6928 || defined __alpha__ || defined __mips__ || defined __s390__ \
6929 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
6930 || defined __x86_64__ \
6931 || defined __ia64__ || defined __sh__
6934 # error "setjmp not known to work on this arch"
6936 ]], [[]])], [AC_DEFINE([GC_SETJMP_WORKS], [1])])
6941 if test x$GCC = xyes; then
6942 dnl GC_SETJMP_WORKS is nearly always appropriate for GCC.
6943 AC_DEFINE([GC_SETJMP_WORKS], [1])
6946 aix* | dragonfly | freebsd | netbsd | openbsd | solaris )
6947 AC_DEFINE([GC_SETJMP_WORKS], [1])
6952 dnl In a weird quirk, MS runtime uses _setjmp and longjmp.
6953 AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
6956 [[#include <setjmp.h>
6958 # define _longjmp longjmp
6963 _longjmp (j, 1);]])],
6964 [emacs_cv_func__setjmp=yes],
6965 [emacs_cv_func__setjmp=no])])
6966 if test $emacs_cv_func__setjmp = yes; then
6967 AC_DEFINE([HAVE__SETJMP], [1], [Define to 1 if _setjmp and _longjmp work.])
6970 # We need to preserve signal mask to handle C stack overflows.
6971 AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp],
6974 [[#include <setjmp.h>
6977 if (! sigsetjmp (j, 1))
6978 siglongjmp (j, 1);]])],
6979 [emacs_cv_func_sigsetjmp=yes],
6980 [emacs_cv_func_sigsetjmp=no])])
6981 if test $emacs_cv_func_sigsetjmp = yes; then
6982 AC_DEFINE([HAVE_SIGSETJMP], [1],
6983 [Define to 1 if sigsetjmp and siglongjmp work.])
6986 case $emacs_cv_func_sigsetjmp,$emacs_cv_alternate_stack,$opsys in
6987 yes,yes,* | *,*,mingw32)
6988 AC_DEFINE([HAVE_STACK_OVERFLOW_HANDLING], [1],
6989 [Define to 1 if C stack overflow can be handled in some cases.]);;
6993 solaris | unixware )
6994 dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
6995 dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs,
6996 dnl and this is all we need.
6997 AC_DEFINE([TIOCSIGSEND], [TIOCSIGNAL], [Some platforms redefine this.])
7004 dnl Used in xfaces.c.
7005 AC_DEFINE([XOS_NEEDS_TIME_H], [1], [Compensate for a bug in Xos.h on
7006 some systems, where it requires time.h.])
7011 dnl Define symbols to identify the version of Unix this is.
7012 dnl Define all the symbols that apply correctly.
7013 AH_TEMPLATE([DOS_NT], [Define if the system is MS DOS or MS Windows.])
7014 AH_TEMPLATE([MSDOS], [Define if the system is MS DOS.])
7015 AH_TEMPLATE([USG], [Define if the system is compatible with System III.])
7016 AH_TEMPLATE([USG5_4],
7017 [Define if the system is compatible with System V Release 4.])
7021 AC_DEFINE([USG], [])
7022 dnl This symbol should be defined on AIX Version 3 ???????
7023 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7025 # error "_AIX not defined"
7027 ]], [[]])], [], [AC_DEFINE([_AIX], [], [Define if the system is AIX.])])
7031 AC_DEFINE([CYGWIN], [1], [Define if the system is Cygwin.])
7035 dnl Not __APPLE__, as this may not be defined on non-macOS Darwin.
7036 dnl Not DARWIN, because Panther and lower CoreFoundation.h use DARWIN to
7037 dnl distinguish macOS from pure Darwin.
7038 AC_DEFINE([DARWIN_OS], [], [Define if the system is Darwin.])
7041 gnu-linux | gnu-kfreebsd )
7042 AC_DEFINE([USG], [])
7043 AC_DEFINE([GNU_LINUX], [],
7044 [Define if this system is compatible with GNU/Linux.])
7048 AC_DEFINE([USG], [])
7049 AC_DEFINE([HPUX], [], [Define if the system is HPUX.])
7053 AC_DEFINE([DOS_NT], [])
7054 AC_DEFINE([WINDOWSNT], [1], [Define if compiling for native MS Windows.])
7055 if test "x$ac_enable_checking" != "x" ; then
7056 AC_DEFINE([EMACSDEBUG], [1],
7057 [Define to 1 to enable w32 debug facilities.])
7062 AC_DEFINE([USG], [])
7063 AC_DEFINE([USG5_4], [])
7064 AC_DEFINE([SOLARIS2], [], [Define if the system is Solaris.])
7068 AC_DEFINE([USG], [])
7069 AC_DEFINE([USG5_4], [])
7073 AC_DEFINE([HAIKU], [], [Define if the system is Haiku.])
7077 AC_SYS_POSIX_TERMIOS
7078 if test $ac_cv_sys_posix_termios = yes; then
7079 AC_CHECK_SIZEOF([speed_t], [], [#include <termios.h>])
7080 dnl on Haiku, and possibly other platforms, speed_t is defined to
7081 dnl unsigned char, even when speeds greater than 200 baud are
7084 if test ${ac_cv_sizeof_speed_t} -lt 2; then
7085 AC_DEFINE([HAVE_TINY_SPEED_T], [1],
7086 [Define to 1 if speed_t has some sort of nonsensically tiny size.])
7090 AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
7093 dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
7094 emacs_cv_usable_FIONREAD=no
7098 emacs_cv_usable_FIONREAD=yes
7103 [AC_LANG_PROGRAM([[#include <sys/types.h>
7104 #include <sys/ioctl.h>
7106 # include <sys/filio.h>
7109 [[int foo = ioctl (0, FIONREAD, &foo);]])],
7110 [emacs_cv_usable_FIONREAD=yes],
7111 [emacs_cv_usable_FIONREAD=no])
7114 if test $emacs_cv_usable_FIONREAD = yes; then
7115 AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.])
7117 if test $emacs_broken_SIGIO = no; then
7118 AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO],
7120 [AC_LANG_PROGRAM([[#include <fcntl.h>
7123 [[int foo = SIGIO | F_SETFL | FASYNC;]])],
7124 [emacs_cv_usable_SIGIO=yes],
7125 [emacs_cv_usable_SIGIO=no])],
7126 [emacs_cv_usable_SIGIO=yes],
7127 [emacs_cv_usable_SIGIO=no])
7128 if test $emacs_cv_usable_SIGIO = yes; then
7129 AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.])
7133 if test $emacs_broken_SIGIO = no && test $emacs_cv_usable_SIGIO = no; then
7134 AC_CACHE_CHECK([for usable SIGPOLL], [emacs_cv_usable_SIGPOLL],
7136 [AC_LANG_PROGRAM([[#include <fcntl.h>
7139 [[int foo = SIGPOLL | F_SETFL;]])],
7140 [emacs_cv_usable_SIGPOLL=yes],
7141 [emacs_cv_usable_SIGPOLL=no])],
7142 [emacs_cv_usable_SIGPOLL=yes],
7143 [emacs_cv_usable_SIGPOLL=no])
7144 if test $emacs_cv_usable_SIGPOLL = yes; then
7145 AC_DEFINE([USABLE_SIGPOLL], [1], [Define to 1 if SIGPOLL is usable but SIGIO is not.])
7152 dnl It works to open the pty's tty in the parent (Emacs), then
7153 dnl close and reopen it in the child.
7154 AC_DEFINE([USG_SUBTTY_WORKS], [1], [Define for USG systems where it
7155 works to open a pty's tty in the parent process, then close and
7156 reopen it in the child.])
7160 AC_DEFINE([_STRUCTURED_PROC], [1], [Needed for system_process_attributes
7165 # Set up the CFLAGS for real compilation, so we can substitute it.
7166 CFLAGS="$REAL_CFLAGS"
7167 CPPFLAGS="$REAL_CPPFLAGS"
7170 ## Hack to detect a buggy GCC version.
7171 if test "$GCC" = yes && \
7172 $CC --version 2> /dev/null | grep 'gcc.* 4.5.0' >/dev/null; then
7174 *-fno-optimize-sibling-calls*) ;;
7176 AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS.]);;
7180 version=$PACKAGE_VERSION
7182 copyright="Copyright (C) 2024 Free Software Foundation, Inc."
7183 AC_DEFINE_UNQUOTED([COPYRIGHT], ["$copyright"],
7184 [Short copyright string for this version of Emacs.])
7185 AC_SUBST([copyright])
7187 ### Specify what sort of things we'll be editing into Makefile and config.h.
7188 ### Use configuration here uncanonicalized to avoid exceeding size limits.
7190 AC_SUBST([configuration])
7192 AC_SUBST([canonical])
7195 AC_SUBST([exec_prefix])
7198 AC_SUBST([gsettingsschemadir])
7199 AC_SUBST([sharedstatedir])
7200 AC_SUBST([libexecdir])
7203 AC_SUBST([lispdirrel])
7205 AC_SUBST([standardlisppath])
7206 AC_SUBST([locallisppath])
7207 AC_SUBST([lisppath])
7208 AC_SUBST([x_default_search_path])
7210 AC_SUBST([archlibdir])
7211 AC_SUBST([etcdocdir])
7212 AC_SUBST([bitmapdir])
7214 AC_SUBST([gameuser])
7215 AC_SUBST([gamegroup])
7216 ## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
7217 ## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
7218 ## end of LIBX_BASE, but nothing ever set it.
7219 AC_SUBST([LD_SWITCH_X_SITE])
7220 AC_SUBST([C_SWITCH_X_SITE])
7221 AC_SUBST([GNUSTEP_CFLAGS])
7223 ## Used in lwlib/Makefile.in.
7224 AC_SUBST([X_TOOLKIT_TYPE])
7225 AC_SUBST([ns_appdir])
7226 AC_SUBST([ns_appbindir])
7227 AC_SUBST([ns_applibexecdir])
7228 AC_SUBST([ns_applibdir])
7229 AC_SUBST([ns_appresdir])
7230 AC_SUBST([ns_appsrc])
7231 AC_SUBST([GNU_OBJC_CFLAGS])
7232 AC_SUBST([OTHER_FILES])
7234 if test -n "${term_header}"; then
7235 AC_DEFINE_UNQUOTED([TERM_HEADER], ["${term_header}"],
7236 [Define to the header for the built-in window system.])
7239 AC_DEFINE_UNQUOTED([EMACS_CONFIGURATION], ["${canonical}"],
7240 [Define to the canonical Emacs configuration name.])
7241 AC_DEFINE_UNQUOTED([EMACS_CONFIG_OPTIONS], "${emacs_config_options}",
7242 [Define to the options passed to configure.])
7247 if test "${HAVE_X_WINDOWS}" = "yes" ; then
7248 AC_DEFINE([HAVE_X_WINDOWS], [1],
7249 [Define to 1 if you want to use the X window system.])
7251 XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o"
7253 if test "$HAVE_CAIRO" = "yes"; then
7254 FONT_OBJ="$FONT_OBJ ftfont.o ftcrfont.o"
7255 elif test "$HAVE_XFT" = "yes"; then
7256 FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o"
7257 elif test "$HAVE_FREETYPE" = "yes"; then
7258 FONT_OBJ="$FONT_OBJ ftfont.o"
7262 if test "${window_system}" = "pgtk"; then
7263 FONT_OBJ="ftfont.o ftcrfont.o"
7266 if test "${HAVE_BE_APP}" = "yes" ; then
7267 if test "${HAVE_CAIRO}" = "yes"; then
7268 FONT_OBJ="$FONT_OBJ ftfont.o ftcrfont.o"
7272 if test "${HAVE_HARFBUZZ}" = "yes" ; then
7273 FONT_OBJ="$FONT_OBJ hbfont.o"
7275 AC_SUBST([FONT_OBJ])
7276 AC_SUBST([XMENU_OBJ])
7278 AC_SUBST([FONT_OBJ])
7282 if test "${USE_X_TOOLKIT}" != "none" ; then
7284 AC_DEFINE([USE_X_TOOLKIT], [1], [Define to 1 if using an X toolkit.])
7285 if test "${USE_X_TOOLKIT}" = "LUCID"; then
7286 AC_DEFINE([USE_LUCID], [1], [Define to 1 if using the Lucid X toolkit.])
7287 elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
7288 AC_DEFINE([USE_MOTIF], [1], [Define to 1 if using the Motif X toolkit.])
7292 ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
7293 MOTIF_LIBW="$MOTIF_LIBW -lXpm"
7297 ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
7298 ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
7299 MOTIF_LIBW="MOTIF_LIBW -lXimp"
7303 ## olson@mcs.anl.gov says -li18n is needed by -lXm.
7304 MOTIF_LIBW="$MOTIF_LIBW -li18n"
7307 MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
7310 AC_SUBST([WIDGET_OBJ])
7313 case "$USE_X_TOOLKIT" in
7314 MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
7315 LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
7316 none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
7318 if test "$HAVE_XWIDGETS" = "yes"; then
7319 TOOLKIT_LIBW="$TOOLKIT_LIBW -lXcomposite"
7321 AC_SUBST([TOOLKIT_LIBW])
7323 if test "${opsys}" != "mingw32"; then
7324 if test "$USE_X_TOOLKIT" = "none"; then
7325 LIBXT_OTHER="\$(LIBXSM)"
7327 LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
7330 AC_SUBST([LIBXT_OTHER])
7332 if test "${HAVE_X11}" = "yes" ; then
7333 AC_DEFINE([HAVE_X11], [1],
7334 [Define to 1 if you want to use version 11 of X windows.])
7335 LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
7339 AC_SUBST([LIBX_OTHER])
7342 if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then
7344 elif test "$USE_X_TOOLKIT" = none; then
7346 LIBXMENU='$(oldXMenudir)/libXMenu11.a'
7347 AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu"
7349 LIBXMENU='$(lwlibdir)/liblw.a'
7350 AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib"
7352 AC_SUBST([LIBXMENU])
7354 AC_CACHE_CHECK([for struct alignment],
7355 [emacs_cv_struct_alignment],
7357 [AC_LANG_PROGRAM([[#include <stddef.h>
7358 struct s { char c; } __attribute__ ((aligned (8)));
7359 struct t { char c; struct s s; };
7360 char verify[offsetof (struct t, s) == 8 ? 1 : -1];
7362 [emacs_cv_struct_alignment=yes],
7363 [emacs_cv_struct_alignment=no])])
7364 if test "$emacs_cv_struct_alignment" = yes; then
7365 AC_DEFINE([HAVE_STRUCT_ATTRIBUTE_ALIGNED], [1],
7366 [Define to 1 if 'struct __attribute__ ((aligned (N)))' aligns the
7367 structure to an N-byte boundary.])
7373 AC_CACHE_CHECK([for statement expressions],
7374 [emacs_cv_statement_expressions],
7376 [AC_LANG_PROGRAM([], [[return ({ int x = 5; x-x; });]])],
7377 [emacs_cv_statement_expressions=yes],
7378 [emacs_cv_statement_expressions=no])])
7379 if test "$emacs_cv_statement_expressions" = yes; then
7380 AC_DEFINE([HAVE_STATEMENT_EXPRESSIONS], [1],
7381 [Define to 1 if statement expressions work.])
7384 if test "${GNU_MALLOC}" = "yes" ; then
7385 AC_DEFINE([GNU_MALLOC], [1],
7386 [Define to 1 if you want to use the GNU memory allocator.])
7390 if test "${REL_ALLOC}" = "yes" ; then
7391 AC_DEFINE([REL_ALLOC], [1],
7392 [Define REL_ALLOC if you want to use the relocating allocator for
7395 test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
7397 AC_SUBST([RALLOC_OBJ])
7399 if test "$opsys" = "cygwin"; then
7400 CYGWIN_OBJ="cygw32.o"
7401 ## Cygwin differs because of its unexec().
7403 POST_ALLOC_OBJ=lastfile.o
7404 elif test "$opsys" = "mingw32"; then
7407 POST_ALLOC_OBJ=lastfile.o
7410 PRE_ALLOC_OBJ=lastfile.o
7413 AC_SUBST([CYGWIN_OBJ])
7414 AC_SUBST([PRE_ALLOC_OBJ])
7415 AC_SUBST([POST_ALLOC_OBJ])
7417 dnl Call this 'FORTIFY_SOUR' so that it sorts before the 'FORTIFY_SOURCE'
7418 dnl verbatim defined above. The tricky name is apropos, as this hack
7419 dnl makes Fortify go sour!
7420 AH_VERBATIM([FORTIFY_SOUR],
7421 [/* Without the following workaround, Emacs runs slowly on OS X 10.8.
7422 The workaround disables some useful run-time checking, so it
7423 should be conditional to the platforms with the performance bug.
7424 Perhaps Apple will fix this some day; also see m4/extern-inline.m4. */
7425 #if defined __APPLE__ && defined __GNUC__
7426 # ifndef _DONT_USE_CTYPE_INLINE_
7427 # define _DONT_USE_CTYPE_INLINE_
7429 # ifndef _FORTIFY_SOURCE
7430 # define _FORTIFY_SOURCE 0
7435 # If user asks to omit features, disable optional features that gnulib
7436 # might otherwise enable.
7437 if test "$with_features" = no && test "$enable_acl" != yes; then
7441 # Configure gnulib. Although this does not affect CFLAGS or LIBS permanently.
7442 # it temporarily reverts them to their pre-pkg-config values,
7443 # because gnulib needs to work with both src (which uses the
7444 # pkg-config stuff) and lib-src (which does not). For example, gnulib
7445 # may need to determine whether CLOCK_TIME_LIB should contain -lrt,
7446 # and it therefore needs to run in an environment where LIBS does not
7447 # already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
7448 # for some package unrelated to lib-src.
7451 CFLAGS=$pre_PKG_CONFIG_CFLAGS
7452 LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
7453 gl_ASSERT_NO_GNULIB_POSIXCHECK
7454 gl_ASSERT_NO_GNULIB_TESTS
7460 # Set up libgmp on Android. Make sure to override what gnulib has
7463 if test "$REALLY_ANDROID" = "yes" && test "$with_libgmp" != "no"; then
7465 ndk_SEARCH_MODULE([libgmp], [LIBGMP], [HAVE_LIBGMP=yes])
7467 if test "$HAVE_LIBGMP" = "yes"; then
7468 SAVE_CFLAGS="$CFLAGS"
7469 CFLAGS="$CFLAGS $LIBGMP_CFLAGS"
7470 unset ac_cv_header_gmp_h
7471 unset ac_cv_header_gmp_gmp_h
7472 AC_CHECK_HEADERS([gmp.h gmp/gmp.h], [break])
7473 CFLAGS="$SAVE_CFLAGS"
7475 GL_GENERATE_GMP_H_CONDITION=
7476 GL_GENERATE_GMP_GMP_H=
7477 GL_GENERATE_GMP_GMP_H_CONDITION=
7478 GL_GENERATE_MINI_GMP_H=
7479 GL_GENERATE_MINI_GMP_H_CONDITION=
7481 if test "$ac_cv_header_gmp_h" != "no" \
7482 || test "$ac_cv_header_gmp_gmp_h" != "no"; then
7484 GL_GENERATE_GMP_H=false
7485 LIBGMP="$LIBGMP_LIBS"
7490 AC_SUBST([LIBGMP_CFLAGS])
7492 # timer_getoverrun needs the same library as timer_settime
7494 LIBS="$LIB_TIMER_TIME $LIBS"
7495 AC_CHECK_FUNCS([timer_getoverrun])
7498 if test "${opsys}" = "mingw32"; then
7499 CPPFLAGS="$CPPFLAGS -DUSE_CRT_DLL=1 -I \${abs_top_srcdir}/nt/inc"
7500 # Remove unneeded switches from the value of CC that goes to Makefiles
7501 CC=`AS_ECHO(["$CC"]) | sed -e "s,$GCC_TEST_OPTIONS,,"`
7505 aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
7507 cygwin) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000" ;;
7510 if test "$HAVE_NS" = "yes"; then
7511 libs_nsgui="-framework AppKit"
7512 if test "$NS_IMPL_COCOA" = "yes"; then
7513 libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon \
7514 -framework IOSurface -framework QuartzCore"
7515 if test "$emacs_cv_macosx_12_0" = "yes"; then
7516 libs_nsgui="$libs_nsgui -framework UniformTypeIdentifiers"
7522 LD_SWITCH_SYSTEM_TEMACS=$libs_nsgui
7523 ## The -headerpad option tells ld (see man page) to leave room at the
7524 ## end of the header for adding load commands. Needed for dumping.
7525 ## 0x1000 is enough for roughly 52 load commands on the x86_64
7526 ## architecture (where they are 78 bytes each). The actual number of
7527 ## load commands added is not consistent but normally ranges from
7528 ## about 14 to about 34. Setting it high gets us plenty of slop and
7529 ## only costs about 1.5K of wasted binary space.
7530 headerpad_extra=1000
7531 if test "$with_unexec" = yes; then
7532 LD_SWITCH_SYSTEM_TEMACS="-fno-pie $LD_SWITCH_SYSTEM_TEMACS -Xlinker -headerpad -Xlinker $headerpad_extra"
7535 ## This is here because src/Makefile.in did some extra fiddling around
7536 ## with LD_SWITCH_SYSTEM. It seems cleaner to put this in
7537 ## LD_SWITCH_SYSTEM_TEMACS instead,
7538 test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
7539 LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
7542 ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
7543 ## find X at run-time.
7544 ## When handled by cpp, this was in LD_SWITCH_SYSTEM. However, at the
7545 ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
7546 ## had not yet been defined and was expanded to null. Hence LD_SWITCH_SYSTEM
7547 ## had different values in configure (in ac_link) and src/Makefile.in.
7548 ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
7549 gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
7552 ## Is it any better under MinGW64 to relocate emacs into higher addresses?
7553 ## If the values of -image-base are modified, the corresponding
7554 ## values of DEFAULT_IMAGE_BASE in w32fns.c should be kept in sync.
7555 case "$canonical" in
7556 x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x400000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
7557 *) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
7559 ## If they want unexec, disable Windows ASLR for the Emacs binary
7560 if test "$with_dumping" = "unexec"; then
7561 case "$canonical" in
7562 x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -Wl,-disable-dynamicbase -Wl,-disable-high-entropy-va -Wl,-default-image-base-low" ;;
7563 *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -Wl,-disable-dynamicbase" ;;
7568 *) LD_SWITCH_SYSTEM_TEMACS= ;;
7571 # -no-pie or -nopie fixes a temacs segfault on Gentoo, OpenBSD,
7572 # Ubuntu, and other systems with "hardened" GCC configurations for
7573 # some reason (Bug#18784). We don't know why this works, but not
7574 # segfaulting is better than segfaulting. Use ac_c_werror_flag=yes
7575 # when trying the option, otherwise clang keeps warning that it does
7576 # not understand it, and pre-4.6 GCC has a similar problem
7577 # (Bug#20338). Prefer -no-pie to -nopie, as -no-pie is the
7578 # spelling used by GCC 6.1.0 and later (Bug#24682).
7580 [for $CC option to disable position independent executables],
7581 [emacs_cv_prog_cc_no_pie],
7582 [if test $with_unexec = no; then
7583 emacs_cv_prog_cc_no_pie='not needed'
7585 emacs_save_c_werror_flag=$ac_c_werror_flag
7586 emacs_save_LDFLAGS=$LDFLAGS
7587 ac_c_werror_flag=yes
7588 for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do
7589 test $emacs_cv_prog_cc_no_pie = no && break
7590 LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie"
7591 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break])
7593 ac_c_werror_flag=$emacs_save_c_werror_flag
7594 LDFLAGS=$emacs_save_LDFLAGS
7596 case $emacs_cv_prog_cc_no_pie in
7598 LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie"
7602 if test x$ac_enable_profiling != x ; then
7604 *freebsd | gnu-linux) ;;
7605 *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -pg" ;;
7609 LD_SWITCH_SYSTEM_TEMACS="$LDFLAGS_NOCOMBRELOC $LD_SWITCH_SYSTEM_TEMACS"
7611 AC_SUBST([LD_SWITCH_SYSTEM_TEMACS])
7613 ## Common for all window systems
7614 if test "$window_system" != "none"; then
7615 AC_DEFINE([HAVE_WINDOW_SYSTEM], [1], [Define if you have a window system.])
7616 AC_DEFINE([POLL_FOR_INPUT], [1],
7617 [Define if you poll periodically to detect C-g.])
7618 WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o"
7620 if test "$window_system" = "x11" || test "$REALLY_ANDROID" = "yes"; then
7621 AC_DEFINE([HAVE_TEXT_CONVERSION], [1],
7622 [Define if the window system has text conversion support.])
7623 WINDOW_SYSTEM_OBJ="$WINDOW_SYSTEM_OBJ textconv.o"
7627 AC_SUBST([WINDOW_SYSTEM_OBJ])
7629 # Some systems have MB_CUR_MAX defined to a call to
7630 # __ctype_get_mb_cur_max, but do not have __ctype_get_mb_cur_max in
7631 # libc. Check for that situation and define MB_CUR_MAX to something
7634 AC_CHECK_FUNC([__ctype_get_mb_cur_max])
7636 AC_CACHE_CHECK([whether MB_CUR_MAX is defined to function that won't link],
7637 [emacs_cv_broken_mb_cur_max],
7638 [AC_EGREP_CPP(__ctype_get_mb_cur_max, [
7641 #define MB_CUR_MAX -1
7643 static int foo = MB_CUR_MAX;
7644 ], [AS_IF([test "$ac_cv_func___ctype_get_mb_cur_max" = "yes"],
7645 [emacs_cv_broken_mb_cur_max=no],
7646 [emacs_cv_broken_mb_cur_max=yes])],
7647 [emacs_cv_broken_mb_cur_max=no])])
7649 AS_IF([test "$emacs_cv_broken_mb_cur_max" = "yes"],
7650 # Define this to 4, which is right for Android.
7651 [AS_CASE([$opsys], [android],
7652 [AC_DEFINE([REPLACEMENT_MB_CUR_MAX], [4],
7653 [Define to MB_CUR_MAX if stdlib.h is broken.])],
7654 [AC_MSG_ERROR([MB_CUR_MAX does not work on your system.
7655 Please modify configure.ac to set an appropriate value, then
7656 send your change to bug-gnu-emacs@gnu.org])])])
7658 AH_TOP([/* GNU Emacs site configuration template file.
7660 Copyright (C) 1988-2024 Free Software Foundation, Inc.
7662 This file is part of GNU Emacs.
7664 GNU Emacs is free software: you can redistribute it and/or modify
7665 it under the terms of the GNU General Public License as published by
7666 the Free Software Foundation, either version 3 of the License, or (at
7667 your option) any later version.
7669 GNU Emacs is distributed in the hope that it will be useful,
7670 but WITHOUT ANY WARRANTY; without even the implied warranty of
7671 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7672 GNU General Public License for more details.
7674 You should have received a copy of the GNU General Public License
7675 along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
7678 /* No code in Emacs #includes config.h twice, but some bits of code
7679 intended to work with other packages as well (like gmalloc.c)
7680 think they can include it as many times as they like. */
7681 #ifndef EMACS_CONFIG_H
7682 #define EMACS_CONFIG_H
7685 AH_BOTTOM([#include <conf_post.h>
7687 #endif /* EMACS_CONFIG_H */
7696 #### Report on what we decided to do.
7697 #### Report GTK as a toolkit, even if it doesn't use Xt.
7698 #### It makes printing result more understandable as using GTK sets
7699 #### toolkit_scroll_bars to yes by default.
7700 if test "${HAVE_GTK}" = "yes"; then
7701 USE_X_TOOLKIT="$USE_GTK_TOOLKIT"
7704 if test $USE_ACL -ne 0; then
7706 test "$LIB_ACL" && ACL_SUMMARY="$ACL_SUMMARY $LIB_ACL"
7707 test "$LIB_XATTR" && ACL_SUMMARY="$ACL_SUMMARY $LIB_XATTR"
7712 if test -z "$GMP_H"; then
7718 emacs_standard_dirs='Standard dirs'
7720 Configured for '${canonical}'.
7722 Where should the build process find the source code? ${srcdir}
7723 What compiler should emacs be built with? ${CC} ${CFLAGS}
7724 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
7725 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
7726 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
7727 What window system should Emacs use? ${window_system}
7728 What toolkit should Emacs use? ${USE_X_TOOLKIT}
7729 Where do we find X Windows header files? ${x_includes:-$emacs_standard_dirs}
7730 Where do we find X Windows libraries? ${x_libraries:-$emacs_standard_dirs}"])
7732 #### Please respect alphabetical ordering when making additions.
7734 emacs_config_features=
7735 for opt in ACL BE_APP CAIRO DBUS FREETYPE GCONF GIF GLIB GMP GNUTLS GPM GSETTINGS \
7736 HARFBUZZ IMAGEMAGICK JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 \
7737 M17N_FLT MODULES NATIVE_COMP NOTIFY NS OLDXMENU PDUMPER PGTK PNG RSVG SECCOMP \
7738 SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER \
7739 UNEXEC WEBP X11 XAW3D XDBE XFT XIM XINPUT2 XPM XWIDGETS X_TOOLKIT \
7743 PDUMPER) val=${with_pdumper} ;;
7744 UNEXEC) val=${with_unexec} ;;
7745 GLIB) val=${emacs_cv_links_glib} ;;
7746 NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;;
7747 TOOLKIT_SCROLL_BARS|X_TOOLKIT) eval val=\${USE_$opt} ;;
7748 THREADS) val=${threads_enabled} ;;
7749 *) eval val=\${HAVE_$opt} ;;
7752 xno|xnone|x) continue ;;
7757 GTK*|LUCID|MOTIF) opt=$val ;;
7763 *lkqueue*) opt="$opt LIBKQUEUE" ;;
7764 *kqueue*) opt="$opt KQUEUE" ;;
7765 *inotify*) opt="$opt INOTIFY" ;;
7766 *gfile*) opt="$opt GFILENOTIFY" ;;
7767 *w32*) opt="$opt W32NOTIFY" ;;
7771 AS_VAR_APPEND([emacs_config_features], ["$optsep$opt"])
7774 AC_DEFINE_UNQUOTED([EMACS_CONFIG_FEATURES], ["${emacs_config_features}"],
7775 [Summary of some of the main features enabled by configure.])
7777 # This is just a printable representation of the shared user ID.
7778 android_shared_user=
7779 AS_IF([test -n "$with_shared_user_id"],[android_shared_user="($with_shared_user_id)"])
7781 AS_ECHO([" Does Emacs use -lXaw3d? ${HAVE_XAW3D}
7782 Is Emacs being built for Android? ${ANDROID} ${android_shared_user}
7783 Does Emacs use the X Double Buffer Extension? ${HAVE_XDBE}
7784 Does Emacs use -lXpm? ${HAVE_XPM}
7785 Does Emacs use -ljpeg? ${HAVE_JPEG}
7786 Does Emacs use -ltiff? ${HAVE_TIFF}
7787 Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF
7788 Does Emacs use a png library? ${HAVE_PNG} $LIBPNG
7789 Does Emacs use -lrsvg-2? ${HAVE_RSVG}
7790 Does Emacs use -lwebp? ${HAVE_WEBP}
7791 Does Emacs use -lsqlite3? ${HAVE_SQLITE3}
7792 Does Emacs use cairo? ${HAVE_CAIRO}
7793 Does Emacs use -llcms2? ${HAVE_LCMS2}
7794 Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}
7795 Does Emacs use native APIs for images? ${NATIVE_IMAGE_API}
7796 Does Emacs support sound? ${HAVE_SOUND}
7797 Does Emacs use -lgpm? ${HAVE_GPM}
7798 Does Emacs use -ldbus? ${HAVE_DBUS}
7799 Does Emacs use -lgconf? ${HAVE_GCONF}
7800 Does Emacs use GSettings? ${HAVE_GSETTINGS}
7801 Does Emacs use a file notification library? ${NOTIFY_SUMMARY}
7802 Does Emacs use access control lists? ${ACL_SUMMARY}
7803 Does Emacs use -lselinux? ${HAVE_LIBSELINUX}
7804 Does Emacs use -lgnutls? ${HAVE_GNUTLS}
7805 Does Emacs use -lxml2? ${HAVE_LIBXML2}
7806 Does Emacs use -lfreetype? ${HAVE_FREETYPE}
7807 Does Emacs use HarfBuzz? ${HAVE_HARFBUZZ}
7808 Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}
7809 Does Emacs use -lotf? ${HAVE_LIBOTF}
7810 Does Emacs use -lxft? ${HAVE_XFT}
7811 Does Emacs use -lsystemd? ${HAVE_LIBSYSTEMD}
7812 Does Emacs use -ltree-sitter? ${HAVE_TREE_SITTER}
7813 Does Emacs use the GMP library? ${HAVE_GMP}
7814 Does Emacs directly use zlib? ${HAVE_ZLIB}
7815 Does Emacs have dynamic modules support? ${HAVE_MODULES}
7816 Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}
7817 Does Emacs support Xwidgets? ${HAVE_XWIDGETS}
7818 Does Emacs have threading support in lisp? ${threads_enabled}
7819 Does Emacs support the portable dumper? ${with_pdumper}
7820 Does Emacs support legacy unexec dumping? ${with_unexec}
7821 Which dumping strategy does Emacs use? ${with_dumping}
7822 Does Emacs have native lisp compiler? ${HAVE_NATIVE_COMP}
7823 Does Emacs use version 2 of the X Input Extension? ${HAVE_XINPUT2}
7824 Does Emacs generate a smaller-size Japanese dictionary? ${with_small_ja_dic}
7827 if test -n "${EMACSDATA}"; then
7828 AS_ECHO([" Environment variable EMACSDATA set to: $EMACSDATA"])
7830 if test -n "${EMACSDOC}"; then
7831 AS_ECHO([" Environment variable EMACSDOC set to: $EMACSDOC"])
7836 if test "$HAVE_NS" = "yes"; then
7838 AS_ECHO(["Run '${MAKE-make}' to build Emacs, then run 'src/emacs' to test it.
7839 Run '${MAKE-make} install' in order to build an application bundle.
7840 The application will go to nextstep/Emacs.app and can be run or moved
7842 if test "$EN_NS_SELF_CONTAINED" = "yes"; then
7843 echo "The application will be fully self-contained."
7845 AS_ECHO(["The lisp resources for the application will be installed under ${prefix}.
7846 You may need to run \"${MAKE-make} install\" with sudo. The application will fail
7847 to run if these resources are not installed."])
7852 case $opsys,$emacs_uname_r in
7854 AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]])
7857 cygwin,3.0.[[0-7]]'('* | cygwin,3.1.[[0-2]]'('*)
7858 AC_DEFINE([HAVE_CYGWIN_O_PATH_BUG], [1],
7859 [Define to 1 if opening a FIFO, socket, or symlink with O_PATH is buggy.]);;
7862 # Remove any trailing slashes in these variables.
7864 */) prefix=`AS_DIRNAME(["$prefix."])`;;
7866 case $exec_prefix in
7867 */) exec_prefix=`AS_DIRNAME(["$exec_prefix."])`;;
7870 if test "$HAVE_NS" = "yes"; then
7871 if test "$NS_IMPL_GNUSTEP" = yes; then
7872 AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \
7873 nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in])
7874 ns_check_file=Resources/Info-gnustep.plist
7876 AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \
7877 nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in])
7878 ns_check_file=Contents/Info.plist
7880 AC_SUBST([ns_check_file])
7883 AC_CONFIG_FILES([Makefile lib/gnulib.mk])
7885 dnl config.status treats $srcdir specially, so I think this is ok...
7886 ARCH_INDEPENDENT_CONFIG_FILES([$srcdir/doc/man/emacs.1])
7888 AC_CONFIG_FILES([lib/Makefile lib-src/Makefile oldXMenu/Makefile src/Makefile
7889 lwlib/Makefile nextstep/Makefile nt/Makefile])
7890 ARCH_INDEPENDENT_CONFIG_FILES([doc/emacs/Makefile doc/misc/Makefile
7891 doc/lispintro/Makefile doc/lispref/Makefile
7892 lisp/Makefile leim/Makefile])
7894 SUBDIR_MAKEFILES="lib/Makefile lib-src/Makefile oldXMenu/Makefile src/Makefile lwlib/Makefile nextstep/Makefile nt/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile lisp/Makefile leim/Makefile"
7896 dnl The test/ directory is missing if './make-dist --no-tests' was used.
7897 opt_makefile=test/Makefile
7898 if test -f "$srcdir/$opt_makefile.in"; then
7899 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
7900 dnl Again, it's best not to use a variable. Though you can add
7901 dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
7902 ARCH_INDEPENDENT_CONFIG_FILES([test/Makefile])
7903 ARCH_INDEPENDENT_CONFIG_FILES([test/manual/noverlay/Makefile])
7905 opt_makefile=test/infra/Makefile
7906 if test -f "$srcdir/$opt_makefile.in"; then
7907 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
7908 dnl Again, it's best not to use a variable. Though you can add
7909 dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
7910 ARCH_INDEPENDENT_CONFIG_FILES([test/infra/Makefile])
7913 if test "$ANDROID" = "yes"; then
7914 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES java/Makefile cross/Makefile"
7917 dnl The admin/ directory used to be excluded from tarfiles.
7918 if test -d $srcdir/admin; then
7919 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES admin/charsets/Makefile admin/unidata/Makefile admin/grammars/Makefile"
7920 ARCH_INDEPENDENT_CONFIG_FILES([admin/charsets/Makefile])
7921 ARCH_INDEPENDENT_CONFIG_FILES([admin/unidata/Makefile])
7922 ARCH_INDEPENDENT_CONFIG_FILES([admin/grammars/Makefile])
7926 SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
7928 AC_SUBST([SUBDIR_MAKEFILES_IN])
7930 SMALL_JA_DIC=$with_small_ja_dic
7931 AC_SUBST([SMALL_JA_DIC])
7933 dnl The following commands are run on the build system when building
7936 if test "$XCONFIGURE" != "android"; then
7937 dnl You might wonder (I did) why epaths.h is generated by running
7938 dnl make, rather than just letting configure generate it from
7939 dnl epaths.in. One reason is that the various paths are not fully
7940 dnl expanded (see above); e.g.,
7941 dnl gamedir='${localstatedir}/games/emacs'. Secondly, the GNU
7942 dnl Coding standards require that one should be able to run 'make
7943 dnl prefix=/some/where/else' and override the values set by
7944 dnl configure. This also explains the 'move-if-change' test and the
7945 dnl use of force in the 'epaths-force' rule in Makefile.in.
7946 AC_CONFIG_COMMANDS([src/epaths.h], [
7947 if test "${opsys}" = "mingw32"; then
7948 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force-w32
7949 elif test "$HAVE_NS" = "yes" && test "$EN_NS_SELF_CONTAINED" = "yes"; then
7950 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force-ns-self-contained
7952 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
7953 fi || AC_MSG_ERROR(['src/epaths.h' could not be made.])
7954 ], [GCC="$GCC" CPPFLAGS="$CPPFLAGS" opsys="$opsys" HAVE_NS="$HAVE_NS"
7955 EN_NS_SELF_CONTAINED="$EN_NS_SELF_CONTAINED"])
7957 dnl NB we have to cheat and use the ac_... version because abs_top_srcdir
7958 dnl is not yet set, sigh. Or we could use ../$srcdir/src/.gdbinit,
7960 AC_CONFIG_COMMANDS([src/.gdbinit], [
7961 if test ! -f src/.gdbinit && test -f "$srcdir/src/.gdbinit"; then
7962 AS_ECHO(["source $ac_abs_top_srcdir/src/.gdbinit"]) > src/.gdbinit
7966 dnl Perhaps this would be better named doc-emacs-emacsver.texi?
7967 dnl See comments for etc-refcards-emacsver.tex.
7968 dnl Since we get a doc/emacs directory generated anyway, for the Makefile,
7969 dnl it is not quite the same. But we are generating in $srcdir.
7970 AC_CONFIG_COMMANDS([doc/emacs/emacsver.texi], [
7971 ${MAKE-make} -s --no-print-directory -C doc/emacs doc-emacsver || \
7972 AC_MSG_ERROR(['doc/emacs/emacsver.texi' could not be made.])
7975 dnl If we give this the more natural name, etc/refcards/emacsver.texi,
7976 dnl then a directory etc/refcards is created in the build directory,
7977 dnl which is probably harmless, but confusing (in out-of-tree builds).
7978 dnl (If we were to generate etc/refcards/Makefile, this might change.)
7979 dnl It is really $srcdir/etc/refcards/emacsver.tex that we generate.
7980 AC_CONFIG_COMMANDS([etc-refcards-emacsver.tex], [
7981 ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \
7982 AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.])
7985 if test $AUTO_DEPEND = yes; then
7986 for dir in $AUTODEPEND_PARENTS; do
7987 AS_MKDIR_P([$dir/deps])
7988 AS_MKDIR_P([cross/$dir/deps])
7991 if $gl_gnulib_enabled_dynarray || $gl_gnulib_enabled_scratch_buffer; then
7992 AS_MKDIR_P([lib/malloc])
7993 AS_MKDIR_P([cross/lib/malloc])
7994 if test $AUTO_DEPEND = yes; then
7995 AS_MKDIR_P([lib/deps/malloc])
7996 AS_MKDIR_P([cross/lib/deps/malloc])
8000 dnl Make cross/lib, which various Makefiles in cross expect to
8002 AS_MKDIR_P([cross/lib])
8003 AS_MKDIR_P([cross/lib/malloc])
8004 AS_MKDIR_P([cross/lib/sys])
8005 AS_MKDIR_P([cross/lib-src])
8007 dnl Make cross/etc; this directory will hold the documentation file
8008 dnl holding doc strings for Android specific C files that aren't
8009 dnl built during the initial compilation of Emacs for the build
8011 AS_MKDIR_P([cross/etc])
8013 AS_IF([test "x$with_android" != "xno"], [
8014 dnl Link gnulib files to cross/lib as well. af_alg.h and
8015 dnl lib/save-cwd.h are copied manually from gnulib, and as such
8016 dnl aren't specified in gl_FILE_LIST.
8017 emacs_files='gl_FILE_LIST lib/af_alg.h lib/save-cwd.h'
8018 dnl These files are specific to Emacs.
8019 emacs_files="$emacs_files lib/fingerprint.c lib/fingerprint.h \
8020 lib/save-cwd.c lib/openat-die.c lib/save-cwd.c \
8022 for file in $emacs_files; do
8023 AS_IF([expr "X${file}J" : "Xlib/.*[[ch]]J" >/dev/null],
8024 [AS_IF([test -f "$srcdir/$file"],
8025 [AC_CONFIG_LINKS([cross/$file:$file])])])
8029 # Make java/Makefile
8030 ARCH_INDEPENDENT_CONFIG_FILES([java/Makefile])
8031 ARCH_INDEPENDENT_CONFIG_FILES([cross/Makefile])
8033 # Make java/AndroidManifest.xml
8034 ARCH_INDEPENDENT_CONFIG_FILES([java/AndroidManifest.xml])
8036 # Make ndk-build Makefiles. This is only done inside the recursive
8042 if test ! "$with_mailutils"; then
8043 if test "$with_pop" = yes; then
8044 AC_MSG_WARN([This configuration installs a 'movemail' program
8045 that retrieves POP3 email via only insecure channels.
8046 To omit insecure POP3, you can use '$0 --without-pop'.])
8047 elif test "$with_pop" = no-by-default; then
8048 AC_MSG_WARN([This configuration installs a 'movemail' program
8049 that does not retrieve POP3 email. By default, Emacs 25 and earlier
8050 installed a 'movemail' program that retrieved POP3 email via only
8051 insecure channels, a practice that is no longer recommended but that
8052 you can continue to support by using '$0 --with-pop'.])
8057 # Don't suggest GNU Mailutils, as it hasn't been ported.
8060 emacs_fix_movemail="use '$0 --with-mailutils'"
8061 case `(movemail --version) 2>/dev/null` in
8063 *) emacs_fix_movemail="install GNU Mailutils
8064 <https://mailutils.org> and $emacs_fix_movemail";;
8066 AC_MSG_NOTICE([You might want to $emacs_fix_movemail.]);;
8070 if test "${HAVE_XFT}" = yes; then
8071 AC_MSG_WARN([This configuration uses libXft, which has a number of
8072 font rendering issues, and is being considered for removal in the
8073 next release of Emacs. Please consider using Cairo graphics +
8074 HarfBuzz text shaping instead (they are auto-detected if the
8075 relevant development headers are installed).])
8078 if test "${HAVE_CAIRO}" = "yes" && test "${HAVE_HARFBUZZ}" = no; then
8079 AC_MSG_WARN([This configuration uses the Cairo graphics library,
8080 but not the HarfBuzz font shaping library (minimum version $harfbuzz_required_ver).
8081 We recommend the use of HarfBuzz when using Cairo, please install
8082 appropriate HarfBuzz development packages.])
8085 # Let plain 'make' work.
8086 test "$MAKE" = make || test -f makefile || cat >makefile <<EOF
8090 \$(MAKE) -f Makefile \$?
8092 \$(MAKE) -f Makefile \$<