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