2 # Configuration script for GNU Emacs
3 # Copyright (C) 1992 Free Software Foundation, Inc.
5 #This file is part of GNU Emacs.
7 #GNU Emacs is free software; you can redistribute it and/or modify
8 #it under the terms of the GNU General Public License as published by
9 #the Free Software Foundation; either version 1, or (at your option)
12 #GNU Emacs is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 #GNU General Public License for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with GNU Emacs; see the file COPYING. If not, write to
19 #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 # Shell script to edit files and make symlinks in preparation for
24 # Usage: configure machine
26 # If configure succeeds, it leaves its status in config.status.
27 # If configure fails after disturbing the status quo,
28 # config.status is removed.
33 short_usage
="Type \`${progname} -usage' for more information about options."
35 usage_message
="Usage: ${progname} MACHINENAME [-OPTION[=VALUE] ...]
36 Set compilation and installation parameters for GNU Emacs, and report.
37 MACHINENAME is the machine to build for. See \`etc/MACHINES'.
39 -opsystem=SYSTEM - operating system to build for; see \`etc/MACHINES'.
40 -libroot=DIR - where to install Emacs's library files
41 These options have reasonable defaults (in []s), and may not be needed:
42 -g, -O - Passed to the compiler. If omitted, use -O only.
43 -cc=COMPILER - Which compiler to use. Defaults to gcc if available.
44 -libdir=DIR - where to look for arch-dependent library files
45 -datadir=DIR - where to look for architecture-independent library files
46 -installbin=DIR - where to install the Emacs executable, and some friends
47 -lisppath=PATH - colon-separated list of Elisp directories
48 -lockdir=DIR - where Emacs should do its file-locking stuff
49 -window_system=none or [x11, if it is installed] - what window system to use
50 -have_x_menu=yes or [no] - include menu support under X11
51 -gnu_malloc=[yes] or no - use the GNU memory allocator
52 -rel_alloc=[yes] or no - use compacting allocator for buffers
53 -highpri=N - run at N points higher-than-normal priority
54 -lisp_float_type=[yes] or no - Support floating point in Elisp
55 If successful, ${progname} leaves its status in config.status. If
56 unsuccessful after disturbing the status quo, config.status is removed."
58 if [ ! -r .
/src
/lisp.h
]; then
59 echo "${progname}: Can't find Emacs sources in \`./src'.
60 Run this config script in the top directory of the Emacs source tree." 1>&2
68 libroot:datadir:libdir:installbin:lisppath:lockdir:\
69 gnu_malloc:rel_alloc:highpri:lisp_float_type:\
70 window_system:have_x_menu:\
75 gnu_malloc:rel_alloc:lisp_float_type:have_x_menu:\
79 highpri:gnu_malloc:rel_alloc:lisp_float_type:\
80 have_x_windows:have_x11:have_x_menu:\
81 c_switch_site:sigtype:\
85 installbin
=/usr
/local
/bin
89 # The default values for the following options are guessed at after other
90 # options have been checked and given values, so we set them to null here.
98 # This must be the only option on the line, and it can't be abbreviated.
99 # This keeps it from interfering with the other, documented options.
100 if [ "$*" = "+distribute" ]; then
101 libroot
=/usr
/local
/lib
/emacs
107 echo "Examining options..."
111 # Separate the switch name from the value it's being given.
114 opt
=`echo ${arg} | sed 's:^-\([^=]*\)=.*$:\1:'`
115 val
=`echo ${arg} | sed 's:^-[^=]*=\(.*\)$:\1:'`
119 # If FOO is a boolean argument, -FOO is equivalent to -FOO=yes.
120 opt
=`echo ${arg} | sed 's:^-\(.*\)$:\1:'`
126 # Make sure the argument is valid and unambiguous.
128 *:${opt}:* ) # Exact match.
131 *:${opt}*:${opt}*:* ) # Ambiguous prefix.
132 echo "\`-${opt}' is an ambiguous switch; it could be any of the following:"
133 echo `echo ${options} | tr ':' '\012' | grep '^'${opt}`
137 *:${opt}*:* ) # Unambigous prefix.
138 optvar
=`echo ${options} | sed 's/^.*:\('${opt}'[^:]*\):.*$/\1/'`
141 (echo "\`-${opt}' is not a valid option."
142 echo "${short_usage}") |
more
149 echo "${usage_message}" |
more
154 # If the variable is supposed to be boolean, make sure the value
155 # given is either "yes" or "no". If not, make sure some value
157 case "${boolean_opts}" in
160 y | ye |
yes ) val
=yes ;;
163 echo "The \`-${optvar}' option (\`-${opt}') is supposed to have a boolean
164 value - set it to either \`yes' or \`no'." 1>&2
170 if [ "${valomitted}" = "yes" ]; then
171 (echo "${progname}: You must give a value for the \`-${opt}' option, as in
173 echo "${short_usage}") |
more
179 eval "${optvar}=\"${val}\""
187 if [ "${machine}" = "" ]; then
188 (echo "You must specify a machine name as an argument to ${progname}."
189 echo "${short_usage}") |
more
193 echo "Checking machine..."
194 machfile
="m/${machine}.h"
195 if [ ! -r src
/${machfile} ]; then
196 echo "${progname}: Emacs has no configuration info for the machine called
197 \`${machine}'. Look at etc/MACHINES for the names of machines
198 that Emacs has been ported to." 1>&2
202 echo "Checking operating system..."
203 if [ "${opsystem}" = "" ]; then
205 echo " No operating system explicitly specified."
206 echo " Guessing, based on machine..."
207 # Get the default operating system to go with the specified machine.
208 opsystem
=`grep 'USUAL-OPSYS="' src/${machfile} \
209 | sed 's/^.*USUAL-OPSYS="\([^"]*\)".*$/\1/'`
211 if [ "${opsystem}" = "" ]; then
212 echo "${progname}: Emacs's configuration files don't suggest what operating
213 system a \`${machine}' machine might run. Try specifying the
214 operating system explicitly by passing ${progname} an
215 \`-opsystem=SYSTEM-NAME' flag. Look at etc/MACHINES for the
216 names of operating systems that Emacs has been ported to." 1>&2
220 if [ "${opsystem}" = "note" ]; then
221 echo "The \`${machine}' machine can be used with more than one operating
222 system, and Emacs's configuration info isn't clever enough to figure
223 out which one you're running. Run ${progname} with -machine and
224 -opsystem arguments as specified below for the appropriate system.
225 (This information comes from the file \`etc/MACHINES' - see that
226 file for more detail.)
229 sed < src
/${machfile} -e '1,/NOTE-START/d' -e '/NOTE-END/,$d' |
more
234 opsysfile
="s/${opsystem}.h"
235 if [ ! -r src
/${opsysfile} ]; then
236 echo "${progname}: Emacs's configuration files say that the default
237 operating system for the machine \`${machine}' is \`${opsystem}',
238 but there is no configuration file for \`${opsystem}', so Emacs's
239 default info is screwed up. Try specifying the operating system
240 explicitly by passing ${progname} an \`-opsystem=SYSTEM-NAME' flag." 1>&2
244 opsysfile
="s/${opsystem}.h"
245 if [ ! -r src
/${opsysfile} ]; then
246 echo "${progname}: Emacs has no configuration info for the operating system
247 \`${opsystem}'. Look at etc/MACHINES for the names of operating
248 systems that Emacs has been ported to." 1>&2
253 if [ "${libroot}" = "" ]; then
254 echo "Guessing library directory..."
258 echo "Checking window system..."
259 window_system
="`echo ${window_system} | tr A-Z a-z`"
260 case "${window_system}" in
261 "none" |
"x11" |
"x10" ) ;;
262 "x" ) window_system
=x11
;;
264 echo " No window system specifed. Looking for X Windows."
266 if [ -r /usr
/lib
/libX11.a
-a -d /usr
/include
/X11
]; then
271 echo "The \`-window_system' option must be set to \`none' or \`X11'." 1>&2
276 case "${window_system}" in
291 # What is the return type of a signal handler? We grep
292 # /usr/include/signal.h for the declaration of the signal function.
294 echo "Looking for return type of signal handler functions..."
295 if [ -r /usr
/include
/signal.h
]; then
296 sigpattern
='[ ]*([ ]*\*[ ]*signal[ ]*('
298 if grep -s "int${sigpattern}" /usr
/include
/signal.h
; then
304 # Do the opsystem or machine files prohibit the use of the GNU malloc?
305 echo "Checking to see if the GNU malloc routines are permissible..."
306 if (cd .
/src
;grep SYSTEM_MALLOC
${opsysfile} ${machfile} > /dev
/null
); then
309 (The GNU allocators don't work with this machine and/or operating system.)"
312 rel_alloc
=${gnu_malloc}
314 if [ "${have_x_menu}" = "" ]; then
318 if [ "${lisppath}" = "" ]; then
319 lisppath
=${libroot}/local-lisp
:${libroot}/lisp
322 if [ "${datadir}" = "" ]; then
323 datadir
=${libroot}/etc
326 if [ "${libdir}" = "" ]; then
327 libdir
=${libroot}/arch-lib
330 if [ "${lockdir}" = "" ]; then
331 lockdir
=${libroot}/lock
334 echo "Checking for GCC..."
337 temppath
=`echo $PATH | sed 's/^:/.:/
342 for dir in ${temppath}; do
343 if [ -f ${dir}/gcc ]; then echo gcc; exit 0; fi
350 case "${O},${g},${cc}" in
351 ,,gcc
) O
=yes; g
=yes ;;
355 echo "Guessing which libraries the lib-src programs will want,"
356 echo " based on the machine- and system-dependent files..."
357 echo '#include "src/'${machfile}'"
358 #include "src/'${opsysfile}'"
365 libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
367 eval `${cc} -E config-tmp-$$.c | grep 'libsrc_libs='`
373 # Make the proper settings in the config file.
374 echo "Making src/config.h from src/config.h-dist"
375 if [ "${highpri}" != "" ]; then
376 highpri
="(-${highpri})"
379 "yes" ) c_switch_site
="${c_switch_site} -g" ;;
382 "yes" ) c_switch_site
="${c_switch_site} -O" ;;
384 sed_flags
="-e 's:@machine@:${machfile}:'"
385 sed_flags
="${sed_flags} -e 's:@opsystem@:${opsysfile}:'"
386 for flag
in `echo ${config_h_opts} | tr ':' ' '`; do
387 cflagname
=`echo ${flag} | tr a-z A-Z`
388 val
=`eval echo '$'${flag}`
391 f
="-e 's:.*#define ${cflagname}.*:/\\* #define ${cflagname} \\*/:'"
394 f
="-e 's:.*#define ${cflagname}.*:#define ${cflagname}:'"
397 f
="-e 's:.*#define ${cflagname}.*:#define ${cflagname} ${val}:'"
400 sed_flags
="${sed_flags} ${f}"
402 eval '/bin/sed '${sed_flags}' < src/config.h-dist > src/config.h'
404 # Modify the parameters in the top makefile.
405 echo "Editing ./Makefile..."
406 tempMakefile
="tempMakefile"$$
407 /bin
/sed < Makefile
> ${tempMakefile} \
408 -e 's;^\(LIBROOT=\).*$;\1'"${libroot};" \
409 -e 's;^\(INSTALLBIN=\).*$;\1'"${installbin};" \
410 -e 's;^\(LISPPATH=\).*$;\1'"${lisppath};" \
411 -e 's;^\(DATADIR=\).*$;\1'"${datadir};" \
412 -e 's;^\(LOCKDIR=\).*$;\1'"${lockdir};" \
413 -e 's;^\(LIBDIR=\).*$;\1'"${libdir};"
414 mv ${tempMakefile} Makefile
416 # Modify the parameters in the `build-install' script.
417 echo "Editing ./build-install..."
419 /bin
/sed < build-install
> ${tempbi} \
420 -e 's;^\(LIBROOT=\).*$;\1'"${libroot};" \
421 -e 's;^\(BINDIR=\).*$;\1'"${installbin};" \
422 -e 's;^\(LISPPATH=\).*$;\1'"${lisppath};" \
423 -e 's;^\(DATADIR=\).*$;\1'"${datadir};" \
424 -e 's;^\(LOCKDIR=\).*$;\1'"${lockdir};" \
425 -e 's;^\(LIBDIR=\).*$;\1'"${libdir};"
426 mv ${tempbi} build-install
427 chmod a
+x build-install
429 # Modify the parameters in the src makefile.
430 echo "Editing src/Makefile..."
431 tempMakefile
="tempMakefile"$$
432 /bin
/sed < src
/Makefile
> ${tempMakefile} \
433 -e 's;^\(CC[ ]*=\).*$;\1'"${cc};"
434 mv ${tempMakefile} src
/Makefile
436 # Modify the parameters in the lib-src makefile.
437 echo "Editing lib-src/Makefile..."
438 tempMakefile
="tempMakefile"$$
439 /bin
/sed < lib-src
/Makefile
> ${tempMakefile} \
440 -e 's;^\(CFLAGS=\).*$;\1'"${c_switch_site};" \
441 -e 's;^\(LOADLIBES=\).*$;\1'"${libsrc_libs};" \
442 -e 's;^\(CC=\).*$;\1'"${cc};"
443 mv ${tempMakefile} lib-src
/Makefile
445 # Document the damage we have done.
447 echo "Configured for machine \`${machine}' running \`${opsystem}'.
448 The following values have been set in ./Makefile and ./build-install:
449 Executables will be placed in
451 Emacs's lisp search path will be
453 Emacs will look for its architecture-independent data in
455 Emacs will look for its utility programs and other architecture-
458 Emacs will keep track of file-locking in
460 The following values have been set in src/config.h:
461 At how much higher than normal priority should Emacs run? ${highpri-none}
462 Should Emacs use the GNU version of malloc? ${gnu_malloc}${gnu_malloc_reason}
463 Should Emacs use the relocating allocator for buffers? ${rel_alloc}
464 Should Emacs support a floating point Elisp type? ${lisp_float_type}
465 What window system should Emacs use? ${window_system}
466 Should Emacs support mouse menus, which require X11? ${have_x_menu}
467 What compiler should emacs be built with? ${cc}
468 Should the compilation use \`-g' and/or \`-O'? ${c_switch_site- neither}" \
469 |
tee config.status
1>&2