* window.c (window_internal_width): New function, which accounts
[bpt/emacs.git] / configure1.in
CommitLineData
0691c179
JB
1
2### The above line is deliberately left blank. If it starts with a #,
3### some CSH's will think this is a csh script.
4
0c22fbca
JB
5#### Configuration script for GNU Emacs
6#### Copyright (C) 1992 Free Software Foundation, Inc.
7
8### This file is part of GNU Emacs.
9
10### GNU Emacs is free software; you can redistribute it and/or modify
11### it under the terms of the GNU General Public License as published by
12### the Free Software Foundation; either version 1, or (at your option)
13### any later version.
14
15### GNU Emacs is distributed in the hope that it will be useful,
16### but WITHOUT ANY WARRANTY; without even the implied warranty of
17### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18### GNU General Public License for more details.
19
20### You should have received a copy of the GNU General Public License
21### along with GNU Emacs; see the file COPYING. If not, write to
22### the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23
24### Shell script to edit files and make symlinks in preparation for
25### compiling Emacs.
26###
27### Usage: configure config_name
28###
29### If configure succeeds, it leaves its status in config.status.
30### If configure fails after disturbing the status quo,
31### config.status is removed.
32###
33
34
35### Remove any leading "." elements from the path name. If we don't
36### remove them, then another "./" will be prepended to the file name
37### each time we use config.status, and the program name will get larger
38### and larger. This wouldn't be a problem, except that since progname
39### gets recorded in all the Makefiles this script produces,
e94740ce 40### move-if-change thinks they're different when they're not.
0c22fbca
JB
41###
42### It would be nice if we could put the ./ in a \( \) group and then
43### apply the * operator to that, so we remove as many leading ./././'s
44### as are present, but some seds (like Ultrix's sed) don't allow you to
45### apply * to a \( \) group. Bleah.
b7cceaf1 46progname="`echo $0 | sed 's:^\./::'`"
ca1d1d23 47
ca1d1d23 48
0c22fbca
JB
49#### Usage messages.
50
51short_usage="Type \`${progname} --usage' for more information about options."
52
53long_usage="Usage: ${progname} CONFIGURATION [-OPTION[=VALUE] ...]
8509d50c 54
ca1d1d23 55Set compilation and installation parameters for GNU Emacs, and report.
8509d50c
JB
56CONFIGURATION specifies the machine and operating system to build for.
57For example:
58 ${progname} sparc-sun-sunos4.1
59configures Emacs to build on a Sun Sparc machine running SunOS 4.1, and
60 ${progname} decstation
20d9a863 61configures Emacs to run on a DECstation running Ultrix. See \`etc/MACHINES'.
0c22fbca
JB
62
63The --with-x, --with-x11 and --with-x10 options specify what window
64 system to use; if all are omitted, use X11 if present. If you
65 don't want X, specify \`--with-x=no'.
66
67The --srcdir=DIR option specifies that the configuration and build
68 processes should look for the Emacs source code in DIR, when
e94740ce 69 DIR is not the current directory. This option doesn't work yet.
0c22fbca 70
ca1d1d23 71If successful, ${progname} leaves its status in config.status. If
0c22fbca
JB
72unsuccessful after disturbing the status quo, it removes config.status."
73
74
75#### Option processing.
ca1d1d23 76
0c22fbca
JB
77### These are the names of CPP symbols we want to define or leave undefined
78### in src/config.h; their values are given by the shell variables of the same
79### names.
80config_h_opts=" \
81HAVE_X_WINDOWS HAVE_X11 HAVE_X_MENU \
82SIGTYPE GNU_MALLOC REL_ALLOC LISP_FLOAT_TYPE "
83
84### Record all the arguments, so we can save them in config.status.
20d9a863 85arguments="$@"
e065a56e 86
4746118a
JB
87while [ $# != 0 ]; do
88 arg="$1"
ca1d1d23 89 case "${arg}" in
0c22fbca
JB
90
91 ## Anything starting with a hyphen we assume is an option.
92 -* )
93
94 ## Separate the switch name from the value it's being given.
ca1d1d23 95 case "${arg}" in
2c44309a 96 -*=*)
20d9a863 97 opt=`echo ${arg} | sed 's:^-*\([^=]*\)=.*$:\1:'`
2c44309a 98 val=`echo ${arg} | sed 's:^-*[^=]*=\(.*\)$:\1:'`
ca1d1d23
JB
99 valomitted=no
100 ;;
2c44309a 101 -*)
0c22fbca
JB
102 ## If FOO is a boolean argument, --FOO is equivalent to
103 ## --FOO=yes. Otherwise, the value comes from the next
104 ## argument - see below.
20d9a863 105 opt=`echo ${arg} | sed 's:^-*\(.*\)$:\1:'`
ca1d1d23
JB
106 val="yes"
107 valomitted=yes
108 ;;
109 esac
110
0c22fbca 111 ## Change `-' in the option name to `_'.
20d9a863
JB
112 opt="`echo ${opt} | tr - _`"
113
0c22fbca
JB
114 ## Process the option.
115 case "${opt}" in
ca1d1d23 116
0c22fbca
JB
117 ## Has the user specified which window systems they want to support?
118 "with_x" | "with_x11" | "with_x10" )
119 ## Make sure the value given was either "yes" or "no".
ca1d1d23
JB
120 case "${val}" in
121 y | ye | yes ) val=yes ;;
122 n | no ) val=no ;;
123 * )
0c22fbca
JB
124 (echo "${progname}: the \`--${opt}' option is supposed to have a boolean value.
125Set it to either \`yes' or \`no'."
126 echo "${short_usage}") >&2
ca1d1d23
JB
127 exit 1
128 ;;
129 esac
0c22fbca 130 eval "${opt}=\"${val}\""
ca1d1d23 131 ;;
0c22fbca
JB
132
133 ## Has the user specified a source directory?
134 "srcdir" )
135 ## If the value was omitted, get it from the next argument.
ca1d1d23 136 if [ "${valomitted}" = "yes" ]; then
0c22fbca 137 ## Get the next argument from the argument list, if there is one.
4746118a 138 if [ $# = 1 ]; then
0c22fbca
JB
139 (echo "${progname}: You must give a value for the \`--${opt}' option, as in
140 \`--${opt}=FOO'."
141 echo "${short_usage}") >&2
4746118a
JB
142 exit 1
143 fi
144 shift; val="$1"
ca1d1d23 145 fi
0c22fbca 146 srcdir="${val}"
e94740ce
JB
147
148 echo "${progname}: Beware - the \`--srcdir' option doesn't work yet." >&2
0c22fbca
JB
149 ;;
150
151 ## Has the user asked for some help?
152 "usage" | "help" )
153 echo "${long_usage}" | more
154 exit
155 ;;
ca1d1d23 156
0c22fbca
JB
157 ## We ignore all other options silently.
158 esac
ca1d1d23 159 ;;
0c22fbca
JB
160
161 ## Anything not starting with a hyphen we assume is a
162 ## configuration name.
ca1d1d23 163 *)
8509d50c 164 configuration=${arg}
ca1d1d23 165 ;;
0c22fbca 166
ca1d1d23 167 esac
4746118a 168 shift
ca1d1d23
JB
169done
170
8509d50c 171if [ "${configuration}" = "" ]; then
0c22fbca
JB
172 (echo "${progname}: You must specify a configuration name as an argument."
173 echo "${short_usage}") >&2
174 exit 1
175fi
176
177
178#### Decide where the source is.
179case "${srcdir}" in
180
e94740ce 181 ## If it's not specified, see if `.' or `..' might work.
0c22fbca 182 "" )
e94740ce
JB
183 if [ -f "./src/lisp.h" -a -f "./lisp/version.el" ]; then
184 srcdir=`pwd`
185 else
186 if [ -f "../src/lisp.h" -a -f "../lisp/version.el" ]; then
187 srcdir=`(cd .. ; pwd)`
188 else
189 (echo "\
190${progname}: Neither the current directory nor its parent seem to
191contain the Emacs sources. If you do not want to build Emacs in its
192source tree, you should run \`${progname}' in the directory in which
193you wish to build Emacs, using its \`--srcdir' option to say where the
194sources may be found."
195 echo "${short_usage}") >&2
196 exit 1
197 fi
198 fi
0c22fbca
JB
199 ;;
200
e94740ce 201 ## Otherwise, check if the directory they specified is okay.
0c22fbca 202 * )
e94740ce
JB
203 if [ ! -d "${srcdir}" -o ! -f "${srcdir}/src/lisp.h" -o ! -f "${srcdir}/lisp/version.el" ]; then
204 (echo "\
205${progname}: The directory specified with the \`--srcdir' option,
206\`${srcdir}', doesn't seem to contain the Emacs sources. You should
207either run the \`${progname}' script at the top of the Emacs source
208tree, or use the \`--srcdir' option to specify where the Emacs sources
209are."
0c22fbca
JB
210 echo "${short_usage}") >&2
211 exit 1
212 fi
213 ;;
214
215esac
216
0c22fbca
JB
217### Make the necessary directories, if they don't exist.
218if [ ! -d ./src ]; then
219 mkdir ./src
220fi
221if [ ! -d ./lib-src ]; then
222 mkdir ./lib-src
223fi
224if [ ! -d ./cpp ]; then
225 mkdir ./cpp
226fi
e94740ce
JB
227if [ ! -d ./oldXMenu ]; then
228 mkdir ./oldXMenu
229fi
0c22fbca
JB
230
231
232#### Given the configuration name, set machfile and opsysfile to the
233#### names of the m/*.h and s/*.h files we should use.
234
235### Canonicalize the configuration name.
8509d50c 236echo "Checking the configuration name."
e94740ce 237if configuration=`${srcdir}/config.sub "${configuration}"` ; then : ; else
8509d50c
JB
238 exit $?
239fi
20d9a863 240
8509d50c
JB
241### You would hope that you could choose an m/*.h file pretty much
242### based on the machine portion of the configuration name, and an s-
243### file based on the operating system portion. However, it turns out
244### that each m/*.h file is pretty manufacturer-specific - for
245### example, apollo.h, hp9000s300.h, mega68k, news.h, and tad68k are
246### all 68000 machines; mips.h, pmax.h, and news-risc are all MIPS
247### machines. So we basically have to have a special case for each
248### configuration name.
249
250### As far as handling version numbers on operating systems is
251### concerned, make sure things will fail in a fixable way. If
252### /etc/MACHINES doesn't say anything about version numbers, be
253### prepared to handle anything reasonably. If version numbers
254### matter, be sure /etc/MACHINES says something about it.
255machine='' opsys='' unported='false'
256case "${configuration}" in
257
258 ## Alliant machines
20d9a863
JB
259 ## Strictly speaking, we need the version of the alliant operating
260 ## system to choose the right machine file, but currently the
261 ## configuration name doesn't tell us enough to choose the right
262 ## one; we need to give alliants their own operating system name to
263 ## do this right. When someone cares, they can help us.
264 fx80-alliant-* )
8509d50c 265 machine=alliant4 opsys=bsd4-2
20d9a863
JB
266 ;;
267 i860-alliant-* )
8509d50c 268 machine=alliant-2800 opsys=bsd4-3
20d9a863 269 ;;
ca1d1d23 270
8509d50c
JB
271 ## Altos 3068
272 m68*-altos-sysv* )
273 machine=altos opsys=usg5-2
20d9a863 274 ;;
8509d50c
JB
275
276 ## Amdahl UTS
277 580-amdahl-sysv* )
278 machine=amdahl opsys=usg5-2-2
20d9a863 279 ;;
ca1d1d23 280
8509d50c
JB
281 ## Appallings - I mean, Apollos - running Domain
282 m68*-apollo* )
283 machine=apollo opsysfile=bsd4-2.h
20d9a863 284 ;;
8509d50c
JB
285
286 ## AT&T 3b2, 3b5, 3b15, 3b20
287 we32k-att-sysv* )
288 machine=att3b opsys=usg5-2-2
289 ;;
290
291 ## AT&T 3b1 - The Mighty Unix PC!
292 m68*-att-sysv* )
293 machine=7300 opsys=usg5-2-2
294 ;;
295
296 ## Bull sps7
297 m68*-bull-sysv* )
298 machine=sps7 opsys=usg5-2
20d9a863 299 ;;
8509d50c
JB
300
301 ## CCI 5/32, 6/32 -- see "Tahoe".
302
303 ## Celerity
304 ## I don't know what configuration name to use for this; config.sub
305 ## doesn't seem to know anything about it. Hey, Celerity users, get
306 ## in touch with us!
307 celerity-celerity-bsd* )
308 machine=celerity opsys=bsd4-2
309 ;;
310
311 ## Clipper
312 ## What operating systems does this chip run that Emacs has been
313 ## tested on?
314 clipper-* )
315 machine=clipper
316 ## We'll use the catch-all code at the bottom to guess the
317 ## operating system.
318 ;;
319
320 ## Convex
321 *-convex-bsd* )
322 machine=convex opsys=bsd4-3
323 ;;
324
325 ## Cubix QBx/386
326 i386-cubix-sysv* )
327 machine=intel386 opsys=usg5-3
328 ;;
329
330 ## Cydra 5
331 cydra*-cydrome-sysv* )
332 machine=cydra5 opsys=usg5-3
333 ;;
334
335 ## DECstations
336 mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0 | mips-dec-bsd4.2 )
337 machine=pmax opsys=bsd4-2
338 ;;
339 mips-dec-ultrix* | mips-dec-bsd* )
340 machine=pmax opsys=bsd4-3
341 ;;
342 mips-dec-osf* )
343 machine=pmax opsys=osf1
344 ;;
345
346 ## Motorola Delta machines
347 m68*-motorola-sysv* )
348 machine=delta opsys=usg5-3
349 ;;
350 m88k-motorola-sysv* | m88k-motorola-m88kbcs* )
351 machine=delta88k opsys=usg5-3
352 ;;
353
354 ## Dual machines
355 m68*-dual-sysv* )
356 machine=dual opsys=usg5-2
357 ;;
358 m68*-dual-uniplus* )
359 machine=dual opsys=unipl5-2
360 ;;
361
362 ## Elxsi 6400
363 elxsi-elxsi-sysv* )
364 machine=elxsi opsys=usg5-2
365 ;;
366
367 ## Encore machines
368 ns16k-encore-bsd* )
369 machine=ns16000 opsys=umax
370 ;;
371
372 ## The GEC 93 - apparently, this port isn't really finished yet.
373
374 ## Gould Power Node and NP1
375 pn-gould-bsd4.2 )
376 machine=gould opsys=bsd4-2
377 ;;
378 pn-gould-bsd4.3 )
379 machine=gould opsys=bsd4-3
380 ;;
381 np1-gould-bsd* )
382 machine=gould-np1 opsys=bsd4-3
383 ;;
384
385 ## Honeywell XPS100
386 xps*-honeywell-sysv* )
387 machine=xps100 opsys=usg5-2
388 ;;
389
390 ## HP 9000 series 200 or 300
391 m68*-hp-bsd* )
392 machine=hp9000s300 opsys=bsd4-3
393 ;;
394 ## HP/UX 8 doesn't run on these machines, so use HP/UX 7.
20d9a863 395 m68*-hp-hpux* )
8509d50c 396 machine=hp9000s300 opsys=hpux
20d9a863 397 ;;
ca1d1d23 398
8509d50c 399 ## HP 9000 series 800, running HP/UX
20d9a863 400 hppa1.0-hp-hpux* )
8509d50c
JB
401 machine=hp9000s800 opsys=hpux
402 ;;
403
404 ## Orion machines
405 orion-orion-bsd* )
406 machine=orion opsys=bsd4-2
407 ;;
408 clipper-orion-bsd* )
409 machine=orion105 opsys=bsd4-2
410 ;;
411
412 ## IBM machines
413 i386-ibm-aix1.1 )
414 machine=ibmps2-aix opsys=usg5-2-2
415 ;;
416 i386-ibm-aix1.2 )
417 machine=ibmps2-aix opsys=usg5-3
418 ;;
419 rs6000-ibm-aix* )
420 machine=ibmrs6000 opsys=aix3-1
421 ;;
422 romp-ibm-bsd* )
423 machine=ibmrt opsys=bsd4-2
424 ;;
425 romp-ibm-aix* )
426 machine=ibmrt-aix opsys=usg5-2-2
427 ;;
428
429 ## Integrated Solutions `Optimum V'
430 m68*-isi-bsd4.2 )
431 machine=isi-ov opsys=bsd4-2
432 ;;
433 m68*-isi-bsd4.3 )
434 machine=isi-ov opsys=bsd4-3
435 ;;
436
437 ## Intel 386 machines where we do care about the manufacturer
438 i[34]86-intsys-sysv* )
439 machine=is386 opsys=usg5-2-2
440 ;;
441 ## Intel 386 machines where we don't care about the manufacturer
442 i[34]86-* )
443 machine=intel386
444 case "${configuration}" in
445 *-isc1.* | *-isc2.[01]* ) opsys=386-ix ;;
446 *-isc* ) opsys=isc2-2 ;;
447 *-esix* ) opsys=esix ;;
448 *-xenix* ) opsys=xenix ;;
449 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
450 esac
451 ;;
452
453 ## Silicon Graphics machines
454 ## Iris 2500 and Iris 2500 Turbo (aka the Iris 3030)
455 m68*-sgi-iris3.5 )
456 machine=irist opsys=iris3-5
457 ;;
458 m68*-sgi-iris3.6 | m68*-sgi-iris*)
459 machine=irist opsys=iris3-6
460 ;;
461 ## Iris 4D
462 mips-sgi-irix3.* )
463 machine=iris4d opsys=irix3-3
464 ;;
465 mips-sgi-irix4.* | mips-sgi-irix* )
466 machine=iris4d opsys=irix4-0
20d9a863
JB
467 ;;
468
8509d50c
JB
469 ## Masscomp machines
470 m68*-masscomp-rtu )
471 machine=masscomp opsys=rtu
472 ;;
473
474 ## Megatest machines
475 m68*-megatest-bsd* )
476 machine=mega68 opsys=bsd4-2
477 ;;
478
479 ## Workstations sold by MIPS
480 ## This is not necessarily all workstations using the MIPS processor -
481 ## Irises are produced by SGI, and DECstations by DEC.
482
483 ## etc/MACHINES lists mips.h and mips4.h as possible machine files,
484 ## and usg5-2-2 and bsd4-3 as possible OS files. The only guidance
485 ## it gives for choosing between the alternatives seems to be "Use
486 ## -machine=mips4 for RISCOS version 4; use -opsystem=bsd4-3 with
487 ## the BSD world." I'll assume that these are instructions for
488 ## handling two odd situations, and that every other situation
489 ## should use mips.h and usg5-2-2, they being listed first.
490 mips-mips-riscos4* )
491 machine=mips4 opsys=usg5-2-2
492 ;;
493 mips-mips-bsd* )
494 machine=mips opsys=bsd4-3
495 ;;
496 mips-mips-* )
497 machine=mips opsys=usg5-2-2
498 ;;
499
500 ## The complete machine from National Semiconductor
501 ns32k-ns-genix* )
502 machine=ns32000 opsys=usg5-2
503 ;;
504
505 ## NCR machines
506 m68*-ncr-sysv2* )
507 machine=tower32 opsys=usg5-2-2
508 ;;
509 m68*-ncr-sysv3* )
510 machine=tower32v3 opsys=usg5-3
511 ;;
512
513 ## Nixdorf Targon 31
514 m68*-nixdorf-sysv* )
515 machine=targon31 opsys=usg5-2-2
516 ;;
517
518 ## Nu (TI or LMI)
519 m68*-nu-sysv* )
520 machine=nu opsys=usg5-2
521 ;;
522
523 ## Plexus
524 m68*-plexus-sysv* )
525 machine=plexus opsys=usg5-2
526 ;;
527
528 ## Prime EXL
529 i386-prime-sysv* )
530 machine=i386 opsys=usg5-3
531 ;;
532
533 ## Pyramid machines
534 ## I don't really have any idea what sort of processor the Pyramid has,
535 ## so I'm assuming it is its own architecture.
536 pyramid-pyramid-bsd* )
537 machine=pyramid opsys=bsd4-2
538 ;;
539
540 ## Sequent Balance
541 ns32k-sequent-bsd4.2 )
542 machine=sequent opsys=bsd4-2
543 ;;
544 ns32k-sequent-bsd4.3 )
545 machine=sequent opsys=bsd4-3
546 ;;
547 ## Sequent Symmetry
548 i386-sequent-bsd* )
549 machine=symmetry opsys=bsd4-3
550 ;;
551
552 ## SONY machines
553 m68*-sony-bsd4.2 )
554 machine=news opsys=bsd4-2
555 ;;
556 m68*-sony-bsd4.3 )
557 machine=news opsys=bsd4-3
558 ;;
559 mips-sony-bsd* )
560 machine=news-risc opsys=bsd4-3
561 ;;
562
563 ## Stride
564 m68*-stride-sysv* )
565 machine=stride opsys=usg5-2
566 ;;
567
568 ## Suns
20d9a863 569 *-sun-sunos* | *-sun-bsd* )
8509d50c
JB
570 case "${configuration}" in
571 m68*-sunos1* ) machine=sun1 ;;
572 m68*-sunos2* ) machine=sun2 ;;
573 m68* ) machine=sun3 ;;
574 i[34]86* ) machine=sun386 ;;
575 sparc* ) machine=sparc ;;
576 * ) unported=true ;;
577 esac
578 case "${configuration}" in
579 *-sunos4.0* ) opsys=sunos4-0 ;;
580 *-sunos4* | *-sunos ) opsys=sunos4-1 ;;
581 * ) opsys=bsd4-2 ;;
20d9a863 582 esac
8509d50c
JB
583 ;;
584
585 ## Tadpole 68k
586 m68*-tadpole-sysv* )
587 machine=tad68k opsys=usg5-3
588 ;;
589
590 ## Tahoe machines
591 tahoe-tahoe-bsd4.2 )
592 machine=tahoe opsys=bsd4-2
593 ;;
594 tahoe-tahoe-bsd4.3 )
595 machine=tahoe opsys=bsd4-3
596 ;;
597
598 ## Tandem Integrity S2
599 mips-tandem-sysv* )
600 machine=tandem-s2 opsys=usg5-3
601 ;;
602
603 ## Tektronix 16000 box (6130?)
604 ns16k-tektronix-bsd* )
605 machine=ns16000 opsys=bsd4-2
606 ;;
607 ## Tektronix 4300
608 ## src/m/tek4300.h hints that this is a m68k machine.
609 m68*-tektronix-bsd* )
610 machine=tex4300 opsys=bsd4-3
611 ;;
612
613 ## Titan P2 or P3
614 ## We seem to have lost the machine-description file titan.h!
615 titan-titan-sysv* )
616 machine=titan opsys=usg5-3
617 ;;
618
619 ## Ustation E30 (SS5E)
620 m68*-unisys-uniplus* )
621 machine=ustation opsystem=unipl5-2
622 ;;
623
624 ## Vaxen.
625 vax-dec-* )
626 machine=vax
627 case "${configuration}" in
628 *-bsd4.1 ) opsys=bsd4-1 ;;
629 *-bsd4.2 | *-ultrix[0-3].* | *-ultrix4.0 ) opsys=bsd4-2 ;;
630 *-bsd4.3 | *-ultrix* ) opsys=bsd4-3 ;;
631 *-sysv[01]* ) opsys=usg5-0 ;;
632 *-sysv2* ) opsys=usg5-2 ;;
633 *-vms* ) opsys=vms ;;
634 * ) unported=true
20d9a863
JB
635 esac
636 ;;
637
8509d50c
JB
638 ## Whitechapel MG1
639 ns16k-whitechapel-* )
640 machine=mg1
641 ## We don't know what sort of OS runs on these; we'll let the
642 ## operating system guessing code below try.
643 ;;
644
645 ## Wicat
646 m68*-wicat-sysv* )
647 machine=wicat opsys=usg5-2
648 ;;
649
20d9a863 650 * )
8509d50c 651 unported=true
20d9a863 652 ;;
20d9a863 653esac
ca1d1d23 654
8509d50c
JB
655### If the code above didn't choose an operating system, just choose
656### an operating system based on the configuration name. You really
657### only want to use this when you have no idea what the right
658### operating system is; if you know what operating systems a machine
659### runs, it's cleaner to make it explicit in the case statement
660### above.
661if [ ! "${opsys}" ]; then
662 case "${configuration}" in
663 *-bsd4.[01] ) opsys=bsd4-1 ;;
664 *-bsd4.2 ) opsys=bsd4-2 ;;
665 *-bsd4.3 ) opsys=bsd4-3 ;;
666 *-sysv0 ) opsys=usg5-0 ;;
667 *-sysv2 ) opsys=usg5-2 ;;
668 *-sysv2.2 ) opsys=usg5-2-2 ;;
669 *-sysv3 ) opsys=usg5-3 ;;
670 *-sysv4 ) opsys=usg5-4 ;;
671 * )
672 unported=true
673 ;;
674 esac
675fi
676
677if $unported ; then
678 (echo "${progname}: Emacs hasn't been ported to \`${configuration}' systems."
679 echo "${progname}: Check \`etc/MACHINES' for recognized configuration names."
680 ) >&2
681 exit 1
682fi
683
684machfile="m/${machine}.h"
685opsysfile="s/${opsys}.h"
686
ca1d1d23 687
0c22fbca 688#### Choose a window system.
46947372 689echo "Checking window system."
8509d50c 690window_system=''
20d9a863 691case "${with_x}" in
2c44309a
RS
692 yes )
693 window_system=${window_system}x11
20d9a863
JB
694 ;;
695 no )
696 window_system=${window_system}none
2c44309a 697esac
20d9a863 698case "${with_x11}" in
2c44309a
RS
699 yes )
700 window_system=${window_system}x11
20d9a863 701 ;;
2c44309a
RS
702esac
703case "${with_x10}" in
704 yes )
705 window_system=${window_system}x10
20d9a863 706 ;;
2c44309a
RS
707esac
708
ca1d1d23
JB
709case "${window_system}" in
710 "none" | "x11" | "x10" ) ;;
ca1d1d23 711 "" )
46947372 712 echo " No window system specifed. Looking for X Windows."
ca1d1d23 713 window_system=none
9e2b097b 714 if [ -r /usr/lib/libX11.a -o -d /usr/include/X11 ]; then
ca1d1d23 715 window_system=x11
46947372 716 fi
ca1d1d23
JB
717 ;;
718 * )
2c44309a 719 echo "Don\'t specify the window system more than once." >&2
ca1d1d23
JB
720 exit 1
721 ;;
722esac
723
724case "${window_system}" in
725 x11 )
0c22fbca
JB
726 HAVE_X_WINDOWS=yes
727 HAVE_X11=yes
8509d50c 728 echo " Using X11."
ca1d1d23
JB
729 ;;
730 x10 )
0c22fbca
JB
731 HAVE_X_WINDOWS=yes
732 HAVE_X11=no
8509d50c 733 echo " Using X10."
ca1d1d23
JB
734 ;;
735 none )
0c22fbca
JB
736 HAVE_X_WINDOWS=no
737 HAVE_X11=no
8509d50c 738 echo " Using no window system."
ca1d1d23
JB
739 ;;
740esac
741
0c22fbca
JB
742### If we're using X11, we should use the X menu package.
743HAVE_X_MENU=no
744case ${HAVE_X11} in
20d9a863 745 yes )
0c22fbca 746 HAVE_X_MENU=yes
ca1d1d23
JB
747 ;;
748esac
749
0c22fbca
JB
750
751#### Choose a compiler.
20d9a863
JB
752echo "Checking for GCC."
753temppath=`echo $PATH | sed 's/^:/.:/
754 s/::/:.:/g
755 s/:$/:./
756 s/:/ /g'`
0c22fbca 757default_cc=`(
20d9a863
JB
758 for dir in ${temppath}; do
759 if [ -f ${dir}/gcc ]; then echo gcc; exit 0; fi
760 done
761 echo cc
762)`
763
0c22fbca 764case "${default_cc}" in
4746118a 765 "gcc" )
8509d50c 766 echo " Using GCC."
0c22fbca 767 default_cflags='-g -O'
4746118a
JB
768 ;;
769 "*" )
8509d50c 770 echo " Using the system's CC."
0c22fbca 771 default_cflags='-g'
4746118a 772 ;;
ca1d1d23
JB
773esac
774
0c22fbca
JB
775
776#### What is the return type of a signal handler?
777
778### We run /usr/include/signal.h through cpp and grep for the
779### declaration of the signal function. Yuck.
4746118a
JB
780echo "Looking for return type of signal handler functions."
781signal_h_file=''
782if [ -r /usr/include/signal.h ]; then
783 signal_h_file=/usr/include/signal.h
784elif [ -r /usr/include/sys/signal.h ]; then
785 signal_h_file=/usr/include/sys/signal.h
786fi
0c22fbca 787SIGTYPE=void
4746118a
JB
788if [ "${signal_h_file}" ]; then
789 sigpattern='[ ]*([ ]*\*[ ]*signal[ ]*('
790
0c22fbca
JB
791 ## We make a copy whose name ends in .c, so the compiler
792 ## won't complain about having only been given a .h file.
4746118a 793 tempcname="configure.tmp.$$.c"
ef15f270 794 cp ${signal_h_file} ${tempcname}
0c22fbca
JB
795 if ${default_cc} -E ${tempcname} | grep "int${sigpattern}" > /dev/null; then
796 SIGTYPE=int
4746118a 797 fi
ef15f270 798 rm -f ${tempcname}
4746118a 799fi
0c22fbca
JB
800echo " Guessing that signals return \`${SIGTYPE}'."
801
802
803#### Extract some information from the operating system and machine files.
4746118a 804
46947372
JB
805echo "Examining the machine- and system-dependent files to find out"
806echo " - which libraries the lib-src programs will want, and"
807echo " - whether the GNU malloc routines are usable."
808tempcname="configure.tmp.$$.c"
e94740ce
JB
809echo '
810#include "'${srcdir}'/src/'${opsysfile}'"
811#include "'${srcdir}'/src/'${machfile}'"
ca1d1d23
JB
812#ifndef LIBS_MACHINE
813#define LIBS_MACHINE
814#endif
815#ifndef LIBS_SYSTEM
816#define LIBS_SYSTEM
817#endif
4746118a 818@configure@ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
46947372 819#ifdef SYSTEM_MALLOC
4746118a 820@configure@ system_malloc=yes
46947372 821#else
4746118a 822@configure@ system_malloc=no
46947372
JB
823#endif
824' > ${tempcname}
0c22fbca 825eval `${default_cc} -E ${tempcname} \
4746118a
JB
826 | grep '@configure@' \
827 | sed -e 's/^@configure@//'`
46947372
JB
828rm ${tempcname}
829
830# Do the opsystem or machine files prohibit the use of the GNU malloc?
e94740ce
JB
831# Assume not, until told otherwise.
832GNU_MALLOC=yes
46947372 833if [ "${system_malloc}" = "yes" ]; then
0c22fbca
JB
834 GNU_MALLOC=no
835 GNU_MALLOC_reason="
8509d50c 836 (The GNU allocators don't work with this system configuration.)"
46947372
JB
837fi
838
0c22fbca
JB
839if [ ! "${REL_ALLOC}" ]; then
840 REL_ALLOC=${GNU_MALLOC}
46947372 841fi
ca1d1d23 842
0c22fbca
JB
843LISP_FLOAT_TYPE=yes
844
e94740ce
JB
845
846#### Find out which version of Emacs this is.
847version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \
848 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'`
849if [ ! "${version}" ]; then
850 echo "${progname}: can't find current emacs version in
851 \`${srcdir}/lisp/version.el'." >&2
852 exit 1
853fi
854
855
0c22fbca 856#### Make the proper settings in `src/config.h'.
ca1d1d23
JB
857rm -f config.status
858set -e
859
0c22fbca
JB
860echo "Making \`./src/config.h' from \`${srcdir}/src/config.h.in'."
861sed_flags="-e 's:@machine@:${machfile}:' -e 's:@opsystem@:${opsysfile}:'"
f6766fff 862
0c22fbca 863for flag in ${config_h_opts}; do
ca1d1d23
JB
864 val=`eval echo '$'${flag}`
865 case ${val} in
866 no | "")
0c22fbca 867 f="-e 's:.*#define ${flag}.*:/\\* #define ${flag} \\*/:'"
ca1d1d23
JB
868 ;;
869 yes)
0c22fbca 870 f="-e 's:.*#define ${flag}.*:#define ${flag}:'"
ca1d1d23
JB
871 ;;
872 *)
0c22fbca 873 f="-e 's:.*#define ${flag}.*:#define ${flag} ${val}:'"
ca1d1d23
JB
874 ;;
875 esac
876 sed_flags="${sed_flags} ${f}"
877done
f6766fff 878
0c22fbca
JB
879rm -f ./src/config.h.tmp
880(echo "/* This file is generated by \`${progname}' from"
881 echo " \`${srcdir}/src/config.h.in'."
882 echo " If you are thinking about editing it, you should seriously consider"
883 echo " running \`${progname} instead, or editing"
884 echo " \`${srcdir}/src/config.h.in' itself."
885 eval '/bin/sed '${sed_flags}' < "${srcdir}/src/config.h.in"'
886) > src/config.h.tmp
e94740ce 887${srcdir}/move-if-change src/config.h.tmp src/config.h
0c22fbca 888### Remind people not to edit this.
46947372 889chmod -w src/config.h
ca1d1d23 890
0c22fbca 891
e94740ce
JB
892#### Modify the parameters in the top-level Makefile.
893echo "Producing \`Makefile' from \`${srcdir}/Makefile.in'."
a88b5c25 894rm -f Makefile.tmp
0c22fbca 895(echo "\
e94740ce
JB
896# This file is generated by \`${progname}' from
897# \`${srcdir}/Makefile.in'.
46947372 898# If you are thinking about editing it, you should seriously consider
e94740ce
JB
899# running \`${progname}' instead, or editing
900# \`${srcdir}/Makefile.in' itself."
901 /bin/sed < ${srcdir}/Makefile.in \
902 -e 's|^configname *=.*$|configname='"${configuration}"'|' \
903 -e 's|^version *=.*$|version='"${version}"'|' \
904 -e 's|^srcdir *=.*$|srcdir='"${srcdir}"'|' \
905 -e 's|^CC *=.*$|CC='"${default_cc}"'|' \
906 -e 's|^CONFIG_CFLAGS *=.*$|CONFIG_CFLAGS='"${default_cflags}"'|' \
907 -e 's|^LOADLIBES *=.*$|LOADLIBES='"${libsrc_libs}"'|' \
908 -e '/^# DIST: /d') > Makefile.tmp
909${srcdir}/move-if-change Makefile.tmp Makefile
ca1d1d23 910
0c22fbca
JB
911### I'm commenting out this section until I bring the `build-install' script
912### into line with the rest of the configuration stuff.
913
914### # Modify the parameters in the `build-install' script.
915### echo "Producing \`./build-install' from \`${srcdir}/build-install.in'."
916### rm -f ./build-install.tmp
917### (echo "\
918### # This file is generated by \`${progname}' from \`${srcdir}/build-install.in'.
919### # If you are thinking about editing it, you should seriously consider
920### # editing \`./build-install.in' itself, or running \`${progname}' instead."
921### /bin/sed < ${srcdir}/build-install.in \
922### -e 's;^\(prefix=\).*$;\1'"${prefix};" \
923### -e 's;^\(bindir=\).*$;\1'"${bindir};" \
924### -e 's;^\(lisppath=\).*$;\1'"${lisppath};" \
925### -e 's;^\(datadir=\).*$;\1'"${datadir};" \
926### -e 's;^\(lockdir=\).*$;\1'"${lockdir};" \
927### -e 's;^\(libdir=\).*$;\1'"${libdir};") > ./build-install.tmp
e94740ce 928### ${srcdir}/move-if-change build-install.tmp build-install
0c22fbca
JB
929### # Remind people not to edit this.
930### chmod -w build-install
931### chmod +x build-install
ca1d1d23 932
e94740ce
JB
933
934#### Describe the results.
935
936### Create a verbal description of what we have done.
8509d50c
JB
937message="Configured for \`${configuration}'.
938
8509d50c
JB
939 What operating system and machine description files should Emacs use?
940 \`${opsysfile}' and \`${machfile}'
0c22fbca
JB
941 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
942 Should Emacs use the relocating allocator for buffers? ${REL_ALLOC}
e5d77022 943 What window system should Emacs use? ${window_system}
e94740ce
JB
944 What compiler should emacs be built with? ${default_cc}
945 Should the compilation use \`-g' and/or \`-O'? ${default_cflags- neither}"
8c0e7b73 946
e94740ce 947### Write config.status, documenting the damage we have done.
8c0e7b73 948
e94740ce
JB
949(echo "\
950#!/bin/sh
951### This file is generated by \`${progname}.'
952### If you are thinking about editing it, you should seriously consider
953### running \`${progname}' instead.
954"
955 echo "${message}" | sed -e 's/^/# /'
956 echo "exec '${progname}' ${arguments} "'$@') > config.status
8c0e7b73 957
e94740ce 958### Remind people not to edit this.
46947372 959chmod -w config.status
8c0e7b73
JB
960chmod +x config.status
961
e94740ce 962### Print the description.
ca1d1d23 963echo
e5d77022 964echo "${message}"
ca1d1d23
JB
965
966exit 0