(fill-context-prefix): Match the two prefixes
[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
6a22cdf4 6dnl Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002
ad4ac636 7dnl 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
13dnl the Free Software Foundation; either version 2, or (at your option)
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
KH
22dnl along with GNU Emacs; see the file COPYING. If not, write to the
23dnl Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24dnl Boston, MA 02111-1307, USA.
6e502e37 25
5a129faf 26AC_PREREQ(2.51)dnl
9ec10b2f 27AC_INIT(src/lisp.h)
5f8c8f00 28AC_CONFIG_HEADER(src/config.h:src/config.in)
9ec10b2f 29
a4663fed
PJ
30dnl Support for --program-prefix, --program-suffix and
31dnl --program-transform-name options
32AC_ARG_PROGRAM
33
9ec10b2f 34lispdir='${datadir}/emacs/${version}/lisp'
4be21f66 35locallisppath='${datadir}/emacs/${version}/site-lisp:'\
684f4cb3 36'${datadir}/emacs/site-lisp:${datadir}/emacs/${version}/leim'
9ec10b2f
DM
37lisppath='${locallisppath}:${lispdir}'
38etcdir='${datadir}/emacs/${version}/etc'
60c3568d 39archlibdir='${libexecdir}/emacs/${version}/${configuration}'
9ec10b2f
DM
40docdir='${datadir}/emacs/${version}/etc'
41
39a7c455 42AC_ARG_WITH(gcc,
6fa064b6 43[ --without-gcc don't use GCC to compile Emacs if GCC is found])
4f734bde 44AC_ARG_WITH(pop,
6fa064b6
DL
45[ --without-pop don't support POP mail retrieval with movemail],
46[if test "$withval" = yes; then
47 AC_DEFINE(MAIL_USE_POP)
48else :
3d9fec71
DL
49fi],
50AC_DEFINE(MAIL_USE_POP))
a21616bd
KR
51AC_ARG_WITH(kerberos,
52[ --with-kerberos support Kerberos-authenticated POP],
53[AC_DEFINE(KERBEROS)])
54AC_ARG_WITH(kerberos5,
4d6e16b3 55[ --with-kerberos5 support Kerberos version 5 authenticated POP],
a21616bd
KR
56[if test "${with_kerberos5+set}" = set; then
57 if test "${with_kerberos+set}" != set; then
58 with_kerberos=yes
59 AC_DEFINE(KERBEROS)
60 fi
61fi
62AC_DEFINE(KERBEROS5)])
4f734bde
DM
63AC_ARG_WITH(hesiod,
64[ --with-hesiod support Hesiod to get the POP server host],
65[AC_DEFINE(HESIOD)])
3d9830e5
PJ
66
67AC_ARG_WITH(sound,
68[ --without-sound don't compile with sound support])
69
4f734bde
DM
70dnl This should be the last --with option, because --with-x is
71dnl added later on when we find the path of X, and it's best to
72dnl keep them together visually.
9ec10b2f 73AC_ARG_WITH(x-toolkit,
f7894e88 74[ --with-x-toolkit=KIT use an X toolkit (KIT = yes/lucid/athena/motif/no)],
9ec10b2f
DM
75[ case "${withval}" in
76 y | ye | yes ) val=athena ;;
77 n | no ) val=no ;;
78 l | lu | luc | luci | lucid ) val=lucid ;;
84c5c823 79 a | at | ath | athe | athen | athena ) val=athena ;;
3cd69289 80 m | mo | mot | moti | motif ) val=motif ;;
2e71ec17 81dnl These don't currently work.
2e71ec17
DM
82dnl o | op | ope | open | open- | open-l | open-lo \
83dnl | open-loo | open-look ) val=open-look ;;
9ec10b2f 84 * )
2e71ec17
DM
85dnl AC_MSG_ERROR([the \`--with-x-toolkit' option is supposed to have a value
86dnl which is \`yes', \`no', \`lucid', \`athena', \`motif' or \`open-look'.])
90b777c5
RS
87AC_MSG_ERROR([\`--with-x-toolkit=$withval' is invalid\;
88this option's value should be \`yes', \`no', \`lucid', \`athena', or \`motif'.
9ec10b2f
DM
89Currently, \`yes', \`athena' and \`lucid' are synonyms.])
90 ;;
91 esac
92 with_x_toolkit=$val
93])
b412189c
GM
94AC_ARG_WITH(xpm,
95[ --with-xpm use -lXpm for displaying XPM images])
96AC_ARG_WITH(jpeg,
97[ --with-jpeg use -ljpeg for displaying JPEG images])
98AC_ARG_WITH(tiff,
495ccc04 99[ --with-tiff use -ltiff for displaying TIFF images])
b412189c
GM
100AC_ARG_WITH(gif,
101[ --with-gif use -lungif for displaying GIF images])
102AC_ARG_WITH(png,
103[ --with-png use -lpng for displaying PNG images])
20c1822e 104AC_ARG_WITH(toolkit-scroll-bars,
4d6e16b3 105[ --without-toolkit-scroll-bars
1c7a4f72 106 don't use Motif or Xaw3d scroll bars])
c6f7dae8 107AC_ARG_WITH(xim,
1c7a4f72 108[ --without-xim don't use X11 XIM])
9ec10b2f
DM
109
110#### Make srcdir absolute, if it isn't already. It's important to
36969de6 111#### avoid running the path through pwd unnecessarily, since pwd can
069df4bf
DM
112#### give you automounter prefixes, which can go away. We do all this
113#### so Emacs can find its files when run uninstalled.
36969de6
GM
114## Make sure CDPATH doesn't affect cd (in case PWD is relative).
115unset CDPATH
9ec10b2f
DM
116case "${srcdir}" in
117 /* ) ;;
118 . )
119 ## We may be able to use the $PWD environment variable to make this
120 ## absolute. But sometimes PWD is inaccurate.
b83e4a77
RS
121 ## Note: we used to use ${PWD} at the end instead of `pwd`,
122 ## but that tested only for a well-formed and valid PWD,
123 ## it did not object when PWD was well-formed and valid but just wrong.
124 if test ".${PWD}" != "." && test ".`(cd ${PWD} ; sh -c pwd)`" = ".`pwd`" ;
9ec10b2f
DM
125 then
126 srcdir="$PWD"
127 else
128 srcdir="`(cd ${srcdir}; pwd)`"
129 fi
130 ;;
131 * ) srcdir="`(cd ${srcdir}; pwd)`" ;;
132esac
133
134#### Check if the source directory already has a configured system in it.
135if test `pwd` != `(cd ${srcdir} && pwd)` \
136 && test -f "${srcdir}/src/config.h" ; then
137 AC_MSG_WARN([The directory tree \`${srcdir}' is being used
138 as a build directory right now; it has been configured in its own
139 right. To configure in another directory as well, you MUST
140 use GNU make. If you do not have GNU make, then you must
141 now do \`make distclean' in ${srcdir},
142 and then run $0 again.])
143
2d73167a 144changequote(, )dnl
9ec10b2f 145 extrasub='/^VPATH[ ]*=/c\
2d73167a 146changequote([, ])dnl
9ec10b2f
DM
147vpath %.c $(srcdir)\
148vpath %.h $(srcdir)\
149vpath %.y $(srcdir)\
150vpath %.l $(srcdir)\
151vpath %.s $(srcdir)\
5ac83f86
RS
152vpath %.in $(srcdir)\
153vpath %.texi $(srcdir)'
9ec10b2f
DM
154fi
155
156#### Given the configuration name, set machfile and opsysfile to the
157#### names of the m/*.h and s/*.h files we should use.
158
159### Canonicalize the configuration name.
160
161AC_CANONICAL_HOST
162canonical=$host
fcb04b6e 163configuration=${host_alias-$host}
9ec10b2f
DM
164
165changequote(, )dnl
166
167### If you add support for a new configuration, add code to this
168### switch statement to recognize your configuration name and select
169### the appropriate operating system and machine description files.
170
171### You would hope that you could choose an m/*.h file pretty much
172### based on the machine portion of the configuration name, and an s-
173### file based on the operating system portion. However, it turns out
174### that each m/*.h file is pretty manufacturer-specific - for
175### example, apollo.h, hp9000s300.h, mega68k, news.h, and tad68k are
176### all 68000 machines; mips.h, pmax.h, and news-risc are all MIPS
177### machines. So we basically have to have a special case for each
178### configuration name.
179###
180### As far as handling version numbers on operating systems is
181### concerned, make sure things will fail in a fixable way. If
182### /etc/MACHINES doesn't say anything about version numbers, be
183### prepared to handle anything reasonably. If version numbers
184### matter, be sure /etc/MACHINES says something about it.
185###
186### Eric Raymond says we should accept strings like "sysvr4" to mean
187### "System V Release 4"; he writes, "The old convention encouraged
188### confusion between `system' and `release' levels'."
189
190machine='' opsys='' unported=no
191case "${canonical}" in
192
ba45dae0
GM
193 ## FreeBSD ports
194 *-*-freebsd* )
195 opsys=freebsd
196 case "${canonical}" in
197 alpha*-*-freebsd*) machine=alpha ;;
198 i[3456]86-*-freebsd*) machine=intel386 ;;
199 esac
200 ;;
201
9ec10b2f
DM
202 ## NetBSD ports
203 *-*-netbsd* )
204 opsys=netbsd
205 case "${canonical}" in
98bbf2a1 206 alpha*-*-netbsd*) machine=alpha ;;
5ac83f86 207 i[3456]86-*-netbsd*) machine=intel386 ;;
9ec10b2f
DM
208 m68k-*-netbsd*)
209 # This is somewhat bogus.
210 machine=hp9000s300 ;;
ca568b47 211 powerpc-apple-netbsd*) machine=macppc ;;
9ec10b2f 212 mips-*-netbsd*) machine=pmax ;;
69d5a2fa 213 mipsel-*-netbsd*) machine=pmax ;;
9ec10b2f 214 ns32k-*-netbsd*) machine=ns32000 ;;
b52425f4 215 powerpc-*-netbsd*) machine=macppc ;;
1ecefa7a 216 sparc*-*-netbsd*) machine=sparc ;;
b336ddd3 217 vax-*-netbsd*) machine=vax ;;
69d5a2fa 218 arm-*-netbsd*) machine=arm ;;
9ec10b2f
DM
219 esac
220 ;;
221
e3ac1b7f
RS
222 ## OpenBSD ports
223 *-*-openbsd* )
224 opsys=openbsd
225 case "${canonical}" in
98bbf2a1 226 alpha*-*-openbsd*) machine=alpha ;;
e3ac1b7f 227 i386-*-openbsd*) machine=intel386 ;;
6239880d
RS
228 m68k-*-openbsd*) machine=hp9000s300 ;;
229 mipsel-*-openbsd*) machine=pmax ;;
e3ac1b7f
RS
230 ns32k-*-openbsd*) machine=ns32000 ;;
231 sparc-*-openbsd*) machine=sparc ;;
ca568b47 232 vax-*-openbsd*) machine=vax ;;
e3ac1b7f
RS
233 esac
234 ;;
235
3cd69289
DM
236 ## Acorn RISCiX:
237 arm-acorn-riscix1.1* )
238 machine=acorn opsys=riscix1-1
239 ;;
240 arm-acorn-riscix1.2* | arm-acorn-riscix )
aac2257c
RS
241 ## This name is riscix12 instead of riscix1.2
242 ## to avoid a file name conflict on MSDOS.
243 machine=acorn opsys=riscix12
3cd69289
DM
244 ;;
245
2c4f7ce7
RS
246 ## BSDI ports
247 *-*-bsdi* )
248 opsys=bsdi
249 case "${canonical}" in
250 i[345]86-*-bsdi*) machine=intel386 ;;
251 sparc-*-bsdi*) machine=sparc ;;
393032d2 252 powerpc-*-bsdi*) machine=macppc ;;
2c4f7ce7
RS
253 esac
254 case "${canonical}" in
255 *-*-bsd386* | *-*-bsdi1* ) opsys=bsd386 ;;
256 *-*-bsdi2.0* ) opsys=bsdos2 ;;
257 *-*-bsdi2* ) opsys=bsdos2-1 ;;
258 *-*-bsdi3* ) opsys=bsdos3 ;;
1d06fc82 259 *-*-bsdi[45]* ) opsys=bsdos4 ;;
2c4f7ce7
RS
260 esac
261 ;;
262
9ec10b2f
DM
263 ## Alliant machines
264 ## Strictly speaking, we need the version of the alliant operating
265 ## system to choose the right machine file, but currently the
266 ## configuration name doesn't tell us enough to choose the right
267 ## one; we need to give alliants their own operating system name to
268 ## do this right. When someone cares, they can help us.
269 fx80-alliant-* )
270 machine=alliant4 opsys=bsd4-2
271 ;;
272 i860-alliant-* )
273 machine=alliant-2800 opsys=bsd4-3
274 ;;
275
30457b4f 276 ## Alpha (DEC) machines.
98bbf2a1 277 alpha*-dec-osf* )
3cd69289 278 machine=alpha opsys=osf1
f528522b 279 # This is needed to find X11R6.1 libraries for certain tests.
1bc5a004
RS
280 NON_GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
281 GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
557dcfd7
DL
282 # NON_GNU_CPP is necessary on 5.0 to avoid mangling src/Makefile
283 # due to non-traditional preprocessing with the current compiler
284 # defaults. OSF 4 can also have that compiler version, and there
285 # seems always to have been a usable /usr/bin/cpp.
286 NON_GNU_CPP=/usr/bin/cpp
71c72a72 287 case "${canonical}" in
d5c898bb 288 alpha*-dec-osf[5-9]*)
f8340326 289 opsys=osf5-0 ;;
e57196a0 290 esac
3cd69289
DM
291 ;;
292
98bbf2a1 293 alpha*-*-linux-gnu* )
5ac83f86 294 machine=alpha opsys=gnu-linux
4e90a7d5
RS
295 ;;
296
d506e713
GM
297 arm*-*-linux-gnu* )
298 machine=arm opsys=gnu-linux
299 ;;
300
301 ppc-*-linux | \
302 powerpc-*-linux* )
393032d2 303 machine=macppc opsys=gnu-linux
d506e713
GM
304 ;;
305
9ec10b2f
DM
306 ## Altos 3068
307 m68*-altos-sysv* )
308 machine=altos opsys=usg5-2
309 ;;
c7f493fd 310
9ec10b2f
DM
311 ## Amdahl UTS
312 580-amdahl-sysv* )
313 machine=amdahl opsys=usg5-2-2
314 ;;
315
acd04c87
RS
316 ## Apollo, Domain/OS
317 m68*-apollo-* )
318 machine=apollo opsys=bsd4-3
9ec10b2f
DM
319 ;;
320
321 ## AT&T 3b2, 3b5, 3b15, 3b20
322 we32k-att-sysv* )
323 machine=att3b opsys=usg5-2-2
324 ;;
325
326 ## AT&T 3b1 - The Mighty Unix PC!
327 m68*-att-sysv* )
328 machine=7300 opsys=usg5-2-2
329 ;;
330
331 ## Bull dpx20
332 rs6000-bull-bosx* )
333 machine=ibmrs6000 opsys=aix3-2
334 ;;
335
336 ## Bull dpx2
337 m68*-bull-sysv3* )
338 machine=dpx2 opsys=usg5-3
339 ;;
340
341 ## Bull sps7
342 m68*-bull-sysv2* )
343 machine=sps7 opsys=usg5-2
344 ;;
345
346 ## CCI 5/32, 6/32 -- see "Tahoe".
347
348 ## Celerity
349 ## I don't know what configuration name to use for this; config.sub
350 ## doesn't seem to know anything about it. Hey, Celerity users, get
351 ## in touch with us!
352 celerity-celerity-bsd* )
353 machine=celerity opsys=bsd4-2
354 ;;
355
356 ## Clipper
357 ## What operating systems does this chip run that Emacs has been
358 ## tested on?
359 clipper-* )
360 machine=clipper
361 ## We'll use the catch-all code at the bottom to guess the
362 ## operating system.
363 ;;
364
b83e4a77
RS
365 ## Compaq Nonstop
366 mips-compaq-nonstopux* )
367 machine=nonstopux opsys=nonstopux
368 ;;
369
9ec10b2f
DM
370 ## Convex
371 *-convex-bsd* | *-convex-convexos* )
372 machine=convex opsys=bsd4-3
908ff139 373 ## Prevents spurious white space in makefiles - d.m.cooke@larc.nasa.gov
9ec10b2f
DM
374 NON_GNU_CPP="cc -E -P"
375 ;;
376
377 ## Cubix QBx/386
5ac83f86 378 i[3456]86-cubix-sysv* )
9ec10b2f
DM
379 machine=intel386 opsys=usg5-3
380 ;;
381
382 ## Cydra 5
383 cydra*-cydrome-sysv* )
384 machine=cydra5 opsys=usg5-3
385 ;;
386
387 ## Data General AViiON Machines
651fc2d2
RS
388 ## DG changed naming conventions with the release of 5.4.4.10, they
389 ## dropped the initial 5.4 but left the intervening R. Because of the
390 ## R this shouldn't conflict with older versions of the OS (which I
f4afda69
KH
391 ## think were named like dgux4.*). In addition, DG new AViiONs series
392 ## uses either Motorola M88k or Intel Pentium CPUs.
9ae70ffe 393 m88k-dg-dguxR4.* | m88k-dg-dgux4* )
651fc2d2
RS
394 machine=aviion opsys=dgux4
395 ;;
9ec10b2f 396 m88k-dg-dgux5.4R3* | m88k-dg-dgux5.4.3* )
aac2257c
RS
397 ## This name is dgux5-4-3 instead of dgux5-4r3
398 ## to avoid a file name conflict on MSDOS.
399 machine=aviion opsys=dgux5-4-3
9ec10b2f
DM
400 ;;
401 m88k-dg-dgux5.4R2* | m88k-dg-dgux5.4.2* )
402 machine=aviion opsys=dgux5-4r2
403 ;;
404 m88k-dg-dgux* )
405 machine=aviion opsys=dgux
406 ;;
407
4e746fa8
KH
408 ## Data General AViiON Intel (x86) Machines
409 ## Exists from 5.4.3 (current i586-dg-dguxR4.11)
410 ## Ehud Karni, 1998-may-30, ehud@unix.simonwiesel.co.il
9ae70ffe 411 i[345]86-dg-dguxR4* )
4e746fa8
KH
412 machine=aviion-intel opsys=dgux4
413 ;;
414
9ec10b2f
DM
415 ## DECstations
416 mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0* | mips-dec-bsd4.2* )
417 machine=pmax opsys=bsd4-2
418 ;;
3bbe016c 419 mips-dec-ultrix4.[12]* | mips-dec-bsd* )
9ec10b2f
DM
420 machine=pmax opsys=bsd4-3
421 ;;
3bbe016c
KH
422 mips-dec-ultrix* )
423 machine=pmax opsys=ultrix4-3
424 ;;
9ec10b2f
DM
425 mips-dec-osf* )
426 machine=pmax opsys=osf1
427 ;;
b95c8e7e
RS
428 mips-dec-mach_bsd4.3* )
429 machine=pmax opsys=mach-bsd4-3
430 ;;
9ec10b2f
DM
431
432 ## Motorola Delta machines
433 m68k-motorola-sysv* | m68000-motorola-sysv* )
434 machine=delta opsys=usg5-3
435 if test -z "`type gnucc | grep 'not found'`"
018427ee
RS
436 then
437 if test -s /etc/167config
438 then CC="gnucc -m68040"
439 else CC="gnucc -m68881"
c7f493fd 440 fi
9ec10b2f
DM
441 else
442 if test -z "`type gcc | grep 'not found'`"
443 then CC=gcc
444 else CC=cc
445 fi
446 fi
447 ;;
448 m88k-motorola-sysv4* )
63c1d3f2
RS
449 # jbotte@bnr.ca says that UNIX_System_V <hostName> 4.0 R40V4.3 m88k mc88110
450 # needs POSIX_SIGNALS and therefore needs usg5-4-2.
451 # I hope there are not other 4.0 versions for this machine
452 # which really need usg5-4 instead.
453 machine=delta88k opsys=usg5-4-2
9ec10b2f
DM
454 ;;
455 m88k-motorola-sysv* | m88k-motorola-m88kbcs* )
456 machine=delta88k opsys=usg5-3
457 ;;
458
459 ## Dual machines
460 m68*-dual-sysv* )
461 machine=dual opsys=usg5-2
462 ;;
463 m68*-dual-uniplus* )
464 machine=dual opsys=unipl5-2
465 ;;
466
467 ## Elxsi 6400
468 elxsi-elxsi-sysv* )
469 machine=elxsi opsys=usg5-2
470 ;;
471
472 ## Encore machines
473 ns16k-encore-bsd* )
474 machine=ns16000 opsys=umax
475 ;;
476
2ce723a5
DL
477 ## The GEC 63 - apparently, this port isn't really finished yet.
478 # I'm sure we finished off the last of the machines, though. -- fx
9ec10b2f
DM
479
480 ## Gould Power Node and NP1
481 pn-gould-bsd4.2* )
482 machine=gould opsys=bsd4-2
483 ;;
484 pn-gould-bsd4.3* )
485 machine=gould opsys=bsd4-3
486 ;;
487 np1-gould-bsd* )
488 machine=gould-np1 opsys=bsd4-3
489 ;;
490
491 ## Harris Night Hawk machines running CX/UX (a 5000 looks just like a 4000
492 ## as far as Emacs is concerned).
493 m88k-harris-cxux* )
494 # Build needs to be different on 7.0 and later releases
495 case "`uname -r`" in
496 [56].[0-9] ) machine=nh4000 opsys=cxux ;;
497 [7].[0-9] ) machine=nh4000 opsys=cxux7 ;;
498 esac
3d68df05 499 NON_GNU_CPP="/lib/cpp"
9ec10b2f
DM
500 ;;
501 ## Harris ecx or gcx running CX/UX (Series 1200, Series 3000)
502 m68k-harris-cxux* )
503 machine=nh3000 opsys=cxux
504 ;;
3d68df05
KH
505 ## Harris power pc NightHawk running Power UNIX (Series 6000)
506 powerpc-harris-powerunix )
507 machine=nh6000 opsys=powerunix
508 NON_GNU_CPP="cc -Xo -E -P"
509 ;;
0e5f305e
RS
510 ## SR2001/SR2201 running HI-UX/MPP
511 hppa1.1-hitachi-hiuxmpp* )
512 machine=sr2k opsys=hiuxmpp
513 ;;
2d0bcbcc
EZ
514 hppa1.1-hitachi-hiuxwe2* )
515 machine=sr2k opsys=hiuxwe2
516 ;;
9ec10b2f
DM
517 ## Honeywell XPS100
518 xps*-honeywell-sysv* )
519 machine=xps100 opsys=usg5-2
520 ;;
521
522 ## HP 9000 series 200 or 300
523 m68*-hp-bsd* )
524 machine=hp9000s300 opsys=bsd4-3
525 ;;
42c3a7f7 526 ## HP/UX 7, 8, 9, and 10 are supported on these machines.
9ec10b2f
DM
527 m68*-hp-hpux* )
528 case "`uname -r`" in
529 ## Someone's system reports A.B8.05 for this.
530 ## I wonder what other possibilities there are.
531 *.B8.* ) machine=hp9000s300 opsys=hpux8 ;;
532 *.08.* ) machine=hp9000s300 opsys=hpux8 ;;
533 *.09.* ) machine=hp9000s300 opsys=hpux9 ;;
88a806e9 534 *.1[0-9].* ) machine=hp9000s300 opsys=hpux9shr ;;
9ec10b2f
DM
535 *) machine=hp9000s300 opsys=hpux ;;
536 esac
537 ;;
538
539 ## HP 9000 series 700 and 800, running HP/UX
540 hppa*-hp-hpux7* )
541 machine=hp800 opsys=hpux
542 ;;
543 hppa*-hp-hpux8* )
544 machine=hp800 opsys=hpux8
545 ;;
546 hppa*-hp-hpux9shr* )
547 machine=hp800 opsys=hpux9shr
548 ;;
549 hppa*-hp-hpux9* )
550 machine=hp800 opsys=hpux9
551 ;;
4f4d6b17 552 hppa*-hp-hpux10* )
12760c02 553 machine=hp800 opsys=hpux10
42c3a7f7 554 ;;
4f4d6b17
EZ
555 hppa*-hp-hpux1[1-9]* )
556 machine=hp800 opsys=hpux11
557 ;;
9ec10b2f 558
6fa6525f
RS
559 hppa*-*-linux-gnu* )
560 machine=hp800 opsys=gnu-linux
561 ;;
562
9ec10b2f
DM
563 ## HP 9000 series 700 and 800, running HP/UX
564 hppa*-hp-hpux* )
565 ## Cross-compilation? Nah!
566 case "`uname -r`" in
567 ## Someone's system reports A.B8.05 for this.
568 ## I wonder what other possibilities there are.
569 *.B8.* ) machine=hp800 opsys=hpux8 ;;
570 *.08.* ) machine=hp800 opsys=hpux8 ;;
571 *.09.* ) machine=hp800 opsys=hpux9 ;;
842f8692 572 *) machine=hp800 opsys=hpux10 ;;
9ec10b2f
DM
573 esac
574 ;;
da945421 575 hppa*-*-nextstep* )
4be21f66
KH
576 machine=hp800 opsys=nextstep
577 ;;
9ec10b2f
DM
578
579 ## Orion machines
580 orion-orion-bsd* )
581 machine=orion opsys=bsd4-2
582 ;;
583 clipper-orion-bsd* )
584 machine=orion105 opsys=bsd4-2
585 ;;
586
587 ## IBM machines
5ac83f86 588 i[3456]86-ibm-aix1.1* )
9ec10b2f
DM
589 machine=ibmps2-aix opsys=usg5-2-2
590 ;;
5ac83f86 591 i[3456]86-ibm-aix1.[23]* | i[3456]86-ibm-aix* )
9ec10b2f
DM
592 machine=ibmps2-aix opsys=usg5-3
593 ;;
594 i370-ibm-aix*)
595 machine=ibm370aix opsys=usg5-3
596 ;;
f4c2acb3
EZ
597 s390-*-linux-gnu)
598 machine=ibms390 opsys=gnu-linux
599 ;;
046545ec 600 rs6000-ibm-aix3.1* | powerpc-ibm-aix3.1* )
9ec10b2f
DM
601 machine=ibmrs6000 opsys=aix3-1
602 ;;
046545ec 603 rs6000-ibm-aix3.2.5 | powerpc-ibm-aix3.2.5 )
9ec10b2f
DM
604 machine=ibmrs6000 opsys=aix3-2-5
605 ;;
b63df577
RS
606 rs6000-ibm-aix4.1* | powerpc-ibm-aix4.1* )
607 machine=ibmrs6000 opsys=aix4-1
608 ;;
a8958813
RS
609 rs6000-ibm-aix4.2* | powerpc-ibm-aix4.2* )
610 machine=ibmrs6000 opsys=aix4-2
611 ;;
1ef1ef96
EZ
612 rs6000-ibm-aix5.1* | powerpc-ibm-aix5.1* )
613 machine=ibmrs6000 opsys=aix4-2
614 ;;
a8958813 615 rs6000-ibm-aix4.0* | powerpc-ibm-aix4.0* )
b63df577
RS
616 machine=ibmrs6000 opsys=aix4
617 ;;
a8958813
RS
618 rs6000-ibm-aix4* | powerpc-ibm-aix4* )
619 machine=ibmrs6000 opsys=aix4-1
620 ;;
046545ec 621 rs6000-ibm-aix* | powerpc-ibm-aix* )
9ec10b2f
DM
622 machine=ibmrs6000 opsys=aix3-2
623 ;;
624 romp-ibm-bsd4.3* )
625 machine=ibmrt opsys=bsd4-3
c7f493fd 626 ;;
9ec10b2f
DM
627 romp-ibm-bsd4.2* )
628 machine=ibmrt opsys=bsd4-2
629 ;;
630 romp-ibm-aos4.3* )
631 machine=ibmrt opsys=bsd4-3
c7f493fd 632 ;;
9ec10b2f
DM
633 romp-ibm-aos4.2* )
634 machine=ibmrt opsys=bsd4-2
635 ;;
636 romp-ibm-aos* )
637 machine=ibmrt opsys=bsd4-3
638 ;;
639 romp-ibm-bsd* )
640 machine=ibmrt opsys=bsd4-3
641 ;;
642 romp-ibm-aix* )
643 machine=ibmrt-aix opsys=usg5-2-2
644 ;;
645
646 ## Integrated Solutions `Optimum V'
647 m68*-isi-bsd4.2* )
648 machine=isi-ov opsys=bsd4-2
649 ;;
650 m68*-isi-bsd4.3* )
651 machine=isi-ov opsys=bsd4-3
652 ;;
653
654 ## Intel 386 machines where we do care about the manufacturer
5ac83f86 655 i[3456]86-intsys-sysv* )
9ec10b2f
DM
656 machine=is386 opsys=usg5-2-2
657 ;;
658
659 ## Prime EXL
5ac83f86 660 i[3456]86-prime-sysv* )
9ec10b2f
DM
661 machine=i386 opsys=usg5-3
662 ;;
663
3cd69289 664 ## Sequent Symmetry running Dynix
5ac83f86 665 i[3456]86-sequent-bsd* )
9ec10b2f
DM
666 machine=symmetry opsys=bsd4-3
667 ;;
668
86d6f6ee
RS
669 ## Sequent Symmetry running ptx 4, which is a modified SVR4.
670 i[3456]86-sequent-ptx4* | i[3456]86-sequent-sysv4* )
671 machine=sequent-ptx opsys=ptx4
0dcdc912 672 NON_GNU_CPP=/lib/cpp
86d6f6ee
RS
673 ;;
674
3cd69289
DM
675 ## Sequent Symmetry running DYNIX/ptx
676 ## Use the old cpp rather than the newer ANSI one.
5ac83f86 677 i[3456]86-sequent-ptx* )
3cd69289
DM
678 machine=sequent-ptx opsys=ptx
679 NON_GNU_CPP="/lib/cpp"
680 ;;
681
cd837fee
KH
682 ## ncr machine running svr4.3.
683 i[3456]86-ncr-sysv4.3 )
684 machine=ncr386 opsys=usg5-4-3
685 ;;
686
9ec10b2f
DM
687 ## Unspecified sysv on an ncr machine defaults to svr4.2.
688 ## (Plain usg5-4 doesn't turn on POSIX signals, which we need.)
5ac83f86 689 i[3456]86-ncr-sysv* )
b0f36760 690 machine=ncr386 opsys=usg5-4-2
9ec10b2f
DM
691 ;;
692
cbce363f
RS
693 ## Intel Paragon OSF/1
694 i860-intel-osf1* )
695 machine=paragon opsys=osf1 NON_GNU_CPP=/usr/mach/lib/cpp
696 ;;
697
9ec10b2f
DM
698 ## Intel 860
699 i860-*-sysv4* )
700 machine=i860 opsys=usg5-4
701 NON_GNU_CC="/bin/cc" # Ie, not the one in /usr/ucb/cc.
702 NON_GNU_CPP="/usr/ccs/lib/cpp" # cc -E tokenizes macro expansion.
703 ;;
704
3ad6e32b
GM
705 ## Macintosh PowerPC
706 powerpc*-*-linux-gnu* )
707 machine=macppc opsys=gnu-linux
708 ;;
709
9ec10b2f
DM
710 ## Masscomp machines
711 m68*-masscomp-rtu* )
712 machine=masscomp opsys=rtu
713 ;;
714
715 ## Megatest machines
716 m68*-megatest-bsd* )
717 machine=mega68 opsys=bsd4-2
718 ;;
719
720 ## Workstations sold by MIPS
721 ## This is not necessarily all workstations using the MIPS processor -
722 ## Irises are produced by SGI, and DECstations by DEC.
723
724 ## etc/MACHINES lists mips.h and mips4.h as possible machine files,
725 ## and usg5-2-2 and bsd4-3 as possible OS files. The only guidance
726 ## it gives for choosing between the alternatives seems to be "Use
727 ## -machine=mips4 for RISCOS version 4; use -opsystem=bsd4-3 with
728 ## the BSD world." I'll assume that these are instructions for
729 ## handling two odd situations, and that every other situation
730 ## should use mips.h and usg5-2-2, they being listed first.
731 mips-mips-usg* )
732 machine=mips4
733 ## Fall through to the general code at the bottom to decide on the OS.
734 ;;
735 mips-mips-riscos4* )
736 machine=mips4 opsys=bsd4-3
737 NON_GNU_CC="cc -systype bsd43"
738 NON_GNU_CPP="cc -systype bsd43 -E"
739 ;;
b95c8e7e
RS
740 mips-mips-riscos5* )
741 machine=mips4 opsys=riscos5
742 NON_GNU_CC="cc -systype bsd43"
743 NON_GNU_CPP="cc -systype bsd43 -E"
744 ;;
9ec10b2f
DM
745 mips-mips-bsd* )
746 machine=mips opsys=bsd4-3
747 ;;
748 mips-mips-* )
749 machine=mips opsys=usg5-2-2
750 ;;
751
752 ## NeXT
5ab52d42
RS
753 m68*-next-* | m68k-*-nextstep* )
754 machine=m68k opsys=nextstep
9ec10b2f
DM
755 ;;
756
757 ## The complete machine from National Semiconductor
758 ns32k-ns-genix* )
759 machine=ns32000 opsys=usg5-2
760 ;;
761
762 ## NCR machines
763 m68*-ncr-sysv2* | m68*-ncr-sysvr2* )
764 machine=tower32 opsys=usg5-2-2
765 ;;
766 m68*-ncr-sysv3* | m68*-ncr-sysvr3* )
767 machine=tower32v3 opsys=usg5-3
768 ;;
769
b4ea3111
KH
770 ## NEC EWS4800
771 mips-nec-sysv4*)
772 machine=ews4800 opsys=ux4800
773 ;;
774
9ec10b2f
DM
775 ## Nixdorf Targon 31
776 m68*-nixdorf-sysv* )
777 machine=targon31 opsys=usg5-2-2
778 ;;
779
780 ## Nu (TI or LMI)
781 m68*-nu-sysv* )
782 machine=nu opsys=usg5-2
783 ;;
784
785 ## Plexus
786 m68*-plexus-sysv* )
787 machine=plexus opsys=usg5-2
788 ;;
789
42326ef0
RS
790 ## PowerPC reference platform
791 powerpcle-*-solaris2* )
792 machine=prep
793 opsys=sol2-5
794 ;;
795
9ec10b2f
DM
796 ## Pyramid machines
797 ## I don't really have any idea what sort of processor the Pyramid has,
798 ## so I'm assuming it is its own architecture.
799 pyramid-pyramid-bsd* )
800 machine=pyramid opsys=bsd4-2
801 ;;
802
803 ## Sequent Balance
804 ns32k-sequent-bsd4.2* )
805 machine=sequent opsys=bsd4-2
806 ;;
807 ns32k-sequent-bsd4.3* )
808 machine=sequent opsys=bsd4-3
809 ;;
810
811 ## Siemens Nixdorf
7cba3845 812 mips-siemens-sysv* | mips-sni-sysv*)
9ec10b2f
DM
813 machine=mips-siemens opsys=usg5-4
814 NON_GNU_CC=/usr/ccs/bin/cc
815 NON_GNU_CPP=/usr/ccs/lib/cpp
816 ;;
817
818 ## Silicon Graphics machines
819 ## Iris 2500 and Iris 2500 Turbo (aka the Iris 3030)
820 m68*-sgi-iris3.5* )
821 machine=irist opsys=iris3-5
822 ;;
823 m68*-sgi-iris3.6* | m68*-sgi-iris*)
824 machine=irist opsys=iris3-6
825 ;;
826 ## Iris 4D
827 mips-sgi-irix3* )
828 machine=iris4d opsys=irix3-3
829 ;;
4ab83697
RS
830 mips-sgi-irix4* )
831 machine=iris4d opsys=irix4-0
832 ;;
a187fb80
KH
833 mips-sgi-irix6.5 )
834 machine=iris4d opsys=irix6-5
91193697
DL
835 # Without defining _LANGUAGE_C, things get masked out in the headers
836 # so that, for instance, grepping for `free' in stdlib.h fails and
837 # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
838 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
63c59d1e 839 NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
a187fb80 840 ;;
546fa279 841 mips-sgi-irix6* )
309daad2 842 machine=iris4d opsys=irix6-0
d9b5c990 843 # It's not clear whether -D_LANGUAGE_C is necessary as it is for 6.5,
91193697
DL
844 # but presumably it does no harm.
845 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
63c59d1e 846 # -32 probably isn't necessary in later v.6s -- anyone know which?
309daad2 847 NON_GCC_TEST_OPTIONS=-32
546fa279 848 ;;
4ab83697 849 mips-sgi-irix5.[01]* )
9ec10b2f
DM
850 machine=iris4d opsys=irix5-0
851 ;;
4ab83697
RS
852 mips-sgi-irix5* | mips-sgi-irix* )
853 machine=iris4d opsys=irix5-2
9ec10b2f
DM
854 ;;
855
856 ## SONY machines
857 m68*-sony-bsd4.2* )
858 machine=news opsys=bsd4-2
859 ;;
860 m68*-sony-bsd4.3* )
861 machine=news opsys=bsd4-3
862 ;;
3d102c59 863 m68*-sony-newsos3* | m68*-sony-news3*)
9ec10b2f
DM
864 machine=news opsys=bsd4-3
865 ;;
3d102c59 866 mips-sony-bsd* | mips-sony-newsos4* | mips-sony-news4*)
9ec10b2f
DM
867 machine=news-risc opsys=bsd4-3
868 ;;
423ef6e8 869 mips-sony-newsos6* )
b48e4aeb 870 machine=news-r6 opsys=newsos6
423ef6e8 871 ;;
3d102c59 872 mips-sony-news* )
9ec10b2f
DM
873 machine=news-risc opsys=newsos5
874 ;;
875
876 ## Stride
877 m68*-stride-sysv* )
878 machine=stride opsys=usg5-2
879 ;;
880
881 ## Suns
b5b193a7 882 sparc-*-linux-gnu* | sparc64-*-linux-gnu* )
5ac83f86 883 machine=sparc opsys=gnu-linux
28d9bc0e
KH
884 ;;
885
f4027958 886 *-auspex-sunos* | *-sun-sunos* | *-sun-bsd* | *-sun-solaris* \
5ac83f86 887 | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* | powerpc*-*-solaris2* \
c42b1767 888 | rs6000-*-solaris2*)
9ec10b2f
DM
889 case "${canonical}" in
890 m68*-sunos1* ) machine=sun1 ;;
891 m68*-sunos2* ) machine=sun2 ;;
892 m68* ) machine=sun3 ;;
5ac83f86
RS
893 i[3456]86-sun-sunos[34]* ) machine=sun386 ;;
894 i[3456]86-*-* ) machine=intel386 ;;
42326ef0 895 powerpcle* ) machine=powerpcle ;;
f7894e88 896 powerpc* | rs6000* ) machine=ibmrs6000 ;;
9ec10b2f
DM
897 sparc* ) machine=sparc ;;
898 * ) unported=yes ;;
899 esac
900 case "${canonical}" in
901 ## The Sun386 didn't get past 4.0.
5ac83f86 902 i[3456]86-*-sunos4 ) opsys=sunos4-0 ;;
9ec10b2f 903 *-sunos4.0* ) opsys=sunos4-0 ;;
0ff0179d 904 *-sunos4.1.[3-9]*noshare )
aac2257c
RS
905 ## This name is sunos413 instead of sunos4-1-3
906 ## to avoid a file name conflict on MSDOS.
907 opsys=sunos413
3d68df05
KH
908 NON_GNU_CPP=/usr/lib/cpp
909 NON_GCC_TEST_OPTIONS=-Bstatic
910 GCC_TEST_OPTIONS=-static
911 ;;
3e23af40
RS
912 *-sunos4.1.[3-9]* | *-sunos4shr*)
913 opsys=sunos4shr
914 NON_GNU_CPP=/usr/lib/cpp
915 ;;
3d68df05
KH
916 *-sunos4* | *-sunos )
917 opsys=sunos4-1
9ec10b2f
DM
918 NON_GCC_TEST_OPTIONS=-Bstatic
919 GCC_TEST_OPTIONS=-static
920 ;;
921 *-sunos5.3* | *-solaris2.3* )
922 opsys=sol2-3
923 NON_GNU_CPP=/usr/ccs/lib/cpp
924 ;;
925 *-sunos5.4* | *-solaris2.4* )
926 opsys=sol2-4
927 NON_GNU_CPP=/usr/ccs/lib/cpp
30457b4f 928 RANLIB="ar -ts"
9ec10b2f 929 ;;
2e567bad
KH
930 *-sunos5.5* | *-solaris2.5* )
931 opsys=sol2-5
932 NON_GNU_CPP=/usr/ccs/lib/cpp
30457b4f 933 RANLIB="ar -ts"
2e567bad 934 ;;
9ec10b2f 935 *-sunos5* | *-solaris* )
348e3a08 936 opsys=sol2-5
9ec10b2f
DM
937 NON_GNU_CPP=/usr/ccs/lib/cpp
938 ;;
939 * ) opsys=bsd4-2 ;;
940 esac
6e502e37
RS
941 ## Watch out for a compiler that we know will not work.
942 case "${canonical}" in
943 *-solaris* | *-sunos5* )
944 if [ "x$CC" = x/usr/ucb/cc ]; then
945 ## /usr/ucb/cc doesn't work;
946 ## we should find some other compiler that does work.
947 unset CC
948 fi
949 ;;
950 *) ;;
951 esac
9ec10b2f 952 ;;
5ab52d42 953 sparc-*-nextstep* )
19e45036 954 machine=sparc opsys=nextstep
5ab52d42 955 ;;
9ec10b2f
DM
956
957 ## Tadpole 68k
958 m68*-tadpole-sysv* )
959 machine=tad68k opsys=usg5-3
960 ;;
961
962 ## Tahoe machines
963 tahoe-tahoe-bsd4.2* )
964 machine=tahoe opsys=bsd4-2
965 ;;
966 tahoe-tahoe-bsd4.3* )
967 machine=tahoe opsys=bsd4-3
968 ;;
969
970 ## Tandem Integrity S2
971 mips-tandem-sysv* )
972 machine=tandem-s2 opsys=usg5-3
973 ;;
974
975 ## Tektronix XD88
976 m88k-tektronix-sysv3* )
977 machine=tekxd88 opsys=usg5-3
978 ;;
979
980 ## Tektronix 16000 box (6130?)
981 ns16k-tektronix-bsd* )
982 machine=ns16000 opsys=bsd4-2
983 ;;
984 ## Tektronix 4300
985 ## src/m/tek4300.h hints that this is a m68k machine.
986 m68*-tektronix-bsd* )
987 machine=tek4300 opsys=bsd4-3
988 ;;
989
990 ## Titan P2 or P3
991 ## We seem to have lost the machine-description file titan.h!
992 titan-titan-sysv* )
993 machine=titan opsys=usg5-3
994 ;;
c7f493fd 995
9ec10b2f
DM
996 ## Ustation E30 (SS5E)
997 m68*-unisys-uniplus* )
998 machine=ustation opsystem=unipl5-2
999 ;;
1000
1001 ## Vaxen.
1002 vax-dec-* )
1003 machine=vax
1004 case "${canonical}" in
1005 *-bsd4.1* ) opsys=bsd4-1 ;;
1006 *-bsd4.2* | *-ultrix[0-3].* | *-ultrix4.0* ) opsys=bsd4-2 ;;
1007 *-bsd4.3* | *-ultrix* ) opsys=bsd4-3 ;;
9ec10b2f
DM
1008 *-sysv[01]* | *-sysvr[01]* ) opsys=usg5-0 ;;
1009 *-sysv2* | *-sysvr2* ) opsys=usg5-2 ;;
1010 *-vms* ) opsys=vms ;;
1011 * ) unported=yes
1012 esac
1013 ;;
1014
1015 ## Whitechapel MG1
1016 ns16k-whitechapel-* )
1017 machine=mg1
1018 ## We don't know what sort of OS runs on these; we'll let the
1019 ## operating system guessing code below try.
1020 ;;
1021
1022 ## Wicat
1023 m68*-wicat-sysv* )
1024 machine=wicat opsys=usg5-2
1025 ;;
1026
2d23c8cc
GM
1027 ## IA-64
1028 ia64*-*-linux* )
1029 machine=ia64 opsys=gnu-linux
1030 ;;
1031
9ec10b2f 1032 ## Intel 386 machines where we don't care about the manufacturer
5ac83f86 1033 i[3456]86-*-* )
9ec10b2f
DM
1034 machine=intel386
1035 case "${canonical}" in
9f25f6fb 1036 *-lynxos* ) opsys=lynxos ;;
9ec10b2f
DM
1037 *-isc1.* | *-isc2.[01]* ) opsys=386-ix ;;
1038 *-isc2.2* ) opsys=isc2-2 ;;
1039 *-isc4.0* ) opsys=isc4-0 ;;
135c9ca6
RS
1040 *-isc4.* ) opsys=isc4-1
1041 GCC_TEST_OPTIONS=-posix
1042 NON_GCC_TEST_OPTIONS=-Xp
1043 ;;
9ec10b2f
DM
1044 *-isc* ) opsys=isc3-0 ;;
1045 *-esix5* ) opsys=esix5r4; NON_GNU_CPP=/usr/lib/cpp ;;
1046 *-esix* ) opsys=esix ;;
1047 *-xenix* ) opsys=xenix ;;
5ac83f86 1048 *-linux-gnu* ) opsys=gnu-linux ;;
9ec10b2f 1049 *-sco3.2v4* ) opsys=sco4 ; NON_GNU_CPP=/lib/cpp ;;
5ac83f86
RS
1050 *-sco3.2v5* ) opsys=sco5
1051 NON_GNU_CPP=/lib/cpp
1052 # Prevent -belf from being passed to $CPP.
1053 # /lib/cpp does not accept it.
1e60bcf8 1054 OVERRIDE_CPPFLAGS=" "
5ac83f86 1055 ;;
0e6d70d5 1056 *-sysv4.2uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
9ec10b2f 1057 *-386bsd* ) opsys=386bsd ;;
5ab52d42 1058 *-nextstep* ) opsys=nextstep ;;
9ec10b2f
DM
1059 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
1060 esac
1061 ;;
1062
287f502c 1063 ## m68k Linux-based GNU system
5ac83f86
RS
1064 m68k-*-linux-gnu* )
1065 machine=m68k opsys=gnu-linux
e1fd57e3
RS
1066 ;;
1067
287f502c
RS
1068 ## Mips Linux-based GNU system
1069 mips-*-linux-gnu* )
1070 machine=mips opsys=gnu-linux
1071 ;;
1072
eded5b68
RS
1073 ## UXP/DS
1074 sparc-fujitsu-sysv4* )
1075 machine=sparc opsys=uxpds
1076 NON_GNU_CPP=/usr/ccs/lib/cpp
1077 RANLIB="ar -ts"
1078 ;;
1079
5dbb45f2
KH
1080 ## UXP/V
1081 f301-fujitsu-uxpv4.1)
1082 machine=f301 opsys=uxpv
1083 ;;
1084
9ec10b2f
DM
1085 * )
1086 unported=yes
1087 ;;
1088esac
1089
1090### If the code above didn't choose an operating system, just choose
1091### an operating system based on the configuration name. You really
1092### only want to use this when you have no idea what the right
1093### operating system is; if you know what operating systems a machine
1094### runs, it's cleaner to make it explicit in the case statement
1095### above.
1096if test x"${opsys}" = x; then
1097 case "${canonical}" in
1098 *-gnu* ) opsys=gnu ;;
1099 *-bsd4.[01] ) opsys=bsd4-1 ;;
1100 *-bsd4.2 ) opsys=bsd4-2 ;;
1101 *-bsd4.3 ) opsys=bsd4-3 ;;
1102 *-sysv0 | *-sysvr0 ) opsys=usg5-0 ;;
1103 *-sysv2 | *-sysvr2 ) opsys=usg5-2 ;;
1104 *-sysv2.2 | *-sysvr2.2 ) opsys=usg5-2-2 ;;
5ab52d42 1105 *-sysv3* | *-sysvr3* ) opsys=usg5-3 ;;
66a96cff 1106 *-sysv4.2uw* ) opsys=unixware ;;
5ab52d42 1107 *-sysv4.1* | *-sysvr4.1* )
9ec10b2f
DM
1108 NON_GNU_CPP=/usr/lib/cpp
1109 opsys=usg5-4 ;;
5ab52d42 1110 *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
b63df577 1111 if [ x$NON_GNU_CPP = x ]; then
16831d8c
RS
1112 if [ -f /usr/ccs/lib/cpp ]; then
1113 NON_GNU_CPP=/usr/ccs/lib/cpp
1114 else
1115 NON_GNU_CPP=/lib/cpp
1116 fi
b63df577
RS
1117 fi
1118 opsys=usg5-4-2 ;;
5ab52d42 1119 *-sysv4* | *-sysvr4* ) opsys=usg5-4 ;;
9ec10b2f
DM
1120 * )
1121 unported=yes
1122 ;;
1123 esac
1124fi
1125
1126changequote([, ])dnl
1127
1128if test $unported = yes; then
1129 AC_MSG_ERROR([Emacs hasn't been ported to \`${canonical}' systems.
1130Check \`etc/MACHINES' for recognized configuration names.])
1131fi
1132
1133machfile="m/${machine}.h"
1134opsysfile="s/${opsys}.h"
1135
1136
1137#### Choose a compiler.
1138test -n "$CC" && cc_specified=yes
1139
5ab52d42
RS
1140# Save the value of CFLAGS that the user specified.
1141SPECIFIED_CFLAGS="$CFLAGS"
1142
9ec10b2f
DM
1143case ${with_gcc} in
1144 "yes" ) CC="gcc" GCC=yes ;;
6e0dc84a 1145 "no" ) : ${CC=cc} ;;
e9b2a022 1146 * )
9ec10b2f 1147esac
e9b2a022 1148AC_PROG_CC
9ec10b2f
DM
1149
1150# On Suns, sometimes $CPP names a directory.
1151if test -n "$CPP" && test -d "$CPP"; then
1152 CPP=
1153fi
1154
1155#### Some systems specify a CPP to use unless we are using GCC.
1156#### Now that we know whether we are using GCC, we can decide whether
1157#### to use that one.
1158if test "x$NON_GNU_CPP" != x && test x$GCC != xyes && test "x$CPP" = x
1159then
1160 CPP="$NON_GNU_CPP"
1161fi
1162
1163#### Some systems specify a CC to use unless we are using GCC.
1164#### Now that we know whether we are using GCC, we can decide whether
1165#### to use that one.
1166if test "x$NON_GNU_CC" != x && test x$GCC != xyes &&
1167 test x$cc_specified != xyes
1168then
1169 CC="$NON_GNU_CC"
1170fi
1171
1172if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x
1173then
1174 CC="$CC $GCC_TEST_OPTIONS"
c7f493fd 1175fi
9ec10b2f
DM
1176
1177if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x
1178then
1179 CC="$CC $NON_GCC_TEST_OPTIONS"
c7f493fd 1180fi
9ec10b2f 1181
1bc5a004
RS
1182if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
1183then
1184 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
1185fi
1186
1187if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
1188then
1189 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
1190fi
1191
9ec10b2f
DM
1192#### Some other nice autoconf tests. If you add a test here which
1193#### should make an entry in src/config.h, don't forget to add an
1194#### #undef clause to src/config.h.in for autoconf to modify.
1195
1196dnl checks for programs
6e0dc84a 1197AC_PROG_LN_S
9ec10b2f
DM
1198AC_PROG_CPP
1199AC_PROG_INSTALL
1200AC_PROG_YACC
3f5b097c
DL
1201if test "x$RANLIB" = x; then
1202 AC_PROG_RANLIB
1203fi
9ec10b2f 1204
3cd69289
DM
1205dnl checks for Unix variants
1206AC_AIX
1207
4428e268
DL
1208#### Extract some information from the operating system and machine files.
1209
1210AC_CHECKING([the machine- and system-dependent files to find out
1211 - which libraries the lib-src programs will want, and
1212 - whether the GNU malloc routines are usable])
1213
1214### First figure out CFLAGS (which we use for running the compiler here)
1215### and REAL_CFLAGS (which we use for real compilation).
1216### The two are the same except on a few systems, where they are made
1217### different to work around various lossages. For example,
1218### GCC 2.5 on GNU/Linux needs them to be different because it treats -g
1219### as implying static linking.
1220
1221### If the CFLAGS env var is specified, we use that value
1222### instead of the default.
1223
1224### It's not important that this name contain the PID; you can't run
1225### two configures in the same directory and have anything work
1226### anyway.
1227tempcname="conftest.c"
1228
1229echo '
1230#include "'${srcdir}'/src/'${opsysfile}'"
1231#include "'${srcdir}'/src/'${machfile}'"
1232#ifndef LIBS_MACHINE
1233#define LIBS_MACHINE
1234#endif
1235#ifndef LIBS_SYSTEM
1236#define LIBS_SYSTEM
1237#endif
1238#ifndef C_SWITCH_SYSTEM
1239#define C_SWITCH_SYSTEM
1240#endif
1241#ifndef C_SWITCH_MACHINE
1242#define C_SWITCH_MACHINE
1243#endif
1244configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
1245configure___ c_switch_system=C_SWITCH_SYSTEM
1246configure___ c_switch_machine=C_SWITCH_MACHINE
1247
1248#ifndef LIB_X11_LIB
1249#define LIB_X11_LIB -lX11
1250#endif
1251
1252#ifndef LIBX11_MACHINE
1253#define LIBX11_MACHINE
1254#endif
1255
1256#ifndef LIBX11_SYSTEM
1257#define LIBX11_SYSTEM
1258#endif
1259configure___ LIBX=LIB_X11_LIB LIBX11_MACHINE LIBX11_SYSTEM
1260
1261#ifdef UNEXEC
1262configure___ unexec=UNEXEC
1263#else
1264configure___ unexec=unexec.o
1265#endif
1266
1267#ifdef SYSTEM_MALLOC
1268configure___ system_malloc=yes
1269#else
1270configure___ system_malloc=no
1271#endif
1272
e32fac2a
GM
1273#ifdef USE_MMAP_FOR_BUFFERS
1274configure___ use_mmap_for_buffers=yes
b1b4ce06 1275#else
e32fac2a 1276configure___ use_mmap_for_buffers=no
b1b4ce06
GM
1277#endif
1278
4428e268
DL
1279#ifndef C_DEBUG_SWITCH
1280#define C_DEBUG_SWITCH -g
1281#endif
1282
1283#ifndef C_OPTIMIZE_SWITCH
1284#ifdef __GNUC__
1285#define C_OPTIMIZE_SWITCH -O2
1286#else
1287#define C_OPTIMIZE_SWITCH -O
1288#endif
1289#endif
1290
1291#ifndef LD_SWITCH_MACHINE
1292#define LD_SWITCH_MACHINE
1293#endif
1294
1295#ifndef LD_SWITCH_SYSTEM
1296#define LD_SWITCH_SYSTEM
1297#endif
1298
1299#ifndef LD_SWITCH_X_SITE_AUX
1300#define LD_SWITCH_X_SITE_AUX
1301#endif
1302
1303configure___ ld_switch_system=LD_SWITCH_SYSTEM
1304configure___ ld_switch_machine=LD_SWITCH_MACHINE
1305
1306#ifdef THIS_IS_CONFIGURE
1307
1308/* Get the CFLAGS for tests in configure. */
1309#ifdef __GNUC__
1310configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
1311#else
1312configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
1313#endif
1314
1315#else /* not THIS_IS_CONFIGURE */
1316
1317/* Get the CFLAGS for real compilation. */
1318#ifdef __GNUC__
1319configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
1320#else
1321configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
1322#endif
1323
1324#endif /* not THIS_IS_CONFIGURE */
1325' > ${tempcname}
1326
1327# The value of CPP is a quoted variable reference, so we need to do this
1328# to get its actual value...
1329CPP=`eval "echo $CPP"`
1330changequote(, )dnl
1331eval `${CPP} -Isrc ${tempcname} \
1332 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
1333if test "x$SPECIFIED_CFLAGS" = x; then
1334 eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \
1335 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
1336else
1337 REAL_CFLAGS="$CFLAGS"
1338fi
1339changequote([, ])dnl
1340rm ${tempcname}
1341
1342ac_link="$ac_link $ld_switch_machine $ld_switch_system"
1343
1344### Make sure subsequent tests use flags consistent with the build flags.
1345
1346if test x"${OVERRIDE_CPPFLAGS}" != x; then
1347 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
1348else
1349 CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
1350fi
1351
48989ead
DL
1352dnl Do this early because it can frob feature test macros for Unix-98 &c.
1353AC_SYS_LARGEFILE
1354
3d9830e5
PJ
1355if test "${with_sound}" != "no"; then
1356 # Sound support for GNU/Linux and the free BSDs.
1357 AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h)
1358 # Emulation library used on NetBSD.
1359 AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
1360 AC_SUBST(LIBSOUND)
1361fi
b412189c 1362
9ec10b2f 1363dnl checks for header files
1113b624
PE
1364AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
1365 linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
149c0cdc 1366 termcap.h stdio_ext.h fcntl.h term.h strings.h coff.h)
6e0dc84a
DM
1367AC_HEADER_STDC
1368AC_HEADER_TIME
1369AC_DECL_SYS_SIGLIST
2ce723a5 1370AC_HEADER_SYS_WAIT
9ec10b2f 1371
3cd69289 1372dnl Some systems have utime.h but don't declare the struct anyplace.
fd0a060b 1373AC_CACHE_CHECK(for struct utimbuf, emacs_cv_struct_utimbuf,
3cd69289
DM
1374AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1375#include <sys/time.h>
1376#include <time.h>
1377#else
1378#ifdef HAVE_SYS_TIME_H
1379#include <sys/time.h>
1380#else
1381#include <time.h>
1382#endif
1383#endif
1384#ifdef HAVE_UTIME_H
1385#include <utime.h>
1386#endif], [static struct utimbuf x; x.actime = x.modtime;],
fd0a060b
AS
1387 emacs_cv_struct_utimbuf=yes, emacs_cv_struct_utimbuf=no))
1388if test $emacs_cv_struct_utimbuf = yes; then
1389 AC_DEFINE(HAVE_STRUCT_UTIMBUF)
1390fi
3cd69289 1391
9ec10b2f 1392dnl checks for typedefs
6e0dc84a 1393AC_TYPE_SIGNAL
9ec10b2f 1394
25abcaf1
GM
1395dnl Check for speed_t typedef.
1396AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
1397AC_TRY_COMPILE([#include <termios.h>], [speed_t x = 1;],
e9b2a022 1398 emacs_cv_speed_t=yes, emacs_cv_speed_t=no))
25abcaf1
GM
1399if test $emacs_cv_speed_t = yes; then
1400 AC_DEFINE(HAVE_SPEED_T)
1401fi
1402
fd0a060b 1403AC_CACHE_CHECK(for struct timeval, emacs_cv_struct_timeval,
3cd69289
DM
1404AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1405#include <sys/time.h>
1406#include <time.h>
1407#else
1408#ifdef HAVE_SYS_TIME_H
1409#include <sys/time.h>
1410#else
1411#include <time.h>
1412#endif
1413#endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
fd0a060b
AS
1414 emacs_cv_struct_timeval=yes, emacs_cv_struct_timeval=no))
1415HAVE_TIMEVAL=$emacs_cv_struct_timeval
1416if test $emacs_cv_struct_timeval = yes; then
1417 AC_DEFINE(HAVE_TIMEVAL)
1418fi
3cd69289 1419
63c59d1e
DL
1420AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
1421AC_TRY_COMPILE([#include <math.h>],
1422[static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;],
1423 emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
1424HAVE_EXCEPTION=$emacs_cv_struct_exception
1425if test $emacs_cv_struct_exception != yes; then
1426 AC_DEFINE(NO_MATHERR)
1427fi
1428
9ec10b2f
DM
1429dnl checks for structure members
1430AC_STRUCT_TM
6e0dc84a 1431AC_STRUCT_TIMEZONE
1113b624
PE
1432AC_CACHE_CHECK(for tm_gmtoff in struct tm, emacs_cv_tm_gmtoff,
1433AC_TRY_LINK([#include <time.h>], [struct tm t; t.tm_gmtoff = 0],
1434 emacs_cv_tm_gmtoff=yes,
1435 emacs_cv_tm_gmtoff=no))
1436if test $emacs_cv_tm_gmtoff = yes; then
1437 AC_DEFINE(HAVE_TM_GMTOFF)
1438fi
9ec10b2f
DM
1439
1440dnl checks for compiler characteristics
3f5b097c
DL
1441
1442dnl Testing __STDC__ to determine prototype support isn't good enough.
1443dnl DEC C, for instance, doesn't define it with default options, and
1444dnl is used on 64-bit systems (OSF Alphas). Similarly for volatile
1445dnl and void *.
1446AC_C_PROTOTYPES
1447AC_C_VOLATILE
6e0dc84a 1448AC_C_CONST
3f5b097c
DL
1449dnl This isn't useful because we can't turn on use of `inline' unless
1450dnl the compiler groks `extern inline'.
1451dnl AC_C_INLINE
1452AC_CACHE_CHECK([for void * support], emacs_cv_void_star,
1453 [AC_TRY_COMPILE(, [void * foo;],
1454 emacs_cv_void_star=yes, emacs_cv_void_star=no)])
1455if test $emacs_cv_void_star = yes; then
1456 AC_DEFINE(POINTER_TYPE, void)
1457else
1458 AC_DEFINE(POINTER_TYPE, char)
1459fi
9ec10b2f
DM
1460
1461dnl check for Make feature
6e0dc84a 1462AC_PROG_MAKE_SET
9ec10b2f
DM
1463
1464dnl checks for operating system services
6e0dc84a 1465AC_SYS_LONG_FILE_NAMES
9ec10b2f
DM
1466
1467#### Choose a window system.
9ec10b2f 1468
6e0dc84a 1469AC_PATH_X
530ce502
DM
1470if test "$no_x" = yes; then
1471 window_system=none
1472else
1473 window_system=x11
1474fi
9ec10b2f 1475
ea199426 1476if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
00ac3ffc
KH
1477 LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
1478 LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
66d736a9
RS
1479 x_default_search_path=""
1480 for x_library in `echo ${x_libraries} | sed -e "s/:/ /g"`; do
c8d4d4cc
KH
1481 x_search_path="\
1482${x_library}/X11/%L/%T/%N%C%S:\
1483${x_library}/X11/%l/%T/%N%C%S:\
1484${x_library}/X11/%T/%N%C%S:\
1485${x_library}/X11/%L/%T/%N%S:\
1486${x_library}/X11/%l/%T/%N%S:\
1487${x_library}/X11/%T/%N%S"
66d736a9
RS
1488 if test x"${x_default_search_path}" = x; then
1489 x_default_search_path=${x_search_path}
1490 else
1491 x_default_search_path="${x_search_path}:${x_default_search_path}"
1492 fi
1493 done
ea199426
DM
1494fi
1495if test "${x_includes}" != NONE && test -n "${x_includes}"; then
cc6476f6 1496 C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
ea199426 1497fi
9ec10b2f 1498
8dbeb353
DM
1499if test x"${x_includes}" = x; then
1500 bitmapdir=/usr/include/X11/bitmaps
3cd69289 1501else
908ff139 1502 # accumulate include directories that have X11 bitmap subdirectories
cc6476f6
KH
1503 bmd_acc="dummyval"
1504 for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
1505 if test -d "${bmd}/X11/bitmaps"; then
1506 bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
4f6f5dab
GM
1507 fi
1508 if test -d "${bmd}/bitmaps"; then
cc6476f6
KH
1509 bmd_acc="${bmd_acc}:${bmd}/bitmaps"
1510 fi
1511 done
1512 if test ${bmd_acc} != "dummyval"; then
1513 bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
1514 fi
3cd69289
DM
1515fi
1516
9ec10b2f
DM
1517case "${window_system}" in
1518 x11 )
1519 HAVE_X_WINDOWS=yes
1520 HAVE_X11=yes
1521 case "${with_x_toolkit}" in
c7f493fd
RM
1522 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
1523 motif ) USE_X_TOOLKIT=MOTIF ;;
1524dnl open-look ) USE_X_TOOLKIT=OPEN_LOOK ;;
4be21f66
KH
1525 no ) USE_X_TOOLKIT=none ;;
1526dnl If user did not say whether to use a toolkit,
1527dnl make this decision later: use the toolkit if we have X11R5 or newer.
1528 * ) USE_X_TOOLKIT=maybe ;;
9ec10b2f
DM
1529 esac
1530 ;;
9ec10b2f
DM
1531 none )
1532 HAVE_X_WINDOWS=no
1533 HAVE_X11=no
1534 USE_X_TOOLKIT=none
1535 ;;
1536esac
9ec10b2f
DM
1537
1538### If we're using X11, we should use the X menu package.
08741ba9 1539HAVE_MENUS=no
9ec10b2f 1540case ${HAVE_X11} in
08741ba9 1541 yes ) HAVE_MENUS=yes ;;
9ec10b2f 1542esac
b412189c 1543
b95c8e7e
RS
1544if test "${opsys}" = "hpux9"; then
1545 case "${x_libraries}" in
1546 *X11R4* )
1547 opsysfile="s/hpux9-x11r4.h"
1548 ;;
1549 esac
1550fi
1551
1552if test "${opsys}" = "hpux9shr"; then
1553 case "${x_libraries}" in
1554 *X11R4* )
1555 opsysfile="s/hpux9shxr4.h"
1556 ;;
1557 esac
1558fi
1559
9ec10b2f
DM
1560### Compute the unexec source name from the object name.
1561UNEXEC_SRC="`echo ${unexec} | sed 's/\.o/.c/'`"
1562
1563# Do the opsystem or machine files prohibit the use of the GNU malloc?
1564# Assume not, until told otherwise.
1565GNU_MALLOC=yes
b05a95cb
RS
1566doug_lea_malloc=yes
1567AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no)
1568AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
fd0a060b
AS
1569AC_CACHE_CHECK(whether __after_morecore_hook exists,
1570 emacs_cv_var___after_morecore_hook,
e9b2a022 1571[AC_TRY_LINK([extern void (* __after_morecore_hook)();],[__after_morecore_hook = 0],
fd0a060b 1572 emacs_cv_var___after_morecore_hook=yes,
e9b2a022 1573 emacs_cv_var___after_morecore_hook=no)])
fd0a060b
AS
1574if test $emacs_cv_var___after_morecore_hook = no; then
1575 doug_lea_malloc=no
1576fi
8cd88038 1577if test "${system_malloc}" = "yes"; then
9ec10b2f
DM
1578 GNU_MALLOC=no
1579 GNU_MALLOC_reason="
b05a95cb 1580 (The GNU allocators don't work with this system configuration.)"
9ec10b2f 1581fi
8cd88038
RS
1582if test "$doug_lea_malloc" = "yes" ; then
1583 if test "$GNU_MALLOC" = yes ; then
1584 GNU_MALLOC_reason="
0855015c 1585 (Using Doug Lea's new malloc from the GNU C Library.)"
8cd88038
RS
1586 fi
1587 AC_DEFINE(DOUG_LEA_MALLOC)
1588fi
9ec10b2f
DM
1589
1590if test x"${REL_ALLOC}" = x; then
1591 REL_ALLOC=${GNU_MALLOC}
1592fi
1593
e32fac2a 1594dnl For now, need to use an explicit `#define USE_MMAP_FOR_BUFFERS 1'
69c40632 1595dnl the system configuration file (s/*.h) to turn the use of mmap
53c94d4d 1596dnl in the relocating allocator on.
b1b4ce06
GM
1597
1598AC_FUNC_MMAP
e32fac2a
GM
1599if test $use_mmap_for_buffers = yes; then
1600 REL_ALLOC=no
b1b4ce06
GM
1601fi
1602
52c76122 1603LIBS="$libsrc_libs $LIBS"
9ec10b2f
DM
1604
1605dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
1606dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
1607AC_CHECK_LIB(dnet, dnet_ntoa)
1608dnl This causes -lresolv to get used in subsequent tests,
1609dnl which causes failures on some systems such as HPUX 9.
1610dnl AC_CHECK_LIB(resolv, gethostbyname)
1611
1612dnl FIXME replace main with a function we actually want from this library.
1613AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
1614
027dae63 1615AC_CHECK_LIB(pthreads, cma_open)
1d94ee28 1616
5d4245a6 1617AC_MSG_CHECKING(for XFree86 in /usr/X386)
9ec10b2f 1618if test -d /usr/X386/include; then
9ec10b2f 1619 HAVE_XFREE386=yes
6e0dc84a 1620 : ${C_SWITCH_X_SITE="-I/usr/X386/include"}
9ec10b2f 1621else
6e0dc84a 1622 HAVE_XFREE386=no
9ec10b2f 1623fi
6e0dc84a 1624AC_MSG_RESULT($HAVE_XFREE386)
9ec10b2f 1625
509fccc3
RS
1626# Change CFLAGS temporarily so that C_SWITCH_X_SITE gets used
1627# for the tests that follow. We set it back to REAL_CFLAGS later on.
9ec10b2f 1628
5a9bf171
KR
1629REAL_CPPFLAGS="$CPPFLAGS"
1630
9ec10b2f
DM
1631if test "${HAVE_X11}" = "yes"; then
1632 DEFS="$C_SWITCH_X_SITE $DEFS"
96c20358
RS
1633 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
1634 LIBS="$LIBX $LIBS"
9ec10b2f 1635 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
5a9bf171 1636 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
509fccc3 1637
617a496c
RS
1638 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
1639 # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
1640 # but it's more convenient here to set LD_RUN_PATH
1641 # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
1642 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
1643 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
1644 export LD_RUN_PATH
1645 fi
1646
5ac83f86 1647 if test "${opsys}" = "gnu-linux"; then
3bbe016c 1648 AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
509fccc3
RS
1649 AC_TRY_LINK([],
1650 [XOpenDisplay ("foo");],
3bbe016c
KH
1651 [xlinux_first_failure=no],
1652 [xlinux_first_failure=yes])
1653 if test "${xlinux_first_failure}" = "yes"; then
509fccc3
RS
1654 OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
1655 OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
1656 OLD_CPPFLAGS="$CPPFLAGS"
1657 OLD_LIBS="$LIBS"
1658 LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
1659 C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
1660 CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
1661 LIBS="$LIBS -b i486-linuxaout"
1662 AC_TRY_LINK([],
1663 [XOpenDisplay ("foo");],
3bbe016c
KH
1664 [xlinux_second_failure=no],
1665 [xlinux_second_failure=yes])
1666 if test "${xlinux_second_failure}" = "yes"; then
509fccc3
RS
1667 # If we get the same failure with -b, there is no use adding -b.
1668 # So take it out. This plays safe.
1669 LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
1670 C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
1671 CPPFLAGS="$OLD_CPPFLAGS"
1672 LIBS="$OLD_LIBS"
1673 AC_MSG_RESULT(no)
1674 else
1675 AC_MSG_RESULT(yes)
1676 fi
1677 else
1678 AC_MSG_RESULT(no)
1679 fi
1680 fi
1681
9ca4be21
GM
1682 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
1683 # header files included from there.
1684 AC_MSG_CHECKING(for Xkb)
1685 AC_TRY_LINK([#include <X11/Xlib.h>
1686#include <X11/XKBlib.h>],
1687 [XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);],
1688 emacs_xkb=yes, emacs_xkb=no)
ad4ac636 1689 AC_MSG_RESULT($emacs_xkb)
9ca4be21
GM
1690 if test $emacs_xkb = yes; then
1691 AC_DEFINE(HAVE_XKBGETKEYBOARD)
1692 fi
1693
6e0dc84a 1694 AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
9ca4be21 1695XScreenNumberOfScreen XSetWMProtocols)
9ec10b2f
DM
1696fi
1697
08741ba9 1698if test "${window_system}" = "x11"; then
4be21f66 1699 AC_MSG_CHECKING(X11 version 6)
fd0a060b 1700 AC_CACHE_VAL(emacs_cv_x11_version_6,
e9b2a022 1701 [AC_TRY_LINK([#include <X11/Xlib.h>],
08741ba9
RS
1702[#if XlibSpecificationRelease < 6
1703fail;
1704#endif
e9b2a022 1705], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
fd0a060b
AS
1706 if test $emacs_cv_x11_version_6 = yes; then
1707 AC_MSG_RESULT(6 or newer)
1708 AC_DEFINE(HAVE_X11R6)
1709 else
1710 AC_MSG_RESULT(before 6)
1711 fi
08741ba9
RS
1712fi
1713
f7894e88 1714if test "${window_system}" = "x11"; then
4be21f66 1715 AC_MSG_CHECKING(X11 version 5)
fd0a060b 1716 AC_CACHE_VAL(emacs_cv_x11_version_5,
e9b2a022 1717 [AC_TRY_LINK([#include <X11/Xlib.h>],
4be21f66
KH
1718[#if XlibSpecificationRelease < 5
1719fail;
1720#endif
e9b2a022 1721], emacs_cv_x11_version_5=yes, emacs_cv_x11_version_5=no)])
fd0a060b
AS
1722 if test $emacs_cv_x11_version_5 = yes; then
1723 AC_MSG_RESULT(5 or newer)
f7894e88 1724 HAVE_X11R5=yes
fd0a060b
AS
1725 AC_DEFINE(HAVE_X11R5)
1726 else
f7894e88 1727 HAVE_X11R5=no
fd0a060b
AS
1728 AC_MSG_RESULT(before 5)
1729 fi
f7894e88
RS
1730fi
1731
bce97856
RS
1732dnl Do not put whitespace before the #include statements below.
1733dnl Older compilers (eg sunos4 cc) choke on it.
f7894e88
RS
1734if test x"${USE_X_TOOLKIT}" = xmaybe; then
1735 if test x"${HAVE_X11R5}" = xyes; then
1736 AC_MSG_CHECKING(X11 version 5 with Xaw)
fd0a060b 1737 AC_CACHE_VAL(emacs_cv_x11_version_5_with_xaw,
e9b2a022 1738 [AC_TRY_LINK([
bce97856
RS
1739#include <X11/Intrinsic.h>
1740#include <X11/Xaw/Simple.h>],
f7894e88 1741 [],
fd0a060b 1742 emacs_cv_x11_version_5_with_xaw=yes,
e9b2a022 1743 emacs_cv_x11_version_5_with_xaw=no)])
fd0a060b
AS
1744 if test $emacs_cv_x11_version_5_with_xaw = yes; then
1745 AC_MSG_RESULT([5 or newer, with Xaw; use toolkit by default])
1746 USE_X_TOOLKIT=LUCID
1747 else
1748 AC_MSG_RESULT(before 5 or no Xaw; do not use toolkit by default)
1749 USE_X_TOOLKIT=none
1750 fi
f7894e88
RS
1751 else
1752 USE_X_TOOLKIT=none
1753 fi
4be21f66
KH
1754fi
1755
1756X_TOOLKIT_TYPE=$USE_X_TOOLKIT
1757
9ec10b2f
DM
1758if test "${USE_X_TOOLKIT}" != "none"; then
1759 AC_MSG_CHECKING(X11 toolkit version)
fd0a060b 1760 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
e9b2a022 1761 [AC_TRY_LINK([#include <X11/Intrinsic.h>],
9ec10b2f
DM
1762[#if XtSpecificationRelease < 6
1763fail;
1764#endif
e9b2a022 1765], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
fd0a060b
AS
1766 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
1767 if test $emacs_cv_x11_toolkit_version_6 = yes; then
1768 AC_MSG_RESULT(6 or newer)
1769 AC_DEFINE(HAVE_X11XTR6)
1770 else
1771 AC_MSG_RESULT(before 6)
1772 fi
6aad10e4
RS
1773
1774dnl If using toolkit, check whether libXmu.a exists.
1775dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
1776 OLDLIBS="$LIBS"
fcc303f4
RS
1777 if test x$HAVE_X11XTR6 = xyes; then
1778 LIBS="-lXt -lSM -lICE $LIBS"
1779 else
1780 LIBS="-lXt $LIBS"
1781 fi
6aad10e4 1782 AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
ad4ac636
GM
1783 test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
1784fi
1785
1786# On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
1787if test "${HAVE_X11}" = "yes"; then
1788 if test "${USE_X_TOOLKIT}" != "none"; then
1789 AC_CHECK_LIB(Xext, XShapeQueryExtension)
1790 fi
9ec10b2f
DM
1791fi
1792
66d736a9 1793if test "${USE_X_TOOLKIT}" = "MOTIF"; then
fd0a060b 1794 AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1,
e9b2a022 1795 [AC_TRY_COMPILE([#include <Xm/Xm.h>],
66d736a9
RS
1796 [#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
1797int x = 5;
1798#else
1799Motif version prior to 2.1.
1800#endif],
e9b2a022 1801 emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
fd0a060b
AS
1802 HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1
1803 if test $emacs_cv_motif_version_2_1 = yes; then
d96a4de3 1804 HAVE_LIBXP=no
fd0a060b 1805 AC_DEFINE(HAVE_MOTIF_2_1)
ad4ac636 1806 AC_CHECK_LIB(Xp, XpCreateContext, HAVE_LIBXP=yes)
72d9b5b3
GM
1807 if test ${HAVE_LIBXP} = yes; then
1808 AC_DEFINE(HAVE_LIBXP)
1809 fi
fd0a060b 1810 fi
66d736a9
RS
1811fi
1812
620fdfdf
RS
1813### Is -lXaw3d available?
1814HAVE_XAW3D=no
1815if test "${HAVE_X11}" = "yes"; then
1816 if test "${USE_X_TOOLKIT}" != "none"; then
620fdfdf 1817 AC_CHECK_HEADER(X11/Xaw3d/Scrollbar.h,
ad4ac636 1818 AC_CHECK_LIB(Xaw3d, XawScrollbarSetThumb, HAVE_XAW3D=yes))
620fdfdf
RS
1819 if test "${HAVE_XAW3D}" = "yes"; then
1820 AC_DEFINE(HAVE_XAW3D)
1821 fi
1822 fi
1823fi
1824
0be97a72
GM
1825dnl Use toolkit scroll bars if configured for X toolkit and either
1826dnl using Motif or Xaw3d is available, and unless
1827dnl --with-toolkit-scroll-bars=no was specified.
1828
1829USE_TOOLKIT_SCROLL_BARS=no
1830if test "${with_toolkit_scroll_bars}" != "no"; then
1831 if test "${USE_X_TOOLKIT}" != "none"; then
1832 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
1833 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1834 HAVE_XAW3D=no
1835 USE_TOOLKIT_SCROLL_BARS=yes
1836 elif test "${HAVE_XAW3D}" = "yes"; then
1837 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1838 USE_TOOLKIT_SCROLL_BARS=yes
1839 fi
1840 fi
1841fi
1842
c6f7dae8
GM
1843dnl Don't use X11 input methods if user specifies he doesn't want it
1844dnl with `--with-xim=no'.
1845
1846if test "${with_xim}" != "no"; then
1847 AC_DEFINE(USE_XIM)
1848fi
1849
620fdfdf
RS
1850### Use -lXpm if available, unless `--with-xpm=no'.
1851HAVE_XPM=no
1852if test "${HAVE_X11}" = "yes"; then
1853 if test "${with_xpm}" != "no"; then
620fdfdf 1854 AC_CHECK_HEADER(X11/xpm.h,
7960d0bd
GM
1855 AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11))
1856 if test "${HAVE_XPM}" = "yes"; then
29c1b68e
GM
1857 AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
1858 AC_EGREP_CPP(no_return_alloc_pixels,
1859 [#include "X11/xpm.h"
7960d0bd
GM
1860#ifndef XpmReturnAllocPixels
1861no_return_alloc_pixels
1862#endif
29c1b68e
GM
1863 ], HAVE_XPM=no, HAVE_XPM=yes)
1864
1865 if test "${HAVE_XPM}" = "yes"; then
1866 AC_MSG_RESULT(yes)
1867 else
1868 AC_MSG_RESULT(no)
1869 fi
1890c0c4 1870 fi
620fdfdf
RS
1871 fi
1872
1873 if test "${HAVE_XPM}" = "yes"; then
1874 AC_DEFINE(HAVE_XPM)
1875 fi
1876fi
1877
1878### Use -ljpeg if available, unless `--with-jpeg=no'.
1879HAVE_JPEG=no
1880if test "${HAVE_X11}" = "yes"; then
1881 if test "${with_jpeg}" != "no"; then
3cc9d384
DL
1882 dnl Checking for jpeglib.h can lose becsue of a redefinition of
1883 dnl HAVE_STDLIB_H.
1884 AC_CHECK_HEADER(jerror.h,
ad4ac636 1885 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes))
620fdfdf
RS
1886 fi
1887
1888 if test "${HAVE_JPEG}" = "yes"; then
1889 AC_DEFINE(HAVE_JPEG)
4d766b59
RS
1890 AC_EGREP_CPP(
1891changequote({, })dnl avoid leadingspace on the next line
1892{version= *(6[2-9]|[7-9][0-9])},
1893changequote([, ])dnl
1894 [#include <jpeglib.h>
1895 version=JPEG_LIB_VERSION
1896],
1897 AC_DEFINE(HAVE_JPEG),
1898 [AC_MSG_WARN([libjpeg found, but not version 6b or later])
1899 HAVE_JPEG=no])
620fdfdf
RS
1900 fi
1901fi
1902
1903### Use -lpng if available, unless `--with-png=no'.
1904HAVE_PNG=no
1905if test "${HAVE_X11}" = "yes"; then
1906 if test "${with_png}" != "no"; then
620fdfdf 1907 AC_CHECK_HEADER(png.h,
ad4ac636 1908 AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm))
620fdfdf
RS
1909 fi
1910
1911 if test "${HAVE_PNG}" = "yes"; then
1912 AC_DEFINE(HAVE_PNG)
1913 fi
1914fi
1915
1916### Use -ltiff if available, unless `--with-tiff=no'.
1917HAVE_TIFF=no
1918if test "${HAVE_X11}" = "yes"; then
1919 if test "${with_tiff}" != "no"; then
620fdfdf 1920 AC_CHECK_HEADER(tiffio.h,
ad4ac636 1921 tifflibs="-lz -lm"
3b3cc4a4
KR
1922 # At least one tiff package requires the jpeg library.
1923 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
1924 AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs))
620fdfdf
RS
1925 fi
1926
1927 if test "${HAVE_TIFF}" = "yes"; then
1928 AC_DEFINE(HAVE_TIFF)
1929 fi
1930fi
1931
1932### Use -lgif if available, unless `--with-gif=no'.
1933HAVE_GIF=no
1934if test "${HAVE_X11}" = "yes"; then
1935 if test "${with_gif}" != "no"; then
620fdfdf 1936 AC_CHECK_HEADER(gif_lib.h,
4d766b59
RS
1937# EGifPutExtensionLast only exists from version libungif-4.1.0b1.
1938# Earlier versions can crash Emacs.
1939 AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes))
620fdfdf
RS
1940 fi
1941
1942 if test "${HAVE_GIF}" = "yes"; then
1943 AC_DEFINE(HAVE_GIF)
1944 fi
1945fi
1946
f21fadcc
JD
1947### Use session management (-lSM -lICE) if available
1948HAVE_X_SM=no
1949if test "${HAVE_X11}" = "yes"; then
1950 AC_CHECK_HEADER(X11/SM/SMlib.h,
1951 AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, -lICE))
1952
1953 if test "${HAVE_X_SM}" = "yes"; then
1954 AC_DEFINE(HAVE_X_SM)
1955 case "$LIBS" in
1956 *-lSM*) ;;
1957 *) LIBS="-lSM -lICE $LIBS" ;;
1958 esac
1959 fi
1960fi
1961
9ec10b2f 1962# If netdb.h doesn't declare h_errno, we must declare it by hand.
fd0a060b
AS
1963AC_CACHE_CHECK(whether netdb declares h_errno,
1964 emacs_cv_netdb_declares_h_errno,
e9b2a022 1965[AC_TRY_LINK([#include <netdb.h>],
01345308 1966 [return h_errno;],
e9b2a022 1967 emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
fd0a060b
AS
1968if test $emacs_cv_netdb_declares_h_errno = yes; then
1969 AC_DEFINE(HAVE_H_ERRNO)
1970fi
9ec10b2f 1971
6e0dc84a 1972AC_FUNC_ALLOCA
9ec10b2f 1973
f6e8adea 1974# fmod, logb, and frexp are found in -lm on most systems.
e468fb38 1975# On HPUX 9.01, -lm does not contain logb, so check for sqrt.
e6fd9047 1976AC_CHECK_LIB(m, sqrt)
e6fd9047 1977
4e4db900 1978# Check for mail-locking functions in a "mail" library
5ad9ac92
DL
1979AC_CHECK_LIB(mail, maillock)
1980dnl Debian, at least:
1981dnl AC_CHECK_LIB(lockfile, maillock, [AC_DEFINE(HAVE_LIBMAIL)])
1982AC_CHECK_LIB(lockfile, maillock)
1983# If we have the shared liblockfile, assume we must use it for mail
1984# locking (e.g. Debian). If we couldn't link against liblockfile
1985# (no liblockfile.a installed), ensure that we don't need to.
1986if test "$ac_cv_lib_lockfile_maillock" = no; then
1987 dnl This works for files generally, not just executables.
1988 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
1989 AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
1990 /usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH)
1991 if test $ac_cv_prog_liblockfile = yes; then
1992 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
1993This probably means that movemail could lose mail.
1994There may be a \`development' package to install containing liblockfile.])
1995 else AC_DEFINE(LIBMAIL, -llockfile)
1996 fi
1997 else :
1998fi
1999AC_CHECK_FUNCS(touchlock)
2000AC_CHECK_HEADERS(maillock.h)
4e4db900 2001
66abe596 2002AC_CHECK_FUNCS(gethostname getdomainname dup2 \
1effc2cb 2003rename closedir mkdir rmdir sysinfo \
fd4bc671 2004random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \
85ea1a28 2005strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
290c1191 2006utimes setrlimit setpgid getcwd getwd shutdown strftime getaddrinfo \
ec406751 2007__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
66abe596 2008sendto recvfrom getsockopt setsockopt getsockname getpeername \
7bb9a036 2009gai_strerror mkstemp)
38c44a91 2010
66abe596
KS
2011AC_CHECK_HEADERS(sys/un.h)
2012
38c44a91
DL
2013AC_FUNC_MKTIME
2014if test "$ac_cv_func_working_mktime" = no; then
2015 AC_DEFINE(BROKEN_MKTIME)
2016fi
2017
1ca2077a
DL
2018AC_FUNC_GETLOADAVG
2019
64a04a42 2020AC_FUNC_FSEEKO
63c59d1e 2021
64a04a42 2022# UNIX98 PTYs.
40ccc4c7
GM
2023AC_CHECK_FUNCS(grantpt)
2024
2025# PTY-related GNU extensions.
2026AC_CHECK_FUNCS(getpt)
2027
16831d8c
RS
2028# Check this now, so that we will NOT find the above functions in ncurses.
2029# That is because we have not set up to link ncurses in lib-src.
2030# It's better to believe a function is not available
2031# than to expect to find it in ncurses.
2032AC_CHECK_LIB(ncurses, tparm)
0c565a0a 2033
84e70f78
KR
2034# Do we need the Hesiod library to provide the support routines?
2035if test "$with_hesiod" = yes ; then
2036 # Don't set $LIBS here -- see comments above.
2037 resolv=no
2038 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
2039 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
2040 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
2041 if test "$resolv" = yes ; then
2042 RESOLVLIB=-lresolv
2043 AC_DEFINE(HAVE_LIBRESOLV)
2044 else
2045 RESOLVLIB=
2046 fi
2047 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
2048 AC_DEFINE(HAVE_LIBHESIOD), :, $RESOLVLIB)])
2049fi
2050
a21616bd
KR
2051# These tell us which Kerberos-related libraries to use.
2052if test "${with_kerberos+set}" = set; then
2053 AC_CHECK_LIB(com_err, com_err)
2054 AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt)
2055 AC_CHECK_LIB(crypto, mit_des_cbc_encrypt)
2056 AC_CHECK_LIB(krb5, krb5_init_context)
2057 if test "${with_kerberos5+set}" != set; then
2058 AC_CHECK_LIB(des425, des_cbc_encrypt,,
2059 AC_CHECK_LIB(des, des_cbc_encrypt))
2060 AC_CHECK_LIB(krb4, krb_get_cred,,
2061 AC_CHECK_LIB(krb, krb_get_cred))
2062 fi
2063
2064 if test "${with_kerberos5+set}" = set; then
2065 AC_CHECK_HEADERS(krb5.h)
2066 else
2067 AC_CHECK_HEADERS(des.h,,
5a129faf
PE
2068 [AC_CHECK_HEADERS(kerberosIV/des.h,,
2069 [AC_CHECK_HEADERS(kerberos/des.h)])])
a21616bd 2070 AC_CHECK_HEADERS(krb.h,,
5a129faf
PE
2071 [AC_CHECK_HEADERS(kerberosIV/krb.h,,
2072 [AC_CHECK_HEADERS(kerberos/krb.h)])])
a21616bd
KR
2073 fi
2074 AC_CHECK_HEADERS(com_err.h)
2075fi
2076
c4510052
PE
2077# Solaris requires -lintl if you want strerror (which calls dgettext)
2078# to return localized messages.
2079AC_CHECK_LIB(intl, dgettext)
2080
0c565a0a
RS
2081AC_MSG_CHECKING(whether localtime caches TZ)
2082AC_CACHE_VAL(emacs_cv_localtime_cache,
fcc303f4 2083[if test x$ac_cv_func_tzset = xyes; then
0c565a0a 2084AC_TRY_RUN([#include <time.h>
22cc077c
RS
2085extern char **environ;
2086unset_TZ ()
2087{
2088 char **from, **to;
2089 for (to = from = environ; (*to = *from); from++)
2090 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
2091 to++;
2092}
98ab445d
RS
2093char TZ_GMT0[] = "TZ=GMT0";
2094char TZ_PST8[] = "TZ=PST8";
0c565a0a
RS
2095main()
2096{
2097 time_t now = time ((time_t *) 0);
22cc077c 2098 int hour_GMT0, hour_unset;
98ab445d 2099 if (putenv (TZ_GMT0) != 0)
0c565a0a 2100 exit (1);
22cc077c
RS
2101 hour_GMT0 = localtime (&now)->tm_hour;
2102 unset_TZ ();
2103 hour_unset = localtime (&now)->tm_hour;
98ab445d 2104 if (putenv (TZ_PST8) != 0)
0c565a0a 2105 exit (1);
22cc077c
RS
2106 if (localtime (&now)->tm_hour == hour_GMT0)
2107 exit (1);
2108 unset_TZ ();
2109 if (localtime (&now)->tm_hour != hour_unset)
2110 exit (1);
2111 exit (0);
0c565a0a
RS
2112}], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
2113[# If we have tzset, assume the worst when cross-compiling.
2114emacs_cv_localtime_cache=yes])
2115else
2116 # If we lack tzset, report that localtime does not cache TZ,
2117 # since we can't invalidate the cache if we don't have tzset.
2118 emacs_cv_localtime_cache=no
2119fi])dnl
2120AC_MSG_RESULT($emacs_cv_localtime_cache)
2121if test $emacs_cv_localtime_cache = yes; then
2122 AC_DEFINE(LOCALTIME_CACHE)
2123fi
9ec10b2f 2124
3d68df05 2125if test "x$HAVE_TIMEVAL" = xyes; then
8a2c2328
DL
2126 AC_CHECK_FUNCS(gettimeofday)
2127 AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
2128 emacs_cv_gettimeofday_two_arguments,
e9b2a022 2129 [AC_TRY_COMPILE([
5ab52d42
RS
2130#ifdef TIME_WITH_SYS_TIME
2131#include <sys/time.h>
2132#include <time.h>
2133#else
2134#ifdef HAVE_SYS_TIME_H
2135#include <sys/time.h>
2136#else
2137#include <time.h>
2138#endif
290c1191 2139#endif],
8a2c2328
DL
2140 [struct timeval time;
2141 gettimeofday (&time, 0);],
2142 emacs_cv_gettimeofday_two_arguments=yes,
e9b2a022 2143 emacs_cv_gettimeofday_two_arguments=no)])
fd0a060b
AS
2144 if test $emacs_cv_gettimeofday_two_arguments = no; then
2145 AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT)
2146 fi
5ab52d42
RS
2147fi
2148
8a2c2328
DL
2149dnl Note that AC_STRUCT_TIMEZONE doesn't do what you might expect.
2150if test "$ac_cv_func_gettimeofday" = yes; then
2151 AC_CACHE_CHECK([for struct timezone], emacs_cv_struct_timezone,
2152 [AC_TRY_COMPILE([#include <sys/time.h>],
2153 [struct timezone tz;],
2154 dnl It may be that we can't call gettimeofday with a non-null pointer,
2155 dnl even though we have struct timezone (e.g. HPUX). In that case
2156 dnl we'll lie about struct timezone.
2157 [AC_TRY_RUN([
2158#ifdef TIME_WITH_SYS_TIME
2159#include <sys/time.h>
2160#include <time.h>
2161#else
2162#ifdef HAVE_SYS_TIME_H
2163#include <sys/time.h>
2164#else
2165#include <time.h>
2166#endif
2167#endif
2168main () {
2169 struct timeval time;
2170 struct timezone dummy;
2171 exit (gettimeofday (&time, &dummy));
2172}],
2173 emacs_cv_struct_timezone=yes,
2174 emacs_cv_struct_timezone=no, emacs_cv_struct_timezone=yes)],
2175 emacs_cv_struct_timezone=no)])
2176fi
2177
9ec10b2f 2178ok_so_far=yes
6e0dc84a 2179AC_CHECK_FUNC(socket, , ok_so_far=no)
9ec10b2f 2180if test $ok_so_far = yes; then
6e0dc84a 2181 AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
9ec10b2f
DM
2182fi
2183if test $ok_so_far = yes; then
6e0dc84a 2184 AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
9ec10b2f
DM
2185fi
2186if test $ok_so_far = yes; then
2187 AC_DEFINE(HAVE_INET_SOCKETS)
2188fi
2189
7bbbba31
DM
2190if test -f /usr/lpp/X11/bin/smt.exp; then
2191 AC_DEFINE(HAVE_AIX_SMT_EXP)
2192fi
2193
27b07953
GM
2194AC_MSG_CHECKING(whether system supports dynamic ptys)
2195if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then
2196 AC_MSG_RESULT(yes)
2197 AC_DEFINE(HAVE_DEV_PTMX)
2198else
2199 AC_MSG_RESULT(no)
2200fi
2201
5a129faf 2202AC_FUNC_FORK
79e12078 2203
8170f46b
DL
2204# Fixme: This should be replaced when we have autoconf 2.14.
2205AC_SIZE_T
2206
9ec10b2f
DM
2207# Set up the CFLAGS for real compilation, so we can substitute it.
2208CFLAGS="$REAL_CFLAGS"
5a9bf171 2209CPPFLAGS="$REAL_CPPFLAGS"
9ec10b2f
DM
2210
2211changequote(, )dnl
2212#### Find out which version of Emacs this is.
2213version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \
2214 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
2215changequote([, ])dnl
2216if test x"${version}" = x; then
2217 AC_MSG_ERROR(can't find current emacs version in \`${srcdir}/lisp/version.el'.)
2218fi
2219
9ec10b2f
DM
2220### Specify what sort of things we'll be editing into Makefile and config.h.
2221### Use configuration here uncanonicalized to avoid exceeding size limits.
2222AC_SUBST(version)
2223AC_SUBST(configuration)
3cd69289 2224AC_SUBST(canonical)
9ec10b2f
DM
2225AC_SUBST(srcdir)
2226AC_SUBST(prefix)
2227AC_SUBST(exec_prefix)
2228AC_SUBST(bindir)
2229AC_SUBST(datadir)
3cd69289
DM
2230AC_SUBST(sharedstatedir)
2231AC_SUBST(libexecdir)
9ec10b2f
DM
2232AC_SUBST(mandir)
2233AC_SUBST(infodir)
2234AC_SUBST(lispdir)
2235AC_SUBST(locallisppath)
2236AC_SUBST(lisppath)
66d736a9 2237AC_SUBST(x_default_search_path)
9ec10b2f 2238AC_SUBST(etcdir)
9ec10b2f
DM
2239AC_SUBST(archlibdir)
2240AC_SUBST(docdir)
3cd69289 2241AC_SUBST(bitmapdir)
9ec10b2f
DM
2242AC_SUBST(c_switch_system)
2243AC_SUBST(c_switch_machine)
2244AC_SUBST(LD_SWITCH_X_SITE)
2245AC_SUBST(LD_SWITCH_X_SITE_AUX)
2246AC_SUBST(C_SWITCH_X_SITE)
2247AC_SUBST(CFLAGS)
2248AC_SUBST(X_TOOLKIT_TYPE)
2249AC_SUBST(machfile)
2250AC_SUBST(opsysfile)
1ca2077a 2251AC_SUBST(GETLOADAVG_LIBS)
9ec10b2f 2252
3cd69289 2253AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}")
6d1da0d1 2254AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}")
9ec10b2f
DM
2255AC_DEFINE_UNQUOTED(config_machfile, "${machfile}")
2256AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}")
2257AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE, ${LD_SWITCH_X_SITE})
2258AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE_AUX, ${LD_SWITCH_X_SITE_AUX})
2259AC_DEFINE_UNQUOTED(C_SWITCH_X_SITE, ${C_SWITCH_X_SITE})
2260AC_DEFINE_UNQUOTED(UNEXEC_SRC, ${UNEXEC_SRC})
2261
2262if test "${HAVE_X_WINDOWS}" = "yes" ; then
2263 AC_DEFINE(HAVE_X_WINDOWS)
2264fi
2265if test "${USE_X_TOOLKIT}" != "none" ; then
2266 AC_DEFINE(USE_X_TOOLKIT)
2267fi
2268if test "${HAVE_X11}" = "yes" ; then
2269 AC_DEFINE(HAVE_X11)
2270fi
2271if test "${HAVE_XFREE386}" = "yes" ; then
2272 AC_DEFINE(HAVE_XFREE386)
2273fi
08741ba9
RS
2274if test "${HAVE_MENUS}" = "yes" ; then
2275 AC_DEFINE(HAVE_MENUS)
9ec10b2f
DM
2276fi
2277if test "${GNU_MALLOC}" = "yes" ; then
2278 AC_DEFINE(GNU_MALLOC)
2279fi
2280if test "${REL_ALLOC}" = "yes" ; then
2281 AC_DEFINE(REL_ALLOC)
2282fi
9ec10b2f 2283
f0f2756d
SS
2284AC_CHECK_HEADERS(nlist.h, [AC_DEFINE(NLIST_STRUCT, 1,
2285 [Define if you have <nlist.h>.])])
2286
9ec10b2f
DM
2287#### Report on what we decided to do.
2288echo "
9ec10b2f
DM
2289Configured for \`${canonical}'.
2290
2291 Where should the build process find the source code? ${srcdir}
2292 What operating system and machine description files should Emacs use?
2293 \`${opsysfile}' and \`${machfile}'
2294 What compiler should emacs be built with? ${CC} ${CFLAGS}
2295 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
b1b4ce06 2296 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
e32fac2a 2297 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
9ec10b2f 2298 What window system should Emacs use? ${window_system}
509fccc3
RS
2299 What toolkit should Emacs use? ${USE_X_TOOLKIT}"
2300
2301if test -n "${x_includes}"; then
2302echo " Where do we find X Windows header files? ${x_includes}"
2303else
2304echo " Where do we find X Windows header files? Standard dirs"
2305fi
2306if test -n "${x_libraries}"; then
2307echo " Where do we find X Windows libraries? ${x_libraries}"
2308else
2309echo " Where do we find X Windows libraries? Standard dirs"
2310fi
9ec10b2f 2311
b412189c
GM
2312echo " Does Emacs use -lXaw3d? ${HAVE_XAW3D}"
2313echo " Does Emacs use -lXpm? ${HAVE_XPM}"
2314echo " Does Emacs use -ljpeg? ${HAVE_JPEG}"
495ccc04 2315echo " Does Emacs use -ltiff? ${HAVE_TIFF}"
b412189c
GM
2316echo " Does Emacs use -lungif? ${HAVE_GIF}"
2317echo " Does Emacs use -lpng? ${HAVE_PNG}"
20c1822e 2318echo " Does Emacs use X toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
509fccc3 2319echo
9ec10b2f
DM
2320
2321# Remove any trailing slashes in these variables.
2322changequote(, )dnl
2323test "${prefix}" != NONE &&
2324 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
2325test "${exec_prefix}" != NONE &&
2326 exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`
2327changequote([, ])dnl
2328
3aa40e0e
GM
2329## Check if the C preprocessor will convert `..' to `. .'. If so, set
2330## CPP_NEED_TRADITIONAL to `yes' so that the code to generate Makefile
2331## from Makefile.c can correctly provide the arg `-traditional' to the
2332## C preprocessor.
2333
2334AC_EGREP_CPP(yes..yes,
2335 [yes..yes],
2336 CPP_NEED_TRADITIONAL=no,
2337 CPP_NEED_TRADITIONAL=yes)
2338
5f8c8f00 2339AC_OUTPUT(Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile \
66a96cff 2340 man/Makefile lwlib/Makefile src/Makefile.c:src/Makefile.in \
56a0a075 2341 lisp/Makefile lispref/Makefile lispintro/Makefile leim/Makefile, [
7bbbba31 2342
b63df577 2343### Make the necessary directories, if they don't exist.
e0a3686b 2344for dir in etc lisp ; do
b3947967 2345 test -d ${dir} || mkdir ${dir}
9ec10b2f
DM
2346done
2347
5f8c8f00
RS
2348# Build src/Makefile from ${srcdir}/src/Makefile.c
2349# and lib-src/Makefile from ${srcdir}/lib-src/Makefile.c
2350# This must be done after src/config.h is built, since we rely on that file.
9ec10b2f 2351
2d73167a 2352changequote(, )dnl The horror, the horror.
9ec10b2f
DM
2353# Now get this: Some word that is part of the ${srcdir} directory name
2354# or the ${configuration} value might, just might, happen to be an
2355# identifier like `sun4' or `i386' or something, and be predefined by
2356# the C preprocessor to some helpful value like 1, or maybe the empty
2357# string. Needless to say consequent macro substitutions are less
2358# than conducive to the makefile finding the correct directory.
2359undefs="`echo $top_srcdir $configuration $canonical |
2360sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/ *$//' \
2361 -e 's/ */ -U/g' -e 's/-U[0-9][^ ]*//g' \
2362`"
2d73167a 2363changequote([, ])dnl
9ec10b2f 2364
6a4bb05d 2365echo creating src/epaths.h
f8f7ab54 2366${MAKE-make} epaths-force
ab85d355 2367
c776f30b
GM
2368# As of 2000-11-19, newest development versions of GNU cpp preprocess
2369# `..' to `. .' unless invoked with -traditional
2370
3aa40e0e 2371if test "x$GCC" = xyes && test "x$CPP_NEED_TRADITIONAL" = xyes; then
c776f30b
GM
2372 CPPFLAGS="$CPPFLAGS -traditional"
2373fi
2374
9ec10b2f
DM
2375echo creating lib-src/Makefile
2376( cd lib-src
2377 rm -f junk.c junk1.c junk2.c
2378 sed -e '/start of cpp stuff/q' \
5f8c8f00 2379 < Makefile.c > junk1.c
9ec10b2f 2380 sed -e '1,/start of cpp stuff/d'\
3b74127d 2381 -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
5f8c8f00 2382 < Makefile.c > junk.c
e9b2a022 2383 $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
9ec10b2f
DM
2384 sed -e 's/^ / /' -e '/^#/d' -e '/^[ \f]*$/d' > junk2.c
2385 cat junk1.c junk2.c > Makefile.new
2386 rm -f junk.c junk1.c junk2.c
2387 chmod 444 Makefile.new
2388 mv -f Makefile.new Makefile
2389)
2390
2391echo creating src/Makefile
2392( cd src
2393 rm -f junk.c junk1.c junk2.c
2394 sed -e '/start of cpp stuff/q' \
5f8c8f00 2395 < Makefile.c > junk1.c
9ec10b2f 2396 sed -e '1,/start of cpp stuff/d'\
3b74127d 2397 -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
5f8c8f00 2398 < Makefile.c > junk.c
e9b2a022 2399 $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
9ec10b2f
DM
2400 sed -e 's/^ / /' -e '/^#/d' -e '/^[ \f]*$/d' > junk2.c
2401 cat junk1.c junk2.c > Makefile.new
2402 rm -f junk.c junk1.c junk2.c
2403 chmod 444 Makefile.new
2404 mv -f Makefile.new Makefile
2405)
8b66759a 2406
e9b2a022 2407if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
8b66759a 2408 echo creating src/.gdbinit
e9b2a022 2409 echo source $srcdir/src/.gdbinit > src/.gdbinit
8b66759a
DM
2410fi
2411
66a96cff
RS
2412# This is how we know whether to re-run configure in certain cases.
2413touch src/config.stamp
2414
3aa40e0e 2415], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPP_NEED_TRADITIONAL="$CPP_NEED_TRADITIONAL" CPPFLAGS="$CPPFLAGS"])
464c7d2d 2416