Fix dates for ChangeLog merge entries
[bpt/emacs.git] / configure.in
CommitLineData
6e502e37 1dnl Autoconf script for GNU Emacs
9ec10b2f
DM
2dnl To rebuild the `configure' script from this, execute the command
3dnl autoconf
4dnl in the directory containing this script.
6e502e37 5dnl
89ce934d 6dnl Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
57ebf0be 7dnl 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
552dfe31 8dnl
6e502e37 9dnl This file is part of GNU Emacs.
552dfe31 10dnl
6e502e37
RS
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
fca4a5de 13dnl the Free Software Foundation; either version 3, or (at your option)
6e502e37 14dnl any later version.
552dfe31 15dnl
6e502e37
RS
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
1fb87c77 22dnl along with GNU Emacs; see the file COPYING. If not, write to the
0d07bc90
LK
23dnl Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24dnl Boston, MA 02110-1301, USA.
6e502e37 25
ba8c1935 26AC_PREREQ(2.61)dnl
9cf8f393 27AC_INIT(emacs, 23.0.50)
5f8c8f00 28AC_CONFIG_HEADER(src/config.h:src/config.in)
9fb1ba80 29AC_CONFIG_SRCDIR(src/lisp.h)
9ec10b2f 30
a4663fed
PJ
31dnl Support for --program-prefix, --program-suffix and
32dnl --program-transform-name options
33AC_ARG_PROGRAM
34
9ec10b2f 35lispdir='${datadir}/emacs/${version}/lisp'
4be21f66 36locallisppath='${datadir}/emacs/${version}/site-lisp:'\
b8225171
KH
37'${datadir}/emacs/site-lisp'
38lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
9ec10b2f 39etcdir='${datadir}/emacs/${version}/etc'
60c3568d 40archlibdir='${libexecdir}/emacs/${version}/${configuration}'
9ec10b2f 41docdir='${datadir}/emacs/${version}/etc'
b914de74 42gamedir='${localstatedir}/games/emacs'
93c05c18
CW
43
44gameuser=games
9ec10b2f 45
eb11f5b8
TTN
46dnl Autoconf is so much less fun under VMS, maybe
47dnl because everything is less fun under VMS. --ttn
48AC_DEFUN([EMACS_ARG_Y],[dnl
49AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[$3],[$4])dnl
50])dnl
51AC_DEFUN([EMACS_ARG_N],[dnl
52AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[$3],[$4])dnl
53])dnl
54
55EMACS_ARG_N([gcc],[don't use GCC to compile Emacs if GCC is found])
56
57EMACS_ARG_N([pop],[don't support POP mail retrieval with movemail],
6fa064b6
DL
58[if test "$withval" = yes; then
59 AC_DEFINE(MAIL_USE_POP)
60else :
3d9fec71
DL
61fi],
62AC_DEFINE(MAIL_USE_POP))
5e7d772d 63AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
eb11f5b8
TTN
64
65EMACS_ARG_Y([kerberos],[support Kerberos-authenticated POP],
ae61688f
CY
66[if test "$withval" = yes; then
67 AC_DEFINE(KERBEROS)
68fi])
5e7d772d
AS
69AH_TEMPLATE(KERBEROS,
70 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
eb11f5b8
TTN
71
72EMACS_ARG_Y([kerberos5],[support Kerberos version 5 authenticated POP],
a21616bd
KR
73[if test "${with_kerberos5+set}" = set; then
74 if test "${with_kerberos+set}" != set; then
75 with_kerberos=yes
76 AC_DEFINE(KERBEROS)
77 fi
ae61688f
CY
78 AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
79fi])
eb11f5b8
TTN
80
81EMACS_ARG_Y([hesiod],[support Hesiod to get the POP server host],
ae61688f
CY
82[if test "$withval" = yes; then
83 AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
84fi])
3d9830e5 85
eb11f5b8 86EMACS_ARG_N([sound],[don't compile with sound support])
3d9830e5 87
4f734bde
DM
88dnl This should be the last --with option, because --with-x is
89dnl added later on when we find the path of X, and it's best to
90dnl keep them together visually.
eb11f5b8
TTN
91AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
92 [use an X toolkit (KIT one of: yes, lucid, athena, motif, gtk, no)])],
9ec10b2f 93[ case "${withval}" in
4f823057 94 y | ye | yes ) val=gtk ;;
9ec10b2f
DM
95 n | no ) val=no ;;
96 l | lu | luc | luci | lucid ) val=lucid ;;
84c5c823 97 a | at | ath | athe | athen | athena ) val=athena ;;
3cd69289 98 m | mo | mot | moti | motif ) val=motif ;;
488dd4c4 99 g | gt | gtk ) val=gtk ;;
9ec10b2f 100 * )
f7b4f5aa 101AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
488dd4c4 102this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
f7b4f5aa 103`yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
9ec10b2f
DM
104 ;;
105 esac
106 with_x_toolkit=$val
107])
eb11f5b8
TTN
108
109EMACS_ARG_Y([xpm],[use -lXpm for displaying XPM images])
110EMACS_ARG_Y([jpeg],[use -ljpeg for displaying JPEG images])
111EMACS_ARG_Y([tiff],[use -ltiff for displaying TIFF images])
112EMACS_ARG_Y([gif],[use -lgif (or -lungif) for displaying GIF images])
113EMACS_ARG_Y([png],[use -lpng for displaying PNG images])
114EMACS_ARG_Y([gpm],[use -lgpm for mouse support on a GNU/Linux console])
115EMACS_ARG_Y([rsvg],[use -lrsvg-2 for displaying SVG images])
116EMACS_ARG_Y([gtk],[use GTK (same as --with-x-toolkit=gtk)])
117EMACS_ARG_Y([pkg-config-prog],[Path to pkg-config for finding GTK and librsvg])
118EMACS_ARG_N([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
119EMACS_ARG_N([xaw3d],[don't use Xaw3d])
120EMACS_ARG_N([xim],[don't use X11 XIM])
121EMACS_ARG_N([carbon],[don't use Carbon GUI on Mac OS X])
209a3a86 122EMACS_ARG_Y([dbus],[use D-Bus])
eb11f5b8 123
52cd7d02 124AC_ARG_ENABLE(carbon-app,
1eb22088
AS
125[AS_HELP_STRING([--enable-carbon-app@<:@=DIR@:>@],
126 [specify install directory for Emacs.app on Mac OS X
127 [DIR=/Application]])],
52cd7d02 128[ carbon_appdir_x=${enableval}])
9ec10b2f 129
d0098f13 130AC_ARG_ENABLE(asserts,
1eb22088 131[AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
d0098f13
JD
132 USE_XASSERTS=$enableval,
133 USE_XASSERTS=no)
134
6a5f7a29 135AC_ARG_ENABLE(maintainer-mode,
1eb22088
AS
136[AS_HELP_STRING([--enable-maintainer-mode],
137 [enable make rules and dependencies not useful (and sometimes
138 confusing) to the casual installer])],
6a5f7a29
AS
139 USE_MAINTAINER_MODE=$enableval,
140 USE_MAINTAINER_MODE=no)
141if test $USE_MAINTAINER_MODE = yes; then
142 MAINT=
143else
144 MAINT=#
145fi
146AC_SUBST(MAINT)
147
261967be 148AC_ARG_ENABLE(locallisppath,
1eb22088
AS
149[AS_HELP_STRING([--enable-locallisppath=PATH],
150 [directories Emacs should search for lisp files specific
151 to this site])],
261967be
LK
152if test "${enableval}" = "no"; then
153 locallisppath=
154elif test "${enableval}" != "yes"; then
155 locallisppath=${enableval}
156fi)
157
9ec10b2f 158#### Make srcdir absolute, if it isn't already. It's important to
36969de6 159#### avoid running the path through pwd unnecessarily, since pwd can
069df4bf
DM
160#### give you automounter prefixes, which can go away. We do all this
161#### so Emacs can find its files when run uninstalled.
36969de6
GM
162## Make sure CDPATH doesn't affect cd (in case PWD is relative).
163unset CDPATH
9ec10b2f
DM
164case "${srcdir}" in
165 /* ) ;;
166 . )
167 ## We may be able to use the $PWD environment variable to make this
168 ## absolute. But sometimes PWD is inaccurate.
b83e4a77
RS
169 ## Note: we used to use ${PWD} at the end instead of `pwd`,
170 ## but that tested only for a well-formed and valid PWD,
171 ## it did not object when PWD was well-formed and valid but just wrong.
172 if test ".${PWD}" != "." && test ".`(cd ${PWD} ; sh -c pwd)`" = ".`pwd`" ;
9ec10b2f
DM
173 then
174 srcdir="$PWD"
175 else
176 srcdir="`(cd ${srcdir}; pwd)`"
177 fi
178 ;;
179 * ) srcdir="`(cd ${srcdir}; pwd)`" ;;
180esac
181
182#### Check if the source directory already has a configured system in it.
183if test `pwd` != `(cd ${srcdir} && pwd)` \
184 && test -f "${srcdir}/src/config.h" ; then
91b5aa9a 185 AC_MSG_WARN([[The directory tree `${srcdir}' is being used
9ec10b2f
DM
186 as a build directory right now; it has been configured in its own
187 right. To configure in another directory as well, you MUST
188 use GNU make. If you do not have GNU make, then you must
91b5aa9a
DL
189 now do `make distclean' in ${srcdir},
190 and then run $0 again.]])
9ec10b2f
DM
191fi
192
193#### Given the configuration name, set machfile and opsysfile to the
194#### names of the m/*.h and s/*.h files we should use.
195
196### Canonicalize the configuration name.
197
198AC_CANONICAL_HOST
199canonical=$host
0b7543ce 200configuration=${host_alias-${build_alias-$host}}
9ec10b2f 201
91b5aa9a
DL
202dnl This used to use changequote, but, apart from `changequote is evil'
203dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
204dnl the great gob of text. Thus it's not processed for possible expansion.
205dnl Just make sure the brackets remain balanced.
10aa5486
MR
206dnl
207dnl Since Emacs can't find matching pairs of quotes, boundaries are
208dnl indicated by comments.
209dnl quotation begins
91b5aa9a 210[
9ec10b2f
DM
211
212### If you add support for a new configuration, add code to this
213### switch statement to recognize your configuration name and select
214### the appropriate operating system and machine description files.
215
216### You would hope that you could choose an m/*.h file pretty much
217### based on the machine portion of the configuration name, and an s-
218### file based on the operating system portion. However, it turns out
219### that each m/*.h file is pretty manufacturer-specific - for
f3041af1
DN
220### example hp9000s300.h is a 68000 machine;
221### mips.h, pmax.h are all MIPS
9ec10b2f
DM
222### machines. So we basically have to have a special case for each
223### configuration name.
224###
225### As far as handling version numbers on operating systems is
226### concerned, make sure things will fail in a fixable way. If
227### /etc/MACHINES doesn't say anything about version numbers, be
228### prepared to handle anything reasonably. If version numbers
229### matter, be sure /etc/MACHINES says something about it.
230###
231### Eric Raymond says we should accept strings like "sysvr4" to mean
232### "System V Release 4"; he writes, "The old convention encouraged
233### confusion between `system' and `release' levels'."
234
235machine='' opsys='' unported=no
236case "${canonical}" in
237
ba45dae0
GM
238 ## FreeBSD ports
239 *-*-freebsd* )
240 opsys=freebsd
241 case "${canonical}" in
242 alpha*-*-freebsd*) machine=alpha ;;
d6d1029d
CY
243 ia64-*-freebsd*) machine=ia64 ;;
244 sparc64-*-freebsd*) machine=sparc ;;
245 powerpc-*-freebsd*) machine=macppc ;;
ba45dae0 246 i[3456]86-*-freebsd*) machine=intel386 ;;
d52c26e9 247 amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
ba45dae0
GM
248 esac
249 ;;
250
472fd4dc
GM
251 ## FreeBSD kernel + glibc based userland
252 *-*-kfreebsd*gnu* )
253 opsys=gnu-kfreebsd
254 case "${canonical}" in
255 alpha*-*-kfreebsd*) machine=alpha ;;
256 ia64-*-kfreebsd*) machine=ia64 ;;
257 sparc64-*-kfreebsd*) machine=sparc ;;
258 powerpc-*-kfreebsd*) machine=macppc ;;
259 i[3456]86-*-kfreebsd*) machine=intel386 ;;
260 amd64-*-kfreebsd*|x86_64-*-kfreebsd*) machine=amdx86-64 ;;
261 esac
262 ;;
263
9ec10b2f
DM
264 ## NetBSD ports
265 *-*-netbsd* )
266 opsys=netbsd
da894f7d 267 if test -f /usr/lib/crti.o; then]
8cfdf2ca
DL
268dnl The close and open brackets here are because this section is quoted --
269dnl see the `changequote' comment above.
270 AC_DEFINE(HAVE_CRTIN, [], [Define to 1 if you have /usr/lib/crti.o.])
da894f7d 271[ fi
fdf83dbb 272
9ec10b2f 273 case "${canonical}" in
98bbf2a1 274 alpha*-*-netbsd*) machine=alpha ;;
5ac83f86 275 i[3456]86-*-netbsd*) machine=intel386 ;;
9ec10b2f
DM
276 m68k-*-netbsd*)
277 # This is somewhat bogus.
278 machine=hp9000s300 ;;
279 mips-*-netbsd*) machine=pmax ;;
69d5a2fa 280 mipsel-*-netbsd*) machine=pmax ;;
1967c6ee 281 mipseb-*-netbsd*) machine=pmax ;;
b52425f4 282 powerpc-*-netbsd*) machine=macppc ;;
1ecefa7a 283 sparc*-*-netbsd*) machine=sparc ;;
b336ddd3 284 vax-*-netbsd*) machine=vax ;;
69d5a2fa 285 arm-*-netbsd*) machine=arm ;;
01cd065b 286 x86_64-*-netbsd*) machine=amdx86-64 ;;
55433670 287 hppa-*-netbsd*) machine=hp800 ;;
9ec10b2f
DM
288 esac
289 ;;
290
e3ac1b7f
RS
291 ## OpenBSD ports
292 *-*-openbsd* )
293 opsys=openbsd
294 case "${canonical}" in
98bbf2a1 295 alpha*-*-openbsd*) machine=alpha ;;
9a982d0a
RS
296 arm-*-openbsd*) machine=arm ;;
297 hppa-*-openbsd*) machine=hp9000s300 ;;
298 i386-*-openbsd*) machine=intel386 ;;
299 m68k-*-openbsd*) machine=hp9000s300 ;;
9a982d0a
RS
300 mips64-*-openbsd*) machine=mips64 ;;
301 powerpc-*-openbsd*) machine=macppc ;;
9a982d0a
RS
302 sparc*-*-openbsd*) machine=sparc ;;
303 vax-*-openbsd*) machine=vax ;;
304 x86_64-*-openbsd*) machine=amdx86-64 ;;
e3ac1b7f
RS
305 esac
306 ;;
307
10a3b1a1
EZ
308 ## LynxOS ports
309 *-*-lynxos* )
310 opsys=lynxos
311 case "${canonical}" in
312 i[3456]86-*-lynxos*) machine=intel386 ;;
313 powerpc-*-lynxos*) machine=powerpc ;;
314 esac
315 ;;
316
2c4f7ce7
RS
317 ## BSDI ports
318 *-*-bsdi* )
319 opsys=bsdi
320 case "${canonical}" in
321 i[345]86-*-bsdi*) machine=intel386 ;;
322 sparc-*-bsdi*) machine=sparc ;;
393032d2 323 powerpc-*-bsdi*) machine=macppc ;;
2c4f7ce7
RS
324 esac
325 case "${canonical}" in
326 *-*-bsd386* | *-*-bsdi1* ) opsys=bsd386 ;;
327 *-*-bsdi2.0* ) opsys=bsdos2 ;;
328 *-*-bsdi2* ) opsys=bsdos2-1 ;;
329 *-*-bsdi3* ) opsys=bsdos3 ;;
1d06fc82 330 *-*-bsdi[45]* ) opsys=bsdos4 ;;
2c4f7ce7
RS
331 esac
332 ;;
333
30457b4f 334 ## Alpha (DEC) machines.
98bbf2a1 335 alpha*-dec-osf* )
3cd69289 336 machine=alpha opsys=osf1
f528522b 337 # This is needed to find X11R6.1 libraries for certain tests.
1bc5a004
RS
338 NON_GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
339 GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
557dcfd7
DL
340 # NON_GNU_CPP is necessary on 5.0 to avoid mangling src/Makefile
341 # due to non-traditional preprocessing with the current compiler
342 # defaults. OSF 4 can also have that compiler version, and there
343 # seems always to have been a usable /usr/bin/cpp.
344 NON_GNU_CPP=/usr/bin/cpp
71c72a72 345 case "${canonical}" in
d5c898bb 346 alpha*-dec-osf[5-9]*)
f8340326 347 opsys=osf5-0 ;;
e57196a0 348 esac
3cd69289
DM
349 ;;
350
98bbf2a1 351 alpha*-*-linux-gnu* )
5ac83f86 352 machine=alpha opsys=gnu-linux
4e90a7d5
RS
353 ;;
354
d506e713
GM
355 arm*-*-linux-gnu* )
356 machine=arm opsys=gnu-linux
357 ;;
358
57653883
RS
359 ## Apple Darwin / Mac OS X
360 *-apple-darwin* )
361 case "${canonical}" in
362 i[3456]86-* ) machine=intel386 ;;
363 powerpc-* ) machine=powermac ;;
364 * ) unported=yes ;;
365 esac
366 opsys=darwin
367 # Define CPP as follows to make autoconf work correctly.
368 CPP="${CC-cc} -E -no-cpp-precomp"
369 # Use fink packages if available.
370 if test -d /sw/include && test -d /sw/lib; then
371 GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
372 CPP="${CPP} ${GCC_TEST_OPTIONS}"
373 NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
374 fi
375 ;;
376
b83e4a77
RS
377 ## Compaq Nonstop
378 mips-compaq-nonstopux* )
379 machine=nonstopux opsys=nonstopux
380 ;;
381
9ec10b2f 382 ## Cubix QBx/386
5ac83f86 383 i[3456]86-cubix-sysv* )
9ec10b2f
DM
384 machine=intel386 opsys=usg5-3
385 ;;
386
9ec10b2f
DM
387 mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0* | mips-dec-bsd4.2* )
388 machine=pmax opsys=bsd4-2
389 ;;
3bbe016c 390 mips-dec-ultrix4.[12]* | mips-dec-bsd* )
9ec10b2f
DM
391 machine=pmax opsys=bsd4-3
392 ;;
3bbe016c
KH
393 mips-dec-ultrix* )
394 machine=pmax opsys=ultrix4-3
395 ;;
9ec10b2f
DM
396 mips-dec-osf* )
397 machine=pmax opsys=osf1
398 ;;
b95c8e7e
RS
399 mips-dec-mach_bsd4.3* )
400 machine=pmax opsys=mach-bsd4-3
401 ;;
9ec10b2f 402
9ec10b2f
DM
403 ## HP 9000 series 200 or 300
404 m68*-hp-bsd* )
405 machine=hp9000s300 opsys=bsd4-3
406 ;;
42c3a7f7 407 ## HP/UX 7, 8, 9, and 10 are supported on these machines.
9ec10b2f
DM
408 m68*-hp-hpux* )
409 case "`uname -r`" in
410 ## Someone's system reports A.B8.05 for this.
411 ## I wonder what other possibilities there are.
412 *.B8.* ) machine=hp9000s300 opsys=hpux8 ;;
413 *.08.* ) machine=hp9000s300 opsys=hpux8 ;;
414 *.09.* ) machine=hp9000s300 opsys=hpux9 ;;
88a806e9 415 *.1[0-9].* ) machine=hp9000s300 opsys=hpux9shr ;;
9ec10b2f
DM
416 *) machine=hp9000s300 opsys=hpux ;;
417 esac
418 ;;
419
d347c8e1
GM
420 ## HP 9000 series 700 and 800, running HP/UX
421 hppa*-hp-hpux7* )
422 machine=hp800 opsys=hpux
423 ;;
424 hppa*-hp-hpux8* )
425 machine=hp800 opsys=hpux8
426 ;;
427 hppa*-hp-hpux9shr* )
428 machine=hp800 opsys=hpux9shr
429 ;;
430 hppa*-hp-hpux9* )
431 machine=hp800 opsys=hpux9
432 ;;
433 hppa*-hp-hpux10.2* )
434 machine=hp800 opsys=hpux10-20
435 ;;
436 hppa*-hp-hpux10* )
437 machine=hp800 opsys=hpux10
438 ;;
439 hppa*-hp-hpux1[1-9]* )
440 machine=hp800 opsys=hpux11
441 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
442 ;;
443
55433670
CY
444 hppa*-*-linux-gnu* )
445 machine=hp800 opsys=gnu-linux
446 ;;
447
d347c8e1
GM
448 ## HP 9000 series 700 and 800, running HP/UX
449 hppa*-hp-hpux* )
450 ## Cross-compilation? Nah!
451 case "`uname -r`" in
452 ## Someone's system reports A.B8.05 for this.
453 ## I wonder what other possibilities there are.
454 *.B8.* ) machine=hp800 opsys=hpux8 ;;
455 *.08.* ) machine=hp800 opsys=hpux8 ;;
456 *.09.* ) machine=hp800 opsys=hpux9 ;;
457 *) machine=hp800 opsys=hpux10 ;;
458 esac
459 ;;
55433670
CY
460 hppa*-*-nextstep* )
461 machine=hp800 opsys=nextstep
462 ;;
463
9ec10b2f 464 ## IBM machines
9ec10b2f
DM
465 i370-ibm-aix*)
466 machine=ibm370aix opsys=usg5-3
467 ;;
4b121527 468 s390-*-linux-gnu* )
f4c2acb3
EZ
469 machine=ibms390 opsys=gnu-linux
470 ;;
e9da7ba5
RS
471 s390x-*-linux-gnu* )
472 machine=ibms390x opsys=gnu-linux
473 ;;
046545ec 474 rs6000-ibm-aix3.1* | powerpc-ibm-aix3.1* )
9ec10b2f
DM
475 machine=ibmrs6000 opsys=aix3-1
476 ;;
046545ec 477 rs6000-ibm-aix3.2.5 | powerpc-ibm-aix3.2.5 )
9ec10b2f
DM
478 machine=ibmrs6000 opsys=aix3-2-5
479 ;;
b63df577
RS
480 rs6000-ibm-aix4.1* | powerpc-ibm-aix4.1* )
481 machine=ibmrs6000 opsys=aix4-1
482 ;;
a8958813
RS
483 rs6000-ibm-aix4.2* | powerpc-ibm-aix4.2* )
484 machine=ibmrs6000 opsys=aix4-2
485 ;;
9fd77b51
CY
486 rs6000-ibm-aix4.3* | powerpc-ibm-aix4.3* )
487 machine=ibmrs6000 opsys=aix4-2
488 ;;
54c4fabd 489 rs6000-ibm-aix5* | powerpc-ibm-aix5* )
1ef1ef96
EZ
490 machine=ibmrs6000 opsys=aix4-2
491 ;;
a8958813 492 rs6000-ibm-aix4.0* | powerpc-ibm-aix4.0* )
b63df577
RS
493 machine=ibmrs6000 opsys=aix4
494 ;;
a8958813
RS
495 rs6000-ibm-aix4* | powerpc-ibm-aix4* )
496 machine=ibmrs6000 opsys=aix4-1
497 ;;
046545ec 498 rs6000-ibm-aix* | powerpc-ibm-aix* )
9ec10b2f
DM
499 machine=ibmrs6000 opsys=aix3-2
500 ;;
9ec10b2f
DM
501
502 ## Prime EXL
5ac83f86 503 i[3456]86-prime-sysv* )
9ec10b2f
DM
504 machine=i386 opsys=usg5-3
505 ;;
506
cd837fee
KH
507 ## ncr machine running svr4.3.
508 i[3456]86-ncr-sysv4.3 )
509 machine=ncr386 opsys=usg5-4-3
510 ;;
511
9ec10b2f
DM
512 ## Unspecified sysv on an ncr machine defaults to svr4.2.
513 ## (Plain usg5-4 doesn't turn on POSIX signals, which we need.)
5ac83f86 514 i[3456]86-ncr-sysv* )
b0f36760 515 machine=ncr386 opsys=usg5-4-2
9ec10b2f
DM
516 ;;
517
3ad6e32b
GM
518 ## Macintosh PowerPC
519 powerpc*-*-linux-gnu* )
520 machine=macppc opsys=gnu-linux
521 ;;
522
9ec10b2f
DM
523 ## Workstations sold by MIPS
524 ## This is not necessarily all workstations using the MIPS processor -
525 ## Irises are produced by SGI, and DECstations by DEC.
526
527 ## etc/MACHINES lists mips.h and mips4.h as possible machine files,
528 ## and usg5-2-2 and bsd4-3 as possible OS files. The only guidance
529 ## it gives for choosing between the alternatives seems to be "Use
530 ## -machine=mips4 for RISCOS version 4; use -opsystem=bsd4-3 with
531 ## the BSD world." I'll assume that these are instructions for
532 ## handling two odd situations, and that every other situation
533 ## should use mips.h and usg5-2-2, they being listed first.
534 mips-mips-usg* )
535 machine=mips4
536 ## Fall through to the general code at the bottom to decide on the OS.
537 ;;
538 mips-mips-riscos4* )
539 machine=mips4 opsys=bsd4-3
540 NON_GNU_CC="cc -systype bsd43"
541 NON_GNU_CPP="cc -systype bsd43 -E"
542 ;;
b95c8e7e
RS
543 mips-mips-riscos5* )
544 machine=mips4 opsys=riscos5
545 NON_GNU_CC="cc -systype bsd43"
546 NON_GNU_CPP="cc -systype bsd43 -E"
547 ;;
9ec10b2f
DM
548 mips-mips-bsd* )
549 machine=mips opsys=bsd4-3
550 ;;
551 mips-mips-* )
552 machine=mips opsys=usg5-2-2
553 ;;
554
555 ## NeXT
5ab52d42
RS
556 m68*-next-* | m68k-*-nextstep* )
557 machine=m68k opsys=nextstep
9ec10b2f
DM
558 ;;
559
b4ea3111
KH
560 ## NEC EWS4800
561 mips-nec-sysv4*)
562 machine=ews4800 opsys=ux4800
563 ;;
564
9ec10b2f 565 ## Siemens Nixdorf
7cba3845 566 mips-siemens-sysv* | mips-sni-sysv*)
9ec10b2f
DM
567 machine=mips-siemens opsys=usg5-4
568 NON_GNU_CC=/usr/ccs/bin/cc
569 NON_GNU_CPP=/usr/ccs/lib/cpp
570 ;;
571
572 ## Silicon Graphics machines
9ec10b2f 573 ## Iris 4D
a187fb80
KH
574 mips-sgi-irix6.5 )
575 machine=iris4d opsys=irix6-5
91193697
DL
576 # Without defining _LANGUAGE_C, things get masked out in the headers
577 # so that, for instance, grepping for `free' in stdlib.h fails and
578 # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
579 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
63c59d1e 580 NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
a187fb80 581 ;;
546fa279 582 mips-sgi-irix6* )
309daad2 583 machine=iris4d opsys=irix6-0
d9b5c990 584 # It's not clear whether -D_LANGUAGE_C is necessary as it is for 6.5,
91193697
DL
585 # but presumably it does no harm.
586 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
63c59d1e 587 # -32 probably isn't necessary in later v.6s -- anyone know which?
309daad2 588 NON_GCC_TEST_OPTIONS=-32
546fa279 589 ;;
4ab83697 590 mips-sgi-irix5.[01]* )
9ec10b2f
DM
591 machine=iris4d opsys=irix5-0
592 ;;
4ab83697
RS
593 mips-sgi-irix5* | mips-sgi-irix* )
594 machine=iris4d opsys=irix5-2
9ec10b2f
DM
595 ;;
596
9ec10b2f 597 ## Suns
b5b193a7 598 sparc-*-linux-gnu* | sparc64-*-linux-gnu* )
5ac83f86 599 machine=sparc opsys=gnu-linux
28d9bc0e
KH
600 ;;
601
f4027958 602 *-auspex-sunos* | *-sun-sunos* | *-sun-bsd* | *-sun-solaris* \
5ac83f86 603 | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* | powerpc*-*-solaris2* \
c42b1767 604 | rs6000-*-solaris2*)
9ec10b2f 605 case "${canonical}" in
5ac83f86 606 i[3456]86-*-* ) machine=intel386 ;;
a15fc3c3 607 amd64-*-*|x86_64-*-*) machine=amdx86-64 ;;
42326ef0 608 powerpcle* ) machine=powerpcle ;;
f7894e88 609 powerpc* | rs6000* ) machine=ibmrs6000 ;;
9ec10b2f
DM
610 sparc* ) machine=sparc ;;
611 * ) unported=yes ;;
612 esac
613 case "${canonical}" in
9ec10b2f
DM
614 *-sunos5.3* | *-solaris2.3* )
615 opsys=sol2-3
616 NON_GNU_CPP=/usr/ccs/lib/cpp
617 ;;
618 *-sunos5.4* | *-solaris2.4* )
619 opsys=sol2-4
620 NON_GNU_CPP=/usr/ccs/lib/cpp
30457b4f 621 RANLIB="ar -ts"
9ec10b2f 622 ;;
2e567bad
KH
623 *-sunos5.5* | *-solaris2.5* )
624 opsys=sol2-5
625 NON_GNU_CPP=/usr/ccs/lib/cpp
30457b4f 626 RANLIB="ar -ts"
2e567bad 627 ;;
a28947f0
RS
628 *-sunos5.6* | *-solaris2.6* )
629 opsys=sol2-6
630 NON_GNU_CPP=/usr/ccs/lib/cpp
631 RANLIB="ar -ts"
632 ;;
9ec10b2f 633 *-sunos5* | *-solaris* )
f79b6dcc 634 opsys=sol2-6
42bf63da
GM
635 emacs_check_sunpro_c=yes
636 NON_GNU_CPP=/usr/ccs/lib/cpp
9ec10b2f
DM
637 ;;
638 * ) opsys=bsd4-2 ;;
639 esac
6e502e37
RS
640 ## Watch out for a compiler that we know will not work.
641 case "${canonical}" in
642 *-solaris* | *-sunos5* )
643 if [ "x$CC" = x/usr/ucb/cc ]; then
644 ## /usr/ucb/cc doesn't work;
645 ## we should find some other compiler that does work.
646 unset CC
647 fi
648 ;;
649 *) ;;
650 esac
9ec10b2f 651 ;;
5ab52d42 652 sparc-*-nextstep* )
19e45036 653 machine=sparc opsys=nextstep
5ab52d42 654 ;;
9ec10b2f 655
9ec10b2f
DM
656 ## Tandem Integrity S2
657 mips-tandem-sysv* )
658 machine=tandem-s2 opsys=usg5-3
659 ;;
660
9ec10b2f
DM
661 ## Vaxen.
662 vax-dec-* )
663 machine=vax
664 case "${canonical}" in
665 *-bsd4.1* ) opsys=bsd4-1 ;;
666 *-bsd4.2* | *-ultrix[0-3].* | *-ultrix4.0* ) opsys=bsd4-2 ;;
667 *-bsd4.3* | *-ultrix* ) opsys=bsd4-3 ;;
9ec10b2f
DM
668 *-sysv[01]* | *-sysvr[01]* ) opsys=usg5-0 ;;
669 *-sysv2* | *-sysvr2* ) opsys=usg5-2 ;;
670 *-vms* ) opsys=vms ;;
671 * ) unported=yes
672 esac
673 ;;
674
2d23c8cc
GM
675 ## IA-64
676 ia64*-*-linux* )
677 machine=ia64 opsys=gnu-linux
678 ;;
679
9ec10b2f 680 ## Intel 386 machines where we don't care about the manufacturer
5ac83f86 681 i[3456]86-*-* )
9ec10b2f
DM
682 machine=intel386
683 case "${canonical}" in
c60ee5e7 684 *-cygwin ) opsys=cygwin ;;
eae54018 685 *-darwin* ) opsys=darwin
23fd4483
ST
686 CPP="${CC-cc} -E -no-cpp-precomp"
687 ;;
9ec10b2f 688 *-xenix* ) opsys=xenix ;;
5ac83f86 689 *-linux-gnu* ) opsys=gnu-linux ;;
0e6d70d5 690 *-sysv4.2uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
167899c4
RS
691 *-sysv5uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
692 *-sysv5OpenUNIX* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
9ec10b2f 693 *-386bsd* ) opsys=386bsd ;;
5ab52d42 694 *-nextstep* ) opsys=nextstep ;;
9ec10b2f
DM
695 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
696 esac
697 ;;
698
287f502c 699 ## m68k Linux-based GNU system
5ac83f86
RS
700 m68k-*-linux-gnu* )
701 machine=m68k opsys=gnu-linux
e1fd57e3
RS
702 ;;
703
287f502c 704 ## Mips Linux-based GNU system
71cc40d5 705 mips-*-linux-gnu* | mipsel-*-linux-gnu* )
287f502c
RS
706 machine=mips opsys=gnu-linux
707 ;;
708
eded5b68
RS
709 ## UXP/DS
710 sparc-fujitsu-sysv4* )
711 machine=sparc opsys=uxpds
712 NON_GNU_CPP=/usr/ccs/lib/cpp
713 RANLIB="ar -ts"
714 ;;
715
3fa4ac47
AS
716 ## AMD x86-64 Linux-based GNU system
717 x86_64-*-linux-gnu* )
177c0ea7 718 machine=amdx86-64 opsys=gnu-linux
3fa4ac47
AS
719 ;;
720
131e4133 721 ## Tensilica Xtensa Linux-based GNU system
94218e27
DN
722 xtensa-*-linux-gnu* )
723 machine=xtensa opsys=gnu-linux
724 ;;
725
9ec10b2f
DM
726 * )
727 unported=yes
728 ;;
729esac
730
731### If the code above didn't choose an operating system, just choose
732### an operating system based on the configuration name. You really
733### only want to use this when you have no idea what the right
734### operating system is; if you know what operating systems a machine
735### runs, it's cleaner to make it explicit in the case statement
736### above.
737if test x"${opsys}" = x; then
738 case "${canonical}" in
739 *-gnu* ) opsys=gnu ;;
740 *-bsd4.[01] ) opsys=bsd4-1 ;;
741 *-bsd4.2 ) opsys=bsd4-2 ;;
742 *-bsd4.3 ) opsys=bsd4-3 ;;
743 *-sysv0 | *-sysvr0 ) opsys=usg5-0 ;;
744 *-sysv2 | *-sysvr2 ) opsys=usg5-2 ;;
745 *-sysv2.2 | *-sysvr2.2 ) opsys=usg5-2-2 ;;
5ab52d42 746 *-sysv3* | *-sysvr3* ) opsys=usg5-3 ;;
66a96cff 747 *-sysv4.2uw* ) opsys=unixware ;;
167899c4
RS
748 *-sysv5uw* ) opsys=unixware ;;
749 *-sysv5OpenUNIX* ) opsys=unixware ;;
5ab52d42 750 *-sysv4.1* | *-sysvr4.1* )
9ec10b2f
DM
751 NON_GNU_CPP=/usr/lib/cpp
752 opsys=usg5-4 ;;
5ab52d42 753 *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
b63df577 754 if [ x$NON_GNU_CPP = x ]; then
16831d8c
RS
755 if [ -f /usr/ccs/lib/cpp ]; then
756 NON_GNU_CPP=/usr/ccs/lib/cpp
757 else
758 NON_GNU_CPP=/lib/cpp
759 fi
b63df577
RS
760 fi
761 opsys=usg5-4-2 ;;
5ab52d42 762 *-sysv4* | *-sysvr4* ) opsys=usg5-4 ;;
9ec10b2f
DM
763 * )
764 unported=yes
765 ;;
766 esac
767fi
768
91b5aa9a 769]
10aa5486 770dnl quotation ends
9ec10b2f
DM
771
772if test $unported = yes; then
91b5aa9a
DL
773 AC_MSG_ERROR([Emacs hasn't been ported to `${canonical}' systems.
774Check `etc/MACHINES' for recognized configuration names.])
9ec10b2f
DM
775fi
776
777machfile="m/${machine}.h"
778opsysfile="s/${opsys}.h"
779
780
781#### Choose a compiler.
782test -n "$CC" && cc_specified=yes
783
5ab52d42
RS
784# Save the value of CFLAGS that the user specified.
785SPECIFIED_CFLAGS="$CFLAGS"
786
9ec10b2f
DM
787case ${with_gcc} in
788 "yes" ) CC="gcc" GCC=yes ;;
6e0dc84a 789 "no" ) : ${CC=cc} ;;
e9b2a022 790 * )
9ec10b2f 791esac
e9b2a022 792AC_PROG_CC
9ec10b2f
DM
793
794# On Suns, sometimes $CPP names a directory.
795if test -n "$CPP" && test -d "$CPP"; then
796 CPP=
797fi
798
42bf63da
GM
799## If not using gcc, and on Solaris, and no CPP specified, see if
800## using a Sun compiler, which needs -Xs to prevent whitespace.
801if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
802 test x"$CPP" = x; then
803 AC_MSG_CHECKING([whether we are using a Sun C compiler])
804 AC_CACHE_VAL(emacs_cv_sunpro_c,
805 [AC_TRY_LINK([],
806[#ifndef __SUNPRO_C
807fail;
808#endif
809], emacs_cv_sunpro_c=yes, emacs_cv_sunpro_c=no)])
810 AC_MSG_RESULT($emacs_cv_sunpro_c)
811
812 if test x"$emacs_cv_sunpro_c" = xyes; then
813 NON_GNU_CPP="$CC -E -Xs"
814 fi
815fi
816
9ec10b2f
DM
817#### Some systems specify a CPP to use unless we are using GCC.
818#### Now that we know whether we are using GCC, we can decide whether
819#### to use that one.
820if test "x$NON_GNU_CPP" != x && test x$GCC != xyes && test "x$CPP" = x
821then
822 CPP="$NON_GNU_CPP"
823fi
824
825#### Some systems specify a CC to use unless we are using GCC.
826#### Now that we know whether we are using GCC, we can decide whether
827#### to use that one.
828if test "x$NON_GNU_CC" != x && test x$GCC != xyes &&
829 test x$cc_specified != xyes
830then
831 CC="$NON_GNU_CC"
832fi
833
834if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x
835then
836 CC="$CC $GCC_TEST_OPTIONS"
c7f493fd 837fi
9ec10b2f
DM
838
839if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x
840then
841 CC="$CC $NON_GCC_TEST_OPTIONS"
c7f493fd 842fi
9ec10b2f 843
f405f8ec
AS
844dnl checks for Unix variants
845AC_AIX
846AC_GNU_SOURCE
847
01abe918
CY
848### Use -Wno-pointer-sign if the compiler supports it
849AC_MSG_CHECKING([whether gcc understands -Wno-pointer-sign])
850SAVE_CFLAGS="$CFLAGS"
851CFLAGS="$CFLAGS -Wno-pointer-sign"
852AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
853if test $has_option = yes; then
854 C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH"
855fi
856AC_MSG_RESULT($has_option)
857CFLAGS="$SAVE_CFLAGS"
858unset has_option
859unset SAVE_CFLAGS
860
fb33ec52 861#### Some other nice autoconf tests.
9ec10b2f
DM
862
863dnl checks for programs
6e0dc84a 864AC_PROG_LN_S
9ec10b2f
DM
865AC_PROG_CPP
866AC_PROG_INSTALL
3f5b097c
DL
867if test "x$RANLIB" = x; then
868 AC_PROG_RANLIB
869fi
d57c2211
DK
870AC_PATH_PROG(INSTALL_INFO, install-info)
871AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin)
872AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin)
19b6b5d3
AS
873dnl Don't use GZIP, which is used by gzip for additional parameters.
874AC_PATH_PROG(GZIP_PROG, gzip)
9ec10b2f 875
d25b54b3 876
9538e9ca 877## Need makeinfo >= 4.6 (?) to build the manuals.
d25b54b3 878AC_PATH_PROG(MAKEINFO, makeinfo, no)
131e4133 879dnl By this stage, configure has already checked for egrep and set EGREP,
d25b54b3
GM
880dnl or exited with an error if no egrep was found.
881if test "$MAKEINFO" != "no" && \
d4840f44 882 test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[[^0-9]]*([[1-4]][[0-9]]+|[[5-9]]|4\.[[6-9]]|4\.[[1-5]][[0-9]]+)'`" = x; then
131e4133 883 MAKEINFO=no
d25b54b3
GM
884fi
885
886if test "$MAKEINFO" = "no"; then
9538e9ca 887 AC_MSG_ERROR( [makeinfo >= 4.6 is required] )
d25b54b3
GM
888fi
889
890
6d621bab
RS
891dnl Add our options to ac_link now, after it is set up.
892
893if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
894then
895 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
896fi
897
898if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
899then
900 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
901fi
902
1d6cc9a8
RS
903dnl We need -znocombreloc if we're using a relatively recent GNU ld.
904dnl If we can link with the flag, it shouldn't do any harm anyhow.
905dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
06aacc62
RS
906dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
907dnl if not built to support GNU ld.
908
1d6cc9a8 909late_LDFLAGS=$LDFLAGS
b917689b 910if test "$GCC" = yes; then
06aacc62
RS
911 LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
912else
913 LDFLAGS="$LDFLAGS -znocombreloc"
914fi
1d6cc9a8 915
e6a304f0 916AC_MSG_CHECKING([for -znocombreloc])
1d6cc9a8
RS
917AC_LINK_IFELSE([main(){return 0;}],
918 [AC_MSG_RESULT(yes)],
919 LDFLAGS=$late_LDFLAGS
920 [AC_MSG_RESULT(no)])
921
4428e268
DL
922#### Extract some information from the operating system and machine files.
923
924AC_CHECKING([the machine- and system-dependent files to find out
925 - which libraries the lib-src programs will want, and
926 - whether the GNU malloc routines are usable])
927
928### First figure out CFLAGS (which we use for running the compiler here)
929### and REAL_CFLAGS (which we use for real compilation).
930### The two are the same except on a few systems, where they are made
931### different to work around various lossages. For example,
932### GCC 2.5 on GNU/Linux needs them to be different because it treats -g
933### as implying static linking.
934
935### If the CFLAGS env var is specified, we use that value
936### instead of the default.
937
938### It's not important that this name contain the PID; you can't run
939### two configures in the same directory and have anything work
940### anyway.
941tempcname="conftest.c"
942
943echo '
944#include "'${srcdir}'/src/'${opsysfile}'"
945#include "'${srcdir}'/src/'${machfile}'"
946#ifndef LIBS_MACHINE
947#define LIBS_MACHINE
948#endif
949#ifndef LIBS_SYSTEM
950#define LIBS_SYSTEM
951#endif
952#ifndef C_SWITCH_SYSTEM
953#define C_SWITCH_SYSTEM
954#endif
955#ifndef C_SWITCH_MACHINE
956#define C_SWITCH_MACHINE
957#endif
958configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
959configure___ c_switch_system=C_SWITCH_SYSTEM
960configure___ c_switch_machine=C_SWITCH_MACHINE
961
962#ifndef LIB_X11_LIB
963#define LIB_X11_LIB -lX11
964#endif
965
966#ifndef LIBX11_MACHINE
967#define LIBX11_MACHINE
968#endif
969
970#ifndef LIBX11_SYSTEM
971#define LIBX11_SYSTEM
972#endif
973configure___ LIBX=LIB_X11_LIB LIBX11_MACHINE LIBX11_SYSTEM
974
975#ifdef UNEXEC
976configure___ unexec=UNEXEC
977#else
978configure___ unexec=unexec.o
979#endif
980
981#ifdef SYSTEM_MALLOC
982configure___ system_malloc=yes
983#else
984configure___ system_malloc=no
985#endif
986
e32fac2a
GM
987#ifdef USE_MMAP_FOR_BUFFERS
988configure___ use_mmap_for_buffers=yes
b1b4ce06 989#else
e32fac2a 990configure___ use_mmap_for_buffers=no
b1b4ce06
GM
991#endif
992
4428e268
DL
993#ifndef C_DEBUG_SWITCH
994#define C_DEBUG_SWITCH -g
995#endif
996
997#ifndef C_OPTIMIZE_SWITCH
998#ifdef __GNUC__
999#define C_OPTIMIZE_SWITCH -O2
1000#else
1001#define C_OPTIMIZE_SWITCH -O
1002#endif
1003#endif
1004
01abe918
CY
1005#ifndef C_WARNINGS_SWITCH
1006#define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
1007#endif
1008
4428e268
DL
1009#ifndef LD_SWITCH_MACHINE
1010#define LD_SWITCH_MACHINE
1011#endif
1012
1013#ifndef LD_SWITCH_SYSTEM
1014#define LD_SWITCH_SYSTEM
1015#endif
1016
1017#ifndef LD_SWITCH_X_SITE_AUX
1018#define LD_SWITCH_X_SITE_AUX
177c0ea7 1019#endif
4428e268
DL
1020
1021configure___ ld_switch_system=LD_SWITCH_SYSTEM
1022configure___ ld_switch_machine=LD_SWITCH_MACHINE
1023
1024#ifdef THIS_IS_CONFIGURE
1025
1026/* Get the CFLAGS for tests in configure. */
1027#ifdef __GNUC__
1028configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
1029#else
1030configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
1031#endif
1032
1033#else /* not THIS_IS_CONFIGURE */
1034
1035/* Get the CFLAGS for real compilation. */
1036#ifdef __GNUC__
01abe918 1037configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH '${SPECIFIED_CFLAGS}'
4428e268
DL
1038#else
1039configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
1040#endif
1041
1042#endif /* not THIS_IS_CONFIGURE */
1043' > ${tempcname}
1044
1045# The value of CPP is a quoted variable reference, so we need to do this
1046# to get its actual value...
1047CPP=`eval "echo $CPP"`
91b5aa9a 1048[eval `${CPP} -Isrc ${tempcname} \
4428e268
DL
1049 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
1050if test "x$SPECIFIED_CFLAGS" = x; then
1051 eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \
1052 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
1053else
1054 REAL_CFLAGS="$CFLAGS"
91b5aa9a 1055fi]
4428e268
DL
1056rm ${tempcname}
1057
1058ac_link="$ac_link $ld_switch_machine $ld_switch_system"
1059
1060### Make sure subsequent tests use flags consistent with the build flags.
1061
1062if test x"${OVERRIDE_CPPFLAGS}" != x; then
1063 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
1064else
1065 CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
1066fi
1067
17b3d9f6
DL
1068dnl For AC_FUNC_GETLOADAVG, at least:
1069AC_CONFIG_LIBOBJ_DIR(src)
1070
48989ead
DL
1071dnl Do this early because it can frob feature test macros for Unix-98 &c.
1072AC_SYS_LARGEFILE
1073
2eec8691 1074
ddd01c5d 1075### The standard library on x86-64 and s390x GNU/Linux distributions can
0bc02f03
CY
1076### be located in either /usr/lib64 or /usr/lib.
1077case "${canonical}" in
058e0687 1078 x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
0bc02f03 1079 if test -d /usr/lib64; then
ddd01c5d
AS
1080 AC_DEFINE(HAVE_LIB64_DIR, 1,
1081 [Define to 1 if the directory /usr/lib64 exists.])
0bc02f03
CY
1082fi
1083esac
1084
2eec8691
JD
1085dnl This function defintion taken from Gnome 2.0
1086dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1087dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1088dnl also defines GSTUFF_PKG_ERRORS on error
1089AC_DEFUN([PKG_CHECK_MODULES], [
1090 succeeded=no
1091
1092 if test -z "$PKG_CONFIG"; then
1093 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1094 fi
1095
1096 if test "$PKG_CONFIG" = "no" ; then
1097 ifelse([$4], , [AC_MSG_ERROR([
1098 *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to 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])
1099 else
1100 PKG_CONFIG_MIN_VERSION=0.9.0
1101 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1102 AC_MSG_CHECKING(for $2)
1103
e9f67acf 1104 if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then
2eec8691
JD
1105 AC_MSG_RESULT(yes)
1106 succeeded=yes
1107
1108 AC_MSG_CHECKING($1_CFLAGS)
94315858 1109 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"|sed -e 's,///*,/,g'`
2eec8691
JD
1110 AC_MSG_RESULT($$1_CFLAGS)
1111
1112 AC_MSG_CHECKING($1_LIBS)
94315858 1113 $1_LIBS=`$PKG_CONFIG --libs "$2"|sed -e 's,///*,/,g'`
2eec8691
JD
1114 AC_MSG_RESULT($$1_LIBS)
1115 else
1116 AC_MSG_RESULT(no)
1117 $1_CFLAGS=""
1118 $1_LIBS=""
1119 ## If we have a custom action on failure, don't print errors, but
1120 ## do set a variable so people can do so.
1121 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1122 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1123 fi
1124
1125 AC_SUBST($1_CFLAGS)
1126 AC_SUBST($1_LIBS)
1127 else
1128 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1129 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1130 fi
1131 fi
1132
1133 if test $succeeded = yes; then
1134 ifelse([$3], , :, [$3])
1135 else
1136 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])
1137 fi
1138])
1139
1140
3d9830e5
PJ
1141if test "${with_sound}" != "no"; then
1142 # Sound support for GNU/Linux and the free BSDs.
1143 AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h)
1144 # Emulation library used on NetBSD.
1145 AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
1146 AC_SUBST(LIBSOUND)
2eec8691
JD
1147
1148 ALSA_REQUIRED=1.0.0
1149 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
1150 dnl Check if --with-pkg-config-prog has been given.
1151 if test "X${with_pkg_config_prog}" != X; then
1152 PKG_CONFIG="${with_pkg_config_prog}"
1153 fi
1154 PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
1155 if test $HAVE_ALSA = yes; then
ce091e44
JD
1156 SAVE_CFLAGS="$CFLAGS"
1157 SAVE_LDFLAGS="$LDFLAGS"
1158 CFLAGS="$ALSA_CFLAGS $CFLAGS"
1159 LDFLAGS="$ALSA_LIBS $LDFLAGS"
1160 AC_TRY_COMPILE([#include <asoundlib.h>], [snd_lib_error_set_handler (0);],
1161 emacs_alsa_normal=yes,
1162 emacs_alsa_normal=no)
1163 if test "$emacs_alsa_normal" != yes; then
1164 AC_TRY_COMPILE([#include <alsa/asoundlib.h>],
1165 [snd_lib_error_set_handler (0);],
1166 emacs_alsa_subdir=yes,
1167 emacs_alsa_subdir=no)
1168 if test "$emacs_alsa_subdir" != yes; then
1169 AC_MSG_ERROR([pkg-config found alsa, but it does not compile. See config.log for error messages.])
1170 fi
1171 ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
1172 fi
1173
1174 CFLAGS="$SAVE_CFLAGS"
1175 LDFLAGS="$SAVE_LDFLAGS"
2eec8691
JD
1176 LIBSOUND="$LIBSOUND $ALSA_LIBS"
1177 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
1178 AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
1179 fi
1180 AC_SUBST(CFLAGS_SOUND)
3d9830e5 1181fi
b412189c 1182
9ec10b2f 1183dnl checks for header files
1113b624
PE
1184AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
1185 linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
9afca57c 1186 termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
551ffc27 1187 sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
8a877e5c 1188 sys/utsname.h pwd.h)
f17e308a
JD
1189
1190AC_MSG_CHECKING(if personality LINUX32 can be set)
1191AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
1192 emacs_cv_personality_linux32=yes,
1193 emacs_cv_personality_linux32=no)
1194AC_MSG_RESULT($emacs_cv_personality_linux32)
1195
1196if test $emacs_cv_personality_linux32 = yes; then
1197 AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
1198 [Define to 1 if personality LINUX32 can be set.])
1199fi
1200
91b5aa9a
DL
1201dnl On Solaris 8 there's a compilation warning for term.h because
1202dnl it doesn't define `bool'.
1203AC_CHECK_HEADERS(term.h, , , -)
6e0dc84a
DM
1204AC_HEADER_STDC
1205AC_HEADER_TIME
71cc40d5
DL
1206AC_CHECK_DECLS([sys_siglist])
1207if test $ac_cv_have_decl_sys_siglist != yes; then
1208 # For Tru64, at least:
1209 AC_CHECK_DECLS([__sys_siglist])
1210 if test $ac_cv_have_decl___sys_siglist = yes; then
1211 AC_DEFINE(sys_siglist, __sys_siglist,
1212 [Define to any substitute for sys_siglist.])
1213 fi
1214fi
2ce723a5 1215AC_HEADER_SYS_WAIT
9ec10b2f 1216
3cd69289 1217dnl Some systems have utime.h but don't declare the struct anyplace.
fd0a060b 1218AC_CACHE_CHECK(for struct utimbuf, emacs_cv_struct_utimbuf,
3cd69289
DM
1219AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1220#include <sys/time.h>
1221#include <time.h>
1222#else
1223#ifdef HAVE_SYS_TIME_H
1224#include <sys/time.h>
1225#else
1226#include <time.h>
1227#endif
1228#endif
1229#ifdef HAVE_UTIME_H
1230#include <utime.h>
1231#endif], [static struct utimbuf x; x.actime = x.modtime;],
fd0a060b
AS
1232 emacs_cv_struct_utimbuf=yes, emacs_cv_struct_utimbuf=no))
1233if test $emacs_cv_struct_utimbuf = yes; then
5e7d772d 1234 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if `struct utimbuf' is declared by <utime.h>.])
fd0a060b 1235fi
3cd69289 1236
9ec10b2f 1237dnl checks for typedefs
6e0dc84a 1238AC_TYPE_SIGNAL
9ec10b2f 1239
25abcaf1
GM
1240dnl Check for speed_t typedef.
1241AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
a1d8dc87
RS
1242 [AC_TRY_COMPILE([#include <termios.h>], [speed_t x = 1;],
1243 emacs_cv_speed_t=yes, emacs_cv_speed_t=no)])
25abcaf1 1244if test $emacs_cv_speed_t = yes; then
177c0ea7 1245 AC_DEFINE(HAVE_SPEED_T, 1,
a1d8dc87 1246 [Define to 1 if `speed_t' is declared by <termios.h>.])
25abcaf1
GM
1247fi
1248
fd0a060b 1249AC_CACHE_CHECK(for struct timeval, emacs_cv_struct_timeval,
3cd69289
DM
1250AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1251#include <sys/time.h>
1252#include <time.h>
1253#else
1254#ifdef HAVE_SYS_TIME_H
1255#include <sys/time.h>
1256#else
1257#include <time.h>
1258#endif
1259#endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
fd0a060b
AS
1260 emacs_cv_struct_timeval=yes, emacs_cv_struct_timeval=no))
1261HAVE_TIMEVAL=$emacs_cv_struct_timeval
1262if test $emacs_cv_struct_timeval = yes; then
5e7d772d 1263 AC_DEFINE(HAVE_TIMEVAL, 1, [Define to 1 if `struct timeval' is declared by <sys/time.h>.])
fd0a060b 1264fi
3cd69289 1265
63c59d1e 1266AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
177c0ea7 1267AC_TRY_COMPILE([#include <math.h>],
63c59d1e
DL
1268[static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;],
1269 emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
1270HAVE_EXCEPTION=$emacs_cv_struct_exception
1271if test $emacs_cv_struct_exception != yes; then
5e7d772d 1272 AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
63c59d1e
DL
1273fi
1274
ce6e4c21
AS
1275AC_CHECK_HEADERS(sys/socket.h)
1276AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1277#if HAVE_SYS_SOCKET_H
1278#include <sys/socket.h>
1279#endif])
1280
9ec10b2f
DM
1281dnl checks for structure members
1282AC_STRUCT_TM
6e0dc84a 1283AC_STRUCT_TIMEZONE
5e7d772d
AS
1284AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1285 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1286 [Define to 1 if `tm_gmtoff' is member of `struct tm'.])],,
1287 [#include <time.h>])
f6214bb7 1288AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
86bd9393 1289 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
ce6e4c21
AS
1290 struct ifreq.ifr_addr], , ,
1291 [AC_INCLUDES_DEFAULT
1292#if HAVE_SYS_SOCKET_H
1293#include <sys/socket.h>
1294#endif
1295#if HAVE_NET_IF_H
1296#include <net/if.h>
1297#endif])
9ec10b2f
DM
1298
1299dnl checks for compiler characteristics
3f5b097c
DL
1300
1301dnl Testing __STDC__ to determine prototype support isn't good enough.
1302dnl DEC C, for instance, doesn't define it with default options, and
1303dnl is used on 64-bit systems (OSF Alphas). Similarly for volatile
1304dnl and void *.
1305AC_C_PROTOTYPES
1306AC_C_VOLATILE
6e0dc84a 1307AC_C_CONST
3f5b097c
DL
1308dnl This isn't useful because we can't turn on use of `inline' unless
1309dnl the compiler groks `extern inline'.
1310dnl AC_C_INLINE
1311AC_CACHE_CHECK([for void * support], emacs_cv_void_star,
177c0ea7 1312 [AC_TRY_COMPILE(, [void * foo;],
3f5b097c
DL
1313 emacs_cv_void_star=yes, emacs_cv_void_star=no)])
1314if test $emacs_cv_void_star = yes; then
1315 AC_DEFINE(POINTER_TYPE, void)
1316else
1317 AC_DEFINE(POINTER_TYPE, char)
1318fi
5e7d772d
AS
1319AH_TEMPLATE(POINTER_TYPE,
1320 [Define as `void' if your compiler accepts `void *'; otherwise
1321 define as `char'.])dnl
9ec10b2f 1322
4494a266
JD
1323
1324
71cc40d5
DL
1325dnl This could be used for targets which can have both byte sexes.
1326dnl We could presumably replace the hardwired WORDS_BIG_ENDIAN generally.
1327dnl AC_C_BIGENDIAN
1328
9ec10b2f 1329dnl check for Make feature
6e0dc84a 1330AC_PROG_MAKE_SET
9ec10b2f
DM
1331
1332dnl checks for operating system services
6e0dc84a 1333AC_SYS_LONG_FILE_NAMES
9ec10b2f
DM
1334
1335#### Choose a window system.
9ec10b2f 1336
6e0dc84a 1337AC_PATH_X
530ce502
DM
1338if test "$no_x" = yes; then
1339 window_system=none
1340else
1341 window_system=x11
1342fi
9ec10b2f 1343
f13de01e
AS
1344if test "${x_libraries}" != NONE; then
1345 if test -n "${x_libraries}"; then
1346 LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
1347 LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
1348 fi
66d736a9 1349 x_default_search_path=""
f13de01e
AS
1350 x_search_path=${x_libraries}
1351 if test -z "${x_search_path}"; then
1352 x_search_path=/usr/lib
1353 fi
1354 for x_library in `echo ${x_search_path}: | \
1355 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
c8d4d4cc
KH
1356 x_search_path="\
1357${x_library}/X11/%L/%T/%N%C%S:\
1358${x_library}/X11/%l/%T/%N%C%S:\
1359${x_library}/X11/%T/%N%C%S:\
1360${x_library}/X11/%L/%T/%N%S:\
1361${x_library}/X11/%l/%T/%N%S:\
1362${x_library}/X11/%T/%N%S"
66d736a9
RS
1363 if test x"${x_default_search_path}" = x; then
1364 x_default_search_path=${x_search_path}
1365 else
1366 x_default_search_path="${x_search_path}:${x_default_search_path}"
1367 fi
1368 done
ea199426
DM
1369fi
1370if test "${x_includes}" != NONE && test -n "${x_includes}"; then
cc6476f6 1371 C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
ea199426 1372fi
9ec10b2f 1373
8dbeb353
DM
1374if test x"${x_includes}" = x; then
1375 bitmapdir=/usr/include/X11/bitmaps
3cd69289 1376else
908ff139 1377 # accumulate include directories that have X11 bitmap subdirectories
cc6476f6
KH
1378 bmd_acc="dummyval"
1379 for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
1380 if test -d "${bmd}/X11/bitmaps"; then
1381 bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
4f6f5dab
GM
1382 fi
1383 if test -d "${bmd}/bitmaps"; then
cc6476f6
KH
1384 bmd_acc="${bmd_acc}:${bmd}/bitmaps"
1385 fi
1386 done
1387 if test ${bmd_acc} != "dummyval"; then
1388 bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
1389 fi
3cd69289
DM
1390fi
1391
9797a87d
YM
1392HAVE_CARBON=no
1393if test "${with_carbon}" != no; then
1394 AC_CHECK_HEADER(Carbon/Carbon.h, HAVE_CARBON=yes)
1395fi
1396if test "${window_system}" = x11 && test "${HAVE_CARBON}" = yes; then
1397 if test "${with_carbon+set}" != set \
1398 && test "${carbon_appdir_x+set}" != set; then
cacacdfc
YM
1399 for var in with_x with_x_toolkit with_gtk with_xim \
1400 with_xpm with_jpeg with_tiff with_gif with_png; do
1401 if eval test \"\${$var+set}\" = set; then
1402 HAVE_CARBON=no
1403 break
1404 fi
1405 done
9797a87d
YM
1406 fi
1407fi
1408if test "${HAVE_CARBON}" = yes; then
1409 window_system=mac
1410fi
1411
9ec10b2f
DM
1412case "${window_system}" in
1413 x11 )
1414 HAVE_X_WINDOWS=yes
1415 HAVE_X11=yes
1416 case "${with_x_toolkit}" in
c7f493fd
RM
1417 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
1418 motif ) USE_X_TOOLKIT=MOTIF ;;
488dd4c4
JD
1419 gtk ) with_gtk=yes
1420dnl Dont set this for GTK. A lot of tests below assumes Xt when
1421dnl USE_X_TOOLKIT is set.
1422 USE_X_TOOLKIT=none ;;
4be21f66 1423 no ) USE_X_TOOLKIT=none ;;
4f823057
GM
1424dnl If user did not say whether to use a toolkit, make this decision later:
1425dnl use the toolkit if we have gtk, or X11R5 or newer.
131e4133 1426 * )
4f823057
GM
1427 if test x"$with_gtk" = xyes; then
1428 USE_X_TOOLKIT=none
1429 else
1430 USE_X_TOOLKIT=maybe
1431 fi
1432 ;;
9ec10b2f
DM
1433 esac
1434 ;;
9797a87d 1435 mac | none )
9ec10b2f
DM
1436 HAVE_X_WINDOWS=no
1437 HAVE_X11=no
1438 USE_X_TOOLKIT=none
1439 ;;
1440esac
9ec10b2f 1441
31ad8850
JD
1442if test "$window_system" = none && test "X$with_x" != "Xno"; then
1443 AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
1444 if test "$HAVE_XSERVER" = true ||
131e4133 1445 test -n "$DISPLAY" ||
31ad8850
JD
1446 test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then
1447 AC_MSG_ERROR([You seem to be running X, but no X development libraries
0d875537
GM
1448were found. You should install the relevant development files for X
1449and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make
31ad8850
JD
1450sure you have development files for image handling, i.e.
1451tiff, gif, jpeg, png and xpm.
1452If you are sure you want Emacs compiled without X window support, pass
1453 --without-x
1454to configure.])
1455 fi
1456fi
1457
9ec10b2f 1458### If we're using X11, we should use the X menu package.
08741ba9 1459HAVE_MENUS=no
9ec10b2f 1460case ${HAVE_X11} in
08741ba9 1461 yes ) HAVE_MENUS=yes ;;
9ec10b2f 1462esac
177c0ea7 1463
9ec10b2f
DM
1464### Compute the unexec source name from the object name.
1465UNEXEC_SRC="`echo ${unexec} | sed 's/\.o/.c/'`"
1466
1467# Do the opsystem or machine files prohibit the use of the GNU malloc?
1468# Assume not, until told otherwise.
1469GNU_MALLOC=yes
b05a95cb
RS
1470doug_lea_malloc=yes
1471AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no)
1472AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
fd0a060b
AS
1473AC_CACHE_CHECK(whether __after_morecore_hook exists,
1474 emacs_cv_var___after_morecore_hook,
e9b2a022 1475[AC_TRY_LINK([extern void (* __after_morecore_hook)();],[__after_morecore_hook = 0],
fd0a060b 1476 emacs_cv_var___after_morecore_hook=yes,
e9b2a022 1477 emacs_cv_var___after_morecore_hook=no)])
fd0a060b
AS
1478if test $emacs_cv_var___after_morecore_hook = no; then
1479 doug_lea_malloc=no
1480fi
8cd88038 1481if test "${system_malloc}" = "yes"; then
9ec10b2f
DM
1482 GNU_MALLOC=no
1483 GNU_MALLOC_reason="
b05a95cb 1484 (The GNU allocators don't work with this system configuration.)"
9ec10b2f 1485fi
8cd88038
RS
1486if test "$doug_lea_malloc" = "yes" ; then
1487 if test "$GNU_MALLOC" = yes ; then
1488 GNU_MALLOC_reason="
0855015c 1489 (Using Doug Lea's new malloc from the GNU C Library.)"
8cd88038 1490 fi
5e7d772d
AS
1491 AC_DEFINE(DOUG_LEA_MALLOC, 1,
1492 [Define to 1 if you are using the GNU C Library.])
8cd88038 1493fi
9ec10b2f
DM
1494
1495if test x"${REL_ALLOC}" = x; then
1496 REL_ALLOC=${GNU_MALLOC}
1497fi
1498
e32fac2a 1499dnl For now, need to use an explicit `#define USE_MMAP_FOR_BUFFERS 1'
69c40632 1500dnl the system configuration file (s/*.h) to turn the use of mmap
53c94d4d 1501dnl in the relocating allocator on.
b1b4ce06
GM
1502
1503AC_FUNC_MMAP
e32fac2a
GM
1504if test $use_mmap_for_buffers = yes; then
1505 REL_ALLOC=no
b1b4ce06
GM
1506fi
1507
52c76122 1508LIBS="$libsrc_libs $LIBS"
9ec10b2f
DM
1509
1510dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
1511dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
1512AC_CHECK_LIB(dnet, dnet_ntoa)
1513dnl This causes -lresolv to get used in subsequent tests,
1514dnl which causes failures on some systems such as HPUX 9.
1515dnl AC_CHECK_LIB(resolv, gethostbyname)
1516
1517dnl FIXME replace main with a function we actually want from this library.
1518AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
1519
027dae63 1520AC_CHECK_LIB(pthreads, cma_open)
1d94ee28 1521
5d4245a6 1522AC_MSG_CHECKING(for XFree86 in /usr/X386)
9ec10b2f 1523if test -d /usr/X386/include; then
9ec10b2f 1524 HAVE_XFREE386=yes
6e0dc84a 1525 : ${C_SWITCH_X_SITE="-I/usr/X386/include"}
9ec10b2f 1526else
6e0dc84a 1527 HAVE_XFREE386=no
9ec10b2f 1528fi
6e0dc84a 1529AC_MSG_RESULT($HAVE_XFREE386)
f6214bb7 1530
f4d9f5b8
FP
1531dnl Check for need for bigtoc support on IBM AIX
1532
1533case ${host_os} in
1534aix*)
1535 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
1536 case $GCC in
1537 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
1538 *) gdb_cv_bigtoc=-bbigtoc ;;
1539 esac
1540
1541 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
1542 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
1543 ])
1544 ;;
1545esac
9ec10b2f 1546
9811b1cf
RS
1547# Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets
1548# used for the tests that follow. We set them back to REAL_CFLAGS and
1549# REAL_CPPFLAGS later on.
9ec10b2f 1550
5a9bf171
KR
1551REAL_CPPFLAGS="$CPPFLAGS"
1552
9ec10b2f
DM
1553if test "${HAVE_X11}" = "yes"; then
1554 DEFS="$C_SWITCH_X_SITE $DEFS"
96c20358
RS
1555 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
1556 LIBS="$LIBX $LIBS"
9ec10b2f 1557 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
5a9bf171 1558 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
509fccc3 1559
617a496c
RS
1560 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
1561 # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
1562 # but it's more convenient here to set LD_RUN_PATH
1563 # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
1564 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
1565 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
1566 export LD_RUN_PATH
1567 fi
1568
5ac83f86 1569 if test "${opsys}" = "gnu-linux"; then
3bbe016c 1570 AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
509fccc3
RS
1571 AC_TRY_LINK([],
1572 [XOpenDisplay ("foo");],
3bbe016c
KH
1573 [xlinux_first_failure=no],
1574 [xlinux_first_failure=yes])
1575 if test "${xlinux_first_failure}" = "yes"; then
509fccc3
RS
1576 OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
1577 OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
1578 OLD_CPPFLAGS="$CPPFLAGS"
1579 OLD_LIBS="$LIBS"
1580 LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
1581 C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
1582 CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
1583 LIBS="$LIBS -b i486-linuxaout"
1584 AC_TRY_LINK([],
1585 [XOpenDisplay ("foo");],
3bbe016c
KH
1586 [xlinux_second_failure=no],
1587 [xlinux_second_failure=yes])
1588 if test "${xlinux_second_failure}" = "yes"; then
509fccc3
RS
1589 # If we get the same failure with -b, there is no use adding -b.
1590 # So take it out. This plays safe.
1591 LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
1592 C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
1593 CPPFLAGS="$OLD_CPPFLAGS"
1594 LIBS="$OLD_LIBS"
1595 AC_MSG_RESULT(no)
1596 else
1597 AC_MSG_RESULT(yes)
1598 fi
1599 else
1600 AC_MSG_RESULT(no)
1601 fi
1602 fi
1603
9ca4be21
GM
1604 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
1605 # header files included from there.
1606 AC_MSG_CHECKING(for Xkb)
1607 AC_TRY_LINK([#include <X11/Xlib.h>
1608#include <X11/XKBlib.h>],
1609 [XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);],
1610 emacs_xkb=yes, emacs_xkb=no)
ad4ac636 1611 AC_MSG_RESULT($emacs_xkb)
9ca4be21 1612 if test $emacs_xkb = yes; then
5e7d772d 1613 AC_DEFINE(HAVE_XKBGETKEYBOARD, 1, [Define to 1 if you have the XkbGetKeyboard function.])
9ca4be21
GM
1614 fi
1615
6e0dc84a 1616 AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
9ca4be21 1617XScreenNumberOfScreen XSetWMProtocols)
9ec10b2f
DM
1618fi
1619
08741ba9 1620if test "${window_system}" = "x11"; then
4be21f66 1621 AC_MSG_CHECKING(X11 version 6)
fd0a060b 1622 AC_CACHE_VAL(emacs_cv_x11_version_6,
e9b2a022 1623 [AC_TRY_LINK([#include <X11/Xlib.h>],
08741ba9
RS
1624[#if XlibSpecificationRelease < 6
1625fail;
1626#endif
e9b2a022 1627], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
fd0a060b
AS
1628 if test $emacs_cv_x11_version_6 = yes; then
1629 AC_MSG_RESULT(6 or newer)
5e7d772d
AS
1630 AC_DEFINE(HAVE_X11R6, 1,
1631 [Define to 1 if you have the X11R6 or newer version of Xlib.])
fd0a060b
AS
1632 else
1633 AC_MSG_RESULT(before 6)
1634 fi
08741ba9
RS
1635fi
1636
f7894e88 1637
96f574f0
GM
1638### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
1639HAVE_RSVG=no
7abdcaf4 1640if test "${HAVE_X11}" = "yes" || test "${HAVE_CARBON}" = "yes"; then
96f574f0
GM
1641 if test "${with_rsvg}" != "no"; then
1642 dnl Check if `--with-pkg-config-prog' has been given.
1643 if test "X${with_pkg_config_prog}" != X; then
1644 PKG_CONFIG="${with_pkg_config_prog}"
1645 fi
1646
1647 RSVG_REQUIRED=2.0.0
1648 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
1649
1650 PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, :, :)
1651 AC_SUBST(RSVG_CFLAGS)
1652 AC_SUBST(RSVG_LIBS)
1653
1654 if test ".${RSVG_CFLAGS}" != "."; then
1655 HAVE_RSVG=yes
1656 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
1657 CFLAGS="$CFLAGS $RSVG_CFLAGS"
1658 LIBS="$RSVG_LIBS $LIBS"
1659 fi
1660 fi
1661fi
1662
1663
488dd4c4 1664HAVE_GTK=no
a8ba915c
JD
1665if test "${with_gtk}" = "yes" && test "$USE_X_TOOLKIT" = "gtk"; then
1666 USE_X_TOOLKIT=none
1667fi
4f823057
GM
1668if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk" || \
1669 test "$USE_X_TOOLKIT" = "maybe"; then
cd890796 1670 if test "$USE_X_TOOLKIT" != "none" && test "$USE_X_TOOLKIT" != "maybe"; then
488dd4c4
JD
1671 AC_MSG_ERROR([Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}]);
1672 fi
f8932819
JD
1673 GLIB_REQUIRED=2.6
1674 GTK_REQUIRED=2.6
488dd4c4
JD
1675 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
1676
1677 dnl Check if --with-pkg-config-prog has been given.
1678 if test "X${with_pkg_config_prog}" != X; then
1679 PKG_CONFIG="${with_pkg_config_prog}"
1680 fi
1681 dnl Checks for libraries.
4f823057
GM
1682 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
1683 if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
1684 AC_MSG_ERROR($GTK_PKG_ERRORS)
1685 fi
1686fi
1687
1688
1689if test x"$pkg_check_gtk" = xyes; then
1690
488dd4c4
JD
1691 AC_SUBST(GTK_CFLAGS)
1692 AC_SUBST(GTK_LIBS)
1693 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
57669b57
JD
1694 CFLAGS="$CFLAGS $GTK_CFLAGS"
1695 LIBS="$GTK_LIBS $LIBS"
a8ba915c
JD
1696 dnl Try to compile a simple GTK program.
1697 GTK_COMPILES=no
1698 AC_CHECK_FUNCS(gtk_main, GTK_COMPILES=yes)
1699 if test "${GTK_COMPILES}" != "yes"; then
4f823057
GM
1700 if test "$USE_X_TOOLKIT" != "maybe"; then
1701 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
1702 fi
1703 else
1704 HAVE_GTK=yes
1705 AC_DEFINE(HAVE_GTK, 1, [Define to 1 if using GTK.])
1706 USE_X_TOOLKIT=none
a8ba915c 1707 fi
4f823057
GM
1708
1709fi
1710
1711
1712if test "${HAVE_GTK}" = "yes"; then
488dd4c4 1713
57669b57 1714 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
488dd4c4 1715 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
d0a80c21
JD
1716 if test "$with_toolkit_scroll_bars" != no; then
1717 with_toolkit_scroll_bars=yes
1718 fi
57669b57
JD
1719
1720 dnl Check if we can use multiple displays with this GTK version.
1721 dnl If gdk_display_open exists, assume all others are there also.
3410a550 1722 HAVE_GTK_MULTIDISPLAY=no
fa1b1007
KL
1723 AC_CHECK_FUNCS(gdk_display_open, HAVE_GTK_MULTIDISPLAY=yes)
1724 if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then
1725 AC_DEFINE(HAVE_GTK_MULTIDISPLAY, 1,
1726 [Define to 1 if GTK can handle more than one display.])
1727 fi
5f6a587f 1728
572a3cc2
JD
1729 dnl Check if we have the old file selection dialog.
1730 dnl If gdk_display_open exists, assume all others are there also.
1731 HAVE_GTK_FILE_SELECTION=no
1732 AC_CHECK_FUNCS(gtk_file_selection_new, HAVE_GTK_FILE_SELECTION=yes)
1733
1734 dnl Check if we have the new file chooser dialog
1735 dnl If gdk_display_open exists, assume all others are there also.
1736 HAVE_GTK_FILE_CHOOSER=no
1737 AC_CHECK_FUNCS(gtk_file_chooser_dialog_new, HAVE_GTK_FILE_CHOOSER=yes)
1738
1739 if test "$HAVE_GTK_FILE_SELECTION" = yes \
1740 && test "$HAVE_GTK_FILE_CHOOSER" = yes; then
1741 AC_DEFINE(HAVE_GTK_FILE_BOTH, 1,
1742 [Define to 1 if GTK has both file selection and chooser dialog.])
1743 fi
b8bdffbe
JD
1744
1745 dnl Check if pthreads are available. Emacs only needs this when using
1746 dnl gtk_file_chooser under Gnome.
1747 if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
1748 HAVE_GTK_AND_PTHREAD=no
1749 AC_CHECK_HEADERS(pthread.h)
1750 if test "$ac_cv_header_pthread_h"; then
1751 AC_CHECK_LIB(pthread, pthread_self, HAVE_GTK_AND_PTHREAD=yes)
1752 fi
1753 if test "$HAVE_GTK_AND_PTHREAD" = yes; then
846d1b3e
JD
1754 case "${canonical}" in
1755 *-hpux*) ;;
1756 *) GTK_LIBS="$GTK_LIBS -lpthread" ;;
1757 esac
b8bdffbe
JD
1758 AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1,
1759 [Define to 1 if you have GTK and pthread (-lpthread).])
1760 fi
1761 fi
488dd4c4
JD
1762fi
1763
131e4133
MA
1764dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
1765dnl other platforms. Support for higher D-Bus versions but 1.0 is
1766dnl also not configured.
1767HAVE_DBUS=no
1768if test "${with_dbus}" = "yes"; then
cffe4909 1769 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
131e4133
MA
1770 if test "$HAVE_DBUS" = yes; then
1771 AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
131e4133
MA
1772 fi
1773fi
131e4133 1774
aa4ff486
JD
1775### Link with -lXft if available to work around a bug.
1776HAVE_XFT=maybe
1777if test "${HAVE_GTK}" = "yes"; then
1778 dnl Check if --with-pkg-config-prog has been given.
1779 if test "X${with_pkg_config_prog}" != X; then
1780 PKG_CONFIG="${with_pkg_config_prog}"
1781 fi
1782
1783 PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
1784 if test "$HAVE_XFT" != no; then
1785 OLD_CFLAGS="$CPPFLAGS"
36942957 1786 OLD_CPPFLAGS="$CFLAGS"
aa4ff486
JD
1787 OLD_LIBS="$LIBS"
1788 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
1789 CFLAGS="$CFLAGS $XFT_CFLAGS"
1790 LIBS="$XFT_LIBS $LIBS"
1791 AC_CHECK_HEADER(X11/Xft/Xft.h,
28aa2c3e 1792 [AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS)])
aa4ff486
JD
1793
1794 if test "${HAVE_XFT}" = "yes"; then
1795 AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
1796 AC_SUBST(XFT_LIBS)
1797 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
1798 else
1799 CFLAGS="$OLD_CPPFLAGS"
1800 CFLAGS="$OLD_CFLAGS"
1801 LIBS="$OLD_LIBS"
1802 fi
1803 fi
1804fi
1805
bce97856
RS
1806dnl Do not put whitespace before the #include statements below.
1807dnl Older compilers (eg sunos4 cc) choke on it.
687b2aa3 1808HAVE_XAW3D=no
465ace28 1809if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
e818a450
JD
1810 if test "$with_xaw3d" != no; then
1811 AC_MSG_CHECKING(for xaw3d)
1812 AC_CACHE_VAL(emacs_cv_xaw3d,
1813 [AC_TRY_LINK([
bce97856 1814#include <X11/Intrinsic.h>
687b2aa3 1815#include <X11/Xaw3d/Simple.h>],
e818a450
JD
1816 [],
1817 emacs_cv_xaw3d=yes,
1818 emacs_cv_xaw3d=no)])
1819 else
1820 emacs_cv_xaw3d=no
1821 fi
1822 if test $emacs_cv_xaw3d = yes; then
1823 AC_MSG_RESULT([yes; using Lucid toolkit])
1824 USE_X_TOOLKIT=LUCID
1825 HAVE_XAW3D=yes
1826 AC_DEFINE(HAVE_XAW3D, 1,
1827 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
1828 else
1829 AC_MSG_RESULT(no)
1830 AC_MSG_CHECKING(for libXaw)
1831 AC_CACHE_VAL(emacs_cv_xaw,
1832 [AC_TRY_LINK([
1833#include <X11/Intrinsic.h>
1834#include <X11/Xaw/Simple.h>],
1835 [],
1836 emacs_cv_xaw=yes,
1837 emacs_cv_xaw=no)])
1838 if test $emacs_cv_xaw = yes; then
687b2aa3 1839 AC_MSG_RESULT([yes; using Lucid toolkit])
fd0a060b 1840 USE_X_TOOLKIT=LUCID
e818a450
JD
1841 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
1842 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
fd0a060b 1843 else
e818a450
JD
1844 AC_MSG_RESULT([no; do not use toolkit by default])
1845 USE_X_TOOLKIT=none
fd0a060b 1846 fi
f7894e88 1847 fi
4be21f66
KH
1848fi
1849
1850X_TOOLKIT_TYPE=$USE_X_TOOLKIT
1851
9ec10b2f
DM
1852if test "${USE_X_TOOLKIT}" != "none"; then
1853 AC_MSG_CHECKING(X11 toolkit version)
fd0a060b 1854 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
e9b2a022 1855 [AC_TRY_LINK([#include <X11/Intrinsic.h>],
9ec10b2f
DM
1856[#if XtSpecificationRelease < 6
1857fail;
1858#endif
e9b2a022 1859], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
fd0a060b
AS
1860 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
1861 if test $emacs_cv_x11_toolkit_version_6 = yes; then
1862 AC_MSG_RESULT(6 or newer)
5e7d772d
AS
1863 AC_DEFINE(HAVE_X11XTR6, 1,
1864 [Define to 1 if you have the X11R6 or newer version of Xt.])
fd0a060b
AS
1865 else
1866 AC_MSG_RESULT(before 6)
1867 fi
6aad10e4
RS
1868
1869dnl If using toolkit, check whether libXmu.a exists.
1870dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
1871 OLDLIBS="$LIBS"
fcc303f4
RS
1872 if test x$HAVE_X11XTR6 = xyes; then
1873 LIBS="-lXt -lSM -lICE $LIBS"
1874 else
1875 LIBS="-lXt $LIBS"
1876 fi
6aad10e4 1877 AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
ad4ac636
GM
1878 test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
1879fi
1880
1881# On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
1882if test "${HAVE_X11}" = "yes"; then
1883 if test "${USE_X_TOOLKIT}" != "none"; then
1884 AC_CHECK_LIB(Xext, XShapeQueryExtension)
1885 fi
9ec10b2f
DM
1886fi
1887
66d736a9 1888if test "${USE_X_TOOLKIT}" = "MOTIF"; then
fd0a060b 1889 AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1,
e9b2a022 1890 [AC_TRY_COMPILE([#include <Xm/Xm.h>],
66d736a9
RS
1891 [#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
1892int x = 5;
1893#else
1894Motif version prior to 2.1.
1895#endif],
e9b2a022 1896 emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
fd0a060b
AS
1897 HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1
1898 if test $emacs_cv_motif_version_2_1 = yes; then
d96a4de3 1899 HAVE_LIBXP=no
5e7d772d
AS
1900 AC_DEFINE(HAVE_MOTIF_2_1, 1,
1901 [Define to 1 if you have Motif 2.1 or newer.])
ad4ac636 1902 AC_CHECK_LIB(Xp, XpCreateContext, HAVE_LIBXP=yes)
72d9b5b3 1903 if test ${HAVE_LIBXP} = yes; then
5e7d772d
AS
1904 AC_DEFINE(HAVE_LIBXP, 1,
1905 [Define to 1 if you have the Xp library (-lXp).])
177c0ea7 1906 fi
4693dbc9
SM
1907 else
1908 AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
1909 # We put this in CFLAGS temporarily to precede other -I options
1910 # that might be in CFLAGS temporarily.
1911 # We put this in CPPFLAGS where it precedes the other -I options.
1912 OLD_CPPFLAGS=$CPPFLAGS
1913 OLD_CFLAGS=$CFLAGS
1914 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
1915 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
1916 [AC_TRY_COMPILE([#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>],
1917 [int x = 5;],
1918 emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
1919 if test $emacs_cv_lesstif = yes; then
1920 # Make sure this -I option remains in CPPFLAGS after it is set
1921 # back to REAL_CPPFLAGS.
1922 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
1923 # have those other -I options anyway. Ultimately, having this
1924 # directory ultimately in CPPFLAGS will be enough.
1925 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
1926 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
1927 else
1928 CFLAGS=$OLD_CFLAGS
1929 CPPFLAGS=$OLD_CPPFLAGS
1930 fi
fd0a060b 1931 fi
66d736a9
RS
1932fi
1933
488dd4c4 1934dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
0be97a72
GM
1935dnl using Motif or Xaw3d is available, and unless
1936dnl --with-toolkit-scroll-bars=no was specified.
1937
5e7d772d
AS
1938AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
1939 [Define to 1 if we should use toolkit scroll bars.])dnl
0be97a72
GM
1940USE_TOOLKIT_SCROLL_BARS=no
1941if test "${with_toolkit_scroll_bars}" != "no"; then
1942 if test "${USE_X_TOOLKIT}" != "none"; then
1943 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
1944 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1945 HAVE_XAW3D=no
1946 USE_TOOLKIT_SCROLL_BARS=yes
1947 elif test "${HAVE_XAW3D}" = "yes"; then
1948 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1949 USE_TOOLKIT_SCROLL_BARS=yes
1950 fi
488dd4c4
JD
1951 elif test "${HAVE_GTK}" = "yes"; then
1952 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1953 USE_TOOLKIT_SCROLL_BARS=yes
de0a3247
YM
1954 elif test "${HAVE_CARBON}" = "yes"; then
1955 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1956 USE_TOOLKIT_SCROLL_BARS=yes
0be97a72
GM
1957 fi
1958fi
1959
0d936a36
RS
1960dnl See if XIM is available.
1961AC_TRY_COMPILE([
1962 #include <X11/Xlib.h>
1963 #include <X11/Xresource.h>],
1964 [XIMProc callback;],
28aa2c3e
AS
1965 [HAVE_XIM=yes
1966 AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
0d936a36
RS
1967 HAVE_XIM=no)
1968
1969dnl `--with-xim' now controls only the initial value of use_xim at run time.
c6f7dae8
GM
1970
1971if test "${with_xim}" != "no"; then
5e7d772d
AS
1972 AC_DEFINE(USE_XIM, 1,
1973 [Define to 1 if we should use XIM, if it is available.])
4fdbcac5 1974fi
f6214bb7 1975
0d936a36
RS
1976
1977if test "${HAVE_XIM}" != "no"; then
a6c2ef66
DL
1978 late_CFLAGS=$CFLAGS
1979 if test "$GCC" = yes; then
1980 CFLAGS="$CFLAGS --pedantic-errors"
1981 fi
1c3a8acf
DL
1982 AC_TRY_COMPILE([
1983#include <X11/Xlib.h>
1984#include <X11/Xresource.h>],
1985[Display *display;
1986XrmDatabase db;
1987char *res_name;
1988char *res_class;
1989XIMProc callback;
1990XPointer *client_data;
a6c2ef66
DL
1991#ifndef __GNUC__
1992/* If we're not using GCC, it's probably not XFree86, and this is
1993 probably right, but we can't use something like --pedantic-errors. */
1994extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
1995 char*, XIMProc, XPointer*);
1996#endif
1c3a8acf
DL
1997(void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
1998 client_data);],
1999 [emacs_cv_arg6_star=yes])
2000 AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
2001 [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
2002either XPointer or XPointer*.])dnl
2003 if test "$emacs_cv_arg6_star" = yes; then
8cfdf2ca 2004 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
1c3a8acf 2005 else
8cfdf2ca 2006 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
1c3a8acf 2007 fi
a6c2ef66 2008 CFLAGS=$late_CFLAGS
c6f7dae8
GM
2009fi
2010
620fdfdf
RS
2011### Use -lXpm if available, unless `--with-xpm=no'.
2012HAVE_XPM=no
2013if test "${HAVE_X11}" = "yes"; then
2014 if test "${with_xpm}" != "no"; then
620fdfdf 2015 AC_CHECK_HEADER(X11/xpm.h,
28aa2c3e 2016 [AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11)])
7960d0bd 2017 if test "${HAVE_XPM}" = "yes"; then
29c1b68e
GM
2018 AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
2019 AC_EGREP_CPP(no_return_alloc_pixels,
2020 [#include "X11/xpm.h"
7960d0bd
GM
2021#ifndef XpmReturnAllocPixels
2022no_return_alloc_pixels
2023#endif
29c1b68e
GM
2024 ], HAVE_XPM=no, HAVE_XPM=yes)
2025
2026 if test "${HAVE_XPM}" = "yes"; then
2027 AC_MSG_RESULT(yes)
2028 else
2029 AC_MSG_RESULT(no)
2030 fi
1890c0c4 2031 fi
620fdfdf
RS
2032 fi
2033
2034 if test "${HAVE_XPM}" = "yes"; then
5e7d772d 2035 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).])
620fdfdf
RS
2036 fi
2037fi
177c0ea7 2038
620fdfdf
RS
2039### Use -ljpeg if available, unless `--with-jpeg=no'.
2040HAVE_JPEG=no
2041if test "${HAVE_X11}" = "yes"; then
2042 if test "${with_jpeg}" != "no"; then
71cc40d5 2043 dnl Checking for jpeglib.h can lose because of a redefinition of
3cc9d384
DL
2044 dnl HAVE_STDLIB_H.
2045 AC_CHECK_HEADER(jerror.h,
28aa2c3e 2046 [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
620fdfdf
RS
2047 fi
2048
5e7d772d 2049 AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
620fdfdf
RS
2050 if test "${HAVE_JPEG}" = "yes"; then
2051 AC_DEFINE(HAVE_JPEG)
91b5aa9a 2052 AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
a0dd4fa6 2053 [#include <jpeglib.h>
4d766b59 2054 version=JPEG_LIB_VERSION
177c0ea7 2055],
28aa2c3e 2056 [AC_DEFINE(HAVE_JPEG)],
4d766b59
RS
2057 [AC_MSG_WARN([libjpeg found, but not version 6b or later])
2058 HAVE_JPEG=no])
620fdfdf
RS
2059 fi
2060fi
177c0ea7 2061
620fdfdf
RS
2062### Use -lpng if available, unless `--with-png=no'.
2063HAVE_PNG=no
2064if test "${HAVE_X11}" = "yes"; then
2065 if test "${with_png}" != "no"; then
8cfdf2ca
DL
2066 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
2067 # in /usr/include/libpng.
2068 AC_CHECK_HEADERS(png.h libpng/png.h)
2069 if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
2070 AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
2071 fi
620fdfdf
RS
2072 fi
2073
2074 if test "${HAVE_PNG}" = "yes"; then
5e7d772d 2075 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
620fdfdf
RS
2076 fi
2077fi
177c0ea7 2078
620fdfdf
RS
2079### Use -ltiff if available, unless `--with-tiff=no'.
2080HAVE_TIFF=no
2081if test "${HAVE_X11}" = "yes"; then
2082 if test "${with_tiff}" != "no"; then
620fdfdf 2083 AC_CHECK_HEADER(tiffio.h,
28aa2c3e 2084 [tifflibs="-lz -lm"
3b3cc4a4
KR
2085 # At least one tiff package requires the jpeg library.
2086 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
28aa2c3e 2087 AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs)])
620fdfdf
RS
2088 fi
2089
2090 if test "${HAVE_TIFF}" = "yes"; then
5e7d772d 2091 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
620fdfdf
RS
2092 fi
2093fi
177c0ea7 2094
47d1e061 2095### Use -lgif or -lungif if available, unless `--with-gif=no'.
620fdfdf 2096HAVE_GIF=no
47d1e061
GM
2097if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
2098 AC_CHECK_HEADER(gif_lib.h,
4d766b59
RS
2099# EGifPutExtensionLast only exists from version libungif-4.1.0b1.
2100# Earlier versions can crash Emacs.
28aa2c3e 2101 [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, try_libungif=yes)])
47d1e061
GM
2102
2103 if test "$HAVE_GIF" = yes; then
12d9c91d 2104 ac_gif_lib_name="-lgif"
47d1e061
GM
2105 fi
2106
12d9c91d
GM
2107# If gif_lib.h but no libgif, try libungif.
2108 if test x"$try_libungif" = xyes; then
2109 AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes)
47d1e061
GM
2110
2111 if test "$HAVE_GIF" = yes; then
12d9c91d
GM
2112 AC_DEFINE(LIBGIF, -lungif, [Compiler option to link with the gif library (if not -lgif).])
2113 ac_gif_lib_name="-lungif"
47d1e061 2114 fi
620fdfdf
RS
2115 fi
2116
2117 if test "${HAVE_GIF}" = "yes"; then
12d9c91d 2118 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif library (default -lgif; otherwise specify with LIBGIF).])
bfa6fb7e
JD
2119 fi
2120fi
2121
2122dnl Check for required libraries.
2123if test "${HAVE_X11}" = "yes"; then
2124 MISSING=""
2125 WITH_NO=""
2126 test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
2127 MISSING="libXpm" && WITH_NO="--with-xpm=no"
2128 test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
2129 MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
2130 test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
2131 MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
2132 test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
2133 MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
2134 test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
2135 MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
2136
2137 if test "X${MISSING}" != X; then
3d20d6aa 2138 AC_MSG_ERROR([The following required libraries were not found:
bfa6fb7e 2139 $MISSING
1ee86f21 2140Maybe some development libraries/packages are missing?
bfa6fb7e
JD
2141If you don't want to link with them give
2142 $WITH_NO
2143as options to configure])
620fdfdf
RS
2144 fi
2145fi
2146
79011b82
NR
2147### Use -lgpm if available, unless `--with-gpm=no'.
2148HAVE_GPM=no
2149if test "${with_gpm}" != "no"; then
2150 AC_CHECK_HEADER(gpm.h,
28aa2c3e 2151 [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
79011b82
NR
2152fi
2153
2154if test "${HAVE_GPM}" = "yes"; then
2155 AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
2156fi
2157
cef11da2 2158dnl Check for malloc/malloc.h on darwin
28aa2c3e 2159AC_CHECK_HEADER(malloc/malloc.h, [AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to 1 if you have the <malloc/malloc.h> header file.])])
cef11da2 2160
de0a3247 2161### Use Mac OS X Carbon API to implement GUI.
e0f712ba 2162if test "${HAVE_CARBON}" = "yes"; then
e3ba1015 2163 AC_DEFINE(HAVE_CARBON, 1, [Define to 1 if you are using the Carbon API on Mac OS X.])
52cd7d02
ST
2164 ## Specify the install directory
2165 carbon_appdir=
2166 if test "${carbon_appdir_x}" != ""; then
2167 case ${carbon_appdir_x} in
2168 y | ye | yes) carbon_appdir=/Applications ;;
2169 * ) carbon_appdir=${carbon_appdir_x} ;;
2170 esac
2171 fi
12bf22e0
AS
2172 # We also have mouse menus.
2173 HAVE_MENUS=yes
e0f712ba
AC
2174fi
2175
f21fadcc
JD
2176### Use session management (-lSM -lICE) if available
2177HAVE_X_SM=no
2178if test "${HAVE_X11}" = "yes"; then
2179 AC_CHECK_HEADER(X11/SM/SMlib.h,
28aa2c3e 2180 [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
f21fadcc
JD
2181
2182 if test "${HAVE_X_SM}" = "yes"; then
5e7d772d 2183 AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
f21fadcc
JD
2184 case "$LIBS" in
2185 *-lSM*) ;;
2186 *) LIBS="-lSM -lICE $LIBS" ;;
2187 esac
2188 fi
2189fi
177c0ea7 2190
9ec10b2f 2191# If netdb.h doesn't declare h_errno, we must declare it by hand.
fd0a060b
AS
2192AC_CACHE_CHECK(whether netdb declares h_errno,
2193 emacs_cv_netdb_declares_h_errno,
e9b2a022 2194[AC_TRY_LINK([#include <netdb.h>],
01345308 2195 [return h_errno;],
e9b2a022 2196 emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
fd0a060b 2197if test $emacs_cv_netdb_declares_h_errno = yes; then
5e7d772d 2198 AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.])
fd0a060b 2199fi
9ec10b2f 2200
6e0dc84a 2201AC_FUNC_ALLOCA
9ec10b2f 2202
4756ee42
GM
2203dnl src/alloca.c has been removed. Could also check if $ALLOCA is set?
2204dnl FIXME is there an autoconf test that does the right thing, without
2205dnl needing to call A_M_E afterwards?
2206if test x"$ac_cv_func_alloca_works" != xyes; then
2207 AC_MSG_ERROR( [a system implementation of alloca is required] )
2208fi
2209
f6e8adea 2210# fmod, logb, and frexp are found in -lm on most systems.
e468fb38 2211# On HPUX 9.01, -lm does not contain logb, so check for sqrt.
e6fd9047 2212AC_CHECK_LIB(m, sqrt)
e6fd9047 2213
4b121527
DL
2214# Check for mail-locking functions in a "mail" library. Probably this should
2215# have the same check as for liblockfile below.
5ad9ac92
DL
2216AC_CHECK_LIB(mail, maillock)
2217dnl Debian, at least:
5ad9ac92
DL
2218AC_CHECK_LIB(lockfile, maillock)
2219# If we have the shared liblockfile, assume we must use it for mail
2220# locking (e.g. Debian). If we couldn't link against liblockfile
2221# (no liblockfile.a installed), ensure that we don't need to.
2222if test "$ac_cv_lib_lockfile_maillock" = no; then
2223 dnl This works for files generally, not just executables.
2224 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
2225 AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
2226 /usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH)
2227 if test $ac_cv_prog_liblockfile = yes; then
2228 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
2229This probably means that movemail could lose mail.
91b5aa9a 2230There may be a `development' package to install containing liblockfile.])
5ad9ac92 2231 else :
4b121527 2232 fi
5ad9ac92
DL
2233fi
2234AC_CHECK_FUNCS(touchlock)
2235AC_CHECK_HEADERS(maillock.h)
4e4db900 2236
66abe596 2237AC_CHECK_FUNCS(gethostname getdomainname dup2 \
e1d954e4 2238rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
555ffc3f 2239random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
85ea1a28 2240strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
12c0a8da 2241utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \
ec406751 2242__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
66abe596 2243sendto recvfrom getsockopt setsockopt getsockname getpeername \
72621b4e 2244gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
4489ece2 2245memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign)
38c44a91 2246
66abe596
KS
2247AC_CHECK_HEADERS(sys/un.h)
2248
38c44a91
DL
2249AC_FUNC_MKTIME
2250if test "$ac_cv_func_working_mktime" = no; then
5e7d772d 2251 AC_DEFINE(BROKEN_MKTIME, 1, [Define to 1 if the mktime function is broken.])
38c44a91
DL
2252fi
2253
1ca2077a
DL
2254AC_FUNC_GETLOADAVG
2255
64a04a42 2256AC_FUNC_FSEEKO
63c59d1e 2257
9eff9fe3
PE
2258# Configure getopt.
2259m4_include([m4/getopt.m4])
2260gl_GETOPT_IFELSE([
2261 gl_GETOPT_SUBSTITUTE_HEADER
2262 gl_PREREQ_GETOPT
2263 GETOPTOBJS='getopt.o getopt1.o'
2264])
2265AC_SUBST(GETOPTOBJS)
2266
71cc40d5
DL
2267AC_FUNC_GETPGRP
2268
12c0a8da
DL
2269AC_FUNC_STRFTIME
2270
64a04a42 2271# UNIX98 PTYs.
40ccc4c7
GM
2272AC_CHECK_FUNCS(grantpt)
2273
2274# PTY-related GNU extensions.
2275AC_CHECK_FUNCS(getpt)
2276
16831d8c
RS
2277# Check this now, so that we will NOT find the above functions in ncurses.
2278# That is because we have not set up to link ncurses in lib-src.
2279# It's better to believe a function is not available
2280# than to expect to find it in ncurses.
2281AC_CHECK_LIB(ncurses, tparm)
0c565a0a 2282
555ffc3f
CY
2283# Do we have res_init, for detecting changes in /etc/resolv.conf?
2284
2285resolv=no
c0a3f2a2
AS
2286AC_TRY_LINK([#include <netinet/in.h>
2287#include <arpa/nameser.h>
2288#include <resolv.h>],
2289 [return res_init();],
2290 have_res_init=yes, have_res_init=no)
555ffc3f
CY
2291if test "$have_res_init" = no; then
2292 OLIBS="$LIBS"
2293 LIBS="$LIBS -lresolv"
2294 AC_MSG_CHECKING(for res_init with -lresolv)
2295 AC_TRY_LINK([#include <netinet/in.h>
2296#include <arpa/nameser.h>
c0a3f2a2
AS
2297#include <resolv.h>],
2298 [return res_init();],
555ffc3f
CY
2299 have_res_init=yes, have_res_init=no)
2300 AC_MSG_RESULT($have_res_init)
2301 if test "$have_res_init" = yes ; then
2302 resolv=yes
2303 fi
2304 LIBS="$OLIBS"
2305fi
2306
2307if test "$have_res_init" = yes; then
2308 AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
2309fi
2310
84e70f78
KR
2311# Do we need the Hesiod library to provide the support routines?
2312if test "$with_hesiod" = yes ; then
2313 # Don't set $LIBS here -- see comments above.
84e70f78
KR
2314 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
2315 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
2316 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
2317 if test "$resolv" = yes ; then
2318 RESOLVLIB=-lresolv
84e70f78
KR
2319 else
2320 RESOLVLIB=
2321 fi
2322 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
28aa2c3e
AS
2323 [AC_DEFINE(HAVE_LIBHESIOD, 1,
2324 [Define to 1 if you have the hesiod library (-lhesiod).])],
5e7d772d 2325 :, $RESOLVLIB)])
84e70f78
KR
2326fi
2327
555ffc3f
CY
2328# Do we need libresolv (due to res_init or Hesiod)?
2329if test "$resolv" = yes ; then
2330 AC_DEFINE(HAVE_LIBRESOLV, 1,
2331 [Define to 1 if you have the resolv library (-lresolv).])
2332fi
2333
a21616bd
KR
2334# These tell us which Kerberos-related libraries to use.
2335if test "${with_kerberos+set}" = set; then
2336 AC_CHECK_LIB(com_err, com_err)
2337 AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt)
2338 AC_CHECK_LIB(crypto, mit_des_cbc_encrypt)
2339 AC_CHECK_LIB(krb5, krb5_init_context)
2340 if test "${with_kerberos5+set}" != set; then
2341 AC_CHECK_LIB(des425, des_cbc_encrypt,,
28aa2c3e 2342 [AC_CHECK_LIB(des, des_cbc_encrypt)])
a21616bd 2343 AC_CHECK_LIB(krb4, krb_get_cred,,
28aa2c3e 2344 [AC_CHECK_LIB(krb, krb_get_cred)])
a21616bd
KR
2345 fi
2346
2347 if test "${with_kerberos5+set}" = set; then
2348 AC_CHECK_HEADERS(krb5.h)
2349 else
2350 AC_CHECK_HEADERS(des.h,,
5a129faf
PE
2351 [AC_CHECK_HEADERS(kerberosIV/des.h,,
2352 [AC_CHECK_HEADERS(kerberos/des.h)])])
a21616bd 2353 AC_CHECK_HEADERS(krb.h,,
5a129faf
PE
2354 [AC_CHECK_HEADERS(kerberosIV/krb.h,,
2355 [AC_CHECK_HEADERS(kerberos/krb.h)])])
a21616bd
KR
2356 fi
2357 AC_CHECK_HEADERS(com_err.h)
2358fi
2359
c4510052
PE
2360# Solaris requires -lintl if you want strerror (which calls dgettext)
2361# to return localized messages.
2362AC_CHECK_LIB(intl, dgettext)
2363
0c565a0a
RS
2364AC_MSG_CHECKING(whether localtime caches TZ)
2365AC_CACHE_VAL(emacs_cv_localtime_cache,
fcc303f4 2366[if test x$ac_cv_func_tzset = xyes; then
0c565a0a 2367AC_TRY_RUN([#include <time.h>
22cc077c
RS
2368extern char **environ;
2369unset_TZ ()
2370{
2371 char **from, **to;
2372 for (to = from = environ; (*to = *from); from++)
2373 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
2374 to++;
2375}
98ab445d
RS
2376char TZ_GMT0[] = "TZ=GMT0";
2377char TZ_PST8[] = "TZ=PST8";
0c565a0a
RS
2378main()
2379{
2380 time_t now = time ((time_t *) 0);
22cc077c 2381 int hour_GMT0, hour_unset;
98ab445d 2382 if (putenv (TZ_GMT0) != 0)
0c565a0a 2383 exit (1);
22cc077c
RS
2384 hour_GMT0 = localtime (&now)->tm_hour;
2385 unset_TZ ();
2386 hour_unset = localtime (&now)->tm_hour;
98ab445d 2387 if (putenv (TZ_PST8) != 0)
0c565a0a 2388 exit (1);
22cc077c
RS
2389 if (localtime (&now)->tm_hour == hour_GMT0)
2390 exit (1);
2391 unset_TZ ();
2392 if (localtime (&now)->tm_hour != hour_unset)
2393 exit (1);
2394 exit (0);
0c565a0a
RS
2395}], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
2396[# If we have tzset, assume the worst when cross-compiling.
2397emacs_cv_localtime_cache=yes])
2398else
2399 # If we lack tzset, report that localtime does not cache TZ,
2400 # since we can't invalidate the cache if we don't have tzset.
2401 emacs_cv_localtime_cache=no
2402fi])dnl
2403AC_MSG_RESULT($emacs_cv_localtime_cache)
2404if test $emacs_cv_localtime_cache = yes; then
5e7d772d
AS
2405 AC_DEFINE(LOCALTIME_CACHE, 1,
2406 [Define to 1 if localtime caches TZ.])
0c565a0a 2407fi
9ec10b2f 2408
3d68df05 2409if test "x$HAVE_TIMEVAL" = xyes; then
8a2c2328 2410 AC_CHECK_FUNCS(gettimeofday)
5e7d772d
AS
2411 if test $ac_cv_func_gettimeofday = yes; then
2412 AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
2413 emacs_cv_gettimeofday_two_arguments,
2414 [AC_TRY_COMPILE([
5ab52d42
RS
2415#ifdef TIME_WITH_SYS_TIME
2416#include <sys/time.h>
2417#include <time.h>
2418#else
2419#ifdef HAVE_SYS_TIME_H
2420#include <sys/time.h>
2421#else
2422#include <time.h>
2423#endif
290c1191 2424#endif],
5e7d772d
AS
2425 [struct timeval time;
2426 gettimeofday (&time, 0);],
2427 emacs_cv_gettimeofday_two_arguments=yes,
2428 emacs_cv_gettimeofday_two_arguments=no)])
2429 if test $emacs_cv_gettimeofday_two_arguments = no; then
2430 AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT, 1,
2431 [Define to 1 if gettimeofday accepts only one argument.])
2432 fi
fd0a060b 2433 fi
5ab52d42
RS
2434fi
2435
9ec10b2f 2436ok_so_far=yes
6e0dc84a 2437AC_CHECK_FUNC(socket, , ok_so_far=no)
9ec10b2f 2438if test $ok_so_far = yes; then
6e0dc84a 2439 AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
9ec10b2f
DM
2440fi
2441if test $ok_so_far = yes; then
6e0dc84a 2442 AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
9ec10b2f
DM
2443fi
2444if test $ok_so_far = yes; then
91b5aa9a 2445dnl Fixme: Not used. Should this be HAVE_SOCKETS?
5e7d772d
AS
2446 AC_DEFINE(HAVE_INET_SOCKETS, 1,
2447 [Define to 1 if you have inet sockets.])
9ec10b2f
DM
2448fi
2449
ce6e4c21 2450AC_CHECK_HEADERS(sys/ioctl.h)
2ba3faa3 2451
7bbbba31 2452if test -f /usr/lpp/X11/bin/smt.exp; then
5e7d772d
AS
2453 AC_DEFINE(HAVE_AIX_SMT_EXP, 1,
2454 [Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists.])
7bbbba31
DM
2455fi
2456
27b07953
GM
2457AC_MSG_CHECKING(whether system supports dynamic ptys)
2458if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then
2459 AC_MSG_RESULT(yes)
5e7d772d 2460 AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if dynamic ptys are supported.])
27b07953
GM
2461else
2462 AC_MSG_RESULT(no)
2463fi
2464
5a129faf 2465AC_FUNC_FORK
79e12078 2466
fb33ec52
DL
2467dnl Adapted from Haible's version.
2468AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
2469 [AC_TRY_LINK([#include <langinfo.h>],
2470 [char* cs = nl_langinfo(CODESET);],
2471 emacs_cv_langinfo_codeset=yes,
2472 emacs_cv_langinfo_codeset=no)
2473 ])
2474if test $emacs_cv_langinfo_codeset = yes; then
2475 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2476 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2477fi
2478
f3acf5be 2479AC_CHECK_TYPES(size_t)
8170f46b 2480
12c0a8da
DL
2481AC_TYPE_MBSTATE_T
2482
91b5aa9a
DL
2483dnl Restrict could probably be used effectively other than in regex.c.
2484AC_CACHE_CHECK([for C restrict keyword], emacs_cv_c_restrict,
2485 [AC_TRY_COMPILE([void fred (int *restrict x);], [],
2486 emacs_cv_c_restrict=yes,
2487 [AC_TRY_COMPILE([void fred (int *__restrict x);], [],
2488 emacs_cv_c_restrict=__restrict,
2489 emacs_cv_c_restrict=no)])])
2490case "$emacs_cv_c_restrict" in
2491 yes) emacs_restrict=restrict;;
2492 no) emacs_restrict="";;
2493 *) emacs_restrict="$emacs_cv_c_restrict";;
2494esac
2495if test "$emacs_restrict" != __restrict; then
2496 AC_DEFINE_UNQUOTED(__restrict, $emacs_restrict,
2497 [Define to compiler's equivalent of C99 restrict keyword.
2498 Don't define if equivalent is `__restrict'.])
2499fi
2500
2501AC_CACHE_CHECK([for C restricted array declarations], emacs_cv_c_restrict_arr,
2502 [AC_TRY_COMPILE([void fred (int x[__restrict]);], [],
2503 emacs_cv_c_restrict_arr=yes, emacs_cv_c_restrict_arr=no)])
2504if test "$emacs_cv_c_restrict_arr" = yes; then
2505 AC_DEFINE(__restrict_arr, __restrict,
2506 [Define to compiler's equivalent of C99 restrict keyword in array
2507 declarations. Define as empty for no equivalent.])
2508fi
2509
2510dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
2511dnl how the tty code is related to POSIX and/or other versions of termios.
4b121527
DL
2512dnl The following looks like a useful start.
2513dnl
2514dnl AC_SYS_POSIX_TERMIOS
2515dnl if test $ac_cv_sys_posix_termios = yes; then
f6214bb7 2516dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
4b121527
DL
2517dnl and macros for terminal control.])
2518dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
2519dnl fi
91b5aa9a
DL
2520
2521dnl Fixme: Use AC_FUNC_MEMCMP since memcmp is used. (Needs libobj replacement.)
2522
9ec10b2f
DM
2523# Set up the CFLAGS for real compilation, so we can substitute it.
2524CFLAGS="$REAL_CFLAGS"
5a9bf171 2525CPPFLAGS="$REAL_CPPFLAGS"
9ec10b2f 2526
9ec10b2f 2527#### Find out which version of Emacs this is.
91b5aa9a
DL
2528[version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \
2529 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`]
9ec10b2f 2530if test x"${version}" = x; then
91b5aa9a 2531 AC_MSG_ERROR([can't find current emacs version in `${srcdir}/lisp/version.el'.])
9ec10b2f
DM
2532fi
2533
9ec10b2f
DM
2534### Specify what sort of things we'll be editing into Makefile and config.h.
2535### Use configuration here uncanonicalized to avoid exceeding size limits.
2536AC_SUBST(version)
2537AC_SUBST(configuration)
3cd69289 2538AC_SUBST(canonical)
9ec10b2f
DM
2539AC_SUBST(srcdir)
2540AC_SUBST(prefix)
2541AC_SUBST(exec_prefix)
2542AC_SUBST(bindir)
2543AC_SUBST(datadir)
3cd69289
DM
2544AC_SUBST(sharedstatedir)
2545AC_SUBST(libexecdir)
9ec10b2f
DM
2546AC_SUBST(mandir)
2547AC_SUBST(infodir)
2548AC_SUBST(lispdir)
2549AC_SUBST(locallisppath)
2550AC_SUBST(lisppath)
66d736a9 2551AC_SUBST(x_default_search_path)
9ec10b2f 2552AC_SUBST(etcdir)
9ec10b2f
DM
2553AC_SUBST(archlibdir)
2554AC_SUBST(docdir)
3cd69289 2555AC_SUBST(bitmapdir)
93c05c18
CW
2556AC_SUBST(gamedir)
2557AC_SUBST(gameuser)
9ec10b2f
DM
2558AC_SUBST(c_switch_system)
2559AC_SUBST(c_switch_machine)
2560AC_SUBST(LD_SWITCH_X_SITE)
2561AC_SUBST(LD_SWITCH_X_SITE_AUX)
2562AC_SUBST(C_SWITCH_X_SITE)
2563AC_SUBST(CFLAGS)
2564AC_SUBST(X_TOOLKIT_TYPE)
2565AC_SUBST(machfile)
2566AC_SUBST(opsysfile)
1ca2077a 2567AC_SUBST(GETLOADAVG_LIBS)
52cd7d02 2568AC_SUBST(carbon_appdir)
9ec10b2f 2569
5e7d772d
AS
2570AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
2571 [Define to the canonical Emacs configuration name.])
2572AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}",
2573 [Define to the options passed to configure.])
2574AC_DEFINE_UNQUOTED(config_machfile, "${machfile}",
2575 [Define to the used machine dependent file.])
2576AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
2577 [Define to the used os dependent file.])
2578AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE, ${LD_SWITCH_X_SITE},
2579[Define LD_SWITCH_X_SITE to contain any special flags your loader
2580 may need to deal with X Windows. For instance, if you've defined
2581 HAVE_X_WINDOWS above and your X libraries aren't in a place that
2582 your loader can find on its own, you might want to add "-L/..." or
2583 something similar.])
2584AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE_AUX, ${LD_SWITCH_X_SITE_AUX},
2585 [Define LD_SWITCH_X_SITE_AUX with an -R option
2586 in case it's needed (for Solaris, for example).])
2587AC_DEFINE_UNQUOTED(C_SWITCH_X_SITE, ${C_SWITCH_X_SITE},
2588[Define C_SWITCH_X_SITE to contain any special flags your compiler
2589 may need to deal with X Windows. For instance, if you've defined
2590 HAVE_X_WINDOWS above and your X include files aren't in a place
2591 that your compiler can find on its own, you might want to add
2592 "-I/..." or something similar.])
2593AC_DEFINE_UNQUOTED(UNEXEC_SRC, ${UNEXEC_SRC},
2594 [Define to the unexec source file name.])
9ec10b2f
DM
2595
2596if test "${HAVE_X_WINDOWS}" = "yes" ; then
5e7d772d
AS
2597 AC_DEFINE(HAVE_X_WINDOWS, 1,
2598 [Define to 1 if you want to use the X window system.])
9ec10b2f
DM
2599fi
2600if test "${USE_X_TOOLKIT}" != "none" ; then
5e7d772d 2601 AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
9ec10b2f
DM
2602fi
2603if test "${HAVE_X11}" = "yes" ; then
5e7d772d
AS
2604 AC_DEFINE(HAVE_X11, 1,
2605 [Define to 1 if you want to use version 11 of X windows.
2606 Otherwise, Emacs expects to use version 10.])
9ec10b2f
DM
2607fi
2608if test "${HAVE_XFREE386}" = "yes" ; then
5e7d772d 2609 AC_DEFINE(HAVE_XFREE386, 1, [Define to 1 if you're using XFree386.])
9ec10b2f 2610fi
08741ba9 2611if test "${HAVE_MENUS}" = "yes" ; then
5e7d772d
AS
2612 AC_DEFINE(HAVE_MENUS, 1,
2613 [Define to 1 if you have mouse menus.
2614 (This is automatic if you use X, but the option to specify it remains.)
2615 It is also defined with other window systems that support xmenu.c.])
9ec10b2f
DM
2616fi
2617if test "${GNU_MALLOC}" = "yes" ; then
5e7d772d
AS
2618 AC_DEFINE(GNU_MALLOC, 1,
2619 [Define to 1 if you want to use the GNU memory allocator.])
9ec10b2f
DM
2620fi
2621if test "${REL_ALLOC}" = "yes" ; then
5e7d772d
AS
2622 AC_DEFINE(REL_ALLOC, 1,
2623 [Define REL_ALLOC if you want to use the relocating allocator for
2624 buffer space.])
9ec10b2f 2625fi
9ec10b2f 2626
bfa6fb7e 2627
f3acf5be 2628AH_TOP([/* GNU Emacs site configuration template file.
57ebf0be
GM
2629 Copyright (C) 1988, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005,
2630 2006, 2007, 2008 Free Software Foundation, Inc.
5e7d772d
AS
2631
2632This file is part of GNU Emacs.
2633
2634GNU Emacs is free software; you can redistribute it and/or modify
2635it under the terms of the GNU General Public License as published by
fca4a5de 2636the Free Software Foundation; either version 3, or (at your option)
5e7d772d
AS
2637any later version.
2638
2639GNU Emacs is distributed in the hope that it will be useful,
2640but WITHOUT ANY WARRANTY; without even the implied warranty of
2641MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2642GNU General Public License for more details.
2643
2644You should have received a copy of the GNU General Public License
2645along with GNU Emacs; see the file COPYING. If not, write to the
086add15
LK
2646Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2647Boston, MA 02110-1301, USA. */
5e7d772d
AS
2648
2649
91b5aa9a 2650/* No code in Emacs #includes config.h twice, but some bits of code
177c0ea7 2651 intended to work with other packages as well (like gmalloc.c)
5e7d772d
AS
2652 think they can include it as many times as they like. */
2653#ifndef EMACS_CONFIG_H
2654#define EMACS_CONFIG_H
2655])dnl
2656
2657AH_BOTTOM([
2658/* If we're using any sort of window system, define some consequences. */
2659#ifdef HAVE_X_WINDOWS
2660#define HAVE_WINDOW_SYSTEM
2661#define MULTI_KBOARD
2662#define HAVE_MOUSE
2663#endif
2664
89ce934d
GM
2665/* Multi-tty support relies on MULTI_KBOARD. It seems safe to turn it
2666 on unconditionally. Note that src/s/darwin.h disables this at
2667 present. */
2668#ifndef MULTI_KBOARD
2669#define MULTI_KBOARD
2670#endif
2671
e3ba1015
AC
2672/* If we're using the Carbon API on Mac OS X, define a few more
2673 variables as well. */
2674#ifdef HAVE_CARBON
2675#define HAVE_WINDOW_SYSTEM
2676#define HAVE_MOUSE
e3ba1015
AC
2677#endif
2678
5e7d772d
AS
2679/* Define USER_FULL_NAME to return a string
2680 that is the user's full name.
2681 It can assume that the variable `pw'
2682 points to the password file entry for this user.
2683
2684 At some sites, the pw_gecos field contains
2685 the user's full name. If neither this nor any other
2686 field contains the right thing, use pw_name,
2687 giving the user's login name, since that is better than nothing. */
2688#define USER_FULL_NAME pw->pw_gecos
2689
2690/* Define AMPERSAND_FULL_NAME if you use the convention
2691 that & in the full name stands for the login id. */
2692/* Turned on June 1996 supposing nobody will mind it. */
2693#define AMPERSAND_FULL_NAME
2694
1c3a8acf
DL
2695/* We have blockinput.h. */
2696#define DO_BLOCK_INPUT
2697
5e7d772d
AS
2698/* Define HAVE_SOUND if we have sound support. We know it works
2699 and compiles only on the specified platforms. For others,
2700 it probably doesn't make sense to try. */
2701
2702#if defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
2703#ifdef HAVE_MACHINE_SOUNDCARD_H
2704#define HAVE_SOUND 1
2705#endif
2706#ifdef HAVE_SYS_SOUNDCARD_H
2707#define HAVE_SOUND 1
2708#endif
2709#ifdef HAVE_SOUNDCARD_H
2710#define HAVE_SOUND 1
2711#endif
2eec8691
JD
2712#ifdef HAVE_ALSA
2713#define HAVE_SOUND 1
2714#endif
5e7d772d
AS
2715#endif /* __FreeBSD__ || __NetBSD__ || __linux__ */
2716
2717/* If using GNU, then support inline function declarations. */
2718/* Don't try to switch on inline handling as detected by AC_C_INLINE
2719 generally, because even if non-gcc compilers accept `inline', they
2720 may reject `extern inline'. */
be5472bd 2721#if defined (__GNUC__) && defined (OPTIMIZE)
5e7d772d
AS
2722#define INLINE __inline__
2723#else
2724#define INLINE
2725#endif
2726
2727/* Include the os and machine dependent files. */
2728#include config_opsysfile
2729#include config_machfile
2730
2731/* Load in the conversion definitions if this system
2732 needs them and the source file being compiled has not
2733 said to inhibit this. There should be no need for you
2734 to alter these lines. */
2735
2736#ifdef SHORTNAMES
2737#ifndef NO_SHORTNAMES
2738#include "../shortnames/remap.h"
2739#endif /* not NO_SHORTNAMES */
2740#endif /* SHORTNAMES */
2741
2742/* If no remapping takes place, static variables cannot be dumped as
2743 pure, so don't worry about the `static' keyword. */
2744#ifdef NO_REMAP
2745#undef static
2746#endif
2747
2748/* Define `subprocesses' should be defined if you want to
2749 have code for asynchronous subprocesses
2750 (as used in M-x compile and M-x shell).
2751 These do not work for some USG systems yet;
2752 for the ones where they work, the s/SYSTEM.h file defines this flag. */
2753
2754#ifndef VMS
2755#ifndef USG
2756/* #define subprocesses */
2757#endif
2758#endif
2759
2760/* SIGTYPE is the macro we actually use. */
2761#ifndef SIGTYPE
2762#define SIGTYPE RETSIGTYPE
2763#endif
2764
2765#ifdef emacs /* Don't do this for lib-src. */
2766/* Tell regex.c to use a type compatible with Emacs. */
2767#define RE_TRANSLATE_TYPE Lisp_Object
2768#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
be5472bd
SM
2769#ifdef make_number
2770/* If make_number is a macro, use it. */
2771#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
2772#else
2773/* If make_number is a function, avoid it. */
2774#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
2775#endif
5e7d772d
AS
2776#endif
2777
2778/* Avoid link-time collision with system mktime if we will use our own. */
2779#if ! HAVE_MKTIME || BROKEN_MKTIME
2780#define mktime emacs_mktime
2781#endif
2782
1c3a8acf
DL
2783#define my_strftime nstrftime /* for strftime.c */
2784
5e7d772d
AS
2785/* The rest of the code currently tests the CPP symbol BSTRING.
2786 Override any claims made by the system-description files.
2787 Note that on some SCO version it is possible to have bcopy and not bcmp. */
2788#undef BSTRING
2789#if defined (HAVE_BCOPY) && defined (HAVE_BCMP)
2790#define BSTRING
2791#endif
2792
2793/* Some of the files of Emacs which are intended for use with other
2794 programs assume that if you have a config.h file, you must declare
2795 the type of getenv.
2796
2797 This declaration shouldn't appear when alloca.s or Makefile.in
2798 includes config.h. */
2799#ifndef NOT_C_CODE
2800extern char *getenv ();
2801#endif
2802
5e7d772d
AS
2803/* These default definitions are good for almost all machines.
2804 The exceptions override them in m/MACHINE.h. */
2805
2806#ifndef BITS_PER_CHAR
2807#define BITS_PER_CHAR 8
2808#endif
2809
2810#ifndef BITS_PER_SHORT
2811#define BITS_PER_SHORT 16
2812#endif
2813
2814/* Note that lisp.h uses this in a preprocessor conditional, so it
2815 would not work to use sizeof. That being so, we do all of them
2816 without sizeof, for uniformity's sake. */
2817#ifndef BITS_PER_INT
2818#define BITS_PER_INT 32
2819#endif
2820
2821#ifndef BITS_PER_LONG
2822#ifdef _LP64
2823#define BITS_PER_LONG 64
2824#else
2825#define BITS_PER_LONG 32
2826#endif
2827#endif
2828
2829/* Define if the compiler supports function prototypes. It may do so
2830 but not define __STDC__ (e.g. DEC C by default) or may define it as
2831 zero. */
2832#undef PROTOTYPES
2833/* For mktime.c: */
2834#ifndef __P
2835# if defined PROTOTYPES
2836# define __P(args) args
2837# else
2838# define __P(args) ()
2839# endif /* GCC. */
2840#endif /* __P */
2841
5e7d772d
AS
2842/* Don't include "string.h" or <stdlib.h> in non-C code. */
2843#ifndef NOT_C_CODE
2844#ifdef HAVE_STRING_H
2845#include "string.h"
2846#endif
f3acf5be
DL
2847#ifdef HAVE_STRINGS_H
2848#include "strings.h" /* May be needed for bcopy & al. */
2849#endif
5e7d772d
AS
2850#ifdef HAVE_STDLIB_H
2851#include <stdlib.h>
2852#endif
91b5aa9a
DL
2853#ifndef __GNUC__
2854# ifdef HAVE_ALLOCA_H
2855# include <alloca.h>
2856# else /* AIX files deal with #pragma. */
2857# ifndef alloca /* predefined by HP cc +Olibcalls */
2858char *alloca ();
2859# endif
2860# endif /* HAVE_ALLOCA_H */
2861#endif /* __GNUC__ */
17b3d9f6 2862#ifndef HAVE_SIZE_T
f968418d 2863typedef unsigned size_t;
17b3d9f6 2864#endif
91b5aa9a 2865#endif /* NOT_C_CODE */
5e7d772d
AS
2866
2867/* Define HAVE_X_I18N if we have usable i18n support. */
2868
2869#ifdef HAVE_X11R6
2870#define HAVE_X_I18N
e818a450 2871#elif !defined X11R5_INHIBIT_I18N
5e7d772d
AS
2872#define HAVE_X_I18N
2873#endif
2874
2875/* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */
2876
2877#if defined HAVE_X11R6 && !defined INHIBIT_X11R6_XIM
2878#define HAVE_X11R6_XIM
2879#endif
2880
2881/* Should we enable expensive run-time checking of data types? */
2882#undef ENABLE_CHECKING
2883
2884#if defined __GNUC__ && (__GNUC__ > 2 \
2885 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
2886#define NO_RETURN __attribute__ ((__noreturn__))
2887#else
2888#define NO_RETURN /* nothing */
2889#endif
f3acf5be 2890
91b5aa9a
DL
2891/* These won't be used automatically yet. We also need to know, at least,
2892 that the stack is continuous. */
2893#ifdef __GNUC__
2894# ifndef GC_SETJMP_WORKS
2895 /* GC_SETJMP_WORKS is nearly always appropriate for GCC --
177c0ea7 2896 see NON_SAVING_SETJMP in the target descriptions. */
f3041af1 2897 /* Exceptions (see NON_SAVING_SETJMP in target description) are
91b5aa9a 2898 SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86.
f3041af1 2899 Fixme: Deal with SVR3. */
91b5aa9a
DL
2900# define GC_SETJMP_WORKS 1
2901# endif
2902# ifndef GC_LISP_OBJECT_ALIGNMENT
2903# define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object))
2904# endif
2905#endif
2906
efd60266
JB
2907#ifndef HAVE_BCOPY
2908#define bcopy(a,b,s) memcpy (b,a,s)
2909#endif
2910#ifndef HAVE_BZERO
2911#define bzero(a,s) memset (a,0,s)
2912#endif
2913#ifndef HAVE_BCMP
2914#define BCMP memcmp
2915#endif
91b5aa9a
DL
2916
2917#endif /* EMACS_CONFIG_H */
2918
177c0ea7 2919/*
91b5aa9a 2920Local Variables:
f3acf5be
DL
2921mode: c
2922End:
2923*/
5e7d772d 2924])dnl
f0f2756d 2925
9ec10b2f 2926#### Report on what we decided to do.
488dd4c4
JD
2927#### Report GTK as a toolkit, even if it doesn't use Xt.
2928#### It makes printing result more understandable as using GTK sets
2929#### toolkit_scroll_bars to yes by default.
2930if test "${HAVE_GTK}" = "yes"; then
2931 USE_X_TOOLKIT=GTK
2932fi
2933
9ec10b2f 2934echo "
9ec10b2f
DM
2935Configured for \`${canonical}'.
2936
2937 Where should the build process find the source code? ${srcdir}
2938 What operating system and machine description files should Emacs use?
2939 \`${opsysfile}' and \`${machfile}'
2940 What compiler should emacs be built with? ${CC} ${CFLAGS}
2941 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
b1b4ce06 2942 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
e32fac2a 2943 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
9ec10b2f 2944 What window system should Emacs use? ${window_system}
dc16594b 2945 What toolkit should Emacs use? ${USE_X_TOOLKIT}"
509fccc3
RS
2946
2947if test -n "${x_includes}"; then
2948echo " Where do we find X Windows header files? ${x_includes}"
2949else
2950echo " Where do we find X Windows header files? Standard dirs"
2951fi
2952if test -n "${x_libraries}"; then
2953echo " Where do we find X Windows libraries? ${x_libraries}"
2954else
2955echo " Where do we find X Windows libraries? Standard dirs"
2956fi
9ec10b2f 2957
b412189c
GM
2958echo " Does Emacs use -lXaw3d? ${HAVE_XAW3D}"
2959echo " Does Emacs use -lXpm? ${HAVE_XPM}"
2960echo " Does Emacs use -ljpeg? ${HAVE_JPEG}"
495ccc04 2961echo " Does Emacs use -ltiff? ${HAVE_TIFF}"
47d1e061 2962echo " Does Emacs use a gif library? ${HAVE_GIF} $ac_gif_lib_name"
b412189c 2963echo " Does Emacs use -lpng? ${HAVE_PNG}"
96f574f0 2964echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
79011b82 2965echo " Does Emacs use -lgpm? ${HAVE_GPM}"
20c1822e 2966echo " Does Emacs use X toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
509fccc3 2967echo
9ec10b2f 2968
d0098f13
JD
2969if test $USE_XASSERTS = yes; then
2970 echo " Compiling with asserts turned on."
d0098f13
JD
2971 CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
2972 echo
2973fi
05cf15c6 2974
adfd1e39
JD
2975if test "$USE_X_TOOLKIT" = GTK; then
2976 case "$canonical" in
2977 *cygwin*)
2978 echo "There are known problems with Emacs and Gtk+ on cygwin, so you
2979 will probably get a crash on startup. If this happens, please use another
2980 toolkit for Emacs. See etc/PROBLEMS for more information."
2981 ;;
2982 esac
2983fi
2984
05cf15c6 2985
f0e04acc
GM
2986if test "$HAVE_CARBON" = "yes"; then
2987 echo
2988 echo "Warning: The Mac Carbon port is currently unsupported and has
2989known problems. It is not recommended for use by non-developers.
2990Read the emacs-devel archives for more information."
2991 echo
131e4133
MA
2992fi
2993
2994if test "$HAVE_DBUS" = yes && test "${opsys}" != "gnu-linux"; then
2995 echo "D-Bus integration has been tested for GNU/Linux only."
2996 echo
2997fi
f0e04acc 2998
05cf15c6 2999
9ec10b2f 3000# Remove any trailing slashes in these variables.
91b5aa9a 3001[test "${prefix}" != NONE &&
9ec10b2f
DM
3002 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
3003test "${exec_prefix}" != NONE &&
91b5aa9a 3004 exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
9ec10b2f 3005
3aa40e0e
GM
3006## Check if the C preprocessor will convert `..' to `. .'. If so, set
3007## CPP_NEED_TRADITIONAL to `yes' so that the code to generate Makefile
3008## from Makefile.c can correctly provide the arg `-traditional' to the
3009## C preprocessor.
3010
3011AC_EGREP_CPP(yes..yes,
3012 [yes..yes],
3013 CPP_NEED_TRADITIONAL=no,
3014 CPP_NEED_TRADITIONAL=yes)
3015
5f8c8f00 3016AC_OUTPUT(Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile \
62b1c28f
GM
3017 doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
3018 doc/lispref/Makefile src/Makefile.c:src/Makefile.in \
3019 lwlib/Makefile lisp/Makefile leim/Makefile, [
7bbbba31 3020
b63df577 3021### Make the necessary directories, if they don't exist.
e0a3686b 3022for dir in etc lisp ; do
b3947967 3023 test -d ${dir} || mkdir ${dir}
9ec10b2f
DM
3024done
3025
5f8c8f00
RS
3026# Build src/Makefile from ${srcdir}/src/Makefile.c
3027# and lib-src/Makefile from ${srcdir}/lib-src/Makefile.c
3028# This must be done after src/config.h is built, since we rely on that file.
9ec10b2f 3029
9ec10b2f
DM
3030# Now get this: Some word that is part of the ${srcdir} directory name
3031# or the ${configuration} value might, just might, happen to be an
3032# identifier like `sun4' or `i386' or something, and be predefined by
3033# the C preprocessor to some helpful value like 1, or maybe the empty
3034# string. Needless to say consequent macro substitutions are less
3035# than conducive to the makefile finding the correct directory.
91b5aa9a 3036[undefs="`echo $top_srcdir $configuration $canonical |
9ec10b2f
DM
3037sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/ *$//' \
3038 -e 's/ */ -U/g' -e 's/-U[0-9][^ ]*//g' \
91b5aa9a 3039`"]
9ec10b2f 3040
6a4bb05d 3041echo creating src/epaths.h
f8f7ab54 3042${MAKE-make} epaths-force
ab85d355 3043
c776f30b
GM
3044# As of 2000-11-19, newest development versions of GNU cpp preprocess
3045# `..' to `. .' unless invoked with -traditional
3046
3aa40e0e 3047if test "x$GCC" = xyes && test "x$CPP_NEED_TRADITIONAL" = xyes; then
c776f30b
GM
3048 CPPFLAGS="$CPPFLAGS -traditional"
3049fi
3050
9ec10b2f
DM
3051echo creating lib-src/Makefile
3052( cd lib-src
3053 rm -f junk.c junk1.c junk2.c
3054 sed -e '/start of cpp stuff/q' \
5f8c8f00 3055 < Makefile.c > junk1.c
9ec10b2f 3056 sed -e '1,/start of cpp stuff/d'\
3b74127d 3057 -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
5f8c8f00 3058 < Makefile.c > junk.c
e9b2a022 3059 $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
9ec10b2f
DM
3060 sed -e 's/^ / /' -e '/^#/d' -e '/^[ \f]*$/d' > junk2.c
3061 cat junk1.c junk2.c > Makefile.new
3062 rm -f junk.c junk1.c junk2.c
3063 chmod 444 Makefile.new
3064 mv -f Makefile.new Makefile
3065)
3066
3067echo creating src/Makefile
3068( cd src
3069 rm -f junk.c junk1.c junk2.c
3070 sed -e '/start of cpp stuff/q' \
5f8c8f00 3071 < Makefile.c > junk1.c
9ec10b2f 3072 sed -e '1,/start of cpp stuff/d'\
3b74127d 3073 -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
5f8c8f00 3074 < Makefile.c > junk.c
e9b2a022 3075 $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
9ec10b2f
DM
3076 sed -e 's/^ / /' -e '/^#/d' -e '/^[ \f]*$/d' > junk2.c
3077 cat junk1.c junk2.c > Makefile.new
3078 rm -f junk.c junk1.c junk2.c
3079 chmod 444 Makefile.new
3080 mv -f Makefile.new Makefile
3081)
8b66759a 3082
e9b2a022 3083if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
8b66759a 3084 echo creating src/.gdbinit
e9b2a022 3085 echo source $srcdir/src/.gdbinit > src/.gdbinit
8b66759a
DM
3086fi
3087
66a96cff
RS
3088# This is how we know whether to re-run configure in certain cases.
3089touch src/config.stamp
3090
3aa40e0e 3091], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPP_NEED_TRADITIONAL="$CPP_NEED_TRADITIONAL" CPPFLAGS="$CPPFLAGS"])
464c7d2d 3092
ab5796a9
MB
3093m4_if(dnl Do not change this comment
3094 arch-tag: 156a4dd5-bddc-4d18-96ac-f37742cf6a5e
3095)dnl