Tune by using memchr and memrchr.
[bpt/emacs.git] / configure.ac
CommitLineData
067d23c9
KY
1dnl Autoconf script for GNU Emacs
2dnl To rebuild the `configure' script from this, execute the command
3dnl autoconf
4dnl in the directory containing this script.
5dnl If you changed any AC_DEFINES, also run autoheader.
6dnl
ab422c4d 7dnl Copyright (C) 1994-1996, 1999-2013 Free Software Foundation, Inc.
067d23c9
KY
8dnl
9dnl This file is part of GNU Emacs.
10dnl
11dnl GNU Emacs is free software: you can redistribute it and/or modify
12dnl it under the terms of the GNU General Public License as published by
13dnl the Free Software Foundation, either version 3 of the License, or
14dnl (at your option) any later version.
15dnl
16dnl GNU Emacs is distributed in the hope that it will be useful,
17dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
18dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19dnl GNU General Public License for more details.
20dnl
21dnl You should have received a copy of the GNU General Public License
22dnl along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24AC_PREREQ(2.65)
052f924a 25AC_INIT(emacs, 24.3.50)
1e8725cf 26
60f5e585
GM
27dnl This is the documented way to record the args passed to configure,
28dnl rather than $ac_configure_args.
29emacs_config_options="$@"
1e8725cf
GM
30## Add some environment variables, if they were passed via the environment
31## rather than on the command-line.
32for 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"
39done
40
067d23c9
KY
41AC_CONFIG_HEADER(src/config.h:src/config.in)
42AC_CONFIG_SRCDIR(src/lisp.h)
24e0f6b1 43AC_CONFIG_AUX_DIR(build-aux)
7d732d1a
GM
44dnl Fairly arbitrary, older versions might work too.
45AM_INIT_AUTOMAKE(1.11)
067d23c9
KY
46
47dnl Support for --program-prefix, --program-suffix and
48dnl --program-transform-name options
49AC_ARG_PROGRAM
50
51dnl It is important that variables on the RHS not be expanded here,
52dnl hence the single quotes. This is per the GNU coding standards, see
53dnl (autoconf) Installation Directory Variables
54dnl See also epaths.h below.
55lispdir='${datadir}/emacs/${version}/lisp'
d71dfe75 56leimdir='${datadir}/emacs/${version}/leim'
ca26824c 57standardlisppath='${lispdir}:${leimdir}'
067d23c9
KY
58locallisppath='${datadir}/emacs/${version}/site-lisp:'\
59'${datadir}/emacs/site-lisp'
ca26824c 60lisppath='${locallisppath}:${standardlisppath}'
067d23c9
KY
61etcdir='${datadir}/emacs/${version}/etc'
62archlibdir='${libexecdir}/emacs/${version}/${configuration}'
63docdir='${datadir}/emacs/${version}/etc'
64gamedir='${localstatedir}/games/emacs'
65
da3d2105
DA
66dnl Special option to disable the most of other options.
67AC_ARG_WITH(all,
68[AS_HELP_STRING([--without-all],
c30d4aef
DA
69 [omit almost all features and build
70 small executable with minimal dependencies])],
da3d2105
DA
71 with_features=$withval,
72 with_features=yes)
c30d4aef 73
067d23c9
KY
74dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
75dnl Create a new --with option that defaults to being disabled.
76dnl NAME is the base name of the option. The shell variable with_NAME
77dnl will be set to either the user's value (if the option is
78dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
79dnl option is not specified). Note that the shell variable name is
80dnl constructed as autoconf does, by replacing non-alphanumeric
81dnl characters with "_".
82dnl HELP-STRING is the help text for the option.
83AC_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
88dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
c30d4aef
DA
89dnl Create a new --with option that defaults to $enable_features.
90dnl NAME is the base name of the option. The shell variable with_NAME
067d23c9
KY
91dnl will be set either to 'no' (for a plain --without-NAME) or to
92dnl 'yes' (if the option is not specified). Note that the shell
93dnl variable name is constructed as autoconf does, by replacing
94dnl non-alphanumeric characters with "_".
95dnl HELP-STRING is the help text for the option.
96AC_DEFUN([OPTION_DEFAULT_ON], [dnl
97 AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
da3d2105 98 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=$with_features])dnl
067d23c9
KY
99])dnl
100
101OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
102if test "$with_pop" = yes; then
103 AC_DEFINE(MAIL_USE_POP)
104fi
105AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
106
107OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
108if test "$with_kerberos" != no; then
109 AC_DEFINE(KERBEROS)
110fi
111AH_TEMPLATE(KERBEROS,
112 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
113
114OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
115if 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.])
121fi
122
123OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
124dnl FIXME hesiod support may not be present, so it seems like an error
125dnl to define, or at least use, this unconditionally.
126if test "$with_hesiod" != no; then
127 AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
128fi
129
130OPTION_DEFAULT_OFF([mmdf],[support MMDF mailboxes])
131if test "$with_mmdf" != no; then
132 AC_DEFINE(MAIL_USE_MMDF, 1, [Define to support MMDF mailboxes in movemail.])
133fi
134
135OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
136if test "$with_mail_unlink" != no; then
137 AC_DEFINE(MAIL_UNLINK_SPOOL, 1, [Define to unlink, rather than empty, mail spool after reading.])
138fi
139
140AC_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
144OPTION_DEFAULT_ON([sound],[don't compile with sound support])
145
067d23c9
KY
146dnl FIXME currently it is not the last.
147dnl This should be the last --with option, because --with-x is
3cc53d60 148dnl added later on when we find the file name of X, and it's best to
067d23c9
KY
149dnl keep them together visually.
150AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
d673aedc 151 [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, motif, no)])],
067d23c9
KY
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 ;;
d673aedc 159 gtk2 ) val=gtk2 ;;
067d23c9
KY
160 gtk3 ) val=gtk3 ;;
161 * )
162AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
d673aedc
JD
163this 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.])
067d23c9
KY
166 ;;
167 esac
168 with_x_toolkit=$val
169])
170
81eafe29
PE
171OPTION_DEFAULT_OFF([wide-int], [prefer wide Emacs integers (typically 62-bit)])
172if test "$with_wide_int" = yes; then
173 AC_DEFINE([WIDE_EMACS_INT], 1, [Use long long for EMACS_INT if available.])
174fi
175
067d23c9
KY
176dnl _ON results in a '--without' option in the --help output, so
177dnl the help text should refer to "don't compile", etc.
178OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
179OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
180OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
181OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
182OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
183OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
184OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
185OPTION_DEFAULT_ON([imagemagick],[don't compile with ImageMagick image support])
186
187OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
188OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
189OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
190
191OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
192OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
193OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
b612ffc9 194OPTION_DEFAULT_OFF([ns],[use NeXTstep (Cocoa or GNUstep) windowing system])
dc098568 195OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI])
067d23c9
KY
196
197OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
198OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
199OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
9851bfc5 200OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
067d23c9 201OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
7c3d167f 202OPTION_DEFAULT_ON([acl],[don't compile with ACL support])
067d23c9 203OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
81606b10 204OPTION_DEFAULT_ON([inotify],[don't compile with inotify (file-watch) support])
067d23c9
KY
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.
208dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
209OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
210
6c269a38
PE
211## Makefile.in needs the cache file name.
212AC_SUBST(cache_file)
213
067d23c9
KY
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.
216OPTION_DEFAULT_ON([compress-info],[don't compress the installed Info pages])
217if test $with_compress_info = yes; then
218 GZIP_INFO=yes
219else
220 GZIP_INFO=
221fi
222AC_SUBST(GZIP_INFO)
223
224AC_ARG_WITH([pkg-config-prog],dnl
3cc53d60
PE
225[AS_HELP_STRING([--with-pkg-config-prog=FILENAME],
226 [file name of pkg-config for finding GTK and librsvg])])
067d23c9
KY
227if 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
231fi
232
233CRT_DIR=
234AC_ARG_WITH([crt-dir],dnl
235[AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc.
236The default is /usr/lib, or /usr/lib64 on some platforms.])])
237CRT_DIR="${with_crt_dir}"
238
4fc5868a
UM
239AC_ARG_WITH(gameuser,dnl
240[AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])])
241test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \
242 && gameuser="${with_gameuser}"
243test "X$gameuser" = X && gameuser=games
244
067d23c9 245AC_ARG_WITH([gnustep-conf],dnl
3cc53d60
PE
246[AS_HELP_STRING([--with-gnustep-conf=FILENAME],
247 [name of GNUstep.conf; default $GNUSTEP_CONFIG_FILE, or /etc/GNUstep/GNUstep.conf])])
067d23c9
KY
248test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
249 GNUSTEP_CONFIG_FILE="${with_gnustep_conf}"
250test "X$GNUSTEP_CONFIG_FILE" = "X" && \
251 GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
252
253AC_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
067d23c9
KY
259AC_ARG_ENABLE(locallisppath,
260[AS_HELP_STRING([--enable-locallisppath=PATH],
261 [directories Emacs should search for lisp files specific
262 to this site])],
263if test "${enableval}" = "no"; then
264 locallisppath=
265elif test "${enableval}" != "yes"; then
266 locallisppath=${enableval}
267fi)
268
269AC_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,
e509cfa6 275 xmallocoverrun, conslist, glyphs])],
067d23c9
KY
276[ac_checking_flags="${enableval}"],[])
277IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
278for check in $ac_checking_flags
279do
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= ;
e509cfa6 288 ac_gc_check_cons_list= ;
94eb8e0a 289 ac_glyphs_debug= ;;
067d23c9
KY
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 ;
e509cfa6 295 ac_gc_check_cons_list=1 ;
94eb8e0a 296 ac_glyphs_debug=1 ;;
067d23c9
KY
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 ;;
94eb8e0a 303 glyphs) ac_glyphs_debug=1 ;;
067d23c9
KY
304 *) AC_MSG_ERROR(unknown check category $check) ;;
305 esac
306done
307IFS="$ac_save_IFS"
308
309if test x$ac_enable_checking != x ; then
310 AC_DEFINE(ENABLE_CHECKING, 1,
a54e2c05 311[Define to 1 if expensive run-time data type and consistency checks are enabled.])
067d23c9
KY
312fi
313if 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.])
318fi
40697cd9 319if test x$ac_gc_check_string_overrun != x ; then
067d23c9
KY
320 AC_DEFINE(GC_CHECK_STRING_OVERRUN, 1,
321[Define this to check for short string overrun.])
322fi
323if 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.])
326fi
327if test x$ac_xmalloc_overrun != x ; then
328 AC_DEFINE(XMALLOC_OVERRUN_CHECK, 1,
329[Define this to check for malloc buffer overrun.])
330fi
331if 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.])
334fi
94eb8e0a 335if test x$ac_glyphs_debug != x ; then
e509cfa6
DA
336 AC_DEFINE(GLYPH_DEBUG, 1,
337[Define this to enable glyphs debugging code.])
338fi
067d23c9 339
646b5f55
AS
340AC_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.])],
067d23c9 344if test "${enableval}" != "no"; then
646b5f55
AS
345 AC_DEFINE(CHECK_LISP_OBJECT_TYPE, 1,
346 [Define this to enable compile time checks for the Lisp_Object data type.])
067d23c9
KY
347fi)
348
349
1b3b7caa
GM
350dnl The name of this option is unfortunate. It predates, and has no
351dnl relation to, the "sampling-based elisp profiler" added in 24.3.
352dnl Actually, it stops it working.
353dnl http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00393.html
067d23c9
KY
354AC_ARG_ENABLE(profiling,
355[AS_HELP_STRING([--enable-profiling],
1b3b7caa
GM
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.])],
067d23c9
KY
359[ac_enable_profiling="${enableval}"],[])
360if test x$ac_enable_profiling != x ; then
361 PROFILING_CFLAGS="-DPROFILING=1 -pg"
362else
363 PROFILING_CFLAGS=
364fi
365AC_SUBST(PROFILING_CFLAGS)
366
367AC_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
7ec363cf
JD
374AC_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
067d23c9 379#### Make srcdir absolute, if it isn't already. It's important to
3cc53d60 380#### avoid running the file name through pwd unnecessarily, since pwd can
067d23c9
KY
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).
384unset CDPATH
385case "${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.
3cc53d60 390 ## Note: we used to use $PWD at the end instead of `pwd`,
067d23c9
KY
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.
3cc53d60 393 if test ".$PWD" != "." && test ".`(cd "$PWD" ; sh -c pwd)`" = ".`pwd`" ;
067d23c9
KY
394 then
395 srcdir="$PWD"
396 else
3cc53d60 397 srcdir=`(cd "$srcdir"; pwd)`
067d23c9
KY
398 fi
399 ;;
3cc53d60 400 * ) srcdir=`(cd "$srcdir"; pwd)` ;;
067d23c9
KY
401esac
402
067d23c9
KY
403### Canonicalize the configuration name.
404
405AC_CANONICAL_HOST
406canonical=$host
407configuration=${host_alias-${build_alias-$host}}
408
409dnl This used to use changequote, but, apart from `changequote is evil'
410dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
411dnl the great gob of text. Thus it's not processed for possible expansion.
412dnl Just make sure the brackets remain balanced.
413dnl
414dnl Since Emacs can't find matching pairs of quotes, boundaries are
415dnl indicated by comments.
416dnl 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
34374650 421### the appropriate operating system file.
067d23c9 422
34374650 423### You would hope that you could choose an s/*.h
067d23c9 424### file based on the operating system portion. However, it turns out
34374650 425### that each s/*.h file is pretty manufacturer-specific.
067d23c9
KY
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
34374650 435opsys='' unported=no
067d23c9
KY
436case "${canonical}" in
437
695a3dc5
PE
438 ## GNU/Linux and similar ports
439 *-*-linux* )
d6a003a8 440 opsys=gnu-linux
d6a003a8
AS
441 ;;
442
067d23c9
KY
443 ## FreeBSD ports
444 *-*-freebsd* )
445 opsys=freebsd
067d23c9
KY
446 ;;
447
448 ## FreeBSD kernel + glibc based userland
449 *-*-kfreebsd*gnu* )
450 opsys=gnu-kfreebsd
067d23c9
KY
451 ;;
452
453 ## NetBSD ports
454 *-*-netbsd* )
455 opsys=netbsd
067d23c9
KY
456 ;;
457
458 ## OpenBSD ports
459 *-*-openbsd* )
460 opsys=openbsd
067d23c9
KY
461 ;;
462
067d23c9
KY
463 ## Apple Darwin / Mac OS X
464 *-apple-darwin* )
465 case "${canonical}" in
34374650
PE
466 i[3456]86-* ) ;;
467 powerpc-* ) ;;
468 x86_64-* ) ;;
067d23c9
KY
469 * ) unported=yes ;;
470 esac
471 opsys=darwin
136c45ee
GM
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
067d23c9
KY
478 ;;
479
480 ## HP 9000 series 700 and 800, running HP/UX
481 hppa*-hp-hpux10.2* )
d6a003a8 482 opsys=hpux10-20
067d23c9
KY
483 ;;
484 hppa*-hp-hpux1[1-9]* )
d6a003a8 485 opsys=hpux11
067d23c9
KY
486 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
487 ;;
488
067d23c9 489 ## IBM machines
067d23c9 490 rs6000-ibm-aix4.[23]* )
34374650 491 opsys=aix4-2
067d23c9
KY
492 ;;
493 powerpc-ibm-aix4.[23]* )
34374650 494 opsys=aix4-2
067d23c9
KY
495 ;;
496 rs6000-ibm-aix[56]* )
34374650 497 opsys=aix4-2
067d23c9
KY
498 ;;
499 powerpc-ibm-aix[56]* )
34374650 500 opsys=aix4-2
067d23c9
KY
501 ;;
502
067d23c9
KY
503 ## Silicon Graphics machines
504 ## Iris 4D
505 mips-sgi-irix6.5 )
76b397fb 506 opsys=irix6-5
067d23c9
KY
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).
067d23c9
KY
510 NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
511 ;;
512
513 ## Suns
067d23c9
KY
514 *-sun-solaris* \
515 | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
516 | x86_64-*-solaris2* | x86_64-*-sunos5*)
517 case "${canonical}" in
34374650
PE
518 i[3456]86-*-* ) ;;
519 amd64-*-*|x86_64-*-*) ;;
520 sparc* ) ;;
067d23c9
KY
521 * ) unported=yes ;;
522 esac
523 case "${canonical}" in
524 *-sunos5.6* | *-solaris2.6* )
525 opsys=sol2-6
067d23c9
KY
526 RANLIB="ar -ts"
527 ;;
528 *-sunos5.[7-9]* | *-solaris2.[7-9]* )
529 opsys=sol2-6
530 emacs_check_sunpro_c=yes
067d23c9
KY
531 ;;
532 *-sunos5* | *-solaris* )
533 opsys=sol2-10
534 emacs_check_sunpro_c=yes
067d23c9
KY
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
067d23c9
KY
550 ## Intel 386 machines where we don't care about the manufacturer.
551 i[3456]86-*-* )
067d23c9
KY
552 case "${canonical}" in
553 *-cygwin ) opsys=cygwin ;;
27cb7be2 554 *-darwin* ) opsys=darwin ;;
f04940ae
PE
555 *-sysv4.2uw* ) opsys=unixware ;;
556 *-sysv5uw* ) opsys=unixware ;;
557 *-sysv5OpenUNIX* ) opsys=unixware ;;
067d23c9
KY
558 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
559 esac
560 ;;
561
067d23c9
KY
562 * )
563 unported=yes
564 ;;
565esac
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.
573if test x"${opsys}" = x; then
574 case "${canonical}" in
575 *-gnu* ) opsys=gnu ;;
576 * )
577 unported=yes
578 ;;
579 esac
580fi
581
582]
583dnl quotation ends
584
585if test $unported = yes; then
586 AC_MSG_ERROR([Emacs hasn't been ported to `${canonical}' systems.
587Check `etc/MACHINES' for recognized configuration names.])
588fi
589
067d23c9
KY
590
591#### Choose a compiler.
27cb7be2 592
067d23c9
KY
593dnl Sets GCC=yes if using gcc.
594AC_PROG_CC
9a514d4a
PE
595AM_PROG_CC_C_O
596
067d23c9
KY
597if test x$GCC = xyes; then
598 test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
599else
600 test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
601fi
602
73dcdb9f
PE
603# Avoid gnulib's tests for O_NOATIME and O_NOFOLLOW, as we don't use them.
604AC_DEFUN([gl_FCNTL_O_FLAGS])
a615a3ae
PE
605# Avoid gnulib's threadlib module, as we do threads our own way.
606AC_DEFUN([gl_THREADLIB])
607
f04940ae 608# Initialize gnulib right after choosing the compiler.
58eaa9ec 609dnl Amongst other things, this sets AR and ARFLAGS.
f04940ae
PE
610gl_EARLY
611
6e8aca60
PE
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.
615if 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
638fi
639
b8df54ff
PE
640AC_ARG_ENABLE([gcc-warnings],
641 [AS_HELP_STRING([--enable-gcc-warnings],
c4e2ba0a 642 [turn on lots of GCC warnings/errors. This is intended for
f5c08e17
PE
643 developers, and may generate false alarms when used
644 with older or non-GNU development tools.])],
b8df54ff
PE
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
94eb8e0a
DA
653AC_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.])],
657if 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"
f5c08e17 666 fi
94eb8e0a
DA
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
677fi)
678
b8df54ff
PE
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.
683AC_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.
699if test "$gl_gcc_warnings" != yes; then
700 isystem='-I'
701else
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
a74e8e38 719 nw="$nw -Wlong-long" # C90 is anachronistic
b8df54ff
PE
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
6045c4fd 729 nw="$nw -Wunreachable-code" # so buggy that it's now silently ignored
b8df54ff 730 nw="$nw -Wpadded" # Our structs are not padded
6045c4fd 731 nw="$nw -Wredundant-decls" # we regularly (re)declare functions
b8df54ff 732 nw="$nw -Wlogical-op" # any use of fwrite provokes this
6045c4fd 733 nw="$nw -Wformat-nonliteral" # we do this a lot
b8df54ff
PE
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
6045c4fd
PE
738 nw="$nw -Wfloat-equal" # warns about high-quality code
739 nw="$nw -Winline" # OK to ignore 'inline'
79a7bafe 740 nw="$nw -Wjump-misses-init" # We sometimes safely jump over init.
d7fcbbfe
PE
741 nw="$nw -Wstrict-overflow" # OK to optimize assuming that
742 # signed overflow has undefined behavior
6045c4fd
PE
743 nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
744 nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
b8df54ff
PE
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
a8e1690b
PE
750 # Emacs's use of alloca inhibits protecting the stack.
751 nw="$nw -Wstack-protector"
752
8ea5c4de 753 # The following line should be removable at some point.
b8df54ff
PE
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
b8df54ff 775 AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
2d3800d2
PE
776 AH_VERBATIM([FORTIFY_SOURCE],
777 [/* Enable compile-time and run-time bounds-checking, and some warnings,
778 without upsetting glibc 2.15+. */
7f8de58c 779 #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
2d3800d2
PE
780 # define _FORTIFY_SOURCE 2
781 #endif
782 ])
b8df54ff
PE
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])
067d23c9 792fi
067d23c9 793
067d23c9
KY
794
795
f04940ae
PE
796dnl Some other nice autoconf tests.
797dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
798dnl AC_PROG_INSTALL
799dnl AC_PROG_MKDIR_P
800dnl if test "x$RANLIB" = x; then
801dnl AC_PROG_RANLIB
802dnl fi
9aa0092c 803AC_PROG_LN_S
067d23c9 804
0e7a053e
PE
805AC_PATH_PROG(INSTALL_INFO, install-info, :,
806 $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
067d23c9
KY
807dnl Don't use GZIP, which is used by gzip for additional parameters.
808AC_PATH_PROG(GZIP_PROG, gzip)
809
0b6b25d5
GM
810if test $opsys = gnu-linux; then
811 AC_PATH_PROG(PAXCTL, paxctl,,
812 [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
32d9ba9a
UM
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
0b6b25d5 819fi
067d23c9 820
23df914b 821## Need makeinfo >= 4.7 (?) to build the manuals.
067d23c9
KY
822AC_PATH_PROG(MAKEINFO, makeinfo, no)
823dnl By this stage, configure has already checked for egrep and set EGREP,
824dnl or exited with an error if no egrep was found.
3cc53d60
PE
825if test "$MAKEINFO" != "no"; then
826 case `
75d7aa24 827 $MAKEINFO --version 2> /dev/null |
3cc53d60
PE
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
067d23c9
KY
832fi
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.
e5365138
GM
843HAVE_MAKEINFO=yes
844
067d23c9 845if test "$MAKEINFO" = "no"; then
e5365138 846 MAKEINFO=makeinfo
067d23c9 847 if test "x${with_makeinfo}" = "xno"; then
e5365138 848 HAVE_MAKEINFO=no
3cc53d60 849 elif test ! -e "$srcdir/info/emacs" && test ! -e "$srcdir/info/emacs.info"; then
23df914b 850 AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.7, and your
067d23c9
KY
851source tree does not seem to have pre-built manuals in the `info' directory.
852Either install a suitable version of makeinfo, or re-run configure
853with the `--without-makeinfo' option to build without the manuals.] )
854 fi
855fi
e5365138 856AC_SUBST(HAVE_MAKEINFO)
067d23c9 857
8045b906
GM
858dnl Just so that there is only a single place we need to edit.
859INFO_EXT=.info
860INFO_OPTS=--no-split
861AC_SUBST(INFO_EXT)
862AC_SUBST(INFO_OPTS)
863
067d23c9
KY
864dnl Add our options to ac_link now, after it is set up.
865
866if test x$GCC = xyes; then
867 test "x$GCC_LINK_TEST_OPTIONS" != x && \
868 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
869else
870 test "x$NON_GCC_LINK_TEST_OPTIONS" != x && \
871 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
872fi
873
874dnl We need -znocombreloc if we're using a relatively recent GNU ld.
875dnl If we can link with the flag, it shouldn't do any harm anyhow.
876dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
877dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
878dnl if not built to support GNU ld.
879
880late_LDFLAGS=$LDFLAGS
881if test x$GCC = xyes; then
882 LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
883else
884 LDFLAGS="$LDFLAGS -znocombreloc"
885fi
886
887AC_MSG_CHECKING([for -znocombreloc])
888AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
889 [AC_MSG_RESULT(yes)],
890 LDFLAGS=$late_LDFLAGS
891 [AC_MSG_RESULT(no)])
892
893
067d23c9
KY
894dnl The function dump-emacs will not be defined and temacs will do
895dnl (load "loadup") automatically unless told otherwise.
4004ef46 896test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no
067d23c9 897case "$opsys" in
4004ef46 898 your-opsys-here) CANNOT_DUMP=yes ;;
067d23c9 899esac
4004ef46
GM
900
901test "$CANNOT_DUMP" = "yes" && \
902 AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs cannot be dumped on your system.])
903
067d23c9
KY
904AC_SUBST(CANNOT_DUMP)
905
906
907UNEXEC_OBJ=unexelf.o
908case "$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).
b06b1098 928 #
067d23c9
KY
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
b06b1098 932 #
067d23c9
KY
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 ;;
937esac
938
939LD_SWITCH_SYSTEM=
940case "$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.
3c30e766
GM
945### It's not our place to do this. See bug#10313#17.
946### LD_SWITCH_SYSTEM=-L/usr/local/lib
947 :
067d23c9
KY
948 ;;
949
950 gnu-linux)
951 ## cpp test was "ifdef __mips__", but presumably this is equivalent...
d6a003a8 952 case $host_cpu in mips*) LD_SWITCH_SYSTEM="-G 0";; esac
067d23c9
KY
953 ;;
954
955 netbsd)
3c30e766
GM
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 :
067d23c9
KY
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 ;;
966esac
967AC_SUBST(LD_SWITCH_SYSTEM)
968
969ac_link="$ac_link $LD_SWITCH_SYSTEM"
970
4d5c6349 971## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
067d23c9
KY
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.
981case "$opsys" in
982 netbsd|openbsd)
4d5c6349 983 LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
067d23c9
KY
984esac
985
986
987C_SWITCH_MACHINE=
34374650
PE
988case $canonical in
989 alpha*)
067d23c9
KY
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
b06b1098 1003 UNEXEC_OBJ=unexalpha.o
067d23c9 1004 fi
34374650
PE
1005 ;;
1006esac
067d23c9
KY
1007AC_SUBST(C_SWITCH_MACHINE)
1008
1009AC_SUBST(UNEXEC_OBJ)
1010
1011C_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
1015test "$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.
1019AC_SUBST(C_SWITCH_SYSTEM)
1020
1021
1022LIBS_SYSTEM=
1023case "$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
1f5d53eb 1031 sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
067d23c9
KY
1032
1033 ## Motif needs -lgen.
1034 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
1035esac
1036AC_SUBST(LIBS_SYSTEM)
1037
1038
1039### Make sure subsequent tests use flags consistent with the build flags.
1040
1041if test x"${OVERRIDE_CPPFLAGS}" != x; then
1042 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
1043else
1044 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
1045fi
1046
c1e127f9
PE
1047# Suppress obsolescent Autoconf test for size_t; Emacs assumes C89 or better.
1048AC_DEFUN([AC_TYPE_SIZE_T])
2a84b02d
PE
1049# Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
1050AC_DEFUN([AC_TYPE_UID_T])
c1e127f9 1051
067d23c9 1052
067d23c9
KY
1053LIB_MATH=-lm
1054LIB_STANDARD=
1055START_FILES=
a9be7d2b
GM
1056dnl Current possibilities handled by sed (aix4-2 -> aix,
1057dnl gnu-linux -> gnu/linux, etc.):
1058dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix.
1059dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
98d8c1f9 1060SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
067d23c9 1061
0538fab0 1062dnl NB do not use CRT_DIR unquoted here, since it might not be set yet.
067d23c9
KY
1063case $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 )
fca64dbd
UM
1074 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
1075 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
a9be7d2b 1076 SYSTEM_TYPE=berkeley-unix
067d23c9
KY
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 ;;
0538fab0 1086 dnl NB this may be adjusted below.
067d23c9 1087 netbsd | openbsd )
0538fab0
GM
1088 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
1089 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
a9be7d2b 1090 SYSTEM_TYPE=berkeley-unix
067d23c9 1091 ;;
a9be7d2b
GM
1092
1093 sol2* | unixware )
1094 SYSTEM_TYPE=usg-unix-v
1095 ;;
1096
067d23c9
KY
1097esac
1098
1099AC_SUBST(LIB_MATH)
1100AC_SUBST(START_FILES)
a9be7d2b
GM
1101AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
1102 [The type of system you are compiling for; sets `system-type'.])
067d23c9 1103
adbc4ef4
GM
1104dnl Not all platforms use crtn.o files. Check if the current one does.
1105crt_files=
1106
1107for 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
1111done
1112
1113if test "x$crt_files" != x; then
1114
1115 ## If user specified a crt-dir, use that unconditionally.
e9dfbb4a
GM
1116 crt_gcc=no
1117
adbc4ef4
GM
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
e9dfbb4a
GM
1141 test "x${GCC}" = xyes && crt_gcc=yes
1142
adbc4ef4
GM
1143 fi # CRT_DIR = ""
1144
1145 crt_missing=
adbc4ef4
GM
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.]
adbc4ef4 1152 if test $crt_gcc = yes && test ! -e $CRT_DIR/$file; then
adbc4ef4
GM
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
d34a9bb3
GM
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
9cfdb3ec 1166 test -e $CRT_DIR/$file || crt_missing="$crt_missing $file"
adbc4ef4
GM
1167 done # $crt_files
1168
1169 test "x$crt_missing" = x || \
1170 AC_MSG_ERROR([Required file(s) not found:$crt_missing
1171Try using the --with-crt-dir option.])
1172
1173fi # crt_files != ""
1174
1175AC_SUBST(CRT_DIR)
1176
0538fab0
GM
1177case $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 ;;
1188esac
1189
adbc4ef4 1190
5dad233c
PE
1191pre_PKG_CONFIG_CFLAGS=$CFLAGS
1192pre_PKG_CONFIG_LIBS=$LIBS
d35af63c 1193
0e7a053e
PE
1194AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1195
067d23c9
KY
1196dnl This function definition taken from Gnome 2.0
1197dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1198dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1199dnl also defines GSTUFF_PKG_ERRORS on error
1200AC_DEFUN([PKG_CHECK_MODULES], [
1201 succeeded=no
1202
067d23c9
KY
1203 if test "$PKG_CONFIG" = "no" ; then
1204 ifelse([$4], , [AC_MSG_ERROR([
3cc53d60 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])
067d23c9
KY
1206 else
1207 PKG_CONFIG_MIN_VERSION=0.9.0
75d7aa24 1208 if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
067d23c9
KY
1209 AC_MSG_CHECKING(for $2)
1210
3cc53d60
PE
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
b8df54ff
PE
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"`
bf6bba2b
PE
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
067d23c9
KY
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
e3141fcf
PE
1229 ## do set a variable so people can do so. Do it in a subshell
1230 ## to capture any diagnostics in invoking pkg-config.
3cc53d60 1231 $1_PKG_ERRORS=`("$PKG_CONFIG" --print-errors "$2") 2>&1`
e3141fcf 1232 ifelse([$4], ,echo "$$1_PKG_ERRORS",)
067d23c9
KY
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
1251if test "${with_sound}" != "no"; then
1252 # Sound support for GNU/Linux and the free BSDs.
b06b1098 1253 AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h,
067d23c9
KY
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"
46d14be7 1264 SAVE_LIBS="$LIBS"
067d23c9 1265 CFLAGS="$ALSA_CFLAGS $CFLAGS"
46d14be7 1266 LIBS="$ALSA_LIBS $LIBS"
181855e6 1267 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <asoundlib.h>]], [[snd_lib_error_set_handler (0);]])],
067d23c9
KY
1268 emacs_alsa_normal=yes,
1269 emacs_alsa_normal=no)
1270 if test "$emacs_alsa_normal" != yes; then
181855e6
GM
1271 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alsa/asoundlib.h>]],
1272 [[snd_lib_error_set_handler (0);]])],
067d23c9
KY
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"
46d14be7 1282 LIBS="$SAVE_LIBS"
067d23c9
KY
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)
1301fi
1302
1303dnl checks for header files
0e7a053e 1304AC_CHECK_HEADERS_ONCE(
0e7a053e 1305 linux/version.h sys/systeminfo.h
49cdacda 1306 coff.h pty.h
0e7a053e 1307 sys/vlimit.h sys/resource.h
95ef7787 1308 sys/utsname.h pwd.h utmp.h util.h)
067d23c9
KY
1309
1310AC_MSG_CHECKING(if personality LINUX32 can be set)
181855e6 1311AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/personality.h>]], [[personality (PER_LINUX32)]])],
067d23c9
KY
1312 emacs_cv_personality_linux32=yes,
1313 emacs_cv_personality_linux32=no)
1314AC_MSG_RESULT($emacs_cv_personality_linux32)
1315
1316if test $emacs_cv_personality_linux32 = yes; then
1317 AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
1318 [Define to 1 if personality LINUX32 can be set.])
1319fi
1320
1321dnl On Solaris 8 there's a compilation warning for term.h because
1322dnl it doesn't define `bool'.
1323AC_CHECK_HEADERS(term.h, , , -)
067d23c9 1324AC_HEADER_TIME
c622b48f
PE
1325AC_CHECK_DECLS([sys_siglist], [], [], [[#include <signal.h>
1326 ]])
067d23c9
KY
1327if test $ac_cv_have_decl_sys_siglist != yes; then
1328 # For Tru64, at least:
c622b48f
PE
1329 AC_CHECK_DECLS([__sys_siglist], [], [], [[#include <signal.h>
1330 ]])
067d23c9
KY
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
1335fi
1336AC_HEADER_SYS_WAIT
1337
067d23c9
KY
1338dnl Check for speed_t typedef.
1339AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
181855e6 1340 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <termios.h>]], [[speed_t x = 1;]])],
067d23c9
KY
1341 emacs_cv_speed_t=yes, emacs_cv_speed_t=no)])
1342if 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>.])
1345fi
1346
0e7a053e 1347AC_CHECK_HEADERS_ONCE(sys/socket.h)
067d23c9
KY
1348AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1349#if HAVE_SYS_SOCKET_H
1350#include <sys/socket.h>
1351#endif])
377538cb
JD
1352AC_CHECK_HEADERS(ifaddrs.h, , , [AC_INCLUDES_DEFAULT
1353#if HAVE_SYS_SOCKET_H
1354#include <sys/socket.h>
1355#endif])
1356AC_CHECK_HEADERS(net/if_dl.h, , , [AC_INCLUDES_DEFAULT
1357#if HAVE_SYS_SOCKET_H
1358#include <sys/socket.h>
1359#endif])
067d23c9
KY
1360
1361dnl checks for structure members
067d23c9
KY
1362AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
1363 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
377538cb
JD
1364 struct ifreq.ifr_addr,
1365 struct ifreq.ifr_addr.sa_len], , ,
067d23c9
KY
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
4c36be58 1374dnl Check for endianness.
0e7a053e 1375dnl AC_C_BIGENDIAN is done by gnulib.
067d23c9
KY
1376
1377dnl check for Make feature
0e7a053e 1378dnl AC_PROG_MAKE_SET is done by Automake.
067d23c9
KY
1379
1380DEPFLAGS=
1381MKDEPDIR=":"
1382deps_frag=deps.mk
1383dnl check for GNU Make if we have GCC and autodepend is on.
1384if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
1385 AC_MSG_CHECKING([whether we are using GNU Make])
1386 HAVE_GNU_MAKE=no
d2eaf3e4 1387 testval=`${MAKE-make} --version 2>/dev/null | grep 'GNU Make'`
067d23c9
KY
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"
52ec1feb 1397 CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
181855e6 1398 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], , ac_enable_autodepend=no)
067d23c9
KY
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
52ec1feb 1405 DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d -MP'
3fe7cdc8
GM
1406 ## MKDIR_P is documented (see AC_PROG_MKDIR_P) to be parallel-safe.
1407 MKDEPDIR='${MKDIR_P} ${DEPDIR}'
067d23c9
KY
1408 deps_frag=autodeps.mk
1409 fi
1410fi
1411deps_frag=$srcdir/src/$deps_frag
1412AC_SUBST(MKDEPDIR)
1413AC_SUBST(DEPFLAGS)
1414AC_SUBST_FILE(deps_frag)
1415
1416
b9704ad9
GM
1417lisp_frag=$srcdir/src/lisp.mk
1418AC_SUBST_FILE(lisp_frag)
1419
1420
067d23c9
KY
1421dnl checks for operating system services
1422AC_SYS_LONG_FILE_NAMES
1423
1424#### Choose a window system.
1425
17a2cbbd
DC
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
1431window_system=none
067d23c9 1432AC_PATH_X
17a2cbbd 1433if test "$no_x" != yes; then
067d23c9
KY
1434 window_system=x11
1435fi
1436
4d5c6349 1437LD_SWITCH_X_SITE_RPATH=
067d23c9
KY
1438if 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"`
1056cb66 1441 LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`echo ${x_libraries} | sed -e "s/:/ -Wl,-rpath,/g"`
067d23c9
KY
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
1463fi
4d5c6349 1464AC_SUBST(LD_SWITCH_X_SITE_RPATH)
067d23c9
KY
1465
1466if test "${x_includes}" != NONE && test -n "${x_includes}"; then
b8df54ff 1467 C_SWITCH_X_SITE="$isystem"`echo ${x_includes} | sed -e "s/:/ $isystem/g"`
067d23c9
KY
1468fi
1469
1470if test x"${x_includes}" = x; then
1471 bitmapdir=/usr/include/X11/bitmaps
1472else
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
1486fi
1487
1488HAVE_NS=no
1489NS_IMPL_COCOA=no
1490NS_IMPL_GNUSTEP=no
1491tmp_CPPFLAGS="$CPPFLAGS"
1492tmp_CFLAGS="$CFLAGS"
1493CPPFLAGS="$CPPFLAGS -x objective-c"
1494CFLAGS="$CFLAGS -x objective-c"
0cc87afb 1495GNU_OBJC_CFLAGS=
2550c6e4 1496LIBS_GNUSTEP=
067d23c9
KY
1497if test "${with_ns}" != no; then
1498 if test "${opsys}" = darwin; then
1499 NS_IMPL_COCOA=yes
1500 ns_appdir=`pwd`/nextstep/Emacs.app
9e6b06ed 1501 ns_appbindir=${ns_appdir}/Contents/MacOS
067d23c9 1502 ns_appresdir=${ns_appdir}/Contents/Resources
83da1b55 1503 ns_appsrc=Cocoa/Emacs.base
067d23c9
KY
1504 elif test -f $GNUSTEP_CONFIG_FILE; then
1505 NS_IMPL_GNUSTEP=yes
1506 ns_appdir=`pwd`/nextstep/Emacs.app
9e6b06ed 1507 ns_appbindir=${ns_appdir}
067d23c9 1508 ns_appresdir=${ns_appdir}/Resources
83da1b55 1509 ns_appsrc=GNUstep/Emacs.base
067d23c9
KY
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}"
2550c6e4 1523 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
067d23c9
KY
1524 LIB_STANDARD=
1525 START_FILES=
0cc87afb
GM
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,
1531AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <GNUstepBase/GSConfig.h>]],
1532[[#if defined BASE_NATIVE_OBJC_EXCEPTIONS && BASE_NATIVE_OBJC_EXCEPTIONS > 0
15331;
1534#else
1535fail;
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
067d23c9 1543 fi
0cc87afb
GM
1544
1545 dnl This is only used while we test the NS headers, it gets reset below.
1546 CFLAGS="$CFLAGS $GNU_OBJC_CFLAGS"
1547
067d23c9
KY
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.])])
335f5ae4
JD
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)
067d23c9
KY
1564 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <Foundation/NSObjCRuntime.h>],
1565 [NSInteger i;])],
1566 ns_have_nsinteger=yes,
1567 ns_have_nsinteger=no)
335f5ae4
JD
1568 if test $ns_osx_have_104 = no; then
1569 AC_MSG_ERROR([`OSX 10.4 or newer is required']);
1570 fi
b1aa797c
GM
1571 if test $ns_have_nsinteger = yes; then
1572 AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.])
067d23c9
KY
1573 fi
1574fi
0fda9b75 1575
2550c6e4 1576AC_SUBST(LIBS_GNUSTEP)
067d23c9 1577
0629a797 1578INSTALL_ARCH_INDEP_EXTRA=install-etc
b4a36200 1579ns_self_contained=no
067d23c9 1580NS_OBJ=
00b3c7ac 1581NS_OBJC_OBJ=
067d23c9 1582if test "${HAVE_NS}" = yes; then
44f92739 1583 if test "$with_toolkit_scroll_bars" = "no"; then
f52bac22 1584 AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for Nextstep.])
44f92739
GM
1585 fi
1586
067d23c9 1587 window_system=nextstep
067d23c9 1588 # set up packaging dirs
067d23c9 1589 if test "${EN_NS_SELF_CONTAINED}" = yes; then
b4a36200 1590 ns_self_contained=yes
067d23c9 1591 prefix=${ns_appresdir}
816be9f6 1592 exec_prefix=${ns_appbindir}
3a4155de
GM
1593 dnl This one isn't really used, only archlibdir is.
1594 libexecdir="\${ns_appbindir}/libexec"
1595 archlibdir="\${ns_appbindir}/libexec"
b42c720d
GM
1596 docdir="\${ns_appresdir}/etc"
1597 etcdir="\${ns_appresdir}/etc"
40c117e7
GM
1598 dnl FIXME maybe set datarootdir instead.
1599 dnl That would also get applications, icons, man.
1600 infodir="\${ns_appresdir}/info"
37f36bcb 1601 mandir="\${ns_appresdir}/man"
b42c720d 1602 lispdir="\${ns_appresdir}/lisp"
d71dfe75 1603 leimdir="\${ns_appresdir}/leim"
0629a797 1604 INSTALL_ARCH_INDEP_EXTRA=
067d23c9 1605 fi
00b3c7ac 1606 NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o"
067d23c9
KY
1607fi
1608CFLAGS="$tmp_CFLAGS"
1609CPPFLAGS="$tmp_CPPFLAGS"
0629a797 1610AC_SUBST(INSTALL_ARCH_INDEP_EXTRA)
b4a36200 1611AC_SUBST(ns_self_contained)
067d23c9 1612AC_SUBST(NS_OBJ)
00b3c7ac 1613AC_SUBST(NS_OBJC_OBJ)
067d23c9 1614AC_SUBST(LIB_STANDARD)
067d23c9 1615
0fda9b75
DC
1616HAVE_W32=no
1617W32_OBJ=
1618W32_LIBS=
1cf1bbd5
DC
1619W32_RES=
1620W32_RES_LINK=
0fda9b75
DC
1621if 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.])])
dc098568 1628 AC_DEFINE(HAVE_NTGUI, 1, [Define to use native MS Windows GUI.])
1cf1bbd5
DC
1629 AC_CHECK_TOOL(WINDRES, [windres],
1630 [AC_MSG_ERROR([No resource compiler found.])])
0fda9b75
DC
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"
1cf1bbd5
DC
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"
0fda9b75
DC
1639fi
1640AC_SUBST(W32_OBJ)
1641AC_SUBST(W32_LIBS)
1cf1bbd5
DC
1642AC_SUBST(W32_RES)
1643AC_SUBST(W32_RES_LINK)
0fda9b75
DC
1644
1645if test "${HAVE_W32}" = "yes"; then
1646 window_system=w32
1647 with_xft=no
1648fi
1649
17a2cbbd
DC
1650## $window_system is now set to the window system we will
1651## ultimately use.
1652
1653term_header=
1654HAVE_X_WINDOWS=no
1655HAVE_X11=no
1656USE_X_TOOLKIT=none
1657
067d23c9
KY
1658case "${window_system}" in
1659 x11 )
1660 HAVE_X_WINDOWS=yes
1661 HAVE_X11=yes
17a2cbbd 1662 term_header=xterm.h
067d23c9
KY
1663 case "${with_x_toolkit}" in
1664 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
1665 motif ) USE_X_TOOLKIT=MOTIF ;;
1666 gtk ) with_gtk=yes
17a2cbbd 1667 term_header=gtkutil.h
c7015153 1668dnl Don't set this for GTK. A lot of tests below assumes Xt when
067d23c9
KY
1669dnl USE_X_TOOLKIT is set.
1670 USE_X_TOOLKIT=none ;;
d673aedc
JD
1671 gtk2 ) with_gtk2=yes
1672 term_header=gtkutil.h
1673 USE_X_TOOLKIT=none ;;
067d23c9 1674 gtk3 ) with_gtk3=yes
17a2cbbd 1675 term_header=gtkutil.h
067d23c9
KY
1676 USE_X_TOOLKIT=none ;;
1677 no ) USE_X_TOOLKIT=none ;;
1678dnl If user did not say whether to use a toolkit, make this decision later:
1679dnl use the toolkit if we have gtk, or X11R5 or newer.
1680 * ) USE_X_TOOLKIT=maybe ;;
1681 esac
1682 ;;
17a2cbbd
DC
1683 nextstep )
1684 term_header=nsterm.h
067d23c9 1685 ;;
0fda9b75
DC
1686 w32 )
1687 term_header=w32term.h
1688 ;;
067d23c9
KY
1689esac
1690
17a2cbbd
DC
1691if test -n "${term_header}"; then
1692 AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}",
1693 [Define to the header for the built-in window system.])
1694fi
1695
067d23c9
KY
1696if 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
1702were found. You should install the relevant development files for X
1703and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make
1704sure you have development files for image handling, i.e.
1705tiff, gif, jpeg, png and xpm.
1706If you are sure you want Emacs compiled without X window support, pass
1707 --without-x
1708to configure.])
1709 fi
1710fi
1711
1712### If we're using X11, we should use the X menu package.
1713HAVE_MENUS=no
1714case ${HAVE_X11} in
1715 yes ) HAVE_MENUS=yes ;;
1716esac
1717
34374650 1718# Does the opsystem file prohibit the use of the GNU malloc?
067d23c9
KY
1719# Assume not, until told otherwise.
1720GNU_MALLOC=yes
4b5b5289
PE
1721
1722AC_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])])
1734doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
067d23c9
KY
1735
1736
1737dnl See comments in aix4-2.h about maybe using system malloc there.
1738system_malloc=no
1739case "$opsys" in
1740 ## darwin ld insists on the use of malloc routines in the System framework.
1741 darwin|sol2-10) system_malloc=yes ;;
1742esac
1743
1744if 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=
1751else
1752 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
1753 VMLIMIT_OBJ=vm-limit.o
1754fi
1755AC_SUBST(GMALLOC_OBJ)
1756AC_SUBST(VMLIMIT_OBJ)
1757
1758if 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
bbd240ce 1769 ## Does the AC_FUNC_MMAP test below make this check unnecessary?
067d23c9
KY
1770 case "$opsys" in
1771 gnu*) REL_ALLOC=no ;;
1772 esac
1773fi
1774
1775if test x"${REL_ALLOC}" = x; then
1776 REL_ALLOC=${GNU_MALLOC}
1777fi
1778
1779use_mmap_for_buffers=no
1780case "$opsys" in
fe0e7ad7 1781 cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
067d23c9
KY
1782esac
1783
1784AC_FUNC_MMAP
1785if 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
1788fi
1789
1790LIBS="$LIBS_SYSTEM $LIBS"
1791
1792dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
1793dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
1794AC_CHECK_LIB(dnet, dnet_ntoa)
1795dnl This causes -lresolv to get used in subsequent tests,
1796dnl which causes failures on some systems such as HPUX 9.
1797dnl AC_CHECK_LIB(resolv, gethostbyname)
1798
1799dnl FIXME replace main with a function we actually want from this library.
1800AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
1801
ae9e757a
JD
1802dnl Check if pthreads is available.
1803LIB_PTHREAD=
0e7a053e 1804AC_CHECK_HEADERS_ONCE(pthread.h)
ae9e757a 1805if test "$ac_cv_header_pthread_h"; then
adee8a65
PE
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)
ae9e757a
JD
1815fi
1816if test "$HAVE_PTHREAD" = yes; then
1817 case "${canonical}" in
1818 *-hpux*) ;;
e782cfab
PE
1819 *) LIB_PTHREAD="-lpthread"
1820 LIBS="$LIB_PTHREAD $LIBS" ;;
ae9e757a
JD
1821 esac
1822 AC_DEFINE(HAVE_PTHREAD, 1, [Define to 1 if you have pthread (-lpthread).])
1823fi
1824AC_SUBST([LIB_PTHREAD])
1825
067d23c9
KY
1826AC_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.
1836test "$opsys" = "aix4-2" && \
1837 test $ac_cv_lib_pthreads_cma_open = yes && \
1838 LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads"
1839
1840dnl Check for need for bigtoc support on IBM AIX
1841
1842case ${host_os} in
1843aix*)
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
181855e6 1851 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], [], [gdb_cv_bigtoc=])
067d23c9
KY
1852 ])
1853 ;;
1854esac
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
1860REAL_CFLAGS="$CFLAGS"
1861REAL_CPPFLAGS="$CPPFLAGS"
1862
1863if 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.
4d5c6349 1871 # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
4737362e 1872 # but it's more convenient here to set LD_RUN_PATH since this
4d5c6349 1873 # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
067d23c9
KY
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)
181855e6
GM
1881 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
1882 [[XOpenDisplay ("foo");]])],
423dbf9b
RS
1883 [xgnu_linux_first_failure=no],
1884 [xgnu_linux_first_failure=yes])
1885 if test "${xgnu_linux_first_failure}" = "yes"; then
067d23c9
KY
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"
181855e6
GM
1894 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
1895 [[XOpenDisplay ("foo");]])],
423dbf9b
RS
1896 [xgnu_linux_second_failure=no],
1897 [xgnu_linux_second_failure=yes])
1898 if test "${xgnu_linux_second_failure}" = "yes"; then
067d23c9
KY
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)
181855e6
GM
1917 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
1918#include <X11/XKBlib.h>]],
1919 [[XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);]])],
067d23c9
KY
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 \
9232a6d9 1927XScreenNumberOfScreen)
067d23c9
KY
1928fi
1929
1930if test "${window_system}" = "x11"; then
1931 AC_MSG_CHECKING(X11 version 6)
1932 AC_CACHE_VAL(emacs_cv_x11_version_6,
181855e6
GM
1933 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
1934[[#if XlibSpecificationRelease < 6
067d23c9
KY
1935fail;
1936#endif
181855e6 1937]])], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
067d23c9
KY
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
1954fi
1955
1956
1957### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
1958HAVE_RSVG=no
be8ec0b3 1959if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
067d23c9
KY
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
1974fi
1975
1976HAVE_IMAGEMAGICK=no
1977if test "${HAVE_X11}" = "yes"; then
1978 if test "${with_imagemagick}" != "no"; then
f5b06c35
GM
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"
067d23c9
KY
1983 PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, :)
1984 AC_SUBST(IMAGEMAGICK_CFLAGS)
1985 AC_SUBST(IMAGEMAGICK_LIBS)
b06b1098 1986
067d23c9
KY
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"
03043c1b 1991 AC_CHECK_FUNCS(MagickExportImagePixels MagickMergeImageLayers)
067d23c9
KY
1992 fi
1993 fi
1994fi
1995
1996
1997HAVE_GTK=no
c195f2de 1998GTK_OBJ=
d673aedc
JD
1999check_gtk2=no
2000gtk3_pkg_errors=
2001if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
0afb4571
J
2002 GLIB_REQUIRED=2.28
2003 GTK_REQUIRED=3.0
067d23c9
KY
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)
d673aedc 2008 if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
067d23c9
KY
2009 AC_MSG_ERROR($GTK_PKG_ERRORS)
2010 fi
d673aedc
JD
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
5fb91e71 2015 USE_GTK_TOOLKIT="GTK3"
7ec363cf
JD
2016 if test "x$ac_enable_gtk_deprecation_warnings" = x; then
2017 GTK_CFLAGS="$GTK_CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS"
2018 fi
d673aedc
JD
2019 else
2020 check_gtk2=yes
2021 gtk3_pkg_errors="$GTK_PKG_ERRORS "
2022 fi
067d23c9
KY
2023fi
2024
d673aedc 2025if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
0ffe1065
JD
2026 GLIB_REQUIRED=2.10
2027 GTK_REQUIRED=2.10
067d23c9
KY
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)
e3141fcf
PE
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)
067d23c9 2036 fi
5fb91e71 2037 test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
067d23c9 2038fi
067d23c9 2039
067d23c9
KY
2040if 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.])
c195f2de 2057 GTK_OBJ="gtkutil.o $GTK_OBJ"
067d23c9 2058 USE_X_TOOLKIT=none
3cc53d60 2059 if "$PKG_CONFIG" --atleast-version=2.10 gtk+-2.0; then
067d23c9
KY
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
2070fi
2071AC_SUBST(GTK_OBJ)
2072
2073
2074if 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
5a1d858b
JD
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
067d23c9 2102
8b745d92
JD
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
067d23c9
KY
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 \
54e9e3bf
JD
2116 gtk_orientable_set_orientation \
2117 gtk_window_set_has_resize_grip)
17a2cbbd
DC
2118
2119 term_header=gtkutil.h
067d23c9
KY
2120fi
2121
2122dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
dcbf5805 2123dnl other platforms.
067d23c9
KY
2124HAVE_DBUS=no
2125DBUS_OBJ=
2126if 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.])
dcbf5805 2131 dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1.
e3a3e213
MA
2132 dnl dbus_type_is_valid and dbus_validate_* have been introduced in
2133 dnl D-Bus 1.5.12.
dcbf5805 2134 AC_CHECK_FUNCS(dbus_watch_get_unix_fd \
e3a3e213 2135 dbus_type_is_valid \
dcbf5805
MA
2136 dbus_validate_bus_name \
2137 dbus_validate_path \
2138 dbus_validate_interface \
2139 dbus_validate_member)
067d23c9
KY
2140 DBUS_OBJ=dbusbind.o
2141 fi
2142fi
2143AC_SUBST(DBUS_OBJ)
2144
9851bfc5
JD
2145dnl GSettings has been tested under GNU/Linux only.
2146HAVE_GSETTINGS=no
2147if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then
2ad77c9d 2148 PKG_CHECK_MODULES(GSETTINGS, gio-2.0 >= 2.26, HAVE_GSETTINGS=yes, HAVE_GSETTINGS=no)
2e6e11eb 2149 if test "$HAVE_GSETTINGS" = "yes"; then
9851bfc5
JD
2150 AC_DEFINE(HAVE_GSETTINGS, 1, [Define to 1 if using GSettings.])
2151 SETTINGS_CFLAGS="$GSETTINGS_CFLAGS"
2152 SETTINGS_LIBS="$GSETTINGS_LIBS"
2153 fi
2154fi
2155
067d23c9
KY
2156dnl GConf has been tested under GNU/Linux only.
2157dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
2158HAVE_GCONF=no
869795d6 2159if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
067d23c9
KY
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.
869795d6
JD
2164 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
2165 SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
067d23c9
KY
2166 fi
2167fi
2168
2e6e11eb 2169if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
f278d339
JD
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
9851bfc5 2175 SAVE_CFLAGS="$CFLAGS"
46d14be7 2176 SAVE_LIBS="$LIBS"
9851bfc5 2177 CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
46d14be7 2178 LIBS="$SETTINGS_LIBS $LIBS"
9851bfc5
JD
2179 AC_CHECK_FUNCS([g_type_init])
2180 CFLAGS="$SAVE_CFLAGS"
46d14be7 2181 LIBS="$SAVE_LIBS"
9851bfc5
JD
2182fi
2183AC_SUBST(SETTINGS_CFLAGS)
2184AC_SUBST(SETTINGS_LIBS)
2185
2186
067d23c9
KY
2187dnl SELinux is available for GNU/Linux only.
2188HAVE_LIBSELINUX=no
2189LIBSELINUX_LIBS=
2190if 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
2196fi
2197AC_SUBST(LIBSELINUX_LIBS)
2198
2199HAVE_GNUTLS=no
33630d51 2200HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY=no
067d23c9 2201if test "${with_gnutls}" = "yes" ; then
9f77899d 2202 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no)
067d23c9
KY
2203 if test "${HAVE_GNUTLS}" = "yes"; then
2204 AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
2205 fi
33630d51
TZ
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
067d23c9 2214fi
33630d51 2215
067d23c9
KY
2216AC_SUBST(LIBGNUTLS_LIBS)
2217AC_SUBST(LIBGNUTLS_CFLAGS)
2218
81606b10 2219dnl inotify is only available on GNU/Linux.
81606b10
RS
2220if test "${with_inotify}" = "yes"; then
2221 AC_CHECK_HEADERS(sys/inotify.h)
2222 if test "$ac_cv_header_sys_inotify_h" = yes ; then
7e77303e 2223 AC_CHECK_FUNC(inotify_init1)
81606b10
RS
2224 fi
2225fi
7e77303e
PE
2226if test "$ac_cv_func_inotify_init1" = yes; then
2227 AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.])
81606b10
RS
2228fi
2229
7c3d167f
RF
2230dnl POSIX ACL support: provided by libacl on GNU/Linux, by libc on FreeBSD.
2231HAVE_POSIX_ACL=no
2232LIBACL_LIBS=
2233if 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
2244fi
2245AC_SUBST(LIBACL_LIBS)
2246
067d23c9
KY
2247dnl Do not put whitespace before the #include statements below.
2248dnl Older compilers (eg sunos4 cc) choke on it.
2249HAVE_XAW3D=no
2250LUCID_LIBW=
2251if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
2252 if test "$with_xaw3d" != no; then
067d23c9 2253 AC_CACHE_VAL(emacs_cv_xaw3d,
181855e6 2254 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
067d23c9 2255#include <X11/Intrinsic.h>
181855e6
GM
2256#include <X11/Xaw3d/Simple.h>]],
2257 [[]])],
37f7b784
CY
2258 [AC_CHECK_LIB(Xaw3d, XawScrollbarSetThumb,
2259 emacs_cv_xaw3d=yes, emacs_cv_xaw3d=no)],
067d23c9
KY
2260 emacs_cv_xaw3d=no)])
2261 else
2262 emacs_cv_xaw3d=no
2263 fi
2264 if test $emacs_cv_xaw3d = yes; then
2c484e75 2265 AC_MSG_CHECKING(for xaw3d)
067d23c9
KY
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
2c484e75 2273 AC_MSG_CHECKING(for xaw3d)
067d23c9
KY
2274 AC_MSG_RESULT(no)
2275 AC_MSG_CHECKING(for libXaw)
2276 AC_CACHE_VAL(emacs_cv_xaw,
181855e6 2277 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
067d23c9 2278#include <X11/Intrinsic.h>
181855e6
GM
2279#include <X11/Xaw/Simple.h>]],
2280 [[]])],
067d23c9
KY
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
d681f183
GM
2290 AC_MSG_ERROR([No X toolkit could be found.
2291If you are sure you want Emacs compiled without an X toolkit, pass
2292 --with-x-toolkit=no
2293to configure. Otherwise, install the development libraries for the toolkit
2294that you want to use (e.g. Gtk+) and re-run configure.])
067d23c9
KY
2295 fi
2296 fi
2297fi
2298
2299X_TOOLKIT_TYPE=$USE_X_TOOLKIT
2300
2301LIBXTR6=
2302if test "${USE_X_TOOLKIT}" != "none"; then
2303 AC_MSG_CHECKING(X11 toolkit version)
2304 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
181855e6
GM
2305 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Intrinsic.h>]],
2306[[#if XtSpecificationRelease < 6
067d23c9
KY
2307fail;
2308#endif
181855e6 2309]])], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
067d23c9
KY
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
2324dnl If using toolkit, check whether libXmu.a exists.
2325dnl 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"
ba9e4b84 2334 dnl ac_cv_lib_Xmu_XmuConvertStandardSelection is also referenced below.
067d23c9
KY
2335fi
2336AC_SUBST(LIBXTR6)
2337
2338dnl FIXME the logic here seems weird, but this is what cpp was doing.
2339dnl Why not just test for libxmu in the normal way?
2340LIBXMU=-lXmu
d6a003a8
AS
2341case $opsys in
2342 ## These systems don't supply Xmu.
067d23c9
KY
2343 hpux* | aix4-2 )
2344 test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU=
2345 ;;
2346esac
2347AC_SUBST(LIBXMU)
2348
2349# On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
2350if test "${HAVE_X11}" = "yes"; then
2351 if test "${USE_X_TOOLKIT}" != "none"; then
2352 AC_CHECK_LIB(Xext, XShapeQueryExtension)
2353 fi
2354fi
2355
2356LIBXP=
2357if test "${USE_X_TOOLKIT}" = "MOTIF"; then
c09bfb2f
DA
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,
181855e6
GM
2373 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Xm/Xm.h>]],
2374 [[#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
067d23c9
KY
2375int x = 5;
2376#else
2377Motif version prior to 2.1.
181855e6 2378#endif]])],
067d23c9
KY
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)
c09bfb2f
DA
2382 if test x$emacs_cv_openmotif = xyes; then
2383 REAL_CPPFLAGS="-I/usr/include/openmotif $REAL_CPPFLAGS"
2384 fi
067d23c9
KY
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"
181855e6
GM
2394 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>]],
2395 [[int x = 5;]])],
067d23c9
KY
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
e4070def
GM
2410 AC_CHECK_HEADER([Xm/BulletinB.h], [],
2411 [AC_MSG_ERROR([Motif toolkit requested but requirements not found.])])
067d23c9
KY
2412fi
2413
2414dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
2415dnl using Motif or Xaw3d is available, and unless
2416dnl --with-toolkit-scroll-bars=no was specified.
2417
2418AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
2419 [Define to 1 if we should use toolkit scroll bars.])dnl
2420USE_TOOLKIT_SCROLL_BARS=no
2421if 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
8d8939e8 2427 elif test "${HAVE_XAW3D}" = "yes" || test "${USE_X_TOOLKIT}" = "LUCID"; then
067d23c9
KY
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
0fda9b75
DC
2437 elif test "${HAVE_W32}" = "yes"; then
2438 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2439 USE_TOOLKIT_SCROLL_BARS=yes
067d23c9
KY
2440 fi
2441fi
2442
2443dnl See if XIM is available.
181855e6 2444AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
067d23c9 2445 #include <X11/Xlib.h>
181855e6
GM
2446 #include <X11/Xresource.h>]],
2447 [[XIMProc callback;]])],
067d23c9
KY
2448 [HAVE_XIM=yes
2449 AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
2450 HAVE_XIM=no)
2451
2452dnl `--with-xim' now controls only the initial value of use_xim at run time.
2453
2454if test "${with_xim}" != "no"; then
2455 AC_DEFINE(USE_XIM, 1,
2456 [Define to 1 if we should use XIM, if it is available.])
2457fi
2458
2459
2460if test "${HAVE_XIM}" != "no"; then
2461 late_CFLAGS=$CFLAGS
2462 if test "$GCC" = yes; then
2463 CFLAGS="$CFLAGS --pedantic-errors"
2464 fi
181855e6 2465 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
067d23c9 2466#include <X11/Xlib.h>
181855e6
GM
2467#include <X11/Xresource.h>]],
2468[[Display *display;
067d23c9
KY
2469XrmDatabase db;
2470char *res_name;
2471char *res_class;
2472XIMProc callback;
2473XPointer *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. */
2477extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
2478 char*, XIMProc, XPointer*);
2479#endif
2480(void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
181855e6 2481 client_data);]])],
067d23c9
KY
2482 [emacs_cv_arg6_star=yes])
2483 AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
2484 [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
2485either 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
2492fi
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.
2499if 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
870d9cf6
GM
2537 ## We used to allow building with FreeType and without Xft.
2538 ## However, the ftx font backend driver is not in good shape.
067d23c9 2539 if test "$HAVE_XFT" != "yes"; then
870d9cf6 2540 dnl For the "Does Emacs use" message at the end.
067d23c9 2541 HAVE_XFT=no
870d9cf6
GM
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,
46dcfee4 2549 HAVE_FREETYPE=no)
870d9cf6
GM
2550
2551 test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(libxft requires libfreetype)
067d23c9
KY
2552 fi
2553
067d23c9
KY
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
2585else
2586 HAVE_XFT=no
2587 HAVE_FREETYPE=no
2588 HAVE_LIBOTF=no
2589 HAVE_M17N_FLT=no
2590fi
2591
2592### End of font-backend (under X11) section.
2593
2594AC_SUBST(FREETYPE_CFLAGS)
2595AC_SUBST(FREETYPE_LIBS)
2596AC_SUBST(FONTCONFIG_CFLAGS)
2597AC_SUBST(FONTCONFIG_LIBS)
2598AC_SUBST(LIBOTF_CFLAGS)
2599AC_SUBST(LIBOTF_LIBS)
2600AC_SUBST(M17N_FLT_CFLAGS)
2601AC_SUBST(M17N_FLT_LIBS)
2602
2603### Use -lXpm if available, unless `--with-xpm=no'.
2604HAVE_XPM=no
2605LIBXPM=
0fda9b75
DC
2606
2607if 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
2620no_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
791ef5f8 2636 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
0fda9b75
DC
2637 LIBXPM=-lXpm
2638 fi
2639fi
2640
067d23c9
KY
2641if 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
2650no_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
20db1522 2663 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
067d23c9
KY
2664 LIBXPM=-lXpm
2665 fi
2666fi
0fda9b75 2667
067d23c9
KY
2668AC_SUBST(LIBXPM)
2669
2670### Use -ljpeg if available, unless `--with-jpeg=no'.
2671HAVE_JPEG=no
2672LIBJPEG=
0fda9b75 2673if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
067d23c9
KY
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
2695fi
2696AC_SUBST(LIBJPEG)
2697
2698### Use -lpng if available, unless `--with-png=no'.
2699HAVE_PNG=no
2700LIBPNG=
0fda9b75 2701if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
067d23c9
KY
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.
0ccb0b09 2705 AC_CHECK_HEADERS(png.h libpng/png.h, break)
067d23c9
KY
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"
0ccb0b09
PE
2714
2715 AC_CHECK_DECL(png_longjmp,
2716 [],
cda158b4 2717 [AC_DEFINE(PNG_DEPSTRUCT, [],
0ccb0b09
PE
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 ]])
067d23c9
KY
2727 fi
2728fi
2729AC_SUBST(LIBPNG)
2730
2731### Use -ltiff if available, unless `--with-tiff=no'.
2732HAVE_TIFF=no
2733LIBTIFF=
0fda9b75 2734if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
067d23c9
KY
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
2748fi
2749AC_SUBST(LIBTIFF)
2750
2751### Use -lgif or -lungif if available, unless `--with-gif=no'.
2752HAVE_GIF=no
2753LIBGIF=
0fda9b75
DC
2754if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
2755 || test "${HAVE_W32}" = "yes"; then
067d23c9
KY
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
2772fi
2773AC_SUBST(LIBGIF)
2774
2775dnl Check for required libraries.
2776if 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
2793Maybe some development libraries/packages are missing?
2794If you don't want to link with them give
2795 $WITH_NO
2796as options to configure])
2797 fi
2798fi
2799
2800### Use -lgpm if available, unless `--with-gpm=no'.
2801HAVE_GPM=no
2802LIBGPM=
067d23c9
KY
2803if 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
067d23c9
KY
2810 fi
2811fi
2812AC_SUBST(LIBGPM)
2813
2814dnl Check for malloc/malloc.h on darwin
0e7a053e 2815AC_CHECK_HEADERS_ONCE(malloc/malloc.h)
067d23c9 2816
2f097256 2817GNUSTEP_CFLAGS=
067d23c9
KY
2818### Use NeXTstep API to implement GUI.
2819if 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.])
067d23c9
KY
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. */
2f097256 2828 GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
0cc87afb
GM
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"
067d23c9 2831 fi
067d23c9
KY
2832 # We also have mouse menus.
2833 HAVE_MENUS=yes
2834 OTHER_FILES=ns-app
2835fi
2836
0fda9b75
DC
2837if test "${HAVE_W32}" = "yes"; then
2838 HAVE_MENUS=yes
2839fi
067d23c9
KY
2840
2841### Use session management (-lSM -lICE) if available
2842HAVE_X_SM=no
2843LIBXSM=
2844if 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
2856fi
2857AC_SUBST(LIBXSM)
2858
2859### Use libxml (-lxml2) if available
04d51ad4 2860HAVE_LIBXML2=no
067d23c9
KY
2861if test "${with_xml2}" != "no"; then
2862 ### I'm not sure what the version number should be, so I just guessed.
dab73760 2863 PKG_CHECK_MODULES(LIBXML2, libxml-2.0 > 2.6.17, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
067d23c9
KY
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
2874fi
2875AC_SUBST(LIBXML2_LIBS)
2876AC_SUBST(LIBXML2_CFLAGS)
2877
2878# If netdb.h doesn't declare h_errno, we must declare it by hand.
2879AC_CACHE_CHECK(whether netdb declares h_errno,
2880 emacs_cv_netdb_declares_h_errno,
181855e6
GM
2881[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
2882 [[return h_errno;]])],
067d23c9
KY
2883 emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
2884if 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.])
2886fi
2887
c990426a
PE
2888# sqrt and other floating-point functions such as fmod and frexp
2889# are found in -lm on most systems.
067d23c9
KY
2890AC_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.
2894AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no)
2895if 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).])
2899else
2900 LIBS_MAIL=
2901fi
2902dnl Debian, at least:
2903AC_CHECK_LIB(lockfile, maillock, have_lockfile=yes, have_lockfile=no)
2904if 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).])
2908else
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.
2918This probably means that movemail could lose mail.
2919There may be a `development' package to install containing liblockfile.])
2920 fi
2921fi
0e7a053e 2922AC_CHECK_HEADERS_ONCE(maillock.h)
067d23c9
KY
2923AC_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.
2928mail_lock=no
2929case "$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 ;;
2954esac
2955
2956BLESSMAIL_TARGET=
2957case "$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" ;;
2963esac
2964AC_SUBST(BLESSMAIL_TARGET)
2965
2966
54e8a418 2967AC_CHECK_FUNCS(gethostname \
95ef7787 2968getrusage get_current_dir_name \
dd0333b6 2969lrand48 \
3d082a26 2970select getpagesize setlocale \
9239d970 2971utimes getrlimit setrlimit shutdown getaddrinfo \
8148369c 2972strsignal setitimer \
03043c1b 2973sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
9232a6d9
PE
2974gai_strerror mkstemp getline getdelim fsync sync \
2975difftime posix_memalign \
316411f0 2976getpwent endpwent getgrent endgrent \
03043c1b 2977touchlock \
c8199d0f 2978cfmakeraw cfsetspeed copysign __executable_start)
067d23c9 2979
4516fbef
GM
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.
5af2266c 2985## We also skip HAVE_RANDOM - see comments in src/conf_post.h.
4516fbef
GM
2986case $opsys in
2987 hpux*) : ;;
2988 *) AC_CHECK_FUNCS(random rint) ;;
2989esac
2990
2018939f
AS
2991dnl Cannot use AC_CHECK_FUNCS
2992AC_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)])
2997if 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.])
3000fi
3001
0e7a053e 3002AC_CHECK_HEADERS_ONCE(sys/un.h)
067d23c9 3003
067d23c9
KY
3004AC_FUNC_FSEEKO
3005
067d23c9 3006# UNIX98 PTYs.
54e8a418 3007AC_CHECK_FUNCS(grantpt)
067d23c9
KY
3008
3009# PTY-related GNU extensions.
1598ef28 3010AC_CHECK_FUNCS(getpt posix_openpt)
067d23c9
KY
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.
f20f95c6
PE
3017AC_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.
3023AC_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])
fd8dea03
GM
3033# Maybe curses should be tried earlier?
3034# See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
a4a18b8b 3035for tputs_library in '' tinfo ncurses terminfo termcap curses; do
f20f95c6
PE
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
3051done
3052AC_MSG_RESULT([$msg])
3053if test "X$msg" = Xno; then
fd8dea03 3054 AC_MSG_ERROR([The required function `tputs' was not found in any library.
a4a18b8b
GM
3055The following libraries were tried (in order):
3056 libtinfo, libncurses, libterminfo, libtermcap, libcurses
fd8dea03
GM
3057Please try installing whichever of these libraries is most appropriate
3058for your system, together with its header files.
3059For example, a libncurses-dev(el) or similar package.])
067d23c9 3060fi
067d23c9 3061
262f06da
GM
3062## Use termcap instead of terminfo?
3063## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
3064TERMINFO=yes
a4a18b8b
GM
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?
067d23c9 3069case "$opsys" in
067d23c9
KY
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.
a4a18b8b
GM
3074 darwin) LIBS_TERMCAP="-lncurses" ;;
3075
01319a4e 3076 gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
067d23c9
KY
3077
3078 freebsd)
3079 AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
3080 AC_CACHE_VAL(emacs_cv_freebsd_terminfo,
181855e6
GM
3081 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <osreldate.h>]],
3082[[#if __FreeBSD_version < 400000
067d23c9
KY
3083fail;
3084#endif
181855e6 3085]])], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)])
067d23c9
KY
3086
3087 AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
3088
3089 if test $emacs_cv_freebsd_terminfo = yes; then
067d23c9
KY
3090 LIBS_TERMCAP="-lncurses"
3091 else
262f06da 3092 TERMINFO=no
067d23c9
KY
3093 LIBS_TERMCAP="-ltermcap"
3094 fi
3095 ;;
3096
3097 netbsd)
01319a4e 3098 if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
262f06da 3099 TERMINFO=no
067d23c9
KY
3100 LIBS_TERMCAP="-ltermcap"
3101 fi
3102 ;;
3103
3ba0a545 3104 openbsd) LIBS_TERMCAP="-lncurses" ;;
067d23c9 3105
067d23c9
KY
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.
e3da5b19
GM
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?
067d23c9
KY
3111 hpux*) LIBS_TERMCAP="-ltermcap" ;;
3112
067d23c9
KY
3113esac
3114
3115TERMCAP_OBJ=tparam.o
3116if test $TERMINFO = yes; then
3117 AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
067d23c9
KY
3118 TERMCAP_OBJ=terminfo.o
3119fi
3120AC_SUBST(LIBS_TERMCAP)
3121AC_SUBST(TERMCAP_OBJ)
3122
3123
3124# Do we have res_init, for detecting changes in /etc/resolv.conf?
4516fbef
GM
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
067d23c9 3127resolv=no
4516fbef
GM
3128
3129if test $opsys != darwin; then
3130
3131 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
067d23c9 3132#include <arpa/nameser.h>
181855e6
GM
3133#include <resolv.h>]],
3134 [[return res_init();]])],
067d23c9 3135 have_res_init=yes, have_res_init=no)
4516fbef
GM
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>
067d23c9 3141#include <arpa/nameser.h>
181855e6 3142#include <resolv.h>]],
4516fbef
GM
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"
067d23c9 3150 fi
067d23c9 3151
4516fbef
GM
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
3155fi dnl !darwin
067d23c9
KY
3156
3157# Do we need the Hesiod library to provide the support routines?
4516fbef 3158dnl FIXME? Should we be skipping this on Darwin too?
067d23c9
KY
3159LIBHESIOD=
3160if 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
3178fi
3179AC_SUBST(LIBHESIOD)
3180
3181# Do we need libresolv (due to res_init or Hesiod)?
4516fbef 3182if test "$resolv" = yes && test $opsys != darwin; then
067d23c9
KY
3183 AC_DEFINE(HAVE_LIBRESOLV, 1,
3184 [Define to 1 if you have the resolv library (-lresolv).])
3185 LIBRESOLV=-lresolv
3186else
3187 LIBRESOLV=
3188fi
3189AC_SUBST(LIBRESOLV)
3190
3191# These tell us which Kerberos-related libraries to use.
3192COM_ERRLIB=
3193CRYPTOLIB=
3194KRB5LIB=
3195DESLIB=
3196KRB4LIB=
3197
3198if 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)
3266fi
3267
3268AC_SUBST(COM_ERRLIB)
3269AC_SUBST(CRYPTOLIB)
3270AC_SUBST(KRB5LIB)
3271AC_SUBST(DESLIB)
3272AC_SUBST(KRB4LIB)
3273
554fef51 3274AC_CHECK_FUNCS_ONCE(tzset)
067d23c9
KY
3275AC_MSG_CHECKING(whether localtime caches TZ)
3276AC_CACHE_VAL(emacs_cv_localtime_cache,
3277[if test x$ac_cv_func_tzset = xyes; then
181855e6 3278AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
067d23c9
KY
3279char TZ_GMT0[] = "TZ=GMT0";
3280char TZ_PST8[] = "TZ=PST8";
3281main()
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);
181855e6 3298}]])], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
067d23c9
KY
3299[# If we have tzset, assume the worst when cross-compiling.
3300emacs_cv_localtime_cache=yes])
3301else
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
3305fi])dnl
3306AC_MSG_RESULT($emacs_cv_localtime_cache)
3307if test $emacs_cv_localtime_cache = yes; then
3308 AC_DEFINE(LOCALTIME_CACHE, 1,
3309 [Define to 1 if localtime caches TZ.])
3310fi
3311
067d23c9
KY
3312ok_so_far=yes
3313AC_CHECK_FUNC(socket, , ok_so_far=no)
3314if test $ok_so_far = yes; then
3315 AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
3316fi
3317if test $ok_so_far = yes; then
3318 AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
3319fi
3320if test $ok_so_far = yes; then
3321dnl Fixme: Not used. Should this be HAVE_SOCKETS?
3322 AC_DEFINE(HAVE_INET_SOCKETS, 1,
3323 [Define to 1 if you have inet sockets.])
3324fi
3325
3326if 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.])
3329fi
3330
3331AC_MSG_CHECKING(whether system supports dynamic ptys)
3332if 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.])
3335else
3336 AC_MSG_RESULT(no)
3337fi
3338
eeceac93
PE
3339dnl Check for a Solaris 2.4 vfork bug that Autoconf misses (through 2.69).
3340dnl This can be removed once we assume Autoconf 2.70.
3341case $canonical in
3342 *-solaris2.4 | *-solaris2.4.*)
3343 dnl Disable the Autoconf-generated vfork test.
3344 : ${ac_cv_func_vfork_works=no};;
3345esac
3346
067d23c9
KY
3347AC_FUNC_FORK
3348
54e8a418 3349AC_CHECK_FUNCS(snprintf)
55e5faa1 3350
067d23c9
KY
3351dnl Adapted from Haible's version.
3352AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
181855e6
GM
3353 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
3354 [[char* cs = nl_langinfo(CODESET);]])],
067d23c9
KY
3355 emacs_cv_langinfo_codeset=yes,
3356 emacs_cv_langinfo_codeset=no)
3357 ])
3358if 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).])
3361fi
3362
067d23c9
KY
3363AC_TYPE_MBSTATE_T
3364
067d23c9 3365AC_CACHE_CHECK([for C restricted array declarations], emacs_cv_c_restrict_arr,
181855e6 3366 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void fred (int x[__restrict]);]], [[]])],
067d23c9
KY
3367 emacs_cv_c_restrict_arr=yes, emacs_cv_c_restrict_arr=no)])
3368if 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.])
3372fi
3373
3374dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
3375dnl how the tty code is related to POSIX and/or other versions of termios.
3376dnl The following looks like a useful start.
3377dnl
3378dnl AC_SYS_POSIX_TERMIOS
3379dnl if test $ac_cv_sys_posix_termios = yes; then
3380dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
3381dnl and macros for terminal control.])
3382dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
3383dnl fi
3384
8d8e2dfe
GM
3385dnl Turned on June 1996 supposing nobody will mind it.
3386AC_DEFINE(AMPERSAND_FULL_NAME, 1, [Define to use the convention that &
3387 in the full name stands for the login id.])
3388
172bedef
GM
3389dnl Every platform that uses configure (ie every non-MS platform)
3390dnl supports this. There is a create-lockfiles option you can
3391dnl customize if you do not want the lock files to be written.
3392dnl So it is not clear that this #define still needs to exist.
3393AC_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
ee1cf5cf
GM
3397dnl Everybody supports this, except MS.
3398dnl 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.
3400AC_DEFINE(HAVE_PTYS, 1, [Define if the system supports pty devices.])
3401
3402dnl Everybody supports this, except MS-DOS.
3403dnl Seems like the kind of thing we should be testing for, though.
3404dnl Compare with HAVE_INET_SOCKETS (which is unused...) above.
3405AC_DEFINE(HAVE_SOCKETS, 1, [Define if the system supports
3406 4.2-compatible sockets.])
3407
ca35a5f7
GM
3408AH_TEMPLATE(INTERNAL_TERMINAL, [This is substituted when $TERM is "internal".])
3409
b2c7a106
GM
3410AC_DEFINE(NULL_DEVICE, ["/dev/null"], [Name of the file to open to get
3411 a null file, or a data sink.])
3412
3413AC_DEFINE(SEPCHAR, [':'], [Character that separates PATH elements.])
3414
8d8e2dfe
GM
3415dnl Everybody supports this, except MS-DOS.
3416AC_DEFINE(subprocesses, 1, [Define to enable asynchronous subprocesses.])
3417
b2c7a106
GM
3418AC_DEFINE(USER_FULL_NAME, [pw->pw_gecos], [How to get a user's full name.])
3419
ee1cf5cf 3420
9374581a
GM
3421AC_DEFINE(DIRECTORY_SEP, ['/'],
3422 [Character that separates directories in a file name.])
3423
5c0c0e8a
GM
3424dnl Only used on MS platforms.
3425AH_TEMPLATE(DEVICE_SEP, [Character that separates a device in a file name.])
3426
3427AC_DEFINE(IS_DEVICE_SEP(_c_), 0,
3428 [Returns true if character is a device separator.])
3429
3430AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == DIRECTORY_SEP)],
3431 [Returns true if character is a directory separator.])
3432
3433dnl On MS, this also accepts IS_DEVICE_SEP.
3434AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_))],
3435 [Returns true if character is any form of separator.])
3436
3437
ba9e4b84
GM
3438AH_TEMPLATE(NO_EDITRES, [Define if XEditRes should not be used.])
3439
3440case $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
5dad233c 3444 AC_DEFINE(NO_EDITRES, 1)
ba9e4b84
GM
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 ;;
3453esac
3454
3455
45fa9c0f 3456case $opsys in
739ae010
GM
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 ;;
45fa9c0f
GM
3464esac
3465
4a4bbad2 3466emacs_broken_SIGIO=no
ea0bbd17 3467
45fa9c0f 3468case $opsys in
ea0bbd17
GM
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>.
45fa9c0f 3471 hpux* | irix6-5 | openbsd | sol2* | unixware )
4a4bbad2 3472 emacs_broken_SIGIO=yes
c5564388
GM
3473 ;;
3474
ea0bbd17 3475 aix4-2)
42bd1719
GM
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.])
ea0bbd17 3516 ;;
45fa9c0f
GM
3517esac
3518
b4492cba
GM
3519case $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 ;;
3524esac
3525
9d596af3
GM
3526case $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 ;;
3532esac
3533
20e94fdd
GM
3534dnl FIXME Surely we can test for this rather than hard-code it.
3535case $opsys in
3536 netbsd | openbsd) sound_device="/dev/audio" ;;
3537 *) sound_device="/dev/dsp" ;;
3538esac
3539
3540dnl Used in sound.c
3541AC_DEFINE_UNQUOTED(DEFAULT_SOUND_DEVICE, "$sound_device",
3542 [Name of the default sound device.])
3543
09f4e3b0 3544
c43fb4c3
GM
3545dnl Emacs can read input using SIGIO and buffering characters itself,
3546dnl or using CBREAK mode and making C-g cause SIGINT.
3547dnl The choice is controlled by the variable interrupt_input.
3548dnl
3549dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
3550dnl
4a4bbad2 3551dnl Emacs uses the presence of the USABLE_SIGIO macro
c43fb4c3
GM
3552dnl to indicate whether or not signal-driven I/O is possible. It uses
3553dnl INTERRUPT_INPUT to decide whether to use it by default.
3554dnl
3555dnl SIGIO can be used only on systems that implement it (4.2 and 4.3).
3556dnl CBREAK mode has two disadvantages
3557dnl 1) At least in 4.2, it is impossible to handle the Meta key properly.
3558dnl I hear that in system V this problem does not exist.
3559dnl 2) Control-G causes output to be discarded.
3560dnl I do not know whether this can be fixed in system V.
3561dnl
3562dnl Another method of doing input is planned but not implemented.
3563dnl It would have Emacs fork off a separate process
3564dnl to read the input and send it to the true Emacs process
3565dnl through a pipe.
3566case $opsys in
3567 darwin | gnu-linux | gnu-kfreebsd )
3568 AC_DEFINE(INTERRUPT_INPUT, 1, [Define to read input using SIGIO.])
3569 ;;
3570esac
3571
3572
308aab79
GM
3573dnl If the system's imake configuration file defines `NeedWidePrototypes'
3574dnl as `NO', we must define NARROWPROTO manually. Such a define is
3575dnl generated in the Makefile generated by `xmkmf'. If we don't define
3576dnl NARROWPROTO, we will see the wrong function prototypes for X functions
3577dnl taking float or double parameters.
3578case $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 ;;
3583esac
3584
3585
6e777848
GM
3586dnl Used in process.c, this must be a loop, even if it only runs once.
3587dnl (Except on SGI; see below. Take that, clarity and consistency!)
3588AH_TEMPLATE(PTY_ITERATION, [How to iterate over PTYs.])
3589dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
3590dnl trying suffixes 0-16.
3591AH_TEMPLATE(FIRST_PTY_LETTER, [Letter to use in finding device name of
3592 first PTY, if PTYs are supported.])
0ab7b23a 3593AH_TEMPLATE(PTY_OPEN, [How to open a PTY, if non-standard.])
3f922c37
GM
3594AH_TEMPLATE(PTY_NAME_SPRINTF, [How to get the device name of the control
3595 end of a PTY, if non-standard.])
3596AH_TEMPLATE(PTY_TTY_NAME_SPRINTF, [How to get device name of the tty
3597 end of a PTY, if non-standard.])
6e777848
GM
3598
3599case $opsys in
3600 aix4-2 )
ef834897 3601 AC_DEFINE(PTY_ITERATION, [int c; for (c = 0; !c ; c++)])
3f922c37
GM
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.
ef834897
GM
3604 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
3605 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));])
6e777848
GM
3606 ;;
3607
3608 cygwin )
ef834897 3609 AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
0ab7b23a 3610 dnl multi-line AC_DEFINEs are hard. :(
2fe28299 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)])
ef834897
GM
3612 AC_DEFINE(PTY_NAME_SPRINTF, [])
3613 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
6e777848
GM
3614 ;;
3615
1598ef28 3616 dnl FIXME? Maybe use same as freebsd - see bug#12040.
6e777848 3617 darwin )
ef834897 3618 AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
6e777848
GM
3619 dnl Not used, because PTY_ITERATION is defined.
3620 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
0ab7b23a
GM
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.
ef834897
GM
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, [])
6e777848
GM
3627 ;;
3628
1598ef28 3629 gnu | openbsd )
6e777848
GM
3630 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
3631 ;;
3632
1598ef28 3633 gnu-linux | gnu-kfreebsd | freebsd | netbsd )
6e777848
GM
3634 dnl if HAVE_GRANTPT
3635 if test "x$ac_cv_func_grantpt" = xyes; then
3e91a053 3636 AC_DEFINE(UNIX98_PTYS, 1, [Define if the system has Unix98 PTYs.])
ef834897 3637 AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
3f922c37
GM
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.
2fe28299 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); }])
1598ef28
JB
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)])
a09710e9 3644 AC_DEFINE(PTY_NAME_SPRINTF, [])
0ab7b23a 3645 dnl if HAVE_GETPT
1598ef28 3646 elif test "x$ac_cv_func_getpt" = xyes; then
0ab7b23a 3647 AC_DEFINE(PTY_OPEN, [fd = getpt ()])
ef834897 3648 AC_DEFINE(PTY_NAME_SPRINTF, [])
3f922c37 3649 else
ef834897 3650 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
0ab7b23a 3651 fi
6e777848
GM
3652 else
3653 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
3654 fi
3655 ;;
3656
3f922c37
GM
3657 hpux*)
3658 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
ef834897
GM
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);])
3f922c37
GM
3661 ;;
3662
6e777848
GM
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'])
d983a10b 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); }])
5dad233c 3678 dnl No need to get the pty name at all.
ef834897 3679 AC_DEFINE(PTY_NAME_SPRINTF, [])
3f922c37 3680 dnl No need to use sprintf to get the tty name--we get that from _getpty.
ef834897 3681 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
6e777848
GM
3682 ;;
3683
3f922c37 3684 sol2* )
3f922c37
GM
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).
d983a10b 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); }])
3f922c37
GM
3689 ;;
3690
3f922c37 3691 unixware )
33d63ff4 3692 dnl Comments are as per sol2*.
d983a10b 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); }])
33d63ff4
GM
3694 ;;
3695esac
3696
3697
3698case $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.
3f922c37 3702 AC_DEFINE(FIRST_PTY_LETTER, ['z'])
ef834897 3703 AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
33d63ff4
GM
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.])
6e777848
GM
3706 ;;
3707esac
3708
3709
09f4e3b0
GM
3710AH_TEMPLATE(SIGNALS_VIA_CHARACTERS, [Make process_send_signal work by
3711"typing" a signal character on the pty.])
3712
3713case $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.
02e7729e 3716 aix4-2 | cygwin | gnu | irix6-5 | freebsd | netbsd | openbsd | darwin )
09f4e3b0
GM
3717 AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
3718 ;;
3719
5dad233c 3720 dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.
09f4e3b0
GM
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 ;;
3735esac
3736
3737
c8add24e
GM
3738dnl Used in vm-limit.c
3739AH_TEMPLATE(DATA_START, [Address of the start of the data segment.])
3740dnl Used in lisp.h, emacs.c, mem-limits.h
3741dnl NEWS.18 describes this as "a number which contains
3742dnl the high bits to be inclusive or'ed with pointers that are unpacked."
3743AH_TEMPLATE(DATA_SEG_BITS, [Extra bits to be or'd in with any pointers
3744stored in a Lisp_Object.])
3745dnl if Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT.
3746
3747case $opsys in
882cf227
GM
3748 gnu)
3749 dnl libc defines data_start.
3750 AC_DEFINE(DATA_START, [({ extern int data_start; (char *) &data_start; })])
3751 ;;
3752
3753 hpux*)
3754 dnl The data segment on this machine always starts at address 0x40000000.
3755 AC_DEFINE(DATA_START, [0x40000000])
3756 AC_DEFINE(DATA_SEG_BITS, [0x40000000])
3757 ;;
3758 irix6-5)
3759 AC_DEFINE(DATA_START, [0x10000000])
3760 AC_DEFINE(DATA_SEG_BITS, [0x10000000])
3761 ;;
3762esac
3763
7ccad002
GM
3764
3765AH_TEMPLATE(TAB3, [Undocumented.])
3766
b4492cba 3767case $opsys in
7ccad002 3768 darwin) AC_DEFINE(TAB3, OXTABS) ;;
8a07a8c6 3769
7ccad002 3770 gnu | freebsd | netbsd | openbsd )
ef834897 3771 AC_DEFINE(TABDLY, OXTABS, [Undocumented.])
7ccad002
GM
3772 AC_DEFINE(TAB3, OXTABS)
3773 ;;
1cce6920 3774
dbee5793 3775 gnu-linux | gnu-kfreebsd )
5b633342
GM
3776 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
3777#ifndef __ia64__
3778# error "not ia64"
3779#endif
3780 ]], [[]])], AC_DEFINE(GC_MARK_SECONDARY_STACK(),
3781 [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)],
3782 [Mark a secondary stack, like the register stack on the ia64.]), [])
dbee5793
GM
3783 ;;
3784
7ccad002
GM
3785 hpux*)
3786 AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call
3787 run_time_remap; for HPUX.])
3788 ;;
3789esac
3790
3791
444b01bb 3792dnl This won't be used automatically yet. We also need to know, at least,
5b3f250f
GM
3793dnl that the stack is continuous.
3794AH_TEMPLATE(GC_SETJMP_WORKS, [Define if setjmp is known to save all
3795 registers relevant for conservative garbage collection in the jmp_buf.])
3796
5b3f250f
GM
3797
3798case $opsys in
5b3f250f
GM
3799 dnl Not all the architectures are tested, but there are Debian packages
3800 dnl for SCM and/or Guile on them, so the technique must work. See also
3801 dnl comments in alloc.c concerning setjmp and gcc.
3802 dnl Fixme: it's probably safe to just use the GCC conditional below.
3803 gnu-linux | gnu-kfreebsd )
3804 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
3805#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
3806 || defined __alpha__ || defined __mips__ || defined __s390__ \
3807 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
3808 || defined __ia64__ || defined __sh__
3809/* ok */
3810#else
3811# error "setjmp not known to work on this arch"
3812#endif
444b01bb 3813 ]], [[]])], AC_DEFINE(GC_SETJMP_WORKS, 1))
5b3f250f
GM
3814 ;;
3815esac
3816
3817
3818if test x$GCC = xyes; then
3819 dnl GC_SETJMP_WORKS is nearly always appropriate for GCC.
3820 AC_DEFINE(GC_SETJMP_WORKS, 1)
3821else
3822 case $opsys in
3823 dnl irix: Tested on Irix 6.5. SCM worked on earlier versions.
3824 freebsd | netbsd | openbsd | irix6-5 | sol2* )
3825 AC_DEFINE(GC_SETJMP_WORKS, 1)
3826 ;;
3827 esac
3828fi dnl GCC?
3829
7b6c362e
PE
3830AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
3831 [AC_LINK_IFELSE(
3832 [AC_LANG_PROGRAM(
3833 [[#include <setjmp.h>
3834 ]],
3835 [[jmp_buf j;
3836 if (! _setjmp (j))
3837 _longjmp (j, 1);]])],
3838 [emacs_cv_func__setjmp=yes],
3839 [emacs_cv_func__setjmp=no])])
0328b6de
PE
3840if test $emacs_cv_func__setjmp = yes; then
3841 AC_DEFINE([HAVE__SETJMP], 1, [Define to 1 if _setjmp and _longjmp work.])
3842else
3843 AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp],
3844 [AC_LINK_IFELSE(
3845 [AC_LANG_PROGRAM(
3846 [[#include <setjmp.h>
3847 ]],
3848 [[sigjmp_buf j;
3849 if (! sigsetjmp (j, 1))
3850 siglongjmp (j, 1);]])],
3851 [emacs_cv_func_sigsetjmp=yes],
3852 [emacs_cv_func_sigsetjmp=no])])
3853 if test $emacs_cv_func_sigsetjmp = yes; then
3854 AC_DEFINE([HAVE_SIGSETJMP], 1,
3855 [Define to 1 if sigsetjmp and siglongjmp work.
3856 The value of this symbol is irrelevant if HAVE__SETJMP is defined.])
3857 fi
7b6c362e 3858fi
b65e7c46 3859
0a763bd1
GM
3860case $opsys in
3861 sol2* | unixware )
b65e7c46
GM
3862 dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
3863 dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs,
3864 dnl and this is all we need.
3865 AC_DEFINE(TIOCSIGSEND, TIOCSIGNAL, [Some platforms redefine this.])
0a763bd1
GM
3866 ;;
3867esac
3868
5b3f250f 3869
7ccad002
GM
3870case $opsys in
3871 hpux* | sol2* )
32bac6d6 3872 dnl Used in xfaces.c.
7ccad002
GM
3873 AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on
3874 some systems, where it requires time.h.])
3875 ;;
3876esac
3877
3878
983188fd
GM
3879dnl Define symbols to identify the version of Unix this is.
3880dnl Define all the symbols that apply correctly.
983188fd 3881AH_TEMPLATE(BSD_SYSTEM, [Define if the system is compatible with BSD 4.2.])
ae21c275
GM
3882AH_TEMPLATE(DOS_NT, [Define if the system is MS DOS or MS Windows.])
3883AH_TEMPLATE(MSDOS, [Define if the system is MS DOS.])
983188fd
GM
3884AH_TEMPLATE(USG, [Define if the system is compatible with System III.])
3885AH_TEMPLATE(USG5, [Define if the system is compatible with System V.])
268e2432 3886AH_TEMPLATE(USG5_4, [Define if the system is compatible with System V Release 4.])
983188fd
GM
3887
3888case $opsys in
3889 aix4-2)
3890 AC_DEFINE(USG, [])
3891 AC_DEFINE(USG5, [])
3892 dnl This symbol should be defined on AIX Version 3 ???????
3893 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
3894#ifndef _AIX
3895# error "_AIX not defined"
3896#endif
3897 ]], [[]])], [], AC_DEFINE(_AIX, [], [Define if the system is AIX.]))
3898 ;;
3899
3900 cygwin)
3901 AC_DEFINE(CYGWIN, 1, [Define if the system is Cygwin.])
3902 ;;
3903
3904 darwin)
3905 dnl BSD4_3 and BSD4_4 are already defined in sys/param.h.
983188fd
GM
3906 AC_DEFINE(BSD_SYSTEM, [])
3907 dnl More specific than the above two. We cannot use __APPLE__ as this
3908 dnl may not be defined on non-OSX Darwin, and we cannot define DARWIN
3909 dnl here because Panther and lower CoreFoundation.h uses DARWIN to
3910 dnl distinguish OS X from pure Darwin.
3911 AC_DEFINE(DARWIN_OS, [], [Define if the system is Darwin.])
3912 ;;
3913
3914 freebsd)
983188fd
GM
3915 dnl Hack to avoid calling AC_PREPROC_IFELSE multiple times.
3916 dnl Would not be needed with autoconf >= 2.67, where the
3917 dnl preprocessed output is accessible in "conftest.i".
3918 AC_DEFINE(BSD_SYSTEM_AHB, 1, [Define if AH_BOTTOM should change BSD_SYSTEM.])
3919 ;;
3920
3921 gnu | netbsd | openbsd )
983188fd
GM
3922 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
3923#ifndef BSD_SYSTEM
3924# error "BSD_SYSTEM not defined"
3925#endif
3926 ]], [[]])], [], AC_DEFINE(BSD_SYSTEM, 43) )
3927 ;;
3928
3929 gnu-linux | gnu-kfreebsd )
3930 AC_DEFINE(USG, [])
3931 AC_DEFINE(GNU_LINUX, [], [Define if ths system is compatible with GNU/Linux.])
3932 ;;
3933
3934 hpux*)
3935 AC_DEFINE(USG, [])
3936 AC_DEFINE(USG5, [])
3937 AC_DEFINE(HPUX, [], [Define if the system is HPUX.])
3938 ;;
3939
3940 irix6-5)
3941 AC_DEFINE(USG, [])
3942 AC_DEFINE(USG5, [])
268e2432 3943 AC_DEFINE(USG5_4, [])
983188fd
GM
3944 AC_DEFINE(IRIX6_5, [], [Define if the system is IRIX.])
3945 ;;
3946
3947 sol2*)
3948 AC_DEFINE(USG, [])
3949 AC_DEFINE(USG5, [])
268e2432 3950 AC_DEFINE(USG5_4, [])
983188fd
GM
3951 AC_DEFINE(SOLARIS2, [], [Define if the system is Solaris.])
3952 ;;
3953
3954 unixware)
3955 AC_DEFINE(USG, [])
3956 AC_DEFINE(USG5, [])
268e2432 3957 AC_DEFINE(USG5_4, [])
983188fd
GM
3958 ;;
3959esac
3960
4a4bbad2
PE
3961AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
3962 [case $opsys in
3963 aix4-2)
3964 dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
3965 emacs_cv_usable_FIONREAD=no
3966 ;;
3967
3968 *)
3969 AC_COMPILE_IFELSE(
3970 [AC_LANG_PROGRAM([[#include <sys/types.h>
3971 #include <sys/ioctl.h>
3972 #ifdef USG5_4
3973 # include <sys/filio.h>
3974 #endif
3975 ]],
3976 [[int foo = ioctl (0, FIONREAD, &foo);]])],
3977 [emacs_cv_usable_FIONREAD=yes],
3978 [emacs_cv_usable_FIONREAD=no])
3979 ;;
3980 esac])
3981if test $emacs_cv_usable_FIONREAD = yes; then
3982 AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.])
3983
3984 if test $emacs_broken_SIGIO = no; then
3985 AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO],
3986 [AC_COMPILE_IFELSE(
3987 [AC_LANG_PROGRAM([[#include <fcntl.h>
3988 #include <signal.h>
3989 ]],
3990 [[int foo = SIGIO | F_SETFL | FASYNC;]])],
3991 [emacs_cv_usable_SIGIO=yes],
3992 [emacs_cv_usable_SIGIO=no])],
3993 [emacs_cv_usable_SIGIO=yes],
3994 [emacs_cv_usable_SIGIO=no])
3995 if test $emacs_cv_usable_SIGIO = yes; then
3996 AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.])
3997 fi
3998 fi
3999fi
4000
983188fd 4001
7ccad002 4002case $opsys in
42bd1719
GM
4003 dnl Emacs supplies its own malloc, but glib (part of Gtk+) calls
4004 dnl memalign and on Cygwin, that becomes the Cygwin-supplied memalign.
4005 dnl As malloc is not the Cygwin malloc, the Cygwin memalign always
4006 dnl returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */
4007 cygwin)
4008 AC_DEFINE(G_SLICE_ALWAYS_MALLOC, 1, [Define to set the
4009 G_SLICE environment variable to "always-malloc" at startup, if
4010 using GTK.])
4011 ;;
4012
7ccad002 4013 hpux11)
7ccad002
GM
4014 dnl It works to open the pty's tty in the parent (Emacs), then
4015 dnl close and reopen it in the child.
4016 AC_DEFINE(USG_SUBTTY_WORKS, 1, [Define for USG systems where it
4017 works to open a pty's tty in the parent process, then close and
4018 reopen it in the child.])
7ccad002
GM
4019 ;;
4020
4021 irix6-5)
4022 AC_DEFINE(PREFER_VSUSP, 1, [Define if process_send_signal should
4023 use VSUSP instead of VSWTCH.])
7ccad002
GM
4024 ;;
4025
7ccad002
GM
4026 sol2-10)
4027 AC_DEFINE(_STRUCTURED_PROC, 1, [Needed for system_process_attributes
4028 on Solaris.])
7ccad002 4029 ;;
0d369729
GM
4030esac
4031
067d23c9
KY
4032# Set up the CFLAGS for real compilation, so we can substitute it.
4033CFLAGS="$REAL_CFLAGS"
4034CPPFLAGS="$REAL_CPPFLAGS"
4035
4036## Hack to detect a buggy GCC version.
4037if test "x$GCC" = xyes \
4038 && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \
4039 && test x"`echo $CFLAGS | grep '\-O@<:@23@:>@'`" != x \
4040 && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then
4041 AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'.])
4042fi
4043
16fab143 4044version=$PACKAGE_VERSION
067d23c9 4045
ab422c4d 4046copyright="Copyright (C) 2013 Free Software Foundation, Inc."
78f83752
GM
4047AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"],
4048 [Short copyright string for this version of Emacs.])
4049AC_SUBST(copyright)
4050
067d23c9
KY
4051### Specify what sort of things we'll be editing into Makefile and config.h.
4052### Use configuration here uncanonicalized to avoid exceeding size limits.
4053AC_SUBST(version)
4054AC_SUBST(configuration)
4055## Unused?
4056AC_SUBST(canonical)
4057AC_SUBST(srcdir)
4058AC_SUBST(prefix)
4059AC_SUBST(exec_prefix)
4060AC_SUBST(bindir)
4061AC_SUBST(datadir)
4062AC_SUBST(sharedstatedir)
4063AC_SUBST(libexecdir)
4064AC_SUBST(mandir)
4065AC_SUBST(infodir)
4066AC_SUBST(lispdir)
d71dfe75 4067AC_SUBST(leimdir)
ca26824c 4068AC_SUBST(standardlisppath)
067d23c9
KY
4069AC_SUBST(locallisppath)
4070AC_SUBST(lisppath)
4071AC_SUBST(x_default_search_path)
4072AC_SUBST(etcdir)
4073AC_SUBST(archlibdir)
4074AC_SUBST(docdir)
4075AC_SUBST(bitmapdir)
4076AC_SUBST(gamedir)
4077AC_SUBST(gameuser)
4078## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
4079## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
4080## end of LIBX_BASE, but nothing ever set it.
4081AC_SUBST(LD_SWITCH_X_SITE)
4082AC_SUBST(C_SWITCH_X_SITE)
2f097256 4083AC_SUBST(GNUSTEP_CFLAGS)
067d23c9
KY
4084AC_SUBST(CFLAGS)
4085## Used in lwlib/Makefile.in.
4086AC_SUBST(X_TOOLKIT_TYPE)
067d23c9
KY
4087AC_SUBST(ns_appdir)
4088AC_SUBST(ns_appbindir)
4089AC_SUBST(ns_appresdir)
4090AC_SUBST(ns_appsrc)
4091AC_SUBST(GNU_OBJC_CFLAGS)
4092AC_SUBST(OTHER_FILES)
4093
17a2cbbd
DC
4094if test -n "${term_header}"; then
4095 AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}",
4096 [Define to the header for the built-in window system.])
4097fi
4098
067d23c9
KY
4099AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
4100 [Define to the canonical Emacs configuration name.])
60f5e585 4101dnl Replace any embedded " characters (bug#13274).
8b0590de 4102emacs_config_options=`echo "$emacs_config_options " | sed -e 's/--no-create //' -e 's/--no-recursion //' -e 's/ *$//' -e "s/\"/'/g"`
60f5e585 4103AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}",
067d23c9 4104 [Define to the options passed to configure.])
68169a33
GM
4105AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure
4106 define this to include extra configuration information.])
067d23c9
KY
4107
4108XMENU_OBJ=
4109XOBJ=
4110FONT_OBJ=
4111if test "${HAVE_X_WINDOWS}" = "yes" ; then
4112 AC_DEFINE(HAVE_X_WINDOWS, 1,
4113 [Define to 1 if you want to use the X window system.])
4114 XMENU_OBJ=xmenu.o
17a2cbbd 4115 XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o"
067d23c9
KY
4116 FONT_OBJ=xfont.o
4117 if test "$HAVE_XFT" = "yes"; then
4118 FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
4119 elif test "$HAVE_FREETYPE" = "yes"; then
4120 FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
4121 fi
4122 AC_SUBST(FONT_OBJ)
4123fi
4124AC_SUBST(XMENU_OBJ)
4125AC_SUBST(XOBJ)
4126AC_SUBST(FONT_OBJ)
4127
4128WIDGET_OBJ=
4129MOTIF_LIBW=
4130if test "${USE_X_TOOLKIT}" != "none" ; then
4131 WIDGET_OBJ=widget.o
4132 AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
4133 if test "${USE_X_TOOLKIT}" = "LUCID"; then
4134 AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.])
4135 elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
4136 AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.])
4137 MOTIF_LIBW=-lXm
4138 case "$opsys" in
4139 gnu-linux)
4140 ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
4141 MOTIF_LIBW="$MOTIF_LIBW -lXpm"
4142 ;;
4143
4144 unixware)
4145 ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
4146 ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
4147 MOTIF_LIBW="MOTIF_LIBW -lXimp"
4148 ;;
4149
4150 aix4-2)
4151 ## olson@mcs.anl.gov says -li18n is needed by -lXm.
4152 MOTIF_LIBW="$MOTIF_LIBW -li18n"
4153 ;;
4154 esac
4155 MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
4156 fi
4157fi
4158AC_SUBST(WIDGET_OBJ)
4159
4160TOOLKIT_LIBW=
4161case "$USE_X_TOOLKIT" in
4162 MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
4163 LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
4164 none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
4165esac
4166AC_SUBST(TOOLKIT_LIBW)
4167
4168if test "$USE_X_TOOLKIT" = "none"; then
4169 LIBXT_OTHER="\$(LIBXSM)"
4170 OLDXMENU_TARGET="really-oldXMenu"
4171else
4172 LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
4173 OLDXMENU_TARGET="really-lwlib"
4174fi
4175AC_SUBST(LIBXT_OTHER)
4176
4177## The X Menu stuff is present in the X10 distribution, but missing
4178## from X11. If we have X10, just use the installed library;
4179## otherwise, use our own copy.
4180if test "${HAVE_X11}" = "yes" ; then
4181 AC_DEFINE(HAVE_X11, 1,
4182 [Define to 1 if you want to use version 11 of X windows.
4183 Otherwise, Emacs expects to use version 10.])
4184
4185 if test "$USE_X_TOOLKIT" = "none"; then
4186 OLDXMENU="\${oldXMenudir}/libXMenu11.a"
4187 else
4188 OLDXMENU="\${lwlibdir}/liblw.a"
4189 fi
4190 LIBXMENU="\$(OLDXMENU)"
4191 LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
4192 OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
4193else
4194 ## For a syntactically valid Makefile; not actually used for anything.
4195 ## See comments in src/Makefile.in.
4196 OLDXMENU=nothing
4197 ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
4198 if test "${HAVE_X_WINDOWS}" = "yes"; then
4199 LIBXMENU="-lXMenu"
4200 else
4201 LIBXMENU=
4202 fi
4203 LIBX_OTHER=
4204 OLDXMENU_DEPS=
4205fi
4206
4207if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
4208 OLDXMENU_TARGET=
b06b1098 4209 OLDXMENU=nothing
067d23c9
KY
4210 LIBXMENU=
4211 OLDXMENU_DEPS=
4212fi
4213
4214AC_SUBST(OLDXMENU_TARGET)
4215AC_SUBST(OLDXMENU)
4216AC_SUBST(LIBXMENU)
4217AC_SUBST(LIBX_OTHER)
4218AC_SUBST(OLDXMENU_DEPS)
4219
4220if test "${HAVE_MENUS}" = "yes" ; then
4221 AC_DEFINE(HAVE_MENUS, 1,
4222 [Define to 1 if you have mouse menus.
4223 (This is automatic if you use X, but the option to specify it remains.)
4224 It is also defined with other window systems that support xmenu.c.])
4225fi
4226
4227if test "${GNU_MALLOC}" = "yes" ; then
4228 AC_DEFINE(GNU_MALLOC, 1,
4229 [Define to 1 if you want to use the GNU memory allocator.])
4230fi
4231
4232RALLOC_OBJ=
4233if test "${REL_ALLOC}" = "yes" ; then
4234 AC_DEFINE(REL_ALLOC, 1,
4235 [Define REL_ALLOC if you want to use the relocating allocator for
4236 buffer space.])
4237
4238 test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
4239fi
4240AC_SUBST(RALLOC_OBJ)
4241
4242if test "$opsys" = "cygwin"; then
0fda9b75 4243 CYGWIN_OBJ="sheap.o cygw32.o"
067d23c9
KY
4244 ## Cygwin differs because of its unexec().
4245 PRE_ALLOC_OBJ=
4246 POST_ALLOC_OBJ=lastfile.o
4247else
4248 CYGWIN_OBJ=
4249 PRE_ALLOC_OBJ=lastfile.o
4250 POST_ALLOC_OBJ=
4251fi
4252AC_SUBST(CYGWIN_OBJ)
4253AC_SUBST(PRE_ALLOC_OBJ)
4254AC_SUBST(POST_ALLOC_OBJ)
4255
5dad233c
PE
4256# Configure gnulib. Although this does not affect CFLAGS or LIBS permanently.
4257# it temporarily reverts them to their pre-pkg-config values,
4258# because gnulib needs to work with both src (which uses the
4259# pkg-config stuff) and lib-src (which does not). For example, gnulib
4260# may need to determine whether LIB_CLOCK_GETTIME should contain -lrt,
4261# and it therefore needs to run in an environment where LIBS does not
4262# already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
4263# for some package unrelated to lib-src.
4264SAVE_CFLAGS=$CFLAGS
4265SAVE_LIBS=$LIBS
4266CFLAGS=$pre_PKG_CONFIG_CFLAGS
4267LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
4268gl_ASSERT_NO_GNULIB_POSIXCHECK
4269gl_ASSERT_NO_GNULIB_TESTS
4270gl_INIT
4271CFLAGS=$SAVE_CFLAGS
4272LIBS=$SAVE_LIBS
4273
067d23c9
KY
4274case "$opsys" in
4275 aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
4276
4277 darwin)
4278 ## The -headerpad option tells ld (see man page) to leave room at the
4279 ## end of the header for adding load commands. Needed for dumping.
4280 ## 0x690 is the total size of 30 segment load commands (at 56
4281 ## each); under Cocoa 31 commands are required.
4282 if test "$HAVE_NS" = "yes"; then
4283 libs_nsgui="-framework AppKit"
4284 headerpad_extra=6C8
4285 else
4286 libs_nsgui=
4287 headerpad_extra=690
4288 fi
c8618a06 4289 LD_SWITCH_SYSTEM_TEMACS="-fno-pie -prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra"
b06b1098 4290
067d23c9
KY
4291 ## This is here because src/Makefile.in did some extra fiddling around
4292 ## with LD_SWITCH_SYSTEM. The cpp logic was:
4293 ## #ifndef LD_SWITCH_SYSTEM
4294 ## #if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
4295 ## Since all the *bsds define LD_SWITCH_SYSTEM, this simplifies to:
34374650 4296 ## not using gcc, darwin.
067d23c9
KY
4297 ## Because this was done in src/Makefile.in, the resulting part of
4298 ## LD_SWITCH_SYSTEM was not used in configure (ie, in ac_link).
4299 ## It therefore seems cleaner to put this in LD_SWITCH_SYSTEM_TEMACS,
4300 ## rather than LD_SWITCH_SYSTEM.
4301 test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
4302 LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
4303 ;;
4304
4d5c6349 4305 ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
4737362e
GM
4306 ## find X at run-time.
4307 ## When handled by cpp, this was in LD_SWITCH_SYSTEM. However, at the
4d5c6349 4308 ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
067d23c9
KY
4309 ## had not yet been defined and was expanded to null. Hence LD_SWITCH_SYSTEM
4310 ## had different values in configure (in ac_link) and src/Makefile.in.
4311 ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
4d5c6349 4312 gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
067d23c9
KY
4313
4314 *) LD_SWITCH_SYSTEM_TEMACS= ;;
4315esac
4316
067d23c9
KY
4317AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
4318
4319
4320LD_FIRSTFLAG=
4321ORDINARY_LINK=
4322case "$opsys" in
4323 ## gnu: GNU needs its own crt0.
4324 aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
4325
4326 ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
4327 ## library search parth, i.e. it won't search /usr/lib for libc and
4328 ## friends. Using -nostartfiles instead avoids this problem, and
4329 ## will also work on earlier NetBSD releases.
4330 netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;;
4331
34374650 4332 ## powerpc*: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
067d23c9 4333 ## MkLinux/LinuxPPC needs this.
34374650 4334 ## s390x-* only supports opsys = gnu-linux so it can be added here.
067d23c9 4335 gnu-*)
34374650
PE
4336 case "$canonical" in
4337 powerpc*|s390x-*) LD_FIRSTFLAG="-nostdlib" ;;
067d23c9
KY
4338 esac
4339 ;;
4340esac
4341
4342
4343if test "x$ORDINARY_LINK" = "xyes"; then
4344
4345 LD_FIRSTFLAG=""
4346 AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
4347
4348## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are:
34374650 4349## freebsd, gnu-* not on powerpc*|s390x*.
067d23c9
KY
4350elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then
4351
4352 ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
4353 ## places that are difficult to figure out at make time. Fortunately,
4354 ## these same versions allow you to pass arbitrary flags on to the
4355 ## linker, so there is no reason not to use it as a linker.
4356 ##
4357 ## Well, it is not quite perfect. The "-nostdlib" keeps GCC from
4358 ## searching for libraries in its internal directories, so we have to
4359 ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
4360 LD_FIRSTFLAG="-nostdlib"
4361fi
4362
4363## FIXME? What setting of EDIT_LDFLAGS should this have?
4364test "$NS_IMPL_GNUSTEP" = "yes" && LD_FIRSTFLAG="-rdynamic"
4365
4366AC_SUBST(LD_FIRSTFLAG)
4367
4368
4369## FIXME? The logic here is not precisely the same as that above.
4370## There is no check here for a pre-defined LD_FIRSTFLAG.
4371## Should we only be setting LIB_GCC if LD ~ -nostdlib?
4372LIB_GCC=
4373if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
4374
4375 case "$opsys" in
4376 freebsd|netbsd|openbsd) LIB_GCC= ;;
4377
4378 gnu-*)
4379 ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
4380 ## build on ARM EABI under GNU/Linux. (Bug#5518)
d6a003a8
AS
4381 case $host_cpu in
4382 arm*)
067d23c9 4383 LIB_GCC="-lgcc_s"
d6a003a8
AS
4384 ;;
4385 *)
067d23c9
KY
4386 ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
4387 ## immediately undefine it again and redefine it to empty.
4388 ## Was the C_SWITCH_X_SITE part really necessary?
4389## LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
4390 LIB_GCC=
d6a003a8
AS
4391 ;;
4392 esac
067d23c9
KY
4393 ;;
4394
4395 ## Ask GCC where to find libgcc.a.
4396 *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
4397 esac
4398fi dnl if $GCC
4399AC_SUBST(LIB_GCC)
4400
17a2cbbd
DC
4401## Common for all window systems
4402if test "$window_system" != "none"; then
067d23c9 4403 AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
17a2cbbd 4404 WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o"
067d23c9 4405fi
067d23c9 4406
17a2cbbd 4407AC_SUBST(WINDOW_SYSTEM_OBJ)
067d23c9
KY
4408
4409AH_TOP([/* GNU Emacs site configuration template file.
73b0cd50 4410
f0ddbf7b 4411Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2013
73b0cd50 4412 Free Software Foundation, Inc.
067d23c9
KY
4413
4414This file is part of GNU Emacs.
4415
4416GNU Emacs is free software: you can redistribute it and/or modify
4417it under the terms of the GNU General Public License as published by
4418the Free Software Foundation, either version 3 of the License, or
4419(at your option) any later version.
4420
4421GNU Emacs is distributed in the hope that it will be useful,
4422but WITHOUT ANY WARRANTY; without even the implied warranty of
4423MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4424GNU General Public License for more details.
4425
4426You should have received a copy of the GNU General Public License
4427along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
4428
4429
4430/* No code in Emacs #includes config.h twice, but some bits of code
4431 intended to work with other packages as well (like gmalloc.c)
4432 think they can include it as many times as they like. */
4433#ifndef EMACS_CONFIG_H
4434#define EMACS_CONFIG_H
4435])dnl
4436
b429a4ee 4437AH_BOTTOM([#include <conf_post.h>
067d23c9 4438
067d23c9
KY
4439#endif /* EMACS_CONFIG_H */
4440
4441/*
4442Local Variables:
4443mode: c
4444End:
4445*/
4446])dnl
4447
4448#### Report on what we decided to do.
4449#### Report GTK as a toolkit, even if it doesn't use Xt.
4450#### It makes printing result more understandable as using GTK sets
4451#### toolkit_scroll_bars to yes by default.
4452if test "${HAVE_GTK}" = "yes"; then
5fb91e71 4453 USE_X_TOOLKIT="$USE_GTK_TOOLKIT"
067d23c9
KY
4454fi
4455
4456echo "
4457Configured for \`${canonical}'.
4458
4459 Where should the build process find the source code? ${srcdir}
067d23c9
KY
4460 What compiler should emacs be built with? ${CC} ${CFLAGS}
4461 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
4462 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
4463 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
4464 What window system should Emacs use? ${window_system}
4465 What toolkit should Emacs use? ${USE_X_TOOLKIT}"
4466
4467if test -n "${x_includes}"; then
4468echo " Where do we find X Windows header files? ${x_includes}"
4469else
4470echo " Where do we find X Windows header files? Standard dirs"
4471fi
4472if test -n "${x_libraries}"; then
4473echo " Where do we find X Windows libraries? ${x_libraries}"
4474else
4475echo " Where do we find X Windows libraries? Standard dirs"
4476fi
4477
4478echo " Does Emacs use -lXaw3d? ${HAVE_XAW3D}"
4479echo " Does Emacs use -lXpm? ${HAVE_XPM}"
4480echo " Does Emacs use -ljpeg? ${HAVE_JPEG}"
4481echo " Does Emacs use -ltiff? ${HAVE_TIFF}"
4482echo " Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF"
4483echo " Does Emacs use -lpng? ${HAVE_PNG}"
4484echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
4485echo " Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}"
4486
4487echo " Does Emacs use -lgpm? ${HAVE_GPM}"
4488echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
4489echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
9851bfc5 4490echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}"
067d23c9 4491echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
9f77899d 4492echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
067d23c9
KY
4493echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
4494
4495echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
4496echo " Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}"
4497echo " Does Emacs use -lotf? ${HAVE_LIBOTF}"
4498echo " Does Emacs use -lxft? ${HAVE_XFT}"
4499
4500echo " Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
4501echo
4502
5f77c86c
GM
4503if test -n "${EMACSDATA}"; then
4504 echo " Environment variable EMACSDATA set to: $EMACSDATA"
4505fi
4506if test -n "${EMACSDOC}"; then
4507 echo " Environment variable EMACSDOC set to: $EMACSDOC"
4508fi
4509
067d23c9
KY
4510echo
4511
4512if test "$HAVE_NS" = "yes"; then
4513 echo
507ea258 4514 echo "You must run \"${MAKE-make} install\" in order to test the built application.
067d23c9
KY
4515The installed application will go to nextstep/Emacs.app and can be
4516run or moved from there."
4517 if test "$EN_NS_SELF_CONTAINED" = "yes"; then
4518 echo "The application will be fully self-contained."
4519 else
4520 echo "The lisp resources for the application will be installed under ${prefix}.
507ea258 4521You may need to run \"${MAKE-make} install\" with sudo. The application will fail
067d23c9
KY
4522to run if these resources are not installed."
4523 fi
4524 echo
4525fi
4526
badf86af
KB
4527if test "${opsys}" = "cygwin"; then
4528 case `uname -r` in
4529 1.5.*) AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]])
4530 echo
4531 ;;
4532 esac
4533fi
067d23c9
KY
4534
4535# Remove any trailing slashes in these variables.
4536[test "${prefix}" != NONE &&
4537 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
4538test "${exec_prefix}" != NONE &&
4539 exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
4540
83da1b55
GM
4541if test "$HAVE_NS" = "yes"; then
4542 if test "$NS_IMPL_GNUSTEP" = yes; then
4543 AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \
4544 nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in])
4545 else
4546 AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \
4547 nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in])
4548 fi
4549fi
4550
bdd556a2 4551dnl Obviously there is duplication here wrt $SUBDIR_MAKEFILES.
d0ff0c7d
GM
4552dnl You _can_ use that variable in AC_CONFIG_FILES, so long as any directory
4553dnl using automake (ie lib/) is explicitly listed and not "hidden" in a variable
bdd556a2
GM
4554dnl (else you get "no `Makefile.am' found for any configure output").
4555dnl This will work, but you get a config.status that is not quite right
4556dnl (see http://lists.gnu.org/archive/html/bug-autoconf/2008-08/msg00028.html).
4557dnl That doesn't have any obvious consequences for Emacs, but on the whole
4558dnl it seems better to just live with the duplication.
83da1b55 4559SUBDIR_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"
bdd556a2
GM
4560
4561AC_CONFIG_FILES([Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile \
4562 doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
4563 doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile \
83da1b55 4564 leim/Makefile nextstep/Makefile])
6c7e099d
GM
4565
4566dnl test/ is not present in release tarfiles.
70716b1d
GM
4567opt_makefile=test/automated/Makefile
4568
3cc53d60 4569if test -f "$srcdir/$opt_makefile.in"; then
70716b1d 4570 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
bdd556a2
GM
4571 dnl Again, it's best not to use a variable. Though you can add
4572 dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
4573 AC_CONFIG_FILES([test/automated/Makefile])
4574fi
70716b1d 4575
a9f72fc1
GM
4576
4577dnl admin/ may or may not be present.
4578opt_makefile=admin/unidata/Makefile
4579
3cc53d60 4580if test -f "$srcdir/$opt_makefile.in"; then
a9f72fc1
GM
4581 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
4582 AC_CONFIG_FILES([admin/unidata/Makefile])
4583fi
4584
4585
bdd556a2 4586SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
70716b1d
GM
4587
4588AC_SUBST(SUBDIR_MAKEFILES_IN)
1e8dbdc6
GM
4589
4590dnl Make the necessary directories, if they don't exist.
4591AC_CONFIG_COMMANDS([mkdirs], [
4592for dir in etc lisp ; do
4593 test -d ${dir} || mkdir ${dir}
4594done
4595])
4596
067d23c9
KY
4597dnl You might wonder (I did) why epaths.h is generated by running make,
4598dnl rather than just letting configure generate it from epaths.in.
4599dnl One reason is that the various paths are not fully expanded (see above);
4600dnl eg gamedir=${prefix}/var/games/emacs.
4601dnl Secondly, the GNU Coding standards require that one should be able
4602dnl to run `make prefix=/some/where/else' and override the values set
4603dnl by configure. This also explains the `move-if-change' test and
4604dnl the use of force in the `epaths-force' rule in Makefile.in.
1e8dbdc6 4605AC_CONFIG_COMMANDS([epaths], [
067d23c9 4606echo creating src/epaths.h
8f25abd3 4607${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
f04940ae 4608], [GCC="$GCC" CPPFLAGS="$CPPFLAGS"])
067d23c9 4609
1e8dbdc6 4610AC_CONFIG_COMMANDS([gdbinit], [
3cc53d60 4611if test ! -f src/.gdbinit && test -f "$srcdir/src/.gdbinit"; then
067d23c9 4612 echo creating src/.gdbinit
75d7aa24 4613 echo "source $srcdir/src/.gdbinit" > src/.gdbinit
067d23c9 4614fi
1e8dbdc6 4615])
067d23c9 4616
1e8dbdc6 4617AC_OUTPUT