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