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
27 ### Usage: configure config_name
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.
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,
40 ### move-if-change thinks they're different when they're not.
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:^\./::'`"
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.
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 --srcdir=DIR option specifies that the configuration and build
68 processes should look for the Emacs source code in DIR, when
69 DIR is not the current directory. This option doesn't work yet.
71 If successful, ${progname} leaves its status in config.status. If
72 unsuccessful after disturbing the status quo, it removes config.status."
75 #### Option processing.
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
81 HAVE_X_WINDOWS HAVE_X11 HAVE_X_MENU \
82 SIGTYPE GNU_MALLOC REL_ALLOC LISP_FLOAT_TYPE "
84 ### Record all the arguments, so we can save them in config.status.
91 ## Anything starting with a hyphen we assume is an option.
94 ## Separate the switch name from the value it's being given.
97 opt=`echo ${arg} | sed 's:^-*\([^=]*\)=.*$:\1:'`
98 val=`echo ${arg} | sed 's:^-*[^=]*=\(.*\)$:\1:'`
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.
105 opt=`echo ${arg} | sed 's:^-*\(.*\)$:\1:'`
111 ## Change `-' in the option name to `_'.
112 opt="`echo ${opt} | tr - _`"
114 ## Process the option.
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".
121 y | ye | yes ) val=yes ;;
124 (echo "${progname}: the \`--${opt}' option is supposed to have a boolean value.
125 Set it to either \`yes' or \`no'."
126 echo "${short_usage}") >&2
130 eval "${opt}=\"${val}\""
133 ## Has the user specified a source directory?
135 ## If the value was omitted, get it from the next argument.
136 if [ "${valomitted}" = "yes" ]; then
137 ## Get the next argument from the argument list, if there is one.
139 (echo "${progname}: You must give a value for the \`--${opt}' option, as in
141 echo "${short_usage}") >&2
148 echo "${progname}: Beware - the \`--srcdir' option doesn't work yet." >&2
151 ## Has the user asked for some help?
153 echo "${long_usage}" | more
157 ## We ignore all other options silently.
161 ## Anything not starting with a hyphen we assume is a
162 ## configuration name.
171 if [ "${configuration}" = "" ]; then
172 (echo "${progname}: You must specify a configuration name as an argument."
173 echo "${short_usage}") >&2
178 #### Decide where the source is.
181 ## If it's not specified, see if `.' or `..' might work.
183 if [ -f "./src/lisp.h" -a -f "./lisp/version.el" ]; then
186 if [ -f "../src/lisp.h" -a -f "../lisp/version.el" ]; then
187 srcdir=`(cd .. ; pwd)`
190 ${progname}: Neither the current directory nor its parent seem to
191 contain the Emacs sources. If you do not want to build Emacs in its
192 source tree, you should run \`${progname}' in the directory in which
193 you wish to build Emacs, using its \`--srcdir' option to say where the
194 sources may be found."
195 echo "${short_usage}") >&2
201 ## Otherwise, check if the directory they specified is okay.
203 if [ ! -d "${srcdir}" -o ! -f "${srcdir}/src/lisp.h" -o ! -f "${srcdir}/lisp/version.el" ]; then
205 ${progname}: The directory specified with the \`--srcdir' option,
206 \`${srcdir}', doesn't seem to contain the Emacs sources. You should
207 either run the \`${progname}' script at the top of the Emacs source
208 tree, or use the \`--srcdir' option to specify where the Emacs sources
210 echo "${short_usage}") >&2
217 ### Make the necessary directories, if they don't exist.
218 if [ ! -d ./src ]; then
221 if [ ! -d ./lib-src ]; then
224 if [ ! -d ./cpp ]; then
227 if [ ! -d ./oldXMenu ]; then
232 #### Given the configuration name, set machfile and opsysfile to the
233 #### names of the m/*.h and s/*.h files we should use.
235 ### Canonicalize the configuration name.
236 echo "Checking the configuration name."
237 if configuration=`${srcdir}/config.sub "${configuration}"` ; then : ; else
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.
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.
255 machine='' opsys='' unported='false'
256 case "${configuration}" in
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.
265 machine=alliant4 opsys=bsd4-2
268 machine=alliant-2800 opsys=bsd4-3
273 machine=altos opsys=usg5-2
278 machine=amdahl opsys=usg5-2-2
281 ## Appallings - I mean, Apollos - running Domain
283 machine=apollo opsysfile=bsd4-2.h
286 ## AT&T 3b2, 3b5, 3b15, 3b20
288 machine=att3b opsys=usg5-2-2
291 ## AT&T 3b1 - The Mighty Unix PC!
293 machine=7300 opsys=usg5-2-2
298 machine=sps7 opsys=usg5-2
301 ## CCI 5/32, 6/32 -- see "Tahoe".
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
307 celerity-celerity-bsd* )
308 machine=celerity opsys=bsd4-2
312 ## What operating systems does this chip run that Emacs has been
316 ## We'll use the catch-all code at the bottom to guess the
322 machine=convex opsys=bsd4-3
327 machine=intel386 opsys=usg5-3
331 cydra*-cydrome-sysv* )
332 machine=cydra5 opsys=usg5-3
336 mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0 | mips-dec-bsd4.2 )
337 machine=pmax opsys=bsd4-2
339 mips-dec-ultrix* | mips-dec-bsd* )
340 machine=pmax opsys=bsd4-3
343 machine=pmax opsys=osf1
346 ## Motorola Delta machines
347 m68*-motorola-sysv* )
348 machine=delta opsys=usg5-3
350 m88k-motorola-sysv* | m88k-motorola-m88kbcs* )
351 machine=delta88k opsys=usg5-3
356 machine=dual opsys=usg5-2
359 machine=dual opsys=unipl5-2
364 machine=elxsi opsys=usg5-2
369 machine=ns16000 opsys=umax
372 ## The GEC 93 - apparently, this port isn't really finished yet.
374 ## Gould Power Node and NP1
376 machine=gould opsys=bsd4-2
379 machine=gould opsys=bsd4-3
382 machine=gould-np1 opsys=bsd4-3
386 xps*-honeywell-sysv* )
387 machine=xps100 opsys=usg5-2
390 ## HP 9000 series 200 or 300
392 machine=hp9000s300 opsys=bsd4-3
394 ## HP/UX 8 doesn't run on these machines, so use HP/UX 7.
396 machine=hp9000s300 opsys=hpux
399 ## HP 9000 series 800, running HP/UX
401 machine=hp9000s800 opsys=hpux
406 machine=orion opsys=bsd4-2
409 machine=orion105 opsys=bsd4-2
414 machine=ibmps2-aix opsys=usg5-2-2
417 machine=ibmps2-aix opsys=usg5-3
420 machine=ibmrs6000 opsys=aix3-1
423 machine=ibmrt opsys=bsd4-2
426 machine=ibmrt-aix opsys=usg5-2-2
429 ## Integrated Solutions `Optimum V'
431 machine=isi-ov opsys=bsd4-2
434 machine=isi-ov opsys=bsd4-3
437 ## Intel 386 machines where we do care about the manufacturer
438 i[34]86-intsys-sysv* )
439 machine=is386 opsys=usg5-2-2
441 ## Intel 386 machines where we don't care about the manufacturer
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.
453 ## Silicon Graphics machines
454 ## Iris 2500 and Iris 2500 Turbo (aka the Iris 3030)
456 machine=irist opsys=iris3-5
458 m68*-sgi-iris3.6 | m68*-sgi-iris*)
459 machine=irist opsys=iris3-6
463 machine=iris4d opsys=irix3-3
465 mips-sgi-irix4.* | mips-sgi-irix* )
466 machine=iris4d opsys=irix4-0
471 machine=masscomp opsys=rtu
476 machine=mega68 opsys=bsd4-2
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.
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.
491 machine=mips4 opsys=usg5-2-2
494 machine=mips opsys=bsd4-3
497 machine=mips opsys=usg5-2-2
500 ## The complete machine from National Semiconductor
502 machine=ns32000 opsys=usg5-2
507 machine=tower32 opsys=usg5-2-2
510 machine=tower32v3 opsys=usg5-3
515 machine=targon31 opsys=usg5-2-2
520 machine=nu opsys=usg5-2
525 machine=plexus opsys=usg5-2
530 machine=i386 opsys=usg5-3
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
541 ns32k-sequent-bsd4.2 )
542 machine=sequent opsys=bsd4-2
544 ns32k-sequent-bsd4.3 )
545 machine=sequent opsys=bsd4-3
549 machine=symmetry opsys=bsd4-3
554 machine=news opsys=bsd4-2
557 machine=news opsys=bsd4-3
560 machine=news-risc opsys=bsd4-3
565 machine=stride opsys=usg5-2
569 *-sun-sunos* | *-sun-bsd* )
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 ;;
578 case "${configuration}" in
579 *-sunos4.0* ) opsys=sunos4-0 ;;
580 *-sunos4* | *-sunos ) opsys=sunos4-1 ;;
587 machine=tad68k opsys=usg5-3
592 machine=tahoe opsys=bsd4-2
595 machine=tahoe opsys=bsd4-3
598 ## Tandem Integrity S2
600 machine=tandem-s2 opsys=usg5-3
603 ## Tektronix 16000 box (6130?)
604 ns16k-tektronix-bsd* )
605 machine=ns16000 opsys=bsd4-2
608 ## src/m/tek4300.h hints that this is a m68k machine.
609 m68*-tektronix-bsd* )
610 machine=tex4300 opsys=bsd4-3
614 ## We seem to have lost the machine-description file titan.h!
616 machine=titan opsys=usg5-3
619 ## Ustation E30 (SS5E)
620 m68*-unisys-uniplus* )
621 machine=ustation opsystem=unipl5-2
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 ;;
639 ns16k-whitechapel-* )
641 ## We don't know what sort of OS runs on these; we'll let the
642 ## operating system guessing code below try.
647 machine=wicat opsys=usg5-2
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
661 if [ ! "${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 ;;
678 (echo "${progname}: Emacs hasn't been ported to \`${configuration}' systems."
679 echo "${progname}: Check \`etc/MACHINES' for recognized configuration names."
684 machfile="m/${machine}.h"
685 opsysfile="s/${opsys}.h"
688 #### Choose a window system.
689 echo "Checking window system."
693 window_system=${window_system}x11
696 window_system=${window_system}none
698 case "${with_x11}" in
700 window_system=${window_system}x11
703 case "${with_x10}" in
705 window_system=${window_system}x10
709 case "${window_system}" in
710 "none" | "x11" | "x10" ) ;;
712 echo " No window system specifed. Looking for X Windows."
714 if [ -r /usr/lib/libX11.a -o -d /usr/include/X11 ]; then
719 echo "Don\'t specify the window system more than once." >&2
724 case "${window_system}" in
738 echo " Using no window system."
742 ### If we're using X11, we should use the X menu package.
751 #### Choose a compiler.
752 echo "Checking for GCC."
753 temppath=`echo $PATH | sed 's/^:/.:/
758 for dir in ${temppath}; do
759 if [ -f ${dir}/gcc ]; then echo gcc; exit 0; fi
764 case "${default_cc}" in
767 default_cflags='-g -O'
770 echo " Using the system's CC."
776 #### What is the return type of a signal handler?
778 ### We run /usr/include/signal.h through cpp and grep for the
779 ### declaration of the signal function. Yuck.
780 echo "Looking for return type of signal handler functions."
782 if [ -r /usr/include/signal.h ]; then
783 signal_h_file=/usr/include/signal.h
784 elif [ -r /usr/include/sys/signal.h ]; then
785 signal_h_file=/usr/include/sys/signal.h
788 if [ "${signal_h_file}" ]; then
789 sigpattern='[ ]*([ ]*\*[ ]*signal[ ]*('
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.
793 tempcname="configure.tmp.$$.c"
794 cp ${signal_h_file} ${tempcname}
795 if ${default_cc} -E ${tempcname} | grep "int${sigpattern}" > /dev/null; then
800 echo " Guessing that signals return \`${SIGTYPE}'."
803 #### Extract some information from the operating system and machine files.
805 echo "Examining the machine- and system-dependent files to find out"
806 echo " - which libraries the lib-src programs will want, and"
807 echo " - whether the GNU malloc routines are usable."
808 tempcname="configure.tmp.$$.c"
810 #include "'${srcdir}'/src/'${opsysfile}'"
811 #include "'${srcdir}'/src/'${machfile}'"
818 @configure@ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
820 @configure@ system_malloc=yes
822 @configure@ system_malloc=no
825 eval `${default_cc} -E ${tempcname} \
826 | grep '@configure@' \
827 | sed -e 's/^@configure@//'`
830 # Do the opsystem or machine files prohibit the use of the GNU malloc?
831 # Assume not, until told otherwise.
833 if [ "${system_malloc}" = "yes" ]; then
836 (The GNU allocators don't work with this system configuration.)"
839 if [ ! "${REL_ALLOC}" ]; then
840 REL_ALLOC=${GNU_MALLOC}
846 #### Find out which version of Emacs this is.
847 version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \
848 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'`
849 if [ ! "${version}" ]; then
850 echo "${progname}: can't find current emacs version in
851 \`${srcdir}/lisp/version.el'." >&2
856 #### Make the proper settings in `src/config.h'.
860 echo "Making \`./src/config.h' from \`${srcdir}/src/config.h.in'."
861 sed_flags="-e 's:@machine@:${machfile}:' -e 's:@opsystem@:${opsysfile}:'"
863 for flag in ${config_h_opts}; do
864 val=`eval echo '$'${flag}`
867 f="-e 's:.*#define ${flag}.*:/\\* #define ${flag} \\*/:'"
870 f="-e 's:.*#define ${flag}.*:#define ${flag}:'"
873 f="-e 's:.*#define ${flag}.*:#define ${flag} ${val}:'"
876 sed_flags="${sed_flags} ${f}"
879 rm -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"'
887 ${srcdir}/move-if-change src/config.h.tmp src/config.h
888 ### Remind people not to edit this.
889 chmod -w src/config.h
892 #### Modify the parameters in the top-level Makefile.
893 echo "Producing \`Makefile' from \`${srcdir}/Makefile.in'."
896 # This file is generated by \`${progname}' from
897 # \`${srcdir}/Makefile.in'.
898 # If you are thinking about editing it, you should seriously consider
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
911 ### I'm commenting out this section until I bring the `build-install' script
912 ### into line with the rest of the configuration stuff.
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
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
928 ### ${srcdir}/move-if-change build-install.tmp build-install
929 ### # Remind people not to edit this.
930 ### chmod -w build-install
931 ### chmod +x build-install
934 #### Describe the results.
936 ### Create a verbal description of what we have done.
937 message="Configured for \`${configuration}'.
939 What operating system and machine description files should Emacs use?
940 \`${opsysfile}' and \`${machfile}'
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}
943 What window system should Emacs use? ${window_system}
944 What compiler should emacs be built with? ${default_cc}
945 Should the compilation use \`-g' and/or \`-O'? ${default_cflags- neither}"
947 ### Write config.status, documenting the damage we have done.
951 ### This file is generated by \`${progname}.'
952 ### If you are thinking about editing it, you should seriously consider
953 ### running \`${progname}' instead.
955 echo "${message}" | sed -e 's/^/# /'
956 echo "exec '${progname}' ${arguments} "'$@') > config.status
958 ### Remind people not to edit this.
959 chmod -w config.status
960 chmod +x config.status
962 ### Print the description.