diff options
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/Configure | 11 | ||||
-rwxr-xr-x | src/scripts/Configure-Makefile | 170 | ||||
-rwxr-xr-x | src/scripts/Configure-config.h | 54 | ||||
-rwxr-xr-x | src/scripts/Configure-eximon | 52 | ||||
-rwxr-xr-x | src/scripts/Configure-os.c | 31 | ||||
-rwxr-xr-x | src/scripts/Configure-os.h | 49 | ||||
-rwxr-xr-x | src/scripts/MakeLinks | 244 | ||||
-rwxr-xr-x | src/scripts/arch-type | 75 | ||||
-rwxr-xr-x | src/scripts/exim_install | 446 | ||||
-rwxr-xr-x | src/scripts/newer | 22 | ||||
-rwxr-xr-x | src/scripts/os-type | 170 |
11 files changed, 1324 insertions, 0 deletions
diff --git a/src/scripts/Configure b/src/scripts/Configure new file mode 100755 index 000000000..ac82c3b52 --- /dev/null +++ b/src/scripts/Configure @@ -0,0 +1,11 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/Configure,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# A script to be called to run all the other configuring scripts manually. + +scripts/Configure-Makefile +scripts/Configure-os.h +scripts/Configure-os.c +scripts/Configure-config.h + +# End of Configure diff --git a/src/scripts/Configure-Makefile b/src/scripts/Configure-Makefile new file mode 100755 index 000000000..9db965095 --- /dev/null +++ b/src/scripts/Configure-Makefile @@ -0,0 +1,170 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/Configure-Makefile,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Shell script to build Makefile in a build directory. It must be called +# from inside the directory. It does its own checking of when to rebuild; it +# just got too horrendous to get it right in "make", because of the optionally +# existing configuration files. + + +# First off, get the OS type, and check that there is a make file for it. + +ostype=`../scripts/os-type -generic` || exit 1 + +if [ ! -r ../OS/Makefile-$ostype ] ; then + echo "" + echo "*** Sorry - operating system $ostype is not supported" + echo "*** See OS/Makefile-* for supported systems" 1>&2 + echo "" + exit 1 +fi + +# We also need the architecture type, in order to test for any architecture- +# specific configuration files. + +archtype=`../scripts/arch-type` || exit 1 + +# Now test for either the non-existence of Makefile, or for any of its +# components being newer. Note that the "newer" script gives the right +# answer (for our purposes) when the first file is non-existent. + +editme=../Local/Makefile +rebuild=yes + +if [ -f Makefile ] ; then + rebuild=no + if ../scripts/newer $editme Makefile || \ + ../scripts/newer $editme-$ostype Makefile || \ + ../scripts/newer $editme-$archtype Makefile || \ + ../scripts/newer $editme-$ostype-$archtype Makefile || \ + ../scripts/newer ../scripts/Configure-Makefile Makefile || \ + ../scripts/newer ../OS/Makefile-Base Makefile || \ + ../scripts/newer ../OS/Makefile-Default Makefile + then + rebuild=yes + fi +fi + +# If the "build" variable is set it means that a build name was explicitly +# given. Arrange to pick up a build-specific configuration file. + +if [ "X$build" != "X" ] ; then + mfb=Local/Makefile-$build + if ../scripts/newer $editme-$build Makefile ; then + rebuild=yes + fi +else + mfb= +fi + + +# If Makefile is up-to-date, no need to rebuild it. + +if [ $rebuild = no ] ; then + echo "\`Makefile' is up to date." + echo " " + exit +fi + +# Makefile needs to be rebuilt in the current directory by joining +# the generic default makefile, the OS base makefile, and then local +# generic, OS-specific, architecture-specific, and OS+architecture-specific +# makefiles, if they exist. These files all contain macro definitions, with +# later definitions overriding earlier ones. Make a temporary file first, in +# case things go wrong. A second temporary is needed for sorting out the +# default Perl stuff. Use short macro names to save typing. + +mf=Makefile +mft=$mf-t +mftt=$mf-tt + +# Ensure the temporary does not exist and start the new one by setting +# the OSTYPE and ARCHTYPE variables. + +rm -f $mft $mftt +(echo "OSTYPE=$ostype"; echo "ARCHTYPE=$archtype"; echo "") > $mft || exit 1 + +# Now concatenate the files to the temporary file. Copy the files using sed to +# remove comments, blank lines, and trailing white space. + +# BEWARE: a tab character is needed in the sed command below. It has had +# a nasty tendency to get lost in the past, causing a problem if a tab has +# actually been present in one of the files. Use a variable to hold a space +# and a tab to keep the tab in one place. + +st=' ' + +for f in OS/Makefile-Default \ + OS/Makefile-$ostype \ + Local/Makefile \ + Local/Makefile-$ostype \ + Local/Makefile-$archtype \ + Local/Makefile-$ostype-$archtype \ + $mfb +do if test -r ../$f + then echo "# From $f" + sed "/^#/d;/^[$st]*\$/d;s/[$st]*\$//" ../$f || exit 1 + echo "# End of $f" + echo "" + fi +done >> $mft || exit 1 + +# See if there is a definition of EXIM_PERL in what we have built so far. +# If so, run Perl to find the default values for PERL_CC, PERL_CCOPTS, +# and PERL_LIBS. These need to be put at the top of the Makefile, so we rename +# what we have so far and then copy it afterwards. Use the value of PERL_COMMAND +# if it has been defined. + +EXIM_PERL=`grep EXIM_PERL $mft` + +PERL_COMMAND=`grep PERL_COMMAND $mft | sed -e "\\$!d;s/^[$st]*PERL_COMMAND[$st]*=[$st]*//"` +if [ "${PERL_COMMAND}" = "" ] ; then + PERL_COMMAND='perl' +fi + +if [ "${EXIM_PERL}" != "" ] ; then + testperl=`$PERL_COMMAND --version` + if [ "$testperl" = "" ] ; then + echo "*** EXIM_PERL is set, but '$PERL_COMMAND --version' failed" + exit 1 + fi + + mv $mft $mftt + echo "PERL_CC=`$PERL_COMMAND -MConfig -e 'print $Config{cc}'`" >>$mft + echo "PERL_CCOPTS=`$PERL_COMMAND -MExtUtils::Embed -e ccopts`" >>$mft + echo "PERL_LIBS=`$PERL_COMMAND -MExtUtils::Embed -e ldopts`" >>$mft + echo "" >>$mft + cat $mftt >> $mft + rm -f $mftt +fi + +# Record the build variable in the Makefile. + +echo "build=$build" >>$mft +echo "" >>$mft + +# Finally, join on the generic base make file, which contains the actual +# rules and stuff. + +cat ../OS/Makefile-Base >> $mft || exit 1 + +# If the new makefile is the same as the existing one, say so, and just +# update the timestamp. Otherwise remove the old and install the new. + +if [ -s $mf ] && cmp -s $mft $mf +then echo ">>> rebuilt $mf unchanged" + echo " " + touch $mf || exit + rm -f $mft +elif rm -f $mf + mv $mft $mf +then echo ">>> New $mf installed" + echo '>>> Use "make makefile" if you need to force rebuilding of the makefile' + echo " " +else echo " " + echo "*** Failed to install $mf - see $mft" + echo " " + exit 1; +fi + +# End of Configure-Makefile diff --git a/src/scripts/Configure-config.h b/src/scripts/Configure-config.h new file mode 100755 index 000000000..2ec437276 --- /dev/null +++ b/src/scripts/Configure-config.h @@ -0,0 +1,54 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/Configure-config.h,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Build the config.h file, using the buildconfig program, first ensuring that +# it exists. + +# 22-May-1996: remove the use of the "-a" flag for /bin/sh because it is not +# implemented in the FreeBSD shell. Sigh. + +# 12-Mar-1997: add s/#.*$// to the sed script to allow for comments on the +# ends of settings - someone got caught. + +# 18-Apr-1997: put the tab character into a variable to stop it getting +# lost by accident (which has happened a couple of times). + +# 19-Jan-1998: indented settings in the makefile weren't being handled +# correctly; added [$st]* before \\([A-Z] in the pattern, to ignore leading +# space. Oddly, the pattern previously read ^\([A-Z which didn't seem to +# cause a problem (but did when the new bit was put in). + +make buildconfig || exit 1 + +# BEWARE: tab characters needed in the following sed command. They have had +# a nasty tendency to get lost in the past, causing a problem if a tab has +# actually been present in makefile. Use a variable to hold a space and a +# tab to keep the tab in one place. This makes the sed option horrendous to +# read, but the whole script is safer. + +st=' ' + +(sed -n \ + "/\\\$/d;s/#.*\$//;s/^[$st]*\\([A-Z][^:$st]*\\)[$st]*=[$st]*\\([^$st]*\\)[$st]*\$/\\1=\\2 export \\1/p" \ + < Makefile ; echo "./buildconfig") | /bin/sh + +# If buildconfig ends with an error code, it will have output an error +# message. Ensure that a broken config.h gets deleted. + +if [ $? != 0 ] ; then + rm -f config.h + exit 1 +fi + +# Double-check that config.h is complete. + +if [ "`tail -1 config.h`" != "/* End of config.h */" ] ; then + echo "*** config.h appears to be incomplete" + echo "*** unexpected failure in buildconfig program" + exit 1 +fi + +echo ">>> config.h built" +echo "" + +# End of Configure-config.h diff --git a/src/scripts/Configure-eximon b/src/scripts/Configure-eximon new file mode 100755 index 000000000..1ea74b7ea --- /dev/null +++ b/src/scripts/Configure-eximon @@ -0,0 +1,52 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/Configure-eximon,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Shell script to build the configurable part of the Exim monitor's start-up +# script. This is built from various configuration files. The final part is +# added in the Makefile, using various macros that are available at that stage. + +scripts=../scripts + +# First off, get the OS type, and check that there is a make file for it. + +os=`$scripts/os-type -generic` || exit 1 + +if test ! -r ../OS/Makefile-$os +then echo "" + echo "*** Sorry - operating system $os is not supported" + echo "*** See OS/Makefile-* for supported systems" 1>&2 + echo "" + exit 1; +fi + +# We also need the architecture type, in order to test for any architecture- +# specific configuration files. + +arch=`$scripts/arch-type` || exit 1 + +# Build a file called eximon in the current directory by joining +# the generic default configure file, the OS base configure file, and then +# local generic, OS-specific, architecture-specific, and OS+architecture- +# specific configurationfiles, if they exist. These files all contain variable +# definitions, with later definitions overriding earlier ones. + +echo "#!/bin/sh" > eximon +chmod a+x eximon + +# Concatenate the configuration files that exist + +for f in OS/eximon.conf-Default \ + OS/eximon.conf-$os \ + Local/eximon.conf \ + Local/eximon.conf-$os \ + Local/eximon.conf-$arch \ + Local/eximon.conf-$os-$arch +do if test -r ../$f + then echo "# From $f" + sed '/^#/d;/^[ ]*$/d' ../$f || exit 1 + echo "# End of $f" + echo "" + fi +done >> eximon || exit 1 + +# End of Configure-eximon diff --git a/src/scripts/Configure-os.c b/src/scripts/Configure-os.c new file mode 100755 index 000000000..d7613bcda --- /dev/null +++ b/src/scripts/Configure-os.c @@ -0,0 +1,31 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/Configure-os.c,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Shell script to build os.c. There doesn't have to be an OS-specific os.c +# file, but if there is, it gets copied at the start of os.c. The basic src +# copy of os.c contains generic functions, controlled in some cases by +# macro switches so that where they are common to a number of OS, they can +# just be switched in. + +scripts=../scripts + +# First off, get the OS type, and check that there is a make file for it. + +os=`$scripts/os-type -generic` || exit 1 + +if test ! -r ../OS/Makefile-$os +then echo "" + echo "*** Sorry - operating system $os is not supported" + echo "*** See OS/Makefile-* for supported systems" 1>&2 + echo "" + exit 1; +fi + +# Now build the file + +rm -f os.c +echo '#include "exim.h"' > os.c || exit 1 +test -r ../OS/os.c-$os && cat ../OS/os.c-$os >> os.c +echo '#include "../src/os.c"' >> os.c || exit 1 + +# End of Configure-os.c diff --git a/src/scripts/Configure-os.h b/src/scripts/Configure-os.h new file mode 100755 index 000000000..b395af499 --- /dev/null +++ b/src/scripts/Configure-os.h @@ -0,0 +1,49 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/Configure-os.h,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Shell script to create a link to the appropriate OS-specific header file. + +scripts=../scripts + +# Get the OS type, and check that there is a make file for it. + +os=`$scripts/os-type -generic` || exit 1 + +if test ! -r ../OS/Makefile-$os +then echo "" + echo "*** Sorry - operating system $os is not supported" + echo "*** See OS/Makefile-* for supported systems" 1>&2 + echo "" + exit 1; +fi + +# Ensure there is an OS-specific header file, and link it to os.h. There should +# always be one if there is a make file for the OS, so its absence is somewhat +# disastrous. + +if test ! -r ../OS/os.h-$os +then echo "" + echo "*** Build error: OS/os.h-$os file is missing" + echo "" + exit 1; +fi +rm -f os.h +ln -s ../OS/os.h-$os os.h || exit 1 + +# Special-purpose fudge for older versions of Linux (pre 2.1.15) that +# use the structure name "options" instead of "ip_options". + +if [ "$os" != "Linux" -a "$os" != "Linux-libc5" ] ; then exit 0; fi + +grep ip_options /usr/include/linux/ip.h >/dev/null +if [ $? = 0 ] ; then exit 0; fi + +cat >>os.h <<End + +/* Fudge added because this Linux doesn't appear to have a definition +for ip_options in /usr/include/linux/ip.h. */ + +#define ip_options options +End + +# End of Configure-os.h diff --git a/src/scripts/MakeLinks b/src/scripts/MakeLinks new file mode 100755 index 000000000..dd1b9eee0 --- /dev/null +++ b/src/scripts/MakeLinks @@ -0,0 +1,244 @@ +#!/bin/sh +# $Cambridge: exim/src/scripts/MakeLinks,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Script to build links for all the exim source files from the system- +# specific build directory. It should be run from within that directory. + +test ! -d ../src && \ + echo "*** $0 should be run in a system-specific subdirectory." && \ + exit 1 +test -r version.c && \ + echo "*** It appears that $0 has already been run." && \ + exit 1 +if [ -r pcre/Makefile ] ; then + echo "*** It appears that $0 was previously interrupted." + echo "*** You need to remove the build directory, and then run 'make' again." + exit 1 +fi + + +# Initialize the file holding the compile number + +echo "0" > cnumber.h + +echo "" +echo ">>> Creating links to source files..." + + +# The PCRE regular expression library sources have to be linked +# independently in their own sub-directory, since their .o files +# are built using their own Makefile in the sub-directory. +mkdir pcre +cd pcre +ln -s ../../src/pcre/Makefile Makefile +ln -s ../../src/pcre/config.h config.h +ln -s ../../src/pcre/dftables.c dftables.c +ln -s ../../src/pcre/internal.h internal.h +ln -s ../../src/pcre/pcre.h pcre.h +ln -s ../../src/pcre/maketables.c maketables.c +ln -s ../../src/pcre/get.c get.c +ln -s ../../src/pcre/pcre.c pcre.c +ln -s ../../src/pcre/pcretest.c pcretest.c +ln -s ../../src/pcre/printint.c printint.c +ln -s ../../src/pcre/study.c study.c +cd .. + +# Likewise for the lookups +mkdir lookups +cd lookups +ln -s ../../src/lookups/README README +ln -s ../../src/lookups/Makefile Makefile +ln -s ../../src/lookups/cdb.h cdb.h +ln -s ../../src/lookups/cdb.c cdb.c +ln -s ../../src/lookups/dbmdb.h dbmdb.h +ln -s ../../src/lookups/dbmdb.c dbmdb.c +ln -s ../../src/lookups/dnsdb.h dnsdb.h +ln -s ../../src/lookups/dnsdb.c dnsdb.c +ln -s ../../src/lookups/dsearch.h dsearch.h +ln -s ../../src/lookups/dsearch.c dsearch.c +ln -s ../../src/lookups/ibase.h ibase.h +ln -s ../../src/lookups/ibase.c ibase.c +ln -s ../../src/lookups/ldap.h ldap.h +ln -s ../../src/lookups/ldap.c ldap.c +ln -s ../../src/lookups/lsearch.h lsearch.h +ln -s ../../src/lookups/lsearch.c lsearch.c +ln -s ../../src/lookups/mysql.h mysql.h +ln -s ../../src/lookups/mysql.c mysql.c +ln -s ../../src/lookups/nis.h nis.h +ln -s ../../src/lookups/nis.c nis.c +ln -s ../../src/lookups/nisplus.h nisplus.h +ln -s ../../src/lookups/nisplus.c nisplus.c +ln -s ../../src/lookups/oracle.h oracle.h +ln -s ../../src/lookups/oracle.c oracle.c +ln -s ../../src/lookups/passwd.h passwd.h +ln -s ../../src/lookups/passwd.c passwd.c +ln -s ../../src/lookups/pgsql.h pgsql.h +ln -s ../../src/lookups/pgsql.c pgsql.c +ln -s ../../src/lookups/testdb.h testdb.h +ln -s ../../src/lookups/testdb.c testdb.c +ln -s ../../src/lookups/whoson.h whoson.h +ln -s ../../src/lookups/whoson.c whoson.c + +ln -s ../../src/lookups/lf_functions.h lf_functions.h +ln -s ../../src/lookups/lf_check_file.c lf_check_file.c +ln -s ../../src/lookups/lf_quote.c lf_quote.c + +cd .. + +# Likewise for the code for the routers +mkdir routers +cd routers +ln -s ../../src/routers/README README +ln -s ../../src/routers/Makefile Makefile +ln -s ../../src/routers/accept.h accept.h +ln -s ../../src/routers/accept.c accept.c +ln -s ../../src/routers/dnslookup.h dnslookup.h +ln -s ../../src/routers/dnslookup.c dnslookup.c +ln -s ../../src/routers/ipliteral.h ipliteral.h +ln -s ../../src/routers/ipliteral.c ipliteral.c +ln -s ../../src/routers/iplookup.h iplookup.h +ln -s ../../src/routers/iplookup.c iplookup.c +ln -s ../../src/routers/manualroute.h manualroute.h +ln -s ../../src/routers/manualroute.c manualroute.c +ln -s ../../src/routers/queryprogram.h queryprogram.h +ln -s ../../src/routers/queryprogram.c queryprogram.c +ln -s ../../src/routers/redirect.h redirect.h +ln -s ../../src/routers/redirect.c redirect.c + +ln -s ../../src/routers/rf_functions.h rf_functions.h +ln -s ../../src/routers/rf_change_domain.c rf_change_domain.c +ln -s ../../src/routers/rf_expand_data.c rf_expand_data.c +ln -s ../../src/routers/rf_get_errors_address.c rf_get_errors_address.c +ln -s ../../src/routers/rf_get_munge_headers.c rf_get_munge_headers.c +ln -s ../../src/routers/rf_get_transport.c rf_get_transport.c +ln -s ../../src/routers/rf_get_ugid.c rf_get_ugid.c +ln -s ../../src/routers/rf_queue_add.c rf_queue_add.c +ln -s ../../src/routers/rf_lookup_hostlist.c rf_lookup_hostlist.c +ln -s ../../src/routers/rf_self_action.c rf_self_action.c +ln -s ../../src/routers/rf_set_ugid.c rf_set_ugid.c + +cd .. + +# Likewise for the code for the transports +mkdir transports +cd transports +ln -s ../../src/transports/README README +ln -s ../../src/transports/Makefile Makefile +ln -s ../../src/transports/appendfile.h appendfile.h +ln -s ../../src/transports/appendfile.c appendfile.c +ln -s ../../src/transports/autoreply.h autoreply.h +ln -s ../../src/transports/autoreply.c autoreply.c +ln -s ../../src/transports/lmtp.h lmtp.h +ln -s ../../src/transports/lmtp.c lmtp.c +ln -s ../../src/transports/pipe.h pipe.h +ln -s ../../src/transports/pipe.c pipe.c +ln -s ../../src/transports/smtp.h smtp.h +ln -s ../../src/transports/smtp.c smtp.c + +ln -s ../../src/transports/tf_maildir.c tf_maildir.c +ln -s ../../src/transports/tf_maildir.h tf_maildir.h + +cd .. + +# Likewise for the code for the authorization functions +mkdir auths +cd auths +ln -s ../../src/auths/README README +ln -s ../../src/auths/Makefile Makefile +ln -s ../../src/auths/b64encode.c b64encode.c +ln -s ../../src/auths/b64decode.c b64decode.c +ln -s ../../src/auths/call_pam.c call_pam.c +ln -s ../../src/auths/call_pwcheck.c call_pwcheck.c +ln -s ../../src/auths/call_radius.c call_radius.c +ln -s ../../src/auths/cyrus_sasl.c cyrus_sasl.c +ln -s ../../src/auths/cyrus_sasl.h cyrus_sasl.h +ln -s ../../src/auths/get_data.c get_data.c +ln -s ../../src/auths/get_no64_data.c get_no64_data.c +ln -s ../../src/auths/md5.c md5.c +ln -s ../../src/auths/xtextencode.c xtextencode.c +ln -s ../../src/auths/xtextdecode.c xtextdecode.c +ln -s ../../src/auths/cram_md5.c cram_md5.c +ln -s ../../src/auths/cram_md5.h cram_md5.h +ln -s ../../src/auths/plaintext.c plaintext.c +ln -s ../../src/auths/plaintext.h plaintext.h +ln -s ../../src/auths/pwcheck.c pwcheck.c +ln -s ../../src/auths/pwcheck.h pwcheck.h +ln -s ../../src/auths/auth-spa.c auth-spa.c +ln -s ../../src/auths/auth-spa.h auth-spa.h +ln -s ../../src/auths/sha1.c sha1.c +ln -s ../../src/auths/spa.c spa.c +ln -s ../../src/auths/spa.h spa.h +cd .. + +# The basic source files for Exim and utilities. NB local_scan.h gets linked, +# but local_scan.c does not, because its location is taken from the build-time +# configuration. Likewise for the os.c file, which gets build dynamically. + +ln -s ../src/dbfunctions.h dbfunctions.h +ln -s ../src/dbstuff.h dbstuff.h +ln -s ../src/exim.h exim.h +ln -s ../src/functions.h functions.h +ln -s ../src/globals.h globals.h +ln -s ../src/local_scan.h local_scan.h +ln -s ../src/macros.h macros.h +ln -s ../src/mytypes.h mytypes.h +ln -s ../src/osfunctions.h osfunctions.h +ln -s ../src/store.h store.h +ln -s ../src/structs.h structs.h + +ln -s ../src/acl.c acl.c +ln -s ../src/buildconfig.c buildconfig.c +ln -s ../src/child.c child.c +ln -s ../src/crypt16.c crypt16.c +ln -s ../src/daemon.c daemon.c +ln -s ../src/dbfn.c dbfn.c +ln -s ../src/debug.c debug.c +ln -s ../src/deliver.c deliver.c +ln -s ../src/directory.c directory.c +ln -s ../src/dns.c dns.c +ln -s ../src/drtables.c drtables.c +ln -s ../src/dummies.c dummies.c +ln -s ../src/enq.c enq.c +ln -s ../src/exim.c exim.c +ln -s ../src/exim_dbmbuild.c exim_dbmbuild.c +ln -s ../src/exim_dbutil.c exim_dbutil.c +ln -s ../src/exim_lock.c exim_lock.c +ln -s ../src/expand.c expand.c +ln -s ../src/filter.c filter.c +ln -s ../src/filtertest.c filtertest.c +ln -s ../src/globals.c globals.c +ln -s ../src/header.c header.c +ln -s ../src/host.c host.c +ln -s ../src/ip.c ip.c +ln -s ../src/log.c log.c +ln -s ../src/lss.c lss.c +ln -s ../src/match.c match.c +ln -s ../src/moan.c moan.c +ln -s ../src/parse.c parse.c +ln -s ../src/perl.c perl.c +ln -s ../src/queue.c queue.c +ln -s ../src/rda.c rda.c +ln -s ../src/readconf.c readconf.c +ln -s ../src/receive.c receive.c +ln -s ../src/retry.c retry.c +ln -s ../src/rewrite.c rewrite.c +ln -s ../src/rfc2047.c rfc2047.c +ln -s ../src/route.c route.c +ln -s ../src/search.c search.c +ln -s ../src/sieve.c sieve.c +ln -s ../src/smtp_in.c smtp_in.c +ln -s ../src/smtp_out.c smtp_out.c +ln -s ../src/spool_in.c spool_in.c +ln -s ../src/spool_out.c spool_out.c +ln -s ../src/store.c store.c +ln -s ../src/string.c string.c +ln -s ../src/tls.c tls.c +ln -s ../src/tls-gnu.c tls-gnu.c +ln -s ../src/tls-openssl.c tls-openssl.c +ln -s ../src/tod.c tod.c +ln -s ../src/transport.c transport.c +ln -s ../src/tree.c tree.c +ln -s ../src/verify.c verify.c +ln -s ../src/version.c version.c + +# End of MakeLinks diff --git a/src/scripts/arch-type b/src/scripts/arch-type new file mode 100755 index 000000000..9fa7f0bd5 --- /dev/null +++ b/src/scripts/arch-type @@ -0,0 +1,75 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/arch-type,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Shell script to determine the architecture type. + +# If EXIM_ARCHTYPE is set, use it. This allows a manual override. + +case "$EXIM_ARCHTYPE" in ?*) arch="$EXIM_ARCHTYPE";; esac + +# Otherwise, try to get a value from the uname command. When uname -p gives +# "unknown" or something containing spaces, try -m. + +case "$arch" in '') arch=`uname -p 2> /dev/null`;; esac +case "$arch" in ''|unknown|*\ *) arch=`uname -m 2> /dev/null`;; esac + +# Otherwise, see if ARCHTYPE is set. Some versions of NetBSD set it to +# "NetBSD", which isn't very helpful. However, we expect uname to have +# worked under NetBSD, so this shouldn't matter. + +case "$arch" in '') arch="$ARCHTYPE";; esac + +# Otherwise, as a cheap test, try shell's HOSTTYPE, but as tcsh sometimes sets +# it to the OS name, ignore it if running with tcsh. + +case "$SHELL" in ?*tcsh) HOSTTYPE="";; esac + +case "$arch++$HOSTTYPE" in +++?*) arch="$HOSTTYPE" + # Fix up disagreements :-) + case "$arch" in + sun4*) arch=sparc;; + +# Comment by Vadim Vygonets: +# Maybe sun4/sun4c/sun4m and sun4u (or whatever else they call the +# Ultras, sparc64?) should be different platforms. Maybe not. +# NetBSD and OpenBSD (the latter is not supported) think about them +# as different platforms. Solaris doesn't seem to. I have no idea +# about Linux. + + sgi) arch=mips;; + MIPSEL) arch=mips;; + esac + ;; +esac + +# Give up if failed. + +case "$arch" in +'') echo "" 1>&2 + echo "*** Failed to determine the machine architecture type." 1>&2 + echo "" 1>&2 + echo UnKnown + exit 1;; +esac + +# Get rid of any gash characters in the string + +arch=`echo $arch | sed 's,[^-+_.a-zA-Z0-9],,g'` + +# Some further fixups needed + +case "$arch" in +i[3456]86*) arch=i386;; +RISC) arch=mips;; # MIPS Ultrix +IP22) arch=mips;; +9000[78][0-9][0-9]) arch=hp9000s700;; +9000[34][0-9][0-9]) arch=hp9000s400;; +3050R) arch=3050;; +esac + +# OK, the script seems to have worked. Pass the value back. + +echo "$arch" + +# End of arch-type diff --git a/src/scripts/exim_install b/src/scripts/exim_install new file mode 100755 index 000000000..c89ed3ce8 --- /dev/null +++ b/src/scripts/exim_install @@ -0,0 +1,446 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/exim_install,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Script to install Exim binaries in BIN_DIRECTORY, which is defined in +# the local Makefile. It expects to be run in a build directory. It needs +# to be run as root in order to make exim setuid to root. If exim runs setuid +# to (e.g.) exim, this script should be run as that user or root. + +# This script also installs a default configuration file in CONFIGURE_FILE +# if there is no configuration file there, but only if CONFIGURE_FILE specifies +# single file. If it specifies a list, no action is taken. + +# If a default configuration file is installed, the existence of the system +# aliases file is tested. A default, containing only comments, is installed if +# necessary. + +# If INFO_DIRECTORY is defined in any of the local Makefiles, and the Exim doc +# directory contains the Texinfo documentation, this script also installs a +# the info files in INFO_DIRECTORY. + +# If DESTDIR is defined, all file paths are prefixed with ${DESTDIR}, with the +# sole exception of the reference to the system aliases file in the default +# configuration, because it is assumed that Exim is not actually going to be +# run from this position. For backward compatibility, if DESTDIR is not +# defined, ROOT is used instead. + +# The script can be made to output what it would do, without actually doing +# anything, by giving it the option "-n" (cf make). Arguments are the names +# of things to install. No arguments installs everything. + +do_chown=yes +do_symlink=yes + +while [ $# -gt 0 ] ; do + case "$1" in + -n) + real="true || " + ver="verification " + com=": " + echo $com "" + echo $com "*** Verification mode only: no commands will actually be obeyed" + echo $com "*** You can cut and paste the bits you want to a shell, etc" + echo $com "" + echo cd `pwd` + ;; + + -no_chown) + do_chown=no + ;; + + -no_symlink) + do_symlink=no + ;; + + *) + break + ;; + esac + shift +done + +# Get the values of BIN_DIRECTORY, CONFIGURE_FILE, INFO_DIRECTORY, NO_SYMLINK, +# SYSTEM_ALIASES_FILE, and EXE from the global Makefile (in the build +# directory). EXE is empty except in the Cygwin environment. In each case, keep +# the latest definition, thus respecting the Makefiles precedence. The sed +# sequences here are messy, but have to be very "basic" in order to work on +# Solaris, where the regular expressions in sed are primitive indeed. Modify at +# your peril. + +BIN_DIRECTORY=`sed -n -e '/^ *BIN_DIRECTORY *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +CONFIGURE_FILE=`sed -n -e '/^ *CONFIGURE_FILE *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +INFO_DIRECTORY=`sed -n -e '/^ *INFO_DIRECTORY *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +NO_SYMLINK=`sed -n -e '/^ *NO_SYMLINK *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +SYSTEM_ALIASES_FILE=`sed -n -e '/^ *SYSTEM_ALIASES_FILE *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +EXE=`sed -n -e '/^ *EXE *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` + +# Set a default for SYSTEM_ALIASES_FILE + +if [ "${SYSTEM_ALIASES_FILE}" = "" ] ; then + SYSTEM_ALIASES_FILE=/etc/aliases +fi + +# Allow INST_xx to over-ride xx +case "$INST_BIN_DIRECTORY" in ?*) BIN_DIRECTORY="$INST_BIN_DIRECTORY";; esac +case "$INST_CONFIGURE_FILE" in ?*) CONFIGURE_FILE="$INST_CONFIGURE_FILE";; esac +case "$INST_INFO_DIRECTORY" in ?*) INFO_DIRECTORY="$INST_INFO_DIRECTORY";; esac +case "$INST_SYSTEM_ALIASES_FILE" in ?*) SYSTEM_ALIASES_FILE="$INST_SYSTEM_ALIASES_FILE";; esac + +case "$INST_UID" in '') INST_UID=root;; *) INST_UID="$INST_UID";; esac +case "$INST_CP" in '') CP=cp;; *) CP="$INST_CP";; esac +case "$INST_MV" in '') MV=mv;; *) MV="$INST_MV";; esac +case "$INST_LN" in '') LN=ln;; *) LN="$INST_LN";; esac +case "$INST_CHOWN" in '') CHOWN=chown;; *) CHOWN="$INST_CHOWN";; esac +case "$INST_CHMOD" in '') CHMOD=chmod;; *) CHMOD="$INST_CHMOD";; esac +case "$INST_DIRNAME" in '') DIRNAME=dirname;; *) DIRNAME="$INST_DIRNAME";; esac +case "$INST_MKDIR" in '') MKDIR=mkdir;; *) MKDIR="$INST_MKDIR";; esac + +# Allow the user to over-ride xx +case "$inst_dest" in ?*) BIN_DIRECTORY="$inst_dest";; esac +case "$inst_conf" in ?*) CONFIGURE_FILE="$inst_conf";; esac +case "$inst_info" in ?*) INFO_DIRECTORY="$inst_info";; esac +case "$inst_aliases" in ?*) SYSTEM_ALIASES_FILE="$inst_aliases";; esac + +# Insert ${DESTDIR} at the start of all paths so that the whole thing can be +# installed under a different file root. For backwards compatibility, use +# ${ROOT} if ${DESTDIR} is not set. However, we need to save the value of +# the real system aliases file, and use that in the default configuration. + +ACTUAL_SYSTEM_ALIASES_FILE=${SYSTEM_ALIASES_FILE} +DESTDIR=${DESTDIR:-${ROOT}} + +BIN_DIRECTORY=${DESTDIR}${BIN_DIRECTORY} +CONFIGURE_FILE=${DESTDIR}${CONFIGURE_FILE} +SYSTEM_ALIASES_FILE=${DESTDIR}${SYSTEM_ALIASES_FILE} + +if [ "${INFO_DIRECTORY}" != "" ] ; then + INFO_DIRECTORY=${DESTDIR}${INFO_DIRECTORY} +fi + +# Overrides of other things +case "$inst_uid" in ?*) INST_UID="$inst_uid";; esac +case "$inst_cp" in ?*) CP="$inst_cp";; esac +case "$inst_mv" in ?*) MV="$inst_mv";; esac +case "$inst_ln" in ?*) LN="$inst_ln";; esac +case "$inst_chown" in ?*) CHOWN="$inst_chown";; esac +case "$inst_chmod" in ?*) CHMOD="$inst_chmod";; esac +case "$inst_dirname" in ?*) DIRNAME="$inst_dirname";; esac +case "$inst_mkdir" in ?*) MKDIR="$inst_mkdir";; esac + +# chown is a special case; in at least one OS it is in /usr/etc instead +# of in /usr/bin, and therefore not likely to be on the path. Another OS +# has it in /usr/sbin. This fudge tries to cope with these variations. + +# Otherwise, and for other commands, we assume that the normal PATH will +# give access to where they are on your operating system (normally /usr/bin +# or /bin). + +if [ "${CHOWN}" = "chown" -a -x /usr/sbin/chown ] ; then + CHOWN=/usr/sbin/chown +fi + +if [ "${CHOWN}" = "chown" -a ! -f /usr/bin/chown -a -f /usr/etc/chown ] ; then + CHOWN=/usr/etc/chown +fi + +# See if the exim monitor has been built + +if [ -f eximon -a -f eximon.bin ]; then + exim_monitor="eximon eximon.bin" +fi + +# If bin directory doesn't exist, try to create it + +if [ ! -d "${BIN_DIRECTORY}" ]; then + echo mkdir -p ${BIN_DIRECTORY} + ${real} mkdir -p ${BIN_DIRECTORY} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + else + ${real} echo $com ${BIN_DIRECTORY} created + fi +fi + +# If no arguments, install everything + +if [ $# -gt 0 ]; then + set $@ +else + set exim${EXE} ${exim_monitor} exim_dumpdb${EXE} exim_fixdb${EXE} \ + exim_tidydb${EXE} exinext exiwhat exim_dbmbuild${EXE} exicyclog \ + exigrep eximstats exipick exiqgrep exiqsumm exim_lock${EXE} \ + exim_checkaccess +fi + +echo $com "" +echo $com Installation directory is ${BIN_DIRECTORY} +echo $com "" + +while [ $# -gt 0 ]; do + name=$1 + shift + + if [ ! -s ${name} ]; then + echo $com "" + echo $com "*** `pwd`/${name} does not exist or is empty" + echo $com "*** Have you built Exim successfully?" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + # The exim binary is handled specially + + if [ $name = exim${EXE} ]; then + version=exim-`./exim -bV -C /dev/null | \ + awk '/Exim version/ { OFS=""; print $3,"-",substr($4,2,length($4)-1) }'`${EXE} + + if [ "${version}" = "exim-${EXE}" ]; then + echo $com "" + echo $com "*** Could not run ./exim to find version number ***" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + # Do something only if newer than existing file, or no existing file + + if ../scripts/newer ${name} ${BIN_DIRECTORY}/${version}; then + echo ${CP} ${name} ${BIN_DIRECTORY}/${version} + ${real} ${CP} ${name} ${BIN_DIRECTORY}/${version} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + # After copy, set ownership and permissions, unless disabled + + if [ "$do_chown" != "no" ]; then + echo ${CHOWN} ${INST_UID} ${BIN_DIRECTORY}/${version} + ${real} ${CHOWN} ${INST_UID} ${BIN_DIRECTORY}/${version} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** You must be ${INST_UID} to install exim ***" + exit 1 + fi + echo ${CHMOD} a+x ${BIN_DIRECTORY}/${version} + ${real} ${CHMOD} a+x ${BIN_DIRECTORY}/${version} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + echo ${CHMOD} u+s ${BIN_DIRECTORY}/${version} + ${real} ${CHMOD} u+s ${BIN_DIRECTORY}/${version} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + else + echo $com "$CHOWN $INST_UID omitted: -no_chown was specified" + echo $com "$CHMOD u+s omitted: -no_chown was specified" + fi + + # Now sort out the "exim" alias, unless NO_SYMLINK is set. + + if [ "X$NO_SYMLINK" = "X" ] && [ "$do_symlink" != "no" ] ; then + + # First check whether "exim" exists in the directory. + if [ -f ${BIN_DIRECTORY}/exim ]; then + + # If it's not a symbolic link, make a copy with the old version number + if [ `ls -l ${BIN_DIRECTORY}/exim | cut -c1-1` != 'l' ]; then + oldversion=exim-`${BIN_DIRECTORY}/exim -bV -C /dev/null | \ + awk '/Exim version/ { OFS=""; print $3,"-",substr($4,2,length($4)-1) }'`${EXE} + if [ "${version}" = "${oldversion}" ] ; then + echo $com "" + echo $com "*** Existing file called exim has the same version and compile number ***" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + echo ${CP} ${BIN_DIRECTORY}/exim ${BIN_DIRECTORY}/${oldversion} + ${real} ${CP} ${BIN_DIRECTORY}/exim ${BIN_DIRECTORY}/${oldversion} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + fi + + # Now we can move the name "exim" to be a symbolic link to the new + # version, atomically. + + echo \(cd ${BIN_DIRECTORY}\; ${LN} -s ${version} temporary_exim\) + (${real} cd ${BIN_DIRECTORY}; ${real} ${LN} -s ${version} temporary_exim) + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + echo ${MV} -f ${BIN_DIRECTORY}/temporary_exim ${BIN_DIRECTORY}/exim + ${real} ${MV} -f ${BIN_DIRECTORY}/temporary_exim ${BIN_DIRECTORY}/exim + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + # If "exim" does not already exist just create a symbolic link. + + else + echo \(cd ${BIN_DIRECTORY}\; ${LN} -s ${version} exim\) + (${real} cd ${BIN_DIRECTORY}; ${real} ${LN} -s ${version} exim) + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + fi + + else + echo $com "creation of symlink omitted" + if [ "X$NO_SYMLINK" != "X" ] ; then + echo $com "(NO_SYMLINK is specified in Local/Makefile)" + else + echo $com "(-no_symlink was specified)" + fi + fi + + # New binary is not newer than the installed file + + else + echo $com ${name} is not newer than ${BIN_DIRECTORY}/${version} + fi + + # Handle everything other than the exim binary itself + + else + if ../scripts/newer ${name} ${BIN_DIRECTORY}/${name}; then + if [ -f ${BIN_DIRECTORY}/${name} ]; then + echo ${CP} ${BIN_DIRECTORY}/${name} ${BIN_DIRECTORY}/${name}.O + ${real} ${CP} ${BIN_DIRECTORY}/${name} ${BIN_DIRECTORY}/${name}.O + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + fi + echo ${CP} ${name} ${BIN_DIRECTORY} + ${real} ${CP} ${name} ${BIN_DIRECTORY} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + else + echo $com ${name} is not newer than ${BIN_DIRECTORY}/${name} + fi + fi + +done + + + +# If there is no configuration file, install the default, modifying it to refer +# to the configured system aliases file. If there is no setting for +# SYSTEM_ALIASES_FILE, use the traditional /etc/aliases. If the file does not +# exist, install a default (dummy) for that too. + +# However, if CONFIGURE_FILE specifies a list of files, skip this code. + +echo $com "" + +if [ `expr "${CONFIGURE_FILE}" : ".*:"` -ne 0 ] ; then + echo $com Runtime configuration is specified as the following list: + echo $com ' ' ${CONFIGURE_FILE} + echo $com Therefore, skipping automatic installation. + +elif [ ! -f ${CONFIGURE_FILE} ]; then + echo $com Installing default configuration in ${CONFIGURE_FILE} + echo $com because there is no existing configuration file. + if [ "${SYSTEM_ALIASES_FILE}" = "" ] ; then + SYSTEM_ALIASES_FILE=/etc/aliases + echo $com This configuration has system aliases in ${SYSTEM_ALIASES_FILE}. + fi + + echo ${MKDIR} -p `${DIRNAME} ${CONFIGURE_FILE}` + ${real} ${MKDIR} -p `${DIRNAME} ${CONFIGURE_FILE}` + + echo sed -e '\\' + echo " \"/SYSTEM_ALIASES_FILE/ s'SYSTEM_ALIASES_FILE'${ACTUAL_SYSTEM_ALIASES_FILE}'\"" '\\' + echo " ../src/configure.default > \${CONFIGURE_FILE}" + + # I can't find a way of writing this using the ${real} feature because + # it seems that the output redirection always happens, even when -n was + # specified. So control it the hard way. + + if [ "$real" = "" ] ; then + sed -e \ + "/SYSTEM_ALIASES_FILE/ s'SYSTEM_ALIASES_FILE'${ACTUAL_SYSTEM_ALIASES_FILE}'" \ + ../src/configure.default > ${CONFIGURE_FILE} + else + true + fi + + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + if [ ! -f ${SYSTEM_ALIASES_FILE} ]; then + echo $com '****' + echo $com Installing a dummy ${SYSTEM_ALIASES_FILE} file because you do not have + echo $com one, and the default configuration requires it. You should + echo $com edit ${SYSTEM_ALIASES_FILE} and at least create an alias for postmaster. + echo $com '***' + echo ${CP} ../src/aliases.default ${SYSTEM_ALIASES_FILE} + ${real} ${CP} ../src/aliases.default ${SYSTEM_ALIASES_FILE} + fi + +else + echo $com Configuration file ${CONFIGURE_FILE} already exists +fi + +# Install info files if the directory is defined and the Texinfo +# source documentation is present. + +if [ "${INFO_DIRECTORY}" != "" -a -f ../doc/spec.texinfo ] ; then + echo $com "" + if [ ! -d "${INFO_DIRECTORY}" ] ; then + echo mkdir -p ${INFO_DIRECTORY} + ${real} mkdir -p ${INFO_DIRECTORY} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + else + echo $com ${INFO_DIRECTORY} created + fi + fi + + echo $com Info installation directory is ${INFO_DIRECTORY} + echo $com "" + + ${real} makeinfo --no-split --output exim.info ../doc/spec.texinfo + echo ${CP} exim.info ${INFO_DIRECTORY} + ${real} ${CP} exim.info ${INFO_DIRECTORY} + ${real} install-info --section="Exim" \ + --entry "* User guide: (exim). Exim manual" \ + ${INFO_DIRECTORY}/exim.info ${INFO_DIRECTORY}/dir + ${real} makeinfo --no-split --output exim_filter.info ../doc/filter.texinfo + echo ${CP} exim_filter.info ${INFO_DIRECTORY} + ${real} ${CP} exim_filter.info ${INFO_DIRECTORY} + ${real} install-info --section="Exim" \ + --entry "* Filtering: (exim_filter). Filtering mail with Exim" \ + ${INFO_DIRECTORY}/exim_filter.info ${INFO_DIRECTORY}/dir +fi + +# Everything OK + +echo $com "" +echo $com Exim installation ${ver}complete + +# End of exim_install diff --git a/src/scripts/newer b/src/scripts/newer new file mode 100755 index 000000000..a2b92f6b8 --- /dev/null +++ b/src/scripts/newer @@ -0,0 +1,22 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/newer,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Script to determine whether the first file is newer than the second. +# If the first does not exist, the answer is "no"; +# if the second does not exist, the answer is "yes"; +# otherwise their ages are compared using "find". + +if [ $# -ne 2 ]; then + echo "*** Two file names needed for 'newer' ***" + exit 2; +fi + +if [ ! -f $1 ]; then exit 1; fi +if [ ! -f $2 ]; then exit 0; fi + +case `find $1 -newer $2 -print` in +'') exit 1;; +*) exit 0;; +esac + +# End diff --git a/src/scripts/os-type b/src/scripts/os-type new file mode 100755 index 000000000..d747ae908 --- /dev/null +++ b/src/scripts/os-type @@ -0,0 +1,170 @@ +#! /bin/sh +# $Cambridge: exim/src/scripts/os-type,v 1.1 2004/10/06 15:07:40 ph10 Exp $ + +# Shell script to determine the operating system type. Some of the heuristics +# herein have accumulated over the years and may not strictly be needed now, +# but they are left in under the principle of "If it ain't broke, don't fix +# it." + +# For some OS there are two variants: a full name, which is used for the +# build directory, and a generic name, which is used to identify the OS- +# specific scripts, and which can be the same for different versions of +# the OS. Solaris 2 is one such OS. The option -generic specifies the +# latter type of output. + +# If EXIM_OSTYPE is set, use it. This allows a manual override. + +case "$EXIM_OSTYPE" in ?*) os="$EXIM_OSTYPE";; esac + +# Otherwise, try to get a value from the uname command. Use an explicit +# option just in case there are any systems where -s is not the default. + +case "$os" in '') os=`uname -s`;; esac + +# It is believed that all systems respond to uname -s, but just in case +# there is one that doesn't, use the shell's $OSTYPE variable. It is known +# to be unhelpful for some systems (under IRIX is it "irix" and under BSDI +# 3.0 it may be "386BSD") but those systems respond to uname -s, so this +# doesn't matter. + +case "$os" in '') os="$OSTYPE";; esac + +# Failed to find OS type. + +case "$os" in +'') echo "" 1>&2 + echo "*** Failed to determine the operating system type." 1>&2 + echo "" 1>&2 + echo UnKnown + exit 1;; +esac + +# Clean out gash characters + +os=`echo $os | sed 's,[^-+_.a-zA-Z0-9],,g'` + +# A value has been obtained for the os. Some massaging may be needed in +# some cases to get a uniform set of values. In earlier versions of this +# script, $OSTYPE was looked at before uname -s, and various shells set it +# to things that are subtly different. It is possible that some of this may +# no longer be needed. + +case "$os" in +aix*) os=AIX;; +AIX*) os=AIX;; +bsdi*) os=BSDI;; +BSDOS) os=BSDI;; +BSD_OS) os=BSDI;; +CYGWIN*) os=CYGWIN;; +dgux) os=DGUX;; +freebsd*) os=FreeBSD;; +gnu) os=GNU;; +Irix5) os=IRIX;; +Irix6) os=IRIX6;; +IRIX64) os=IRIX6;; +irix6.5) os=IRIX65;; +IRIX) version=`uname -r` + case "$version" in + 5*) os=IRIX;; + 6.5) version=`uname -R | awk '{print $NF}'` + version=`echo $version | sed 's,[^-+_a-zA-Z0-9],,g'` + os=IRIX$version;; + 6*) os=IRIX632;; + esac;; +HI-OSF1-MJ) os=HI-OSF;; +HI-UXMPP) os=HI-OSF;; +hpux*) os=HP-UX;; +linux) os=Linux;; +linux-*) os=Linux;; +Linux-*) os=Linux;; +netbsd*) os=NetBSD;; +openbsd*) os=OpenBSD;; +osf1) os=OSF1;; +qnx*) os=QNX;; +solaris*) os=SunOS5;; +sunos4*) os=SunOS4;; +UnixWare) os=Unixware7;; +Ultrix) os=ULTRIX;; +ultrix*) os=ULTRIX;; +esac + +# In the case of SunOS we need to distinguish between SunOS4 and Solaris (aka +# SunOS5); in the case of BSDI we need to distinguish between versions 3 and 4; +# in the case of HP-UX we need to distinguish between version 9 and later. + +case "$os" in +SunOS) case `uname -r` in + 5*) os="${os}5";; + 4*) os="${os}4";; + esac;; + +BSDI) case `uname -r` in + 3*) os="${os}3";; + 4.2*) os="${os}4.2";; + 4*) os="${os}4";; + esac;; + +HP-UX) case `uname -r` in + A.09*) os="${os}-9";; + esac;; +esac + +# Need to distinguish Solaris from the version on the HAL (64bit sparc, +# CC=hcc -DV7). Also need to distinguish different versions of the OS +# for building different binaries. + +case "$os" in +SunOS5) case `uname -m` in + sun4H) os="${os}-hal";; + *) os="${os}-`uname -r`";; + esac + ;; + +# In the case of Linux we need to distinguish which libc is used. +# This is more cautious than it needs to be. In practice libc5 will always +# be a symlink, and libc6 will always be a linker control file, but it's +# easy enough to do a better check, and check the symlink destination or the +# control file contents and make sure. + +Linux) if [ -L /usr/lib/libc.so ]; then + if [ x"$(file /usr/lib/libc.so | grep "libc.so.5")"x != xx ]; then + os=Linux-libc5 + fi + else + if grep -q libc.so.5 /usr/lib/libc.so; then + os=Linux-libc5 + fi + fi + ;; + +# In the case of NetBSD we need to distinguish between a.out, ELF +# and COFF binary formats. However, a.out and COFF are the same +# for our purposes, so both of them are defined as "a.out". +# Todd Vierling of Wasabi Systems reported that NetBSD/sh3 (the +# only NetBSD port that uses COFF binary format) will switch to +# ELF soon. + +NetBSD) if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ ; then + # Non-ELF system + os="NetBSD-a.out" + fi + ;; + +esac + +# If a generic OS name is requested, some further massaging is needed +# for some systems. + +if [ "$1" = '-generic' ]; then + case "$os" in + SunOS5*) os=SunOS5;; + BSDI*) os=BSDI;; + IRIX65*) os=IRIX65;; + esac +fi + +# OK, the script seems to have worked. Pass the value back. + +echo "$os" + +# End of os-type |