Return to BSD News archive
Xref: sserve comp.os.386bsd.questions:6247 comp.os.386bsd.bugs:1656 gnu.emacs.help:13236 Newsgroups: comp.os.386bsd.questions,comp.os.386bsd.bugs,gnu.emacs.help Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!saimiri.primate.wisc.edu!news.doit.wisc.edu!psl.wisc.edu!128.104.200.15!ram From: ram@xor.epi.wisc.edu (Ram Bhamidipaty) Subject: Re: NetBSD 0.9: Need help building emacs In-Reply-To: Mike.Long@analog.com's message of Wed, 27 Oct 1993 03:03:10 GMT Message-ID: <RAM.93Oct27100243@xor.epi.wisc.edu> Sender: news@pslu1.psl.wisc.edu (USENET News System) Organization: Physical Sciences Lab, UW-Madison References: <MIKE.LONG.93Oct26230310@cthulhu.analog.com> Date: 27 Oct 1993 15:02:42 GMT Lines: 4396 Heres a set of patches that I grabbed from one of the gnu.emacs newsgroups. I used it to compile emacs-19.19 on netbsd-0.9. -Ram >From dong@das.harvard.edu Wed Sep 1 10:17:58 1993 Path: psl.wisc.edu!news.doit.wisc.edu!uwm.edu!math.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!das.harvard.edu!dong >From: dong@das.harvard.edu Newsgroups: gnu.emacs.bug Subject: Emacs 19.19 fixes for NetBSD-0.9 Date: 31 Aug 1993 19:28:50 -0400 Organization: GNUs Not Usenet Lines: 4371 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <9308302157.AA11033@virtual12.harvard.edu> Emacs 19.19 does not dump the right executable for NetBSD-0.9. The reason is that unexec.c uses the wrong a.out format. I have a temporary fix for it and it works perfectly for my 486. I am sure it will break for other configurations. Enclosed are the files I have changed or added, please incorporate them in the system so that it can benefit other NetBSD users. these files are : emacs-19.19/configure emacs-19.19/config.sub emacs-19.19/src/unexec.c emacs-19.19/src/s/netbsd.h /*********** emacs-19.19/configure *************/ #!/bin/sh #### Configuration script for GNU Emacs #### Copyright (C) 1992 Free Software Foundation, Inc. ### Don't edit this script! ### This script was automatically generated by the `autoconf' program ### from the file `./configure.in'. ### To rebuild it, execute the command ### autoconf ### in the this directory. You must have autoconf version 1.4 or later. ### This file is part of GNU Emacs. ### GNU Emacs is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 1, or (at your option) ### any later version. ### GNU Emacs is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### You should have received a copy of the GNU General Public License ### along with GNU Emacs; see the file COPYING. If not, write to ### the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ### Since Emacs has configuration requirements that autoconf can't ### meet, this file is an unholy marriage of custom-baked ### configuration code and autoconf macros. ### ### We use the m4 quoting characters [ ] (as established by the ### autoconf system) to include large sections of raw sewage - Oops, I ### mean, shell code - in the final configuration script. ### ### Usage: configure config_name ### ### If configure succeeds, it leaves its status in config.status. ### If configure fails after disturbing the status quo, ### config.status is removed. ### Remove any more than one leading "." element from the path name. ### If we don't remove them, then another "./" will be prepended to ### the file name each time we use config.status, and the program name ### will get larger and larger. This wouldn't be a problem, except ### that since progname gets recorded in all the Makefiles this script ### produces, move-if-change thinks they're different when they're ### not. ### ### It would be nice if we could put the ./ in a \( \) group and then ### apply the * operator to that, so we remove as many leading ./././'s ### as are present, but some seds (like Ultrix's sed) don't allow you to ### apply * to a \( \) group. Bleah. progname="`echo $0 | sed 's:^\./\./:\./:'`" #### Usage messages. short_usage="Usage: ${progname} CONFIGURATION [-OPTION[=VALUE] ...] Set compilation and installation parameters for GNU Emacs, and report. CONFIGURATION specifies the machine and operating system to build for. --with-x Support the X Window System. --with-x=no Don't support X. --x-includes=DIR Search for X header files in DIR. --x-libraries=DIR Search for X libraries in DIR. --with-gcc Use GCC to compile Emacs. --with-gcc=no Don't use GCC to compile Emacs. --run-in-place Use libraries and data files directly out of the source tree. --srcdir=DIR Look for source in DIR. --prefix=DIR Install files below dir. If successful, ${progname} leaves its status in config.status. If unsuccessful after disturbing the status quo, it removes config.status." #### Option processing. ### Record all the arguments, so we can save them in config.status. arguments="$@" ### These values are used to comment and uncomment different values ### for the path variables in the Makefile, to choose the installed ### configuration or the run-in-place configuration. rip_paths='#disabled# ' inst_paths='' ### Establish some default values. prefix='/usr/local' exec_prefix='${prefix}' ### Don't use shift -- that destroys the argument list, which autoconf needs ### to produce config.status. It turns out that "set - ${arguments}" doesn't ### work portably. index=0 while [ $index -lt $# ]; do index=`expr $index + 1` arg=`eval echo '$'$index` case "${arg}" in ## Anything starting with a hyphen we assume is an option. -* ) ## Separate the switch name from the value it's being given. case "${arg}" in -*=*) opt=`echo ${arg} | sed 's:^-*\([^=]*\)=.*$:\1:'` val=`echo ${arg} | sed 's:^-*[^=]*=\(.*\)$:\1:'` valomitted=no ;; -*) ## If FOO is a boolean argument, --FOO is equivalent to ## --FOO=yes. Otherwise, the value comes from the next ## argument - see below. opt=`echo ${arg} | sed 's:^-*\(.*\)$:\1:'` val="yes" valomitted=yes ;; esac ## Change `-' in the option name to `_'. optname="${opt}" opt="`echo ${opt} | tr - _`" ## Process the option. case "${opt}" in ## Has the user specified which window systems they want to support? "with_x" | "with_x11" | "with_x10" ) ## Make sure the value given was either "yes" or "no". case "${val}" in y | ye | yes ) val=yes ;; n | no ) val=no ;; * ) (echo "${progname}: the \`--${optname}' option is supposed to have a boolean value. Set it to either \`yes' or \`no'." echo "${short_usage}") >&2 exit 1 ;; esac eval "${opt}=\"${val}\"" ;; ## Has the user specified whether or not they want GCC? "with_gcc" | "with_gnu_cc" ) ## Make sure the value given was either "yes" or "no". case "${val}" in y | ye | yes ) val=yes ;; n | no ) val=no ;; * ) (echo "${progname}: the \`--${optname}' option is supposed to have a boolean value. Set it to either \`yes' or \`no'." echo "${short_usage}") >&2 exit 1 ;; esac eval "${opt}=\"${val}\"" ;; ## Has the user specified a source directory? "srcdir" ) ## If the value was omitted, get it from the next argument. if [ "${valomitted}" = "yes" ]; then ## Get the next argument from the argument list, if there is one. if [ $index = $# ]; then (echo "${progname}: You must give a value for the \`--${optname}' option, as in \`--${optname}=FOO'." echo "${short_usage}") >&2 exit 1 fi index=`expr $index + 1` val=`eval echo '$'$index` fi srcdir="${val}" ;; ## Has the user tried to tell us where the X files are? ## I think these are dopey, but no less than three alpha ## testers, at large sites, have said they have their X files ## installed in odd places. "x_includes" ) ## If the value was omitted, get it from the next argument. if [ "${valomitted}" = "yes" ]; then ## Get the next argument from the argument list, if there is one. if [ $index = $# ]; then (echo "${progname}: You must give a value for the \`--${optname}' option, as in \`--${optname}=FOO'." echo "${short_usage}") >&2 exit 1 fi index=`expr $index + 1` val=`eval echo '$'$index` fi x_includes="${val}" ;; "x_libraries" ) ## If the value was omitted, get it from the next argument. if [ "${valomitted}" = "yes" ]; then ## Get the next argument from the argument list, if there is one. if [ $index = $# ]; then (echo "${progname}: You must give a value for the \`--${optname}' option, as in \`--${optname}=FOO'." echo "${short_usage}") >&2 exit 1 fi index=`expr $index + 1` val=`eval echo '$'$index` fi x_libraries="${val}" ;; ## Should this use the "development configuration"? "run_in_place" ) rip_paths='' inst_paths='#disabled# ' ;; ## Has the user specified an installation prefix? "prefix" ) ## If the value was omitted, get it from the next argument. if [ "${valomitted}" = "yes" ]; then ## Get the next argument from the argument list, if there is one. if [ $index = $# ]; then (echo "${progname}: You must give a value for the \`--${optname}' option, as in \`--${optname}=FOO'." echo "${short_usage}") >&2 exit 1 fi index=`expr $index + 1` val=`eval echo '$'$index` fi prefix="${val}" ;; ## Has the user specified an installation prefix? "exec_prefix" ) ## If the value was omitted, get it from the next argument. if [ "${valomitted}" = "yes" ]; then ## Get the next argument from the argument list, if there is one. if [ $index = $# ]; then (echo "${progname}: You must give a value for the \`--${optname}' option, as in \`--${optname}=FOO'." echo "${short_usage}") >&2 exit 1 fi index=`expr $index + 1` val=`eval echo '$'$index` fi exec_prefix="${val}" ;; ## Verbose flag, tested by autoconf macros. "verbose" ) verbose=yes ;; ## Has the user asked for some help? "usage" | "help" ) if [ "x$PAGER" = x ] then echo "${short_usage}" | more else echo "${short_usage}" | $PAGER fi exit ;; ## We ignore all other options silently. esac ;; ## Anything not starting with a hyphen we assume is a ## configuration name. *) configuration=${arg} ;; esac done if [ "${configuration}" = "" ]; then echo '- You did not tell me what kind of host system you want to configure. - I will attempt to guess the kind of system this is.' 1>&2 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'` if configuration=`${guesssys}` ; then echo "- Looks like this is a ${configuration}" 1>&2 else echo '- Failed to guess the system type. You need to tell me.' 1>&2 echo "${short_usage}" >&2 exit 1 fi fi #### Decide where the source is. case "${srcdir}" in ## If it's not specified, see if `.' or `..' might work. "" ) confdir=`echo $0 | sed 's|//|/|' | sed 's|/[^/]*$||'` if [ -f $confdir/src/lisp.h -a -f $confdir/lisp/version.el ]; then srcdir="${confdir}" else if [ -f "./src/lisp.h" -a -f "./lisp/version.el" ]; then srcdir='.' else if [ -f "../src/lisp.h" -a -f "../lisp/version.el" ]; then srcdir='..' else (echo "\ ${progname}: Neither the current directory nor its parent seem to contain the Emacs sources. If you do not want to build Emacs in its source tree, you should run \`${progname}' in the directory in which you wish to build Emacs, using its \`--srcdir' option to say where the sources may be found." echo "${short_usage}") >&2 exit 1 fi fi fi ;; ## Otherwise, check if the directory they specified is okay. * ) if [ ! -d "${srcdir}" -o ! -f "${srcdir}/src/lisp.h" -o ! -f "${srcdir}/lisp/version.el" ]; then (echo "\ ${progname}: The directory specified with the \`--srcdir' option, \`${srcdir}', doesn't seem to contain the Emacs sources. You should either run the \`${progname}' script at the top of the Emacs source tree, or use the \`--srcdir' option to specify where the Emacs sources are." echo "${short_usage}") >&2 exit 1 fi ;; esac #### Make srcdir absolute, if it isn't already. It's important to #### avoid running the path through pwd unnecessary, since pwd can #### give you automounter prefixes, which can go away. case "${srcdir}" in /* ) ;; . ) ## We may be able to use the $PWD environment variable to make this ## absolute. But sometimes PWD is inaccurate. if [ "${PWD}" != "" ] && [ "`(cd ${PWD} ; pwd)`" = "`pwd`" ] ; then srcdir="$PWD" else srcdir="`(cd ${srcdir}; pwd)`" fi ;; * ) srcdir="`(cd ${srcdir}; pwd)`" ;; esac #### Make sure that the source directory doesn't already have a #### configured system in it. if [ `pwd` != `(cd ${srcdir} && pwd)` ] \ && [ -f "${srcdir}/src/config.h" ] ; then (echo "${progname}: the directory tree \`${srcdir}' is being used" echo " as a build directory right now; it has been configured in its own" echo " right. You can't use srcdir in this situation.") >&2 exit 1 fi ### Make the necessary directories, if they don't exist. for dir in ./src ./lib-src ./cpp ./oldXMenu ./etc ; do if [ ! -d ${dir} ]; then mkdir ${dir} fi done #### Given the configuration name, set machfile and opsysfile to the #### names of the m/*.h and s/*.h files we should use. ### Canonicalize the configuration name. echo "Checking the configuration name." if canonical=`${srcdir}/config.sub "${configuration}"` ; then : ; else exit $? fi ### If you add support for a new configuration, add code to this ### switch statement to recognize your configuration name and select ### the appropriate operating system and machine description files. ### You would hope that you could choose an m/*.h file pretty much ### based on the machine portion of the configuration name, and an s- ### file based on the operating system portion. However, it turns out ### that each m/*.h file is pretty manufacturer-specific - for ### example, apollo.h, hp9000s300.h, mega68k, news.h, and tad68k are ### all 68000 machines; mips.h, pmax.h, and news-risc are all MIPS ### machines. So we basically have to have a special case for each ### configuration name. ### ### As far as handling version numbers on operating systems is ### concerned, make sure things will fail in a fixable way. If ### /etc/MACHINES doesn't say anything about version numbers, be ### prepared to handle anything reasonably. If version numbers ### matter, be sure /etc/MACHINES says something about it. ### ### Eric Raymond says we should accept strings like "sysvr4" to mean ### "System V Release 4"; he writes, "The old convention encouraged ### confusion between `system' and `release' levels'." machine='' opsys='' unported='false' case "${canonical}" in ## Alliant machines ## Strictly speaking, we need the version of the alliant operating ## system to choose the right machine file, but currently the ## configuration name doesn't tell us enough to choose the right ## one; we need to give alliants their own operating system name to ## do this right. When someone cares, they can help us. fx80-alliant-* ) machine=alliant4 opsys=bsd4-2 ;; i860-alliant-* ) machine=alliant-2800 opsys=bsd4-3 ;; ## Altos 3068 m68*-altos-sysv* ) machine=altos opsys=usg5-2 ;; ## Amdahl UTS 580-amdahl-sysv* ) machine=amdahl opsys=usg5-2-2 ;; ## Appallings - I mean, Apollos - running Domain m68*-apollo* ) machine=apollo opsys=bsd4-2 ;; ## AT&T 3b2, 3b5, 3b15, 3b20 we32k-att-sysv* ) machine=att3b opsys=usg5-2-2 ;; ## AT&T 3b1 - The Mighty Unix PC! m68*-att-sysv* ) machine=7300 opsys=usg5-2-2 ;; ## Bull dpx2 m68*-bull-sysv3* ) machine=dpx2 opsys=usg5-3 ;; ## Bull sps7 m68*-bull-sysv2* ) machine=sps7 opsys=usg5-2 ;; ## CCI 5/32, 6/32 -- see "Tahoe". ## Celerity ## I don't know what configuration name to use for this; config.sub ## doesn't seem to know anything about it. Hey, Celerity users, get ## in touch with us! celerity-celerity-bsd* ) machine=celerity opsys=bsd4-2 ;; ## Clipper ## What operating systems does this chip run that Emacs has been ## tested on? clipper-* ) machine=clipper ## We'll use the catch-all code at the bottom to guess the ## operating system. ;; ## Convex *-convex-bsd* ) machine=convex opsys=bsd4-3 ;; ## Cubix QBx/386 i386-cubix-sysv* ) machine=intel386 opsys=usg5-3 ;; ## Cydra 5 cydra*-cydrome-sysv* ) machine=cydra5 opsys=usg5-3 ;; ## Data General AViiON Machines m88k-dg-dgux* ) machine=aviion opsys=dgux ;; ## DECstations mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0* | mips-dec-bsd4.2* ) machine=pmax opsys=bsd4-2 ;; mips-dec-ultrix* | mips-dec-bsd* ) machine=pmax opsys=bsd4-3 ;; mips-dec-osf* ) machine=pmax opsys=osf1 ;; ## Motorola Delta machines m68*-motorola-sysv* ) machine=delta opsys=usg5-3 ;; m88k-motorola-sysv4* ) machine=delta88k opsys=usg5-4 ;; m88k-motorola-sysv* | m88k-motorola-m88kbcs* ) machine=delta88k opsys=usg5-3 ;; ## Dual machines m68*-dual-sysv* ) machine=dual opsys=usg5-2 ;; m68*-dual-uniplus* ) machine=dual opsys=unipl5-2 ;; ## Elxsi 6400 elxsi-elxsi-sysv* ) machine=elxsi opsys=usg5-2 ;; ## Encore machines ns16k-encore-bsd* ) machine=ns16000 opsys=umax ;; ## The GEC 93 - apparently, this port isn't really finished yet. ## Gould Power Node and NP1 pn-gould-bsd4.2* ) machine=gould opsys=bsd4-2 ;; pn-gould-bsd4.3* ) machine=gould opsys=bsd4-3 ;; np1-gould-bsd* ) machine=gould-np1 opsys=bsd4-3 ;; ## Honeywell XPS100 xps*-honeywell-sysv* ) machine=xps100 opsys=usg5-2 ;; ## HP 9000 series 200 or 300 m68*-hp-bsd* ) machine=hp9000s300 opsys=bsd4-3 ;; ## HP/UX 7, 8 and 9 are supported on these machines. m68*-hp-hpux* ) case "`uname -r`" in ## Someone's system reports A.B8.05 for this. ## I wonder what other possibilities there are. *.B8.* ) machine=hp9000s300 opsys=hpux8 ;; *.08.* ) machine=hp9000s300 opsys=hpux8 ;; *.09.* ) machine=hp9000s300 opsys=hpux9 ;; *) machine=hp9000s300 opsys=hpux ;; esac ;; ## HP 9000 series 700 and 800, running HP/UX hppa*-hp-hpux7* ) machine=hp9000s800 opsys=hpux ;; hppa*-hp-hpux8* ) machine=hp9000s800 opsys=hpux8 ;; hppa*-hp-hpux9* ) machine=hp9000s800 opsys=hpux9 ;; ## HP 9000 series 700 and 800, running HP/UX hppa*-hp-hpux* ) ## Cross-compilation? Nah! case "`uname -r`" in ## Someone's system reports A.B8.05 for this. ## I wonder what other possibilities there are. *.B8.* ) machine=hp9000s800 opsys=hpux8 ;; *.08.* ) machine=hp9000s800 opsys=hpux8 ;; *.09.* ) machine=hp9000s800 opsys=hpux9 ;; *) machine=hp9000s800 opsys=hpux ;; esac ;; ## Orion machines orion-orion-bsd* ) machine=orion opsys=bsd4-2 ;; clipper-orion-bsd* ) machine=orion105 opsys=bsd4-2 ;; ## IBM machines i386-ibm-aix1.1* ) machine=ibmps2-aix opsys=usg5-2-2 ;; i386-ibm-aix1.[23]* | i386-ibm-aix* ) machine=ibmps2-aix opsys=usg5-3 ;; i370-ibm-aix*) machine=ibm370aix opsys=usg5-3 ;; rs6000-ibm-aix3.1* ) machine=ibmrs6000 opsys=aix3-1 ;; rs6000-ibm-aix3.2* | rs6000-ibm-aix* ) machine=ibmrs6000 opsys=aix3-2 ;; romp-ibm-bsd4.3* ) machine=ibmrt opsys=bsd4-3 ;; romp-ibm-bsd4.2* ) machine=ibmrt opsys=bsd4-2 ;; romp-ibm-aos4.3* ) machine=ibmrt opsys=bsd4-3 ;; romp-ibm-aos4.2* ) machine=ibmrt opsys=bsd4-2 ;; romp-ibm-aos* ) machine=ibmrt opsys=bsd4-3 ;; romp-ibm-bsd* ) machine=ibmrt opsys=bsd4-3 ;; romp-ibm-aix* ) machine=ibmrt-aix opsys=usg5-2-2 ;; ## Integrated Solutions `Optimum V' m68*-isi-bsd4.2* ) machine=isi-ov opsys=bsd4-2 ;; m68*-isi-bsd4.3* ) machine=isi-ov opsys=bsd4-3 ;; ## Intel 386 machines where we do care about the manufacturer i[34]86-intsys-sysv* ) machine=is386 opsys=usg5-2-2 ;; ## Prime EXL i386-prime-sysv* ) machine=i386 opsys=usg5-3 ;; ## Sequent Symmetry i386-sequent-bsd* ) machine=symmetry opsys=bsd4-3 ;; ## Intel 860 i860-*-sysvr4* ) machine=i860 opsys=usg5-4 ;; ## Silicon Graphics machines ## Iris 2500 and Iris 2500 Turbo (aka the Iris 3030) m68*-sgi-iris3.5* ) machine=irist opsys=iris3-5 ;; m68*-sgi-iris3.6* | m68*-sgi-iris*) machine=irist opsys=iris3-6 ;; ## Iris 4D mips-sgi-irix3.* ) machine=iris4d opsys=irix3-3 ;; mips-sgi-irix5.* ) machine=iris4d opsys=irix5-0 ;; mips-sgi-irix4.* | mips-sgi-irix* ) machine=iris4d opsys=irix4-0 ;; ## Masscomp machines m68*-masscomp-rtu* ) machine=masscomp opsys=rtu ;; ## Megatest machines m68*-megatest-bsd* ) machine=mega68 opsys=bsd4-2 ;; ## Workstations sold by MIPS ## This is not necessarily all workstations using the MIPS processor - ## Irises are produced by SGI, and DECstations by DEC. ## etc/MACHINES lists mips.h and mips4.h as possible machine files, ## and usg5-2-2 and bsd4-3 as possible OS files. The only guidance ## it gives for choosing between the alternatives seems to be "Use ## -machine=mips4 for RISCOS version 4; use -opsystem=bsd4-3 with ## the BSD world." I'll assume that these are instructions for ## handling two odd situations, and that every other situation ## should use mips.h and usg5-2-2, they being listed first. mips-mips-usg* ) machine=mips4 ## Fall through to the general code at the bottom to decide on the OS. ;; mips-mips-riscos4* ) machine=mips4 opsys=bsd4-3 ;; mips-mips-bsd* ) machine=mips opsys=bsd4-3 ;; mips-mips-* ) machine=mips opsys=usg5-2-2 ;; ## NeXT m68*-next-mach* | m68*-next-bsd* ) machine=next opsys=mach2 ;; ## The complete machine from National Semiconductor ns32k-ns-genix* ) machine=ns32000 opsys=usg5-2 ;; ## NCR machines m68*-ncr-sysv2* | m68*-ncr-sysvr2* ) machine=tower32 opsys=usg5-2-2 ;; m68*-ncr-sysv3* | m68*-ncr-sysvr3* ) machine=tower32v3 opsys=usg5-3 ;; ## Nixdorf Targon 31 m68*-nixdorf-sysv* ) machine=targon31 opsys=usg5-2-2 ;; ## Nu (TI or LMI) m68*-nu-sysv* ) machine=nu opsys=usg5-2 ;; ## Plexus m68*-plexus-sysv* ) machine=plexus opsys=usg5-2 ;; ## Pyramid machines ## I don't really have any idea what sort of processor the Pyramid has, ## so I'm assuming it is its own architecture. pyramid-pyramid-bsd* ) machine=pyramid opsys=bsd4-2 ;; ## Sequent Balance ns32k-sequent-bsd4.2* ) machine=sequent opsys=bsd4-2 ;; ns32k-sequent-bsd4.3* ) machine=sequent opsys=bsd4-3 ;; ## SONY machines m68*-sony-bsd4.2* ) machine=news opsys=bsd4-2 ;; m68*-sony-bsd4.3* ) machine=news opsys=bsd4-3 ;; m68*-sony-newsos3*) machine=news opsys=bsd4-3 ;; mips-sony-bsd* ) machine=news-risc opsys=bsd4-3 ;; ## Stride m68*-stride-sysv* ) machine=stride opsys=usg5-2 ;; ## Suns *-sun-sunos* | *-sun-bsd* | *-sun-solaris* ) case "${canonical}" in m68*-sunos1* ) machine=sun1 ;; m68*-sunos2* ) machine=sun2 ;; m68* ) machine=sun3 ;; i[34]86* ) machine=sun386 ;; sparc* ) machine=sparc ;; * ) unported=true ;; esac case "${canonical}" in ## The Sun386 didn't get past 4.0. i386-*-sunos4 ) opsys=sunos4-0 ;; *-sunos4.0* ) opsys=sunos4-0 ;; *-sunos4.1.3* ) opsys=sunos4-1-3 ;; *-sunos4* | *-sunos ) opsys=sunos4-1 ;; *-sunos5* | *-solaris* ) opsys=sol2 ;; * ) opsys=bsd4-2 ;; esac ;; ## Tadpole 68k m68*-tadpole-sysv* ) machine=tad68k opsys=usg5-3 ;; ## Tahoe machines tahoe-tahoe-bsd4.2* ) machine=tahoe opsys=bsd4-2 ;; tahoe-tahoe-bsd4.3* ) machine=tahoe opsys=bsd4-3 ;; ## Tandem Integrity S2 mips-tandem-sysv* ) machine=tandem-s2 opsys=usg5-3 ;; ## Tektronix XD88 m88k-tektronix-sysv3* ) machine=tekxd88 opsys=usg5-3 ;; ## Tektronix 16000 box (6130?) ns16k-tektronix-bsd* ) machine=ns16000 opsys=bsd4-2 ;; ## Tektronix 4300 ## src/m/tek4300.h hints that this is a m68k machine. m68*-tektronix-bsd* ) machine=tek4300 opsys=bsd4-3 ;; ## Titan P2 or P3 ## We seem to have lost the machine-description file titan.h! titan-titan-sysv* ) machine=titan opsys=usg5-3 ;; ## Ustation E30 (SS5E) m68*-unisys-uniplus* ) machine=ustation opsystem=unipl5-2 ;; ## Vaxen. vax-dec-* ) machine=vax case "${canonical}" in *-bsd4.1* ) opsys=bsd4-1 ;; *-bsd4.2* | *-ultrix[0-3].* | *-ultrix4.0* ) opsys=bsd4-2 ;; *-bsd4.3* | *-ultrix* ) opsys=bsd4-3 ;; *-bsd386* ) opsys=bsd386 ;; *-sysv[01]* | *-sysvr[01]* ) opsys=usg5-0 ;; *-sysv2* | *-sysvr2* ) opsys=usg5-2 ;; *-vms* ) opsys=vms ;; * ) unported=true esac ;; ## Whitechapel MG1 ns16k-whitechapel-* ) machine=mg1 ## We don't know what sort of OS runs on these; we'll let the ## operating system guessing code below try. ;; ## Wicat m68*-wicat-sysv* ) machine=wicat opsys=usg5-2 ;; ## Intel 386 machines where we don't care about the manufacturer i[34]86-*-* ) machine=intel386 case "${canonical}" in *-isc1.* | *-isc2.[01]* ) opsys=386-ix ;; *-isc2.2* ) opsys=isc2-2 ;; *-isc* ) opsys=isc3-0 ;; *-esix5* ) opsys=esix5r4 ;; *-esix* ) opsys=esix ;; *-xenix* ) opsys=xenix ;; *-linux* ) opsys=linux ;; *-sco3.2v4* ) opsys=sco4 ;; *-bsd386* ) opsys=bsd386 ;; *-386bsd* ) opsys=386bsd ;; *-netbsd* ) opsys=netbsd ;; ## Otherwise, we'll fall through to the generic opsys code at the bottom. esac ;; * ) unported=true ;; esac ### If the code above didn't choose an operating system, just choose ### an operating system based on the configuration name. You really ### only want to use this when you have no idea what the right ### operating system is; if you know what operating systems a machine ### runs, it's cleaner to make it explicit in the case statement ### above. if [ x"${opsys}" = x ]; then case "${canonical}" in *-bsd4.[01] ) opsys=bsd4-1 ;; *-bsd4.2 ) opsys=bsd4-2 ;; *-bsd4.3 ) opsys=bsd4-3 ;; *-sysv0 | *-sysvr0 ) opsys=usg5-0 ;; *-sysv2 | *-sysvr2 ) opsys=usg5-2 ;; *-sysv2.2 | *-sysvr2.2 ) opsys=usg5-2-2 ;; *-sysv3 | *-sysvr3 ) opsys=usg5-3 ;; *-sysv4 | *-sysvr4 ) opsys=usg5-4 ;; *-sysv4.2 | *-sysvr4.2 ) opsys=usg5-4-2 ;; * ) unported=true ;; esac fi if $unported ; then (echo "${progname}: Emacs hasn't been ported to \`${canonical}' systems." echo "${progname}: Check \`etc/MACHINES' for recognized configuration names." ) >&2 exit 1 fi machfile="m/${machine}.h" opsysfile="s/${opsys}.h" trap 'rm -fr conftest* core; exit 1' 1 3 15 # NLS nuisances. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi if test "${LANG+set}" = 'set' ; then LANG=C; export LANG; fi rm -f conftest* compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. unique_file=lisp # Find the source files, if location was not specified. if test -z "$srcdir"; then srcdirdefaulted=yes # Try the directory containing this script, then `..'. prog=$0 confdir=`echo $prog|sed 's%/[^/][^/]*$%%'` test "X$confdir" = "X$prog" && confdir=. srcdir=$confdir if test ! -r $srcdir/$unique_file; then srcdir=.. fi fi if test ! -r $srcdir/$unique_file; then if test x$srcdirdefaulted = xyes; then echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2 else echo "configure: Can not find sources in \`${srcdir}'." 1>&2 fi exit 1 fi # Preserve a srcdir of `.' to avoid automounter screwups with pwd. # But we can't avoid them for `..', to make subdirectories work. case $srcdir in .|/*|~*) ;; *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute. esac # Save the original args to write them into config.status later. configure_args="$*" #### Choose a compiler. case ${with_gcc} in "yes" ) CC="gcc" GCC=1 ;; "no" ) CC="cc" ;; * ) if test -z "$CC"; then # Extract the first word of `gcc', so it can be a program name with args. set dummy gcc; word=$2 echo checking for $word IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/$word; then CC="gcc" break fi done IFS="$saveifs" fi test -z "$CC" && CC="cc" test -n "$CC" -a -n "$verbose" && echo " setting CC to $CC" # Find out if we are using GNU C, under whatever name. cat > conftest.c <<EOF #ifdef __GNUC__ yes #endif EOF ${CC-cc} -E conftest.c > conftest.out 2>&1 if egrep yes conftest.out >/dev/null 2>&1; then GCC=1 # For later tests. fi rm -f conftest* esac #### Some other nice autoconf tests. If you add a test here which #### should make an entry in src/config.h, don't forget to add an #### #undef clause to src/config.h.in for autoconf to modify. echo checking for ln -s rm -f conftestdata if ln -s X conftestdata 2>/dev/null then rm -f conftestdata LN_S="ln -s" else LN_S=ln fi echo checking how to run the C preprocessor if test -z "$CPP"; then # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and ``${CC-cc}'' will simply confuse # make. It must be expanded now. CPP="${CC-cc} -E" cat > conftest.c <<EOF #include <stdio.h> Syntax Error EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then : else CPP=/lib/cpp fi rm -f conftest* fi test ".${verbose}" != "." && echo " setting CPP to $CPP" # Make sure to not get the incompatible SysV /etc/install and # /usr/sbin/install, which might be in PATH before a BSD-like install, # or the SunOS /usr/etc/install directory, or the AIX /bin/install, # or the AFS install, which mishandles nonexistent args, or # /usr/ucb/install on SVR4, which tries to use the nonexistent group # `staff'. On most BSDish systems install is in /usr/bin, not /usr/ucb # anyway. Sigh. if test "z${INSTALL}" = "z" ; then echo checking for install IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" for dir in $PATH; do test -z "$dir" && dir=. case $dir in /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;; *) if test -f $dir/installbsd; then INSTALL="$dir/installbsd -c" # OSF1 INSTALL_PROGRAM='$(INSTALL)' INSTALL_DATA='$(INSTALL) -m 644' break fi if test -f $dir/install; then if grep dspmsg $dir/install >/dev/null 2>&1; then : # AIX else INSTALL="$dir/install -c" INSTALL_PROGRAM='$(INSTALL)' INSTALL_DATA='$(INSTALL) -m 644' break fi fi ;; esac done IFS="$saveifs" fi INSTALL=${INSTALL-cp} test -n "$verbose" && echo " setting INSTALL to $INSTALL" INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'} test -n "$verbose" && echo " setting INSTALL_PROGRAM to $INSTALL_PROGRAM" INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'} test -n "$verbose" && echo " setting INSTALL_DATA to $INSTALL_DATA" for p in 'bison -y' byacc do if test -z "$YACC"; then # Extract the first word of `$p', so it can be a program name with args. set dummy $p; word=$2 echo checking for $word IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/$word; then YACC="$p" break fi done IFS="$saveifs" fi test -n "$YACC" -a -n "$verbose" && echo " setting YACC to $YACC" test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" for hdr in sys/timeb.h sys/time.h do trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'` echo checking for ${hdr} cat > conftest.c <<EOF #include <${hdr}> EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then { test -n "$verbose" && \ echo " defining ${trhdr}" DEFS="$DEFS -D${trhdr}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD} \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD} \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD} " } fi rm -f conftest* done echo checking for ANSI C header files cat > conftest.c <<EOF #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. echo '#include <string.h>' > conftest.c eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" if egrep "memchr" conftest.out >/dev/null 2>&1; then # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. cat > conftest.c <<EOF #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e,f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining STDC_HEADERS" DEFS="$DEFS -DSTDC_HEADERS=1" SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD} \${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD} \${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD} " } fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* echo checking for whether time.h and sys/time.h may both be included cat > conftest.c <<EOF #include <sys/types.h> #include <sys/time.h> #include <time.h> int main() { exit(0); } int t() { struct tm *tp; } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining TIME_WITH_SYS_TIME" DEFS="$DEFS -DTIME_WITH_SYS_TIME=1" SEDDEFS="${SEDDEFS}\${SEDdA}TIME_WITH_SYS_TIME\${SEDdB}TIME_WITH_SYS_TIME\${SEDdC}1\${SEDdD} \${SEDuA}TIME_WITH_SYS_TIME\${SEDuB}TIME_WITH_SYS_TIME\${SEDuC}1\${SEDuD} \${SEDeA}TIME_WITH_SYS_TIME\${SEDeB}TIME_WITH_SYS_TIME\${SEDeC}1\${SEDeD} " } fi rm -f conftest* echo checking for return type of signal handlers cat > conftest.c <<EOF #include <sys/types.h> #include <signal.h> #ifdef signal #undef signal #endif extern void (*signal ()) (); int main() { exit(0); } int t() { int i; } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining RETSIGTYPE to be void" DEFS="$DEFS -DRETSIGTYPE=void" SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}void\${SEDdD} \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}void\${SEDuD} \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}void\${SEDeD} " } else { test -n "$verbose" && \ echo " defining RETSIGTYPE to be int" DEFS="$DEFS -DRETSIGTYPE=int" SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}int\${SEDdD} \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}int\${SEDuD} \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}int\${SEDeD} " } fi rm -f conftest* echo checking for struct tm in time.h cat > conftest.c <<EOF #include <sys/types.h> #include <time.h> int main() { exit(0); } int t() { struct tm *tp; } EOF if eval $compile; then : else { test -n "$verbose" && \ echo " defining TM_IN_SYS_TIME" DEFS="$DEFS -DTM_IN_SYS_TIME=1" SEDDEFS="${SEDDEFS}\${SEDdA}TM_IN_SYS_TIME\${SEDdB}TM_IN_SYS_TIME\${SEDdC}1\${SEDdD} \${SEDuA}TM_IN_SYS_TIME\${SEDuB}TM_IN_SYS_TIME\${SEDuC}1\${SEDuD} \${SEDeA}TM_IN_SYS_TIME\${SEDeB}TM_IN_SYS_TIME\${SEDeC}1\${SEDeD} " } fi rm -f conftest* decl='#include <sys/types.h> ' case "$DEFS" in *TM_IN_SYS_TIME*) decl="$decl #include <sys/time.h> " ;; *) decl="$decl #include <time.h> " ;; esac echo checking for tm_zone in struct tm cat > conftest.c <<EOF $decl int main() { exit(0); } int t() { struct tm tm; tm.tm_zone; } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining HAVE_TM_ZONE" DEFS="$DEFS -DHAVE_TM_ZONE=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TM_ZONE\${SEDdB}HAVE_TM_ZONE\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_TM_ZONE\${SEDuB}HAVE_TM_ZONE\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_TM_ZONE\${SEDeB}HAVE_TM_ZONE\${SEDeC}1\${SEDeD} " } else no_tm_zone=1 fi rm -f conftest* if test -n "$no_tm_zone"; then echo checking for tzname cat > conftest.c <<EOF #include <time.h> #ifndef tzname /* For SGI. */ extern char *tzname[]; /* RS6000 and others want it this way. */ #endif int main() { exit(0); } int t() { atoi(*tzname); } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining HAVE_TZNAME" DEFS="$DEFS -DHAVE_TZNAME=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TZNAME\${SEDdB}HAVE_TZNAME\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_TZNAME\${SEDuB}HAVE_TZNAME\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_TZNAME\${SEDeB}HAVE_TZNAME\${SEDeC}1\${SEDeD} " } fi rm -f conftest* fi prog='/* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25,17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; }' echo checking for working const cat > conftest.c <<EOF int main() { exit(0); } int t() { $prog } EOF if eval $compile; then : else { test -n "$verbose" && \ echo " defining const to be empty" DEFS="$DEFS -Dconst=" SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD} \${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD} \${SEDeA}const\${SEDeB}const\${SEDeC}\${SEDeD} " } fi rm -f conftest* echo checking for long file names lost=false # Test for long file names in all the places we know might matter: # . the current directory, where building will happen # /tmp where it might want to write temporary files # /usr/tmp likewise # $prefix where we will be installing things # $exec_prefix likewise for dir in . /tmp /usr/tmp $prefix $exec_prefix ; do test -w $dir || { echo \ warning: cannot write $dir to see if it supports long file names continue; } (echo 1 > $dir/conftest9012345) 2>/dev/null (echo 2 > $dir/conftest9012346) 2>/dev/null val=`cat $dir/conftest9012345 2>/dev/null` test -f $dir/conftest9012345 && test "$val" = 1 || lost=true rm -f $dir/conftest9012345 $dir/conftest9012346 2> /dev/null done $lost || { test -n "$verbose" && \ echo " defining HAVE_LONG_FILE_NAMES" DEFS="$DEFS -DHAVE_LONG_FILE_NAMES=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONG_FILE_NAMES\${SEDdB}HAVE_LONG_FILE_NAMES\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_LONG_FILE_NAMES\${SEDuB}HAVE_LONG_FILE_NAMES\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_LONG_FILE_NAMES\${SEDeB}HAVE_LONG_FILE_NAMES\${SEDeC}1\${SEDeD} " } #### Choose a window system. echo "Checking window system." window_system='' case "${with_x}" in yes ) window_system=${window_system}x11 ;; no ) window_system=${window_system}none esac case "${with_x11}" in yes ) window_system=${window_system}x11 ;; esac case "${with_x10}" in yes ) window_system=${window_system}x10 ;; esac case "${window_system}" in "none" | "x11" | "x10" ) ;; "" ) # --x-includes or --x-libraries implies --with-x11. if [ -n "${x_includes}" ] || [ -n "${x_libraries}" ]; then window_system=x11 else echo " No window system specified. Looking for X11." # If the user didn't specify a window system and we found X11, use it. if [ -r /usr/lib/libX11.a \ -o -d /usr/include/X11 \ -o -d /usr/X386/include \ -o -d ${x_includes}/X11 ]; then window_system=x11 fi fi ;; * ) echo "Don't specify a window system more than once." >&2 exit 1 ;; esac case "${window_system}" in "" | "x11" ) ### If the user hasn't specified where we should find X, try ### letting autoconf figure that out. if [ -z "${x_includes}" ] && [ -z "${x_libraries}" ]; then # If we find X, set shell vars x_includes and x_libraries to the paths. echo checking for X include and library files with xmkmf rm -fr conftestdir if mkdir conftestdir; then cd conftestdir cat > Imakefile <<\EOF acfindx: @echo "temp_includes=$(INCROOT); temp_libraries=$(USRLIBDIR)" EOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then eval `make acfindx` case "$temp_includes" in /usr/include) ;; *) x_includes="$temp_includes" ;; esac case "$temp_libraries" in /usr/lib | /lib) ;; *) x_libraries="$temp_libraries" ;; esac fi cd .. rm -fr conftestdir fi fi if [ -n "${x_includes}" ] || [ -n "${x_libraries}" ]; then window_system=x11 fi ;; esac [ -z "${window_system}" ] && window_system=none [ -n "${x_libraries}" ] && LD_SWITCH_X_SITE="-L${x_libraries}" [ -n "${x_includes}" ] && C_SWITCH_X_SITE="-I${x_includes}" case "${window_system}" in x11 ) HAVE_X_WINDOWS=yes HAVE_X11=yes echo " Using X11." ;; x10 ) HAVE_X_WINDOWS=yes HAVE_X11=no echo " Using X10." ;; none ) HAVE_X_WINDOWS=no HAVE_X11=no echo " Using no window system." ;; esac ### If we're using X11, we should use the X menu package. HAVE_X_MENU=no case ${HAVE_X11} in yes ) HAVE_X_MENU=yes ;; esac #### Extract some information from the operating system and machine files. echo "Examining the machine- and system-dependent files to find out" echo " - which libraries the lib-src programs will want, and" echo " - whether the GNU malloc routines are usable." ### It's not important that this name contain the PID; you can't run ### two configures in the same directory and have anything work ### anyway. tempcname="conftest.c" echo ' #include "'${srcdir}'/src/'${opsysfile}'" #include "'${srcdir}'/src/'${machfile}'" #ifndef LIBS_MACHINE #define LIBS_MACHINE #endif #ifndef LIBS_SYSTEM #define LIBS_SYSTEM #endif #ifndef C_SWITCH_SYSTEM #define C_SWITCH_SYSTEM #endif @configure@ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM @configure@ c_switch_system=C_SWITCH_SYSTEM #ifndef LIB_X11_LIB #define LIB_X11_LIB -lX11 #endif #ifndef LIBX11_MACHINE #define LIBX11_MACHINE #endif #ifndef LIBX11_SYSTEM #define LIBX11_SYSTEM #endif @configure@ LIBX=LIB_X11_LIB LIBX11_MACHINE LIBX11_SYSTEM #ifdef UNEXEC @configure@ unexec=UNEXEC #else @configure@ unexec=unexec.o #endif #ifdef SYSTEM_MALLOC @configure@ system_malloc=yes #else @configure@ system_malloc=no #endif #ifndef C_DEBUG_SWITCH #define C_DEBUG_SWITCH -g #endif #ifndef C_OPTIMIZE_SWITCH #define C_OPTIMIZE_SWITCH -O #endif #ifdef __GNUC__ @configure@ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH #else @configure@ CFLAGS=C_DEBUG_SWITCH #endif ' > ${tempcname} # The value of CPP is a quoted variable reference, so we need to do this # to get its actual value... CPP=`eval "echo $CPP"` eval `${CPP} -Isrc ${tempcname} \ | grep '@configure@' \ | sed -e 's/^@configure@ \([^=]*=\)\(.*\)$/\1"\2"/'` rm ${tempcname} ### Compute the unexec source name from the object name. UNEXEC_SRC="`echo ${unexec} | sed 's/\.o/.c/'`" # Do the opsystem or machine files prohibit the use of the GNU malloc? # Assume not, until told otherwise. GNU_MALLOC=yes if [ "${system_malloc}" = "yes" ]; then GNU_MALLOC=no GNU_MALLOC_reason=" (The GNU allocators don't work with this system configuration.)" fi if [ x"${REL_ALLOC}" = x ]; then REL_ALLOC=${GNU_MALLOC} fi LISP_FLOAT_TYPE=yes #### Add the libraries to LIBS and check for some functions. DEFS="$c_switch_system $DEFS" LIBS="$libsrc_libs" LIBS_save="${LIBS}" LIBS="${LIBS} -ldnet" have_lib="" echo checking for -ldnet cat > conftest.c <<EOF int main() { exit(0); } int t() { main(); } EOF if eval $compile; then have_lib="1" fi rm -f conftest* LIBS="${LIBS_save}" if test -n "${have_lib}"; then { test -n "$verbose" && \ echo " defining HAVE_LIBDNET" DEFS="$DEFS -DHAVE_LIBDNET=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIBDNET\${SEDdB}HAVE_LIBDNET\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_LIBDNET\${SEDuB}HAVE_LIBDNET\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_LIBDNET\${SEDeB}HAVE_LIBDNET\${SEDeC}1\${SEDeD} " } LIBS="${LIBS} -ldnet" fi LIBS_save="${LIBS}" LIBS="${LIBS} -lXbsd" have_lib="" echo checking for -lXbsd cat > conftest.c <<EOF int main() { exit(0); } int t() { main(); } EOF if eval $compile; then have_lib="1" fi rm -f conftest* LIBS="${LIBS_save}" if test -n "${have_lib}"; then :; LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd" if test -d /usr/X386/include; then HAVE_XFREE386=yes test -z "${C_SWITCH_X_SITE}" && C_SWITCH_X_SITE="-I/usr/X386/include" fi else :; fi if test "${HAVE_X11}" = "yes"; then DEFS="$C_SWITCH_X_SITE $DEFS" LIBS="$LD_SWITCH_X_SITE $LIBX $LIBS" for func in XrmSetDatabase XScreenResourceString XScreenNumberOfScreen do trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'` echo checking for ${func} cat > conftest.c <<EOF #include <ctype.h> int main() { exit(0); } int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_${func}) || defined (__stub___${func}) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char ${func}(); ${func}(); #endif } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining ${trfunc}" DEFS="$DEFS -D${trfunc}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD} " } fi rm -f conftest* done fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo checking for working alloca.h cat > conftest.c <<EOF #include <alloca.h> int main() { exit(0); } int t() { char *p = alloca(2 * sizeof(int)); } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining HAVE_ALLOCA_H" DEFS="$DEFS -DHAVE_ALLOCA_H=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD} " } fi rm -f conftest* decl="#ifdef __GNUC__ #define alloca __builtin_alloca #else #if HAVE_ALLOCA_H #include <alloca.h> #else #ifdef _AIX #pragma alloca #else char *alloca (); #endif #endif #endif " echo checking for alloca cat > conftest.c <<EOF $decl int main() { exit(0); } int t() { char *p = (char *) alloca(1); } EOF if eval $compile; then : else alloca_missing=1 cat > conftest.c <<EOF #if defined(CRAY) && ! defined(CRAY2) winnitude #else lossage #endif EOF eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" if egrep "winnitude" conftest.out >/dev/null 2>&1; then echo checking for _getb67 cat > conftest.c <<EOF #include <ctype.h> int main() { exit(0); } int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub__getb67) || defined (__stub____getb67) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char _getb67(); _getb67(); #endif } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining CRAY_STACKSEG_END to be _getb67" DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}_getb67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}_getb67\${SEDuD} \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}_getb67\${SEDeD} " } else echo checking for GETB67 cat > conftest.c <<EOF #include <ctype.h> int main() { exit(0); } int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_GETB67) || defined (__stub___GETB67) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char GETB67(); GETB67(); #endif } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining CRAY_STACKSEG_END to be GETB67" DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}GETB67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}GETB67\${SEDuD} \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}GETB67\${SEDeD} " } else echo checking for getb67 cat > conftest.c <<EOF #include <ctype.h> int main() { exit(0); } int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getb67) || defined (__stub___getb67) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char getb67(); getb67(); #endif } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining CRAY_STACKSEG_END to be getb67" DEFS="$DEFS -DCRAY_STACKSEG_END=getb67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}getb67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}getb67\${SEDuD} \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}getb67\${SEDeD} " } fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* if test -n "$alloca_missing"; then # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=alloca.o echo 'checking stack direction for C alloca' echo checking whether cross-compiling # If we cannot run a trivial program, we must be cross compiling. cat > conftest.c <<EOF main(){exit(0);} EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then : else cross_compiling=1 fi rm -f conftest* if test -n "$cross_compiling" then { test -n "$verbose" && \ echo " defining STACK_DIRECTION to be 0" DEFS="$DEFS -DSTACK_DIRECTION=0" SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}0\${SEDdD} \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}0\${SEDuD} \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}0\${SEDeD} " } else cat > conftest.c <<EOF find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } main () { exit (find_stack_direction() < 0); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining STACK_DIRECTION to be 1" DEFS="$DEFS -DSTACK_DIRECTION=1" SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}1\${SEDdD} \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}1\${SEDuD} \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}1\${SEDeD} " } else { test -n "$verbose" && \ echo " defining STACK_DIRECTION to be -1" DEFS="$DEFS -DSTACK_DIRECTION=-1" SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}-1\${SEDdD} \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}-1\${SEDuD} \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}-1\${SEDeD} " } fi fi rm -f conftest* fi # logb and frexp are found in -lm on most systems. LIBS_save="${LIBS}" LIBS="${LIBS} -lm" have_lib="" echo checking for -lm cat > conftest.c <<EOF int main() { exit(0); } int t() { main(); } EOF if eval $compile; then have_lib="1" fi rm -f conftest* LIBS="${LIBS_save}" if test -n "${have_lib}"; then { test -n "$verbose" && \ echo " defining HAVE_LIBM" DEFS="$DEFS -DHAVE_LIBM=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIBM\${SEDdB}HAVE_LIBM\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_LIBM\${SEDuB}HAVE_LIBM\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_LIBM\${SEDeB}HAVE_LIBM\${SEDeC}1\${SEDeD} " } LIBS="${LIBS} -lm" fi for func in gettimeofday gethostname dup2 rename closedir mkdir rmdir random bcopy logb frexp ftime do trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'` echo checking for ${func} cat > conftest.c <<EOF #include <ctype.h> int main() { exit(0); } int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_${func}) || defined (__stub___${func}) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char ${func}(); ${func}(); #endif } EOF if eval $compile; then { test -n "$verbose" && \ echo " defining ${trfunc}" DEFS="$DEFS -D${trfunc}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD} " } fi rm -f conftest* done ok_so_far=true echo checking for socket cat > conftest.c <<EOF #include <ctype.h> int main() { exit(0); } int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_socket) || defined (__stub___socket) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char socket(); socket(); #endif } EOF if eval $compile; then : else ok_so_far= fi rm -f conftest* if test -n "$ok_so_far"; then echo checking for netinet/in.h cat > conftest.c <<EOF #include <netinet/in.h> EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then : else ok_so_far= fi rm -f conftest* fi if test -n "$ok_so_far"; then echo checking for arpa/inet.h cat > conftest.c <<EOF #include <arpa/inet.h> EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then : else ok_so_far= fi rm -f conftest* fi if test -n "$ok_so_far"; then { test -n "$verbose" && \ echo " defining HAVE_INET_SOCKETS" DEFS="$DEFS -DHAVE_INET_SOCKETS=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_INET_SOCKETS\${SEDdB}HAVE_INET_SOCKETS\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_INET_SOCKETS\${SEDuB}HAVE_INET_SOCKETS\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_INET_SOCKETS\${SEDeB}HAVE_INET_SOCKETS\${SEDeC}1\${SEDeD} " } fi #### Find out which version of Emacs this is. version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \ | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'` if [ x"${version}" = x ]; then echo "${progname}: can't find current emacs version in \`${srcdir}/lisp/version.el'." >&2 exit 1 fi if [ -f /usr/lpp/X11/bin/smt.exp ]; then { test -n "$verbose" && \ echo " defining HAVE_AIX_SMT_EXP" DEFS="$DEFS -DHAVE_AIX_SMT_EXP=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_AIX_SMT_EXP\${SEDdB}HAVE_AIX_SMT_EXP\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_AIX_SMT_EXP\${SEDuB}HAVE_AIX_SMT_EXP\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_AIX_SMT_EXP\${SEDeB}HAVE_AIX_SMT_EXP\${SEDeC}1\${SEDeD} " } fi #### Specify what sort of things we'll be editing into Makefile and config.h. ### Use configuration here uncanonicalized to avoid exceeding size limits. { test -n "$verbose" && \ echo " defining config_machfile to be "\"${machfile}\""" DEFS="$DEFS -Dconfig_machfile="\"${machfile}\""" SEDDEFS="${SEDDEFS}\${SEDdA}config_machfile\${SEDdB}config_machfile\${SEDdC}"\"${machfile}\""\${SEDdD} \${SEDuA}config_machfile\${SEDuB}config_machfile\${SEDuC}"\"${machfile}\""\${SEDuD} \${SEDeA}config_machfile\${SEDeB}config_machfile\${SEDeC}"\"${machfile}\""\${SEDeD} " } { test -n "$verbose" && \ echo " defining config_opsysfile to be "\"${opsysfile}\""" DEFS="$DEFS -Dconfig_opsysfile="\"${opsysfile}\""" SEDDEFS="${SEDDEFS}\${SEDdA}config_opsysfile\${SEDdB}config_opsysfile\${SEDdC}"\"${opsysfile}\""\${SEDdD} \${SEDuA}config_opsysfile\${SEDuB}config_opsysfile\${SEDuC}"\"${opsysfile}\""\${SEDuD} \${SEDeA}config_opsysfile\${SEDeB}config_opsysfile\${SEDeC}"\"${opsysfile}\""\${SEDeD} " } { test -n "$verbose" && \ echo " defining LD_SWITCH_X_SITE to be ${LD_SWITCH_X_SITE}" DEFS="$DEFS -DLD_SWITCH_X_SITE=${LD_SWITCH_X_SITE}" SEDDEFS="${SEDDEFS}\${SEDdA}LD_SWITCH_X_SITE\${SEDdB}LD_SWITCH_X_SITE\${SEDdC}${LD_SWITCH_X_SITE}\${SEDdD} \${SEDuA}LD_SWITCH_X_SITE\${SEDuB}LD_SWITCH_X_SITE\${SEDuC}${LD_SWITCH_X_SITE}\${SEDuD} \${SEDeA}LD_SWITCH_X_SITE\${SEDeB}LD_SWITCH_X_SITE\${SEDeC}${LD_SWITCH_X_SITE}\${SEDeD} " } { test -n "$verbose" && \ echo " defining C_SWITCH_X_SITE to be ${C_SWITCH_X_SITE}" DEFS="$DEFS -DC_SWITCH_X_SITE=${C_SWITCH_X_SITE}" SEDDEFS="${SEDDEFS}\${SEDdA}C_SWITCH_X_SITE\${SEDdB}C_SWITCH_X_SITE\${SEDdC}${C_SWITCH_X_SITE}\${SEDdD} \${SEDuA}C_SWITCH_X_SITE\${SEDuB}C_SWITCH_X_SITE\${SEDuC}${C_SWITCH_X_SITE}\${SEDuD} \${SEDeA}C_SWITCH_X_SITE\${SEDeB}C_SWITCH_X_SITE\${SEDeC}${C_SWITCH_X_SITE}\${SEDeD} " } { test -n "$verbose" && \ echo " defining UNEXEC_SRC to be ${UNEXEC_SRC}" DEFS="$DEFS -DUNEXEC_SRC=${UNEXEC_SRC}" SEDDEFS="${SEDDEFS}\${SEDdA}UNEXEC_SRC\${SEDdB}UNEXEC_SRC\${SEDdC}${UNEXEC_SRC}\${SEDdD} \${SEDuA}UNEXEC_SRC\${SEDuB}UNEXEC_SRC\${SEDuC}${UNEXEC_SRC}\${SEDuD} \${SEDeA}UNEXEC_SRC\${SEDeB}UNEXEC_SRC\${SEDeC}${UNEXEC_SRC}\${SEDeD} " } if [ "${HAVE_X_WINDOWS}" = "yes" ] ; then { test -n "$verbose" && \ echo " defining HAVE_X_WINDOWS" DEFS="$DEFS -DHAVE_X_WINDOWS=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_X_WINDOWS\${SEDdB}HAVE_X_WINDOWS\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_X_WINDOWS\${SEDuB}HAVE_X_WINDOWS\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_X_WINDOWS\${SEDeB}HAVE_X_WINDOWS\${SEDeC}1\${SEDeD} " } fi if [ "${HAVE_X11}" = "yes" ] ; then { test -n "$verbose" && \ echo " defining HAVE_X11" DEFS="$DEFS -DHAVE_X11=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_X11\${SEDdB}HAVE_X11\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_X11\${SEDuB}HAVE_X11\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_X11\${SEDeB}HAVE_X11\${SEDeC}1\${SEDeD} " } fi if [ "${HAVE_XFREE386}" = "yes" ] ; then { test -n "$verbose" && \ echo " defining HAVE_XFREE386" DEFS="$DEFS -DHAVE_XFREE386=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_XFREE386\${SEDdB}HAVE_XFREE386\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_XFREE386\${SEDuB}HAVE_XFREE386\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_XFREE386\${SEDeB}HAVE_XFREE386\${SEDeC}1\${SEDeD} " } fi if [ "${HAVE_X_MENU}" = "yes" ] ; then { test -n "$verbose" && \ echo " defining HAVE_X_MENU" DEFS="$DEFS -DHAVE_X_MENU=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_X_MENU\${SEDdB}HAVE_X_MENU\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_X_MENU\${SEDuB}HAVE_X_MENU\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_X_MENU\${SEDeB}HAVE_X_MENU\${SEDeC}1\${SEDeD} " } fi if [ "${GNU_MALLOC}" = "yes" ] ; then { test -n "$verbose" && \ echo " defining GNU_MALLOC" DEFS="$DEFS -DGNU_MALLOC=1" SEDDEFS="${SEDDEFS}\${SEDdA}GNU_MALLOC\${SEDdB}GNU_MALLOC\${SEDdC}1\${SEDdD} \${SEDuA}GNU_MALLOC\${SEDuB}GNU_MALLOC\${SEDuC}1\${SEDuD} \${SEDeA}GNU_MALLOC\${SEDeB}GNU_MALLOC\${SEDeC}1\${SEDeD} " } fi if [ "${REL_ALLOC}" = "yes" ] ; then { test -n "$verbose" && \ echo " defining REL_ALLOC" DEFS="$DEFS -DREL_ALLOC=1" SEDDEFS="${SEDDEFS}\${SEDdA}REL_ALLOC\${SEDdB}REL_ALLOC\${SEDdC}1\${SEDdD} \${SEDuA}REL_ALLOC\${SEDuB}REL_ALLOC\${SEDuC}1\${SEDuD} \${SEDeA}REL_ALLOC\${SEDeB}REL_ALLOC\${SEDeC}1\${SEDeD} " } fi if [ "${LISP_FLOAT_TYPE}" = "yes" ] ; then { test -n "$verbose" && \ echo " defining LISP_FLOAT_TYPE" DEFS="$DEFS -DLISP_FLOAT_TYPE=1" SEDDEFS="${SEDDEFS}\${SEDdA}LISP_FLOAT_TYPE\${SEDdB}LISP_FLOAT_TYPE\${SEDdC}1\${SEDdD} \${SEDuA}LISP_FLOAT_TYPE\${SEDuB}LISP_FLOAT_TYPE\${SEDuC}1\${SEDuD} \${SEDeA}LISP_FLOAT_TYPE\${SEDeB}LISP_FLOAT_TYPE\${SEDeC}1\${SEDeD} " } fi #### Report on what we decided to do. echo " Configured for \`${canonical}'. Where should the build process find the source code? ${srcdir} What operating system and machine description files should Emacs use? \`${opsysfile}' and \`${machfile}' What compiler should emacs be built with? ${CC} ${CFLAGS} Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason} Should Emacs use the relocating allocator for buffers? ${REL_ALLOC} What window system should Emacs use? ${window_system}${x_includes+ Where do we find X Windows header files? }${x_includes}${x_libraries+ Where do we find X Windows libraries? }${x_libraries} " # Remove any trailing slashes in these variables. test -n "${prefix}" && prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'` test -n "${exec_prefix}" && exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'` if test -n "$prefix"; then test -z "$exec_prefix" && exec_prefix='${prefix}' prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" fi if test -n "$exec_prefix"; then prsub="$prsub s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%" fi cat >conftest.def <<EOF $DEFS EOF escape_ampersand_and_backslash='s%[&\\]%\\&%g' DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def` rm -f conftest.def trap 'rm -f config.status; exit 1' 1 3 15 echo creating config.status rm -f config.status cat > config.status <<EOF #!/bin/sh # Generated automatically by configure. # Run this file to recreate the current configuration. # This directory was configured as follows, # on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # # $0 $configure_args for arg do case "\$arg" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo running /bin/sh $0 $configure_args exec /bin/sh $0 $configure_args ;; *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; esac done trap 'rm -fr Makefile src/config.h conftest*; exit 1' 1 3 15 CC='$CC' LN_S='$LN_S' CPP='$CPP' INSTALL='$INSTALL' INSTALL_PROGRAM='$INSTALL_PROGRAM' INSTALL_DATA='$INSTALL_DATA' YACC='$YACC' ALLOCA='$ALLOCA' configuration='$configuration' version='$version' srcdir='$srcdir' c_switch_system='$c_switch_system' libsrc_libs='$libsrc_libs' rip_paths='$rip_paths' inst_paths='$inst_paths' LD_SWITCH_X_SITE='$LD_SWITCH_X_SITE' C_SWITCH_X_SITE='$C_SWITCH_X_SITE' CFLAGS='$CFLAGS' prefix='$prefix' exec_prefix='$exec_prefix' LIBS='$LIBS' prefix='$prefix' exec_prefix='$exec_prefix' prsub='$prsub' EOF cat >> config.status <<\EOF top_srcdir=$srcdir # Allow make-time overrides of the generated file list. test -n "$gen_files" || gen_files="Makefile" for file in .. $gen_files; do if [ "x$file" != "x.." ]; then srcdir=$top_srcdir # Remove last slash and all that follows it. Not all systems have dirname. dir=`echo $file|sed 's%/[^/][^/]*$%%'` if test "$dir" != "$file"; then test "$top_srcdir" != . && srcdir=$top_srcdir/$dir test ! -d $dir && mkdir $dir fi echo creating $file rm -f $file echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file sed -e " $prsub s%@CC@%$CC%g s%@LN_S@%$LN_S%g s%@CPP@%$CPP%g s%@INSTALL@%$INSTALL%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@YACC@%$YACC%g s%@ALLOCA@%$ALLOCA%g s%@configuration@%$configuration%g s%@version@%$version%g s%@srcdir@%$srcdir%g s%@c_switch_system@%$c_switch_system%g s%@libsrc_libs@%$libsrc_libs%g s%@rip_paths@%$rip_paths%g s%@inst_paths@%$inst_paths%g s%@LD_SWITCH_X_SITE@%$LD_SWITCH_X_SITE%g s%@C_SWITCH_X_SITE@%$C_SWITCH_X_SITE%g s%@CFLAGS@%$CFLAGS%g s%@prefix@%$prefix%g s%@exec_prefix@%$exec_prefix%g s%@LIBS@%$LIBS%g s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file fi; done test -n "$gen_config" || gen_config=src/config.h echo creating $gen_config # These sed commands are put into SEDDEFS when defining a macro. # They are broken into pieces to make the sed script easier to manage. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME # is the cpp macro being defined and VALUE is the value it is being given. # Each defining turns into a single global substitution command. # # SEDd sets the value in "#define NAME VALUE" lines. SEDdA='s@^\([ ]*\)#\([ ]*define[ ][ ]*\)' SEDdB='\([ ][ ]*\)[^ ]*@\1#\2' SEDdC='\3' SEDdD='@g' # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE". SEDuA='s@^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' SEDuB='\([ ]\)@\1#\2define\3' SEDuC=' ' SEDuD='\4@g' # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE". SEDeA='s@^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' SEDeB='$@\1#\2define\3' SEDeC=' ' SEDeD='@g' rm -f conftest.sed EOF # Turn off quoting long enough to insert the sed commands. rm -f conftest.sh cat > conftest.sh <<EOF $SEDDEFS EOF # Maximum number of lines to put in a single here document. maxshlines=9 # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit # on the size of here documents. while : do lines=`grep -c . conftest.sh` if test -z "$lines" || test "$lines" -eq 0; then break; fi rm -f conftest.s1 conftest.s2 sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20. sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21. # Write a limited-size here document to append to conftest.sed. echo 'cat >> conftest.sed <<CONFEOF' >> config.status cat conftest.s1 >> config.status echo 'CONFEOF' >> config.status rm -f conftest.s1 conftest.sh mv conftest.s2 conftest.sh done rm -f conftest.sh # Now back to your regularly scheduled config.status. cat >> config.status <<\EOF # This sed command replaces #undef's with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it in # src/config.h. cat >> conftest.sed <<\CONFEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, CONFEOF rm -f conftest.h # Break up the sed commands because old seds have small limits. maxsedlines=20 cp $top_srcdir/$gen_config.in conftest.h1 while : do lines=`grep -c . conftest.sed` if test -z "$lines" || test "$lines" -eq 0; then break; fi rm -f conftest.s1 conftest.s2 conftest.h2 sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20. sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21. sed -f conftest.s1 < conftest.h1 > conftest.h2 rm -f conftest.s1 conftest.h1 conftest.sed mv conftest.h2 conftest.h1 mv conftest.s2 conftest.sed done rm -f conftest.sed conftest.h echo "/* $gen_config. Generated automatically by configure. */" > conftest.h cat conftest.h1 >> conftest.h rm -f conftest.h1 if cmp -s $gen_config conftest.h 2>/dev/null; then # The file exists and we would not be changing it. rm -f conftest.h else rm -f $gen_config mv conftest.h $gen_config fi exit 0 EOF chmod +x config.status test -n "$no_create" || ./config.status /******************* emacs-19.19/config.sub *****************/ #!/bin/sh # Configuration validation subroutine script, version 1.1. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. #This file is free software; you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation; either version 2 of the License, or #(at your option) any later version. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. #You should have received a copy of the GNU General Public License #along with this program; if not, write to the Free Software #Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # First pass through any local machine types. case $1 in *local*) echo $1 exit 0 ;; *) ;; esac # Separate what the user gave into CPU-COMPANY and OS (if any). basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next* | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp ) os= basic_machine=$1 ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` ;; -lynx) os=-lynxos ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types with without company name. # Some are omitted here because they have special meanings below. tahoe | i[34]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \ | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \ | alpha | we32k | ns16k | clipper | sparclite | i370 | sh) basic_machine=$basic_machine-unknown ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with with company name. vax-* | tahoe-* | i[34]86-* | i860-* | m68k-* | m68000-* | m88k-* \ | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ | sh-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; i370-ibm* | ibm*) basic_machine=i370-ibm os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` os=-sysv32 ;; i[34]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` os=-sysv4 ;; i[34]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` os=-sysv ;; i[34]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` os=-solaris2 ;; spur) basic_machine=spur-unknown ;; alliant | fx80) basic_machine=fx80-alliant ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; m88k-omron*) basic_machine=m88k-omron ;; merlin) basic_machine=ns32k-utek os=-sysv ;; crds | unos) basic_machine=m68k-crds ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; genix) basic_machine=ns32k-ns ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; balance) basic_machine=ns32k-sequent os=-dynix ;; pc532) basic_machine=ns32k-pc532 ;; symmetry) basic_machine=i386-sequent os=-dynix ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun3) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; ps2) basic_machine=i386-ibm ;; fx2800) basic_machine=i860-alliant ;; next) basic_machine=m68k-next os=-bsd ;; amiga) basic_machine=m68k-cbm ;; amigados) basic_machine=m68k-cbm os=-amigados ;; amigaunix | amix) basic_machine=m68k-cbm os=-sysv4 ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k31[0-9] | hp9k2[0-9][0-9]) basic_machine=m68000-hp ;; hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; altos | altos3068) basic_machine=m68k-altos ;; miniframe) basic_machine=m68000-convergent ;; tower | tower-32) basic_machine=m68k-ncr ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; xmp) basic_machine=xmp-cray os=-unicos ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; sh) basic_machine=sh-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp os=-hpux ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp os=-hpux ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; news1000) basic_machine=m68030-sony os=-newsos ;; nindy960) basic_machine=i960-intel os=-nindy ;; pn) basic_machine=pn-gould ;; np1) basic_machine=np1-gould ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; xps | xps100) basic_machine=xps100-honeywell ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. mips) basic_machine=mips-mips ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; we32k) basic_machine=we32k-att ;; sparc) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; # First accept the basic system types. # The portable systems comes first. # Each alternative must end in a *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]* | -hpux* \ | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \ | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \ | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \ | -386bsd* | -lynxos* | -netbsd*) ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -ctix* | -uts*) os=-sysv ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -xenix) os=-xenix ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $1 | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-dec | vax-*) os=-ultrix4.2 ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-ibm) os=-aix ;; *-hp) os=-hpux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigados ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m88k-omron*) os=-luna ;; *-sequent) os=-bsd ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-bsd ;; i[34]86-*) os=-sco3.2v2 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-masscomp) os=-rtu ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -sunos*) vendor=sun ;; -lynxos*) vendor=lynx ;; -aix*) vendor=ibm ;; -hpux*) vendor=hp ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs*) vendor=ibm ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os /********************** emacs-19.19/src/unexec.c *******************/ /* Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * unexec.c - Convert a running program into an a.out file. * * Author: Spencer W. Thomas * Computer Science Dept. * University of Utah * Date: Tue Mar 2 1982 * Modified heavily since then. * * Synopsis: * unexec (new_name, a_name, data_start, bss_start, entry_address) * char *new_name, *a_name; * unsigned data_start, bss_start, entry_address; * * Takes a snapshot of the program and makes an a.out format file in the * file named by the string argument new_name. * If a_name is non-NULL, the symbol table will be taken from the given file. * On some machines, an existing a_name file is required. * * The boundaries within the a.out file may be adjusted with the data_start * and bss_start arguments. Either or both may be given as 0 for defaults. * * Data_start gives the boundary between the text segment and the data * segment of the program. The text segment can contain shared, read-only * program code and literal data, while the data segment is always unshared * and unprotected. Data_start gives the lowest unprotected address. * The value you specify may be rounded down to a suitable boundary * as required by the machine you are using. * * Specifying zero for data_start means the boundary between text and data * should not be the same as when the program was loaded. * If NO_REMAP is defined, the argument data_start is ignored and the * segment boundaries are never changed. * * Bss_start indicates how much of the data segment is to be saved in the * a.out file and restored when the program is executed. It gives the lowest * unsaved address, and is rounded up to a page boundary. The default when 0 * is given assumes that the entire data segment is to be stored, including * the previous data and bss as well as any additional storage allocated with * break (2). * * The new file is set up to start at entry_address. * * If you make improvements I'd like to get them too. * harpo!utah-cs!thomas, thomas@Utah-20 * */ /* Modified to support SysVr3 shared libraries by James Van Artsdalen * of Dell Computer Corporation. james@bigtex.cactus.org. */ /* There are several compilation parameters affecting unexec: * COFF Define this if your system uses COFF for executables. * COFF_ENCAPSULATE Define this if you are using the GNU coff encapsulated a.out format. This is closer to a.out than COFF. You should *not* define COFF if you define COFF_ENCAPSULATE Otherwise we assume you use Berkeley format. * NO_REMAP Define this if you do not want to try to save Emacs's pure data areas as part of the text segment. Saving them as text is good because it allows users to share more. However, on machines that locate the text area far from the data area, the boundary cannot feasibly be moved. Such machines require NO_REMAP. Also, remapping can cause trouble with the built-in startup routine /lib/crt0.o, which defines `environ' as an initialized variable. Dumping `environ' as pure does not work! So, to use remapping, you must write a startup routine for your machine in Emacs's crt0.c. If NO_REMAP is defined, Emacs uses the system's crt0.o. * SECTION_ALIGNMENT Some machines that use COFF executables require that each section start on a certain boundary *in the COFF file*. Such machines should define SECTION_ALIGNMENT to a mask of the low-order bits that must be zero on such a boundary. This mask is used to control padding between segments in the COFF file. If SECTION_ALIGNMENT is not defined, the segments are written consecutively with no attempt at alignment. This is right for unmodified system V. * SEGMENT_MASK Some machines require that the beginnings and ends of segments *in core* be on certain boundaries. For most machines, a page boundary is sufficient. That is the default. When a larger boundary is needed, define SEGMENT_MASK to a mask of the bits that must be zero on such a boundary. * A_TEXT_OFFSET(HDR) Some machines count the a.out header as part of the size of the text segment (a_text); they may actually load the header into core as the first data in the text segment. Some have additional padding between the header and the real text of the program that is counted in a_text. For these machines, define A_TEXT_OFFSET(HDR) to examine the header structure HDR and return the number of bytes to add to `a_text' before writing it (above and beyond the number of bytes of actual program text). HDR's standard fields are already correct, except that this adjustment to the `a_text' field has not yet been made; thus, the amount of offset can depend on the data in the file. * A_TEXT_SEEK(HDR) If defined, this macro specifies the number of bytes to seek into the a.out file before starting to write the text segment.a * EXEC_MAGIC For machines using COFF, this macro, if defined, is a value stored into the magic number field of the output file. * ADJUST_EXEC_HEADER This macro can be used to generate statements to adjust or initialize nonstandard fields in the file header * ADDR_CORRECT(ADDR) Macro to correct an int which is the bit pattern of a pointer to a byte into an int which is the number of a byte. This macro has a default definition which is usually right. This default definition is a no-op on most machines (where a pointer looks like an int) but not on all machines. */ #ifndef emacs #define PERROR(arg) perror (arg); return -1 #else #define IN_UNEXEC #include "config.h" #define PERROR(file) report_error (file, new) #endif #ifndef CANNOT_DUMP /* all rest of file! */ #ifndef CANNOT_UNEXEC /* most of rest of file */ #ifdef COFF_ENCAPSULATE int need_coff_header = 1; #include <coff-encap/a.out.encap.h> /* The location might be a poor assumption */ #else #include <a.out.h> #endif /* Define getpagesize () if the system does not. Note that this may depend on symbols defined in a.out.h */ #include "getpagesize.h" #ifndef makedev /* Try to detect types.h already loaded */ #include <sys/types.h> #endif /* makedev */ #include <stdio.h> #include <sys/stat.h> #include <errno.h> extern char *start_of_text (); /* Start of text */ extern char *start_of_data (); /* Start of initialized data */ #ifdef COFF static long block_copy_start; /* Old executable start point */ static struct filehdr f_hdr; /* File header */ static struct aouthdr f_ohdr; /* Optional file header (a.out) */ long bias; /* Bias to add for growth */ long lnnoptr; /* Pointer to line-number info within file */ #define SYMS_START block_copy_start static long text_scnptr; static long data_scnptr; #else /* not COFF */ #ifdef HPUX extern void *sbrk (); #else #ifdef __STDC__ extern void *sbrk (); #else extern char *sbrk (); #endif /* __STDC__ */ #endif /* HPUX */ #define SYMS_START ((long) N_SYMOFF (ohdr)) /* Some machines override the structure name for an a.out header. */ #ifndef EXEC_HDR_TYPE #define EXEC_HDR_TYPE struct exec #endif #ifdef HPUX #ifdef HP9000S200_ID #define MY_ID HP9000S200_ID #else #include <model.h> #define MY_ID MYSYS #endif /* no HP9000S200_ID */ static MAGIC OLDMAGIC = {MY_ID, SHARE_MAGIC}; static MAGIC NEWMAGIC = {MY_ID, DEMAND_MAGIC}; #define N_TXTOFF(x) TEXT_OFFSET(x) #define N_SYMOFF(x) LESYM_OFFSET(x) static EXEC_HDR_TYPE hdr, ohdr; #else /* not HPUX */ #if defined (USG) && !defined (IBMAIX) && !defined (IRIS) && !defined (COFF_ENCAPSULATE) && !defined (LINUX) static struct bhdr hdr, ohdr; #define a_magic fmagic #define a_text tsize #define a_data dsize #define a_bss bsize #define a_syms ssize #define a_trsize rtsize #define a_drsize rdsize #define a_entry entry #define N_BADMAG(x) \ (((x).fmagic)!=OMAGIC && ((x).fmagic)!=NMAGIC &&\ ((x).fmagic)!=FMAGIC && ((x).fmagic)!=IMAGIC) #define NEWMAGIC FMAGIC #else /* IRIS or IBMAIX or not USG */ static EXEC_HDR_TYPE hdr, ohdr; #define NEWMAGIC ZMAGIC #endif /* IRIS or IBMAIX not USG */ #endif /* not HPUX */ static int unexec_text_start; static int unexec_data_start; static int unexec_real_text_size; static int unexec_real_data_size; #ifdef COFF_ENCAPSULATE /* coffheader is defined in the GNU a.out.encap.h file. */ struct coffheader coffheader; #endif #endif /* not COFF */ static int pagemask; /* Correct an int which is the bit pattern of a pointer to a byte into an int which is the number of a byte. This is a no-op on ordinary machines, but not on all. */ #ifndef ADDR_CORRECT /* Let m-*.h files override this definition */ #define ADDR_CORRECT(x) ((char *)(x) - (char*)0) #endif #ifdef emacs static report_error (file, fd) char *file; int fd; { if (fd) close (fd); error ("Failure operating on %s\n", file); } #endif /* emacs */ #define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1 #define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 #define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 static report_error_1 (fd, msg, a1, a2) int fd; char *msg; int a1, a2; { close (fd); #ifdef emacs error (msg, a1, a2); #else fprintf (stderr, msg, a1, a2); fprintf (stderr, "\n"); #endif } static int make_hdr (); static int copy_text_and_data (); static int copy_sym (); static void mark_x (); static void padfile (); /* **************************************************************** * unexec * * driving logic. */ unexec (new_name, a_name, data_start, bss_start, entry_address) char *new_name, *a_name; unsigned data_start, bss_start, entry_address; { int new, a_out = -1; if (a_name && (a_out = open (a_name, 0)) < 0) { PERROR (a_name); } if ((new = creat (new_name, 0666)) < 0) { PERROR (new_name); } if (make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) < 0 || copy_text_and_data (new, a_out) < 0 || copy_sym (new, a_out, a_name, new_name) < 0 #ifdef COFF #ifndef COFF_BSD_SYMBOLS || adjust_lnnoptrs (new, a_out, new_name) < 0 #endif #endif ) { close (new); /* unlink (new_name); /* Failed, unlink new a.out */ return -1; } close (new); if (a_out >= 0) close (a_out); mark_x (new_name); return 0; } /* **************************************************************** * make_hdr * * Make the header in the new a.out from the header in core. * Modify the text and data sizes. */ static int make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) int new, a_out; unsigned data_start, bss_start, entry_address; char *a_name; char *new_name; { int tem; #ifdef COFF auto struct scnhdr f_thdr; /* Text section header */ auto struct scnhdr f_dhdr; /* Data section header */ auto struct scnhdr f_bhdr; /* Bss section header */ auto struct scnhdr scntemp; /* Temporary section header */ register int scns; #endif /* COFF */ #ifdef USG_SHARED_LIBRARIES extern unsigned int bss_end; #else unsigned int bss_end; #endif pagemask = getpagesize () - 1; /* Adjust text/data boundary. */ #ifdef NO_REMAP data_start = (int) start_of_data (); #else /* not NO_REMAP */ if (!data_start) data_start = (int) start_of_data (); #endif /* not NO_REMAP */ data_start = ADDR_CORRECT (data_start); #ifdef SEGMENT_MASK data_start = data_start & ~SEGMENT_MASK; /* (Down) to segment boundary. */ #else data_start = data_start & ~pagemask; /* (Down) to page boundary. */ #endif bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; bss_end &= ~ pagemask; /* Adjust data/bss boundary. */ if (bss_start != 0) { bss_start = (ADDR_CORRECT (bss_start) + pagemask); /* (Up) to page bdry. */ bss_start &= ~ pagemask; if (bss_start > bss_end) { ERROR1 ("unexec: Specified bss_start (%u) is past end of program", bss_start); } } else bss_start = bss_end; if (data_start > bss_start) /* Can't have negative data size. */ { ERROR2 ("unexec: data_start (%u) can't be greater than bss_start (%u)", data_start, bss_start); } #ifdef COFF /* Salvage as much info from the existing file as possible */ if (a_out >= 0) { if (read (a_out, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr)) { PERROR (a_name); } block_copy_start += sizeof (f_hdr); if (f_hdr.f_opthdr > 0) { if (read (a_out, &f_ohdr, sizeof (f_ohdr)) != sizeof (f_ohdr)) { PERROR (a_name); } block_copy_start += sizeof (f_ohdr); } /* Loop through section headers, copying them in */ for (scns = f_hdr.f_nscns; scns > 0; scns--) { if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp)) { PERROR (a_name); } if (scntemp.s_scnptr > 0L) { if (block_copy_start < scntemp.s_scnptr + scntemp.s_size) block_copy_start = scntemp.s_scnptr + scntemp.s_size; } if (strcmp (scntemp.s_name, ".text") == 0) { f_thdr = scntemp; } else if (strcmp (scntemp.s_name, ".data") == 0) { f_dhdr = scntemp; } else if (strcmp (scntemp.s_name, ".bss") == 0) { f_bhdr = scntemp; } } } else { ERROR0 ("can't build a COFF file from scratch yet"); } /* Now we alter the contents of all the f_*hdr variables to correspond to what we want to dump. */ #ifdef USG_SHARED_LIBRARIES /* The amount of data we're adding to the file is distance from the * end of the original .data space to the current end of the .data * space. */ bias = bss_start - (f_ohdr.data_start + f_dhdr.s_size); #endif f_hdr.f_flags |= (F_RELFLG | F_EXEC); #ifdef TPIX f_hdr.f_nscns = 3; #endif #ifdef EXEC_MAGIC f_ohdr.magic = EXEC_MAGIC; #endif #ifndef NO_REMAP f_ohdr.text_start = (long) start_of_text (); f_ohdr.tsize = data_start - f_ohdr.text_start; f_ohdr.data_start = data_start; #endif /* NO_REMAP */ f_ohdr.dsize = bss_start - f_ohdr.data_start; f_ohdr.bsize = bss_end - bss_start; #ifndef KEEP_OLD_TEXT_SCNPTR /* On some machines, the old values are right. ??? Maybe on all machines with NO_REMAP. */ f_thdr.s_size = f_ohdr.tsize; f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr); f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr)); #endif /* KEEP_OLD_TEXT_SCNPTR */ #ifdef ADJUST_TEXT_SCNHDR_SIZE /* On some machines, `text size' includes all headers. */ f_thdr.s_size -= f_thdr.s_scnptr; #endif /* ADJUST_TEST_SCNHDR_SIZE */ lnnoptr = f_thdr.s_lnnoptr; #ifdef SECTION_ALIGNMENT /* Some systems require special alignment of the sections in the file itself. */ f_thdr.s_scnptr = (f_thdr.s_scnptr + SECTION_ALIGNMENT) & ~SECTION_ALIGNMENT; #endif /* SECTION_ALIGNMENT */ #ifdef TPIX f_thdr.s_scnptr = 0xd0; #endif text_scnptr = f_thdr.s_scnptr; #ifdef ADJUST_TEXTBASE text_scnptr = sizeof (f_hdr) + sizeof (f_ohdr) + (f_hdr.f_nscns) * (sizeof (f_thdr)); #endif #ifndef KEEP_OLD_PADDR f_dhdr.s_paddr = f_ohdr.data_start; #endif /* KEEP_OLD_PADDR */ f_dhdr.s_vaddr = f_ohdr.data_start; f_dhdr.s_size = f_ohdr.dsize; f_dhdr.s_scnptr = f_thdr.s_scnptr + f_thdr.s_size; #ifdef SECTION_ALIGNMENT /* Some systems require special alignment of the sections in the file itself. */ f_dhdr.s_scnptr = (f_dhdr.s_scnptr + SECTION_ALIGNMENT) & ~SECTION_ALIGNMENT; #endif /* SECTION_ALIGNMENT */ #ifdef DATA_SECTION_ALIGNMENT /* Some systems require special alignment of the data section only. */ f_dhdr.s_scnptr = (f_dhdr.s_scnptr + DATA_SECTION_ALIGNMENT) & ~DATA_SECTION_ALIGNMENT; #endif /* DATA_SECTION_ALIGNMENT */ data_scnptr = f_dhdr.s_scnptr; #ifndef KEEP_OLD_PADDR f_bhdr.s_paddr = f_ohdr.data_start + f_ohdr.dsize; #endif /* KEEP_OLD_PADDR */ f_bhdr.s_vaddr = f_ohdr.data_start + f_ohdr.dsize; f_bhdr.s_size = f_ohdr.bsize; f_bhdr.s_scnptr = 0L; #ifndef USG_SHARED_LIBRARIES bias = f_dhdr.s_scnptr + f_dhdr.s_size - block_copy_start; #endif if (f_hdr.f_symptr > 0L) { f_hdr.f_symptr += bias; } if (f_thdr.s_lnnoptr > 0L) { f_thdr.s_lnnoptr += bias; } #ifdef ADJUST_EXEC_HEADER ADJUST_EXEC_HEADER; #endif /* ADJUST_EXEC_HEADER */ if (write (new, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr)) { PERROR (new_name); } if (write (new, &f_ohdr, sizeof (f_ohdr)) != sizeof (f_ohdr)) { PERROR (new_name); } #ifndef USG_SHARED_LIBRARIES if (write (new, &f_thdr, sizeof (f_thdr)) != sizeof (f_thdr)) { PERROR (new_name); } if (write (new, &f_dhdr, sizeof (f_dhdr)) != sizeof (f_dhdr)) { PERROR (new_name); } if (write (new, &f_bhdr, sizeof (f_bhdr)) != sizeof (f_bhdr)) { PERROR (new_name); } #else /* USG_SHARED_LIBRARIES */ /* The purpose of this code is to write out the new file's section * header table. * * Scan through the original file's sections. If the encountered * section is one we know (.text, .data or .bss), write out the * correct header. If it is a section we do not know (such as * .lib), adjust the address of where the section data is in the * file, and write out the header. * * If any section precedes .text or .data in the file, this code * will not adjust the file pointer for that section correctly. */ lseek (a_out, sizeof (f_hdr) + sizeof (f_ohdr), 0); for (scns = f_hdr.f_nscns; scns > 0; scns--) { if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp)) PERROR (a_name); if (!strcmp (scntemp.s_name, f_thdr.s_name)) /* .text */ { if (write (new, &f_thdr, sizeof (f_thdr)) != sizeof (f_thdr)) PERROR (new_name); } else if (!strcmp (scntemp.s_name, f_dhdr.s_name)) /* .data */ { if (write (new, &f_dhdr, sizeof (f_dhdr)) != sizeof (f_dhdr)) PERROR (new_name); } else if (!strcmp (scntemp.s_name, f_bhdr.s_name)) /* .bss */ { if (write (new, &f_bhdr, sizeof (f_bhdr)) != sizeof (f_bhdr)) PERROR (new_name); } else { if (scntemp.s_scnptr) scntemp.s_scnptr += bias; if (write (new, &scntemp, sizeof (scntemp)) != sizeof (scntemp)) PERROR (new_name); } } #endif /* USG_SHARED_LIBRARIES */ return (0); #else /* if not COFF */ /* Get symbol table info from header of a.out file if given one. */ if (a_out >= 0) { #ifdef COFF_ENCAPSULATE if (read (a_out, &coffheader, sizeof coffheader) != sizeof coffheader) { PERROR(a_name); } if (coffheader.f_magic != COFF_MAGIC) { ERROR1("%s doesn't have legal coff magic number\n", a_name); } #endif if (read (a_out, &ohdr, sizeof hdr) != sizeof hdr) { PERROR (a_name); } if (N_BADMAG (ohdr)) { ERROR1 ("invalid magic number in %s", a_name); } hdr = ohdr; } else { #ifdef COFF_ENCAPSULATE /* We probably could without too much trouble. The code is in gld * but I don't have that much time or incentive. */ ERROR0 ("can't build a COFF file from scratch yet"); #else bzero (&hdr, sizeof hdr); #endif } unexec_text_start = (long) start_of_text (); unexec_data_start = data_start; /* these are used for writing, as hdr.a_text and hdr.a_data may be aligned */ unexec_real_text_size = data_start - unexec_text_start; unexec_real_data_size = bss_start - data_start; /* Machine-dependent fixup for header, or maybe for unexec_text_start */ #ifdef ADJUST_EXEC_HEADER ADJUST_EXEC_HEADER; #endif /* ADJUST_EXEC_HEADER */ hdr.a_trsize = 0; hdr.a_drsize = 0; if (entry_address != 0) hdr.a_entry = entry_address; hdr.a_bss = bss_end - bss_start; hdr.a_data = bss_start - data_start; #ifdef SECTION_ALIGNMENT if( ZQMAGIC(hdr) ) hdr.a_data = (hdr.a_data + SECTION_ALIGNMENT) & ~(SECTION_ALIGNMENT); #endif /* not SECTION ALIGNMENT */ #ifdef NO_REMAP hdr.a_text = ohdr.a_text; #else /* not NO_REMAP */ hdr.a_text = data_start - unexec_text_start; #ifdef A_TEXT_OFFSET hdr.a_text += A_TEXT_OFFSET (ohdr); #endif #ifdef SECTION_ALIGNMENT if( ZQMAGIC(hdr) ) hdr.a_text = (hdr.a_text + SECTION_ALIGNMENT) & ~(SECTION_ALIGNMENT); #endif /* not SECTION ALIGNMENT */ #endif /* not NO_REMAP */ #ifdef COFF_ENCAPSULATE /* We are encapsulating BSD format within COFF format. */ { struct coffscn *tp, *dp, *bp; tp = &coffheader.scns[0]; dp = &coffheader.scns[1]; bp = &coffheader.scns[2]; tp->s_size = hdr.a_text + sizeof(struct exec); dp->s_paddr = data_start; dp->s_vaddr = data_start; dp->s_size = hdr.a_data; bp->s_paddr = dp->s_vaddr + dp->s_size; bp->s_vaddr = bp->s_paddr; bp->s_size = hdr.a_bss; coffheader.tsize = tp->s_size; coffheader.dsize = dp->s_size; coffheader.bsize = bp->s_size; coffheader.text_start = tp->s_vaddr; coffheader.data_start = dp->s_vaddr; } if (write (new, &coffheader, sizeof coffheader) != sizeof coffheader) { PERROR(new_name); } #endif /* COFF_ENCAPSULATE */ if (write (new, &hdr, sizeof hdr) != sizeof hdr) { PERROR (new_name); } #ifdef A_TEXT_OFFSET hdr.a_text -= A_TEXT_OFFSET (ohdr); #endif return 0; #endif /* not COFF */ } /* **************************************************************** * copy_text_and_data * * Copy the text and data segments from memory to the new a.out */ static int copy_text_and_data (new, a_out) int new, a_out; { register char *end; register char *ptr; #ifdef COFF #ifdef USG_SHARED_LIBRARIES int scns; struct scnhdr scntemp; /* Temporary section header */ /* The purpose of this code is to write out the new file's section * contents. * * Step through the section table. If we know the section (.text, * .data) do the appropriate thing. Otherwise, if the section has * no allocated space in the file (.bss), do nothing. Otherwise, * the section has space allocated in the file, and is not a section * we know. So just copy it. */ lseek (a_out, sizeof (struct filehdr) + sizeof (struct aouthdr), 0); for (scns = f_hdr.f_nscns; scns > 0; scns--) { if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp)) PERROR ("temacs"); if (!strcmp (scntemp.s_name, ".text")) { lseek (new, (long) text_scnptr, 0); ptr = (char *) f_ohdr.text_start; end = ptr + f_ohdr.tsize; write_segment (new, ptr, end); } else if (!strcmp (scntemp.s_name, ".data")) { lseek (new, (long) data_scnptr, 0); ptr = (char *) f_ohdr.data_start; end = ptr + f_ohdr.dsize; write_segment (new, ptr, end); } else if (!scntemp.s_scnptr) ; /* do nothing - no data for this section */ else { char page[BUFSIZ]; int size, n; long old_a_out_ptr = lseek (a_out, 0, 1); lseek (a_out, scntemp.s_scnptr, 0); for (size = scntemp.s_size; size > 0; size -= sizeof (page)) { n = size > sizeof (page) ? sizeof (page) : size; if (read (a_out, page, n) != n || write (new, page, n) != n) PERROR ("emacs"); } lseek (a_out, old_a_out_ptr, 0); } } #else /* COFF, but not USG_SHARED_LIBRARIES */ lseek (new, (long) text_scnptr, 0); ptr = (char *) f_ohdr.text_start; #ifdef HEADER_INCL_IN_TEXT /* For Gould UTX/32, text starts after headers */ ptr = (char *) (ptr + text_scnptr); #endif /* HEADER_INCL_IN_TEXT */ end = ptr + f_ohdr.tsize; write_segment (new, ptr, end); lseek (new, (long) data_scnptr, 0); ptr = (char *) f_ohdr.data_start; end = ptr + f_ohdr.dsize; write_segment (new, ptr, end); #endif /* USG_SHARED_LIBRARIES */ #else /* if not COFF */ /* Some machines count the header as part of the text segment. That is to say, the header appears in core just before the address that start_of_text () returns. For them, N_TXTOFF is the place where the header goes. We must adjust the seek to the place after the header. Note that at this point hdr.a_text does *not* count the extra A_TEXT_OFFSET bytes, only the actual bytes of code. */ #ifdef A_TEXT_SEEK lseek (new, (long) A_TEXT_SEEK (hdr), 0); #else lseek (new, (long) N_TXTOFF (hdr), 0); #endif /* no A_TEXT_SEEK */ ptr = (char *) unexec_text_start; end = ptr + unexec_real_text_size; write_segment (new, ptr, end); #ifdef SECTION_ALIGNMENT if( ZQMAGIC(hdr) && hdr.a_text > unexec_real_text_size ) padfile(new, hdr.a_text - unexec_real_text_size); #endif ptr = (char *) unexec_data_start; end = ptr + unexec_real_data_size; /* This lseek is certainly incorrect when A_TEXT_OFFSET and I believe it is a no-op otherwise. Let's see if its absence ever fails. */ /* lseek (new, (long) N_TXTOFF (hdr) + hdr.a_text, 0); */ write_segment (new, ptr, end); #ifdef SECTION_ALIGNMENT if( ZQMAGIC(hdr) && hdr.a_data > unexec_real_data_size ) padfile(new, hdr.a_data - unexec_real_data_size); #endif #endif /* not COFF */ return 0; } void padfile (outdesc, padding) int padding; int outdesc; { register char *buf; if (padding <= 0) return; buf = (char *) alloca (padding); bzero (buf, padding); if( write (outdesc, buf, padding) != padding ) exit(1); } write_segment (new, ptr, end) int new; register char *ptr, *end; { register int i, nwrite, ret; char buf[80]; extern int errno; char zeros[128]; bzero (zeros, sizeof zeros); for (i = 0; ptr < end;) { /* distance to next multiple of 128. */ nwrite = (((int) ptr + 128) & -128) - (int) ptr; /* But not beyond specified end. */ if (nwrite > end - ptr) nwrite = end - ptr; ret = write (new, ptr, nwrite); /* If write gets a page fault, it means we reached a gap between the old text segment and the old data segment. This gap has probably been remapped into part of the text segment. So write zeros for it. */ if (ret == -1 && errno == EFAULT) write (new, zeros, nwrite); else if (nwrite != ret) { sprintf (buf, "unexec write failure: addr 0x%x, fileno %d, size 0x%x, wrote 0x%x, errno %d", ptr, new, nwrite, ret, errno); PERROR (buf); } i += nwrite; ptr += nwrite; } } /* **************************************************************** * copy_sym * * Copy the relocation information and symbol table from the a.out to the new */ static int copy_sym (new, a_out, a_name, new_name) int new, a_out; char *a_name, *new_name; { char page[1024]; int n; if (a_out < 0) return 0; #ifdef COFF if (SYMS_START == 0L) return 0; #endif /* COFF */ #ifdef COFF if (lnnoptr) /* if there is line number info */ lseek (a_out, lnnoptr, 0); /* start copying from there */ else #endif /* COFF */ lseek (a_out, SYMS_START, 0); /* Position a.out to symtab. */ while ((n = read (a_out, page, sizeof page)) > 0) { if (write (new, page, n) != n) { PERROR (new_name); } } if (n < 0) { PERROR (a_name); } return 0; } /* **************************************************************** * mark_x * * After successfully building the new a.out, mark it executable */ static void mark_x (name) char *name; { struct stat sbuf; int um; int new = 0; /* for PERROR */ um = umask (777); umask (um); if (stat (name, &sbuf) == -1) { PERROR (name); } sbuf.st_mode |= 0111 & ~um; if (chmod (name, sbuf.st_mode) == -1) PERROR (name); } #ifdef COFF #ifndef COFF_BSD_SYMBOLS /* * If the COFF file contains a symbol table and a line number section, * then any auxiliary entries that have values for x_lnnoptr must * be adjusted by the amount that the line number section has moved * in the file (bias computed in make_hdr). The #@$%&* designers of * the auxiliary entry structures used the absolute file offsets for * the line number entry rather than an offset from the start of the * line number section! * * When I figure out how to scan through the symbol table and pick out * the auxiliary entries that need adjustment, this routine will * be fixed. As it is now, all such entries are wrong and sdb * will complain. Fred Fish, UniSoft Systems Inc. */ /* This function is probably very slow. Instead of reopening the new file for input and output it should copy from the old to the new using the two descriptors already open (WRITEDESC and READDESC). Instead of reading one small structure at a time it should use a reasonable size buffer. But I don't have time to work on such things, so I am installing it as submitted to me. -- RMS. */ adjust_lnnoptrs (writedesc, readdesc, new_name) int writedesc; int readdesc; char *new_name; { register int nsyms; register int new; #if defined (amdahl_uts) || defined (pfa) SYMENT symentry; AUXENT auxentry; #else struct syment symentry; union auxent auxentry; #endif if (!lnnoptr || !f_hdr.f_symptr) return 0; if ((new = open (new_name, 2)) < 0) { PERROR (new_name); return -1; } lseek (new, f_hdr.f_symptr, 0); for (nsyms = 0; nsyms < f_hdr.f_nsyms; nsyms++) { read (new, &symentry, SYMESZ); if (symentry.n_numaux) { read (new, &auxentry, AUXESZ); nsyms++; if (ISFCN (symentry.n_type) || symentry.n_type == 0x2400) { auxentry.x_sym.x_fcnary.x_fcn.x_lnnoptr += bias; lseek (new, -AUXESZ, 1); write (new, &auxentry, AUXESZ); } } } close (new); } #endif /* COFF_BSD_SYMBOLS */ #endif /* COFF */ #endif /* not CANNOT_UNEXEC */ #endif /* not CANNOT_DUMP */ /************************** emacs-19.19/src/s/netbsd.h *********************/ /* s/ file for netbsd system. */ /* Get most of the stuff from 386bsd */ #include "386bsd.h" #define A_TEXT_OFFSET(hdr) sizeof(hdr) #define A_TEXT_SEEK(hdr) (A_TEXT_OFFSET(hdr)) /* ZMAGIC and QMAGIC require page alignments */ #define ZQMAGIC(hdr) ( (N_GETMAGIC(hdr) == ZMAGIC) || \ (N_GETMAGIC(hdr) == QMAGIC) ) #define SECTION_ALIGNMENT (__LDPGSZ-1) -- -------------- Ram Bhamidipaty use this ->ram@epidat.epi.wisc.edu Department of Preventive Medicine or this->ram%epidat.decnet@macc.wisc.edu University of Wisconsin, Madison or this->ram@xor.epi.wisc.edu