From 61ec970df30325dbcd8c9d0f0e431dc793126656 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Wed, 6 Oct 2004 15:07:39 +0000 Subject: [PATCH] Start --- src/OS/Makefile-AIX | 26 ++ src/OS/Makefile-BSDI | 23 ++ src/OS/Makefile-Base | 703 +++++++++++++++++++++++++++++++++ src/OS/Makefile-CYGWIN | 113 ++++++ src/OS/Makefile-DGUX | 33 ++ src/OS/Makefile-Darwin | 26 ++ src/OS/Makefile-Default | 332 ++++++++++++++++ src/OS/Makefile-FreeBSD | 36 ++ src/OS/Makefile-GNU | 24 ++ src/OS/Makefile-HI-OSF | 10 + src/OS/Makefile-HI-UX | 14 + src/OS/Makefile-HP-UX | 17 + src/OS/Makefile-HP-UX-9 | 17 + src/OS/Makefile-IRIX | 14 + src/OS/Makefile-IRIX6 | 15 + src/OS/Makefile-IRIX632 | 18 + src/OS/Makefile-IRIX65 | 18 + src/OS/Makefile-Linux | 31 ++ src/OS/Makefile-Linux-libc5 | 23 ++ src/OS/Makefile-NetBSD | 27 ++ src/OS/Makefile-NetBSD-a.out | 24 ++ src/OS/Makefile-OSF1 | 12 + src/OS/Makefile-OpenBSD | 26 ++ src/OS/Makefile-OpenUNIX | 19 + src/OS/Makefile-QNX | 31 ++ src/OS/Makefile-SCO | 29 ++ src/OS/Makefile-SCO_SV | 34 ++ src/OS/Makefile-SunOS4 | 23 ++ src/OS/Makefile-SunOS5 | 24 ++ src/OS/Makefile-SunOS5-hal | 20 + src/OS/Makefile-ULTRIX | 20 + src/OS/Makefile-UNIX_SV | 26 ++ src/OS/Makefile-USG | 35 ++ src/OS/Makefile-Unixware7 | 34 ++ src/OS/Makefile-mips | 19 + src/OS/eximon.conf-Default | 43 ++ src/OS/os.Configuring | 209 ++++++++++ src/OS/os.c-GNU | 57 +++ src/OS/os.c-HI-OSF | 37 ++ src/OS/os.c-IRIX | 120 ++++++ src/OS/os.c-IRIX6 | 120 ++++++ src/OS/os.c-IRIX632 | 120 ++++++ src/OS/os.c-IRIX65 | 120 ++++++ src/OS/os.c-Linux | 155 ++++++++ src/OS/os.c-Linux-libc5 | 39 ++ src/OS/os.c-OSF1 | 38 ++ src/OS/os.c-cygwin | 652 ++++++++++++++++++++++++++++++ src/OS/os.h-AIX | 25 ++ src/OS/os.h-BSDI | 12 + src/OS/os.h-DGUX | 27 ++ src/OS/os.h-Darwin | 29 ++ src/OS/os.h-FreeBSD | 12 + src/OS/os.h-GNU | 20 + src/OS/os.h-HI-OSF | 11 + src/OS/os.h-HI-UX | 20 + src/OS/os.h-HP-UX | 19 + src/OS/os.h-HP-UX-9 | 22 ++ src/OS/os.h-IRIX | 22 ++ src/OS/os.h-IRIX6 | 21 + src/OS/os.h-IRIX632 | 23 ++ src/OS/os.h-IRIX65 | 21 + src/OS/os.h-Linux | 39 ++ src/OS/os.h-Linux-libc5 | 13 + src/OS/os.h-NetBSD | 15 + src/OS/os.h-NetBSD-a.out | 7 + src/OS/os.h-OSF1 | 13 + src/OS/os.h-OpenBSD | 15 + src/OS/os.h-OpenUNIX | 18 + src/OS/os.h-QNX | 23 ++ src/OS/os.h-SCO | 20 + src/OS/os.h-SCO_SV | 18 + src/OS/os.h-SunOS4 | 38 ++ src/OS/os.h-SunOS5 | 33 ++ src/OS/os.h-SunOS5-hal | 13 + src/OS/os.h-ULTRIX | 17 + src/OS/os.h-UNIX_SV | 24 ++ src/OS/os.h-USG | 18 + src/OS/os.h-Unixware7 | 21 + src/OS/os.h-cygwin | 53 +++ src/OS/os.h-mips | 26 ++ src/scripts/Configure | 11 + src/scripts/Configure-Makefile | 170 ++++++++ src/scripts/Configure-config.h | 54 +++ src/scripts/Configure-eximon | 52 +++ src/scripts/Configure-os.c | 31 ++ src/scripts/Configure-os.h | 49 +++ src/scripts/MakeLinks | 244 ++++++++++++ src/scripts/arch-type | 75 ++++ src/scripts/exim_install | 446 +++++++++++++++++++++ src/scripts/newer | 22 ++ src/scripts/os-type | 170 ++++++++ 91 files changed, 5638 insertions(+) create mode 100644 src/OS/Makefile-AIX create mode 100644 src/OS/Makefile-BSDI create mode 100644 src/OS/Makefile-Base create mode 100644 src/OS/Makefile-CYGWIN create mode 100644 src/OS/Makefile-DGUX create mode 100644 src/OS/Makefile-Darwin create mode 100644 src/OS/Makefile-Default create mode 100644 src/OS/Makefile-FreeBSD create mode 100644 src/OS/Makefile-GNU create mode 100644 src/OS/Makefile-HI-OSF create mode 100644 src/OS/Makefile-HI-UX create mode 100644 src/OS/Makefile-HP-UX create mode 100644 src/OS/Makefile-HP-UX-9 create mode 100644 src/OS/Makefile-IRIX create mode 100644 src/OS/Makefile-IRIX6 create mode 100644 src/OS/Makefile-IRIX632 create mode 100644 src/OS/Makefile-IRIX65 create mode 100644 src/OS/Makefile-Linux create mode 100644 src/OS/Makefile-Linux-libc5 create mode 100644 src/OS/Makefile-NetBSD create mode 100644 src/OS/Makefile-NetBSD-a.out create mode 100644 src/OS/Makefile-OSF1 create mode 100644 src/OS/Makefile-OpenBSD create mode 100644 src/OS/Makefile-OpenUNIX create mode 100644 src/OS/Makefile-QNX create mode 100644 src/OS/Makefile-SCO create mode 100644 src/OS/Makefile-SCO_SV create mode 100644 src/OS/Makefile-SunOS4 create mode 100644 src/OS/Makefile-SunOS5 create mode 100644 src/OS/Makefile-SunOS5-hal create mode 100644 src/OS/Makefile-ULTRIX create mode 100644 src/OS/Makefile-UNIX_SV create mode 100644 src/OS/Makefile-USG create mode 100644 src/OS/Makefile-Unixware7 create mode 100644 src/OS/Makefile-mips create mode 100644 src/OS/eximon.conf-Default create mode 100644 src/OS/os.Configuring create mode 100644 src/OS/os.c-GNU create mode 100644 src/OS/os.c-HI-OSF create mode 100644 src/OS/os.c-IRIX create mode 100644 src/OS/os.c-IRIX6 create mode 100644 src/OS/os.c-IRIX632 create mode 100644 src/OS/os.c-IRIX65 create mode 100644 src/OS/os.c-Linux create mode 100644 src/OS/os.c-Linux-libc5 create mode 100644 src/OS/os.c-OSF1 create mode 100644 src/OS/os.c-cygwin create mode 100644 src/OS/os.h-AIX create mode 100644 src/OS/os.h-BSDI create mode 100644 src/OS/os.h-DGUX create mode 100644 src/OS/os.h-Darwin create mode 100644 src/OS/os.h-FreeBSD create mode 100644 src/OS/os.h-GNU create mode 100644 src/OS/os.h-HI-OSF create mode 100644 src/OS/os.h-HI-UX create mode 100644 src/OS/os.h-HP-UX create mode 100644 src/OS/os.h-HP-UX-9 create mode 100644 src/OS/os.h-IRIX create mode 100644 src/OS/os.h-IRIX6 create mode 100644 src/OS/os.h-IRIX632 create mode 100644 src/OS/os.h-IRIX65 create mode 100644 src/OS/os.h-Linux create mode 100644 src/OS/os.h-Linux-libc5 create mode 100644 src/OS/os.h-NetBSD create mode 100644 src/OS/os.h-NetBSD-a.out create mode 100644 src/OS/os.h-OSF1 create mode 100644 src/OS/os.h-OpenBSD create mode 100644 src/OS/os.h-OpenUNIX create mode 100644 src/OS/os.h-QNX create mode 100644 src/OS/os.h-SCO create mode 100644 src/OS/os.h-SCO_SV create mode 100644 src/OS/os.h-SunOS4 create mode 100644 src/OS/os.h-SunOS5 create mode 100644 src/OS/os.h-SunOS5-hal create mode 100644 src/OS/os.h-ULTRIX create mode 100644 src/OS/os.h-UNIX_SV create mode 100644 src/OS/os.h-USG create mode 100644 src/OS/os.h-Unixware7 create mode 100644 src/OS/os.h-cygwin create mode 100644 src/OS/os.h-mips create mode 100755 src/scripts/Configure create mode 100755 src/scripts/Configure-Makefile create mode 100755 src/scripts/Configure-config.h create mode 100755 src/scripts/Configure-eximon create mode 100755 src/scripts/Configure-os.c create mode 100755 src/scripts/Configure-os.h create mode 100755 src/scripts/MakeLinks create mode 100755 src/scripts/arch-type create mode 100755 src/scripts/exim_install create mode 100755 src/scripts/newer create mode 100755 src/scripts/os-type diff --git a/src/OS/Makefile-AIX b/src/OS/Makefile-AIX new file mode 100644 index 000000000..42659a6cd --- /dev/null +++ b/src/OS/Makefile-AIX @@ -0,0 +1,26 @@ +# $Cambridge: exim/src/OS/Makefile-AIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for AIX +# Written by Nick Waterman (nick@cimio.co.uk) + +# Note that the output of uname -m is probably not what Philip expected, +# so you might end up with more build-AIX-random_number directories than +# you expected if you have too many AIX boxes, but it seems to work... I +# blame IBM. + +# Note that nowadays you have to pay extra for a compiler with AIX! + +CC=cc + +# This needs to be in here rather than os.h-AIX because of regexp stuff. +# basically strchr is a #define, which means "extern char *strchr()" +# ruins things. __STR31__ seems to get around this by magic. The AIX +# include files are quite a confusing maze. + +CFLAGS = -D__STR31__ + +# Needed for vfork() and vfork() only? + +LIBS = -lbsd + +# End diff --git a/src/OS/Makefile-BSDI b/src/OS/Makefile-BSDI new file mode 100644 index 000000000..10ea69895 --- /dev/null +++ b/src/OS/Makefile-BSDI @@ -0,0 +1,23 @@ +# $Cambridge: exim/src/OS/Makefile-BSDI,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for BSDI. Its antique link editor +# cannot handle the TextPop overriding. + +CFLAGS=-O +CHOWN_COMMAND=/usr/sbin/chown + +HAVE_SA_LEN=YES + +X11=/usr/X11 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +LIBS_EXIMON=-lSM -lICE -lipc +EXIMON_TEXTPOP= + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base new file mode 100644 index 000000000..7a5cf2b43 --- /dev/null +++ b/src/OS/Makefile-Base @@ -0,0 +1,703 @@ +# $Cambridge: exim/src/OS/Makefile-Base,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# This file is the basis of the main makefile for Exim and friends. The +# makefile at the top level arranges to build the main makefile by calling +# scripts/Configure-Makefile from within the build directory. This +# concatentates the configuration settings from Local/Makefile and other, +# optional, Local/* files at the front of this file, to create Makefile in the +# build directory. + +SHELL = $(MAKE_SHELL) +SCRIPTS = ../scripts +EDITME = ../Local/Makefile +EXIMON_EDITME = ../Local/eximon.conf + +# The compiler used for linking is normally the same as the compiler used for +# compiling. However, by giving it a different name, we can override it from +# the command line, and this is helpful for certain types of testing. + +LNCC = $(CC) + + +# The default target double-checks the existence of $(EDITME) and then arranges +# to touch it if it exists and any of the optional configuration files, which +# depend on the os or the architecture, have been altered. The same sub-target +# does the same thing for the eximon configuration file if it exists. Then +# there is a check that the Makefile (the one built from this file) is +# up-to-date. Then the os-specific source files and the C configuration file +# are set up, and finally it goes to the main Exim target. + +all: $(EDITME) checklocalmake Makefile os.h os.c config.h allexim + +checklocalmake: + @if $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE) $(EDITME) || \ + $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(ARCHTYPE) $(EDITME) || \ + $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE)-$(ARCHTYPE) $(EDITME); \ + then \ + touch $(EDITME); \ + fi + @if $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(OSTYPE) $(EXIMON_EDITME) || \ + $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(ARCHTYPE) $(EXIMON_EDITME) || \ + $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(OSTYPE)-$(ARCHTYPE) $(EXIMON_EDITME); \ + then \ + if [ -f $(EXIMON_EDITME) ]; then touch $(EXIMON_EDITME); fi \ + fi + +$(EDITME): + @echo " " + @echo "*** Please create Local/Makefile by copying src/EDITME and making" + @echo "*** appropriate changes for your site." + @echo " " + @false + +$(EXIMON_EDITME): + @echo " " + @echo "*** Please create Local/eximon.conf by copying exim_monitor/EDITME and making" + @echo "*** appropriate changes for your site." + @echo " " + @test ! -d ../Local && mkdir ../Local + @false + +# Check that the local Makefile is up-to-date + +Makefile: ../OS/Makefile-Base ../OS/Makefile-Default \ + $(SCRIPTS)/Configure $(SCRIPTS)/Configure-Makefile $(EDITME) + @echo " " + @echo "*** Makefile needs rebuilding" + @echo "*** Please run \"make makefile\" at top level" + @echo " " + @false + +# Build (link) the os.h file + +os.h: + $(SHELL) $(SCRIPTS)/Configure-os.h + +# Build the os.c file + +os.c: ../src/os.c + $(SHELL) $(SCRIPTS)/Configure-os.c + +# Build the config.h file. + +config.h: Makefile buildconfig ../src/config.h.defaults $(EDITME) + $(SHELL) $(SCRIPTS)/Configure-config.h + + +# This target is recognized specially by GNU make. It records those targets +# that do not correspond to files that are being built and which should +# therefore always be run, even if the files exist. This shouldn't in fact be a +# problem, but it does no harm. Other make programs will just ignore this. + +.PHONY: all allexim buildauths buildlookups buildpcre buildrouters \ + buildtransports checklocalmake clean + + +# This is the real default target for all the various exim binaries and +# scripts, once the configuring stuff is done. + +allexim: config.h buildpcre $(EXIM_MONITOR) exicyclog exinext exiwhat \ + exigrep eximstats exipick exiqgrep exiqsumm \ + transport-filter.pl convert4r3 convert4r4 \ + exim_checkaccess \ + exim_dbmbuild exim_dumpdb exim_fixdb exim_tidydb exim_lock \ + buildlookups buildrouters buildtransports \ + buildauths exim + + +# Targets for special-purpose configuration header builders +buildconfig: buildconfig.c + $(CC) $(CFLAGS) $(INCLUDE) -o buildconfig buildconfig.c $(LIBS) + + +# Target for the exicyclog utility script +exicyclog: Makefile config.h ../src/exicyclog.src + @rm -f exicyclog + sed \ + -e "s?PROCESSED_FLAG?This file has been so processed.?"\ + -e "/^# /p" \ + -e "/^# /d" \ + -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \ + -e "s?CONFIGURE_FILE_USE_EUID?$(CONFIGURE_FILE_USE_EUID)?" \ + -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \ + -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \ + -e "s?EXICYCLOG_MAX?$(EXICYCLOG_MAX)?" \ + -e "s?COMPRESS_COMMAND?$(COMPRESS_COMMAND)?" \ + -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \ + -e "s?CHOWN_COMMAND?$(CHOWN_COMMAND)?" \ + -e "s?CHGRP_COMMAND?$(CHGRP_COMMAND)?" \ + -e "s?MV_COMMAND?$(MV_COMMAND)?" \ + -e "s?RM_COMMAND?$(RM_COMMAND)?" \ + ../src/exicyclog.src > exicyclog-t + @mv exicyclog-t exicyclog + @chmod a+x exicyclog + @echo ">>> exicyclog script built"; echo "" + +# Target for the exinext utility script +exinext: Makefile config.h ../src/exinext.src + @rm -f exinext + sed \ + -e "s?PROCESSED_FLAG?This file has been so processed.?"\ + -e "/^# /p" \ + -e "/^# /d" \ + -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \ + -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \ + -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \ + ../src/exinext.src > exinext-t + @mv exinext-t exinext + @chmod a+x exinext + @echo ">>> exinext script built"; echo "" + +# Target for the exiwhat utility script +exiwhat: Makefile config.h ../src/exiwhat.src + @rm -f exiwhat + sed \ + -e "s?PROCESSED_FLAG?This file has been so processed.?"\ + -e "/^# /p" \ + -e "/^# /d" \ + -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \ + -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \ + -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \ + -e "s?EXIWHAT_PS_CMD?$(EXIWHAT_PS_CMD)?" \ + -e "s?EXIWHAT_PS_ARG?$(EXIWHAT_PS_ARG)?" \ + -e "s?EXIWHAT_KILL_SIGNAL?$(EXIWHAT_KILL_SIGNAL)?" \ + -e "s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)?" \ + -e "s?EXIWHAT_MULTIKILL_CMD?$(EXIWHAT_MULTIKILL_CMD)?" \ + -e "s?EXIWHAT_MULTIKILL_ARG?$(EXIWHAT_MULTIKILL_ARG)?" \ + ../src/exiwhat.src > exiwhat-t + @mv exiwhat-t exiwhat + @chmod a+x exiwhat + @echo ">>> exiwhat script built"; echo "" + +# Target for the exim_checkaccess utility script +exim_checkaccess: Makefile config.h ../src/exim_checkaccess.src + @rm -f exim_checkaccess + sed \ + -e "s?PROCESSED_FLAG?This file has been so processed.?"\ + -e "/^# /p" \ + -e "/^# /d" \ + -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \ + -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \ + -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + ../src/exim_checkaccess.src > exim_checkaccess-t + @mv exim_checkaccess-t exim_checkaccess + @chmod a+x exim_checkaccess + @echo ">>> exim_checkaccess script built"; echo "" + +# Target for the Exim monitor start-up script +eximon: Makefile config.h ../src/eximon.src ../OS/eximon.conf-Default \ + ../Local/eximon.conf + @rm -f eximon + $(SHELL) $(SCRIPTS)/Configure-eximon + sed \ + -e "s?PROCESSED_FLAG?This file has been so processed.?"\ + -e "/^# /p" \ + -e "/^# /d" \ + -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \ + -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \ + -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \ + -e "s?BASENAME_COMMAND?$(BASENAME_COMMAND)?" \ + -e "s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)?" \ + -e "s?X11_LD_LIBRARY?$(X11_LD_LIB)?" \ + ../src/eximon.src >> eximon + @echo ">>> eximon script built"; echo "" + +# Targets for utilities; these are all Perl scripts that have to get the +# location of Perl put in them. A few need other things as well. + +exigrep: Makefile ../src/exigrep.src + @rm -f exigrep + sed \ + -e "s?PROCESSED_FLAG?This file has been so processed.?"\ + -e "/^# /p" \ + -e "/^# /d" \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + -e "s?ZCAT_COMMAND?$(ZCAT_COMMAND)?" \ + -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \ + ../src/exigrep.src > exigrep-t + @mv exigrep-t exigrep + @chmod a+x exigrep + @echo ">>> exigrep script built"; echo "" + +eximstats: Makefile ../src/eximstats.src + @rm -f eximstats + sed \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + ../src/eximstats.src > eximstats-t + @mv eximstats-t eximstats + @chmod a+x eximstats + @echo ">>> eximstats script built"; echo "" + +exiqgrep: Makefile ../src/exiqgrep.src + @rm -f exiqgrep + sed \ + -e "s?PROCESSED_FLAG?This file has been so processed.?"\ + -e "/^# /p" \ + -e "/^# /d" \ + -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + ../src/exiqgrep.src > exiqgrep-t + @mv exiqgrep-t exiqgrep + @chmod a+x exiqgrep + @echo ">>> exiqgrep script built"; echo "" + +exiqsumm: Makefile ../src/exiqsumm.src + @rm -f exiqsumm + sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + ../src/exiqsumm.src > exiqsumm-t + @mv exiqsumm-t exiqsumm + @chmod a+x exiqsumm + @echo ">>> exiqsumm script built"; echo "" + +exipick: Makefile ../src/exipick.src + @rm -f exipick + sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \ + ../src/exipick.src > exipick-t + @mv exipick-t exipick + @chmod a+x exipick + @echo ">>> exipick script built"; echo "" + +transport-filter.pl: Makefile ../src/transport-filter.src + @rm -f transport-filter.pl + sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + ../src/transport-filter.src > transport-filter.pl-t + @mv transport-filter.pl-t transport-filter.pl + @chmod a+x transport-filter.pl + @echo ">>> transport-filter.pl script built"; echo "" + +convert4r3: Makefile ../src/convert4r3.src + @rm -f convert4r3 + sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + ../src/convert4r3.src > convert4r3-t + @mv convert4r3-t convert4r3 + @chmod a+x convert4r3 + @echo ">>> convert4r3 script built"; echo "" + +convert4r4: Makefile ../src/convert4r4.src + @rm -f convert4r4 + sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + ../src/convert4r4.src > convert4r4-t + @mv convert4r4-t convert4r4 + @chmod a+x convert4r4 + @echo ">>> convert4r4 script built"; echo "" + + +# Targets for final binaries; the main one has a build number which is +# updated each time. We don't bother with that for the auxiliaries. + +OBJ_EXIM = acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \ + directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \ + filtertest.o globals.o \ + header.o host.o ip.o log.o lss.o match.o moan.o \ + os.o parse.o queue.o \ + rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o \ + route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \ + store.o string.o tls.o tod.o transport.o tree.o verify.o \ + local_scan.o $(EXIM_PERL) + +exim: pcre/libpcre.a lookups/lookups.a auths/auths.a \ + routers/routers.a transports/transports.a \ + $(OBJ_EXIM) version.c + @echo " " + awk '{ print ($$1+1) }' cnumber.h > cnumber.temp + rm -f cnumber.h; mv cnumber.temp cnumber.h + $(CC) -c $(CFLAGS) $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) version.c + rm -f exim + $(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \ + pcre/libpcre.a \ + routers/routers.a transports/transports.a lookups/lookups.a \ + auths/auths.a \ + $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \ + $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \ + $(PERL_LIBS) $(TLS_LIBS) + @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ + echo $(STRIP_COMMAND) exim; \ + $(STRIP_COMMAND) exim; \ + fi + $(EXIM_CHMOD) + @echo " " + @echo ">>> exim binary built" + @echo " " + +# The utility for dumping the contents of an exim database + +OBJ_DUMPDB = exim_dumpdb.o util-os.o util-store.o + +exim_dumpdb: $(OBJ_DUMPDB) + $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \ + $(LIBS) $(EXTRALIBS) $(DBMLIB) + @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ + echo $(STRIP_COMMAND) exim_dumpdb; \ + $(STRIP_COMMAND) exim_dumpdb; \ + fi + @echo " " + @echo ">>> exim_dumpdb utility built" + @echo " " + +# The utility for interrogating/fixing the contents of an exim database + +OBJ_FIXDB = exim_fixdb.o util-os.o util-store.o + +exim_fixdb: $(OBJ_FIXDB) + $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \ + $(LIBS) $(EXTRALIBS) $(DBMLIB) + @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ + echo $(STRIP_COMMAND) exim_fixdb; \ + $(STRIP_COMMAND) exim_fixdb; \ + fi + @echo " " + @echo ">>> exim_fixdb utility built" + @echo " " + +# The utility for tidying the contents of an exim database + +OBJ_TIDYDB = exim_tidydb.o util-os.o util-store.o + +exim_tidydb: $(OBJ_TIDYDB) + $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \ + $(LIBS) $(EXTRALIBS) $(DBMLIB) + @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ + echo $(STRIP_COMMAND) exim_tidydb; \ + $(STRIP_COMMAND) exim_tidydb; \ + fi + @echo " " + @echo ">>> exim_tidydb utility built" + @echo " " + +# The utility for building dbm files + +exim_dbmbuild: exim_dbmbuild.o + $(LNCC) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \ + $(LIBS) $(EXTRALIBS) $(DBMLIB) + @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ + echo $(STRIP_COMMAND) exim_dbmbuild; \ + $(STRIP_COMMAND) exim_dbmbuild; \ + fi + @echo " " + @echo ">>> exim_dbmbuild utility built" + @echo " " + +# The utility for locking a mailbox while messing around with it + +exim_lock: exim_lock.c + $(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c + $(LNCC) -o exim_lock $(LFLAGS) exim_lock.o \ + $(LIBS) $(EXTRALIBS) + @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ + echo $(STRIP_COMMAND) exim_lock; \ + $(STRIP_COMMAND) exim_lock; \ + fi + @echo " " + @echo ">>> exim_lock utility built" + @echo " " + +# The X-based Exim monitor program's binary part. There's a macro for cutting +# out the modified TextPop module, because some antique link editors cannot +# handle the fact that it is redefining things that are found later in the +# Xaw library. + +# Object modules that are the unique Eximon modules + +MONBIN = em_StripChart.o $(EXIMON_TEXTPOP) em_globals.o em_init.o \ + em_log.o em_main.o em_menu.o em_queue.o em_strip.o \ + em_text.o em_xs.o + +# The complete modules list also includes some specially compiled versions of +# code from the main Exim source tree. + +OBJ_MONBIN = util-spool_in.o util-store.o util-string.o tod.o tree.o $(MONBIN) + +eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) pcre/libpcre.a \ + ../exim_monitor/em_version.c + $(CC) -o em_version.o -c \ + $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c + $(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \ + $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 pcre/libpcre.a \ + $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc + @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ + echo $(STRIP_COMMAND) eximon.bin; \ + $(STRIP_COMMAND) eximon.bin; \ + fi + @echo " " + @echo ">>> exim monitor binary built" + @echo " " + + +# Compile step for most of the exim modules. HDRS is a list of headers +# which cause everthing to be rebuilt. PHDRS is the same, for the use +# of routers, transports, and authenticators. I can't find a way of doing this +# in one. This list is overkill, but it doesn't really take much time to +# rebuild Exim on a modern computer. + +HDRS = config.h dbfunctions.h dbstuff.h exim.h functions.h globals.h local_scan.h macros.h mytypes.h structs.h +PHDRS = ../config.h ../dbfunctions.h ../dbstuff.h ../exim.h ../functions.h ../globals.h ../local_scan.h ../macros.h ../mytypes.h ../structs.h + +.SUFFIXES: .o .c +.c.o:; $(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c + +# This is the dummy module for use by test compiles of individual modules. It +# contains functions such as log_write() that may be called from bits of Exim +# in the tested code. + +dummies.o: dummies.c + +# Compile instructions for perl.o for when EXIM_PERL is set + +perl.o: $(HDRS) perl.c + $(PERL_CC) $(PERL_CCOPTS) $(INCLUDE) -c perl.c + +# Compile instructions for the database utility modules + +exim_dumpdb.o: $(HDRS) exim_dbutil.c + $(CC) -c $(CFLAGS) $(INCLUDE) \ + -DCOMPILE_UTILITY \ + -DEXIM_DUMPDB \ + -o exim_dumpdb.o exim_dbutil.c + +exim_fixdb.o: $(HDRS) exim_dbutil.c + $(CC) -c $(CFLAGS) $(INCLUDE) \ + -DCOMPILE_UTILITY \ + -DEXIM_FIXDB \ + -o exim_fixdb.o exim_dbutil.c + +exim_tidydb.o: $(HDRS) exim_dbutil.c + $(CC) -c $(CFLAGS) $(INCLUDE) \ + -DCOMPILE_UTILITY \ + -DEXIM_TIDYDB \ + -o exim_tidydb.o exim_dbutil.c + +# Compile instructions for exim_dbmbuild + +exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c + $(CC) -c $(CFLAGS) $(INCLUDE) -o exim_dbmbuild.o exim_dbmbuild.c + +# Utilities use special versions of some modules - typically with debugging +# calls cut out. + +util-spool_in.o: $(HDRS) spool_in.c + $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c + +util-store.o: $(HDRS) store.c + $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c + +util-string.o: $(HDRS) string.c + $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c + +util-os.o: $(HDRS) os.c + $(CC) -c $(CFLAGS) $(INCLUDE) \ + -DCOMPILE_UTILITY \ + -DOS_LOAD_AVERAGE \ + -DFIND_RUNNING_INTERFACES \ + -o util-os.o os.c + +# The local scan module depends only on its own special header, and is compiled +# from a source whose location is set by configuration. + +local_scan.o: Makefile local_scan.h ../$(LOCAL_SCAN_SOURCE) + $(CC) -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE) + +# Dependencies for the "ordinary" exim modules + +acl.o: $(HDRS) acl.c +child.o: $(HDRS) child.c +crypt16.o: $(HDRS) crypt16.c +daemon.o: $(HDRS) daemon.c +dbfn.o: $(HDRS) dbfn.c +debug.o: $(HDRS) debug.c +deliver.o: $(HDRS) deliver.c +directory.o: $(HDRS) directory.c +dns.o: $(HDRS) dns.c +enq.o: $(HDRS) enq.c +exim.o: $(HDRS) exim.c +expand.o: $(HDRS) expand.c +filter.o: $(HDRS) filter.c +filtertest.o: $(HDRS) filtertest.c +globals.o: $(HDRS) globals.c +header.o: $(HDRS) header.c +host.o: $(HDRS) host.c +ip.o: $(HDRS) ip.c +log.o: $(HDRS) log.c +lss.o: $(HDRS) lss.c +match.o: $(HDRS) match.c +moan.o: $(HDRS) moan.c +os.o: $(HDRS) os.c +parse.o: $(HDRS) parse.c +queue.o: $(HDRS) queue.c +rda.o: $(HDRS) rda.c +readconf.o: $(HDRS) readconf.c +receive.o: $(HDRS) receive.c +retry.o: $(HDRS) retry.c +rewrite.o: $(HDRS) rewrite.c +rfc2047.o: $(HDRS) rfc2047.c +route.o: $(HDRS) route.c +search.o: $(HDRS) search.c +sieve.o: $(HDRS) sieve.c +smtp_in.o: $(HDRS) smtp_in.c +smtp_out.o: $(HDRS) smtp_out.c +spool_in.o: $(HDRS) spool_in.c +spool_out.o: $(HDRS) spool_out.c +store.o: $(HDRS) store.c +string.o: $(HDRS) string.c +tls.o: $(HDRS) tls.c tls-gnu.c tls-openssl.c +tod.o: $(HDRS) tod.c +transport.o: $(HDRS) transport.c +tree.o: $(HDRS) tree.c +verify.o: $(HDRS) verify.c + +# The module containing tables of available lookups, routers, auths, and +# transports must be rebuilt if any of them are. However, because the makefiles +# for the drivers are always run, we don't actually put the dependencies here, +# because if we do, some version of "make" (e.g. IRIX) insist on rebuilding +# drtables.o even though the .a files haven't in fact been updated. Instead +# it is arranged that the lower-level makefiles remove drtables.o when they +# rebuild the .a files. + +drtables.o: $(HDRS) drtables.c + + +# The exim monitor's private modules - the sources live in a private +# subdirectory. The final binary combines the private modules with some +# modules from the main exim binary. + +em_StripChart.o: ../exim_monitor/em_StripChart.c +em_TextPop.o: ../exim_monitor/em_TextPop.c +em_globals.o: ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h +em_init.o: ../exim_monitor/em_init.c ../exim_monitor/em_hdr.h +em_log.o: ../exim_monitor/em_log.c ../exim_monitor/em_hdr.h +em_main.o: ../exim_monitor/em_main.c ../exim_monitor/em_hdr.h +em_menu.o: ../exim_monitor/em_menu.c ../exim_monitor/em_hdr.h +em_queue.o: ../exim_monitor/em_queue.c ../exim_monitor/em_hdr.h +em_strip.o: ../exim_monitor/em_strip.c ../exim_monitor/em_hdr.h +em_text.o: ../exim_monitor/em_text.c ../exim_monitor/em_hdr.h +em_xs.o: ../exim_monitor/em_xs.c ../exim_monitor/em_hdr.h +em_version.o: ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h +$(MONBIN): $(HDRS) + $(CC) -o $@ -c $(CFLAGS) -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \ + ../exim_monitor/`echo $@ | sed 's/o$$/c/'` + + +# Targets for the various libraries that Exim uses. This coding is tedious, +# because different versions of "make" behave in different ways with regard +# to rebuilding. If these target names are of the form pcre/libpcre.a, for +# example, then a forcing mechanism is required to get them obeyed each time. +# That's fine on Solaris and other systems; the rebuilding of the exim target +# happens only if the libraries are actually rebuilt. However, on IRIX, if +# the target is forced, the exim target gets unnecessarily rebuilt even if +# the .a file is not. Contrariwise, if we use dummy names, they don't interact +# with the building of exim (and eximon.bin), but for libpcre Exim doesn't get +# rebuilt when it should. (For the others it does, because they remove +# drtables.o when they rebuild.) To get round this, we forcibly remove the +# binary when it needs to be rebuilt. + +# The PCRE regex library. Move the pcretest program to the util directory. Some +# "clever" versions of make notice that there are two successive shell +# commands, and they run them in the same shell. This means that we have to +# take care to encapsulate change of directory in parentheses, so that it +# reverts when it should. + +buildpcre: + @(cd pcre; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" \ + CFLAGS="$(CFLAGS) $(PCRE_CFLAGS)" \ + RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)") + @if $(SHELL) $(SCRIPTS)/newer pcre/libpcre.a exim; then \ + rm -f exim eximon.bin; fi + +# The lookups library. + +buildlookups: + @cd lookups; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"; \ + echo " " + +# The routers library. + +buildrouters: + @cd routers; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \ + echo " " + +# The transports library. + +buildtransports: + @cd transports; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \ + echo " " + +# The library of authorization modules + +buildauths: + @cd auths; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \ + echo " " + +# The "clean", "install", and "makefile" targets just pass themselves back to +# the main Exim makefile. These targets will be obeyed only if "make" is obeyed +# for them in the build directory. + +clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@ + +# Targets for building stand-alone testing programs for basic testing of +# some of the building blocks. These are not integrated with the makefile- +# building targets. If you change something that is going to cause the +# makefile to be rebuilt, you must run "make makefile" before running one +# of these. + +# The testing programs use different versions of some modules - usually +# with bits cut out that are not relevant to the test in hand. For those +# that are used by several tests, we use a different name. + +sa-globals.o: $(HDRS) globals.c + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c + +sa-os.o: $(HDRS) os.c + $(CC) -c $(CFLAGS) $(INCLUDE) \ + -DFIND_RUNNING_INTERFACES \ + -o sa-os.o os.c + +# These are the test targets themselves + +test_dbfn: config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \ + string.o tod.o version.o + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c + $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \ + dummies.o sa-globals.o sa-os.o store.o string.o \ + tod.o version.o $(LIBS) $(DBMLIB) + rm -f dbfn.o + +test_host: config.h host.c dns.c dummies.o sa-globals.o sa-os.o store.o \ + string.o tod.o tree.o + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c + $(LNCC) -o test_host $(LFLAGS) \ + host.o dns.o dummies.o sa-globals.o os.o store.o string.o tod.o tree.o \ + $(LIBS) $(LIBRESOLV) + rm -f dummies.o host.o dns.o + +test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c + $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \ + sa-globals.o store.o string.o tod.o $(LIBS) + rm -f os.o + +test_parse: config.h parse.c dummies.o sa-globals.o \ + store.o string.o tod.o version.o + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c + $(LNCC) -o test_parse $(LFLAGS) parse.o \ + dummies.o sa-globals.o store.o string.o tod.o version.o + rm -f parse.o + +test_string: config.h string.c dummies.o sa-globals.o store.o tod.o + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c + $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \ + dummies.o sa-globals.o store.o tod.o $(LIBS) + rm -f string.o + +# End diff --git a/src/OS/Makefile-CYGWIN b/src/OS/Makefile-CYGWIN new file mode 100644 index 000000000..e9b7a9ee7 --- /dev/null +++ b/src/OS/Makefile-CYGWIN @@ -0,0 +1,113 @@ +# $Cambridge: exim/src/OS/Makefile-CYGWIN,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# OS-specific file for Cygwin. + +# This file provided by Pierre A. Humblet + +HAVE_ICONV = yes +CFLAGS= -g -Wall -O2 +LIBS= -lcrypt -lresolv +LIBS_EXIM= -liconv +EXIWHAT_PS_ARG=-as +EXIWHAT_KILL_SIGNAL=-USR1 +EXIWHAT_EGREP_ARG='/(EXIM|exim)[0-9. -]*$$' + +DBMLIB=-lgdbm +USE_GDBM=YES + +# Some OS add a suffix to executables +EXE = .exe + +# To add a resource file with an icon +LIBS_EXIM +=../Local/exim_res.o + +# To produce a linker map +#LIBS_EXIM+=-Wl,-Map,Exim.Map + + +################################################## +# The following is normaly set in local/Makefile. +# Makefile.cygwin provides defaults with which the +# precompiled version is built +################################################## + +BIN_DIRECTORY=/usr/bin +CONFIGURE_FILE=/etc/exim.conf +EXIM_USER=18 # This changes if user exim exists +EXIM_GROUP=544 # Administrators +SPOOL_DIRECTORY=/var/spool/exim +LOG_FILE_PATH=/var/log/exim/exim_%s.log +TIMEZONE_DEFAULT = "" + +AUTH_CRAM_MD5=yes +AUTH_PLAINTEXT=yes +AUTH_SPA=yes + +SUPPORT_TLS=yes +TLS_LIBS=-lssl -lcrypto + +ROUTER_ACCEPT=yes +ROUTER_DNSLOOKUP=yes +ROUTER_IPLITERAL=yes +ROUTER_MANUALROUTE=yes +ROUTER_QUERYPROGRAM=yes +ROUTER_REDIRECT=yes + +TRANSPORT_APPENDFILE=yes +TRANSPORT_AUTOREPLY=yes +TRANSPORT_PIPE=yes +TRANSPORT_SMTP=yes + +SUPPORT_MAILDIR=yes +SUPPORT_MAILSTORE=yes +SUPPORT_MBX=yes + +LOOKUP_DBM=yes +LOOKUP_LSEARCH=yes + +# LOOKUP_CDB=yes +LOOKUP_DNSDB=yes +# LOOKUP_DSEARCH=yes +# LOOKUP_LDAP=yes +# LOOKUP_MYSQL=yes +# LOOKUP_NIS=yes +# LOOKUP_NISPLUS=yes +# LOOKUP_ORACLE=yes +LOOKUP_PASSWD=yes +# LOOKUP_PGSQL=yes +# LOOKUP_WHOSON=yes + +# It is important to define this variable but its value is always overridden +CONFIGURE_OWNER=544 + +EXICYCLOG_MAX=10 + +COMPRESS_COMMAND=/usr/bin/gzip +COMPRESS_SUFFIX=gz +ZCAT_COMMAND=/usr/bin/zcat + +# EXIM_PERL=perl.o + +# Comment the two lines below if you do not have PAM, e.g. from +# ftp://ftp.uni-erlangen.de/pub/pc/gnuwin32/cygwin/porters/Humblet_Pierre_A +SUPPORT_PAM=yes +CFLAGS += -DINCLUDE_PAM -I ../pam -I ../../pam + +APPENDFILE_MODE = 0644 # default if no ntsec +APPENDFILE_DIRECTORY_MODE = 0777 +APPENDFILE_LOCKFILE_MODE = 0666 +EXIMDB_DIRECTORY_MODE = 0777 +EXIMDB_MODE = 0666 +EXIMDB_LOCKFILE_MODE = 0666 +INPUT_DIRECTORY_MODE = 0777 +LOG_DIRECTORY_MODE = 0777 +LOG_MODE = 0666 +MSGLOG_DIRECTORY_MODE = 0777 +SPOOL_DIRECTORY_MODE = 0777 +SPOOL_MODE = 0666 + +# PERL_CC=gcc -g -O2 -I ../minires +# PERL_CCOPTS= -dD -save-temps -I ../minires +# PERL_LIBS = /usr/lib/perl5/5.6.1/cygwin-multi/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl5/5.6.1/cygwin-multi/CORE -llibperl5_6_1 + +# End diff --git a/src/OS/Makefile-DGUX b/src/OS/Makefile-DGUX new file mode 100644 index 000000000..4f0439b93 --- /dev/null +++ b/src/OS/Makefile-DGUX @@ -0,0 +1,33 @@ +# $Cambridge: exim/src/OS/Makefile-DGUX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for DGUX +# +# Written by Ken Bailey (K.Bailey@rbgkew.org.uk) Feb 1998 +# on dgux R4.11MU04 generic AViiON mc88100 +# with no X + +# Minor tidies to remove settings that are actually the default, +# in line with the style of other system files - PH. + +BASENAME_COMMAND=/bin/basename +CHOWN_COMMAND=/bin/chown +CHGRP_COMMAND=/bin/chgrp + +# PERL +# Perl is not necessary for running Exim itself, but some Perl utilities +# are provided for processing the logs. Perl 5 is assumed. +# DG ship perl version 4.036 in /bin/perl so need to use locally installed perl + +PERL_COMMAND=/usr/local/bin/perl + +# dg's version of gcc likes O2 + +CFLAGS=-O2 + +RANLIB=@true +LIBS=-lsocket -lnsl +LIBRESOLV=-lresolv +DBMLIB=-ldbm + +# End + diff --git a/src/OS/Makefile-Darwin b/src/OS/Makefile-Darwin new file mode 100644 index 000000000..6b8cdc8a6 --- /dev/null +++ b/src/OS/Makefile-Darwin @@ -0,0 +1,26 @@ +# $Cambridge: exim/src/OS/Makefile-Darwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for Darwin (Mac OS X). + +CC=cc + +BASENAME_COMMAND=look_for_it +CHOWN_COMMAND=/usr/sbin/chown + +HAVE_SA_LEN=YES + +CFLAGS=-O -no-cpp-precomp -DBIND_8_COMPAT + +USE_DB = yes +DBMLIB = + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +EXIWHAT_PS_ARG=ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/src/OS/Makefile-Default b/src/OS/Makefile-Default new file mode 100644 index 000000000..5e0640568 --- /dev/null +++ b/src/OS/Makefile-Default @@ -0,0 +1,332 @@ +# $Cambridge: exim/src/OS/Makefile-Default,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +################################################## +# The Exim mail transport agent # +################################################## + +# Generic default make file containing settings that relate to the OS or +# to selectable features within the OS. The configuration options for Exim +# itself live in Local/Makefile, which is constructed by editing src/EDITME. + +# These settings are basic defaults which may be overridden, either by the +# generic OS-specific files, or by site-specific files. Do not edit this file. +# Instead, edit or create suitable OS-specific and/or site specific files. +# See the manual for details. + + +# MAKE_SHELL contains the name of the shell to be used for executing commands +# from the make files. Normally /bin/sh should be used. + +MAKE_SHELL=/bin/sh + + +# BASENAME_COMMAND contains the path to the "basename" command, which varies +# from OS to OS. This is used when building the Exim monitor script only. (See +# also HOSTNAME_COMMAND.) If BASENAME_COMMAND is set to "look_for_it" then the +# script checks for /usr/bin/basename and /bin/basename, and if neither is +# found, it uses /usr/ucb/basename. This copes with Solaris 2 and Linux, both +# of which come in different versions. + +BASENAME_COMMAND=/usr/bin/basename + + +# If you set STRIP_COMMAND to the path of the "strip" command, it will be run +# on every binary that is built. It is left unset by default, which leaves +# the binaries unstripped. + +# STRIP_COMMAND=/usr/bin/strip + + +# Some of the following commands live in different places in different OS. We +# include them all here for generality. + +CHOWN_COMMAND=/usr/bin/chown +CHGRP_COMMAND=/usr/bin/chgrp +MV_COMMAND=/bin/mv +RM_COMMAND=/bin/rm + + +# Some operating systems have different ways of building libraries of +# functions. This macro defines the command to do this, defaulting to +# the "ar" command with options "cq". + +AR=ar cq + + +# Not all operating systems have the iconv() function. Those that do have +# +# HAVE_ICONV=yes +# +# in their OS-specific Makefiles. On those that don't it is possible to +# install an independent implementation of iconv(). If you've done this, +# add "HAVE_ICONV=yes" to your Local/Makefile. + + +# Perl is not necessary for running Exim itself, except when EXIM_PERL +# is set to cause Perl embedding. However, some Perl utilities are provided +# for processing the logs. Perl 5 is assumed. + +PERL_COMMAND=/usr/bin/perl + + +# CC contains the name of the C compiler to be used. + +CC=gcc + + +# CFLAGS contains flags to be passed to the compiler. Nothing is defaulted +# here; instead each OS-dependent Makefile contains a default setting. + +# CFLAGS=-O + + +# LFLAGS contains flags to be passed to the link editor. Nothing is defaulted +# here; instead each OS-dependent Makefile contains a default setting if one +# is needed. + +# LFLAGS= + + +# LIBS and EXTRALIBS contain library settings that are used on linking +# commands to build binaries. The OS-dependent Makefile may contain a default +# setting for LIBS, leaving EXTRALIBS available for adding further libraries +# that are required for optional extras. + +# LIBS= +# EXTRALIBS= + + +# LIBS_EXIM and EXTRALIBS_EXIM contain library settings that are used +# only when linking the Exim binary. They are not used for other binaries. +# One possible use is for the TCP wrappers library. + +# LIBS_EXIM= +# EXTRALIBS_EXIM= + + +# LIBS_EXIMON and EXTRALIBS_EXIMON contain library settings that are +# used only when linking the Exim monitor binary. They are not used for +# other binaries. + +# LIBS_EXIMON= +# EXTRALIBS_EXIMON= + + +# PCRE_CFLAGS contains flags to be passed to the CFLAGS parameter of the +# makefile for building the PCRE regular expression library, in addition +# to CFLAGS. Typical use is to set -DUSE_BCOPY on legacy systems that lack +# the memmove() function but do have bcopy(). + +# PCRE_CFLAGS= + + +# The error name for quota exceeded varies among operating systems, and +# even, unfortunately, in different versions of the same operating system. +# EDQUOT was not in Sys V, but is in SPEC 1170, apparently. It was used +# in SunOS4, but got taken out for SunOS5, where ENOSPC was given if a quota +# was exceeded. However, it got put back into SunOS5 with a patch to 5.4 in +# order to comply with SPEC 1170. Thus even different patch levels of the same +# system (SunOS5) may use different numbers. +# +# If you don't have quotas or are not interested in handling quota errors +# specially, just set this variable to 0. If it is not set, it defaults to +# EDQUOT if that is defined for the OS; otherwise it defaults to ENOSPC. + +# ERRNO_QUOTA=EDQUOT + + +# The exiwhat utility script finds all the processes running Exim, and sends +# them a SIGUSR1 signal to get them to write their status to a file. There are +# two ways in which this can be done: +# +# (1) If the OS has a command to find processes and signal them, that can be +# used. Linux has "killall"; Solaris has "pkill". (Note: "killall" on Solaris +# does something very different - and disastrous.) The following are set in the +# OS-specific Makefiles for those OS where this can be done: + +# EXIWHAT_MULTIKILL_CMD= +# EXIWHAT_MULTIKILL_ARG= + +# (2) For other operating systems, exiwhat calls the ps command and egreps the +# output in order to find all the processes running Exim. The arguments for the +# various commands needed to do this vary from OS to OS. These defaults work on +# Solaris 2, HPUX, and IRIX. The OS-specific Makefiles have different versions +# for other systems, and you can override with your own requirements in your +# private Makefiles in the Local directory. The most commonly found +# alternatives are -ax instead of -e for the ps argument, and / instead of a +# blank before the name exim for the egrep argument on systems whose ps output +# shows the full path name. The quotes for the egrep argument are specified +# here so that leading white space can be used. This value should always be +# given in single quotes. + +EXIWHAT_PS_CMD=/bin/ps +EXIWHAT_PS_ARG=-e +EXIWHAT_EGREP_ARG=' exim( |$$|-)' + +# For both kinds of exiwhat usage, the next setting specifies the signal that +# is sent. + +EXIWHAT_KILL_SIGNAL=-USR1 + + +# IPv6 is coming. Exim has experimental support that has been tried out on +# one or two OS. See the file README.IPV6 for the current status of this +# support. Do not set this option unless you are working on IPv6 and know +# what you are doing. As well as the basic enabling option, there are +# parameters for include and library directories that may be needed for IPv6 +# on some systems. + +# HAVE_IPV6=YES +# IPV6_INCLUDE=-I /usr/ipv6/include +# IPV6_LIBS=-L/usr/ipv6/libs -linet6 + +# Setting this brings in support for A6 DNS records for IPV6. These are +# now expected to be reduced to "experimental" status by the IETF, so +# the code is omitted by default. + +# SUPPORT_A6=yes + +# Exim uses the function getaddrinfo() for converting IPv6 addresses in text +# form to binary. Apparently some operating systems do not support this, or not +# correctly, and require the use of the function inet_pton() instead. The +# following setting enables this. Note, however, the inet_pton() has reduced +# functionality compared with getaddrinfo(). In particular, it does not +# recognize the percent convention for identifying scopes (interfaces) that is +# used by some operating systems. + +# IPV6_USE_INET_PTON=yes + + +# HOSTNAME_COMMAND contains the path to the "hostname" command, which varies +# from OS to OS. This is used when building the Exim monitor script only. (See +# also BASENAME_COMMAND.) If HOSTNAME_COMMAND is set to "look_for_it" then the +# script checks for /usr/bin/hostname and /bin/hostname, and if neither is +# found, it uses /usr/ucb/basename. This copes with Solaris 2, which comes in +# different versions. + +HOSTNAME_COMMAND=/bin/hostname + + +# INCLUDE contains arbitrary include parameters that you may need to use +# when building exim. It is added to every compile command. + +# INCLUDE=-I /some/special/include-directory + + +# Some OS require a separate library to be quoted when linking programs that +# call name resolver functions. This can be set in LIBRESOLV, which is left +# unset here, but is set is some of the OS-specific Makefiles. + +# LIBRESOLV= + + +# Additional libraries and include directories may be required for some +# lookup styles, e.g. LDAP or SQL. LOOKUP_LIBS is included only on the +# command for linking Exim itself, not on any auxiliary programs. You +# don't need to set LOOKUP_INCLUDE if the relevant directories are already +# specified in INCLUDE. + +# LOOKUP_INCLUDE=-I /usr/local/ldap/include -I /usr/local/sql/include +# LOOKUP_LIBS=-L/usr/local/lib -lldap -llber + + +# RANLIB should be set to something that does nothing on systems that do not +# have the ranlib command or do not need to run it on library files. + +RANLIB=ranlib + + +# EXIM_CHMOD is available to specify a command that is automatically applied +# to the Exim binary immediately it is compiled. (I find this useful when +# building test versions.) + +EXIM_CHMOD=@true + + +# LOCAL_SCAN_SOURCE defines the file in which the function local_scan() is +# defined. This provides the administrator with a hook for including C code +# for scanning incoming mails. The path that is defined must be relative to +# the Exim distribution directory. For example + +# LOCAL_SCAN_SOURCE=Local/local_scan.c + +# The default setting points to a template function that doesn't actually do +# any scanning, but just accepts the message. + +LOCAL_SCAN_SOURCE=src/local_scan.c + +# If you want to specify options for your local_scan() that can be set from +# the main Exim configuration file, you need to uncomment the following line, +# and then provide a table of options in your local_scan() source, as described +# in the reference manual. + +# LOCAL_SCAN_HAS_OPTIONS=yes + + +############################################################################# +# The following are all concerned with configuring the way Exim handles its +# database (hints) and other dbm files. + +# Some systems require a separate library to be supplied when linking programs +# that make use of DBM library calls. This can be set in DBMLIB, which is unset +# by default, but is set in some of the OS-specific Makefiles. Setting it in +# your Local/Makefile will override any other setting. + +# DBMLIB= + + +# When Exim is attempting to lock one of its database (hints) files, it +# applies a timeout which can be altered here. + +# EXIMDB_LOCK_TIMEOUT=60 + + +# By default, Exim uses traditional ndbm function calls to handle its indexed +# hints databases. On systems that have Berkeley db installed, this still +# works via the compatibility interface. However, by defining USE_DB you can +# make it use native db function calls. + +# USE_DB=YES + +# Similarly, if you are using gdbm, Exim will by default use the ndbm +# compatibility interface. However, by defining USE_GDBM you can make it +# use the native gdbm function calls. + +# USE_GDBM=YES + + +############################################################################# +# The following definitions are relevant only when compiling the Exim monitor +# program, which requires an X11 display. See the varible EXIM_MONITOR in +# src/EDITME for how to suppress this compilation. + +# X11 contains the location of the X11 libraries and include files. + +X11=/usr/X11R6 + +# XINCLUDE contains options for header inclusion when compiling functions +# that call X11 functions. + +XINCLUDE=-I$(X11)/include + +# XLFLAGS contains flags to be passed to the linker when linking the monitor. + +XLFLAGS=-L$(X11)/lib + +# X11_LD_LIB contains the name of the X11 library that is to be added to +# LD_LIBRARY_PATH when running the monitor program. + +X11_LD_LIB=$(X11)/lib + +# A modified version of the Athena TextPop module is supplied with Exim. The +# modification is to remove the "replace" part of the "search and replace" +# operation because it isn't wanted. TextPop is only one of a number of +# modules that make up the Text widget. Some antique link editors cannot handle +# the case of a replacement module for one of a set of modules. To allow +# the monitor to be linked in such cases, set the value of EXIMON_TEXTPOP +# to be empty. The search operations will then contain a useless "replace" +# option, which is untidy, but does no harm. + +EXIMON_TEXTPOP=em_TextPop.o + +# End diff --git a/src/OS/Makefile-FreeBSD b/src/OS/Makefile-FreeBSD new file mode 100644 index 000000000..179cbacb4 --- /dev/null +++ b/src/OS/Makefile-FreeBSD @@ -0,0 +1,36 @@ +# $Cambridge: exim/src/OS/Makefile-FreeBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for FreeBSD +# There's no setting of CFLAGS here, to allow the system default +# for "make" to be the default. + +PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout + +CHOWN_COMMAND=/usr/sbin/chown + +HAVE_SA_LEN=YES + +# crypt() is in a separate library +LIBS=-lcrypt + +# FreeBSD always ships with Berkeley DB +USE_DB=yes + +# This setting changed on Sheldon Hearn's recommendation +# X11=/usr/X11R6 +X11=$(X11BASE) + +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +.if ${PORTOBJFORMAT} == "elf" +XLFLAGS+=-Wl,-rpath,${X11BASE}/lib +.endif +X11_LD_LIB=$(X11)/lib + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_MULTIKILL_CMD='killall -m' +EXIWHAT_MULTIKILL_ARG='^exim($$|-[0-9.]+-[0-9]+$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/src/OS/Makefile-GNU b/src/OS/Makefile-GNU new file mode 100644 index 000000000..d52fb22c9 --- /dev/null +++ b/src/OS/Makefile-GNU @@ -0,0 +1,24 @@ +# $Cambridge: exim/src/OS/Makefile-GNU,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for GNU/Hurd. + +BASENAME_COMMAND=look_for_it + +DBMLIB = -ldb +USE_DB = yes + +LIBS = -lnsl -lcrypt +LIBRESOLV = -lresolv + +CFLAGS = -O2 -g -Wall + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +EXIWHAT_PS_ARG=ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/src/OS/Makefile-HI-OSF b/src/OS/Makefile-HI-OSF new file mode 100644 index 000000000..c49d12547 --- /dev/null +++ b/src/OS/Makefile-HI-OSF @@ -0,0 +1,10 @@ +# $Cambridge: exim/src/OS/Makefile-HI-OSF,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for HI-OSF/1-MJ and HI-UX/MPP + +CC=cc +CFLAGS=-O +RANLIB=@true +EXIWHAT_EGREP_ARG='/exim( |$$)' + +# End diff --git a/src/OS/Makefile-HI-UX b/src/OS/Makefile-HI-UX new file mode 100644 index 000000000..f8c968aa4 --- /dev/null +++ b/src/OS/Makefile-HI-UX @@ -0,0 +1,14 @@ +# $Cambridge: exim/src/OS/Makefile-HI-UX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for HI-UX + +CC=cc -Aa -D_HIUX_SOURCE +HAVE_SETRESUID=YES +HAVE_SETEUID=NO +XINCLUDE=-I/usr/include/X11R5 +XLFLAGS=-L/usr/lib/X11R5 +DBMLIB = -lndbm +NEED_H_ERRNO=1 +RANLIB=@true + +# End diff --git a/src/OS/Makefile-HP-UX b/src/OS/Makefile-HP-UX new file mode 100644 index 000000000..a5d5374c3 --- /dev/null +++ b/src/OS/Makefile-HP-UX @@ -0,0 +1,17 @@ +# $Cambridge: exim/src/OS/Makefile-HP-UX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for HP-UX later than 9 + +CFLAGS=-O +BASENAME_COMMAND=/bin/basename +HAVE_ICONV=yes +HAVE_SETRESUID=YES +HAVE_SETEUID=NO +XINCLUDE=-I/usr/include/X11R6 -I/usr/contrib/X11R6/include +XLFLAGS=-L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib +X11_LD_LIB=/usr/contrib/X11R6/lib +EXIMON_TEXTPOP= +DBMLIB=-lndbm +RANLIB=@true + +# End diff --git a/src/OS/Makefile-HP-UX-9 b/src/OS/Makefile-HP-UX-9 new file mode 100644 index 000000000..f96a0bc24 --- /dev/null +++ b/src/OS/Makefile-HP-UX-9 @@ -0,0 +1,17 @@ +# $Cambridge: exim/src/OS/Makefile-HP-UX-9,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for HP-UX 9 + +CFLAGS=-O +BASENAME_COMMAND=/bin/basename +HAVE_ICONV=yes +HAVE_SETRESUID=YES +HAVE_SETEUID=NO +XINCLUDE=-I/usr/include/X11R5 +XLFLAGS=-L/usr/lib/X11R5 -L/usr/contrib/X11R5/lib +X11_LD_LIB=/usr/contrib/X11R5/lib +EXIMON_TEXTPOP= +DBMLIB=-lndbm +RANLIB=@true + +# End diff --git a/src/OS/Makefile-IRIX b/src/OS/Makefile-IRIX new file mode 100644 index 000000000..bab1e9910 --- /dev/null +++ b/src/OS/Makefile-IRIX @@ -0,0 +1,14 @@ +# $Cambridge: exim/src/OS/Makefile-IRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for IRIX + +HAVE_ICONV=yes +BASENAME_COMMAND=/sbin/basename +HOSTNAME_COMMAND=/usr/bsd/hostname +CFLAGS=-OPT:Olimit=1500 +LIBS=-lmld +XINCLUDE=-I/usr/include/X11 +vfork=fork +RANLIB=@true + +# End diff --git a/src/OS/Makefile-IRIX6 b/src/OS/Makefile-IRIX6 new file mode 100644 index 000000000..3534e5d66 --- /dev/null +++ b/src/OS/Makefile-IRIX6 @@ -0,0 +1,15 @@ +# $Cambridge: exim/src/OS/Makefile-IRIX6,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for IRIX6 on 64-bit systems + +HAVE_ICONV=yes +HOSTNAME_COMMAND=/usr/bsd/hostname +CFLAGS=-O2 -n32 -OPT:Olimit=4000 +LFLAGS=-n32 +LIBS=-lelf +XINCLUDE=-I/usr/include/X11 +XLFLAGS= +vfork=fork +RANLIB=@true + +# End diff --git a/src/OS/Makefile-IRIX632 b/src/OS/Makefile-IRIX632 new file mode 100644 index 000000000..5b09364df --- /dev/null +++ b/src/OS/Makefile-IRIX632 @@ -0,0 +1,18 @@ +# $Cambridge: exim/src/OS/Makefile-IRIX632,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for IRIX 6 on 32-bit systems. +# There seems to be some variation. The commented settings show +# some alternatives. + +HAVE_ICONV=yes +HOSTNAME_COMMAND=/usr/bsd/hostname +#CFLAGS=-OPT:Olimit=1500 -32 -mips2 +CFLAGS=-32 +LFLAGS=-32 +#LIBS=-lmld +LIBS=-lelf +XINCLUDE=-I/usr/include/X11 +vfork=fork +RANLIB=@true + +# End diff --git a/src/OS/Makefile-IRIX65 b/src/OS/Makefile-IRIX65 new file mode 100644 index 000000000..b678e37ae --- /dev/null +++ b/src/OS/Makefile-IRIX65 @@ -0,0 +1,18 @@ +# $Cambridge: exim/src/OS/Makefile-IRIX65,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for IRIX 6.5 + +HAVE_ICONV=yes +HOSTNAME_COMMAND=/usr/bsd/hostname +CC=cc +CFLAGS=-O2 -OPT:Olimit=0 +# CFLAGS=-O2 # override with this (in your Local/Makefile) if using gcc +LFLAGS=-Wl,-LD_MSG:off=85 +LFLAGS= +# nlist has moved from libmld to libelf +LIBS=-lelf +XINCLUDE=-I/usr/include/X11 +vfork=fork +RANLIB=@true + +# End diff --git a/src/OS/Makefile-Linux b/src/OS/Makefile-Linux new file mode 100644 index 000000000..d933c056a --- /dev/null +++ b/src/OS/Makefile-Linux @@ -0,0 +1,31 @@ +# $Cambridge: exim/src/OS/Makefile-Linux,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for Linux. This is for modern Linuxes, +# which use libc6. + +HAVE_ICONV=yes + +BASENAME_COMMAND=look_for_it +CHOWN_COMMAND=look_for_it +CHGRP_COMMAND=look_for_it + +CFLAGS=-O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + +DBMLIB = -ldb +USE_DB = yes + +LIBS = -lnsl -lcrypt +LIBRESOLV = -lresolv + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +EXIWHAT_PS_ARG=ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_MULTIKILL_CMD=killall +EXIWHAT_MULTIKILL_ARG=exim +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/src/OS/Makefile-Linux-libc5 b/src/OS/Makefile-Linux-libc5 new file mode 100644 index 000000000..7ae2152e8 --- /dev/null +++ b/src/OS/Makefile-Linux-libc5 @@ -0,0 +1,23 @@ +# $Cambridge: exim/src/OS/Makefile-Linux-libc5,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for Linux systems using the old libc5 +# version of the C library. + +BASENAME_COMMAND=look_for_it +CHOWN_COMMAND=look_for_it +CHGRP_COMMAND=look_for_it + +CFLAGS=-O + +DBMLIB = -lndbm + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/src/OS/Makefile-NetBSD b/src/OS/Makefile-NetBSD new file mode 100644 index 000000000..0f00789cb --- /dev/null +++ b/src/OS/Makefile-NetBSD @@ -0,0 +1,27 @@ +# $Cambridge: exim/src/OS/Makefile-NetBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for NetBSD (ELF object format) + +CHOWN_COMMAND=/usr/sbin/chown +CFLAGS=-O + +HAVE_SA_LEN=YES +HAVE_IPV6=YES +LIBS=-lcrypt + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# NetBSD always ships with Berkeley DB +USE_DB=yes + +# NetBSD ELF linker needs a -R flag. +XLFLAGS+=-Wl,-R$(X11)/lib/ + +# End diff --git a/src/OS/Makefile-NetBSD-a.out b/src/OS/Makefile-NetBSD-a.out new file mode 100644 index 000000000..1ef7a86c8 --- /dev/null +++ b/src/OS/Makefile-NetBSD-a.out @@ -0,0 +1,24 @@ +# $Cambridge: exim/src/OS/Makefile-NetBSD-a.out,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for NetBSD (a.out/COFF object format) + +CHOWN_COMMAND=/usr/sbin/chown +CFLAGS=-O + +HAVE_SA_LEN=YES +HAVE_IPV6=YES +LIBS=-lcrypt + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# NetBSD always ships with Berkeley DB +USE_DB=yes + +# End diff --git a/src/OS/Makefile-OSF1 b/src/OS/Makefile-OSF1 new file mode 100644 index 000000000..b5a61fb19 --- /dev/null +++ b/src/OS/Makefile-OSF1 @@ -0,0 +1,12 @@ +# $Cambridge: exim/src/OS/Makefile-OSF1,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for OSF1 + +CFLAGS=-O +LIBS=-liconv +HAVE_CRYPT16=yes +HAVE_ICONV=yes +HOSTNAME_COMMAND=/usr/bin/hostname +EXIWHAT_EGREP_ARG='/exim( |$$)' + +# End diff --git a/src/OS/Makefile-OpenBSD b/src/OS/Makefile-OpenBSD new file mode 100644 index 000000000..05d0b3d44 --- /dev/null +++ b/src/OS/Makefile-OpenBSD @@ -0,0 +1,26 @@ +# $Cambridge: exim/src/OS/Makefile-OpenBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for OpenBSD + +CHOWN_COMMAND=/usr/sbin/chown +CHGRP_COMMAND=/usr/sbin/chgrp +CFLAGS=-O2 -Wall + +HAVE_SA_LEN=YES + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib + +EXIWHAT_MULTIKILL_CMD=pkill +EXIWHAT_MULTIKILL_ARG='exim( |$$|-)' +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +HAVE_IPV6=YES + +# OpenBSD always ships with Berkeley DB +USE_DB=yes + +# End diff --git a/src/OS/Makefile-OpenUNIX b/src/OS/Makefile-OpenUNIX new file mode 100644 index 000000000..2d543b64f --- /dev/null +++ b/src/OS/Makefile-OpenUNIX @@ -0,0 +1,19 @@ +# $Cambridge: exim/src/OS/Makefile-OpenUNIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for OpenUNIX + +CC=/usr/bin/cc +CFLAGS=-O -I/usr/local/include +LFLAGS=-L/usr/local/lib + +LIBS=-lsocket -lnsl -lelf -lgen -lresolv +EXTRALIBS_EXIMON=-lICE -lSM + +RANLIB=@true +ERRNO_QUOTA=0 + +X11=/usr/lib/X11 +XINCLUDE=-I/usr/include/X11 +XLFLAGS=-L/usr/lib -L$(X11)/lib + +# End diff --git a/src/OS/Makefile-QNX b/src/OS/Makefile-QNX new file mode 100644 index 000000000..d0f74608d --- /dev/null +++ b/src/OS/Makefile-QNX @@ -0,0 +1,31 @@ +# $Cambridge: exim/src/OS/Makefile-QNX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific makefile for QNX + +BASENAME_COMMAND=/bin/basename +MAKE_SHELL=/usr/bin/bash + +CHOWN_COMMAND=/bin/chown +CHGRP_COMMAND=/bin/chgrp +HOSTNAME_COMMAND=/bin/hostname +MV_COMMAND=/bin/mv +PERL_COMMAND=/usr/bin/perl +RM_COMMAND=/bin/rm + +AR=ar -rc + +CC=cc +CFLAGS=-Otax +LIBIDENTCFLAGS= + +RANLIB=@true +DBMLIB=-ldb +USE_DB=yes +LIBS=-lsocket + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +# End diff --git a/src/OS/Makefile-SCO b/src/OS/Makefile-SCO new file mode 100644 index 000000000..4366f387b --- /dev/null +++ b/src/OS/Makefile-SCO @@ -0,0 +1,29 @@ +# $Cambridge: exim/src/OS/Makefile-SCO,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for SCO + +# It was reported that some versions of gcc (e.g. 2.8.1) require this to be +# CFLAGS=-melf + +CFLAGS=-b elf + +RANLIB=@true +DBMLIB=-lndbm +ERRNO_QUOTA=0 +LIBS=-lsocket +HAVE_ICONV=yes + +X11=/usr/lib/X11 +XINCLUDE=-I/usr/include/X11 +XLFLAGS=-L/usr/lib -L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +# Changes from Frank Bernhardt (30/09/04) + +BASENAME_COMMAND=/bin/basename +CHOWN_COMMAND=/bin/chown +CHGRP_COMMAND=/bin/chgrp +HOSTNAME_COMMAND=/usr/bin/hostname + + +# End diff --git a/src/OS/Makefile-SCO_SV b/src/OS/Makefile-SCO_SV new file mode 100644 index 000000000..48b5f2278 --- /dev/null +++ b/src/OS/Makefile-SCO_SV @@ -0,0 +1,34 @@ +# $Cambridge: exim/src/OS/Makefile-SCO_SV,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for SCO_SV release 5 (tested on 5.0.5 & 5.0.5) +# (see the UNIX_SV files for SCO 4.2) +# Supplied by: Tony Earnshaw + +# Note that 'gcc -melf -m486' applies to gcc 2.7.2 and higher; +# 2.7.1 and SCO's SDK need '-belf'. + +# Removed -lwrap (PH 27/7/00) because not all systems have it + +CFLAGS=-melf -O3 -m486 +LFLAGS=-L/lib -L/usr/lib -L/usr/local/lib +LIBS=-ltinfo -lm -lsocket + +HAVE_ICONV=yes + +RANLIB=@true +DBMLIB=-lndbm +ERRNO_QUOTA=0 + +X11=/usr/lib/X11 +XINCLUDE=-I/usr/include/X11 +XLFLAGS=-L/usr/lib -L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +# Changes from Frank Bernhardt (30/9/04) + +BASENAME_COMMAND=/bin/basename +CHOWN_COMMAND=/bin/chown +CHGRP_COMMAND=/bin/chgrp +HOSTNAME_COMMAND=/usr/bin/hostname + +# End diff --git a/src/OS/Makefile-SunOS4 b/src/OS/Makefile-SunOS4 new file mode 100644 index 000000000..fd08dd23e --- /dev/null +++ b/src/OS/Makefile-SunOS4 @@ -0,0 +1,23 @@ +# $Cambridge: exim/src/OS/Makefile-SunOS4,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for SunOS4 + +CFLAGS=-O + +# Don't need -DSTRERROR_FROM_ERRLIST in PCRE_CFLAGS, because it is in os.h +# for SunOS4, which gets included for pcre. + +PCRE_CFLAGS=-DUSE_BCOPY + +CHOWN_COMMAND=/usr/etc/chown +HOSTNAME_COMMAND=/usr/bin/hostname +EXIT_FAILURE=1 +EXIT_SUCCESS=0 +LIBRESOLV=-lresolv +XINCLUDE=-I/usr/include/X11 + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-30 + +# End diff --git a/src/OS/Makefile-SunOS5 b/src/OS/Makefile-SunOS5 new file mode 100644 index 000000000..1afef4d23 --- /dev/null +++ b/src/OS/Makefile-SunOS5 @@ -0,0 +1,24 @@ +# $Cambridge: exim/src/OS/Makefile-SunOS5,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for SunOS5 + +CFLAGS=-O + +HAVE_ICONV=yes + +BASENAME_COMMAND=look_for_it +HOSTNAME_COMMAND=look_for_it + +RANLIB=@true +LIBS=-lsocket -lnsl -lkstat +LIBRESOLV=-lresolv + +EXIWHAT_MULTIKILL_CMD=pkill +EXIWHAT_MULTIKILL_ARG='exim( |$$|-)' + +X11=/usr/openwin +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib -R$(X11)/lib +X11LIB=$(X11)/lib + +# End diff --git a/src/OS/Makefile-SunOS5-hal b/src/OS/Makefile-SunOS5-hal new file mode 100644 index 000000000..014bac1e1 --- /dev/null +++ b/src/OS/Makefile-SunOS5-hal @@ -0,0 +1,20 @@ +# $Cambridge: exim/src/OS/Makefile-SunOS5-hal,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for SunOS5 on a HAL + +# Note: The HAL runs a standard SunOS5 except that it has a 64 bit C +# compiler called hcc. To make things work pass the -KV7 flag to force +# 32bit compilation - this is necessary to interwork with some libraries. + +CC=hcc +CFLAGS=-O -KV7 +LIBIDENTCFLAGS="-KV7 -O -DHAVE_ANSIHEADERS" +LIBIDENTNAME=sunos5 +RANLIB=@true +LIBS=-lsocket -lnsl -lkstat +LIBRESOLV=-lresolv +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib -R$(X11)/lib + +# End diff --git a/src/OS/Makefile-ULTRIX b/src/OS/Makefile-ULTRIX new file mode 100644 index 000000000..d9cd30262 --- /dev/null +++ b/src/OS/Makefile-ULTRIX @@ -0,0 +1,20 @@ +# $Cambridge: exim/src/OS/Makefile-ULTRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for Ultrix + +MAKE_SHELL=/usr/bin/sh5 + +CFLAGS=-O + +# This can either be /usr/include/X11 or /usr/include/mit depending on +# the particular version of ULTRIX. + +XINCLUDE=-I/usr/include/X11 -I/usr/include/mit + +DBMLIB=-lgdbm + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/src/OS/Makefile-UNIX_SV b/src/OS/Makefile-UNIX_SV new file mode 100644 index 000000000..1f56c59fa --- /dev/null +++ b/src/OS/Makefile-UNIX_SV @@ -0,0 +1,26 @@ +# $Cambridge: exim/src/OS/Makefile-UNIX_SV,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for SCO SVR4.2MP (and maybe Unixware) +# +# *** Note that for SCO 5 the configuration file is called SCO_SV, +# *** and that Unixware7 has its own configuration. This is an old +# *** file that is retained for compatibility. +# +# Note that SCO does not include dbm/ndbm with their standard compiler +# (it is available with /usr/ucb/cc, but that has bugs of its own). You +# should install gcc and gdbm, then execute 'make install-compat' in the +# gdbm source directory. + +CC=gcc -I/usr/local/include +CFLAGS=-O + +RANLIB=@true +DBMLIB=-lgdbm -L/usr/local/lib +ERRNO_QUOTA=0 +LIBS=-lsocket -lelf -lgen -lnsl -lresolv + +X11=/usr/lib/X11 +XINCLUDE=-I/usr/include/X11 +XLFLAGS=-L/usr/lib -L$(X11)/lib + +# End diff --git a/src/OS/Makefile-USG b/src/OS/Makefile-USG new file mode 100644 index 000000000..b49feecc9 --- /dev/null +++ b/src/OS/Makefile-USG @@ -0,0 +1,35 @@ +# $Cambridge: exim/src/OS/Makefile-USG,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for Unixware 2.x +# +# Note that Unixware does not include db/dbm/ndbm with their standard compiler +# (it is available with /usr/ucb/cc, but that has bugs of its own). You +# should install gcc and Berkeley DB (or another dbm library if you really +# insist). If you use a different dbm library you will need to override +# DBMLIB below. +# +# DB 1.85 and 2.x can be found at http://www.sleepycat.com/. +# They have different characteristics. See the discussion of dbm libraries +# in doc/dbm.discuss.txt in the Exim distribution. +# +# DB needs to be compiled with gcc and you need a 'cc' in your path +# before the Unixware CC to compile it. +# +# Don't bother even starting to install exim on Unixware unless +# you have installed gcc and use it for everything. + +CC=gcc -I/usr/local/include +CFLAGS=-O + +RANLIB=@true +DBMLIB=-ldb -L/usr/local/lib +USE_DB=YES +ERRNO_QUOTA=0 +LIBS=-lsocket -lelf -lgen -lnsl -lresolv + +X11=/usr/lib/X11 +XINCLUDE=-I/usr/include/X11 +XLFLAGS=-L/usr/lib -L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +# End diff --git a/src/OS/Makefile-Unixware7 b/src/OS/Makefile-Unixware7 new file mode 100644 index 000000000..5c228cc7f --- /dev/null +++ b/src/OS/Makefile-Unixware7 @@ -0,0 +1,34 @@ +# $Cambridge: exim/src/OS/Makefile-Unixware7,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for Unixware7 +# Based on information from James FitzGibbon + +# If you want to use libbind, you need to +# add -I/usr/local/bind/include to CFLAGS +# add -L/usr/local/bind/lib to LFLAGS +# remove -lresolv from LIBS +# add LOOKUP_LIBS=-lbind +# The new settings should go in your Local/Makefile rather than here; then +# they will be usable for subsequent Exim releases. + +CC=/usr/bin/cc +CFLAGS=-O -I/usr/local/include +LFLAGS=-L/usr/local/lib + +HAVE_ICONV=yes + +LIBS=-lsocket -lnsl -lelf -lgen -lresolv + +# Removed on the advice of Larry Rosenman +# EXTRALIBS=-lwrap + +EXTRALIBS_EXIMON=-lICE -lSM + +RANLIB=@true +ERRNO_QUOTA=0 + +X11=/usr/lib/X11 +XINCLUDE=-I/usr/include/X11 +XLFLAGS=-L/usr/lib -L$(X11)/lib + +# End diff --git a/src/OS/Makefile-mips b/src/OS/Makefile-mips new file mode 100644 index 000000000..9df94e2d7 --- /dev/null +++ b/src/OS/Makefile-mips @@ -0,0 +1,19 @@ +# $Cambridge: exim/src/OS/Makefile-mips,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: OS-specific make file for RiscOS4bsd + +HOSTNAME_COMMAND=/usr/ucb/hostname +EXIT_FAILURE=1 +EXIT_SUCCESS=0 +LIBRESOLV=-lresolv +LIBS=-liberty +XINCLUDE=-I/usr/X11R6/include + +CFLAGS=-O +PCRE_CFLAGS=-DUSE_BCOPY -DSTRERROR_FROM_ERRLIST + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-30 + +# End diff --git a/src/OS/eximon.conf-Default b/src/OS/eximon.conf-Default new file mode 100644 index 000000000..08ef41537 --- /dev/null +++ b/src/OS/eximon.conf-Default @@ -0,0 +1,43 @@ +# $Cambridge: exim/src/OS/eximon.conf-Default,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +# Exim: Default settings for the eximon script which fires up the Exim monitor. +# These can be overridden by OS-specific scripts and local installation +# scripts, and also at run time by shell variables. + +# The name of the eximon binary, usually the same as the eximon script, +# with .bin stuck on the end. + +EXIMON_BINARY=${EXIMON_BINARY-$0.bin} + +# The remaining parameters are values likely to be changed to suit the +# user's taste. They are documented in the EDITME file. + +WINDOW_TITLE=${EXIMON_WINDOW_TITLE-'"${hostname} eximon"'} + +ACTION_OUTPUT=${EXIMON_ACTION_OUTPUT-no} +ACTION_QUEUE_UPDATE=${EXIMON_ACTION_QUEUE_UPDATE-yes} +BODY_MAX=${EXIMON_BODY_MAX-20000} +LOG_DEPTH=${EXIMON_LOG_DEPTH-300} +LOG_WIDTH=${EXIMON_LOG_WIDTH-${EXIMON_WIDTH-950}} +LOG_BUFFER=${EXIMON_LOG_BUFFER-20K} +LOG_FONT=${EXIMON_LOG_FONT--misc-fixed-medium-r-normal-*-14-140-*-*-*-*-iso8859-1} +LOG_STRIPCHARTS='/ <= /in/ + / => /out/ + / => .+ R=local/local/ + / => .+ T=[^ ]*smtp/smtp/' +MENU_EVENT=${EXIMON_MENU_EVENT-'Shift'} +MIN_HEIGHT=${EXIMON_MIN_HEIGHT-162} +MIN_WIDTH=${EXIMON_MIN_WIDTH-103} +QUEUE_DEPTH=${EXIMON_QUEUE_DEPTH-200} +QUEUE_WIDTH=${EXIMON_QUEUE_WIDTH-${EXIMON_WIDTH-950}} +QUEUE_FONT=${EXIMON_QUEUE_FONT-${LOG_FONT}} +QUEUE_MAX_ADDRESSES=${EXIMON_QUEUE_MAX_ADDRESSES-10} +QUEUE_INTERVAL=${EXIMON_QUEUE_INTERVAL-300} +QUEUE_STRIPCHART_NAME=${EXIMON_QUEUE_STRIPCHART_NAME-queue} +SIZE_STRIPCHART=${EXIMON_SIZE_STRIPCHART} +SIZE_STRIPCHART_NAME=${EXIMON_SIZE_STRIPCHART_NAME} +START_SMALL=${EXIMON_START_SMALL-no} +STRIPCHART_INTERVAL=${EXIMON_STRIPCHART_INTERVAL-60} +TEXT_DEPTH=${EXIMON_TEXT_DEPTH-200} + +# End diff --git a/src/OS/os.Configuring b/src/OS/os.Configuring new file mode 100644 index 000000000..df6c57d8d --- /dev/null +++ b/src/OS/os.Configuring @@ -0,0 +1,209 @@ +$Cambridge: exim/src/OS/os.Configuring,v 1.1 2004/10/06 15:07:39 ph10 Exp $ + +Configuring Exim for different Operating Systems +------------------------------------------------ + +These notes describe the way in which Exim is configured at the C program level +for different operating systems. The normal configuration options that apply +independently of the operating system are specified by creating files in the +Local directory, as described in chapter 4 of the manual. + +These notes cover the os.* files in the OS directory, and contain information +for people who want to port the program to some new OS, or to modify the +configuration for an existing port. If you are just wanting to compile Exim on +a system that it already knows about, you do not need to read further unless +there are problems. + +The os.c- files +----------------------- + +There may be an os.c- file for each operating system, but for many of +them it is not necessary. No error occurs is there isn't one. There is a +generic file called os.c which contains code that is common to two or more OS +for setting a restarting or a non-restarting signal, for computing the load +average, and for finding all the network interface addresses. A few OS have +their own individual code for one or more of these. When they do, the code is +put into an os.c- file, which also defines a macro such as +OS_RESTARTING_SIGNAL (for example) to cut out the common code in the generic +os.c. + +The os.h- files +----------------------- + +For each OS that Exim knows about, there is an os.h- file, where + is the OS name. The relevant file is included as a C header file for +all Exim compilation by pointing a symbolic link called os.h at it from the +build directory. The settings are as follows: + +The select() function +--------------------- + +There is a difference in the data type for the second argument to the select() +function in some OS. The macro SELECT_ARG2_TYPE can be used to define the type. +If it is not defined in os.h, then it is defaulted to fs_set in exim.h. + +The dn_expand() function +------------------------ + +There is a difference in the data type for the fourth argument to the +dn_expand() function in some OS. The macro DN_EXPAND_ARG4_TYPE can be used to +define the type. If it is not defined in os.h, then it is defaulted to char * +in exim.h. + +The h_errno variable +-------------------- + +If NEED_H_ERRNO is defined, then a definition of the form + +extern int h_errno + +is included in the compiled code of Exim. + +The strerror() function +----------------------- + +Most systems provide the ANSI standard strerror() function; older systems may +instead have an errlist[] variable in which to look up error texts. Defining +STRERROR_FROM_ERRLIST causes Exim to build its own strerror() function that +mimics the ANSI function by lookup up the error code in errlist. + +Truncating files +---------------- + +The fcntl() option for truncating the length of a file is called F_FREESP in +most systems; in some, however, it is called O_TRUNC. Some os.h files define +F_FREESP to be O_TRUNC for this reason. + +Finding local interfaces +------------------------ + +The SIOCGIFCONF ioctl for finding local interfaces behaves differently on BSD +systems. It returns a vector of ifreq blocks containing sockaddr structures +that can be longer than their sizeof definition, making the returned ifreq +blocks longer than their sizeof definitions. BSD sockaddrs structures contain +an sa_len field giving the actual size. To cope with difference, there is a +macro called HAVE_SA_LEN. If it is defined, code that works on BSD systems is +used. Otherwise, the objects returned by SIOCGIFCONF are assumed to be of +length sizeof(struct ifreq). + +On some operating systems, the SIOCGIFCONF ioctl returns the IP addresses +with the list of interfaces, and there is no need to call SIOCGIFADDR for each +individual address. Mostly, making the second call does no harm, but on Linux +when there are IP aliases, it causes things to go wrong. This also happens on +BSDI. Therefore, there is now a macro to cut it out, called +SIOCGIFCONF_GIVES_ADDR. + +Note that, if IPv6 support is configured, Exim cannot find the IPv6 addresses +on local interfaces by itself. You need to set the local_interfaces option in +this situation. + +Computing load averages +----------------------- + +There are several different ways that load averages are computed. One-off code +is put in the os.c-, but several OS use similar methods, and these +are coded in the generic os.c, using a number of parameters to make variations +between OS. + +Sometimes the load average is not available to unprivileged callers. If +LOAD_AVG_NEEDS_ROOT is set, Exim ensures that it is root before trying to +obtain a load average value. + +(1) If HAVE_BSD_GETLOADAVG is defined, Exim uses a simple call to the +getloadavg() function. + +(2) If HAVE_KSTAT is defined, Exim uses the kstat package as found in Solaris 2 +(but nowhere else as yet). It uses some supplementary definitions: + + LOAD_AVG_KSTAT the kstat to use + LOAD_AVG_KSTAT_MODULE the module to access + LOAD_AVG_KSTAT_SYMBOL the symbol containing the value we want + LOAD_AVG_KSTAT_FIELD the field identity + +(3) If HAVE_DEV_KMEM is defined, Exim reads load average values from the +/dev/kmem device. It uses some supplementary definitions: + + LOAD_AVG_TYPE the data type + LOAD_AVG_SYMBOL the symbol to look up + KERNEL_PATH the name of the kernel + FSCALE a scaling factor + +Sometimes FSCALE is defined in system headers so need not be defined in the +os.h- file. + +Glibc systems and IP options +---------------------------- + +The code for inspecting IP options is the same in all OS except for systems +using glibc (e.g. Linux), which uses a different structure to return data from +getsockopt(). To handle this, there is a macro called + + GLIBC_IP_OPTIONS + +which should be set for Linux (in os.h-Linux) and any other operating system +that uses glibc. + +Options for statvfs() +--------------------- + +The following settings apply to the compilation of the Exim monitor as well as +to the main Exim binary. + +#undefine HAVE_STATFS + +Exim has options for checking the amount of space in the spool partition +before accepting a message, and the monitor has the ability to display a +stripchart of the percentage fullness of a particular disc partition, usually +/var/spool/mail. The standard way of finding out the data is to call the +statvfs() function, but some operating systems use statfs() and some may not +have the ability at all. The Exim code uses STATVFS() for this function and +this gets defined appropriately. HAVE_STATFS is defined before including the +os.h file; undefining it suppresses the code for checking a partition in the +main binary, and for monitoring disc partition in the monitor. + +When HAVE_STATFS is defined, the distinction between statvfs() and statfs() is +made by checking HAVE_SYS_STATVFS_H. If it is defined, then sys/statvfs.h is +included. Otherwise, STATVFS() is defined as a macro for statfs(), and some +further includes are done, according to the following definitions: + +#define HAVE_SYS_MOUNT_H +#define HAVE_VFS_H + +Each of those definitions causes the inclusion of the corresponding system +header file in the Exim monitor compilation. For example, the first one causes + +#include + +to be obeyed. Different systems may require different combinations of these +headers. + +The sys/resource.h header +------------------------- + +One OS does not have the sys/resource.h header. If NO_SYS_RESOURCE_H is defined +in an os.h- file, then the #include for this header is skipped in +exim.h. + +The crypt_h header +------------------ + +Some OS require crypt.h to be included to get a prototype for the crypt() +function. This is needed only when compiling with AUTH support. If CRYPT_H is +defined, then this header is included. + +mmap() support +-------------- + +The CDB support includes the option of handling file operations by using +mmap()/munmap(). This gives a reasonable performance increase which will +probably scale over multiple processes (since the files are mapped read-only +shared). The vast majority of modern operating systems will support mmap +(certainly in the simplified way that it is being used here). For example any +BSD 4.x derived or POSIX compliant system will support it, as will pretty much +any system using dynamically shared link libraries. + +If the OS is believed to support mmap() then the symbol HAVE_MMAP is defined. +Not all systems that support mmap will have had their config files updated to +reflect this. Currently Linux, Sun, BSD and SGI/mips systems have been updated. + +*** End *** diff --git a/src/OS/os.c-GNU b/src/OS/os.c-GNU new file mode 100644 index 000000000..52316a73d --- /dev/null +++ b/src/OS/os.c-GNU @@ -0,0 +1,57 @@ +/* $Cambridge: exim/src/OS/os.c-GNU,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* See the file NOTICE for conditions of use and distribution. */ + +/* GNU-specific code. This is concatenated onto the generic src/os.c file. +GNU/Hurd has approximately the same way to determine the load average as NeXT, +so a variant of this could also be in the generic os.c file. See the GNU EMacs +getloadavg.c file, from which this snippet was derived. getloadavg.c from Emacs +is copyrighted by the FSF under the terms of the GPLv2 or any later version. +Changes are hereby placed under the same license, as requested by the GPL. */ + +#ifndef OS_LOAD_AVERAGE +#define OS_LOAD_AVERAGE + +#include + +static processor_set_t default_set; +static int getloadavg_initialized; + +int +os_getloadavg (void) +{ +host_t host; +struct processor_set_basic_info info; +unsigned info_count; + +if (!getloadavg_initialized) + { + if (processor_set_default (mach_host_self(), &default_set) == KERN_SUCCESS) + getloadavg_initialized = 1; + } + +if (getloadavg_initialized) + { + info_count = PROCESSOR_SET_BASIC_INFO_COUNT; + if (processor_set_info(default_set, PROCESSOR_SET_BASIC_INFO, &host, + (processor_set_info_t)&info, &info_count) != KERN_SUCCESS) + getloadavg_initialized = 0; + else + { + #if LOAD_SCALE == 1000 + return info.load_average; + #else + return (int) (((double) info.load_average * 1000) / LOAD_SCALE)); + #endif + } + } + +return -1; +} +#endif /* OS_LOAD_AVERAGE */ + +/* End of os.c-GNU */ diff --git a/src/OS/os.c-HI-OSF b/src/OS/os.c-HI-OSF new file mode 100644 index 000000000..a21765022 --- /dev/null +++ b/src/OS/os.c-HI-OSF @@ -0,0 +1,37 @@ +/* $Cambridge: exim/src/OS/os.c-HI-OSF,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* HI-OSF-specific code. This is concatenated onto the generic +src/os.c file. OSF has an apparently unique way of getting the +load average, so we provide a unique function here, and define +OS_LOAD_AVERAGE to stop src/os.c trying to provide the function. */ + +#ifndef OS_LOAD_AVERAGE +#define OS_LOAD_AVERAGE + +#include + +int +os_getloadavg(void) +{ +double avg; +struct tbl_loadavg load_avg; + +table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg)); + +avg = (load_avg.tl_lscale == 0)? + load_avg.tl_avenrun.d[0] : + (load_avg.tl_avenrun.l[0] / (double)load_avg.tl_lscale); + +return (int)(avg * 1000.0); +} + +#endif /* OS_LOAD_AVERAGE */ + +/* End of os.c-HI-OSF */ diff --git a/src/OS/os.c-IRIX b/src/OS/os.c-IRIX new file mode 100644 index 000000000..50d44feb7 --- /dev/null +++ b/src/OS/os.c-IRIX @@ -0,0 +1,120 @@ +/* $Cambridge: exim/src/OS/os.c-IRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* Irix-specific code. This is concatenated onto the generic src/os.c file. +Irix has a unique way of finding all the network interfaces, so we provide a +unique function here, and define FIND_RUNNING_INTERFACES to stop src/os.c +trying to provide the function. The macro may be set initially anyway, when +compiling os. for utilities that don't want this function. */ + +#ifndef FIND_RUNNING_INTERFACES +#define FIND_RUNNING_INTERFACES + +/* This is the special form of the function using sysctl() which is the only +form that returns all the aliases on IRIX systems. This code has its origins +in a sample program that came from within SGI. */ + +#include +#include +#include +#include +#include + +#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) -1))) \ + : sizeof(__uint64_t)) +#ifdef _HAVE_SA_LEN +#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) +#else +#define ADVANCE(x, n) (x += ROUNDUP(_FAKE_SA_LEN_DST(n))) +#endif + + +ip_address_item * +os_find_running_interfaces(void) +{ +ip_address_item *yield = NULL; +ip_address_item *last = NULL; +ip_address_item *next; + +size_t needed; +int mib[6]; +char *buf, *nextaddr, *lim; +register struct if_msghdr *ifm; + +mib[0] = CTL_NET; +mib[1] = PF_ROUTE; +mib[2] = 0; +mib[3] = 0; +mib[4] = NET_RT_IFLIST; +mib[5] = 0; + +/* Get an estimate of the amount of store needed, then get the store and +get the data into it. Any error causes a panic death. */ + +if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + log_write(0, LOG_PANIC_DIE, "iflist-sysctl-estimate failed: %s", + strerror(errno)); + +buf = store_get(needed); + +if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) + log_write(0, LOG_PANIC_DIE, "sysctl of ifnet list failed: %s", + strerror(errno)); + +/* Now fish out the data for each interface */ + +lim = buf + needed; +for (nextaddr = buf; nextaddr < lim; nextaddr += ifm->ifm_msglen) + { + ifm = (struct if_msghdr *)nextaddr; + + if (ifm->ifm_type != RTM_IFINFO) + { + struct ifa_msghdr *ifam = (struct ifa_msghdr *)ifm; + struct sockaddr_in *mask = NULL, *addr = NULL; + + if ((ifam->ifam_addrs & RTA_NETMASK) != 0) + mask = (struct sockaddr_in *)(ifam + 1); + + if ((ifam->ifam_addrs & RTA_IFA) != 0) + { + char *cp = (char *)mask; + struct sockaddr *sa = (struct sockaddr *)mask; + ADVANCE(cp, sa); + addr = (struct sockaddr_in *)cp; + } + + /* Create a data block for the address, fill in the data, and put it on + the chain. This data has to survive for ever, so use malloc. */ + + if (addr != NULL) + { + next = store_malloc(sizeof(ip_address_item)); + next->next = NULL; + next->port = 0; + (void)host_ntoa(-1, addr, next->address, NULL); + + if (yield == NULL) yield = last = next; else + { + last->next = next; + last = next; + } + + DEBUG(D_interface) debug_printf("Actual local interface address is %s\n", + last->address); + } + } + } + +return yield; +} + +#endif /* FIND_RUNNING_INTERFACES */ + +/* End of os.c-IRIX */ diff --git a/src/OS/os.c-IRIX6 b/src/OS/os.c-IRIX6 new file mode 100644 index 000000000..5bb251554 --- /dev/null +++ b/src/OS/os.c-IRIX6 @@ -0,0 +1,120 @@ +/* $Cambridge: exim/src/OS/os.c-IRIX6,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* Irix-specific code. This is concatenated onto the generic src/os.c file. +Irix has a unique way of finding all the network interfaces, so we provide a +unique function here, and define FIND_RUNNING_INTERFACES to stop src/os.c +trying to provide the function. The macro may be set initially anyway, when +compiling os. for utilities that don't want this function. */ + +#ifndef FIND_RUNNING_INTERFACES +#define FIND_RUNNING_INTERFACES + +/* This is the special form of the function using sysctl() which is the only +form that returns all the aliases on IRIX systems. This code has its origins +in a sample program that came from within SGI. */ + +#include +#include +#include +#include +#include + +#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) -1))) \ + : sizeof(__uint64_t)) +#ifdef _HAVE_SA_LEN +#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) +#else +#define ADVANCE(x, n) (x += ROUNDUP(_FAKE_SA_LEN_DST(n))) +#endif + + +ip_address_item * +os_find_running_interfaces(void) +{ +ip_address_item *yield = NULL; +ip_address_item *last = NULL; +ip_address_item *next; + +size_t needed; +int mib[6]; +char *buf, *nextaddr, *lim; +register struct if_msghdr *ifm; + +mib[0] = CTL_NET; +mib[1] = PF_ROUTE; +mib[2] = 0; +mib[3] = 0; +mib[4] = NET_RT_IFLIST; +mib[5] = 0; + +/* Get an estimate of the amount of store needed, then get the store and +get the data into it. Any error causes a panic death. */ + +if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + log_write(0, LOG_PANIC_DIE, "iflist-sysctl-estimate failed: %s", + strerror(errno)); + +buf = store_get(needed); + +if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) + log_write(0, LOG_PANIC_DIE, "sysctl of ifnet list failed: %s", + strerror(errno)); + +/* Now fish out the data for each interface */ + +lim = buf + needed; +for (nextaddr = buf; nextaddr < lim; nextaddr += ifm->ifm_msglen) + { + ifm = (struct if_msghdr *)nextaddr; + + if (ifm->ifm_type != RTM_IFINFO) + { + struct ifa_msghdr *ifam = (struct ifa_msghdr *)ifm; + struct sockaddr_in *mask = NULL, *addr = NULL; + + if ((ifam->ifam_addrs & RTA_NETMASK) != 0) + mask = (struct sockaddr_in *)(ifam + 1); + + if ((ifam->ifam_addrs & RTA_IFA) != 0) + { + char *cp = (char *)mask; + struct sockaddr *sa = (struct sockaddr *)mask; + ADVANCE(cp, sa); + addr = (struct sockaddr_in *)cp; + } + + /* Create a data block for the address, fill in the data, and put it on + the chain. This data has to survive for ever, so use malloc. */ + + if (addr != NULL) + { + next = store_malloc(sizeof(ip_address_item)); + next->next = NULL; + next->port = 0; + (void)host_ntoa(-1, addr, next->address, NULL); + + if (yield == NULL) yield = last = next; else + { + last->next = next; + last = next; + } + + DEBUG(D_interface) debug_printf("Actual local interface address is %s\n", + last->address); + } + } + } + +return yield; +} + +#endif /* FIND_RUNNING_INTERFACES */ + +/* End of os.c-IRIX */ diff --git a/src/OS/os.c-IRIX632 b/src/OS/os.c-IRIX632 new file mode 100644 index 000000000..b7e0994f1 --- /dev/null +++ b/src/OS/os.c-IRIX632 @@ -0,0 +1,120 @@ +/* $Cambridge: exim/src/OS/os.c-IRIX632,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* Irix-specific code. This is concatenated onto the generic src/os.c file. +Irix has a unique way of finding all the network interfaces, so we provide a +unique function here, and define FIND_RUNNING_INTERFACES to stop src/os.c +trying to provide the function. The macro may be set initially anyway, when +compiling os. for utilities that don't want this function. */ + +#ifndef FIND_RUNNING_INTERFACES +#define FIND_RUNNING_INTERFACES + +/* This is the special form of the function using sysctl() which is the only +form that returns all the aliases on IRIX systems. This code has its origins +in a sample program that came from within SGI. */ + +#include +#include +#include +#include +#include + +#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) -1))) \ + : sizeof(__uint64_t)) +#ifdef _HAVE_SA_LEN +#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) +#else +#define ADVANCE(x, n) (x += ROUNDUP(_FAKE_SA_LEN_DST(n))) +#endif + + +ip_address_item * +os_find_running_interfaces(void) +{ +ip_address_item *yield = NULL; +ip_address_item *last = NULL; +ip_address_item *next; + +size_t needed; +int mib[6]; +char *buf, *nextaddr, *lim; +register struct if_msghdr *ifm; + +mib[0] = CTL_NET; +mib[1] = PF_ROUTE; +mib[2] = 0; +mib[3] = 0; +mib[4] = NET_RT_IFLIST; +mib[5] = 0; + +/* Get an estimate of the amount of store needed, then get the store and +get the data into it. Any error causes a panic death. */ + +if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + log_write(0, LOG_PANIC_DIE, "iflist-sysctl-estimate failed: %s", + strerror(errno)); + +buf = store_get(needed); + +if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) + log_write(0, LOG_PANIC_DIE, "sysctl of ifnet list failed: %s", + strerror(errno)); + +/* Now fish out the data for each interface */ + +lim = buf + needed; +for (nextaddr = buf; nextaddr < lim; nextaddr += ifm->ifm_msglen) + { + ifm = (struct if_msghdr *)nextaddr; + + if (ifm->ifm_type != RTM_IFINFO) + { + struct ifa_msghdr *ifam = (struct ifa_msghdr *)ifm; + struct sockaddr_in *mask = NULL, *addr = NULL; + + if ((ifam->ifam_addrs & RTA_NETMASK) != 0) + mask = (struct sockaddr_in *)(ifam + 1); + + if ((ifam->ifam_addrs & RTA_IFA) != 0) + { + char *cp = (char *)mask; + struct sockaddr *sa = (struct sockaddr *)mask; + ADVANCE(cp, sa); + addr = (struct sockaddr_in *)cp; + } + + /* Create a data block for the address, fill in the data, and put it on + the chain. This data has to survive for ever, so use malloc. */ + + if (addr != NULL) + { + next = store_malloc(sizeof(ip_address_item)); + next->next = NULL; + next->port = 0; + (void)host_ntoa(-1, addr, next->address, NULL); + + if (yield == NULL) yield = last = next; else + { + last->next = next; + last = next; + } + + DEBUG(D_interface) debug_printf("Actual local interface address is %s\n", + last->address); + } + } + } + +return yield; +} + +#endif /* FIND_RUNNING_INTERFACES */ + +/* End of os.c-IRIX */ diff --git a/src/OS/os.c-IRIX65 b/src/OS/os.c-IRIX65 new file mode 100644 index 000000000..b6e3d66a0 --- /dev/null +++ b/src/OS/os.c-IRIX65 @@ -0,0 +1,120 @@ +/* $Cambridge: exim/src/OS/os.c-IRIX65,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* Irix-specific code. This is concatenated onto the generic src/os.c file. +Irix has a unique way of finding all the network interfaces, so we provide a +unique function here, and define FIND_RUNNING_INTERFACES to stop src/os.c +trying to provide the function. The macro may be set initially anyway, when +compiling os. for utilities that don't want this function. */ + +#ifndef FIND_RUNNING_INTERFACES +#define FIND_RUNNING_INTERFACES + +/* This is the special form of the function using sysctl() which is the only +form that returns all the aliases on IRIX systems. This code has its origins +in a sample program that came from within SGI. */ + +#include +#include +#include +#include +#include + +#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) -1))) \ + : sizeof(__uint64_t)) +#ifdef _HAVE_SA_LEN +#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) +#else +#define ADVANCE(x, n) (x += ROUNDUP(_FAKE_SA_LEN_DST(n))) +#endif + + +ip_address_item * +os_find_running_interfaces(void) +{ +ip_address_item *yield = NULL; +ip_address_item *last = NULL; +ip_address_item *next; + +size_t needed; +int mib[6]; +char *buf, *nextaddr, *lim; +register struct if_msghdr *ifm; + +mib[0] = CTL_NET; +mib[1] = PF_ROUTE; +mib[2] = 0; +mib[3] = 0; +mib[4] = NET_RT_IFLIST; +mib[5] = 0; + +/* Get an estimate of the amount of store needed, then get the store and +get the data into it. Any error causes a panic death. */ + +if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + log_write(0, LOG_PANIC_DIE, "iflist-sysctl-estimate failed: %s", + strerror(errno)); + +buf = store_get(needed); + +if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) + log_write(0, LOG_PANIC_DIE, "sysctl of ifnet list failed: %s", + strerror(errno)); + +/* Now fish out the data for each interface */ + +lim = buf + needed; +for (nextaddr = buf; nextaddr < lim; nextaddr += ifm->ifm_msglen) + { + ifm = (struct if_msghdr *)nextaddr; + + if (ifm->ifm_type != RTM_IFINFO) + { + struct ifa_msghdr *ifam = (struct ifa_msghdr *)ifm; + struct sockaddr_in *mask = NULL, *addr = NULL; + + if ((ifam->ifam_addrs & RTA_NETMASK) != 0) + mask = (struct sockaddr_in *)(ifam + 1); + + if ((ifam->ifam_addrs & RTA_IFA) != 0) + { + char *cp = (char *)mask; + struct sockaddr *sa = (struct sockaddr *)mask; + ADVANCE(cp, sa); + addr = (struct sockaddr_in *)cp; + } + + /* Create a data block for the address, fill in the data, and put it on + the chain. This data has to survive for ever, so use malloc. */ + + if (addr != NULL) + { + next = store_malloc(sizeof(ip_address_item)); + next->next = NULL; + next->port = 0; + (void)host_ntoa(-1, addr, next->address, NULL); + + if (yield == NULL) yield = last = next; else + { + last->next = next; + last = next; + } + + DEBUG(D_interface) debug_printf("Actual local interface address is %s\n", + last->address); + } + } + } + +return yield; +} + +#endif /* FIND_RUNNING_INTERFACES */ + +/* End of os.c-IRIX */ diff --git a/src/OS/os.c-Linux b/src/OS/os.c-Linux new file mode 100644 index 000000000..5589a015b --- /dev/null +++ b/src/OS/os.c-Linux @@ -0,0 +1,155 @@ +/* $Cambridge: exim/src/OS/os.c-Linux,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 1997 - 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* Linux-specific code. This is concatenated onto the generic +src/os.c file. */ + + +/************************************************* +* Load average computation * +*************************************************/ + +/*Linux has an apparently unique way of getting the load average, so we provide +a unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to +provide the function. However, when compiling os.c for utilities, we may not +want this at all, so check that it isn't set first. */ + +#ifndef OS_LOAD_AVERAGE +#define OS_LOAD_AVERAGE + +/* Linux has 2 ways of returning load average: + + (1) Do a read on /proc/loadavg + (2) Use the sysinfo library function and syscall + +The latter is simpler but in Linux 2.0 - 2.2 (and probably later releases) is +exceptionally slow - 10-50ms per call is not unusual and about 100x slow the +first method. This cripples high performance mail servers by increasing CPU +utilisation by 3-5x. + +In Exim's very early days, it used the 1st method. Later, it switched to the +2nd method. Now it tries the 1st method and falls back to the 2nd if /proc is +unavailable. */ + +#include + +static int +linux_slow_getloadavg(void) +{ +struct sysinfo s; +double avg; +if (sysinfo(&s) < 0) return -1; +avg = (double) (s.loads[0]) / (1<next != NULL) last = last->next; + +while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n", + addr6p[0], addr6p[1], addr6p[2], addr6p[3], + addr6p[4], addr6p[5], addr6p[6], addr6p[7], + &if_idx, &plen, &scope, &dad_status, devname) != EOF) + { + struct sockaddr_in6 addr; + + /* This data has to survive for ever, so use malloc. */ + + next = store_malloc(sizeof(ip_address_item)); + next->next = NULL; + next->port = 0; + sprintf(CS next->address, "%s:%s:%s:%s:%s:%s:%s:%s", + addr6p[0], addr6p[1], addr6p[2], addr6p[3], + addr6p[4], addr6p[5], addr6p[6], addr6p[7]); + + /* Normalize the representation */ + + inet_pton(AF_INET6, CS next->address, &addr.sin6_addr); + inet_ntop(AF_INET6, &addr.sin6_addr, CS next->address, sizeof(next->address)); + + if (yield == NULL) yield = last = next; else + { + last->next = next; + last = next; + } + + DEBUG(D_interface) + debug_printf("Actual local interface address is %s (%s)\n", last->address, + devname); + } +fclose(f); +#endif /* HAVE_IPV6 */ + +return yield; +} + +#endif /* FIND_RUNNING_INTERFACES */ + +/* End of os.c-Linux */ diff --git a/src/OS/os.c-Linux-libc5 b/src/OS/os.c-Linux-libc5 new file mode 100644 index 000000000..cbda9e6fa --- /dev/null +++ b/src/OS/os.c-Linux-libc5 @@ -0,0 +1,39 @@ +/* $Cambridge: exim/src/OS/os.c-Linux-libc5,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* Linux-specific code. This is concatenated onto the generic src/os.c file. +Linux has an apparently unique way of getting the load average, so we provide a +unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to +provide the function. The macro may be set initially anyway, when compiling os. +for utilities that don't want this function. */ + +#ifndef OS_LOAD_AVERAGE +#define OS_LOAD_AVERAGE + +int +os_getloadavg(void) +{ +char buffer[40]; +double avg; +int count; +int fd = open ("/proc/loadavg", O_RDONLY); +if (fd == -1) return -1; +count = read (fd, buffer, sizeof(buffer)); +(void)close (fd); +if (count <= 0) return -1; +count = sscanf (buffer, "%lf", &avg); +if (count < 1) return -1; + +return (int)(avg * 1000.0); +} + +#endif /* OS_LOAD_AVERAGE */ + +/* End of os.c-Linux */ + diff --git a/src/OS/os.c-OSF1 b/src/OS/os.c-OSF1 new file mode 100644 index 000000000..eb5032eaf --- /dev/null +++ b/src/OS/os.c-OSF1 @@ -0,0 +1,38 @@ +/* $Cambridge: exim/src/OS/os.c-OSF1,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* OSF1-specific code. This is concatenated onto the generic src/os.c file. +OSF1 has an apparently unique way of getting the load average, so we provide a +unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to +provide the function. The macro may be set initially anyway, when compiling os. +for utilities that don't want this function. */ + +#ifndef OS_LOAD_AVERAGE +#define OS_LOAD_AVERAGE + +#include + +int +os_getloadavg(void) +{ +double avg; +struct tbl_loadavg load_avg; + +table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg)); + +avg = (load_avg.tl_lscale == 0)? + load_avg.tl_avenrun.d[0] : + (load_avg.tl_avenrun.l[0] / (double)load_avg.tl_lscale); + +return (int)(avg * 1000.0); +} + +#endif /* OS_LOAD_AVERAGE */ + +/* End of os.c-OSF1 */ diff --git a/src/OS/os.c-cygwin b/src/OS/os.c-cygwin new file mode 100644 index 000000000..739605590 --- /dev/null +++ b/src/OS/os.c-cygwin @@ -0,0 +1,652 @@ +/* $Cambridge: exim/src/OS/os.c-cygwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Cygwin-specific code. December 2002 + This is concatenated onto the generic src/os.c file. + + This code was supplied by Pierre A. Humblet +*/ + +/* We need a special mkdir that + allows names starting with // */ +#undef mkdir +int cygwin_mkdir( const char *path, mode_t mode ) +{ + const char * p = path; + if (*p == '/') while(*(p+1) == '/') p++; + return mkdir(p, mode); +} + +/* We have strsignal but cannot use #define + because types don't match */ +#define OS_STRSIGNAL /* src/os.c need not provide it */ +char * os_strsignal(int sig) +{ + return (char *) strsignal(sig); +} + +#ifndef COMPILE_UTILITY /* Utilities don't need special code */ +#ifdef INCLUDE_MINIRES +#include "../minires/minires.c" +#include "../minires/os-interface.c" +#endif + +#ifdef INCLUDE_PAM +#include "../pam/pam.c" +#endif + +unsigned int cygwin_WinVersion; + +/* Conflict between Windows definitions and others */ +#ifdef NOERROR +#undef NOERROR +#endif +#ifdef DELETE +#undef DELETE +#endif + +#include +#include + +/* Special static variables */ +static BOOL cygwin_debug = FALSE; +static int privileged = 1; /* when not privileged, setuid = noop */ + +#undef setuid +int cygwin_setuid(uid_t uid ) +{ + int res; + if (privileged <= 0) return 0; + else { + res = setuid(uid); + if (cygwin_debug) + fprintf(stderr, "setuid %lu %lu %d pid: %d\n", + uid, getuid(),res, getpid()); + } + return res; +} + +#undef setgid +int cygwin_setgid(gid_t gid ) +{ + int res; + if (privileged <= 0) return 0; + else { + res = setgid(gid); + if (cygwin_debug) + fprintf(stderr, "setgid %lu %lu %d pid: %d\n", + gid, getgid(), res, getpid()); + } + return res; +} + +/* Background processes run at lower priority */ +static void setpriority() +{ + if (!SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS)) + SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); + return; +} + + +/* GetVersion() + MSB: 1 for 95/98/ME; Next 7: build number, except for 95/98/ME + Next byte: 0 + Next byte: minor version of OS + Low byte: major version of OS (3 or 4 for for NT, 5 for 2000 and XP) */ +#define VERSION_IS_58M(x) (x & 0x80000000) /* 95, 98, Me */ +#define VERSION_IS_NT(x) ((x & 0XFF) < 5) /* NT 4 or 3.51 */ + +/* + Routine to find if process or thread is privileged +*/ + +enum { + CREATE_BIT = 1, + RESTORE_BIT = 2 +}; + +static DWORD get_privileges () +{ + char buffer[1024]; + DWORD i, length; + HANDLE hToken = NULL; + PTOKEN_PRIVILEGES privs; + LUID cluid, rluid; + DWORD ret = 0; + + privs = (PTOKEN_PRIVILEGES) buffer; + + if (OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &hToken) + && LookupPrivilegeValue (NULL, SE_CREATE_TOKEN_NAME, &cluid) + && LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &rluid) + && (GetTokenInformation( hToken, TokenPrivileges, + privs, sizeof (buffer), &length) + || (GetLastError () == ERROR_INSUFFICIENT_BUFFER + && (privs = (PTOKEN_PRIVILEGES) alloca (length)) + && GetTokenInformation(hToken, TokenPrivileges, + privs, length, &length)))) { + for (i = 0; i < privs->PrivilegeCount; i++) { + if (privs->Privileges[i].Luid.QuadPart == cluid.QuadPart) + ret |= CREATE_BIT; + else if (privs->Privileges[i].Luid.QuadPart == rluid.QuadPart) + ret |= RESTORE_BIT; + else continue; + if (ret == (CREATE_BIT | RESTORE_BIT)) + break; + } + } + else + fprintf(stderr, "has_create_token_privilege %ld\n", GetLastError()); + + if (hToken) + CloseHandle(hToken); + + return ret; +} + +/* We use a special routine to initialize + cygwin_init is called from the OS_INIT macro in main(). */ + +void cygwin_init(int argc, char ** argv, void * rup, + void * eup, void * egp, void * cup) +{ + int i; + uid_t myuid, systemuid; + gid_t mygid, adminsgid; + struct passwd * pwp; + char *cygenv, win32_path[MAX_PATH]; + SID(1, SystemSid, SECURITY_LOCAL_SYSTEM_RID); + SID(2, AdminsSid, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS); + DWORD priv_flags; + + myuid = getuid(); + mygid = getgid(); + cygwin_WinVersion = GetVersion(); + if ((cygenv = getenv("CYGWIN")) == NULL) cygenv = ""; + /* Produce some debugging on stderr, + cannot yet use exim's debug functions. + Exim does not use -c and ignores -n. + Set lower priority for daemons */ + for (i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + if (argv[i][1] == 'c') { + argv[i][1] = 'n'; /* Replace -c by -n */ + cygwin_debug = TRUE; + fprintf(stderr, "CYGWIN = \"%s\".", cygenv); + cygwin_conv_to_win32_path("/", win32_path); + fprintf(stderr, " Root / mapped to %s.\n", win32_path); + } + else if (argv[i][1] == 'b' && argv[i][2] == 'd') + setpriority(); + } + } + if (VERSION_IS_58M(cygwin_WinVersion)) { + * (uid_t *) rup = myuid; /* Pretend we are root */ + * (uid_t *) eup = myuid; /* ... and exim */ + * (gid_t *) egp = mygid; + return; + } + /* Nt/2000/XP + We initially set the exim uid & gid to those of the "real exim", + or to the root uid (SYSTEM) and exim gid (ADMINS), + If privileged, we setuid to those. + We always set the configure uid to the system uid. + We always set the root uid to the real uid + to avoid useless execs following forks. + If not privileged and unable to chown, + we set the exim uid to our uid. + If unprivileged, we fake all subsequent setuid. */ + + priv_flags = get_privileges (); + privileged = !!(priv_flags & CREATE_BIT); + + /* Get the system and admins uid from their sids, + or use the default values from the Makefile. */ + if ((systemuid = cygwin_internal(CW_GET_UID_FROM_SID, & SystemSid)) == -1) + systemuid = * (uid_t *) eup; + if ((adminsgid = cygwin_internal(CW_GET_GID_FROM_SID, & AdminsSid)) == -1) + adminsgid = * (gid_t *) egp; + + if ((pwp = getpwnam("exim")) != NULL) { + * (uid_t *) eup = pwp->pw_uid; /* Set it according to passwd */ + * (gid_t *) egp = pwp->pw_gid; + } + else { + * (uid_t *) eup = systemuid; + * (gid_t *) egp = adminsgid; + } + + /* Set the configuration uid to the system uid. + Note that exim uid is also accepted as owner of exim.conf. */ + * (uid_t *) cup = systemuid; + + if (privileged) { /* Can setuid */ + if (cygwin_setgid(* (gid_t *) egp) /* Setuid to exim */ + || cygwin_setuid(* (uid_t *) eup)) + privileged = -1; /* Problem... Perhaps not in 544 */ + } + + /* Pretend we are root to avoid useless execs. + We are limited by file access rights */ + * (uid_t *) rup = getuid (); + + /* If we have not setuid to exim and cannot chown, + set the exim uid to our uid to avoid chown failures */ + if (privileged <= 0 && !(priv_flags & RESTORE_BIT)) + * (uid_t *) eup = * (uid_t *) rup; + + if (cygwin_debug) { + fprintf(stderr, "Starting uid %ld, gid %ld, ntsec %lu, privileged %d.\n", + myuid, mygid, cygwin_internal(CW_CHECK_NTSEC, NULL), privileged); + fprintf(stderr, "root_uid %ld, exim_uid %ld, exim_gid %ld, config_uid %ld.\n", + * (uid_t *) rup, * (uid_t *) eup, * (gid_t *) egp, * (uid_t *) cup); + } + return; +} + +/***************************************************************** + * + Functions for average load measurements + + Obtaining statistics in Windows is done at a low level by + calling registry functions, in particular the key + HKEY_PERFORMANCE_DATA on NT and successors. + Something equivalent exists on Win95, see Microsoft article + HOWTO: Access the Performance Registry Under Windows 95 (Q174631) + but it is not implemented here. + + The list of objects to be polled is specified in the string + passed to RegQueryValueEx in ReadStat() below. + On NT, all objects are polled even if info about only one is + required. This is fixed in Windows 2000. See articles + INFO: Perflib Calling Close Procedure in Windows 2000 (Q270127) + INFO: Performance Data Changes Between Windows NT 4.0 and Windows + 2000 (Q296523) + + It is unclear to me how the counters are primarily identified. + Whether it's by name strings or by the offset of their strings + as mapped in X:\Winnt\system32\perfc009.dat [or equivalently as + reported by the registry functions in GetNameStrings( ) below]. + Microsoft documentation seems to say that both methods should + work. + + In the interest of speed and language independence, the main + code below relies on offsets. However if debug is enabled, the + code verifies that the names of the corresponding strings are + as expected. + +*****************************************************************/ +#ifndef OS_LOAD_AVERAGE /* Can be set on command line */ +#define OS_LOAD_AVERAGE /* src/os.c need not provide it */ + +/* Object and counter indices and names */ +#define PROCESSOR_OBJECT_INDEX 238 +#define PROCESSOR_OBJECT_STRING "238" +#define PROCESSOR_OBJECT_NAME "Processor" +#define PROCESSOR_TIME_COUNTER 6 +#define PROCESSOR_TIME_NAME "% Processor Time" + +/* Structure to compute the load average efficiently */ +static struct { + long long Time100ns; /* Last measurement time */ + long long IdleCount; /* Latest cumulative idle time */ + long long LastCounter; /* Last measurement counter */ + long long PerfFreq; /* Perf counter frequency */ + PPERF_DATA_BLOCK PerfData; /* Pointer to a buffer to get the data */ + DWORD BufferSize; /* Size of PerfData */ + int LastLoad; /* Last reported load, or -1 */ + LPSTR * NamesArray; /* Temporary (malloc) buffer for index */ + BOOL Init; /* True if initialized */ +} cygwin_load = { 0, 0, 0, 0, NULL, 0, 0, NULL, FALSE}; + +#define BYTEINCREMENT 800 /* Block to add to PerfData */ + +/***************************************************************** + * + Macros to navigate through the performance data. + + *****************************************************************/ +#define FirstObject(PerfData)\ + ((PPERF_OBJECT_TYPE)((PBYTE)PerfData + PerfData->HeaderLength)) +#define NextObject(PerfObj)\ + ((PPERF_OBJECT_TYPE)((PBYTE)PerfObj + PerfObj->TotalByteLength)) +#define ObjectCounterBlock(PerfObj)\ + ((PPERF_COUNTER_BLOCK)(PBYTE)PerfObj + PerfObj->DefinitionLength ) +#define FirstInstance(PerfObj )\ + ((PPERF_INSTANCE_DEFINITION)((PBYTE)PerfObj + PerfObj->DefinitionLength)) +#define InstanceCounterBlock(PerfInst)\ + ((PPERF_COUNTER_BLOCK) ((PBYTE)PerfInst + PerfInst->ByteLength )) +#define NextInstance(PerfInst )\ + ((PPERF_INSTANCE_DEFINITION)((PBYTE)InstanceCounterBlock(PerfInst) + \ + InstanceCounterBlock(PerfInst)->ByteLength) ) +#define FirstCounter(PerfObj)\ + ((PPERF_COUNTER_DEFINITION) ((PBYTE)PerfObj + PerfObj->HeaderLength)) +#define NextCounter(PerfCntr)\ + ((PPERF_COUNTER_DEFINITION)((PBYTE)PerfCntr + PerfCntr->ByteLength)) + +/***************************************************************** + * + Load the counter and object names from the registry + to cygwin_load.NameStrings + and index them in cygwin_load.NamesArray + + NameStrings seems to be taken from the file + X:\Winnt\system32\perfc009.dat + + This is used only for name verification during initialization, + if DEBUG(D_load) is TRUE. + +*****************************************************************/ +static BOOL GetNameStrings( ) +{ + HKEY hKeyPerflib; // handle to registry key + DWORD dwArraySize; // size for array + DWORD dwNamesSize; // size for strings + LPSTR lpCurrentString; // pointer for enumerating data strings + DWORD dwCounter; // current counter index + LONG res; + + /* Get the number of Counter items into dwArraySize. */ + if ((res = RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib", + 0, + KEY_QUERY_VALUE, /* KEY_READ, */ + &hKeyPerflib)) + != ERROR_SUCCESS) { + DEBUG(D_load) debug_printf("RegOpenKeyEx (1): error %ld (Windows)\n", res); + return FALSE; + } + dwNamesSize = sizeof(dwArraySize); /* Temporary reuse */ + if ((res = RegQueryValueEx( hKeyPerflib, + "Last Counter", + NULL, + NULL, + (LPBYTE) &dwArraySize, + &dwNamesSize )) + != ERROR_SUCCESS) { + DEBUG(D_load) debug_printf("RegQueryValueEx (1): error %ld (Windows)\n", res); + return FALSE; + } + RegCloseKey( hKeyPerflib ); + /* Open the key containing the counter and object names. */ + if ((res = RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009", + 0, + KEY_READ, + &hKeyPerflib)) + != ERROR_SUCCESS) { + DEBUG(D_load) debug_printf("RegOpenKeyEx (2): error %ld (Windows)\n", res); + return FALSE; + } + /* Get the size of the Counter value in the key + and then read the value in the tail of NamesArray */ + dwNamesSize = 0; + lpCurrentString = NULL; + while (1) { + res = RegQueryValueEx( hKeyPerflib, + "Counter", + NULL, + NULL, + (unsigned char *) lpCurrentString, + &dwNamesSize); + if ((res == ERROR_SUCCESS) && /* Bug (NT 4.0): SUCCESS was returned on first call */ + (cygwin_load.NamesArray != NULL)) break; + if ((res == ERROR_SUCCESS) || /* but cygwin_load.NamesArrays == NULL */ + (res == ERROR_MORE_DATA)) { + /* Allocate memory BOTH for the names array and for the counter and object names */ + if ((cygwin_load.NamesArray = + (LPSTR *) malloc( (dwArraySize + 1) * sizeof(LPSTR) + dwNamesSize * sizeof(CHAR))) + != NULL) { + /* Point to area for the counter and object names */ + lpCurrentString = (LPSTR) & cygwin_load.NamesArray[dwArraySize + 1]; + continue; + } + DEBUG(D_load) debug_printf("Malloc: errno %d (%s)\n", errno, strerror(errno)); + } + else { /* Serious error */ + DEBUG(D_load) debug_printf("RegQueryValueEx (2): error %ld (Windows)\n", res); + } + return FALSE; + } + RegCloseKey( hKeyPerflib ); + /* Index the names into an array. */ + while (*lpCurrentString) { + dwCounter = atol( lpCurrentString ); + lpCurrentString += (lstrlen(lpCurrentString)+1); + cygwin_load.NamesArray[dwCounter] = lpCurrentString; + lpCurrentString += (strlen(lpCurrentString)+1); + } + return TRUE; +} + +/***************************************************************** + * + Find the value of the Processor Time counter + +*****************************************************************/ +static BOOL ReadTimeCtr(PPERF_OBJECT_TYPE PerfObj, + PPERF_COUNTER_DEFINITION CurCntr, + PPERF_COUNTER_BLOCK PtrToCntr, + unsigned long long * TimePtr){ + int j; + /* Scan all counters. */ + for( j = 0; j < PerfObj->NumCounters; j++ ) { + if (CurCntr->CounterNameTitleIndex == PROCESSOR_TIME_COUNTER) { + /* Verify it is really the proc time counter */ + if ((CurCntr->CounterType != PERF_100NSEC_TIMER_INV) || /* Wrong type */ + ((cygwin_load.NamesArray != NULL) && /* Verify name */ + (strcmp(cygwin_load.NamesArray[CurCntr->CounterNameTitleIndex], + PROCESSOR_TIME_NAME)))) { + log_write(0, LOG_MAIN|LOG_PANIC, + "Incorrect Perf counter type or name %x %s", + (unsigned) CurCntr->CounterType, + cygwin_load.NamesArray[CurCntr->CounterNameTitleIndex]); + return FALSE; + } + *TimePtr += *(unsigned long long int *) ((PBYTE) PtrToCntr + CurCntr->CounterOffset); + return TRUE; /* return TRUE as soon as we found the counter */ + } + /* Get the next counter. */ + CurCntr = NextCounter( CurCntr ); + } + return FALSE; +} +/***************************************************************** + * + ReadStat() + Measures current Time100ns and IdleCount + Return TRUE if success. + + *****************************************************************/ +static BOOL ReadStat(long long int *Time100nsPtr, + long long int * IdleCountPtr) +{ + PPERF_OBJECT_TYPE PerfObj; + PPERF_INSTANCE_DEFINITION PerfInst; + PPERF_COUNTER_DEFINITION PerfCntr; + PPERF_COUNTER_BLOCK PtrToCntr; + DWORD i, k, res; + + /* Get the performance data for the Processor object + There is no need to open a key. + We may need to blindly increase the buffer size. + BufferSize does not return info but may be changed */ + while (1) { + DWORD BufferSize = cygwin_load.BufferSize; + res = RegQueryValueEx( HKEY_PERFORMANCE_DATA, + PROCESSOR_OBJECT_STRING, + NULL, + NULL, + (LPBYTE) cygwin_load.PerfData, + &BufferSize ); + if (res == ERROR_SUCCESS) break; + if (res == ERROR_MORE_DATA ) { + /* Increment if necessary to get a buffer that is big enough. */ + cygwin_load.BufferSize += BYTEINCREMENT; + if ((cygwin_load.PerfData = + (PPERF_DATA_BLOCK) realloc( cygwin_load.PerfData, cygwin_load.BufferSize )) + != NULL) continue; + DEBUG(D_load) debug_printf("Malloc: errno %d (%s)\n", errno, strerror(errno)); + } + else { /* Serious error */ + DEBUG(D_load) debug_printf("RegQueryValueEx (3): error %ld (Windows)\n", res); + } + return FALSE; + } + /* Initialize the counters */ + *Time100nsPtr = 0; + *IdleCountPtr = 0; + /* We should only have one object, but write general code just in case. */ + PerfObj = FirstObject( cygwin_load.PerfData ); + for( i = 0; i < cygwin_load.PerfData->NumObjectTypes; i++ ) { + /* We are only interested in the processor object */ + if ( PerfObj->ObjectNameTitleIndex == PROCESSOR_OBJECT_INDEX) { + /* Possibly verify it is really the Processor object. */ + if ((cygwin_load.NamesArray != NULL) && + (strcmp(cygwin_load.NamesArray[PerfObj->ObjectNameTitleIndex], + PROCESSOR_OBJECT_NAME))) { + log_write(0, LOG_MAIN|LOG_PANIC, + "Incorrect Perf object name %s", + cygwin_load.NamesArray[PerfObj->ObjectNameTitleIndex]); + return FALSE; + } + /* Get the first counter */ + PerfCntr = FirstCounter( PerfObj ); + /* See if the object has instances. + It should, but write general code. */ + if( PerfObj->NumInstances != PERF_NO_INSTANCES ) { + PerfInst = FirstInstance( PerfObj ); + for( k = 0; k < PerfObj->NumInstances; k++ ) { + /* There can be several processors. + Accumulate both the Time100ns and the idle counter. + On Win 2000 I have seen an instance named "_Total". + Do not use it. We only use instances with a single + character in the name. + If we examine the object names, we also look at the instance + names and their lengths and issue reports */ + if ( cygwin_load.NamesArray != NULL) { + CHAR ascii[30]; /* The name is in unicode */ + wsprintf(ascii,"%.29lS", + (char *)((PBYTE)PerfInst + PerfInst->NameOffset)); + log_write(0, LOG_MAIN, + "Perf: Found processor instance \"%s\", length %d", + ascii, PerfInst->NameLength); + if ((PerfInst->NameLength != 4) && + (strcmp(ascii, "_Total") != 0)) { + log_write(0, LOG_MAIN|LOG_PANIC, + "Perf: WARNING: Unexpected processor instance name"); + return FALSE; + } + } + if (PerfInst->NameLength == 4) { + *Time100nsPtr += cygwin_load.PerfData->PerfTime100nSec.QuadPart; + PtrToCntr = InstanceCounterBlock(PerfInst); + if (! ReadTimeCtr(PerfObj, PerfCntr, PtrToCntr, IdleCountPtr)) { + return FALSE; + } + } + PerfInst = NextInstance( PerfInst ); + } + return (*Time100nsPtr != 0); /* Something was read */ + } + else { /* No instance, just the counter data */ + *Time100nsPtr = cygwin_load.PerfData->PerfTime100nSec.QuadPart; + PtrToCntr = ObjectCounterBlock(PerfObj); + return ReadTimeCtr(PerfObj, PerfCntr, PtrToCntr, IdleCountPtr); + } + } + PerfObj = NextObject( PerfObj ); + } + return FALSE; /* Did not find the Processor object */ +} + +/***************************************************************** + * + InitLoadAvg() + Initialize the cygwin_load structure. + and set cygwin_load.Flag to TRUE if successful. + This is called the first time os_getloadavg is called + *****************************************************************/ +static void InitLoadAvg() +{ + BOOL success = TRUE; + cygwin_load.Init = TRUE; /* We have run */ + /* Get perf frequency and counter */ + QueryPerformanceFrequency((LARGE_INTEGER *)& cygwin_load.PerfFreq); + QueryPerformanceCounter((LARGE_INTEGER *)& cygwin_load.LastCounter); + DEBUG(D_load) { + /* Get the name strings through the registry + to verify that the object and counter numbers + have the names we expect */ + success = GetNameStrings(); + } + /* Get initial values for Time100ns and IdleCount + and possibly verify the names */ + // success = success && + success = ReadStat( & cygwin_load.Time100ns, + & cygwin_load.IdleCount); + /* If success, set the Load to 0, else to -1 */ + if (success) cygwin_load.LastLoad = 0; + else { + log_write(0, LOG_MAIN, "Cannot obtain Load Average"); + cygwin_load.LastLoad = -1; + } + /* Free the buffer created for debug name verification */ + if (cygwin_load.NamesArray != NULL) { + free(cygwin_load.NamesArray); + cygwin_load.NamesArray = NULL; + } +} +/***************************************************************** + * + os_getloadavg() + + Return -1 if not available; + Return the previous value if less than AVERAGING sec old. + else return the processor load on a [0 - 1000] scale. + + The first time we are called we initialize the counts + and return 0 or -1. + The load cannot be measured because we use the processor 100% +*****************************************************************/ +#define AVERAGING 10 +int os_getloadavg() +{ + long long Time100ns, IdleCount, CurrCounter; + int value; + + if (! cygwin_load.Init) InitLoadAvg(); + else if (cygwin_load.LastLoad >= 0) { /* Initialized OK */ + /* Get the current time (PerfCounter) */ + QueryPerformanceCounter((LARGE_INTEGER *)& CurrCounter); + /* Calls closer than AVERAGING sec apart use the previous value */ + if (CurrCounter - cygwin_load.LastCounter > + AVERAGING * cygwin_load.PerfFreq) { + /* Get Time100ns and IdleCount */ + if (ReadStat( & Time100ns, & IdleCount)) { /* Success */ + /* Return processor load on 1000 scale */ + value = 1000 - ((1000 * (IdleCount - cygwin_load.IdleCount)) / + (Time100ns - cygwin_load.Time100ns)); + cygwin_load.Time100ns = Time100ns; + cygwin_load.IdleCount = IdleCount; + cygwin_load.LastCounter = CurrCounter; + cygwin_load.LastLoad = value; + } + else { /* Something bad happened. + Refuse to measure the load anymore + but don't bother releasing the buffer */ + log_write(0, LOG_MAIN, "Cannot obtain Load Average"); + cygwin_load.LastLoad = -1; + } + } + } + DEBUG(D_load) + debug_printf("Perf: load average = %d\n", cygwin_load.LastLoad); + return cygwin_load.LastLoad; +} +#endif /* OS_LOAD_AVERAGE */ +#endif /* COMPILE_UTILITY */ diff --git a/src/OS/os.h-AIX b/src/OS/os.h-AIX new file mode 100644 index 000000000..29a2903a3 --- /dev/null +++ b/src/OS/os.h-AIX @@ -0,0 +1,25 @@ +/* $Cambridge: exim/src/OS/os.h-AIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for AIX */ +/* Written by Nick Waterman */ +/* Modified by Philip Hazel with data from + Niels Provos + Juozas Simkevicius for load averages +*/ + +#define HAVE_DEV_KMEM +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/unix" +#define LOAD_AVG_TYPE int +#define FSCALE 65536.0 + +#define HAVE_SYS_VFS_H +#define HAVE_SYS_STATFS_H + +/* Now tell AIX to emulate BSD as badly as it can. */ + +#define _BSD 44 + +typedef struct flock flock_t; + +/* End */ diff --git a/src/OS/os.h-BSDI b/src/OS/os.h-BSDI new file mode 100644 index 000000000..09b646197 --- /dev/null +++ b/src/OS/os.h-BSDI @@ -0,0 +1,12 @@ +/* $Cambridge: exim/src/OS/os.h-BSDI,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for BSDI */ + +#define HAVE_BSD_GETLOADAVG +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR + +typedef struct flock flock_t; + +/* End */ diff --git a/src/OS/os.h-DGUX b/src/OS/os.h-DGUX new file mode 100644 index 000000000..4f9c6746f --- /dev/null +++ b/src/OS/os.h-DGUX @@ -0,0 +1,27 @@ +/* $Cambridge: exim/src/OS/os.h-DGUX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for DGUX */ + +/* Written by Ken Bailey (K.Bailey@rbgkew.org.uk) Feb 1998 */ +/* on dgux R4.11MU04 generic AViiON mc88100 */ +/* Modified Dec 1998 by PH after message from Ken. */ + +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail + +#define NO_SYSEXITS /* DGUX doesn't ship sysexits.h */ +#define NO_IP_VAR_H /* DGUX has no netinet/ip_var.h */ + +#define os_strsignal dg_strsignal +#define OS_STRSIGNAL + +#define HAVE_MMAP + +/* The definition of ipoptions in netinet/in.h (masquerading as ip_opts) used +in smtp_in.c is for Intel DG _IX86_ABI only. You may be able to get this to +work on Intel DG but it's certainly easier to skip it on M88k. This means we +forego the detection of some source-routing based IP attacks. */ + +#define NO_IP_OPTIONS + +/* End */ diff --git a/src/OS/os.h-Darwin b/src/OS/os.h-Darwin new file mode 100644 index 000000000..3a716376d --- /dev/null +++ b/src/OS/os.h-Darwin @@ -0,0 +1,29 @@ +/* $Cambridge: exim/src/OS/os.h-Darwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for Darwin (Mac OS X) */ + +/* #define CRYPT_H */ /* Apparently this isn't needed */ + +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define PAM_H_IN_PAM +#define SIOCGIFCONF_GIVES_ADDR + +#define F_FREESP O_TRUNC +typedef struct flock flock_t; + +#define BASE_62 36 /* HFS+ aliases lower and upper cases in filenames. + Consider reducing MAX_LOCALHOST_NUMBER */ + +#ifndef _BSD_SOCKLEN_T_ +#define _BSD_SOCKLEN_T_ int32_t /* socklen_t (duh) */ +#endif + +/* Settings for handling IP options. There's no netinet/ip_var.h. The IP +option handling is in the style of the later GLIBCs but the GLIBC macros +aren't set, so we invent a new one. */ + +#define NO_IP_VAR_H +#define DARWIN_IP_OPTIONS + +/* End */ diff --git a/src/OS/os.h-FreeBSD b/src/OS/os.h-FreeBSD new file mode 100644 index 000000000..9a2da7a5a --- /dev/null +++ b/src/OS/os.h-FreeBSD @@ -0,0 +1,12 @@ +/* $Cambridge: exim/src/OS/os.h-FreeBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for FreeBSD */ + +#define HAVE_BSD_GETLOADAVG +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR + +typedef struct flock flock_t; + +/* End */ diff --git a/src/OS/os.h-GNU b/src/OS/os.h-GNU new file mode 100644 index 000000000..6d44d5a2d --- /dev/null +++ b/src/OS/os.h-GNU @@ -0,0 +1,20 @@ +/* $Cambridge: exim/src/OS/os.h-GNU,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for GNU/Hurd */ + +#define CRYPT_H +#define HAVE_MMAP +#define HAVE_SYS_VFS_H +#define NO_IP_VAR_H +#define NO_NET_IF_H +#define NO_FIND_INTERFACES +#define SETRLIMIT_NOT_SUPPORTED +#define GLIBC_IP_OPTIONS + +#define F_FREESP O_TRUNC +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +/* End */ diff --git a/src/OS/os.h-HI-OSF b/src/OS/os.h-HI-OSF new file mode 100644 index 000000000..82c077d69 --- /dev/null +++ b/src/OS/os.h-HI-OSF @@ -0,0 +1,11 @@ +/* $Cambridge: exim/src/OS/os.h-HI-OSF,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for HI-OSF/1-MJ and HI-UX/MPP */ + +#define HAVE_SYS_MOUNT_H + +typedef struct flock flock_t; +#define F_FREESP O_TRUNC +#define DN_EXPAND_ARG4_TYPE u_char * + +/* End */ diff --git a/src/OS/os.h-HI-UX b/src/OS/os.h-HI-UX new file mode 100644 index 000000000..e6f5fdf61 --- /dev/null +++ b/src/OS/os.h-HI-UX @@ -0,0 +1,20 @@ +/* $Cambridge: exim/src/OS/os.h-HI-UX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for HI-UX */ + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE double +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/HI-UX" +#define FSCALE 1.0 + +#define HAVE_SYS_VFS_H + +#define SELECT_ARG2_TYPE int +#define F_FREESP O_TRUNC +#define NEED_H_ERRNO 1 + +typedef struct flock flock_t; + +/* End */ diff --git a/src/OS/os.h-HP-UX b/src/OS/os.h-HP-UX new file mode 100644 index 000000000..fda838de4 --- /dev/null +++ b/src/OS/os.h-HP-UX @@ -0,0 +1,19 @@ +/* $Cambridge: exim/src/OS/os.h-HP-UX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for HP-UX versions greater than 9 */ + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE double +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/hp-ux" +#define FSCALE 1.0 + +#define HAVE_SYS_STATVFS_H + +#define F_FREESP O_TRUNC +#define NEED_H_ERRNO 1 + +typedef struct flock flock_t; + +/* End */ diff --git a/src/OS/os.h-HP-UX-9 b/src/OS/os.h-HP-UX-9 new file mode 100644 index 000000000..c7e3604c3 --- /dev/null +++ b/src/OS/os.h-HP-UX-9 @@ -0,0 +1,22 @@ +/* $Cambridge: exim/src/OS/os.h-HP-UX-9,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for HP-UX version 9 */ + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE double +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/hp-ux" +#define FSCALE 1.0 + +#define HAVE_SYS_VFS_H + +#define SELECT_ARG2_TYPE int +#define F_FREESP O_TRUNC +#define NEED_H_ERRNO 1 + +#define killpg(pgid,sig) kill(-(pgid),sig) + +typedef struct flock flock_t; + +/* End */ diff --git a/src/OS/os.h-IRIX b/src/OS/os.h-IRIX new file mode 100644 index 000000000..934fa315d --- /dev/null +++ b/src/OS/os.h-IRIX @@ -0,0 +1,22 @@ +/* $Cambridge: exim/src/OS/os.h-IRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for IRIX */ + +#define DN_EXPAND_ARG4_TYPE u_char * + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE long +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/unix" +#define FSCALE 1000.0 + +#define HAVE_MMAP +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define vfork fork + +/* Other OS have "const" in here */ +#define ICONV_ARG2_TYPE char ** + +/* End */ diff --git a/src/OS/os.h-IRIX6 b/src/OS/os.h-IRIX6 new file mode 100644 index 000000000..b2d6306a4 --- /dev/null +++ b/src/OS/os.h-IRIX6 @@ -0,0 +1,21 @@ +/* $Cambridge: exim/src/OS/os.h-IRIX6,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for IRIX */ + +#define CRYPT_H +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE long +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/unix" +#define FSCALE 1000.0 + +#define HAVE_MMAP +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define vfork fork + +/* Other OS have "const" in here */ +#define ICONV_ARG2_TYPE char ** + +/* End */ diff --git a/src/OS/os.h-IRIX632 b/src/OS/os.h-IRIX632 new file mode 100644 index 000000000..f4d368482 --- /dev/null +++ b/src/OS/os.h-IRIX632 @@ -0,0 +1,23 @@ +/* $Cambridge: exim/src/OS/os.h-IRIX632,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for IRIX */ + +#define CRYPT_H +#define DN_EXPAND_ARG4_TYPE u_char * + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE long +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/unix" +#define FSCALE 1000.0 + +#define HAVE_MMAP +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define vfork fork + +/* Other OS have "const" in here */ +#define ICONV_ARG2_TYPE char ** + +/* End */ diff --git a/src/OS/os.h-IRIX65 b/src/OS/os.h-IRIX65 new file mode 100644 index 000000000..6c08fd2d0 --- /dev/null +++ b/src/OS/os.h-IRIX65 @@ -0,0 +1,21 @@ +/* $Cambridge: exim/src/OS/os.h-IRIX65,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for IRIX 6.5 */ + +#define CRYPT_H +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE long +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/unix" +#define FSCALE 1000.0 + +#define HAVE_MMAP +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define vfork fork + +/* Other OS have "const" in here */ +#define ICONV_ARG2_TYPE char ** + +/* End */ diff --git a/src/OS/os.h-Linux b/src/OS/os.h-Linux new file mode 100644 index 000000000..f89ea7adb --- /dev/null +++ b/src/OS/os.h-Linux @@ -0,0 +1,39 @@ +/* $Cambridge: exim/src/OS/os.h-Linux,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for Linux */ + +#define CRYPT_H +#define GLIBC_IP_OPTIONS +#define HAVE_MMAP +#define HAVE_SYS_VFS_H +#define NO_IP_VAR_H +#define SIOCGIFCONF_GIVES_ADDR +#define SIG_IGN_WORKS + +/* Some versions of Linux need explicit sync-ing of directories as well as +files. This setting requests that. If the directory is on NFS, it may not +be possible to sync it - in that case, Exim now should ignore the error. But +if you have problems in that area, try undefining this. But be aware that you +may be in a situation where files are not being properly "committed to stable +storage" as quickly as Exim thinks they are. */ + +#define NEED_SYNC_DIRECTORY + +/* Other OS have "const" in here */ +#define ICONV_ARG2_TYPE char ** + +#define F_FREESP O_TRUNC +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +#define os_find_running_interfaces os_find_running_interfaces_linux + +/* Need a prototype for the Linux-specific function. The structure hasn't +been defined yet, so we need to pre-declare it. */ + +struct ip_address_item; +extern struct ip_address_item *os_find_running_interfaces_linux(void); + +/* End */ diff --git a/src/OS/os.h-Linux-libc5 b/src/OS/os.h-Linux-libc5 new file mode 100644 index 000000000..56bbd50d1 --- /dev/null +++ b/src/OS/os.h-Linux-libc5 @@ -0,0 +1,13 @@ +/* $Cambridge: exim/src/OS/os.h-Linux-libc5,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for Linux */ + +#define HAVE_MMAP +#define HAVE_SYS_VFS_H +#define NO_IP_VAR_H +#define GLIBC_IP_OPTIONS + +#define F_FREESP O_TRUNC +typedef struct flock flock_t; + +/* End */ diff --git a/src/OS/os.h-NetBSD b/src/OS/os.h-NetBSD new file mode 100644 index 000000000..e07186bf3 --- /dev/null +++ b/src/OS/os.h-NetBSD @@ -0,0 +1,15 @@ +/* $Cambridge: exim/src/OS/os.h-NetBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for NetBSD */ + +#define HAVE_BSD_GETLOADAVG +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR + +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +/* End */ diff --git a/src/OS/os.h-NetBSD-a.out b/src/OS/os.h-NetBSD-a.out new file mode 100644 index 000000000..0c59d601c --- /dev/null +++ b/src/OS/os.h-NetBSD-a.out @@ -0,0 +1,7 @@ +/* $Cambridge: exim/src/OS/os.h-NetBSD-a.out,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for NetBSD (a.out binary format) */ + +#include "../OS/os.h-NetBSD" /* Same as for ELF format */ + +/* End */ diff --git a/src/OS/os.h-OSF1 b/src/OS/os.h-OSF1 new file mode 100644 index 000000000..1aa4ff95d --- /dev/null +++ b/src/OS/os.h-OSF1 @@ -0,0 +1,13 @@ +/* $Cambridge: exim/src/OS/os.h-OSF1,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for OSF1 */ + +#define HAVE_SYS_MOUNT_H +#define HAVE_GETIPNODEBYNAME 1 + +typedef struct flock flock_t; +#define F_FREESP O_TRUNC + +#define SOCKLEN_T size_t + +/* End */ diff --git a/src/OS/os.h-OpenBSD b/src/OS/os.h-OpenBSD new file mode 100644 index 000000000..60eceb285 --- /dev/null +++ b/src/OS/os.h-OpenBSD @@ -0,0 +1,15 @@ +/* $Cambridge: exim/src/OS/os.h-OpenBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for OpenBSD */ + +#define HAVE_BSD_GETLOADAVG +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR + +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +/* End */ diff --git a/src/OS/os.h-OpenUNIX b/src/OS/os.h-OpenUNIX new file mode 100644 index 000000000..30d10f9bf --- /dev/null +++ b/src/OS/os.h-OpenUNIX @@ -0,0 +1,18 @@ +/* $Cambridge: exim/src/OS/os.h-OpenUNIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for OpenUNIX */ + +#define NO_SYSEXITS + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE short +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/stand/unix" +#define FSCALE 256 + +#define HAVE_SYS_STATVFS_H +#define _SVID3 +#define NEED_H_ERRNO + +/* End */ diff --git a/src/OS/os.h-QNX b/src/OS/os.h-QNX new file mode 100644 index 000000000..96611880e --- /dev/null +++ b/src/OS/os.h-QNX @@ -0,0 +1,23 @@ +/* $Cambridge: exim/src/OS/os.h-QNX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for QNX */ +/* Modified for QNX 6.2.0 with diffs from Samuli Tuomola. */ + +#include + +/* This include is wrapped in an ifdef so as to be skipped for QNXRTP, which +doesn't have/need this header file. From Karsten P. Hoffmann. */ + +#ifdef __QNX__ +#include +#endif + +#undef HAVE_STATFS +#undef HAVE_VFS_H +#undef HAVE_SYS_MOUNT_H + +#define NO_SYSEXITS + +extern int h_errno; + +/* End */ diff --git a/src/OS/os.h-SCO b/src/OS/os.h-SCO new file mode 100644 index 000000000..1b7eb06e3 --- /dev/null +++ b/src/OS/os.h-SCO @@ -0,0 +1,20 @@ +/* $Cambridge: exim/src/OS/os.h-SCO,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for SCO */ + +#define DN_EXPAND_ARG4_TYPE u_char * + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE short +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/unix" +#define FSCALE 256 +#define SOCKLEN_T int + +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define _SVID3 +#define NEED_H_ERRNO + +/* End */ diff --git a/src/OS/os.h-SCO_SV b/src/OS/os.h-SCO_SV new file mode 100644 index 000000000..76dc4020f --- /dev/null +++ b/src/OS/os.h-SCO_SV @@ -0,0 +1,18 @@ +/* $Cambridge: exim/src/OS/os.h-SCO_SV,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for SCO_SV */ + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE short +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/unix" +#define FSCALE 256 +#define SOCKLEN_T int + +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define _SVID3 +#define NEED_H_ERRNO + +/* End */ diff --git a/src/OS/os.h-SunOS4 b/src/OS/os.h-SunOS4 new file mode 100644 index 000000000..cdb633ccc --- /dev/null +++ b/src/OS/os.h-SunOS4 @@ -0,0 +1,38 @@ +/* $Cambridge: exim/src/OS/os.h-SunOS4,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for SunOS4 */ + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE long +#define LOAD_AVG_SYMBOL "_avenrun" +#define KERNEL_PATH "/vmunix" + +#define HAVE_MMAP +#define HAVE_SYS_VFS_H + +#define F_FREESP O_TRUNC +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +typedef struct flock flock_t; + +#define STRERROR_FROM_ERRLIST +#define memmove(a, b, c) bcopy(b, a, c) +#define strtoul(str, ptr, base) ((unsigned int)strtol((str),(ptr),(base))) + +extern char *strerror(int); +extern int sys_nerr; +extern char *sys_errlist[]; + +/* In ANSI C strtod() is defined in stdlib.h, but in SunOS4 it is defined in +floatingpoint.h which is called from math.h, which Exim doesn't include. */ + +extern double strtod(const char *, char **); + +/* SunOS4 seems to define getc, ungetc, feof and ferror as macros only, not +as functions. We need to have them as assignable functions. Setting this +flag causes this to get done in exim.h. */ + +#define FUDGE_GETC_AND_FRIENDS + +/* End */ diff --git a/src/OS/os.h-SunOS5 b/src/OS/os.h-SunOS5 new file mode 100644 index 000000000..d0ffd57fd --- /dev/null +++ b/src/OS/os.h-SunOS5 @@ -0,0 +1,33 @@ +/* $Cambridge: exim/src/OS/os.h-SunOS5,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for SunOS5 aka Solaris */ + +#define CRYPT_H +#define HAVE_MMAP +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define SIOCGIFCONF_GIVES_ADDR + +#define HAVE_GETIPNODEBYNAME 1 +#define HAVE_GETIPNODEBYADDR 1 + +#define HAVE_KSTAT +#define LOAD_AVG_KSTAT "system_misc" +#define LOAD_AVG_KSTAT_MODULE "unix" +#define LOAD_AVG_SYMBOL "avenrun_1min" +#define LOAD_AVG_FIELD value.ui32 + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +/* This is needed for some early Solaris releases, but causes trouble +in the current ones, so it is out by default. */ + +/* #define SOCKLEN_T size_t */ + +/* This is different from Linux and all other PAM implementations, +it seems. */ + +#define PAM_CONVERSE_ARG2_TYPE struct pam_message + +/* End */ diff --git a/src/OS/os.h-SunOS5-hal b/src/OS/os.h-SunOS5-hal new file mode 100644 index 000000000..9ba6d8a3c --- /dev/null +++ b/src/OS/os.h-SunOS5-hal @@ -0,0 +1,13 @@ +/* $Cambridge: exim/src/OS/os.h-SunOS5-hal,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for SunOS5 on HAL */ + +#define HAVE_MMAP + +#define HAVE_KSTAT +#define LOAD_AVG_KSTAT "system_misc" +#define LOAD_AVG_KSTAT_MODULE "unix" +#define LOAD_AVG_SYMBOL "avenrun_1min" +#define LOAD_AVG_FIELD value.ul + +/* End */ diff --git a/src/OS/os.h-ULTRIX b/src/OS/os.h-ULTRIX new file mode 100644 index 000000000..5b3fde1ad --- /dev/null +++ b/src/OS/os.h-ULTRIX @@ -0,0 +1,17 @@ +/* $Cambridge: exim/src/OS/os.h-ULTRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for Ultrix */ + +/* Well, it *does* have statfs(), but its structure is called something +different, all the members have different names, and the function returns +1 on success rather than 0. As this is for a minority function, and I think +a minority operating system, easiest just to say "no" until someone asks. */ + +#undef HAVE_STATFS + +#define F_FREESP O_TRUNC +#define NEED_H_ERRNO +#define NO_OPENLOG +typedef struct flock flock_t; + +/* End */ diff --git a/src/OS/os.h-UNIX_SV b/src/OS/os.h-UNIX_SV new file mode 100644 index 000000000..4beedbcc8 --- /dev/null +++ b/src/OS/os.h-UNIX_SV @@ -0,0 +1,24 @@ +/* $Cambridge: exim/src/OS/os.h-UNIX_SV,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for SCO SVR4.2 (and maybe Unixware) */ + +/** +*** Note that for SCO 5 the configuration file is called SCO_SV, +*** and that Unixware7 has its own configuration. This is an old +*** file that is retained for compatibility. +**/ + +#define NO_SYSEXITS + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE short +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/stand/unix" +#define FSCALE 256 + +#define HAVE_SYS_STATVFS_H +#define _SVID3 +#define NEED_H_ERRNO + +/* End */ diff --git a/src/OS/os.h-USG b/src/OS/os.h-USG new file mode 100644 index 000000000..5bf995139 --- /dev/null +++ b/src/OS/os.h-USG @@ -0,0 +1,18 @@ +/* $Cambridge: exim/src/OS/os.h-USG,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for Unixware 2.x */ + +#define NO_SYSEXITS + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE short +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/stand/unix" +#define FSCALE 256 + +#define HAVE_SYS_STATVFS_H +#define _SVID3 +#define NEED_H_ERRNO + +/* End */ diff --git a/src/OS/os.h-Unixware7 b/src/OS/os.h-Unixware7 new file mode 100644 index 000000000..618bac677 --- /dev/null +++ b/src/OS/os.h-Unixware7 @@ -0,0 +1,21 @@ +/* $Cambridge: exim/src/OS/os.h-Unixware7,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for Unixware 7 */ + +#define NO_SYSEXITS + +#define ICONV_ARG2_TYPE char ** +#define SOCKLEN_T size_t + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE short +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/stand/unix" +#define FSCALE 256 + +#define HAVE_SYS_STATVFS_H +#define _SVID3 +#define NEED_H_ERRNO + +/* End */ diff --git a/src/OS/os.h-cygwin b/src/OS/os.h-cygwin new file mode 100644 index 000000000..ebd9c848b --- /dev/null +++ b/src/OS/os.h-cygwin @@ -0,0 +1,53 @@ +/* $Cambridge: exim/src/OS/os.h-cygwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for Cygwin */ + +/* This code was supplied by Pierre A. Humblet */ + +/* Define the OS_INIT macro that we insert in exim.c:main() + to set the root and exim uid depending on the system */ +/* We use a special routine to initialize */ +void cygwin_init(int, char **, void *, void *, void *, void *); +#define OS_INIT\ + cygwin_init(argc, (char **) argv, &root_uid, &exim_uid, &exim_gid, &config_uid); + +/* We need a special mkdir that + allows names starting with // */ +#include /* Do not redefine mkdir in sys/stat.h */ +int cygwin_mkdir( const char *_path, mode_t __mode ); +#define mkdir cygwin_mkdir /* redefine mkdir elsewhere */ + +/* Redefine the set*id calls to run when faking root */ +#include /* Do not redefine in unitsd.h */ +int cygwin_setuid(uid_t uid ); +int cygwin_setgid(gid_t gid ); +#define setuid cygwin_setuid +#define setgid cygwin_setgid + +extern unsigned int cygwin_WinVersion; + +#define BASE_62 36 /* Windows aliases lower and upper cases in filenames. + Consider reducing MAX_LOCALHOST_NUMBER */ +#define CRYPT_H +#define HAVE_MMAP +#define HAVE_SYS_VFS_H +#define NO_IP_VAR_H +#define NO_IP_OPTIONS +#define F_FREESP O_TRUNC +/* Defining LOAD_AVG_NEEDS_ROOT causes an initial + call to os_getloadavg. In our case this is beneficial + because it initializes the counts */ +#define LOAD_AVG_NEEDS_ROOT + +typedef struct flock flock_t; + +/* Macro to define variable length SID structures */ +#define SID(n, name, sid...) \ +struct { \ + BYTE Revision; \ + BYTE SubAuthorityCount; \ + SID_IDENTIFIER_AUTHORITY IdentifierAuthority; \ + DWORD SubAuthority[n]; \ +} name = { SID_REVISION, n, {SECURITY_NT_AUTHORITY}, {sid}} + +/* End */ diff --git a/src/OS/os.h-mips b/src/OS/os.h-mips new file mode 100644 index 000000000..74abf5f2c --- /dev/null +++ b/src/OS/os.h-mips @@ -0,0 +1,26 @@ +/* $Cambridge: exim/src/OS/os.h-mips,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */ + +/* Exim: OS-specific C header file for RiscOS4bsd */ + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE long +#define LOAD_AVG_SYMBOL "_avenrun" +#define KERNEL_PATH "/unix" + +#define HAVE_MMAP +#define HAVE_SYS_VFS_H + +#define F_FREESP O_TRUNC +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +typedef struct flock flock_t; + +#define STRERROR_FROM_ERRLIST +#define memmove(a, b, c) bcopy(b, a, c) + +extern char *strerror(int); +extern int sys_nerr; +extern char *sys_errlist[]; + +/* End */ 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 < 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 -- 2.25.1