(repeat-history-command): Bug fix. Someone forgot a car.
[emacs.git] / configure1.in
blobfcce3ada2c4117a24ccbec0f364ac8dd3105e09f
2 ### The above line is deliberately left blank.  If it starts with a #,
3 ### some CSH's will think this is a csh script.
5 #### Configuration script for GNU Emacs
6 #### Copyright (C) 1992 Free Software Foundation, Inc.
8 ### This file is part of GNU Emacs.
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.
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.
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.
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.
34 ### Remove any more than one leading "." element from the path name.
35 ### If we don't remove them, then another "./" will be prepended to
36 ### the file name each time we use config.status, and the program name
37 ### will get larger and larger.  This wouldn't be a problem, except
38 ### that since progname gets recorded in all the Makefiles this script
39 ### produces, move-if-change thinks they're different when they're
40 ### not.
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.
46 progname="`echo $0 | sed 's:^\./\./:\./:'`"
49 #### Usage messages.
51 short_usage="Type \`${progname} --usage' for more information about options."
53 long_usage="Usage: ${progname} CONFIGURATION [-OPTION[=VALUE] ...]
55 Set compilation and installation parameters for GNU Emacs, and report.
56 CONFIGURATION specifies the machine and operating system to build for.
57 For example:
58         ${progname} sparc-sun-sunos4.1
59 configures Emacs to build on a Sun Sparc machine running SunOS 4.1, and 
60         ${progname} decstation
61 configures Emacs to run on a DECstation running Ultrix.  See \`etc/MACHINES'.
63 The --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'.
67 The --x-includes=DIR option tells the build process where to search
68         for the X Windows header files.  DIR should have a
69         subdirectory called \`X11' which contains \`X.h', \`Xlib.h', and
70         the rest of the header files; DIR should not contain \`X11'
71         itself.  If this option is omitted, the build process assumes
72         they exist in a directory the compiler checks by default.
74 The --x-libraries=DIR option tells the build process where to look for
75         the X windows libraries.  If this option is omitted, the build
76         process assumes they are in a directory the compiler checks by
77         default.
79 The --with-gcc option says that the build process should use GCC to
80         compile Emacs.  If you have GCC but don't want to use it,
81         specify \`--with-gcc=no'.  \`configure' tries to guess whether
82         or not you have GCC by searching your executable path, but if
83         it guesses incorrectly, you may need to use this.
85 The --srcdir=DIR option specifies that the configuration and build
86         processes should look for the Emacs source code in DIR, when
87         DIR is not the current directory.  This option doesn't work yet.
89 If successful, ${progname} leaves its status in config.status.  If
90 unsuccessful after disturbing the status quo, it removes config.status."
93 #### Option processing.
95 ### These are the names of CPP symbols we want to define or leave undefined
96 ### in src/config.h; their values are given by the shell variables of the same
97 ### names.
98 config_h_opts=" \
99 HAVE_X_WINDOWS HAVE_X11 HAVE_X_MENU \
100 SIGTYPE GNU_MALLOC REL_ALLOC LISP_FLOAT_TYPE HAVE_CONST \
101 LD_SWITCH_X_SITE C_SWITCH_X_SITE HAVE_XFREE386"
103 ### Record all the arguments, so we can save them in config.status.
104 arguments="$@"
106 while [ $# != 0 ]; do
107   arg="$1"
108   case "${arg}" in
110     ## Anything starting with a hyphen we assume is an option.
111     -* )
113       ## Separate the switch name from the value it's being given.
114       case "${arg}" in
115         -*=*)
116           opt=`echo ${arg} | sed 's:^-*\([^=]*\)=.*$:\1:'`
117           val=`echo ${arg} | sed 's:^-*[^=]*=\(.*\)$:\1:'`
118           valomitted=no
119         ;;
120         -*)
121           ## If FOO is a boolean argument, --FOO is equivalent to
122           ## --FOO=yes.  Otherwise, the value comes from the next
123           ## argument - see below.
124           opt=`echo ${arg} | sed 's:^-*\(.*\)$:\1:'`
125           val="yes"
126           valomitted=yes
127         ;;
128       esac
130       ## Change `-' in the option name to `_'.
131       optname="${opt}"
132       opt="`echo ${opt} | tr - _`"
134       ## Process the option.
135       case "${opt}" in
137         ## Has the user specified which window systems they want to support?
138         "with_x" | "with_x11" | "with_x10" )
139           ## Make sure the value given was either "yes" or "no".
140           case "${val}" in
141             y | ye | yes )      val=yes ;;
142             n | no )            val=no  ;;
143             * )
144               (echo "${progname}: the \`--${optname}' option is supposed to have a boolean value.
145 Set it to either \`yes' or \`no'."
146                echo "${short_usage}") >&2
147               exit 1
148             ;;
149           esac
150           eval "${opt}=\"${val}\""
151         ;;
153         ## Has the user specified whether or not they want GCC?
154         "with_gcc" )
155           ## Make sure the value given was either "yes" or "no".
156           case "${val}" in
157             y | ye | yes )      val=yes ;;
158             n | no )            val=no  ;;
159             * )
160               (echo "${progname}: the \`--${optname}' option is supposed to have a boolean value.
161 Set it to either \`yes' or \`no'."
162                echo "${short_usage}") >&2
163               exit 1
164             ;;
165           esac
166           eval "${opt}=\"${val}\""
167         ;;
169         ## Has the user specified a source directory?
170         "srcdir" )
171           ## If the value was omitted, get it from the next argument.
172           if [ "${valomitted}" = "yes" ]; then
173             ## Get the next argument from the argument list, if there is one.
174             if [ $# = 1 ]; then
175               (echo "${progname}: You must give a value for the \`--${optname}' option, as in
176     \`--${optname}=FOO'."
177                echo "${short_usage}") >&2
178               exit 1
179             fi
180             shift; val="$1"
181           fi
182           srcdir="${val}"
184           echo "${progname}: Beware - the \`--srcdir' option doesn't work yet." >&2
185         ;;
187         ## Has the user tried to tell us where the X files are?
188         ## I think these are dopey, but no less than three alpha
189         ## testers, at large sites, have said they have their X files
190         ## installed in odd places.
191         "x_includes" )
192           ## If the value was omitted, get it from the next argument.
193           if [ "${valomitted}" = "yes" ]; then
194             ## Get the next argument from the argument list, if there is one.
195             if [ $# = 1 ]; then
196               (echo "${progname}: You must give a value for the \`--${optname}' option, as in
197     \`--${optname}=FOO'."
198                echo "${short_usage}") >&2
199               exit 1
200             fi
201             shift; val="$1"
202           fi
203           x_includes="${val}"
204           C_SWITCH_X_SITE="-I${x_includes}"
205         ;;
206         "x_libraries" )
207           ## If the value was omitted, get it from the next argument.
208           if [ "${valomitted}" = "yes" ]; then
209             ## Get the next argument from the argument list, if there is one.
210             if [ $# = 1 ]; then
211               (echo "${progname}: You must give a value for the \`--${optname}' option, as in
212     \`--${optname}=FOO'."
213                echo "${short_usage}") >&2
214               exit 1
215             fi
216             shift; val="$1"
217           fi
218           x_libraries="${val}"
219           LD_SWITCH_X_SITE="-L${x_libraries}"
220         ;;
222         ## Has the user asked for some help?
223         "usage" | "help" )
224           echo "${long_usage}" | more
225           exit
226         ;;
228         ## We ignore all other options silently.
229       esac
230     ;;
232     ## Anything not starting with a hyphen we assume is a
233     ## configuration name.
234     *)
235       configuration=${arg}
236     ;;
238   esac
239   shift
240 done
242 if [ "${configuration}" = "" ]; then
243   (echo "${progname}: You must specify a configuration name as an argument."
244    echo "${short_usage}") >&2
245   exit 1
249 #### Decide where the source is.
250 case "${srcdir}" in
252   ## If it's not specified, see if  `.' or `..' might work.
253   "" )
254     if [ -f "./src/lisp.h" -a -f "./lisp/version.el" ]; then
255       srcdir=`pwd`
256     else
257       if [ -f "../src/lisp.h" -a -f "../lisp/version.el" ]; then
258         srcdir=`(cd .. ; pwd)`
259       else
260         (echo "\
261 ${progname}: Neither the current directory nor its parent seem to
262 contain the Emacs sources.  If you do not want to build Emacs in its
263 source tree, you should run \`${progname}' in the directory in which
264 you wish to build Emacs, using its \`--srcdir' option to say where the
265 sources may be found."
266          echo "${short_usage}") >&2
267         exit 1
268       fi
269     fi
270   ;;
272   ## Otherwise, check if the directory they specified is okay.
273   * )
274     if [ ! -d "${srcdir}" -o ! -f "${srcdir}/src/lisp.h" -o ! -f "${srcdir}/lisp/version.el" ]; then
275       (echo "\
276 ${progname}: The directory specified with the \`--srcdir' option,
277 \`${srcdir}', doesn't seem to contain the Emacs sources.  You should
278 either run the \`${progname}' script at the top of the Emacs source
279 tree, or use the \`--srcdir' option to specify where the Emacs sources
280 are."
281        echo "${short_usage}") >&2
282       exit 1
283     fi
284   ;;
286 esac
288 ### Make the necessary directories, if they don't exist.
289 if [ ! -d ./src ]; then
290   mkdir ./src
292 if [ ! -d ./lib-src ]; then
293   mkdir ./lib-src
295 if [ ! -d ./cpp ]; then
296   mkdir ./cpp
298 if [ ! -d ./oldXMenu ]; then
299   mkdir ./oldXMenu
303 #### Given the configuration name, set machfile and opsysfile to the
304 #### names of the m/*.h and s/*.h files we should use.
306 ### Canonicalize the configuration name.
307 echo "Checking the configuration name."
308 if configuration=`${srcdir}/config.sub "${configuration}"` ; then : ; else
309   exit $?
312 ### If you add support for a new configuration, add code to this
313 ### switch statement to recognize your configuration name and select
314 ### the appropriate operating system and machine description files.
316 ### You would hope that you could choose an m/*.h file pretty much
317 ### based on the machine portion of the configuration name, and an s-
318 ### file based on the operating system portion.  However, it turns out
319 ### that each m/*.h file is pretty manufacturer-specific - for
320 ### example, apollo.h, hp9000s300.h, mega68k, news.h, and tad68k are
321 ### all 68000 machines; mips.h, pmax.h, and news-risc are all MIPS
322 ### machines.  So we basically have to have a special case for each
323 ### configuration name.
325 ### As far as handling version numbers on operating systems is
326 ### concerned, make sure things will fail in a fixable way.  If
327 ### /etc/MACHINES doesn't say anything about version numbers, be
328 ### prepared to handle anything reasonably.  If version numbers
329 ### matter, be sure /etc/MACHINES says something about it.
331 ### Eric Raymond says we should accept strings like "sysvr4" to mean
332 ### "System V Release 4"; he writes, "The old convention encouraged
333 ### confusion between `system' and `release' levels'."
335 machine='' opsys='' unported='false'
336 case "${configuration}" in
338   ## Alliant machines
339   ## Strictly speaking, we need the version of the alliant operating
340   ## system to choose the right machine file, but currently the
341   ## configuration name doesn't tell us enough to choose the right
342   ## one; we need to give alliants their own operating system name to
343   ## do this right.  When someone cares, they can help us.
344   fx80-alliant-* )
345     machine=alliant4 opsys=bsd4-2
346   ;;
347   i860-alliant-* )
348     machine=alliant-2800 opsys=bsd4-3
349   ;;
351   ## Altos 3068
352   m68*-altos-sysv* )
353     machine=altos opsys=usg5-2
354   ;;
355     
356   ## Amdahl UTS
357   580-amdahl-sysv* )
358     machine=amdahl opsys=usg5-2-2
359   ;;
361   ## Appallings - I mean, Apollos - running Domain
362   m68*-apollo* )
363     machine=apollo opsysfile=bsd4-2.h
364   ;;
366   ## AT&T 3b2, 3b5, 3b15, 3b20
367   we32k-att-sysv* )
368     machine=att3b opsys=usg5-2-2
369   ;;
371   ## AT&T 3b1 - The Mighty Unix PC!
372   m68*-att-sysv* )
373     machine=7300 opsys=usg5-2-2
374   ;;
376   ## Bull sps7
377   m68*-bull-sysv* )
378     machine=sps7 opsys=usg5-2
379   ;;
381   ## CCI 5/32, 6/32 -- see "Tahoe".
383   ## Celerity
384   ## I don't know what configuration name to use for this; config.sub
385   ## doesn't seem to know anything about it.  Hey, Celerity users, get
386   ## in touch with us!
387   celerity-celerity-bsd* )
388     machine=celerity opsys=bsd4-2
389   ;;
391   ## Clipper
392   ## What operating systems does this chip run that Emacs has been
393   ## tested on?
394   clipper-* )
395     machine=clipper
396     ## We'll use the catch-all code at the bottom to guess the
397     ## operating system.
398   ;;
400   ## Convex
401   *-convex-bsd* )
402     machine=convex opsys=bsd4-3
403   ;;
405   ## Cubix QBx/386
406   i386-cubix-sysv* )
407     machine=intel386 opsys=usg5-3
408   ;;
410   ## Cydra 5
411   cydra*-cydrome-sysv* )
412     machine=cydra5 opsys=usg5-3
413   ;;
415   ## DECstations
416   mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0 | mips-dec-bsd4.2 )
417     machine=pmax opsys=bsd4-2
418   ;;
419   mips-dec-ultrix* | mips-dec-bsd* )
420     machine=pmax opsys=bsd4-3
421   ;;
422   mips-dec-osf* )
423     machine=pmax opsys=osf1
424   ;;
426   ## Motorola Delta machines
427   m68*-motorola-sysv* )
428     machine=delta opsys=usg5-3
429   ;;
430   m88k-motorola-sysv* | m88k-motorola-m88kbcs* )
431     machine=delta88k opsys=usg5-3
432   ;;
434   ## Dual machines
435   m68*-dual-sysv* )
436     machine=dual opsys=usg5-2
437   ;;
438   m68*-dual-uniplus* )
439     machine=dual opsys=unipl5-2
440   ;;
442   ## Elxsi 6400
443   elxsi-elxsi-sysv* )
444     machine=elxsi opsys=usg5-2
445   ;;
447   ## Encore machines
448   ns16k-encore-bsd* )
449     machine=ns16000 opsys=umax
450   ;;
452   ## The GEC 93 - apparently, this port isn't really finished yet.
454   ## Gould Power Node and NP1
455   pn-gould-bsd4.2 )
456     machine=gould opsys=bsd4-2
457   ;;
458   pn-gould-bsd4.3 )
459     machine=gould opsys=bsd4-3
460   ;;
461   np1-gould-bsd* )
462     machine=gould-np1 opsys=bsd4-3
463   ;;
465   ## Honeywell XPS100
466   xps*-honeywell-sysv* )
467     machine=xps100 opsys=usg5-2
468   ;;
470   ## HP 9000 series 200 or 300
471   m68*-hp-bsd* )
472     machine=hp9000s300 opsys=bsd4-3
473   ;;
474   ## HP/UX 8 doesn't run on these machines, so use HP/UX 7.
475   m68*-hp-hpux* )
476     machine=hp9000s300 opsys=hpux
477   ;;
479   ## HP 9000 series 800, running HP/UX
480   hppa1.0-hp-hpux* )
481     machine=hp9000s800 opsys=hpux
482   ;;
484   ## Orion machines
485   orion-orion-bsd* )
486     machine=orion opsys=bsd4-2
487   ;;
488   clipper-orion-bsd* )
489     machine=orion105 opsys=bsd4-2
490   ;;
492   ## IBM machines
493   i386-ibm-aix1.1 )
494     machine=ibmps2-aix opsys=usg5-2-2
495   ;;
496   i386-ibm-aix1.2 )
497     machine=ibmps2-aix opsys=usg5-3
498   ;;
499   rs6000-ibm-aix3.1 )
500     machine=ibmrs6000 opsys=aix3-1
501   ;;
502   rs6000-ibm-aix3.2 | rs6000-ibm-aix* )
503     machine=ibmrs6000 opsys=aix3-2
504   ;;
505   romp-ibm-bsd* )
506     machine=ibmrt opsys=bsd4-2
507   ;;
508   romp-ibm-aix* )
509     machine=ibmrt-aix opsys=usg5-2-2
510   ;;
512   ## Integrated Solutions `Optimum V'
513   m68*-isi-bsd4.2 )
514     machine=isi-ov opsys=bsd4-2
515   ;;
516   m68*-isi-bsd4.3 )
517     machine=isi-ov opsys=bsd4-3
518   ;;
520   ## Intel 386 machines where we do care about the manufacturer
521   i[34]86-intsys-sysv* )
522     machine=is386 opsys=usg5-2-2
523   ;;
524   ## Intel 386 machines where we don't care about the manufacturer
525   i[34]86-* )
526     machine=intel386
527     case "${configuration}" in
528       *-isc1.* | *-isc2.[01]* ) opsys=386-ix ;;
529       *-isc2.2 )                opsys=isc2-2 ;;
530       *-isc* )                  opsys=isc3-0 ;;
531       *-esix* )                 opsys=esix ;;
532       *-xenix* )                opsys=xenix ;;
533       ## Otherwise, we'll fall through to the generic opsys code at the bottom.
534     esac
535   ;;
537   ## Silicon Graphics machines
538   ## Iris 2500 and Iris 2500 Turbo (aka the Iris 3030)
539   m68*-sgi-iris3.5 )
540     machine=irist opsys=iris3-5
541   ;;
542   m68*-sgi-iris3.6 | m68*-sgi-iris*)
543     machine=irist opsys=iris3-6
544   ;;
545   ## Iris 4D
546   mips-sgi-irix3.* )
547     machine=iris4d opsys=irix3-3
548   ;;
549   mips-sgi-irix4.* | mips-sgi-irix* )
550     machine=iris4d opsys=irix4-0
551   ;;
553   ## Masscomp machines
554   m68*-masscomp-rtu )
555     machine=masscomp opsys=rtu
556   ;;
558   ## Megatest machines
559   m68*-megatest-bsd* )
560     machine=mega68 opsys=bsd4-2
561   ;;
563   ## Workstations sold by MIPS
564   ## This is not necessarily all workstations using the MIPS processor -
565   ## Irises are produced by SGI, and DECstations by DEC.
567   ## etc/MACHINES lists mips.h and mips4.h as possible machine files,
568   ## and usg5-2-2 and bsd4-3 as possible OS files.  The only guidance
569   ## it gives for choosing between the alternatives seems to be "Use
570   ## -machine=mips4 for RISCOS version 4; use -opsystem=bsd4-3 with
571   ## the BSD world."  I'll assume that these are instructions for
572   ## handling two odd situations, and that every other situation
573   ## should use mips.h and usg5-2-2, they being listed first.
574   mips-mips-riscos4* )
575     machine=mips4 opsys=usg5-2-2
576   ;;
577   mips-mips-bsd* )
578     machine=mips opsys=bsd4-3
579   ;;
580   mips-mips-* )
581     machine=mips opsys=usg5-2-2
582   ;;
584   ## The complete machine from National Semiconductor
585   ns32k-ns-genix* )
586     machine=ns32000 opsys=usg5-2
587   ;;
589   ## NCR machines
590   m68*-ncr-sysv2* | m68*-ncr-sysvr2* )
591     machine=tower32 opsys=usg5-2-2
592   ;;
593   m68*-ncr-sysv3* | m68*-ncr-sysvr3* )
594     machine=tower32v3 opsys=usg5-3
595   ;;
597   ## Nixdorf Targon 31
598   m68*-nixdorf-sysv* )
599     machine=targon31 opsys=usg5-2-2
600   ;;
602   ## Nu (TI or LMI)
603   m68*-nu-sysv* )
604     machine=nu opsys=usg5-2
605   ;;
607   ## Plexus
608   m68*-plexus-sysv* )
609     machine=plexus opsys=usg5-2
610   ;;
612   ## Prime EXL
613   i386-prime-sysv* )
614     machine=i386 opsys=usg5-3
615   ;;
617   ## Pyramid machines
618   ## I don't really have any idea what sort of processor the Pyramid has,
619   ## so I'm assuming it is its own architecture.
620   pyramid-pyramid-bsd* )
621     machine=pyramid opsys=bsd4-2
622   ;;
624   ## Sequent Balance
625   ns32k-sequent-bsd4.2 )
626     machine=sequent opsys=bsd4-2
627   ;;
628   ns32k-sequent-bsd4.3 )
629     machine=sequent opsys=bsd4-3
630   ;;
631   ## Sequent Symmetry
632   i386-sequent-bsd* )
633     machine=symmetry opsys=bsd4-3
634   ;;
636   ## SONY machines
637   m68*-sony-bsd4.2 )
638     machine=news opsys=bsd4-2
639   ;;
640   m68*-sony-bsd4.3 )
641     machine=news opsys=bsd4-3
642   ;;
643   mips-sony-bsd* )
644     machine=news-risc opsys=bsd4-3
645   ;;
647   ## Stride
648   m68*-stride-sysv* )
649     machine=stride opsys=usg5-2
650   ;;
652   ## Suns
653   *-sun-sunos* | *-sun-bsd* )
654     case "${configuration}" in
655       m68*-sunos1* )    machine=sun1 ;;
656       m68*-sunos2* )    machine=sun2 ;;
657       m68* )            machine=sun3 ;;
658       i[34]86* )        machine=sun386 ;;
659       sparc* )          machine=sparc ;;
660       * )               unported=true ;;
661     esac
662     case "${configuration}" in
663       *-sunos4.0*         ) opsys=sunos4-0 ;;
664       *-sunos4* | *-sunos ) opsys=sunos4-1 ;;
665       *                   ) opsys=bsd4-2   ;;
666     esac
667   ;;
669   ## Tadpole 68k
670   m68*-tadpole-sysv* )
671     machine=tad68k opsys=usg5-3
672   ;;
674   ## Tahoe machines
675   tahoe-tahoe-bsd4.2 )
676     machine=tahoe opsys=bsd4-2
677   ;;
678   tahoe-tahoe-bsd4.3 )
679     machine=tahoe opsys=bsd4-3
680   ;;
682   ## Tandem Integrity S2
683   mips-tandem-sysv* )
684     machine=tandem-s2 opsys=usg5-3
685   ;;
687   ## Tektronix 16000 box (6130?)
688   ns16k-tektronix-bsd* )
689     machine=ns16000 opsys=bsd4-2
690   ;;
691   ## Tektronix 4300
692   ## src/m/tek4300.h hints that this is a m68k machine.
693   m68*-tektronix-bsd* )
694     machine=tex4300 opsys=bsd4-3
695   ;;
697   ## Titan P2 or P3
698   ## We seem to have lost the machine-description file titan.h!
699   titan-titan-sysv* )
700     machine=titan opsys=usg5-3
701   ;;
702   
703   ## Ustation E30 (SS5E)
704   m68*-unisys-uniplus* )
705     machine=ustation opsystem=unipl5-2
706   ;;
708   ## Vaxen.
709   vax-dec-* )
710     machine=vax
711     case "${configuration}" in
712       *-bsd4.1 )                                        opsys=bsd4-1 ;;
713       *-bsd4.2 | *-ultrix[0-3].* | *-ultrix4.0 )        opsys=bsd4-2 ;;
714       *-bsd4.3 | *-ultrix* )                            opsys=bsd4-3 ;;
715       *-sysv[01]* | *-sysvr[01]* )                      opsys=usg5-0 ;;
716       *-sysv2* | *-sysvr2* )                            opsys=usg5-2 ;;
717       *-vms* )                                          opsys=vms ;;
718       * )                                               unported=true
719     esac
720   ;;
722   ## Whitechapel MG1
723   ns16k-whitechapel-* )
724     machine=mg1
725     ## We don't know what sort of OS runs on these; we'll let the
726     ## operating system guessing code below try.
727   ;;
729   ## Wicat
730   m68*-wicat-sysv* )
731     machine=wicat opsys=usg5-2
732   ;;
734   * )
735     unported=true
736   ;;
737 esac
739 ### If the code above didn't choose an operating system, just choose
740 ### an operating system based on the configuration name.  You really
741 ### only want to use this when you have no idea what the right
742 ### operating system is; if you know what operating systems a machine
743 ### runs, it's cleaner to make it explicit in the case statement
744 ### above.
745 if [ ! "${opsys}" ]; then
746   case "${configuration}" in
747     *-bsd4.[01] )       opsys=bsd4-1 ;;
748     *-bsd4.2 )          opsys=bsd4-2 ;;
749     *-bsd4.3 )          opsys=bsd4-3 ;;
750     *-sysv0 | *-sysvr0 )                opsys=usg5-0 ;;
751     *-sysv2 | *-sysvr2 )                opsys=usg5-2 ;;
752     *-sysv2.2 | *-sysvr2.2 )            opsys=usg5-2-2 ;;
753     *-sysv3 | *-sysvr3 )                opsys=usg5-3 ;;
754     *-sysv4 | *-sysvr4 )                opsys=usg5-4 ;;
755     * )
756       unported=true
757     ;;
758   esac
761 if $unported ; then
762   (echo "${progname}: Emacs hasn't been ported to \`${configuration}' systems."
763    echo "${progname}: Check \`etc/MACHINES' for recognized configuration names."
764   ) >&2
765   exit 1
768 machfile="m/${machine}.h"
769 opsysfile="s/${opsys}.h"
772 #### Choose a window system.
773 echo "Checking window system."
774 window_system=''
775 case "${with_x}" in
776   yes )
777     window_system=${window_system}x11
778   ;;
779   no )
780     window_system=${window_system}none
781 esac
782 case "${with_x11}" in
783   yes )
784     window_system=${window_system}x11
785   ;;
786 esac
787 case "${with_x10}" in
788   yes )
789     window_system=${window_system}x10
790   ;;
791 esac
793 case "${window_system}" in
794   "none" | "x11" | "x10" ) ;;
795   "" )
796     echo "  No window system specifed.  Looking for X Windows."
797     window_system=none
798     if [ -r /usr/lib/libX11.a \
799          -o -d /usr/include/X11 \
800          -o -d /usr/X386/include ]; then
801       window_system=x11
802     fi
803   ;;
804   * )
805     echo "Don\'t specify the window system more than once." >&2
806     exit 1
807   ;;
808 esac
810 case "${window_system}" in
811   x11 )
812     HAVE_X_WINDOWS=yes
813     HAVE_X11=yes
814     echo "  Using X11."
815   ;;
816   x10 )
817     HAVE_X_WINDOWS=yes
818     HAVE_X11=no
819     echo "  Using X10."
820   ;;
821   none )
822     HAVE_X_WINDOWS=no
823     HAVE_X11=no
824     echo "  Using no window system."
825   ;;
826 esac
828 ### If we're using X11, we should use the X menu package.
829 HAVE_X_MENU=no
830 case ${HAVE_X11} in
831   yes )
832     HAVE_X_MENU=yes
833   ;;
834 esac
836 ### Check for XFree386.  It needs special hacks.
837 case ${window_system} in
838   x11 )
839     if [ -d /usr/X386/include ]; then
840       HAVE_XFREE386=yes
841       if [ "${C_SWITCH_X_SITE}" = "" ]; then
842         C_SWITCH_X_SITE="-I/usr/X386/include"
843       fi
844     fi
845   ;;
846 esac
848 #### Choose a compiler.
849 echo "Checking compilers."
850 if [ "${with_gcc}" = "" ]; then
851   echo "  Searching load path for GCC."
852   temppath=`echo $PATH | sed 's/^:/.:/
853                               s/::/:.:/g
854                               s/:$/:./
855                               s/:/ /g'`
856   default_cc=`(
857     for dir in ${temppath}; do
858       if [ -f ${dir}/gcc ]; then echo gcc; exit 0; fi
859     done
860     echo cc
861   )`
862 else
863   case ${with_gcc} in
864     "yes" ) default_cc="gcc" ;;
865     "no"  ) default_cc="cc"  ;;
866   esac
869 case "${default_cc}" in
870   "gcc" )
871     echo "  Using GCC."
872     default_cflags='-g -O'
873   ;;
874   * )
875     echo "  Using the system's CC."
876     default_cflags='-g'
877   ;;
878 esac
881 #### Does this compiler support the `const' keyword?
882 #### The code for this test was adapted from autoconf's test.
883 echo "Checking if the compiler supports \`const'."
884 rm -f conftest*
885 compile='${default_cc} conftest.c -o conftest >/dev/null 2>&1'
886 echo "
887 main() { exit(0); } t() {
888 /* Ultrix mips cc rejects this.  */
889 typedef int charset[2]; const charset x;
890 /* SunOS 4.1.1 cc rejects this. */
891 char const *const *p;
892 char **p2;
893 /* AIX 3.2 cc rejects this.  */
894 p += p ? p-p : 0;
895 /* HPUX 7.0 cc rejects these. */
896 ++p;
897 p2 = (char const* const*) p;
898  }" > conftest.c
899 if eval $compile; then
900   echo "  It seems to."
901   HAVE_CONST=yes
902 else
903   echo "  It doesn't seem to."
904   HAVE_CONST=no
906 rm -f conftest*
908 #### What is the return type of a signal handler?
910 ### We run /usr/include/signal.h through cpp and grep for the
911 ### declaration of the signal function.  Yuck.
912 echo "Looking for return type of signal handler functions."
913 signal_h_file=''
914 if [ -r /usr/include/signal.h ]; then
915   signal_h_file=/usr/include/signal.h
916 elif [ -r /usr/include/sys/signal.h ]; then
917   signal_h_file=/usr/include/sys/signal.h
919 SIGTYPE=void
920 if [ "${signal_h_file}" ]; then
921   sigpattern='[         ]*([    ]*\*[   ]*signal[       ]*('
923   ## We make a copy whose name ends in .c, so the compiler
924   ## won't complain about having only been given a .h file.
925   tempcname="configure.tmp.$$.c"
926   cp ${signal_h_file}  ${tempcname}
927   if ${default_cc} -E ${tempcname} | grep "int${sigpattern}" > /dev/null; then
928     SIGTYPE=int
929   fi
930   rm -f ${tempcname}
932 echo "  Guessing that signals return \`${SIGTYPE}'."
935 #### Extract some information from the operating system and machine files.
937 echo "Examining the machine- and system-dependent files to find out"
938 echo " - which libraries the lib-src programs will want, and"
939 echo " - whether the GNU malloc routines are usable."
940 tempcname="configure.tmp.$$.c"
941 echo '
942 #include "'${srcdir}'/src/'${opsysfile}'"
943 #include "'${srcdir}'/src/'${machfile}'"
944 #ifndef LIBS_MACHINE
945 #define LIBS_MACHINE
946 #endif
947 #ifndef LIBS_SYSTEM
948 #define LIBS_SYSTEM
949 #endif
950 #ifndef C_SWITCH_SYSTEM
951 #define C_SWITCH_SYSTEM
952 #endif
953 @configure@ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
954 @configure@ c_switch_system=C_SWITCH_SYSTEM
955 #ifdef SYSTEM_MALLOC
956 @configure@ system_malloc=yes
957 #else
958 @configure@ system_malloc=no
959 #endif
960 ' > ${tempcname}
961 eval `${default_cc} -E ${tempcname} \
962        | grep '@configure@' \
963        | sed -e 's/^@configure@ \([^=]*=\)\(.*\)$/\1"\2"/'`
964 rm ${tempcname}
966 # Do the opsystem or machine files prohibit the use of the GNU malloc?
967 # Assume not, until told otherwise.
968 GNU_MALLOC=yes
969 if [ "${system_malloc}" = "yes" ]; then
970   GNU_MALLOC=no
971   GNU_MALLOC_reason="
972   (The GNU allocators don't work with this system configuration.)"
975 if [ ! "${REL_ALLOC}" ]; then
976   REL_ALLOC=${GNU_MALLOC}
979 LISP_FLOAT_TYPE=yes
982 #### Find out which version of Emacs this is.
983 version=`grep 'defconst[         ]*emacs-version' ${srcdir}/lisp/version.el \
984          | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'`
985 if [ ! "${version}" ]; then
986   echo "${progname}: can't find current emacs version in
987         \`${srcdir}/lisp/version.el'." >&2
988   exit 1
992 #### Make the proper settings in `src/config.h'.
993 rm -f config.status
994 set -e
996 echo "Making \`./src/config.h' from \`${srcdir}/src/config.h.in'."
997 sed_flags="-e 's:@machine@:${machfile}:' -e 's:@opsystem@:${opsysfile}:'"
999 for flag in ${config_h_opts}; do
1000   val=`eval echo '$'${flag}`
1001   case ${val} in
1002     no | "")
1003       f="-e 's:.*#define ${flag}.*:/\\* #define ${flag} \\*/:'"
1004     ;;
1005     yes)
1006       f="-e 's:.*#define ${flag}.*:#define ${flag}:'"
1007     ;;
1008     *)
1009       f="-e 's:.*#define ${flag}.*:#define ${flag} ${val}:'"
1010     ;;
1011   esac
1012   sed_flags="${sed_flags} ${f}"
1013 done
1015 rm -f ./src/config.h.tmp
1016 (echo "/* This file is generated by \`${progname}' from"
1017  echo "   \`${srcdir}/src/config.h.in'."
1018  echo "   If you are thinking about editing it, you should seriously consider"
1019  echo "   running \`${progname} instead, or editing"
1020  echo "   \`${srcdir}/src/config.h.in' itself." 
1021  eval '/bin/sed '${sed_flags}' < "${srcdir}/src/config.h.in"'
1022 ) > src/config.h.tmp
1023 ${srcdir}/move-if-change src/config.h.tmp src/config.h
1024 ### Remind people not to edit this.
1025 chmod -w src/config.h
1028 #### Modify the parameters in the top-level Makefile.
1029 echo "Producing \`Makefile' from \`${srcdir}/Makefile.in'."
1030 rm -f Makefile.tmp
1031 (echo "\
1032 # This file is generated by \`${progname}' from
1033 # \`${srcdir}/Makefile.in'.
1034 # If you are thinking about editing it, you should seriously consider
1035 # running \`${progname}' instead, or editing
1036 # \`${srcdir}/Makefile.in' itself."
1037  /bin/sed < ${srcdir}/Makefile.in                                       \
1038  -e 's|^configname *=.*$|configname='"${configuration}"'|'              \
1039  -e 's|^version *=.*$|version='"${version}"'|'                          \
1040  -e 's|^srcdir *=.*$|srcdir='"${srcdir}"'|'                             \
1041  -e 's|^CC *=.*$|CC='"${default_cc}"'|'                                 \
1042  -e 's|^CONFIG_CFLAGS *=.*$|CONFIG_CFLAGS='"${default_cflags}"'|'       \
1043  -e 's|^C_SWITCH_SYSTEM *=.*$|C_SWITCH_SYSTEM='"${c_switch_system}"'|'  \
1044  -e 's|^LOADLIBES *=.*$|LOADLIBES='"${libsrc_libs}"'|'                  \
1045  -e '/^# DIST: /d') > Makefile.tmp
1046 ${srcdir}/move-if-change Makefile.tmp Makefile
1048 ### I'm commenting out this section until I bring the `build-install' script
1049 ### into line with the rest of the configuration stuff.
1051 ### # Modify the parameters in the `build-install' script.
1052 ### echo "Producing \`./build-install' from \`${srcdir}/build-install.in'."
1053 ### rm -f ./build-install.tmp
1054 ### (echo "\
1055 ### # This file is generated by \`${progname}' from \`${srcdir}/build-install.in'.
1056 ### # If you are thinking about editing it, you should seriously consider
1057 ### # editing \`./build-install.in' itself, or running \`${progname}' instead."
1058 ###  /bin/sed < ${srcdir}/build-install.in                      \
1059 ###  -e 's;^\(prefix=\).*$;\1'"${prefix};"                      \
1060 ###  -e 's;^\(bindir=\).*$;\1'"${bindir};"                      \
1061 ###  -e 's;^\(lisppath=\).*$;\1'"${lisppath};"          \
1062 ###  -e 's;^\(datadir=\).*$;\1'"${datadir};"            \
1063 ###  -e 's;^\(lockdir=\).*$;\1'"${lockdir};"            \
1064 ###  -e 's;^\(libdir=\).*$;\1'"${libdir};") > ./build-install.tmp
1065 ### ${srcdir}/move-if-change build-install.tmp build-install
1066 ### # Remind people not to edit this.
1067 ### chmod -w build-install
1068 ### chmod +x build-install
1071 #### Describe the results.
1073 ### Create a verbal description of what we have done.
1075 message="Configured for \`${configuration}'.
1077   What operating system and machine description files should Emacs use?
1078         \`${opsysfile}' and \`${machfile}'
1079   Should Emacs use the GNU version of malloc?             ${GNU_MALLOC}${GNU_MALLOC_reason}
1080   Should Emacs use the relocating allocator for buffers?  ${REL_ALLOC}
1081   What window system should Emacs use?                    ${window_system}
1082   What compiler should emacs be built with?               ${default_cc}
1083   Should the compilation use \`-g' and/or \`-O'?            ${default_cflags-neither}${x_includes+
1084   Where do we find X Windows header files?                }${x_includes}${x_libraries+
1085   Where do we find X Windows libraries?                   }${x_libraries}"
1087 ### Write config.status, documenting the damage we have done.
1089 (echo "\
1090 #!/bin/sh
1091 ### This file is generated by \`${progname}.'
1092 ### If you are thinking about editing it, you should seriously consider
1093 ### running \`${progname}' instead.
1095  echo "${message}" | sed -e 's/^/# /'
1096  echo "exec '${progname}' ${arguments} "'$@') > config.status
1098 ### Remind people not to edit this.
1099 chmod -w config.status
1100 chmod +x config.status
1102 ### Print the description.
1103 echo
1104 echo "${message}"
1106 exit 0