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