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 AC_ARG_ENABLE([gc-mark-trace],
786 [AS_HELP_STRING([--disable-gc-mark-trace],
787 [disable the mark trace buffer used for debugging the Emacs
788 garbage collector])],
789 [ac_enable_gc_mark_trace="${enableval}"],
790 [ac_enable_gc_mark_trace=yes])
791 if test "x$ac_enable_gc_mark_trace" = xyes ; then
792 AC_DEFINE([GC_REMEMBER_LAST_MARKED], [1],
793 [Define to 1 to enable GC mark trace buffer.])
796 dnl The name of this option is unfortunate. It predates, and has no
797 dnl relation to, the "sampling-based elisp profiler" added in 24.3.
798 dnl Actually, it stops it working.
799 dnl https://lists.gnu.org/r/emacs-devel/2012-11/msg00393.html
800 AC_ARG_ENABLE([profiling],
801 [AS_HELP_STRING([--enable-profiling],
802 [build emacs with low-level, gprof profiling support.
803 Mainly useful for debugging Emacs itself. May not work on
804 all platforms. Stops profiler.el working.])],
805 [ac_enable_profiling="${enableval}"],[])
806 if test x$ac_enable_profiling != x ; then
807 PROFILING_CFLAGS="-DPROFILING=1 -pg"
811 AC_SUBST([PROFILING_CFLAGS])
813 AC_ARG_ENABLE([autodepend],
814 [AS_HELP_STRING([--enable-autodepend],
815 [automatically generate dependencies to .h-files.
816 Requires gcc, enabled if found.])],
817 [ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes])
819 AC_ARG_ENABLE([gtk-deprecation-warnings],
820 [AS_HELP_STRING([--enable-gtk-deprecation-warnings],
821 [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])],
822 [ac_enable_gtk_deprecation_warnings="${enableval}"],[])
825 AC_ARG_ENABLE([build-details],
826 [AS_HELP_STRING([--disable-build-details],
827 [Make the build more deterministic by omitting host
828 names, time stamps, etc. from the output.])],
829 [test "$enableval" = no && BUILD_DETAILS=--no-build-details])
830 AC_SUBST([BUILD_DETAILS])
832 # JAVA_PUSH_LINT(OPT)
833 # -------------------
834 # Check if javac supports the diagnostic flag -Xlint:OPT.
835 # If it does, add it to WARN_JAVAFLAGS.
837 AC_DEFUN([JAVA_PUSH_LINT],
839 AC_CACHE_CHECK([whether Java compiler accepts -Xlint:$1],
840 [emacs_cv_javac_knows_lint_$1],
841 AS_IF([rm -f conftest.class
842 cat << EOF > conftest.java
850 ("$JAVAC" -Xlint:$1 conftest.java 2>&AS_MESSAGE_LOG_FD) \
851 && rm -f conftest.class], [emacs_cv_javac_knows_lint_$1=yes],
852 [emacs_cv_javac_knows_lint_$1=no]))
854 AS_IF([test "$emacs_cv_javac_knows_lint_$1" = "yes"],
855 [WARN_JAVAFLAGS="$WARN_JAVAFLAGS -Xlint:$1"])
858 # Start Android configuration. This is done in three steps:
860 # First, the SDK tools needed to build the Android package on the host
863 # Then, configure is called inside itself with the NDK C and C++
864 # compilers, and the Makefiles generated, along with config.h, are
865 # renamed to end with .android.
867 # Finally, configure continues to configure the Emacs binary that will
880 ANDROID_SHARED_USER_ID=
881 ANDROID_SHARED_USER_NAME=
884 # This is a list of Makefiles that have alternative versions for
886 android_makefiles="lib/Makefile lib/gnulib.mk lib-src/Makefile src/Makefile"
888 # This is whether or not to package mailutils into the executable.
891 AC_ARG_VAR([ANDROID_CC], [The Android C cross-compiler.])
892 AC_ARG_VAR([SDK_BUILD_TOOLS], [Name of directory holding Android SDK build-tools.])
893 AC_ARG_VAR([ANDROID_CFLAGS], [Flags given to the Android C cross-compiler.])
894 AC_ARG_VAR([JAVAC], [Java compiler path. Used for Android.])
895 AC_ARG_VAR([JARSIGNER], [Java package signer path. Used for Android.])
896 AC_ARG_VAR([APKSIGNER], [Android package signer path. Used for Android.])
897 AC_ARG_VAR([SDK_BUILD_TOOLS], [Path to the Android SDK build tools.])
898 AC_ARG_VAR([ZIP], [Path to the `zip' utility.])
900 if test "$with_android" = "yes"; then
901 AC_MSG_ERROR([Please specify the path to the Android.jar file, like so:
903 ./configure --with-android=/path/to/android.jar
905 along with the path to the SDK build-tools (this is the directory with
906 tools such as aapt, dx, and aidl):
908 SDK_BUILD_TOOLS=/path/to/sdk-build-tools
910 The cross-compiler should then be specified:
912 ANDROID_CC=/path/to/armv7a-linux-androideabi19-clang
914 In addition, you may pass any special arguments to the cross-compiler
915 via the ANDROID_CFLAGS environment variable.])
916 elif test "$with_android" = "no" || test "$with_android" = ""; then
919 AC_CHECK_PROGS([JAVAC], [javac])
920 if test "$JAVAC" = ""; then
921 AC_MSG_ERROR([The Java compiler required to build Emacs was not found.
922 Please make sure `javac' can be found on your path, or alternatively specify
923 the path to your Java compiler before configuring Emacs, like so:
925 JAVAC=/opt/jdk/bin/javac ./configure --with-android])
928 AC_CHECK_PROGS([JARSIGNER], [jarsigner])
929 if test "$JARSIGNER" = ""; then
930 AC_MSG_ERROR([The Java package signing utility was not found.
931 Please make sure `jarsigner' can be found on your path, or alternatively
932 specify its location before configuring Emacs, like so:
934 JARSIGNER=/opt/jdk/bin/jarsigner ./configure --with-android])
937 AC_CACHE_CHECK([whether the Java compiler works],
938 [emacs_cv_working_javac],
939 AS_IF([rm -f conftest.class
940 cat << EOF > conftest.java
942 import android.app.Activity;
943 import android.os.Bundle;
945 class conftest extends Activity
949 onCreate (Bundle savedInstanceState)
951 super.onCreate (savedInstanceState);
956 ("$JAVAC" -classpath "$with_android" -target 1.7 -source 1.7 conftest.java \
957 -d . >&AS_MESSAGE_LOG_FD 2>&1) && test -s conftest.class && rm -f conftest.class],
958 [emacs_cv_working_javac=yes],
959 [emacs_cv_working_javac=no]))
961 if test "$emacs_cv_working_javac" = "no"; then
962 AC_MSG_ERROR([The Java compiler does not work, or you did not specify
963 a valid path to android.jar. See config.log for more details.])
966 AC_CACHE_CHECK([whether android.jar is new enough],
967 [emacs_cv_android_v_or_later],
968 AS_IF([rm -f conftest.class
969 cat << EOF > conftest.java
971 import android.os.Build;
975 private static int test = Build.VERSION_CODES.VANILLA_ICE_CREAM;
979 ("$JAVAC" -classpath "$with_android" -target 1.7 -source 1.7 conftest.java \
980 -d . >&AS_MESSAGE_LOG_FD 2>&1) && test -s conftest.class && rm -f conftest.class],
981 [emacs_cv_android_v_or_later=yes],
982 [emacs_cv_android_v_or_later=no]))
984 if test "$emacs_cv_android_v_or_later" = "no"; then
985 AC_MSG_ERROR([Emacs must be built with an android.jar file produced for \
986 Android 15 (Vanilla Ice Cream) or later.])
989 dnl See if the Java compiler supports the `--release' option which
990 dnl makes it check for and prevent using features introduced after
993 AC_CACHE_CHECK([whether javac accepts --release 7],
994 [emacs_cv_javac_release_7], AS_IF([rm -f conftest.class
995 cat << EOF > conftest.java
1003 ("$JAVAC" --release 7 conftest.java 2>&AS_MESSAGE_LOG_FD) \
1004 && rm -f conftest.class],
1005 [emacs_cv_javac_release_7=yes],
1006 [emacs_cv_javac_release_7=no]))
1008 if test "$emacs_cv_javac_release_7" = "yes"; then
1009 WARN_JAVAFLAGS="$WARN_JAVAFLAGS --release 7"
1011 dnl If not, just make sure the generated bytecode is correct.
1012 WARN_JAVAFLAGS="$WARN_JAVAFLAGS -target 1.7 -source 1.7"
1015 dnl Enable some useful Java linting options.
1016 JAVA_PUSH_LINT([deprecation])
1017 JAVA_PUSH_LINT([cast])
1018 JAVA_PUSH_LINT([divzero])
1019 JAVA_PUSH_LINT([nonempty])
1020 JAVA_PUSH_LINT([empty])
1021 JAVA_PUSH_LINT([finally])
1022 JAVA_PUSH_LINT([overrides])
1023 JAVA_PUSH_LINT([path])
1024 JAVA_PUSH_LINT([serial])
1025 JAVA_PUSH_LINT([unchecked])
1027 # Get the name of the android.jar file.
1028 ANDROID_JAR="$with_android"
1030 # Substitute this into java/Makefile.
1031 AC_SUBST([WARN_JAVAFLAGS])
1033 AC_PATH_PROGS([AAPT], [aapt], [], "${SDK_BUILD_TOOLS}:$PATH")
1034 if test "$AAPT" = ""; then
1035 AC_MSG_ERROR([The Android asset packaging tool was not found.
1036 Please verify that the path to the SDK build tools you specified is correct])
1039 AC_PATH_PROGS([APKSIGNER], [apksigner], [], "${SDK_BUILD_TOOLS}:$PATH")
1040 if test "$APKSIGNER" = ""; then
1041 AC_MSG_ERROR([The Android package signing tool was not found.
1042 Please verify that the path to the SDK build tools you specified is correct])
1045 AC_PATH_PROGS([D8], [d8], [], "${SDK_BUILD_TOOLS}:$PATH")
1046 if test "$D8" = ""; then
1047 AC_MSG_ERROR([The Android dexer was not found.
1048 Please verify that the path to the SDK build tools you specified is correct])
1051 # Locate any d8.jar within the SDK build tools directory. The R8
1052 # optimizing compiler is also present in this bundle, and it generates
1053 # far superior code.
1054 emacs_val=`which $D8`
1055 emacs_val=`AS_DIRNAME([$emacs_val])`/lib/d8.jar
1056 AS_IF([test -f "$emacs_val"],
1057 [AC_CACHE_CHECK([whether d8.jar coresident with d8 binary provides r8],
1058 [emacs_cv_d8_provides_r8],
1059 [AS_IF([java -cp "$emacs_val" com.android.tools.r8.R8 --help &>/dev/null],
1060 [emacs_cv_d8_provides_r8=yes], [emacs_cv_d8_provides_r8=no])])])
1061 AS_IF([test "$emacs_cv_d8_provides_r8" = "yes"],
1062 # And substitute it for D8 if present.
1063 [D8="java -cp $emacs_val com.android.tools.r8.R8"
1066 AC_PATH_PROGS([ZIPALIGN], [zipalign], [], "${SDK_BUILD_TOOLS}:$PATH")
1067 if test "ZIPALIGN" = ""; then
1068 AC_MSG_ERROR([The Android ZIP archive alignment utility was not found.
1069 Please verify that the path to the SDK build tools you specified is correct]);
1072 dnl Now configure Emacs to generate binaries for Android. After the
1073 dnl configuration completes, move the generated Makefiles.
1075 if test "$ANDROID_CC" = ""; then
1076 AC_MSG_ERROR([Please specify the path to the Android cross-compiler
1077 for your machine. For example:
1079 ANDROID_CC=/path/to/armv7a-linux-androideabi19-clang \\
1080 ./configure --with-android])
1083 dnl Obtain the cross compiler's target to find out where binaries go
1084 dnl in the resulting package.
1086 AC_MSG_CHECKING([for the kind of Android system Emacs is being built for])
1087 cc_target=`${ANDROID_CC} -v 2>&1 | sed -n 's/Target: //p'`
1088 case "$cc_target" in
1090 *i[3-6]86*) android_abi=x86
1092 *x86_64*) android_abi=x86_64
1094 *aarch64*) android_abi=arm64-v8a
1096 *arm*v7a*) android_abi=armeabi-v7a
1098 *mips64*) android_abi=mips64
1100 *mips*) android_abi=mips
1102 *arm*) android_abi=armeabi
1105 *) AC_MSG_ERROR([configure could not determine the type of Android \
1106 binary Emacs is being configured for. Please port this configure script \
1107 to your Android system, or verify that you specified the correct compiler \
1108 in the ANDROID_CC variable when you ran configure.
1110 The compiler target is: $cc_target])
1113 AC_MSG_RESULT([$android_abi])
1115 ANDROID_ABI=$android_abi
1117 dnl Obtain the minimum SDK version of the resulting Emacs binary
1118 dnl built with this NDK.
1121 AC_MSG_CHECKING([for the lowest Android version Emacs can run on])
1122 [android_sdk=`echo "$cc_target" | grep -oE 'android([0-9][0-9]?)'`]
1124 if test -n "$android_sdk"; then
1125 android_sdk=`echo "$android_sdk" | sed -n 's/android//p'`
1126 AC_MSG_RESULT([$android_sdk])
1127 ANDROID_MIN_SDK=$android_sdk
1129 # This is probably GCC.
1130 [ cat << EOF > conftest.c
1131 #include <android/api-level.h>
1132 extern const char *foo;
1137 #if __ANDROID_API__ < 7
1138 foo = "emacs_api_6";
1139 #elif __ANDROID_API__ < 8
1140 foo = "emacs_api_7";
1141 #elif __ANDROID_API__ < 9
1142 foo = "emacs_api_8";
1143 #elif __ANDROID_API__ < 10
1144 foo = "emacs_api_9";
1145 #elif __ANDROID_API__ < 11
1146 foo = "emacs_api_10";
1147 #elif __ANDROID_API__ < 12
1148 foo = "emacs_api_11";
1149 #elif __ANDROID_API__ < 13
1150 foo = "emacs_api_12";
1151 #elif __ANDROID_API__ < 14
1152 foo = "emacs_api_13";
1153 #elif __ANDROID_API__ < 15
1154 foo = "emacs_api_14";
1155 #elif __ANDROID_API__ < 16
1156 foo = "emacs_api_15";
1157 #elif __ANDROID_API__ < 17
1158 foo = "emacs_api_16";
1159 #elif __ANDROID_API__ < 18
1160 foo = "emacs_api_17";
1161 #elif __ANDROID_API__ < 19
1162 foo = "emacs_api_18";
1163 #elif __ANDROID_API__ < 20
1164 foo = "emacs_api_19";
1165 #elif __ANDROID_API__ < 21
1166 foo = "emacs_api_20";
1167 #elif __ANDROID_API__ < 22
1168 foo = "emacs_api_21";
1169 #elif __ANDROID_API__ < 23
1170 foo = "emacs_api_22";
1171 #elif __ANDROID_API__ < 24
1172 foo = "emacs_api_23";
1173 #elif __ANDROID_API__ < 25
1174 foo = "emacs_api_24";
1175 #elif __ANDROID_API__ < 26
1176 foo = "emacs_api_25";
1177 #elif __ANDROID_API__ < 27
1178 foo = "emacs_api_26";
1179 #elif __ANDROID_API__ < 28
1180 foo = "emacs_api_27";
1181 #elif __ANDROID_API__ < 29
1182 foo = "emacs_api_28";
1183 #elif __ANDROID_API__ < 30
1184 foo = "emacs_api_29";
1185 #elif __ANDROID_API__ < 31
1186 foo = "emacs_api_30";
1187 #elif __ANDROID_API__ < 32
1188 foo = "emacs_api_31";
1189 #elif __ANDROID_API__ < 33
1190 foo = "emacs_api_32";
1191 #elif __ANDROID_API__ < 34
1192 foo = "emacs_api_33";
1193 #elif __ANDROID_API__ < 35
1194 foo = "emacs_api_34";
1195 #elif __ANDROID_API__ < 36
1196 foo = "emacs_api_35";
1198 foo = "emacs_api_future";
1203 AC_CACHE_VAL([emacs_cv_android_api],
1204 [$ANDROID_CC $ANDROID_CFLAGS -c conftest.c -o conftest.o \
1205 && emacs_cv_android_api=`grep -ao -E \
1206 "emacs_api_([[0-9][0-9]]?|future)" conftest.o`])
1207 android_sdk="$emacs_cv_android_api"
1208 rm -rf conftest.c conftest.o
1210 # If this version of the NDK requires __ANDROID_API__ to be
1211 # specified, then complain to the user.
1212 if test "$android_sdk" = "emacs_api_future"; then
1213 AC_MSG_ERROR([The version of Android to build for was not specified.
1214 You must tell the Android compiler what version of Android to build for,
1215 by defining the __ANDROID_API__ preprocessor macro in ANDROID_CC, like so:
1217 ANDROID_CC="/path/to/ndk/arm-linux-android-gcc -D__ANDROID_API__=8"])
1220 if test -n "$android_sdk"; then
1221 android_sdk=`echo $android_sdk | sed -n 's/emacs_api_//p'`
1222 AC_MSG_RESULT([$android_sdk])
1223 ANDROID_MIN_SDK=$android_sdk
1225 AC_MSG_RESULT([unknown ($cc_target); assuming 8])
1226 AC_MSG_ERROR([configure could not determine the versions of Android \
1227 a binary built with this compiler will run on. The generated application \
1228 package will likely install on older systems but crash on startup.])
1232 AC_SUBST([ANDROID_MIN_SDK])
1234 # Now tell java/Makefile if Emacs is being built for Android 4.3 or
1236 ANDROID_SDK_18_OR_EARLIER=
1237 if test "$android_sdk" -le "18"; then
1238 ANDROID_SDK_18_OR_EARLIER=yes
1240 AC_SUBST([ANDROID_SDK_18_OR_EARLIER])
1242 # Likewise for Android 2.2.
1243 ANDROID_SDK_8_OR_EARLIER=
1244 if test "$android_sdk" -le "8"; then
1245 ANDROID_SDK_8_OR_EARLIER=yes
1246 AC_CHECK_PROGS([ZIP], [zip])
1247 AS_IF([test -z "$ZIP"],
1248 [AC_MSG_ERROR([The `zip' utility is required for generating \
1249 packages targeting Android 2.2.])])
1251 AC_SUBST([ANDROID_SDK_8_OR_EARLIER])
1254 # Save confdefs.h and config.log for now.
1255 mv -f confdefs.h _confdefs.h
1256 mv -f config.log _config.log
1258 # Make sure these files are removed upon exit.
1259 trap "rm -rf _confdefs.h _config.log" 0
1261 # Figure out what --with-FOO options to pass through.
1262 passthrough="$passthrough --with-png=$with_png"
1263 passthrough="$passthrough --with-webp=$with_webp"
1264 passthrough="$passthrough --with-gif=$with_gif"
1265 passthrough="$passthrough --with-jpeg=$with_jpeg"
1266 passthrough="$passthrough --with-xml2=$with_xml2"
1267 passthrough="$passthrough --with-sqlite3=$with_sqlite3"
1268 passthrough="$passthrough --with-gnutls=$with_gnutls"
1269 passthrough="$passthrough --with-tiff=$with_tiff"
1270 passthrough="$passthrough --with-selinux=$with_selinux"
1271 passthrough="$passthrough --with-modules=$with_modules"
1272 passthrough="$passthrough --with-tree-sitter=$with_tree_sitter"
1273 passthrough="$passthrough --with-imagemagick=$with_imagemagick"
1274 passthrough="$passthrough --with-lcms2=$with_lcms2"
1275 passthrough="$passthrough --with-mailutils=$with_mailutils"
1276 passthrough="$passthrough --with-pop=$with_pop"
1277 passthrough="$passthrough --with-harfbuzz=$with_harfbuzz"
1278 passthrough="$passthrough --with-threads=$with_threads"
1279 passthrough="$passthrough --with-rsvg=$with_rsvg"
1281 # Now pass through some checking-related options.
1282 emacs_val="--enable-check-lisp-object-type=$enable_check_lisp_object_type"
1283 passthrough="$passthrough $emacs_val"
1285 # And derive a name for the recursive configure invocation's cache
1286 # file if one should be specified for this.
1287 AS_IF([test -n "$cache_file" && test "$cache_file" != "/dev/null"],
1288 [passthrough="$passthrough --cache-file=$cache_file.1"])
1290 AS_IF([test "x$with_mailutils" = "xyes"], [emacs_use_mailutils=yes])
1291 AC_SUBST([emacs_use_mailutils])
1293 AS_IF([XCONFIGURE=android ANDROID_CC="$ANDROID_CC" \
1294 ANDROID_SDK="$android_sdk" android_abi=$android_abi \
1295 android_ndk_path="$with_ndk_path" \
1296 android_ndk_cxx="$android_ndk_cxx" \
1297 $CONFIG_SHELL $0 $passthrough], [],
1298 [AC_MSG_ERROR([Failed to cross-configure Emacs for android.])])
1300 # Now set ANDROID to yes.
1303 for makefile in $android_makefiles; do
1304 AC_MSG_NOTICE([Generating $makefile.android])
1305 mv -f "$makefile" "$makefile.android"
1308 AC_MSG_NOTICE([Generating src/config.h.android])
1309 mv -f src/config.h src/config.h.android
1311 # Tell AndroidManifest.xml whether or not Emacs should be built
1313 ANDROID_DEBUGGABLE=false
1314 if test "$with_android_debug" = "yes"; then
1315 ANDROID_DEBUGGABLE=true
1317 AC_SUBST([ANDROID_DEBUGGABLE])
1319 # Move confdefs.h back now that the recursive call to configure is
1321 mv -f _confdefs.h confdefs.h
1323 # Move the Android config.log to config.log.android. */
1324 mv -f config.log config.log.android
1326 # And _config.log back.
1327 mv -f _config.log config.log
1334 AC_SUBST([ZIPALIGN])
1335 AC_SUBST([ANDROID_JAR])
1336 AC_SUBST([ANDROID_ABI])
1337 AC_SUBST([IS_D8_R8])
1339 if test "$XCONFIGURE" = "android"; then
1342 # Enable cross compiling.
1346 AC_SUBST([XCONFIGURE])
1348 if test "$ANDROID" = "yes"; then
1349 # When --with-android is specified, almost all build options must be
1350 # disabled, both within the recursive invocation of configure and
1354 # Some of these dependencies are now supported within Android, so
1355 # they can be enabled.
1356 if test "$XCONFIGURE" != "android"; then
1373 with_native_compilation=no
1387 # zlib is available in android.
1390 dnl This used to use changequote, but, apart from 'changequote is evil'
1391 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
1392 dnl the great gob of text. Thus it's not processed for possible expansion.
1393 dnl Just make sure the brackets remain balanced.
1395 dnl Since Emacs can't find matching pairs of quotes, boundaries are
1396 dnl indicated by comments.
1397 dnl quotation begins
1400 ### If you add support for a new configuration, add code to this
1401 ### switch statement to recognize your configuration name and select
1402 ### the appropriate opsys.
1404 ### As far as handling version numbers on operating systems is
1405 ### concerned, make sure things will fail in a fixable way. If
1406 ### /etc/MACHINES doesn't say anything about version numbers, be
1407 ### prepared to handle anything reasonably. If version numbers
1408 ### matter, be sure /etc/MACHINES says something about it.
1410 opsys='' unported=no
1411 case "${canonical}" in
1418 ## GNU/Linux and similar ports
1433 ## FreeBSD kernel + glibc based userland
1444 *-*-openbsd* | *-*-mirbsd* )
1448 ## Apple Darwin / macOS
1450 case "${canonical}" in
1451 *-apple-darwin[0-9].*) unported=yes ;;
1452 i[3456]86-* | x86_64-* | arm-* | aarch64-* ) ;;
1456 ## FIXME: Find a way to use Fink if available (Bug#11507).
1459 ## Chromium Native Client
1469 ## HP 9000 series 700 and 800, running HP/UX
1470 hppa*-hp-hpux10.2* )
1473 hppa*-hp-hpux1[1-9]* )
1475 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
1479 rs6000-ibm-aix4.[23]* )
1482 powerpc-ibm-aix4.[23]* )
1485 rs6000-ibm-aix[56]* )
1488 powerpc-ibm-aix[5-9]* | powerpc-ibm-aix[1-9][0-9]* )
1493 *-*-solaris* | *-*-sunos*)
1494 case "${canonical}" in
1496 amd64-*-*|x86_64-*-*) ;;
1501 ## Watch out for a compiler that we know will not work.
1502 if [ "$CC" = /usr/ucb/cc ]; then
1503 ## /usr/ucb/cc doesn't work;
1504 ## we should find some other compiler that does work.
1512 test -z "$CC" && CC=qcc
1513 LDFLAGS="-N2M $LDFLAGS"
1520 ## Intel 386 machines where we don't care about the manufacturer.
1522 case "${canonical}" in
1523 *-darwin* ) opsys=darwin ;;
1526 # MinGW overrides and adds some system headers in nt/inc.
1527 # Also, GCC 14 turns on implicit-function-declaration
1528 # error by default, which fails configure tests where our
1529 # emulation of Posix headers defines only the minimal
1530 # stuff we actually need.
1531 GCC_TEST_OPTIONS="-I $srcdir/nt/inc -Wno-error=implicit-function-declaration"
1533 *-sysv4.2uw* ) opsys=unixware ;;
1534 *-sysv5uw* ) opsys=unixware ;;
1535 *-sysv5OpenUNIX* ) opsys=unixware ;;
1536 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
1542 case "${canonical}" in
1545 # MinGW overrides and adds some system headers in nt/inc.
1546 GCC_TEST_OPTIONS="-I $srcdir/nt/inc -Wno-error=implicit-function-declaration"
1548 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
1557 ### If the code above didn't choose an operating system, just choose
1558 ### an operating system based on the configuration name. You really
1559 ### only want to use this when you have no idea what the right
1560 ### operating system is; if you know what operating systems a machine
1561 ### runs, it's cleaner to make it explicit in the case statement
1563 if test x"${opsys}" = x; then
1564 case "${canonical}" in
1565 *-gnu* ) opsys=gnu ;;
1575 if test $unported = yes; then
1576 AC_MSG_ERROR([Emacs does not support '${canonical}' systems.
1577 If you think it should, please send a report to ${PACKAGE_BUGREPORT}.
1578 Check 'etc/MACHINES' for recognized configuration names.])
1581 #### Choose a compiler.
1583 dnl Don't bother to test for C89.
1584 AC_DEFUN([_AC_PROG_CC_C89], [$2])
1586 dnl Sets GCC=yes if using gcc.
1587 AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"])
1589 if test -n "$XCRUN"; then
1590 AC_CHECK_PROGS([AR], [ar "$XCRUN ar"])
1591 test -n "$AR" && export AR
1594 dnl Emacs needs C99 or later.
1599 if test x$GCC = xyes; then
1600 test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
1603 # Avoid gnulib's tests for -lcrypto, so that there's no static dependency on it.
1604 AC_DEFUN([gl_CRYPTO_CHECK])
1605 # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
1606 # as we don't use them.
1607 AC_DEFUN([gl_FCNTL_O_FLAGS])
1608 # Avoid gnulib's test for pthread_sigmask.
1610 for func in $ac_func_list; do
1611 test $func = pthread_sigmask || AS_VAR_APPEND([funcs], [" $func"])
1614 # Emacs does not use the wchar or wctype-h modules.
1615 AC_DEFUN([gt_TYPE_WINT_T],
1616 [GNULIBHEADERS_OVERRIDE_WINT_T=0
1617 AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])])
1618 # Emacs does not need precise checks for the Solaris 10 MB_CUR_MAX bug.
1619 AC_DEFUN_ONCE([gl_STDLIB_H],
1620 [AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
1621 gl_NEXT_HEADERS([stdlib.h])])
1622 # Emacs does not need to check for off64_t.
1623 AC_DEFUN([gl_TYPE_OFF64_T],
1625 AC_SUBST([HAVE_OFF64_T])])
1627 # Initialize gnulib right after choosing the compiler.
1628 dnl Amongst other things, this sets AR and ARFLAGS.
1631 # ndk_LATE must be enclosed in this conditional to prevent the
1632 # AC_PROG_CXX it indirectly requires from being expanded at top level.
1633 if test "$ndk_INITIALIZED" = "yes"; then
1638 if test "$ac_test_CFLAGS" != set; then
1639 # It's helpful to have C macros available to GDB, so prefer -g3 to -g
1640 # if -g3 works and the user does not specify CFLAGS.
1641 # This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
1644 emacs_g3_CFLAGS='-g3';;
1646 emacs_g3_CFLAGS='-g3 -O2';;
1648 emacs_g3_CFLAGS='';;
1650 if test -n "$emacs_g3_CFLAGS"; then
1651 emacs_save_CFLAGS=$CFLAGS
1652 CFLAGS=$emacs_g3_CFLAGS
1653 AC_CACHE_CHECK([whether $CC accepts $emacs_g3_CFLAGS],
1654 [emacs_cv_prog_cc_g3],
1655 [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1656 [emacs_cv_prog_cc_g3=yes],
1657 [emacs_cv_prog_cc_g3=no])])
1658 if test $emacs_cv_prog_cc_g3 != yes; then
1659 CFLAGS=$emacs_save_CFLAGS
1661 # Haiku also needs -gdwarf-2 because its GDB is too old
1662 # to understand newer formats.
1663 if test $opsys = mingw32 || test $opsys = haiku; then
1664 CFLAGS="$CFLAGS -gdwarf-2"
1671 # No optimization flag was inferred for this non-GCC compiler.
1672 # Try -O. This is needed for xlc on AIX; see Bug#14258.
1673 emacs_save_CFLAGS=$CFLAGS
1674 test -z "$CFLAGS" || CFLAGS="$CFLAGS "
1676 AC_CACHE_CHECK([whether $CC accepts -O],
1677 [emacs_cv_prog_cc_o],
1678 [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1679 [emacs_cv_prog_cc_o=yes],
1680 [emacs_cv_prog_cc_o=no])])
1681 if test $emacs_cv_prog_cc_o != yes; then
1682 CFLAGS=$emacs_save_CFLAGS
1687 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
1688 # ---------------------------------------------------------------------------
1689 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
1690 # Otherwise, run RUN-IF-NOT-FOUND.
1691 AC_DEFUN([gl_GCC_VERSION_IFELSE],
1695 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
1698 # error "your version of gcc is older than $1.$2"
1705 # clang is unduly picky about some things.
1706 AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
1713 [emacs_cv_clang=yes],
1714 [emacs_cv_clang=no])])
1716 AC_ARG_ENABLE([gcc-warnings],
1717 [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@],
1718 [control generation of GCC warnings. The TYPE 'yes'
1719 means to fail if any warnings are issued; 'warn-only'
1720 means issue warnings without failing (default for
1721 developer builds); 'no' means disable warnings
1722 (default for non-developer builds).])],
1724 yes|no|warn-only) ;;
1725 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
1727 gl_gcc_warnings=$enableval],
1728 [# By default, use 'warn-only' if it looks like the invoker of 'configure'
1729 # is a developer as opposed to a builder. This is most likely true
1730 # if GCC is recent enough and there is a .git directory or file;
1731 # however, if there is also a .tarball-version file it is probably
1732 # just a release imported into Git for patch management.
1734 AS_IF([test -d "$srcdir"/.git || test -f "$srcdir"/.git],
1735 [AS_IF([test -f "$srcdir"/.tarball-version], [],
1736 # Clang typically identifies itself as GCC 4.2 or something similar
1737 # even if it is recent enough to accept the warnings we enable.
1738 [AS_IF([test "$emacs_cv_clang" = yes],
1739 [gl_gcc_warnings=warn-only],
1740 [gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only])])])])])
1742 NATIVE_COMPILATION_AOT=no
1743 AC_ARG_WITH([native-compilation],
1744 [AS_HELP_STRING([--with-native-compilation@<:@=TYPE@:>@],
1745 [compile with Emacs Lisp native compiler support. The TYPE
1746 'yes' (or empty) means to enable it and compile natively
1747 preloaded Lisp files; 'no' means to disable it;
1748 'aot' will make the build process compile all the Lisp
1749 files in the tree natively ahead of time. (This will
1750 usually be quite slow.)])],
1755 NATIVE_COMPILATION_AOT=yes
1758 *) AC_MSG_ERROR([bad value $withval for native-compilation option]) ;;
1760 with_native_compilation=$withval],
1761 [with_native_compilation=default]
1763 AC_SUBST([NATIVE_COMPILATION_AOT])
1765 AC_ARG_ENABLE([check-lisp-object-type],
1766 [AS_HELP_STRING([--enable-check-lisp-object-type],
1767 [Enable compile time checks for the Lisp_Object data type,
1768 which can catch some bugs during development.])])
1769 if test "$enable_check_lisp_object_type" = yes; then
1770 AC_DEFINE([CHECK_LISP_OBJECT_TYPE], [1],
1771 [Define to enable compile-time checks for the Lisp_Object data type.])
1775 # When compiling with GCC, prefer -isystem to -I when including system
1776 # include files, to avoid generating useless diagnostics for the files.
1777 AS_IF([test $gl_gcc_warnings = no],
1780 AS_IF([test "$emacs_cv_clang" = yes],
1782 # Turn off some warnings if supported.
1783 gl_WARN_ADD([-Wno-pointer-sign])
1784 gl_WARN_ADD([-Wno-string-plus-int])
1785 gl_WARN_ADD([-Wno-unknown-attributes])
1786 gl_WARN_ADD([-Wno-unknown-pragmas])
1791 # This, $nw, is the list of warnings we disable.
1794 case $with_x_toolkit in
1795 lucid | athena | motif)
1796 # Old toolkits mishandle 'const'.
1797 nw="$nw -Wwrite-strings"
1800 AS_IF([test $gl_gcc_warnings = yes],
1801 [WERROR_CFLAGS=-Werror],
1802 [# Use -fanalyzer and related options only if --enable-gcc-warnings,
1803 # as they slow GCC considerably.
1804 nw="$nw -fanalyzer -Wno-analyzer-double-free -Wno-analyzer-malloc-leak"
1805 nw="$nw -Wno-analyzer-null-dereference -Wno-analyzer-use-after-free"
1806 # Use -Wsuggest-attribute=malloc only if --enable-gcc-warnings,
1807 # as it doesn't flag code that is wrong in any way.
1808 nw="$nw -Wsuggest-attribute=malloc"])
1810 nw="$nw -Wcast-align=strict" # Emacs is tricky with pointers.
1811 nw="$nw -Wduplicated-branches" # Too many false alarms
1812 nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 110333
1813 nw="$nw -Woverlength-strings" # Not a problem these days
1814 nw="$nw -Wvla" # Emacs uses <vla.h>.
1815 nw="$nw -Wunused-const-variable=2" # lisp.h declares const objects.
1816 nw="$nw -Winline" # OK to ignore 'inline'
1817 nw="$nw -Wstrict-overflow" # OK to optimize assuming that
1818 # signed overflow has undefined behavior
1819 nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
1820 nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
1821 nw="$nw -Wbad-function-cast" # These casts are no worse than others.
1823 # Emacs doesn't care about shadowing; see
1824 # <https://lists.gnu.org/r/emacs-diffs/2011-11/msg00265.html>.
1827 # Emacs's use of alloca inhibits protecting the stack.
1828 nw="$nw -Wstack-protector"
1830 # Emacs's use of __attribute__ ((cold)) causes false alarms with this option.
1831 nw="$nw -Wsuggest-attribute=cold"
1833 # Emacs's use of partly-const functions such as Fgnutls_available_p
1834 # make this option problematic.
1835 nw="$nw -Wsuggest-attribute=const"
1837 # Emacs's use of partly-pure functions such as CHECK_TYPE make this
1838 # option problematic.
1839 nw="$nw -Wsuggest-attribute=pure"
1841 # Emacs doesn't need this paranoia.
1842 nw="$nw -Wbidi-chars=any,ucn"
1844 if test "$emacs_cv_clang" = yes; then
1845 nw="$nw -Wdouble-promotion"
1846 nm="$nm -Wunknown-pragmas"
1849 # This causes too much noise in the MinGW build.
1850 if test $opsys = mingw32; then
1851 nw="$nw -Wsuggest-attribute=format"
1854 # If Emacs is being built for Android and many functions are
1855 # currently stubbed out for operation on the build machine, disable
1856 # -Wsuggest-attribute=noreturn.
1858 AS_IF([test "$ANDROID" = "yes"],
1859 [nw="$nw -Wsuggest-attribute=noreturn"])
1861 gl_MANYWARN_ALL_GCC([ws])
1862 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
1866 gl_WARN_ADD([-Wredundant-decls]) # Prefer this, as we don't use Bison.
1867 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
1868 gl_WARN_ADD([-Wno-override-init]) # More trouble than it is worth
1869 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
1870 gl_WARN_ADD([-Wno-type-limits]) # Too many warnings for now
1871 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
1872 gl_WARN_ADD([-Wno-format-nonliteral])
1873 gl_WARN_ADD([-Wno-bidi-chars])
1874 AS_IF([test $gl_gcc_warnings = yes],
1875 [gl_WARN_ADD([-Wno-analyzer-fd-leak])]) # GCC bug 109839
1877 # clang is unduly picky about some things.
1878 if test "$emacs_cv_clang" = yes; then
1879 gl_WARN_ADD([-Wno-bitwise-instead-of-logical])
1880 gl_WARN_ADD([-Wno-missing-braces])
1881 gl_WARN_ADD([-Wno-null-pointer-arithmetic])
1882 gl_WARN_ADD([-Wno-implicit-const-int-float-conversion])
1883 gl_WARN_ADD([-Wno-int-in-bool-context])
1884 gl_WARN_ADD([-Wno-shift-overflow])
1887 # This causes too much noise in the MinGW build
1888 if test $opsys = mingw32; then
1889 gl_WARN_ADD([-Wno-pointer-sign])
1892 AC_DEFINE([GCC_LINT], [1], [Define to 1 if --enable-gcc-warnings.])
1893 AS_IF([test $gl_gcc_warnings = yes],
1894 [AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
1895 AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE],
1896 [/* Enable compile-time and run-time bounds-checking, and some warnings,
1897 without upsetting glibc 2.15+. */
1898 #if (defined GNULIB_PORTCHECK && !defined _FORTIFY_SOURCE \
1899 && defined __OPTIMIZE__ && __OPTIMIZE__)
1900 # define _FORTIFY_SOURCE 2
1905 # clang is picky about these regardless of whether
1906 # --enable-gcc-warnings is specified.
1907 if test "$emacs_cv_clang" = yes; then
1908 gl_WARN_ADD([-Wno-initializer-overrides])
1909 gl_WARN_ADD([-Wno-tautological-compare])
1910 gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
1913 # Suppress deprecation warnings from using sprintf variants,
1914 # starting with Xcode 14.1 on macOS 13.
1915 # These warnings are false alarms, as Emacs usage of sprintf is safe.
1916 if test $opsys = darwin; then
1917 gl_WARN_ADD([-Wno-deprecated-declarations])
1920 # Use a slightly smaller set of warning options for lib/.
1922 nw="$nw -Wunused-macros"
1923 gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
1925 AC_SUBST([WERROR_CFLAGS])
1926 AC_SUBST([GNULIB_WARN_CFLAGS])
1935 AC_ARG_ENABLE([link-time-optimization],
1936 [AS_HELP_STRING([--enable-link-time-optimization],
1937 [build with link-time optimization
1938 (experimental; see INSTALL)])],
1939 if test "${enableval}" != "no"; then
1941 if test "$emacs_cv_clang" = yes; then
1942 AC_MSG_CHECKING([whether link-time optimization is supported by clang])
1943 GOLD_PLUGIN=`$CC -print-file-name=LLVMgold.so 2>/dev/null`
1944 if test -x "$GOLD_PLUGIN"; then
1947 elif test x$GCC = xyes; then
1948 AC_MSG_CHECKING([whether link-time optimization is supported by gcc])
1949 CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
1950 if test x$CPUS != x; then
1956 AC_MSG_ERROR([Link-time optimization is not supported with your compiler.])
1958 if test -z "$LTO"; then
1962 CFLAGS="$CFLAGS $LTO"
1963 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1964 [ac_lto_supported=yes], [ac_lto_supported=no])
1965 CFLAGS="$old_CFLAGS"
1967 AC_MSG_RESULT([$ac_lto_supported])
1968 if test "$ac_lto_supported" = "yes"; then
1969 CFLAGS="$CFLAGS $LTO"
1970 if test "$emacs_cv_clang" = yes; then
1971 AC_MSG_WARN([Please read INSTALL before using link-time optimization with clang])
1972 # WARNING: 'ar --plugin ...' doesn't work without
1973 # command, so plugin name is appended to ARFLAGS.
1974 ARFLAGS="cru --plugin $GOLD_PLUGIN"
1975 RANLIB="$RANLIB --plugin $GOLD_PLUGIN"
1977 dnl The following is needed for GCC 4.9.0. The GCC 4.9.0 release notes
1978 dnl suggest that instead of -ffat-lto-objects we should use gcc-ar and
1979 dnl gcc-ranlib in place of ar and ranlib, but gcc-ar makes /usr/bin/ar
1980 dnl dump core on Fedora 20, so play it safe for now.
1981 gl_COMPILER_OPTION_IF([-ffat-lto-objects],
1982 [CFLAGS="$CFLAGS -ffat-lto-objects"])
1988 dnl Automake replacements.
1989 AC_DEFUN([AM_CONDITIONAL],
1990 [$2 && $1_CONDITION=1 || $1_CONDITION=
1991 AC_SUBST([$1_CONDITION])])
1992 AC_DEFUN([AM_COND_IF],
1993 [AS_IF([test "$$1_CONDITION"], [$2], [$3])])
1995 dnl Prefer silent make output. For verbose output, use
1996 dnl 'configure --disable-silent-rules' or 'make V=1' .
1997 AC_ARG_ENABLE([silent-rules],
1999 [--disable-silent-rules],
2000 [verbose build output (undo: "make V=0")])])
2001 if test "$enable_silent_rules" = no; then
2002 AM_DEFAULT_VERBOSITY=1
2004 AM_DEFAULT_VERBOSITY=0
2006 AC_SUBST([AM_DEFAULT_VERBOSITY])
2007 ARCH_INDEPENDENT_CONFIG_FILES([src/verbose.mk])
2009 dnl Some other nice autoconf tests.
2011 dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
2013 dnl if test "x$RANLIB" = x; then
2018 dnl Sadly, AC_PROG_LN_S is too restrictive. It also tests whether links
2019 dnl can be made to directories. This is not relevant for our usage, and
2020 dnl excludes some cases that work fine for us. Eg MS Windows or files
2021 dnl hosted on AFS, both examples where simple links work, but links to
2022 dnl directories fail. We use a cut-down version instead.
2025 AC_CACHE_CHECK([command to symlink files in the same directory], [emacs_cv_ln_s_fileonly],
2026 [rm -f conf$$ conf$$.file
2028 emacs_cv_ln_s_fileonly='cp -p'
2030 dnl On MinGW, ensure we will call the MSYS /bin/ln.exe, not some
2031 dnl random program in the current directory.
2032 if (echo >conf$$.file) 2>/dev/null; then
2033 if test "$opsys" = "mingw32"; then
2034 emacs_cv_ln_s_fileonly=/bin/ln
2035 elif ln -s conf$$.file conf$$ 2>/dev/null; then
2036 emacs_cv_ln_s_fileonly='ln -s'
2037 elif ln conf$$.file conf$$ 2>/dev/null; then
2038 emacs_cv_ln_s_fileonly=ln
2042 rm -f conf$$ conf$$.file])
2043 LN_S_FILEONLY=$emacs_cv_ln_s_fileonly
2045 AC_SUBST([LN_S_FILEONLY])
2048 dnl AC_PROG_LN_S sets LN_S to 'cp -pR' for MinGW, on the premise that 'ln'
2049 dnl doesn't support links to directories, as in "ln file dir". But that
2050 dnl use is non-portable, and OTOH MinGW wants to use hard links for Emacs
2051 dnl executables at "make install" time.
2052 dnl See https://lists.gnu.org/r/emacs-devel/2013-04/msg00475.html
2053 dnl for more details.
2054 if test "$opsys" = "mingw32"; then
2058 dnl On some Debian versions, "install-info" prints irritating messages
2059 dnl "This is not dpkg install-info anymore, but GNU install-info"
2060 dnl if called via an absolute file name.
2061 dnl Use the entirely-identical-but-quieter ginstall-info instead if present.
2062 dnl Sadly some people may have an old ginstall-info installed on
2063 dnl non-Debian systems, so we can't use this.
2064 dnl AC_PATH_PROGS([INSTALL_INFO], [ginstall-info install-info], [:],
2065 dnl [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
2067 AC_PATH_PROG([INSTALL_INFO], [install-info], [:],
2068 [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
2069 dnl Don't use GZIP, which is used by gzip for additional parameters.
2070 AC_PATH_PROG([GZIP_PROG], [gzip])
2072 test $with_compress_install != yes && test -n "$GZIP_PROG" && \
2073 GZIP_PROG=" # $GZIP_PROG # (disabled by configure --without-compress-install)"
2075 if test "$with_dumping" = "unexec" && test "$opsys" = "nacl"; then
2076 AC_MSG_ERROR([nacl is not compatible with --with-dumping=unexec])
2079 AC_CACHE_CHECK([for 'find' args to delete a file],
2080 [emacs_cv_find_delete],
2081 [if touch conftest.tmp && find conftest.tmp -delete 2>/dev/null &&
2082 test ! -f conftest.tmp
2083 then emacs_cv_find_delete="-delete"
2084 else emacs_cv_find_delete="-exec rm -f {} +"
2086 FIND_DELETE=$emacs_cv_find_delete
2087 AC_SUBST([FIND_DELETE])
2091 if test $with_unexec = yes && test $opsys = gnu-linux; then
2092 if test "${SETFATTR+set}" != set; then
2093 AC_CACHE_CHECK([for setfattr],
2094 [emacs_cv_prog_setfattr],
2096 if (setfattr -n user.pax.flags conftest.tmp) >/dev/null 2>&1; then
2097 emacs_cv_prog_setfattr=yes
2099 emacs_cv_prog_setfattr=no
2101 if test "$emacs_cv_prog_setfattr" = yes; then
2102 PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er'
2108 case $opsys,$PAXCTL_notdumped,$emacs_uname_r in
2109 gnu-linux,,* | netbsd,,[0-7].*)
2110 AC_PATH_PROG([PAXCTL], [paxctl], [],
2111 [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
2112 if test -n "$PAXCTL"; then
2113 if test "$opsys" = netbsd; then
2114 PAXCTL_dumped='$(PAXCTL) +a'
2115 PAXCTL_notdumped=$PAXCTL_dumped
2117 AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header])
2118 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
2119 [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then
2120 AC_MSG_RESULT([yes])
2125 if test -n "$PAXCTL"; then
2126 PAXCTL_dumped='$(PAXCTL) -zex'
2127 PAXCTL_notdumped='$(PAXCTL) -r'
2133 AC_SUBST([PAXCTL_dumped])
2134 AC_SUBST([PAXCTL_notdumped])
2135 AC_SUBST([SETFATTR])
2137 # Makeinfo on macOS is ancient, check whether there is a more recent
2138 # version installed by Homebrew.
2139 AC_CHECK_PROGS([BREW], [brew])
2140 if test -n "$BREW"; then
2141 AC_PATH_PROG([MAKEINFO], [makeinfo], [],
2142 [`$BREW --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH])
2145 # Check MacPorts on macOS.
2146 if test $opsys = darwin; then
2147 AC_PATH_PROG([HAVE_MACPORTS], [port])
2150 ## Require makeinfo >= 4.13 (last of the 4.x series) to build the manuals.
2151 : ${MAKEINFO:=makeinfo}
2152 case `($MAKEINFO --version) 2>/dev/null` in
2153 *' (GNU texinfo) '4.1[[3-9]]* | \
2154 *' (GNU texinfo) '[[5-9]]* | \
2155 *' (GNU texinfo) '[[1-9][0-9]]* ) ;;
2159 ## Makeinfo is unusual. For a released Emacs, the manuals are
2160 ## pre-built, and not deleted by the normal clean rules. makeinfo is
2161 ## therefore in the category of "special tools" not normally required, which
2162 ## configure does not have to check for (eg autoconf itself).
2163 ## In a repository checkout on the other hand, the manuals are not included.
2164 ## So makeinfo is a requirement to build from the repository, and configure
2165 ## should test for it as it does for any other build requirement.
2166 ## We use the presence of $srcdir/info/emacs to distinguish a release,
2167 ## with pre-built manuals, from a repository checkout.
2168 if test "$MAKEINFO" = "no"; then
2170 if test ! -e "$srcdir/info/emacs" && test ! -e "$srcdir/info/emacs.info"; then
2171 AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.13, and your
2172 source tree does not seem to have pre-built manuals in the 'info' directory.
2173 Please install a suitable version of makeinfo.] )
2175 AC_MSG_WARN( [You do not seem to have makeinfo >= 4.13.
2176 You will not be able to rebuild the manuals if you delete them or change
2180 AC_SUBST([MAKEINFO])
2182 if test $opsys = mingw32; then
2183 DOCMISC_W32=efaq-w32
2187 AC_SUBST([DOCMISC_W32])
2189 dnl Add our options to ac_link now, after it is set up.
2191 if test x$GCC = xyes; then
2192 test "x$GCC_LINK_TEST_OPTIONS" != x && \
2193 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
2195 test "x$NON_GCC_LINK_TEST_OPTIONS" != x && \
2196 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
2199 dnl On some platforms using GNU ld, linking temacs needs -znocombreloc.
2200 dnl Although this has something to do with dumping, the details are unknown.
2201 dnl If the flag is used but not needed,
2202 dnl Emacs should still work (albeit a bit more slowly),
2203 dnl so use the flag everywhere that it is supported.
2204 dnl When testing whether the flag works, treat GCC specially
2205 dnl since it just gives a non-fatal 'unrecognized option'
2206 dnl if not built to support GNU ld.
2207 if test "$GCC" = yes; then
2208 LDFLAGS_NOCOMBRELOC="-Wl,-znocombreloc"
2210 LDFLAGS_NOCOMBRELOC="-znocombreloc"
2213 AC_CACHE_CHECK([for -znocombreloc], [emacs_cv_znocombreloc],
2214 [if test $with_unexec = no; then
2215 emacs_cv_znocombreloc='not needed'
2217 save_LDFLAGS=$LDFLAGS
2218 LDFLAGS="$LDFLAGS $LDFLAGS_NOCOMBRELOC"
2219 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
2220 [emacs_cv_znocombreloc=yes], [emacs_cv_znocombreloc=no])
2221 LDFLAGS=$save_LDFLAGS
2224 case $emacs_cv_znocombreloc in
2226 LDFLAGS_NOCOMBRELOC= ;;
2230 AC_CACHE_CHECK([whether addresses are sanitized],
2231 [emacs_cv_sanitize_address],
2234 [[#ifndef __has_feature
2235 #define __has_feature(f) 0
2237 #if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
2239 error "Addresses are not sanitized.";
2242 [emacs_cv_sanitize_address=yes],
2243 [emacs_cv_sanitize_address=no])])
2245 if test $with_unexec = yes; then
2246 AC_DEFINE([HAVE_UNEXEC], [1], [Define if Emacs supports unexec.])
2247 if test "$emacs_cv_sanitize_address" = yes; then
2248 AC_MSG_WARN([[Addresses are sanitized; suggest --without-unexec]])
2254 test $with_unexec = yes &&
2256 # MSDOS uses unexcoff.o
2258 UNEXEC_OBJ=unexaix.o
2264 UNEXEC_OBJ=unexmacosx.o
2267 UNEXEC_OBJ=unexhp9k800.o
2270 UNEXEC_OBJ=unexw32.o
2273 # Use the Solaris dldump() function, called from unexsol.c, to dump
2274 # emacs, instead of the generic ELF dump code found in unexelf.c.
2275 # The resulting binary has a complete symbol table, and is better
2276 # for debugging and other observability tools (debuggers, pstack, etc).
2277 UNEXEC_OBJ=unexsol.o
2280 UNEXEC_OBJ=unexelf.o
2283 AC_SUBST([UNEXEC_OBJ])
2286 test "$with_unexec" = no || case "$opsys" in
2288 ## Let 'ld' find image libs and similar things in /usr/local/lib.
2289 ## The system compiler, GCC, has apparently been modified to not
2290 ## look there, contrary to what a stock GCC would do.
2291 ### It's not our place to do this. See bug#10313#17.
2292 ### LD_SWITCH_SYSTEM=-L/usr/local/lib
2297 ## cpp test was "ifdef __mips__", but presumably this is equivalent...
2298 case $host_cpu in mips*) LD_SWITCH_SYSTEM="-G 0";; esac
2302 ### It's not our place to do this. See bug#10313#17.
2303 ### LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
2308 ## Han Boetes <han@boetes.org> says this is necessary,
2309 ## otherwise Emacs dumps core on elf systems.
2310 LD_SWITCH_SYSTEM="-Z"
2313 AC_SUBST([LD_SWITCH_SYSTEM])
2315 ac_link="$ac_link $LD_SWITCH_SYSTEM"
2317 ## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
2318 ## which has not been defined yet. When this was handled with cpp,
2319 ## it was expanded to null when configure sourced the s/*.h file.
2320 ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
2321 ## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
2322 ## (or somesuch), but because it is supposed to go at the _front_
2323 ## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
2324 ## Compare with the gnu-linux case below, which added to the end
2325 ## of LD_SWITCH_SYSTEM, and so can instead go at the front of
2326 ## LD_SWITCH_SYSTEM_TEMACS.
2329 LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
2334 test $with_unexec = yes &&
2337 ## With ELF, make sure that all common symbols get allocated to in the
2338 ## data section. Otherwise, the dump of temacs may miss variables in
2339 ## the shared library that have been initialized. For example, with
2340 ## GNU libc, __malloc_initialized would normally be resolved to the
2341 ## shared library's .bss section, which is fatal.
2342 if test "x$GCC" = "xyes"; then
2343 C_SWITCH_MACHINE="-fno-common"
2345 AC_MSG_ERROR([Non-GCC compilers are not supported.])
2350 AC_CACHE_CHECK([for flags to work around GCC bug 58416],
2351 [emacs_cv_gcc_bug_58416_CFLAGS],
2352 [emacs_cv_gcc_bug_58416_CFLAGS='none needed'
2353 AS_CASE([$canonical],
2354 [[i[3456]86-* | x86_64-*]],
2355 [AS_IF([test "$GCC" = yes],
2357 # If no flags are needed (e.g., not GCC 4+), don't use any.
2358 # Otherwise, use -mfpmath=sse if already assuming SSE2.
2359 # Otherwise, use -fno-tree-sra.
2360 for emacs_cv_gcc_bug_58416_CFLAGS in \
2361 'none needed' -mfpmath=sse -fno-tree-sra
2363 AS_CASE([$emacs_cv_gcc_bug_58416_CFLAGS],
2364 ['none needed'], [],
2365 [-fno-tree-sra], [break],
2366 [CFLAGS="$old_CFLAGS $emacs_cv_gcc_bug_58416_CFLAGS"])
2368 [AC_LANG_DEFINES_PROVIDED
2369 [/* Work around GCC bug with double in unions on x86,
2370 where the generated insns copy non-floating-point data
2371 via fldl/fstpl instruction pairs. This can misbehave
2372 the data's bit pattern looks like a NaN. See, e.g.:
2373 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58416#c10
2374 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71460
2375 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93271
2376 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114659
2377 Problem observed with 'gcc -m32' with GCC 14.1.1
2378 20240607 (Red Hat 14.1.1-5) on x86-64. */
2381 (4 <= __GNUC__ && __GNUC__ <= 14 && !defined __clang__ \
2382 && (defined __i386__ || defined __x86_64__) \
2383 && ! (0 <= FLT_EVAL_METHOD && FLT_EVAL_METHOD <= 1))
2384 # error "GCC bug 58416 is possibly present"
2389 CFLAGS=$old_CFLAGS])])])
2390 AS_CASE([$emacs_cv_gcc_bug_58416_CFLAGS],
2392 [C_SWITCH_MACHINE="$C_SWITCH_MACHINE $emacs_cv_gcc_bug_58416_CFLAGS"])
2394 AC_SUBST([C_SWITCH_MACHINE])
2397 ## Some programs in src produce warnings saying certain subprograms
2398 ## are too complex and need a MAXMEM value greater than 2000 for
2399 ## additional optimization. --nils@exp-math.uni-essen.de
2400 test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
2401 C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
2402 if test "$opsys" = "mingw32"; then
2403 case "$canonical" in
2404 x86_64-*-mingw*) C_SWITCH_SYSTEM="-mtune=generic" ;;
2405 *) C_SWITCH_SYSTEM="-mtune=pentium4" ;;
2408 ## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
2409 ## It is redundant in glibc2, since we define _GNU_SOURCE.
2410 AC_SUBST([C_SWITCH_SYSTEM])
2415 ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
2416 aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
2418 freebsd|dragonfly) LIBS_SYSTEM="-lutil" ;;
2420 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
2422 qnxnto) LIBS_SYSTEM="-lsocket" ;;
2424 solaris) LIBS_SYSTEM="-lsocket -lnsl" ;;
2426 ## Motif needs -lgen.
2427 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
2429 # Haiku needs -lbsd for cfsetspeed.
2430 haiku) LIBS_SYSTEM="-lnetwork -lbsd" ;;
2433 AC_SUBST([LIBS_SYSTEM])
2435 ### Make sure subsequent tests use flags consistent with the build flags.
2437 if test x"${OVERRIDE_CPPFLAGS}" != x; then
2438 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
2440 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
2443 # Suppress obsolescent Autoconf test for size_t; Emacs assumes C99 or better.
2444 AC_DEFUN([AC_TYPE_SIZE_T])
2445 # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
2446 AC_DEFUN([AC_TYPE_UID_T])
2447 ac_cv_type_gid_t=yes # AC_TYPE_GETGROUPS needs this in Autoconf 2.72.
2449 # Check for all math.h functions that Emacs uses; on some platforms,
2450 # -lm is needed for some of these functions.
2451 AC_CACHE_CHECK([for math library],
2452 [emacs_cv_lib_math],
2458 main (int argc, char **argv)
2469 d = copysign (d, d);
2492 return d == f && i == l;
2495 [emacs_cv_lib_math='none required'],
2498 [emacs_cv_lib_math=-lm],
2499 [AC_MSG_ERROR([Math library (-lm) not found])])])
2501 case $emacs_cv_lib_math in
2502 -*) LIB_MATH=$emacs_cv_lib_math;;
2506 dnl Current possibilities handled by sed (aix4-2 -> aix,
2507 dnl gnu-linux -> gnu/linux, etc.):
2508 dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux.
2509 dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
2510 SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
2517 ## Adding -lm confuses the dynamic linker, so omit it.
2520 freebsd | dragonfly )
2521 SYSTEM_TYPE=berkeley-unix
2523 gnu-linux | gnu-kfreebsd )
2525 hpux10-20 | hpux11 )
2529 SYSTEM_TYPE=windows-nt
2532 SYSTEM_TYPE=berkeley-unix
2535 solaris | unixware )
2536 SYSTEM_TYPE=usg-unix-v
2541 AC_SUBST([LIB_MATH])
2542 AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
2543 [The type of system you are compiling for; sets 'system-type'.])
2544 AC_SUBST([SYSTEM_TYPE])
2546 pre_PKG_CONFIG_CFLAGS=$CFLAGS
2547 pre_PKG_CONFIG_LIBS=$LIBS
2549 dnl pkg-config does not work when cross-compiling for Android.
2550 if test "${ANDROID}" != "yes"; then
2551 PKG_PROG_PKG_CONFIG([0.9.0])
2554 dnl EMACS_CHECK_MODULES([GSTUFF], [gtk+-2.0 >= 1.3 glib = 1.3.4])
2555 dnl acts like PKG_CHECK_MODULES([GSTUFF], [gtk+-2.0 >= 1.3 glib = 1.3.4],
2556 dnl [HAVE_GSTUFF=yes], [HAVE_GSTUFF=no]) -- see pkg-config man page --
2557 dnl except that it postprocesses CFLAGS as needed for --enable-gcc-warnings.
2558 dnl EMACS_CHECK_MODULES accepts optional 3rd and 4th arguments that
2559 dnl can take the place of the default HAVE_GSTUFF=yes and HAVE_GSTUFF=no
2561 AC_DEFUN([EMACS_CHECK_MODULES],
2562 [AS_IF([test -n "$ndk_INITIALIZED"],
2563 [ndk_CHECK_MODULES([$1], [$2], m4_default([$3], [HAVE_$1=yes]),
2564 m4_default([$4],[HAVE_$1=no]))],
2565 [PKG_CHECK_MODULES([$1], [$2],
2566 [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
2567 m4_default([$3], [HAVE_$1=yes])],
2568 [m4_default([$4], [HAVE_$1=no])])])])
2570 dnl EMACS_CHECK_LIB(NAME, FUNCTION, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND,
2571 dnl OTHER-LIBRARIES, INCLUDES)
2572 dnl ---------------------------------------------------------------------
2573 dnl This is like AC_CHECK_LIB; however, there is no default action, and
2574 dnl when cross-configuring for Android, AC_CHECK_DECLS is called with NAME
2575 dnl and INCLUDES instead, as the library being checked against will likely
2576 dnl be built together with Emacs.
2577 AC_DEFUN([EMACS_CHECK_LIB],
2578 [AS_IF([test -n "$ndk_INITIALIZED"],
2579 [AC_CHECK_DECL([$2], [$3], [$4], [$6])],
2580 [AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])])])
2583 if test "${with_sound}" != "no"; then
2584 # Sound support for GNU/Linux, the free BSDs, MinGW, and Cygwin.
2585 AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h mmsystem.h],
2586 [have_sound_header=yes], [], [
2588 #define WIN32_LEAN_AND_MEAN
2589 #include <windows.h>
2592 test "${with_sound}" = "oss" && test "${have_sound_header}" != "yes" && \
2593 AC_MSG_ERROR([OSS sound support requested but not found.])
2595 if test "${with_sound}" = "bsd-ossaudio" || test "${with_sound}" = "yes"; then
2596 # OSS emulation library used on NetBSD and OpenBSD.
2597 AC_CHECK_LIB([ossaudio], [_oss_ioctl], [LIBSOUND=-lossaudio], [LIBSOUND=])
2598 test "${with_sound}" = "bsd-ossaudio" && test -z "$LIBSOUND" && \
2599 AC_MSG_ERROR([bsd-ossaudio sound support requested but not found.])
2600 # On {Net,Open}BSD use the system audio library instead of
2601 # potentially switching to ALSA below, as ALSA on these appears to
2602 # just wrap system libraries.
2603 test "${with_sound}" = "yes" && test "$LIBSOUND" = "-lossaudio" && \
2604 with_sound="bsd-ossaudio"
2606 AC_SUBST([LIBSOUND])
2608 if test "${with_sound}" = "alsa" || test "${with_sound}" = "yes"; then
2610 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
2611 EMACS_CHECK_MODULES([ALSA], [$ALSA_MODULES])
2612 if test $HAVE_ALSA = yes; then
2613 LIBSOUND="$LIBSOUND $ALSA_LIBS"
2614 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
2615 AC_DEFINE([HAVE_ALSA], [1], [Define to 1 if ALSA is available.])
2616 elif test "${with_sound}" = "alsa"; then
2617 AC_MSG_ERROR([ALSA sound support requested but not found.])
2619 fi dnl with_sound = alsa|yes
2621 dnl Define HAVE_SOUND if we have sound support. We know it works and
2622 dnl compiles only on the specified platforms. For others, it
2623 dnl probably doesn't make sense to try.
2624 dnl FIXME So surely we should bypass this whole section if not using
2625 dnl one of these platforms?
2626 if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
2628 dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
2629 dnl Adjust the --with-sound help text if you change this.
2630 gnu-linux|freebsd|netbsd|mingw32|cygwin)
2631 AC_DEFINE([HAVE_SOUND], [1], [Define to 1 if you have sound support.])
2637 AC_SUBST([CFLAGS_SOUND])
2640 dnl checks for header files
2641 AC_CHECK_HEADERS_ONCE(
2648 sys/utsname.h pwd.h util.h
2649 sanitizer/lsan_interface.h
2650 sanitizer/asan_interface.h
2651 sanitizer/common_interface_defs.h])
2653 AC_CACHE_CHECK([for ADDR_NO_RANDOMIZE],
2654 [emacs_cv_personality_addr_no_randomize],
2656 [AC_LANG_PROGRAM([[#include <sys/personality.h>]],
2657 [[personality (personality (0xffffffff)
2658 | ADDR_NO_RANDOMIZE)]])],
2659 [emacs_cv_personality_addr_no_randomize=yes],
2660 [emacs_cv_personality_addr_no_randomize=no])])
2661 if test $emacs_cv_personality_addr_no_randomize = yes; then
2662 AC_DEFINE([HAVE_PERSONALITY_ADDR_NO_RANDOMIZE], [1],
2663 [Define to 1 if personality flag ADDR_NO_RANDOMIZE exists.])
2666 # Note that Solaris has sys/sysinfo.h which defines struct
2667 # sysinfo as well. To make sure that we're using GNU/Linux
2668 # sysinfo, we explicitly set one of its fields.
2669 if test "$ac_cv_header_sys_sysinfo_h" = yes; then
2670 AC_CACHE_CHECK([if Linux sysinfo may be used], [emacs_cv_linux_sysinfo],
2671 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sysinfo.h>]],
2672 [[struct sysinfo si;
2675 emacs_cv_linux_sysinfo=yes, emacs_cv_linux_sysinfo=no)])
2677 if test $emacs_cv_linux_sysinfo = yes; then
2678 AC_DEFINE([HAVE_LINUX_SYSINFO], [1],
2679 [Define to 1 if you have Linux sysinfo function.])
2680 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sysinfo.h>]],
2681 [[struct sysinfo si; return si.mem_unit]])],
2682 AC_DEFINE([LINUX_SYSINFO_UNIT], [1],
2683 [Define to 1 if Linux sysinfo sizes are in multiples of mem_unit bytes.]))
2687 dnl On Solaris 8 there's a compilation warning for term.h because
2688 dnl it doesn't define 'bool'.
2689 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <term.h>]],[[]])],
2690 [AC_DEFINE([HAVE_TERM_H], [1],
2691 [Define to 1 if you have the <term.h> header file.])])
2694 AC_CHECK_HEADERS_ONCE([sys/socket.h])
2695 AC_CHECK_HEADERS([net/if.h], [], [], [AC_INCLUDES_DEFAULT
2696 #if HAVE_SYS_SOCKET_H
2697 #include <sys/socket.h>
2699 AC_CHECK_HEADERS([ifaddrs.h], [], [], [AC_INCLUDES_DEFAULT
2700 #if HAVE_SYS_SOCKET_H
2701 #include <sys/socket.h>
2703 AC_CHECK_HEADERS([net/if_dl.h], [], [], [AC_INCLUDES_DEFAULT
2704 #if HAVE_SYS_SOCKET_H
2705 #include <sys/socket.h>
2708 dnl checks for structure members
2709 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
2710 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
2711 struct ifreq.ifr_addr,
2712 struct ifreq.ifr_addr.sa_len], [], [],
2713 [AC_INCLUDES_DEFAULT
2714 #if HAVE_SYS_SOCKET_H
2715 #include <sys/socket.h>
2721 dnl Check for endianness.
2722 dnl AC_C_BIGENDIAN is done by gnulib.
2724 dnl check for Make feature
2727 AUTODEPEND_PARENTS='lib src'
2728 dnl check if we have GCC and autodepend is on.
2729 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
2730 AC_CACHE_CHECK([whether gcc understands -MMD -MF], [emacs_cv_autodepend],
2731 [SAVE_CFLAGS="$CFLAGS"
2732 CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
2733 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
2734 [emacs_cv_autodepend=yes], [emacs_cv_autodepend=no])
2735 CFLAGS="$SAVE_CFLAGS"
2736 test -f deps.d || emacs_cv_autodepend=no
2738 if test $emacs_cv_autodepend = yes; then
2742 AC_SUBST([AUTO_DEPEND])
2744 #### Choose a window system.
2746 ## We leave window_system equal to none if
2747 ## we end up building without one. Any new window system should
2748 ## set window_system to an appropriate value and add objects to
2749 ## window-system-specific substs.
2755 # ANDROID_CFLAGS is a precious variable used to pass information to
2756 # the cross-compiler.
2757 ANDROID_BUILD_CFLAGS=
2761 AS_IF([test "$ANDROID" = "yes"],[
2762 window_system=android
2764 ANDROID_OBJ="androidterm.o androidfns.o androidfont.o androidmenu.o"
2765 ANDROID_OBJ="$ANDROID_OBJ android.o"
2769 AC_DEFINE([HAVE_ANDROID], [1], [Define to 1 if Emacs is being built
2770 with Android support])
2772 AS_IF([test "$XCONFIGURE" != "android"], [
2773 AC_DEFINE([ANDROID_STUBIFY], [1], [Define to 1 if Emacs is being built
2774 for Android, but all API calls need to be stubbed out])
2776 # Now set any shared user ID that was specified.
2777 AS_IF([test -n "$with_shared_user_id"],
2778 [emacs_val=$with_shared_user_id
2779 emacs_val=`AS_ECHO(["$with_shared_user_id"]) \
2780 | sed -e 's/"/\\"/'`
2781 emacs_val="\"$emacs_val\""
2782 ANDROID_SHARED_USER_ID="android:sharedUserId=$emacs_val"
2783 # `android:sharedUserName' is required for sharedUserID to work
2784 # on recent Android releases. It does not otherwise affect the
2785 # behavior of any code.
2786 emacs_val="\"@string/shared_user_name\""
2787 ANDROID_SHARED_USER_NAME="android:sharedUserLabel=$emacs_val"])],[
2788 # Emacs will be built as a shared library, and a wrapper around it
2789 # will also be built for the benefit of applications. This
2790 # requires Emacs be built as a position independent executable.
2791 ANDROID_BUILD_CFLAGS="-fPIC -fvisibility=hidden"
2793 # Graphics code in sfntfont-android.c benefits heavily from
2795 ANDROID_BUILD_CFLAGS="$ANDROID_BUILD_CFLAGS -ftree-vectorize"
2797 # Link with libraries required for Android support.
2798 # API 9 and later require `-landroid' for the asset manager.
2799 # API 8 uses an emulation via the JNI.
2800 AS_IF([test "$ANDROID_SDK" -lt "9"],
2801 [ANDROID_LIBS="-llog -ljnigraphics"],
2802 [ANDROID_LIBS="-landroid -llog -ljnigraphics"])
2804 # This is required to make the system load emacs.apk's libpng
2805 # (among others) instead of the system's own. But it doesn't work
2806 # on all Android versions yet, so for now just suffix shared
2807 # libraries with _emacs.
2808 # ANDROID_LDFLAGS="-Wl,-rpath,'\$\$ORIGIN'"
2810 # Link with the sfnt font library and sfntfont.o, along with
2811 # sfntfont-android.o.
2812 ANDROID_OBJ="$ANDROID_OBJ sfnt.o sfntfont.o sfntfont-android.o"
2814 # Build androidselect.o and androidvfs.o.
2815 ANDROID_OBJ="$ANDROID_OBJ androidselect.o androidvfs.o"
2817 # Check for some functions not always present in the NDK.
2818 AC_CHECK_DECLS([android_get_device_api_level])
2820 # Mention this build is really for Android.
2821 REALLY_ANDROID=yes])])
2824 AC_SUBST([ANDROID_OBJ])
2825 AC_SUBST([ANDROID_LIBS])
2826 AC_SUBST([ANDROID_LDFLAGS])
2827 AC_SUBST([ANDROID_BUILD_CFLAGS])
2828 AC_SUBST([ANDROID_SHARED_USER_ID])
2829 AC_SUBST([ANDROID_SHARED_USER_NAME])
2831 # Check for pw_gecos in struct passwd; this is known to be missing on
2834 AH_TEMPLATE([USER_FULL_NAME], [How to get a user's full name.])
2835 AC_CHECK_MEMBERS([struct passwd.pw_gecos], [], [], [#include <pwd.h>])
2836 AS_IF([test x"$REALLY_ANDROID" = "xyes"],
2837 [AC_DEFINE([USER_FULL_NAME], [android_user_full_name (pw)])],
2838 [AS_IF([test x"$ac_cv_member_struct_passwd_pw_gecos" = "xyes"],
2839 [AC_DEFINE([USER_FULL_NAME], [pw->pw_gecos])],
2840 [AC_DEFINE([USER_FULL_NAME], [NULL])])])
2842 if test "${with_pgtk}" = "yes"; then
2846 if test "${ANDROID}" != "yes"; then
2848 if test "$no_x" != yes && test "${with_pgtk}" != "yes"; then
2853 LD_SWITCH_X_SITE_RPATH=
2854 if test "${x_libraries}" != NONE; then
2855 if test -n "${x_libraries}"; then
2856 LD_SWITCH_X_SITE=-L`AS_ECHO(["$x_libraries"]) | sed -e 's/:/ -L/g'`
2857 LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`
2858 AS_ECHO(["$x_libraries"]) | sed -e 's/:/ -Wl,-rpath,/g'
2861 x_default_search_path=""
2862 x_search_path=${x_libraries}
2863 if test -z "${x_search_path}"; then
2864 x_search_path=/usr/lib
2866 for x_library in `AS_ECHO(["$x_search_path:"]) | \
2867 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
2869 ${x_library}/X11/%L/%T/%N%C%S:\
2870 ${x_library}/X11/%l/%T/%N%C%S:\
2871 ${x_library}/X11/%T/%N%C%S:\
2872 ${x_library}/X11/%L/%T/%N%S:\
2873 ${x_library}/X11/%l/%T/%N%S:\
2874 ${x_library}/X11/%T/%N%S"
2875 if test x"${x_default_search_path}" = x; then
2876 x_default_search_path=${x_search_path}
2878 x_default_search_path="${x_search_path}:${x_default_search_path}"
2882 AC_SUBST([LD_SWITCH_X_SITE_RPATH])
2884 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
2885 C_SWITCH_X_SITE=$isystem`AS_ECHO(["$x_includes"]) | sed -e "s/:/ $isystem/g"`
2888 if test x"${x_includes}" = x; then
2889 bitmapdir=/usr/include/X11/bitmaps
2891 # accumulate include directories that have X11 bitmap subdirectories
2893 for bmd in `AS_ECHO(["$x_includes"]) | sed -e 's/:/ /g'`; do
2894 if test -d "${bmd}/X11/bitmaps"; then
2895 bmd_acc="${bmd_acc+$bmd_acc:}${bmd}/X11/bitmaps"
2897 if test -d "${bmd}/bitmaps"; then
2898 bmd_acc="${bmd_acc+$bmd_acc:}${bmd}/bitmaps"
2906 test "${with_ns}" = maybe && test "${opsys}" != darwin && with_ns=no
2908 NS_GNUSTEP_CONFIG=no
2911 tmp_CPPFLAGS="$CPPFLAGS"
2912 tmp_CFLAGS="$CFLAGS"
2913 CPPFLAGS="$CPPFLAGS -x objective-c"
2914 CFLAGS="$CFLAGS -x objective-c"
2917 if test "${with_ns}" != no; then
2918 # macfont.o requires macuvs.h which is absent after 'make extraclean',
2919 # so avoid NS_IMPL_COCOA if macuvs.h is absent.
2920 # Even a headless Emacs can build macuvs.h, so this should let you bootstrap.
2921 if test "${opsys}" = darwin && test -f "$srcdir/src/macuvs.h"; then
2923 ns_appdir=`pwd`/nextstep/Emacs.app
2924 ns_appbindir=${ns_appdir}/Contents/MacOS
2925 ns_applibexecdir=${ns_appdir}/Contents/MacOS/libexec
2926 ns_applibdir=${ns_appdir}/Contents/Frameworks
2927 ns_appresdir=${ns_appdir}/Contents/Resources
2928 ns_appsrc=Cocoa/Emacs.base
2929 ns_fontfile=macfont.o
2930 elif flags=`(gnustep-config --objc-flags) 2>/dev/null`; then
2932 NS_GNUSTEP_CONFIG=yes
2933 GNU_OBJC_CFLAGS="$flags"
2934 LIBS_GNUSTEP=`gnustep-config --gui-libs || exit`
2935 elif test -f $GNUSTEP_CONFIG_FILE; then
2937 dnl FIXME sourcing this several times in subshells seems inefficient.
2938 GNUSTEP_SYSTEM_HEADERS=`. $GNUSTEP_CONFIG_FILE \
2939 && AS_ECHO(["$GNUSTEP_SYSTEM_HEADERS"])`
2940 GNUSTEP_SYSTEM_LIBRARIES=` . $GNUSTEP_CONFIG_FILE \
2941 && AS_ECHO(["$GNUSTEP_SYSTEM_LIBRARIES"])`
2942 dnl I seemed to need these as well with GNUstep-startup 0.25.
2943 GNUSTEP_LOCAL_HEADERS=`. $GNUSTEP_CONFIG_FILE \
2944 && AS_ECHO(["$GNUSTEP_LOCAL_HEADERS"])`
2945 GNUSTEP_LOCAL_LIBRARIES=`. $GNUSTEP_CONFIG_FILE \
2946 && AS_ECHO(["$GNUSTEP_LOCAL_LIBRARIES"])`
2947 test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
2948 GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
2949 test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
2950 GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
2951 CPPFLAGS="$CPPFLAGS -isystem ${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
2952 CFLAGS="$CFLAGS -isystem ${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
2953 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
2954 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
2955 dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
2956 dnl If they had chosen to either define it or not, we could have
2957 dnl just used AC_CHECK_DECL here.
2958 AC_CACHE_CHECK([if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS],
2959 [emacs_cv_objc_exceptions],
2961 [AC_LANG_PROGRAM([[#include <GNUstepBase/GSConfig.h>]],
2962 [[#if defined BASE_NATIVE_OBJC_EXCEPTIONS && BASE_NATIVE_OBJC_EXCEPTIONS > 0
2967 [emacs_cv_objc_exceptions=yes],
2968 [emacs_cv_objc_exceptions=no])])
2969 if test $emacs_cv_objc_exceptions = yes; then
2970 dnl _NATIVE_OBJC_EXCEPTIONS is used by the GNUstep headers.
2971 AC_DEFINE([_NATIVE_OBJC_EXCEPTIONS], [1],
2972 [Define if GNUstep uses ObjC exceptions.])
2973 GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fobjc-exceptions"
2976 if test $NS_IMPL_GNUSTEP = yes; then
2977 ns_appdir=`pwd`/nextstep/Emacs.app
2978 ns_appbindir=${ns_appdir}
2979 ns_applibexecdir=${ns_appdir}/libexec
2980 ns_applibdir=${ns_appdir}/Frameworks
2981 ns_appresdir=${ns_appdir}/Resources
2982 ns_appsrc=GNUstep/Emacs.base
2983 ns_fontfile=nsfont.o
2986 dnl This is only used while we test the NS headers, it gets reset below.
2987 CPPFLAGS="$CPPFLAGS $GNU_OBJC_CFLAGS"
2988 CFLAGS="$CFLAGS $GNU_OBJC_CFLAGS"
2990 AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
2991 [AC_MSG_ERROR([The include files (AppKit/AppKit.h etc) that
2992 are required for a Nextstep build are missing or cannot be compiled.
2993 Either fix this, or re-configure with the option '--without-ns'.])])
2996 if test "${NS_IMPL_COCOA}" = "yes"; then
2997 AC_MSG_CHECKING([for Mac OS X 10.6 or newer])
2998 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>],
3000 #ifdef MAC_OS_X_VERSION_MAX_ALLOWED
3001 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
3004 error "Mac OS X 10.6 or newer required";
3008 [ns_osx_have_106=yes],
3009 [ns_osx_have_106=no])
3010 AC_MSG_RESULT([$ns_osx_have_106])
3012 if test $ns_osx_have_106 = no; then
3013 AC_MSG_ERROR([Mac OS X 10.6 or newer is required]);
3017 AC_CACHE_CHECK([for Mac OS X 12.0 or later],
3018 [emacs_cv_macosx_12_0],
3019 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3020 #include <AvailabilityMacros.h>
3021 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
3022 Mac OS X 12.x or later.
3024 ]])], [emacs_cv_macosx_12_0=no],
3025 [emacs_cv_macosx_12_0=yes]))
3027 if test "${with_native_image_api}" = yes; then
3028 AC_DEFINE([HAVE_NATIVE_IMAGE_API], [1],
3029 [Define to use native OS APIs for images.])
3030 NATIVE_IMAGE_API="yes (ns)"
3034 AC_SUBST([LIBS_GNUSTEP])
3036 INSTALL_ARCH_INDEP_EXTRA=install-etc
3037 ns_self_contained=no
3040 if test "${HAVE_NS}" = yes; then
3041 if test "$with_toolkit_scroll_bars" = "no"; then
3042 AC_MSG_WARN([Non-toolkit scroll bars are not implemented for Nextstep.])
3045 window_system=nextstep
3046 # set up packaging dirs
3047 if test "${EN_NS_SELF_CONTAINED}" = yes; then
3048 AC_DEFINE([NS_SELF_CONTAINED], [1], [Build an NS bundled app])
3049 ns_self_contained=yes
3050 prefix=${ns_appresdir}
3051 exec_prefix=${ns_appbindir}
3052 dnl This one isn't really used, only archlibdir is.
3053 libexecdir="\${ns_applibexecdir}"
3054 archlibdir="\${ns_applibexecdir}"
3055 etcdocdir="\${ns_appresdir}/etc"
3056 etcdir="\${ns_appresdir}/etc"
3057 dnl FIXME maybe set datarootdir instead.
3058 dnl That would also get applications, icons, man.
3059 infodir="\${ns_appresdir}/info"
3060 mandir="\${ns_appresdir}/man"
3061 lispdir="\${ns_appresdir}/lisp"
3062 lispdirrel="\${ns_appresdir}/lisp"
3063 test "$locallisppathset" = no && locallisppath="\${ns_appresdir}/site-lisp"
3064 INSTALL_ARCH_INDEP_EXTRA=
3067 NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o $ns_fontfile"
3069 CFLAGS="$tmp_CFLAGS"
3070 CPPFLAGS="$tmp_CPPFLAGS"
3071 AC_SUBST([INSTALL_ARCH_INDEP_EXTRA])
3072 AC_SUBST([ns_self_contained])
3074 AC_SUBST([NS_OBJC_OBJ])
3076 if test "${HAVE_NS}" = yes; then
3077 AC_LANG_PUSH([Objective C])
3079 [if the Objective C compiler supports instancetype],
3080 [emacs_cv_objc_instancetype],
3082 [AC_LANG_SOURCE([[@interface Test
3083 + (instancetype)test;
3085 [emacs_cv_objc_instancetype=yes],
3086 [emacs_cv_objc_instancetype=no])])
3088 if test x$emacs_cv_objc_instancetype = xyes ; then
3089 AC_DEFINE([NATIVE_OBJC_INSTANCETYPE], [1],
3090 [Define if ObjC compiler supports instancetype natively.])
3094 [if the Objective C compiler defaults to C99],
3095 [emacs_cv_objc_c99],
3097 [AC_LANG_PROGRAM([], [[for (int i = 0;;);]])],
3098 [emacs_cv_objc_c99=yes],
3099 [emacs_cv_objc_c99=no])])
3101 if test x$emacs_cv_objc_c99 = xno ; then
3102 GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -std=c99"
3104 AC_LANG_POP([Objective C])
3108 if test "${opsys}" = "haiku" && test "${with_be_app}" = "yes"; then
3109 dnl Only GCC is supported. Clang might work, but it's
3110 dnl not reliable, so don't check for it here.
3111 AC_PROG_CXX([gcc g++])
3112 CXXFLAGS="$CXXFLAGS $emacs_g3_CFLAGS"
3114 AC_CHECK_HEADER([app/Application.h], [HAVE_BE_APP=yes],
3115 [AC_MSG_ERROR([The Application Kit headers required for building
3116 with the Application Kit were not found or cannot be compiled. Either fix this, or
3117 re-configure with the option '--without-be-app'.])])
3121 AC_SUBST([HAVE_BE_APP])
3131 if test "${with_w32}" != no; then
3134 AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
3135 [AC_MSG_ERROR(['--with-w32' was specified, but windows.h
3136 cannot be found.])])
3139 ## Using --with-w32 with MinGW is a no-op, but we allow it.
3142 AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin and MinGW32.])
3147 if test "${opsys}" = "mingw32"; then
3148 AC_CACHE_CHECK([whether Windows API headers are recent enough], [emacs_cv_w32api],
3149 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3150 #include <windows.h>
3151 #include <usp10.h>]],
3152 [[PIMAGE_NT_HEADERS pHeader;
3153 PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader)]])],
3154 [emacs_cv_w32api=yes], [emacs_cv_w32api=no])])
3155 if test "${emacs_cv_w32api}" = "no"; then
3156 AC_MSG_ERROR([the Windows API headers are too old to support this build.])
3158 HAVE_W32=${emacs_cv_w32api}
3167 if test "${HAVE_W32}" = "yes"; then
3168 AC_DEFINE([HAVE_NTGUI], [1], [Define to use native MS Windows GUI.])
3169 if test "$with_toolkit_scroll_bars" = "no"; then
3170 AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for w32 build.])
3172 AC_CHECK_TOOL([WINDRES], [windres],
3173 [AC_MSG_ERROR([No resource compiler found.])])
3174 W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
3175 W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o w32cygwinx.o"
3176 EMACSRES="emacs.res"
3177 case "$canonical" in
3178 x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;;
3179 *) EMACS_MANIFEST="emacs-x86.manifest" ;;
3181 dnl Construct something of the form "24,4,0,0" with 4 components.
3182 comma_version=`echo "${PACKAGE_VERSION}.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'`
3184 comma_space_version=`echo "$comma_version" | sed 's/,/, /g'`
3185 AC_SUBST([comma_version])
3186 AC_SUBST([comma_space_version])
3187 AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc])
3188 if test "${opsys}" = "cygwin"; then
3189 W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lusp10 -lgdi32"
3190 W32_LIBS="$W32_LIBS -lole32 -lcomdlg32 -lcomctl32 -lwinspool"
3191 # Tell the linker that emacs.res is an object (which we compile from
3192 # the rc file), not a linker script.
3193 W32_RES_LINK="-Wl,emacs.res"
3195 W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
3196 dnl FIXME: This should probably be supported for Cygwin/w32 as
3197 dnl well, but the Cygwin build needs to link against -lgdiplus
3198 if test "${with_native_image_api}" = yes; then
3199 AC_DEFINE([HAVE_NATIVE_IMAGE_API], [1],
3200 [Define to use native OS APIs for images.])
3201 NATIVE_IMAGE_API="yes (w32)"
3202 W32_OBJ="$W32_OBJ w32image.o"
3204 W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32"
3205 W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32"
3206 W32_RES_LINK="\$(EMACSRES)"
3207 CLIENTRES="emacsclient.res"
3208 CLIENTW="emacsclientw\$(EXEEXT)"
3209 FIRSTFILE_OBJ=firstfile.o
3212 LIBS_ECLIENT="-lcomctl32"
3213 LIB_WSOCK32="-lwsock32"
3214 NTLIB="ntlib.$ac_objext"
3215 XARGS_LIMIT="-s 10000"
3219 if test "${HAVE_W32}" = "no" && test "${opsys}" = "cygwin"; then
3220 W32_LIBS="-lkernel32"
3221 W32_OBJ="w32cygwinx.o"
3225 AC_SUBST([W32_LIBS])
3226 AC_SUBST([EMACSRES])
3227 AC_SUBST([EMACS_MANIFEST])
3228 AC_SUBST([CLIENTRES])
3230 AC_SUBST([W32_RES_LINK])
3231 AC_SUBST([FIRSTFILE_OBJ])
3234 AC_SUBST([LIBS_ECLIENT])
3235 AC_SUBST([LIB_WSOCK32])
3237 AC_SUBST([XARGS_LIMIT])
3239 if test "${HAVE_W32}" = "yes"; then
3249 if test "$opsys" = "haiku"; then
3250 HAIKU_OBJ="$HAIKU_OBJ haiku.o"
3253 if test "${HAVE_BE_APP}" = "yes"; then
3254 AC_DEFINE([HAVE_HAIKU], [1],
3255 [Define if Emacs will be built with Haiku windowing support])
3258 if test "${HAVE_BE_APP}" = "yes"; then
3261 HAIKU_OBJ="$HAIKU_OBJ haikufns.o haikuterm.o haikumenu.o haikufont.o haikuselect.o haiku_io.o"
3262 HAIKU_CXX_OBJ="haiku_support.o haiku_font_support.o haiku_draw_support.o haiku_select.o"
3263 HAIKU_LIBS="-lbe -lgame -ltranslation -ltracker" # -lgame is needed for set_mouse_position.
3265 if test "${with_native_image_api}" = yes; then
3266 AC_DEFINE([HAVE_NATIVE_IMAGE_API], [1],
3267 [Define to use native OS APIs for images.])
3268 NATIVE_IMAGE_API="yes (haiku)"
3269 HAIKU_OBJ="$HAIKU_OBJ haikuimage.o"
3273 AC_SUBST([HAIKU_LIBS])
3274 AC_SUBST([HAIKU_OBJ])
3275 AC_SUBST([HAIKU_CXX_OBJ])
3276 AC_SUBST([HAIKU_CFLAGS])
3278 ## $window_system is now set to the window system we will
3287 case "${window_system}" in
3292 case "${with_x_toolkit}" in
3293 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
3294 motif ) USE_X_TOOLKIT=MOTIF ;;
3296 term_header=gtkutil.h
3297 dnl Don't set this for GTK. A lot of tests below assumes Xt when
3298 dnl USE_X_TOOLKIT is set.
3299 USE_X_TOOLKIT=none ;;
3300 gtk2 ) with_gtk2=yes
3301 term_header=gtkutil.h
3302 USE_X_TOOLKIT=none ;;
3303 gtk3 ) with_gtk3=yes
3304 term_header=gtkutil.h
3305 USE_X_TOOLKIT=none ;;
3306 no ) USE_X_TOOLKIT=none ;;
3307 dnl If user did not say whether to use a toolkit, make this decision later:
3308 dnl use the toolkit if we have gtk, or X11R5 or newer.
3309 * ) USE_X_TOOLKIT=maybe ;;
3313 term_header=nsterm.h
3316 term_header=w32term.h
3319 term_header=pgtkterm.h
3323 AC_DEFINE([HAVE_PGTK], [1], [Define to 1 if you have pure Gtk+-3.])
3326 term_header=haikuterm.h
3329 term_header=androidterm.h
3333 AC_SUBST([HAVE_PGTK])
3335 if test "$window_system" = none && test "X$with_x" != "Xno"; then
3336 AC_CHECK_PROG([HAVE_XSERVER], [X], [true], [false])
3337 if test "$HAVE_XSERVER" = true ||
3338 test -n "$DISPLAY" ||
3340 for emacs_libX11 in /usr/lib/libX11.*; do break; done
3341 test "$emacs_libX11" != '/usr/lib/libX11.*'
3344 AC_MSG_ERROR([You seem to be running X, but no X development libraries
3345 were found. You should install the relevant development files for X
3346 and for the toolkit you want, such as Gtk+ or Motif. Also make
3347 sure you have development files for image handling, i.e.
3348 tiff, gif, jpeg, png and xpm.
3349 If you are sure you want Emacs compiled without X window support, pass
3355 # Does the opsystem file prohibit the use of the GNU malloc?
3356 # Assume not, until told otherwise.
3360 [whether malloc is Doug Lea style],
3361 [emacs_cv_var_doug_lea_malloc],
3362 [emacs_cv_var_doug_lea_malloc=no
3363 dnl Hooks do not work with address sanitization.
3364 if test "$emacs_cv_sanitize_address" != yes; then
3367 [[#include <malloc.h>
3368 static void hook (void) {}]],
3369 [[malloc_set_state (malloc_get_state ());
3370 __after_morecore_hook = hook;
3371 __malloc_initialize_hook = hook;]])],
3372 [emacs_cv_var_doug_lea_malloc=yes])
3374 doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
3379 dnl This must be before the test of $ac_cv_func_sbrk below.
3380 AC_CHECK_FUNCS_ONCE([sbrk])
3382 test $with_unexec = yes &&
3384 ## darwin ld insists on the use of malloc routines in the System framework.
3385 darwin | mingw32 | nacl | solaris) ;;
3386 cygwin | qnxnto | freebsd)
3389 *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
3392 if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \
3393 && test "${UNEXEC_OBJ}" = unexelf.o; then
3399 if test "${system_malloc}" = "yes"; then
3400 AC_DEFINE([SYSTEM_MALLOC], [1],
3401 [Define to 1 to use the system memory allocator, even if it is not
3405 (The GNU allocators don't work with this system configuration.)"
3407 elif test "$hybrid_malloc" = yes; then
3408 AC_DEFINE([HYBRID_MALLOC], [1],
3409 [Define to use gmalloc before dumping and the system malloc after.])
3412 GNU_MALLOC_reason=" (only before dumping)"
3413 GMALLOC_OBJ=gmalloc.o
3416 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
3417 VMLIMIT_OBJ=vm-limit.o
3419 AC_CHECK_HEADERS([sys/vlimit.h])
3420 AC_CACHE_CHECK([for data_start], [emacs_cv_data_start],
3423 [[extern char data_start[]; char ch;]],
3424 [[return data_start < &ch;]])],
3425 [emacs_cv_data_start=yes],
3426 [emacs_cv_data_start=no])])
3427 if test $emacs_cv_data_start = yes; then
3428 AC_DEFINE([HAVE_DATA_START], [1],
3429 [Define to 1 if data_start is the address of the start
3430 of the main data segment.])
3433 AC_SUBST([HYBRID_MALLOC])
3434 AC_SUBST([GMALLOC_OBJ])
3435 AC_SUBST([VMLIMIT_OBJ])
3437 if test "$doug_lea_malloc" = "yes" && test "$hybrid_malloc" != yes; then
3438 if test "$GNU_MALLOC" = yes ; then
3440 (Using Doug Lea's new malloc from the GNU C Library.)"
3442 AC_DEFINE([DOUG_LEA_MALLOC], [1],
3443 [Define to 1 if the system memory allocator is Doug Lea style,
3444 with malloc hooks and malloc_set_state.])
3446 ## Use mmap directly for allocating larger buffers.
3447 ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
3448 ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
3449 ## Does the AC_FUNC_MMAP test below make this check unnecessary?
3451 mingw32|gnu*) REL_ALLOC=no ;;
3455 if test x"${REL_ALLOC}" = x; then
3456 REL_ALLOC=${GNU_MALLOC}
3459 use_mmap_for_buffers=no
3461 mingw32) use_mmap_for_buffers=yes ;;
3465 if test $use_mmap_for_buffers = yes; then
3466 AC_DEFINE([USE_MMAP_FOR_BUFFERS], [1],
3467 [Define to use mmap to allocate buffer text.])
3471 LIBS="$LIBS_SYSTEM $LIBS"
3473 dnl FIXME replace main with a function we actually want from this library.
3474 AC_CHECK_LIB([Xbsd], [main], [LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd"])
3476 dnl Check for the POSIX thread library.
3478 AC_CHECK_HEADERS_ONCE([pthread.h])
3479 if test "$ac_cv_header_pthread_h" && test "$opsys" != "mingw32"; then
3480 AC_CACHE_CHECK([for pthread library],
3481 [emacs_cv_pthread_lib],
3482 [emacs_cv_pthread_lib=no
3484 for emacs_pthread_lib in 'none needed' -lpthread; do
3485 case $emacs_pthread_lib in
3486 -*) LIBS="$OLD_LIBS $emacs_pthread_lib";;
3490 [[#include <pthread.h>
3492 sigset_t old_mask, new_mask;
3493 void noop (void) {}]],
3494 [[pthread_t th = pthread_self ();
3496 status += pthread_create (&th, 0, 0, 0);
3497 status += pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask);
3498 status += pthread_kill (th, 0);
3499 #if ! (defined SYSTEM_MALLOC || defined HYBRID_MALLOC \
3500 || defined DOUG_LEA_MALLOC)
3501 /* Test for pthread_atfork only if gmalloc uses it,
3502 as older-style hosts like MirBSD 10 lack it. */
3503 status += pthread_atfork (noop, noop, noop);
3506 [emacs_cv_pthread_lib=$emacs_pthread_lib])
3508 if test "$emacs_cv_pthread_lib" != no; then
3512 if test "$emacs_cv_pthread_lib" != no; then
3513 AC_DEFINE([HAVE_PTHREAD], [1], [Define to 1 if you have POSIX threads.])
3514 case $emacs_cv_pthread_lib in
3515 -*) LIB_PTHREAD=$emacs_cv_pthread_lib;;
3517 ac_cv_func_pthread_sigmask=yes
3518 # Some systems optimize for single-threaded programs by default, and
3519 # need special flags to disable these optimizations. For example, the
3520 # definition of 'errno' in <errno.h>.
3523 AC_DEFINE([_REENTRANT], [1],
3524 [Define to 1 if your system requires this in multithreaded code.]);;
3526 AC_DEFINE([_THREAD_SAFE], [1],
3527 [Define to 1 if your system requires this in multithreaded code.]);;
3531 AC_SUBST([LIB_PTHREAD])
3533 AC_MSG_CHECKING([for thread support])
3535 if test "$with_threads" = yes; then
3536 if test "$emacs_cv_pthread_lib" != no; then
3537 AC_DEFINE([THREADS_ENABLED], [1],
3538 [Define to 1 if you want elisp thread support.])
3540 elif test "${opsys}" = "mingw32"; then
3541 dnl MinGW can do native Windows threads even without pthreads
3542 AC_DEFINE([THREADS_ENABLED], [1],
3543 [Define to 1 if you want elisp thread support.])
3547 AC_MSG_RESULT([$threads_enabled])
3549 dnl Check for need for bigtoc support on IBM AIX
3553 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
3555 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
3556 *) gdb_cv_bigtoc=-bbigtoc ;;
3559 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
3560 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], [], [gdb_cv_bigtoc=])
3565 # Change CFLAGS, CPPFLAGS, and LIBS temporarily so that C_SWITCH_X_SITE
3566 # is for the tests that follow. We set them back later on.
3568 REAL_CFLAGS="$CFLAGS"
3569 REAL_CPPFLAGS="$CPPFLAGS"
3572 if test "${HAVE_X11}" = "yes"; then
3573 DEFS="$C_SWITCH_X_SITE $DEFS"
3574 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
3576 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
3577 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
3579 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
3580 # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
3581 # but it's more convenient here to set LD_RUN_PATH since this
3582 # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
3583 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
3584 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
3588 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
3589 # header files included from there.
3590 AC_CACHE_CHECK([for Xkb], [emacs_cv_xkb],
3591 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
3592 #include <X11/XKBlib.h>]],
3593 [[XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);]])],
3595 [emacs_cv_xkb=no])])
3596 if test $emacs_cv_xkb = yes; then
3597 AC_DEFINE([HAVE_XKB], [1], [Define to 1 if you have the Xkb extension.])
3598 AC_CHECK_FUNCS([XkbRefreshKeyboardMapping XkbFreeNames])
3601 AC_CHECK_FUNCS([XrmSetDatabase XScreenResourceString XScreenNumberOfScreen])
3602 AC_CHECK_FUNCS([XDisplayCells XDestroySubwindows])
3605 if test "${window_system}" = "x11"; then
3606 AC_MSG_CHECKING([X11 version 6])
3607 AC_CACHE_VAL([emacs_cv_x11_version_6],
3608 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
3609 [[#if XlibSpecificationRelease < 6
3612 ]])], [emacs_cv_x11_version_6=yes],
3613 [emacs_cv_x11_version_6=no])])
3614 if test $emacs_cv_x11_version_6 = yes; then
3615 AC_MSG_RESULT([6 or newer])
3616 AC_DEFINE([HAVE_X11R6], [1],
3617 [Define to 1 if you have the X11R6 or newer version of Xlib.])
3618 AC_DEFINE([HAVE_X_I18N], [1], [Define if you have usable i18n support.])
3619 AC_CHECK_MEMBERS([XICCallback.callback], [], [], [#include <X11/Xlib.h>])
3620 ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
3624 *) AC_DEFINE([HAVE_X11R6_XIM], [1],
3625 [Define if you have usable X11R6-style XIM support.])
3629 AC_MSG_RESULT([before 6])
3633 ### Use -lrsvg-2 if available, unless '--with-rsvg=no' is specified.
3635 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" \
3636 || test "${opsys}" = "mingw32" || test "${HAVE_BE_APP}" = "yes" \
3637 || test "${window_system}" = "pgtk" \
3638 || test "${REALLY_ANDROID}" = "yes"; then
3639 if test "${with_rsvg}" != "no"; then
3640 RSVG_REQUIRED=2.14.0
3641 AS_IF([test "${REALLY_ANDROID}" = "yes"],
3642 [RSVG_MODULE="librsvg"],
3643 [RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"])
3645 EMACS_CHECK_MODULES([RSVG], [$RSVG_MODULE])
3646 AC_SUBST([RSVG_CFLAGS])
3647 AC_SUBST([RSVG_LIBS])
3649 if test $HAVE_RSVG = yes; then
3650 AC_DEFINE([HAVE_RSVG], [1], [Define to 1 if using librsvg.])
3651 CFLAGS="$CFLAGS $RSVG_CFLAGS"
3652 # Windows loads librsvg dynamically
3653 if test "${opsys}" = "mingw32"; then
3660 ### Use -lwebp if available, unless '--with-webp=no'
3662 if test "${with_webp}" != "no"; then
3663 if test "${HAVE_X11}" = "yes" || test "${opsys}" = "mingw32" \
3664 || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes" \
3665 || test "${HAVE_BE_APP}" = "yes" || test "${HAVE_PGTK}" = "yes" \
3666 || test "${REALLY_ANDROID}" = "yes"; then
3668 WEBP_MODULE="libwebpdemux >= $WEBP_REQUIRED"
3670 EMACS_CHECK_MODULES([WEBP], [$WEBP_MODULE])
3672 # WebPGetInfo is sometimes not present inside libwebpdemux, so
3673 # if it does not link, also check for libwebpdecoder.
3677 CFLAGS="$CFLAGS $WEBP_CFLAGS"
3678 LIBS="$LIBS $WEBP_LIBS"
3680 AS_IF([test "$REALLY_ANDROID" != "yes"], [
3681 AC_CHECK_FUNC([WebPGetInfo], [],
3682 [WEBP_MODULE="$WEBP_MODULE libwebpdecoder >= $WEBP_REQUIRED"
3684 AS_UNSET([WEBP_LIBS])
3685 AS_UNSET([WEBP_CFLAGS])
3686 EMACS_CHECK_MODULES([WEBP], [$WEBP_MODULE])])])
3691 AC_SUBST([WEBP_CFLAGS])
3692 AC_SUBST([WEBP_LIBS])
3694 if test $HAVE_WEBP = yes; then
3695 AC_DEFINE([HAVE_WEBP], [1], [Define to 1 if using libwebp.])
3696 # Windows loads libwebp dynamically
3697 if test "${opsys}" = "mingw32"; then
3703 ### Use -lsqlite3 if available, unless '--with-sqlite3=no'
3707 if test "${with_sqlite3}" != "no"; then
3708 if test "${REALLY_ANDROID}" = "yes"; then
3709 ndk_SEARCH_MODULE([sqlite3], [SQLITE3], [HAVE_SQLITE3=yes])
3711 if test "$HAVE_SQLITE3" = "yes"; then
3712 SAVE_CFLAGS="$CFLAGS"
3713 CFLAGS="$CFLAGS $SQLITE3_CFLAGS"
3714 AC_CHECK_DECL([sqlite3_open_v2], [HAVE_SQLITE=yes],
3715 [HAVE_SQLITE3=no], [#include <sqlite3.h>])
3716 CFLAGS="$SAVE_CFLAGS"
3719 AC_CHECK_LIB([sqlite3], [sqlite3_open_v2],
3722 if test "$HAVE_SQLITE3" = "yes"; then
3723 SQLITE3_LIBS=-lsqlite3
3724 LIBS="$SQLITE3_LIBS $LIBS"
3725 # Windows loads libsqlite dynamically
3726 if test "${opsys}" = "mingw32"; then
3729 AC_CHECK_LIB([sqlite3], [sqlite3_load_extension],
3730 [HAVE_SQLITE3_LOAD_EXTENSION=yes],
3731 [HAVE_SQLITE3_LOAD_EXTENSION=no])
3732 if test "$HAVE_SQLITE3_LOAD_EXTENSION" = "yes"; then
3733 AC_DEFINE([HAVE_SQLITE3_LOAD_EXTENSION], [1],
3734 [Define to 1 if sqlite3 supports loading extensions.])
3739 if test "$HAVE_SQLITE3" = "yes"; then
3740 AC_DEFINE([HAVE_SQLITE3], [1],
3741 [Define to 1 if you have the libsqlite3 library (-lsqlite).])
3745 AC_SUBST([SQLITE3_LIBS])
3746 AC_SUBST([SQLITE3_CFLAGS])
3749 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes" || \
3750 test "${HAVE_BE_APP}" = "yes" || test "${window_system}" = "pgtk" || \
3751 test "${REALLY_ANDROID}" = "yes"; then
3752 if test "${with_imagemagick}" != "no"; then
3753 if test -n "$BREW"; then
3754 # Homebrew doesn't link ImageMagick 6 by default, so make sure
3755 # pkgconfig can find it.
3756 export PKG_CONFIG_PATH="$PKG_CONFIG_PATH$PATH_SEPARATOR`$BREW --prefix imagemagick@6 2>/dev/null`/lib/pkgconfig"
3759 EMACS_CHECK_MODULES([IMAGEMAGICK], [MagickWand >= 7])
3760 if test $HAVE_IMAGEMAGICK = yes; then
3761 AC_DEFINE([HAVE_IMAGEMAGICK7], [1],
3762 [Define to 1 if using ImageMagick7.])
3764 ## 6.3.5 is the earliest version known to work; see Bug#17339.
3765 ## 6.8.2 makes Emacs crash; see Bug#13867.
3766 EMACS_CHECK_MODULES([IMAGEMAGICK], [Wand >= 6.3.5 Wand != 6.8.2])
3769 if test $HAVE_IMAGEMAGICK = yes; then
3772 CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
3773 LIBS="$IMAGEMAGICK_LIBS $LIBS"
3774 if test "$REALLY_ANDROID" != "yes"; then
3775 AC_CHECK_FUNCS([MagickRelinquishMemory MagickExportImagePixels \
3776 MagickMergeImageLayers MagickAutoOrientImage])
3778 # AC_CHECK_FUNCS doesn't work for Android dependencies because
3779 # they are built alongside Emacs.
3780 AC_CHECK_DECLS([MagickRelinquishMemory,MagickExportImagePixels,
3781 MagickMergeImageLayers,MagickAutoOrientImage],
3782 [], [], [#include <MagickWand/MagickWand.h>])
3786 # Check that ImageMagick links. It does not link on Fedora 25
3787 # with './configure CC=clang', as pkg-config outputs flags like
3788 # -lomp that work for GCC but not Clang.
3789 if test "$ac_cv_func_MagickRelinquishMemory" != yes \
3790 && test "$REALLY_ANDROID" != "yes"; then
3794 if test $HAVE_IMAGEMAGICK = yes; then
3795 AC_DEFINE([HAVE_IMAGEMAGICK], [1], [Define to 1 if using ImageMagick.])
3797 if test "${with_imagemagick}" != "no"; then
3798 AC_MSG_ERROR([ImageMagick wanted, but it does not compile. Maybe some library files are missing?]);
3803 AC_SUBST([IMAGEMAGICK_CFLAGS])
3804 AC_SUBST([IMAGEMAGICK_LIBS])
3808 AC_CHECK_LIB([anl], [getaddrinfo_a], [HAVE_GETADDRINFO_A=yes])
3809 if test "${HAVE_GETADDRINFO_A}" = "yes"; then
3810 AC_DEFINE([HAVE_GETADDRINFO_A], [1],
3811 [Define to 1 if you have getaddrinfo_a for asynchronous DNS resolution.])
3812 GETADDRINFO_A_LIBS="-lanl"
3813 AC_SUBST([GETADDRINFO_A_LIBS])
3818 gtk_term_header=$term_header
3821 if test "${opsys}" != "mingw32"; then
3822 if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
3823 GLIB_REQUIRED=2.37.5
3824 if test "${window_system}" = "x11"; then
3827 GTK_REQUIRED=3.22.23
3829 GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
3831 dnl Checks for libraries.
3832 EMACS_CHECK_MODULES([GTK], [$GTK_MODULES],
3833 [pkg_check_gtk=yes], [pkg_check_gtk=no])
3834 if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
3835 AC_MSG_ERROR([$GTK_PKG_ERRORS])
3837 if test "$pkg_check_gtk" = "yes"; then
3838 AC_DEFINE([HAVE_GTK3], [1], [Define to 1 if using GTK 3 or later.])
3839 GTK_OBJ=emacsgtkfixed.o
3840 gtk_term_header=gtkutil.h
3841 USE_GTK_TOOLKIT="GTK3"
3842 if test "x$ac_enable_gtk_deprecation_warnings" = x; then
3843 AC_DEFINE([GDK_DISABLE_DEPRECATION_WARNINGS], [1],
3844 [Define to 1 to disable GTK+/GDK deprecation warnings.])
3845 AC_DEFINE([GLIB_DISABLE_DEPRECATION_WARNINGS], [1],
3846 [Define to 1 to disable Glib deprecation warnings.])
3850 gtk3_pkg_errors="$GTK_PKG_ERRORS "
3854 if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
3857 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
3859 dnl Checks for libraries.
3860 EMACS_CHECK_MODULES([GTK], [$GTK_MODULES],
3861 [pkg_check_gtk=yes], [pkg_check_gtk=no])
3862 if test "$pkg_check_gtk" = "no" &&
3863 { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
3865 AC_MSG_ERROR([$gtk3_pkg_errors$GTK_PKG_ERRORS])
3867 test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
3874 if test x"$pkg_check_gtk" = xyes; then
3876 AC_SUBST([GTK_LIBS])
3877 CFLAGS="$CFLAGS $GTK_CFLAGS"
3878 LIBS="$GTK_LIBS $LIBS"
3879 dnl Try to compile a simple GTK program.
3880 AC_CACHE_CHECK([whether GTK compiles], [emacs_cv_gtk_compiles],
3883 [[/* Check the Gtk and Glib APIs. */
3884 #include <gtk/gtk.h>
3885 #include <glib-object.h>
3887 callback (GObject *go, GParamSpec *spec, gpointer user_data)
3891 GtkSettings *gs = 0;
3892 /* Use G_CALLBACK to make sure function pointers can be cast to void *;
3893 strict C prohibits this. Use gtk_main_iteration to test that the
3894 libraries are there. */
3895 if (g_signal_handler_find (G_OBJECT (gs), G_SIGNAL_MATCH_FUNC,
3896 0, 0, 0, G_CALLBACK (callback), 0))
3897 gtk_main_iteration ();
3899 [emacs_cv_gtk_compiles=yes], [emacs_cv_gtk_compiles=no])])
3900 if test "${emacs_cv_gtk_compiles}" != "yes"; then
3902 if test "$USE_X_TOOLKIT" != "maybe"; then
3903 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
3906 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
3908 AC_DEFINE([USE_GTK], [1], [Define to 1 if using GTK.])
3909 GTK_OBJ="gtkutil.o $GTK_OBJ"
3910 term_header=$gtk_term_header
3912 AC_MSG_WARN([[Your version of Gtk+ will have problems with
3913 closing open displays. This is no problem if you just use
3914 one display, but if you use more than one and close one of them
3916 See https://gitlab.gnome.org/GNOME/gtk/issues/221]])
3923 if test "${HAVE_GTK}" = "yes"; then
3925 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
3926 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
3927 if test "$with_toolkit_scroll_bars" != no; then
3928 with_toolkit_scroll_bars=yes
3931 term_header=gtkutil.h
3933 if test "${USE_GTK_TOOLKIT}" = GTK2; then
3935 dnl Check if we have the old file selection dialog declared and
3936 dnl in the link library. In 2.x it may be in the library,
3937 dnl but not declared if deprecated featured has been selected out.
3938 dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
3939 HAVE_GTK_FILE_SELECTION=no
3940 AC_CHECK_DECL([GTK_TYPE_FILE_SELECTION],
3941 [HAVE_GTK_FILE_SELECTION=yes],
3942 [HAVE_GTK_FILE_SELECTION=no],
3943 [AC_INCLUDES_DEFAULT
3944 #include <gtk/gtk.h>])
3945 if test "$HAVE_GTK_FILE_SELECTION" = yes; then
3946 AC_CHECK_FUNCS([gtk_file_selection_new])
3949 dnl This procedure causes a bug on certain Ubuntu GTK+2 builds
3950 AC_CHECK_FUNCS([gtk_window_set_has_resize_grip])
3959 if test "$window_system" = "pgtk"; then
3960 PGTK_OBJ="pgtkfns.o pgtkterm.o pgtkselect.o pgtkmenu.o pgtkim.o xsettings.o"
3961 PGTK_LIBS="$GTK_LIBS"
3963 AC_SUBST([PGTK_OBJ])
3964 AC_SUBST([PGTK_LIBS])
3966 AC_CHECK_FUNCS([malloc_trim])
3968 dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
3969 dnl other platforms.
3972 if test "${with_dbus}" = "yes"; then
3973 EMACS_CHECK_MODULES([DBUS], [dbus-1 >= 1.0])
3974 if test "$HAVE_DBUS" = yes; then
3975 AC_DEFINE([HAVE_DBUS], [1], [Define to 1 if using D-Bus.])
3976 dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1.
3977 dnl dbus_type_is_valid and dbus_validate_* have been introduced in
3979 dnl dbus_message_set_allow_interactive_authorization was introduced
3980 dnl in D-Bus 1.8.10.
3982 LIBS="$LIBS $DBUS_LIBS"
3983 AC_CHECK_FUNCS([dbus_watch_get_unix_fd \
3984 dbus_type_is_valid \
3985 dbus_validate_bus_name \
3986 dbus_validate_path \
3987 dbus_validate_interface \
3988 dbus_validate_member \
3989 dbus_message_set_allow_interactive_authorization])
3994 AC_SUBST([DBUS_CFLAGS])
3995 AC_SUBST([DBUS_LIBS])
3996 AC_SUBST([DBUS_OBJ])
3998 dnl GSettings has been tested under GNU/Linux only.
4000 if test "${HAVE_X11}" = "yes" -o "${window_system}" = "pgtk" && test "${with_gsettings}" = "yes"; then
4001 EMACS_CHECK_MODULES([GSETTINGS], [gio-2.0 >= 2.26])
4002 if test "$HAVE_GSETTINGS" = "yes"; then
4004 CFLAGS="$CFLAGS $GSETTINGS_CFLAGS"
4006 LIBS="$LIBS $GSETTINGS_LIBS"
4007 AC_CACHE_CHECK([whether GSettings is in gio], [emacs_cv_gsettings_in_gio],
4010 [[/* Check that gsettings really is present. */
4011 #include <glib-object.h>
4012 #include <gio/gio.h>
4015 GSettings *settings;
4016 GVariant *val = g_settings_get_value (settings, "");
4018 [emacs_cv_gsettings_in_gio=yes], [emacs_cv_gsettings_in_gio=no])])
4020 if test "$emacs_cv_gsettings_in_gio" = "yes"; then
4021 AC_DEFINE([HAVE_GSETTINGS], [1], [Define to 1 if using GSettings.])
4022 SETTINGS_CFLAGS="$GSETTINGS_CFLAGS"
4023 SETTINGS_LIBS="$GSETTINGS_LIBS"
4024 test "$with_gconf" = "yes" || with_gconf=no
4030 AC_SUBST([HAVE_GSETTINGS])
4032 dnl GConf has been tested under GNU/Linux only.
4033 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
4035 if test "${HAVE_X11}" = "yes" -o "${window_system}" = "pgtk" && test "${with_gconf}" != "no"; then
4036 EMACS_CHECK_MODULES([GCONF], [gconf-2.0 >= 2.13])
4037 if test "$HAVE_GCONF" = yes; then
4038 AC_DEFINE([HAVE_GCONF], [1], [Define to 1 if using GConf.])
4039 dnl Newer GConf doesn't link with g_objects, so this is not defined.
4040 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
4041 SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
4045 if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
4046 EMACS_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0])
4047 if test "$HAVE_GOBJECT" = "yes"; then
4048 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS"
4049 SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS"
4051 SAVE_CFLAGS="$CFLAGS"
4053 CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
4054 LIBS="$SETTINGS_LIBS $LIBS"
4055 CFLAGS="$SAVE_CFLAGS"
4058 AC_SUBST([SETTINGS_CFLAGS])
4059 AC_SUBST([SETTINGS_LIBS])
4061 USE_STARTUP_NOTIFICATION=no
4062 if test "${HAVE_GTK}" = "yes"; then
4063 USE_STARTUP_NOTIFICATION=yes
4065 AC_SUBST([USE_STARTUP_NOTIFICATION])
4067 dnl SELinux is available for Linux kernel based systems only.
4068 dnl These include GNU/Linux and Android.
4072 if test "${with_selinux}" = "yes"; then
4073 if test "$REALLY_ANDROID" = "yes"; then
4074 ndk_SEARCH_MODULE([libselinux], [LIBSELINUX],
4075 [HAVE_LIBSELINUX=yes])
4077 AC_CHECK_LIB([selinux], [lgetfilecon],
4078 [HAVE_LIBSELINUX=yes],
4079 [HAVE_LIBSELINUX=no])
4081 if test "$HAVE_LIBSELINUX" = yes; then
4082 AC_DEFINE([HAVE_LIBSELINUX], [1], [Define to 1 if using SELinux.])
4083 if test "$REALLY_ANDROID" != "yes"; then
4084 LIBSELINUX_LIBS=-lselinux
4088 AC_SUBST([LIBSELINUX_LIBS])
4089 AC_SUBST([LIBSELINUX_CFLAGS])
4092 if test "${with_gnutls}" != "no" ; then
4093 EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.2],
4094 [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no])
4095 if test "${HAVE_GNUTLS}" = "yes"; then
4096 AC_DEFINE([HAVE_GNUTLS], [1], [Define if using GnuTLS.])
4099 # Windows loads GnuTLS dynamically
4100 if test "${opsys}" = "mingw32"; then
4105 AC_SUBST([LIBGNUTLS_LIBS])
4106 AC_SUBST([LIBGNUTLS_CFLAGS])
4109 if test "${with_libsystemd}" = "yes" ; then
4110 dnl This code has been tested with libsystemd 222 and later.
4111 dnl FIXME: Find the earliest version number for which Emacs should work,
4112 dnl and change '222' to that number.
4113 EMACS_CHECK_MODULES([LIBSYSTEMD], [libsystemd >= 222],
4114 [HAVE_LIBSYSTEMD=yes], [HAVE_LIBSYSTEMD=no])
4115 if test "${HAVE_LIBSYSTEMD}" = "yes"; then
4116 AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define if using libsystemd.])
4120 AC_SUBST([LIBSYSTEMD_LIBS])
4121 AC_SUBST([LIBSYSTEMD_CFLAGS])
4127 if test "${with_tree_sitter}" != "no"; then
4128 dnl Tree-sitter 0.20.2 added support to change the malloc it uses
4129 dnl at runtime, we need that feature. However, tree-sitter's
4130 dnl Makefile has problems, until that's fixed, all tree-sitter
4131 dnl libraries distributed are versioned 0.6.3. We try to
4132 dnl accept a tree-sitter library that has incorrect version as long
4133 dnl as it supports changing malloc.
4134 EMACS_CHECK_MODULES([TREE_SITTER], [tree-sitter >= 0.20.2],
4135 [HAVE_TREE_SITTER=yes], [HAVE_TREE_SITTER=no])
4136 if test "${HAVE_TREE_SITTER}" = yes; then
4137 AC_DEFINE(HAVE_TREE_SITTER, 1, [Define if using tree-sitter.])
4140 EMACS_CHECK_MODULES([TREE_SITTER], [tree-sitter >= 0.6.3],
4141 [HAVE_TREE_SITTER=yes], [HAVE_TREE_SITTER=no])
4142 if test "${HAVE_TREE_SITTER}" = yes; then
4145 CFLAGS="$CFLAGS $TREE_SITTER_CFLAGS"
4146 LIBS="$TREE_SITTER_LIBS $LIBS"
4147 AC_CHECK_FUNCS([ts_set_allocator])
4150 if test "$ac_cv_func_ts_set_allocator" = yes; then
4151 AC_DEFINE(HAVE_TREE_SITTER, 1, [Define if using tree-sitter.])
4154 AC_MSG_ERROR([Tree-sitter library exists but its version is too old]);
4161 # Windows loads tree-sitter dynamically
4162 if test "${opsys}" = "mingw32"; then
4167 AC_SUBST(TREE_SITTER_LIBS)
4168 AC_SUBST(TREE_SITTER_CFLAGS)
4173 dnl MS Windows native file monitor is available for mingw32 only.
4174 case $with_file_notification,$opsys in
4176 AC_MSG_ERROR(['--with-file-notification=w32' was specified, but
4177 this is only supported on MS-Windows native and MinGW32 builds.
4178 Consider using gfile instead.])
4180 w32,* | yes,mingw32)
4181 AC_CHECK_HEADER([windows.h])
4182 if test "$ac_cv_header_windows_h" = yes ; then
4183 AC_DEFINE([HAVE_W32NOTIFY], [1], [Define to 1 to use w32notify.])
4184 NOTIFY_OBJ=w32notify.o
4185 NOTIFY_SUMMARY="yes (w32)"
4189 dnl inotify is available only on Linux-kernel based systems.
4190 case $with_file_notification,$NOTIFY_OBJ in
4192 AC_CHECK_HEADER([sys/inotify.h])
4193 if test "$ac_cv_header_sys_inotify_h" = yes ; then
4194 AC_CHECK_FUNCS([inotify_init inotify_init1])
4195 if test "$ac_cv_func_inotify_init" = yes; then
4196 AC_DEFINE([HAVE_INOTIFY], [1], [Define to 1 to use inotify.])
4197 NOTIFY_OBJ=inotify.o
4198 NOTIFY_SUMMARY="yes (inotify)"
4203 AS_IF([test "$opsys" != "haiku"], [
4204 dnl kqueue is available on BSD-like systems and Haiku, but Haiku's
4205 dnl implementation cannot monitor filesystem activity.
4206 case $with_file_notification,$NOTIFY_OBJ in
4208 EMACS_CHECK_MODULES([KQUEUE], [libkqueue])
4209 if test "$HAVE_KQUEUE" = "yes"; then
4210 AC_DEFINE([HAVE_KQUEUE], [1], [Define to 1 to use kqueue.])
4211 CPPFLAGS="$CPPFLAGS -I/usr/include/kqueue"
4212 NOTIFY_CFLAGS=$KQUEUE_CFLAGS
4213 NOTIFY_LIBS=$KQUEUE_LIBS
4215 NOTIFY_SUMMARY="yes -lkqueue"
4217 AC_SEARCH_LIBS([kqueue], [])
4218 if test "$ac_cv_search_kqueue" != no; then
4219 AC_DEFINE([HAVE_KQUEUE], [1], [Define to 1 to use kqueue.])
4221 NOTIFY_SUMMARY="yes (kqueue)"
4226 dnl g_file_monitor exists since glib 2.18. G_FILE_MONITOR_EVENT_MOVED
4227 dnl has been added in glib 2.24. It has been tested under
4229 case $with_file_notification,$NOTIFY_OBJ in
4231 if test "${HAVE_NS}" = yes; then
4232 AC_MSG_ERROR(['--with-file-notification=gfile' is not supported in NextStep builds.
4233 Consider kqueue instead.])
4235 EMACS_CHECK_MODULES([GFILENOTIFY], [gio-2.0 >= 2.24])
4236 if test "$HAVE_GFILENOTIFY" = "yes"; then
4237 AC_DEFINE([HAVE_GFILENOTIFY], [1], [Define to 1 if using GFile.])
4238 NOTIFY_CFLAGS=$GFILENOTIFY_CFLAGS
4239 NOTIFY_LIBS=$GFILENOTIFY_LIBS
4240 NOTIFY_OBJ=gfilenotify.o
4241 NOTIFY_SUMMARY="yes -lgio (gfile)"
4246 case $with_file_notification,$NOTIFY_OBJ in
4247 yes,* | no,* | *,?*) ;;
4248 *) AC_MSG_ERROR([File notification '$with_file_notification' requested but requirements not found.]) ;;
4251 if test -n "$NOTIFY_OBJ"; then
4252 AC_DEFINE([USE_FILE_NOTIFY], [1],
4253 [Define to 1 if using file notifications.])
4255 AC_SUBST([NOTIFY_CFLAGS])
4256 AC_SUBST([NOTIFY_LIBS])
4257 AC_SUBST([NOTIFY_OBJ])
4259 dnl Do not put whitespace before the #include statements below.
4260 dnl Older compilers (eg sunos4 cc) choke on it.
4263 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
4264 if test "$with_xaw3d" != no; then
4265 AC_CACHE_VAL([emacs_cv_xaw3d],
4266 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4267 #include <X11/Intrinsic.h>
4268 #include <X11/Xaw3d/Simple.h>]],
4270 [AC_CHECK_LIB([Xaw3d], [XawScrollbarSetThumb],
4271 [emacs_cv_xaw3d=yes],
4272 [emacs_cv_xaw3d=no])],
4273 [emacs_cv_xaw3d=no])])
4277 if test $emacs_cv_xaw3d = yes; then
4278 AC_MSG_CHECKING([for xaw3d])
4279 AC_MSG_RESULT([yes; using Lucid toolkit])
4283 AC_DEFINE([HAVE_XAW3D], [1],
4284 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
4286 AC_MSG_CHECKING([for xaw3d])
4288 AC_MSG_CHECKING([for libXaw])
4289 AC_CACHE_VAL([emacs_cv_xaw],
4290 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4291 #include <X11/Intrinsic.h>
4292 #include <X11/Xaw/Simple.h>]],
4295 [emacs_cv_xaw=no])])
4296 if test $emacs_cv_xaw = yes; then
4297 AC_MSG_RESULT([yes; using Lucid toolkit])
4300 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
4301 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
4303 AC_MSG_ERROR([No X toolkit could be found.
4304 If you are sure you want Emacs compiled without an X toolkit, pass
4306 to configure. Otherwise, install the development libraries for the toolkit
4307 that you want to use (e.g. Gtk+) and re-run configure.])
4312 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
4316 if test "${USE_X_TOOLKIT}" != "none"; then
4317 AC_MSG_CHECKING([X11 toolkit version])
4318 AC_CACHE_VAL([emacs_cv_x11_toolkit_version_6],
4319 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Intrinsic.h>]],
4320 [[#if XtSpecificationRelease < 6
4323 ]])], [emacs_cv_x11_toolkit_version_6=yes],
4324 [emacs_cv_x11_toolkit_version_6=no])])
4325 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
4326 if test $emacs_cv_x11_toolkit_version_6 = yes; then
4327 AC_MSG_RESULT([6 or newer])
4328 AC_DEFINE([HAVE_X11XTR6], [1],
4329 [Define to 1 if you have the X11R6 or newer version of Xt.])
4330 LIBXTR6="-lSM -lICE"
4332 ## Use libw.a along with X11R6 Xt.
4333 unixware) LIBXTR6="$LIBXTR6 -lw" ;;
4336 AC_MSG_RESULT([before 6])
4339 dnl If using toolkit, check whether libXmu.a exists.
4340 dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
4342 if test x$HAVE_X11XTR6 = xyes; then
4343 OTHERLIBS='-lXt -lSM -lICE'
4347 AC_SEARCH_LIBS([XmuConvertStandardSelection], [Xmu], [], [], [$OTHERLIBS])
4348 if test "X$LIBS" != "X$OLDLIBS"; then
4349 LIBXMU=$ac_cv_search_XmuConvertStandardSelection
4352 dnl ac_cv_search_XmuConvertStandardSelection is also referenced below.
4358 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
4359 # OpenMotif may be installed in such a way on some GNU/Linux systems.
4360 if test -d /usr/include/openmotif; then
4361 CPPFLAGS="-I/usr/include/openmotif $CPPFLAGS"
4362 emacs_cv_openmotif=yes
4363 case "$canonical" in
4364 x86_64-*-linux-gnu* | powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*)
4365 test -d /usr/lib64/openmotif && LDFLAGS="-L/usr/lib64/openmotif $LDFLAGS"
4368 test -d /usr/lib/openmotif && LDFLAGS="-L/usr/lib/openmotif $LDFLAGS"
4371 emacs_cv_openmotif=no
4373 AC_CACHE_CHECK([for (Open)Motif version 2.1], [emacs_cv_motif_version_2_1],
4374 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Xm/Xm.h>]],
4375 [[#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
4378 Motif version prior to 2.1.
4380 [emacs_cv_motif_version_2_1=yes],
4381 [emacs_cv_motif_version_2_1=no])])
4382 if test $emacs_cv_motif_version_2_1 = yes; then
4383 AC_CHECK_LIB([Xp], [XpCreateContext], [LIBXP=-lXp])
4384 if test x$emacs_cv_openmotif = xyes; then
4385 REAL_CPPFLAGS="-I/usr/include/openmotif $REAL_CPPFLAGS"
4388 # We put this in CFLAGS temporarily to precede other -I options
4389 # that might be in CFLAGS temporarily.
4390 # We put this in CPPFLAGS where it precedes the other -I options.
4391 OLD_CPPFLAGS=$CPPFLAGS
4393 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
4394 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
4395 AC_CACHE_CHECK([for LessTif where some systems put it], [emacs_cv_lesstif],
4398 [[#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>
4401 [emacs_cv_lesstif=yes],
4402 [emacs_cv_lesstif=no])])
4403 if test $emacs_cv_lesstif = yes; then
4404 # Make sure this -I option remains in CPPFLAGS after it is set
4405 # back to REAL_CPPFLAGS.
4406 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
4407 # have those other -I options anyway. Ultimately, having this
4408 # directory ultimately in CPPFLAGS will be enough.
4409 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
4410 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
4413 CPPFLAGS=$OLD_CPPFLAGS
4416 AC_CHECK_HEADER([Xm/BulletinB.h], [],
4417 [AC_MSG_ERROR([Motif toolkit requested but requirements not found.])])
4420 dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
4421 dnl using Motif or Xaw3d is available, and unless
4422 dnl --with-toolkit-scroll-bars=no was specified.
4424 AH_TEMPLATE([USE_TOOLKIT_SCROLL_BARS],
4425 [Define to 1 if we should use toolkit scroll bars.])dnl
4426 USE_TOOLKIT_SCROLL_BARS=no
4427 if test "${with_toolkit_scroll_bars}" != "no"; then
4428 if test "${USE_X_TOOLKIT}" != "none"; then
4429 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
4430 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4432 USE_TOOLKIT_SCROLL_BARS=yes
4433 elif test "${HAVE_XAW3D}" = "yes" || test "${USE_X_TOOLKIT}" = "LUCID"; then
4434 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4435 USE_TOOLKIT_SCROLL_BARS=yes
4437 elif test "${HAVE_GTK}" = "yes"; then
4438 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4439 USE_TOOLKIT_SCROLL_BARS=yes
4440 elif test "${HAVE_NS}" = "yes"; then
4441 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4442 USE_TOOLKIT_SCROLL_BARS=yes
4443 elif test "${HAVE_W32}" = "yes"; then
4444 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4445 USE_TOOLKIT_SCROLL_BARS=yes
4446 elif test "${HAVE_BE_APP}" = "yes"; then
4447 AC_DEFINE([USE_TOOLKIT_SCROLL_BARS])
4448 USE_TOOLKIT_SCROLL_BARS=yes
4450 elif test "${window_system}" != "x11" && test "${window_system}" != "none"; then
4451 AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for your system])
4454 dnl See if XIM is available.
4455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4456 #include <X11/Xlib.h>
4457 #include <X11/Xresource.h>]],
4458 [[XIMProc callback;]])],
4460 AC_DEFINE([HAVE_XIM], [1], [Define to 1 if XIM is available])],
4463 dnl Note this is non-standard. --with-xim does not control whether
4464 dnl XIM support is compiled in, it only affects the runtime default of
4465 dnl use_xim in xterm.c.
4466 if test "${with_xim}" != "no"; then
4467 AC_DEFINE([USE_XIM], [1],
4468 [Define to 1 to default runtime use of XIM to on.])
4473 if test "${HAVE_X11}" = "yes"; then
4476 [[#include <X11/Intrinsic.h>
4477 #include <X11/extensions/Xrender.h>
4479 [[return !XRenderQueryExtension;]])],
4480 [AC_CHECK_LIB([Xrender], [XRenderQueryExtension], [HAVE_XRENDER=yes])])
4481 if test $HAVE_XRENDER = yes; then
4482 XRENDER_LIBS="-lXrender"
4483 AC_SUBST([XRENDER_LIBS])
4484 AC_DEFINE([HAVE_XRENDER], [1], [Define to 1 if XRender is available.])
4489 if test "${HAVE_X11}" = "yes"; then
4490 if test "${with_cairo}" != "no"; then
4491 CAIRO_REQUIRED=1.8.0
4492 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
4493 EMACS_CHECK_MODULES([CAIRO], [$CAIRO_MODULE])
4494 if test $HAVE_CAIRO = yes; then
4495 AS_IF([test "x$with_cairo_xcb" = "xyes"], [
4496 CAIRO_XCB_MODULE="cairo-xcb >= $CAIRO_REQUIRED"
4497 EMACS_CHECK_MODULES([CAIRO_XCB], [$CAIRO_XCB_MODULE])
4498 AS_IF([test "x$HAVE_CAIRO_XCB" = "xyes"], [
4499 CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_XCB_CFLAGS"
4500 CAIRO_LIBS="$CAIRO_LIBS $CAIRO_XCB_LIBS"
4501 AC_DEFINE([USE_CAIRO_XCB], [1],
4502 [Define to 1 if cairo XCB surfaces are available.])])])
4503 AC_DEFINE([USE_CAIRO], [1], [Define to 1 if using cairo.])
4504 CFLAGS="$CFLAGS $CAIRO_CFLAGS"
4505 LIBS="$LIBS $CAIRO_LIBS"
4506 AC_SUBST([CAIRO_CFLAGS])
4507 AC_SUBST([CAIRO_LIBS])
4509 AC_MSG_WARN([cairo requested but not found.])
4514 dnl Enable xwidgets if GTK3 and WebKitGTK+ are available.
4515 dnl Enable xwidgets if macOS Cocoa and WebKit framework are available.
4518 if test "$with_xwidgets" != "no"; then
4519 if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then
4520 WEBKIT_REQUIRED=2.12
4521 WEBKIT_BROKEN=2.41.92
4522 WEBKIT_MODULES="webkit2gtk-4.1 >= $WEBKIT_REQUIRED webkit2gtk-4.1 < $WEBKIT_BROKEN"
4523 EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
4524 if test "$HAVE_WEBKIT" = "no"; then
4525 WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED webkit2gtk-4.0 < $WEBKIT_BROKEN"
4526 EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
4528 HAVE_XWIDGETS=$HAVE_WEBKIT
4529 XWIDGETS_OBJ="xwidget.o"
4530 if test "$HAVE_X_WINDOWS" = "yes" && test "${with_cairo}" = "no"; then
4531 CAIRO_XLIB_MODULES="cairo >= 1.8.0 cairo-xlib >= 1.8.0"
4532 EMACS_CHECK_MODULES([CAIRO_XLIB], [$CAIRO_XLIB_MODULES])
4533 if test $HAVE_CAIRO_XLIB = "yes"; then
4534 CAIRO_CFLAGS="$CAIRO_XLIB_CFLAGS"
4535 CAIRO_LIBS="$CAIRO_XLIB_LIBS"
4536 AC_SUBST([CAIRO_CFLAGS])
4537 AC_SUBST([CAIRO_LIBS])
4539 AC_MSG_ERROR([xwidgets requested, but a suitable cairo installation wasn't found])
4542 elif test "${NS_IMPL_COCOA}" = "yes"; then
4543 dnl FIXME: Check framework WebKit2
4544 dnl WEBKIT_REQUIRED=M.m.p
4545 WEBKIT_LIBS="-Wl,-framework -Wl,WebKit"
4546 WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers"
4548 HAVE_XWIDGETS=$HAVE_WEBKIT
4549 XWIDGETS_OBJ="xwidget.o"
4550 NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o"
4551 dnl Update NS_OBJC_OBJ with added nsxwidget.o
4552 AC_SUBST([NS_OBJC_OBJ])
4554 AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or macOS Cocoa as window system.])
4557 test $HAVE_XWIDGETS = yes ||
4558 AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not found.])
4560 AC_DEFINE([HAVE_XWIDGETS], [1], [Define to 1 if you have xwidgets support.])
4562 AC_SUBST([XWIDGETS_OBJ])
4564 if test "$window_system" = "pgtk"; then
4565 CAIRO_REQUIRED=1.12.0
4566 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
4567 EMACS_CHECK_MODULES([CAIRO], [$CAIRO_MODULE])
4568 if test $HAVE_CAIRO = yes; then
4569 AC_DEFINE([USE_CAIRO], [1], [Define to 1 if using cairo.])
4571 AC_MSG_ERROR([cairo required but not found.])
4574 CFLAGS="$CFLAGS $CAIRO_CFLAGS"
4575 LIBS="$LIBS $CAIRO_LIBS"
4576 AC_SUBST([CAIRO_CFLAGS])
4577 AC_SUBST([CAIRO_LIBS])
4580 if test "${HAVE_BE_APP}" = "yes"; then
4581 if test "${with_be_cairo}" != "no"; then
4582 CAIRO_REQUIRED=1.8.0
4583 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
4584 EMACS_CHECK_MODULES([CAIRO], [$CAIRO_MODULE])
4585 if test $HAVE_CAIRO = yes; then
4586 AC_DEFINE([USE_BE_CAIRO], [1], [Define to 1 if using cairo on Haiku.])
4587 CFLAGS="$CFLAGS $CAIRO_CFLAGS"
4588 LIBS="$LIBS $CAIRO_LIBS"
4589 AC_SUBST([CAIRO_CFLAGS])
4590 AC_SUBST([CAIRO_LIBS])
4592 AC_MSG_WARN([cairo requested but not found.])
4597 ### Start of font-backend (under any platform) section.
4598 # (nothing here yet -- this is a placeholder)
4599 ### End of font-backend (under any platform) section.
4601 ### Start of font-backend (under X11) section.
4602 if test "${HAVE_X11}" = "yes"; then
4603 if test $HAVE_CAIRO = yes; then
4604 dnl Strict linkers fail with
4605 dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
4606 dnl if -lfreetype is not specified.
4607 dnl The following is needed to set FREETYPE_LIBS.
4608 EMACS_CHECK_MODULES([FREETYPE], [freetype2])
4610 test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR([cairo requires libfreetype])
4612 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4614 test "$HAVE_FONTCONFIG" = "no" &&
4615 AC_MSG_ERROR([cairo requires libfontconfig])
4616 dnl For the "Does Emacs use" message at the end.
4619 ## Use -lXft if available, unless '--with-xft=no'.
4621 if test "x${with_x}" = "xno"; then
4625 if test "$with_xft" != no; then
4626 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4627 with_xft=$HAVE_FONTCONFIG
4630 if test "x${with_xft}" != "xno"; then
4632 EMACS_CHECK_MODULES([XFT], [xft >= 0.13.0], [], [HAVE_XFT=no])
4633 ## Because xterm.c uses XRenderQueryExtension when XFT is
4634 ## enabled, we also need to link to -lXrender.
4635 if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
4636 OLD_CPPFLAGS="$CPPFLAGS"
4637 OLD_CFLAGS="$CFLAGS"
4639 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
4640 CFLAGS="$CFLAGS $XFT_CFLAGS"
4641 LIBS="$XFT_LIBS $LIBS"
4642 AC_CHECK_HEADER([X11/Xft/Xft.h],
4643 [AC_CHECK_LIB([Xft], [XftFontOpen], [HAVE_XFT=yes],
4646 [[#include <X11/X.h>]])
4648 if test "${HAVE_XFT}" = "yes"; then
4649 AC_DEFINE([HAVE_XFT], [1], [Define to 1 if you have the Xft library.])
4650 AC_SUBST([XFT_LIBS])
4651 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
4652 fi # "${HAVE_XFT}" = "yes"
4653 CPPFLAGS=$OLD_CPPFLAGS
4657 # Make sure XFT is disabled if we found XFT but not XRender
4659 fi # "$HAVE_XFT" != no
4660 fi # "x${with_xft}" != "xno"
4662 if test "$HAVE_XFT" != "yes"; then
4663 dnl For the "Does Emacs use" message at the end.
4667 dnl Strict linkers fail with
4668 dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
4669 dnl if -lfreetype is not specified.
4670 dnl The following is needed to set FREETYPE_LIBS.
4671 EMACS_CHECK_MODULES([FREETYPE], [freetype2])
4673 test "$HAVE_FREETYPE" = "no" &&
4674 AC_MSG_ERROR([libxft requires libfreetype])
4676 fi # $HAVE_CAIRO != yes
4679 if test "${HAVE_FREETYPE}" = "yes"; then
4680 AC_DEFINE([HAVE_FREETYPE], [1],
4681 [Define to 1 if using the freetype and fontconfig libraries.])
4684 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
4685 LIBS="$FREETYPE_LIBS $LIBS"
4686 AC_CHECK_FUNCS([FT_Face_GetCharVariantIndex])
4689 if test "${with_libotf}" != "no"; then
4690 EMACS_CHECK_MODULES([LIBOTF], [libotf])
4691 if test "$HAVE_LIBOTF" = "yes"; then
4692 AC_DEFINE([HAVE_LIBOTF], [1], [Define to 1 if using libotf.])
4693 AC_CHECK_LIB([otf], [OTF_get_variation_glyphs],
4694 [HAVE_OTF_GET_VARIATION_GLYPHS=yes],
4695 [HAVE_OTF_GET_VARIATION_GLYPHS=no])
4696 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
4697 AC_DEFINE([HAVE_OTF_GET_VARIATION_GLYPHS], [1],
4698 [Define to 1 if libotf has OTF_get_variation_glyphs.])
4700 if $PKG_CONFIG --atleast-version=0.9.16 libotf; then :; else
4701 AC_DEFINE([HAVE_OTF_KANNADA_BUG], [1],
4702 [Define to 1 if libotf is affected by https://debbugs.gnu.org/28110.])
4706 dnl FIXME should there be an error if HAVE_FREETYPE != yes?
4707 dnl Does the new font backend require it, or can it work without it?
4711 if test "${HAVE_LIBOTF}" = yes; then
4712 if test "${with_m17n_flt}" != "no"; then
4713 EMACS_CHECK_MODULES([M17N_FLT], [m17n-flt])
4714 if test "$HAVE_M17N_FLT" = "yes"; then
4715 AC_DEFINE([HAVE_M17N_FLT], [1], [Define to 1 if using libm17n-flt.])
4719 else # "${HAVE_X11}" != "yes"
4720 if test $window_system = pgtk; then
4721 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4722 EMACS_CHECK_MODULES([FREETYPE], [freetype2])
4723 if test "$HAVE_FONTCONFIG" != yes -o "$HAVE_FREETYPE" != yes; then
4724 AC_MSG_ERROR([fontconfig and freetype is required.])
4727 AC_DEFINE([HAVE_FREETYPE], [1],
4728 [Define to 1 if using the freetype and fontconfig libraries.])
4729 if test "${with_libotf}" != "no"; then
4730 EMACS_CHECK_MODULES([LIBOTF], [libotf])
4731 if test "$HAVE_LIBOTF" = "yes"; then
4732 AC_DEFINE([HAVE_LIBOTF], [1], [Define to 1 if using libotf.])
4733 AC_CHECK_LIB([otf], [OTF_get_variation_glyphs],
4734 [HAVE_OTF_GET_VARIATION_GLYPHS=yes],
4735 [HAVE_OTF_GET_VARIATION_GLYPHS=no])
4736 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
4737 AC_DEFINE([HAVE_OTF_GET_VARIATION_GLYPHS], [1],
4738 [Define to 1 if libotf has OTF_get_variation_glyphs.])
4748 fi # "${HAVE_X11}" != "yes"
4751 ### On MS-Windows we use hb_font_get_nominal_glyph, which appeared
4752 ### in HarfBuzz version 1.2.3
4753 if test "${HAVE_W32}" = "yes"; then
4754 harfbuzz_required_ver=1.2.3
4756 harfbuzz_required_ver=0.9.42
4758 if test "${HAVE_X11}" = "yes" && test "${HAVE_FREETYPE}" = "yes" \
4759 || test "$window_system" = "pgtk" \
4760 || test "${HAVE_W32}" = "yes" \
4761 || test "$REALLY_ANDROID" = "yes"; then
4762 if test "${with_harfbuzz}" != "no"; then
4763 EMACS_CHECK_MODULES([HARFBUZZ], [harfbuzz >= $harfbuzz_required_ver])
4764 AS_IF([test "$HAVE_HARFBUZZ" = "yes"],[
4765 AC_DEFINE([HAVE_HARFBUZZ], [1], [Define to 1 if using HarfBuzz.])
4766 ### mingw32 and Cygwin-w32 don't use -lharfbuzz, since they load
4767 ### the library dynamically.
4768 AS_IF([test "${HAVE_W32}" = "yes"], [HARFBUZZ_LIBS=])
4769 ## Now check for `hb_font_set_var_named_instance'.
4771 CFLAGS="$HARFBUZZ_CFLAGS $CFLAGS"
4772 EMACS_CHECK_LIB([harfbuzz], [hb_font_set_var_named_instance],
4773 [AC_DEFINE([HAVE_HB_FONT_SET_VAR_NAMED_INSTANCE], [1],
4774 [Define to 1 if `hb_font_set_var_named_instance' is present.])],
4775 [], [$HARFBUZZ_LIBS], [#include <hb.h>])
4776 CFLAGS=$OLD_CFLAGS])
4780 ### Start of font-backend (under Haiku) selectionn.
4781 if test "${HAVE_BE_APP}" = "yes"; then
4782 if test $HAVE_CAIRO = "yes"; then
4783 EMACS_CHECK_MODULES([FREETYPE], [freetype2 >= 2.5.0])
4784 test "$HAVE_FREETYPE" = "no" &&
4785 AC_MSG_ERROR([cairo on Haiku requires libfreetype])
4786 EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
4787 test "$HAVE_FONTCONFIG" = "no" &&
4788 AC_MSG_ERROR([cairo on Haiku requires libfontconfig])
4793 if test "${HAVE_FREETYPE}" = "yes"; then
4794 AC_DEFINE([HAVE_FREETYPE], [1],
4795 [Define to 1 if using the freetype and fontconfig libraries.])
4798 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
4799 LIBS="$FREETYPE_LIBS $LIBS"
4800 AC_CHECK_FUNCS([FT_Face_GetCharVariantIndex])
4803 if test "${with_libotf}" != "no"; then
4804 EMACS_CHECK_MODULES([LIBOTF], [libotf])
4805 if test "$HAVE_LIBOTF" = "yes"; then
4806 AC_DEFINE([HAVE_LIBOTF], [1], [Define to 1 if using libotf.])
4807 AC_CHECK_LIB([otf], [OTF_get_variation_glyphs],
4808 [HAVE_OTF_GET_VARIATION_GLYPHS=yes],
4809 [HAVE_OTF_GET_VARIATION_GLYPHS=no])
4810 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
4811 AC_DEFINE([HAVE_OTF_GET_VARIATION_GLYPHS], [1],
4812 [Define to 1 if libotf has OTF_get_variation_glyphs.])
4814 if $PKG_CONFIG --atleast-version=0.9.16 libotf; then :; else
4815 AC_DEFINE([HAVE_OTF_KANNADA_BUG], [1],
4816 [Define to 1 if libotf is affected by https://debbugs.gnu.org/28110.])
4820 dnl FIXME should there be an error if HAVE_FREETYPE != yes?
4821 dnl Does the new font backend require it, or can it work without it?
4825 if test "${HAVE_BE_APP}" = "yes" && test "${HAVE_FREETYPE}" = "yes"; then
4826 if test "${with_harfbuzz}" != "no"; then
4827 EMACS_CHECK_MODULES([HARFBUZZ], [harfbuzz >= $harfbuzz_required_ver])
4828 if test "$HAVE_HARFBUZZ" = "yes"; then
4829 AC_DEFINE([HAVE_HARFBUZZ], [1], [Define to 1 if using HarfBuzz.])
4834 ### End of font-backend section.
4836 AC_SUBST([FREETYPE_CFLAGS])
4837 AC_SUBST([FREETYPE_LIBS])
4838 AC_SUBST([FONTCONFIG_CFLAGS])
4839 AC_SUBST([FONTCONFIG_LIBS])
4840 AC_SUBST([HARFBUZZ_CFLAGS])
4841 AC_SUBST([HARFBUZZ_LIBS])
4842 AC_SUBST([LIBOTF_CFLAGS])
4843 AC_SUBST([LIBOTF_LIBS])
4844 AC_SUBST([M17N_FLT_CFLAGS])
4845 AC_SUBST([M17N_FLT_LIBS])
4848 if test "${HAVE_X11}" = "yes"; then
4849 AC_CHECK_HEADER([X11/Xlib-xcb.h],
4850 [AC_CHECK_LIB([xcb], [xcb_translate_coordinates], [HAVE_XCB=yes])])
4851 if test "${HAVE_XCB}" = "yes"; then
4852 AC_CHECK_LIB([X11-xcb], [XGetXCBConnection], [HAVE_X11_XCB=yes])
4853 if test "${HAVE_X11_XCB}" = "yes"; then
4854 AC_DEFINE([USE_XCB], [1],
4855 [Define to 1 if you have the XCB library and X11-XCB library for mixed
4856 X11/XCB programming.])
4857 XCB_LIBS="-lX11-xcb -lxcb"
4861 AC_SUBST([XCB_LIBS])
4863 ### Use -lXpm if available, unless '--with-xpm=no'.
4864 ### mingw32 doesn't use -lXpm, since it loads the library dynamically.
4865 ### The Cygwin-w32 build uses <noX/xpm.h> instead of <X11/xpm.h>, so
4866 ### we need to set LDFLAGS accordingly.
4869 if test "${HAVE_W32}" = "yes" && test "${opsys}" = "cygwin"; then
4870 if test "${with_xpm}" != "no"; then
4871 SAVE_LDFLAGS="$LDFLAGS"
4872 LDFLAGS="$LDFLAGS -L/usr/lib/noX"
4873 AC_CHECK_HEADER([noX/xpm.h],
4874 [AC_CHECK_LIB([Xpm], [XpmReadFileToImage], [HAVE_XPM=yes])])
4875 if test "${HAVE_XPM}" = "yes"; then
4876 AC_CACHE_CHECK([for XpmReturnAllocPixels preprocessor define],
4877 [emacs_cv_cpp_xpm_return_alloc_pixels],
4878 [AC_EGREP_CPP([no_return_alloc_pixels],
4879 [#include "noX/xpm.h"
4880 #ifndef XpmReturnAllocPixels
4881 no_return_alloc_pixels
4883 ], [emacs_cv_cpp_xpm_return_alloc_pixels=no],
4884 [emacs_cv_cpp_xpm_return_alloc_pixels=yes])])
4886 if test "$emacs_cv_cpp_xpm_return_alloc_pixels" = "no"; then
4888 LDFLAGS="$SAVE_LDFLAGS"
4893 if test "${HAVE_XPM}" = "yes"; then
4894 AC_DEFINE([HAVE_XPM], [1],
4895 [Define to 1 if you have the Xpm library (-lXpm).])
4900 if test "${HAVE_X11}" = "yes"; then
4901 dnl Avoid Xpm on AIX unless requested, as it crashes; see Bug#17598.
4902 case $opsys,$with_xpm_set,$with_xpm in
4904 aix4-2,*) with_xpm=no;;
4907 if test "${with_xpm}" != "no"; then
4908 AC_CHECK_HEADER([X11/xpm.h],
4909 [AC_CHECK_LIB([Xpm], [XpmReadFileToPixmap],
4910 [HAVE_XPM=yes], [], [-lX11])])
4911 if test "${HAVE_XPM}" = "yes"; then
4912 AC_CACHE_CHECK([for XpmReturnAllocPixels preprocessor define],
4913 [emacs_cv_cpp_xpm_return_alloc_pixels],
4914 [AC_EGREP_CPP([no_return_alloc_pixels],
4915 [#include "X11/xpm.h"
4916 #ifndef XpmReturnAllocPixels
4917 no_return_alloc_pixels
4919 ], [emacs_cv_cpp_xpm_return_alloc_pixels=no],
4920 [emacs_cv_cpp_xpm_return_alloc_pixels=yes])])
4922 if test "$emacs_cv_cpp_xpm_return_alloc_pixels" = "no"; then
4928 if test "${HAVE_XPM}" = "yes"; then
4929 AC_DEFINE([HAVE_XPM], [1],
4930 [Define to 1 if you have the Xpm library (-lXpm).])
4932 elif test "$opsys,$LUCID_LIBW" = aix4-2,-lXaw; then
4933 dnl AIX -lXaw needs -lXpm linked too; see Bug#17598 Message#152.
4938 ### FIXME: Perhaps regroup to minimize code duplication due to MinGW's
4939 ### slightly different requirements wrt image libraries (it doesn't
4940 ### use -lXpm because it loads the xpm shared library dynamically at
4942 if test "${opsys}" = "mingw32"; then
4943 if test "${with_xpm}" != "no"; then
4944 AC_CHECK_HEADER([X11/xpm.h], [HAVE_XPM=yes], [HAVE_XPM=no], [
4948 if test "${HAVE_XPM}" = "yes"; then
4949 AC_DEFINE([HAVE_XPM], [1],
4950 [Define to 1 if you have the Xpm library (-lXpm).])
4956 ### Use -ljpeg if available, unless '--with-jpeg=no'.
4960 if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
4961 || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
4962 || test "$window_system" = "pgtk" \
4963 || test "${REALLY_ANDROID}" = "yes"; then
4964 if test "${with_jpeg}" != "no"; then
4965 if test "${REALLY_ANDROID}" = "yes"; then
4966 # Look for libjpeg using the NDK.
4967 ndk_SEARCH_MODULE([libjpeg], [JPEG], [HAVE_JPEG=yes])
4969 if test "$HAVE_JPEG" = "yes"; then
4970 LIBJPEG="$JPEG_LIBS"
4972 AC_DEFINE([HAVE_JPEG], [1],
4973 [Define to 1 if you have the jpeg library (typically -ljpeg).])
4976 AC_CACHE_CHECK([for jpeglib 6b or later],
4979 for emacs_cv_jpeglib in yes -ljpeg no; do
4980 case $emacs_cv_jpeglib in
4983 *) LIBS="$LIBS $emacs_cv_jpeglib";;
4987 [[#undef HAVE_STDLIB_H /* Avoid config.h/jpeglib.h collision. */
4988 #include <stdio.h> /* jpeglib.h needs FILE and size_t. */
4989 #include <jpeglib.h>
4991 char verify[JPEG_LIB_VERSION < 62 ? -1 : 1];
4992 struct jpeg_decompress_struct cinfo;
4995 jpeg_create_decompress (&cinfo);
4996 WARNMS (&cinfo, JWRN_JPEG_EOF);
4997 jpeg_destroy_decompress (&cinfo);
4999 [emacs_link_ok=yes],
5002 test $emacs_link_ok = yes && break
5004 if test "$emacs_cv_jpeglib" != no; then
5006 AC_DEFINE([HAVE_JPEG], [1],
5007 [Define to 1 if you have the jpeg library (typically -ljpeg).])
5008 ### mingw32 doesn't use -ljpeg, since it loads the library
5009 ### dynamically when needed, and doesn't want a run-time
5010 ### dependency on the jpeglib DLL.
5011 test "$emacs_cv_jpeglib" != yes && test "${opsys}" != "mingw32" \
5012 && LIBJPEG=$emacs_cv_jpeglib
5018 AC_SUBST([JPEG_CFLAGS])
5023 if test "${with_lcms2}" != "no"; then
5024 EMACS_CHECK_MODULES([LCMS2], [lcms2])
5026 if test "${HAVE_LCMS2}" = "yes"; then
5027 AC_DEFINE([HAVE_LCMS2], [1],
5028 [Define to 1 if you have the lcms2 library (-llcms2).])
5029 ### mingw32 doesn't use -llcms2, since it loads the library dynamically.
5030 if test "${opsys}" = "mingw32"; then
5034 AC_SUBST([LCMS2_CFLAGS])
5035 AC_SUBST([LCMS2_LIBS])
5039 if test "${with_zlib}" != "no"; then
5041 AC_SEARCH_LIBS([inflateEnd], [z], [HAVE_ZLIB=yes])
5043 case $ac_cv_search_inflateEnd in
5044 -*) LIBZ=$ac_cv_search_inflateEnd ;;
5047 if test "${HAVE_ZLIB}" = "yes"; then
5048 AC_DEFINE([HAVE_ZLIB], [1],
5049 [Define to 1 if you have the zlib library (-lz).])
5050 ### mingw32 doesn't use -lz, since it loads the library dynamically.
5051 if test "${opsys}" = "mingw32"; then
5057 ### Dynamic library support
5059 cygwin|mingw32) DYNAMIC_LIB_SUFFIX=".dll" ;;
5060 darwin) DYNAMIC_LIB_SUFFIX=".dylib" ;;
5061 *) DYNAMIC_LIB_SUFFIX=".so" ;;
5064 darwin) DYNAMIC_LIB_SECONDARY_SUFFIX='.so' ;;
5065 *) DYNAMIC_LIB_SECONDARY_SUFFIX='' ;;
5067 AC_DEFINE_UNQUOTED(DYNAMIC_LIB_SUFFIX, "$DYNAMIC_LIB_SUFFIX",
5068 [System extension for dynamic libraries])
5069 AC_DEFINE_UNQUOTED(DYNAMIC_LIB_SECONDARY_SUFFIX, "$DYNAMIC_LIB_SECONDARY_SUFFIX",
5070 [Alternative system extension for dynamic libraries.])
5072 AC_SUBST(DYNAMIC_LIB_SUFFIX)
5073 AC_SUBST(DYNAMIC_LIB_SECONDARY_SUFFIX)
5075 ### Dynamic modules support
5079 MODULES_SUFFIX="${DYNAMIC_LIB_SUFFIX}"
5080 MODULES_SECONDARY_SUFFIX="${DYNAMIC_LIB_SECONDARY_SUFFIX}"
5082 # pgtkterm.c uses dlsym
5083 if test $window_system = pgtk; then
5091 AS_IF([test "x$with_modules" != "xno"],
5092 [AS_CASE(["$opsys"],
5096 [cygwin|mingw32|darwin],
5098 # BSD systems have dlopen in libc.
5099 [AC_CHECK_FUNC([dlopen], [HAVE_MODULES=yes])])
5101 AS_IF([test "x$HAVE_MODULES" = "xno"],
5102 [AS_IF([test "$with_modules" = "ifavailable"],
5103 [AC_MSG_WARN([Dynamic modules are not supported on your system])],
5104 [AC_MSG_ERROR([Dynamic modules are not supported on your system])])],
5106 LIBS="$LIBS $LIBMODULES"
5107 AC_CHECK_FUNCS([dladdr dlfunc])
5110 AS_IF([test "x$HAVE_MODULES" = xyes],
5111 [MODULES_OBJ="emacs-module.o"
5113 AC_DEFINE([HAVE_MODULES], [1], [Define to 1 if dynamic modules are enabled])
5114 AC_DEFINE_UNQUOTED([MODULES_SUFFIX], ["$MODULES_SUFFIX"],
5115 [System extension for dynamic libraries])
5116 AS_IF([test -n "$MODULES_SECONDARY_SUFFIX"],
5117 [AC_DEFINE_UNQUOTED([MODULES_SECONDARY_SUFFIX],
5118 ["$MODULES_SECONDARY_SUFFIX"],
5119 [Alternative system extension for dynamic libraries.])])])
5121 AC_SUBST([MODULES_OBJ])
5122 AC_SUBST([LIBMODULES])
5123 AC_SUBST([HAVE_MODULES])
5124 AC_SUBST([MODULES_SUFFIX])
5125 AC_SUBST([MODULES_SECONDARY_SUFFIX])
5127 ARCH_INDEPENDENT_CONFIG_FILES([src/emacs-module.h])
5128 AC_SUBST_FILE([module_env_snippet_25])
5129 AC_SUBST_FILE([module_env_snippet_26])
5130 AC_SUBST_FILE([module_env_snippet_27])
5131 AC_SUBST_FILE([module_env_snippet_28])
5132 AC_SUBST_FILE([module_env_snippet_29])
5133 AC_SUBST_FILE([module_env_snippet_30])
5134 AC_SUBST_FILE([module_env_snippet_31])
5135 module_env_snippet_25="$srcdir/src/module-env-25.h"
5136 module_env_snippet_26="$srcdir/src/module-env-26.h"
5137 module_env_snippet_27="$srcdir/src/module-env-27.h"
5138 module_env_snippet_28="$srcdir/src/module-env-28.h"
5139 module_env_snippet_29="$srcdir/src/module-env-29.h"
5140 module_env_snippet_30="$srcdir/src/module-env-30.h"
5141 module_env_snippet_31="$srcdir/src/module-env-31.h"
5142 emacs_major_version=`AS_ECHO([$PACKAGE_VERSION]) | sed 's/[[.]].*//'`
5143 AC_SUBST([emacs_major_version])
5145 ### Emacs Lisp native compiler support
5147 AC_DEFUN([libgccjit_smoke_test], [
5149 [[#include <libgccjit.h>
5153 main (int argc, char **argv)
5155 gcc_jit_context *ctxt;
5156 gcc_jit_result *result;
5157 ctxt = gcc_jit_context_acquire ();
5160 gcc_jit_type *int_type =
5161 gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
5162 gcc_jit_function *func =
5163 gcc_jit_context_new_function (ctxt, NULL,
5164 GCC_JIT_FUNCTION_EXPORTED,
5165 int_type, "foo", 0, NULL, 0);
5166 gcc_jit_block *block = gcc_jit_function_new_block (func, "foo");
5167 gcc_jit_block_end_with_return (
5170 gcc_jit_context_new_rvalue_from_int (ctxt, int_type, 1));
5171 result = gcc_jit_context_compile (ctxt);
5174 typedef int (*fn_type) (void);
5176 (fn_type)gcc_jit_result_get_code (result, "foo");
5181 gcc_jit_context_release (ctxt);
5182 gcc_jit_result_release (result);
5186 AC_DEFUN([libgccjit_not_found_err], [
5187 AC_MSG_ERROR([ELisp native compiler was requested, but libgccjit was not found.
5188 Please try installing libgccjit or a similar package.
5189 If you are sure you want Emacs be compiled without ELisp native compiler,
5190 pass the --without-native-compilation option to configure.])])
5192 AC_DEFUN([libgccjit_dev_not_found_err], [
5193 AC_MSG_ERROR([ELisp native compiler was requested, but libgccjit header files were
5195 Please try installing libgccjit-dev or a similar package.
5196 If you are sure you want Emacs be compiled without ELisp native compiler,
5197 pass the --without-native-compilation option to configure.])])
5199 AC_DEFUN([libgccjit_broken_err], [
5200 AC_MSG_ERROR([The installed libgccjit failed to compile and run a test program using
5201 the libgccjit library; see config.log for the details of the failure.
5202 The test program can be found here:
5203 <https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
5204 You can try compiling it yourself to investigate the issues.
5205 Please report the issue to your distribution if libgccjit was installed
5207 You can find the instructions on how to compile and install libgccjit from
5208 source on this site:
5209 <https://gcc.gnu.org/wiki/JIT>.])])
5214 if test "$canonical" = i686-pc-cygwin; then
5215 if test "${with_cygwin32_native_compilation}" = yes; then
5216 with_native_compilation=yes
5217 elif test "${with_native_compilation}" != no; then
5218 AC_MSG_ERROR([Native compilation is not supported on 32-bit Cygwin.
5219 If you really want to try it anyway, use the configure option
5220 '--with-cygwin32-native-compilation'.])
5224 AC_DEFUN([libgccjit_not_found], [
5225 AC_MSG_WARN([Elisp native compiler can't be enabled as libgccjit was not
5227 Please try installing libgccjit or a similar package if you want to have it
5230 with_native_compilation=no
5233 AC_DEFUN([libgccjit_dev_not_found], [
5234 AC_MSG_WARN([Elisp native compiler can't be enabled as libgccjit header files
5236 Please try installing libgccjit-dev or a similar package if you want to have it
5239 with_native_compilation=no
5242 AC_DEFUN([libgccjit_broken], [
5243 AC_MSG_WARN([Elisp native compiler can't be enabled as the installed libgccjit
5244 failed to compile and run a test program using the libgccjit library; see
5245 config.log for the details of the failure.
5246 The test program can be found here:
5247 <https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
5248 You can try compiling it yourself to investigate the issues.
5249 Please report the issue to your distribution if libgccjit was installed
5251 You can find the instructions on how to compile and install libgccjit from
5252 source on this site:
5253 <https://gcc.gnu.org/wiki/JIT>.])
5255 with_native_compilation=no])
5257 if test "$with_features" = "no" \
5258 && test "${with_native_compilation}" = "default"; then
5259 with_native_compilation=no
5262 if test "${with_native_compilation}" = "default"; then
5263 # Check if libgccjit is available.
5264 AC_CHECK_LIB([gccjit], [gcc_jit_context_acquire],
5265 [], [libgccjit_not_found])
5266 AC_CHECK_HEADERS([libgccjit.h], [], [libgccjit_dev_not_found])
5267 if test "${with_native_compilation}" != "no"; then
5268 # Check if libgccjit really works.
5269 AC_RUN_IFELSE([libgccjit_smoke_test], [], [libgccjit_broken])
5271 if test "$with_unexec" = yes; then
5272 with_native_compilation=no
5276 if test "${with_native_compilation}" != "no"; then
5277 if test "$with_unexec" = yes; then
5278 AC_MSG_ERROR(['--with-native-compilation' is not compatible with unexec])
5280 if test "${HAVE_ZLIB}" = no; then
5281 AC_MSG_ERROR(['--with-native-compilation' requires zlib])
5287 if test "${opsys}" = "darwin"; then
5288 # Ensure libgccjit installed by Homebrew or macports can be found.
5289 if test -n "$BREW"; then
5290 if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then
5291 MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \
5293 MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit \
5294 | grep -m1 -E 'libgccjit\.(so|dylib)$'))"
5298 if test -n "$HAVE_MACPORTS"; then
5299 # Determine which gcc version has been installed (gcc11, for
5300 # instance). Use the latest version, if more than one is
5301 # available. (We filter out the gcc4 packages, because they
5302 # don't support jit, and they have names like "gcc49" that
5303 # sort later than "gcc11".)
5304 PORT_PACKAGE=`port installed active | grep '^ *gcc@<:@0-9@:>@* ' | \
5305 awk '{ print $1; }' | grep -v 'gcc4@<:@0-9@:>@' | \
5306 sort -V | tail -n 1`
5307 if test -n "$PORT_PACKAGE"; then
5308 emacs_val=`port contents $PORT_PACKAGE | grep libgccjit.h`
5309 emacs_val=`dirname $emacs_val`
5310 MAC_CFLAGS="-I$emacs_val"
5311 emacs_val=`port contents $PORT_PACKAGE | grep libgccjit.dylib`
5312 emacs_val=`dirname $emacs_val`
5313 MAC_LIBS="-L$emacs_val"
5317 if test -n "$MAC_CFLAGS" && test -n "$MAC_LIBS"; then
5318 CFLAGS="$CFLAGS ${MAC_CFLAGS}"
5319 LIBS="$LIBS ${MAC_LIBS}"
5323 # In the default case we already checked
5324 if test "${with_native_compilation}" != "default"; then
5325 # Check if libgccjit is available.
5326 AC_CHECK_LIB([gccjit], [gcc_jit_context_acquire],
5327 [], [libgccjit_not_found_err])
5328 AC_CHECK_HEADERS([libgccjit.h], [], [libgccjit_dev_not_found_err])
5329 # Check if libgccjit really works.
5330 AC_RUN_IFELSE([libgccjit_smoke_test], [], [libgccjit_broken_err])
5332 HAVE_NATIVE_COMP=yes
5334 # mingw32 loads the library dynamically.
5336 # Neither NetBSD, OpenBSD nor Haiku have libdl, with all dynamic
5337 # linker functions placed within libc.
5338 netbsd|openbsd|haiku)
5339 LIBGCCJIT_LIBS="-lgccjit" ;;
5341 LIBGCCJIT_CFLAGS="${MAC_CFLAGS}"
5342 LIBGCCJIT_LIBS="${MAC_LIBS} -lgccjit -ldl";;
5344 LIBGCCJIT_LIBS="-lgccjit -ldl" ;;
5347 AC_DEFINE([HAVE_NATIVE_COMP], [1],
5348 [Define to 1 if native compiler is available.])
5353 AC_DEFINE_UNQUOTED([NATIVE_ELISP_SUFFIX], [".eln"],
5354 [System extension for native compiled elisp])
5355 AC_SUBST([HAVE_NATIVE_COMP])
5356 AC_SUBST([LIBGCCJIT_CFLAGS])
5357 AC_SUBST([LIBGCCJIT_LIBS])
5360 if test "${NEED_DYNLIB}" = yes; then
5361 DYNLIB_OBJ="dynlib.o"
5363 AC_SUBST([DYNLIB_OBJ])
5365 ### Use -lpng if available, unless '--with-png=no'.
5369 if test "${with_png}" != no; then
5370 # mingw32 loads the library dynamically.
5371 if test "$opsys" = mingw32; then
5372 AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
5373 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
5374 || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
5375 || test "$window_system" = "pgtk" \
5376 || test "${REALLY_ANDROID}" = "yes"; then
5377 EMACS_CHECK_MODULES([PNG], [libpng >= 1.0.0])
5378 if test $HAVE_PNG = yes; then
5381 # Test old way in case pkg-config doesn't have it (older machines).
5382 AC_MSG_CHECKING([for libpng not configured by pkg-config])
5384 png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
5385 png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {
5386 # libpng-config does not work; configure by hand.
5387 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
5388 # in /usr/include/libpng.
5389 if test -r /usr/include/libpng/png.h &&
5390 test ! -r /usr/include/png.h; then
5391 png_cflags=-I/usr/include/libpng
5399 CFLAGS="$CFLAGS $png_cflags"
5400 LIBS="$png_ldflags -lz -lm $LIBS"
5402 [AC_LANG_PROGRAM([[#include <png.h>]],
5403 [[return !png_get_channels (0, 0);]])],
5405 PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
5406 LIBPNG=$png_ldflags])
5409 AC_MSG_RESULT([$HAVE_PNG])
5412 # $LIBPNG requires explicit -lz in some cases.
5413 # We don't know what those cases are, exactly, so play it safe and
5414 # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
5415 case " $LIBPNG ",$LIBZ in
5416 *' -lz '*, | *' ',?*) ;;
5417 *) LIBPNG="$LIBPNG -lz" ;;
5421 if test $HAVE_PNG = yes; then
5422 AC_DEFINE([HAVE_PNG], [1], [Define to 1 if you have the png library.])
5425 CFLAGS="$CFLAGS $PNG_CFLAGS"
5426 AC_CHECK_DECL([png_longjmp],
5428 [AC_DEFINE([PNG_DEPSTRUCT], [],
5429 [Define to empty to suppress deprecation warnings when building
5430 with --enable-gcc-warnings and with libpng versions before 1.5,
5431 which lack png_longjmp.])],
5437 AC_SUBST([PNG_CFLAGS])
5439 ### Use -ltiff if available, unless '--with-tiff=no'.
5440 ### mingw32 doesn't use -ltiff, since it loads the library dynamically.
5444 if test "${opsys}" = "mingw32"; then
5445 if test "${with_tiff}" != "no"; then
5446 AC_CHECK_HEADER([tiffio.h], [HAVE_TIFF=yes], [HAVE_TIFF=no])
5448 if test "${HAVE_TIFF}" = "yes"; then
5449 AC_DEFINE([HAVE_TIFF], [1],
5450 [Define to 1 if you have the tiff library (-ltiff).])
5452 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
5453 || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
5454 || test "$window_system" = "pgtk" \
5455 || test "${REALLY_ANDROID}" = "yes"; then
5456 if test "${with_tiff}" != "no"; then
5457 if test "${REALLY_ANDROID}" != "yes"; then
5458 AC_CHECK_HEADER([tiffio.h],
5460 # At least one tiff package requires the jpeg library.
5461 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
5462 AC_CHECK_LIB([tiff], [TIFFGetVersion], [HAVE_TIFF=yes], [],
5465 ndk_SEARCH_MODULE([libtiff], [TIFF], [HAVE_TIFF=yes])
5467 if test "$HAVE_TIFF" = "yes"; then
5468 LIBTIFF="$TIFF_LIBS"
5473 if test "${HAVE_TIFF}" = "yes"; then
5474 AC_DEFINE([HAVE_TIFF], [1],
5475 [Define to 1 if you have the tiff library (-ltiff).])
5477 if test "$REALLY_ANDROID" != "yes"; then
5478 dnl FIXME -lz -lm, as per libpng?
5484 AC_SUBST([TIFF_CFLAGS])
5486 ### Use -lgif or -lungif if available, unless '--with-gif=no'.
5487 ### mingw32 doesn't use -lgif/-lungif, since it loads the library dynamically.
5491 if test "${opsys}" = "mingw32"; then
5492 if test "${with_gif}" != "no"; then
5493 AC_CHECK_HEADER([gif_lib.h], [HAVE_GIF=yes], [HAVE_GIF=no])
5495 if test "${HAVE_GIF}" = "yes"; then
5496 AC_DEFINE([HAVE_GIF], [1],
5497 [Define to 1 if you have a gif (or ungif) library.])
5499 elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
5500 || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes" \
5501 || test "${HAVE_BE_APP}" = "yes" || test "$window_system" = "pgtk" \
5502 || test "${REALLY_ANDROID}" = "yes" \
5503 && test "${with_gif}" != "no"; then
5504 AC_CHECK_HEADER([gif_lib.h],
5505 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
5506 # Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
5507 [AC_CHECK_LIB([gif], [GifMakeMapObject], [HAVE_GIF=yes],
5508 [AC_CHECK_LIB([gif], [EGifPutExtensionLast],
5510 [HAVE_GIF=maybe])])])
5512 if test "$HAVE_GIF" = yes; then
5514 elif test "$HAVE_GIF" = maybe; then
5515 # If gif_lib.h but no libgif, try libungif.
5516 AC_CHECK_LIB([ungif], [EGifPutExtensionLast],
5519 test "$HAVE_GIF" = yes && LIBGIF=-lungif
5522 # Finally, try ndk-build on Android.
5523 if test "$REALLY_ANDROID" = "yes"; then
5524 ndk_SEARCH_MODULE([libgif], [GIF], [HAVE_GIF=yes],
5526 test "$HAVE_GIF" = yes && LIBGIF="$GIF_LIBS"
5529 if test "${HAVE_GIF}" = "yes"; then
5530 AC_DEFINE([HAVE_GIF], [1],
5531 [Define to 1 if you have a gif (or ungif) library.])
5535 AC_SUBST([GIF_CFLAGS])
5537 dnl Check for required libraries.
5540 if test "${HAVE_X11}" = "yes"; then
5541 case $with_xpm,$HAVE_XPM in
5542 no,* | ifavailable,* | *,yes) ;;
5544 WITH_IFAVAILABLE="--with-xpm=ifavailable";;
5546 case $with_jpeg,$HAVE_JPEG in
5547 no,* | ifavailable,* | *,yes) ;;
5548 *) MISSING="$MISSING libjpeg"
5549 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-jpeg=ifavailable";;
5551 case $with_png,$HAVE_PNG in
5552 no,* | ifavailable,* | *,yes) ;;
5553 *) MISSING="$MISSING libpng"
5554 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-png=ifavailable";;
5556 case $with_gif,$HAVE_GIF in
5557 no,* | ifavailable,* | *,yes) ;;
5558 *) MISSING="$MISSING libgif/libungif"
5559 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gif=ifavailable";;
5561 case $with_tiff,$HAVE_TIFF in
5562 no,* | ifavailable,* | *,yes) ;;
5563 *) MISSING="$MISSING libtiff"
5564 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-tiff=ifavailable";;
5567 case $with_gnutls,$HAVE_GNUTLS in
5568 no,* | ifavailable,* | *,yes) ;;
5569 *) MISSING="$MISSING gnutls"
5570 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gnutls=ifavailable";;
5572 case $with_tree_sitter,$HAVE_TREE_SITTER in
5573 no,* | ifavailable,* | *,yes) ;;
5574 *) MISSING="$MISSING tree-sitter"
5575 WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-tree-sitter=ifavailable";;
5578 if test "X${MISSING}" != X; then
5579 # If we have a missing library, and we don't have pkg-config installed,
5580 # the missing pkg-config may be the reason. Give the user a hint.
5581 if test "X${PKG_CONFIG}" = X; then
5582 AC_MSG_WARN([Unable to locate a usable pkg-config])
5584 AC_MSG_ERROR([The following required libraries were not found:
5586 Maybe some development libraries/packages are missing?
5587 To build anyway, give:
5589 as options to configure.])
5592 ### Use -lgpm if available, unless '--with-gpm=no'.
5595 if test "${with_gpm}" != "no"; then
5596 AC_CHECK_HEADER([gpm.h],
5597 [AC_CHECK_LIB([gpm], [Gpm_Open], [HAVE_GPM=yes])])
5599 if test "${HAVE_GPM}" = "yes"; then
5600 AC_DEFINE([HAVE_GPM], [1],
5601 [Define to 1 if you have the gpm library (-lgpm).])
5607 dnl Check for malloc/malloc.h on darwin
5608 AC_CHECK_HEADERS_ONCE([malloc/malloc.h])
5611 ### Use NeXTstep API to implement GUI.
5612 if test "${HAVE_NS}" = "yes"; then
5613 AC_DEFINE([HAVE_NS], [1],
5614 [Define to 1 if you are using the NeXTstep API,
5615 either GNUstep or Cocoa on macOS.])
5616 if test "${NS_IMPL_COCOA}" = "yes"; then
5617 AC_DEFINE([NS_IMPL_COCOA], [1],
5618 [Define to 1 if you are using NS windowing under macOS.])
5620 if test "${NS_IMPL_GNUSTEP}" = "yes"; then
5621 AC_DEFINE([NS_IMPL_GNUSTEP], [1],
5622 [Define to 1 if you are using NS windowing under GNUstep.])
5623 if test $NS_GNUSTEP_CONFIG != yes; then
5624 # See also .m.o rule in src/Makefile.in. */
5625 # FIXME: are all these flags really needed? Document here why. */
5626 GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
5627 ## Extra CFLAGS applied to src/*.m files.
5628 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"
5634 ### Use session management (-lSM -lICE) if available
5637 if test "${HAVE_X11}" = "yes"; then
5638 AC_CHECK_HEADER([X11/SM/SMlib.h],
5639 [AC_CHECK_LIB([SM], [SmcOpenConnection], [HAVE_X_SM=yes], [], [-lICE])])
5641 if test "${HAVE_X_SM}" = "yes"; then
5642 AC_DEFINE([HAVE_X_SM], [1],
5643 [Define to 1 if you have the SM library (-lSM).])
5649 ### Use XRandr (-lXrandr) if available
5651 if test "${HAVE_X11}" = "yes"; then
5652 XRANDR_REQUIRED=1.2.2
5653 XRANDR_MODULES="xrandr >= $XRANDR_REQUIRED"
5654 EMACS_CHECK_MODULES([XRANDR], [$XRANDR_MODULES])
5655 if test $HAVE_XRANDR = no; then
5656 # Test old way in case pkg-config doesn't have it (older machines).
5657 # Include Xrender.h by hand to work around bug in older Xrandr.h
5658 # (e.g. RHEL5) and silence (harmless) configure warning (bug#18465).
5659 AC_CHECK_HEADER([X11/extensions/Xrandr.h],
5660 [AC_CHECK_LIB([Xrandr], [XRRGetScreenResources], [HAVE_XRANDR=yes])],
5661 [], [AC_INCLUDES_DEFAULT
5662 #include <X11/extensions/Xrender.h>])
5663 if test $HAVE_XRANDR = yes; then
5664 XRANDR_LIBS=-lXrandr
5667 if test $HAVE_XRANDR = yes; then
5668 AC_DEFINE([HAVE_XRANDR], [1],
5669 [Define to 1 if you have the XRandr extension.])
5672 AC_SUBST([XRANDR_CFLAGS])
5673 AC_SUBST([XRANDR_LIBS])
5675 ### Use Xinerama (-lXinerama) if available
5677 if test "${HAVE_X11}" = "yes"; then
5678 XINERAMA_REQUIRED=1.0.2
5679 XINERAMA_MODULES="xinerama >= $XINERAMA_REQUIRED"
5680 EMACS_CHECK_MODULES([XINERAMA], [$XINERAMA_MODULES])
5681 if test $HAVE_XINERAMA = no; then
5682 # Test old way in case pkg-config doesn't have it (older machines).
5683 AC_CHECK_HEADER([X11/extensions/Xinerama.h],
5684 [AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
5685 [HAVE_XINERAMA=yes])])
5686 if test $HAVE_XINERAMA = yes; then
5687 XINERAMA_LIBS=-lXinerama
5690 if test $HAVE_XINERAMA = yes; then
5691 AC_DEFINE([HAVE_XINERAMA], [1],
5692 [Define to 1 if you have the Xinerama extension.])
5695 AC_SUBST([XINERAMA_CFLAGS])
5696 AC_SUBST([XINERAMA_LIBS])
5698 ### Use Xfixes (-lXfixes) if available
5700 if test "${HAVE_X11}" = "yes"; then
5701 XFIXES_REQUIRED=1.0.0
5702 XFIXES_MODULES="xfixes >= $XFIXES_REQUIRED"
5703 EMACS_CHECK_MODULES([XFIXES], [$XFIXES_MODULES])
5704 if test $HAVE_XFIXES = no; then
5705 # Test old way in case pkg-config doesn't have it (older machines).
5706 AC_CHECK_HEADER([X11/extensions/Xfixes.h],
5707 [AC_CHECK_LIB([Xfixes], [XFixesHideCursor], [HAVE_XFIXES=yes])])
5708 if test $HAVE_XFIXES = yes; then
5709 XFIXES_LIBS=-lXfixes
5712 if test $HAVE_XFIXES = yes; then
5713 AC_DEFINE([HAVE_XFIXES], [1],
5714 [Define to 1 if you have the Xfixes extension.])
5717 AC_SUBST([XFIXES_CFLAGS])
5718 AC_SUBST([XFIXES_LIBS])
5720 ## Use XInput 2.0 if available
5722 if test "${HAVE_X11}" = "yes" && test "${with_xinput2}" != "no"; then
5723 EMACS_CHECK_MODULES([XINPUT], [xi])
5724 if test $HAVE_XINPUT = yes; then
5725 # Now check for XInput2.h
5726 AC_CHECK_HEADER([X11/extensions/XInput2.h],
5727 [AC_CHECK_LIB([Xi], [XIGrabButton], [HAVE_XINPUT2=yes])])
5729 if test $HAVE_XINPUT2 = yes; then
5730 AC_DEFINE([HAVE_XINPUT2], [1],
5731 [Define to 1 if the X Input Extension version 2.0 or later is present.])
5732 if test "$USE_GTK_TOOLKIT" = "GTK2"; then
5733 AC_MSG_WARN([You are building Emacs with GTK+ 2 and the X Input Extension version 2.
5734 This might lead to problems if your version of GTK+ is not built with support for XInput 2.])
5737 # Now check for some members (which used in conjunction with
5738 # protocol definitions) can be used to determine the version of
5740 AC_CHECK_MEMBERS([XIScrollClassInfo.type, XITouchClassInfo.type,
5741 XIBarrierReleasePointerInfo.deviceid, XIGestureClassInfo.type],
5742 [], [], [#include <X11/extensions/XInput2.h>])
5745 AC_SUBST([XINPUT_CFLAGS])
5746 AC_SUBST([XINPUT_LIBS])
5751 if test "${HAVE_X11}" = "yes"; then
5752 AC_CHECK_HEADER([X11/extensions/sync.h],
5753 [AC_CHECK_LIB([Xext], [XSyncQueryExtension], [HAVE_XSYNC=yes])],
5754 [], [#include <X11/Xlib.h>])
5756 if test "${HAVE_XSYNC}" = "yes"; then
5757 AC_DEFINE([HAVE_XSYNC], [1],
5758 [Define to 1 if the X Synchronization Extension is available.])
5761 LIBS="-lXext $LIBS" # Set this temporarily for AC_CHECK_FUNC
5762 AC_CHECK_FUNCS([XSyncTriggerFence]) # Check for version 3.1
5766 AC_SUBST([XSYNC_LIBS])
5767 AC_SUBST([XSYNC_CFLAGS])
5769 ### Use Xdbe (-lXdbe) if available
5771 if test "${HAVE_X11}" = "yes"; then
5772 if test "${with_xdbe}" != "no"; then
5773 AC_CHECK_HEADER([X11/extensions/Xdbe.h],
5774 [AC_CHECK_LIB([Xext], [XdbeAllocateBackBufferName], [HAVE_XDBE=yes])],
5776 [#include <X11/Xlib.h>
5779 if test $HAVE_XDBE = yes; then
5782 if test $HAVE_XDBE = yes; then
5783 AC_DEFINE([HAVE_XDBE], [1], [Define to 1 if you have the Xdbe extension.])
5786 AC_SUBST([XDBE_CFLAGS])
5787 AC_SUBST([XDBE_LIBS])
5789 ### Use the Nonrectangular Window Shape extension if available.
5792 if test "${HAVE_X11}" = "yes"; then
5793 AC_CHECK_HEADER([X11/extensions/shape.h],
5794 [AC_CHECK_LIB([Xext], [XShapeQueryVersion], [HAVE_XSHAPE=yes])],
5796 [#include <X11/extensions/shape.h>
5798 if test $HAVE_XSHAPE = yes; then
5800 AC_CHECK_HEADER([xcb/shape.h],
5801 [AC_CHECK_LIB([xcb-shape], [xcb_shape_combine], [HAVE_XCB_SHAPE=yes])],
5803 [#include <xcb/shape.h>])
5805 if test $HAVE_XCB_SHAPE = yes && test "$XCB_LIBS" != ""; then
5806 XSHAPE_LIBS="$XSHAPE_LIBS -lxcb-shape"
5807 AC_DEFINE([HAVE_XCB_SHAPE], [1],
5808 [Define to 1 if XCB supports the
5809 Nonrectangular Window Shape extension.])
5812 if test $HAVE_XSHAPE = yes; then
5813 AC_DEFINE([HAVE_XSHAPE], [1],
5814 [Define to 1 if you have the Nonrectangular Window Shape extension.])
5817 AC_SUBST([XSHAPE_CFLAGS])
5818 AC_SUBST([XSHAPE_LIBS])
5820 ### Use Xcomposite (-lXcomposite) if available
5822 if test "${HAVE_X11}" = "yes"; then
5823 AC_CHECK_HEADER([X11/extensions/Xcomposite.h],
5824 [AC_CHECK_LIB([Xcomposite], [XCompositeRedirectWindow],
5825 [HAVE_XCOMPOSITE=yes])],
5827 [#include <X11/extensions/Xcomposite.h>
5829 if test $HAVE_XCOMPOSITE = yes; then
5830 XCOMPOSITE_LIBS=-lXcomposite
5832 if test $HAVE_XCOMPOSITE = yes; then
5833 AC_DEFINE([HAVE_XCOMPOSITE], [1],
5834 [Define to 1 if you have the XCOMPOSITE extension.])
5837 AC_SUBST([XCOMPOSITE_CFLAGS])
5838 AC_SUBST([XCOMPOSITE_LIBS])
5840 ### Use libxml (-lxml2) if available
5841 ### mingw32 doesn't use -lxml2, since it loads the library dynamically.
5843 if test "${with_xml2}" != "no"; then
5844 ### I'm not sure what the version number should be, so I just guessed.
5845 EMACS_CHECK_MODULES([LIBXML2], [libxml-2.0 > 2.6.17])
5846 # Built-in libxml2 on OS X 10.8 lacks libxml-2.0.pc.
5847 if test "${HAVE_LIBXML2}" != "yes" && test "$opsys" = "darwin"; then
5848 SAVE_CPPFLAGS="$CPPFLAGS"
5849 if test -z "$xcsdkdir" -a -n "$XCRUN" -a ! -d /usr/include; then
5850 dnl /usr/include is not found. Try Xcode SDK dir if it is sane.
5851 xcsdkdir=`$XCRUN --show-sdk-path 2>/dev/null`
5853 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
5857 CPPFLAGS="$CPPFLAGS -isystem${xcsdkdir}/usr/include/libxml2"
5858 AC_CHECK_HEADER([libxml/HTMLparser.h],
5859 [AC_CHECK_DECL([HTML_PARSE_RECOVER], [HAVE_LIBXML2=yes], [],
5860 [#include <libxml/HTMLparser.h>])])
5861 CPPFLAGS="$SAVE_CPPFLAGS"
5862 if test "${HAVE_LIBXML2}" = "yes"; then
5863 LIBXML2_CFLAGS="-isystem${xcsdkdir}/usr/include/libxml2"
5864 LIBXML2_LIBS="-lxml2"
5867 if test "${HAVE_LIBXML2}" = "yes"; then
5868 if test "${opsys}" != "mingw32"; then
5870 CFLAGS="$CFLAGS $LIBXML2_CFLAGS"
5871 EMACS_CHECK_LIB([xml2], [htmlReadMemory],
5874 [$LIBXML2_LIBS], [#include <libxml/HTMLparser.h>])
5875 CFLAGS="$SAVE_CFLAGS"
5879 if test "${HAVE_LIBXML2}" = "yes"; then
5880 AC_DEFINE([HAVE_LIBXML2], [1],
5881 [Define to 1 if you have the libxml library (-lxml2).])
5888 AC_SUBST([LIBXML2_LIBS])
5889 AC_SUBST([LIBXML2_CFLAGS])
5893 if test ! "$with_mailutils"; then
5894 # Check for mail-locking functions in a "mail" library. Probably this should
5895 # have the same check as for liblockfile below.
5896 AC_CHECK_LIB([mail], [maillock], [have_mail=yes], [have_mail=no])
5897 if test $have_mail = yes; then
5899 AC_DEFINE([HAVE_LIBMAIL], [1],
5900 [Define to 1 if you have the 'mail' library (-lmail).])
5903 LIBS="$LIBS_MAIL $LIBS"
5904 AC_CHECK_FUNCS([touchlock])
5907 dnl Debian, at least:
5908 AC_CHECK_LIB([lockfile], [maillock], [have_lockfile=yes], [have_lockfile=no])
5909 if test $have_lockfile = yes; then
5910 LIBS_MAIL=-llockfile
5911 AC_DEFINE([HAVE_LIBLOCKFILE], [1],
5912 [Define to 1 if you have the 'lockfile' library (-llockfile).])
5914 # If we have the shared liblockfile, assume we must use it for mail
5915 # locking (e.g. Debian). If we couldn't link against liblockfile
5916 # (no liblockfile.a installed), ensure that we don't need to.
5917 dnl This works for files generally, not just executables.
5918 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
5919 AC_CHECK_PROG([liblockfile], [liblockfile.so], [yes], [no],
5920 [/usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH])
5921 if test "$ac_cv_prog_liblockfile" = yes; then
5922 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
5923 This probably means that movemail could lose mail.
5924 There may be a 'development' package to install containing liblockfile.])
5927 AC_CHECK_HEADERS([maillock.h])
5929 ## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
5930 ## interlock access to the mail spool. The alternative is a lock file named
5931 ## /usr/spool/mail/$USER.lock.
5934 aix4-2) mail_lock="lockf" ;;
5936 gnu|freebsd|dragonfly|netbsd|openbsd|darwin) mail_lock="flock" ;;
5938 ## On GNU/Linux systems, both methods are used by various mail programs.
5939 ## I assume most people are using newer mailers that have heard of flock.
5940 ## Change this if you need to.
5941 ## Debian contains a patch which says: "On Debian/GNU/Linux systems,
5942 ## configure gets the right answers, and that means *NOT* using flock.
5943 ## Using flock is guaranteed to be the wrong thing. See Debian Policy
5944 ## for details." and then uses '#ifdef DEBIAN'. Unfortunately the
5945 ## Debian maintainer hasn't provided a clean fix for Emacs.
5946 ## movemail.c will use 'maillock' when MAILDIR, HAVE_LIBMAIL and
5947 ## HAVE_MAILLOCK_H are defined, so the following appears to be the
5948 ## correct logic. -- fx
5949 ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
5950 ## liblockfile is a Free Software replacement for libmail, used on
5951 ## Debian systems and elsewhere. -rfr.
5954 if test $have_mail = yes || test $have_lockfile = yes; then
5955 test $ac_cv_header_maillock_h = yes && mail_lock=no
5959 mail_lock="none-needed" ;;
5963 flock) AC_DEFINE([MAIL_USE_FLOCK], [1],
5964 [Define if the mailer uses flock to interlock the mail spool.]);;
5966 lockf) AC_DEFINE([MAIL_USE_LOCKF], [1],
5967 [Define if the mailer uses lockf to interlock the mail spool.]);;
5971 *) BLESSMAIL_TARGET="need-blessmail" ;;
5974 AC_SUBST([BLESSMAIL_TARGET])
5975 AC_SUBST([LIBS_MAIL])
5979 [linux/seccomp.h linux/filter.h],
5981 [SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_TSYNC],
5982 [HAVE_SECCOMP=yes], [],
5984 #include <linux/seccomp.h>
5986 AC_SUBST([HAVE_SECCOMP])
5988 EMACS_CHECK_MODULES([LIBSECCOMP], [libseccomp >= 2.5.2])
5989 AC_SUBST([HAVE_LIBSECCOMP])
5990 AC_SUBST([LIBSECCOMP_LIBS])
5991 AC_SUBST([LIBSECCOMP_CFLAGS])
5993 AC_CHECK_SIZEOF([long])
5994 SIZEOF_LONG="$ac_cv_sizeof_long"
5995 AC_SUBST([SIZEOF_LONG])
5998 LIBS="$LIB_PTHREAD $LIB_MATH $LIBS"
5999 AC_CHECK_FUNCS([accept4 fchdir gethostname \
6000 getrusage get_current_dir_name \
6001 lrand48 random rint tcdrain trunc \
6002 select getpagesize newlocale \
6003 getrlimit setrlimit shutdown \
6004 pthread_sigmask strsignal setitimer \
6005 sendto recvfrom getsockname getifaddrs freeifaddrs \
6007 endpwent getgrent endgrent \
6008 cfmakeraw cfsetspeed __executable_start log2 pthread_setname_np \
6009 pthread_set_name_np])
6011 # getpwent is not present in older versions of Android. (bug#65319)
6012 gl_CHECK_FUNCS_ANDROID([getpwent], [[#include <pwd.h>]])
6014 # renameat2 is not present in older versions of Android.
6015 gl_CHECK_FUNCS_ANDROID([renameat2], [[#include <stdio.h>]])
6017 if test "$ac_cv_func_cfmakeraw" != "yes"; then
6018 # On some systems (Android), cfmakeraw is inline, so AC_CHECK_FUNCS
6019 # cannot find it. Check if some code including termios.h and using
6021 AC_CACHE_CHECK([whether cfmakeraw is inline],
6022 [emacs_cv_func_cfmakeraw_inline],
6023 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
6024 [[#include <termios.h>]],
6026 [emacs_cv_func_cfmakeraw_inline=yes],
6027 [emacs_cv_func_cfmakeraw_inline=no])])
6029 if test "$emacs_cv_func_cfmakeraw_inline" = "yes"; then
6030 # Define HAVE_CFMAKERAW again.
6031 AC_DEFINE([HAVE_CFMAKERAW], [1])
6035 if test "$ac_cv_func_cfsetspeed" != "yes"; then
6036 AC_CACHE_CHECK([whether cfsetspeed is inline],
6037 [emacs_cv_func_cfsetspeed_inline],
6038 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
6039 [[#include <termios.h>]],
6041 [emacs_cv_func_cfsetspeed_inline=yes],
6042 [emacs_cv_func_cfsetspeed_inline=no])])
6044 if test "$emacs_cv_func_cfsetspeed_inline" = "yes"; then
6045 # Define HAVE_CFSETSPEED again.
6046 AC_DEFINE([HAVE_CFSETSPEED], [1])
6052 if test "$ac_cv_func_pthread_setname_np" = "yes"; then
6054 [whether pthread_setname_np takes a single argument],
6055 [emacs_cv_pthread_setname_np_1arg],
6058 [[#include <pthread.h>]],
6059 [[pthread_setname_np ("a");]])],
6060 [emacs_cv_pthread_setname_np_1arg=yes],
6061 [emacs_cv_pthread_setname_np_1arg=no])])
6062 if test "$emacs_cv_pthread_setname_np_1arg" = "yes"; then
6064 [HAVE_PTHREAD_SETNAME_NP_1ARG], [1],
6065 [Define to 1 if pthread_setname_np takes a single argument.])
6068 [whether pthread_setname_np takes three arguments],
6069 [emacs_cv_pthread_setname_np_3arg],
6072 [[#include <pthread.h>]],
6073 [[pthread_setname_np (0, "%s", "a");]])],
6074 [emacs_cv_pthread_setname_np_3arg=yes],
6075 [emacs_cv_pthread_setname_np_3arg=no])])
6076 if test "$emacs_cv_pthread_setname_np_3arg" = "yes"; then
6078 [HAVE_PTHREAD_SETNAME_NP_3ARG], [1],
6079 [Define to 1 if pthread_setname_np takes three arguments.])
6084 dnl No need to check for posix_memalign if aligned_alloc works.
6085 AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
6086 AC_CHECK_DECLS([aligned_alloc], [], [], [[#include <stdlib.h>]])
6088 case $with_unexec,$canonical in
6090 AC_CHECK_DECL([__ELF__], [],
6091 [AC_MSG_ERROR([Non-ELF systems are not supported on this platform.])]);;
6094 if test "$with_unexec" = yes && test "$opsys" = "haiku"; then
6095 dnl A serious attempt was actually made to port unexec to Haiku.
6096 dnl Something in libstdc++ seems to prevent it from working.
6097 AC_MSG_ERROR([Haiku is not supported by the legacy unexec dumper.
6098 Please use the portable dumper instead.])
6101 # Dump loading. Android lacks posix_madvise.
6102 AC_CHECK_FUNCS([posix_madvise madvise])
6104 dnl Cannot use AC_CHECK_FUNCS
6105 AC_CACHE_CHECK([for __builtin_frame_address],
6106 [emacs_cv_func___builtin_frame_address],
6107 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_frame_address (0);])],
6108 [emacs_cv_func___builtin_frame_address=yes],
6109 [emacs_cv_func___builtin_frame_address=no])])
6110 if test $emacs_cv_func___builtin_frame_address = yes; then
6111 AC_DEFINE([HAVE___BUILTIN_FRAME_ADDRESS], [1],
6112 [Define to 1 if you have the '__builtin_frame_address' function.])
6114 AC_CACHE_CHECK([for __builtin_unwind_init],
6115 [emacs_cv_func___builtin_unwind_init],
6116 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_unwind_init ();])],
6117 [emacs_cv_func___builtin_unwind_init=yes],
6118 [emacs_cv_func___builtin_unwind_init=no])])
6119 if test $emacs_cv_func___builtin_unwind_init = yes; then
6120 AC_DEFINE([HAVE___BUILTIN_UNWIND_INIT], [1],
6121 [Define to 1 if you have the '__builtin_unwind_init' function.])
6124 AC_CHECK_HEADERS_ONCE([sys/un.h])
6129 AC_CHECK_FUNCS([grantpt])
6131 # PTY-related GNU extensions.
6132 AC_CHECK_FUNCS([getpt posix_openpt])
6134 dnl Run a test program that contains a call to tputs, a call that is
6135 dnl never executed. This tests whether a pre-'main' dynamic linker
6136 dnl works with the library. It's too much trouble to actually call
6137 dnl tputs in the test program, due to portability hassles. When
6138 dnl cross-compiling, assume the test program will run if it links.
6139 AC_DEFUN([tputs_link_source], [
6141 [[extern void tputs (const char *, int, int (*)(int));
6142 int main (int argc, char **argv)
6145 tputs (argv[0], 0, 0);
6149 # Check this now, so that we will NOT find the above functions in ncurses.
6150 # That is because we have not set up to link ncurses in lib-src.
6151 # It's better to believe a function is not available
6152 # than to expect to find it in ncurses.
6153 # Also we need tputs and friends to be able to build at all.
6154 AC_CACHE_CHECK([for library containing tputs], [emacs_cv_tputs_lib],
6155 [if test "${opsys}" = "mingw32" || test x"$REALLY_ANDROID" = "xyes"; then
6156 emacs_cv_tputs_lib='none required'
6158 # curses precedes termcap because of AIX (Bug#9736#35) and OpenIndiana.
6159 tputs_libraries='tinfo ncurses terminfo curses termcap tinfow ncursesw'
6160 for tputs_library in '' $tputs_libraries; do
6162 if test -z "$tputs_library"; then
6163 emacs_cv_tputs_lib='none required'
6165 emacs_cv_tputs_lib=-l$tputs_library
6166 LIBS="$emacs_cv_tputs_lib $LIBS"
6168 AC_RUN_IFELSE([tputs_link_source], [], [emacs_cv_tputs_lib=no],
6169 [AC_LINK_IFELSE([tputs_link_source], [], [emacs_cv_tputs_lib=no])])
6171 if test "X$emacs_cv_tputs_lib" != Xno; then
6176 AS_CASE(["$emacs_cv_tputs_lib"],
6177 [no], [AC_MSG_ERROR([The required function 'tputs' was not found in any library.
6178 The following libraries were tried (in order):
6179 libtinfo, libncurses, libterminfo, libcurses, libtermcap
6180 Please try installing whichever of these libraries is most appropriate
6181 for your system, together with its header files.
6182 For example, a libncurses-dev(el) or similar package.])],
6183 [-l*], [LIBS_TERMCAP=$emacs_cv_tputs_lib],
6184 [*], [LIBS_TERMCAP=])
6186 ## Use termcap instead of terminfo?
6187 ## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
6189 ## FIXME? In the cases below where we unconditionally set
6190 ## LIBS_TERMCAP="-lncurses", this overrides LIBS_TERMCAP = -ltinfo,
6191 ## if that was found above to have tputs.
6192 ## Should we use the gnu* logic everywhere?
6193 case "$opsys$REALLY_ANDROID" in
6194 ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
6195 ## The ncurses library has been moved out of the System framework in
6196 ## Mac OS X 10.2. So if configure detects it, set the command-line
6197 ## option to use it.
6198 darwin) LIBS_TERMCAP="-lncurses" ;;
6200 gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
6203 AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
6204 AC_CACHE_VAL([emacs_cv_freebsd_terminfo],
6205 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <osreldate.h>]],
6206 [[#if __FreeBSD_version < 400000
6209 ]])], [emacs_cv_freebsd_terminfo=yes],
6210 [emacs_cv_freebsd_terminfo=no])])
6212 AC_MSG_RESULT([$emacs_cv_freebsd_terminfo])
6214 if test $emacs_cv_freebsd_terminfo = yes; then
6215 LIBS_TERMCAP="-lncurses"
6218 LIBS_TERMCAP="-ltermcap"
6222 # The case condition is a concatenation of both $opsys and
6223 # $REALLY_ANDROID. Only disable termcap if building a GUI program.
6225 mingw32 | androidyes)
6231 # NetBSD versions prior to 6.0 lack native terminfo, but have a
6232 # tputs() built on top of termcap in these libraries. Use native
6233 # termcap instead in this case. NetBSD >= 6.0 has native terminfo
6234 # implementation in -lterminfo.
6235 if test "x$LIBS_TERMCAP" = "x-ltermcap" -o "x$LIBS_TERMCAP" = "x-lcurses"; then
6237 LIBS_TERMCAP="-ltermcap"
6241 openbsd | dragonfly) LIBS_TERMCAP="-lncurses" ;;
6243 ## hpux: Make sure we get select from libc rather than from libcurses
6244 ## because libcurses on HPUX 10.10 has a broken version of select.
6245 ## We used to use -lc -lcurses, but this may be cleaner.
6246 ## FIXME? But TERMINFO = yes on hpux (it used to be explicitly
6247 # set that way, now it uses the default). Isn't this a contradiction?
6248 hpux*) LIBS_TERMCAP="-ltermcap" ;;
6252 TERMCAP_OBJ=tparam.o
6253 if test $TERMINFO = yes; then
6254 AC_DEFINE([TERMINFO], [1],
6255 [Define to 1 if you use terminfo instead of termcap.])
6256 TERMCAP_OBJ=terminfo.o
6257 AC_CACHE_CHECK([whether $LIBS_TERMCAP library defines BC],
6258 [emacs_cv_terminfo_defines_BC],
6260 LIBS="$LIBS $LIBS_TERMCAP"
6261 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *BC;]], [[return !*BC;]])],
6262 [emacs_cv_terminfo_defines_BC=yes],
6263 [emacs_cv_terminfo_defines_BC=no])
6265 if test "$emacs_cv_terminfo_defines_BC" = yes; then
6266 AC_DEFINE([TERMINFO_DEFINES_BC], [1], [Define to 1 if the
6267 terminfo library defines the variables BC, PC, and UP.])
6270 if test "X$LIBS_TERMCAP" = "X-lncurses"; then
6271 AC_DEFINE([USE_NCURSES], [1], [Define to 1 if you use ncurses.])
6273 AC_SUBST([LIBS_TERMCAP])
6274 AC_SUBST([TERMCAP_OBJ])
6276 # GNU/Linux-specific timer functions.
6277 AC_CACHE_CHECK([for timerfd interface], [emacs_cv_have_timerfd],
6279 [AC_LANG_PROGRAM([[#include <sys/timerfd.h>
6281 [[timerfd_create (CLOCK_REALTIME,
6282 TFD_CLOEXEC | TFD_NONBLOCK);
6283 timerfd_settime (0, TFD_TIMER_ABSTIME, 0, 0);]])],
6284 [emacs_cv_have_timerfd=yes],
6285 [emacs_cv_have_timerfd=no])])
6286 if test "$emacs_cv_have_timerfd" = yes; then
6287 AC_DEFINE([HAVE_TIMERFD], [1],
6288 [Define to 1 if timerfd functions are supported as in GNU/Linux.])
6291 # Alternate stack for signal handlers.
6292 AC_CACHE_CHECK([whether signals can be handled on alternate stack],
6293 [emacs_cv_alternate_stack],
6295 [AC_LANG_PROGRAM([[#include <signal.h>
6299 struct sigaction sa;
6300 ss.ss_sp = malloc (SIGSTKSZ);
6301 ss.ss_size = SIGSTKSZ;
6302 sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
6303 sigaltstack (&ss, 0);
6304 sigaction (SIGSEGV, &sa, 0);]])],
6305 [emacs_cv_alternate_stack=yes],
6306 [emacs_cv_alternate_stack=no])])
6308 # Do we need the Hesiod library to provide the support routines?
6309 dnl FIXME? Should we be skipping this on Darwin too?
6312 if test "$with_hesiod" != no ; then
6313 # Don't set $LIBS here -- see comments above. FIXME which comments?
6315 AC_CHECK_FUNC([res_send], [], [AC_CHECK_FUNC([__res_send], [],
6316 [AC_CHECK_LIB([resolv], [res_send], [resolv=yes],
6317 [AC_CHECK_LIB([resolv], [__res_send], [resolv=yes])])])])
6318 if test "$resolv" = yes ; then
6324 AC_CHECK_FUNC([hes_getmailhost], [],
6325 [AC_CHECK_LIB([hesiod], [hes_getmailhost],
6326 [hesiod=yes], [:], [$RESOLVLIB])])
6328 if test x"$hesiod" = xyes; then
6330 LIBRESOLV=$RESOLVLIB
6333 AC_SUBST([LIBHESIOD])
6334 AC_SUBST([LIBRESOLV])
6336 # These tell us which Kerberos-related libraries to use.
6343 if test "${with_kerberos}" != no; then
6345 AC_CHECK_LIB([com_err], [com_err], [have_com_err=yes], [have_com_err=no])
6346 if test $have_com_err = yes; then
6347 COM_ERRLIB=-lcom_err
6348 LIBS="$COM_ERRLIB $LIBS"
6350 AC_CHECK_LIB([crypto], [mit_des_cbc_encrypt],
6353 if test $have_crypto = yes; then
6355 LIBS="$CRYPTOLIB $LIBS"
6357 AC_CHECK_LIB([k5crypto], [mit_des_cbc_encrypt],
6358 [have_k5crypto=yes],
6360 if test $have_k5crypto = yes; then
6361 CRYPTOLIB=-lk5crypto
6362 LIBS="$CRYPTOLIB $LIBS"
6364 AC_CHECK_LIB([krb5], [krb5_init_context], [have_krb5=yes], [have_krb5=no])
6365 if test $have_krb5=yes; then
6367 LIBS="$KRB5LIB $LIBS"
6369 dnl FIXME Simplify. Does not match 22 logic, thanks to default_off?
6370 if test "${with_kerberos5}" = no; then
6371 AC_CHECK_LIB([des425], [des_cbc_encrypt],
6374 if test $have_des425 = yes; then
6376 LIBS="$DESLIB $LIBS"
6378 AC_CHECK_LIB([des], [des_cbc_encrypt], [have_des=yes], [have_des=no])
6379 if test $have_des = yes; then
6381 LIBS="$DESLIB $LIBS"
6384 AC_CHECK_LIB([krb4], [krb_get_cred], [have_krb4=yes], [have_krb4=no])
6385 if test $have_krb4 = yes; then
6387 LIBS="$KRB4LIB $LIBS"
6389 AC_CHECK_LIB([krb], [krb_get_cred], [have_krb=yes], [have_krb=no])
6390 if test $have_krb = yes; then
6392 LIBS="$KRB4LIB $LIBS"
6397 if test "${with_kerberos5}" != no; then
6398 AC_CHECK_HEADERS([krb5.h],
6399 [AC_CHECK_MEMBERS([krb5_error.text, krb5_error.e_text], [], [],
6400 [#include <krb5.h>])])
6402 AC_CHECK_HEADERS([krb.h], [],
6403 [AC_CHECK_HEADERS([kerberosIV/krb.h], [],
6404 [AC_CHECK_HEADERS([kerberos/krb.h])])])
6406 AC_CHECK_HEADERS([com_err.h])
6410 AC_SUBST([COM_ERRLIB])
6411 AC_SUBST([CRYPTOLIB])
6416 AC_CHECK_HEADERS([valgrind/valgrind.h])
6418 AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
6420 AC_CHECK_FUNCS_ONCE([__lsan_ignore_object])
6424 dnl AC_CHECK_FUNCS_ONCE wouldn’t be right for snprintf, which needs
6425 dnl the current CFLAGS etc.
6426 AC_CHECK_FUNCS([snprintf open_memstream])
6428 dnl posix_spawn. The chdir and setsid functionality is relatively
6429 dnl recent, so we check for it specifically.
6430 AC_CHECK_HEADERS([spawn.h])
6431 AC_SUBST([HAVE_SPAWN_H])
6432 AC_CHECK_FUNCS([posix_spawn \
6433 posix_spawn_file_actions_addchdir \
6434 posix_spawn_file_actions_addchdir_np \
6435 posix_spawnattr_setflags])
6436 AC_SUBST([HAVE_POSIX_SPAWN])
6437 AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR])
6438 AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP])
6439 AC_SUBST([HAVE_POSIX_SPAWNATTR_SETFLAGS])
6440 AC_CHECK_DECLS([POSIX_SPAWN_SETSID], [], [], [[
6443 AC_SUBST([HAVE_DECL_POSIX_SPAWN_SETSID])
6445 dnl Check for glib. This differs from other library checks in that
6446 dnl Emacs need not link to glib unless some other library is already
6447 dnl linking to glib. Although glib provides no facilities that Emacs
6448 dnl needs for its own purposes, when glib is present Emacs needs to
6449 dnl use primitives like g_main_context_query to avoid clashing with
6450 dnl glib at a low level.
6452 dnl Check this late, since it depends on $GTK_CFLAGS etc.
6454 AC_CACHE_CHECK([whether GLib is linked in], [emacs_cv_links_glib],
6455 [OLDCFLAGS="$CFLAGS"
6457 CFLAGS="$CFLAGS $GTK_CFLAGS $RSVG_CFLAGS $DBUS_CFLAGS $SETTINGS_CFLAGS"
6458 LIBS="$LIBS $GTK_LIBS $RSVG_LIBS $DBUS_LIBS $SETTINGS_LIBS"
6459 CFLAGS="$CFLAGS $NOTIFY_CFLAGS $CAIRO_CFLAGS"
6460 LIBS="$LIBS $NOTIFY_LIBS $CAIRO_LIBS"
6461 AC_LINK_IFELSE([AC_LANG_PROGRAM(
6464 [[g_print ("Hello world");]])],
6465 [emacs_cv_links_glib=yes],
6466 [emacs_cv_links_glib=no])
6469 if test "${emacs_cv_links_glib}" = "yes"; then
6470 AC_DEFINE([HAVE_GLIB], [1], [Define to 1 if GLib is linked in.])
6471 if test "$HAVE_NS" = no ; then
6475 AC_SUBST([XGSELOBJ])
6477 AC_DEFUN([EMACS_PAPER_WIDTH],
6478 [AC_REQUIRE([AM_LANGINFO_CODESET])
6479 AS_IF([test "$am_cv_langinfo_codeset" = yes],
6480 [AC_CACHE_CHECK([for nl_langinfo and _NL_PAPER_WIDTH],
6481 [emacs_cv_langinfo__nl_paper_width],
6482 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
6483 [[char *cs = nl_langinfo (_NL_PAPER_WIDTH);]])],
6484 [emacs_cv_langinfo__nl_paper_width=yes],
6485 [emacs_cv_langinfo__nl_paper_width=no])
6487 AS_IF([test "$emacs_cv_langinfo__nl_paper_width" = yes],
6488 [AC_DEFINE([HAVE_LANGINFO__NL_PAPER_WIDTH], [1],
6489 [Define if you have <langinfo.h>
6490 and nl_langinfo (_NL_PAPER_WIDTH).])])])])
6495 dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
6496 dnl how the tty code is related to POSIX and/or other versions of termios.
6497 dnl The following looks like a useful start.
6499 dnl AC_SYS_POSIX_TERMIOS
6500 dnl if test $ac_cv_sys_posix_termios = yes; then
6501 dnl AC_DEFINE([HAVE_TERMIOS], [1],
6502 dnl [Define to 1 if you have POSIX-style
6503 dnl functions and macros for terminal control.])
6504 dnl AC_DEFINE([HAVE_TCATTR], [1],
6505 dnl [Define to 1 if you have tcgetattr and tcsetattr.])
6508 dnl Turned on June 1996 supposing nobody will mind it.
6509 dnl MinGW emulates passwd database, so this feature doesn't make sense there.
6510 if test "${opsys}" != "mingw32"; then
6511 AC_DEFINE([AMPERSAND_FULL_NAME], [1], [Define to use the convention that &
6512 in the full name stands for the login id.])
6515 dnl Everybody supports this, except MS.
6516 dnl Seems like the kind of thing we should be testing for, though.
6517 ## Note: PTYs are broken on darwin <6. Use at your own risk.
6518 if test "${opsys}" != "mingw32"; then
6519 AC_DEFINE([HAVE_PTYS], [1], [Define if the system supports pty devices.])
6522 dnl Everybody supports this, except MS-DOS.
6523 dnl Seems like the kind of thing we should be testing for, though.
6524 AC_DEFINE([HAVE_SOCKETS], [1], [Define if the system supports
6525 4.2-compatible sockets.])
6527 AH_TEMPLATE([INTERNAL_TERMINAL],
6528 [This is substituted when $TERM is "internal".])
6530 AH_TEMPLATE([NULL_DEVICE], [Name of the file to open to get
6531 a null file, or a data sink.])
6532 if test "${opsys}" = "mingw32"; then
6533 AC_DEFINE([NULL_DEVICE], ["NUL:"])
6535 AC_DEFINE([NULL_DEVICE], ["/dev/null"])
6538 if test "${opsys}" = "mingw32"; then
6543 AC_DEFINE_UNQUOTED([SEPCHAR], ['$SEPCHAR'],
6544 [Character that separates PATH elements.])
6545 dnl This is for MinGW, and is used in test/Makefile.in.
6546 dnl The MSYS Bash has heuristics for replacing ':' with ';' when it
6547 dnl decides that a command-line argument to be passed to a MinGW program
6548 dnl is a PATH-style list of directories. But that heuristics plays it
6549 dnl safe, and only does the replacement when it is _absolutely_ sure it
6550 dnl sees a colon-separated list of file names; e.g. ":." is left alone,
6551 dnl which breaks in-tree builds. So we do this manually instead.
6552 dnl Note that we cannot rely on PATH_SEPARATOR, as that one will always
6553 dnl be computed as ':' in MSYS Bash.
6556 dnl Everybody supports this, except MS-DOS.
6557 AC_DEFINE([subprocesses], [1], [Define to enable asynchronous subprocesses.])
6559 AC_DEFINE([DIRECTORY_SEP], ['/'],
6560 [Character that separates directories in a file name.])
6562 if test "${opsys}" = "mingw32"; then
6563 AC_DEFINE([IS_DEVICE_SEP(_c_)], [((_c_) == ':')],
6564 [Returns true if character is a device separator.])
6566 AC_DEFINE([IS_DIRECTORY_SEP(_c_)], [((_c_) == '/' || (_c_) == '\\')],
6567 [Returns true if character is a directory separator.])
6569 AC_DEFINE([IS_ANY_SEP(_c_)],
6570 [(IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))],
6571 [Returns true if character is any form of separator.])
6573 AC_DEFINE([IS_DEVICE_SEP(_c_)], 0,
6574 [Returns true if character is a device separator.])
6576 AC_DEFINE([IS_DIRECTORY_SEP(_c_)], [((_c_) == DIRECTORY_SEP)],
6577 [Returns true if character is a directory separator.])
6579 AC_DEFINE([IS_ANY_SEP(_c_)], [(IS_DIRECTORY_SEP (_c_))],
6580 [Returns true if character is any form of separator.])
6583 if test "$USE_X_TOOLKIT" != "none"; then
6587 dnl Assar Westerlund <assar@sics.se> says this is necessary
6588 dnl for HP-UX 10.20, and that it works for HP-UX 0 as well.
6592 if test "$have_editres" != no && test ! -z "$LIBXMU"; then
6594 dnl See libXmu.a check above.
6595 if test x$HAVE_X11XTR6 = xyes; then
6596 LIBS="-lXt -lSM -lICE $LIBXMU"
6598 OTHERLIBS="-lXt -$LIBXMU"
6600 AC_LINK_IFELSE([AC_LANG_PROGRAM(
6601 [[#include <X11/Intrinsic.h>
6602 #include <X11/Xmu/Editres.h>]],
6603 [[_XEditResCheckMessages (0, 0, 0, 0);]])],
6604 [AC_DEFINE([X_TOOLKIT_EDITRES], [1],
6605 [Define to 1 if we should use XEditRes.])])
6611 solaris | unixware )
6612 dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
6613 dnl instead, there's a system variable _sys_nsig. Unfortunately, we
6614 dnl need the constant to dimension an array. So wire in the appropriate
6616 AC_DEFINE([NSIG_MINIMUM], [32], [Minimum value of NSIG.])
6620 emacs_broken_SIGIO=no
6623 dnl SIGIO exists, but the feature doesn't work in the way Emacs needs.
6624 hpux* | nacl | solaris | unixware )
6625 emacs_broken_SIGIO=yes
6629 dnl On AIX Emacs uses the gmalloc.c malloc implementation. But given
6630 dnl the way this system works, libc functions that return malloced
6631 dnl memory use the libc malloc implementation. Calling xfree or
6632 dnl xrealloc on the results of such functions results in a crash.
6634 dnl One solution for this could be to define SYSTEM_MALLOC in configure,
6635 dnl but that does not currently work on this system.
6637 dnl It is possible to completely override the malloc implementation on
6638 dnl AIX, but that involves putting the malloc functions in a shared
6639 dnl library and setting the MALLOCTYPE environment variable to point to
6640 dnl that shared library.
6642 dnl Emacs currently calls xrealloc on the results of get_current_dir name,
6643 dnl to avoid a crash just use the Emacs implementation for that function.
6645 dnl FIXME We could change the AC_CHECK_FUNCS call near the start
6646 dnl of this file, so that we do not check for get_current_dir_name
6647 dnl on AIX. But that might be fragile if something else ends
6648 dnl up testing for get_current_dir_name as a dependency.
6649 AC_DEFINE([BROKEN_GET_CURRENT_DIR_NAME], [1], [Define if
6650 get_current_dir_name should not be used.])
6654 dnl Circumvent a bug in FreeBSD. In the following sequence of
6655 dnl writes/reads on a PTY, read(2) returns bogus data:
6657 dnl write(2) 1022 bytes
6658 dnl write(2) 954 bytes, get EAGAIN
6659 dnl read(2) 1024 bytes in process_read_output
6660 dnl read(2) 11 bytes in process_read_output
6662 dnl That is, read(2) returns more bytes than have ever been written
6663 dnl successfully. The 1033 bytes read are the 1022 bytes written
6664 dnl successfully after processing (for example with CRs added if the
6665 dnl terminal is set up that way which it is here). The same bytes will
6666 dnl be seen again in a later read(2), without the CRs.
6667 AC_DEFINE([BROKEN_PTY_READ_AFTER_EAGAIN], [1], [Define on FreeBSD to
6668 work around an issue when reading from a PTY.])
6673 gnu-* | android | solaris | cygwin )
6674 dnl FIXME Can't we test if this exists (eg /proc/$$)?
6675 AC_DEFINE([HAVE_PROCFS], [1], [Define if you have the /proc filesystem.])
6680 darwin | dragonfly | freebsd | netbsd | openbsd )
6681 AC_DEFINE([DONT_REOPEN_PTY], [1], [Define if process.c does not need to
6682 close a pty to make it a controlling terminal (it is already a
6683 controlling terminal of the subprocess, because we did ioctl TIOCSCTTY).])
6687 dnl FIXME Surely we can test for this rather than hard-code it.
6689 netbsd | openbsd) sound_device="/dev/audio" ;;
6690 *) sound_device="/dev/dsp" ;;
6694 AC_DEFINE_UNQUOTED([DEFAULT_SOUND_DEVICE], ["$sound_device"],
6695 [Name of the default sound device.])
6698 dnl Emacs can read input using SIGIO and buffering characters itself,
6699 dnl or using CBREAK mode and making C-g cause SIGINT.
6700 dnl The choice is controlled by the variable interrupt_input.
6702 dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
6704 dnl Emacs uses the presence of the USABLE_SIGIO macro
6705 dnl to indicate whether or not signal-driven I/O is possible. It uses
6706 dnl INTERRUPT_INPUT to decide whether to use it by default.
6708 dnl SIGIO can be used only on systems that implement it (4.2 and 4.3).
6709 dnl CBREAK mode has two disadvantages
6710 dnl 1) At least in 4.2, it is impossible to handle the Meta key properly.
6711 dnl I hear that in system V this problem does not exist.
6712 dnl 2) Control-G causes output to be discarded.
6713 dnl I do not know whether this can be fixed in system V.
6715 dnl Another method of doing input is planned but not implemented.
6716 dnl It would have Emacs fork off a separate process
6717 dnl to read the input and send it to the true Emacs process
6720 darwin | gnu-linux | gnu-kfreebsd)
6721 AC_DEFINE([INTERRUPT_INPUT], [1], [Define to read input using SIGIO.])
6726 dnl If the system's imake configuration file defines 'NeedWidePrototypes'
6727 dnl as 'NO', we must define NARROWPROTO manually. Such a define is
6728 dnl generated in the Makefile generated by 'xmkmf'. If we don't define
6729 dnl NARROWPROTO, we will see the wrong function prototypes for X functions
6730 dnl taking float or double parameters.
6732 cygwin|gnu|gnu-linux|gnu-kfreebsd|freebsd|netbsd|openbsd)
6733 AC_DEFINE([NARROWPROTO], [1], [Define if system's imake configuration
6734 file defines 'NeedWidePrototypes' as 'NO'.])
6739 dnl Used in process.c, this must be a loop, even if it only runs once.
6740 AH_TEMPLATE([PTY_ITERATION], [How to iterate over PTYs.])
6741 dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
6742 dnl trying suffixes 0-16.
6743 AH_TEMPLATE([FIRST_PTY_LETTER], [Letter to use in finding device name of
6744 first PTY, if PTYs are supported.])
6745 AH_TEMPLATE([PTY_OPEN], [How to open a PTY, if non-standard.])
6746 AH_TEMPLATE([PTY_NAME_SPRINTF], [How to get the device name of the control
6747 end of a PTY, if non-standard.])
6748 AH_TEMPLATE([PTY_TTY_NAME_SPRINTF], [How to get device name of the tty
6749 end of a PTY, if non-standard.])
6753 AC_DEFINE([PTY_ITERATION], [int c; for (c = 0; !c ; c++)])
6754 dnl You allocate a pty by opening /dev/ptc to get the master side.
6755 dnl To get the name of the slave side, you just ttyname() the master side.
6756 AC_DEFINE([PTY_NAME_SPRINTF], [strcpy (pty_name, "/dev/ptc");])
6757 AC_DEFINE([PTY_TTY_NAME_SPRINTF], [strcpy (pty_name, ttyname (fd));])
6761 AC_DEFINE([PTY_ITERATION], [int i; for (i = 0; i < 1; i++)])
6762 dnl multi-line AC_DEFINEs are hard. :(
6763 AC_DEFINE([PTY_OPEN],
6764 [ 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)])
6765 AC_DEFINE([PTY_NAME_SPRINTF], [])
6766 AC_DEFINE([PTY_TTY_NAME_SPRINTF], [])
6770 AC_DEFINE([FIRST_PTY_LETTER], ['p'])
6774 AC_DEFINE([PTY_ITERATION], [int i; for (i = 0; i < 1; ++i)])
6775 dnl grantpt may be defined in libc but not declared. The same
6776 dnl goes for posix_openpt. When that is the case, it means that
6777 dnl grantpt or posix_openpt cannot actually be used.
6778 AC_CHECK_DECLS([grantpt, posix_openpt])
6779 AS_IF([test "x$ac_cv_have_decl_grantpt" = xyes],
6780 [AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6781 [{ 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); }])],
6782 [AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6783 [{ 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); }])])
6784 AS_IF([test "x$ac_cv_have_decl_posix_openpt" = xyes],
6785 [AC_DEFINE([PTY_OPEN],
6786 [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (false)])
6787 AC_DEFINE([PTY_NAME_SPRINTF], [])],
6788 [AC_DEFINE([PTY_NAME_SPRINTF], [])
6789 AC_DEFINE([PTY_OPEN], [fd = getpt ()])])
6792 gnu-linux | gnu-kfreebsd | dragonfly | freebsd | openbsd | netbsd | darwin | nacl )
6794 if test "x$ac_cv_func_grantpt" = xyes; then
6795 AC_DEFINE([UNIX98_PTYS], [1], [Define if the system has Unix98 PTYs.])
6796 AC_DEFINE([PTY_ITERATION], [int i; for (i = 0; i < 1; i++)])
6797 dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD
6798 dnl to prevent sigchld_handler from intercepting the child's death.
6799 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6800 [{ 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); }])
6801 dnl if HAVE_POSIX_OPENPT
6802 if test "x$ac_cv_func_posix_openpt" = xyes; then
6803 AC_DEFINE([PTY_OPEN],
6804 [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (false)])
6805 AC_DEFINE([PTY_NAME_SPRINTF], [])
6807 elif test "x$ac_cv_func_getpt" = xyes; then
6808 AC_DEFINE([PTY_OPEN], [fd = getpt ()])
6809 AC_DEFINE([PTY_NAME_SPRINTF], [])
6811 AC_DEFINE([PTY_NAME_SPRINTF], [strcpy (pty_name, "/dev/ptmx");])
6814 AC_DEFINE([FIRST_PTY_LETTER], ['p'])
6819 AC_DEFINE([FIRST_PTY_LETTER], ['p'])
6820 AC_DEFINE([PTY_NAME_SPRINTF],
6821 [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])
6822 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6823 [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])
6827 dnl On SysVr4, grantpt(3) forks a subprocess, so do not use
6828 dnl O_CLOEXEC when opening the pty, and keep the SIGCHLD handler
6829 dnl from intercepting that death. If any child but grantpt's should die
6830 dnl within, it should be caught after sigrelse(2).
6831 AC_DEFINE([PTY_OPEN], [fd = open (pty_name, O_RDWR | O_NONBLOCK)])
6832 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6833 [{ 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); }])
6837 dnl Comments are as per solaris.
6838 AC_DEFINE([PTY_OPEN], [fd = open (pty_name, O_RDWR | O_NONBLOCK)])
6839 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6840 [{ 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); }])
6844 AC_DEFINE([FIRST_PTY_LETTER], ['s'])
6845 AC_DEFINE([PTY_NAME_SPRINTF], [])
6846 dnl on Haiku pty names aren't distinctive, thus the use of posix_openpt
6847 AC_DEFINE([PTY_OPEN], [fd = posix_openpt (O_RDWR | O_NONBLOCK)])
6848 AC_DEFINE([PTY_TTY_NAME_SPRINTF],
6849 [{ 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); }])
6855 solaris | unixware )
6856 dnl This change means that we don't loop through allocate_pty too
6857 dnl many times in the (rare) event of a failure.
6858 AC_DEFINE([FIRST_PTY_LETTER], ['z'])
6859 AC_DEFINE([PTY_NAME_SPRINTF], [strcpy (pty_name, "/dev/ptmx");])
6860 dnl Push various streams modules onto a PTY channel. Used in process.c.
6861 AC_DEFINE([SETUP_SLAVE_PTY],
6862 [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.])
6867 AH_TEMPLATE([SIGNALS_VIA_CHARACTERS], [Make process_send_signal work by
6868 "typing" a signal character on the pty.])
6871 dnl Perry Smith <pedz@ddivt1.austin.ibm.com> says this is correct for AIX.
6872 aix4-2 | cygwin | gnu | dragonfly | freebsd | netbsd | openbsd | darwin )
6873 AC_DEFINE([SIGNALS_VIA_CHARACTERS], [1])
6876 dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.
6877 dnl FIXME Does gnu-kfreebsd have linux/version.h? It seems unlikely...
6878 gnu-linux | gnu-kfreebsd )
6880 AC_CACHE_CHECK([for signals via characters], [emacs_cv_signals_via_chars],
6881 [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6882 #include <linux/version.h>
6883 #if LINUX_VERSION_CODE < 0x20400
6884 # error "Linux version too old"
6887 [emacs_cv_signals_via_chars=yes],
6888 [emacs_cv_signals_via_chars=no])])
6890 test "$emacs_cv_signals_via_chars" = yes &&
6891 AC_DEFINE([SIGNALS_VIA_CHARACTERS], [1])
6896 AH_TEMPLATE([TAB3], [Undocumented.])
6899 darwin) AC_DEFINE([TAB3], [OXTABS]) ;;
6901 gnu | dragonfly | freebsd | netbsd | openbsd )
6902 AC_DEFINE([TABDLY], [OXTABS], [Undocumented.])
6903 AC_DEFINE([TAB3], [OXTABS])
6906 gnu-linux | gnu-kfreebsd )
6914 [AC_DEFINE([GC_MARK_SECONDARY_STACK()],
6915 [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)],
6916 [Mark a secondary stack, like the register stack on the ia64.])], [])
6920 AC_DEFINE([RUN_TIME_REMAP], [1], [Define if emacs.c needs to call
6921 run_time_remap; for HPUX.])
6926 dnl This won't be used automatically yet. We also need to know, at least,
6927 dnl that the stack is continuous.
6928 AH_TEMPLATE([GC_SETJMP_WORKS], [Define if setjmp is known to save all
6929 registers relevant for conservative garbage collection in the jmp_buf.])
6933 dnl Not all the architectures are tested, but there are Debian packages
6934 dnl for SCM and/or Guile on them, so the technique must work. See also
6935 dnl comments in alloc.c concerning setjmp and gcc.
6936 dnl Fixme: it's probably safe to just use the GCC conditional below.
6937 gnu-linux | gnu-kfreebsd )
6938 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6939 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
6940 || defined __alpha__ || defined __mips__ || defined __s390__ \
6941 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
6942 || defined __x86_64__ \
6943 || defined __ia64__ || defined __sh__
6946 # error "setjmp not known to work on this arch"
6948 ]], [[]])], [AC_DEFINE([GC_SETJMP_WORKS], [1])])
6953 if test x$GCC = xyes; then
6954 dnl GC_SETJMP_WORKS is nearly always appropriate for GCC.
6955 AC_DEFINE([GC_SETJMP_WORKS], [1])
6958 aix* | dragonfly | freebsd | netbsd | openbsd | solaris )
6959 AC_DEFINE([GC_SETJMP_WORKS], [1])
6964 dnl In a weird quirk, MS runtime uses _setjmp and longjmp.
6965 AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
6968 [[#include <setjmp.h>
6970 # define _longjmp longjmp
6975 _longjmp (j, 1);]])],
6976 [emacs_cv_func__setjmp=yes],
6977 [emacs_cv_func__setjmp=no])])
6978 if test $emacs_cv_func__setjmp = yes; then
6979 AC_DEFINE([HAVE__SETJMP], [1], [Define to 1 if _setjmp and _longjmp work.])
6982 # We need to preserve signal mask to handle C stack overflows.
6983 AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp],
6986 [[#include <setjmp.h>
6989 if (! sigsetjmp (j, 1))
6990 siglongjmp (j, 1);]])],
6991 [emacs_cv_func_sigsetjmp=yes],
6992 [emacs_cv_func_sigsetjmp=no])])
6993 if test $emacs_cv_func_sigsetjmp = yes; then
6994 AC_DEFINE([HAVE_SIGSETJMP], [1],
6995 [Define to 1 if sigsetjmp and siglongjmp work.])
6998 case $emacs_cv_func_sigsetjmp,$emacs_cv_alternate_stack,$opsys in
6999 yes,yes,* | *,*,mingw32)
7000 AC_DEFINE([HAVE_STACK_OVERFLOW_HANDLING], [1],
7001 [Define to 1 if C stack overflow can be handled in some cases.]);;
7005 solaris | unixware )
7006 dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
7007 dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs,
7008 dnl and this is all we need.
7009 AC_DEFINE([TIOCSIGSEND], [TIOCSIGNAL], [Some platforms redefine this.])
7016 dnl Used in xfaces.c.
7017 AC_DEFINE([XOS_NEEDS_TIME_H], [1], [Compensate for a bug in Xos.h on
7018 some systems, where it requires time.h.])
7023 dnl Define symbols to identify the version of Unix this is.
7024 dnl Define all the symbols that apply correctly.
7025 AH_TEMPLATE([DOS_NT], [Define if the system is MS DOS or MS Windows.])
7026 AH_TEMPLATE([MSDOS], [Define if the system is MS DOS.])
7027 AH_TEMPLATE([USG], [Define if the system is compatible with System III.])
7028 AH_TEMPLATE([USG5_4],
7029 [Define if the system is compatible with System V Release 4.])
7033 AC_DEFINE([USG], [])
7034 dnl This symbol should be defined on AIX Version 3 ???????
7035 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7037 # error "_AIX not defined"
7039 ]], [[]])], [], [AC_DEFINE([_AIX], [], [Define if the system is AIX.])])
7043 AC_DEFINE([CYGWIN], [1], [Define if the system is Cygwin.])
7047 dnl Not __APPLE__, as this may not be defined on non-macOS Darwin.
7048 dnl Not DARWIN, because Panther and lower CoreFoundation.h use DARWIN to
7049 dnl distinguish macOS from pure Darwin.
7050 AC_DEFINE([DARWIN_OS], [], [Define if the system is Darwin.])
7053 gnu-linux | gnu-kfreebsd )
7054 AC_DEFINE([USG], [])
7055 AC_DEFINE([GNU_LINUX], [],
7056 [Define if this system is compatible with GNU/Linux.])
7060 AC_DEFINE([USG], [])
7061 AC_DEFINE([HPUX], [], [Define if the system is HPUX.])
7065 AC_DEFINE([DOS_NT], [])
7066 AC_DEFINE([WINDOWSNT], [1], [Define if compiling for native MS Windows.])
7067 if test "x$ac_enable_checking" != "x" ; then
7068 AC_DEFINE([EMACSDEBUG], [1],
7069 [Define to 1 to enable w32 debug facilities.])
7074 AC_DEFINE([USG], [])
7075 AC_DEFINE([USG5_4], [])
7076 AC_DEFINE([SOLARIS2], [], [Define if the system is Solaris.])
7080 AC_DEFINE([USG], [])
7081 AC_DEFINE([USG5_4], [])
7085 AC_DEFINE([HAIKU], [], [Define if the system is Haiku.])
7089 AC_SYS_POSIX_TERMIOS
7090 if test $ac_cv_sys_posix_termios = yes; then
7091 AC_CHECK_SIZEOF([speed_t], [], [#include <termios.h>])
7092 dnl on Haiku, and possibly other platforms, speed_t is defined to
7093 dnl unsigned char, even when speeds greater than 200 baud are
7096 if test ${ac_cv_sizeof_speed_t} -lt 2; then
7097 AC_DEFINE([HAVE_TINY_SPEED_T], [1],
7098 [Define to 1 if speed_t has some sort of nonsensically tiny size.])
7102 AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
7105 dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
7106 emacs_cv_usable_FIONREAD=no
7110 emacs_cv_usable_FIONREAD=yes
7115 [AC_LANG_PROGRAM([[#include <sys/types.h>
7116 #include <sys/ioctl.h>
7118 # include <sys/filio.h>
7121 [[int foo = ioctl (0, FIONREAD, &foo);]])],
7122 [emacs_cv_usable_FIONREAD=yes],
7123 [emacs_cv_usable_FIONREAD=no])
7126 if test $emacs_cv_usable_FIONREAD = yes; then
7127 AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.])
7129 if test $emacs_broken_SIGIO = no; then
7130 AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO],
7132 [AC_LANG_PROGRAM([[#include <fcntl.h>
7135 [[int foo = SIGIO | F_SETFL | FASYNC;]])],
7136 [emacs_cv_usable_SIGIO=yes],
7137 [emacs_cv_usable_SIGIO=no])],
7138 [emacs_cv_usable_SIGIO=yes],
7139 [emacs_cv_usable_SIGIO=no])
7140 if test $emacs_cv_usable_SIGIO = yes; then
7141 AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.])
7145 if test $emacs_broken_SIGIO = no && test $emacs_cv_usable_SIGIO = no; then
7146 AC_CACHE_CHECK([for usable SIGPOLL], [emacs_cv_usable_SIGPOLL],
7148 [AC_LANG_PROGRAM([[#include <fcntl.h>
7151 [[int foo = SIGPOLL | F_SETFL;]])],
7152 [emacs_cv_usable_SIGPOLL=yes],
7153 [emacs_cv_usable_SIGPOLL=no])],
7154 [emacs_cv_usable_SIGPOLL=yes],
7155 [emacs_cv_usable_SIGPOLL=no])
7156 if test $emacs_cv_usable_SIGPOLL = yes; then
7157 AC_DEFINE([USABLE_SIGPOLL], [1], [Define to 1 if SIGPOLL is usable but SIGIO is not.])
7164 dnl It works to open the pty's tty in the parent (Emacs), then
7165 dnl close and reopen it in the child.
7166 AC_DEFINE([USG_SUBTTY_WORKS], [1], [Define for USG systems where it
7167 works to open a pty's tty in the parent process, then close and
7168 reopen it in the child.])
7172 AC_DEFINE([_STRUCTURED_PROC], [1], [Needed for system_process_attributes
7177 # Set up the CFLAGS for real compilation, so we can substitute it.
7178 CFLAGS="$REAL_CFLAGS"
7179 CPPFLAGS="$REAL_CPPFLAGS"
7182 ## Hack to detect a buggy GCC version.
7183 if test "$GCC" = yes && \
7184 $CC --version 2> /dev/null | grep 'gcc.* 4.5.0' >/dev/null; then
7186 *-fno-optimize-sibling-calls*) ;;
7188 AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS.]);;
7192 version=$PACKAGE_VERSION
7194 copyright="Copyright (C) 2024 Free Software Foundation, Inc."
7195 AC_DEFINE_UNQUOTED([COPYRIGHT], ["$copyright"],
7196 [Short copyright string for this version of Emacs.])
7197 AC_SUBST([copyright])
7199 ### Specify what sort of things we'll be editing into Makefile and config.h.
7200 ### Use configuration here uncanonicalized to avoid exceeding size limits.
7202 AC_SUBST([configuration])
7204 AC_SUBST([canonical])
7207 AC_SUBST([exec_prefix])
7210 AC_SUBST([gsettingsschemadir])
7211 AC_SUBST([sharedstatedir])
7212 AC_SUBST([libexecdir])
7215 AC_SUBST([lispdirrel])
7217 AC_SUBST([standardlisppath])
7218 AC_SUBST([locallisppath])
7219 AC_SUBST([lisppath])
7220 AC_SUBST([x_default_search_path])
7222 AC_SUBST([archlibdir])
7223 AC_SUBST([etcdocdir])
7224 AC_SUBST([bitmapdir])
7226 AC_SUBST([gameuser])
7227 AC_SUBST([gamegroup])
7228 ## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
7229 ## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
7230 ## end of LIBX_BASE, but nothing ever set it.
7231 AC_SUBST([LD_SWITCH_X_SITE])
7232 AC_SUBST([C_SWITCH_X_SITE])
7233 AC_SUBST([GNUSTEP_CFLAGS])
7235 ## Used in lwlib/Makefile.in.
7236 AC_SUBST([X_TOOLKIT_TYPE])
7237 AC_SUBST([ns_appdir])
7238 AC_SUBST([ns_appbindir])
7239 AC_SUBST([ns_applibexecdir])
7240 AC_SUBST([ns_applibdir])
7241 AC_SUBST([ns_appresdir])
7242 AC_SUBST([ns_appsrc])
7243 AC_SUBST([GNU_OBJC_CFLAGS])
7244 AC_SUBST([OTHER_FILES])
7246 if test -n "${term_header}"; then
7247 AC_DEFINE_UNQUOTED([TERM_HEADER], ["${term_header}"],
7248 [Define to the header for the built-in window system.])
7251 AC_DEFINE_UNQUOTED([EMACS_CONFIGURATION], ["${canonical}"],
7252 [Define to the canonical Emacs configuration name.])
7253 AC_DEFINE_UNQUOTED([EMACS_CONFIG_OPTIONS], "${emacs_config_options}",
7254 [Define to the options passed to configure.])
7259 if test "${HAVE_X_WINDOWS}" = "yes" ; then
7260 AC_DEFINE([HAVE_X_WINDOWS], [1],
7261 [Define to 1 if you want to use the X window system.])
7263 XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o"
7265 if test "$HAVE_CAIRO" = "yes"; then
7266 FONT_OBJ="$FONT_OBJ ftfont.o ftcrfont.o"
7267 elif test "$HAVE_XFT" = "yes"; then
7268 FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o"
7269 elif test "$HAVE_FREETYPE" = "yes"; then
7270 FONT_OBJ="$FONT_OBJ ftfont.o"
7274 if test "${window_system}" = "pgtk"; then
7275 FONT_OBJ="ftfont.o ftcrfont.o"
7278 if test "${HAVE_BE_APP}" = "yes" ; then
7279 if test "${HAVE_CAIRO}" = "yes"; then
7280 FONT_OBJ="$FONT_OBJ ftfont.o ftcrfont.o"
7284 if test "${HAVE_HARFBUZZ}" = "yes" ; then
7285 FONT_OBJ="$FONT_OBJ hbfont.o"
7287 AC_SUBST([FONT_OBJ])
7288 AC_SUBST([XMENU_OBJ])
7290 AC_SUBST([FONT_OBJ])
7294 if test "${USE_X_TOOLKIT}" != "none" ; then
7296 AC_DEFINE([USE_X_TOOLKIT], [1], [Define to 1 if using an X toolkit.])
7297 if test "${USE_X_TOOLKIT}" = "LUCID"; then
7298 AC_DEFINE([USE_LUCID], [1], [Define to 1 if using the Lucid X toolkit.])
7299 elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
7300 AC_DEFINE([USE_MOTIF], [1], [Define to 1 if using the Motif X toolkit.])
7304 ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
7305 MOTIF_LIBW="$MOTIF_LIBW -lXpm"
7309 ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
7310 ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
7311 MOTIF_LIBW="MOTIF_LIBW -lXimp"
7315 ## olson@mcs.anl.gov says -li18n is needed by -lXm.
7316 MOTIF_LIBW="$MOTIF_LIBW -li18n"
7319 MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
7322 AC_SUBST([WIDGET_OBJ])
7325 case "$USE_X_TOOLKIT" in
7326 MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
7327 LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
7328 none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
7330 if test "$HAVE_XWIDGETS" = "yes"; then
7331 TOOLKIT_LIBW="$TOOLKIT_LIBW -lXcomposite"
7333 AC_SUBST([TOOLKIT_LIBW])
7335 if test "${opsys}" != "mingw32"; then
7336 if test "$USE_X_TOOLKIT" = "none"; then
7337 LIBXT_OTHER="\$(LIBXSM)"
7339 LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
7342 AC_SUBST([LIBXT_OTHER])
7344 if test "${HAVE_X11}" = "yes" ; then
7345 AC_DEFINE([HAVE_X11], [1],
7346 [Define to 1 if you want to use version 11 of X windows.])
7347 LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
7351 AC_SUBST([LIBX_OTHER])
7354 if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then
7356 elif test "$USE_X_TOOLKIT" = none; then
7358 LIBXMENU='$(oldXMenudir)/libXMenu11.a'
7359 AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu"
7361 LIBXMENU='$(lwlibdir)/liblw.a'
7362 AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib"
7364 AC_SUBST([LIBXMENU])
7366 AC_CACHE_CHECK([for struct alignment],
7367 [emacs_cv_struct_alignment],
7369 [AC_LANG_PROGRAM([[#include <stddef.h>
7370 struct s { char c; } __attribute__ ((aligned (8)));
7371 struct t { char c; struct s s; };
7372 char verify[offsetof (struct t, s) == 8 ? 1 : -1];
7374 [emacs_cv_struct_alignment=yes],
7375 [emacs_cv_struct_alignment=no])])
7376 if test "$emacs_cv_struct_alignment" = yes; then
7377 AC_DEFINE([HAVE_STRUCT_ATTRIBUTE_ALIGNED], [1],
7378 [Define to 1 if 'struct __attribute__ ((aligned (N)))' aligns the
7379 structure to an N-byte boundary.])
7385 AC_CACHE_CHECK([for statement expressions],
7386 [emacs_cv_statement_expressions],
7388 [AC_LANG_PROGRAM([], [[return ({ int x = 5; x-x; });]])],
7389 [emacs_cv_statement_expressions=yes],
7390 [emacs_cv_statement_expressions=no])])
7391 if test "$emacs_cv_statement_expressions" = yes; then
7392 AC_DEFINE([HAVE_STATEMENT_EXPRESSIONS], [1],
7393 [Define to 1 if statement expressions work.])
7396 if test "${GNU_MALLOC}" = "yes" ; then
7397 AC_DEFINE([GNU_MALLOC], [1],
7398 [Define to 1 if you want to use the GNU memory allocator.])
7402 if test "${REL_ALLOC}" = "yes" ; then
7403 AC_DEFINE([REL_ALLOC], [1],
7404 [Define REL_ALLOC if you want to use the relocating allocator for
7407 test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
7409 AC_SUBST([RALLOC_OBJ])
7411 if test "$opsys" = "cygwin"; then
7412 CYGWIN_OBJ="cygw32.o"
7413 ## Cygwin differs because of its unexec().
7415 POST_ALLOC_OBJ=lastfile.o
7416 elif test "$opsys" = "mingw32"; then
7419 POST_ALLOC_OBJ=lastfile.o
7422 PRE_ALLOC_OBJ=lastfile.o
7425 AC_SUBST([CYGWIN_OBJ])
7426 AC_SUBST([PRE_ALLOC_OBJ])
7427 AC_SUBST([POST_ALLOC_OBJ])
7429 dnl Call this 'FORTIFY_SOUR' so that it sorts before the 'FORTIFY_SOURCE'
7430 dnl verbatim defined above. The tricky name is apropos, as this hack
7431 dnl makes Fortify go sour!
7432 AH_VERBATIM([FORTIFY_SOUR],
7433 [/* Without the following workaround, Emacs runs slowly on OS X 10.8.
7434 The workaround disables some useful run-time checking, so it
7435 should be conditional to the platforms with the performance bug.
7436 Perhaps Apple will fix this some day; also see m4/extern-inline.m4. */
7437 #if defined __APPLE__ && defined __GNUC__
7438 # ifndef _DONT_USE_CTYPE_INLINE_
7439 # define _DONT_USE_CTYPE_INLINE_
7441 # ifndef _FORTIFY_SOURCE
7442 # define _FORTIFY_SOURCE 0
7447 # If user asks to omit features, disable optional features that gnulib
7448 # might otherwise enable.
7449 if test "$with_features" = no && test "$enable_acl" != yes; then
7453 # Configure gnulib. Although this does not affect CFLAGS or LIBS permanently.
7454 # it temporarily reverts them to their pre-pkg-config values,
7455 # because gnulib needs to work with both src (which uses the
7456 # pkg-config stuff) and lib-src (which does not). For example, gnulib
7457 # may need to determine whether CLOCK_TIME_LIB should contain -lrt,
7458 # and it therefore needs to run in an environment where LIBS does not
7459 # already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
7460 # for some package unrelated to lib-src.
7463 CFLAGS=$pre_PKG_CONFIG_CFLAGS
7464 LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
7465 gl_ASSERT_NO_GNULIB_POSIXCHECK
7466 gl_ASSERT_NO_GNULIB_TESTS
7472 # Set up libgmp on Android. Make sure to override what gnulib has
7475 if test "$REALLY_ANDROID" = "yes" && test "$with_libgmp" != "no"; then
7477 ndk_SEARCH_MODULE([libgmp], [LIBGMP], [HAVE_LIBGMP=yes])
7479 if test "$HAVE_LIBGMP" = "yes"; then
7480 SAVE_CFLAGS="$CFLAGS"
7481 CFLAGS="$CFLAGS $LIBGMP_CFLAGS"
7482 unset ac_cv_header_gmp_h
7483 unset ac_cv_header_gmp_gmp_h
7484 AC_CHECK_HEADERS([gmp.h gmp/gmp.h], [break])
7485 CFLAGS="$SAVE_CFLAGS"
7487 GL_GENERATE_GMP_H_CONDITION=
7488 GL_GENERATE_GMP_GMP_H=
7489 GL_GENERATE_GMP_GMP_H_CONDITION=
7490 GL_GENERATE_MINI_GMP_H=
7491 GL_GENERATE_MINI_GMP_H_CONDITION=
7493 if test "$ac_cv_header_gmp_h" != "no" \
7494 || test "$ac_cv_header_gmp_gmp_h" != "no"; then
7496 GL_GENERATE_GMP_H=false
7497 LIBGMP="$LIBGMP_LIBS"
7502 AC_SUBST([LIBGMP_CFLAGS])
7504 # timer_getoverrun needs the same library as timer_settime
7506 LIBS="$LIB_TIMER_TIME $LIBS"
7507 AC_CHECK_FUNCS([timer_getoverrun])
7510 if test "${opsys}" = "mingw32"; then
7511 CPPFLAGS="$CPPFLAGS -DUSE_CRT_DLL=1 -I \${abs_top_srcdir}/nt/inc"
7512 # Remove unneeded switches from the value of CC that goes to Makefiles
7513 CC=`AS_ECHO(["$CC"]) | sed -e "s,$GCC_TEST_OPTIONS,,"`
7517 aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
7519 cygwin) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000" ;;
7522 if test "$HAVE_NS" = "yes"; then
7523 libs_nsgui="-framework AppKit"
7524 if test "$NS_IMPL_COCOA" = "yes"; then
7525 libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon \
7526 -framework IOSurface -framework QuartzCore"
7527 if test "$emacs_cv_macosx_12_0" = "yes"; then
7528 libs_nsgui="$libs_nsgui -framework UniformTypeIdentifiers"
7534 LD_SWITCH_SYSTEM_TEMACS=$libs_nsgui
7535 ## The -headerpad option tells ld (see man page) to leave room at the
7536 ## end of the header for adding load commands. Needed for dumping.
7537 ## 0x1000 is enough for roughly 52 load commands on the x86_64
7538 ## architecture (where they are 78 bytes each). The actual number of
7539 ## load commands added is not consistent but normally ranges from
7540 ## about 14 to about 34. Setting it high gets us plenty of slop and
7541 ## only costs about 1.5K of wasted binary space.
7542 headerpad_extra=1000
7543 if test "$with_unexec" = yes; then
7544 LD_SWITCH_SYSTEM_TEMACS="-fno-pie $LD_SWITCH_SYSTEM_TEMACS -Xlinker -headerpad -Xlinker $headerpad_extra"
7547 ## This is here because src/Makefile.in did some extra fiddling around
7548 ## with LD_SWITCH_SYSTEM. It seems cleaner to put this in
7549 ## LD_SWITCH_SYSTEM_TEMACS instead,
7550 test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
7551 LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
7554 ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
7555 ## find X at run-time.
7556 ## When handled by cpp, this was in LD_SWITCH_SYSTEM. However, at the
7557 ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
7558 ## had not yet been defined and was expanded to null. Hence LD_SWITCH_SYSTEM
7559 ## had different values in configure (in ac_link) and src/Makefile.in.
7560 ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
7561 gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
7564 ## Is it any better under MinGW64 to relocate emacs into higher addresses?
7565 ## If the values of -image-base are modified, the corresponding
7566 ## values of DEFAULT_IMAGE_BASE in w32fns.c should be kept in sync.
7567 case "$canonical" in
7568 x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x400000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
7569 *) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
7571 ## If they want unexec, disable Windows ASLR for the Emacs binary
7572 if test "$with_dumping" = "unexec"; then
7573 case "$canonical" in
7574 x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -Wl,-disable-dynamicbase -Wl,-disable-high-entropy-va -Wl,-default-image-base-low" ;;
7575 *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -Wl,-disable-dynamicbase" ;;
7580 *) LD_SWITCH_SYSTEM_TEMACS= ;;
7583 # -no-pie or -nopie fixes a temacs segfault on Gentoo, OpenBSD,
7584 # Ubuntu, and other systems with "hardened" GCC configurations for
7585 # some reason (Bug#18784). We don't know why this works, but not
7586 # segfaulting is better than segfaulting. Use ac_c_werror_flag=yes
7587 # when trying the option, otherwise clang keeps warning that it does
7588 # not understand it, and pre-4.6 GCC has a similar problem
7589 # (Bug#20338). Prefer -no-pie to -nopie, as -no-pie is the
7590 # spelling used by GCC 6.1.0 and later (Bug#24682).
7592 [for $CC option to disable position independent executables],
7593 [emacs_cv_prog_cc_no_pie],
7594 [if test $with_unexec = no; then
7595 emacs_cv_prog_cc_no_pie='not needed'
7597 emacs_save_c_werror_flag=$ac_c_werror_flag
7598 emacs_save_LDFLAGS=$LDFLAGS
7599 ac_c_werror_flag=yes
7600 for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do
7601 test $emacs_cv_prog_cc_no_pie = no && break
7602 LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie"
7603 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break])
7605 ac_c_werror_flag=$emacs_save_c_werror_flag
7606 LDFLAGS=$emacs_save_LDFLAGS
7608 case $emacs_cv_prog_cc_no_pie in
7610 LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie"
7614 if test x$ac_enable_profiling != x ; then
7616 *freebsd | gnu-linux) ;;
7617 *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -pg" ;;
7621 LD_SWITCH_SYSTEM_TEMACS="$LDFLAGS_NOCOMBRELOC $LD_SWITCH_SYSTEM_TEMACS"
7623 AC_SUBST([LD_SWITCH_SYSTEM_TEMACS])
7625 ## Common for all window systems
7626 if test "$window_system" != "none"; then
7627 AC_DEFINE([HAVE_WINDOW_SYSTEM], [1], [Define if you have a window system.])
7628 AC_DEFINE([POLL_FOR_INPUT], [1],
7629 [Define if you poll periodically to detect C-g.])
7630 WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o"
7632 if test "$window_system" = "x11" || test "$REALLY_ANDROID" = "yes"; then
7633 AC_DEFINE([HAVE_TEXT_CONVERSION], [1],
7634 [Define if the window system has text conversion support.])
7635 WINDOW_SYSTEM_OBJ="$WINDOW_SYSTEM_OBJ textconv.o"
7639 AC_SUBST([WINDOW_SYSTEM_OBJ])
7641 # Some systems have MB_CUR_MAX defined to a call to
7642 # __ctype_get_mb_cur_max, but do not have __ctype_get_mb_cur_max in
7643 # libc. Check for that situation and define MB_CUR_MAX to something
7646 AC_CHECK_FUNC([__ctype_get_mb_cur_max])
7648 AC_CACHE_CHECK([whether MB_CUR_MAX is defined to function that won't link],
7649 [emacs_cv_broken_mb_cur_max],
7650 [AC_EGREP_CPP(__ctype_get_mb_cur_max, [
7653 #define MB_CUR_MAX -1
7655 static int foo = MB_CUR_MAX;
7656 ], [AS_IF([test "$ac_cv_func___ctype_get_mb_cur_max" = "yes"],
7657 [emacs_cv_broken_mb_cur_max=no],
7658 [emacs_cv_broken_mb_cur_max=yes])],
7659 [emacs_cv_broken_mb_cur_max=no])])
7661 AS_IF([test "$emacs_cv_broken_mb_cur_max" = "yes"],
7662 # Define this to 4, which is right for Android.
7663 [AS_CASE([$opsys], [android],
7664 [AC_DEFINE([REPLACEMENT_MB_CUR_MAX], [4],
7665 [Define to MB_CUR_MAX if stdlib.h is broken.])],
7666 [AC_MSG_ERROR([MB_CUR_MAX does not work on your system.
7667 Please modify configure.ac to set an appropriate value, then
7668 send your change to bug-gnu-emacs@gnu.org])])])
7670 AH_TOP([/* GNU Emacs site configuration template file.
7672 Copyright (C) 1988-2024 Free Software Foundation, Inc.
7674 This file is part of GNU Emacs.
7676 GNU Emacs is free software: you can redistribute it and/or modify
7677 it under the terms of the GNU General Public License as published by
7678 the Free Software Foundation, either version 3 of the License, or (at
7679 your option) any later version.
7681 GNU Emacs is distributed in the hope that it will be useful,
7682 but WITHOUT ANY WARRANTY; without even the implied warranty of
7683 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7684 GNU General Public License for more details.
7686 You should have received a copy of the GNU General Public License
7687 along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
7690 /* No code in Emacs #includes config.h twice, but some bits of code
7691 intended to work with other packages as well (like gmalloc.c)
7692 think they can include it as many times as they like. */
7693 #ifndef EMACS_CONFIG_H
7694 #define EMACS_CONFIG_H
7697 AH_BOTTOM([#include <conf_post.h>
7699 #endif /* EMACS_CONFIG_H */
7708 #### Report on what we decided to do.
7709 #### Report GTK as a toolkit, even if it doesn't use Xt.
7710 #### It makes printing result more understandable as using GTK sets
7711 #### toolkit_scroll_bars to yes by default.
7712 if test "${HAVE_GTK}" = "yes"; then
7713 USE_X_TOOLKIT="$USE_GTK_TOOLKIT"
7716 if test $USE_ACL -ne 0; then
7718 test "$LIB_ACL" && ACL_SUMMARY="$ACL_SUMMARY $LIB_ACL"
7719 test "$LIB_XATTR" && ACL_SUMMARY="$ACL_SUMMARY $LIB_XATTR"
7724 if test -z "$GMP_H"; then
7730 emacs_standard_dirs='Standard dirs'
7732 Configured for '${canonical}'.
7734 Where should the build process find the source code? ${srcdir}
7735 What compiler should emacs be built with? ${CC} ${CFLAGS}
7736 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
7737 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
7738 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
7739 What window system should Emacs use? ${window_system}
7740 What toolkit should Emacs use? ${USE_X_TOOLKIT}
7741 Where do we find X Windows header files? ${x_includes:-$emacs_standard_dirs}
7742 Where do we find X Windows libraries? ${x_libraries:-$emacs_standard_dirs}"])
7744 #### Please respect alphabetical ordering when making additions.
7746 emacs_config_features=
7747 for opt in ACL BE_APP CAIRO DBUS FREETYPE GCONF GIF GLIB GMP GNUTLS GPM GSETTINGS \
7748 HARFBUZZ IMAGEMAGICK JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 \
7749 M17N_FLT MODULES NATIVE_COMP NOTIFY NS OLDXMENU PDUMPER PGTK PNG RSVG SECCOMP \
7750 SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER \
7751 UNEXEC WEBP X11 XAW3D XDBE XFT XIM XINPUT2 XPM XWIDGETS X_TOOLKIT \
7755 PDUMPER) val=${with_pdumper} ;;
7756 UNEXEC) val=${with_unexec} ;;
7757 GLIB) val=${emacs_cv_links_glib} ;;
7758 NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;;
7759 TOOLKIT_SCROLL_BARS|X_TOOLKIT) eval val=\${USE_$opt} ;;
7760 THREADS) val=${threads_enabled} ;;
7761 *) eval val=\${HAVE_$opt} ;;
7764 xno|xnone|x) continue ;;
7769 GTK*|LUCID|MOTIF) opt=$val ;;
7775 *lkqueue*) opt="$opt LIBKQUEUE" ;;
7776 *kqueue*) opt="$opt KQUEUE" ;;
7777 *inotify*) opt="$opt INOTIFY" ;;
7778 *gfile*) opt="$opt GFILENOTIFY" ;;
7779 *w32*) opt="$opt W32NOTIFY" ;;
7783 AS_VAR_APPEND([emacs_config_features], ["$optsep$opt"])
7786 AC_DEFINE_UNQUOTED([EMACS_CONFIG_FEATURES], ["${emacs_config_features}"],
7787 [Summary of some of the main features enabled by configure.])
7789 # This is just a printable representation of the shared user ID.
7790 android_shared_user=
7791 AS_IF([test -n "$with_shared_user_id"],[android_shared_user="($with_shared_user_id)"])
7793 AS_ECHO([" Does Emacs use -lXaw3d? ${HAVE_XAW3D}
7794 Is Emacs being built for Android? ${ANDROID} ${android_shared_user}
7795 Does Emacs use the X Double Buffer Extension? ${HAVE_XDBE}
7796 Does Emacs use -lXpm? ${HAVE_XPM}
7797 Does Emacs use -ljpeg? ${HAVE_JPEG}
7798 Does Emacs use -ltiff? ${HAVE_TIFF}
7799 Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF
7800 Does Emacs use a png library? ${HAVE_PNG} $LIBPNG
7801 Does Emacs use -lrsvg-2? ${HAVE_RSVG}
7802 Does Emacs use -lwebp? ${HAVE_WEBP}
7803 Does Emacs use -lsqlite3? ${HAVE_SQLITE3}
7804 Does Emacs use cairo? ${HAVE_CAIRO}
7805 Does Emacs use -llcms2? ${HAVE_LCMS2}
7806 Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}
7807 Does Emacs use native APIs for images? ${NATIVE_IMAGE_API}
7808 Does Emacs support sound? ${HAVE_SOUND}
7809 Does Emacs use -lgpm? ${HAVE_GPM}
7810 Does Emacs use -ldbus? ${HAVE_DBUS}
7811 Does Emacs use -lgconf? ${HAVE_GCONF}
7812 Does Emacs use GSettings? ${HAVE_GSETTINGS}
7813 Does Emacs use a file notification library? ${NOTIFY_SUMMARY}
7814 Does Emacs use access control lists? ${ACL_SUMMARY}
7815 Does Emacs use -lselinux? ${HAVE_LIBSELINUX}
7816 Does Emacs use -lgnutls? ${HAVE_GNUTLS}
7817 Does Emacs use -lxml2? ${HAVE_LIBXML2}
7818 Does Emacs use -lfreetype? ${HAVE_FREETYPE}
7819 Does Emacs use HarfBuzz? ${HAVE_HARFBUZZ}
7820 Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}
7821 Does Emacs use -lotf? ${HAVE_LIBOTF}
7822 Does Emacs use -lxft? ${HAVE_XFT}
7823 Does Emacs use -lsystemd? ${HAVE_LIBSYSTEMD}
7824 Does Emacs use -ltree-sitter? ${HAVE_TREE_SITTER}
7825 Does Emacs use the GMP library? ${HAVE_GMP}
7826 Does Emacs directly use zlib? ${HAVE_ZLIB}
7827 Does Emacs have dynamic modules support? ${HAVE_MODULES}
7828 Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}
7829 Does Emacs support Xwidgets? ${HAVE_XWIDGETS}
7830 Does Emacs have threading support in lisp? ${threads_enabled}
7831 Does Emacs support the portable dumper? ${with_pdumper}
7832 Does Emacs support legacy unexec dumping? ${with_unexec}
7833 Which dumping strategy does Emacs use? ${with_dumping}
7834 Does Emacs have native lisp compiler? ${HAVE_NATIVE_COMP}
7835 Does Emacs use version 2 of the X Input Extension? ${HAVE_XINPUT2}
7836 Does Emacs generate a smaller-size Japanese dictionary? ${with_small_ja_dic}
7839 if test -n "${EMACSDATA}"; then
7840 AS_ECHO([" Environment variable EMACSDATA set to: $EMACSDATA"])
7842 if test -n "${EMACSDOC}"; then
7843 AS_ECHO([" Environment variable EMACSDOC set to: $EMACSDOC"])
7848 if test "$HAVE_NS" = "yes"; then
7850 AS_ECHO(["Run '${MAKE-make}' to build Emacs, then run 'src/emacs' to test it.
7851 Run '${MAKE-make} install' in order to build an application bundle.
7852 The application will go to nextstep/Emacs.app and can be run or moved
7854 if test "$EN_NS_SELF_CONTAINED" = "yes"; then
7855 echo "The application will be fully self-contained."
7857 AS_ECHO(["The lisp resources for the application will be installed under ${prefix}.
7858 You may need to run \"${MAKE-make} install\" with sudo. The application will fail
7859 to run if these resources are not installed."])
7864 case $opsys,$emacs_uname_r in
7866 AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]])
7869 cygwin,3.0.[[0-7]]'('* | cygwin,3.1.[[0-2]]'('*)
7870 AC_DEFINE([HAVE_CYGWIN_O_PATH_BUG], [1],
7871 [Define to 1 if opening a FIFO, socket, or symlink with O_PATH is buggy.]);;
7874 # Remove any trailing slashes in these variables.
7876 */) prefix=`AS_DIRNAME(["$prefix."])`;;
7878 case $exec_prefix in
7879 */) exec_prefix=`AS_DIRNAME(["$exec_prefix."])`;;
7882 if test "$HAVE_NS" = "yes"; then
7883 if test "$NS_IMPL_GNUSTEP" = yes; then
7884 AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \
7885 nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in])
7886 ns_check_file=Resources/Info-gnustep.plist
7888 AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \
7889 nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in])
7890 ns_check_file=Contents/Info.plist
7892 AC_SUBST([ns_check_file])
7895 AC_CONFIG_FILES([Makefile lib/gnulib.mk])
7897 dnl config.status treats $srcdir specially, so I think this is ok...
7898 ARCH_INDEPENDENT_CONFIG_FILES([$srcdir/doc/man/emacs.1])
7900 AC_CONFIG_FILES([lib/Makefile lib-src/Makefile oldXMenu/Makefile src/Makefile
7901 lwlib/Makefile nextstep/Makefile nt/Makefile])
7902 ARCH_INDEPENDENT_CONFIG_FILES([doc/emacs/Makefile doc/misc/Makefile
7903 doc/lispintro/Makefile doc/lispref/Makefile
7904 lisp/Makefile leim/Makefile])
7906 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"
7908 dnl The test/ directory is missing if './make-dist --no-tests' was used.
7909 opt_makefile=test/Makefile
7910 if test -f "$srcdir/$opt_makefile.in"; then
7911 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
7912 dnl Again, it's best not to use a variable. Though you can add
7913 dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
7914 ARCH_INDEPENDENT_CONFIG_FILES([test/Makefile])
7915 ARCH_INDEPENDENT_CONFIG_FILES([test/manual/noverlay/Makefile])
7917 opt_makefile=test/infra/Makefile
7918 if test -f "$srcdir/$opt_makefile.in"; then
7919 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
7920 dnl Again, it's best not to use a variable. Though you can add
7921 dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
7922 ARCH_INDEPENDENT_CONFIG_FILES([test/infra/Makefile])
7925 if test "$ANDROID" = "yes"; then
7926 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES java/Makefile cross/Makefile"
7929 dnl The admin/ directory used to be excluded from tarfiles.
7930 if test -d $srcdir/admin; then
7931 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES admin/charsets/Makefile admin/unidata/Makefile admin/grammars/Makefile"
7932 ARCH_INDEPENDENT_CONFIG_FILES([admin/charsets/Makefile])
7933 ARCH_INDEPENDENT_CONFIG_FILES([admin/unidata/Makefile])
7934 ARCH_INDEPENDENT_CONFIG_FILES([admin/grammars/Makefile])
7938 SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
7940 AC_SUBST([SUBDIR_MAKEFILES_IN])
7942 SMALL_JA_DIC=$with_small_ja_dic
7943 AC_SUBST([SMALL_JA_DIC])
7945 dnl The following commands are run on the build system when building
7948 if test "$XCONFIGURE" != "android"; then
7949 dnl You might wonder (I did) why epaths.h is generated by running
7950 dnl make, rather than just letting configure generate it from
7951 dnl epaths.in. One reason is that the various paths are not fully
7952 dnl expanded (see above); e.g.,
7953 dnl gamedir='${localstatedir}/games/emacs'. Secondly, the GNU
7954 dnl Coding standards require that one should be able to run 'make
7955 dnl prefix=/some/where/else' and override the values set by
7956 dnl configure. This also explains the 'move-if-change' test and the
7957 dnl use of force in the 'epaths-force' rule in Makefile.in.
7958 AC_CONFIG_COMMANDS([src/epaths.h], [
7959 if test "${opsys}" = "mingw32"; then
7960 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force-w32
7961 elif test "$HAVE_NS" = "yes" && test "$EN_NS_SELF_CONTAINED" = "yes"; then
7962 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force-ns-self-contained
7964 ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
7965 fi || AC_MSG_ERROR(['src/epaths.h' could not be made.])
7966 ], [GCC="$GCC" CPPFLAGS="$CPPFLAGS" opsys="$opsys" HAVE_NS="$HAVE_NS"
7967 EN_NS_SELF_CONTAINED="$EN_NS_SELF_CONTAINED"])
7969 dnl NB we have to cheat and use the ac_... version because abs_top_srcdir
7970 dnl is not yet set, sigh. Or we could use ../$srcdir/src/.gdbinit,
7972 AC_CONFIG_COMMANDS([src/.gdbinit], [
7973 if test ! -f src/.gdbinit && test -f "$srcdir/src/.gdbinit"; then
7974 AS_ECHO(["source $ac_abs_top_srcdir/src/.gdbinit"]) > src/.gdbinit
7978 dnl Perhaps this would be better named doc-emacs-emacsver.texi?
7979 dnl See comments for etc-refcards-emacsver.tex.
7980 dnl Since we get a doc/emacs directory generated anyway, for the Makefile,
7981 dnl it is not quite the same. But we are generating in $srcdir.
7982 AC_CONFIG_COMMANDS([doc/emacs/emacsver.texi], [
7983 ${MAKE-make} -s --no-print-directory -C doc/emacs doc-emacsver || \
7984 AC_MSG_ERROR(['doc/emacs/emacsver.texi' could not be made.])
7987 dnl If we give this the more natural name, etc/refcards/emacsver.texi,
7988 dnl then a directory etc/refcards is created in the build directory,
7989 dnl which is probably harmless, but confusing (in out-of-tree builds).
7990 dnl (If we were to generate etc/refcards/Makefile, this might change.)
7991 dnl It is really $srcdir/etc/refcards/emacsver.tex that we generate.
7992 AC_CONFIG_COMMANDS([etc-refcards-emacsver.tex], [
7993 ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \
7994 AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.])
7997 if test $AUTO_DEPEND = yes; then
7998 for dir in $AUTODEPEND_PARENTS; do
7999 AS_MKDIR_P([$dir/deps])
8000 AS_MKDIR_P([cross/$dir/deps])
8003 if $gl_gnulib_enabled_dynarray || $gl_gnulib_enabled_scratch_buffer; then
8004 AS_MKDIR_P([lib/malloc])
8005 AS_MKDIR_P([cross/lib/malloc])
8006 if test $AUTO_DEPEND = yes; then
8007 AS_MKDIR_P([lib/deps/malloc])
8008 AS_MKDIR_P([cross/lib/deps/malloc])
8012 dnl Make cross/lib, which various Makefiles in cross expect to
8014 AS_MKDIR_P([cross/lib])
8015 AS_MKDIR_P([cross/lib/malloc])
8016 AS_MKDIR_P([cross/lib/sys])
8017 AS_MKDIR_P([cross/lib-src])
8019 dnl Make cross/etc; this directory will hold the documentation file
8020 dnl holding doc strings for Android specific C files that aren't
8021 dnl built during the initial compilation of Emacs for the build
8023 AS_MKDIR_P([cross/etc])
8025 AS_IF([test "x$with_android" != "xno"], [
8026 dnl Link gnulib files to cross/lib as well. af_alg.h and
8027 dnl lib/save-cwd.h are copied manually from gnulib, and as such
8028 dnl aren't specified in gl_FILE_LIST.
8029 emacs_files='gl_FILE_LIST lib/af_alg.h lib/save-cwd.h'
8030 dnl These files are specific to Emacs.
8031 emacs_files="$emacs_files lib/fingerprint.c lib/fingerprint.h \
8032 lib/save-cwd.c lib/openat-die.c lib/save-cwd.c \
8034 for file in $emacs_files; do
8035 AS_IF([expr "X${file}J" : "Xlib/.*[[ch]]J" >/dev/null],
8036 [AS_IF([test -f "$srcdir/$file"],
8037 [AC_CONFIG_LINKS([cross/$file:$file])])])
8041 # Make java/Makefile
8042 ARCH_INDEPENDENT_CONFIG_FILES([java/Makefile])
8043 ARCH_INDEPENDENT_CONFIG_FILES([cross/Makefile])
8045 # Make java/AndroidManifest.xml
8046 ARCH_INDEPENDENT_CONFIG_FILES([java/AndroidManifest.xml])
8048 # Make ndk-build Makefiles. This is only done inside the recursive
8054 if test ! "$with_mailutils"; then
8055 if test "$with_pop" = yes; then
8056 AC_MSG_WARN([This configuration installs a 'movemail' program
8057 that retrieves POP3 email via only insecure channels.
8058 To omit insecure POP3, you can use '$0 --without-pop'.])
8059 elif test "$with_pop" = no-by-default; then
8060 AC_MSG_WARN([This configuration installs a 'movemail' program
8061 that does not retrieve POP3 email. By default, Emacs 25 and earlier
8062 installed a 'movemail' program that retrieved POP3 email via only
8063 insecure channels, a practice that is no longer recommended but that
8064 you can continue to support by using '$0 --with-pop'.])
8069 # Don't suggest GNU Mailutils, as it hasn't been ported.
8072 emacs_fix_movemail="use '$0 --with-mailutils'"
8073 case `(movemail --version) 2>/dev/null` in
8075 *) emacs_fix_movemail="install GNU Mailutils
8076 <https://mailutils.org> and $emacs_fix_movemail";;
8078 AC_MSG_NOTICE([You might want to $emacs_fix_movemail.]);;
8082 if test "${HAVE_XFT}" = yes; then
8083 AC_MSG_WARN([This configuration uses libXft, which has a number of
8084 font rendering issues, and is being considered for removal in the
8085 next release of Emacs. Please consider using Cairo graphics +
8086 HarfBuzz text shaping instead (they are auto-detected if the
8087 relevant development headers are installed).])
8090 if test "${HAVE_CAIRO}" = "yes" && test "${HAVE_HARFBUZZ}" = no; then
8091 AC_MSG_WARN([This configuration uses the Cairo graphics library,
8092 but not the HarfBuzz font shaping library (minimum version $harfbuzz_required_ver).
8093 We recommend the use of HarfBuzz when using Cairo, please install
8094 appropriate HarfBuzz development packages.])
8097 # Let plain 'make' work.
8098 test "$MAKE" = make || test -f makefile || cat >makefile <<EOF
8102 \$(MAKE) -f Makefile \$?
8104 \$(MAKE) -f Makefile \$<